@citolab/qti-components 10.0.0-next.12 → 10.0.0-next.13

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 (55) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +227 -176
  3. package/dist/base.d.ts +2 -2
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-YOCOLMGB.js → chunk-AKX4YMWU.js} +2 -2
  6. package/dist/chunk-DVLSXMXD.js +7 -0
  7. package/dist/chunk-DVLSXMXD.js.map +1 -0
  8. package/dist/{chunk-PLP3YX6C.js → chunk-EIBGCCXH.js} +2 -2
  9. package/dist/{chunk-RWMY7KRT.js → chunk-FLAD6SC6.js} +2 -2
  10. package/dist/{chunk-AVZRY5SQ.js → chunk-G6LTYTJR.js} +2 -2
  11. package/dist/{chunk-OHRAG2UM.js → chunk-H3GITIPE.js} +36 -15
  12. package/dist/chunk-H3GITIPE.js.map +1 -0
  13. package/dist/{chunk-O76BOKAP.js → chunk-HOGJ5ZNW.js} +8 -6
  14. package/dist/{chunk-O76BOKAP.js.map → chunk-HOGJ5ZNW.js.map} +1 -1
  15. package/dist/{chunk-AJ5U5KXR.js → chunk-K4WLYVDT.js} +2 -2
  16. package/dist/{chunk-LCGPLQLE.js → chunk-MDBNEEPH.js} +2 -2
  17. package/dist/{chunk-M7X6TWSX.js → chunk-PHRHLDQB.js} +2 -2
  18. package/dist/{chunk-XXJAE6AP.js → chunk-PYHKCIYN.js} +3 -3
  19. package/dist/{chunk-T7YSBBAA.js → chunk-WUIA4OOX.js} +1 -1
  20. package/dist/chunk-WUIA4OOX.js.map +1 -0
  21. package/dist/{chunk-5K5JO7OG.js → chunk-Y5DZTCDP.js} +179 -103
  22. package/dist/chunk-Y5DZTCDP.js.map +1 -0
  23. package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-BniMHSBB.d.ts} +3 -2
  24. package/dist/corrections.d.ts +16 -6
  25. package/dist/corrections.js +8 -8
  26. package/dist/elements.js +3 -3
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +15 -13
  29. package/dist/interactions.d.ts +4 -4
  30. package/dist/interactions.js +3 -3
  31. package/dist/item.css +36 -16
  32. package/dist/item.d.ts +2 -2
  33. package/dist/item.js +4 -4
  34. package/dist/processing.js +3 -3
  35. package/dist/qti-components-jsx.d.ts +78 -11
  36. package/dist/{qti-item.d-B1gffYCL.d.ts → qti-item.d-BqWYBdV2.d.ts} +1 -1
  37. package/dist/{qti-test.d-D5C7W8Lg.d.ts → qti-test.d-B6AGSQlk.d.ts} +29 -3
  38. package/dist/{qti-text-entry-interaction.d-CU-fAAD1.d.ts → qti-text-entry-interaction.d-B44Z3qUG.d.ts} +6 -4
  39. package/dist/{record.d-wB9uYs-j.d.ts → record.d-C6m0Y4xr.d.ts} +1 -1
  40. package/dist/test.d.ts +7 -4
  41. package/dist/test.js +7 -5
  42. package/package.json +9 -9
  43. package/dist/chunk-5K5JO7OG.js.map +0 -1
  44. package/dist/chunk-OHRAG2UM.js.map +0 -1
  45. package/dist/chunk-T7YSBBAA.js.map +0 -1
  46. package/dist/chunk-YKXVAXSI.js +0 -7
  47. package/dist/chunk-YKXVAXSI.js.map +0 -1
  48. /package/dist/{chunk-YOCOLMGB.js.map → chunk-AKX4YMWU.js.map} +0 -0
  49. /package/dist/{chunk-PLP3YX6C.js.map → chunk-EIBGCCXH.js.map} +0 -0
  50. /package/dist/{chunk-RWMY7KRT.js.map → chunk-FLAD6SC6.js.map} +0 -0
  51. /package/dist/{chunk-AVZRY5SQ.js.map → chunk-G6LTYTJR.js.map} +0 -0
  52. /package/dist/{chunk-AJ5U5KXR.js.map → chunk-K4WLYVDT.js.map} +0 -0
  53. /package/dist/{chunk-LCGPLQLE.js.map → chunk-MDBNEEPH.js.map} +0 -0
  54. /package/dist/{chunk-M7X6TWSX.js.map → chunk-PHRHLDQB.js.map} +0 -0
  55. /package/dist/{chunk-XXJAE6AP.js.map → chunk-PYHKCIYN.js.map} +0 -0
package/cdn/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var Mc=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 Qt=function(o,t,e,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(o,e):r?r.value=e:t.set(o,e),e},rt=function(o,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(o):n?n.value:t.get(o)},Rn,Nr,$r,Si,$a,Ei,Lr,Ze,Ai,xe,zr,Dc;var U={__proto__:null};U.enumerable=!0;Object.freeze(U);var La=(xe=class{constructor(t,e={}){if(Rn.set(this,!1),Nr.set(this,!1),$r.set(this,!1),Si.set(this,!1),$a.set(this,Date.now()),Ei.set(this,!1),Lr.set(this,void 0),Ze.set(this,void 0),Ai.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:n,cancelable:r,composed:i}=e;Qt(this,Rn,!!r,"f"),Qt(this,Nr,!!n,"f"),Qt(this,$r,!!i,"f"),Qt(this,Lr,`${t}`,"f"),Qt(this,Ze,null,"f"),Qt(this,Ai,!1,"f")}initEvent(t,e,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Qt(this,Si,!0,"f")}get target(){return rt(this,Ze,"f")}get currentTarget(){return rt(this,Ze,"f")}get srcElement(){return rt(this,Ze,"f")}get type(){return rt(this,Lr,"f")}get cancelable(){return rt(this,Rn,"f")}get defaultPrevented(){return rt(this,Rn,"f")&&rt(this,Si,"f")}get timeStamp(){return rt(this,$a,"f")}composedPath(){return rt(this,Ai,"f")?[rt(this,Ze,"f")]:[]}get returnValue(){return!rt(this,Rn,"f")||!rt(this,Si,"f")}get bubbles(){return rt(this,Nr,"f")}get composed(){return rt(this,$r,"f")}get eventPhase(){return rt(this,Ai,"f")?xe.AT_TARGET:xe.NONE}get cancelBubble(){return rt(this,Ei,"f")}set cancelBubble(t){t&&Qt(this,Ei,!0,"f")}stopPropagation(){Qt(this,Ei,!0,"f")}get isTrusted(){return!1}},Rn=new WeakMap,Nr=new WeakMap,$r=new WeakMap,Si=new WeakMap,$a=new WeakMap,Ei=new WeakMap,Lr=new WeakMap,Ze=new WeakMap,Ai=new WeakMap,xe.NONE=0,xe.CAPTURING_PHASE=1,xe.AT_TARGET=2,xe.BUBBLING_PHASE=3,xe);Object.defineProperties(La.prototype,{initEvent:U,stopImmediatePropagation:U,preventDefault:U,target:U,currentTarget:U,srcElement:U,type:U,cancelable:U,defaultPrevented:U,timeStamp:U,composedPath:U,returnValue:U,bubbles:U,composed:U,eventPhase:U,cancelBubble:U,stopPropagation:U,isTrusted:U});var Nc=(Dc=class extends La{constructor(t,e={}){super(t,e),zr.set(this,void 0),Qt(this,zr,e?.detail??null,"f")}initCustomEvent(t,e,n,r){throw new Error("Method not implemented.")}get detail(){return rt(this,zr,"f")}},zr=new WeakMap,Dc);Object.defineProperties(Nc.prototype,{detail:U});var re=La,za=Nc;var ht;var vg=(ht=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}},ht.STYLE_RULE=1,ht.CHARSET_RULE=2,ht.IMPORT_RULE=3,ht.MEDIA_RULE=4,ht.FONT_FACE_RULE=5,ht.PAGE_RULE=6,ht.NAMESPACE_RULE=10,ht.KEYFRAMES_RULE=7,ht.KEYFRAME_RULE=8,ht.SUPPORTS_RULE=12,ht.COUNTER_STYLE_RULE=11,ht.FONT_FEATURE_VALUES_RULE=14,ht.MARGIN_RULE=9,ht);globalThis.Event??=re;globalThis.CustomEvent??=za;var ja=Symbol(),$c=o=>typeof o=="boolean"?o:o?.capture??!1,oe={__proto__:null};oe.enumerable=!0;Object.freeze(oe);var Vr=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,n){if(e==null)return;let r=$c(n)?this.__captureEventListeners:this.__eventListeners,i=r.get(t);if(i===void 0)i=new Map,r.set(t,i);else if(i.has(e))return;let s=typeof n=="object"&&n?n:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,n)),i.set(e,s??{})}removeEventListener(t,e,n){if(e==null)return;let r=$c(n)?this.__captureEventListeners:this.__eventListeners,i=r.get(t);i!==void 0&&(i.delete(e),i.size||r.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let n=!1,r=!1,i=re.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 i},...oe},composedPath:{value:()=>e,...oe},stopPropagation:{value:()=>{n=!0,c.call(t)},...oe},stopImmediatePropagation:{value:()=>{r=!0,d.call(t)},...oe}});let h=(u,g,v)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&v.delete(u)},f=()=>(l=null,i=re.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,i=u===t.target?re.AT_TARGET:re.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[v,w]of g)if(h(v,w,g),r)return f()}if(n)return f()}let q=t.bubbles?e:[this];a=null;for(let u of q){!s&&(!a||u===a.__host)&&y(q.slice(0,q.indexOf(u)+1)),l=u,i=u===t.target?re.AT_TARGET:re.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[v,w]of g)if(h(v,w,g),r)return f()}if(n)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Vc,Au]}};var Lc=new WeakMap,Ti=o=>{let t=Lc.get(o);return t===void 0&&Lc.set(o,t=new Map),t},Ii=class extends Vr{getRootNode(t){return t?.composed?Va:this.__host?.__shadowRoot??Va}};var zc=class extends Ii{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Vc=new zc,Va=Vc;var jc=class extends Ii{constructor(t){if(super(),t!==ja)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:jr,customElements:Ba,document:Va,Document:zc,Element:Fc,EventTarget:Vr,HTMLElement:Bc,Node:Ii,ShadowRoot:Uc,window:this,Window:jc})}};var Fc=class extends Ii{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ti(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){Ti(this).set(t,String(e))}removeAttribute(t){Ti(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 Ti(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Uc(ja,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 Mc(this);return this.__internals=t,t}getAttribute(t){return Ti(this).get(t)??null}};var Bc=class extends Fc{},Fa=Bc;var Uc=class extends Ii{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 Fa,"localName",{get(){return"lit-server-root"}});function Su(){let o,t;return{promise:new Promise((n,r)=>{o=n,t=r}),resolve:o,reject:t}}var jr=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 n=this.__pendingWhenDefineds.get(t);return n||(n=Su(),this.__pendingWhenDefineds.set(t,n)),n.promise}},Eu=jr;var Ba=new Eu,Au=new jc(ja);var _i=globalThis,Fr=_i.ShadowRoot&&(_i.ShadyCSS===void 0||_i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ua=Symbol(),Hc=new WeakMap,Ri=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==Ua)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(Fr&&t===void 0){let n=e!==void 0&&e.length===1;n&&(t=Hc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Hc.set(e,t))}return t}toString(){return this.cssText}},Wc=o=>new Ri(typeof o=="string"?o:o+"",void 0,Ua),x=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((n,r,i)=>n+(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.")})(r)+o[i+1],o[0]);return new Ri(e,o,Ua)},Qc=(o,t)=>{if(Fr)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let n=document.createElement("style"),r=_i.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=e.cssText,o.appendChild(n)}},Ha=Fr||_i.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let n of t.cssRules)e+=n.cssText;return Wc(e)})(o):o;var{is:Tu,defineProperty:Iu,getOwnPropertyDescriptor:_u,getOwnPropertyNames:Ru,getOwnPropertySymbols:Ou,getPrototypeOf:Pu}=Object,Mi=globalThis;Mi.customElements??=Ba;var Gc=Mi.trustedTypes,Mu=Gc?Gc.emptyScript:"",Du=Mi.reactiveElementPolyfillSupport,Oi=(o,t)=>o,Pi={toAttribute(o,t){switch(t){case Boolean:o=o?Mu: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}},Br=(o,t)=>!Tu(o,t),Xc={attribute:!0,type:String,converter:Pi,reflect:!1,useDefault:!1,hasChanged:Br};Symbol.metadata??=Symbol("metadata"),Mi.litPropertyMetadata??=new WeakMap;var se=class extends(globalThis.HTMLElement??Fa){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Xc){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 n=Symbol(),r=this.getPropertyDescriptor(t,n,e);r!==void 0&&Iu(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){let{get:r,set:i}=_u(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:r,set(s){let a=r?.call(this);i?.call(this,s),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Xc}static _$Ei(){if(this.hasOwnProperty(Oi("elementProperties")))return;let t=Pu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Oi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Oi("properties"))){let e=this.properties,n=[...Ru(e),...Ou(e)];for(let r of n)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[n,r]of e)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[e,n]of this.elementProperties){let r=this._$Eu(e,n);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let r of n)e.unshift(Ha(r))}else t!==void 0&&e.push(Ha(t));return e}static _$Eu(t,e){let n=e.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qc(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,n){this._$AK(t,n)}_$ET(t,e){let n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(r!==void 0&&n.reflect===!0){let i=(n.converter?.toAttribute!==void 0?n.converter:Pi).toAttribute(e,n.type);this._$Em=t,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){let n=this.constructor,r=n._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let i=n.getPropertyOptions(r),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Pi;this._$Em=r;let a=s.fromAttribute(e,i.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,n,r=!1,i){if(t!==void 0){let s=this.constructor;if(r===!1&&(i=this[t]),n??=s.getPropertyOptions(t),!((n.hasChanged??Br)(i,e)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,e,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:r,wrapped:i},s){n&&!(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||n||(e=void 0),this._$AL.set(t,e)),r===!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[r,i]of this._$Ep)this[r]=i;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,i]of n){let{wrapped:s}=i,a=this[r];s!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,i,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(e)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}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[Oi("elementProperties")]=new Map,se[Oi("finalized")]=new Map,Du?.({ReactiveElement:se}),(Mi.reactiveElementVersions??=[]).push("2.1.2");var Yr=globalThis,Yc=o=>o,Ur=Yr.trustedTypes,Jc=Ur?Ur.createPolicy("lit-html",{createHTML:o=>o}):void 0,Qa="$lit$",ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Ga="?"+ae,Nu=`<${Ga}>`,nn=Yr.document===void 0?{createTreeWalker:()=>({})}:document,Ni=()=>nn.createComment(""),$i=o=>o===null||typeof o!="object"&&typeof o!="function",Xa=Array.isArray,id=o=>Xa(o)||typeof o?.[Symbol.iterator]=="function",Wa=`[
3
- \f\r]`,Di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kc=/-->/g,Zc=/>/g,tn=RegExp(`>|${Wa}(?:([^\\s"'>=/]+)(${Wa}*=${Wa}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),td=/'/g,ed=/"/g,rd=/^(?:script|style|textarea|title)$/i,Ya=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=Ya(1),zi=Ya(2),Jg=Ya(3),st=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),nd=new WeakMap,en=nn.createTreeWalker(nn,129);function od(o,t){if(!Xa(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jc!==void 0?Jc.createHTML(t):t}var sd=(o,t)=>{let e=o.length-1,n=[],r,i=t===2?"<svg>":t===3?"<math>":"",s=Di;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===Di?d[1]==="!--"?s=Kc:d[1]!==void 0?s=Zc:d[2]!==void 0?(rd.test(d[2])&&(r=RegExp("</"+d[2],"g")),s=tn):d[3]!==void 0&&(s=tn):s===tn?d[0]===">"?(s=r??Di,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?tn:d[3]==='"'?ed:td):s===ed||s===td?s=tn:s===Kc||s===Zc?s=Di:(s=tn,r=void 0);let m=s===tn&&o[a+1].startsWith("/>")?" ":"";i+=s===Di?l+Nu:h>=0?(n.push(c),l.slice(0,h)+Qa+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[od(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},Li=class o{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,s=0,a=t.length-1,l=this.parts,[c,d]=sd(t,e);if(this.el=o.createElement(c,n),en.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=en.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(Qa)){let f=d[s++],m=r.getAttribute(h).split(ae),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:y[2],strings:m,ctor:y[1]==="."?Wr:y[1]==="?"?Qr:y[1]==="@"?Gr:on}),r.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:i}),r.removeAttribute(h));if(rd.test(r.tagName)){let h=r.textContent.split(ae),f=h.length-1;if(f>0){r.textContent=Ur?Ur.emptyScript:"";for(let m=0;m<f;m++)r.append(h[m],Ni()),en.nextNode(),l.push({type:2,index:++i});r.append(h[f],Ni())}}}else if(r.nodeType===8)if(r.data===Ga)l.push({type:2,index:i});else{let h=-1;for(;(h=r.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:i}),h+=ae.length-1}i++}}static createElement(t,e){let n=nn.createElement("template");return n.innerHTML=t,n}};function rn(o,t,e=o,n){if(t===st)return t;let r=n!==void 0?e._$Co?.[n]:e._$Cl,i=$i(t)?void 0:t._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),i===void 0?r=void 0:(r=new i(o),r._$AT(o,e,n)),n!==void 0?(e._$Co??=[])[n]=r:e._$Cl=r),r!==void 0&&(t=rn(o,r._$AS(o,t.values),r,n)),t}var Hr=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:n}=this._$AD,r=(t?.creationScope??nn).importNode(e,!0);en.currentNode=r;let i=en.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new On(i,i.nextSibling,this,t):l.type===1?c=new l.ctor(i,l.name,l.strings,this,t):l.type===6&&(c=new Xr(i,this,t)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=en.nextNode(),s++)}return en.currentNode=nn,r}p(t){let e=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},On=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=r?.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=rn(this,t,e),$i(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==st&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):id(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!==P&&$i(this._$AH)?this._$AA.nextSibling.data=t:this.T(nn.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Li.createElement(od(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{let i=new Hr(r,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=nd.get(t.strings);return e===void 0&&nd.set(t.strings,e=new Li(t)),e}k(t){Xa(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,n,r=0;for(let i of t)r===e.length?e.push(n=new o(this.O(Ni()),this.O(Ni()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let n=Yc(t).nextSibling;Yc(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},on=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,r,i){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=P}_$AI(t,e=this,n,r){let i=this.strings,s=!1;if(i===void 0)t=rn(this,t,e,0),s=!$i(t)||t!==this._$AH&&t!==st,s&&(this._$AH=t);else{let a=t,l,c;for(t=i[0],l=0;l<i.length-1;l++)c=rn(this,a[n+l],e,l),c===st&&(c=this._$AH[l]),s||=!$i(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!r&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Wr=class extends on{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Qr=class extends on{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Gr=class extends on{constructor(t,e,n,r,i){super(t,e,n,r,i),this.type=5}_$AI(t,e=this){if((t=rn(this,t,e,0)??P)===st)return;let n=this._$AH,r=t===P&&n!==P||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==P&&(n===P||r);r&&this.element.removeEventListener(this.name,this,n),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)}},Xr=class{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){rn(this,t)}},ot={M:Qa,P:ae,A:Ga,C:1,L:sd,R:Hr,D:id,V:rn,I:On,H:on,N:Qr,U:Gr,B:Wr,F:Xr},$u=Yr.litHtmlPolyfillSupport;$u?.(Li,On),(Yr.litHtmlVersions??=[]).push("3.3.3");var Ja=(o,t,e)=>{let n=e?.renderBefore??t,r=n._$litPart$;if(r===void 0){let i=e?.renderBefore??null;n._$litPart$=r=new On(t.insertBefore(Ni(),i),i,void 0,e??{})}return r._$AI(o),r};var Ka=globalThis,k=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=Ja(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return st}};k._$litElement$=!0,k.finalized=!0,Ka.litElementHydrateSupport?.({LitElement:k});var Lu=Ka.litElementPolyfillSupport;Lu?.({LitElement:k});(Ka.litElementVersions??=[]).push("4.2.2");var zu={attribute:!0,type:String,converter:Pi,reflect:!1,hasChanged:Br},Vu=(o=zu,t,e)=>{let{kind:n,metadata:r}=e,i=globalThis.litPropertyMetadata.get(r);if(i===void 0&&globalThis.litPropertyMetadata.set(r,i=new Map),n==="setter"&&((o=Object.create(o)).wrapped=!0),i.set(e.name,o),n==="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(n==="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: "+n)};function p(o){return(t,e)=>typeof e=="object"?Vu(o,t,e):((n,r,i)=>{let s=r.hasOwnProperty(i);return r.constructor.createProperty(i,n),s?Object.getOwnPropertyDescriptor(r,i):void 0})(o,t,e)}function _(o){return p({...o,state:!0,attribute:!1})}var qe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Pn(o,t){return(e,n,r)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof n=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return qe(e,n,{get(){let l=s.call(this);return l===void 0&&(l=i(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return qe(e,n,{get(){return i(this)}})}}function ad(o){return(t,e)=>{let{slot:n,selector:r}=o??{},i="slot"+(n?`[name=${n}]`:":not([name])");return qe(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return r===void 0?a:a.filter(l=>l.matches(r))}})}}var le=class extends Event{constructor(t,e,n,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=n,this.subscribe=r??!1}};var xt=class{constructor(t,e,n,r){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=n,this.subscribe=r??!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 Jr=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let n=e||!Object.is(t,this.o);this.o=t,n&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:n}]of this.subscriptions)e(this.o,n)},t!==void 0&&(this.value=t)}addCallback(t,e,n){if(!n)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:r}=this.subscriptions.get(t);t(this.value,r)}clearCallbacks(){this.subscriptions.clear()}};var Za=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},ke=class extends Jr{constructor(t,e,n){super(e.context!==void 0?e.initialValue:n),this.onContextRequest=r=>{if(r.context!==this.context)return;let i=r.contextTarget??r.composedPath()[0];i!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,i,r.subscribe))},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.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 le(this.context,a,s,!0)));r.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 Za(this.context,this.host))}};var Vi=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:n}=e;for(let{elementRef:r,callbackRef:i}of n){let s=r.deref(),a=i.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],n=t.callback,r=this.pendingContextRequests.get(t.context);r===void 0&&this.pendingContextRequests.set(t.context,r={callbacks:new WeakMap,requests:[]});let i=r.callbacks.get(e);i===void 0&&r.callbacks.set(e,i=new WeakSet),i.has(n)||(i.add(n),r.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(n)}))}}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 H({context:o}){return(t,e)=>{let n=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(r){return n.get(this).setValue(r),t.set.call(this,r)},init(r){return n.set(this,new ke(this,{context:o,initialValue:r})),r}};{t.constructor.addInitializer((s=>{n.set(s,new ke(s,{context:o}))}));let r=Object.getOwnPropertyDescriptor(t,e),i;if(r===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){n.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=r.set;i={...r,set(a){n.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function I({context:o,subscribe:t}){return(e,n)=>{typeof n=="object"?n.addInitializer((function(){new xt(this,{context:o,callback:r=>{e.set.call(this,r)},subscribe:t})})):e.constructor.addInitializer((r=>{new xt(r,{context:o,callback:i=>{r[n]=i},subscribe:t})}))}}var Kr=["this"],ld=["+","-","!"],cd=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],tl={"!":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},Zr=13;var ju=["==","!=","<=",">=","||","&&","??","|>"],Fu=["===","!=="],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 Gt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Bu=o=>o===9||o===10||o===13||o===32,dd=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Uu=o=>dd(o)||ji(o),Hu=o=>Kr.indexOf(o)!==-1,Wu=o=>o===34||o===39,ji=o=>48<=o&&o<=57,Qu=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,Gu=o=>o===40||o===41||o===91||o===93||o===123||o===125,Xu=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}}),to=class{#t;#e=-1;#n=0;#i;constructor(t){this.#t=t,this.#r()}nextToken(){for(;Bu(this.#i);)this.#r(!0);if(Wu(this.#i))return this.#a();if(dd(this.#i))return this.#c();if(ji(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#m();if(this.#i===58)return this.#d();if(Qu(this.#i))return this.#h();if(Gu(this.#i))return this.#b();if(this.#r(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#r(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#n=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#n,this.#e+t);return t===0&&this.#s(),e}#s(){this.#n=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#r(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#r(),this.#i===void 0))throw new Error(t);this.#r()}let n=Gt(M.STRING,Xu(this.#o()));return this.#r(),n}#c(){do this.#r();while(Uu(this.#i));let t=this.#o(),e=Hu(t)?M.KEYWORD:M.IDENTIFIER;return Gt(e,t)}#p(){do this.#r();while(ji(this.#i));return this.#i===46?this.#l():Gt(M.INTEGER,this.#o())}#l(){return this.#r(),ji(this.#i)?this.#u():(this.#s(),Gt(M.DOT,".",Zr))}#m(){return this.#r(!0),Gt(M.COMMA,",")}#d(){return this.#r(!0),Gt(M.COLON,":")}#u(){do this.#r();while(ji(this.#i));return Gt(M.DECIMAL,this.#o())}#h(){this.#r();let t=this.#o(2);if(Fu.indexOf(t)!==-1)this.#r(),this.#r();else{if(t=this.#o(1),t==="=>")return this.#r(),Gt(M.ARROW,t);ju.indexOf(t)!==-1&&this.#r()}return t=this.#o(),Gt(M.OPERATOR,t,tl[t])}#b(){let t=String.fromCharCode(this.#i),e=Gt(M.GROUPER,t,tl[t]);return this.#r(!0),e}};var el=(o,t)=>new Fi(o,t).parse(),Fi=class{#t;#e;#n;#i;#r;constructor(t,e){this.#e=new to(t),this.#n=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 n=this.#e.nextToken();this.#i=n,this.#t=n?.kind,this.#r=n?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#r!==e)}#s(){if(!this.#i)return this.#n.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 n=this.#v();t=this.#n.invoke(t,void 0,n)}else if(this._matches(M.GROUPER,"[")){let n=this.#g();t=this.#n.index(t,n)}else if(this._matches(M.DOT)){this.#o();let n=this.#l();t=this.#c(t,n)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=e)t=this.#r==="?"?this.#m(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.#n.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let n=e.receiver;return this.#n.invoke(t,n.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(cd.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let n=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#i.precedence>e.precedence;)n=this.#a(n,this.#i.precedence);return this.#n.binary(t,e.value,n)}#l(){if(this._matches(M.OPERATOR)){let t=this.#r;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#k(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(ld.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),Zr);return this.#n.unary(t,e)}return this.#d()}#m(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let n=this.#s();return this.#n.ternary(t,e,n)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#r;if(t==="this")return this.#o(),this.#n.id(t);throw Kr.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#x();case M.INTEGER:return this.#k();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#r==="("?this.#y():this.#r==="{"?this.#h():this.#r==="["?this.#u():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#u(){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.#n.list(t)}#h(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#r;(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.#n.map(t)}#b(){let t=this.#r;if(t==="true")return this.#o(),this.#n.literal(!0);if(t==="false")return this.#o(),this.#n.literal(!1);if(t==="null")return this.#o(),this.#n.literal(null);if(t==="undefined")return this.#o(),this.#n.literal(void 0);let e=this.#f(),n=this.#v();return n?this.#n.invoke(e,void 0,n):e}#f(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#r}`);let t=this.#r;return this.#o(),this.#n.id(t)}#v(){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}#g(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#y(){let t=this.#v();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),n=t?.map(r=>r.value)??[];return this.#n.arrowFunction(n,e)}else return this.#n.paren(t[0])}#x(){let t=this.#n.literal(this.#r);return this.#o(),t}#k(t=""){let e=this.#n.literal(parseInt(`${t}${this.#r}`,10));return this.#o(),e}#E(t=""){let e=this.#n.literal(parseFloat(`${t}${this.#r}`));return this.#o(),e}};var{hasOwn:hd,fromEntries:Yu}=Object,Ju={"+":(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)},Ku={"+":o=>o,"-":o=>-o,"!":o=>!o},eo=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 n=Ku[t];return{type:"Unary",operator:t,child:e,evaluate(r){return n(this.child.evaluate(r))},getIds(r){return this.child.getIds(r)}}}binary(t,e,n){let r=Ju[e];return{type:"Binary",operator:e,left:t,right:n,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 r(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(n){return this.receiver.evaluate(n)?.[this.name]},getIds(n){return this.receiver.getIds(n),n}}}invoke(t,e,n){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:n,evaluate(r){let i=this.receiver.evaluate(r),s=this.method?i:r?.this??r,a=this.method?i?.[e]:i,c=(this.arguments??[]).map(d=>d?.evaluate(r));return a?.apply?.(s,c)},getIds(r){return this.receiver.getIds(r),this.arguments?.forEach(i=>i?.getIds(r)),r}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(n){return this.receiver.evaluate(n)?.[this.argument.evaluate(n)]},getIds(n){return this.receiver.getIds(n),n}}}ternary(t,e,n){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:n,evaluate(r){return this.condition.evaluate(r)?this.trueExpr.evaluate(r):this.falseExpr.evaluate(r)},getIds(r){return this.condition.getIds(r),this.trueExpr.getIds(r),this.falseExpr.getIds(r),r}}}map(t){return{type:"Map",entries:t,evaluate(e){let n={};if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&(n[r]=i.evaluate(e))}return n},getIds(e){if(t&&this.entries)for(let n in t){let r=this.entries[n];r&&r.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(n=>n?.evaluate(e))},getIds(e){return this.items?.forEach(n=>n?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(n){let r=this.params,i=this.body;return function(...s){let a=Yu(r.map((c,d)=>[c,s[d]])),l=new Proxy(n??{},{set(c,d,h){return hd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return hd(a,d)?a[d]:c[d]}});return i.evaluate(l)}},getIds(n){return this.body.getIds(n).filter(r=>!this.params.includes(r))}}}};var nl=null,pd={boundAttributeSuffix:ot.M,marker:ot.P,markerMatch:ot.A,HTML_RESULT:ot.C,getTemplateHtml:ot.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,n){return t(this,n)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){nl??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(nl))return void(e[nl]=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 n=st;return o.j=r=>n=r,o._$AI(t,o,e),n},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:ot.V,AttributePart:ot.H,PropertyPart:ot.B,BooleanAttributePart:ot.N,EventPart:ot.U,ElementPart:ot.F,TemplateInstance:ot.R,isIterable:ot.D,ChildPart:ot.I};var{AttributePart:Zu,PropertyPart:tm,BooleanAttributePart:em,EventPart:nm}=pd,rl=new eo,il=new Map,ud=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),no=(o,t)=>{let e=il.get(o);if(e===void 0){if(il.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let n=o.substring(2,o.length-2).trim();e=new Fi(n,rl).parse(),il.set(o,e)}}return e?.evaluate(t)},im=(o,t,e,n)=>{let r=o.getAttribute("if");if(r!==null&&no(r,t))return io(o,t,e,n)},md=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,fd=o=>/(?:\\{{)|(?:\\}})/g.test(o),Bi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),rm=(o,t,e,n)=>{let r=o.getAttribute("repeat");if(r!==null){let i=no(r,t);if(!i[Symbol.iterator])return P;let s=Ui(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 y=m.update(d,e,n);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},bd={if:im,repeat:rm},Ce=(o,t=bd,e={},n)=>{let i=Ui(o).renderers;if(n){let a=Ui(n).renderers,l=i.super;l!==void 0?e={...i,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>io(n,f,m,y)},l(c,d,h))}:(e={...a,...i,...e},o=n)}else e={...i,...e};return s=>io(o,s,t,e)};var io=(o,t,e=bd,n={})=>{let r=Ui(o),i=[];for(let a of r.parts){let l=a.update(t,e,n);a.type===1?i.push(...l):i.push(l)}return{_$litType$:r,values:i}},gd=new Map,Ui=o=>{let t=gd.get(o);return t===void 0&&gd.set(o,t=om(o)),t},om=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),n=e.currentNode,r=-1,i=[];for(;(n=e.nextNode())!==null;)if(n.nodeType===Node.COMMENT_NODE)r++;else if(n.nodeType===Node.ELEMENT_NODE){r++;let s=n;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=(y,q,u)=>{let g=s.getAttribute("data"),v=g===null?void 0:no(g,y);return(m?no(f,y):u[d])?.(v,q,u)}}else l!==null?h=(f,m,y)=>{let q=m[l];return q?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let q=y.super,u=Ui(s);return y={...y,...u.renderers},q(f,m,y)}:t.renderers[c]=(f,m,y)=>io(s,f,m,y),h=(f,m,y)=>{let q=y[c];return q?.(f,m,y)});t.parts.push({type:2,index:r,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(md);if(d.length===1){fd(c)&&s.setAttribute(l,Bi(c));continue}s.removeAttribute(l);let h=l,f=Zu,m=l[0];m==="."?(h=ud(l.substring(1)),f=tm):m==="?"?(h=l.substring(1),f=em):m==="@"&&(h=ud(l.substring(1)),f=nm);let y=[Bi(d[0])],q=[];for(let u=1;u<d.length;u+=2){let g=d[u];q.push(el(g,rl)),y.push(Bi(d[u+1]))}t.parts.push({type:1,index:r,name:h,strings:y,ctor:f,update:(u,g,v)=>q.map(w=>w.evaluate(u))})}}else if(n.nodeType===Node.TEXT_NODE){let s=n,a=s.textContent,l=a.split(md);l.length>1?s.textContent=Bi(l[0]):fd(a)&&(s.textContent=Bi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=el(d,rl);t.parts.push({type:2,index:++r,update:(m,y)=>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 ol=Symbol.for("qti-components.context-root"),sm=()=>{if(typeof document>"u")return;let o=globalThis;o[ol]||(o[ol]=new Vi,o[ol].attach(document.documentElement))};sm();var vd=[];var al=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.#n():queueMicrotask(()=>this.#n())}#n(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},sl="custom-state-support-probe";function am(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(sl)||customElements.define(sl,class extends HTMLElement{});let t=o.call(document.createElement(sl)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var yd=!1;function wd(){if(yd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=am(o);return t==="modern"||(yd=!0,HTMLElement.prototype.attachInternals=function(){let n=o.call(this);return Object.defineProperty(n,"states",{configurable:!0,enumerable:!0,value:new al(this)}),n}),t}wd();for(let{tag:o,ctor:t}of vd)customElements.get(o)||customElements.define(o,t);var Se=Symbol("computedItemContext");var j=Symbol("computedContext");var qt=Symbol("configContext");var Mn=Symbol("interactionContext");var F=Symbol("item");var xd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var lm=/^[A-Za-z0-9-]+$/,cm=o=>typeof o=="string"&&lm.test(o),Bv=o=>cm(o)?o:void 0,kt=Symbol("qtiContext");var ll={view:"candidate"},Ee=Symbol("sessionContext");var cl={items:[],testOutcomeVariables:[]},at=Symbol("testContext");var O=x`
1
+ var Dc=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 Qt=function(o,t,e,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(o,e):r?r.value=e:t.set(o,e),e},rt=function(o,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(o):n?n.value:t.get(o)},Rn,$r,Lr,Si,La,Ei,zr,Ze,Ai,xe,Vr,Nc;var U={__proto__:null};U.enumerable=!0;Object.freeze(U);var za=(xe=class{constructor(t,e={}){if(Rn.set(this,!1),$r.set(this,!1),Lr.set(this,!1),Si.set(this,!1),La.set(this,Date.now()),Ei.set(this,!1),zr.set(this,void 0),Ze.set(this,void 0),Ai.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:n,cancelable:r,composed:i}=e;Qt(this,Rn,!!r,"f"),Qt(this,$r,!!n,"f"),Qt(this,Lr,!!i,"f"),Qt(this,zr,`${t}`,"f"),Qt(this,Ze,null,"f"),Qt(this,Ai,!1,"f")}initEvent(t,e,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Qt(this,Si,!0,"f")}get target(){return rt(this,Ze,"f")}get currentTarget(){return rt(this,Ze,"f")}get srcElement(){return rt(this,Ze,"f")}get type(){return rt(this,zr,"f")}get cancelable(){return rt(this,Rn,"f")}get defaultPrevented(){return rt(this,Rn,"f")&&rt(this,Si,"f")}get timeStamp(){return rt(this,La,"f")}composedPath(){return rt(this,Ai,"f")?[rt(this,Ze,"f")]:[]}get returnValue(){return!rt(this,Rn,"f")||!rt(this,Si,"f")}get bubbles(){return rt(this,$r,"f")}get composed(){return rt(this,Lr,"f")}get eventPhase(){return rt(this,Ai,"f")?xe.AT_TARGET:xe.NONE}get cancelBubble(){return rt(this,Ei,"f")}set cancelBubble(t){t&&Qt(this,Ei,!0,"f")}stopPropagation(){Qt(this,Ei,!0,"f")}get isTrusted(){return!1}},Rn=new WeakMap,$r=new WeakMap,Lr=new WeakMap,Si=new WeakMap,La=new WeakMap,Ei=new WeakMap,zr=new WeakMap,Ze=new WeakMap,Ai=new WeakMap,xe.NONE=0,xe.CAPTURING_PHASE=1,xe.AT_TARGET=2,xe.BUBBLING_PHASE=3,xe);Object.defineProperties(za.prototype,{initEvent:U,stopImmediatePropagation:U,preventDefault:U,target:U,currentTarget:U,srcElement:U,type:U,cancelable:U,defaultPrevented:U,timeStamp:U,composedPath:U,returnValue:U,bubbles:U,composed:U,eventPhase:U,cancelBubble:U,stopPropagation:U,isTrusted:U});var $c=(Nc=class extends za{constructor(t,e={}){super(t,e),Vr.set(this,void 0),Qt(this,Vr,e?.detail??null,"f")}initCustomEvent(t,e,n,r){throw new Error("Method not implemented.")}get detail(){return rt(this,Vr,"f")}},Vr=new WeakMap,Nc);Object.defineProperties($c.prototype,{detail:U});var re=za,Va=$c;var ht;var xg=(ht=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}},ht.STYLE_RULE=1,ht.CHARSET_RULE=2,ht.IMPORT_RULE=3,ht.MEDIA_RULE=4,ht.FONT_FACE_RULE=5,ht.PAGE_RULE=6,ht.NAMESPACE_RULE=10,ht.KEYFRAMES_RULE=7,ht.KEYFRAME_RULE=8,ht.SUPPORTS_RULE=12,ht.COUNTER_STYLE_RULE=11,ht.FONT_FEATURE_VALUES_RULE=14,ht.MARGIN_RULE=9,ht);globalThis.Event??=re;globalThis.CustomEvent??=Va;var Fa=Symbol(),Lc=o=>typeof o=="boolean"?o:o?.capture??!1,oe={__proto__:null};oe.enumerable=!0;Object.freeze(oe);var jr=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,n){if(e==null)return;let r=Lc(n)?this.__captureEventListeners:this.__eventListeners,i=r.get(t);if(i===void 0)i=new Map,r.set(t,i);else if(i.has(e))return;let s=typeof n=="object"&&n?n:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,n)),i.set(e,s??{})}removeEventListener(t,e,n){if(e==null)return;let r=Lc(n)?this.__captureEventListeners:this.__eventListeners,i=r.get(t);i!==void 0&&(i.delete(e),i.size||r.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let n=!1,r=!1,i=re.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 i},...oe},composedPath:{value:()=>e,...oe},stopPropagation:{value:()=>{n=!0,c.call(t)},...oe},stopImmediatePropagation:{value:()=>{r=!0,d.call(t)},...oe}});let h=(u,g,v)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&v.delete(u)},f=()=>(l=null,i=re.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,i=u===t.target?re.AT_TARGET:re.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[v,w]of g)if(h(v,w,g),r)return f()}if(n)return f()}let q=t.bubbles?e:[this];a=null;for(let u of q){!s&&(!a||u===a.__host)&&y(q.slice(0,q.indexOf(u)+1)),l=u,i=u===t.target?re.AT_TARGET:re.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[v,w]of g)if(h(v,w,g),r)return f()}if(n)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,jc,Tu]}};var zc=new WeakMap,Ti=o=>{let t=zc.get(o);return t===void 0&&zc.set(o,t=new Map),t},Ii=class extends jr{getRootNode(t){return t?.composed?ja:this.__host?.__shadowRoot??ja}};var Vc=class extends Ii{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var jc=new Vc,ja=jc;var Fc=class extends Ii{constructor(t){if(super(),t!==Fa)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Fr,customElements:Ua,document:ja,Document:Vc,Element:Bc,EventTarget:jr,HTMLElement:Uc,Node:Ii,ShadowRoot:Hc,window:this,Window:Fc})}};var Bc=class extends Ii{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ti(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){Ti(this).set(t,String(e))}removeAttribute(t){Ti(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 Ti(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Hc(Fa,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 Dc(this);return this.__internals=t,t}getAttribute(t){return Ti(this).get(t)??null}};var Uc=class extends Bc{},Ba=Uc;var Hc=class extends Ii{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 Ba,"localName",{get(){return"lit-server-root"}});function Eu(){let o,t;return{promise:new Promise((n,r)=>{o=n,t=r}),resolve:o,reject:t}}var Fr=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 n=this.__pendingWhenDefineds.get(t);return n||(n=Eu(),this.__pendingWhenDefineds.set(t,n)),n.promise}},Au=Fr;var Ua=new Au,Tu=new Fc(Fa);var _i=globalThis,Br=_i.ShadowRoot&&(_i.ShadyCSS===void 0||_i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ha=Symbol(),Wc=new WeakMap,Ri=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==Ha)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(Br&&t===void 0){let n=e!==void 0&&e.length===1;n&&(t=Wc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Wc.set(e,t))}return t}toString(){return this.cssText}},Qc=o=>new Ri(typeof o=="string"?o:o+"",void 0,Ha),x=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((n,r,i)=>n+(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.")})(r)+o[i+1],o[0]);return new Ri(e,o,Ha)},Gc=(o,t)=>{if(Br)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let n=document.createElement("style"),r=_i.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=e.cssText,o.appendChild(n)}},Wa=Br||_i.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let n of t.cssRules)e+=n.cssText;return Qc(e)})(o):o;var{is:Iu,defineProperty:_u,getOwnPropertyDescriptor:Ru,getOwnPropertyNames:Ou,getOwnPropertySymbols:Pu,getPrototypeOf:Mu}=Object,Mi=globalThis;Mi.customElements??=Ua;var Xc=Mi.trustedTypes,Du=Xc?Xc.emptyScript:"",Nu=Mi.reactiveElementPolyfillSupport,Oi=(o,t)=>o,Pi={toAttribute(o,t){switch(t){case Boolean:o=o?Du: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}},Ur=(o,t)=>!Iu(o,t),Yc={attribute:!0,type:String,converter:Pi,reflect:!1,useDefault:!1,hasChanged:Ur};Symbol.metadata??=Symbol("metadata"),Mi.litPropertyMetadata??=new WeakMap;var se=class extends(globalThis.HTMLElement??Ba){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Yc){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 n=Symbol(),r=this.getPropertyDescriptor(t,n,e);r!==void 0&&_u(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){let{get:r,set:i}=Ru(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:r,set(s){let a=r?.call(this);i?.call(this,s),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Yc}static _$Ei(){if(this.hasOwnProperty(Oi("elementProperties")))return;let t=Mu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Oi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Oi("properties"))){let e=this.properties,n=[...Ou(e),...Pu(e)];for(let r of n)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[n,r]of e)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[e,n]of this.elementProperties){let r=this._$Eu(e,n);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let r of n)e.unshift(Wa(r))}else t!==void 0&&e.push(Wa(t));return e}static _$Eu(t,e){let n=e.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Gc(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,n){this._$AK(t,n)}_$ET(t,e){let n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(r!==void 0&&n.reflect===!0){let i=(n.converter?.toAttribute!==void 0?n.converter:Pi).toAttribute(e,n.type);this._$Em=t,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){let n=this.constructor,r=n._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let i=n.getPropertyOptions(r),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Pi;this._$Em=r;let a=s.fromAttribute(e,i.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,n,r=!1,i){if(t!==void 0){let s=this.constructor;if(r===!1&&(i=this[t]),n??=s.getPropertyOptions(t),!((n.hasChanged??Ur)(i,e)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,e,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:r,wrapped:i},s){n&&!(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||n||(e=void 0),this._$AL.set(t,e)),r===!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[r,i]of this._$Ep)this[r]=i;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,i]of n){let{wrapped:s}=i,a=this[r];s!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,i,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(e)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}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[Oi("elementProperties")]=new Map,se[Oi("finalized")]=new Map,Nu?.({ReactiveElement:se}),(Mi.reactiveElementVersions??=[]).push("2.1.2");var Jr=globalThis,Jc=o=>o,Hr=Jr.trustedTypes,Kc=Hr?Hr.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ga="$lit$",ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Xa="?"+ae,$u=`<${Xa}>`,nn=Jr.document===void 0?{createTreeWalker:()=>({})}:document,Ni=()=>nn.createComment(""),$i=o=>o===null||typeof o!="object"&&typeof o!="function",Ya=Array.isArray,rd=o=>Ya(o)||typeof o?.[Symbol.iterator]=="function",Qa=`[
3
+ \f\r]`,Di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zc=/-->/g,td=/>/g,tn=RegExp(`>|${Qa}(?:([^\\s"'>=/]+)(${Qa}*=${Qa}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ed=/'/g,nd=/"/g,od=/^(?:script|style|textarea|title)$/i,Ja=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=Ja(1),zi=Ja(2),tb=Ja(3),st=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),id=new WeakMap,en=nn.createTreeWalker(nn,129);function sd(o,t){if(!Ya(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Kc!==void 0?Kc.createHTML(t):t}var ad=(o,t)=>{let e=o.length-1,n=[],r,i=t===2?"<svg>":t===3?"<math>":"",s=Di;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===Di?d[1]==="!--"?s=Zc:d[1]!==void 0?s=td:d[2]!==void 0?(od.test(d[2])&&(r=RegExp("</"+d[2],"g")),s=tn):d[3]!==void 0&&(s=tn):s===tn?d[0]===">"?(s=r??Di,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?tn:d[3]==='"'?nd:ed):s===nd||s===ed?s=tn:s===Zc||s===td?s=Di:(s=tn,r=void 0);let m=s===tn&&o[a+1].startsWith("/>")?" ":"";i+=s===Di?l+$u:h>=0?(n.push(c),l.slice(0,h)+Ga+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[sd(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},Li=class o{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,s=0,a=t.length-1,l=this.parts,[c,d]=ad(t,e);if(this.el=o.createElement(c,n),en.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=en.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(Ga)){let f=d[s++],m=r.getAttribute(h).split(ae),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:y[2],strings:m,ctor:y[1]==="."?Qr:y[1]==="?"?Gr:y[1]==="@"?Xr:on}),r.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:i}),r.removeAttribute(h));if(od.test(r.tagName)){let h=r.textContent.split(ae),f=h.length-1;if(f>0){r.textContent=Hr?Hr.emptyScript:"";for(let m=0;m<f;m++)r.append(h[m],Ni()),en.nextNode(),l.push({type:2,index:++i});r.append(h[f],Ni())}}}else if(r.nodeType===8)if(r.data===Xa)l.push({type:2,index:i});else{let h=-1;for(;(h=r.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:i}),h+=ae.length-1}i++}}static createElement(t,e){let n=nn.createElement("template");return n.innerHTML=t,n}};function rn(o,t,e=o,n){if(t===st)return t;let r=n!==void 0?e._$Co?.[n]:e._$Cl,i=$i(t)?void 0:t._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),i===void 0?r=void 0:(r=new i(o),r._$AT(o,e,n)),n!==void 0?(e._$Co??=[])[n]=r:e._$Cl=r),r!==void 0&&(t=rn(o,r._$AS(o,t.values),r,n)),t}var Wr=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:n}=this._$AD,r=(t?.creationScope??nn).importNode(e,!0);en.currentNode=r;let i=en.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new On(i,i.nextSibling,this,t):l.type===1?c=new l.ctor(i,l.name,l.strings,this,t):l.type===6&&(c=new Yr(i,this,t)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=en.nextNode(),s++)}return en.currentNode=nn,r}p(t){let e=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},On=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=r?.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=rn(this,t,e),$i(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==st&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):rd(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!==P&&$i(this._$AH)?this._$AA.nextSibling.data=t:this.T(nn.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Li.createElement(sd(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{let i=new Wr(r,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=id.get(t.strings);return e===void 0&&id.set(t.strings,e=new Li(t)),e}k(t){Ya(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,n,r=0;for(let i of t)r===e.length?e.push(n=new o(this.O(Ni()),this.O(Ni()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let n=Jc(t).nextSibling;Jc(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},on=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,r,i){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=P}_$AI(t,e=this,n,r){let i=this.strings,s=!1;if(i===void 0)t=rn(this,t,e,0),s=!$i(t)||t!==this._$AH&&t!==st,s&&(this._$AH=t);else{let a=t,l,c;for(t=i[0],l=0;l<i.length-1;l++)c=rn(this,a[n+l],e,l),c===st&&(c=this._$AH[l]),s||=!$i(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!r&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Qr=class extends on{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Gr=class extends on{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Xr=class extends on{constructor(t,e,n,r,i){super(t,e,n,r,i),this.type=5}_$AI(t,e=this){if((t=rn(this,t,e,0)??P)===st)return;let n=this._$AH,r=t===P&&n!==P||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==P&&(n===P||r);r&&this.element.removeEventListener(this.name,this,n),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)}},Yr=class{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){rn(this,t)}},ot={M:Ga,P:ae,A:Xa,C:1,L:ad,R:Wr,D:rd,V:rn,I:On,H:on,N:Gr,U:Xr,B:Qr,F:Yr},Lu=Jr.litHtmlPolyfillSupport;Lu?.(Li,On),(Jr.litHtmlVersions??=[]).push("3.3.3");var Ka=(o,t,e)=>{let n=e?.renderBefore??t,r=n._$litPart$;if(r===void 0){let i=e?.renderBefore??null;n._$litPart$=r=new On(t.insertBefore(Ni(),i),i,void 0,e??{})}return r._$AI(o),r};var Za=globalThis,k=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=Ka(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return st}};k._$litElement$=!0,k.finalized=!0,Za.litElementHydrateSupport?.({LitElement:k});var zu=Za.litElementPolyfillSupport;zu?.({LitElement:k});(Za.litElementVersions??=[]).push("4.2.2");var Vu={attribute:!0,type:String,converter:Pi,reflect:!1,hasChanged:Ur},ju=(o=Vu,t,e)=>{let{kind:n,metadata:r}=e,i=globalThis.litPropertyMetadata.get(r);if(i===void 0&&globalThis.litPropertyMetadata.set(r,i=new Map),n==="setter"&&((o=Object.create(o)).wrapped=!0),i.set(e.name,o),n==="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(n==="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: "+n)};function p(o){return(t,e)=>typeof e=="object"?ju(o,t,e):((n,r,i)=>{let s=r.hasOwnProperty(i);return r.constructor.createProperty(i,n),s?Object.getOwnPropertyDescriptor(r,i):void 0})(o,t,e)}function _(o){return p({...o,state:!0,attribute:!1})}var qe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Pn(o,t){return(e,n,r)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof n=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return qe(e,n,{get(){let l=s.call(this);return l===void 0&&(l=i(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return qe(e,n,{get(){return i(this)}})}}function ld(o){return(t,e)=>{let{slot:n,selector:r}=o??{},i="slot"+(n?`[name=${n}]`:":not([name])");return qe(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return r===void 0?a:a.filter(l=>l.matches(r))}})}}var le=class extends Event{constructor(t,e,n,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=n,this.subscribe=r??!1}};var xt=class{constructor(t,e,n,r){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=n,this.subscribe=r??!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 Kr=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let n=e||!Object.is(t,this.o);this.o=t,n&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:n}]of this.subscriptions)e(this.o,n)},t!==void 0&&(this.value=t)}addCallback(t,e,n){if(!n)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:r}=this.subscriptions.get(t);t(this.value,r)}clearCallbacks(){this.subscriptions.clear()}};var tl=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},ke=class extends Kr{constructor(t,e,n){super(e.context!==void 0?e.initialValue:n),this.onContextRequest=r=>{if(r.context!==this.context)return;let i=r.contextTarget??r.composedPath()[0];i!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,i,r.subscribe))},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.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 le(this.context,a,s,!0)));r.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 tl(this.context,this.host))}};var Vi=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:n}=e;for(let{elementRef:r,callbackRef:i}of n){let s=r.deref(),a=i.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],n=t.callback,r=this.pendingContextRequests.get(t.context);r===void 0&&this.pendingContextRequests.set(t.context,r={callbacks:new WeakMap,requests:[]});let i=r.callbacks.get(e);i===void 0&&r.callbacks.set(e,i=new WeakSet),i.has(n)||(i.add(n),r.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(n)}))}}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 H({context:o}){return(t,e)=>{let n=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(r){return n.get(this).setValue(r),t.set.call(this,r)},init(r){return n.set(this,new ke(this,{context:o,initialValue:r})),r}};{t.constructor.addInitializer((s=>{n.set(s,new ke(s,{context:o}))}));let r=Object.getOwnPropertyDescriptor(t,e),i;if(r===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){n.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=r.set;i={...r,set(a){n.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function I({context:o,subscribe:t}){return(e,n)=>{typeof n=="object"?n.addInitializer((function(){new xt(this,{context:o,callback:r=>{e.set.call(this,r)},subscribe:t})})):e.constructor.addInitializer((r=>{new xt(r,{context:o,callback:i=>{r[n]=i},subscribe:t})}))}}var Zr=["this"],cd=["+","-","!"],dd=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],el={"!":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},to=13;var Fu=["==","!=","<=",">=","||","&&","??","|>"],Bu=["===","!=="],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 Gt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Uu=o=>o===9||o===10||o===13||o===32,hd=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Hu=o=>hd(o)||ji(o),Wu=o=>Zr.indexOf(o)!==-1,Qu=o=>o===34||o===39,ji=o=>48<=o&&o<=57,Gu=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,Xu=o=>o===40||o===41||o===91||o===93||o===123||o===125,Yu=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}}),eo=class{#t;#e=-1;#n=0;#i;constructor(t){this.#t=t,this.#r()}nextToken(){for(;Uu(this.#i);)this.#r(!0);if(Qu(this.#i))return this.#a();if(hd(this.#i))return this.#c();if(ji(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#m();if(this.#i===58)return this.#d();if(Gu(this.#i))return this.#h();if(Xu(this.#i))return this.#b();if(this.#r(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#r(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#n=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#n,this.#e+t);return t===0&&this.#s(),e}#s(){this.#n=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#r(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#r(),this.#i===void 0))throw new Error(t);this.#r()}let n=Gt(M.STRING,Yu(this.#o()));return this.#r(),n}#c(){do this.#r();while(Hu(this.#i));let t=this.#o(),e=Wu(t)?M.KEYWORD:M.IDENTIFIER;return Gt(e,t)}#p(){do this.#r();while(ji(this.#i));return this.#i===46?this.#l():Gt(M.INTEGER,this.#o())}#l(){return this.#r(),ji(this.#i)?this.#u():(this.#s(),Gt(M.DOT,".",to))}#m(){return this.#r(!0),Gt(M.COMMA,",")}#d(){return this.#r(!0),Gt(M.COLON,":")}#u(){do this.#r();while(ji(this.#i));return Gt(M.DECIMAL,this.#o())}#h(){this.#r();let t=this.#o(2);if(Bu.indexOf(t)!==-1)this.#r(),this.#r();else{if(t=this.#o(1),t==="=>")return this.#r(),Gt(M.ARROW,t);Fu.indexOf(t)!==-1&&this.#r()}return t=this.#o(),Gt(M.OPERATOR,t,el[t])}#b(){let t=String.fromCharCode(this.#i),e=Gt(M.GROUPER,t,el[t]);return this.#r(!0),e}};var nl=(o,t)=>new Fi(o,t).parse(),Fi=class{#t;#e;#n;#i;#r;constructor(t,e){this.#e=new eo(t),this.#n=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 n=this.#e.nextToken();this.#i=n,this.#t=n?.kind,this.#r=n?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#r!==e)}#s(){if(!this.#i)return this.#n.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 n=this.#v();t=this.#n.invoke(t,void 0,n)}else if(this._matches(M.GROUPER,"[")){let n=this.#g();t=this.#n.index(t,n)}else if(this._matches(M.DOT)){this.#o();let n=this.#l();t=this.#c(t,n)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=e)t=this.#r==="?"?this.#m(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.#n.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let n=e.receiver;return this.#n.invoke(t,n.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(dd.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let n=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#i.precedence>e.precedence;)n=this.#a(n,this.#i.precedence);return this.#n.binary(t,e.value,n)}#l(){if(this._matches(M.OPERATOR)){let t=this.#r;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#k(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(cd.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),to);return this.#n.unary(t,e)}return this.#d()}#m(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let n=this.#s();return this.#n.ternary(t,e,n)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#r;if(t==="this")return this.#o(),this.#n.id(t);throw Zr.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#x();case M.INTEGER:return this.#k();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#r==="("?this.#y():this.#r==="{"?this.#h():this.#r==="["?this.#u():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#u(){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.#n.list(t)}#h(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#r;(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.#n.map(t)}#b(){let t=this.#r;if(t==="true")return this.#o(),this.#n.literal(!0);if(t==="false")return this.#o(),this.#n.literal(!1);if(t==="null")return this.#o(),this.#n.literal(null);if(t==="undefined")return this.#o(),this.#n.literal(void 0);let e=this.#f(),n=this.#v();return n?this.#n.invoke(e,void 0,n):e}#f(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#r}`);let t=this.#r;return this.#o(),this.#n.id(t)}#v(){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}#g(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#y(){let t=this.#v();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),n=t?.map(r=>r.value)??[];return this.#n.arrowFunction(n,e)}else return this.#n.paren(t[0])}#x(){let t=this.#n.literal(this.#r);return this.#o(),t}#k(t=""){let e=this.#n.literal(parseInt(`${t}${this.#r}`,10));return this.#o(),e}#E(t=""){let e=this.#n.literal(parseFloat(`${t}${this.#r}`));return this.#o(),e}};var{hasOwn:pd,fromEntries:Ju}=Object,Ku={"+":(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)},Zu={"+":o=>o,"-":o=>-o,"!":o=>!o},no=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 n=Zu[t];return{type:"Unary",operator:t,child:e,evaluate(r){return n(this.child.evaluate(r))},getIds(r){return this.child.getIds(r)}}}binary(t,e,n){let r=Ku[e];return{type:"Binary",operator:e,left:t,right:n,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 r(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(n){return this.receiver.evaluate(n)?.[this.name]},getIds(n){return this.receiver.getIds(n),n}}}invoke(t,e,n){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:n,evaluate(r){let i=this.receiver.evaluate(r),s=this.method?i:r?.this??r,a=this.method?i?.[e]:i,c=(this.arguments??[]).map(d=>d?.evaluate(r));return a?.apply?.(s,c)},getIds(r){return this.receiver.getIds(r),this.arguments?.forEach(i=>i?.getIds(r)),r}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(n){return this.receiver.evaluate(n)?.[this.argument.evaluate(n)]},getIds(n){return this.receiver.getIds(n),n}}}ternary(t,e,n){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:n,evaluate(r){return this.condition.evaluate(r)?this.trueExpr.evaluate(r):this.falseExpr.evaluate(r)},getIds(r){return this.condition.getIds(r),this.trueExpr.getIds(r),this.falseExpr.getIds(r),r}}}map(t){return{type:"Map",entries:t,evaluate(e){let n={};if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&(n[r]=i.evaluate(e))}return n},getIds(e){if(t&&this.entries)for(let n in t){let r=this.entries[n];r&&r.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(n=>n?.evaluate(e))},getIds(e){return this.items?.forEach(n=>n?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(n){let r=this.params,i=this.body;return function(...s){let a=Ju(r.map((c,d)=>[c,s[d]])),l=new Proxy(n??{},{set(c,d,h){return pd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return pd(a,d)?a[d]:c[d]}});return i.evaluate(l)}},getIds(n){return this.body.getIds(n).filter(r=>!this.params.includes(r))}}}};var il=null,ud={boundAttributeSuffix:ot.M,marker:ot.P,markerMatch:ot.A,HTML_RESULT:ot.C,getTemplateHtml:ot.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,n){return t(this,n)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){il??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(il))return void(e[il]=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 n=st;return o.j=r=>n=r,o._$AI(t,o,e),n},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:ot.V,AttributePart:ot.H,PropertyPart:ot.B,BooleanAttributePart:ot.N,EventPart:ot.U,ElementPart:ot.F,TemplateInstance:ot.R,isIterable:ot.D,ChildPart:ot.I};var{AttributePart:tm,PropertyPart:em,BooleanAttributePart:nm,EventPart:im}=ud,ol=new no,rl=new Map,md=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),io=(o,t)=>{let e=rl.get(o);if(e===void 0){if(rl.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let n=o.substring(2,o.length-2).trim();e=new Fi(n,ol).parse(),rl.set(o,e)}}return e?.evaluate(t)},rm=(o,t,e,n)=>{let r=o.getAttribute("if");if(r!==null&&io(r,t))return ro(o,t,e,n)},fd=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,gd=o=>/(?:\\{{)|(?:\\}})/g.test(o),Bi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),om=(o,t,e,n)=>{let r=o.getAttribute("repeat");if(r!==null){let i=io(r,t);if(!i[Symbol.iterator])return P;let s=Ui(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 y=m.update(d,e,n);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},vd={if:rm,repeat:om},Ce=(o,t=vd,e={},n)=>{let i=Ui(o).renderers;if(n){let a=Ui(n).renderers,l=i.super;l!==void 0?e={...i,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>ro(n,f,m,y)},l(c,d,h))}:(e={...a,...i,...e},o=n)}else e={...i,...e};return s=>ro(o,s,t,e)};var ro=(o,t,e=vd,n={})=>{let r=Ui(o),i=[];for(let a of r.parts){let l=a.update(t,e,n);a.type===1?i.push(...l):i.push(l)}return{_$litType$:r,values:i}},bd=new Map,Ui=o=>{let t=bd.get(o);return t===void 0&&bd.set(o,t=sm(o)),t},sm=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),n=e.currentNode,r=-1,i=[];for(;(n=e.nextNode())!==null;)if(n.nodeType===Node.COMMENT_NODE)r++;else if(n.nodeType===Node.ELEMENT_NODE){r++;let s=n;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=(y,q,u)=>{let g=s.getAttribute("data"),v=g===null?void 0:io(g,y);return(m?io(f,y):u[d])?.(v,q,u)}}else l!==null?h=(f,m,y)=>{let q=m[l];return q?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let q=y.super,u=Ui(s);return y={...y,...u.renderers},q(f,m,y)}:t.renderers[c]=(f,m,y)=>ro(s,f,m,y),h=(f,m,y)=>{let q=y[c];return q?.(f,m,y)});t.parts.push({type:2,index:r,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(fd);if(d.length===1){gd(c)&&s.setAttribute(l,Bi(c));continue}s.removeAttribute(l);let h=l,f=tm,m=l[0];m==="."?(h=md(l.substring(1)),f=em):m==="?"?(h=l.substring(1),f=nm):m==="@"&&(h=md(l.substring(1)),f=im);let y=[Bi(d[0])],q=[];for(let u=1;u<d.length;u+=2){let g=d[u];q.push(nl(g,ol)),y.push(Bi(d[u+1]))}t.parts.push({type:1,index:r,name:h,strings:y,ctor:f,update:(u,g,v)=>q.map(w=>w.evaluate(u))})}}else if(n.nodeType===Node.TEXT_NODE){let s=n,a=s.textContent,l=a.split(fd);l.length>1?s.textContent=Bi(l[0]):gd(a)&&(s.textContent=Bi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=nl(d,ol);t.parts.push({type:2,index:++r,update:(m,y)=>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 sl=Symbol.for("qti-components.context-root"),am=()=>{if(typeof document>"u")return;let o=globalThis;o[sl]||(o[sl]=new Vi,o[sl].attach(document.documentElement))};am();var yd=[];var ll=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.#n():queueMicrotask(()=>this.#n())}#n(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},al="custom-state-support-probe";function lm(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(al)||customElements.define(al,class extends HTMLElement{});let t=o.call(document.createElement(al)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var wd=!1;function xd(){if(wd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=lm(o);return t==="modern"||(wd=!0,HTMLElement.prototype.attachInternals=function(){let n=o.call(this);return Object.defineProperty(n,"states",{configurable:!0,enumerable:!0,value:new ll(this)}),n}),t}xd();for(let{tag:o,ctor:t}of yd)customElements.get(o)||customElements.define(o,t);var Se=Symbol("computedItemContext");var j=Symbol("computedContext");var qt=Symbol("configContext");var Mn=Symbol("interactionContext");var F=Symbol("item");var qd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var cm=/^[A-Za-z0-9-]+$/,dm=o=>typeof o=="string"&&cm.test(o),Wv=o=>dm(o)?o:void 0,kt=Symbol("qtiContext");var cl={view:"candidate"},Ee=Symbol("sessionContext");var dl={items:[],testOutcomeVariables:[]},at=Symbol("testContext");var O=x`
6
6
  :host {
7
7
  box-sizing: border-box;
8
8
  }
@@ -56,23 +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 Dn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},D=class extends k{#t;get _context(){return this.#t.value}#e;#n;#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.#n&&(this.#n=t.disabled,this.disabled=t.disabled),this.#a(t)}#r;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),n=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!n)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let r=this.#r===void 0,i=JSON.stringify(n.value??null);i!==this.#r&&(this.#r=i,!(r&&(n.value===null||n.value===void 0))&&i!==this.#o&&(this.#o=i,this.response=n.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(n=>n.type==="response"),e=this.getAttribute("response-identifier");return t.find(n=>n.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,n=this.configContext;return n&&n.allowReorder!==void 0?n.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,n=this.configContext;return n?n.disableAfterMaxReached!==void 0?n.disableAfterMaxReached:n.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),n.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",n,r){let i=n??this;this._internals.setValidity(t?{}:{customError:!0},e,i),r?.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 xt(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){}};Dn([I({context:qt,subscribe:!0})],D.prototype,"configContext",void 0);Dn([H({context:Mn})],D.prototype,"_interactionContext",void 0);Dn([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Dn([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Dn([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Dn([p({type:String})],D.prototype,"name",void 0);var Nn=class extends k{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 n=e.map(r=>r.innerHTML.trim());return n.length>1||t==="multiple"||t==="ordered"?n:n[0]}};var hl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},dl=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??qd(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??qd(o),value:String(o),cardinality:"single",type:"response"},qd=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",dm=(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 k{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 n=e.getAttribute("identifier")||"";return n==="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(n)}case"qti-multiple":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=e.getResult();return r?.length>0?r:null}case"qti-custom-operator":return dl(e.calculate?.());case"qti-correct":{let n=e.getAttribute("identifier")||"",r=this.context?.variables?.find(i=>i.identifier===n);return r?{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}:(console.warn(`qti-correct: no response declaration for "${n}"`),dl(null))}default:{try{let n=e,r=n.getResult();return dl(r,n.resultBaseType??dm(n,r))}catch(n){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,n)}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=x`
59
+ `;var Dn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},D=class extends k{#t;get _context(){return this.#t.value}#e;#n;#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.#n&&(this.#n=t.disabled,this.disabled=t.disabled),this.#a(t)}#r;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),n=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!n)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let r=this.#r===void 0,i=JSON.stringify(n.value??null);i!==this.#r&&(this.#r=i,!(r&&(n.value===null||n.value===void 0))&&i!==this.#o&&(this.#o=i,this.response=n.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(n=>n.type==="response"),e=this.getAttribute("response-identifier");return t.find(n=>n.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,n=this.configContext;return n&&n.allowReorder!==void 0?n.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,n=this.configContext;return n?n.disableAfterMaxReached!==void 0?n.disableAfterMaxReached:n.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),n.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",n,r){let i=n??this;this._internals.setValidity(t?{}:{customError:!0},e,i),r?.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 xt(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){}};Dn([I({context:qt,subscribe:!0})],D.prototype,"configContext",void 0);Dn([H({context:Mn})],D.prototype,"_interactionContext",void 0);Dn([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Dn([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Dn([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Dn([p({type:String})],D.prototype,"name",void 0);var Nn=class extends k{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 n=e.map(r=>r.innerHTML.trim());return n.length>1||t==="multiple"||t==="ordered"?n:n[0]}};var pl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hl=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??kd(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??kd(o),value:String(o),cardinality:"single",type:"response"},kd=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",hm=(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 k{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 n=e.getAttribute("identifier")||"";return n==="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(n)}case"qti-multiple":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=e.getResult();return r?.length>0?r:null}case"qti-custom-operator":return hl(e.calculate?.());case"qti-correct":{let n=e.getAttribute("identifier")||"",r=this.context?.variables?.find(i=>i.identifier===n);return r?{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}:(console.warn(`qti-correct: no response declaration for "${n}"`),hl(null))}default:{try{let n=e,r=n.getResult();return hl(r,n.resultBaseType??hm(n,r))}catch(n){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,n)}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=x`
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)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(r=>r.identifier===e[0])?.variables?.find(r=>r.identifier===e[e.length-1])??null}};hl([I({context:F,subscribe:!0})],E.prototype,"context",void 0);hl([I({context:kt,subscribe:!0})],E.prototype,"qtiContext",void 0);hl([I({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 vy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Pt=o=>typeof o=="string"?o:o.toString();function pl(o){return o==null}function ro(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Hi=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ft=class extends k{constructor(){super(...arguments),this.showHide="show",this.#t=new xt(this,{context:F,subscribe:!0,callback:t=>this.#n(t)})}#t;get _context(){return this.#t.value}#e;#n(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let n=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),r=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,i=this.#e===void 0?r>0:this.#e!==n||r>0;this.#e=n,i&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(r=>r.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let n=!1;Array.isArray(e.value)?n=e.value.includes(this.identifier):n=!pl(this.identifier)&&!pl(e?.value)&&this.identifier===e.value||!1,this.#i(n)}#i(t){if(!this.#r()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#r(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(r=>r.active)?.sections.flatMap(r=>r.items).find(r=>r.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(r=>r.identifier==="numAttempts")?.value)||0)<e}};Hi([p({type:String,attribute:"show-hide"})],ft.prototype,"showHide",void 0);Hi([p({type:String,attribute:"outcome-identifier"})],ft.prototype,"outcomeIdentifier",void 0);Hi([p({type:String})],ft.prototype,"identifier",void 0);Hi([p({type:String,attribute:!1})],ft.prototype,"showStatus",void 0);Hi([I({context:j,subscribe:!0}),_()],ft.prototype,"_computedContext",void 0);function ul(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 ml(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*Ay(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 Ty(o){let[t,e,...n]=o.trim().split(/\s+/);if(!t||!e||n.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function Iy(o,t){return`${o} ${t}`}function _y(o){let[t,e,...n]=o.trim().split(/\s+/),r=Number(t),i=Number(e);if(!Number.isFinite(r)||!Number.isFinite(i)||n.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:r,y:i}}function Ry(o,t){return`${o} ${t}`}function Jt(o){let{emptyAs:t}=o,e=n=>n===t||n==null||n===""||Array.isArray(n)&&n.length===0;return{fromAttribute:n=>{let r=ul(n);return r===null?t:r},toAttribute:n=>e(n)?null:ml(n)}}var Mt=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Wi=o=>{let t={},e={};for(let n of o){let r=n.getAttribute("field-identifier");if(!r)continue;t[r]=n.textContent?.trim()??"";let i=n.getAttribute("base-type");i&&(e[r]=i)}return{value:t,baseTypes:e}},kd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,oo=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(kd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(n=>kd.test(n))?"point":"string"};var Cd=class extends k{},$n=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Ln=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var hm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},fl=o=>t=>{let e=hm(t);return e===null?null:o(e)},pm=["depcp","questify","qade"],um={Trim:fl(o=>o.trim()),ToAscii:fl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:fl(o=>o.replace(",","."))},mm=new Map(pm.flatMap(o=>Object.entries(um).map(([t,e])=>[`${o}:${t}`,e]))),gl=new Map,Ny=(o,t)=>{gl.set(o,t)},$y=o=>{gl.delete(o)},Sd=o=>gl.get(o)??mm.get(o)??null;var Ed={true:!0,1:!0,false:!1,0:!1},J=class{static isPointInArea(t,e,n){if(n!=="point")return console.warn(`Base type ${n} is not supported for point area mapping.`),!1;let[r,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((r-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):r>=c&&r<=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=(r-c)**2/h**2,y=(i-d)**2/f**2;return m+y<=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:r,y:i},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r].x,a=e[r].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&&(n=!n)}return n}static compareSingleValues(t,e,n){switch(n){case"identifier":case"string":return t===e;case"boolean":{let r=Ed[t.trim().toLowerCase()];return r!==void 0&&r===Ed[e.trim().toLowerCase()]}case"integer":{let r=parseInt(t,10),i=parseInt(e,10);if(!isNaN(r)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:r===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let r=parseFloat(t),i=parseFloat(e);if(!isNaN(r)&&!isNaN(i))return r===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=t.split(" "),i=e.split(" ");if(r.length===2&&i.length===2)return n==="pair"&&(r.sort(),i.sort()),r.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 Ae=Symbol("testHost");var Td={"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 bl(o,t,e,n,r=!1){let i={detail:n??{},bubbles:!0,composed:!0,cancelable:r},s=o.dispatchEvent(new CustomEvent(e,i)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,i))&&s:s}var Ad=new Set;function vl(o,t,e,n){let r;o.addEventListener(e,s=>{r=s.detail,queueMicrotask(()=>r=void 0),n(s)});let{deprecated:i}=t[e];i&&o.addEventListener(i,s=>{r!==void 0&&s.detail===r||(Ad.has(i)||(Ad.add(i),console.warn(`[qti-components] The event "${i}" is deprecated; dispatch "${e}" instead.`)),n(s))})}function zn(o,t,e,n=!1){return bl(o,Td,t,e,n)}function Id(o,t,e){vl(o,Td,t,e)}var _d={"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-submit":{kind:"request",scope:"test"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-update-plugin-state":{kind:"request",scope:"test"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-submitted":{kind:"notification",scope:"test"},"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 $(o,t,e){bl(o,_d,t,e)}function B(o,t,e){vl(o,_d,t,e)}var Te=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Rd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends k{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 n=e.getAttribute("identifier");if(!n)continue;let r=Number(e.getAttribute("value"));if(Number.isNaN(r)){console.warn(`qti-weight "${n}" has a non-numeric value, ignoring it`);continue}t.set(n,r)}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?Ce(t):null,this.requestUpdate(),await this.updateComplete,$(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 n=e.items.find(r=>r.identifier===this.identifier);if(n)return n}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(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)}};Te([p({type:String})],Ct.prototype,"category",void 0);Te([p({type:String})],Ct.prototype,"identifier",void 0);Te([p({type:Boolean,converter:Rd})],Ct.prototype,"required",void 0);Te([p({type:Boolean,converter:Rd})],Ct.prototype,"fixed",void 0);Te([p({type:String})],Ct.prototype,"href",void 0);Te([_(),I({context:j,subscribe:!0})],Ct.prototype,"computedContext",void 0);Te([p({type:Object,attribute:!1})],Ct.prototype,"xmlDoc",void 0);Te([I({context:Ae,subscribe:!0})],Ct.prototype,"testHost",void 0);var Ie=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},yl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},St=class extends k{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>`}};Ie([p({type:String})],St.prototype,"identifier",void 0);Ie([p({type:String})],St.prototype,"required",void 0);Ie([p({type:Boolean,converter:yl})],St.prototype,"fixed",void 0);Ie([p({type:Boolean,converter:yl})],St.prototype,"visible",void 0);Ie([p({type:Boolean,converter:yl,attribute:"keep-together"})],St.prototype,"keepTogether",void 0);Ie([p({type:String,attribute:"navigation-mode"})],St.prototype,"navigationMode",void 0);Ie([p({type:String,attribute:"submission-mode"})],St.prototype,"submissionMode",void 0);Ie([I({context:at,subscribe:!0})],St.prototype,"_testContext",void 0);var wl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},sn=class extends k{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,"cito-test-loaded",this)}render(){return b` <slot></slot>`}};wl([p({type:String})],sn.prototype,"identifier",void 0);wl([p({type:String})],sn.prototype,"title",null);wl([I({context:at,subscribe:!0})],sn.prototype,"_testContext",void 0);function so(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 n=e.calculate();return n===!0||n==="true"}catch(n){return console.warn(`<${o.localName}> could not evaluate its expression`,n),t}}var fm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ce=class extends k{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=x`
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(r=>r.identifier===e[0])?.variables?.find(r=>r.identifier===e[e.length-1])??null}};pl([I({context:F,subscribe:!0})],E.prototype,"context",void 0);pl([I({context:kt,subscribe:!0})],E.prototype,"qtiContext",void 0);pl([I({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 xy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Pt=o=>typeof o=="string"?o:o.toString();function ul(o){return o==null}function oo(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Hi=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ft=class extends k{constructor(){super(...arguments),this.showHide="show",this.#t=new xt(this,{context:F,subscribe:!0,callback:t=>this.#n(t)})}#t;get _context(){return this.#t.value}#e;#n(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let n=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),r=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,i=this.#e===void 0?r>0:this.#e!==n||r>0;this.#e=n,i&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(r=>r.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let n=!1;Array.isArray(e.value)?n=e.value.includes(this.identifier):n=!ul(this.identifier)&&!ul(e?.value)&&this.identifier===e.value||!1,this.#i(n)}#i(t){if(!this.#r()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#r(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(r=>r.active)?.sections.flatMap(r=>r.items).find(r=>r.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(r=>r.identifier==="numAttempts")?.value)||0)<e}};Hi([p({type:String,attribute:"show-hide"})],ft.prototype,"showHide",void 0);Hi([p({type:String,attribute:"outcome-identifier"})],ft.prototype,"outcomeIdentifier",void 0);Hi([p({type:String})],ft.prototype,"identifier",void 0);Hi([p({type:String,attribute:!1})],ft.prototype,"showStatus",void 0);Hi([I({context:j,subscribe:!0}),_()],ft.prototype,"_computedContext",void 0);function ml(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 fl(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*_y(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 Ry(o){let[t,e,...n]=o.trim().split(/\s+/);if(!t||!e||n.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function Oy(o,t){return`${o} ${t}`}function Py(o){let[t,e,...n]=o.trim().split(/\s+/),r=Number(t),i=Number(e);if(!Number.isFinite(r)||!Number.isFinite(i)||n.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:r,y:i}}function My(o,t){return`${o} ${t}`}function Jt(o){let{emptyAs:t}=o,e=n=>n===t||n==null||n===""||Array.isArray(n)&&n.length===0;return{fromAttribute:n=>{let r=ml(n);return r===null?t:r},toAttribute:n=>e(n)?null:fl(n)}}var Mt=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Wi=o=>{let t={},e={};for(let n of o){let r=n.getAttribute("field-identifier");if(!r)continue;t[r]=n.textContent?.trim()??"";let i=n.getAttribute("base-type");i&&(e[r]=i)}return{value:t,baseTypes:e}},Cd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,so=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(Cd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(n=>Cd.test(n))?"point":"string"};var Sd=class extends k{},$n=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Ln=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var pm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},gl=o=>t=>{let e=pm(t);return e===null?null:o(e)},um=["depcp","questify","qade"],mm={Trim:gl(o=>o.trim()),ToAscii:gl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:gl(o=>o.replace(",","."))},fm=new Map(um.flatMap(o=>Object.entries(mm).map(([t,e])=>[`${o}:${t}`,e]))),bl=new Map,zy=(o,t)=>{bl.set(o,t)},Vy=o=>{bl.delete(o)},Ed=o=>bl.get(o)??fm.get(o)??null;var Ad={true:!0,1:!0,false:!1,0:!1},J=class{static isPointInArea(t,e,n){if(n!=="point")return console.warn(`Base type ${n} is not supported for point area mapping.`),!1;let[r,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((r-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):r>=c&&r<=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=(r-c)**2/h**2,y=(i-d)**2/f**2;return m+y<=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:r,y:i},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r].x,a=e[r].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&&(n=!n)}return n}static compareSingleValues(t,e,n){switch(n){case"identifier":case"string":return t===e;case"boolean":{let r=Ad[t.trim().toLowerCase()];return r!==void 0&&r===Ad[e.trim().toLowerCase()]}case"integer":{let r=parseInt(t,10),i=parseInt(e,10);if(!isNaN(r)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:r===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let r=parseFloat(t),i=parseFloat(e);if(!isNaN(r)&&!isNaN(i))return r===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=t.split(" "),i=e.split(" ");if(r.length===2&&i.length===2)return n==="pair"&&(r.sort(),i.sort()),r.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 Ae=Symbol("testHost");var Id={"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 vl(o,t,e,n,r=!1){let i={detail:n??{},bubbles:!0,composed:!0,cancelable:r},s=o.dispatchEvent(new CustomEvent(e,i)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,i))&&s:s}var Td=new Set;function yl(o,t,e,n){let r;o.addEventListener(e,s=>{r=s.detail,queueMicrotask(()=>r=void 0),n(s)});let{deprecated:i}=t[e];i&&o.addEventListener(i,s=>{r!==void 0&&s.detail===r||(Td.has(i)||(Td.add(i),console.warn(`[qti-components] The event "${i}" is deprecated; dispatch "${e}" instead.`)),n(s))})}function zn(o,t,e,n=!1){return vl(o,Id,t,e,n)}function _d(o,t,e){yl(o,Id,t,e)}var Rd={"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-submit":{kind:"request",scope:"test"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-update-plugin-state":{kind:"request",scope:"test"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-submitted":{kind:"notification",scope:"test"},"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 $(o,t,e){vl(o,Rd,t,e)}function B(o,t,e){yl(o,Rd,t,e)}var Te=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Od={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends k{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 n=e.getAttribute("identifier");if(!n)continue;let r=Number(e.getAttribute("value"));if(Number.isNaN(r)){console.warn(`qti-weight "${n}" has a non-numeric value, ignoring it`);continue}t.set(n,r)}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?Ce(t):null,this.requestUpdate(),await this.updateComplete,$(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 n=e.items.find(r=>r.identifier===this.identifier);if(n)return n}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(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)}};Te([p({type:String})],Ct.prototype,"category",void 0);Te([p({type:String})],Ct.prototype,"identifier",void 0);Te([p({type:Boolean,converter:Od})],Ct.prototype,"required",void 0);Te([p({type:Boolean,converter:Od})],Ct.prototype,"fixed",void 0);Te([p({type:String})],Ct.prototype,"href",void 0);Te([_(),I({context:j,subscribe:!0})],Ct.prototype,"computedContext",void 0);Te([p({type:Object,attribute:!1})],Ct.prototype,"xmlDoc",void 0);Te([I({context:Ae,subscribe:!0})],Ct.prototype,"testHost",void 0);var Ie=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},wl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},St=class extends k{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>`}};Ie([p({type:String})],St.prototype,"identifier",void 0);Ie([p({type:String})],St.prototype,"required",void 0);Ie([p({type:Boolean,converter:wl})],St.prototype,"fixed",void 0);Ie([p({type:Boolean,converter:wl})],St.prototype,"visible",void 0);Ie([p({type:Boolean,converter:wl,attribute:"keep-together"})],St.prototype,"keepTogether",void 0);Ie([p({type:String,attribute:"navigation-mode"})],St.prototype,"navigationMode",void 0);Ie([p({type:String,attribute:"submission-mode"})],St.prototype,"submissionMode",void 0);Ie([I({context:at,subscribe:!0})],St.prototype,"_testContext",void 0);var xl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},sn=class extends k{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,"cito-test-loaded",this)}render(){return b` <slot></slot>`}};xl([p({type:String})],sn.prototype,"identifier",void 0);xl([p({type:String})],sn.prototype,"title",null);xl([I({context:at,subscribe:!0})],sn.prototype,"_testContext",void 0);function ao(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 n=e.calculate();return n===!0||n==="true"}catch(n){return console.warn(`<${o.localName}> could not evaluate its expression`,n),t}}var gm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ce=class extends k{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=x`
64
64
  :host {
65
65
  display: none;
66
66
  }
67
- `}evaluate(){return so(this,!1)}render(){return b`<slot></slot>`}};fm([p({type:String})],ce.prototype,"target",void 0);var an=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vn={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Dt=class extends k{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>`}};an([p({type:Number,attribute:"max-attempts"})],Dt.prototype,"maxAttempts",void 0);an([p({type:Boolean,converter:Vn,attribute:"show-feedback"})],Dt.prototype,"showFeedback",void 0);an([p({type:Boolean,converter:Vn,attribute:"allow-review"})],Dt.prototype,"allowReview",void 0);an([p({type:Boolean,converter:Vn,attribute:"show-solution"})],Dt.prototype,"showSolution",void 0);an([p({type:Boolean,converter:Vn,attribute:"allow-comment"})],Dt.prototype,"allowComment",void 0);an([p({type:Boolean,converter:Vn,attribute:"allow-skipping"})],Dt.prototype,"allowSkipping",void 0);an([p({type:Boolean,converter:Vn,attribute:"validate-responses"})],Dt.prototype,"validateResponses",void 0);var xl=o=>o?.split(/\s+/).filter(Boolean)??[],jn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:xl(o.getAttribute("include-category")),excludeCategories:xl(o.getAttribute("exclude-category"))}),Fn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:n})=>{let r=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return r.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):r.flatMap(i=>Array.from(i.querySelectorAll("qti-assessment-item-ref"))).filter(i=>{let s=xl(i.category);return!(e.length>0&&!s.some(a=>e.includes(a))||n.length>0&&s.some(a=>n.includes(a)))})};var gm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Qi=class extends E{#t=null;constructor(){super(),B(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-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(n=>{let r=n.variables?.find(i=>i.identifier==="completionStatus")?.value;return r!=null&&r!=="not_attempted"}).map(n=>n.identifier));return Fn(t,jn(this)).filter(n=>e.has(n.identifier)).length}calculate(){return this.getResult()}};gm([I({context:at,subscribe:!0})],Qi.prototype,"_testContext",void 0);var ao=class extends E{#t=null;constructor(){super(),B(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?Fn(t,jn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var lo=class extends k{static{this.styles=x`
67
+ `}evaluate(){return ao(this,!1)}render(){return b`<slot></slot>`}};gm([p({type:String})],ce.prototype,"target",void 0);var an=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vn={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Dt=class extends k{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>`}};an([p({type:Number,attribute:"max-attempts"})],Dt.prototype,"maxAttempts",void 0);an([p({type:Boolean,converter:Vn,attribute:"show-feedback"})],Dt.prototype,"showFeedback",void 0);an([p({type:Boolean,converter:Vn,attribute:"allow-review"})],Dt.prototype,"allowReview",void 0);an([p({type:Boolean,converter:Vn,attribute:"show-solution"})],Dt.prototype,"showSolution",void 0);an([p({type:Boolean,converter:Vn,attribute:"allow-comment"})],Dt.prototype,"allowComment",void 0);an([p({type:Boolean,converter:Vn,attribute:"allow-skipping"})],Dt.prototype,"allowSkipping",void 0);an([p({type:Boolean,converter:Vn,attribute:"validate-responses"})],Dt.prototype,"validateResponses",void 0);var ql=o=>o?.split(/\s+/).filter(Boolean)??[],jn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:ql(o.getAttribute("include-category")),excludeCategories:ql(o.getAttribute("exclude-category"))}),Fn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:n})=>{let r=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return r.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):r.flatMap(i=>Array.from(i.querySelectorAll("qti-assessment-item-ref"))).filter(i=>{let s=ql(i.category);return!(e.length>0&&!s.some(a=>e.includes(a))||n.length>0&&s.some(a=>n.includes(a)))})};var bm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Qi=class extends E{#t=null;constructor(){super(),B(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-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(n=>{let r=n.variables?.find(i=>i.identifier==="completionStatus")?.value;return r!=null&&r!=="not_attempted"}).map(n=>n.identifier));return Fn(t,jn(this)).filter(n=>e.has(n.identifier)).length}calculate(){return this.getResult()}};bm([I({context:at,subscribe:!0})],Qi.prototype,"_testContext",void 0);var lo=class extends E{#t=null;constructor(){super(),B(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?Fn(t,jn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var co=class extends k{static{this.styles=x`
68
68
  :host {
69
69
  display: none;
70
70
  }
71
- `}evaluate(){return so(this,!0)}render(){return b`<slot></slot>`}};var co=class extends k{static{this.styles=[x`
71
+ `}evaluate(){return ao(this,!0)}render(){return b`<slot></slot>`}};var ho=class extends k{static{this.styles=[x`
72
72
  :host {
73
73
  display: none;
74
74
  }
75
- `]}render(){return b`<slot></slot>`}process(){let t=new ql,e=[...this.children];t.process(e)}},ql=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Ln))throw e}}};var ln=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},gt=class extends k{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:xd},this.#n={...this._context,variables:this._context.variables},this.#i=new Map,this.#r=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,n=e.type==="template"?this.#i.get(e.identifier):void 0,r=n!==void 0?{...e,value:n}:e;this._context={...this._context,variables:[...this._context.variables,r]},this.#n=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:n}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(n)},this.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:n}=t.detail;this.updateOutcomeVariable(e,n),t.stopPropagation()},this.#m=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:n}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,n??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:n}=t.detail;this.updateCorrectResponse(e,n??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:n,state:r}=t.detail;this.updateResponseVariable(e,n),r!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:r}}),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),n=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||n)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...n?{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,n=t.filter(i=>i.value!==null&&i.value!==void 0&&(i.type==="template"||e.some(s=>s.identifier===i.identifier&&s.type==="template")));n.forEach(i=>this.#i.set(i.identifier,i.value));let r=n.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.#r&&r&&this.#b(),this.updateComplete.then(()=>this.#v())}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#n;#i;#r;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let r=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);r&&(r.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),zn(this,"cito-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#h()})}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.#m),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#u)}#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.#m),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#m;#d;#u;async#h(){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.#r=!0,this.#b()}#b(){this.#e&&(this.#e.process(),this.#n={...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.#y();let n=this.querySelector("qti-response-processing"),r=!!(n&&typeof n.process=="function");return r&&n.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#g()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),r}resetResponses(){this._context=this.#n}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(n=>n.identifier!==t?n:{...n,value:e})},this.afterResponseVariableUpdated(),zn(this,"cito-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#g())}updateTemplateVariable(t,e){let n=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!n){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let r=n.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:r})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let n=this.getResponse(t);if(!n){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let r=n.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:r})},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 n=this.getOutcome(t);if(!n){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:n.cardinality==="single"||Array.isArray(e)?e:[e]})},zn(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(r=>r.identifier===t)?.value})}validate(t=!0){let e=this.interactionElements.every(n=>n.validate());return this.#f(e),t&&this.reportValidity(),e}#f(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#v(){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()}#g(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#y(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let r=("defaultValue"in t?t.defaultValue:null)??null;return r==null&&(t.baseType==="integer"||t.baseType==="float")&&(r="0"),{...t,value:r}})}}};ln([p({type:String})],gt.prototype,"identifier",void 0);ln([p({type:String})],gt.prototype,"adaptive",void 0);ln([p({type:String,attribute:"time-dependent"})],gt.prototype,"timeDependent",void 0);ln([p({type:String})],gt.prototype,"title",null);ln([p({type:Boolean})],gt.prototype,"disabled",void 0);ln([p({type:Boolean})],gt.prototype,"readonly",void 0);ln([H({context:F})],gt.prototype,"_context",void 0);var Od=x`
75
+ `]}render(){return b`<slot></slot>`}process(){let t=new kl,e=[...this.children];t.process(e)}},kl=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Ln))throw e}}};var ln=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},gt=class extends k{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:qd},this.#n={...this._context,variables:this._context.variables},this.#i=new Map,this.#r=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,n=e.type==="template"?this.#i.get(e.identifier):void 0,r=n!==void 0?{...e,value:n}:e;this._context={...this._context,variables:[...this._context.variables,r]},this.#n=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:n}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(n)},this.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:n}=t.detail;this.updateOutcomeVariable(e,n),t.stopPropagation()},this.#m=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:n}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,n??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:n}=t.detail;this.updateCorrectResponse(e,n??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:n,state:r}=t.detail;this.updateResponseVariable(e,n),r!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:r}}),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),n=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||n)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...n?{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,n=t.filter(i=>i.value!==null&&i.value!==void 0&&(i.type==="template"||e.some(s=>s.identifier===i.identifier&&s.type==="template")));n.forEach(i=>this.#i.set(i.identifier,i.value));let r=n.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.#r&&r&&this.#b(),this.updateComplete.then(()=>this.#v())}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#n;#i;#r;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let r=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);r&&(r.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),zn(this,"cito-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#h()})}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.#m),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#u)}#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.#m),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#m;#d;#u;async#h(){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.#r=!0,this.#b()}#b(){this.#e&&(this.#e.process(),this.#n={...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.#y();let n=this.querySelector("qti-response-processing"),r=!!(n&&typeof n.process=="function");return r&&n.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#g()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),r}resetResponses(){this._context=this.#n}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(n=>n.identifier!==t?n:{...n,value:e})},this.afterResponseVariableUpdated(),zn(this,"cito-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#g())}updateTemplateVariable(t,e){let n=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!n){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let r=n.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:r})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let n=this.getResponse(t);if(!n){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let r=n.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:r})},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 n=this.getOutcome(t);if(!n){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:n.cardinality==="single"||Array.isArray(e)?e:[e]})},zn(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(r=>r.identifier===t)?.value})}validate(t=!0){let e=this.interactionElements.every(n=>n.validate());return this.#f(e),t&&this.reportValidity(),e}#f(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#v(){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()}#g(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#y(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let r=("defaultValue"in t?t.defaultValue:null)??null;return r==null&&(t.baseType==="integer"||t.baseType==="float")&&(r="0"),{...t,value:r}})}}};ln([p({type:String})],gt.prototype,"identifier",void 0);ln([p({type:String})],gt.prototype,"adaptive",void 0);ln([p({type:String,attribute:"time-dependent"})],gt.prototype,"timeDependent",void 0);ln([p({type:String})],gt.prototype,"title",null);ln([p({type:Boolean})],gt.prototype,"disabled",void 0);ln([p({type:Boolean})],gt.prototype,"readonly",void 0);ln([H({context:F})],gt.prototype,"_context",void 0);var Pd=x`
76
76
  :host {
77
77
  display: contents;
78
78
  }
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
80
80
  ::slotted(qti-catalog-info) {
81
81
  display: none;
82
82
  }
83
- `;var ho=class extends k{static{this.styles=Od}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function Pd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let n=document.createComment(e.textContent);e.replaceChild(n,e.firstChild)})}async function Md(o,t,e,n="qti-portable-custom-interaction"){let r=[],i=o.querySelectorAll(n);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&&r.includes(d)&&(d=d+r.length,c.setAttribute("custom-interaction-type-identifier",d),r.push(d)),d&&r.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}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let q of y){let u=q.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],v=Array.isArray(g)?g[0]:g;if(q.setAttribute("primary-path",v),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?q.setAttribute("fallback-path",w[0]):q.setAttribute("fallback-path",w)}}}if(m.paths){for(let q in m.paths)if(!h.querySelector(`qti-interaction-module[id="${q}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",q);let v=Array.isArray(m.paths[q])?m.paths[q][0]:m.paths[q];if(g.setAttribute("primary-path",v),a&&a.paths&&a.paths[q]){let w=a.paths[q];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],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let q=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=q.map((v,w)=>{let T=u.length>w?u[w]:"";return{primaryPath:v,fallbackPath:T}});for(let v of u)g.some(w=>w.fallbackPath===v)||g.push({primaryPath:q.length>0?q[0]:v,fallbackPath:v});for(let v of g){let w=o.createElement("qti-interaction-module");v.fallbackPath&&w.setAttribute("fallback-path",v.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",v.primaryPath),h&&h.appendChild(w)}}}}}function Dd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=$d(i,s);i.replaceWith(a)})}function Nd(o,t){o.querySelectorAll("*").forEach(e=>{let n=e.classList;n&&n.forEach(r=>{if(r.startsWith(`${t}:`)){let i=r.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=$d(e,s);e.replaceWith(a)}})})}function $d(o,t){let e=o.ownerDocument.createElement(t);for(let n of o.attributes)e.setAttribute(n.name,n.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Ld(o,t){let e=["hook","module"],n=t.substring(0,t.lastIndexOf("/"));for(let r of e)o.querySelectorAll("["+r+"]").forEach(s=>{let a=s.getAttribute(r);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",n+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var kl=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=vm(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=bm(`${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 po(o){return kl.fromSeedKey(o)}function bm(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 zd(t)}function vm(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 zd(t)}function zd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var ym=o=>typeof o=="function"?o():o.random();function uo(o,t){let e=o.filter(r=>!r.fixed);for(let r=e.length-1;r>0;r--){let i=Math.floor(ym(t)*(r+1));[e[r],e[i]]=[e[i],e[r]]}let n=0;return o.map(r=>r.fixed?r:e[n++])}function wm(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 Cl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),n=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),r=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of n){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=wm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=r?po(`${t}:${i}:${l}:${f}`):Math.random;f++;let q=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(q.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=q[0].parentElement;if(!u||q.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=q[q.length-1].nextSibling,v=uo(q.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),y);for(let w of q)w.remove();for(let{element:w}of v)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function Vd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var jd=!1;function mo(o,t){jd||(jd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function xm(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 Fd(o,t){let n=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),r=n.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??n.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(r)throw new Error(t(xm(r)));return n}function Bn(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=>Fd(e,n=>`is not well-formed XML: ${n}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Un(o){return Fd(o,t=>`Failed to parse XML: ${t}`)}function Bd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let n=o,r;!n.namespaceURI||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?r=e?t.createElement(n.localName,{customElementRegistry:e}):t.createElement(n.localName):r=t.createElementNS(n.namespaceURI,n.tagName);for(let i=0;i<n.attributes.length;i++){let s=n.attributes[i];r.setAttribute(s.localName,s.value)}for(let i=0;i<n.childNodes.length;i++)r.appendChild(Bd(n.childNodes[i],t,e));return r}return o.cloneNode(!1)}function Hn(o,t){let e=document.createDocumentFragment();for(let n=0;n<o.childNodes.length;n++)e.appendChild(Bd(o.childNodes[n],document,t));return e}function Wn(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(n=>{for(let r of["src","href","srcset","poster"]){let i=n.getAttribute(r)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);n.setAttribute(r,s)}}})}var Kt=()=>{let o,t="",e={load(n,r){return t=n,Bn(n,r).then(i=>(o=i,e))},parse(n){return o=Un(n),t="",e},path:n=>(Wn(o,n),t=null,e),fn(n){return n(o),e},pciHooks(n){return Ld(o,n),e},async configurePci(n,r,i="qti-portable-custom-interaction"){return await Md(o,n,r,i),e},shuffleInteractions(n){let r=typeof n=="string"?n.trim():n;if(r==null||r===""){let i=t||"default-item-seed";return mo("qtiTransformItem",i),Cl(o,i),e}return Cl(o,r),e},extendElementName:(n,r)=>(Dd(o,n,r),e),extendElementsWithClass:(n="extend")=>(Nd(o,n),e),customInteraction(n,r){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",n),i.setAttribute("data-base-item",n+r),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return Pd(o),e},stripStyleSheets(){return Vd(o),e},html(){return t!==null&&Wn(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Hn(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return t!==null&&Wn(o,t.substring(0,t.lastIndexOf("/"))),Hn(o,n)},xmlDoc(){return o}};return e};var Ud=()=>{let o,t={async load(e,n){return o=await Bn(e,n),t},parse(e){o=Un(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Hd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let n=e.getAttribute("identifier"),r=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:n,href:r,category:i})}),t}var fo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Wd=o=>fo(o,"qti-assessment-item-ref","assessmentitemref"),Xi=o=>fo(o,"qti-assessment-section","assessmentsection"),Gi=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="true"||n==="1"}),qm=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="false"||n==="0"}),Sl=o=>fo(o,"qti-ordering","ordering"),km=o=>fo(o,"qti-selection","selection"),Cm=o=>Array.from(o.children).filter(t=>Sl(t)&&Gi(t,"shuffle")),Sm=(o,t)=>po(`${o}:${t}`);function Em(o){let t=[],e=[],n=r=>{for(let i of Array.from(r.children))Wd(i)?t.push(i):Xi(i)?n(i):!Sl(i)&&!km(i)&&e.push(i.localName)};return n(o),{itemRefs:t,dropped:e}}function Am(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 Qd(o,t){for(let l of Array.from(o.children))Xi(l)&&Qd(l,t);let e=Cm(o);if(e.length===0)return;let n=[],r=[];for(let l of Array.from(o.children))if(Wd(l))n.push({nodes:[l],fixed:Gi(l,"fixed")}),r.push(l);else if(Xi(l)){let{itemRefs:c,dropped:d}=Em(l);if(Am(l,d),qm(l,"keep-together","keeptogether"))for(let h of c)n.push({nodes:[h],fixed:Gi(h,"fixed")});else c.length>0&&n.push({nodes:c,fixed:Gi(l,"fixed")});r.push(l)}let i=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=uo(n,Sm(t,s));for(let l of r)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 Gd(o){return Array.from(o.getElementsByTagName("*")).some(t=>Sl(t)&&Gi(t,"shuffle"))}function El(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(n=>Xi(n));for(let n of e){if(!n.parentNode)continue;let r=n.parentElement;r&&Xi(r)||Qd(n,t)}}var Qn=()=>{let o,t="",e={async load(n,r){return o=await Bn(n,r),t=n,e.path(n.substring(0,n.lastIndexOf("/"))),e},parse(n){return o=Un(n),t="",e},path:n=>(Wn(o,n),e),fn(n){return n(o),e},shuffleOrdering(n){if(!Gd(o))return e;let r=typeof n=="string"?n.trim():n;if(r==null||r===""){let i=t||"default-test-seed";return mo("qtiTransformTest",i),El(o,i),e}return El(o,r),e},items(){return Hd(o)},html(){return new XMLSerializer().serializeToString(Hn(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return Hn(o,n)},xmlDoc(){return o}};return e};var Xd=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Al=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}},Gn=class extends k{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Al(this,t);this.dispatchEvent(e);let n=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&n&&await this.updateStimulusRef(n)}async updateStimulusRef(t){let n=(await Kt().load(this.href).then(r=>r.htmlDoc()))?.querySelector("qti-assessment-stimulus");n&&(t.innerHTML="",t.append(n))}};Xd([p({type:String})],Gn.prototype,"identifier",void 0);Xd([p({type:String})],Gn.prototype,"href",void 0);var go=class extends k{};var Tm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Yi=class extends k{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(r=>r.type==="template");for(let r of e){let i=r;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let n=Array.from(this.querySelectorAll("*")).filter(r=>r.localName.toLowerCase()==="mi"||r.localName.toLowerCase()==="mn");for(let r of n){let i=r.getAttribute("data-qti-math-variable-source")??r.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(r.localName.toLowerCase()==="mn"){r.textContent=s,r.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),r.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Tm([I({context:F,subscribe:!0}),_()],Yi.prototype,"context",void 0);var Yd=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Xn=class extends k{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[x`
83
+ `;var po=class extends k{static{this.styles=Pd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function Md(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let n=document.createComment(e.textContent);e.replaceChild(n,e.firstChild)})}async function Dd(o,t,e,n="qti-portable-custom-interaction"){let r=[],i=o.querySelectorAll(n);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&&r.includes(d)&&(d=d+r.length,c.setAttribute("custom-interaction-type-identifier",d),r.push(d)),d&&r.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}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let q of y){let u=q.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],v=Array.isArray(g)?g[0]:g;if(q.setAttribute("primary-path",v),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?q.setAttribute("fallback-path",w[0]):q.setAttribute("fallback-path",w)}}}if(m.paths){for(let q in m.paths)if(!h.querySelector(`qti-interaction-module[id="${q}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",q);let v=Array.isArray(m.paths[q])?m.paths[q][0]:m.paths[q];if(g.setAttribute("primary-path",v),a&&a.paths&&a.paths[q]){let w=a.paths[q];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],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let q=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=q.map((v,w)=>{let T=u.length>w?u[w]:"";return{primaryPath:v,fallbackPath:T}});for(let v of u)g.some(w=>w.fallbackPath===v)||g.push({primaryPath:q.length>0?q[0]:v,fallbackPath:v});for(let v of g){let w=o.createElement("qti-interaction-module");v.fallbackPath&&w.setAttribute("fallback-path",v.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",v.primaryPath),h&&h.appendChild(w)}}}}}function Nd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=Ld(i,s);i.replaceWith(a)})}function $d(o,t){o.querySelectorAll("*").forEach(e=>{let n=e.classList;n&&n.forEach(r=>{if(r.startsWith(`${t}:`)){let i=r.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=Ld(e,s);e.replaceWith(a)}})})}function Ld(o,t){let e=o.ownerDocument.createElement(t);for(let n of o.attributes)e.setAttribute(n.name,n.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function zd(o,t){let e=["hook","module"],n=t.substring(0,t.lastIndexOf("/"));for(let r of e)o.querySelectorAll("["+r+"]").forEach(s=>{let a=s.getAttribute(r);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",n+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Cl=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=ym(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=vm(`${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 uo(o){return Cl.fromSeedKey(o)}function vm(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 Vd(t)}function ym(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 Vd(t)}function Vd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var wm=o=>typeof o=="function"?o():o.random();function mo(o,t){let e=o.filter(r=>!r.fixed);for(let r=e.length-1;r>0;r--){let i=Math.floor(wm(t)*(r+1));[e[r],e[i]]=[e[i],e[r]]}let n=0;return o.map(r=>r.fixed?r:e[n++])}function xm(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"]'),n=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),r=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of n){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=xm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=r?uo(`${t}:${i}:${l}:${f}`):Math.random;f++;let q=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(q.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=q[0].parentElement;if(!u||q.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=q[q.length-1].nextSibling,v=mo(q.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),y);for(let w of q)w.remove();for(let{element:w}of v)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function jd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Fd=!1;function fo(o,t){Fd||(Fd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function qm(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 Bd(o,t){let n=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),r=n.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??n.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(r)throw new Error(t(qm(r)));return n}function Bn(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=>Bd(e,n=>`is not well-formed XML: ${n}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Un(o){return Bd(o,t=>`Failed to parse XML: ${t}`)}function Ud(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let n=o,r;!n.namespaceURI||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?r=e?t.createElement(n.localName,{customElementRegistry:e}):t.createElement(n.localName):r=t.createElementNS(n.namespaceURI,n.tagName);for(let i=0;i<n.attributes.length;i++){let s=n.attributes[i];r.setAttribute(s.localName,s.value)}for(let i=0;i<n.childNodes.length;i++)r.appendChild(Ud(n.childNodes[i],t,e));return r}return o.cloneNode(!1)}function Hn(o,t){let e=document.createDocumentFragment();for(let n=0;n<o.childNodes.length;n++)e.appendChild(Ud(o.childNodes[n],document,t));return e}function Wn(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(n=>{for(let r of["src","href","srcset","poster"]){let i=n.getAttribute(r)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);n.setAttribute(r,s)}}})}var Kt=()=>{let o,t="",e={load(n,r){return t=n,Bn(n,r).then(i=>(o=i,e))},parse(n){return o=Un(n),t="",e},path:n=>(Wn(o,n),t=null,e),fn(n){return n(o),e},pciHooks(n){return zd(o,n),e},async configurePci(n,r,i="qti-portable-custom-interaction"){return await Dd(o,n,r,i),e},shuffleInteractions(n){let r=typeof n=="string"?n.trim():n;if(r==null||r===""){let i=t||"default-item-seed";return fo("qtiTransformItem",i),Sl(o,i),e}return Sl(o,r),e},extendElementName:(n,r)=>(Nd(o,n,r),e),extendElementsWithClass:(n="extend")=>($d(o,n),e),customInteraction(n,r){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",n),i.setAttribute("data-base-item",n+r),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return Md(o),e},stripStyleSheets(){return jd(o),e},html(){return t!==null&&Wn(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Hn(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return t!==null&&Wn(o,t.substring(0,t.lastIndexOf("/"))),Hn(o,n)},xmlDoc(){return o}};return e};var Hd=()=>{let o,t={async load(e,n){return o=await Bn(e,n),t},parse(e){o=Un(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Wd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let n=e.getAttribute("identifier"),r=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:n,href:r,category:i})}),t}var go=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Qd=o=>go(o,"qti-assessment-item-ref","assessmentitemref"),Xi=o=>go(o,"qti-assessment-section","assessmentsection"),Gi=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="true"||n==="1"}),km=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="false"||n==="0"}),El=o=>go(o,"qti-ordering","ordering"),Cm=o=>go(o,"qti-selection","selection"),Sm=o=>Array.from(o.children).filter(t=>El(t)&&Gi(t,"shuffle")),Em=(o,t)=>uo(`${o}:${t}`);function Am(o){let t=[],e=[],n=r=>{for(let i of Array.from(r.children))Qd(i)?t.push(i):Xi(i)?n(i):!El(i)&&!Cm(i)&&e.push(i.localName)};return n(o),{itemRefs:t,dropped:e}}function Tm(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 Gd(o,t){for(let l of Array.from(o.children))Xi(l)&&Gd(l,t);let e=Sm(o);if(e.length===0)return;let n=[],r=[];for(let l of Array.from(o.children))if(Qd(l))n.push({nodes:[l],fixed:Gi(l,"fixed")}),r.push(l);else if(Xi(l)){let{itemRefs:c,dropped:d}=Am(l);if(Tm(l,d),km(l,"keep-together","keeptogether"))for(let h of c)n.push({nodes:[h],fixed:Gi(h,"fixed")});else c.length>0&&n.push({nodes:c,fixed:Gi(l,"fixed")});r.push(l)}let i=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=mo(n,Em(t,s));for(let l of r)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 Xd(o){return Array.from(o.getElementsByTagName("*")).some(t=>El(t)&&Gi(t,"shuffle"))}function Al(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(n=>Xi(n));for(let n of e){if(!n.parentNode)continue;let r=n.parentElement;r&&Xi(r)||Gd(n,t)}}var Qn=()=>{let o,t="",e={async load(n,r){return o=await Bn(n,r),t=n,e.path(n.substring(0,n.lastIndexOf("/"))),e},parse(n){return o=Un(n),t="",e},path:n=>(Wn(o,n),e),fn(n){return n(o),e},shuffleOrdering(n){if(!Xd(o))return e;let r=typeof n=="string"?n.trim():n;if(r==null||r===""){let i=t||"default-test-seed";return fo("qtiTransformTest",i),Al(o,i),e}return Al(o,r),e},items(){return Wd(o)},html(){return new XMLSerializer().serializeToString(Hn(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return Hn(o,n)},xmlDoc(){return o}};return e};var Yd=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Tl=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}},Gn=class extends k{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Tl(this,t);this.dispatchEvent(e);let n=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&n&&await this.updateStimulusRef(n)}async updateStimulusRef(t){let n=(await Kt().load(this.href).then(r=>r.htmlDoc()))?.querySelector("qti-assessment-stimulus");n&&(t.innerHTML="",t.append(n))}};Yd([p({type:String})],Gn.prototype,"identifier",void 0);Yd([p({type:String})],Gn.prototype,"href",void 0);var bo=class extends k{};var Im=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Yi=class extends k{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(r=>r.type==="template");for(let r of e){let i=r;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let n=Array.from(this.querySelectorAll("*")).filter(r=>r.localName.toLowerCase()==="mi"||r.localName.toLowerCase()==="mn");for(let r of n){let i=r.getAttribute("data-qti-math-variable-source")??r.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(r.localName.toLowerCase()==="mn"){r.textContent=s,r.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),r.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Im([I({context:F,subscribe:!0}),_()],Yi.prototype,"context",void 0);var Jd=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Xn=class extends k{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[x`
84
84
  :host {
85
85
  display: none;
86
86
  }
87
- `]}render(){return b`<slot></slot>`}};Yd([p({type:String})],Xn.prototype,"identifier",void 0);Yd([p({type:String})],Xn.prototype,"cardinality",void 0);var Im=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ji=class extends k{#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:r=>this._context?.variables.find(i=>i.identifier===r)?.value??"",correct:r=>this._context?.variables.find(i=>i.identifier===r)?.correctResponse??""},n={getVariable:r=>this._context?.variables.find(i=>i.identifier===r),updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.#t(this._context,e,n)}#e(t){let e=Sd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let n=Array.from(this.children).map(r=>{let i=r.calculate;return typeof i=="function"?i.call(r):null});return e(n)}};Im([I({context:F,subscribe:!0}),_()],Ji.prototype,"_context",void 0);var bo=class extends ft{static{this.styles=x`
87
+ `]}render(){return b`<slot></slot>`}};Jd([p({type:String})],Xn.prototype,"identifier",void 0);Jd([p({type:String})],Xn.prototype,"cardinality",void 0);var _m=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ji=class extends k{#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:r=>this._context?.variables.find(i=>i.identifier===r)?.value??"",correct:r=>this._context?.variables.find(i=>i.identifier===r)?.correctResponse??""},n={getVariable:r=>this._context?.variables.find(i=>i.identifier===r),updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.#t(this._context,e,n)}#e(t){let e=Ed(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let n=Array.from(this.children).map(r=>{let i=r.calculate;return typeof i=="function"?i.call(r):null});return e(n)}};_m([I({context:F,subscribe:!0}),_()],Ji.prototype,"_context",void 0);var vo=class extends ft{static{this.styles=x`
88
88
  :host {
89
89
  display: block;
90
90
  }
@@ -94,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
94
94
  .off {
95
95
  display: none;
96
96
  }
97
- `}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Z=o=>o??P;var vo=class extends ft{constructor(){super(...arguments),this.render=()=>b` <slot part="feedback" class="${Z(this.showStatus)}"></slot> `}static{this.styles=x`
97
+ `}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Z=o=>o??P;var yo=class extends ft{constructor(){super(...arguments),this.render=()=>b` <slot part="feedback" class="${Z(this.showStatus)}"></slot> `}static{this.styles=x`
98
98
  .on {
99
99
  display: inline-block;
100
100
  }
101
101
  .off {
102
102
  display: none;
103
103
  }
104
- `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Jd=x`
104
+ `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Kd=x`
105
105
  :host {
106
106
  display: block;
107
107
  }
108
- `;var yo=class extends k{static{this.styles=Jd}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Yn=class extends ft{static{this.styles=x`
108
+ `;var wo=class extends k{static{this.styles=Kd}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Yn=class extends ft{static{this.styles=x`
109
109
  .cito-dialog {
110
110
  background: var(--qti-bg);
111
111
  border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
@@ -154,11 +154,11 @@ Make sure to test your application with a production build as repeat registratio
154
154
  :host {
155
155
  display: none;
156
156
  }
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 n of t.querySelectorAll("qti-interpolation-table-entry")){let r=parseFloat(n.getAttribute("source-value")),i=parseFloat(n.getAttribute("target-value"));if(Number.isNaN(r)||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:r,targetValue:i,includeBoundary:n.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 n of t.querySelectorAll("qti-match-table-entry")){let r=parseFloat(n.getAttribute("source-value")),i=n.getAttribute("target-value");if(Number.isNaN(r)||i===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(r,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}}))}};Ki([p({type:String,attribute:"base-type"})],de.prototype,"baseType",void 0);Ki([p({type:String,attribute:"external-scored"})],de.prototype,"externalScored",void 0);Ki([p({type:String})],de.prototype,"identifier",void 0);Ki([p({type:String})],de.prototype,"cardinality",void 0);Ki([I({context:F,subscribe:!0}),_()],de.prototype,"itemContext",void 0);var wo=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},_e=class extends Nn{static{this.styles=[x`
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 n of t.querySelectorAll("qti-interpolation-table-entry")){let r=parseFloat(n.getAttribute("source-value")),i=parseFloat(n.getAttribute("target-value"));if(Number.isNaN(r)||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:r,targetValue:i,includeBoundary:n.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 n of t.querySelectorAll("qti-match-table-entry")){let r=parseFloat(n.getAttribute("source-value")),i=n.getAttribute("target-value");if(Number.isNaN(r)||i===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(r,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}}))}};Ki([p({type:String,attribute:"base-type"})],de.prototype,"baseType",void 0);Ki([p({type:String,attribute:"external-scored"})],de.prototype,"externalScored",void 0);Ki([p({type:String})],de.prototype,"identifier",void 0);Ki([p({type:String})],de.prototype,"cardinality",void 0);Ki([I({context:F,subscribe:!0}),_()],de.prototype,"itemContext",void 0);var xo=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},_e=class extends Nn{static{this.styles=[x`
158
158
  :host {
159
159
  display: none;
160
160
  }
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.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:n}=this.#t(),r={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...n?{fieldBaseTypes:n}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};r.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:r}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#n};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:n,baseTypes:r}=Wi(e);return e.forEach(i=>i.remove()),{correctResponse:Object.keys(n).length?n:void 0,fieldBaseTypes:r}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Wi(t);return Object.keys(e).length?e:null}get#n(){let t,e=this.querySelector("qti-correct-response");if(e){let n=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&n.length>0)t=n[0].textContent.trim(),n[0].remove();else if(this.cardinality!=="single"){t=[];for(let r=0;r<n.length;r++)t.push(n[r].textContent.trim()),n[r].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),n=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(n)?null:n,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,n=parseFloat(t?.getAttribute("lower-bound")),r=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(n)?null:n,upperBound:isNaN(r)?null:r,areaMapEntries:i}}};wo([p({type:String,attribute:"base-type"})],_e.prototype,"baseType",void 0);wo([p({type:String})],_e.prototype,"identifier",void 0);wo([p({type:String})],_e.prototype,"cardinality",void 0);wo([I({context:F,subscribe:!0}),_()],_e.prototype,"itemContext",void 0);var Kd=`<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.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:n}=this.#t(),r={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...n?{fieldBaseTypes:n}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};r.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:r}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#n};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:n,baseTypes:r}=Wi(e);return e.forEach(i=>i.remove()),{correctResponse:Object.keys(n).length?n:void 0,fieldBaseTypes:r}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Wi(t);return Object.keys(e).length?e:null}get#n(){let t,e=this.querySelector("qti-correct-response");if(e){let n=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&n.length>0)t=n[0].textContent.trim(),n[0].remove();else if(this.cardinality!=="single"){t=[];for(let r=0;r<n.length;r++)t.push(n[r].textContent.trim()),n[r].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),n=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(n)?null:n,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,n=parseFloat(t?.getAttribute("lower-bound")),r=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(n)?null:n,upperBound:isNaN(r)?null:r,areaMapEntries:i}}};xo([p({type:String,attribute:"base-type"})],_e.prototype,"baseType",void 0);xo([p({type:String})],_e.prototype,"identifier",void 0);xo([p({type:String})],_e.prototype,"cardinality",void 0);xo([I({context:F,subscribe:!0}),_()],_e.prototype,"itemContext",void 0);var Zd=`<qti-response-condition>
162
162
  <qti-response-if>
163
163
  <qti-match>
164
164
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -173,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
173
173
  <qti-base-value base-type="float">0</qti-base-value>
174
174
  </qti-set-outcome-value>
175
175
  </qti-response-else>
176
- </qti-response-condition>`,Zd=`<qti-response-condition>
176
+ </qti-response-condition>`,th=`<qti-response-condition>
177
177
  <qti-response-if>
178
178
  <qti-is-null>
179
179
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -187,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
187
187
  <qti-map-response identifier="RESPONSE"> </qti-map-response>
188
188
  </qti-set-outcome-value>
189
189
  </qti-response-else>
190
- </qti-response-condition>`,th=`<qti-response-condition>
190
+ </qti-response-condition>`,eh=`<qti-response-condition>
191
191
  <qti-response-if>
192
192
  <qti-is-null>
193
193
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -201,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
201
201
  <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
202
202
  </qti-set-outcome-value>
203
203
  </qti-response-else>
204
- </qti-response-condition>`;var _m={map_response:Zd,map_response_point:th,match_correct:Kd},xo=class extends k{static{this.styles=[x`
204
+ </qti-response-condition>`;var Rm={map_response:th,map_response_point:eh,match_correct:Zd},qo=class extends k{static{this.styles=[x`
205
205
  :host {
206
206
  display: none;
207
207
  }
208
- `]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let n of e)n.process()}catch(n){if(!(n instanceof $n))throw n}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let n=e.split("/").pop().replace(".xml",""),r=_m[n];r&&(this.innerHTML=r)}};function z(o,t){let e={waitUntilFirstUpdate:!1,...t};return(n,r)=>{let{update:i}=n,s=Array.isArray(o)?o:[o];n.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[r](d,h)}}),i.call(this,a)}}}var Jn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Nt=o=>(...t)=>({_$litDirective$:o,values:t}),Re=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Rm}=ot,eh=o=>o,ih=o=>o===null||typeof o!="object"&&typeof o!="function";var rh=o=>o.strings===void 0,nh=()=>document.createComment(""),Kn=(o,t,e)=>{let n=o._$AA.parentNode,r=t===void 0?o._$AB:t._$AA;if(e===void 0){let i=n.insertBefore(nh(),r),s=n.insertBefore(nh(),r);e=new Rm(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!==r||a){let l=e._$AA;for(;l!==i;){let c=eh(l).nextSibling;eh(n).insertBefore(l,r),l=c}}}return e},Oe=(o,t,e=o)=>(o._$AI(t,e),o),Om={},oh=(o,t=Om)=>o._$AH=t,sh=o=>o._$AH,qo=o=>{o._$AR(),o._$AA.remove()};var Zi=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let n of e)n._$AO?.(t,!1),Zi(n,t);return!0},ko=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},ah=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),Dm(t)}};function Pm(o){this._$AN!==void 0?(ko(this),this._$AM=o,ah(this)):this._$AM=o}function Mm(o,t=!1,e=0){let n=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(n))for(let i=e;i<n.length;i++)Zi(n[i],!1),ko(n[i]);else n!=null&&(Zi(n,!1),ko(n));else Zi(this,o)}var Dm=o=>{o.type==Jn.CHILD&&(o._$AP??=Mm,o._$AQ??=Pm)},Pe=class extends Re{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),ah(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Zi(this,t),ko(this))}setValue(t){if(rh(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 Tl=class extends Pe{constructor(){super(...arguments),this.prevData={}}render(t){return P}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},P}apply(t){let e=this.#t(t),{prevData:n,element:r}=this;for(let i in e){let s=e[i];s!==n[i]&&(s===!0?r.setAttribute(i,""):s===!1?r.removeAttribute(i):s!=null?r.setAttribute(i,String(s)):r.removeAttribute(i))}}groom(t){let{prevData:e,element:n}=this;if(!e)return;let r=t?this.#t(t):{};for(let i in e)(!r||!(i in r))&&n.removeAttribute(i)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>typeof n=="function"?!1:e==="max-choices"&&n===0?!0:!(n===""||n===null||n===void 0)))}},A0=Nt(Tl);var tr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},he=class extends k{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!zn(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=x`
208
+ `]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let n of e)n.process()}catch(n){if(!(n instanceof $n))throw n}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let n=e.split("/").pop().replace(".xml",""),r=Rm[n];r&&(this.innerHTML=r)}};function z(o,t){let e={waitUntilFirstUpdate:!1,...t};return(n,r)=>{let{update:i}=n,s=Array.isArray(o)?o:[o];n.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[r](d,h)}}),i.call(this,a)}}}var Jn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Nt=o=>(...t)=>({_$litDirective$:o,values:t}),Re=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Om}=ot,nh=o=>o,rh=o=>o===null||typeof o!="object"&&typeof o!="function";var oh=o=>o.strings===void 0,ih=()=>document.createComment(""),Kn=(o,t,e)=>{let n=o._$AA.parentNode,r=t===void 0?o._$AB:t._$AA;if(e===void 0){let i=n.insertBefore(ih(),r),s=n.insertBefore(ih(),r);e=new Om(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!==r||a){let l=e._$AA;for(;l!==i;){let c=nh(l).nextSibling;nh(n).insertBefore(l,r),l=c}}}return e},Oe=(o,t,e=o)=>(o._$AI(t,e),o),Pm={},sh=(o,t=Pm)=>o._$AH=t,ah=o=>o._$AH,ko=o=>{o._$AR(),o._$AA.remove()};var Zi=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let n of e)n._$AO?.(t,!1),Zi(n,t);return!0},Co=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},lh=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),Nm(t)}};function Mm(o){this._$AN!==void 0?(Co(this),this._$AM=o,lh(this)):this._$AM=o}function Dm(o,t=!1,e=0){let n=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(n))for(let i=e;i<n.length;i++)Zi(n[i],!1),Co(n[i]);else n!=null&&(Zi(n,!1),Co(n));else Zi(this,o)}var Nm=o=>{o.type==Jn.CHILD&&(o._$AP??=Dm,o._$AQ??=Mm)},Pe=class extends Re{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),lh(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Zi(this,t),Co(this))}setValue(t){if(oh(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 Il=class extends Pe{constructor(){super(...arguments),this.prevData={}}render(t){return P}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},P}apply(t){let e=this.#t(t),{prevData:n,element:r}=this;for(let i in e){let s=e[i];s!==n[i]&&(s===!0?r.setAttribute(i,""):s===!1?r.removeAttribute(i):s!=null?r.setAttribute(i,String(s)):r.removeAttribute(i))}}groom(t){let{prevData:e,element:n}=this;if(!e)return;let r=t?this.#t(t):{};for(let i in e)(!r||!(i in r))&&n.removeAttribute(i)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>typeof n=="function"?!1:e==="max-choices"&&n===0?!0:!(n===""||n===null||n===void 0)))}},_0=Nt(Il);var tr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},he=class extends k{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!zn(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=x`
209
209
  :host {
210
210
  display: block;
211
211
  }
212
- `}render(){return b`<slot></slot>`}};tr([p({type:String})],he.prototype,"id",void 0);tr([p({type:String})],he.prototype,"use",void 0);tr([p({type:String})],he.prototype,"view",void 0);tr([p({type:String,attribute:"class"})],he.prototype,"classNames",void 0);tr([z("classNames",{waitUntilFirstUpdate:!0})],he.prototype,"handleclassNamesChange",null);var Co=class extends k{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(n=>n.text()).then(n=>{let r=this.#e(n);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.")}).catch(n=>{console.error("Failed to load stylesheet:",n)}),this.textContent!==null&&this.textContent.trim()!==""){let n=this.#e(this.textContent);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.")}}#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 So=class extends k{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 er=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pe=class extends k{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[x`
212
+ `}render(){return b`<slot></slot>`}};tr([p({type:String})],he.prototype,"id",void 0);tr([p({type:String})],he.prototype,"use",void 0);tr([p({type:String})],he.prototype,"view",void 0);tr([p({type:String,attribute:"class"})],he.prototype,"classNames",void 0);tr([z("classNames",{waitUntilFirstUpdate:!0})],he.prototype,"handleclassNamesChange",null);var So=class extends k{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(n=>n.text()).then(n=>{let r=this.#e(n);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.")}).catch(n=>{console.error("Failed to load stylesheet:",n)}),this.textContent!==null&&this.textContent.trim()!==""){let n=this.#e(this.textContent);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.")}}#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 Eo=class extends k{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 er=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pe=class extends k{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[x`
213
213
  :host {
214
214
  display: none;
215
215
  }
216
- `]}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.#n(e)}#n(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}}};er([p({type:String})],pe.prototype,"identifier",void 0);er([p({type:String})],pe.prototype,"cardinality",void 0);er([p({type:String,attribute:"base-type"})],pe.prototype,"baseType",void 0);er([p({type:Boolean,attribute:"math-variable"})],pe.prototype,"mathVariable",void 0);er([p({type:Boolean,attribute:"param-variable"})],pe.prototype,"paramVariable",void 0);var Eo=class extends k{static{this.styles=[x`
216
+ `]}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.#n(e)}#n(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}}};er([p({type:String})],pe.prototype,"identifier",void 0);er([p({type:String})],pe.prototype,"cardinality",void 0);er([p({type:String,attribute:"base-type"})],pe.prototype,"baseType",void 0);er([p({type:Boolean,attribute:"math-variable"})],pe.prototype,"mathVariable",void 0);er([p({type:Boolean,attribute:"param-variable"})],pe.prototype,"paramVariable",void 0);var Ao=class extends k{static{this.styles=[x`
217
217
  :host {
218
218
  display: none;
219
219
  }
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,n=!1;do{if(n=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let r=[...this.children];for(let i of r)if(i.tagName.toLowerCase()==="qti-template-constraint"){if(i.calculate()===!1){n=!0;break}}else i.process()}catch(r){console.error("Error during template processing:",r);break}}while(n);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 lh=[{tag:"qti-assessment-item",ctor:gt},{tag:"qti-assessment-stimulus",ctor:ho},{tag:"qti-assessment-stimulus-ref",ctor:Gn},{tag:"qti-companion-materials-info",ctor:go},{tag:"qti-content-body",ctor:Yi},{tag:"qti-context-declaration",ctor:Xn},{tag:"qti-custom-operator",ctor:Ji},{tag:"qti-feedback-block",ctor:bo},{tag:"qti-feedback-inline",ctor:vo},{tag:"qti-item-body",ctor:yo},{tag:"qti-modal-feedback",ctor:Yn},{tag:"qti-outcome-declaration",ctor:de},{tag:"qti-response-declaration",ctor:_e},{tag:"qti-response-processing",ctor:xo},{tag:"qti-rubric-block",ctor:he},{tag:"qti-stylesheet",ctor:Co},{tag:"qti-template-constraint",ctor:So},{tag:"qti-template-declaration",ctor:pe},{tag:"qti-template-processing",ctor:Eo}];var Nm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},nr=class extends Yn{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=x`
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,n=!1;do{if(n=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let r=[...this.children];for(let i of r)if(i.tagName.toLowerCase()==="qti-template-constraint"){if(i.calculate()===!1){n=!0;break}}else i.process()}catch(r){console.error("Error during template processing:",r);break}}while(n);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 ch=[{tag:"qti-assessment-item",ctor:gt},{tag:"qti-assessment-stimulus",ctor:po},{tag:"qti-assessment-stimulus-ref",ctor:Gn},{tag:"qti-companion-materials-info",ctor:bo},{tag:"qti-content-body",ctor:Yi},{tag:"qti-context-declaration",ctor:Xn},{tag:"qti-custom-operator",ctor:Ji},{tag:"qti-feedback-block",ctor:vo},{tag:"qti-feedback-inline",ctor:yo},{tag:"qti-item-body",ctor:wo},{tag:"qti-modal-feedback",ctor:Yn},{tag:"qti-outcome-declaration",ctor:de},{tag:"qti-response-declaration",ctor:_e},{tag:"qti-response-processing",ctor:qo},{tag:"qti-rubric-block",ctor:he},{tag:"qti-stylesheet",ctor:So},{tag:"qti-template-constraint",ctor:Eo},{tag:"qti-template-declaration",ctor:pe},{tag:"qti-template-processing",ctor:Ao}];var $m=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},nr=class extends Yn{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=x`
221
221
  :host {
222
222
  color: gray;
223
223
  }
224
- `}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return b``}};Nm([p({type:String})],nr.prototype,"access",void 0);var Ao=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Me=class extends k{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>`}};Ao([p({type:String})],Me.prototype,"identifier",void 0);Ao([p({type:String})],Me.prototype,"class",void 0);Ao([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);Ao([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);var $m=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ir=class extends E{#t=null;constructor(){super(),B(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")??"",n=this.getAttribute("variable-identifier"),r=Fn(t,jn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Il(this._testContext,n,r).calculate()}calculate(){return this.getResult()}};$m([I({context:at,subscribe:!0})],ir.prototype,"_testContext",void 0);var Il=class{constructor(t,e,n){this.testContext=t,this.itemVariable=e,this.includedItems=n}calculate(){let t=this.testContext?.items??[],e=0,n=[...new Set(this.includedItems.map(r=>r.item))];return t.forEach(r=>{if(n.includes(r.identifier)){let i=r.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===r.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var rr="qti-assessment-section",To="qti-test-part",$t=o=>o.identifier||o.getAttribute("identifier")||"";function ch(o,t){let e=o[t],n=t+1,r=Lm(e,o,t);if(r){let s=zm(r,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map($t)};s>t?n=s:console.warn(`qti-branch-rule target "${r.target}" is not ahead of "${$t(e)}", ignored`)}let i=o.slice(t+1,n).map($t);for(let s=n;s<o.length;s++){if(hh(o[s],e))return{id:$t(o[s]),skipped:i};i.push($t(o[s]))}return{id:null,skipped:i}}function dh(o){let t=[];for(let e of o){if(hh(e,null))return{id:$t(e),skipped:t};t.push($t(e))}return{id:null,skipped:t}}function Lm(o,t,e){let n=[o];for(let r=o.parentElement;r&&(r.localName===rr||r.localName===To)&&!r.contains(t[e+1]??null);r=r.parentElement)n.push(r);for(let r of n)for(let i of r.querySelectorAll(":scope > qti-branch-rule"))if(i.evaluate?.())return i;return null}function zm(o,t,e){let n=o.parentElement,r=i=>{if(!i)return null;let s=t.findLastIndex(a=>i.contains(a));return s+1<t.length?s+1:null};switch(o.target){case ce.EXIT_TEST:return null;case ce.EXIT_TESTPART:return r(n.closest(To));case ce.EXIT_SECTION:{let i=n.localName===rr?n:n.closest(rr);return r(i??n)}default:{let i=t.findIndex(l=>$t(l)===o.target);if(i>=0)return i;let s=[...n.closest("qti-assessment-test")?.querySelectorAll(`${rr}, ${To}`)??[]].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 hh(o,t){let e=[o];for(let n=o.parentElement;n&&(n.localName===rr||n.localName===To);n=n.parentElement)(!t||!n.contains(t))&&e.push(n);return e.every(n=>[...n.querySelectorAll(":scope > qti-pre-condition")].every(r=>r.evaluate?.()??!0))}var Io=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ph=o=>{class t extends o{constructor(...n){super(...n),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(n,r){let i=r||this._getDefaultNavigationId(n);i&&$(this,"cito-test-navigate",{type:n,id:i})}_bindEventHandlers(){B(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),B(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(n){this._testElement=n.detail,this._initializeNavigation()}_handleItemConnected(n){let r=n.detail;this._loadingState.connectedItems++;let i=r.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(n){n.preventDefault();let{element:r,item:i}=n;if(console.info("Stimulus ref connected:",{identifier:r.identifier,href:r.href,item:i.identifier}),this._loadedStimulusHrefs.has(r.href)){console.info("Stimulus already loaded, skipping:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(r.href)){console.info("Stimulus already loading, skipping duplicate:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(r.href),console.info("Starting stimulus load:",r.href);try{await this._loadStimulusRef(r,i),this._loadedStimulusHrefs.add(r.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",r.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${r.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(r.href)}}_getDefaultNavigationId(n){return n==="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 n=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(r[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let i=dh(r);if(i.skipped.length&&$(this,"cito-test-items-skipped",{ids:i.skipped}),i.id===null){$(this,"cito-test-end-reached",{});return}n=i.id}}n&&this.navigateTo(this.navigate,n)}_isLinearNavigationRestricted(n,r){let i=this.sessionContext?.navItemRefId;if(!i||n==="item"&&r===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(n==="item"){let f=d.findIndex(m=>m.identifier===r);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(n,r){if(n!=="item"||!this._testElement)return;let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=i.findIndex(l=>$t(l)===this.sessionContext?.navItemRefId);if(s<0||!i[s+1]||$t(i[s+1])!==r||i[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=ch(i,s);if(a.id!==r)return a}async _handleNavigationRequest({detail:n}){if(!n?.id)return;let r=this._resolveLinearNext(n.type,n.id);if(r?.id===null){r.skipped.length&&$(this,"cito-test-items-skipped",{ids:r.skipped}),$(this,"cito-test-end-reached",{});return}let i=r?.id??n.id;if(!r&&this._isLinearNavigationRestricted(n.type,i)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),n.type,n.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(n.type,i),this._activeController=a,await this._executeNavigation(n.type,i,s,a),r?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&$(this,"cito-test-items-skipped",{ids:r.skipped})}catch(l){this._handleNavigationError(l,n.type,i)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(n.type,i)}}_handleNavigationError(n,r,i){n.name!=="AbortError"&&this._dispatchError(this._createNavigationError(n,r,i))}async _executeNavigation(n,r,i,s){n==="item"?await this._navigateToItem(r,i,s):await this._navigateToSection(r,i,s)}async _navigateToItem(n,r,i){let s=this._findItemRef(n);this._updateSessionContext(s,n),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([n],r,i),await this._waitForLoadingComplete(r,i),!this._isStaleNavigation(r,i)&&this._dispatchTestLoaded(this._loadResults,"item",n)}async _navigateToSection(n,r,i){let a=this._findSection(n)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(n);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:n,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,r,i),await this._waitForLoadingComplete(r,i),!this._isStaleNavigation(r,i)&&this._dispatchTestLoaded(this._loadResults,"section",n)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let n=this._loadingState.connectedItems>=this._loadingState.expectedItems,r=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;n&&r&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(n,r){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(n,r))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(n,r){console.info("Loading stimulus:",n.href);let i=await this._loadStimulus(n.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,n,r)}_applyStimulusContent(n,r,i){if(!n){console.warn("No stimulus content to apply");return}let s=n.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="${r.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${r.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(n,r,i){if(!this._testElement||n.length===0)return;let s=n.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,r,i)))).filter(Boolean);this._isStaleNavigation(r,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(n,r,i){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Kt().load(n.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,n)),this._isStaleNavigation(r,i)?null:{itemRef:n,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${n.identifier} was aborted`),s;return console.warn(`Failed to load item ${n.identifier}:`,s),null}}async _loadStimulus(n){return(await Kt().load(n,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let n=this.querySelector("test-container");if(n)return n.customElementRegistry??void 0}_findItemRef(n){let r=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!r)throw new Error(`Item with identifier "${n}" not found`);return r}_findSection(n){return this._testElement?.querySelector(`qti-assessment-section[identifier="${n}"]`)||null}_updateSessionContext(n,r){let i=n.closest("qti-test-part")?.identifier,s=n.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:r}}_getSectionItemIds(n){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${n}"] > qti-assessment-item-ref`)).map(r=>r.identifier).filter(Boolean)}_clearLoadedItems(){let n=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(n||[]).forEach(r=>{r.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(n=>n.innerHTML="")}_isStaleNavigation(n,r){return r.signal.aborted||n!==this._navigationId}_createNavigationError(n,r,i){return{message:n.message||`Failed to load ${r}: ${i}`,details:n,itemId:r==="item"?i:void 0,sectionId:r==="section"?i:void 0}}_dispatchLoadingStarted(n,r){$(this,"cito-test-navigation-started",{type:n,id:r})}_dispatchLoadingEnded(n,r){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:n,id:r},bubbles:!0,composed:!0}))}_dispatchError(n){$(this,"cito-test-navigation-failed",n)}_dispatchTestLoaded(n,r,i){requestAnimationFrame(()=>{$(this,"cito-test-rendered",n.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),$(this,"cito-test-navigated",{type:r,id:i})})}}return Io([p({type:String})],t.prototype,"navigate",void 0),Io([p({type:Number})],t.prototype,"requestTimeout",void 0),Io([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),Io([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var uh=o=>{class t extends o{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"cito-test-switch-view",r=>{this.sessionContext={...this.sessionContext,view:r.detail},this._updateElementView()}),B(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",r=>{this._updateElementView(),this._setCorrectResponseVisibility(r.detail)})}willUpdate(n){super.willUpdate(n),n.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(n){this.updateAssessmentItemView(n,this.sessionContext.view)}updateAssessmentItemView(n,r){}}return t};var mh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},_l=o=>{class t extends o{constructor(...n){super(...n),this.testContext=cl,this.sessionContext=ll,this._updateItemInTestContext=r=>{let i=r.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=[...r.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}r.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(r.state=l.state)}},this._initializeEventListeners()}updateItemVariables(n,r,i){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==n)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of r){let f=l.findIndex(y=>y.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(n)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===n)?.variables??[]],i&&(s.state=i))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=cl,this.sessionContext=ll}),B(this,"cito-test-loaded",n=>{this._testElement=n.detail;let r=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:r}}),this.addEventListener("qti-assessment-item-connected",n=>{let r=n.detail,i=r.closest("qti-assessment-item-ref")?.identifier;i&&(r.assessmentItemRefId=i),this._updateItemInTestContext(n.detail)}),this.addEventListener("qti-item-context-updated",n=>{this._updateItemVariablesInTestContext(n.detail.itemContext.identifier,n.detail.itemContext.variables,n.detail.itemContext.state,n.detail.itemContext.valid)})}_updateItemVariablesInTestContext(n,r,i,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:r.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}))}#t(n,r){typeof r!="string"||r==="not_attempted"||this.testContext.items.find(a=>a.identifier===n)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:r}:l)})})}}return mh([p({attribute:!1,type:Object}),H({context:at})],t.prototype,"testContext",void 0),mh([p({attribute:!1,type:Object}),H({context:Ee})],t.prototype,"sessionContext",void 0),t},fh=class extends _l(k){};var _o=1;var Rl=o=>Array.isArray(o)?[...o]:o??null,Vm=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},jm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(n=>({identifier:n.identifier,...n.type?{type:n.type}:{},value:Rl(n.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Rl(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),gh=o=>{class t extends o{#t=null;#e=!1;#n=null;constructor(...n){super(...n),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#n=null}),B(this,"cito-test-update-plugin-state",({detail:r})=>this.#i(r)),B(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}#i({plugin:n,value:r}){if(typeof n!="string"||n==="")return;let{[n]:i,...s}=this.sessionContext.plugins??{},a=s;if(r!=null)try{a={...s,[n]:JSON.parse(JSON.stringify(r))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${n}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return jm(this.testContext,this.sessionContext)}set state(n){if(!Vm(n)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=n;return}let{navItemRefId:r,navSectionId:i}=this.sessionContext;this.#r(n);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==r?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==i&&this.#s("section",s.navSectionId)}updated(n){if(super.updated(n),!this.#e||!(n.has("testContext")||n.has("sessionContext")))return;let r=this.state,i=JSON.stringify(r);i!==this.#n&&(this.#n=i,$(this,"cito-test-state-changed",r))}#r(n){for(let i of n.test.items)this.updateItemVariables(i.identifier,i.variables,i.state);let r=new Map(n.test.outcomes.map(i=>[i.identifier,i.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>r.has(i.identifier)?{...i,value:Rl(r.get(i.identifier))}:i)},this.sessionContext={...this.sessionContext,...this.#o(n.session),plugins:n.session.plugins&&typeof n.session.plugins=="object"?{...n.session.plugins}:{}}}#o(n){let r=(i,s)=>!!s&&!!this._testElement?.querySelector(`${i}[identifier="${CSS.escape(s)}"]`);return{...r("qti-test-part",n.navPartId)?{navPartId:n.navPartId}:{},...r("qti-assessment-section",n.navSectionId)?{navSectionId:n.navSectionId}:{},...this.testContext.items.some(i=>i.identifier===n.navItemRefId)?{navItemRefId:n.navItemRefId}:{}}}#s(n,r){$(this,"cito-test-navigate",{type:n,id:r})}}return t};var bh=o=>{class t extends o{constructor(...n){super(...n),this.addEventListener("qti-register-variable",r=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],r.detail.variable]},r.stopPropagation()}),B(this,"cito-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",r=>{let{outcomeIdentifier:i,value:s}=r.detail;this.updateOutcomeVariable(i,s),r.stopPropagation()})}outcomeProcessing(){let n=(this._testElement??this).querySelector("qti-outcome-processing");return n?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>({...r,value:r.defaultValue??null}))},n.process(),!0):!1}submit(){return this.outcomeProcessing()?($(this,"cito-test-submitted",{}),!0):!1}getTestFeedback(n){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(i=>(!n||i.access===n)&&i.matches(this.getOutcome(i.outcomeIdentifier)?.value))}updateOutcomeVariable(n,r){let i=this.getOutcome(n);if(!i){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:i.cardinality==="single"?r:[...s.value,r]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(r=>r.identifier===n)||null}}return t};var vh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},De=class extends ph(uh(bh(gh(_l(k))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new ke(this,{context:Ae,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};vh([_(),H({context:qt})],De.prototype,"configContext",void 0);vh([_(),H({context:kt})],De.prototype,"qtiContext",void 0);var Ro=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Oo=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 yh=o=>!ih(o)&&typeof o.then=="function",wh=1073741823,Ol=class extends Pe{constructor(){super(...arguments),this._$Cwt=wh,this._$Cbt=[],this._$CK=new Ro(this),this._$CX=new Oo}render(...t){return t.find(e=>!yh(e))??st}update(t,e){let n=this._$Cbt,r=n.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(!yh(l))return this._$Cwt=a,l;a<r&&l===n[a]||(this._$Cwt=wh,r=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 st}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Po=Nt(Ol);var Mo=`
224
+ `}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return b``}};$m([p({type:String})],nr.prototype,"access",void 0);var To=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Me=class extends k{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>`}};To([p({type:String})],Me.prototype,"identifier",void 0);To([p({type:String})],Me.prototype,"class",void 0);To([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);To([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);var Lm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ir=class extends E{#t=null;constructor(){super(),B(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")??"",n=this.getAttribute("variable-identifier"),r=Fn(t,jn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new _l(this._testContext,n,r).calculate()}calculate(){return this.getResult()}};Lm([I({context:at,subscribe:!0})],ir.prototype,"_testContext",void 0);var _l=class{constructor(t,e,n){this.testContext=t,this.itemVariable=e,this.includedItems=n}calculate(){let t=this.testContext?.items??[],e=0,n=[...new Set(this.includedItems.map(r=>r.item))];return t.forEach(r=>{if(n.includes(r.identifier)){let i=r.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===r.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var rr="qti-assessment-section",Io="qti-test-part",$t=o=>o.identifier||o.getAttribute("identifier")||"";function dh(o,t){let e=o[t],n=t+1,r=zm(e,o,t);if(r){let s=Vm(r,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map($t)};s>t?n=s:console.warn(`qti-branch-rule target "${r.target}" is not ahead of "${$t(e)}", ignored`)}let i=o.slice(t+1,n).map($t);for(let s=n;s<o.length;s++){if(ph(o[s],e))return{id:$t(o[s]),skipped:i};i.push($t(o[s]))}return{id:null,skipped:i}}function hh(o){let t=[];for(let e of o){if(ph(e,null))return{id:$t(e),skipped:t};t.push($t(e))}return{id:null,skipped:t}}function zm(o,t,e){let n=[o];for(let r=o.parentElement;r&&(r.localName===rr||r.localName===Io)&&!r.contains(t[e+1]??null);r=r.parentElement)n.push(r);for(let r of n)for(let i of r.querySelectorAll(":scope > qti-branch-rule"))if(i.evaluate?.())return i;return null}function Vm(o,t,e){let n=o.parentElement,r=i=>{if(!i)return null;let s=t.findLastIndex(a=>i.contains(a));return s+1<t.length?s+1:null};switch(o.target){case ce.EXIT_TEST:return null;case ce.EXIT_TESTPART:return r(n.closest(Io));case ce.EXIT_SECTION:{let i=n.localName===rr?n:n.closest(rr);return r(i??n)}default:{let i=t.findIndex(l=>$t(l)===o.target);if(i>=0)return i;let s=[...n.closest("qti-assessment-test")?.querySelectorAll(`${rr}, ${Io}`)??[]].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 ph(o,t){let e=[o];for(let n=o.parentElement;n&&(n.localName===rr||n.localName===Io);n=n.parentElement)(!t||!n.contains(t))&&e.push(n);return e.every(n=>[...n.querySelectorAll(":scope > qti-pre-condition")].every(r=>r.evaluate?.()??!0))}var _o=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},uh=o=>{class t extends o{constructor(...n){super(...n),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(n,r){let i=r||this._getDefaultNavigationId(n);i&&$(this,"cito-test-navigate",{type:n,id:i})}_bindEventHandlers(){B(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),B(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(n){this._testElement=n.detail,this._initializeNavigation()}_handleItemConnected(n){let r=n.detail;this._loadingState.connectedItems++;let i=r.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(n){n.preventDefault();let{element:r,item:i}=n;if(console.info("Stimulus ref connected:",{identifier:r.identifier,href:r.href,item:i.identifier}),this._loadedStimulusHrefs.has(r.href)){console.info("Stimulus already loaded, skipping:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(r.href)){console.info("Stimulus already loading, skipping duplicate:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(r.href),console.info("Starting stimulus load:",r.href);try{await this._loadStimulusRef(r,i),this._loadedStimulusHrefs.add(r.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",r.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${r.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(r.href)}}_getDefaultNavigationId(n){return n==="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 n=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(r[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let i=hh(r);if(i.skipped.length&&$(this,"cito-test-items-skipped",{ids:i.skipped}),i.id===null){$(this,"cito-test-end-reached",{});return}n=i.id}}n&&this.navigateTo(this.navigate,n)}_isLinearNavigationRestricted(n,r){let i=this.sessionContext?.navItemRefId;if(!i||n==="item"&&r===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(n==="item"){let f=d.findIndex(m=>m.identifier===r);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(n,r){if(n!=="item"||!this._testElement)return;let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=i.findIndex(l=>$t(l)===this.sessionContext?.navItemRefId);if(s<0||!i[s+1]||$t(i[s+1])!==r||i[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=dh(i,s);if(a.id!==r)return a}async _handleNavigationRequest({detail:n}){if(!n?.id)return;let r=this._resolveLinearNext(n.type,n.id);if(r?.id===null){r.skipped.length&&$(this,"cito-test-items-skipped",{ids:r.skipped}),$(this,"cito-test-end-reached",{});return}let i=r?.id??n.id;if(!r&&this._isLinearNavigationRestricted(n.type,i)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),n.type,n.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(n.type,i),this._activeController=a,await this._executeNavigation(n.type,i,s,a),r?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&$(this,"cito-test-items-skipped",{ids:r.skipped})}catch(l){this._handleNavigationError(l,n.type,i)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(n.type,i)}}_handleNavigationError(n,r,i){n.name!=="AbortError"&&this._dispatchError(this._createNavigationError(n,r,i))}async _executeNavigation(n,r,i,s){n==="item"?await this._navigateToItem(r,i,s):await this._navigateToSection(r,i,s)}async _navigateToItem(n,r,i){let s=this._findItemRef(n);this._updateSessionContext(s,n),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([n],r,i),await this._waitForLoadingComplete(r,i),!this._isStaleNavigation(r,i)&&this._dispatchTestLoaded(this._loadResults,"item",n)}async _navigateToSection(n,r,i){let a=this._findSection(n)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(n);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:n,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,r,i),await this._waitForLoadingComplete(r,i),!this._isStaleNavigation(r,i)&&this._dispatchTestLoaded(this._loadResults,"section",n)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let n=this._loadingState.connectedItems>=this._loadingState.expectedItems,r=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;n&&r&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(n,r){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(n,r))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(n,r){console.info("Loading stimulus:",n.href);let i=await this._loadStimulus(n.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,n,r)}_applyStimulusContent(n,r,i){if(!n){console.warn("No stimulus content to apply");return}let s=n.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="${r.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${r.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(n,r,i){if(!this._testElement||n.length===0)return;let s=n.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,r,i)))).filter(Boolean);this._isStaleNavigation(r,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(n,r,i){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Kt().load(n.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,n)),this._isStaleNavigation(r,i)?null:{itemRef:n,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${n.identifier} was aborted`),s;return console.warn(`Failed to load item ${n.identifier}:`,s),null}}async _loadStimulus(n){return(await Kt().load(n,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let n=this.querySelector("test-container");if(n)return n.customElementRegistry??void 0}_findItemRef(n){let r=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!r)throw new Error(`Item with identifier "${n}" not found`);return r}_findSection(n){return this._testElement?.querySelector(`qti-assessment-section[identifier="${n}"]`)||null}_updateSessionContext(n,r){let i=n.closest("qti-test-part")?.identifier,s=n.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:r}}_getSectionItemIds(n){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${n}"] > qti-assessment-item-ref`)).map(r=>r.identifier).filter(Boolean)}_clearLoadedItems(){let n=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(n||[]).forEach(r=>{r.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(n=>n.innerHTML="")}_isStaleNavigation(n,r){return r.signal.aborted||n!==this._navigationId}_createNavigationError(n,r,i){return{message:n.message||`Failed to load ${r}: ${i}`,details:n,itemId:r==="item"?i:void 0,sectionId:r==="section"?i:void 0}}_dispatchLoadingStarted(n,r){$(this,"cito-test-navigation-started",{type:n,id:r})}_dispatchLoadingEnded(n,r){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:n,id:r},bubbles:!0,composed:!0}))}_dispatchError(n){$(this,"cito-test-navigation-failed",n)}_dispatchTestLoaded(n,r,i){requestAnimationFrame(()=>{$(this,"cito-test-rendered",n.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),$(this,"cito-test-navigated",{type:r,id:i})})}}return _o([p({type:String})],t.prototype,"navigate",void 0),_o([p({type:Number})],t.prototype,"requestTimeout",void 0),_o([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),_o([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var mh=o=>{class t extends o{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"cito-test-switch-view",r=>{this.sessionContext={...this.sessionContext,view:r.detail},this._updateElementView()}),B(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",r=>{this._updateElementView(),this._setCorrectResponseVisibility(r.detail)})}willUpdate(n){super.willUpdate(n),n.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(n){this.updateAssessmentItemView(n,this.sessionContext.view)}updateAssessmentItemView(n,r){}}return t};var fh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Rl=o=>{class t extends o{constructor(...n){super(...n),this.testContext=dl,this.sessionContext=cl,this._updateItemInTestContext=r=>{let i=r.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=[...r.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}r.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(r.state=l.state)}},this._initializeEventListeners()}updateItemVariables(n,r,i){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==n)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of r){let f=l.findIndex(y=>y.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(n)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===n)?.variables??[]],i&&(s.state=i))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=dl,this.sessionContext=cl}),B(this,"cito-test-loaded",n=>{this._testElement=n.detail;let r=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:r}}),this.addEventListener("qti-assessment-item-connected",n=>{let r=n.detail,i=r.closest("qti-assessment-item-ref")?.identifier;i&&(r.assessmentItemRefId=i),this._updateItemInTestContext(n.detail)}),this.addEventListener("qti-item-context-updated",n=>{this._updateItemVariablesInTestContext(n.detail.itemContext.identifier,n.detail.itemContext.variables,n.detail.itemContext.state,n.detail.itemContext.valid)})}_updateItemVariablesInTestContext(n,r,i,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:r.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}))}#t(n,r){typeof r!="string"||r==="not_attempted"||this.testContext.items.find(a=>a.identifier===n)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:r}:l)})})}}return fh([p({attribute:!1,type:Object}),H({context:at})],t.prototype,"testContext",void 0),fh([p({attribute:!1,type:Object}),H({context:Ee})],t.prototype,"sessionContext",void 0),t},gh=class extends Rl(k){};var Ro=1;var Ol=o=>Array.isArray(o)?[...o]:o??null,jm=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},Fm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(n=>({identifier:n.identifier,...n.type?{type:n.type}:{},value:Ol(n.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Ol(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),bh=o=>{class t extends o{#t=null;#e=!1;#n=null;constructor(...n){super(...n),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#n=null}),B(this,"cito-test-update-plugin-state",({detail:r})=>this.#i(r)),B(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}#i({plugin:n,value:r}){if(typeof n!="string"||n==="")return;let{[n]:i,...s}=this.sessionContext.plugins??{},a=s;if(r!=null)try{a={...s,[n]:JSON.parse(JSON.stringify(r))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${n}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Fm(this.testContext,this.sessionContext)}set state(n){if(!jm(n)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=n;return}let{navItemRefId:r,navSectionId:i}=this.sessionContext;this.#r(n);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==r?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==i&&this.#s("section",s.navSectionId)}updated(n){if(super.updated(n),!this.#e||!(n.has("testContext")||n.has("sessionContext")))return;let r=this.state,i=JSON.stringify(r);i!==this.#n&&(this.#n=i,$(this,"cito-test-state-changed",r))}#r(n){for(let i of n.test.items)this.updateItemVariables(i.identifier,i.variables,i.state);let r=new Map(n.test.outcomes.map(i=>[i.identifier,i.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>r.has(i.identifier)?{...i,value:Ol(r.get(i.identifier))}:i)},this.sessionContext={...this.sessionContext,...this.#o(n.session),plugins:n.session.plugins&&typeof n.session.plugins=="object"?{...n.session.plugins}:{}}}#o(n){let r=(i,s)=>!!s&&!!this._testElement?.querySelector(`${i}[identifier="${CSS.escape(s)}"]`);return{...r("qti-test-part",n.navPartId)?{navPartId:n.navPartId}:{},...r("qti-assessment-section",n.navSectionId)?{navSectionId:n.navSectionId}:{},...this.testContext.items.some(i=>i.identifier===n.navItemRefId)?{navItemRefId:n.navItemRefId}:{}}}#s(n,r){$(this,"cito-test-navigate",{type:n,id:r})}}return t};var vh=o=>{class t extends o{constructor(...n){super(...n),this.addEventListener("qti-register-variable",r=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],r.detail.variable]},r.stopPropagation()}),B(this,"cito-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",r=>{let{outcomeIdentifier:i,value:s}=r.detail;this.updateOutcomeVariable(i,s),r.stopPropagation()})}outcomeProcessing(){let n=(this._testElement??this).querySelector("qti-outcome-processing");return n?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>({...r,value:r.defaultValue??null}))},n.process(),!0):!1}submit(){return this.outcomeProcessing()?($(this,"cito-test-submitted",{}),!0):!1}getTestFeedback(n){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(i=>(!n||i.access===n)&&i.matches(this.getOutcome(i.outcomeIdentifier)?.value))}updateOutcomeVariable(n,r){let i=this.getOutcome(n);if(!i){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:i.cardinality==="single"?r:[...s.value,r]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(r=>r.identifier===n)||null}}return t};var yh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},De=class extends uh(mh(vh(bh(Rl(k))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new ke(this,{context:Ae,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};yh([_(),H({context:qt})],De.prototype,"configContext",void 0);yh([_(),H({context:kt})],De.prototype,"qtiContext",void 0);var Oo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Po=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 wh=o=>!rh(o)&&typeof o.then=="function",xh=1073741823,Pl=class extends Pe{constructor(){super(...arguments),this._$Cwt=xh,this._$Cbt=[],this._$CK=new Oo(this),this._$CX=new Po}render(...t){return t.find(e=>!wh(e))??st}update(t,e){let n=this._$Cbt,r=n.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(!wh(l))return this._$Cwt=a,l;a<r&&l===n[a]||(this._$Cwt=xh,r=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 st}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Mo=Nt(Pl);var Do=`
225
225
  @layer qti-base, qti-components, qti-extended;
226
226
 
227
227
  @layer qti-components.reset, qti-components.global, qti-components.interactions.base,
@@ -1675,6 +1675,9 @@ Make sure to test your application with a production build as repeat registratio
1675
1675
  @layer qti-base{
1676
1676
 
1677
1677
  .qti-layout-row {
1678
+ /* The columns stack when the row is narrow, not the viewport: an item in a side-by-side player or a
1679
+ * narrow pane collapses too. The row is the container, so it is never shrink-to-fit (width: 100%). */
1680
+ container-type: inline-size;
1678
1681
  display: flex;
1679
1682
  flex-wrap: wrap;
1680
1683
  width: 100%;
@@ -1786,7 +1789,7 @@ Make sure to test your application with a production build as repeat registratio
1786
1789
  margin-left: 93.6170212766%;
1787
1790
  }
1788
1791
 
1789
- @media (width <= 767px) {
1792
+ @container (width <= 767px) {
1790
1793
  [class*='qti-layout-col'] {
1791
1794
  width: 100%;
1792
1795
  }
@@ -1802,7 +1805,7 @@ Make sure to test your application with a production build as repeat registratio
1802
1805
  * not worth the file count.
1803
1806
  *
1804
1807
  * \`interactions.brand\` and \`overrides\` hold nothing here ON PURPOSE \u2014 they are the extension points
1805
- * a brand sheet writes into (apps/e2e/src/stories/kennisnet/kennisnet.css uses \`interactions.brand\`).
1808
+ * a brand sheet writes into (a host's own brand CSS; the Storybook presets need none, being tokens).
1806
1809
  * They must stay DECLARED even while empty: a layer first created by a consumer's own \`@layer\`
1807
1810
  * block is appended after every declared layer, which would put brand paint above the state and
1808
1811
  * correction paint it is meant to sit under. Deleting the two names moved 7 of the 17 VRT baselines.
@@ -2185,8 +2188,8 @@ Make sure to test your application with a production build as repeat registratio
2185
2188
  * THE body text colour \u2014 the foreground half of the --qti-bg / --qti-fg pair.
2186
2189
  *
2187
2190
  * \`inherit\`, deliberately: the base theme does not impose a text colour. What a candidate reads
2188
- * is the host page's, and a brand that wants its own sets this token (kennisnet.css declares
2189
- * #3e144e). A base theme that cannot pick the colour also cannot pick a failing one.
2191
+ * is the host page's, and a brand that wants its own sets this token, or paints the page in its
2192
+ * base-content colour as the Storybook presets do (Kennisnet's #3e144e reaches the text that way). A base theme that cannot pick the colour also cannot pick a failing one.
2190
2193
  *
2191
2194
  * This is a FIX that changes nothing, which is the point. It read \`var(#aaaaaa)\` \u2014 a value
2192
2195
  * wrapped in var() by mistake in 925bdf14. var() takes a custom-property name, so \`#aaaaaa\` made
@@ -2212,7 +2215,7 @@ Make sure to test your application with a production build as repeat registratio
2212
2215
  * meet the 3:1 WCAG asks of a field's edge. It was the primary colour, which drew every field,
2213
2216
  * table and drop in the brand's blue at rest; the primary now marks only what is active or
2214
2217
  * selected (--qti-border-active). A brand that wants its colour on every edge sets this token,
2215
- * as kennisnet.css does.
2218
+ * as the Kennisnet preset does.
2216
2219
  */
2217
2220
  --qti-border-color: var(
2218
2221
  --cito-color-border,
@@ -2226,10 +2229,11 @@ Make sure to test your application with a production build as repeat registratio
2226
2229
  without the theme a well got its padding and nothing else. Filled from the theme's own
2227
2230
  tokens: a brand that restyles its borders restyles the well and the bordered box with them.
2228
2231
  A well is a tinted surface inside the theme's border (\xA71.1.6.2: border plus background, the
2229
- background chosen by the platform); base-200 is the theme's tint for that. */
2232
+ background chosen by the platform); base-200 is the theme's tint for that, and a brand that
2233
+ puts its items on a coloured page sets --cito-color-well (Kennisnet: white, like its cards). */
2230
2234
  --table-border-color: var(--qti-border-color);
2231
2235
  --foreground: var(--qti-color-base-content);
2232
- --well-bg: var(--qti-color-base-200);
2236
+ --well-bg: var(--cito-color-well, var(--qti-color-base-200)); /* t1 input: --cito-color-well, optional */
2233
2237
  --well-border: var(--qti-border);
2234
2238
  --well-box-shadow: none;
2235
2239
 
@@ -2270,14 +2274,19 @@ Make sure to test your application with a production build as repeat registratio
2270
2274
  * Depth, worked out from --cito-depth (tier 1).
2271
2275
  *
2272
2276
  * --qti-drag-lift a chip at rest: a hard shadow under it, as tall as two borders. At
2273
- * depth 0 its colour mixes to nothing, so the chip is flat.
2277
+ * depth 0 its colour mixes to nothing, so the chip is flat. A theme sets
2278
+ * its own with --cito-shadow-chip (Kennisnet: a taller lift in its brand
2279
+ * colour).
2274
2280
  * --qti-drag-elevation a chip in flight, at any depth: picked up is always off the page. A
2275
2281
  * theme sets its own with --cito-shadow-drag (\`none\` for flat).
2276
2282
  * --qti-hover-mix how much base-content a hover mixes into a fill.
2277
2283
  * --qti-active-mix how much a press mixes in: twice the hover, so a press reads as one.
2278
2284
  */
2279
- --qti-drag-lift: 0 calc(2 * var(--qti-border-width)) 0
2280
- color-mix(in oklab, var(--qti-color-base-content) calc(var(--qti-depth) * 20%), transparent);
2285
+ --qti-drag-lift: var(
2286
+ --cito-shadow-chip,
2287
+ 0 calc(2 * var(--qti-border-width)) 0
2288
+ color-mix(in oklab, var(--qti-color-base-content) calc(var(--qti-depth) * 20%), transparent)
2289
+ ); /* t1 input: --cito-shadow-chip, optional */
2281
2290
  --qti-drag-elevation: var(
2282
2291
  --cito-shadow-drag,
2283
2292
  0 var(--qti-spacing) calc(var(--qti-spacing) * 1.5)
@@ -2290,6 +2299,14 @@ Make sure to test your application with a production build as repeat registratio
2290
2299
  /* A chip's resting fill: the tier-1 chip colour. \`press\` reads --qti-<role>-fill, so a pressed
2291
2300
  chip darkens from the chip colour; other roles fall back to the component surface. */
2292
2301
  --qti-drag-fill: var(--qti-color-chip);
2302
+ /* An order interaction's PLACED chip, when a brand gives it a look of its own: Kennisnet inverts
2303
+ it (a white chip with dark text and a border on its filled bank) so a dropped answer reads as
2304
+ settled. Optional and unset by default \u2014 then a placed order chip is the same chip as in the
2305
+ bank. Unset, these compute to the guaranteed-invalid value, and the role slots they feed fall
2306
+ back to the chip's own look. */
2307
+ --qti-order-placed-fill: var(--cito-color-order-placed); /* t1 input, optional */
2308
+ --qti-order-placed-color: var(--cito-color-order-placed-content); /* t1 input, optional */
2309
+ --qti-order-placed-border-color: var(--cito-color-order-placed-border); /* t1 input, optional */
2293
2310
  --qti-active-mix: 16%; /* a press: the same mix, twice as far */
2294
2311
 
2295
2312
  /* Interaction icon masks. Kept in the QTI namespace so the theme has no FontAwesome runtime
@@ -5929,7 +5946,8 @@ Make sure to test your application with a production build as repeat registratio
5929
5946
  outline-offset: var(--qti-focus-offset);
5930
5947
  }
5931
5948
  /* A placed chip, and the editor's fake-drag projected into the drop-target shadow. Its hover,
5932
- and ring are in the states layer below. */
5949
+ and ring are in the states layer below. The three --drag-* slots take a brand's placed-chip
5950
+ look (--cito-color-order-placed*); unset, they are invalid and the chip keeps its own. */
5933
5951
  qti-order-interaction::part(drag) {
5934
5952
  /* Structural \u2014 the load-bearing box, never state-switched (layout-invariance contract).
5935
5953
  box-sizing is deliberate: the clone is appended to document.body outside reset.css's
@@ -5991,6 +6009,9 @@ Make sure to test your application with a production build as repeat registratio
5991
6009
  card; the width stays, so a chip keeps its size whichever edge it shows. */
5992
6010
  border-color: var(--drag-border-color, var(--cito-color-chip-border, var(--qti-component-border-color)));
5993
6011
  color: var(--drag-color, var(--cito-color-chip-content, inherit));
6012
+ --drag-background-color: var(--qti-order-placed-fill);
6013
+ --drag-color: var(--qti-order-placed-color);
6014
+ --drag-border-color: var(--qti-order-placed-border-color);
5994
6015
  }
5995
6016
  /* The drag's box \u2014 flex, centred, clipped \u2014 is in qti-order-interaction.styles.ts. */
5996
6017
  qti-order-interaction::part(drag) {
@@ -6083,11 +6104,10 @@ Make sure to test your application with a production build as repeat registratio
6083
6104
 
6084
6105
  /* \`align-self\` on a populated drop, and the drops' and drag's \`overflow: visible\` that let a
6085
6106
  chip's shadow escape its column, are laid out in qti-order-interaction.styles.ts. */
6086
- /* The placed order chip's INVERTED look (white fill, dark text, neutral border) is
6087
- Kennisnet-specific \u2014 a light chip against the primary bank \u2014 so it lives in the Kennisnet brand
6088
- overlay (apps/e2e/src/stories/kennisnet/kennisnet.css), not here. In the base theme a placed
6089
- chip is just the neutral chip (@mixin drag), and its corrections route through --drag-*
6090
- like every other chip. */
6107
+ /* The placed order chip's INVERTED look (white fill, dark text, a border) is a brand choice \u2014
6108
+ Kennisnet's \u2014 made through the --cito-color-order-placed* inputs on ::part(drag) above. In the
6109
+ base theme a placed chip is just the neutral chip (@mixin drag), and its corrections route
6110
+ through --drag-* like every other chip. */
6091
6111
  qti-order-interaction qti-simple-choice {
6092
6112
  /* Structural \u2014 the load-bearing box, never state-switched (layout-invariance contract).
6093
6113
  box-sizing is deliberate: the clone is appended to document.body outside reset.css's
@@ -7499,11 +7519,11 @@ div.full-correct-response-inline {
7499
7519
  display: inline-block;
7500
7520
  }
7501
7521
  }
7502
- `;var Ne=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Et=class extends k{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 Qn().load(this.testURL)).shuffleOrdering(t),n=this.testHost;if(n?.postLoadTestTransformCallback){let i=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");i&&(e=await n.postLoadTestTransformCallback(e,i))}this.#n(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#n(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.#n(Qn().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.#r(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:b``}#r(){let t=new CSSStyleSheet;t.replaceSync(Mo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
7522
+ `;var Ne=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Et=class extends k{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 Qn().load(this.testURL)).shuffleOrdering(t),n=this.testHost;if(n?.postLoadTestTransformCallback){let i=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");i&&(e=await n.postLoadTestTransformCallback(e,i))}this.#n(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#n(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.#n(Qn().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.#r(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:b``}#r(){let t=new CSSStyleSheet;t.replaceSync(Do),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
7503
7523
  ${this.#t}
7504
7524
  <slot></slot>
7505
- ${Po(this.testDoc,b`<span>Loading...</span>`)}
7506
- `}};Ne([p({attribute:!1})],Et.prototype,"customElementRegistry",void 0);Ne([p({type:String,attribute:"test-url"})],Et.prototype,"testURL",void 0);Ne([_()],Et.prototype,"testDoc",void 0);Ne([_()],Et.prototype,"testXML",void 0);Ne([I({context:Ae,subscribe:!0})],Et.prototype,"testHost",void 0);Ne([_(),I({context:kt,subscribe:!0})],Et.prototype,"qtiContext",void 0);Ne([z("testURL",{waitUntilFirstUpdate:!0})],Et.prototype,"handleTestURLChange",null);Ne([z("testXML",{waitUntilFirstUpdate:!0})],Et.prototype,"handleTestXMLChange",null);var Do=x`var(--qti-color-base-100, var(--cito-color-base-100, Canvas))`,Pl=x`var(--qti-color-base-content, var(--cito-color-base-content, CanvasText))`,No=x`var(--qti-color-neutral, var(--cito-color-neutral, CanvasText))`,Ml=x`var(--qti-color-neutral-content, var(--cito-color-neutral-content, Canvas))`,xh=x`
7525
+ ${Mo(this.testDoc,b`<span>Loading...</span>`)}
7526
+ `}};Ne([p({attribute:!1})],Et.prototype,"customElementRegistry",void 0);Ne([p({type:String,attribute:"test-url"})],Et.prototype,"testURL",void 0);Ne([_()],Et.prototype,"testDoc",void 0);Ne([_()],Et.prototype,"testXML",void 0);Ne([I({context:Ae,subscribe:!0})],Et.prototype,"testHost",void 0);Ne([_(),I({context:kt,subscribe:!0})],Et.prototype,"qtiContext",void 0);Ne([z("testURL",{waitUntilFirstUpdate:!0})],Et.prototype,"handleTestURLChange",null);Ne([z("testXML",{waitUntilFirstUpdate:!0})],Et.prototype,"handleTestXMLChange",null);var No=x`var(--qti-color-base-100, var(--cito-color-base-100, Canvas))`,Ml=x`var(--qti-color-base-content, var(--cito-color-base-content, CanvasText))`,$o=x`var(--qti-color-neutral, var(--cito-color-neutral, CanvasText))`,Dl=x`var(--qti-color-neutral-content, var(--cito-color-neutral-content, Canvas))`,qh=x`
7507
7527
  display: inline-flex;
7508
7528
  align-items: center;
7509
7529
  justify-content: center;
@@ -7517,34 +7537,34 @@ div.full-correct-response-inline {
7517
7537
  user-select: none;
7518
7538
  border-radius: var(--test-button-border-radius, var(--qti-radius-field, var(--cito-radius-field, 0.2rem)));
7519
7539
  `,tt=x`
7520
- ${xh};
7521
- background-color: var(--test-button-background-color, ${Do});
7540
+ ${qh};
7541
+ background-color: var(--test-button-background-color, ${No});
7522
7542
  color: var(--test-button-color, inherit);
7523
7543
  border: var(--qti-border-width, var(--cito-border-width, 1px)) solid
7524
- var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${Pl} 45%, ${Do})));
7525
- `,qh=x`
7526
- background-color: var(--test-button-primary-background-color, ${No});
7527
- color: var(--test-button-primary-color, ${Ml});
7528
- border-color: var(--test-button-primary-background-color, ${No});
7544
+ var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${Ml} 45%, ${No})));
7545
+ `,kh=x`
7546
+ background-color: var(--test-button-primary-background-color, ${$o});
7547
+ color: var(--test-button-primary-color, ${Dl});
7548
+ border-color: var(--test-button-primary-background-color, ${$o});
7529
7549
  `,lt=x`
7530
7550
  background-color: var(
7531
7551
  --test-button-hover-background-color,
7532
- color-mix(in oklab, ${Do}, ${Pl} var(--qti-hover-mix, 8%))
7552
+ color-mix(in oklab, ${No}, ${Ml} var(--qti-hover-mix, 8%))
7533
7553
  );
7534
- `,kh=x`
7554
+ `,Ch=x`
7535
7555
  background-color: var(
7536
7556
  --test-button-primary-hover-background-color,
7537
- color-mix(in oklab, ${No}, ${Ml} var(--qti-hover-mix, 8%))
7557
+ color-mix(in oklab, ${$o}, ${Dl} var(--qti-hover-mix, 8%))
7538
7558
  );
7539
7559
  `,ct=x`
7540
7560
  background-color: var(
7541
7561
  --test-button-active-background-color,
7542
- color-mix(in oklab, ${Do}, ${Pl} var(--qti-active-mix, 16%))
7562
+ color-mix(in oklab, ${No}, ${Ml} var(--qti-active-mix, 16%))
7543
7563
  );
7544
- `,Ch=x`
7564
+ `,Sh=x`
7545
7565
  background-color: var(
7546
7566
  --test-button-primary-active-background-color,
7547
- color-mix(in oklab, ${No}, ${Ml} var(--qti-active-mix, 16%))
7567
+ color-mix(in oklab, ${$o}, ${Dl} var(--qti-active-mix, 16%))
7548
7568
  );
7549
7569
  `,et=x`
7550
7570
  outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
@@ -7552,10 +7572,10 @@ div.full-correct-response-inline {
7552
7572
  `,nt=x`
7553
7573
  cursor: not-allowed;
7554
7574
  opacity: 0.45;
7555
- `,RC=x`
7556
- ${xh};
7575
+ `,MC=x`
7576
+ ${qh};
7557
7577
  border: var(--qti-border-width, var(--cito-border-width, 1px)) solid var(--qti-border-color, GrayText);
7558
- `;var Dl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},cn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=x`
7578
+ `;var Nl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},cn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=x`
7559
7579
  :host {
7560
7580
  ${tt};
7561
7581
  }
@@ -7573,7 +7593,7 @@ div.full-correct-response-inline {
7573
7593
  :host([disabled]) {
7574
7594
  ${nt};
7575
7595
  }
7576
- `}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||$(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),n=e.findIndex(a=>a.active),r=e[n];if(!r){this._internalDisabled=!1;return}let i=r.maxAttempts??1,s=r.numAttempts||0;if(!r.adaptive&&r.optimal){this._internalDisabled=!0;return}if(r.adaptive&&r.completionStatus==="completed"){this._internalDisabled=!0;return}if(!r.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}r.allowSkipping===!1?this._internalDisabled=r.valid===!1||r.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};Dl([I({context:j,subscribe:!0}),p({attribute:!1})],cn.prototype,"computedContext",void 0);Dl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cn.prototype,"_internalDisabled",void 0);Dl([z("computedContext")],cn.prototype,"_handleTestElementChange",null);var Fm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},or=class extends k{static{this.styles=x`
7596
+ `}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||$(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),n=e.findIndex(a=>a.active),r=e[n];if(!r){this._internalDisabled=!1;return}let i=r.maxAttempts??1,s=r.numAttempts||0;if(!r.adaptive&&r.optimal){this._internalDisabled=!0;return}if(r.adaptive&&r.completionStatus==="completed"){this._internalDisabled=!0;return}if(!r.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}r.allowSkipping===!1?this._internalDisabled=r.valid===!1||r.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};Nl([I({context:j,subscribe:!0}),p({attribute:!1})],cn.prototype,"computedContext",void 0);Nl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cn.prototype,"_internalDisabled",void 0);Nl([z("computedContext")],cn.prototype,"_handleTestElementChange",null);var Bm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},or=class extends k{static{this.styles=x`
7577
7597
  :host {
7578
7598
  ${tt};
7579
7599
  }
@@ -7591,18 +7611,18 @@ div.full-correct-response-inline {
7591
7611
  :host([disabled]) {
7592
7612
  ${nt};
7593
7613
  }
7594
- `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return b` <slot></slot> `}};Fm([p({type:String,attribute:"item-id"})],or.prototype,"itemId",void 0);var dn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),bt=class extends k{get qtiContext(){return this.#r()?.qtiContext??(this.#t??=Bm())}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.#n(t)}#t;#e;#n(t){let e=this.#r();e?e.qtiContext=t:this.#t=t}#i;#r(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new xt(this,{context:Ae,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,B(this,"cito-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#b.bind(this)),Id(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"cito-test-end-attempt",this.#l.bind(this)),B(this,"cito-test-update-outcome",this.#m.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let n=this.#v(e);this.#s.set(e.identifier,n);let r=this.computedItemFor(e.identifier),i=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"),r,this.#f(i,n,r?.maxAttempts,r?.adaptive,s))}afterAttemptEnded(t,e,n){}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="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=this.activeAssessmentItem;if(!e)return;let n=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,n)}#m(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 n=e.variables.find(r=>r.identifier==="SCORE");if(n&&n.externalScored===null&&e.adaptive==="false"){let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}}}render(){return b`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#n({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=this.#h(r);Object.keys(i).length>0&&this.#n({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})});let n=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:n.map(r=>{let i=[...r.querySelectorAll("qti-assessment-section")],s=r.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:r.identifier,navigationMode:r.navigationMode,submissionMode:r.submissionMode,allowSkipping:a,sections:i.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,q=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:y,items:f.map(v=>{let w=v.querySelector(":scope > qti-item-session-control"),T=w?w.allowSkipping:y,A=w?w.maxAttempts:q,S=w?w.showFeedback:u,C=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===v.identifier),active:!1,identifier:v.identifier,categories:v.category?v.category?.split(" "):[],href:v.href,variables:[],allowSkipping:T,maxAttempts:A,showFeedback:S,showSolution:C}})}})}})}}#h(t){let e={},n=t.querySelector("qti-default-value");return n&&n.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}#b(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(n=>({...n,sections:n.sections.map(r=>({...r,items:r.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 y=m.querySelector("qti-mapping"),q=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||q?.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,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(n=>({...n,active:this._sessionContext?.navPartId===n.identifier||!1,sections:n.sections.map(r=>({...r,active:this._sessionContext?.navSectionId===r.identifier||!1,completed:r.items.every(i=>this._testContext.items.find(s=>s.identifier===i.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:r.items.map(i=>{let s=this._testContext?.items.find(S=>S.identifier===i.identifier),a={...i,...s,...this.initContext?.find(S=>S.identifier===i.identifier)},l=a.variables?.find(S=>S.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(S=>S.identifier==="completionStatus")?.value,h=a.variables?.find(S=>S.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(S=>S.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(S=>S.type==="response")||[]).every(S=>{if(S.value===void 0||S.value===null)return!0;let C;switch(S.baseType){case"integer":case"float":case"duration":C="0";break;case"boolean":C="false";break;default:C="";break}let R=S.defaultValue??C;if(Array.isArray(S.value)){let N=Array.isArray(R)?R:[R];return S.value.length===N.length&&S.value.every((V,L)=>V===N[L])}return S.value===R}),g=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,v=i.variables?.find(S=>S.identifier=="MAXSCORE")?.value,w=v==null?null:parseFloat(v?.toString()),T=this.#s.get(a.identifier);T===void 0&&(T=s?this.#v(s):"unscored",f>0&&this.#s.set(a.identifier,T));let A=this.#f(f,T,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,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}))}#f(t,e,n,r,i){if(t===0)return!1;if(r)return i==="completed";if(e!=="suboptimal")return!0;let s=n??1;return s>0&&t>=s}#v(t){let e=t.variables??[],n=this.#g(e,"SCORE"),r=this.#g(e,"MAXSCORE");if(n!==null&&r!==null)return n>=r?"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"}#g(t,e){let n=t?.find(i=>i.identifier===e)?.value;if(n==null||Array.isArray(n))return null;let r=parseFloat(n.toString());return Number.isNaN(r)?null:r}};dn([p({type:String})],bt.prototype,"identifier",void 0);dn([_()],bt.prototype,"initContext",void 0);dn([_(),I({context:qt,subscribe:!0})],bt.prototype,"configContext",void 0);dn([_(),I({context:at,subscribe:!0})],bt.prototype,"_testContext",void 0);dn([_(),I({context:Ee,subscribe:!0})],bt.prototype,"_sessionContext",void 0);dn([_(),H({context:j})],bt.prototype,"computedContext",void 0);dn([p({type:Boolean,attribute:"auto-score-items"})],bt.prototype,"autoScoreItems",void 0);var Nl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=x`
7614
+ `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return b` <slot></slot> `}};Bm([p({type:String,attribute:"item-id"})],or.prototype,"itemId",void 0);var dn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Um=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),bt=class extends k{get qtiContext(){return this.#r()?.qtiContext??(this.#t??=Um())}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.#n(t)}#t;#e;#n(t){let e=this.#r();e?e.qtiContext=t:this.#t=t}#i;#r(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new xt(this,{context:Ae,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,B(this,"cito-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#b.bind(this)),_d(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"cito-test-end-attempt",this.#l.bind(this)),B(this,"cito-test-update-outcome",this.#m.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let n=this.#v(e);this.#s.set(e.identifier,n);let r=this.computedItemFor(e.identifier),i=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"),r,this.#f(i,n,r?.maxAttempts,r?.adaptive,s))}afterAttemptEnded(t,e,n){}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="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=this.activeAssessmentItem;if(!e)return;let n=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,n)}#m(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 n=e.variables.find(r=>r.identifier==="SCORE");if(n&&n.externalScored===null&&e.adaptive==="false"){let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}}}render(){return b`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#n({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=this.#h(r);Object.keys(i).length>0&&this.#n({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})});let n=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:n.map(r=>{let i=[...r.querySelectorAll("qti-assessment-section")],s=r.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:r.identifier,navigationMode:r.navigationMode,submissionMode:r.submissionMode,allowSkipping:a,sections:i.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,q=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:y,items:f.map(v=>{let w=v.querySelector(":scope > qti-item-session-control"),T=w?w.allowSkipping:y,A=w?w.maxAttempts:q,S=w?w.showFeedback:u,C=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===v.identifier),active:!1,identifier:v.identifier,categories:v.category?v.category?.split(" "):[],href:v.href,variables:[],allowSkipping:T,maxAttempts:A,showFeedback:S,showSolution:C}})}})}})}}#h(t){let e={},n=t.querySelector("qti-default-value");return n&&n.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}#b(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(n=>({...n,sections:n.sections.map(r=>({...r,items:r.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 y=m.querySelector("qti-mapping"),q=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||q?.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,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(n=>({...n,active:this._sessionContext?.navPartId===n.identifier||!1,sections:n.sections.map(r=>({...r,active:this._sessionContext?.navSectionId===r.identifier||!1,completed:r.items.every(i=>this._testContext.items.find(s=>s.identifier===i.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:r.items.map(i=>{let s=this._testContext?.items.find(S=>S.identifier===i.identifier),a={...i,...s,...this.initContext?.find(S=>S.identifier===i.identifier)},l=a.variables?.find(S=>S.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(S=>S.identifier==="completionStatus")?.value,h=a.variables?.find(S=>S.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(S=>S.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(S=>S.type==="response")||[]).every(S=>{if(S.value===void 0||S.value===null)return!0;let C;switch(S.baseType){case"integer":case"float":case"duration":C="0";break;case"boolean":C="false";break;default:C="";break}let R=S.defaultValue??C;if(Array.isArray(S.value)){let N=Array.isArray(R)?R:[R];return S.value.length===N.length&&S.value.every((V,L)=>V===N[L])}return S.value===R}),g=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,v=i.variables?.find(S=>S.identifier=="MAXSCORE")?.value,w=v==null?null:parseFloat(v?.toString()),T=this.#s.get(a.identifier);T===void 0&&(T=s?this.#v(s):"unscored",f>0&&this.#s.set(a.identifier,T));let A=this.#f(f,T,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,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}))}#f(t,e,n,r,i){if(t===0)return!1;if(r)return i==="completed";if(e!=="suboptimal")return!0;let s=n??1;return s>0&&t>=s}#v(t){let e=t.variables??[],n=this.#g(e,"SCORE"),r=this.#g(e,"MAXSCORE");if(n!==null&&r!==null)return n>=r?"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"}#g(t,e){let n=t?.find(i=>i.identifier===e)?.value;if(n==null||Array.isArray(n))return null;let r=parseFloat(n.toString());return Number.isNaN(r)?null:r}};dn([p({type:String})],bt.prototype,"identifier",void 0);dn([_()],bt.prototype,"initContext",void 0);dn([_(),I({context:qt,subscribe:!0})],bt.prototype,"configContext",void 0);dn([_(),I({context:at,subscribe:!0})],bt.prototype,"_testContext",void 0);dn([_(),I({context:Ee,subscribe:!0})],bt.prototype,"_sessionContext",void 0);dn([_(),H({context:j})],bt.prototype,"computedContext",void 0);dn([p({type:Boolean,attribute:"auto-score-items"})],bt.prototype,"autoScoreItems",void 0);var $l=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=x`
7595
7615
  :host {
7596
7616
  ${tt};
7597
- ${qh};
7617
+ ${kh};
7598
7618
  }
7599
7619
  @media (hover: hover) and (pointer: fine) {
7600
7620
  :host(:hover:not([disabled])) {
7601
- ${kh};
7621
+ ${Ch};
7602
7622
  }
7603
7623
  }
7604
7624
  :host(:active:not([disabled])) {
7605
- ${Ch};
7625
+ ${Sh};
7606
7626
  }
7607
7627
  :host(:focus-visible) {
7608
7628
  ${et};
@@ -7610,7 +7630,7 @@ div.full-correct-response-inline {
7610
7630
  :host([disabled]) {
7611
7631
  ${nt};
7612
7632
  }
7613
- `}#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(n=>n.active);e&&(this.sectionItems=e.sections.flatMap(n=>n.items),this.itemIndex=this.sectionItems.findIndex(n=>n.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),n=e?.navigationMode||t.navigationMode,r=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=n==="linear"&&r==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};Nl([p({type:Boolean,reflect:!0,attribute:"disabled"})],hn.prototype,"_internalDisabled",void 0);Nl([I({context:j,subscribe:!0})],hn.prototype,"computedContext",void 0);Nl([z("computedContext")],hn.prototype,"_handleTestElementChange",null);var $l=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=x`
7633
+ `}#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(n=>n.active);e&&(this.sectionItems=e.sections.flatMap(n=>n.items),this.itemIndex=this.sectionItems.findIndex(n=>n.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),n=e?.navigationMode||t.navigationMode,r=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=n==="linear"&&r==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};$l([p({type:Boolean,reflect:!0,attribute:"disabled"})],hn.prototype,"_internalDisabled",void 0);$l([I({context:j,subscribe:!0})],hn.prototype,"computedContext",void 0);$l([z("computedContext")],hn.prototype,"_handleTestElementChange",null);var Ll=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=x`
7614
7634
  :host {
7615
7635
  ${tt};
7616
7636
  }
@@ -7628,7 +7648,7 @@ div.full-correct-response-inline {
7628
7648
  :host([disabled]) {
7629
7649
  ${nt};
7630
7650
  }
7631
- `}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(n=>n.active);e&&(this.sectionItems=e.sections.flatMap(n=>n.items),this.itemIndex=this.sectionItems.findIndex(n=>n.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(r=>r.active),n=t?.sections.find(r=>r.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=n==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};$l([p({type:Boolean,reflect:!0,attribute:"disabled"})],pn.prototype,"_internalDisabled",void 0);$l([I({context:j,subscribe:!0})],pn.prototype,"computedContext",void 0);$l([z("computedContext")],pn.prototype,"_handleTestElementChange",null);var Um=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},sr=class extends k{static{this.styles=x`
7651
+ `}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(n=>n.active);e&&(this.sectionItems=e.sections.flatMap(n=>n.items),this.itemIndex=this.sectionItems.findIndex(n=>n.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(r=>r.active),n=t?.sections.find(r=>r.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=n==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};Ll([p({type:Boolean,reflect:!0,attribute:"disabled"})],pn.prototype,"_internalDisabled",void 0);Ll([I({context:j,subscribe:!0})],pn.prototype,"computedContext",void 0);Ll([z("computedContext")],pn.prototype,"_handleTestElementChange",null);var Hm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},sr=class extends k{static{this.styles=x`
7632
7652
  :host {
7633
7653
  ${tt};
7634
7654
  }
@@ -7646,7 +7666,7 @@ div.full-correct-response-inline {
7646
7666
  :host([disabled]) {
7647
7667
  ${nt};
7648
7668
  }
7649
- `}#t(t){$(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> `}};Um([p({type:String,attribute:"section-id"})],sr.prototype,"sectionId",void 0);var Sh=(o,t)=>o?.plugins?.[t];var $o=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ll=o=>Sh(o,"bookmarks")??[],Eh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Eh(e.host):void 0},$e=class extends k{static{this.styles=x`
7669
+ `}#t(t){$(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> `}};Hm([p({type:String,attribute:"section-id"})],sr.prototype,"sectionId",void 0);var Eh=(o,t)=>o?.plugins?.[t];var Lo=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},zl=o=>Eh(o,"bookmarks")??[],Ah=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Ah(e.host):void 0},$e=class extends k{static{this.styles=x`
7650
7670
  :host {
7651
7671
  ${tt};
7652
7672
  }
@@ -7684,7 +7704,7 @@ div.full-correct-response-inline {
7684
7704
  :host([disabled]) {
7685
7705
  ${nt};
7686
7706
  }
7687
- `}constructor(){super(),this.bookmarked=!1,this.disabled=!1,this.addEventListener("click",()=>this.#e()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#e())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}get#t(){return this.item||(Eh(this)??this.computedContext?.testParts?.flatMap(t=>t.sections.flatMap(e=>e.items)).find(t=>t.active)?.identifier)}willUpdate(){let t=this.#t;this.disabled=!t,this.bookmarked=!!t&&Ll(this.computedContext).includes(t)}updated(){this.setAttribute("aria-pressed",String(this.bookmarked)),this.setAttribute("aria-disabled",String(this.disabled))}#e(){let t=this.#t;if(!t)return;let e=Ll(this.computedContext),n=e.includes(t)?e.filter(r=>r!==t):[...e,t];$(this,"cito-test-update-plugin-state",{plugin:"bookmarks",value:n.length>0?n:null})}render(){return b`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h12v18l-6-4.5L6 21z" /></svg><slot></slot>`}};$o([I({context:j,subscribe:!0}),p({attribute:!1})],$e.prototype,"computedContext",void 0);$o([p({reflect:!0})],$e.prototype,"item",void 0);$o([p({type:Boolean,reflect:!0})],$e.prototype,"bookmarked",void 0);$o([p({type:Boolean,reflect:!0})],$e.prototype,"disabled",void 0);var Hm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},un=class extends k{static{this.styles=x`
7707
+ `}constructor(){super(),this.bookmarked=!1,this.disabled=!1,this.addEventListener("click",()=>this.#e()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#e())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}get#t(){return this.item||(Ah(this)??this.computedContext?.testParts?.flatMap(t=>t.sections.flatMap(e=>e.items)).find(t=>t.active)?.identifier)}willUpdate(){let t=this.#t;this.disabled=!t,this.bookmarked=!!t&&zl(this.computedContext).includes(t)}updated(){this.setAttribute("aria-pressed",String(this.bookmarked)),this.setAttribute("aria-disabled",String(this.disabled))}#e(){let t=this.#t;if(!t)return;let e=zl(this.computedContext),n=e.includes(t)?e.filter(r=>r!==t):[...e,t];$(this,"cito-test-update-plugin-state",{plugin:"bookmarks",value:n.length>0?n:null})}render(){return b`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h12v18l-6-4.5L6 21z" /></svg><slot></slot>`}};Lo([I({context:j,subscribe:!0}),p({attribute:!1})],$e.prototype,"computedContext",void 0);Lo([p({reflect:!0})],$e.prototype,"item",void 0);Lo([p({type:Boolean,reflect:!0})],$e.prototype,"bookmarked",void 0);Lo([p({type:Boolean,reflect:!0})],$e.prototype,"disabled",void 0);var Wm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},un=class extends k{static{this.styles=x`
7688
7708
  :host {
7689
7709
  ${tt};
7690
7710
  }
@@ -7702,7 +7722,7 @@ div.full-correct-response-inline {
7702
7722
  :host([disabled]) {
7703
7723
  ${nt};
7704
7724
  }
7705
- `}constructor(){super(),this.view="scorer",this.addEventListener("click",()=>{$(this,"cito-test-end-attempt",{}),$(this,"cito-test-switch-view",this.view)})}render(){return b` <slot></slot> `}};Hm([p({type:String})],un.prototype,"view",void 0);var Wm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ar=class extends k{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};Wm([_(),I({context:j,subscribe:!0})],ar.prototype,"computedContext",void 0);var Qm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Lo=o=>o==null?"":Array.isArray(o)?o.map(Lo).join(", "):Mt(o)?Object.entries(o).map(([t,e])=>`${t}: ${Lo(e)}`).join(", "):String(o),lr=class extends k{static{this.styles=x`
7725
+ `}constructor(){super(),this.view="scorer",this.addEventListener("click",()=>{$(this,"cito-test-end-attempt",{}),$(this,"cito-test-switch-view",this.view)})}render(){return b` <slot></slot> `}};Wm([p({type:String})],un.prototype,"view",void 0);var Qm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ar=class extends k{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};Qm([_(),I({context:j,subscribe:!0})],ar.prototype,"computedContext",void 0);var Gm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},zo=o=>o==null?"":Array.isArray(o)?o.map(zo).join(", "):Mt(o)?Object.entries(o).map(([t,e])=>`${t}: ${zo(e)}`).join(", "):String(o),lr=class extends k{static{this.styles=x`
7706
7726
  table {
7707
7727
  width: 100%;
7708
7728
  border-collapse: collapse;
@@ -7736,10 +7756,10 @@ div.full-correct-response-inline {
7736
7756
  </tr>
7737
7757
  </thead>
7738
7758
  <tbody>
7739
- ${i.map(a=>{let l=Lo(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`
7759
+ ${i.map(a=>{let l=zo(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`
7740
7760
  <tr>
7741
7761
  <td>${a.identifier}</td>
7742
- <td>${Lo(a.value)}</td>
7762
+ <td>${zo(a.value)}</td>
7743
7763
  <td>${a.cardinality}</td>
7744
7764
  <td>${a.baseType}</td>
7745
7765
  <td>${l||c||d}</td>
@@ -7749,8 +7769,32 @@ div.full-correct-response-inline {
7749
7769
  </table>
7750
7770
  `;return b`
7751
7771
  ${r(e,"Response Variables")} ${r(n,"Outcome Variables")}
7752
- `}};Qm([I({context:j,subscribe:!0})],lr.prototype,"computedContext",void 0);var zl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},mn=class extends k{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ce(t)}#t(t){let r=(this.computedContext?.testParts.find(i=>i.active)).sections.flatMap(i=>i.items).find(i=>i.active)?.identifier;$(this,"cito-test-update-outcome",{assessmentItemRefId:r,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,n=t.variables.find(a=>a.identifier=="SCORE"),r=n?.value,i=n?.externalScored!=="human";if(!e||!n)return P;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:r,disabled:i}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,n=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(n)})}};zl([p({type:String,attribute:"view"})],mn.prototype,"view",void 0);zl([p({type:Boolean})],mn.prototype,"disabled",void 0);zl([I({context:j,subscribe:!0})],mn.prototype,"computedContext",void 0);var Ah=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Zn=class extends k{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,n=t?.variables.find(a=>a.identifier=="SCORE"),r=parseFloat(n?.value),i=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!i&&r!==void 0&&!Number.isNaN(r)?r>0?this.dataset.textCorrect:this.dataset.textIncorrect:i==="externalMachine"?Number.isNaN(r)||r===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${r===0?"geen punten":r==1?"\xE9\xE9n punt":`${r} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:i==="human"?Number.isNaN(r)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Ah([I({context:j,subscribe:!0})],Zn.prototype,"computedContext",void 0);Ah([p({type:String,attribute:"view"})],Zn.prototype,"view",void 0);var Vl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},fn=class extends k{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=Ce(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),n=e?.sections.find(h=>h.active),r=n?.items.find(h=>h.active),{variables:i,...s}=r||{};if(!e)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={...n,items:(n?.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>`:P}
7753
- ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Vl([p({type:Boolean,reflect:!0})],fn.prototype,"debug",void 0);Vl([_(),I({context:j,subscribe:!0})],fn.prototype,"computedContext",void 0);Vl([_()],fn.prototype,"stampContext",void 0);var zo=class extends k{static{this.styles=x`
7772
+ `}};Gm([I({context:j,subscribe:!0})],lr.prototype,"computedContext",void 0);var Xm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},cr=class extends k{#t=null;static{this.styles=x`
7773
+ :host {
7774
+ display: block;
7775
+ }
7776
+ ul {
7777
+ list-style: none;
7778
+ margin: 0;
7779
+ padding-inline-start: 1rem;
7780
+ }
7781
+ summary {
7782
+ cursor: pointer;
7783
+ }
7784
+ [part~='count'] {
7785
+ opacity: 0.7;
7786
+ }
7787
+ `}#e=t=>{this.testState=t.detail};connectedCallback(){super.connectedCallback(),this.#t=this.closest("qti-test"),this.#t?.addEventListener("cito-test-state-changed",this.#e),this.testState=this.#t?.state}disconnectedCallback(){super.disconnectedCallback(),this.#t?.removeEventListener("cito-test-state-changed",this.#e),this.#t=null}render(){return this.testState?b`<ul>
7788
+ ${this.#n("state",this.testState,0)}
7789
+ </ul>`:P}#n(t,e,n){if(e===null||typeof e!="object")return b`<li><span part="key">${t}</span>: <span part="value">${JSON.stringify(e)}</span></li>`;let r=Array.isArray(e)?e.map((s,a)=>[Ym(s,a),s]):Object.entries(e),i=Array.isArray(e)?`[${r.length}]`:`{${r.length}}`;return b`<li>
7790
+ <details ?open=${n<2}>
7791
+ <summary><span part="key">${t}</span> <span part="count">${i}</span></summary>
7792
+ <ul>
7793
+ ${r.map(([s,a])=>this.#n(s,a,n+1))}
7794
+ </ul>
7795
+ </details>
7796
+ </li>`}};Xm([_()],cr.prototype,"testState",void 0);var Ym=(o,t)=>{let e=o?.identifier;return typeof e=="string"?`${t} \xB7 ${e}`:String(t)};var Vl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},mn=class extends k{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ce(t)}#t(t){let r=(this.computedContext?.testParts.find(i=>i.active)).sections.flatMap(i=>i.items).find(i=>i.active)?.identifier;$(this,"cito-test-update-outcome",{assessmentItemRefId:r,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,n=t.variables.find(a=>a.identifier=="SCORE"),r=n?.value,i=n?.externalScored!=="human";if(!e||!n)return P;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:r,disabled:i}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,n=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(n)})}};Vl([p({type:String,attribute:"view"})],mn.prototype,"view",void 0);Vl([p({type:Boolean})],mn.prototype,"disabled",void 0);Vl([I({context:j,subscribe:!0})],mn.prototype,"computedContext",void 0);var Th=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Zn=class extends k{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,n=t?.variables.find(a=>a.identifier=="SCORE"),r=parseFloat(n?.value),i=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!i&&r!==void 0&&!Number.isNaN(r)?r>0?this.dataset.textCorrect:this.dataset.textIncorrect:i==="externalMachine"?Number.isNaN(r)||r===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${r===0?"geen punten":r==1?"\xE9\xE9n punt":`${r} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:i==="human"?Number.isNaN(r)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Th([I({context:j,subscribe:!0})],Zn.prototype,"computedContext",void 0);Th([p({type:String,attribute:"view"})],Zn.prototype,"view",void 0);var jl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},fn=class extends k{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=Ce(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),n=e?.sections.find(h=>h.active),r=n?.items.find(h=>h.active),{variables:i,...s}=r||{};if(!e)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={...n,items:(n?.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>`:P}
7797
+ ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};jl([p({type:Boolean,reflect:!0})],fn.prototype,"debug",void 0);jl([_(),I({context:j,subscribe:!0})],fn.prototype,"computedContext",void 0);jl([_()],fn.prototype,"stampContext",void 0);var Vo=class extends k{static{this.styles=x`
7754
7798
  :host {
7755
7799
  ${tt};
7756
7800
  }
@@ -7768,7 +7812,7 @@ div.full-correct-response-inline {
7768
7812
  :host([disabled]) {
7769
7813
  ${nt};
7770
7814
  }
7771
- `}constructor(){super(),this.addEventListener("click",()=>$(this,"cito-test-submit",{}))}render(){return b` <slot></slot> `}};var cr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vo,Zt=class extends k{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=Vo.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=>Vo.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=Vo.DEFAULT_VIEW_OPTIONS}_switchView(t){$(this,"cito-test-switch-view",t)}render(){return b`
7815
+ `}constructor(){super(),this.addEventListener("click",()=>$(this,"cito-test-submit",{}))}render(){return b` <slot></slot> `}};var dr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},jo,Zt=class extends k{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=jo.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=>jo.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=jo.DEFAULT_VIEW_OPTIONS}_switchView(t){$(this,"cito-test-switch-view",t)}render(){return b`
7772
7816
  <label part="label" for="viewSelect">${this.label}</label>
7773
7817
  <select
7774
7818
  part="select"
@@ -7777,17 +7821,17 @@ div.full-correct-response-inline {
7777
7821
  >
7778
7822
  ${this._viewOptions.map(t=>b`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
7779
7823
  </select>
7780
- `}};Vo=Zt;cr([I({context:Ee,subscribe:!0})],Zt.prototype,"sessionContext",void 0);cr([p({type:String})],Zt.prototype,"label",void 0);cr([p({type:String,attribute:"view-options"})],Zt.prototype,"viewOptions",void 0);cr([z("viewOptions",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleViewOptionsChange",void 0);cr([_()],Zt.prototype,"_viewOptions",void 0);var Gm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},dr=class extends k{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ce(t)}_switchView(t){$(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}):P}`}};Gm([I({context:Ee,subscribe:!0})],dr.prototype,"sessionContext",void 0);var ti=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Fo="tts-element",Bo="tts-word",jo=null;function Xm(){return jo||(jo=new CSSStyleSheet,jo.replaceSync(`
7781
- ::highlight(${Fo}) {
7824
+ `}};jo=Zt;dr([I({context:Ee,subscribe:!0})],Zt.prototype,"sessionContext",void 0);dr([p({type:String})],Zt.prototype,"label",void 0);dr([p({type:String,attribute:"view-options"})],Zt.prototype,"viewOptions",void 0);dr([z("viewOptions",{waitUntilFirstUpdate:!0})],Zt.prototype,"_handleViewOptionsChange",void 0);dr([_()],Zt.prototype,"_viewOptions",void 0);var Jm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hr=class extends k{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ce(t)}_switchView(t){$(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}):P}`}};Jm([I({context:Ee,subscribe:!0})],hr.prototype,"sessionContext",void 0);var ti=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bo="tts-element",Uo="tts-word",Fo=null;function Km(){return Fo||(Fo=new CSSStyleSheet,Fo.replaceSync(`
7825
+ ::highlight(${Bo}) {
7782
7826
  background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--cito-color-info, Highlight)) 15%, transparent));
7783
7827
  color: inherit;
7784
7828
  }
7785
- ::highlight(${Bo}) {
7829
+ ::highlight(${Uo}) {
7786
7830
  background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--cito-color-warning, Mark)) 55%, transparent));
7787
7831
  color: inherit;
7788
7832
  }
7789
- `)),jo}var Th=Symbol("tts-context"),Ym={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"},Le=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
7790
- <path d="${Ym[o]}"></path>
7833
+ `)),Fo}var Ih=Symbol("tts-context"),Zm={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"},Le=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
7834
+ <path d="${Zm[o]}"></path>
7791
7835
  </svg>`;return b`${e}<span class="label">${t}</span>`},Lt=class extends k{static{this.styles=x`
7792
7836
  :host {
7793
7837
  display: inline-flex;
@@ -7838,18 +7882,18 @@ div.full-correct-response-inline {
7838
7882
  clip-path: inset(50%);
7839
7883
  white-space: nowrap;
7840
7884
  }
7841
- `}#t=this.attachInternals();#e;#n=!1;updated(t){let e=this._tts?.state,n=this._tts?.picking??!1;e===this.#e&&n===this.#n||(this.#e=e,this.#n=n,this.#t.states.clear(),e&&this.#t.states.add(e),n&&this.#t.states.add("picking"))}};ti([p({type:String})],Lt.prototype,"label",void 0);ti([I({context:Th,subscribe:!0})],Lt.prototype,"_tts",void 0);var gn=class extends k{static{this.styles=x`
7885
+ `}#t=this.attachInternals();#e;#n=!1;updated(t){let e=this._tts?.state,n=this._tts?.picking??!1;e===this.#e&&n===this.#n||(this.#e=e,this.#n=n,this.#t.states.clear(),e&&this.#t.states.add(e),n&&this.#t.states.add("picking"))}};ti([p({type:String})],Lt.prototype,"label",void 0);ti([I({context:Ih,subscribe:!0})],Lt.prototype,"_tts",void 0);var gn=class extends k{static{this.styles=x`
7842
7886
  :host {
7843
7887
  display: inline-flex;
7844
7888
  flex-wrap: wrap;
7845
7889
  align-items: center;
7846
7890
  gap: var(--test-tts-gap, 0.25rem);
7847
7891
  }
7848
- `}#t;#e;#n;#i;#r;#o;#s;#a;#c;#p;#l;#m;#d;#u;#h;#b;#f;#v;#g;#y;#x;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#n=null,this.#i=!1,this.#r=null,this.#o=null,this.#s=this.#E.bind(this),this.#a=()=>this.#R(),this.#c=void 0,this.#p=void 0,this.#l=null,this.#m=null,this.#d=0,this.#u=[],this.#h=null,this.#b=!1,this.#f=null,this.#v=this.#Q.bind(this),this.#g=!1,this.#y=new Highlight,this.#x=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#F(),pause:()=>this.#B(),resume:()=>this.#U(),stop:()=>{this.#S(),this.#R()},prevElement:()=>this.#G(),nextElement:()=>this.#X(),togglePick:()=>this.#H(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#i||this.#r)return;let{item:e,section:n}=this.#w(),r=this.#c!==void 0&&this.#c!==e,i=this.#p!==void 0&&this.#p!==n,s=this.#l!==null&&this.#m!==null&&this.#m!==this.#D();(r||i||s)&&this.#k(),this.#c=e,this.#p=n}#k(){this.#S(),this.#R(),this.#l=null,this.#d=0,this.#g=!1,this.#A()}connectedCallback(){if(super.connectedCallback(),this.#q("idle"),this.#e=this.#P()!==null,this.#e){this.#n=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#L()}),this.#n.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#i=this.#M()!==null,!this.#i&&(this.#r=this.closest("qti-assessment-item-ref"),this.#r?(this.#o=this.#r,this.#o.addEventListener("qti-assessment-item-connected",this.#s)):(this.#o=this.closest("test-navigation")??this.getRootNode(),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.#S(),this.#I(),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.#r=null,this.#n?.disconnect(),this.#n=null,this.#e=!1,this.#i=!1}render(){return b`<slot></slot>`}#E(){this.#l!==null&&this.#k()}#w(){for(let t of this._computedContext?.testParts??[])for(let e of t.sections)if(e.active)return{item:e.items.find(n=>n.active)?.identifier??null,section:e.identifier};return{item:null,section:null}}#L(){this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#S(),this.#I(),this.#q("idle"),this.#l=null,this.#d=0,this.#g=!1,this.#A()}#P(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#M(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#D(){return this.#e?this.#P()?.querySelector("qti-stimulus-body")??null:this.#i?this.#M():this.#z()?.querySelector("qti-item-body")??null}#z(){if(this.#r)return this.#r.assessmentItem;let{item:t}=this.#w();return t?this._computedContext?.itemElement?.(t)??null:null}#q(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.#C().length}}#C(){if(this.#i&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#d=0,this.#g=!1),this.#l===null){let t=this.#D();if(!t)return[];this.#m=t;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(n=>(n.textContent??"").trim().length>0&&!n.querySelector(e)&&!n.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}#j(t){let e=t;for(;e;){let r=e.getAttribute("lang")||e.getAttribute("xml:lang");if(r?.trim())return r.trim();e=e.parentElement??e.getRootNode().host??null}let n=document.documentElement.getAttribute("lang");return n?.trim()?n.trim():this.language}#F(){if(!this.#C().length){console.warn("test-item-to-speech: no readable elements found");return}this.#S(),speechSynthesis.cancel(),this.#g&&(this.#g=!1,this.#d=0),this.#i&&this.#d===0&&(this.#l=null),this.#_(this.#d)}#_(t){let e=this.#C();if(t>=e.length){this.#T(),this.#d=e.length-1,e.length>0&&this.#O(e[this.#d]),this.#g=!0,this.#q("idle"),this.#A();return}this.#d=t,this.#g=!1,this.#A();let n=e[t];n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(n),this.#u=this.#Y(n);let r=this.#u.map(s=>s.textContent??"").join("");if(!r.trim()){this.#_(t+1);return}let i=new SpeechSynthesisUtterance(r);i.lang=this.#j(n),i.rate=1,i.onboundary=s=>{s.name==="word"&&this.#J(s.charIndex,s.charLength??0)},i.onend=()=>{this.#h===i&&(this.#h=null,this.#T(),this.#_(this.#d+1))},i.onerror=()=>{this.#h===i&&(this.#h=null,this.#I(),this.#q("idle"))},this.#h=i,speechSynthesis.speak(i),this.#q("playing")}#B(){speechSynthesis.pause(),this.#q("paused")}#U(){speechSynthesis.resume(),this.#q("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#I(),this.#q("idle")}#H(){this.#b?this.#S():this.#W()}#W(){this.#i&&(this.#l=null);let t=this.#C();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#R(),this.#b=!0,this.#t.states.add("picking"),this.#N(t),this.#f=t[0].getRootNode(),this.#f.addEventListener("click",this.#v,!0),this._ttsContext={...this._ttsContext,picking:!0}}#S(){this.#b&&(this.#b=!1,this.#t.states.delete("picking"),this.#f?.removeEventListener("click",this.#v,!0),this.#f=null,this.#I(),this._ttsContext={...this._ttsContext,picking:!1})}#Q(t){let e=this.#C(),n=t.composedPath(),r=e.findIndex(i=>n.includes(i));if(r<0){let i=n.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));i&&(r=e.findIndex(s=>i.contains(s)))}r<0||(t.preventDefault(),t.stopPropagation(),this.#S(),speechSynthesis.cancel(),this.#_(r))}#G(){let t=this.#C();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#T(),this.#d=Math.max(0,this.#d-1),this.#g=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#q("idle")}#X(){let t=this.#C();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#T(),this.#d=Math.min(t.length-1,this.#d+1),this.#g=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#q("idle")}#Y(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r;for(;r=n.nextNode();)(r.textContent??"").length>0&&!r.parentElement?.closest('[aria-hidden="true"]')&&e.push(r);return e}#O(t){this.#N([t])}#N(t){if("highlights"in CSS){this.#$(),this.#y.clear();for(let e of t){let n=new Range;n.selectNodeContents(e),this.#y.add(n)}CSS.highlights.set(Fo,this.#y)}}#J(t,e){if(!("highlights"in CSS))return;this.#$(),this.#x.clear();let n=this.#u.map(d=>d.textContent??"").join(""),r=t+(e>0?e:this.#K(t,n)),i=0,s=null,a=0,l=null,c=0;for(let d of this.#u){let h=d.textContent?.length??0;if(!s&&i+h>t&&(s=d,a=t-i),s&&i+h>=r){l=d,c=r-i;break}i+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#x.add(d),CSS.highlights.set(Bo,this.#x)}}#T(){"highlights"in CSS&&(this.#x.clear(),CSS.highlights.get(Bo)===this.#x&&CSS.highlights.delete(Bo))}#I(){"highlights"in CSS&&(this.#T(),this.#y.clear(),CSS.highlights.get(Fo)===this.#y&&CSS.highlights.delete(Fo))}#K(t,e){let n=e.slice(t).search(/\s/);return n<0?e.length-t:n}#$(){if(!("highlights"in CSS))return;let t=Xm();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let r=this.#l?.[0]?.getRootNode();r instanceof ShadowRoot&&e.add(r);for(let i of e)i.adoptedStyleSheets.includes(t)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,t])}};ti([p({type:String})],gn.prototype,"language",void 0);ti([I({context:j,subscribe:!0})],gn.prototype,"_computedContext",void 0);ti([_(),H({context:Th})],gn.prototype,"_ttsContext",void 0);var hr=class extends Lt{#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`
7892
+ `}#t;#e;#n;#i;#r;#o;#s;#a;#c;#p;#l;#m;#d;#u;#h;#b;#f;#v;#g;#y;#x;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#n=null,this.#i=!1,this.#r=null,this.#o=null,this.#s=this.#E.bind(this),this.#a=()=>this.#R(),this.#c=void 0,this.#p=void 0,this.#l=null,this.#m=null,this.#d=0,this.#u=[],this.#h=null,this.#b=!1,this.#f=null,this.#v=this.#Q.bind(this),this.#g=!1,this.#y=new Highlight,this.#x=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#F(),pause:()=>this.#B(),resume:()=>this.#U(),stop:()=>{this.#S(),this.#R()},prevElement:()=>this.#G(),nextElement:()=>this.#X(),togglePick:()=>this.#H(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#i||this.#r)return;let{item:e,section:n}=this.#w(),r=this.#c!==void 0&&this.#c!==e,i=this.#p!==void 0&&this.#p!==n,s=this.#l!==null&&this.#m!==null&&this.#m!==this.#D();(r||i||s)&&this.#k(),this.#c=e,this.#p=n}#k(){this.#S(),this.#R(),this.#l=null,this.#d=0,this.#g=!1,this.#A()}connectedCallback(){if(super.connectedCallback(),this.#q("idle"),this.#e=this.#P()!==null,this.#e){this.#n=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#L()}),this.#n.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#i=this.#M()!==null,!this.#i&&(this.#r=this.closest("qti-assessment-item-ref"),this.#r?(this.#o=this.#r,this.#o.addEventListener("qti-assessment-item-connected",this.#s)):(this.#o=this.closest("test-navigation")??this.getRootNode(),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.#S(),this.#I(),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.#r=null,this.#n?.disconnect(),this.#n=null,this.#e=!1,this.#i=!1}render(){return b`<slot></slot>`}#E(){this.#l!==null&&this.#k()}#w(){for(let t of this._computedContext?.testParts??[])for(let e of t.sections)if(e.active)return{item:e.items.find(n=>n.active)?.identifier??null,section:e.identifier};return{item:null,section:null}}#L(){this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#S(),this.#I(),this.#q("idle"),this.#l=null,this.#d=0,this.#g=!1,this.#A()}#P(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#M(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#D(){return this.#e?this.#P()?.querySelector("qti-stimulus-body")??null:this.#i?this.#M():this.#z()?.querySelector("qti-item-body")??null}#z(){if(this.#r)return this.#r.assessmentItem;let{item:t}=this.#w();return t?this._computedContext?.itemElement?.(t)??null:null}#q(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.#C().length}}#C(){if(this.#i&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#d=0,this.#g=!1),this.#l===null){let t=this.#D();if(!t)return[];this.#m=t;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(n=>(n.textContent??"").trim().length>0&&!n.querySelector(e)&&!n.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}#j(t){let e=t;for(;e;){let r=e.getAttribute("lang")||e.getAttribute("xml:lang");if(r?.trim())return r.trim();e=e.parentElement??e.getRootNode().host??null}let n=document.documentElement.getAttribute("lang");return n?.trim()?n.trim():this.language}#F(){if(!this.#C().length){console.warn("test-item-to-speech: no readable elements found");return}this.#S(),speechSynthesis.cancel(),this.#g&&(this.#g=!1,this.#d=0),this.#i&&this.#d===0&&(this.#l=null),this.#_(this.#d)}#_(t){let e=this.#C();if(t>=e.length){this.#T(),this.#d=e.length-1,e.length>0&&this.#O(e[this.#d]),this.#g=!0,this.#q("idle"),this.#A();return}this.#d=t,this.#g=!1,this.#A();let n=e[t];n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(n),this.#u=this.#Y(n);let r=this.#u.map(s=>s.textContent??"").join("");if(!r.trim()){this.#_(t+1);return}let i=new SpeechSynthesisUtterance(r);i.lang=this.#j(n),i.rate=1,i.onboundary=s=>{s.name==="word"&&this.#J(s.charIndex,s.charLength??0)},i.onend=()=>{this.#h===i&&(this.#h=null,this.#T(),this.#_(this.#d+1))},i.onerror=()=>{this.#h===i&&(this.#h=null,this.#I(),this.#q("idle"))},this.#h=i,speechSynthesis.speak(i),this.#q("playing")}#B(){speechSynthesis.pause(),this.#q("paused")}#U(){speechSynthesis.resume(),this.#q("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#I(),this.#q("idle")}#H(){this.#b?this.#S():this.#W()}#W(){this.#i&&(this.#l=null);let t=this.#C();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#R(),this.#b=!0,this.#t.states.add("picking"),this.#N(t),this.#f=t[0].getRootNode(),this.#f.addEventListener("click",this.#v,!0),this._ttsContext={...this._ttsContext,picking:!0}}#S(){this.#b&&(this.#b=!1,this.#t.states.delete("picking"),this.#f?.removeEventListener("click",this.#v,!0),this.#f=null,this.#I(),this._ttsContext={...this._ttsContext,picking:!1})}#Q(t){let e=this.#C(),n=t.composedPath(),r=e.findIndex(i=>n.includes(i));if(r<0){let i=n.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));i&&(r=e.findIndex(s=>i.contains(s)))}r<0||(t.preventDefault(),t.stopPropagation(),this.#S(),speechSynthesis.cancel(),this.#_(r))}#G(){let t=this.#C();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#T(),this.#d=Math.max(0,this.#d-1),this.#g=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#q("idle")}#X(){let t=this.#C();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#T(),this.#d=Math.min(t.length-1,this.#d+1),this.#g=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#q("idle")}#Y(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r;for(;r=n.nextNode();)(r.textContent??"").length>0&&!r.parentElement?.closest('[aria-hidden="true"]')&&e.push(r);return e}#O(t){this.#N([t])}#N(t){if("highlights"in CSS){this.#$(),this.#y.clear();for(let e of t){let n=new Range;n.selectNodeContents(e),this.#y.add(n)}CSS.highlights.set(Bo,this.#y)}}#J(t,e){if(!("highlights"in CSS))return;this.#$(),this.#x.clear();let n=this.#u.map(d=>d.textContent??"").join(""),r=t+(e>0?e:this.#K(t,n)),i=0,s=null,a=0,l=null,c=0;for(let d of this.#u){let h=d.textContent?.length??0;if(!s&&i+h>t&&(s=d,a=t-i),s&&i+h>=r){l=d,c=r-i;break}i+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#x.add(d),CSS.highlights.set(Uo,this.#x)}}#T(){"highlights"in CSS&&(this.#x.clear(),CSS.highlights.get(Uo)===this.#x&&CSS.highlights.delete(Uo))}#I(){"highlights"in CSS&&(this.#T(),this.#y.clear(),CSS.highlights.get(Bo)===this.#y&&CSS.highlights.delete(Bo))}#K(t,e){let n=e.slice(t).search(/\s/);return n<0?e.length-t:n}#$(){if(!("highlights"in CSS))return;let t=Km();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let r=this.#l?.[0]?.getRootNode();r instanceof ShadowRoot&&e.add(r);for(let i of e)i.adoptedStyleSheets.includes(t)||(i.adoptedStyleSheets=[...i.adoptedStyleSheets,t])}};ti([p({type:String})],gn.prototype,"language",void 0);ti([I({context:j,subscribe:!0})],gn.prototype,"_computedContext",void 0);ti([_(),H({context:Ih})],gn.prototype,"_ttsContext",void 0);var pr=class extends Lt{#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`
7849
7893
  <button part="button" aria-label=${Z(t?this.pauseLabel:this.label)} @click=${this.#t}>
7850
7894
  ${t?b`<slot name="pause">${Le("pause",this.pauseLabel??"Pause")}</slot>`:b`<slot name="play">${Le("play",this.label??"Play")}</slot>`}
7851
7895
  </button>
7852
- `}};ti([p({type:String,attribute:"pause-label"})],hr.prototype,"pauseLabel",void 0);var Uo=class extends Lt{render(){return b`
7896
+ `}};ti([p({type:String,attribute:"pause-label"})],pr.prototype,"pauseLabel",void 0);var Ho=class extends Lt{render(){return b`
7853
7897
  <button
7854
7898
  part="button"
7855
7899
  aria-label=${Z(this.label)}
@@ -7858,7 +7902,7 @@ div.full-correct-response-inline {
7858
7902
  >
7859
7903
  <slot>${Le("pause",this.label??"Pause")}</slot>
7860
7904
  </button>
7861
- `}},Ho=class extends Lt{render(){return b`
7905
+ `}},Wo=class extends Lt{render(){return b`
7862
7906
  <button
7863
7907
  part="button"
7864
7908
  aria-label=${Z(this.label)}
@@ -7867,11 +7911,11 @@ div.full-correct-response-inline {
7867
7911
  >
7868
7912
  <slot>${Le("play",this.label??"Resume")}</slot>
7869
7913
  </button>
7870
- `}},Wo=class extends Lt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
7914
+ `}},Qo=class extends Lt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
7871
7915
  <button part="button" aria-label=${Z(this.label)} ?disabled=${t} @click=${()=>this._tts?.stop()}>
7872
7916
  <slot>${Le("stop",this.label??"Stop")}</slot>
7873
7917
  </button>
7874
- `}},Qo=class extends Lt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
7918
+ `}},Go=class extends Lt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
7875
7919
  <button
7876
7920
  part="button"
7877
7921
  aria-label=${Z(this.label)}
@@ -7880,7 +7924,7 @@ div.full-correct-response-inline {
7880
7924
  >
7881
7925
  <slot>${Le("prev",this.label??"Previous sentence")}</slot>
7882
7926
  </button>
7883
- `}},Go=class extends Lt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
7927
+ `}},Xo=class extends Lt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
7884
7928
  <button
7885
7929
  part="button"
7886
7930
  aria-label=${Z(this.label)}
@@ -7889,7 +7933,7 @@ div.full-correct-response-inline {
7889
7933
  >
7890
7934
  <slot>${Le("next",this.label??"Next sentence")}</slot>
7891
7935
  </button>
7892
- `}},Xo=class extends Lt{render(){return b`
7936
+ `}},Yo=class extends Lt{render(){return b`
7893
7937
  <button
7894
7938
  part="button"
7895
7939
  aria-label=${Z(this.label)}
@@ -7898,11 +7942,11 @@ div.full-correct-response-inline {
7898
7942
  >
7899
7943
  <slot>${Le("pick",this.label??"Read from here")}</slot>
7900
7944
  </button>
7901
- `}};var Ih=[{tag:"test-item-to-speech",ctor:gn},{tag:"test-tts-next",ctor:Go},{tag:"test-tts-pause",ctor:Uo},{tag:"test-tts-pick",ctor:Xo},{tag:"test-tts-play",ctor:hr},{tag:"test-tts-prev",ctor:Qo},{tag:"test-tts-resume",ctor:Ho},{tag:"test-tts-stop",ctor:Wo}];var _h=[{tag:"test-check-item",ctor:un},{tag:"test-bookmark",ctor:$e},{tag:"test-print-context",ctor:ar},{tag:"test-print-item-variables",ctor:lr},{tag:"test-scoring-buttons",ctor:mn},{tag:"test-scoring-feedback",ctor:Zn},{tag:"test-stamp",ctor:fn},{tag:"test-submit",ctor:zo},{tag:"test-view",ctor:Zt},{tag:"test-view-toggle",ctor:dr},...Ih];var Rh=[{tag:"qti-assessment-item-ref",ctor:Ct},{tag:"qti-assessment-section",ctor:St},{tag:"qti-assessment-test",ctor:sn},{tag:"qti-branch-rule",ctor:ce},{tag:"qti-item-session-control",ctor:Dt},{tag:"qti-number-presented",ctor:Qi},{tag:"qti-number-selected",ctor:ao},{tag:"qti-outcome-processing",ctor:co},{tag:"qti-pre-condition",ctor:lo},{tag:"qti-test",ctor:De},{tag:"qti-test-feedback",ctor:nr},{tag:"qti-test-part",ctor:Me},{tag:"qti-test-variables",ctor:ir},{tag:"test-container",ctor:Et},{tag:"test-end-attempt",ctor:cn},{tag:"test-item-link",ctor:or},{tag:"test-navigation",ctor:bt},{tag:"test-next",ctor:hn},{tag:"test-prev",ctor:pn},{tag:"test-section-link",ctor:sr},..._h];for(let{tag:o,ctor:t}of Rh)customElements.get(o)||customElements.define(o,t);var bn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},zt=class extends k{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.#n(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#n(){let t=this.querySelector("template");this.#t=t?t.content:b``}#i(){let t=new CSSStyleSheet;t.replaceSync(Mo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
7945
+ `}};var _h=[{tag:"test-item-to-speech",ctor:gn},{tag:"test-tts-next",ctor:Xo},{tag:"test-tts-pause",ctor:Ho},{tag:"test-tts-pick",ctor:Yo},{tag:"test-tts-play",ctor:pr},{tag:"test-tts-prev",ctor:Go},{tag:"test-tts-resume",ctor:Wo},{tag:"test-tts-stop",ctor:Qo}];var Rh=[{tag:"test-check-item",ctor:un},{tag:"test-bookmark",ctor:$e},{tag:"test-print-context",ctor:ar},{tag:"test-print-item-variables",ctor:lr},{tag:"test-print-state",ctor:cr},{tag:"test-scoring-buttons",ctor:mn},{tag:"test-scoring-feedback",ctor:Zn},{tag:"test-stamp",ctor:fn},{tag:"test-submit",ctor:Vo},{tag:"test-view",ctor:Zt},{tag:"test-view-toggle",ctor:hr},..._h];var Oh=[{tag:"qti-assessment-item-ref",ctor:Ct},{tag:"qti-assessment-section",ctor:St},{tag:"qti-assessment-test",ctor:sn},{tag:"qti-branch-rule",ctor:ce},{tag:"qti-item-session-control",ctor:Dt},{tag:"qti-number-presented",ctor:Qi},{tag:"qti-number-selected",ctor:lo},{tag:"qti-outcome-processing",ctor:ho},{tag:"qti-pre-condition",ctor:co},{tag:"qti-test",ctor:De},{tag:"qti-test-feedback",ctor:nr},{tag:"qti-test-part",ctor:Me},{tag:"qti-test-variables",ctor:ir},{tag:"test-container",ctor:Et},{tag:"test-end-attempt",ctor:cn},{tag:"test-item-link",ctor:or},{tag:"test-navigation",ctor:bt},{tag:"test-next",ctor:hn},{tag:"test-prev",ctor:pn},{tag:"test-section-link",ctor:sr},...Rh];for(let{tag:o,ctor:t}of Oh)customElements.get(o)||customElements.define(o,t);var bn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},zt=class extends k{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.#n(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#n(){let t=this.querySelector("template");this.#t=t?t.content:b``}#i(){let t=new CSSStyleSheet;t.replaceSync(Do),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
7902
7946
  ${this.#t}
7903
7947
  <slot></slot>
7904
- ${Po(this.itemDoc,b`<span>Loading...</span>`)}
7905
- `}};bn([p({attribute:!1})],zt.prototype,"customElementRegistry",void 0);bn([p({type:String,attribute:"item-url"})],zt.prototype,"itemURL",void 0);bn([_()],zt.prototype,"itemDoc",void 0);bn([_()],zt.prototype,"itemXML",void 0);bn([_(),I({context:kt,subscribe:!0})],zt.prototype,"qtiContext",void 0);bn([z("itemURL",{waitUntilFirstUpdate:!0})],zt.prototype,"handleItemURLChange",null);bn([z("itemXML",{waitUntilFirstUpdate:!0})],zt.prototype,"handleItemXMLChange",null);var Jm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pr=class extends k{static{this.styles=x`
7948
+ ${Mo(this.itemDoc,b`<span>Loading...</span>`)}
7949
+ `}};bn([p({attribute:!1})],zt.prototype,"customElementRegistry",void 0);bn([p({type:String,attribute:"item-url"})],zt.prototype,"itemURL",void 0);bn([_()],zt.prototype,"itemDoc",void 0);bn([_()],zt.prototype,"itemXML",void 0);bn([_(),I({context:kt,subscribe:!0})],zt.prototype,"qtiContext",void 0);bn([z("itemURL",{waitUntilFirstUpdate:!0})],zt.prototype,"handleItemURLChange",null);bn([z("itemXML",{waitUntilFirstUpdate:!0})],zt.prototype,"handleItemXMLChange",null);var tf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ur=class extends k{static{this.styles=x`
7906
7950
  table {
7907
7951
  width: 100%;
7908
7952
  border-collapse: collapse;
@@ -7949,7 +7993,7 @@ div.full-correct-response-inline {
7949
7993
  </table>
7950
7994
  `;return b`
7951
7995
  ${r(e,"Response Variables")} ${r(n,"Outcome Variables")}
7952
- `}};Jm([I({context:Se,subscribe:!0})],pr.prototype,"computedContext",void 0);var Km=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Oh=o=>{class t extends o{#t;constructor(...n){super(...n),this.view="candidate",this.addEventListener("qti-assessment-item-connected",r=>{this.#t=r.detail,this.#e()}),this.addEventListener("item-switch-view",r=>{this.view=r.detail})}willUpdate(n){super.willUpdate(n),n.has("view")&&this.#e()}#e(){let n=this.#t;n&&(n.querySelectorAll("[view]").forEach(r=>{r.classList.toggle("show",r.getAttribute("view")===this.view)}),this.updateAssessmentItemView(n,this.view))}updateAssessmentItemView(n,r){}}return Km([p({type:String})],t.prototype,"view",void 0),t};var jl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},me=class extends Oh(k){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#n.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#n(t){this.#r(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.#r(this.assessmentItem.identifier,e||[])}#r(t,e){let n=e?.find(c=>c.identifier=="SCORE")?.value,r=parseFloat(n?.toString()),i=e?.find(c=>c.identifier==="completionStatus")?.value,s=r!==void 0&&!isNaN(r)&&r>0,a=r!==void 0&&!isNaN(r)&&r<=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)}};jl([_(),H({context:Se})],me.prototype,"computedContext",void 0);jl([_(),H({context:qt})],me.prototype,"configContext",void 0);jl([_(),H({context:kt})],me.prototype,"qtiContext",void 0);var Ph=[{tag:"item-container",ctor:zt},{tag:"item-print-variables",ctor:pr},{tag:"qti-item",ctor:me}];for(let{tag:o,ctor:t}of Ph)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of lh)customElements.get(o)||customElements.define(o,t);var Mh=(o,t,e)=>{let n=new Map;for(let r=t;r<=e;r++)n.set(o[r],r);return n},Q=Nt(class extends Re{constructor(o){if(super(o),o.type!==Jn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let n;e===void 0?e=t:t!==void 0&&(n=t);let r=[],i=[],s=0;for(let a of o)r[s]=n?n(a,s):s,i[s]=e(a,s),s++;return{values:i,keys:r}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,n]){let r=sh(o),{values:i,keys:s}=this.dt(t,e,n);if(!Array.isArray(r))return this.ut=s,i;let a=this.ut??=[],l=[],c,d,h=0,f=r.length-1,m=0,y=i.length-1;for(;h<=f&&m<=y;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(a[h]===s[m])l[m]=Oe(r[h],i[m]),h++,m++;else if(a[f]===s[y])l[y]=Oe(r[f],i[y]),f--,y--;else if(a[h]===s[y])l[y]=Oe(r[h],i[y]),Kn(o,l[y+1],r[h]),h++,y--;else if(a[f]===s[m])l[m]=Oe(r[f],i[m]),Kn(o,r[h],r[f]),f--,m++;else if(c===void 0&&(c=Mh(s,m,y),d=Mh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let q=d.get(s[m]),u=q!==void 0?r[q]:null;if(u===null){let g=Kn(o,r[h]);Oe(g,i[m]),l[m]=g}else l[m]=Oe(u,i[m]),Kn(o,r[h],u),r[q]=null;m++}else qo(r[f]),f--;else qo(r[h]),h++;for(;m<=y;){let q=Kn(o,l[y+1]);Oe(q,i[m]),l[m++]=q}for(;h<=f;){let q=r[h++];q!==null&&qo(q)}return this.ut=s,oh(o,l),st}});var ze=Symbol("dragDropContext");var Dh=[O,Xt,x`
7996
+ `}};tf([I({context:Se,subscribe:!0})],ur.prototype,"computedContext",void 0);var ef=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ph=o=>{class t extends o{#t;constructor(...n){super(...n),this.view="candidate",this.addEventListener("qti-assessment-item-connected",r=>{this.#t=r.detail,this.#e()}),this.addEventListener("item-switch-view",r=>{this.view=r.detail})}willUpdate(n){super.willUpdate(n),n.has("view")&&this.#e()}#e(){let n=this.#t;n&&(n.querySelectorAll("[view]").forEach(r=>{r.classList.toggle("show",r.getAttribute("view")===this.view)}),this.updateAssessmentItemView(n,this.view))}updateAssessmentItemView(n,r){}}return ef([p({type:String})],t.prototype,"view",void 0),t};var Fl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},me=class extends Ph(k){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#n.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#n(t){this.#r(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.#r(this.assessmentItem.identifier,e||[])}#r(t,e){let n=e?.find(c=>c.identifier=="SCORE")?.value,r=parseFloat(n?.toString()),i=e?.find(c=>c.identifier==="completionStatus")?.value,s=r!==void 0&&!isNaN(r)&&r>0,a=r!==void 0&&!isNaN(r)&&r<=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)}};Fl([_(),H({context:Se})],me.prototype,"computedContext",void 0);Fl([_(),H({context:qt})],me.prototype,"configContext",void 0);Fl([_(),H({context:kt})],me.prototype,"qtiContext",void 0);var Mh=[{tag:"item-container",ctor:zt},{tag:"item-print-variables",ctor:ur},{tag:"qti-item",ctor:me}];for(let{tag:o,ctor:t}of Mh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ch)customElements.get(o)||customElements.define(o,t);var Dh=(o,t,e)=>{let n=new Map;for(let r=t;r<=e;r++)n.set(o[r],r);return n},Q=Nt(class extends Re{constructor(o){if(super(o),o.type!==Jn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let n;e===void 0?e=t:t!==void 0&&(n=t);let r=[],i=[],s=0;for(let a of o)r[s]=n?n(a,s):s,i[s]=e(a,s),s++;return{values:i,keys:r}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,n]){let r=ah(o),{values:i,keys:s}=this.dt(t,e,n);if(!Array.isArray(r))return this.ut=s,i;let a=this.ut??=[],l=[],c,d,h=0,f=r.length-1,m=0,y=i.length-1;for(;h<=f&&m<=y;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(a[h]===s[m])l[m]=Oe(r[h],i[m]),h++,m++;else if(a[f]===s[y])l[y]=Oe(r[f],i[y]),f--,y--;else if(a[h]===s[y])l[y]=Oe(r[h],i[y]),Kn(o,l[y+1],r[h]),h++,y--;else if(a[f]===s[m])l[m]=Oe(r[f],i[m]),Kn(o,r[h],r[f]),f--,m++;else if(c===void 0&&(c=Dh(s,m,y),d=Dh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let q=d.get(s[m]),u=q!==void 0?r[q]:null;if(u===null){let g=Kn(o,r[h]);Oe(g,i[m]),l[m]=g}else l[m]=Oe(u,i[m]),Kn(o,r[h],u),r[q]=null;m++}else ko(r[f]),f--;else ko(r[h]),h++;for(;m<=y;){let q=Kn(o,l[y+1]);Oe(q,i[m]),l[m++]=q}for(;h<=f;){let q=r[h++];q!==null&&ko(q)}return this.ut=s,sh(o,l),st}});var ze=Symbol("dragDropContext");var Nh=[O,Xt,x`
7953
7997
  /* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
7954
7998
  custom properties on its host; the properties themselves live here. */
7955
7999
  :host {
@@ -7973,9 +8017,9 @@ div.full-correct-response-inline {
7973
8017
  [part~='drag'] {
7974
8018
  flex-shrink: 0;
7975
8019
  }
7976
- `];var Nh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ei=class extends k{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Dh}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">
8020
+ `];var $h=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ei=class extends k{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Nh}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">
7977
8021
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
7978
- </div>`}};Nh([p({type:String,reflect:!0})],ei.prototype,"identifier",void 0);Nh([I({context:ze,subscribe:!0}),_()],ei.prototype,"_dragDrop",void 0);var $h=[{tag:"qti-associable-hotspot",ctor:ei}];var Lh=[O,Xt,x`
8022
+ </div>`}};$h([p({type:String,reflect:!0})],ei.prototype,"identifier",void 0);$h([I({context:ze,subscribe:!0}),_()],ei.prototype,"_dragDrop",void 0);var Lh=[{tag:"qti-associable-hotspot",ctor:ei}];var zh=[O,Xt,x`
7979
8023
  /*
7980
8024
  * A drop target. The interaction measures its chips and publishes the result as custom
7981
8025
  * properties on its own host; the actual CSS properties live here, not in a style attribute.
@@ -8020,9 +8064,9 @@ div.full-correct-response-inline {
8020
8064
  min-height: var(--qti-dropzone-min-height, 0);
8021
8065
  min-width: var(--qti-dropzone-min-width, 0);
8022
8066
  }
8023
- `];var Fl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},vn=class extends k{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Lh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
8067
+ `];var Bl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},vn=class extends k{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=zh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
8024
8068
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
8025
- </div>`}};Fl([p({type:Number,reflect:!0})],vn.prototype,"tabindex",void 0);Fl([p({type:String,reflect:!0})],vn.prototype,"identifier",void 0);Fl([I({context:ze,subscribe:!0}),_()],vn.prototype,"_dragDrop",void 0);var zh=[{tag:"qti-gap",ctor:vn}];var Vh=[O,x`
8069
+ </div>`}};Bl([p({type:Number,reflect:!0})],vn.prototype,"tabindex",void 0);Bl([p({type:String,reflect:!0})],vn.prototype,"identifier",void 0);Bl([I({context:ze,subscribe:!0}),_()],vn.prototype,"_dragDrop",void 0);var Vh=[{tag:"qti-gap",ctor:vn}];var jh=[O,x`
8026
8070
  /* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
8027
8071
  graphic-gap-match rules, on the host from the document. */
8028
8072
  :host {
@@ -8035,7 +8079,7 @@ div.full-correct-response-inline {
8035
8079
  anywhere else it is unset and the chip keeps its size. */
8036
8080
  zoom: var(--qti-graphic-scale, 1);
8037
8081
  }
8038
- `];var Zm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ur=class extends k{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Vh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};Zm([p({type:Number,reflect:!0})],ur.prototype,"tabindex",void 0);var jh=[{tag:"qti-gap-img",ctor:ur}];var yn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Fh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function At(o,t,{activateOn:e="click"}={}){class n extends o{#t;#e;#n(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(i,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(i,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...i){super(...i),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("qti-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),this.#n()}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.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}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 yn([p({type:String})],n.prototype,"identifier",void 0),yn([p({type:Number,reflect:!0,attribute:"tabindex"})],n.prototype,"tabIndex",void 0),yn([p({type:Boolean,attribute:"aria-disabled",converter:Fh})],n.prototype,"disabled",void 0),yn([p({type:Boolean,attribute:"aria-readonly",converter:Fh})],n.prototype,"readonly",void 0),yn([I({context:Mn,subscribe:!0}),_()],n.prototype,"_interactionContext",void 0),yn([z("disabled",{waitUntilFirstUpdate:!0})],n.prototype,"handleDisabledChange",null),yn([z("readonly",{waitUntilFirstUpdate:!0})],n.prototype,"handleReadonlyChange",null),n}var Bh=[O,x`
8082
+ `];var nf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},mr=class extends k{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=jh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};nf([p({type:Number,reflect:!0})],mr.prototype,"tabindex",void 0);var Fh=[{tag:"qti-gap-img",ctor:mr}];var yn=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function At(o,t,{activateOn:e="click"}={}){class n extends o{#t;#e;#n(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(i,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(i,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...i){super(...i),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("qti-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),this.#n()}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.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}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 yn([p({type:String})],n.prototype,"identifier",void 0),yn([p({type:Number,reflect:!0,attribute:"tabindex"})],n.prototype,"tabIndex",void 0),yn([p({type:Boolean,attribute:"aria-disabled",converter:Bh})],n.prototype,"disabled",void 0),yn([p({type:Boolean,attribute:"aria-readonly",converter:Bh})],n.prototype,"readonly",void 0),yn([I({context:Mn,subscribe:!0}),_()],n.prototype,"_interactionContext",void 0),yn([z("disabled",{waitUntilFirstUpdate:!0})],n.prototype,"handleDisabledChange",null),yn([z("readonly",{waitUntilFirstUpdate:!0})],n.prototype,"handleReadonlyChange",null),n}var Uh=[O,x`
8039
8083
  /*
8040
8084
  * A chip's own box. Both drag-drop interactions that use this element laid it out from the
8041
8085
  * theme — gap-match with 'display: flex !important; align-items: center !important',
@@ -8078,8 +8122,8 @@ div.full-correct-response-inline {
8078
8122
  align-items: center;
8079
8123
  justify-content: center;
8080
8124
  }
8081
- `];var tf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ve=class extends At(k,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Bh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
8082
- <slot part="label"></slot>`}};tf([p({type:Number,reflect:!0})],Ve.prototype,"tabindex",void 0);var Uh=[{tag:"qti-gap-text",ctor:Ve}];var Hh=[O,x`
8125
+ `];var rf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ve=class extends At(k,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Uh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
8126
+ <slot part="label"></slot>`}};rf([p({type:Number,reflect:!0})],Ve.prototype,"tabindex",void 0);var Hh=[{tag:"qti-gap-text",ctor:Ve}];var Wh=[O,x`
8083
8127
  :host {
8084
8128
  display: flex;
8085
8129
  user-select: none;
@@ -8099,7 +8143,7 @@ div.full-correct-response-inline {
8099
8143
  display: grid;
8100
8144
  place-content: center;
8101
8145
  }
8102
- `];var ef=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},wn=class extends At(k,"qti-hotspot-choice"){static{this.styles=Hh}};ef([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],wn.prototype,"order",void 0);var Wh=[{tag:"qti-hotspot-choice",ctor:wn}];var Qh=[O,x`
8146
+ `];var of=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},wn=class extends At(k,"qti-hotspot-choice"){static{this.styles=Wh}};of([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],wn.prototype,"order",void 0);var Qh=[{tag:"qti-hotspot-choice",ctor:wn}];var Gh=[O,x`
8103
8147
  /* 'position: relative' is the containing block for the answer-key tick the theme draws as an
8104
8148
  absolutely positioned ::before. See CONTRACT.md §7. */
8105
8149
  :host {
@@ -8119,8 +8163,8 @@ div.full-correct-response-inline {
8119
8163
  [part='control'] {
8120
8164
  display: none;
8121
8165
  }
8122
- `];var xn=class extends At(k,"qti-hottext"){static{this.styles=Qh}render(){return b`<div part="control"><div part="control-mark"></div></div>
8123
- <slot part="label"></slot>`}};var Gh=[{tag:"qti-hottext",ctor:xn}];var nf=x`
8166
+ `];var xn=class extends At(k,"qti-hottext"){static{this.styles=Gh}render(){return b`<div part="control"><div part="control-mark"></div></div>
8167
+ <slot part="label"></slot>`}};var Xh=[{tag:"qti-hottext",ctor:xn}];var sf=x`
8124
8168
  /*
8125
8169
  * An option row: one line, clipped, with its text centred against the row's min-height. All four
8126
8170
  * were in the theme, set on this host from the document — which is also why the 'display: block'
@@ -8137,13 +8181,13 @@ div.full-correct-response-inline {
8137
8181
  slot {
8138
8182
  display: inline;
8139
8183
  }
8140
- `,Xh=nf;var rf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},mr=class extends At(k,"qti-inline-choice"){static{this.styles=Xh}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}}))}};rf([p({type:String})],mr.prototype,"identifier",void 0);var Yh=[{tag:"qti-inline-choice",ctor:mr}];var Jh=[O,x`
8184
+ `,Yh=sf;var af=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},fr=class extends At(k,"qti-inline-choice"){static{this.styles=Yh}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}}))}};af([p({type:String})],fr.prototype,"identifier",void 0);var Jh=[{tag:"qti-inline-choice",ctor:fr}];var Kh=[O,x`
8141
8185
  :host {
8142
8186
  display: block;
8143
8187
  margin: var(--qti-gap) 0;
8144
8188
  width: 100%;
8145
8189
  }
8146
- `];var Yo=class extends k{static{this.styles=Jh}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Kh=[{tag:"qti-prompt",ctor:Yo}];var Zh=[O,Xt,x`
8190
+ `];var Jo=class extends k{static{this.styles=Kh}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Zh=[{tag:"qti-prompt",ctor:Jo}];var tp=[O,Xt,x`
8147
8191
  /*
8148
8192
  * 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
8149
8193
  * way. In tabular match this element is a light-DOM *grandchild* of the slotted
@@ -8292,13 +8336,13 @@ div.full-correct-response-inline {
8292
8336
  align-items: center;
8293
8337
  justify-content: center;
8294
8338
  }
8295
- `];var Jo=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vt=class extends At(k,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Zh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
8339
+ `];var Ko=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vt=class extends At(k,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=tp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
8296
8340
  <div part="control"></div>
8297
8341
  <slot part="label"></slot>
8298
8342
  <div part="drop">
8299
8343
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
8300
8344
  </div>
8301
- `}};Jo([p({type:Number,attribute:"match-min"})],Vt.prototype,"matchMin",void 0);Jo([p({type:Number,attribute:"match-max"})],Vt.prototype,"matchMax",void 0);Jo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Jo([I({context:ze,subscribe:!0}),_()],Vt.prototype,"_dragDrop",void 0);var tp=[{tag:"qti-simple-associable-choice",ctor:Vt}];var ep=[O,x`
8345
+ `}};Ko([p({type:Number,attribute:"match-min"})],Vt.prototype,"matchMin",void 0);Ko([p({type:Number,attribute:"match-max"})],Vt.prototype,"matchMax",void 0);Ko([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Ko([I({context:ze,subscribe:!0}),_()],Vt.prototype,"_dragDrop",void 0);var ep=[{tag:"qti-simple-associable-choice",ctor:Vt}];var np=[O,x`
8302
8346
  /*
8303
8347
  * 'position: relative' unconditionally, because this element can carry a correction badge and a
8304
8348
  * badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
@@ -8334,9 +8378,9 @@ div.full-correct-response-inline {
8334
8378
  align-items: center;
8335
8379
  justify-content: center;
8336
8380
  }
8337
- `];var Ko=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},jt=class extends At(k,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=ep}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control"><div part="control-mark"></div></div>
8381
+ `];var Zo=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},jt=class extends At(k,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=np}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control"><div part="control-mark"></div></div>
8338
8382
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
8339
- <slot part="label"></slot>`}};Ko([p({type:String,attribute:"template-identifier"})],jt.prototype,"templateIdentifier",void 0);Ko([p({type:String,attribute:"show-hide"})],jt.prototype,"showHide",void 0);Ko([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],jt.prototype,"fixed",void 0);Ko([p({type:String,attribute:!1})],jt.prototype,"marker",void 0);var np=[{tag:"qti-simple-choice",ctor:jt}];var ip=[...$h,...zh,...jh,...Uh,...Wh,...Gh,...Yh,...Kh,...tp,...np];var of=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};function sf(o,t,e,n,r={}){let i=r.publishWidth??!0,s=r.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=n.length?n:[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")}),r.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`)),n.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 Bl=(o,t,e,n='slot[part="drags"]')=>{class r extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#n=null,this.#i=0,this.#r=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#n;#i;#r;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(n,this),...s(n,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(sf(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#r;return d&&d.height===c.height&&d.width===c.width?!1:(this.#r=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#n||(this.#n=new MutationObserver(()=>this.#s()),this.#n.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.#n?.disconnect(),this.#n=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return of([p({type:Boolean,attribute:"auto-size-dropzones"})],r.prototype,"autoSizeDropzones",void 0),r};var{AbortController:te,AbortSignal:Ul,WeakMap:af,WeakRef:lf,Window:rp,reportError:Zo=console.log}=globalThis,je=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||je(o.defaultView.parent.document)),qn=()=>!!rp&&globalThis instanceof rp,Hl=Symbol("unset"),[op,cf]=(()=>{function o(q,u,g=!0){Object.defineProperty(q,u,{...Object.getOwnPropertyDescriptor(q,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(q,...u)=>new Promise(g=>g(q(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let q,u;return{promise:new Promise((v,w)=>(q=v,u=w)),resolve:q,reject:u}};function n(q,u){let g=u.call(q);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let r=new af,i={next(...q){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:v}=g;return t(()=>v.next(...q))},return(...q){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:v}=g;return t(()=>v.return?v.return(...q):{value:void 0,done:!0})},throw(...q){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:v}=g;return t(()=>{if(!v.throw)throw v.return(),new TypeError("no throw method");return v.throw(...q)})}};function s(q){let u=Object.create(i);return r.set(u,{syncIteratorRecord:q}),u}function a(q,u){let g;if(u){if(g=q[Symbol.asyncIterator],g==null){if(g=q[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let v=n(q,g);return s(v)}}else g=q[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return n(q,g)}let l="any"in Ul?Ul.any.bind(Ul):q=>{let u=new te;for(let g of q)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of q)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=q=>l(q.filter(Boolean));class d{constructor({next:u,error:g,complete:v}={}){r.set(this,{next:u,error:g,complete:v})}next(u){let{next:g}=r.get(this)||{};g&&g(u)}error(u){let{error:g}=r.get(this)||{};g?g(u):Zo(u)}complete(){let{complete:u}=r.get(this)||{};u&&u()}}function h(q,u){let g=r.get(q);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let v of g.teardowns.reverse()){if(qn()&&!je(document))return;try{v()}catch(w){Zo(w)}}}}function f(q,u,g={}){if(qn()&&!je(document))return;let v;typeof u=="function"?v=new d({next:u}):u&&!(u instanceof d)?v=new d(u):v=u||new d;let w=r.get(q),T=w.weakSubscriber?.deref();if(T?.active){let S=T,C=r.get(S);C.observers.add(v),g.signal&&(g.signal.aborted?C.observers.delete(v):g.signal.addEventListener("abort",()=>{let R=r.get(S);R?.active&&(R.observers.delete(v),R.observers.size==0&&h(S,g.signal.reason))}));return}let A=new m(v);if(w.weakSubscriber=new lf(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let S=r.get(A);S?.active&&(S.observers.delete(v),S.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(S){A.error(S)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");r.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=r.get(this);if(!g?.active||qn()&&!je(document))return;let v=new Set(g.observers);for(let w of v)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=r.get(this);if(!g?.active){Zo(u);return}if(qn()&&!je(document))return;h(this,u);let v=new Set(g.observers);for(let w of v)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=r.get(this);if(!u?.active||qn()&&!je(document))return;h(this);let g=new Set(u.observers);for(let v of g)v.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(qn()&&!je(document))return;let g=r.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!r.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!r.has(this)){let u=new te;return u.abort(),u.signal}return r.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 y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");r.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 y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let T=function(A,S){if(A.signal.aborted)return;let C;try{let R=S.next();C=Promise.resolve(R)}catch(R){C=Promise.reject(R)}C.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),T(A,S)},R=>{A.error(R)})},w=!1;return new y(A=>{if(A.signal.aborted)return;let S;try{S=a(u,!0)}catch(R){A.error(R);return}let C=S;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||w)return;t(()=>C.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),T(A,C))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(w=>{if(w.signal.aborted)return;let T;try{T=a(u,!1)}catch(C){w.error(C);return}let A=!1,S=T;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||A)return;let C=S.return();if(C===null||typeof C!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let C=S.next();if({done:A}=C,A){w.complete();return}if(w.next(C.value),w.signal.aborted)break}catch(C){w.error(C);break}});if(u instanceof Promise||typeof u.then=="function")return new y(w=>{u.then(T=>{w.next(T),w.complete()},T=>{w.error(T)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,v=y.from(u);return new y(w=>{let T=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(v,T,A),!w.active)return;let S=new d({next(C){w.next(C)},error(C){w.error(C)},complete(){w.complete()}});f(g,S,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=new d({next(S){let C;try{C=u(S,w)}catch(R){v.error(R);return}w+=1,v.next(C)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}inspect(u={}){let g=null,v=null,w=null,T=null,A=null;typeof u=="function"?v=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(v=u.next),"error"in u&&(w=u.error),"complete"in u&&(T=u.complete),"abort"in u&&(A=u.abort));let S=this;return new y(C=>{if(g!==null)try{g()}catch(L){C.error(L);return}let R=()=>{try{A!==null&&A(C.signal.reason)}catch(L){Zo(L)}};C.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(v!==null)try{v(L)}catch(mt){C.signal.removeEventListener("abort",R),C.error(mt);return}C.next(L)},error(L){if(C.signal.removeEventListener("abort",R),w!==null)try{w(L)}catch(mt){C.error(mt);return}C.error(L)},complete(){if(C.signal.removeEventListener("abort",R),T!==null)try{T()}catch(L){C.error(L);return}C.complete()}}),V={signal:C.signal};f(S,N,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=new d({next(S){let C=!1;try{C=u(S,w)}catch(R){v.error(R);return}w+=1,C&&v.next(S)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(v=>{let w=u;if(w==0)return v.complete();let T=new d({next(S){v.next(S),w-=1,w==0&&v.complete()},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(v=>{let w=u,T=new d({next(S){if(w>0)return w-=1;w==0&&v.next(S)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=!1,A=[];function S(V){let L;try{L=u(V,w)}catch(ie){return v.error(ie)}w+=1;let mt;try{mt=y.from(L)}catch(ie){return v.error(ie)}let Na=new d({next(ie){v.next(ie)},error(ie){v.error(ie)},complete(){if(A.length){let ie=A.shift();S(ie)}else C=!1,T&&v.complete()}}),Wt={signal:v.signal};f(mt,Na,Wt)}let C=!1,R=new d({next(V){C?A.push(V):(C=!0,S(V))},error(V){v.error(V)},complete(){T=!0,!C&&!A.length&&v.complete()}}),N={signal:v.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=!1,A=null;function S(N){let V;try{V=u(N,w)}catch(Wt){return v.error(Wt)}w+=1;let L;try{L=y.from(V)}catch(Wt){return v.error(Wt)}let mt=new d({next(Wt){v.next(Wt)},error(Wt){v.error(Wt)},complete(Wt){T?v.complete():A=null}}),Na={signal:c([A.signal,v.signal])};f(L,mt,Na)}let C=new d({next(N){A&&A.abort(),A=new te,S(N)},error(N){v.error(N)},complete(){T=!0,A||v.complete()}}),R={signal:v.signal};f(g,C,R)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(w=>{let T=new d({next(S){w.next(S)},error(S){let C;try{C=u(S)}catch(L){w.error(L);return}let R;try{R=y.from(C)}catch(L){w.error(L);return}let N=new d({next(L){w.next(L)},error(L){w.error(L)},complete(){w.complete()}}),V={signal:w.signal};f(R,N,V)},complete(){w.complete()}}),A={signal:w.signal};f(g,T,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{v.addTeardown(u);let w=new d({next(A){v.next(A)},error(A){v.error(A)},complete(){v.complete()}}),T={signal:v.signal};f(g,w,T)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:v,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 T=[],A=new d({next(S){T.push(S)},error(S){w(S)},complete(){v(T)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){try{u(N,C)}catch(V){T(V),A.abort(V)}C+=1},error(N){T(N)},complete(){w()}});return f(this,R,S),v}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){let V=!1;try{V=u(N,C)}catch(L){T(L),A.abort(L)}C+=1,V||(w(!1),A.abort())},error(N){T(N)},complete(){w(!0)}});return f(this,R,S),v}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:v,reject:w}=e(),T=new te,A={signal:c([T.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let S=new d({next(C){v(C),T.abort()},error(C){w(C)},complete(){w(new RangeError("No values in Observable"))}});return f(this,S,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:v,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 T=null,A=!1,S=new d({next(C){A=!0,T=C},error(C){w(C)},complete(){A?v(T):w(new RangeError("No values in Observable"))}});return f(this,S,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){let V=!1;try{V=u(N,C)}catch(L){T(L),A.abort(L)}C+=1,V&&(w(N),A.abort())},error(N){T(N)},complete(){w()}});return f(this,R,S),v}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){let V=!1;try{V=u(N,C)}catch(L){T(L),A.abort(L)}C+=1,V&&(w(!0),A.abort())},error(N){T(N)},complete(){w(!1)}});return f(this,R,S),v}reduce(u,g,v={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:T,reject:A}=e(),S=new te,C={signal:c([S.signal,v.signal])};if(C.signal.aborted)return A(C.signal.reason),w;C.signal.addEventListener("abort",()=>{A(C.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Hl,V=new d({next(L){if(N===Hl){N=L,R++;return}try{let mt=u(N,L,R);R++,N=mt}catch(mt){A(mt),S.abort(mt);return}},error(L){A(L)},complete(){N!==Hl?T(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,C),w}}return o(y.prototype,"subscribe"),[y,m]})();function sp(){return typeof globalThis.Observable=="function"}function ap(){Object.defineProperties(globalThis,{Observable:{value:op,configurable:!0,writable:!0},Subscriber:{value:cf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(qn()&&!je(document))return;let e=this;return new op(n=>{if(!e||n.signal.aborted)return;let r=i=>{n.next(i)};e.addEventListener(o,r,{capture:t.capture||!1,passive:t.passive,once:!1,signal:n.signal})})}}function Wl(o,t,e){let n=o.filter(r=>!r.hasAttribute("disabled"));for(let r of n){let i=r.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return r}return null}function lp(o,t,e,n){if(!n)return null;let r=o.filter(s=>!s.hasAttribute("disabled")),i=n.getBoundingClientRect();for(let s of r){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 cp(o,t,e,n){let r=o.filter(c=>!c.hasAttribute("disabled"));if(r.length===0)return null;let i,s;if(n){let c=n.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 r){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 dp(o,t,e,n){let r=o.filter(l=>!l.hasAttribute("disabled"));if(r.length===0)return null;let i;if(n){let l=n.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 r){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 y of i)for(let q of d){let u=Math.sqrt(Math.pow(y.x-q.x,2)+Math.pow(y.y-q.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function df(o,t,e){let n=o.getBoundingClientRect();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}function hf(o,t,e,n,r){let i=r&&r.length>0?o.filter(g=>r.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(n){let g=n.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 v=g.getBoundingClientRect(),w=[{x:v.left,y:v.top},{x:v.right,y:v.top},{x:v.left,y:v.bottom},{x:v.right,y:v.bottom}],T=0,A=0;for(let S of l)for(let C of w){let R=Math.sqrt(Math.pow(S.x-C.x,2)+Math.pow(S.y-C.y,2));T+=R,A++}return T/A},d=null,h=1/0;for(let g of i){let v=c(g);v<h&&(h=v,d=g)}let f=null,m=1/0;for(let g of a){let v=c(g);v<m&&(m=v,f=g)}if(d&&n){let g=n.getBoundingClientRect(),v=d.getBoundingClientRect(),w=g.left+g.width/2,T=g.top+g.height/2;if(w>=v.left&&w<=v.right&&T>=v.top&&T<=v.bottom)return d}if(f&&df(f,t,e))return f;let q=n?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*q?d:f:d||f}function hp(o){switch(o){case"pointerWithin":return Wl;case"rectangleIntersection":return lp;case"closestCenter":return cp;case"closestCorners":return dp;case"closestCornersWithInventoryPriority":return hf;default:return Wl}}function ni(o,t,e,n,r="pointerWithin",i){return hp(r)(o,t,e,n,i)}function Fe(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let n of e)if(n instanceof HTMLElement&&n.tagName!=="SLOT"){if(n.matches(t)||n.hasAttribute("qti-draggable"))return n;let r=n.closest(t)||n.closest('[qti-draggable="true"]');if(r)return r}return null}function fr(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Ql=o=>o?.internals;function Ft(o,t,e){let n=Ql(o)?.states;n&&(e?n.add(t):n.delete(t))}function ts(o,t){return Ql(o)?.states?.has(t)??!1}function gr(o){Ft(o,"dragging",!1),Ft(o,"placeholder",!1),Ft(o,"return-anchor",!1)}function kn(o){return ts(o,"dragging")||ts(o,"placeholder")}function fe(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let n=Ql(o)?.states;if(n){e?n.add(t):n.delete(t);return}let r=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));r.has("drop")&&(e?r.add(t):r.delete(t),o.setAttribute("part",[...r].join(" ")))}function ii(o,t){fe(o,"filled",t)}function ri(o,t){let e=[];return o.forEach(n=>{let r=[];n.tagName.toLowerCase()==="slot"?r=n.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):r=Array.from(n.querySelectorAll(`[identifier="${t}"]`)),e.push(...r)}),e}function pp(o,t){let e=o.find(r=>r.getAttribute("identifier")===t);if(!e)return 1;let n=e.getAttribute("match-max");return n?parseInt(n,10)||0:1}var Gl={origin:{x:0,y:0},scale:{x:1,y:1}},es=100,pf=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},uf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},mf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Xl=(o,t)=>{let e=o.ownerDocument??document,n=t??e.body,r=pf(e);return r&&!mf(r,n)?uf(r):n},Yl=(o,t=1)=>{let n=(o.ownerDocument??document).createElement("div");n.style.cssText=`position:fixed;left:0;top:0;width:${es}px;height:${es}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(n);let r=n.getBoundingClientRect();return n.remove(),{origin:{x:r.left,y:r.top},scale:{x:(r.width/es||1)*t,y:(r.height/es||1)*t}}},up=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});sp()||ap();var mp=new WeakSet;function ff(o){!o||mp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),mp.add(o))}var fp=o=>!!o.internals?.states,ns=(o,t,e,n='slot[part="drags"]',r="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=r,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Gl,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#n=a=>{let l=a;if(l.context!==Mn)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.#n,{capture:!0}),ff(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#n,{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;#n;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=(C,R)=>Array.from(R?.querySelectorAll(C)??[]),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),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let q=a(n,this),u=a(n,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...q,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),v=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),T=g?v:new Set,A=g?w:new Set,S=new Set([...v,...w].filter(fp));for(let C of this.#t)S.has(C)||(C.internals.states.delete("drag"),C.internals.states.delete("droppable"));for(let C of S){let R=T.has(C),N=!R&&A.has(C);R?C.internals.states.add("drag"):C.internals.states.delete("drag"),N?C.internals.states.add("droppable"):C.internals.states.delete("droppable")}this.#t=S,this.trackedDraggables.forEach(C=>{let R=kn(C);g&&!R?(C.style.cursor="grab",C.style.userSelect="none",C.style.touchAction="none",C.style.webkitUserSelect="none",C.style.webkitTouchCallout="none",C.setAttribute("qti-draggable","true"),C.setAttribute("tabindex","0")):(C.style.cursor="",C.style.userSelect="",C.style.touchAction="",C.style.webkitUserSelect="",C.style.webkitTouchCallout="",C.removeAttribute("qti-draggable"),C.getAttribute("tabindex")==="0"&&C.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 y=Fe(m,t),q=this.disabled||this.readonly,u=fr(y)||kn(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!q&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Fe(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let q=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),q===0){this.dragState.dragging||this.initiateDrag(y,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(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},q)}),c=a.when("mousedown").filter(m=>{let y=Fe(m,t),q=this.disabled||this.readonly,u=fr(y)||kn(y),g=m.button===0,v=Date.now()-this.lastPointerDownAt<50;return y&&g&&!q&&!u&&!v}).subscribe(m=>{let y=Fe(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Fe(m,t),q=this.disabled||this.readonly,u=fr(y)||kn(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),v=Date.now()-this.lastPointerDownAt<50;return y&&g&&!q&&!u&&!v}).subscribe(m=>{let y=Fe(m,t),q=m.touches?.[0]||m.changedTouches?.[0];!y||!q||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,q.clientX,q.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 y=this.trackedDraggables.filter(u=>!kn(u)),q=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%q.length;h={...h,dropIndex:u,dropElement:q[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+q.length)%q.length;h={...h,dropIndex:u,dropElement:q[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=Fe(m,t),g=this.disabled||this.readonly,v=fr(u)||kn(u);u&&["Space","Enter"].includes(m.code)&&!g&&!v&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:q[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 y=v=>v.contains(a)||!!v.shadowRoot?.contains(a),q=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(v=>v.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:[]},q){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let v=a.getAttribute("identifier");if(v){let w=ri(this.trackedDragContainers,v);w.forEach(T=>Ft(T,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Ft(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,T=this.dragState.pointerId;w&&T!==void 0&&w.setPointerCapture&&w.setPointerCapture(T)}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 v=()=>{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,T=this.dragState.pointerId;w&&T!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(T)}catch{}};this.dragState.touchCleanup=v}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let v=this.dragState.startedFromTrustedEvent;return v===void 0||g.isTrusted===v},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let v=g.touches?.[0]||g.changedTouches?.[0];if(!v)return;this.handleDragMove(v.clientX,v.clientY);return}if(l==="mouse"){let v=g;if(typeof v.buttons=="number"&&(v.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())}}),y=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()}}),q=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,q];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=ni(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=>fe(m,"hover",!1)),c&&fe(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 y=l.getBoundingClientRect();h=ni(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Ft(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{Ft(y,"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){gr(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))}c.style.removeProperty("box-shadow");let h=Xl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Yl(h,this.cloneZoom),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.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}=up(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=Xl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Yl(m,this.cloneZoom),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=>{fe(a,"enabled",!0),fe(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{fe(a,"enabled",!1),fe(a,"active",!1),fe(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Ft(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=Gl,this.cloneZoom=1,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)fp(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var gp={duration:250,easing:"ease",fill:"both"};function Jl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function bp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Be(o){let t=new Map;return o.forEach(e=>{t.set(e,Jl(e))}),t}function vp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function is(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 Kl(o){return is(o)>0}function rs(o,t,e={}){let n=is(o);if(n<=0)return null;let r=Jl(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:l}=vp(t,r);if(i===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...gp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*n,easing:d,fill:h})}function Ue(o,t={}){let e=new Map;return o.forEach((n,r)=>{if(!(r instanceof HTMLElement))return;let i=rs(r,n,t);i&&e.set(r,i)}),e}var br=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bt=(o,t,e,n='slot[part="drags"]',r="closestCornersWithInventoryPriority")=>{let i=Bl(o,t,e,n),s=ns(i,t,e,n,r);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&&ii(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()),ii(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),q=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,q.length),h[m]=y}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&&Kl(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(q=>this.placeResponse(q));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(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(ts(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),q=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&q,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{rs(c,bp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){gr(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 q=ri(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);q&&this.dropDraggableInDroppable(q,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 T=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),T&&this.restoreOriginalInInventory(T,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,q=y===0||y>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Be(u):null;if(!q){let T=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(T){let A=T.getAttribute("identifier"),S=T.getBoundingClientRect();this.removeChipFromDroppable(d,T);let C=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&C&&C!==d&&this.isDeclarativeTarget(C)?C:null;R?(this.placeChip(R,T),ii(R,!0),this.animateReturn(T,S)):A&&this.restoreOriginalInInventory(A,S)}}let v=c.cloneNode(!0);v.removeAttribute("style"),v.removeAttribute("data-keyboard-dragging"),v.setAttribute("qti-draggable","true"),v.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(v.setAttribute("part",v.localName==="qti-gap-text"?"drag drag-text":"drag"),v.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,v)):d.tagName==="SLOT"?v.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&v.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(v)),ii(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Ue(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let T=v.getBoundingClientRect(),A=h.left-T.left,S=h.top-T.top;(A!==0||S!==0)&&v.animate([{transform:`translate(${A}px, ${S}px)`},{transform:"translate(0, 0)"}],{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(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&ii(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=ri(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(q=>{q.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?Be(m):null;h.forEach(q=>{gr(q),q.style.display="",q.style.visibility="visible"}),y&&this.enableFlipAnimations&&Ue(y,this.flipAnimationConfig),h.forEach(q=>this.animateReturn(q,d))}updateInventoryBasedOnMatchMax(c){let d=ri(this.trackedDragContainers,c),h=pp(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(q=>q.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{Ft(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="",y=!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}.`,y=!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}.`,y=!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"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let q=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,q,{suppressInline:!0}),y}reportValidity(){return super.reportValidity()}}return br([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),br([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),br([H({context:ze})],a.prototype,"_dragDrop",void 0),br([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),br([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Jt({emptyAs:[]})})],a.prototype,"response",null),a};var os=class{getInsertPosition(t,e,n,r,i){let s=t.indexOf(n);if(s===-1)return null;let a=n.getBoundingClientRect(),l=(i-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var yp=new os;var gf={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function vr(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function ss(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function as(o,t,e={}){let n={...gf,...e},r=document.createElement("div");return r.setAttribute("data-drop-placeholder","true"),r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.margin=window.getComputedStyle(o).margin,r.style.boxSizing="border-box",r.style.border=`${n.borderStyle} ${n.borderColor}`,r.style.borderRadius=getComputedStyle(o).borderRadius,r.style.background=n.background,r.style.transition=`transform ${n.transitionDuration*is(o)}ms ease`,r.style.pointerEvents="none",r}function Zl(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ut=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#n=vr(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#r=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#n;#i;#r;#o;set allowReorder(r){this.#o=r}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(r){return Zl(r,this.trackedDroppables)}#s(r){return r.querySelector(t)}#a(r){let i=this.#c(r);return i===0||i>1}#c(r){let i=parseInt(r.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#p(r){return r.querySelectorAll(t).length}#l(r){let i=this.#c(r);return i===0?!1:this.#p(r)>=i}#m(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(r){if(!this.#t||r===this.#t){this.#u();return}if(this.#i.hoveredSlot===r)return;this.#u();let i=this.#s(r);if(!i){this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r;return}if(this.#a(r)){if(this.#l(r)){this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),this.#i.hoveredSlot=null;return}this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r;return}if(this.isDeclarativeTarget(r)){this.#n.placeholder?.parentElement&&this.#n.placeholder.remove(),this.#i.hoveredSlot=r;return}let a=Be([i]);this.#i.originalPositions.set(i,r),this.#n.placeholder&&this.#n.placeholder.parentElement&&this.#n.placeholder.remove(),this.#t.appendChild(i),this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r,Ue(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let r=Array.from(this.#i.originalPositions.keys()),i=r.length>0?Be(r):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),i&&Ue(i,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(r,i,s,a,...l){this.#t=null,this.#n=vr(),this.#m();let c=this.findContainingDroppable(r);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#n.sortContainer=c;let h=r.getBoundingClientRect();this.#n.placeholder=as(r,h,this.sortablePlaceholderConfig);let f=r.getAttribute("slot");f&&this.#n.placeholder.setAttribute("slot",f),this.#n.placeholder.style.visibility="hidden",c.appendChild(this.#n.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#r.add(m)}})}let[d]=l;super.initiateDrag(r,i,s,a,d)}cleanupSortableState(r=!0){if(r)for(let[i,s]of this.#i.originalPositions)s.appendChild(i);this.#n.placeholder&&this.#n.placeholder.remove(),ss(this.#n),this.#r.clear(),this.#t=null,this.#m()}onSortableDragMove(r,i){if(!this.isDraggingFromSlot)return;let s=ni(this.trackedDroppables,r,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#u()}handleDragMove(r,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,r,i),this.onSortableDragMove(r,i)}allowDrop(r,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(r,i)}handleDrop(r,i){super.handleDrop(r,i),this.cleanupSortableState(!1)}handleInvalidDrop(r){this.cleanupSortableState(),super.handleInvalidDrop(r)}}return e};var wp=[O,W,Xt,x`
8383
+ <slot part="label"></slot>`}};Zo([p({type:String,attribute:"template-identifier"})],jt.prototype,"templateIdentifier",void 0);Zo([p({type:String,attribute:"show-hide"})],jt.prototype,"showHide",void 0);Zo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],jt.prototype,"fixed",void 0);Zo([p({type:String,attribute:!1})],jt.prototype,"marker",void 0);var ip=[{tag:"qti-simple-choice",ctor:jt}];var rp=[...Lh,...Vh,...Fh,...Hh,...Qh,...Xh,...Jh,...Zh,...ep,...ip];var lf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};function cf(o,t,e,n,r={}){let i=r.publishWidth??!0,s=r.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=n.length?n:[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")}),r.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`)),n.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 Ul=(o,t,e,n='slot[part="drags"]')=>{class r extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#n=null,this.#i=0,this.#r=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#n;#i;#r;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(n,this),...s(n,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(cf(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#r;return d&&d.height===c.height&&d.width===c.width?!1:(this.#r=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#n||(this.#n=new MutationObserver(()=>this.#s()),this.#n.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.#n?.disconnect(),this.#n=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return lf([p({type:Boolean,attribute:"auto-size-dropzones"})],r.prototype,"autoSizeDropzones",void 0),r};var{AbortController:te,AbortSignal:Hl,WeakMap:df,WeakRef:hf,Window:op,reportError:ts=console.log}=globalThis,je=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||je(o.defaultView.parent.document)),qn=()=>!!op&&globalThis instanceof op,Wl=Symbol("unset"),[sp,pf]=(()=>{function o(q,u,g=!0){Object.defineProperty(q,u,{...Object.getOwnPropertyDescriptor(q,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(q,...u)=>new Promise(g=>g(q(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let q,u;return{promise:new Promise((v,w)=>(q=v,u=w)),resolve:q,reject:u}};function n(q,u){let g=u.call(q);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let r=new df,i={next(...q){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:v}=g;return t(()=>v.next(...q))},return(...q){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:v}=g;return t(()=>v.return?v.return(...q):{value:void 0,done:!0})},throw(...q){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:v}=g;return t(()=>{if(!v.throw)throw v.return(),new TypeError("no throw method");return v.throw(...q)})}};function s(q){let u=Object.create(i);return r.set(u,{syncIteratorRecord:q}),u}function a(q,u){let g;if(u){if(g=q[Symbol.asyncIterator],g==null){if(g=q[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let v=n(q,g);return s(v)}}else g=q[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return n(q,g)}let l="any"in Hl?Hl.any.bind(Hl):q=>{let u=new te;for(let g of q)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of q)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=q=>l(q.filter(Boolean));class d{constructor({next:u,error:g,complete:v}={}){r.set(this,{next:u,error:g,complete:v})}next(u){let{next:g}=r.get(this)||{};g&&g(u)}error(u){let{error:g}=r.get(this)||{};g?g(u):ts(u)}complete(){let{complete:u}=r.get(this)||{};u&&u()}}function h(q,u){let g=r.get(q);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let v of g.teardowns.reverse()){if(qn()&&!je(document))return;try{v()}catch(w){ts(w)}}}}function f(q,u,g={}){if(qn()&&!je(document))return;let v;typeof u=="function"?v=new d({next:u}):u&&!(u instanceof d)?v=new d(u):v=u||new d;let w=r.get(q),T=w.weakSubscriber?.deref();if(T?.active){let S=T,C=r.get(S);C.observers.add(v),g.signal&&(g.signal.aborted?C.observers.delete(v):g.signal.addEventListener("abort",()=>{let R=r.get(S);R?.active&&(R.observers.delete(v),R.observers.size==0&&h(S,g.signal.reason))}));return}let A=new m(v);if(w.weakSubscriber=new hf(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let S=r.get(A);S?.active&&(S.observers.delete(v),S.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(S){A.error(S)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");r.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=r.get(this);if(!g?.active||qn()&&!je(document))return;let v=new Set(g.observers);for(let w of v)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=r.get(this);if(!g?.active){ts(u);return}if(qn()&&!je(document))return;h(this,u);let v=new Set(g.observers);for(let w of v)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=r.get(this);if(!u?.active||qn()&&!je(document))return;h(this);let g=new Set(u.observers);for(let v of g)v.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(qn()&&!je(document))return;let g=r.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!r.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!r.has(this)){let u=new te;return u.abort(),u.signal}return r.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 y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");r.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 y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let T=function(A,S){if(A.signal.aborted)return;let C;try{let R=S.next();C=Promise.resolve(R)}catch(R){C=Promise.reject(R)}C.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),T(A,S)},R=>{A.error(R)})},w=!1;return new y(A=>{if(A.signal.aborted)return;let S;try{S=a(u,!0)}catch(R){A.error(R);return}let C=S;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||w)return;t(()=>C.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),T(A,C))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(w=>{if(w.signal.aborted)return;let T;try{T=a(u,!1)}catch(C){w.error(C);return}let A=!1,S=T;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||A)return;let C=S.return();if(C===null||typeof C!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let C=S.next();if({done:A}=C,A){w.complete();return}if(w.next(C.value),w.signal.aborted)break}catch(C){w.error(C);break}});if(u instanceof Promise||typeof u.then=="function")return new y(w=>{u.then(T=>{w.next(T),w.complete()},T=>{w.error(T)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,v=y.from(u);return new y(w=>{let T=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(v,T,A),!w.active)return;let S=new d({next(C){w.next(C)},error(C){w.error(C)},complete(){w.complete()}});f(g,S,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=new d({next(S){let C;try{C=u(S,w)}catch(R){v.error(R);return}w+=1,v.next(C)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}inspect(u={}){let g=null,v=null,w=null,T=null,A=null;typeof u=="function"?v=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(v=u.next),"error"in u&&(w=u.error),"complete"in u&&(T=u.complete),"abort"in u&&(A=u.abort));let S=this;return new y(C=>{if(g!==null)try{g()}catch(L){C.error(L);return}let R=()=>{try{A!==null&&A(C.signal.reason)}catch(L){ts(L)}};C.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(v!==null)try{v(L)}catch(mt){C.signal.removeEventListener("abort",R),C.error(mt);return}C.next(L)},error(L){if(C.signal.removeEventListener("abort",R),w!==null)try{w(L)}catch(mt){C.error(mt);return}C.error(L)},complete(){if(C.signal.removeEventListener("abort",R),T!==null)try{T()}catch(L){C.error(L);return}C.complete()}}),V={signal:C.signal};f(S,N,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=new d({next(S){let C=!1;try{C=u(S,w)}catch(R){v.error(R);return}w+=1,C&&v.next(S)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(v=>{let w=u;if(w==0)return v.complete();let T=new d({next(S){v.next(S),w-=1,w==0&&v.complete()},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(v=>{let w=u,T=new d({next(S){if(w>0)return w-=1;w==0&&v.next(S)},error(S){v.error(S)},complete(){v.complete()}}),A={signal:v.signal};f(g,T,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=!1,A=[];function S(V){let L;try{L=u(V,w)}catch(ie){return v.error(ie)}w+=1;let mt;try{mt=y.from(L)}catch(ie){return v.error(ie)}let $a=new d({next(ie){v.next(ie)},error(ie){v.error(ie)},complete(){if(A.length){let ie=A.shift();S(ie)}else C=!1,T&&v.complete()}}),Wt={signal:v.signal};f(mt,$a,Wt)}let C=!1,R=new d({next(V){C?A.push(V):(C=!0,S(V))},error(V){v.error(V)},complete(){T=!0,!C&&!A.length&&v.complete()}}),N={signal:v.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{let w=0,T=!1,A=null;function S(N){let V;try{V=u(N,w)}catch(Wt){return v.error(Wt)}w+=1;let L;try{L=y.from(V)}catch(Wt){return v.error(Wt)}let mt=new d({next(Wt){v.next(Wt)},error(Wt){v.error(Wt)},complete(Wt){T?v.complete():A=null}}),$a={signal:c([A.signal,v.signal])};f(L,mt,$a)}let C=new d({next(N){A&&A.abort(),A=new te,S(N)},error(N){v.error(N)},complete(){T=!0,A||v.complete()}}),R={signal:v.signal};f(g,C,R)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(w=>{let T=new d({next(S){w.next(S)},error(S){let C;try{C=u(S)}catch(L){w.error(L);return}let R;try{R=y.from(C)}catch(L){w.error(L);return}let N=new d({next(L){w.next(L)},error(L){w.error(L)},complete(){w.complete()}}),V={signal:w.signal};f(R,N,V)},complete(){w.complete()}}),A={signal:w.signal};f(g,T,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(v=>{v.addTeardown(u);let w=new d({next(A){v.next(A)},error(A){v.error(A)},complete(){v.complete()}}),T={signal:v.signal};f(g,w,T)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:v,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 T=[],A=new d({next(S){T.push(S)},error(S){w(S)},complete(){v(T)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){try{u(N,C)}catch(V){T(V),A.abort(V)}C+=1},error(N){T(N)},complete(){w()}});return f(this,R,S),v}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){let V=!1;try{V=u(N,C)}catch(L){T(L),A.abort(L)}C+=1,V||(w(!1),A.abort())},error(N){T(N)},complete(){w(!0)}});return f(this,R,S),v}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:v,reject:w}=e(),T=new te,A={signal:c([T.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let S=new d({next(C){v(C),T.abort()},error(C){w(C)},complete(){w(new RangeError("No values in Observable"))}});return f(this,S,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:v,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 T=null,A=!1,S=new d({next(C){A=!0,T=C},error(C){w(C)},complete(){A?v(T):w(new RangeError("No values in Observable"))}});return f(this,S,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){let V=!1;try{V=u(N,C)}catch(L){T(L),A.abort(L)}C+=1,V&&(w(N),A.abort())},error(N){T(N)},complete(){w()}});return f(this,R,S),v}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:w,reject:T}=e(),A=new te,S={signal:c([A.signal,g.signal])};if(S.signal.aborted)return T(S.signal.reason),v;S.signal.addEventListener("abort",()=>{T(S.signal.reason)});let C=0,R=new d({next(N){let V=!1;try{V=u(N,C)}catch(L){T(L),A.abort(L)}C+=1,V&&(w(!0),A.abort())},error(N){T(N)},complete(){w(!1)}});return f(this,R,S),v}reduce(u,g,v={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:T,reject:A}=e(),S=new te,C={signal:c([S.signal,v.signal])};if(C.signal.aborted)return A(C.signal.reason),w;C.signal.addEventListener("abort",()=>{A(C.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Wl,V=new d({next(L){if(N===Wl){N=L,R++;return}try{let mt=u(N,L,R);R++,N=mt}catch(mt){A(mt),S.abort(mt);return}},error(L){A(L)},complete(){N!==Wl?T(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,C),w}}return o(y.prototype,"subscribe"),[y,m]})();function ap(){return typeof globalThis.Observable=="function"}function lp(){Object.defineProperties(globalThis,{Observable:{value:sp,configurable:!0,writable:!0},Subscriber:{value:pf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(qn()&&!je(document))return;let e=this;return new sp(n=>{if(!e||n.signal.aborted)return;let r=i=>{n.next(i)};e.addEventListener(o,r,{capture:t.capture||!1,passive:t.passive,once:!1,signal:n.signal})})}}function Ql(o,t,e){let n=o.filter(r=>!r.hasAttribute("disabled"));for(let r of n){let i=r.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return r}return null}function cp(o,t,e,n){if(!n)return null;let r=o.filter(s=>!s.hasAttribute("disabled")),i=n.getBoundingClientRect();for(let s of r){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 dp(o,t,e,n){let r=o.filter(c=>!c.hasAttribute("disabled"));if(r.length===0)return null;let i,s;if(n){let c=n.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 r){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 hp(o,t,e,n){let r=o.filter(l=>!l.hasAttribute("disabled"));if(r.length===0)return null;let i;if(n){let l=n.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 r){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 y of i)for(let q of d){let u=Math.sqrt(Math.pow(y.x-q.x,2)+Math.pow(y.y-q.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function uf(o,t,e){let n=o.getBoundingClientRect();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}function mf(o,t,e,n,r){let i=r&&r.length>0?o.filter(g=>r.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(n){let g=n.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 v=g.getBoundingClientRect(),w=[{x:v.left,y:v.top},{x:v.right,y:v.top},{x:v.left,y:v.bottom},{x:v.right,y:v.bottom}],T=0,A=0;for(let S of l)for(let C of w){let R=Math.sqrt(Math.pow(S.x-C.x,2)+Math.pow(S.y-C.y,2));T+=R,A++}return T/A},d=null,h=1/0;for(let g of i){let v=c(g);v<h&&(h=v,d=g)}let f=null,m=1/0;for(let g of a){let v=c(g);v<m&&(m=v,f=g)}if(d&&n){let g=n.getBoundingClientRect(),v=d.getBoundingClientRect(),w=g.left+g.width/2,T=g.top+g.height/2;if(w>=v.left&&w<=v.right&&T>=v.top&&T<=v.bottom)return d}if(f&&uf(f,t,e))return f;let q=n?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*q?d:f:d||f}function pp(o){switch(o){case"pointerWithin":return Ql;case"rectangleIntersection":return cp;case"closestCenter":return dp;case"closestCorners":return hp;case"closestCornersWithInventoryPriority":return mf;default:return Ql}}function ni(o,t,e,n,r="pointerWithin",i){return pp(r)(o,t,e,n,i)}function Fe(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let n of e)if(n instanceof HTMLElement&&n.tagName!=="SLOT"){if(n.matches(t)||n.hasAttribute("qti-draggable"))return n;let r=n.closest(t)||n.closest('[qti-draggable="true"]');if(r)return r}return null}function gr(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Gl=o=>o?.internals;function Ft(o,t,e){let n=Gl(o)?.states;n&&(e?n.add(t):n.delete(t))}function es(o,t){return Gl(o)?.states?.has(t)??!1}function br(o){Ft(o,"dragging",!1),Ft(o,"placeholder",!1),Ft(o,"return-anchor",!1)}function kn(o){return es(o,"dragging")||es(o,"placeholder")}function fe(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let n=Gl(o)?.states;if(n){e?n.add(t):n.delete(t);return}let r=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));r.has("drop")&&(e?r.add(t):r.delete(t),o.setAttribute("part",[...r].join(" ")))}function ii(o,t){fe(o,"filled",t)}function ri(o,t){let e=[];return o.forEach(n=>{let r=[];n.tagName.toLowerCase()==="slot"?r=n.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):r=Array.from(n.querySelectorAll(`[identifier="${t}"]`)),e.push(...r)}),e}function up(o,t){let e=o.find(r=>r.getAttribute("identifier")===t);if(!e)return 1;let n=e.getAttribute("match-max");return n?parseInt(n,10)||0:1}var Xl={origin:{x:0,y:0},scale:{x:1,y:1}},ns=100,ff=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},gf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},bf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Yl=(o,t)=>{let e=o.ownerDocument??document,n=t??e.body,r=ff(e);return r&&!bf(r,n)?gf(r):n},Jl=(o,t=1)=>{let n=(o.ownerDocument??document).createElement("div");n.style.cssText=`position:fixed;left:0;top:0;width:${ns}px;height:${ns}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(n);let r=n.getBoundingClientRect();return n.remove(),{origin:{x:r.left,y:r.top},scale:{x:(r.width/ns||1)*t,y:(r.height/ns||1)*t}}},mp=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});ap()||lp();var fp=new WeakSet;function vf(o){!o||fp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),fp.add(o))}var gp=o=>!!o.internals?.states,is=(o,t,e,n='slot[part="drags"]',r="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=r,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Xl,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#n=a=>{let l=a;if(l.context!==Mn)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.#n,{capture:!0}),vf(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#n,{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;#n;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=(C,R)=>Array.from(R?.querySelectorAll(C)??[]),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),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let q=a(n,this),u=a(n,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...q,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),v=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),T=g?v:new Set,A=g?w:new Set,S=new Set([...v,...w].filter(gp));for(let C of this.#t)S.has(C)||(C.internals.states.delete("drag"),C.internals.states.delete("droppable"));for(let C of S){let R=T.has(C),N=!R&&A.has(C);R?C.internals.states.add("drag"):C.internals.states.delete("drag"),N?C.internals.states.add("droppable"):C.internals.states.delete("droppable")}this.#t=S,this.trackedDraggables.forEach(C=>{let R=kn(C);g&&!R?(C.style.cursor="grab",C.style.userSelect="none",C.style.touchAction="none",C.style.webkitUserSelect="none",C.style.webkitTouchCallout="none",C.setAttribute("qti-draggable","true"),C.setAttribute("tabindex","0")):(C.style.cursor="",C.style.userSelect="",C.style.touchAction="",C.style.webkitUserSelect="",C.style.webkitTouchCallout="",C.removeAttribute("qti-draggable"),C.getAttribute("tabindex")==="0"&&C.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 y=Fe(m,t),q=this.disabled||this.readonly,u=gr(y)||kn(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!q&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Fe(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let q=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),q===0){this.dragState.dragging||this.initiateDrag(y,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(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},q)}),c=a.when("mousedown").filter(m=>{let y=Fe(m,t),q=this.disabled||this.readonly,u=gr(y)||kn(y),g=m.button===0,v=Date.now()-this.lastPointerDownAt<50;return y&&g&&!q&&!u&&!v}).subscribe(m=>{let y=Fe(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Fe(m,t),q=this.disabled||this.readonly,u=gr(y)||kn(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),v=Date.now()-this.lastPointerDownAt<50;return y&&g&&!q&&!u&&!v}).subscribe(m=>{let y=Fe(m,t),q=m.touches?.[0]||m.changedTouches?.[0];!y||!q||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,q.clientX,q.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 y=this.trackedDraggables.filter(u=>!kn(u)),q=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%q.length;h={...h,dropIndex:u,dropElement:q[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+q.length)%q.length;h={...h,dropIndex:u,dropElement:q[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=Fe(m,t),g=this.disabled||this.readonly,v=gr(u)||kn(u);u&&["Space","Enter"].includes(m.code)&&!g&&!v&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:q[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 y=v=>v.contains(a)||!!v.shadowRoot?.contains(a),q=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(v=>v.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:[]},q){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let v=a.getAttribute("identifier");if(v){let w=ri(this.trackedDragContainers,v);w.forEach(T=>Ft(T,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Ft(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,T=this.dragState.pointerId;w&&T!==void 0&&w.setPointerCapture&&w.setPointerCapture(T)}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 v=()=>{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,T=this.dragState.pointerId;w&&T!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(T)}catch{}};this.dragState.touchCleanup=v}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let v=this.dragState.startedFromTrustedEvent;return v===void 0||g.isTrusted===v},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let v=g.touches?.[0]||g.changedTouches?.[0];if(!v)return;this.handleDragMove(v.clientX,v.clientY);return}if(l==="mouse"){let v=g;if(typeof v.buttons=="number"&&(v.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())}}),y=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()}}),q=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,q];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=ni(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=>fe(m,"hover",!1)),c&&fe(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 y=l.getBoundingClientRect();h=ni(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Ft(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{Ft(y,"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){br(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))}c.style.removeProperty("box-shadow");let h=Yl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Jl(h,this.cloneZoom),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.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}=mp(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=Yl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Jl(m,this.cloneZoom),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=>{fe(a,"enabled",!0),fe(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{fe(a,"enabled",!1),fe(a,"active",!1),fe(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Ft(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=Xl,this.cloneZoom=1,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)gp(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var bp={duration:250,easing:"ease",fill:"both"};function Kl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function vp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Be(o){let t=new Map;return o.forEach(e=>{t.set(e,Kl(e))}),t}function yp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function rs(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 Zl(o){return rs(o)>0}function os(o,t,e={}){let n=rs(o);if(n<=0)return null;let r=Kl(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:l}=yp(t,r);if(i===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...bp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*n,easing:d,fill:h})}function Ue(o,t={}){let e=new Map;return o.forEach((n,r)=>{if(!(r instanceof HTMLElement))return;let i=os(r,n,t);i&&e.set(r,i)}),e}var vr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bt=(o,t,e,n='slot[part="drags"]',r="closestCornersWithInventoryPriority")=>{let i=Ul(o,t,e,n),s=is(i,t,e,n,r);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&&ii(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()),ii(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),q=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,q.length),h[m]=y}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&&Zl(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(q=>this.placeResponse(q));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(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(es(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),q=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&q,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{os(c,vp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){br(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 q=ri(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);q&&this.dropDraggableInDroppable(q,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 T=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),T&&this.restoreOriginalInInventory(T,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,q=y===0||y>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Be(u):null;if(!q){let T=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(T){let A=T.getAttribute("identifier"),S=T.getBoundingClientRect();this.removeChipFromDroppable(d,T);let C=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&C&&C!==d&&this.isDeclarativeTarget(C)?C:null;R?(this.placeChip(R,T),ii(R,!0),this.animateReturn(T,S)):A&&this.restoreOriginalInInventory(A,S)}}let v=c.cloneNode(!0);v.removeAttribute("style"),v.removeAttribute("data-keyboard-dragging"),v.setAttribute("qti-draggable","true"),v.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(v.setAttribute("part",v.localName==="qti-gap-text"?"drag drag-text":"drag"),v.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,v)):d.tagName==="SLOT"?v.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&v.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(v)),ii(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Ue(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let T=v.getBoundingClientRect(),A=h.left-T.left,S=h.top-T.top;(A!==0||S!==0)&&v.animate([{transform:`translate(${A}px, ${S}px)`},{transform:"translate(0, 0)"}],{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(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&ii(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=ri(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(q=>{q.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?Be(m):null;h.forEach(q=>{br(q),q.style.display="",q.style.visibility="visible"}),y&&this.enableFlipAnimations&&Ue(y,this.flipAnimationConfig),h.forEach(q=>this.animateReturn(q,d))}updateInventoryBasedOnMatchMax(c){let d=ri(this.trackedDragContainers,c),h=up(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(q=>q.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{Ft(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="",y=!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}.`,y=!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}.`,y=!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"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let q=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,q,{suppressInline:!0}),y}reportValidity(){return super.reportValidity()}}return vr([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),vr([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),vr([H({context:ze})],a.prototype,"_dragDrop",void 0),vr([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),vr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Jt({emptyAs:[]})})],a.prototype,"response",null),a};var ss=class{getInsertPosition(t,e,n,r,i){let s=t.indexOf(n);if(s===-1)return null;let a=n.getBoundingClientRect(),l=(i-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var wp=new ss;var yf={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function yr(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function as(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function ls(o,t,e={}){let n={...yf,...e},r=document.createElement("div");return r.setAttribute("data-drop-placeholder","true"),r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.margin=window.getComputedStyle(o).margin,r.style.boxSizing="border-box",r.style.border=`${n.borderStyle} ${n.borderColor}`,r.style.borderRadius=getComputedStyle(o).borderRadius,r.style.background=n.background,r.style.transition=`transform ${n.transitionDuration*rs(o)}ms ease`,r.style.pointerEvents="none",r}function tc(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ut=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#n=yr(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#r=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#n;#i;#r;#o;set allowReorder(r){this.#o=r}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(r){return tc(r,this.trackedDroppables)}#s(r){return r.querySelector(t)}#a(r){let i=this.#c(r);return i===0||i>1}#c(r){let i=parseInt(r.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#p(r){return r.querySelectorAll(t).length}#l(r){let i=this.#c(r);return i===0?!1:this.#p(r)>=i}#m(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(r){if(!this.#t||r===this.#t){this.#u();return}if(this.#i.hoveredSlot===r)return;this.#u();let i=this.#s(r);if(!i){this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r;return}if(this.#a(r)){if(this.#l(r)){this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),this.#i.hoveredSlot=null;return}this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r;return}if(this.isDeclarativeTarget(r)){this.#n.placeholder?.parentElement&&this.#n.placeholder.remove(),this.#i.hoveredSlot=r;return}let a=Be([i]);this.#i.originalPositions.set(i,r),this.#n.placeholder&&this.#n.placeholder.parentElement&&this.#n.placeholder.remove(),this.#t.appendChild(i),this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r,Ue(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let r=Array.from(this.#i.originalPositions.keys()),i=r.length>0?Be(r):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),i&&Ue(i,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(r,i,s,a,...l){this.#t=null,this.#n=yr(),this.#m();let c=this.findContainingDroppable(r);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#n.sortContainer=c;let h=r.getBoundingClientRect();this.#n.placeholder=ls(r,h,this.sortablePlaceholderConfig);let f=r.getAttribute("slot");f&&this.#n.placeholder.setAttribute("slot",f),this.#n.placeholder.style.visibility="hidden",c.appendChild(this.#n.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#r.add(m)}})}let[d]=l;super.initiateDrag(r,i,s,a,d)}cleanupSortableState(r=!0){if(r)for(let[i,s]of this.#i.originalPositions)s.appendChild(i);this.#n.placeholder&&this.#n.placeholder.remove(),as(this.#n),this.#r.clear(),this.#t=null,this.#m()}onSortableDragMove(r,i){if(!this.isDraggingFromSlot)return;let s=ni(this.trackedDroppables,r,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#u()}handleDragMove(r,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,r,i),this.onSortableDragMove(r,i)}allowDrop(r,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(r,i)}handleDrop(r,i){super.handleDrop(r,i),this.cleanupSortableState(!1)}handleInvalidDrop(r){this.cleanupSortableState(),super.handleInvalidDrop(r)}}return e};var xp=[O,W,Xt,x`
8340
8384
  :host {
8341
8385
  display: block; /* necessary to calculate scaling position */
8342
8386
  }
@@ -8389,7 +8433,7 @@ div.full-correct-response-inline {
8389
8433
  :host([answer-key]) ::slotted(qti-simple-associable-choice) {
8390
8434
  display: none;
8391
8435
  }
8392
- `];var qf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},kf=Bt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Cn=class extends Ut(kf,'[qti-draggable="true"]'){static{this.styles=wp}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 n=e;this._childrenMap.includes(n)||(this._childrenMap=[...this._childrenMap,n])}#t(t,e){let n=this._dragDrop?.nodesByTarget?.[t]??[];return b`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
8436
+ `];var Sf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ef=Bt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Cn=class extends Ut(Ef,'[qti-draggable="true"]'){static{this.styles=xp}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 n=e;this._childrenMap.includes(n)||(this._childrenMap=[...this._childrenMap,n])}#t(t,e){let n=this._dragDrop?.nodesByTarget?.[t]??[];return b`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
8393
8437
  ${Q(n,r=>r.getAttribute("identifier"),r=>r)}
8394
8438
  </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 n=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),i=n&&this.chipsIn(n)[0]?.getAttribute("identifier"),s=r&&this.chipsIn(r)[0]?.getAttribute("identifier");i&&s&&t.push(`${i} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,n)=>{let r=e.split(" ");return r.length!==2?[]:[`${r[0]} droplist${n}_left`,`${r[1]} droplist${n}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
8395
8439
  <slot part="drags" name="qti-simple-associable-choice"></slot>
@@ -8400,7 +8444,7 @@ div.full-correct-response-inline {
8400
8444
  </div>`)}
8401
8445
 
8402
8446
  <div role="alert" part="message" id="validation-message"></div>
8403
- </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};qf([_()],Cn.prototype,"_childrenMap",void 0);var ls=[{tag:"qti-associate-interaction",ctor:Cn}];var He=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},We=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(r,i)=>{this._choiceElements.forEach(s=>s.disabled=i)},this._handleReadonlyChange=(r,i)=>{this._choiceElements.forEach(s=>s.readonly=i)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(r,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(r){this.maxChoices>1&&(typeof r=="string"||r===null)?this.response=r?r.toString().split(","):[]:this.response=r||""}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 r=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{r.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 r=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==r&&(this._interactionContext={...this._interactionContext,choiceRole:r})}_choiceElementSelectedHandler(r){this._toggleChoiceChecked(r.target);let i=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==r.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(r,i){r.internals?.states&&(i?(r.internals.states.add("checked"),r.internals.ariaChecked="true"):(r.internals.states.delete("checked"),r.internals.ariaChecked="false"))}_getChoiceChecked(r){return r.internals.states.has("checked")}_toggleChoiceChecked(r){let i=this._getChoiceChecked(r);this._setChoiceChecked(r,!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 r=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(i=>{let s=r.includes(i.identifier);this._setChoiceChecked(i,s)})}}return He([Pn("#validation-message")],e.prototype,"_validationMessageElement",void 0),He([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),He([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),He([z("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),He([z("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),He([z("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),He([p({attribute:"response",reflect:!1,converter:Jt({emptyAs:""})})],e.prototype,"response",void 0),He([z("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Cf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},xp=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#n=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(r){this.#t=this.#r(r),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(r,i,s){super.attributeChangedCallback(r,i,s),r==="class"&&i!==s&&(this.class=s??"")}updated(r){super.updated(r),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(r=>{r.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}#r(r){return r?r.split(/\s+/).map(i=>i.trim()).filter(Boolean).filter((i,s,a)=>a.indexOf(i)===s):[]}#o(){let r=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),i=this.#s(r),s=this.#a(),a=this.#c();i.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(r){return r.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(r=>this.#e.includes(r)).pop()??null}#c(){return this.#t.filter(r=>this.#n.includes(r)).pop()??null}#p(r,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=`${r}`;break;case"qti-labels-lower-alpha":l=this.#l(r,"lower");break;case"qti-labels-upper-alpha":l=this.#l(r,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(r,i){let s=r,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 Cf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var qp=[O,W,x`
8447
+ </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Sf([_()],Cn.prototype,"_childrenMap",void 0);var cs=[{tag:"qti-associate-interaction",ctor:Cn}];var He=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},We=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(r,i)=>{this._choiceElements.forEach(s=>s.disabled=i)},this._handleReadonlyChange=(r,i)=>{this._choiceElements.forEach(s=>s.readonly=i)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(r,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(r){this.maxChoices>1&&(typeof r=="string"||r===null)?this.response=r?r.toString().split(","):[]:this.response=r||""}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 r=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{r.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 r=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==r&&(this._interactionContext={...this._interactionContext,choiceRole:r})}_choiceElementSelectedHandler(r){this._toggleChoiceChecked(r.target);let i=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==r.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(r,i){r.internals?.states&&(i?(r.internals.states.add("checked"),r.internals.ariaChecked="true"):(r.internals.states.delete("checked"),r.internals.ariaChecked="false"))}_getChoiceChecked(r){return r.internals.states.has("checked")}_toggleChoiceChecked(r){let i=this._getChoiceChecked(r);this._setChoiceChecked(r,!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 r=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(i=>{let s=r.includes(i.identifier);this._setChoiceChecked(i,s)})}}return He([Pn("#validation-message")],e.prototype,"_validationMessageElement",void 0),He([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),He([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),He([z("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),He([z("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),He([z("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),He([p({attribute:"response",reflect:!1,converter:Jt({emptyAs:""})})],e.prototype,"response",void 0),He([z("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Af=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},qp=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#n=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(r){this.#t=this.#r(r),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(r,i,s){super.attributeChangedCallback(r,i,s),r==="class"&&i!==s&&(this.class=s??"")}updated(r){super.updated(r),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(r=>{r.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}#r(r){return r?r.split(/\s+/).map(i=>i.trim()).filter(Boolean).filter((i,s,a)=>a.indexOf(i)===s):[]}#o(){let r=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),i=this.#s(r),s=this.#a(),a=this.#c();i.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(r){return r.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(r=>this.#e.includes(r)).pop()??null}#c(){return this.#t.filter(r=>this.#n.includes(r)).pop()??null}#p(r,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=`${r}`;break;case"qti-labels-lower-alpha":l=this.#l(r,"lower");break;case"qti-labels-upper-alpha":l=this.#l(r,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(r,i){let s=r,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 Af([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var kp=[O,W,x`
8404
8448
  :host {
8405
8449
  display: block;
8406
8450
  }
@@ -8469,16 +8513,16 @@ div.full-correct-response-inline {
8469
8513
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
8470
8514
  grid-row: auto;
8471
8515
  }
8472
- `];var Sf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Sn=class extends xp(We(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=qp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
8516
+ `];var Tf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Sn=class extends qp(We(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=kp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
8473
8517
  <slot part="prompt" name="prompt"></slot>
8474
8518
  <slot part="slot" @slotchange=${this.#t}></slot>
8475
8519
  <div part="message" role="alert" id="validation-message"></div>
8476
- `}};Sf([p({type:String})],Sn.prototype,"orientation",void 0);var cs=[{tag:"qti-choice-interaction",ctor:Sn}];var kp=[O,x`
8520
+ `}};Tf([p({type:String})],Sn.prototype,"orientation",void 0);var ds=[{tag:"qti-choice-interaction",ctor:Sn}];var Cp=[O,x`
8477
8521
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8478
8522
  :host {
8479
8523
  display: block;
8480
8524
  }
8481
- `];var yr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},tc=`
8525
+ `];var wr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ec=`
8482
8526
  const postToParentWindows = (type, data) => {
8483
8527
  window.top.postMessage(data ? { type, data } : { type }, '*');
8484
8528
  let w = window.parent;
@@ -8545,7 +8589,7 @@ window.CES = {
8545
8589
  },
8546
8590
  };
8547
8591
  CES.load();
8548
- `,Ef=`
8592
+ `,If=`
8549
8593
  (function() {
8550
8594
  var blobUrlReceived = null;
8551
8595
 
@@ -8589,7 +8633,7 @@ CES.load();
8589
8633
  requestBlobUrl();
8590
8634
  }
8591
8635
  })();
8592
- `,ge=class extends D{#t;#e;#n;static{this.styles=kp}constructor(){super(),this.#t="",this.#e=null,this.#n=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let n=this.querySelector("object[data]");if(n){t=n.getAttribute("data");let r=n.getAttribute("width"),i=n.getAttribute("height");r&&this.setAttribute("width",r),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:ro((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(n=>n.json()).then(n=>{this.manifest=n,this.setupCES()}).catch(n=>{this._errorMessage=n})}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 n=this.manifest.style[0],r=this.#a(),i=await this.#l(n,r),s=i.url;if(i.baseUrl&&!this.#n&&(this.#n=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,r,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#n&&(this.#n=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+tc+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let q=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(q)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,r,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#n&&(this.#n=y.baseUrl),y.text){let q=y.text;if(!(q.includes("postToParentWindows")||q.includes("window.CES"))){let v="<script>"+tc+"</script>",w=q.indexOf("<head>");w!==-1?q=q.slice(0,w+6)+v+q.slice(w+6):q=v+q}let g=new Blob([q],{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 q="<script>"+tc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+q+f.slice(u+6):f=q+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${Ef}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
8636
+ `,ge=class extends D{#t;#e;#n;static{this.styles=Cp}constructor(){super(),this.#t="",this.#e=null,this.#n=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let n=this.querySelector("object[data]");if(n){t=n.getAttribute("data");let r=n.getAttribute("width"),i=n.getAttribute("height");r&&this.setAttribute("width",r),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:oo((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(n=>n.json()).then(n=>{this.manifest=n,this.setupCES()}).catch(n=>{this._errorMessage=n})}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 n=this.manifest.style[0],r=this.#a(),i=await this.#l(n,r),s=i.url;if(i.baseUrl&&!this.#n&&(this.#n=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,r,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#n&&(this.#n=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+ec+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let q=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(q)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,r,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#n&&(this.#n=y.baseUrl),y.text){let q=y.text;if(!(q.includes("postToParentWindows")||q.includes("window.CES"))){let v="<script>"+ec+"</script>",w=q.indexOf("<head>");w!==-1?q=q.slice(0,w+6)+v+q.slice(w+6):q=v+q}let g=new Blob([q],{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 q="<script>"+ec+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+q+f.slice(u+6):f=q+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${If}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
8593
8637
  <!DOCTYPE html>
8594
8638
  <html>
8595
8639
  <head>
@@ -8609,7 +8653,7 @@ CES.load();
8609
8653
  ${this._errorMessage&&b`<div style="color:red">
8610
8654
  <h1>Error</h1>
8611
8655
  ${this._errorMessage}
8612
- </div>`}`}#a(){let e=[this.#n,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(r=>new URL(r,window.location.href).toString()),n=this.#p();return n&&e.push(n),[...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,n={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let r of e){let i=new URL(r,window.location.href).toString(),s=new URL(t,i.endsWith("/")?i:`${i}/`).toString();try{let a=await fetch(s);if(a.ok){if(n.returnText){let l=await a.text();return{url:s,baseUrl:i,text:l}}return{url:s,baseUrl:i}}}catch{}}return{url:"",baseUrl:null}}};yr([p({type:String,attribute:"data"})],ge.prototype,"data",void 0);yr([p({type:String,attribute:"data-base-item"})],ge.prototype,"baseItemUrl",void 0);yr([p({type:String,attribute:"data-base-ref"})],ge.prototype,"baseRefUrl",void 0);yr([p({type:String,attribute:"id"})],ge.prototype,"id",void 0);yr([_()],ge.prototype,"_errorMessage",void 0);var ds=[{tag:"qti-custom-interaction",ctor:ge}];var Cp=[O];var hs=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Qe=class extends k{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Cp}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"}}))}};hs([p({type:String,attribute:"response-identifier"})],Qe.prototype,"responseIdentifier",void 0);hs([p({reflect:!0,type:Boolean})],Qe.prototype,"disabled",void 0);hs([p({type:String,attribute:"count-attempt"})],Qe.prototype,"countAttempt",void 0);hs([p({type:String})],Qe.prototype,"title",void 0);var ps=[{tag:"qti-end-attempt-interaction",ctor:Qe}];var Sp=[O,x`
8656
+ </div>`}`}#a(){let e=[this.#n,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(r=>new URL(r,window.location.href).toString()),n=this.#p();return n&&e.push(n),[...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,n={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let r of e){let i=new URL(r,window.location.href).toString(),s=new URL(t,i.endsWith("/")?i:`${i}/`).toString();try{let a=await fetch(s);if(a.ok){if(n.returnText){let l=await a.text();return{url:s,baseUrl:i,text:l}}return{url:s,baseUrl:i}}}catch{}}return{url:"",baseUrl:null}}};wr([p({type:String,attribute:"data"})],ge.prototype,"data",void 0);wr([p({type:String,attribute:"data-base-item"})],ge.prototype,"baseItemUrl",void 0);wr([p({type:String,attribute:"data-base-ref"})],ge.prototype,"baseRefUrl",void 0);wr([p({type:String,attribute:"id"})],ge.prototype,"id",void 0);wr([_()],ge.prototype,"_errorMessage",void 0);var hs=[{tag:"qti-custom-interaction",ctor:ge}];var Sp=[O];var ps=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Qe=class extends k{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Sp}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"}}))}};ps([p({type:String,attribute:"response-identifier"})],Qe.prototype,"responseIdentifier",void 0);ps([p({reflect:!0,type:Boolean})],Qe.prototype,"disabled",void 0);ps([p({type:String,attribute:"count-attempt"})],Qe.prototype,"countAttempt",void 0);ps([p({type:String})],Qe.prototype,"title",void 0);var us=[{tag:"qti-end-attempt-interaction",ctor:Qe}];var Ep=[O,x`
8613
8657
  /* PK: display host as block, else design will be collapsed */
8614
8658
  /* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
8615
8659
  :host {
@@ -8622,7 +8666,7 @@ CES.load();
8622
8666
  height: 100%;
8623
8667
  border: 0;
8624
8668
  }
8625
- `];var vt=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ep=5,Af=50,Ap="qti-height-lines-",Tp=!1,G=class extends D{constructor(){super(...arguments),this._rows=Ep,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Tp||(Tp=!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=Sp}_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/Af):Ep}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Ap))continue;let e=parseInt(t.slice(Ap.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="",n=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let r=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(r);n=t.checkValidity()&&i.test(t.value),n||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else n=t.checkValidity();return n&&!this.response&&this.minStrings>=1&&(n=!1),!n&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(n,e,t,{suppressInline:!0}),n}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
8669
+ `];var vt=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ap=5,_f=50,Tp="qti-height-lines-",Ip=!1,G=class extends D{constructor(){super(...arguments),this._rows=Ap,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Ip||(Ip=!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=Ep}_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/_f):Ap}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Tp))continue;let e=parseInt(t.slice(Tp.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="",n=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let r=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(r);n=t.checkValidity()&&i.test(t.value),n||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else n=t.checkValidity();return n&&!this.response&&this.minStrings>=1&&(n=!1),!n&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(n,e,t,{suppressInline:!0}),n}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
8626
8670
  part="textarea"
8627
8671
  name="${this.responseIdentifier}"
8628
8672
  spellcheck="false"
@@ -8637,7 +8681,7 @@ CES.load();
8637
8681
  ?disabled="${this.disabled}"
8638
8682
  ?readonly="${this.readonly}"
8639
8683
  .value=${this.response}
8640
- ></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))}};vt([_()],G.prototype,"_rows",void 0);vt([p({type:Number,attribute:"expected-length"})],G.prototype,"expectedLength",void 0);vt([p({type:Number,attribute:"expected-lines"})],G.prototype,"expectedLines",void 0);vt([p({type:String,reflect:!0})],G.prototype,"format",void 0);vt([z("format")],G.prototype,"_handleFormatChange",void 0);vt([p({type:Number,attribute:"min-strings"})],G.prototype,"minStrings",void 0);vt([p({type:String,attribute:"pattern-mask"})],G.prototype,"patternMask",void 0);vt([p({type:String,attribute:"placeholder-text"})],G.prototype,"placeholderText",void 0);vt([p({type:String,attribute:"data-patternmask-message"})],G.prototype,"dataPatternmaskMessage",void 0);vt([p({type:String,attribute:"class"})],G.prototype,"classNames",void 0);vt([z(["classNames","expectedLines","expectedLength"])],G.prototype,"_handleRowsInputChange",null);vt([p({type:String,attribute:"response",reflect:!1})],G.prototype,"response",void 0);vt([z("response",{waitUntilFirstUpdate:!0})],G.prototype,"_handleResponseChange",void 0);var us=[{tag:"qti-extended-text-interaction",ctor:G}];var Ip=[O,W,x`
8684
+ ></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))}};vt([_()],G.prototype,"_rows",void 0);vt([p({type:Number,attribute:"expected-length"})],G.prototype,"expectedLength",void 0);vt([p({type:Number,attribute:"expected-lines"})],G.prototype,"expectedLines",void 0);vt([p({type:String,reflect:!0})],G.prototype,"format",void 0);vt([z("format")],G.prototype,"_handleFormatChange",void 0);vt([p({type:Number,attribute:"min-strings"})],G.prototype,"minStrings",void 0);vt([p({type:String,attribute:"pattern-mask"})],G.prototype,"patternMask",void 0);vt([p({type:String,attribute:"placeholder-text"})],G.prototype,"placeholderText",void 0);vt([p({type:String,attribute:"data-patternmask-message"})],G.prototype,"dataPatternmaskMessage",void 0);vt([p({type:String,attribute:"class"})],G.prototype,"classNames",void 0);vt([z(["classNames","expectedLines","expectedLength"])],G.prototype,"_handleRowsInputChange",null);vt([p({type:String,attribute:"response",reflect:!1})],G.prototype,"response",void 0);vt([z("response",{waitUntilFirstUpdate:!0})],G.prototype,"_handleResponseChange",void 0);var ms=[{tag:"qti-extended-text-interaction",ctor:G}];var _p=[O,W,x`
8641
8685
  :host {
8642
8686
  display: flex;
8643
8687
  align-items: flex-start;
@@ -8681,10 +8725,10 @@ CES.load();
8681
8725
  :host([answer-key]) [part~='drags'] {
8682
8726
  display: none;
8683
8727
  }
8684
- `];var oi=class extends Ut(Bt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=Ip}render(){return b`<slot name="prompt"> </slot>
8728
+ `];var oi=class extends Ut(Bt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=_p}render(){return b`<slot name="prompt"> </slot>
8685
8729
  <slot part="drags" name="drags"></slot>
8686
8730
  <slot part="drops"></slot>
8687
- <div role="alert" part="message" id="validation-message"></div>`}};var ms=[{tag:"qti-gap-match-interaction",ctor:oi}];function Pp(o){return o.querySelector('img, object[type^="image"]')}function _p(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let n=parseFloat(e);return Number.isFinite(n)&&n>0?n:null}var Mp=new WeakMap,Rp=new WeakMap;function Tf(o){let t=Rp.get(o);return t||(t=new Promise(e=>{let n=o.data;if(!n){e(null);return}let r=new Image;r.onload=()=>{let i={width:r.naturalWidth,height:r.naturalHeight};if(!(i.width>0)||!(i.height>0)){e(null);return}Mp.set(o,i),e(i)},r.onerror=()=>e(null),r.src=n}),Rp.set(o,t)),t}function If(o){if(o.localName==="object")return Mp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function fs(o){let t=_p(o,"width"),e=_p(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let n=If(o);return n?{width:t??n.width,height:e??n.height}:null}function _f(o){let t=fs(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Tf(o).then(()=>fs(o));let e=o;return e.complete?Promise.resolve(null):new Promise(n=>{let r=()=>{e.removeEventListener("load",r),e.removeEventListener("error",r),n(fs(o))};e.addEventListener("load",r),e.addEventListener("error",r)})}function ee(o,t,e,n){let r=fs(e);if(r){Op(o,t,r,n);return}_f(e).then(i=>{if(!i){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Op(o,t,i,n)})}function Op(o,t,{width:e,height:n},r){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/n*100,d=a/e*100,h=a/n*100;r.style.left=l-d+"%",r.style.top=c-h+"%",r.style.width=2*d+"%",r.style.height=2*h+"%",r.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/n*100,h=a/e*100,f=l/n*100;r.style.left=c+"%",r.style.top=d+"%",r.style.width=h-c+"%",r.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/n*100,h=a/e*100,f=l/n*100;r.style.left=c-h+"%",r.style.top=d-f+"%",r.style.width=2*h+"%",r.style.height=2*f+"%",r.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 v=0;v<t.length;v+=2)i.push({x:t[v],y:t[v+1]});let s=Math.min(...i.map(v=>v.x)),a=Math.max(...i.map(v=>v.x)),l=Math.min(...i.map(v=>v.y)),c=Math.max(...i.map(v=>v.y)),d=s/e*100,h=l/n*100,f=a/e*100,m=c/n*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=f-d+"%",r.style.height=m-h+"%";let y=i.map(v=>({x:(v.x-s)/(a-s)*100,y:(v.y-l)/(c-l)*100})),q=y.map(v=>`${v.x}% ${v.y}%`).join(",");r.style.clipPath=`polygon(${q})`;let u=y.map(v=>`${v.x},${v.y}`).join(" "),g=v=>`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='${v}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;r.style.setProperty("--qti-shape-outline",g(4)),r.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":r.style.left="0%",r.style.top="0%",r.style.width="100%",r.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Dp=[O,W,x`
8731
+ <div role="alert" part="message" id="validation-message"></div>`}};var fs=[{tag:"qti-gap-match-interaction",ctor:oi}];function Mp(o){return o.querySelector('img, object[type^="image"]')}function Rp(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let n=parseFloat(e);return Number.isFinite(n)&&n>0?n:null}var Dp=new WeakMap,Op=new WeakMap;function Rf(o){let t=Op.get(o);return t||(t=new Promise(e=>{let n=o.data;if(!n){e(null);return}let r=new Image;r.onload=()=>{let i={width:r.naturalWidth,height:r.naturalHeight};if(!(i.width>0)||!(i.height>0)){e(null);return}Dp.set(o,i),e(i)},r.onerror=()=>e(null),r.src=n}),Op.set(o,t)),t}function Of(o){if(o.localName==="object")return Dp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function gs(o){let t=Rp(o,"width"),e=Rp(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let n=Of(o);return n?{width:t??n.width,height:e??n.height}:null}function Pf(o){let t=gs(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Rf(o).then(()=>gs(o));let e=o;return e.complete?Promise.resolve(null):new Promise(n=>{let r=()=>{e.removeEventListener("load",r),e.removeEventListener("error",r),n(gs(o))};e.addEventListener("load",r),e.addEventListener("error",r)})}function ee(o,t,e,n){let r=gs(e);if(r){Pp(o,t,r,n);return}Pf(e).then(i=>{if(!i){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Pp(o,t,i,n)})}function Pp(o,t,{width:e,height:n},r){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/n*100,d=a/e*100,h=a/n*100;r.style.left=l-d+"%",r.style.top=c-h+"%",r.style.width=2*d+"%",r.style.height=2*h+"%",r.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/n*100,h=a/e*100,f=l/n*100;r.style.left=c+"%",r.style.top=d+"%",r.style.width=h-c+"%",r.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/n*100,h=a/e*100,f=l/n*100;r.style.left=c-h+"%",r.style.top=d-f+"%",r.style.width=2*h+"%",r.style.height=2*f+"%",r.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 v=0;v<t.length;v+=2)i.push({x:t[v],y:t[v+1]});let s=Math.min(...i.map(v=>v.x)),a=Math.max(...i.map(v=>v.x)),l=Math.min(...i.map(v=>v.y)),c=Math.max(...i.map(v=>v.y)),d=s/e*100,h=l/n*100,f=a/e*100,m=c/n*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=f-d+"%",r.style.height=m-h+"%";let y=i.map(v=>({x:(v.x-s)/(a-s)*100,y:(v.y-l)/(c-l)*100})),q=y.map(v=>`${v.x}% ${v.y}%`).join(",");r.style.clipPath=`polygon(${q})`;let u=y.map(v=>`${v.x},${v.y}`).join(" "),g=v=>`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='${v}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;r.style.setProperty("--qti-shape-outline",g(4)),r.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":r.style.left="0%",r.style.top="0%",r.style.width="100%",r.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Np=[O,W,x`
8688
8732
  /* Containing block for the absolutely positioned hotspots over the image. Was on this host in
8689
8733
  the theme, together with a 'display: block' this component now owns. */
8690
8734
  :host {
@@ -8714,7 +8758,7 @@ CES.load();
8714
8758
  top: 0px;
8715
8759
  left: 0px;
8716
8760
  }
8717
- `];var wr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ht=class extends D{static{this.styles=Dp}#t;#e;#n;constructor(){super(),this.#t=[],this.#e=null,this.#n=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#r().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]}#r(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return b`<slot name="prompt"></slot>
8761
+ `];var xr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ht=class extends D{static{this.styles=Np}#t;#e;#n;constructor(){super(),this.#t=[],this.#e=null,this.#n=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#r().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]}#r(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return b`<slot name="prompt"></slot>
8718
8762
  <line-container>
8719
8763
  <svg
8720
8764
  width=${Z(this.grImage[0]?.width)}
@@ -8746,7 +8790,7 @@ CES.load();
8746
8790
  </svg>
8747
8791
  <slot></slot>
8748
8792
  </line-container>
8749
- <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),n=t.target,r=n.getAttribute("coords"),i=n.getAttribute("shape"),s=r.split(",").map(a=>parseInt(a));ee(i,s,e,n)}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 n=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-n.left,y:t.clientY-n.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.#n||(this.#n=e.target,this._response=this.#r(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#n.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#n=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)}};wr([_()],Ht.prototype,"startCoord",void 0);wr([_()],Ht.prototype,"mouseCoord",void 0);wr([ad({selector:"img"})],Ht.prototype,"grImage",void 0);wr([_()],Ht.prototype,"_response",void 0);wr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Jt({emptyAs:[]})})],Ht.prototype,"response",null);var gs=[{tag:"qti-graphic-associate-interaction",ctor:Ht}];var Np=[O,W,x`
8793
+ <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),n=t.target,r=n.getAttribute("coords"),i=n.getAttribute("shape"),s=r.split(",").map(a=>parseInt(a));ee(i,s,e,n)}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 n=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-n.left,y:t.clientY-n.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.#n||(this.#n=e.target,this._response=this.#r(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#n.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#n=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)}};xr([_()],Ht.prototype,"startCoord",void 0);xr([_()],Ht.prototype,"mouseCoord",void 0);xr([ld({selector:"img"})],Ht.prototype,"grImage",void 0);xr([_()],Ht.prototype,"_response",void 0);xr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Jt({emptyAs:[]})})],Ht.prototype,"response",null);var bs=[{tag:"qti-graphic-associate-interaction",ctor:Ht}];var $p=[O,W,x`
8750
8794
  :host {
8751
8795
  display: flex;
8752
8796
  align-items: flex-start;
@@ -8831,10 +8875,10 @@ CES.load();
8831
8875
  user-select: none;
8832
8876
  pointer-events: none;
8833
8877
  }
8834
- `];var Rf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Of=Bt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),En=class extends Ut(Of,'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#r(t.target)}}static{this.styles=Np}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return b` <slot name="prompt"></slot>
8878
+ `];var Mf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Df=Bt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),En=class extends Ut(Df,'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#r(t.target)}}static{this.styles=$p}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return b` <slot name="prompt"></slot>
8835
8879
  <slot part="image" style=${t}></slot>
8836
8880
  <slot part="drags" name="drags" class="hover-border" style=${t}></slot>
8837
- <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#n(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(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},n=e("width"),r=e("height");n&&r&&(t.style.aspectRatio=`${n} / ${r}`)}#r(t){let e=this.#n(),n=t.getAttribute("coords"),r=t.getAttribute("shape");!e||!n||!r||(this.#i(e),this.#o(e),ee(r,n.split(",").map(i=>parseFloat(i)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),n=t.getBoundingClientRect().width,r=e>0&&n>0?Math.min(1,n/e):1,i=Math.round(r*1e3)/1e3;i!==this._graphicScale&&(this._graphicScale=i)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};Rf([_()],En.prototype,"_graphicScale",void 0);var bs=[{tag:"qti-graphic-gap-match-interaction",ctor:En}];var $p=[O,W,x`
8881
+ <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#n(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(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},n=e("width"),r=e("height");n&&r&&(t.style.aspectRatio=`${n} / ${r}`)}#r(t){let e=this.#n(),n=t.getAttribute("coords"),r=t.getAttribute("shape");!e||!n||!r||(this.#i(e),this.#o(e),ee(r,n.split(",").map(i=>parseFloat(i)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),n=t.getBoundingClientRect().width,r=e>0&&n>0?Math.min(1,n/e):1,i=Math.round(r*1e3)/1e3;i!==this._graphicScale&&(this._graphicScale=i)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};Mf([_()],En.prototype,"_graphicScale",void 0);var vs=[{tag:"qti-graphic-gap-match-interaction",ctor:En}];var Lp=[O,W,x`
8838
8882
  /* The order pins are anchored outside their hotspot's box. */
8839
8883
  :host {
8840
8884
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
@@ -8872,11 +8916,11 @@ CES.load();
8872
8916
  pointer-events: none;
8873
8917
  user-select: none;
8874
8918
  }
8875
- `];var Lp=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ge=class o extends We(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#r=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=$p}static#t="cito-graphic-order-marker";render(){return b`
8919
+ `];var zp=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ge=class o extends We(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#r=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=Lp}static#t="cito-graphic-order-marker";render(){return b`
8876
8920
  <slot name="prompt"></slot>
8877
8921
  <slot></slot>
8878
8922
  <div role="alert" part="message" id="validation-message"></div>
8879
- `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(i=>i.identifier===e))return;let n=[...this.#e()],r=n.indexOf(e);if(r>=0)n.splice(r,1);else{let i=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(n.length>=i)return;n.push(e)}this.response=n,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#n(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),n=Array.from(this.querySelectorAll(`.${o.#t}`));n.length===e.length&&e.every((i,s)=>{let a=n[s];return a.textContent===String(i.order)&&a.style.getPropertyValue("position-anchor")===this.#n(i)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(i)})||(n.forEach(i=>i.remove()),this._choiceElements.forEach(i=>{i.style.removeProperty("anchor-name")}),e.forEach(i=>{let s=this.#n(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=Pp(this),n=t.getAttribute("coords"),r=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let i=n.split(",").map(s=>parseInt(s));ee(r,i,e,t)}#r;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r),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.#r)}};Lp([p({type:Number,attribute:"max-choices"})],Ge.prototype,"maxChoices",void 0);Lp([z("response")],Ge.prototype,"handleOrderedResponseChange",null);var vs=[{tag:"qti-graphic-order-interaction",ctor:Ge}];var zp=[O,W,x`
8923
+ `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(i=>i.identifier===e))return;let n=[...this.#e()],r=n.indexOf(e);if(r>=0)n.splice(r,1);else{let i=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(n.length>=i)return;n.push(e)}this.response=n,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#n(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),n=Array.from(this.querySelectorAll(`.${o.#t}`));n.length===e.length&&e.every((i,s)=>{let a=n[s];return a.textContent===String(i.order)&&a.style.getPropertyValue("position-anchor")===this.#n(i)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(i)})||(n.forEach(i=>i.remove()),this._choiceElements.forEach(i=>{i.style.removeProperty("anchor-name")}),e.forEach(i=>{let s=this.#n(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=Mp(this),n=t.getAttribute("coords"),r=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let i=n.split(",").map(s=>parseInt(s));ee(r,i,e,t)}#r;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r),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.#r)}};zp([p({type:Number,attribute:"max-choices"})],Ge.prototype,"maxChoices",void 0);zp([z("response")],Ge.prototype,"handleOrderedResponseChange",null);var ys=[{tag:"qti-graphic-order-interaction",ctor:Ge}];var Vp=[O,W,x`
8880
8924
  :host {
8881
8925
  display: block;
8882
8926
  }
@@ -8925,17 +8969,17 @@ CES.load();
8925
8969
  max-width: 100%;
8926
8970
  height: auto;
8927
8971
  }
8928
- `];var si=class extends We(D,"qti-hotspot-choice"){static{this.styles=zp}render(){return b`
8972
+ `];var si=class extends We(D,"qti-hotspot-choice"){static{this.styles=Vp}render(){return b`
8929
8973
  <slot name="prompt"></slot>
8930
8974
  <slot></slot>
8931
8975
  <div part="message" role="alert" id="validation-message"></div>
8932
- `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let n=()=>{t.removeEventListener("load",n),e(t)};t.addEventListener("load",n)})),this.#t}async#n(t){let e=this.querySelector("img"),n=t.getAttribute("coords"),r=t.getAttribute("shape"),i=n.split(",").map(a=>parseInt(a)),s=await this.#e(e);ee(r,i,s,t)}#i=t=>{this.#n(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ys=[{tag:"qti-hotspot-interaction",ctor:si}];var Vp=[O,W,x`
8976
+ `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let n=()=>{t.removeEventListener("load",n),e(t)};t.addEventListener("load",n)})),this.#t}async#n(t){let e=this.querySelector("img"),n=t.getAttribute("coords"),r=t.getAttribute("shape"),i=n.split(",").map(a=>parseInt(a)),s=await this.#e(e);ee(r,i,s,t)}#i=t=>{this.#n(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ws=[{tag:"qti-hotspot-interaction",ctor:si}];var jp=[O,W,x`
8933
8977
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8934
8978
  :host {
8935
8979
  display: block;
8936
8980
  }
8937
8981
  `];var ai=class extends We(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
8938
- <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Vp}};var ws=[{tag:"qti-hottext-interaction",ctor:ai}];var ec=(o,t="[part='menu']",e="[part='trigger']",n="--qti-inline-choice-width")=>{class r extends o{#t=null;#e=null;#n=null;#i=0;#r=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.#r||(this.#r=l,s.style.setProperty(n,`${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.#n||(this.#n=new MutationObserver(()=>this.#a()),this.#n.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.#n?.disconnect(),this.#n=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return r};var Pf=x`
8982
+ <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=jp}};var xs=[{tag:"qti-hottext-interaction",ctor:ai}];var nc=(o,t="[part='menu']",e="[part='trigger']",n="--qti-inline-choice-width")=>{class r extends o{#t=null;#e=null;#n=null;#i=0;#r=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.#r||(this.#r=l,s.style.setProperty(n,`${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.#n||(this.#n=new MutationObserver(()=>this.#a()),this.#n.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.#n?.disconnect(),this.#n=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return r};var Nf=x`
8939
8983
  /* ── Host ──────────────────────────────────────────────────────────────────
8940
8984
  Inline-block so the element flows with surrounding text.
8941
8985
  --qti-inline-choice-width is the single width control surface:
@@ -9116,7 +9160,7 @@ CES.load();
9116
9160
  z-index: var(--qti-overlay-z-index);
9117
9161
  white-space: nowrap;
9118
9162
  }
9119
- `,Mf=Pf,jp=Mf;var be=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Df=0,dt=class extends ec(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Df++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#r=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 n=t.newState==="open";this._dropdownOpen!==n&&(this._dropdownOpen=n),n?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.#v(),n=this.renderRoot.activeElement,r=this.#p(),i=n||(r instanceof HTMLElement&&this.#l(r)?r: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.#n(a)}}},this.#u=()=>{this.#e()},this.#h=t=>{if(this.disabled||this.readonly)return;let n=t.currentTarget.getAttribute("identifier")??"";this.#n(n)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[jp]}renderTrigger(){let t=this.#t();return b`
9163
+ `,$f=Nf,Fp=$f;var be=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Lf=0,dt=class extends nc(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Lf++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#r=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 n=t.newState==="open";this._dropdownOpen!==n&&(this._dropdownOpen=n),n?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.#v(),n=this.renderRoot.activeElement,r=this.#p(),i=n||(r instanceof HTMLElement&&this.#l(r)?r: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.#n(a)}}},this.#u=()=>{this.#e()},this.#h=t=>{if(this.disabled||this.readonly)return;let n=t.currentTarget.getAttribute("identifier")??"";this.#n(n)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[Fp]}renderTrigger(){let t=this.#t();return b`
9120
9164
  <button
9121
9165
  part="trigger"
9122
9166
  type="button"
@@ -9156,7 +9200,7 @@ CES.load();
9156
9200
  </button>
9157
9201
  <slot @slotchange=${this.#u}></slot>
9158
9202
  </div>
9159
- `}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.#d(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#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",n=this._pendingResponse,r=n!==void 0?n??"":this.options.find(a=>a.selected)?.value??"",i=[{content:e,value:"",selected:r===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===r}})],s=i.some(a=>a.selected);this.options=s?i:i.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#f(),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,n=this.required||this.minChoices>=1,r=e||!n,i=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(r,r?"":i,this,{suppressInline:!0}),r}reportValidity(){return super.reportValidity()}reset(){this.#i(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#f()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(n=>({...n,selected:n.value===e})),this.#f()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#n(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#f(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#i(!1)}#i(t){let e=this.#m();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#r;#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)}#m(){return this.renderRoot.querySelector(`#${this._menuId}`)}#d(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#u;#h;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#h),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#f(){await this.updateComplete;let t=this.options.find(n=>n.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let n of e){let i=(n.getAttribute("identifier")??"")===t;n.removeEventListener("click",this.#h),n.addEventListener("click",this.#h),n.disabled=this.disabled,n.readonly=this.readonly,n.internals.role="option",n.internals.ariaSelected=i?"true":"false",n.internals.ariaChecked=i?"true":"false",n.internals.ariaDisabled=this.disabled?"true":"false",n.internals.ariaReadOnly=this.readonly?"true":"false",i?n.internals.states.add("checked"):n.internals.states.delete("checked"),n.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};be([_()],dt.prototype,"options",void 0);be([_()],dt.prototype,"_dropdownOpen",void 0);be([I({context:qt,subscribe:!0}),p({attribute:!1})],dt.prototype,"configContext",void 0);be([p({type:String,attribute:"data-prompt"})],dt.prototype,"dataPrompt",void 0);be([z("dataPrompt",{waitUntilFirstUpdate:!0})],dt.prototype,"_handleDataPromptChange",void 0);be([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],dt.prototype,"required",void 0);be([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);be([z(["required","minChoices"],{waitUntilFirstUpdate:!0})],dt.prototype,"_handleRequiredChange",void 0);be([p({attribute:"response",reflect:!1,noAccessor:!0})],dt.prototype,"response",null);var xs=[{tag:"qti-inline-choice-interaction",ctor:dt}];var Fp=[O,W,x`
9203
+ `}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.#d(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#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",n=this._pendingResponse,r=n!==void 0?n??"":this.options.find(a=>a.selected)?.value??"",i=[{content:e,value:"",selected:r===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===r}})],s=i.some(a=>a.selected);this.options=s?i:i.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#f(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}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,n=this.required||this.minChoices>=1,r=e||!n,i=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(r,r?"":i,this,{suppressInline:!0}),r}reportValidity(){return super.reportValidity()}reset(){this.#i(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#f()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(n=>({...n,selected:n.value===e})),this.#f()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#n(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#f(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#i(!1)}#i(t){let e=this.#m();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#r;#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)}#m(){return this.renderRoot.querySelector(`#${this._menuId}`)}#d(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#u;#h;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#h),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#f(){await this.updateComplete;let t=this.options.find(n=>n.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let n of e){let i=(n.getAttribute("identifier")??"")===t;n.removeEventListener("click",this.#h),n.addEventListener("click",this.#h),n.disabled=this.disabled,n.readonly=this.readonly,n.internals.role="option",n.internals.ariaSelected=i?"true":"false",n.internals.ariaChecked=i?"true":"false",n.internals.ariaDisabled=this.disabled?"true":"false",n.internals.ariaReadOnly=this.readonly?"true":"false",i?n.internals.states.add("checked"):n.internals.states.delete("checked"),n.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};be([_()],dt.prototype,"options",void 0);be([_()],dt.prototype,"_dropdownOpen",void 0);be([I({context:qt,subscribe:!0}),p({attribute:!1})],dt.prototype,"configContext",void 0);be([p({type:String,attribute:"data-prompt"})],dt.prototype,"dataPrompt",void 0);be([z("dataPrompt",{waitUntilFirstUpdate:!0})],dt.prototype,"_handleDataPromptChange",void 0);be([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],dt.prototype,"required",void 0);be([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);be([z(["required","minChoices"],{waitUntilFirstUpdate:!0})],dt.prototype,"_handleRequiredChange",void 0);be([p({attribute:"response",reflect:!1,noAccessor:!0})],dt.prototype,"response",null);var qs=[{tag:"qti-inline-choice-interaction",ctor:dt}];var Bp=[O,W,x`
9160
9204
  /*
9161
9205
  * A custom element is inline unless it says otherwise, and this one never did. Its shadow content
9162
9206
  * is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
@@ -9262,7 +9306,7 @@ CES.load();
9262
9306
  :host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
9263
9307
  display: none;
9264
9308
  }
9265
- `];var Bp=[O,x`
9309
+ `];var Up=[O,x`
9266
9310
  :host(.qti-match-tabular) slot:not([hidden]) {
9267
9311
  display: contents;
9268
9312
  }
@@ -9337,7 +9381,7 @@ CES.load();
9337
9381
  justify-content: center;
9338
9382
  flex-shrink: 0;
9339
9383
  }
9340
- `];var nc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ve=class extends Ut(Bt(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,n=e.value,r=e.name,i=e.type;e.checked?(this.response?this.response.indexOf(n)===-1&&(i==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(r)===-1)),this.response=[...this.response,n]):this.response=[n],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==n),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=[Fp,Bp]}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"),n=e[0],r=e[1],i=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(n?.setAttribute("slot","match-rows"),r?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{i(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{i(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(n?.removeAttribute("slot"),r?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}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`
9384
+ `];var ic=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ve=class extends Ut(Bt(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,n=e.value,r=e.name,i=e.type;e.checked?(this.response?this.response.indexOf(n)===-1&&(i==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(r)===-1)),this.response=[...this.response,n]):this.response=[n],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==n),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=[Bp,Up]}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"),n=e[0],r=e[1],i=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(n?.setAttribute("slot","match-rows"),r?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{i(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{i(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(n?.removeAttribute("slot"),r?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}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`
9341
9385
  <slot name="prompt"></slot>
9342
9386
  <slot ?hidden=${t}></slot>
9343
9387
 
@@ -9380,13 +9424,13 @@ CES.load();
9380
9424
  `:P}
9381
9425
 
9382
9426
  <div role="alert" part="message" id="validation-message"></div>
9383
- `}};nc([p({type:String})],ve.prototype,"class",void 0);nc([_()],ve.prototype,"_response",void 0);nc([p({type:String,attribute:"response-identifier"})],ve.prototype,"responseIdentifier",void 0);var qs=[{tag:"qti-match-interaction",ctor:ve}];var Up=[O,x`
9427
+ `}};ic([p({type:String})],ve.prototype,"class",void 0);ic([_()],ve.prototype,"_response",void 0);ic([p({type:String,attribute:"response-identifier"})],ve.prototype,"responseIdentifier",void 0);var ks=[{tag:"qti-match-interaction",ctor:ve}];var Hp=[O,x`
9384
9428
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
9385
9429
  :host {
9386
9430
  display: block;
9387
9431
  }
9388
- `];var ks=class extends D{static{this.styles=Up}#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>
9389
- <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 Cs=[{tag:"qti-media-interaction",ctor:ks}];var Hp=[O,W,Xt,x`
9432
+ `];var Cs=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>
9433
+ <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 Ss=[{tag:"qti-media-interaction",ctor:Cs}];var Wp=[O,W,Xt,x`
9390
9434
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
9391
9435
  :host {
9392
9436
  display: block;
@@ -9596,7 +9640,7 @@ CES.load();
9596
9640
  :host([answer-key]) [part~='drags'] {
9597
9641
  display: none;
9598
9642
  }
9599
- `];var Wp=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Nf=Bt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Xe=class extends Ut(Nf,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Hp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
9643
+ `];var Qp=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},zf=Bt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Xe=class extends Ut(zf,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Wp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
9600
9644
  <div part="container">
9601
9645
  <slot part="drags"> </slot>
9602
9646
  <div part="drops">
@@ -9605,7 +9649,7 @@ CES.load();
9605
9649
  </div>`})}
9606
9650
  </div>
9607
9651
  <div id="validation-message" part="message" role="alert" style="display:none;"></div>
9608
- </div>`}getValue(t){return t?.map((e,n)=>`${e} droplist${n}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(n=>n.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Wp([_()],Xe.prototype,"nrChoices",void 0);Wp([p({type:String})],Xe.prototype,"orientation",void 0);var Ss=[{tag:"qti-order-interaction",ctor:Xe}];var Qp=`@layer qti-base {
9652
+ </div>`}getValue(t){return t?.map((e,n)=>`${e} droplist${n}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(n=>n.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Qp([_()],Xe.prototype,"nrChoices",void 0);Qp([p({type:String})],Xe.prototype,"orientation",void 0);var Es=[{tag:"qti-order-interaction",ctor:Xe}];var Gp=`@layer qti-base {
9609
9653
  /* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
9610
9654
  /* ============================
9611
9655
  QTI 3 shared css
@@ -11041,6 +11085,9 @@ CES.load();
11041
11085
  @layer qti-base {
11042
11086
 
11043
11087
  .qti-layout-row {
11088
+ /* The columns stack when the row is narrow, not the viewport: an item in a side-by-side player or a
11089
+ * narrow pane collapses too. The row is the container, so it is never shrink-to-fit (width: 100%). */
11090
+ container-type: inline-size;
11044
11091
  display: flex;
11045
11092
  flex-wrap: wrap;
11046
11093
  width: 100%;
@@ -11152,13 +11199,13 @@ CES.load();
11152
11199
  margin-left: 93.6170212766%;
11153
11200
  }
11154
11201
 
11155
- @media (width <= 767px) {
11202
+ @container (width <= 767px) {
11156
11203
  [class*='qti-layout-col'] {
11157
11204
  width: 100%;
11158
11205
  }
11159
11206
  }
11160
11207
  }
11161
- `;var Gp=[O,x`
11208
+ `;var Xp=[O,x`
11162
11209
  :host {
11163
11210
  display: block;
11164
11211
  width: 100%;
@@ -11168,18 +11215,18 @@ CES.load();
11168
11215
  ::slotted(qti-interaction-markup) {
11169
11216
  display: none;
11170
11217
  }
11171
- `];var $f=new Set(["point","pair","directedPair"]),li=(o,t)=>{if(o==null)return o;switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let n=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(r=>typeof r=="number"?r:parseFloat(String(r)));return n.length===2&&n.every(Number.isFinite)?n:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},Lf=(o,t,e)=>{if(e)return Array.isArray(t)&&!$f.has(e)?{name:o,list:{[e]:t.map(n=>li(n,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:li(t,e)}};if(Array.isArray(t)){let n=t.filter(r=>r!=null);if(n.length&&n.every(r=>typeof r=="boolean"))return{name:o,list:{boolean:n}};if(n.length&&n.every(r=>typeof r=="number")){let r=n,i=r.every(s=>Number.isInteger(s));return{name:o,list:{[i?"integer":"float"]:r}}}return{name:o,list:{string:t.map(r=>r==null?"":String(r))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},Es=(o,t={})=>{if(!Mt(o))return{record:[]};let e=[];for(let[n,r]of Object.entries(o))e.push(Lf(n,r,t[n]));return{record:e}},zf=(o,t={})=>{if(!Mt(o))return{...t};let e={};for(let[n,r]of Object.entries(o))e[n]=t[n]??oo(Array.isArray(r)?r[0]:r);return e},Jp=(o,t={})=>Es(o,zf(o,t)),Xp=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},Yp=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Kp=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let n=Yp(e.list);t[e.name]=Array.isArray(n)?n.map(Xp).filter(r=>r!==null):[]}else t[e.name]=Xp(Yp(e.base));return t};var Zp=`/** vim: et:ts=4:sw=4:sts=4
11218
+ `];var Vf=new Set(["point","pair","directedPair"]),li=(o,t)=>{if(o==null)return o;switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let n=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(r=>typeof r=="number"?r:parseFloat(String(r)));return n.length===2&&n.every(Number.isFinite)?n:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},jf=(o,t,e)=>{if(e)return Array.isArray(t)&&!Vf.has(e)?{name:o,list:{[e]:t.map(n=>li(n,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:li(t,e)}};if(Array.isArray(t)){let n=t.filter(r=>r!=null);if(n.length&&n.every(r=>typeof r=="boolean"))return{name:o,list:{boolean:n}};if(n.length&&n.every(r=>typeof r=="number")){let r=n,i=r.every(s=>Number.isInteger(s));return{name:o,list:{[i?"integer":"float"]:r}}}return{name:o,list:{string:t.map(r=>r==null?"":String(r))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},As=(o,t={})=>{if(!Mt(o))return{record:[]};let e=[];for(let[n,r]of Object.entries(o))e.push(jf(n,r,t[n]));return{record:e}},Ff=(o,t={})=>{if(!Mt(o))return{...t};let e={};for(let[n,r]of Object.entries(o))e[n]=t[n]??so(Array.isArray(r)?r[0]:r);return e},Kp=(o,t={})=>As(o,Ff(o,t)),Yp=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},Jp=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Zp=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let n=Jp(e.list);t[e.name]=Array.isArray(n)?n.map(Yp).filter(r=>r!==null):[]}else t[e.name]=Yp(Jp(e.base));return t};var tu=`/** vim: et:ts=4:sw=4:sts=4
11172
11219
  * @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
11173
11220
  * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
11174
11221
  */var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
11175
- https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var Tt=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),jf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Ff=["solution","review"];function Bf(o){return o==null?!1:Array.isArray(o)?o.length>0:Mt(o)?Object.keys(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="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#r=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.#g(),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`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let n=e?.params?.value,r=n&&typeof n=="object"?this.#m(n):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(r===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=r;this.response=c,this.validate(),this.saveResponse(c,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=[Gp,x`
11222
+ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var Tt=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Bf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Uf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Hf=["solution","review"];function Wf(o){return o==null?!1:Array.isArray(o)?o.length>0:Mt(o)?Object.keys(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="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#r=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.#g(),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`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let n=e?.params?.value,r=n&&typeof n=="object"?this.#m(n):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(r===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=r;this.response=c,this.validate(),this.saveResponse(c,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=[Xp,x`
11176
11223
  :host {
11177
11224
  display: block;
11178
11225
  width: 100%;
11179
11226
  min-height: 50px;
11180
11227
  }
11181
- `]}#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},n=t.correctResponse;return Bf(n)&&(e.correctResponse={value:n}),e}#n(){let t=this.responseDeclaration;if(!t?.correctResponse||Ff.includes(this.status))return t;let{correctResponse:e,...n}=t;return n}#i;#r;#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.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#r={}}return this.#r||{}}#p(){return this.#a()}#l(){return this.#c()}#m(t){if(t&&Array.isArray(t.record)){let e=Kp(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let n=t[e];if(n){for(let r in n)if(n.hasOwnProperty(r)){let i=n[r];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(n=>n.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,n){if(e==="record"||n==="record")return Es(t);if(e!=="single"){let r=this.normalizeListValue(t).map(i=>li(i,n));return{list:{[n]:r}}}return{base:{[n]:li(t,n)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=r.querySelector("qti-default-value");if(!i)return;let{value:s,baseTypes:a}=Wi(i.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=li(c,a[l]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},n={...t,...e};if(!Object.keys(n).length)return null;let r={candidateIdentifier:n.candidateIdentifier??"",testIdentifier:n.testIdentifier??"",environmentIdentifier:n.environmentIdentifier??"",...n};return Es(r)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(n=>{let r=n.getAttribute("template-identifier")||n.getAttribute("identifier")||"";if(!r)return;let i=this.context?.variables?.find(l=>l.identifier===r);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[r]=this.variableToQtiVariableJSON(i.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(n=>{let r=n.getAttribute("identifier")||"";if(!r)return;if(r==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[r]=l);return}let i=this.context?.variables?.find(l=>l.identifier===r);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[r]=this.variableToQtiVariableJSON(i.value,s,a)}),t}#d(t){let e={...t};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=n.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);e[r]=t[n]}return e}#u(t){let e={...t},n=(r,i,s)=>{let a=r;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[r,i]of Object.entries(t)){if(!r.includes("__"))continue;let s=r.split("__").filter(Boolean);s.length<2||n(e,s,i)}return e}responseVariablesToQtiVariableJSON(t,e,n,r){if(e==="record")return Jp(t,r);if(e!=="single"){let i={list:{}};return i.list[n]=t,i}else{let i={base:{}};return i.base[n]=t,i}}#h(){return this.response===null||this.response===void 0?!1:Mt(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#b(t,e){let n=this.dataset.invalidresponsemessage||"Invalid response.",r=t?"":e&&e.trim().length>0?e:n;this._internals.setValidity(t?{}:{customError:!0},r)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#h();return this.#b(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:Mt(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#m(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(n=>n.identifier===this.responseIdentifier);if(e){let n=e.cardinality||"single",r=e.baseType||"string",i=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(i,n,r,s);t[this.responseIdentifier]=a}return t}#f(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,"=")}#v(t){let e={};for(let[n,r]of Object.entries(t))typeof r=="string"?e[n]=this.#f(r):e[n]=r;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let n=this.iframe?.contentWindow;if(!this._iframeLoaded||!n){this._pendingMessages.push({method:t,params:e});return}n.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#g(){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.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#y(){let t=this.#d(this.#u(this.#v({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],n=typeof e=="string"&&e.length>0?e:null,r={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:ro(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#x(),boundTo:n?null:this.boundTo,responseDeclaration:this.#n(),status:this.status,state:n};this.sendMessageToIframe("initialize",r)}#x(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let n=e.querySelectorAll("qti-interaction-module");for(let r of n)t.push({id:r.getAttribute("id"),primaryPath:r.getAttribute("primary-path"),fallbackPath:r.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 r=e.map(i=>i.outerHTML).join(`
11182
- `);this.sendMessageToIframe("setStylesheets",r)}let n=this.querySelector("properties");n&&this.sendMessageToIframe("setProperties",n.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()),n=JSON.stringify(this.#l()),r=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",i=r?r.endsWith("/")?r:`${r}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,l=this.dataset.componentsCssUrl,c=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${Vf(Zp)}</script>`,d=`
11228
+ `]}#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},n=t.correctResponse;return Wf(n)&&(e.correctResponse={value:n}),e}#n(){let t=this.responseDeclaration;if(!t?.correctResponse||Hf.includes(this.status))return t;let{correctResponse:e,...n}=t;return n}#i;#r;#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.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#r={}}return this.#r||{}}#p(){return this.#a()}#l(){return this.#c()}#m(t){if(t&&Array.isArray(t.record)){let e=Zp(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let n=t[e];if(n){for(let r in n)if(n.hasOwnProperty(r)){let i=n[r];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(n=>n.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,n){if(e==="record"||n==="record")return As(t);if(e!=="single"){let r=this.normalizeListValue(t).map(i=>li(i,n));return{list:{[n]:r}}}return{base:{[n]:li(t,n)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=r.querySelector("qti-default-value");if(!i)return;let{value:s,baseTypes:a}=Wi(i.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=li(c,a[l]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},n={...t,...e};if(!Object.keys(n).length)return null;let r={candidateIdentifier:n.candidateIdentifier??"",testIdentifier:n.testIdentifier??"",environmentIdentifier:n.environmentIdentifier??"",...n};return As(r)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(n=>{let r=n.getAttribute("template-identifier")||n.getAttribute("identifier")||"";if(!r)return;let i=this.context?.variables?.find(l=>l.identifier===r);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[r]=this.variableToQtiVariableJSON(i.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(n=>{let r=n.getAttribute("identifier")||"";if(!r)return;if(r==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[r]=l);return}let i=this.context?.variables?.find(l=>l.identifier===r);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[r]=this.variableToQtiVariableJSON(i.value,s,a)}),t}#d(t){let e={...t};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=n.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);e[r]=t[n]}return e}#u(t){let e={...t},n=(r,i,s)=>{let a=r;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[r,i]of Object.entries(t)){if(!r.includes("__"))continue;let s=r.split("__").filter(Boolean);s.length<2||n(e,s,i)}return e}responseVariablesToQtiVariableJSON(t,e,n,r){if(e==="record")return Kp(t,r);if(e!=="single"){let i={list:{}};return i.list[n]=t,i}else{let i={base:{}};return i.base[n]=t,i}}#h(){return this.response===null||this.response===void 0?!1:Mt(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#b(t,e){let n=this.dataset.invalidresponsemessage||"Invalid response.",r=t?"":e&&e.trim().length>0?e:n;this._internals.setValidity(t?{}:{customError:!0},r)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#h();return this.#b(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:Mt(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#m(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(n=>n.identifier===this.responseIdentifier);if(e){let n=e.cardinality||"single",r=e.baseType||"string",i=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(i,n,r,s);t[this.responseIdentifier]=a}return t}#f(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,"=")}#v(t){let e={};for(let[n,r]of Object.entries(t))typeof r=="string"?e[n]=this.#f(r):e[n]=r;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let n=this.iframe?.contentWindow;if(!this._iframeLoaded||!n){this._pendingMessages.push({method:t,params:e});return}n.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#g(){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.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#y(){let t=this.#d(this.#u(this.#v({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],n=typeof e=="string"&&e.length>0?e:null,r={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:oo(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#x(),boundTo:n?null:this.boundTo,responseDeclaration:this.#n(),status:this.status,state:n};this.sendMessageToIframe("initialize",r)}#x(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let n=e.querySelectorAll("qti-interaction-module");for(let r of n)t.push({id:r.getAttribute("id"),primaryPath:r.getAttribute("primary-path"),fallbackPath:r.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 r=e.map(i=>i.outerHTML).join(`
11229
+ `);this.sendMessageToIframe("setStylesheets",r)}let n=this.querySelector("properties");n&&this.sendMessageToIframe("setProperties",n.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()),n=JSON.stringify(this.#l()),r=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",i=r?r.endsWith("/")?r:`${r}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,l=this.dataset.componentsCssUrl,c=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${Bf(tu)}</script>`,d=`
11183
11230
  font-family: ${t.getPropertyValue("font-family")};
11184
11231
  font-size: ${t.getPropertyValue("font-size")};
11185
11232
  line-height: ${t.getPropertyValue("line-height")};
@@ -11192,7 +11239,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11192
11239
  <title>QTI PCI Container</title>
11193
11240
  <base href="${i}" />
11194
11241
  ${a?`<script type="module">import '${a}';</script>`:""}
11195
- <style>${jf(Qp)}</style>
11242
+ <style>${Uf(Gp)}</style>
11196
11243
  <style>
11197
11244
  body, html {
11198
11245
  margin: 0;
@@ -12078,7 +12125,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12078
12125
  <h1>Error</h1>
12079
12126
  ${this._errorMessage}
12080
12127
  </div>`:""}
12081
- `}};Tt([p({type:String,attribute:"module"})],X.prototype,"module",void 0);Tt([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);Tt([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);Tt([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);Tt([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);Tt([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);Tt([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);Tt([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);Tt([_()],X.prototype,"_errorMessage",void 0);Tt([I({context:F,subscribe:!0}),_()],X.prototype,"context",void 0);Tt([I({context:kt,subscribe:!0}),_()],X.prototype,"qtiContext",void 0);Tt([p({attribute:"response",reflect:!1,converter:Jt({emptyAs:null})})],X.prototype,"response",void 0);var As=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,n)=>{let r=()=>{window.clearTimeout(i),e()},i=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",r),n(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",r,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,n=r=>{let{data:i}=r;i?.source==="qti-pci-iframe"&&(!i?.responseIdentifier||i?.responseIdentifier===this.responseIdentifier)&&i?.method==="getContentResponse"&&i?.messageId===e&&(window.removeEventListener("message",n),t(i.content))};window.addEventListener("message",n),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",n),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(n=>{let r=`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===r&&(window.removeEventListener("message",i),n())};window.addEventListener("message",i),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),n()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let n=`click-selector-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let n=`click-text-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(n=>{let r=`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===r&&(window.removeEventListener("message",i),n(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),n(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let n=`get-bounding-rect-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.rect??null))};window.addEventListener("message",r),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(n=>{let r=`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===r&&(window.removeEventListener("message",i),n(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),n(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let n=`mousedown-selector-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
12128
+ `}};Tt([p({type:String,attribute:"module"})],X.prototype,"module",void 0);Tt([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);Tt([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);Tt([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);Tt([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);Tt([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);Tt([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);Tt([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);Tt([_()],X.prototype,"_errorMessage",void 0);Tt([I({context:F,subscribe:!0}),_()],X.prototype,"context",void 0);Tt([I({context:kt,subscribe:!0}),_()],X.prototype,"qtiContext",void 0);Tt([p({attribute:"response",reflect:!1,converter:Jt({emptyAs:null})})],X.prototype,"response",void 0);var Ts=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,n)=>{let r=()=>{window.clearTimeout(i),e()},i=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",r),n(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",r,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,n=r=>{let{data:i}=r;i?.source==="qti-pci-iframe"&&(!i?.responseIdentifier||i?.responseIdentifier===this.responseIdentifier)&&i?.method==="getContentResponse"&&i?.messageId===e&&(window.removeEventListener("message",n),t(i.content))};window.addEventListener("message",n),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",n),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(n=>{let r=`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===r&&(window.removeEventListener("message",i),n())};window.addEventListener("message",i),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),n()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let n=`click-selector-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let n=`click-text-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(n=>{let r=`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===r&&(window.removeEventListener("message",i),n(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),n(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let n=`get-bounding-rect-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.rect??null))};window.addEventListener("message",r),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(n=>{let r=`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===r&&(window.removeEventListener("message",i),n(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),n(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let n=`mousedown-selector-${Date.now()}`,r=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
12082
12129
  // Test helper functions for QtiPortableCustomInteractionTest
12083
12130
  // Base iframe implementation already provides PCIManager.getContent
12084
12131
 
@@ -12271,7 +12318,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12271
12318
  }
12272
12319
  },
12273
12320
  true
12274
- );`,n=t.lastIndexOf("</script>");return t.substring(0,n)+e+t.substring(n)}};var Ts=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:As}];var tu=[O,x`
12321
+ );`,n=t.lastIndexOf("</script>");return t.substring(0,n)+e+t.substring(n)}};var Is=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:Ts}];var eu=[O,x`
12275
12322
  :host {
12276
12323
  display: block;
12277
12324
  }
@@ -12282,12 +12329,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12282
12329
  left: 50%;
12283
12330
  transform: translateX(-50%);
12284
12331
  }
12285
- `];var Is=class extends k{static{this.styles=tu}render(){return b`<slot></slot>`}};var eu=[O,x`
12332
+ `];var _s=class extends k{static{this.styles=eu}render(){return b`<slot></slot>`}};var nu=[O,x`
12286
12333
  :host {
12287
12334
  display: inline-block;
12288
12335
  position: relative;
12289
12336
  }
12290
- `];var _s=class extends k{static{this.styles=eu}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,n=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+n+"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 Rs=[{tag:"qti-position-object-interaction",ctor:Is},{tag:"qti-position-object-stage",ctor:_s}];var nu="important",Uf=" !"+nu,Os=Nt(class extends Re{constructor(o){if(super(o),o.type!==Jn.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 n=o[e];return n==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}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 n of this.ft)t[n]==null&&(this.ft.delete(n),n.includes("-")?e.removeProperty(n):e[n]=null);for(let n in t){let r=t[n];if(r!=null){this.ft.add(n);let i=typeof r=="string"&&r.endsWith(Uf);n.includes("-")||i?e.setProperty(n,i?r.slice(0,-11):r,i?nu:""):e[n]=r}}return st}});var iu=[O,x`
12337
+ `];var Rs=class extends k{static{this.styles=nu}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,n=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+n+"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 Os=[{tag:"qti-position-object-interaction",ctor:_s},{tag:"qti-position-object-stage",ctor:Rs}];var iu="important",Qf=" !"+iu,Ps=Nt(class extends Re{constructor(o){if(super(o),o.type!==Jn.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 n=o[e];return n==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}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 n of this.ft)t[n]==null&&(this.ft.delete(n),n.includes("-")?e.removeProperty(n):e[n]=null);for(let n in t){let r=t[n];if(r!=null){this.ft.add(n);let i=typeof r=="string"&&r.endsWith(Qf);n.includes("-")||i?e.setProperty(n,i?r.slice(0,-11):r,i?iu:""):e[n]=r}}return st}});var ru=[O,x`
12291
12338
  :host {
12292
12339
  display: block;
12293
12340
  --qti-select-point-marker-size: 1.5rem;
@@ -12348,12 +12395,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12348
12395
  -webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
12349
12396
  mask: var(--qti-select-point-icon) no-repeat center / contain;
12350
12397
  }
12351
- `];var ci=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>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.#n=1,this.#i=1,this.#r=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(),n=(t.clientX-e.left)*this.#n,r=(t.clientY-e.top)*this.#i,i=`${n.toFixed()} ${r.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=iu}#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;#n;#i;#r;#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(n=>n).map(n=>{let[r,i]=n.split(" ").map(Number);return{x:r,y:i}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let n of t){let r=n.dataset.coord,i=n.dataset.shape;!r||!i||ee(i,r.split(",").map(s=>+s),e,n)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
12398
+ `];var ci=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>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.#n=1,this.#i=1,this.#r=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(),n=(t.clientX-e.left)*this.#n,r=(t.clientY-e.top)*this.#i,i=`${n.toFixed()} ${r.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=ru}#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;#n;#i;#r;#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(n=>n).map(n=>{let[r,i]=n.split(" ").map(Number);return{x:r,y:i}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let n of t){let r=n.dataset.coord,i=n.dataset.shape;!r||!i||ee(i,r.split(",").map(s=>+s),e,n)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
12352
12399
  <point-container>
12353
12400
  ${Q(e.filter(n=>n),n=>n,(n,r)=>{let[i,s]=n.split(" ").map(Number),a=i/(this.#r||1)*100,l=s/(this.#o||1)*100;return b`
12354
12401
  <button
12355
12402
  part=${this.pointPart(n,r)}
12356
- style=${Os({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
12403
+ style=${Ps({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
12357
12404
  aria-label="Remove point at ${n}"
12358
12405
  ?disabled=${this.disabled}
12359
12406
  @click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==r),this.saveResponse(this.response)}}
@@ -12361,7 +12408,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12361
12408
  `})}
12362
12409
  ${this.renderSupplementalLayer()}
12363
12410
  <slot></slot>
12364
- </point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,n=t<this.minChoices,r=!0,i="";return e?(r=!1,i=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):n&&(r=!1,i=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(r,i,this.#e??this,{suppressInline:!0}),r}reportValidity(){return super.reportValidity()}#c(){this.#r=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.#n=t.width===0?1:this.#r/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.requestUpdate(),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)}};ci([p({type:Number,attribute:"max-choices"})],yt.prototype,"maxChoices",void 0);ci([p({type:Number,attribute:"min-choices"})],yt.prototype,"minChoices",void 0);ci([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=ul(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>ml(o)}})],yt.prototype,"response",void 0);ci([p({attribute:"area-mappings"})],yt.prototype,"areaMappings",void 0);ci([_()],yt.prototype,"_areaEntries",void 0);ci([z("areaMappings")],yt.prototype,"_handleAreaMappingsChange",void 0);var Ps=[{tag:"qti-select-point-interaction",ctor:yt}];var ru=[O,x`
12411
+ </point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,n=t<this.minChoices,r=!0,i="";return e?(r=!1,i=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):n&&(r=!1,i=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(r,i,this.#e??this,{suppressInline:!0}),r}reportValidity(){return super.reportValidity()}#c(){this.#r=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.#n=t.width===0?1:this.#r/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.requestUpdate(),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)}};ci([p({type:Number,attribute:"max-choices"})],yt.prototype,"maxChoices",void 0);ci([p({type:Number,attribute:"min-choices"})],yt.prototype,"minChoices",void 0);ci([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=ml(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>fl(o)}})],yt.prototype,"response",void 0);ci([p({attribute:"area-mappings"})],yt.prototype,"areaMappings",void 0);ci([_()],yt.prototype,"_areaEntries",void 0);ci([z("areaMappings")],yt.prototype,"_handleAreaMappingsChange",void 0);var Ms=[{tag:"qti-select-point-interaction",ctor:yt}];var ou=[O,x`
12365
12412
  :host {
12366
12413
  display: block;
12367
12414
  --show-bounds: true;
@@ -12429,7 +12476,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12429
12476
  text-align: center;
12430
12477
  color: #6b7280; /* text-gray-500 */
12431
12478
  }
12432
- `];var xr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},It=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=ru}#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 P}#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 n=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${n}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#n(t){this.#e(t)&&this.saveResponse(this.response)}render(){return b`
12479
+ `];var qr=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},It=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=ou}#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 P}#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 n=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${n}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#n(t){this.#e(t)&&this.saveResponse(this.response)}render(){return b`
12433
12480
  <slot name="prompt"></slot>
12434
12481
  <div id="slider" part="slider">
12435
12482
  <div id="bounds" part="bounds">
@@ -12447,7 +12494,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12447
12494
  ${this.renderRailSupplement()}
12448
12495
  </div>
12449
12496
  </div>
12450
- `}#i(t){this.#o(t.pageX);let e=r=>this.#s(r.pageX),n=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",n)}#r(t){this.#o(t.touches[0].pageX);let e=r=>this.#s(r.touches[0].pageX),n=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",n),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",n)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),n=t-e.left,r=Math.min(1,Math.max(0,n/e.width)),i=this.min+Math.round(r*(this.max-this.min)/this.step)*this.step;this.#n(i)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};xr([Pn("#rail")],It.prototype,"_rail",void 0);xr([p({type:Number,attribute:"lower-bound"})],It.prototype,"min",void 0);xr([p({type:Number,attribute:"upper-bound"})],It.prototype,"max",void 0);xr([p({type:Number,attribute:"step"})],It.prototype,"step",void 0);xr([p({attribute:"response",reflect:!1,noAccessor:!0})],It.prototype,"response",null);var Ms=[{tag:"qti-slider-interaction",ctor:It}];var ou=()=>new rc,rc=class{},ic=new WeakMap,VD=Nt(class extends Pe{render(o){return P}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)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=ic.get(t);e===void 0&&(e=new WeakMap,ic.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"?ic.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 su=[O,x`
12497
+ `}#i(t){this.#o(t.pageX);let e=r=>this.#s(r.pageX),n=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",n)}#r(t){this.#o(t.touches[0].pageX);let e=r=>this.#s(r.touches[0].pageX),n=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",n),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",n)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),n=t-e.left,r=Math.min(1,Math.max(0,n/e.width)),i=this.min+Math.round(r*(this.max-this.min)/this.step)*this.step;this.#n(i)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};qr([Pn("#rail")],It.prototype,"_rail",void 0);qr([p({type:Number,attribute:"lower-bound"})],It.prototype,"min",void 0);qr([p({type:Number,attribute:"upper-bound"})],It.prototype,"max",void 0);qr([p({type:Number,attribute:"step"})],It.prototype,"step",void 0);qr([p({attribute:"response",reflect:!1,noAccessor:!0})],It.prototype,"response",null);var Ds=[{tag:"qti-slider-interaction",ctor:It}];var su=()=>new oc,oc=class{},rc=new WeakMap,QD=Nt(class extends Pe{render(o){return P}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)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=rc.get(t);e===void 0&&(e=new WeakMap,rc.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"?rc.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 au=[O,x`
12451
12498
  :host {
12452
12499
  display: inline-flex;
12453
12500
  align-items: center;
@@ -12536,7 +12583,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12536
12583
  :host(.qti-input-width-72) {
12537
12584
  --qti-input-width: 72;
12538
12585
  }
12539
- `];var An=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ut=class extends D{constructor(){super(...arguments),this.inputRef=ou(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=su}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
12586
+ `];var An=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ut=class extends D{constructor(){super(...arguments),this.inputRef=su(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=au}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
12540
12587
  part="input"
12541
12588
  name="${this.responseIdentifier}"
12542
12589
  spellcheck="false"
@@ -12552,7 +12599,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12552
12599
  maxlength=${1e3}
12553
12600
  ?disabled="${this.disabled}"
12554
12601
  ?readonly="${this.readonly}"
12555
- />`}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=""}};An([p({type:Number,attribute:"expected-length"})],ut.prototype,"expectedLength",void 0);An([p({type:String,attribute:"pattern-mask"})],ut.prototype,"patternMask",void 0);An([p({type:String,attribute:"placeholder-text"})],ut.prototype,"placeholderText",void 0);An([p({type:String,attribute:"data-patternmask-message"})],ut.prototype,"dataPatternmaskMessage",void 0);An([p({type:String,attribute:"response",reflect:!1})],ut.prototype,"response",void 0);An([Pn("input")],ut.prototype,"_input",void 0);An([z("response",{waitUntilFirstUpdate:!0})],ut.prototype,"_handleValueChange",void 0);var Ds=[{tag:"qti-text-entry-interaction",ctor:ut}];var au=[O,x`
12602
+ />`}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=""}};An([p({type:Number,attribute:"expected-length"})],ut.prototype,"expectedLength",void 0);An([p({type:String,attribute:"pattern-mask"})],ut.prototype,"patternMask",void 0);An([p({type:String,attribute:"placeholder-text"})],ut.prototype,"placeholderText",void 0);An([p({type:String,attribute:"data-patternmask-message"})],ut.prototype,"dataPatternmaskMessage",void 0);An([p({type:String,attribute:"response",reflect:!1})],ut.prototype,"response",void 0);An([Pn("input")],ut.prototype,"_input",void 0);An([z("response",{waitUntilFirstUpdate:!0})],ut.prototype,"_handleValueChange",void 0);var Ns=[{tag:"qti-text-entry-interaction",ctor:ut}];var lu=[O,x`
12556
12603
  :host {
12557
12604
  display: block;
12558
12605
  margin: 1em 0;
@@ -12561,7 +12608,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12561
12608
  display: block;
12562
12609
  margin-top: 0.5em;
12563
12610
  }
12564
- `];var Ns=class extends D{static{this.styles=au}#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`
12611
+ `];var $s=class extends D{static{this.styles=lu}#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`
12565
12612
  <div>
12566
12613
  <slot name="prompt"></slot>
12567
12614
  <input
@@ -12572,7 +12619,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12572
12619
  ?readonly="${this.readonly}"
12573
12620
  />
12574
12621
  </div>
12575
- `}async#n(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,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(t)})}};var $s=[{tag:"qti-upload-interaction",ctor:Ns}];var lu=[...ls,...cs,...ds,...ps,...us,...ms,...gs,...bs,...vs,...ys,...ws,...xs,...qs,...Cs,...Ss,...Ts,...Rs,...Ps,...Ms,...Ds,...$s,...ip];for(let{tag:o,ctor:t}of lu)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 ps)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 bs)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 ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)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 Ss)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 Rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ps)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 Ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of $s)customElements.get(o)||customElements.define(o,t);var g2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Ud().load(`${o}`).then(a=>a.assessmentTest()),n=await Qn().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),r=await Qn().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:n,testURI:s,testURL:i,items:r,testIdentifier:e.identifier}},b2=async o=>Kt().load(o).then(t=>t.htmlDoc().firstElementChild);var Ls=class extends Hf(Yt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Hf(o){return class extends o{calculateChildren(e){return e.map(r=>{let i=r;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(r=>typeof r=="boolean"&&r)}}}var cu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},di=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 n of t){if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(n.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(n.value===null||n.value===void 0)return null;n.value==="true"&&e++}return e>=this.min&&e<=this.max}};cu([p({type:Number})],di.prototype,"min",void 0);cu([p({type:Number})],di.prototype,"max",void 0);var Wf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},qr=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Wf([p({type:String,attribute:"base-type"})],qr.prototype,"baseType",void 0);var zs=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 Vs=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 n=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,n));let r=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(r,i,n):this.#n(r,i,n)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,n){return J.compareSingleValues(t,e,n)||t===e}#n(t,e,n){let r=[...t];return e.every(i=>{let s=r.findIndex(a=>this.#e(a,i,n));return s===-1?!1:(r.splice(s,1),!0)})}#i(t,e,n){for(let r=0;r+e.length<=t.length;r++)if(e.every((i,s)=>this.#e(t[r+s],i,n)))return!0;return!1}};var js=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(n=>n.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var oc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Tn=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,n;if(t.length===2)e=t[0],n=t[1];else if(t.length===1)n=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===n);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let r=this.context.variables.find(i=>i.identifier===n);return r?r.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item context`),null)}};oc([p({type:String})],Tn.prototype,"identifier",void 0);oc([I({context:F,subscribe:!0}),_()],Tn.prototype,"context",void 0);oc([_(),I({context:at,subscribe:!0})],Tn.prototype,"_testContext",void 0);var Fs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return e.cardinality!=="single"||!Array.isArray(n.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):n.value.filter(i=>!e.value.includes(i))}return null}};var Bs=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 n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var Us=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(n=>this.#e(n));return e.some(n=>n===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 Hs=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(n=>this.#e(n));return e.some(n=>n===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 Qf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},kr=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],n=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let r=parseFloat(e.value),i=parseFloat(n.value);if(!isNaN(r)&&!isNaN(i))return this.roundingMode==="significantFigures"?r.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(r*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: ${r}, ${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}};Qf([p({type:String,attribute:"rounding-mode"})],kr.prototype,"roundingMode",void 0);var du=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hi=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],n=t[1];return!e||!n?null:e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||n.value===null||e.value===void 0||n.value===void 0?null:this.toleranceMode==="exact"?J.compareSingleValues(e.value,n.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(n.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 n=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(n.length===0||n.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[r,i=r]=n,[s,a]=this.toleranceMode==="absolute"?[e-r,e+i]:[e*(1-r/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};du([p({type:String,attribute:"tolerance-mode"})],hi.prototype,"toleranceMode",void 0);du([p({type:String})],hi.prototype,"tolerance",void 0);var Y=class extends k{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ws=class extends Y{process(){throw new $n}};var Qs=class extends Y{process(){throw new Ln}};var Gs=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;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],n=e?.cardinality==="record"||e?.baseType==="record";if(n&&(e.value===null||e.value===void 0))return null;if(!e||!n||!Mt(e.value))return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r==null?null:(this.#t=e.fieldBaseTypes?.[t]??oo(Array.isArray(r)?r[0]:r),r)}};var Xs=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 n of t){if(n.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(n.value===null||n.value===void 0)return null;if(n.cardinality==="single"){if(Array.isArray(n.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let r=parseInt(n.value,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}else if(n.cardinality==="multiple"||n.cardinality==="ordered"){if(!Array.isArray(n.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let r of n.value){if(r==null)return null;let i=parseInt(r,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 n=1;n<t.length&&(e=this.#e(e,Math.abs(t[n])),e!==1);n++);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 n=e;e=t%e,t=n}return t}};var _t=o=>o==null||o==="";var Ys=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(_t(e?.value)||_t(n?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float"))return+e.value>+n.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Js=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return _t(e?.value)||_t(n?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float")?+e.value>=+n.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Gf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Cr=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 n=this.#t(this.n);if(n===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(n)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let n=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>n.length?null:n[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(n=>n.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Gf([p({type:String})],Cr.prototype,"n",void 0);var hu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pi=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 n=this.#t(e.value.toString()),r=this.#e(this.coords);if(!n||r.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#n(n,r);case"rect":return this.#i(n,r);case"ellipse":return this.#r(n,r);case"poly":case"polygon":return this.#o(n,r);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 n=Number.parseFloat(e[0]),r=Number.parseFloat(e[1]);return Number.isNaN(n)||Number.isNaN(r)?(console.error("qti-inside requires numeric point coordinates"),null):{x:n,y:r}}#e(t){let e=t.split(",").map(n=>n.trim()).filter(Boolean).map(n=>Number.parseFloat(n));return e.some(n=>Number.isNaN(n))?(console.error("qti-inside requires numeric coords"),[]):e}#n(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[n,r,i]=e;return(t.x-n)**2+(t.y-r)**2<=i**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[n,r,i,s]=e,a=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,s),d=Math.max(r,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#r(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[n,r,i,s]=e;return i===0||s===0?!1:(t.x-n)**2/i**2+(t.y-r)**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 n=!1;for(let r=0,i=e.length-2;r<e.length;r+=2){let s=e[r],a=e[r+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&&(n=!n),i=r}return n}};hu([p({type:String})],pi.prototype,"shape",void 0);hu([p({type:String})],pi.prototype,"coords",void 0);var Ks=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 n of t){if(n.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-integer-divide requires single cardinality"),[];if(n.value===null||n.value===void 0)return[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-integer-divide requires integer values"),[];e.push(r)}return e}};var Zs=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 n of t){if(n.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(n.value===null||n.value===void 0)return[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-integer-modulus requires integer values"),[];e.push(r)}return e}};var ta=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 n=Number.parseInt(e.value,10);return Number.isNaN(n)?(console.error("qti-integer-to-float requires an integer value"),null):n}};var ea=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 na=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,n)=>this.#n(e,n))}#t(t){let e=[];for(let n of t){if(n.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(n.value===null||n.value===void 0)return[];if(n.cardinality==="single"){if(Array.isArray(n.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r);continue}if(n.cardinality!=="multiple"&&n.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(n.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let r of n.value){let i=Number.parseInt(r,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let n=Math.abs(t),r=Math.abs(e);for(;r!==0;){let i=n%r;n=r,r=i}return n}#n(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var pu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ui=class extends Y{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 n=parseFloat(this.childExpression.calculate()),r;return e.matchTable?.size?r=e.matchTable.get(n):e.interpolationTable&&(r=this.#t(n,e.interpolationTable)),r==null?(console.warn(`lookupOutcomeValue: no table entry matches ${n} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Pt(r)}})),r)}#t(t,e){if(!Number.isNaN(t))return e.find(n=>n.includeBoundary?t>=n.sourceValue:t>n.sourceValue)?.targetValue}};pu([p({type:String})],ui.prototype,"identifier",void 0);pu([I({context:F,subscribe:!0}),_()],ui.prototype,"context",void 0);var ia=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(_t(e?.value)||_t(n?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float"))return+e.value<+n.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var ra=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return _t(e?.value)||_t(n?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float")?+e.value<=+n.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Xf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Sr=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 n=Array.isArray(t.value)?t.value:[t.value];if(!n||n.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,i=new Set;for(let s of n)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){r+=a.mappedValue??0,i.add(a.coords);break}}return i.size<n.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};Xf([p({type:String})],Sr.prototype,"identifier",void 0);var Yf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Er=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,n=Array.isArray(t.value)?t.value:[t.value],r=0;for(let i of n){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):J.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?r+=e.defaultValue:r+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(r=Math.max(e.lowerBound,r)),e?.upperBound!==null&&e?.upperBound!==void 0&&(r=Math.min(e.upperBound,r)),r}};Yf([p({type:String})],Er.prototype,"identifier",void 0);var oa=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return o.match(e,n)}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):J.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 n=0;n<t.value.length;n++)if(!J.compareSingleValues(e.value[n],t.value[n],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 n=0;for(let r of e.value){let i=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(r,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;n++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Jf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ar=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}}};Jf([p({type:String})],Ar.prototype,"name",void 0);var Kf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Tr=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 n of t){if(n.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(n.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(n.value===null||n.value===void 0)return null;if(n.baseType!=="integer"&&n.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let r=parseFloat(n.value);if(isNaN(r))return console.error("qti-math-operator non-numerical value"),null;e.push(r)}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 n=e[0],r=e[1];return n===0&&r<=0||n<0&&!Number.isInteger(r)?null:Math.pow(n,r)}case"log_base":{if(e.length!==2)return null;let n=e[0],r=e[1];return n<=0||r<=0||r===1?null:Math.log(n)/Math.log(r)}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(n){return console.error(`qti-math-operator: error performing operation "${t}":`,n),null}}};Kf([p({type:String})],Tr.prototype,"name",void 0);var sa=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 n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var aa=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,n]=t;if(e.baseType===n.baseType||e.baseType==="integer"&&n.baseType==="float"||e.baseType==="float"&&n.baseType==="integer"||console.warn("Which must both have the same base-type"),n.cardinality==="multiple"||n.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||n.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||n.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||n.value===null)return null;let r=e.value;return n.value.includes(r)}};var la=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 n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var ca=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 da=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var ha=class extends E{getResult(){return null}};var pa=class extends Yt{getResult(){return Array.from(this.children).map(e=>{let n=e;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=n.calculate(),i=!1;if(typeof r=="string")if(r==="true")i=!0;else if(r==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(i=r);return i}).some(e=>typeof e=="boolean"&&e)}};var ua=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 ma=class extends k{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},mi=class extends ma{shouldProcess(){return!0}getSubRules(){return[...this.children]}},fi=class extends ma{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},gi=class extends Y{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var fa=class extends gi{};var bi=class extends fi{};var ga=class extends bi{};var ba=class extends mi{};var Zf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ir=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 n=this.#t();return n?n.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}}}};Zf([p({type:String})],Ir.prototype,"pattern",void 0);var va=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,n]=t;if(e.cardinality!=="single"||n.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(n.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||n.value===null||n.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||n.baseType!=="integer"&&n.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let r=parseFloat(e.value),i=parseFloat(n.value);if(isNaN(r)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(r===0&&i<=0||r<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(r,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 tg=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function eg(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function _r(o,t){return eg(t===void 0?o.toExponential():o.toExponential(t))}function uu(o){let[t,e]=o.split(/e/i),n=t.includes(".")?t.replace(/\.?0+$/,""):t,r=e===void 0?"":`e${e}`;return`${n}${r}`}function mu(o,t){let e=t===0?1:t,n=o===0?0:Math.floor(Math.log10(o));return n<-4||n>=e?uu(_r(o,e-1)):uu(o.toFixed(Math.max(0,e-1-n)))}function ng(o,t,e,n){if(o==="s"||o==="c"){let c=o==="c"?n.slice(0,1):n;return e===void 0?c:c.slice(0,e)}let r=Number(n);if(n.trim()===""||!Number.isFinite(r))return n;let i=Math.abs(r),s,a=r<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=_r(i,e??6);break;case"E":s=_r(i,e??6).toUpperCase();break;case"g":s=mu(i,e??6);break;case"G":s=mu(i,e??6).toUpperCase();break;default:return n}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function ig(o,t,e){if(o.length>=e)return o;let n=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(n)}`;if(t.includes("0")){let[,r,i]=/^([-+ ]?)(.*)$/.exec(o);return`${r}${"0".repeat(n)}${i}`}return`${" ".repeat(n)}${o}`}function fu(o,t){return o.replace(tg,(e,n,r,i,s,a)=>n?"%":ig(ng(a,r??"",s===void 0?void 0:Number(s),t),r??"",i===void 0?0:Number(i)))}var ye=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},wt=class extends k{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(n=>n.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P: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 n=e[this.index-1];return n==null?null:this.#e(n,t.baseType)}return e.map(n=>this.#e(n,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let n=e;if(this.field!==void 0){let i=n[this.field];return i==null?null:this.#e(i,t.baseType)}let r=Object.entries(n).filter(([,i])=>i!=null);return r.length===0?null:r.map(([i,s])=>`${i}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let n=Array.isArray(t)?t.join(" "):String(t);if(this.format)return fu(this.format,n);if(e==="integer"&&this.base!==10){let r=Number.parseInt(n,10);if(Number.isFinite(r))return r.toString(this.base)}if(this.powerForm){let r=Number(n);if(n.trim()!==""&&Number.isFinite(r))return _r(r)}return n}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ye([p({type:String})],wt.prototype,"identifier",void 0);ye([p({type:String})],wt.prototype,"format",void 0);ye([p({type:Number})],wt.prototype,"base",void 0);ye([p({type:Number})],wt.prototype,"index",void 0);ye([p({type:Boolean,attribute:"power-form"})],wt.prototype,"powerForm",void 0);ye([p({type:String})],wt.prototype,"field",void 0);ye([p({type:String})],wt.prototype,"delimiter",void 0);ye([p({type:String,attribute:"mapping-indicator"})],wt.prototype,"mappingIndicator",void 0);ye([I({context:F,subscribe:!0}),_()],wt.prototype,"context",void 0);var ya=class extends E{getResult(){return this.getVariables().reduce((n,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return n*parseFloat(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return n},1)}};var sc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},In=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 r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),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 n=Math.floor(Math.random()*t.length);return t[n]}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 n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};sc([p({type:Number})],In.prototype,"min",void 0);sc([p({type:Number})],In.prototype,"max",void 0);sc([p({type:Number})],In.prototype,"step",void 0);var wa=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let n=Math.floor(Math.random()*e.length);return e[n]}return e}return console.error("unexpected number of children in match"),null}};var rg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ac=1e3,Rr=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 n=[];for(let r=0;r<t;r++){let i=e.calculate(),s=this.#n(i);s&&n.push(s)}return n}#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,n=this.context?.variables?.find(s=>s.identifier===e);if(!n)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let r=Array.isArray(n.value)?n.value[0]:n.value,i=parseInt(r?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>ac?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${ac} limit, truncating`),ac):t}#n(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"}}};rg([p({type:String,attribute:"number-repeats"})],Rr.prototype,"numberRepeats",void 0);var xa=class extends gi{};var vi=class extends fi{};var qa=class extends vi{};var ka=class extends mi{};var Ca=class extends Y{process(){for(let t of[...this.children])t.process()}};var gu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},yi=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 n=parseFloat(e.value);return isNaN(n)?null:isFinite(n)?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(n,this.figures):this.#e(n,this.figures):n===1/0?1/0:n===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let n=Math.pow(10,e);return Math.round(t*n)/n}#e(t,e){if(t===0)return 0;let n=Math.floor(Math.log10(Math.abs(t))),r=Math.pow(10,e-n-1);return Math.round(t*r)/r}};gu([p({type:String,attribute:"rounding-mode"})],yi.prototype,"roundingMode",void 0);gu([p({type:Number})],yi.prototype,"figures",void 0);var Sa=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 n=parseFloat(e.value);return isNaN(n)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(n)?Math.floor(n+.5):n===1/0?1/0:n===-1/0?-1/0:null}};var Ea=class extends Y{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 r=new lc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Pt(this.#e(e))):Pt(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()??""}},lc=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 Aa=class extends Y{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 r=new cc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(r)}}))}#t(t){return Array.isArray(t)?t.map(Pt):t!==null?Pt(t):null}},cc=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 Ta=class extends Y{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 r=new dc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Pt(this.#e(e))):Pt(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()??""}},dc=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 og=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Or=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.#n(t,t.length);case"popsd":return Math.sqrt(this.#n(t,t.length));case"samplevariance":return t.length<2?null:this.#n(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#n(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,n)=>e+n,0)/t.length}#e(t){let e=[...t].sort((r,i)=>r-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}#n(t,e){let n=this.#t(t);return t.reduce((r,i)=>r+Math.pow(i-n,2),0)/e}#i(t){let e=[];for(let n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};og([p({type:String})],Or.prototype,"name",void 0);var sg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Pr=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("unexpected cardinality in qti string-match"),!1;let r=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?n.value:n.value.toLowerCase();return J.compareSingleValues(r,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};sg([p({type:String,attribute:"case-sensitive"})],Pr.prototype,"caseSensitive",void 0);var ag=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Mr=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,n]=t;if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||n.value===null||e.value===void 0||n.value===void 0)return null;let r=e.value.toString(),i=n.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(r.toLowerCase()):i.includes(r)}};ag([p({type:String,attribute:"case-sensitive"})],Mr.prototype,"caseSensitive",void 0);var Ia=class extends lg(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function lg(o){return class extends o{calculateChildren(e){let n=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return n.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):n[0]-n[1]}}}var _a=class extends E{getResult(){return new hc(Array.from(this.children)).calculate()}},hc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(n=>n.calculate!==void 0).some(n=>n.calculate()===null)?null:this.expressions.map(n=>{let r=n.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((n,r)=>n+r,0)}};var Ra=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 n=Number.parseFloat(e.value);return Number.isNaN(n)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(n)}};var Oa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var bu=[{tag:"qti-and",ctor:Ls},{tag:"qti-any-n",ctor:di},{tag:"qti-base-value",ctor:qr},{tag:"qti-container-size",ctor:zs},{tag:"qti-contains",ctor:Vs},{tag:"qti-correct",ctor:js},{tag:"qti-default",ctor:Tn},{tag:"qti-delete",ctor:Fs},{tag:"qti-divide",ctor:Bs},{tag:"qti-duration-gte",ctor:Us},{tag:"qti-duration-lt",ctor:Hs},{tag:"qti-equal",ctor:hi},{tag:"qti-equal-rounded",ctor:kr},{tag:"qti-exit-response",ctor:Ws},{tag:"qti-exit-test",ctor:Qs},{tag:"qti-field-value",ctor:Gs},{tag:"qti-gcd",ctor:Xs},{tag:"qti-gt",ctor:Ys},{tag:"qti-gte",ctor:Js},{tag:"qti-index",ctor:Cr},{tag:"qti-inside",ctor:pi},{tag:"qti-integer-divide",ctor:Ks},{tag:"qti-integer-modulus",ctor:Zs},{tag:"qti-integer-to-float",ctor:ta},{tag:"qti-is-null",ctor:ea},{tag:"qti-lcm",ctor:na},{tag:"qti-lookup-outcome-value",ctor:ui},{tag:"qti-lt",ctor:ia},{tag:"qti-lte",ctor:ra},{tag:"qti-map-response",ctor:Er},{tag:"qti-map-response-point",ctor:Sr},{tag:"qti-match",ctor:oa},{tag:"qti-math-constant",ctor:Ar},{tag:"qti-math-operator",ctor:Tr},{tag:"qti-max",ctor:sa},{tag:"qti-member",ctor:aa},{tag:"qti-min",ctor:la},{tag:"qti-multiple",ctor:ca},{tag:"qti-not",ctor:da},{tag:"qti-null",ctor:ha},{tag:"qti-or",ctor:pa},{tag:"qti-ordered",ctor:ua},{tag:"qti-outcome-condition",ctor:fa},{tag:"qti-outcome-else",ctor:ba},{tag:"qti-outcome-else-if",ctor:ga},{tag:"qti-outcome-if",ctor:bi},{tag:"qti-pattern-match",ctor:Ir},{tag:"qti-power",ctor:va},{tag:"qti-printed-variable",ctor:wt},{tag:"qti-product",ctor:ya},{tag:"qti-random",ctor:wa},{tag:"qti-random-integer",ctor:In},{tag:"qti-repeat",ctor:Rr},{tag:"qti-response-condition",ctor:xa},{tag:"qti-response-else",ctor:ka},{tag:"qti-response-else-if",ctor:qa},{tag:"qti-response-if",ctor:vi},{tag:"qti-response-processing-fragment",ctor:Ca},{tag:"qti-round",ctor:Sa},{tag:"qti-round-to",ctor:yi},{tag:"qti-rule",ctor:Y},{tag:"qti-set-correct-response",ctor:Ea},{tag:"qti-set-outcome-value",ctor:Aa},{tag:"qti-set-template-value",ctor:Ta},{tag:"qti-stats-operator",ctor:Or},{tag:"qti-string-match",ctor:Pr},{tag:"qti-substring",ctor:Mr},{tag:"qti-subtract",ctor:Ia},{tag:"qti-sum",ctor:_a},{tag:"qti-truncate",ctor:Ra},{tag:"qti-variable",ctor:Oa}];for(let{tag:o,ctor:t}of bu)customElements.get(o)||customElements.define(o,t);var we=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},it;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(it||(it={}));var pc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(n,r)=>{this.toggleInternalCorrectResponse(r)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(n,r)=>{this.toggleFullCorrectResponse(r)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(n,r)=>{this.toggleCandidateCorrection(r)},this._correctResponse=null}set correctResponseAttr(n){this._correctResponse=n}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(n){this._isFullCorrectResponse=n,n&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let n=this.responseVariable;return n?.correctResponse?n.correctResponse:this._correctResponse}set correctResponse(n){let r=this._correctResponse;this._correctResponse=n,n==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(n)?n.join(","):n),this.requestUpdate("_correctResponse",r)}get correctness(){let n=this.correctResponse;if(!n)return null;let r=this.response;if(r==null||r===""||Array.isArray(r)&&r.length===0)return null;let i=Array.isArray(n)?n:[n],a=(Array.isArray(r)?r:[r]).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?it.Correct:l>0&&(l<i.length||c>0)?it.PartiallyCorrect:it.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(n){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(n):this.toggleInternalCorrectResponse(n)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(n){let r=this.nextSibling,i=r instanceof HTMLDivElement&&r?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(n&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==it.Correct))){if(!i)return;this.parentElement?.removeChild(r);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(n){this._internals.states.delete("show-correct-response"),n&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(n){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return we([p({attribute:"correct-response",reflect:!0,converter:Jt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),we([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),we([z("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),we([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),we([z("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),we([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),we([z("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),we([_()],t.prototype,"_isFullCorrectResponse",void 0),we([_()],t.prototype,"_correctResponse",void 0),t};var pt=x`
12622
+ `}async#n(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,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(t)})}};var Ls=[{tag:"qti-upload-interaction",ctor:$s}];var cu=[...cs,...ds,...hs,...us,...ms,...fs,...bs,...vs,...ys,...ws,...xs,...qs,...ks,...Ss,...Es,...Is,...Os,...Ms,...Ds,...Ns,...Ls,...rp];for(let{tag:o,ctor:t}of cu)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 fs)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);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)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 ks)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 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 Os)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 Ds)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 Ls)customElements.get(o)||customElements.define(o,t);var k2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Hd().load(`${o}`).then(a=>a.assessmentTest()),n=await Qn().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),r=await Qn().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:n,testURI:s,testURL:i,items:r,testIdentifier:e.identifier}},C2=async o=>Kt().load(o).then(t=>t.htmlDoc().firstElementChild);var zs=class extends Gf(Yt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Gf(o){return class extends o{calculateChildren(e){return e.map(r=>{let i=r;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(r=>typeof r=="boolean"&&r)}}}var du=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},di=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 n of t){if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(n.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(n.value===null||n.value===void 0)return null;n.value==="true"&&e++}return e>=this.min&&e<=this.max}};du([p({type:Number})],di.prototype,"min",void 0);du([p({type:Number})],di.prototype,"max",void 0);var Xf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},kr=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Xf([p({type:String,attribute:"base-type"})],kr.prototype,"baseType",void 0);var Vs=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 js=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 n=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,n));let r=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(r,i,n):this.#n(r,i,n)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,n){return J.compareSingleValues(t,e,n)||t===e}#n(t,e,n){let r=[...t];return e.every(i=>{let s=r.findIndex(a=>this.#e(a,i,n));return s===-1?!1:(r.splice(s,1),!0)})}#i(t,e,n){for(let r=0;r+e.length<=t.length;r++)if(e.every((i,s)=>this.#e(t[r+s],i,n)))return!0;return!1}};var Fs=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(n=>n.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var sc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Tn=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,n;if(t.length===2)e=t[0],n=t[1];else if(t.length===1)n=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===n);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let r=this.context.variables.find(i=>i.identifier===n);return r?r.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item context`),null)}};sc([p({type:String})],Tn.prototype,"identifier",void 0);sc([I({context:F,subscribe:!0}),_()],Tn.prototype,"context",void 0);sc([_(),I({context:at,subscribe:!0})],Tn.prototype,"_testContext",void 0);var Bs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return e.cardinality!=="single"||!Array.isArray(n.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):n.value.filter(i=>!e.value.includes(i))}return null}};var Us=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 n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var Hs=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(n=>this.#e(n));return e.some(n=>n===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 Ws=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(n=>this.#e(n));return e.some(n=>n===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 Yf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Cr=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],n=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let r=parseFloat(e.value),i=parseFloat(n.value);if(!isNaN(r)&&!isNaN(i))return this.roundingMode==="significantFigures"?r.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(r*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: ${r}, ${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}};Yf([p({type:String,attribute:"rounding-mode"})],Cr.prototype,"roundingMode",void 0);var hu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hi=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],n=t[1];return!e||!n?null:e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||n.value===null||e.value===void 0||n.value===void 0?null:this.toleranceMode==="exact"?J.compareSingleValues(e.value,n.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(n.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 n=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(n.length===0||n.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[r,i=r]=n,[s,a]=this.toleranceMode==="absolute"?[e-r,e+i]:[e*(1-r/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};hu([p({type:String,attribute:"tolerance-mode"})],hi.prototype,"toleranceMode",void 0);hu([p({type:String})],hi.prototype,"tolerance",void 0);var Y=class extends k{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Qs=class extends Y{process(){throw new $n}};var Gs=class extends Y{process(){throw new Ln}};var Xs=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;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],n=e?.cardinality==="record"||e?.baseType==="record";if(n&&(e.value===null||e.value===void 0))return null;if(!e||!n||!Mt(e.value))return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r==null?null:(this.#t=e.fieldBaseTypes?.[t]??so(Array.isArray(r)?r[0]:r),r)}};var Ys=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 n of t){if(n.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(n.value===null||n.value===void 0)return null;if(n.cardinality==="single"){if(Array.isArray(n.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let r=parseInt(n.value,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}else if(n.cardinality==="multiple"||n.cardinality==="ordered"){if(!Array.isArray(n.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let r of n.value){if(r==null)return null;let i=parseInt(r,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 n=1;n<t.length&&(e=this.#e(e,Math.abs(t[n])),e!==1);n++);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 n=e;e=t%e,t=n}return t}};var _t=o=>o==null||o==="";var Js=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(_t(e?.value)||_t(n?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float"))return+e.value>+n.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Ks=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return _t(e?.value)||_t(n?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float")?+e.value>=+n.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Jf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Sr=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 n=this.#t(this.n);if(n===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(n)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let n=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>n.length?null:n[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(n=>n.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Jf([p({type:String})],Sr.prototype,"n",void 0);var pu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},pi=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 n=this.#t(e.value.toString()),r=this.#e(this.coords);if(!n||r.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#n(n,r);case"rect":return this.#i(n,r);case"ellipse":return this.#r(n,r);case"poly":case"polygon":return this.#o(n,r);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 n=Number.parseFloat(e[0]),r=Number.parseFloat(e[1]);return Number.isNaN(n)||Number.isNaN(r)?(console.error("qti-inside requires numeric point coordinates"),null):{x:n,y:r}}#e(t){let e=t.split(",").map(n=>n.trim()).filter(Boolean).map(n=>Number.parseFloat(n));return e.some(n=>Number.isNaN(n))?(console.error("qti-inside requires numeric coords"),[]):e}#n(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[n,r,i]=e;return(t.x-n)**2+(t.y-r)**2<=i**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[n,r,i,s]=e,a=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,s),d=Math.max(r,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#r(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[n,r,i,s]=e;return i===0||s===0?!1:(t.x-n)**2/i**2+(t.y-r)**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 n=!1;for(let r=0,i=e.length-2;r<e.length;r+=2){let s=e[r],a=e[r+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&&(n=!n),i=r}return n}};pu([p({type:String})],pi.prototype,"shape",void 0);pu([p({type:String})],pi.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 n of t){if(n.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-integer-divide requires single cardinality"),[];if(n.value===null||n.value===void 0)return[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-integer-divide requires integer values"),[];e.push(r)}return e}};var ta=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 n of t){if(n.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(n.value===null||n.value===void 0)return[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-integer-modulus requires integer values"),[];e.push(r)}return e}};var ea=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 n=Number.parseInt(e.value,10);return Number.isNaN(n)?(console.error("qti-integer-to-float requires an integer value"),null):n}};var na=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 ia=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,n)=>this.#n(e,n))}#t(t){let e=[];for(let n of t){if(n.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(n.value===null||n.value===void 0)return[];if(n.cardinality==="single"){if(Array.isArray(n.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r);continue}if(n.cardinality!=="multiple"&&n.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(n.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let r of n.value){let i=Number.parseInt(r,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let n=Math.abs(t),r=Math.abs(e);for(;r!==0;){let i=n%r;n=r,r=i}return n}#n(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var uu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ui=class extends Y{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 n=parseFloat(this.childExpression.calculate()),r;return e.matchTable?.size?r=e.matchTable.get(n):e.interpolationTable&&(r=this.#t(n,e.interpolationTable)),r==null?(console.warn(`lookupOutcomeValue: no table entry matches ${n} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Pt(r)}})),r)}#t(t,e){if(!Number.isNaN(t))return e.find(n=>n.includeBoundary?t>=n.sourceValue:t>n.sourceValue)?.targetValue}};uu([p({type:String})],ui.prototype,"identifier",void 0);uu([I({context:F,subscribe:!0}),_()],ui.prototype,"context",void 0);var ra=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(_t(e?.value)||_t(n?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float"))return+e.value<+n.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var oa=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return _t(e?.value)||_t(n?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float")?+e.value<=+n.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Kf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Er=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 n=Array.isArray(t.value)?t.value:[t.value];if(!n||n.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,i=new Set;for(let s of n)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){r+=a.mappedValue??0,i.add(a.coords);break}}return i.size<n.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};Kf([p({type:String})],Er.prototype,"identifier",void 0);var Zf=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ar=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,n=Array.isArray(t.value)?t.value:[t.value],r=0;for(let i of n){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):J.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?r+=e.defaultValue:r+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(r=Math.max(e.lowerBound,r)),e?.upperBound!==null&&e?.upperBound!==void 0&&(r=Math.min(e.upperBound,r)),r}};Zf([p({type:String})],Ar.prototype,"identifier",void 0);var sa=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return o.match(e,n)}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):J.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 n=0;n<t.value.length;n++)if(!J.compareSingleValues(e.value[n],t.value[n],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 n=0;for(let r of e.value){let i=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(r,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;n++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var tg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Tr=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}}};tg([p({type:String})],Tr.prototype,"name",void 0);var eg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ir=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 n of t){if(n.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(n.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(n.value===null||n.value===void 0)return null;if(n.baseType!=="integer"&&n.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let r=parseFloat(n.value);if(isNaN(r))return console.error("qti-math-operator non-numerical value"),null;e.push(r)}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 n=e[0],r=e[1];return n===0&&r<=0||n<0&&!Number.isInteger(r)?null:Math.pow(n,r)}case"log_base":{if(e.length!==2)return null;let n=e[0],r=e[1];return n<=0||r<=0||r===1?null:Math.log(n)/Math.log(r)}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(n){return console.error(`qti-math-operator: error performing operation "${t}":`,n),null}}};eg([p({type:String})],Ir.prototype,"name",void 0);var aa=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 n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var la=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,n]=t;if(e.baseType===n.baseType||e.baseType==="integer"&&n.baseType==="float"||e.baseType==="float"&&n.baseType==="integer"||console.warn("Which must both have the same base-type"),n.cardinality==="multiple"||n.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||n.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||n.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||n.value===null)return null;let r=e.value;return n.value.includes(r)}};var ca=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 n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var da=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 ha=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var pa=class extends E{getResult(){return null}};var ua=class extends Yt{getResult(){return Array.from(this.children).map(e=>{let n=e;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=n.calculate(),i=!1;if(typeof r=="string")if(r==="true")i=!0;else if(r==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(i=r);return i}).some(e=>typeof e=="boolean"&&e)}};var ma=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 fa=class extends k{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},mi=class extends fa{shouldProcess(){return!0}getSubRules(){return[...this.children]}},fi=class extends fa{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},gi=class extends Y{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ga=class extends gi{};var bi=class extends fi{};var ba=class extends bi{};var va=class extends mi{};var ng=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},_r=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 n=this.#t();return n?n.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}}}};ng([p({type:String})],_r.prototype,"pattern",void 0);var ya=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,n]=t;if(e.cardinality!=="single"||n.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(n.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||n.value===null||n.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||n.baseType!=="integer"&&n.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let r=parseFloat(e.value),i=parseFloat(n.value);if(isNaN(r)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(r===0&&i<=0||r<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(r,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 ig=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function rg(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function Rr(o,t){return rg(t===void 0?o.toExponential():o.toExponential(t))}function mu(o){let[t,e]=o.split(/e/i),n=t.includes(".")?t.replace(/\.?0+$/,""):t,r=e===void 0?"":`e${e}`;return`${n}${r}`}function fu(o,t){let e=t===0?1:t,n=o===0?0:Math.floor(Math.log10(o));return n<-4||n>=e?mu(Rr(o,e-1)):mu(o.toFixed(Math.max(0,e-1-n)))}function og(o,t,e,n){if(o==="s"||o==="c"){let c=o==="c"?n.slice(0,1):n;return e===void 0?c:c.slice(0,e)}let r=Number(n);if(n.trim()===""||!Number.isFinite(r))return n;let i=Math.abs(r),s,a=r<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=Rr(i,e??6);break;case"E":s=Rr(i,e??6).toUpperCase();break;case"g":s=fu(i,e??6);break;case"G":s=fu(i,e??6).toUpperCase();break;default:return n}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function sg(o,t,e){if(o.length>=e)return o;let n=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(n)}`;if(t.includes("0")){let[,r,i]=/^([-+ ]?)(.*)$/.exec(o);return`${r}${"0".repeat(n)}${i}`}return`${" ".repeat(n)}${o}`}function gu(o,t){return o.replace(ig,(e,n,r,i,s,a)=>n?"%":sg(og(a,r??"",s===void 0?void 0:Number(s),t),r??"",i===void 0?0:Number(i)))}var ye=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},wt=class extends k{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(n=>n.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P: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 n=e[this.index-1];return n==null?null:this.#e(n,t.baseType)}return e.map(n=>this.#e(n,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let n=e;if(this.field!==void 0){let i=n[this.field];return i==null?null:this.#e(i,t.baseType)}let r=Object.entries(n).filter(([,i])=>i!=null);return r.length===0?null:r.map(([i,s])=>`${i}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let n=Array.isArray(t)?t.join(" "):String(t);if(this.format)return gu(this.format,n);if(e==="integer"&&this.base!==10){let r=Number.parseInt(n,10);if(Number.isFinite(r))return r.toString(this.base)}if(this.powerForm){let r=Number(n);if(n.trim()!==""&&Number.isFinite(r))return Rr(r)}return n}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ye([p({type:String})],wt.prototype,"identifier",void 0);ye([p({type:String})],wt.prototype,"format",void 0);ye([p({type:Number})],wt.prototype,"base",void 0);ye([p({type:Number})],wt.prototype,"index",void 0);ye([p({type:Boolean,attribute:"power-form"})],wt.prototype,"powerForm",void 0);ye([p({type:String})],wt.prototype,"field",void 0);ye([p({type:String})],wt.prototype,"delimiter",void 0);ye([p({type:String,attribute:"mapping-indicator"})],wt.prototype,"mappingIndicator",void 0);ye([I({context:F,subscribe:!0}),_()],wt.prototype,"context",void 0);var wa=class extends E{getResult(){return this.getVariables().reduce((n,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return n*parseFloat(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return n},1)}};var ac=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},In=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 r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),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 n=Math.floor(Math.random()*t.length);return t[n]}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 n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};ac([p({type:Number})],In.prototype,"min",void 0);ac([p({type:Number})],In.prototype,"max",void 0);ac([p({type:Number})],In.prototype,"step",void 0);var xa=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let n=Math.floor(Math.random()*e.length);return e[n]}return e}return console.error("unexpected number of children in match"),null}};var ag=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},lc=1e3,Or=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 n=[];for(let r=0;r<t;r++){let i=e.calculate(),s=this.#n(i);s&&n.push(s)}return n}#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,n=this.context?.variables?.find(s=>s.identifier===e);if(!n)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let r=Array.isArray(n.value)?n.value[0]:n.value,i=parseInt(r?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>lc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${lc} limit, truncating`),lc):t}#n(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"}}};ag([p({type:String,attribute:"number-repeats"})],Or.prototype,"numberRepeats",void 0);var qa=class extends gi{};var vi=class extends fi{};var ka=class extends vi{};var Ca=class extends mi{};var Sa=class extends Y{process(){for(let t of[...this.children])t.process()}};var bu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},yi=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 n=parseFloat(e.value);return isNaN(n)?null:isFinite(n)?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(n,this.figures):this.#e(n,this.figures):n===1/0?1/0:n===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let n=Math.pow(10,e);return Math.round(t*n)/n}#e(t,e){if(t===0)return 0;let n=Math.floor(Math.log10(Math.abs(t))),r=Math.pow(10,e-n-1);return Math.round(t*r)/r}};bu([p({type:String,attribute:"rounding-mode"})],yi.prototype,"roundingMode",void 0);bu([p({type:Number})],yi.prototype,"figures",void 0);var Ea=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 n=parseFloat(e.value);return isNaN(n)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(n)?Math.floor(n+.5):n===1/0?1/0:n===-1/0?-1/0:null}};var Aa=class extends Y{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 r=new cc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Pt(this.#e(e))):Pt(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()??""}},cc=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 Ta=class extends Y{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 r=new dc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(r)}}))}#t(t){return Array.isArray(t)?t.map(Pt):t!==null?Pt(t):null}},dc=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 Ia=class extends Y{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 r=new hc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Pt(this.#e(e))):Pt(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()??""}},hc=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 lg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Pr=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.#n(t,t.length);case"popsd":return Math.sqrt(this.#n(t,t.length));case"samplevariance":return t.length<2?null:this.#n(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#n(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,n)=>e+n,0)/t.length}#e(t){let e=[...t].sort((r,i)=>r-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}#n(t,e){let n=this.#t(t);return t.reduce((r,i)=>r+Math.pow(i-n,2),0)/e}#i(t){let e=[];for(let n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};lg([p({type:String})],Pr.prototype,"name",void 0);var cg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Mr=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("unexpected cardinality in qti string-match"),!1;let r=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?n.value:n.value.toLowerCase();return J.compareSingleValues(r,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};cg([p({type:String,attribute:"case-sensitive"})],Mr.prototype,"caseSensitive",void 0);var dg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Dr=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,n]=t;if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||n.value===null||e.value===void 0||n.value===void 0)return null;let r=e.value.toString(),i=n.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(r.toLowerCase()):i.includes(r)}};dg([p({type:String,attribute:"case-sensitive"})],Dr.prototype,"caseSensitive",void 0);var _a=class extends hg(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function hg(o){return class extends o{calculateChildren(e){let n=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return n.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):n[0]-n[1]}}}var Ra=class extends E{getResult(){return new pc(Array.from(this.children)).calculate()}},pc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(n=>n.calculate!==void 0).some(n=>n.calculate()===null)?null:this.expressions.map(n=>{let r=n.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((n,r)=>n+r,0)}};var Oa=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 n=Number.parseFloat(e.value);return Number.isNaN(n)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(n)}};var Pa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var vu=[{tag:"qti-and",ctor:zs},{tag:"qti-any-n",ctor:di},{tag:"qti-base-value",ctor:kr},{tag:"qti-container-size",ctor:Vs},{tag:"qti-contains",ctor:js},{tag:"qti-correct",ctor:Fs},{tag:"qti-default",ctor:Tn},{tag:"qti-delete",ctor:Bs},{tag:"qti-divide",ctor:Us},{tag:"qti-duration-gte",ctor:Hs},{tag:"qti-duration-lt",ctor:Ws},{tag:"qti-equal",ctor:hi},{tag:"qti-equal-rounded",ctor:Cr},{tag:"qti-exit-response",ctor:Qs},{tag:"qti-exit-test",ctor:Gs},{tag:"qti-field-value",ctor:Xs},{tag:"qti-gcd",ctor:Ys},{tag:"qti-gt",ctor:Js},{tag:"qti-gte",ctor:Ks},{tag:"qti-index",ctor:Sr},{tag:"qti-inside",ctor:pi},{tag:"qti-integer-divide",ctor:Zs},{tag:"qti-integer-modulus",ctor:ta},{tag:"qti-integer-to-float",ctor:ea},{tag:"qti-is-null",ctor:na},{tag:"qti-lcm",ctor:ia},{tag:"qti-lookup-outcome-value",ctor:ui},{tag:"qti-lt",ctor:ra},{tag:"qti-lte",ctor:oa},{tag:"qti-map-response",ctor:Ar},{tag:"qti-map-response-point",ctor:Er},{tag:"qti-match",ctor:sa},{tag:"qti-math-constant",ctor:Tr},{tag:"qti-math-operator",ctor:Ir},{tag:"qti-max",ctor:aa},{tag:"qti-member",ctor:la},{tag:"qti-min",ctor:ca},{tag:"qti-multiple",ctor:da},{tag:"qti-not",ctor:ha},{tag:"qti-null",ctor:pa},{tag:"qti-or",ctor:ua},{tag:"qti-ordered",ctor:ma},{tag:"qti-outcome-condition",ctor:ga},{tag:"qti-outcome-else",ctor:va},{tag:"qti-outcome-else-if",ctor:ba},{tag:"qti-outcome-if",ctor:bi},{tag:"qti-pattern-match",ctor:_r},{tag:"qti-power",ctor:ya},{tag:"qti-printed-variable",ctor:wt},{tag:"qti-product",ctor:wa},{tag:"qti-random",ctor:xa},{tag:"qti-random-integer",ctor:In},{tag:"qti-repeat",ctor:Or},{tag:"qti-response-condition",ctor:qa},{tag:"qti-response-else",ctor:Ca},{tag:"qti-response-else-if",ctor:ka},{tag:"qti-response-if",ctor:vi},{tag:"qti-response-processing-fragment",ctor:Sa},{tag:"qti-round",ctor:Ea},{tag:"qti-round-to",ctor:yi},{tag:"qti-rule",ctor:Y},{tag:"qti-set-correct-response",ctor:Aa},{tag:"qti-set-outcome-value",ctor:Ta},{tag:"qti-set-template-value",ctor:Ia},{tag:"qti-stats-operator",ctor:Pr},{tag:"qti-string-match",ctor:Mr},{tag:"qti-substring",ctor:Dr},{tag:"qti-subtract",ctor:_a},{tag:"qti-sum",ctor:Ra},{tag:"qti-truncate",ctor:Oa},{tag:"qti-variable",ctor:Pa}];for(let{tag:o,ctor:t}of vu)customElements.get(o)||customElements.define(o,t);var we=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},it;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(it||(it={}));var uc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(n,r)=>{this.toggleInternalCorrectResponse(r)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(n,r)=>{this.toggleFullCorrectResponse(r)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(n,r)=>{this.toggleCandidateCorrection(r)},this._correctResponse=null}set correctResponseAttr(n){this._correctResponse=n}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(n){this._isFullCorrectResponse=n,n&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let n=this.responseVariable;return n?.correctResponse?n.correctResponse:this._correctResponse}set correctResponse(n){let r=this._correctResponse;this._correctResponse=n,n==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(n)?n.join(","):n),this.requestUpdate("_correctResponse",r)}get correctness(){let n=this.correctResponse;if(!n)return null;let r=this.response;if(r==null||r===""||Array.isArray(r)&&r.length===0)return null;let i=Array.isArray(n)?n:[n],a=(Array.isArray(r)?r:[r]).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?it.Correct:l>0&&(l<i.length||c>0)?it.PartiallyCorrect:it.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(n){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(n):this.toggleInternalCorrectResponse(n)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(n){let r=this.nextSibling,i=r instanceof HTMLDivElement&&r?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(n&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==it.Correct))){if(!i)return;this.parentElement?.removeChild(r);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(n){this._internals.states.delete("show-correct-response"),n&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(n){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return we([p({attribute:"correct-response",reflect:!0,converter:Jt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),we([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),we([z("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),we([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),we([z("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),we([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),we([z("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),we([_()],t.prototype,"_isFullCorrectResponse",void 0),we([_()],t.prototype,"_correctResponse",void 0),t};var pt=x`
12576
12623
  /* Nothing at all until the item judges this element. */
12577
12624
  [part~='correction'] {
12578
12625
  display: none;
@@ -12605,21 +12652,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12605
12652
 
12606
12653
  pointer-events: none;
12607
12654
  }
12608
- `;var cg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},K=o=>{class t extends pc(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(n){this.showCandidateCorrection!==n&&(this.showCandidateCorrection=n),super.toggleCandidateCorrection(n);let r=this._internals;r.states.delete("candidate-correct"),r.states.delete("candidate-partially-correct"),r.states.delete("candidate-incorrect");let i=null;n&&(this.correctness===it.Correct&&(r.states.add("candidate-correct"),i="correct"),this.correctness===it.PartiallyCorrect&&(r.states.add("candidate-partially-correct"),i="partially-correct"),this.correctness===it.Incorrect&&(r.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 cg([_()],t.prototype,"_candidateCorrection",void 0),t};var _n=o=>{class t extends K(o){toggleInternalCorrectResponse(n){super.toggleInternalCorrectResponse(n);let r=this.correctResponse,i=r?Array.isArray(r)?r:[r]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),n&&i.length>0&&s.internals.states.add(i.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(n){super.toggleCandidateCorrection(n);for(let s of this._choiceElements)s.candidateCorrection=null;if(!n||!this.correctResponse)return;let r=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=r.includes(s.identifier)?"correct":"incorrect")}}return t};var Rt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(n){if(this.#t===n)return;let r=this.#t;this.#t=n;let i=this.internals.states;i.delete("candidate-correct"),i.delete("candidate-incorrect"),i.delete("candidate-partially-correct"),n&&i.add(`candidate-${n}`),this.requestUpdate("candidateCorrection",r)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var uc=class extends Rt(Ve){static{this.styles=[Ve.styles,pt]}render(){return b`<div part="control"></div>
12655
+ `;var pg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},K=o=>{class t extends uc(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(n){this.showCandidateCorrection!==n&&(this.showCandidateCorrection=n),super.toggleCandidateCorrection(n);let r=this._internals;r.states.delete("candidate-correct"),r.states.delete("candidate-partially-correct"),r.states.delete("candidate-incorrect");let i=null;n&&(this.correctness===it.Correct&&(r.states.add("candidate-correct"),i="correct"),this.correctness===it.PartiallyCorrect&&(r.states.add("candidate-partially-correct"),i="partially-correct"),this.correctness===it.Incorrect&&(r.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 pg([_()],t.prototype,"_candidateCorrection",void 0),t};var _n=o=>{class t extends K(o){toggleInternalCorrectResponse(n){super.toggleInternalCorrectResponse(n);let r=this.correctResponse,i=r?Array.isArray(r)?r:[r]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),n&&i.length>0&&s.internals.states.add(i.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(n){super.toggleCandidateCorrection(n);for(let s of this._choiceElements)s.candidateCorrection=null;if(!n||!this.correctResponse)return;let r=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=r.includes(s.identifier)?"correct":"incorrect")}}return t};var Rt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(n){if(this.#t===n)return;let r=this.#t;this.#t=n;let i=this.internals.states;i.delete("candidate-correct"),i.delete("candidate-incorrect"),i.delete("candidate-partially-correct"),n&&i.add(`candidate-${n}`),this.requestUpdate("candidateCorrection",r)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var mc=class extends Rt(Ve){static{this.styles=[Ve.styles,pt]}render(){return b`<div part="control"></div>
12609
12656
  <slot part="label"></slot>
12610
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var dg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Pa=class extends Rt(wn){constructor(){super(...arguments),this.orderCorrect=null}};dg([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Pa.prototype,"orderCorrect",void 0);var mc=class extends Rt(xn){static{this.styles=[xn.styles,pt]}render(){return b`<div part="control"><div part="control-mark"></div></div>
12657
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var ug=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ma=class extends Rt(wn){constructor(){super(...arguments),this.orderCorrect=null}};ug([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Ma.prototype,"orderCorrect",void 0);var fc=class extends Rt(xn){static{this.styles=[xn.styles,pt]}render(){return b`<div part="control"><div part="control-mark"></div></div>
12611
12658
  <slot part="label"></slot>
12612
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var fc=class extends Rt(Vt){static{this.styles=[Vt.styles,pt]}render(){return b`
12659
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var gc=class extends Rt(Vt){static{this.styles=[Vt.styles,pt]}render(){return b`
12613
12660
  <div part="control"></div>
12614
12661
  <slot part="label"></slot>
12615
12662
  <span part=${this.correctionPart} aria-hidden="true"></span>
12616
12663
  <div part="drop">
12617
12664
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
12618
12665
  </div>
12619
- `}};var gc=class extends Rt(jt){static{this.styles=[jt.styles,pt]}render(){return b`<div part="control"><div part="control-mark"></div></div>
12666
+ `}};var bc=class extends Rt(jt){static{this.styles=[jt.styles,pt]}render(){return b`<div part="control"><div part="control-mark"></div></div>
12620
12667
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
12621
12668
  <slot part="label"></slot>
12622
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var vu=class extends gt{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 n=this.getRootNode();for(;;){if(n.querySelectorAll(t).forEach(r=>r.shown=e),!(n instanceof ShadowRoot))return;n=n.host.getRootNode()}}};var yu=class extends me{#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)};#n=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.#n)}updateControlState(t,e){this.querySelectorAll(t).forEach(n=>n.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.#n),super.disconnectedCallback()}};var wu=class extends bt{#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,n){if(!t||!e?.showSolution)return;let r=t;r.showCandidateCorrection?.(!0),r.showCorrectResponse?.(n)}},xu=class extends De{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},qu=class extends un{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var bc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Dr=class extends k{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`
12669
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var yu=class extends gt{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 n=this.getRootNode();for(;;){if(n.querySelectorAll(t).forEach(r=>r.shown=e),!(n instanceof ShadowRoot))return;n=n.host.getRootNode()}}};var wu=class extends me{#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)};#n=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.#n)}updateControlState(t,e){this.querySelectorAll(t).forEach(n=>n.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.#n),super.disconnectedCallback()}};var xu=class extends bt{#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,n){if(!t||!e?.showSolution)return;let r=t;r.showCandidateCorrection?.(!0),r.showCorrectResponse?.(n)}},qu=class extends De{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},ku=class extends un{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var vc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Nr=class extends k{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`
12623
12670
  <label part="label" for="modeSelect">${this.label}</label>
12624
12671
  <select
12625
12672
  part="select"
@@ -12630,7 +12677,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12630
12677
  ${this._options[t]}
12631
12678
  </option>`)}
12632
12679
  </select>
12633
- `}};bc([I({context:qt,subscribe:!0})],Dr.prototype,"itemContext",void 0);bc([p({type:String})],Dr.prototype,"label",void 0);bc([_()],Dr.prototype,"_options",void 0);var ku=x`
12680
+ `}};vc([I({context:qt,subscribe:!0})],Nr.prototype,"itemContext",void 0);vc([p({type:String})],Nr.prototype,"label",void 0);vc([_()],Nr.prototype,"_options",void 0);var Cu=x`
12634
12681
  display: inline-flex;
12635
12682
  align-items: center;
12636
12683
  cursor: pointer;
@@ -12639,12 +12686,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12639
12686
  user-select: none;
12640
12687
  `,wi=x`
12641
12688
  background-color: lightgray;
12642
- ${ku};
12689
+ ${Cu};
12643
12690
  `,xi=x`
12644
12691
  cursor: not-allowed;
12645
12692
  opacity: 0.8;
12646
- `,VB=x`
12647
- ${ku};
12693
+ `,QB=x`
12694
+ ${Cu};
12648
12695
  border: 1px solid gray;
12649
12696
  `;var qi=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ye=class extends k{static{this.styles=x`
12650
12697
  :host {
@@ -12660,14 +12707,18 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12660
12707
  :host([disabled]) {
12661
12708
  ${xi};
12662
12709
  }
12663
- `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(n=>n.correctResponse),e=!!this.computedContext?.variables.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#n(){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.#n}">${this.#i()}</div> `}};ki([I({context:Se,subscribe:!0})],Je.prototype,"computedContext",void 0);ki([p({type:Boolean,reflect:!0})],Je.prototype,"shown",void 0);ki([p({type:Boolean,reflect:!0})],Je.prototype,"disabled",void 0);ki([p({type:String})],Je.prototype,"showCorrectText",void 0);ki([p({type:String})],Je.prototype,"hideCorrectText",void 0);ki([p({type:String})],Je.prototype,"noCorrectResponseText",void 0);var Ci=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ke=class extends k{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=x`
12710
+ `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(n=>n.correctResponse),e=!!this.computedContext?.variables.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#n(){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.#n}">${this.#i()}</div> `}};ki([I({context:Se,subscribe:!0})],Je.prototype,"computedContext",void 0);ki([p({type:Boolean,reflect:!0})],Je.prototype,"shown",void 0);ki([p({type:Boolean,reflect:!0})],Je.prototype,"disabled",void 0);ki([p({type:String})],Je.prototype,"showCorrectText",void 0);ki([p({type:String})],Je.prototype,"hideCorrectText",void 0);ki([p({type:String})],Je.prototype,"noCorrectResponseText",void 0);var Ci=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ke=class extends k{static{this.styles=x`
12664
12711
  :host {
12665
12712
  ${wi};
12666
12713
  }
12714
+ :host(:focus-visible) {
12715
+ outline: 2px solid currentColor;
12716
+ outline-offset: 2px;
12717
+ }
12667
12718
  :host([disabled]) {
12668
12719
  ${xi};
12669
12720
  }
12670
- `}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(r=>r.items)).find(n=>n.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let n=!!e?.variables?.some(i=>i.correctResponse),r=!!e?.variables?.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.disabled=!n&&!r}else this.disabled=!0}#e(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#n(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#e}">${this.#n()}</div> `}};Ci([I({context:j,subscribe:!0})],Ke.prototype,"computedContext",void 0);Ci([p({type:Boolean,reflect:!0})],Ke.prototype,"shown",void 0);Ci([p({type:Boolean,reflect:!0})],Ke.prototype,"disabled",void 0);Ci([p({type:String})],Ke.prototype,"showCorrectText",void 0);Ci([p({type:String})],Ke.prototype,"hideCorrectText",void 0);Ci([p({type:String})],Ke.prototype,"noCorrectResponseText",void 0);var ne=o=>{class t extends K(o){toggleInternalCorrectResponse(n){this.showFullCorrectResponse||this.toggleFullCorrectResponse(n)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var yc=class extends ne(Cn){};var wc=class extends _n(Sn){};var hg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ma=class extends Rt(G){static{this.styles=[G.styles,pt,x`
12721
+ `}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#n()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#n())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(r=>r.items)).find(n=>n.active);if(this.#e!==e&&(this.shown=!1,this.#e=e),e){let n=!!e?.variables?.some(i=>i.correctResponse),r=!!e?.variables?.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.disabled=!n&&!r}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#n(){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`${this.#i()}`}};Ci([I({context:j,subscribe:!0})],Ke.prototype,"computedContext",void 0);Ci([p({type:Boolean,reflect:!0})],Ke.prototype,"shown",void 0);Ci([p({type:Boolean,reflect:!0})],Ke.prototype,"disabled",void 0);Ci([p({type:String})],Ke.prototype,"showCorrectText",void 0);Ci([p({type:String})],Ke.prototype,"hideCorrectText",void 0);Ci([p({type:String})],Ke.prototype,"noCorrectResponseText",void 0);var ne=o=>{class t extends K(o){toggleInternalCorrectResponse(n){this.showFullCorrectResponse||this.toggleFullCorrectResponse(n)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var wc=class extends ne(Cn){};var xc=class extends _n(Sn){};var mg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Da=class extends Rt(G){static{this.styles=[G.styles,pt,x`
12671
12722
  /*
12672
12723
  * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
12673
12724
  * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
@@ -12731,7 +12782,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12731
12782
  }
12732
12783
  `]}render(){return b`${this.renderPrompt()}${this.renderTextarea()}
12733
12784
  <span part=${this.correctionPart} aria-hidden="true"></span>
12734
- ${this.renderValidationMessage()}`}};hg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Ma.prototype,"candidateCorrection",void 0);var Da=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[n,r]=e.split(" ");return{source:n,target:r}}):[];var xc=class extends ne(oi){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Da(this.correctResponse);for(let n of this.querySelectorAll("qti-gap")){let r=n.getAttribute("identifier"),i=n.drags;for(let s of i)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===r)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var qc=class extends K(Ht){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,n=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",n)}renderSupplementalLines(){return Q(this.#t,t=>t,t=>zi`
12785
+ ${this.renderValidationMessage()}`}};mg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Da.prototype,"candidateCorrection",void 0);var Na=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[n,r]=e.split(" ");return{source:n,target:r}}):[];var qc=class extends ne(oi){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Na(this.correctResponse);for(let n of this.querySelectorAll("qti-gap")){let r=n.getAttribute("identifier"),i=n.drags;for(let s of i)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===r)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var kc=class extends K(Ht){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,n=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",n)}renderSupplementalLines(){return Q(this.#t,t=>t,t=>zi`
12735
12786
  <line
12736
12787
  part="correct-line"
12737
12788
  x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
@@ -12742,7 +12793,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12742
12793
  stroke-width="3"
12743
12794
  stroke-dasharray="5,5"
12744
12795
  />
12745
- `)}};var kc=class extends ne(En){};var Cc=class extends K(Ge){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,n=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements){let i=n.indexOf(r.identifier);r.orderCorrect=t&&i>=0?i+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,n=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements)r.candidateCorrection=null,t&&r.order!=null&&(r.candidateCorrection=n[r.order-1]===r.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var Sc=class extends _n(si){};var Ec=class extends _n(ai){};var Ac=class extends K(dt){static get styles(){return[dt.styles,pt,x`
12796
+ `)}};var Cc=class extends ne(En){};var Sc=class extends K(Ge){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,n=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements){let i=n.indexOf(r.identifier);r.orderCorrect=t&&i>=0?i+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,n=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements)r.candidateCorrection=null,t&&r.order!=null&&(r.candidateCorrection=n[r.order-1]===r.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var Ec=class extends _n(si){};var Ac=class extends _n(ai){};var Tc=class extends K(dt){static get styles(){return[dt.styles,pt,x`
12746
12797
  /*
12747
12798
  * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
12748
12799
  * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
@@ -12761,7 +12812,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12761
12812
  `]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return b`
12762
12813
  ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
12763
12814
  <span part=${this.correctionPart} aria-hidden="true"></span>
12764
- `}};var Tc=class extends ne(ve){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Da(this.correctResponse);this.#t=t?new Set(e.map(n=>`${n.source} ${n.target}`)):new Set;for(let n of this.targetChoices){let r=n.getAttribute("identifier"),i=n.drags;for(let s of i)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${r}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function pg(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 n=0;for(let i=1;i<o.length;i++)t[i]>t[n]&&(n=i);let r=new Set;for(let i=n;i!==-1;i=e[i])r.add(i);return r}function Cu(o,t){let e=new Map(t.map((a,l)=>[a,l])),n=o.filter(a=>e.has(a)),r=n.map(a=>e.get(a)),i=pg(r),s=new Set;return i.forEach(a=>s.add(n[a])),s}var Ic=class extends ne(Xe){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let n=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of n)c.candidateCorrection=null;if(!t)return;let r=this.correctResponse,s=(r?Array.isArray(r)?r:[r]:[]).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=n.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=Cu(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var _c=class extends K(X){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,n=e?.correctResponse??this.correctResponse;this.correctResponse=t?n:e?.cardinality==="single"?"":[];let r=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${r}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let i=document.createElement("div");i.id=r,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 Rc=class extends K(yt){#t=[];#e=[];static{this.styles=[yt.styles,x`
12815
+ `}};var Ic=class extends ne(ve){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Na(this.correctResponse);this.#t=t?new Set(e.map(n=>`${n.source} ${n.target}`)):new Set;for(let n of this.targetChoices){let r=n.getAttribute("identifier"),i=n.drags;for(let s of i)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${r}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function fg(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 n=0;for(let i=1;i<o.length;i++)t[i]>t[n]&&(n=i);let r=new Set;for(let i=n;i!==-1;i=e[i])r.add(i);return r}function Su(o,t){let e=new Map(t.map((a,l)=>[a,l])),n=o.filter(a=>e.has(a)),r=n.map(a=>e.get(a)),i=fg(r),s=new Set;return i.forEach(a=>s.add(n[a])),s}var _c=class extends ne(Xe){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let n=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of n)c.candidateCorrection=null;if(!t)return;let r=this.correctResponse,s=(r?Array.isArray(r)?r:[r]:[]).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=n.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=Su(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var Rc=class extends K(X){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,n=e?.correctResponse??this.correctResponse;this.correctResponse=t?n:e?.cardinality==="single"?"":[];let r=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${r}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let i=document.createElement("div");i.id=r,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 Oc=class extends K(yt){#t=[];#e=[];static{this.styles=[yt.styles,x`
12765
12816
  [part~='correct'] {
12766
12817
  --qti-select-point-marker-color: var(--qti-correct);
12767
12818
  }
@@ -12769,12 +12820,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12769
12820
  --qti-select-point-marker-color: var(--qti-incorrect);
12770
12821
  }
12771
12822
  `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let n=this._effectiveAreaEntries,r=this.responseVariable?.baseType,i=this.correctResponse;for(let s of this.responsePoints){let a=n.some(l=>J.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,r));!n.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 r=this.#t;this.#t=[],this.requestUpdate("correctAreas",r);return}let e=this._effectiveAreaEntries;if(!e.length){let r=this.correctResponse,i=r?Array.isArray(r)?r:[r]:[];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 n=this.#t;this.#t=e.map(r=>({shape:r.shape,coords:r.coords})),this.requestUpdate("correctAreas",n)}pointPart(t,e){let n=this.#e[e];return n===void 0?"point":`point ${n?"correct":"incorrect"}`}renderSupplementalLayer(){return Q(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>b`<div
12772
- style=${Os({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
12823
+ style=${Ps({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
12773
12824
  data-correction-area
12774
12825
  data-coord=${t.coords}
12775
12826
  data-shape=${t.shape}
12776
12827
  alt=${`correct-response-${e+1}`}
12777
- ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Oc=class extends K(It){#t=null;static{this.styles=[It.styles,x`
12828
+ ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Pc=class extends K(It){#t=null;static{this.styles=[It.styles,x`
12778
12829
  [part='knob-correct'] {
12779
12830
  background-color: var(--qti-correct-light);
12780
12831
  border: 2px solid var(--qti-correct);
@@ -12789,7 +12840,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12789
12840
  }
12790
12841
  `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,n=Array.isArray(e)?e[0]:e,r=t&&n?parseFloat(n):NaN,i=this.#t;if(this.#t=Number.isFinite(r)?r: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?P:b`<div id="knob-correct" part="knob-correct">
12791
12842
  <div id="value" part="value">${this.#t}</div>
12792
- </div>`}};var Pc=class extends K(ut){static{this.styles=[ut.styles,pt,x`
12843
+ </div>`}};var Mc=class extends K(ut){static{this.styles=[ut.styles,pt,x`
12793
12844
  /*
12794
12845
  * The trailing inset only — size and leading gap come from the shared sheet.
12795
12846
  *
@@ -12822,7 +12873,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
12822
12873
  ${this.renderAnswer()} ${this.renderInput()}
12823
12874
  <span part=${this.correctionPart} aria-hidden="true"></span>
12824
12875
  ${this.renderValidationMessage()}
12825
- `}};export{K as CandidateCorrectionMixin,_n as ChoiceCorrectionMixin,pc as CorrectResponseMixin,it as Correctness,al as CustomStateSetShim,ll as INITIAL_SESSION_CONTEXT,cl as INITIAL_TEST_CONTEXT,D as Interaction,pl as IsNullOrUndefined,zt as ItemContainer,Dr as ItemCorrectResponseMode,pr as ItemPrintVariables,Ye as ItemShowCandidateCorrection,Je as ItemShowCorrectResponse,Oh as ItemViewMixin,Td as PUBLIC_ITEM_EVENTS,_o as QTI_TEST_STATE_VERSION,Ls as QtiAnd,di as QtiAnyN,gt as QtiAssessmentItem,vu as QtiAssessmentItemCorrection,Ct as QtiAssessmentItemRef,St as QtiAssessmentSection,ho as QtiAssessmentStimulus,Gn as QtiAssessmentStimulusRef,Al as QtiAssessmentStimulusRefConnectedEvent,sn as QtiAssessmentTest,ei as QtiAssociableHotspot,Cn as QtiAssociateInteraction,yc as QtiAssociateInteractionCorrection,qr as QtiBaseValue,ce as QtiBranchRule,Sn as QtiChoiceInteraction,wc as QtiChoiceInteractionCorrection,go as QtiCompanionMaterialsInfo,Yt as QtiConditionExpression,zs as QtiContainerSize,Vs as QtiContains,Yi as QtiContentBody,Xn as QtiContextDeclaration,js as QtiCorrect,ge as QtiCustomInteraction,Ji as QtiCustomOperator,Tn as QtiDefault,Fs as QtiDelete,Bs as QtiDivide,Us as QtiDurationGte,Hs as QtiDurationLt,Qe as QtiEndAttemptInteraction,hi as QtiEqual,kr as QtiEqualRounded,Ws as QtiExitResponse,$n as QtiExitResponseSignal,Qs as QtiExitTest,Ln as QtiExitTestSignal,E as QtiExpression,G as QtiExtendedTextInteraction,Ma as QtiExtendedTextInteractionCorrection,ft as QtiFeedback,bo as QtiFeedbackBlock,vo as QtiFeedbackInline,Gs as QtiFieldValue,vn as QtiGap,ur as QtiGapImg,oi as QtiGapMatchInteraction,xc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,uc as QtiGapTextCorrection,Xs as QtiGcd,Ht as QtiGraphicAssociateInteraction,qc as QtiGraphicAssociateInteractionCorrection,En as QtiGraphicGapMatchInteraction,kc as QtiGraphicGapMatchInteractionCorrection,Ge as QtiGraphicOrderInteraction,Cc as QtiGraphicOrderInteractionCorrection,Ys as QtiGt,Js as QtiGte,wn as QtiHotspotChoice,Pa as QtiHotspotChoiceCorrection,si as QtiHotspotInteraction,Sc as QtiHotspotInteractionCorrection,xn as QtiHottext,mc as QtiHottextCorrection,ai as QtiHottextInteraction,Ec as QtiHottextInteractionCorrection,Cr as QtiIndex,mr as QtiInlineChoice,dt as QtiInlineChoiceInteraction,Ac as QtiInlineChoiceInteractionCorrection,pi as QtiInside,Ks as QtiIntegerDivide,Zs as QtiIntegerModulus,ta as QtiIntegerToFloat,ea as QtiIsNull,me as QtiItem,yo as QtiItemBody,yu as QtiItemCorrection,Dt as QtiItemSessionControl,na as QtiLcm,ui as QtiLookupOutcomeValue,ia as QtiLt,ra as QtiLte,Er as QtiMapResponse,Sr as QtiMapResponsePoint,oa as QtiMatch,ve as QtiMatchInteraction,Tc as QtiMatchInteractionCorrection,Ar as QtiMathConstant,Tr as QtiMathOperator,sa as QtiMax,ks as QtiMediaInteraction,aa as QtiMember,la as QtiMin,Yn as QtiModalFeedback,ca as QtiMultiple,da as QtiNot,ha as QtiNull,Qi as QtiNumberPresented,ao as QtiNumberSelected,pa as QtiOr,Xe as QtiOrderInteraction,Ic as QtiOrderInteractionCorrection,ua as QtiOrdered,fa as QtiOutcomeCondition,de as QtiOutcomeDeclaration,ba as QtiOutcomeElse,ga as QtiOutcomeElseIf,bi as QtiOutcomeIf,co as QtiOutcomeProcessing,ql as QtiOutcomeProcessingProcessor,Ir as QtiPatternMatch,X as QtiPortableCustomInteraction,_c as QtiPortableCustomInteractionCorrection,Is as QtiPositionObjectInteraction,_s as QtiPositionObjectStage,va as QtiPower,lo as QtiPreCondition,wt as QtiPrintedVariable,ya as QtiProduct,Yo as QtiPrompt,wa as QtiRandom,In as QtiRandomInteger,Rr as QtiRepeat,xa as QtiResponseCondition,_e as QtiResponseDeclaration,ka as QtiResponseElse,qa as QtiResponseElseIf,vi as QtiResponseIf,xo as QtiResponseProcessing,Ca as QtiResponseProcessingFragment,Sa as QtiRound,yi as QtiRoundTo,he as QtiRubricBlock,Cd as QtiRuleElement,yt as QtiSelectPointInteraction,Rc as QtiSelectPointInteractionCorrection,Ea as QtiSetCorrectResponse,lc as QtiSetCorrectResponseRule,Aa as QtiSetOutcomeValue,cc as QtiSetOutcomeValueRule,Ta as QtiSetTemplateValue,dc as QtiSetTemplateValueRule,Vt as QtiSimpleAssociableChoice,fc as QtiSimpleAssociableChoiceCorrection,jt as QtiSimpleChoice,gc as QtiSimpleChoiceCorrection,It as QtiSliderInteraction,Oc as QtiSliderInteractionCorrection,Or as QtiStatsOperator,Pr as QtiStringMatch,Co as QtiStylesheet,Mr as QtiSubstring,Ia as QtiSubtract,_a as QtiSum,hc as QtiSumExpression,So as QtiTemplateConstraint,pe as QtiTemplateDeclaration,Eo as QtiTemplateProcessing,De as QtiTest,xu as QtiTestCorrection,nr as QtiTestFeedback,Me as QtiTestPart,ir as QtiTestVariables,Il as QtiTestVariablesExpression,ut as QtiTextEntryInteraction,Pc as QtiTextEntryInteractionCorrection,Ra as QtiTruncate,Ns as QtiUploadInteraction,Oa as QtiVariable,Nn as QtiVariableDeclaration,J as ScoringHelper,$e as TestBookmark,un as TestCheckItem,qu as TestCheckItemCorrection,Et as TestContainer,cn as TestEndAttempt,or as TestItemLink,gn as TestItemToSpeech,bt as TestNavigation,wu as TestNavigationCorrection,hn as TestNext,pn as TestPrev,ar as TestPrintContext,lr as TestPrintVariables,mn as TestScoringButtons,Zn as TestScoringFeedback,sr as TestSectionLink,Ke as TestShowCorrectResponse,fn as TestStamp,zo as TestSubmit,Go as TestTtsNext,Uo as TestTtsPause,Xo as TestTtsPick,hr as TestTtsPlay,Qo as TestTtsPrev,Ho as TestTtsResume,Wo as TestTtsStop,Zt as TestView,dr as TestViewToggle,Bv as asSeed,Ll as bookmarkedItems,O as boxSizing,am as classifyCustomStateSupport,j as computedContext,Se as computedItemContext,qt as configContext,Pt as convertNumberToUniversalFormat,pt as correctionPart,vy as decimalSeparator,bl as dispatchDeclared,zn as dispatchPublic,Xt as dropRegion,Sd as getCustomOperator,b2 as getItemByUri,g2 as getManifestInfo,oo as inferRecordFieldBaseType,Vf as inlineScriptText,jf as inlineStyleText,wd as installCustomStateSetFallback,Mn as interactionContext,Mt as isRecordValue,cm as isSeed,F as itemContext,xd as itemContextVariables,Ay as iterResponseValues,vl as listenDeclared,Id as listenPublic,Ty as parsePair,_y as parsePoint,ul as parseResponseAttribute,_h as pluginElements,Sh as pluginState,Hf as qtiAndMixin,kt as qtiContext,lu as qtiInteractionElements,lg as qtiSubtractMixin,Kt as qtiTransformItem,Ud as qtiTransformManifest,Qn as qtiTransformTest,Wi as readRecordFieldValues,Ny as registerCustomOperator,ro as removeDoubleSlashes,Jt as responseAttributeConverter,Iy as serializePair,Ry as serializePoint,ml as serializeResponseAttribute,Ee as sessionContext,at as testContext,Ih as ttsElements,$y as unregisterCustomOperator,W as validationMessage};
12876
+ `}};export{K as CandidateCorrectionMixin,_n as ChoiceCorrectionMixin,uc as CorrectResponseMixin,it as Correctness,ll as CustomStateSetShim,cl as INITIAL_SESSION_CONTEXT,dl as INITIAL_TEST_CONTEXT,D as Interaction,ul as IsNullOrUndefined,zt as ItemContainer,Nr as ItemCorrectResponseMode,ur as ItemPrintVariables,Ye as ItemShowCandidateCorrection,Je as ItemShowCorrectResponse,Ph as ItemViewMixin,Id as PUBLIC_ITEM_EVENTS,Ro as QTI_TEST_STATE_VERSION,zs as QtiAnd,di as QtiAnyN,gt as QtiAssessmentItem,yu as QtiAssessmentItemCorrection,Ct as QtiAssessmentItemRef,St as QtiAssessmentSection,po as QtiAssessmentStimulus,Gn as QtiAssessmentStimulusRef,Tl as QtiAssessmentStimulusRefConnectedEvent,sn as QtiAssessmentTest,ei as QtiAssociableHotspot,Cn as QtiAssociateInteraction,wc as QtiAssociateInteractionCorrection,kr as QtiBaseValue,ce as QtiBranchRule,Sn as QtiChoiceInteraction,xc as QtiChoiceInteractionCorrection,bo as QtiCompanionMaterialsInfo,Yt as QtiConditionExpression,Vs as QtiContainerSize,js as QtiContains,Yi as QtiContentBody,Xn as QtiContextDeclaration,Fs as QtiCorrect,ge as QtiCustomInteraction,Ji as QtiCustomOperator,Tn as QtiDefault,Bs as QtiDelete,Us as QtiDivide,Hs as QtiDurationGte,Ws as QtiDurationLt,Qe as QtiEndAttemptInteraction,hi as QtiEqual,Cr as QtiEqualRounded,Qs as QtiExitResponse,$n as QtiExitResponseSignal,Gs as QtiExitTest,Ln as QtiExitTestSignal,E as QtiExpression,G as QtiExtendedTextInteraction,Da as QtiExtendedTextInteractionCorrection,ft as QtiFeedback,vo as QtiFeedbackBlock,yo as QtiFeedbackInline,Xs as QtiFieldValue,vn as QtiGap,mr as QtiGapImg,oi as QtiGapMatchInteraction,qc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,mc as QtiGapTextCorrection,Ys as QtiGcd,Ht as QtiGraphicAssociateInteraction,kc as QtiGraphicAssociateInteractionCorrection,En as QtiGraphicGapMatchInteraction,Cc as QtiGraphicGapMatchInteractionCorrection,Ge as QtiGraphicOrderInteraction,Sc as QtiGraphicOrderInteractionCorrection,Js as QtiGt,Ks as QtiGte,wn as QtiHotspotChoice,Ma as QtiHotspotChoiceCorrection,si as QtiHotspotInteraction,Ec as QtiHotspotInteractionCorrection,xn as QtiHottext,fc as QtiHottextCorrection,ai as QtiHottextInteraction,Ac as QtiHottextInteractionCorrection,Sr as QtiIndex,fr as QtiInlineChoice,dt as QtiInlineChoiceInteraction,Tc as QtiInlineChoiceInteractionCorrection,pi as QtiInside,Zs as QtiIntegerDivide,ta as QtiIntegerModulus,ea as QtiIntegerToFloat,na as QtiIsNull,me as QtiItem,wo as QtiItemBody,wu as QtiItemCorrection,Dt as QtiItemSessionControl,ia as QtiLcm,ui as QtiLookupOutcomeValue,ra as QtiLt,oa as QtiLte,Ar as QtiMapResponse,Er as QtiMapResponsePoint,sa as QtiMatch,ve as QtiMatchInteraction,Ic as QtiMatchInteractionCorrection,Tr as QtiMathConstant,Ir as QtiMathOperator,aa as QtiMax,Cs as QtiMediaInteraction,la as QtiMember,ca as QtiMin,Yn as QtiModalFeedback,da as QtiMultiple,ha as QtiNot,pa as QtiNull,Qi as QtiNumberPresented,lo as QtiNumberSelected,ua as QtiOr,Xe as QtiOrderInteraction,_c as QtiOrderInteractionCorrection,ma as QtiOrdered,ga as QtiOutcomeCondition,de as QtiOutcomeDeclaration,va as QtiOutcomeElse,ba as QtiOutcomeElseIf,bi as QtiOutcomeIf,ho as QtiOutcomeProcessing,kl as QtiOutcomeProcessingProcessor,_r as QtiPatternMatch,X as QtiPortableCustomInteraction,Rc as QtiPortableCustomInteractionCorrection,_s as QtiPositionObjectInteraction,Rs as QtiPositionObjectStage,ya as QtiPower,co as QtiPreCondition,wt as QtiPrintedVariable,wa as QtiProduct,Jo as QtiPrompt,xa as QtiRandom,In as QtiRandomInteger,Or as QtiRepeat,qa as QtiResponseCondition,_e as QtiResponseDeclaration,Ca as QtiResponseElse,ka as QtiResponseElseIf,vi as QtiResponseIf,qo as QtiResponseProcessing,Sa as QtiResponseProcessingFragment,Ea as QtiRound,yi as QtiRoundTo,he as QtiRubricBlock,Sd as QtiRuleElement,yt as QtiSelectPointInteraction,Oc as QtiSelectPointInteractionCorrection,Aa as QtiSetCorrectResponse,cc as QtiSetCorrectResponseRule,Ta as QtiSetOutcomeValue,dc as QtiSetOutcomeValueRule,Ia as QtiSetTemplateValue,hc as QtiSetTemplateValueRule,Vt as QtiSimpleAssociableChoice,gc as QtiSimpleAssociableChoiceCorrection,jt as QtiSimpleChoice,bc as QtiSimpleChoiceCorrection,It as QtiSliderInteraction,Pc as QtiSliderInteractionCorrection,Pr as QtiStatsOperator,Mr as QtiStringMatch,So as QtiStylesheet,Dr as QtiSubstring,_a as QtiSubtract,Ra as QtiSum,pc as QtiSumExpression,Eo as QtiTemplateConstraint,pe as QtiTemplateDeclaration,Ao as QtiTemplateProcessing,De as QtiTest,qu as QtiTestCorrection,nr as QtiTestFeedback,Me as QtiTestPart,ir as QtiTestVariables,_l as QtiTestVariablesExpression,ut as QtiTextEntryInteraction,Mc as QtiTextEntryInteractionCorrection,Oa as QtiTruncate,$s as QtiUploadInteraction,Pa as QtiVariable,Nn as QtiVariableDeclaration,J as ScoringHelper,$e as TestBookmark,un as TestCheckItem,ku as TestCheckItemCorrection,Et as TestContainer,cn as TestEndAttempt,or as TestItemLink,gn as TestItemToSpeech,bt as TestNavigation,xu as TestNavigationCorrection,hn as TestNext,pn as TestPrev,ar as TestPrintContext,cr as TestPrintState,lr as TestPrintVariables,mn as TestScoringButtons,Zn as TestScoringFeedback,sr as TestSectionLink,Ke as TestShowCorrectResponse,fn as TestStamp,Vo as TestSubmit,Xo as TestTtsNext,Ho as TestTtsPause,Yo as TestTtsPick,pr as TestTtsPlay,Go as TestTtsPrev,Wo as TestTtsResume,Qo as TestTtsStop,Zt as TestView,hr as TestViewToggle,Wv as asSeed,zl as bookmarkedItems,O as boxSizing,lm as classifyCustomStateSupport,j as computedContext,Se as computedItemContext,qt as configContext,Pt as convertNumberToUniversalFormat,pt as correctionPart,xy as decimalSeparator,vl as dispatchDeclared,zn as dispatchPublic,Xt as dropRegion,Ed as getCustomOperator,C2 as getItemByUri,k2 as getManifestInfo,so as inferRecordFieldBaseType,Bf as inlineScriptText,Uf as inlineStyleText,xd as installCustomStateSetFallback,Mn as interactionContext,Mt as isRecordValue,dm as isSeed,F as itemContext,qd as itemContextVariables,_y as iterResponseValues,yl as listenDeclared,_d as listenPublic,Ry as parsePair,Py as parsePoint,ml as parseResponseAttribute,Rh as pluginElements,Eh as pluginState,Gf as qtiAndMixin,kt as qtiContext,cu as qtiInteractionElements,hg as qtiSubtractMixin,Kt as qtiTransformItem,Hd as qtiTransformManifest,Qn as qtiTransformTest,Wi as readRecordFieldValues,zy as registerCustomOperator,oo as removeDoubleSlashes,Jt as responseAttributeConverter,Oy as serializePair,My as serializePoint,fl as serializeResponseAttribute,Ee as sessionContext,at as testContext,_h as ttsElements,Vy as unregisterCustomOperator,W as validationMessage};
12826
12877
  /*! Bundled license information:
12827
12878
 
12828
12879
  @lit-labs/ssr-dom-shim/lib/element-internals.js: