@citolab/qti-components 10.0.0-next.7 → 10.0.0-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var Ac=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ht=function(o,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},et=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)},Tn,Dr,Nr,Si,Oa,ki,$r,Ke,Ei,ve,Lr,Ic;var B={__proto__:null};B.enumerable=!0;Object.freeze(B);var Pa=(ve=class{constructor(t,e={}){if(Tn.set(this,!1),Dr.set(this,!1),Nr.set(this,!1),Si.set(this,!1),Oa.set(this,Date.now()),ki.set(this,!1),$r.set(this,void 0),Ke.set(this,void 0),Ei.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:i,composed:r}=e;Ht(this,Tn,!!i,"f"),Ht(this,Dr,!!n,"f"),Ht(this,Nr,!!r,"f"),Ht(this,$r,`${t}`,"f"),Ht(this,Ke,null,"f"),Ht(this,Ei,!1,"f")}initEvent(t,e,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Ht(this,Si,!0,"f")}get target(){return et(this,Ke,"f")}get currentTarget(){return et(this,Ke,"f")}get srcElement(){return et(this,Ke,"f")}get type(){return et(this,$r,"f")}get cancelable(){return et(this,Tn,"f")}get defaultPrevented(){return et(this,Tn,"f")&&et(this,Si,"f")}get timeStamp(){return et(this,Oa,"f")}composedPath(){return et(this,Ei,"f")?[et(this,Ke,"f")]:[]}get returnValue(){return!et(this,Tn,"f")||!et(this,Si,"f")}get bubbles(){return et(this,Dr,"f")}get composed(){return et(this,Nr,"f")}get eventPhase(){return et(this,Ei,"f")?ve.AT_TARGET:ve.NONE}get cancelBubble(){return et(this,ki,"f")}set cancelBubble(t){t&&Ht(this,ki,!0,"f")}stopPropagation(){Ht(this,ki,!0,"f")}get isTrusted(){return!1}},Tn=new WeakMap,Dr=new WeakMap,Nr=new WeakMap,Si=new WeakMap,Oa=new WeakMap,ki=new WeakMap,$r=new WeakMap,Ke=new WeakMap,Ei=new WeakMap,ve.NONE=0,ve.CAPTURING_PHASE=1,ve.AT_TARGET=2,ve.BUBBLING_PHASE=3,ve);Object.defineProperties(Pa.prototype,{initEvent:B,stopImmediatePropagation:B,preventDefault:B,target:B,currentTarget:B,srcElement:B,type:B,cancelable:B,defaultPrevented:B,timeStamp:B,composedPath:B,returnValue:B,bubbles:B,composed:B,eventPhase:B,cancelBubble:B,stopPropagation:B,isTrusted:B});var _c=(Ic=class extends Pa{constructor(t,e={}){super(t,e),Lr.set(this,void 0),Ht(this,Lr,e?.detail??null,"f")}initCustomEvent(t,e,n,i){throw new Error("Method not implemented.")}get detail(){return et(this,Lr,"f")}},Lr=new WeakMap,Ic);Object.defineProperties(_c.prototype,{detail:B});var ne=Pa,Ma=_c;var dt;var lg=(dt=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}},dt.STYLE_RULE=1,dt.CHARSET_RULE=2,dt.IMPORT_RULE=3,dt.MEDIA_RULE=4,dt.FONT_FACE_RULE=5,dt.PAGE_RULE=6,dt.NAMESPACE_RULE=10,dt.KEYFRAMES_RULE=7,dt.KEYFRAME_RULE=8,dt.SUPPORTS_RULE=12,dt.COUNTER_STYLE_RULE=11,dt.FONT_FEATURE_VALUES_RULE=14,dt.MARGIN_RULE=9,dt);globalThis.Event??=ne;globalThis.CustomEvent??=Ma;var Na=Symbol(),Tc=o=>typeof o=="boolean"?o:o?.capture??!1,ie={__proto__:null};ie.enumerable=!0;Object.freeze(ie);var Vr=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,n){if(e==null)return;let i=Tc(n)?this.__captureEventListeners:this.__eventListeners,r=i.get(t);if(r===void 0)r=new Map,i.set(t,r);else if(r.has(e))return;let s=typeof n=="object"&&n?n:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,n)),r.set(e,s??{})}removeEventListener(t,e,n){if(e==null)return;let i=Tc(n)?this.__captureEventListeners:this.__eventListeners,r=i.get(t);r!==void 0&&(r.delete(e),r.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let n=!1,i=!1,r=ne.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ie},srcElement:{get(){return t.target},...ie},currentTarget:{get(){return l},...ie},eventPhase:{get(){return r},...ie},composedPath:{value:()=>e,...ie},stopPropagation:{value:()=>{n=!0,c.call(t)},...ie},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...ie}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(l=null,r=ne.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),l=u,r=u===t.target?ne.AT_TARGET:ne.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),i)return f()}if(n)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),l=u,r=u===t.target?ne.AT_TARGET:ne.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),i)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,Pc,bu]}};var Rc=new WeakMap,Ai=o=>{let t=Rc.get(o);return t===void 0&&Rc.set(o,t=new Map),t},Ii=class extends Vr{getRootNode(t){return t?.composed?Da:this.__host?.__shadowRoot??Da}};var Oc=class extends Ii{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Pc=new Oc,Da=Pc;var Mc=class extends Ii{constructor(t){if(super(),t!==Na)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:zr,customElements:La,document:Da,Document:Oc,Element:Dc,EventTarget:Vr,HTMLElement:Nc,Node:Ii,ShadowRoot:$c,window:this,Window:Mc})}};var Dc=class extends Ii{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ai(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){Ai(this).set(t,String(e))}removeAttribute(t){Ai(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 Ai(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new $c(Na,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 Ac(this);return this.__internals=t,t}getAttribute(t){return Ai(this).get(t)??null}};var Nc=class extends Dc{},$a=Nc;var $c=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 $a,"localName",{get(){return"lit-server-root"}});function fu(){let o,t;return{promise:new Promise((n,i)=>{o=n,t=i}),resolve:o,reject:t}}var zr=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=fu(),this.__pendingWhenDefineds.set(t,n)),n.promise}},gu=zr;var La=new gu,bu=new Mc(Na);var _i=globalThis,jr=_i.ShadowRoot&&(_i.ShadyCSS===void 0||_i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Va=Symbol(),Lc=new WeakMap,Ti=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==Va)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(jr&&t===void 0){let n=e!==void 0&&e.length===1;n&&(t=Lc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Lc.set(e,t))}return t}toString(){return this.cssText}},Vc=o=>new Ti(typeof o=="string"?o:o+"",void 0,Va),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((n,i,r)=>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.")})(i)+o[r+1],o[0]);return new Ti(e,o,Va)},zc=(o,t)=>{if(jr)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let n=document.createElement("style"),i=_i.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=e.cssText,o.appendChild(n)}},za=jr||_i.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let n of t.cssRules)e+=n.cssText;return Vc(e)})(o):o;var{is:yu,defineProperty:vu,getOwnPropertyDescriptor:wu,getOwnPropertyNames:xu,getOwnPropertySymbols:qu,getPrototypeOf:Cu}=Object,Pi=globalThis;Pi.customElements??=La;var jc=Pi.trustedTypes,Su=jc?jc.emptyScript:"",ku=Pi.reactiveElementPolyfillSupport,Ri=(o,t)=>o,Oi={toAttribute(o,t){switch(t){case Boolean:o=o?Su: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}},Fr=(o,t)=>!yu(o,t),Fc={attribute:!0,type:String,converter:Oi,reflect:!1,useDefault:!1,hasChanged:Fr};Symbol.metadata??=Symbol("metadata"),Pi.litPropertyMetadata??=new WeakMap;var re=class extends(globalThis.HTMLElement??$a){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Fc){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(),i=this.getPropertyDescriptor(t,n,e);i!==void 0&&vu(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){let{get:i,set:r}=wu(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);r?.call(this,s),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Fc}static _$Ei(){if(this.hasOwnProperty(Ri("elementProperties")))return;let t=Cu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ri("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ri("properties"))){let e=this.properties,n=[...xu(e),...qu(e)];for(let i of n)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[n,i]of e)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[e,n]of this.elementProperties){let i=this._$Eu(e,n);i!==void 0&&this._$Eh.set(i,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 i of n)e.unshift(za(i))}else t!==void 0&&e.push(za(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 zc(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),i=this.constructor._$Eu(t,n);if(i!==void 0&&n.reflect===!0){let r=(n.converter?.toAttribute!==void 0?n.converter:Oi).toAttribute(e,n.type);this._$Em=t,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){let n=this.constructor,i=n._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let r=n.getPropertyOptions(i),s=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Oi;this._$Em=i;let a=s.fromAttribute(e,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,n,i=!1,r){if(t!==void 0){let s=this.constructor;if(i===!1&&(r=this[t]),n??=s.getPropertyOptions(t),!((n.hasChanged??Fr)(r,e)||n.useDefault&&n.reflect&&r===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:i,wrapped:r},s){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),r!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),i===!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[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,r]of n){let{wrapped:s}=r,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,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){}};re.elementStyles=[],re.shadowRootOptions={mode:"open"},re[Ri("elementProperties")]=new Map,re[Ri("finalized")]=new Map,ku?.({ReactiveElement:re}),(Pi.reactiveElementVersions??=[]).push("2.1.2");var Xr=globalThis,Bc=o=>o,Br=Xr.trustedTypes,Uc=Br?Br.createPolicy("lit-html",{createHTML:o=>o}):void 0,Fa="$lit$",oe=`lit$${Math.random().toFixed(9).slice(2)}$`,Ba="?"+oe,Eu=`<${Ba}>`,en=Xr.document===void 0?{createTreeWalker:()=>({})}:document,Di=()=>en.createComment(""),Ni=o=>o===null||typeof o!="object"&&typeof o!="function",Ua=Array.isArray,Yc=o=>Ua(o)||typeof o?.[Symbol.iterator]=="function",ja=`[
3
- \f\r]`,Mi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hc=/-->/g,Wc=/>/g,Ze=RegExp(`>|${ja}(?:([^\\s"'>=/]+)(${ja}*=${ja}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Qc=/'/g,Gc=/"/g,Jc=/^(?:script|style|textarea|title)$/i,Ha=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=Ha(1),Li=Ha(2),jg=Ha(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Xc=new WeakMap,tn=en.createTreeWalker(en,129);function Kc(o,t){if(!Ua(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Uc!==void 0?Uc.createHTML(t):t}var Zc=(o,t)=>{let e=o.length-1,n=[],i,r=t===2?"<svg>":t===3?"<math>":"",s=Mi;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===Mi?d[1]==="!--"?s=Hc:d[1]!==void 0?s=Wc:d[2]!==void 0?(Jc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Ze):d[3]!==void 0&&(s=Ze):s===Ze?d[0]===">"?(s=i??Mi,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ze:d[3]==='"'?Gc:Qc):s===Gc||s===Qc?s=Ze:s===Hc||s===Wc?s=Mi:(s=Ze,i=void 0);let m=s===Ze&&o[a+1].startsWith("/>")?" ":"";r+=s===Mi?l+Eu:h>=0?(n.push(c),l.slice(0,h)+Fa+l.slice(h)+oe+m):l+oe+(h===-2?a:m)}return[Kc(o,r+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},$i=class o{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,s=0,a=t.length-1,l=this.parts,[c,d]=Zc(t,e);if(this.el=o.createElement(c,n),tn.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=tn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Fa)){let f=d[s++],m=i.getAttribute(h).split(oe),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:r,name:v[2],strings:m,ctor:v[1]==="."?Hr:v[1]==="?"?Wr:v[1]==="@"?Qr:rn}),i.removeAttribute(h)}else h.startsWith(oe)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(Jc.test(i.tagName)){let h=i.textContent.split(oe),f=h.length-1;if(f>0){i.textContent=Br?Br.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],Di()),tn.nextNode(),l.push({type:2,index:++r});i.append(h[f],Di())}}}else if(i.nodeType===8)if(i.data===Ba)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(oe,h+1))!==-1;)l.push({type:7,index:r}),h+=oe.length-1}r++}}static createElement(t,e){let n=en.createElement("template");return n.innerHTML=t,n}};function nn(o,t,e=o,n){if(t===it)return t;let i=n!==void 0?e._$Co?.[n]:e._$Cl,r=Ni(t)?void 0:t._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(o),i._$AT(o,e,n)),n!==void 0?(e._$Co??=[])[n]=i:e._$Cl=i),i!==void 0&&(t=nn(o,i._$AS(o,t.values),i,n)),t}var Ur=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,i=(t?.creationScope??en).importNode(e,!0);tn.currentNode=i;let r=tn.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Rn(r,r.nextSibling,this,t):l.type===1?c=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(c=new Gr(r,this,t)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(r=tn.nextNode(),s++)}return tn.currentNode=en,i}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++}},Rn=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cv=i?.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=nn(this,t,e),Ni(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Yc(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&&Ni(this._$AH)?this._$AA.nextSibling.data=t:this.T(en.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:n}=t,i=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=$i.createElement(Kc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{let r=new Ur(i,this),s=r.u(this.options);r.p(e),this.T(s),this._$AH=r}}_$AC(t){let e=Xc.get(t.strings);return e===void 0&&Xc.set(t.strings,e=new $i(t)),e}k(t){Ua(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,n,i=0;for(let r of t)i===e.length?e.push(n=new o(this.O(Di()),this.O(Di()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let n=Bc(t).nextSibling;Bc(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},rn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,i,r){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,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,i){let r=this.strings,s=!1;if(r===void 0)t=nn(this,t,e,0),s=!Ni(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=nn(this,a[n+l],e,l),c===it&&(c=this._$AH[l]),s||=!Ni(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Hr=class extends rn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Wr=class extends rn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Qr=class extends rn{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){if((t=nn(this,t,e,0)??P)===it)return;let n=this._$AH,i=t===P&&n!==P||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==P&&(n===P||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Gr=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){nn(this,t)}},nt={M:Fa,P:oe,A:Ba,C:1,L:Zc,R:Ur,D:Yc,V:nn,I:Rn,H:rn,N:Wr,U:Qr,B:Hr,F:Gr},Au=Xr.litHtmlPolyfillSupport;Au?.($i,Rn),(Xr.litHtmlVersions??=[]).push("3.3.3");var Wa=(o,t,e)=>{let n=e?.renderBefore??t,i=n._$litPart$;if(i===void 0){let r=e?.renderBefore??null;n._$litPart$=i=new Rn(t.insertBefore(Di(),r),r,void 0,e??{})}return i._$AI(o),i};var Qa=globalThis,C=class extends re{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=Wa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};C._$litElement$=!0,C.finalized=!0,Qa.litElementHydrateSupport?.({LitElement:C});var Iu=Qa.litElementPolyfillSupport;Iu?.({LitElement:C});(Qa.litElementVersions??=[]).push("4.2.2");var _u={attribute:!0,type:String,converter:Oi,reflect:!1,hasChanged:Fr},Tu=(o=_u,t,e)=>{let{kind:n,metadata:i}=e,r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),n==="setter"&&((o=Object.create(o)).wrapped=!0),r.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"?Tu(o,t,e):((n,i,r)=>{let s=i.hasOwnProperty(r);return i.constructor.createProperty(r,n),s?Object.getOwnPropertyDescriptor(i,r):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var we=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function On(o,t){return(e,n,i)=>{let r=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof n=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return we(e,n,{get(){let l=s.call(this);return l===void 0&&(l=r(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return we(e,n,{get(){return r(this)}})}}function td(o){return(t,e)=>{let{slot:n,selector:i}=o??{},r="slot"+(n?`[name=${n}]`:":not([name])");return we(t,e,{get(){let s=this.renderRoot?.querySelector(r),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var se=class extends Event{constructor(t,e,n,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=n,this.subscribe=i??!1}};var wt=class{constructor(t,e,n,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=n,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new se(this.context,this.host,this.t,this.subscribe))}};var Yr=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:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ga=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},xe=class extends Yr{constructor(t,e,n){super(e.context!==void 0?e.initialValue:n),this.onContextRequest=i=>{if(i.context!==this.context)return;let r=i.contextTarget??i.composedPath()[0];r!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,r,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let r=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)r.has(s)||(r.add(s),a.dispatchEvent(new se(this.context,a,s,!0)));i.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 Ga(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:i,callbackRef:r}of n){let s=i.deref(),a=r.deref();s===void 0||a===void 0||s.dispatchEvent(new se(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],n=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let r=i.callbacks.get(e);r===void 0&&i.callbacks.set(e,r=new WeakSet),r.has(n)||(r.add(n),i.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 U({context:o}){return(t,e)=>{let n=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return n.get(this).setValue(i),t.set.call(this,i)},init(i){return n.set(this,new xe(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{n.set(s,new xe(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),r;if(i===void 0){let s=new WeakMap;r={get(){return s.get(this)},set(a){n.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;r={...i,set(a){n.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,r)}}}function _({context:o,subscribe:t}){return(e,n)=>{typeof n=="object"?n.addInitializer((function(){new wt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new wt(i,{context:o,callback:r=>{i[n]=r},subscribe:t})}))}}var Jr=["this"],ed=["+","-","!"],nd=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Xa={"!":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},Kr=13;var Ru=["==","!=","<=",">=","||","&&","??","|>"],Ou=["===","!=="],M;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(M||(M={}));var Wt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Pu=o=>o===9||o===10||o===13||o===32,id=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Mu=o=>id(o)||zi(o),Du=o=>Jr.indexOf(o)!==-1,Nu=o=>o===34||o===39,zi=o=>48<=o&&o<=57,$u=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,Lu=o=>o===40||o===41||o===91||o===93||o===123||o===125,Vu=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}}),Zr=class{#t;#e=-1;#n=0;#i;constructor(t){this.#t=t,this.#r()}nextToken(){for(;Pu(this.#i);)this.#r(!0);if(Nu(this.#i))return this.#a();if(id(this.#i))return this.#c();if(zi(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($u(this.#i))return this.#h();if(Lu(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=Wt(M.STRING,Vu(this.#o()));return this.#r(),n}#c(){do this.#r();while(Mu(this.#i));let t=this.#o(),e=Du(t)?M.KEYWORD:M.IDENTIFIER;return Wt(e,t)}#p(){do this.#r();while(zi(this.#i));return this.#i===46?this.#l():Wt(M.INTEGER,this.#o())}#l(){return this.#r(),zi(this.#i)?this.#u():(this.#s(),Wt(M.DOT,".",Kr))}#m(){return this.#r(!0),Wt(M.COMMA,",")}#d(){return this.#r(!0),Wt(M.COLON,":")}#u(){do this.#r();while(zi(this.#i));return Wt(M.DECIMAL,this.#o())}#h(){this.#r();let t=this.#o(2);if(Ou.indexOf(t)!==-1)this.#r(),this.#r();else{if(t=this.#o(1),t==="=>")return this.#r(),Wt(M.ARROW,t);Ru.indexOf(t)!==-1&&this.#r()}return t=this.#o(),Wt(M.OPERATOR,t,Xa[t])}#b(){let t=String.fromCharCode(this.#i),e=Wt(M.GROUPER,t,Xa[t]);return this.#r(!0),e}};var Ya=(o,t)=>new ji(o,t).parse(),ji=class{#t;#e;#n;#i;#r;constructor(t,e){this.#e=new Zr(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.#y();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(nd.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.#C(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(ed.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),Kr);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 Jr.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.#C();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#r==="("?this.#v():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.#y();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)}#y(){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}#v(){let t=this.#y();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),n=t?.map(i=>i.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}#C(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:rd,fromEntries:zu}=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)},Fu={"+":o=>o,"-":o=>-o,"!":o=>!o},to=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=Fu[t];return{type:"Unary",operator:t,child:e,evaluate(i){return n(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,n){let i=ju[e];return{type:"Binary",operator:e,left:t,right:n,evaluate(r){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(r),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(r),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(r),l=this.left.argument.evaluate(r)):this.left.type==="ID"&&(a=r,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(r),this.right.evaluate(r))},getIds(r){return this.left.getIds(r),this.right.getIds(r),r}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(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(i){let r=this.receiver.evaluate(i),s=this.method?r:i?.this??i,a=this.method?r?.[e]:r,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(r=>r?.getIds(i)),i}}}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(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let n={};if(t&&this.entries)for(let i in t){let r=this.entries[i];r&&(n[i]=r.evaluate(e))}return n},getIds(e){if(t&&this.entries)for(let n in t){let i=this.entries[n];i&&i.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 i=this.params,r=this.body;return function(...s){let a=zu(i.map((c,d)=>[c,s[d]])),l=new Proxy(n??{},{set(c,d,h){return rd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return rd(a,d)?a[d]:c[d]}});return r.evaluate(l)}},getIds(n){return this.body.getIds(n).filter(i=>!this.params.includes(i))}}}};var Ja=null,od={boundAttributeSuffix:nt.M,marker:nt.P,markerMatch:nt.A,HTML_RESULT:nt.C,getTemplateHtml:nt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,n){return t(this,n)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ja??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ja))return void(e[Ja]=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=it;return o.j=i=>n=i,o._$AI(t,o,e),n},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:nt.V,AttributePart:nt.H,PropertyPart:nt.B,BooleanAttributePart:nt.N,EventPart:nt.U,ElementPart:nt.F,TemplateInstance:nt.R,isIterable:nt.D,ChildPart:nt.I};var{AttributePart:Bu,PropertyPart:Uu,BooleanAttributePart:Hu,EventPart:Wu}=od,Za=new to,Ka=new Map,sd=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),eo=(o,t)=>{let e=Ka.get(o);if(e===void 0){if(Ka.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let n=o.substring(2,o.length-2).trim();e=new ji(n,Za).parse(),Ka.set(o,e)}}return e?.evaluate(t)},Qu=(o,t,e,n)=>{let i=o.getAttribute("if");if(i!==null&&eo(i,t))return no(o,t,e,n)},ad=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,ld=o=>/(?:\\{{)|(?:\\}})/g.test(o),Fi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Gu=(o,t,e,n)=>{let i=o.getAttribute("repeat");if(i!==null){let r=eo(i,t);if(!r[Symbol.iterator])return P;let s=Bi(o),a=-1,l=[];for(let c of r){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let v=m.update(d,e,n);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};l.push(f)}return l}},dd={if:Qu,repeat:Gu},qe=(o,t=dd,e={},n)=>{let r=Bi(o).renderers;if(n){let a=Bi(n).renderers,l=r.super;l!==void 0?e={...r,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,v)=>no(n,f,m,v)},l(c,d,h))}:(e={...a,...r,...e},o=n)}else e={...r,...e};return s=>no(o,s,t,e)};var no=(o,t,e=dd,n={})=>{let i=Bi(o),r=[];for(let a of i.parts){let l=a.update(t,e,n);a.type===1?r.push(...l):r.push(l)}return{_$litType$:i,values:r}},cd=new Map,Bi=o=>{let t=cd.get(o);return t===void 0&&cd.set(o,t=Xu(o)),t},Xu=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,i=-1,r=[];for(;(n=e.nextNode())!==null;)if(n.nodeType===Node.COMMENT_NODE)i++;else if(n.nodeType===Node.ELEMENT_NODE){i++;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),r.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:eo(g,v);return(m?eo(f,v):u[d])?.(y,x,u)}}else l!==null?h=(f,m,v)=>{let x=m[l];return x?.(s,f,m,v)}:(c==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=Bi(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[c]=(f,m,v)=>no(s,f,m,v),h=(f,m,v)=>{let x=v[c];return x?.(f,m,v)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(ad);if(d.length===1){ld(c)&&s.setAttribute(l,Fi(c));continue}s.removeAttribute(l);let h=l,f=Bu,m=l[0];m==="."?(h=sd(l.substring(1)),f=Uu):m==="?"?(h=l.substring(1),f=Hu):m==="@"&&(h=sd(l.substring(1)),f=Wu);let v=[Fi(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ya(g,Za)),v.push(Fi(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:v,ctor:f,update:(u,g,y)=>x.map(w=>w.evaluate(u))})}}else if(n.nodeType===Node.TEXT_NODE){let s=n,a=s.textContent,l=a.split(ad);l.length>1?s.textContent=Fi(l[0]):ld(a)&&(s.textContent=Fi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=Ya(d,Za);t.parts.push({type:2,index:++i,update:(m,v)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of r)s.remove();return t};var tl=Symbol.for("qti-components.context-root"),Yu=()=>{if(typeof document>"u")return;let o=globalThis;o[tl]||(o[tl]=new Vi,o[tl].attach(document.documentElement))};Yu();var hd=[];var nl=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(" "))}},el="custom-state-support-probe";function Ju(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(el)||customElements.define(el,class extends HTMLElement{});let t=o.call(document.createElement(el)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var pd=!1;function ud(){if(pd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Ju(o);return t==="modern"||(pd=!0,HTMLElement.prototype.attachInternals=function(){let n=o.call(this);return Object.defineProperty(n,"states",{configurable:!0,enumerable:!0,value:new nl(this)}),n}),t}ud();for(let{tag:o,ctor:t}of hd)customElements.get(o)||customElements.define(o,t);var Ce=Symbol("computedItemContext");var j=Symbol("computedContext");var xt=Symbol("configContext");var Pn=Symbol("interactionContext");var F=Symbol("item");var md=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Ku=/^[A-Za-z0-9-]+$/,Zu=o=>typeof o=="string"&&Ku.test(o),Py=o=>Zu(o)?o:void 0,qt=Symbol("qtiContext");var il={view:"candidate"},Se=Symbol("sessionContext");var rl={items:[],testOutcomeVariables:[]},rt=Symbol("testContext");var O=q`
1
+ var Ic=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Wt=function(o,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},et=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)},Tn,Dr,Nr,Si,Pa,ki,$r,Ke,Ei,ve,Lr,_c;var B={__proto__:null};B.enumerable=!0;Object.freeze(B);var Ma=(ve=class{constructor(t,e={}){if(Tn.set(this,!1),Dr.set(this,!1),Nr.set(this,!1),Si.set(this,!1),Pa.set(this,Date.now()),ki.set(this,!1),$r.set(this,void 0),Ke.set(this,void 0),Ei.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:i,composed:r}=e;Wt(this,Tn,!!i,"f"),Wt(this,Dr,!!n,"f"),Wt(this,Nr,!!r,"f"),Wt(this,$r,`${t}`,"f"),Wt(this,Ke,null,"f"),Wt(this,Ei,!1,"f")}initEvent(t,e,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Wt(this,Si,!0,"f")}get target(){return et(this,Ke,"f")}get currentTarget(){return et(this,Ke,"f")}get srcElement(){return et(this,Ke,"f")}get type(){return et(this,$r,"f")}get cancelable(){return et(this,Tn,"f")}get defaultPrevented(){return et(this,Tn,"f")&&et(this,Si,"f")}get timeStamp(){return et(this,Pa,"f")}composedPath(){return et(this,Ei,"f")?[et(this,Ke,"f")]:[]}get returnValue(){return!et(this,Tn,"f")||!et(this,Si,"f")}get bubbles(){return et(this,Dr,"f")}get composed(){return et(this,Nr,"f")}get eventPhase(){return et(this,Ei,"f")?ve.AT_TARGET:ve.NONE}get cancelBubble(){return et(this,ki,"f")}set cancelBubble(t){t&&Wt(this,ki,!0,"f")}stopPropagation(){Wt(this,ki,!0,"f")}get isTrusted(){return!1}},Tn=new WeakMap,Dr=new WeakMap,Nr=new WeakMap,Si=new WeakMap,Pa=new WeakMap,ki=new WeakMap,$r=new WeakMap,Ke=new WeakMap,Ei=new WeakMap,ve.NONE=0,ve.CAPTURING_PHASE=1,ve.AT_TARGET=2,ve.BUBBLING_PHASE=3,ve);Object.defineProperties(Ma.prototype,{initEvent:B,stopImmediatePropagation:B,preventDefault:B,target:B,currentTarget:B,srcElement:B,type:B,cancelable:B,defaultPrevented:B,timeStamp:B,composedPath:B,returnValue:B,bubbles:B,composed:B,eventPhase:B,cancelBubble:B,stopPropagation:B,isTrusted:B});var Tc=(_c=class extends Ma{constructor(t,e={}){super(t,e),Lr.set(this,void 0),Wt(this,Lr,e?.detail??null,"f")}initCustomEvent(t,e,n,i){throw new Error("Method not implemented.")}get detail(){return et(this,Lr,"f")}},Lr=new WeakMap,_c);Object.defineProperties(Tc.prototype,{detail:B});var ie=Ma,Da=Tc;var dt;var cg=(dt=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}},dt.STYLE_RULE=1,dt.CHARSET_RULE=2,dt.IMPORT_RULE=3,dt.MEDIA_RULE=4,dt.FONT_FACE_RULE=5,dt.PAGE_RULE=6,dt.NAMESPACE_RULE=10,dt.KEYFRAMES_RULE=7,dt.KEYFRAME_RULE=8,dt.SUPPORTS_RULE=12,dt.COUNTER_STYLE_RULE=11,dt.FONT_FEATURE_VALUES_RULE=14,dt.MARGIN_RULE=9,dt);globalThis.Event??=ie;globalThis.CustomEvent??=Da;var $a=Symbol(),Rc=o=>typeof o=="boolean"?o:o?.capture??!1,re={__proto__:null};re.enumerable=!0;Object.freeze(re);var Vr=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,n){if(e==null)return;let i=Rc(n)?this.__captureEventListeners:this.__eventListeners,r=i.get(t);if(r===void 0)r=new Map,i.set(t,r);else if(r.has(e))return;let s=typeof n=="object"&&n?n:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,n)),r.set(e,s??{})}removeEventListener(t,e,n){if(e==null)return;let i=Rc(n)?this.__captureEventListeners:this.__eventListeners,r=i.get(t);r!==void 0&&(r.delete(e),r.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let n=!1,i=!1,r=ie.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...re},srcElement:{get(){return t.target},...re},currentTarget:{get(){return l},...re},eventPhase:{get(){return r},...re},composedPath:{value:()=>e,...re},stopPropagation:{value:()=>{n=!0,c.call(t)},...re},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...re}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(l=null,r=ie.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),l=u,r=u===t.target?ie.AT_TARGET:ie.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),i)return f()}if(n)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),l=u,r=u===t.target?ie.AT_TARGET:ie.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),i)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,Mc,yu]}};var Oc=new WeakMap,Ai=o=>{let t=Oc.get(o);return t===void 0&&Oc.set(o,t=new Map),t},Ii=class extends Vr{getRootNode(t){return t?.composed?Na:this.__host?.__shadowRoot??Na}};var Pc=class extends Ii{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Mc=new Pc,Na=Mc;var Dc=class extends Ii{constructor(t){if(super(),t!==$a)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:zr,customElements:Va,document:Na,Document:Pc,Element:Nc,EventTarget:Vr,HTMLElement:$c,Node:Ii,ShadowRoot:Lc,window:this,Window:Dc})}};var Nc=class extends Ii{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ai(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){Ai(this).set(t,String(e))}removeAttribute(t){Ai(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 Ai(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Lc($a,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Ic(this);return this.__internals=t,t}getAttribute(t){return Ai(this).get(t)??null}};var $c=class extends Nc{},La=$c;var Lc=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 La,"localName",{get(){return"lit-server-root"}});function gu(){let o,t;return{promise:new Promise((n,i)=>{o=n,t=i}),resolve:o,reject:t}}var zr=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=gu(),this.__pendingWhenDefineds.set(t,n)),n.promise}},bu=zr;var Va=new bu,yu=new Dc($a);var _i=globalThis,jr=_i.ShadowRoot&&(_i.ShadyCSS===void 0||_i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,za=Symbol(),Vc=new WeakMap,Ti=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==za)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(jr&&t===void 0){let n=e!==void 0&&e.length===1;n&&(t=Vc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Vc.set(e,t))}return t}toString(){return this.cssText}},zc=o=>new Ti(typeof o=="string"?o:o+"",void 0,za),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((n,i,r)=>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.")})(i)+o[r+1],o[0]);return new Ti(e,o,za)},jc=(o,t)=>{if(jr)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let n=document.createElement("style"),i=_i.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=e.cssText,o.appendChild(n)}},ja=jr||_i.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let n of t.cssRules)e+=n.cssText;return zc(e)})(o):o;var{is:vu,defineProperty:wu,getOwnPropertyDescriptor:xu,getOwnPropertyNames:qu,getOwnPropertySymbols:Cu,getPrototypeOf:Su}=Object,Pi=globalThis;Pi.customElements??=Va;var Fc=Pi.trustedTypes,ku=Fc?Fc.emptyScript:"",Eu=Pi.reactiveElementPolyfillSupport,Ri=(o,t)=>o,Oi={toAttribute(o,t){switch(t){case Boolean:o=o?ku: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}},Fr=(o,t)=>!vu(o,t),Bc={attribute:!0,type:String,converter:Oi,reflect:!1,useDefault:!1,hasChanged:Fr};Symbol.metadata??=Symbol("metadata"),Pi.litPropertyMetadata??=new WeakMap;var oe=class extends(globalThis.HTMLElement??La){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Bc){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(),i=this.getPropertyDescriptor(t,n,e);i!==void 0&&wu(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){let{get:i,set:r}=xu(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);r?.call(this,s),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Bc}static _$Ei(){if(this.hasOwnProperty(Ri("elementProperties")))return;let t=Su(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ri("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ri("properties"))){let e=this.properties,n=[...qu(e),...Cu(e)];for(let i of n)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[n,i]of e)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[e,n]of this.elementProperties){let i=this._$Eu(e,n);i!==void 0&&this._$Eh.set(i,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 i of n)e.unshift(ja(i))}else t!==void 0&&e.push(ja(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 jc(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),i=this.constructor._$Eu(t,n);if(i!==void 0&&n.reflect===!0){let r=(n.converter?.toAttribute!==void 0?n.converter:Oi).toAttribute(e,n.type);this._$Em=t,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){let n=this.constructor,i=n._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let r=n.getPropertyOptions(i),s=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Oi;this._$Em=i;let a=s.fromAttribute(e,r.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,n,i=!1,r){if(t!==void 0){let s=this.constructor;if(i===!1&&(r=this[t]),n??=s.getPropertyOptions(t),!((n.hasChanged??Fr)(r,e)||n.useDefault&&n.reflect&&r===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:i,wrapped:r},s){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),r!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),i===!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[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,r]of n){let{wrapped:s}=r,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,r,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){}};oe.elementStyles=[],oe.shadowRootOptions={mode:"open"},oe[Ri("elementProperties")]=new Map,oe[Ri("finalized")]=new Map,Eu?.({ReactiveElement:oe}),(Pi.reactiveElementVersions??=[]).push("2.1.2");var Xr=globalThis,Uc=o=>o,Br=Xr.trustedTypes,Hc=Br?Br.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ba="$lit$",se=`lit$${Math.random().toFixed(9).slice(2)}$`,Ua="?"+se,Au=`<${Ua}>`,en=Xr.document===void 0?{createTreeWalker:()=>({})}:document,Di=()=>en.createComment(""),Ni=o=>o===null||typeof o!="object"&&typeof o!="function",Ha=Array.isArray,Jc=o=>Ha(o)||typeof o?.[Symbol.iterator]=="function",Fa=`[
3
+ \f\r]`,Mi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Wc=/-->/g,Qc=/>/g,Ze=RegExp(`>|${Fa}(?:([^\\s"'>=/]+)(${Fa}*=${Fa}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Gc=/'/g,Xc=/"/g,Kc=/^(?:script|style|textarea|title)$/i,Wa=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=Wa(1),Li=Wa(2),Fg=Wa(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Yc=new WeakMap,tn=en.createTreeWalker(en,129);function Zc(o,t){if(!Ha(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hc!==void 0?Hc.createHTML(t):t}var td=(o,t)=>{let e=o.length-1,n=[],i,r=t===2?"<svg>":t===3?"<math>":"",s=Mi;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===Mi?d[1]==="!--"?s=Wc:d[1]!==void 0?s=Qc:d[2]!==void 0?(Kc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Ze):d[3]!==void 0&&(s=Ze):s===Ze?d[0]===">"?(s=i??Mi,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ze:d[3]==='"'?Xc:Gc):s===Xc||s===Gc?s=Ze:s===Wc||s===Qc?s=Mi:(s=Ze,i=void 0);let m=s===Ze&&o[a+1].startsWith("/>")?" ":"";r+=s===Mi?l+Au:h>=0?(n.push(c),l.slice(0,h)+Ba+l.slice(h)+se+m):l+se+(h===-2?a:m)}return[Zc(o,r+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},$i=class o{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,s=0,a=t.length-1,l=this.parts,[c,d]=td(t,e);if(this.el=o.createElement(c,n),tn.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=tn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Ba)){let f=d[s++],m=i.getAttribute(h).split(se),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:r,name:v[2],strings:m,ctor:v[1]==="."?Hr:v[1]==="?"?Wr:v[1]==="@"?Qr:rn}),i.removeAttribute(h)}else h.startsWith(se)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(Kc.test(i.tagName)){let h=i.textContent.split(se),f=h.length-1;if(f>0){i.textContent=Br?Br.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],Di()),tn.nextNode(),l.push({type:2,index:++r});i.append(h[f],Di())}}}else if(i.nodeType===8)if(i.data===Ua)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(se,h+1))!==-1;)l.push({type:7,index:r}),h+=se.length-1}r++}}static createElement(t,e){let n=en.createElement("template");return n.innerHTML=t,n}};function nn(o,t,e=o,n){if(t===it)return t;let i=n!==void 0?e._$Co?.[n]:e._$Cl,r=Ni(t)?void 0:t._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(o),i._$AT(o,e,n)),n!==void 0?(e._$Co??=[])[n]=i:e._$Cl=i),i!==void 0&&(t=nn(o,i._$AS(o,t.values),i,n)),t}var Ur=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,i=(t?.creationScope??en).importNode(e,!0);tn.currentNode=i;let r=tn.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Rn(r,r.nextSibling,this,t):l.type===1?c=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(c=new Gr(r,this,t)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(r=tn.nextNode(),s++)}return tn.currentNode=en,i}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++}},Rn=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cv=i?.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=nn(this,t,e),Ni(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Jc(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&&Ni(this._$AH)?this._$AA.nextSibling.data=t:this.T(en.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:n}=t,i=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=$i.createElement(Zc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{let r=new Ur(i,this),s=r.u(this.options);r.p(e),this.T(s),this._$AH=r}}_$AC(t){let e=Yc.get(t.strings);return e===void 0&&Yc.set(t.strings,e=new $i(t)),e}k(t){Ha(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,n,i=0;for(let r of t)i===e.length?e.push(n=new o(this.O(Di()),this.O(Di()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let n=Uc(t).nextSibling;Uc(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},rn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,i,r){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,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,i){let r=this.strings,s=!1;if(r===void 0)t=nn(this,t,e,0),s=!Ni(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=nn(this,a[n+l],e,l),c===it&&(c=this._$AH[l]),s||=!Ni(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Hr=class extends rn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Wr=class extends rn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Qr=class extends rn{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){if((t=nn(this,t,e,0)??P)===it)return;let n=this._$AH,i=t===P&&n!==P||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==P&&(n===P||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Gr=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){nn(this,t)}},nt={M:Ba,P:se,A:Ua,C:1,L:td,R:Ur,D:Jc,V:nn,I:Rn,H:rn,N:Wr,U:Qr,B:Hr,F:Gr},Iu=Xr.litHtmlPolyfillSupport;Iu?.($i,Rn),(Xr.litHtmlVersions??=[]).push("3.3.3");var Qa=(o,t,e)=>{let n=e?.renderBefore??t,i=n._$litPart$;if(i===void 0){let r=e?.renderBefore??null;n._$litPart$=i=new Rn(t.insertBefore(Di(),r),r,void 0,e??{})}return i._$AI(o),i};var Ga=globalThis,C=class extends oe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Qa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};C._$litElement$=!0,C.finalized=!0,Ga.litElementHydrateSupport?.({LitElement:C});var _u=Ga.litElementPolyfillSupport;_u?.({LitElement:C});(Ga.litElementVersions??=[]).push("4.2.2");var Tu={attribute:!0,type:String,converter:Oi,reflect:!1,hasChanged:Fr},Ru=(o=Tu,t,e)=>{let{kind:n,metadata:i}=e,r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),n==="setter"&&((o=Object.create(o)).wrapped=!0),r.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"?Ru(o,t,e):((n,i,r)=>{let s=i.hasOwnProperty(r);return i.constructor.createProperty(r,n),s?Object.getOwnPropertyDescriptor(i,r):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var we=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function On(o,t){return(e,n,i)=>{let r=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof n=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return we(e,n,{get(){let l=s.call(this);return l===void 0&&(l=r(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return we(e,n,{get(){return r(this)}})}}function ed(o){return(t,e)=>{let{slot:n,selector:i}=o??{},r="slot"+(n?`[name=${n}]`:":not([name])");return we(t,e,{get(){let s=this.renderRoot?.querySelector(r),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var ae=class extends Event{constructor(t,e,n,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=n,this.subscribe=i??!1}};var wt=class{constructor(t,e,n,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let r=e;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=e,this.callback=n,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ae(this.context,this.host,this.t,this.subscribe))}};var Yr=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:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Xa=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},xe=class extends Yr{constructor(t,e,n){super(e.context!==void 0?e.initialValue:n),this.onContextRequest=i=>{if(i.context!==this.context)return;let r=i.contextTarget??i.composedPath()[0];r!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,r,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let r=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)r.has(s)||(r.add(s),a.dispatchEvent(new ae(this.context,a,s,!0)));i.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 Xa(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:i,callbackRef:r}of n){let s=i.deref(),a=r.deref();s===void 0||a===void 0||s.dispatchEvent(new ae(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],n=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let r=i.callbacks.get(e);r===void 0&&i.callbacks.set(e,r=new WeakSet),r.has(n)||(r.add(n),i.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 U({context:o}){return(t,e)=>{let n=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return n.get(this).setValue(i),t.set.call(this,i)},init(i){return n.set(this,new xe(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{n.set(s,new xe(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),r;if(i===void 0){let s=new WeakMap;r={get(){return s.get(this)},set(a){n.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;r={...i,set(a){n.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,r)}}}function _({context:o,subscribe:t}){return(e,n)=>{typeof n=="object"?n.addInitializer((function(){new wt(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new wt(i,{context:o,callback:r=>{i[n]=r},subscribe:t})}))}}var Jr=["this"],nd=["+","-","!"],id=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Ya={"!":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},Kr=13;var Ou=["==","!=","<=",">=","||","&&","??","|>"],Pu=["===","!=="],M;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(M||(M={}));var Qt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Mu=o=>o===9||o===10||o===13||o===32,rd=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Du=o=>rd(o)||zi(o),Nu=o=>Jr.indexOf(o)!==-1,$u=o=>o===34||o===39,zi=o=>48<=o&&o<=57,Lu=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,Vu=o=>o===40||o===41||o===91||o===93||o===123||o===125,zu=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}}),Zr=class{#t;#e=-1;#n=0;#i;constructor(t){this.#t=t,this.#r()}nextToken(){for(;Mu(this.#i);)this.#r(!0);if($u(this.#i))return this.#a();if(rd(this.#i))return this.#c();if(zi(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(Lu(this.#i))return this.#h();if(Vu(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=Qt(M.STRING,zu(this.#o()));return this.#r(),n}#c(){do this.#r();while(Du(this.#i));let t=this.#o(),e=Nu(t)?M.KEYWORD:M.IDENTIFIER;return Qt(e,t)}#p(){do this.#r();while(zi(this.#i));return this.#i===46?this.#l():Qt(M.INTEGER,this.#o())}#l(){return this.#r(),zi(this.#i)?this.#u():(this.#s(),Qt(M.DOT,".",Kr))}#m(){return this.#r(!0),Qt(M.COMMA,",")}#d(){return this.#r(!0),Qt(M.COLON,":")}#u(){do this.#r();while(zi(this.#i));return Qt(M.DECIMAL,this.#o())}#h(){this.#r();let t=this.#o(2);if(Pu.indexOf(t)!==-1)this.#r(),this.#r();else{if(t=this.#o(1),t==="=>")return this.#r(),Qt(M.ARROW,t);Ou.indexOf(t)!==-1&&this.#r()}return t=this.#o(),Qt(M.OPERATOR,t,Ya[t])}#b(){let t=String.fromCharCode(this.#i),e=Qt(M.GROUPER,t,Ya[t]);return this.#r(!0),e}};var Ja=(o,t)=>new ji(o,t).parse(),ji=class{#t;#e;#n;#i;#r;constructor(t,e){this.#e=new Zr(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.#y();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(id.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.#C(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(nd.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),Kr);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 Jr.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.#C();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#r==="("?this.#v():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.#y();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)}#y(){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}#v(){let t=this.#y();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),n=t?.map(i=>i.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}#C(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:od,fromEntries:ju}=Object,Fu={"+":(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)},Bu={"+":o=>o,"-":o=>-o,"!":o=>!o},to=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=Bu[t];return{type:"Unary",operator:t,child:e,evaluate(i){return n(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,n){let i=Fu[e];return{type:"Binary",operator:e,left:t,right:n,evaluate(r){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(r),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(r),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(r),l=this.left.argument.evaluate(r)):this.left.type==="ID"&&(a=r,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(r),this.right.evaluate(r))},getIds(r){return this.left.getIds(r),this.right.getIds(r),r}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(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(i){let r=this.receiver.evaluate(i),s=this.method?r:i?.this??i,a=this.method?r?.[e]:r,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(r=>r?.getIds(i)),i}}}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(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let n={};if(t&&this.entries)for(let i in t){let r=this.entries[i];r&&(n[i]=r.evaluate(e))}return n},getIds(e){if(t&&this.entries)for(let n in t){let i=this.entries[n];i&&i.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 i=this.params,r=this.body;return function(...s){let a=ju(i.map((c,d)=>[c,s[d]])),l=new Proxy(n??{},{set(c,d,h){return od(a,d)&&(a[d]=h),c[d]=h},get(c,d){return od(a,d)?a[d]:c[d]}});return r.evaluate(l)}},getIds(n){return this.body.getIds(n).filter(i=>!this.params.includes(i))}}}};var Ka=null,sd={boundAttributeSuffix:nt.M,marker:nt.P,markerMatch:nt.A,HTML_RESULT:nt.C,getTemplateHtml:nt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,n){return t(this,n)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ka??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ka))return void(e[Ka]=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=it;return o.j=i=>n=i,o._$AI(t,o,e),n},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:nt.V,AttributePart:nt.H,PropertyPart:nt.B,BooleanAttributePart:nt.N,EventPart:nt.U,ElementPart:nt.F,TemplateInstance:nt.R,isIterable:nt.D,ChildPart:nt.I};var{AttributePart:Uu,PropertyPart:Hu,BooleanAttributePart:Wu,EventPart:Qu}=sd,tl=new to,Za=new Map,ad=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),eo=(o,t)=>{let e=Za.get(o);if(e===void 0){if(Za.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let n=o.substring(2,o.length-2).trim();e=new ji(n,tl).parse(),Za.set(o,e)}}return e?.evaluate(t)},Gu=(o,t,e,n)=>{let i=o.getAttribute("if");if(i!==null&&eo(i,t))return no(o,t,e,n)},ld=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,cd=o=>/(?:\\{{)|(?:\\}})/g.test(o),Fi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Xu=(o,t,e,n)=>{let i=o.getAttribute("repeat");if(i!==null){let r=eo(i,t);if(!r[Symbol.iterator])return P;let s=Bi(o),a=-1,l=[];for(let c of r){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let v=m.update(d,e,n);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};l.push(f)}return l}},hd={if:Gu,repeat:Xu},qe=(o,t=hd,e={},n)=>{let r=Bi(o).renderers;if(n){let a=Bi(n).renderers,l=r.super;l!==void 0?e={...r,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,v)=>no(n,f,m,v)},l(c,d,h))}:(e={...a,...r,...e},o=n)}else e={...r,...e};return s=>no(o,s,t,e)};var no=(o,t,e=hd,n={})=>{let i=Bi(o),r=[];for(let a of i.parts){let l=a.update(t,e,n);a.type===1?r.push(...l):r.push(l)}return{_$litType$:i,values:r}},dd=new Map,Bi=o=>{let t=dd.get(o);return t===void 0&&dd.set(o,t=Yu(o)),t},Yu=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,i=-1,r=[];for(;(n=e.nextNode())!==null;)if(n.nodeType===Node.COMMENT_NODE)i++;else if(n.nodeType===Node.ELEMENT_NODE){i++;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),r.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:eo(g,v);return(m?eo(f,v):u[d])?.(y,x,u)}}else l!==null?h=(f,m,v)=>{let x=m[l];return x?.(s,f,m,v)}:(c==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=Bi(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[c]=(f,m,v)=>no(s,f,m,v),h=(f,m,v)=>{let x=v[c];return x?.(f,m,v)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(ld);if(d.length===1){cd(c)&&s.setAttribute(l,Fi(c));continue}s.removeAttribute(l);let h=l,f=Uu,m=l[0];m==="."?(h=ad(l.substring(1)),f=Hu):m==="?"?(h=l.substring(1),f=Wu):m==="@"&&(h=ad(l.substring(1)),f=Qu);let v=[Fi(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ja(g,tl)),v.push(Fi(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:v,ctor:f,update:(u,g,y)=>x.map(w=>w.evaluate(u))})}}else if(n.nodeType===Node.TEXT_NODE){let s=n,a=s.textContent,l=a.split(ld);l.length>1?s.textContent=Fi(l[0]):cd(a)&&(s.textContent=Fi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=Ja(d,tl);t.parts.push({type:2,index:++i,update:(m,v)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of r)s.remove();return t};var el=Symbol.for("qti-components.context-root"),Ju=()=>{if(typeof document>"u")return;let o=globalThis;o[el]||(o[el]=new Vi,o[el].attach(document.documentElement))};Ju();var pd=[];var il=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(" "))}},nl="custom-state-support-probe";function Ku(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(nl)||customElements.define(nl,class extends HTMLElement{});let t=o.call(document.createElement(nl)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var ud=!1;function md(){if(ud)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Ku(o);return t==="modern"||(ud=!0,HTMLElement.prototype.attachInternals=function(){let n=o.call(this);return Object.defineProperty(n,"states",{configurable:!0,enumerable:!0,value:new il(this)}),n}),t}md();for(let{tag:o,ctor:t}of pd)customElements.get(o)||customElements.define(o,t);var Ce=Symbol("computedItemContext");var j=Symbol("computedContext");var xt=Symbol("configContext");var Pn=Symbol("interactionContext");var F=Symbol("item");var fd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Zu=/^[A-Za-z0-9-]+$/,tm=o=>typeof o=="string"&&Zu.test(o),My=o=>tm(o)?o:void 0,qt=Symbol("qtiContext");var rl={view:"candidate"},Se=Symbol("sessionContext");var ol={items:[],testOutcomeVariables:[]},rt=Symbol("testContext");var O=q`
6
6
  :host {
7
7
  box-sizing: border-box;
8
8
  }
@@ -12,7 +12,7 @@ Make sure to test your application with a production build as repeat registratio
12
12
  *::after {
13
13
  box-sizing: inherit;
14
14
  }
15
- `;var Qt=q`
15
+ `;var Gt=q`
16
16
  [part~='drop'] {
17
17
  /*
18
18
  * The one deliberate opt-out from the border-box reset.
@@ -56,15 +56,15 @@ 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 Mn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},D=class extends C{#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 i=this.#r===void 0,r=JSON.stringify(n.value??null);r!==this.#r&&(this.#r=r,!(i&&(n.value===null||n.value===void 0))&&r!==this.#o&&(this.#o=r,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,i){let r=n??this;this._internals.setValidity(t?{}:{customError:!0},e,r),i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}constructor(){super(),this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals(),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Mn([_({context:xt,subscribe:!0})],D.prototype,"configContext",void 0);Mn([U({context:Pn})],D.prototype,"_interactionContext",void 0);Mn([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Mn([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Mn([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Mn([p({type:String})],D.prototype,"name",void 0);var Dn=class extends C{render(){return b`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let n=e.map(i=>i.innerHTML.trim());return n.length>1||t==="multiple"||t==="ordered"?n:n[0]}};var sl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ol=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??fd(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??fd(o),value:String(o),cardinality:"single",type:"response"},fd=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",tm=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let 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 i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(r=>r.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(r=>r.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return ol(e.calculate?.());case"qti-correct":{let n=e.getAttribute("identifier")||"",i=this.context?.variables?.find(r=>r.identifier===n);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${n}"`),ol(null))}default:{try{let n=e,i=n.getResult();return ol(i,n.resultBaseType??tm(n,i))}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=q`
59
+ `;var Mn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},D=class extends C{#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 i=this.#r===void 0,r=JSON.stringify(n.value??null);r!==this.#r&&(this.#r=r,!(i&&(n.value===null||n.value===void 0))&&r!==this.#o&&(this.#o=r,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,i){let r=n??this;this._internals.setValidity(t?{}:{customError:!0},e,r),i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}constructor(){super(),this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals(),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Mn([_({context:xt,subscribe:!0})],D.prototype,"configContext",void 0);Mn([U({context:Pn})],D.prototype,"_interactionContext",void 0);Mn([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Mn([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Mn([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Mn([p({type:String})],D.prototype,"name",void 0);var Dn=class extends C{render(){return b`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let n=e.map(i=>i.innerHTML.trim());return n.length>1||t==="multiple"||t==="ordered"?n:n[0]}};var al=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},sl=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??gd(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??gd(o),value:String(o),cardinality:"single",type:"response"},gd=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",em=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let 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 i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(r=>r.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(r=>r.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return sl(e.calculate?.());case"qti-correct":{let n=e.getAttribute("identifier")||"",i=this.context?.variables?.find(r=>r.identifier===n);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${n}"`),sl(null))}default:{try{let n=e,i=n.getResult();return sl(i,n.resultBaseType??em(n,i))}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=q`
60
60
  slot {
61
61
  display: none;
62
62
  }
63
- `}render(){return b`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};sl([_({context:F,subscribe:!0})],E.prototype,"context",void 0);sl([_({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);sl([_({context:rt,subscribe:!0})],E.prototype,"_testContext",void 0);var Gt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var lv=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ot=o=>typeof o=="string"?o:o.toString();function al(o){return o==null}function io(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Ui=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},mt=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#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),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,r=this.#e===void 0?i>0:this.#e!==n||i>0;this.#e=n,r&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let n=!1;Array.isArray(e.value)?n=e.value.includes(this.identifier):n=!al(this.identifier)&&!al(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(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.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(i=>i.identifier==="numAttempts")?.value)||0)<e}};Ui([p({type:String,attribute:"show-hide"})],mt.prototype,"showHide",void 0);Ui([p({type:String,attribute:"outcome-identifier"})],mt.prototype,"outcomeIdentifier",void 0);Ui([p({type:String})],mt.prototype,"identifier",void 0);Ui([p({type:String,attribute:!1})],mt.prototype,"showStatus",void 0);Ui([_({context:j,subscribe:!0}),T()],mt.prototype,"_computedContext",void 0);function ll(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 cl(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*bv(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 yv(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 vv(o,t){return`${o} ${t}`}function wv(o){let[t,e,...n]=o.trim().split(/\s+/),i=Number(t),r=Number(e);if(!Number.isFinite(i)||!Number.isFinite(r)||n.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:r}}function xv(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=n=>n===t||n==null||n===""||Array.isArray(n)&&n.length===0;return{fromAttribute:n=>{let i=ll(n);return i===null?t:i},toAttribute:n=>e(n)?null:cl(n)}}var ae=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Hi=o=>{let t={},e={};for(let n of o){let i=n.getAttribute("field-identifier");if(!i)continue;t[i]=n.textContent?.trim()??"";let r=n.getAttribute("base-type");r&&(e[i]=r)}return{value:t,baseTypes:e}},gd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,ro=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(gd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(n=>gd.test(n))?"point":"string"};var bd=class extends C{},Nn=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},$n=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var em=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},dl=o=>t=>{let e=em(t);return e===null?null:o(e)},nm=["depcp","questify","qade"],im={Trim:dl(o=>o.trim()),ToAscii:dl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:dl(o=>o.replace(",","."))},rm=new Map(nm.flatMap(o=>Object.entries(im).map(([t,e])=>[`${o}:${t}`,e]))),hl=new Map,Ev=(o,t)=>{hl.set(o,t)},Av=o=>{hl.delete(o)},yd=o=>hl.get(o)??rm.get(o)??null;var vd={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[i,r]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(r-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&r>=d&&r<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,v=(r-d)**2/f**2;return m+v<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:r},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let n=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){let s=e[i].x,a=e[i].y,l=e[r].x,c=e[r].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(n=!n)}return n}static compareSingleValues(t,e,n){switch(n){case"identifier":case"string":return t===e;case"boolean":{let i=vd[t.trim().toLowerCase()];return i!==void 0&&i===vd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),r=parseInt(e,10);if(!isNaN(i)&&!isNaN(r)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===r}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),r=parseFloat(e);if(!isNaN(i)&&!isNaN(r))return i===r;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),r=e.split(" ");if(i.length===2&&r.length===2)return n==="pair"&&(i.sort(),r.sort()),i.join(" ")===r.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var ke=Symbol("testHost");var xd={"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 pl(o,t,e,n,i=!1){let r={detail:n??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,r)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,r))&&s:s}var wd=new Set;function ul(o,t,e,n){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),n(s)});let{deprecated:r}=t[e];r&&o.addEventListener(r,s=>{i!==void 0&&s.detail===i||(wd.has(r)||(wd.add(r),console.warn(`[qti-components] The event "${r}" is deprecated; dispatch "${e}" instead.`)),n(s))})}function Ln(o,t,e,n=!1){return pl(o,xd,t,e,n)}function qd(o,t,e){ul(o,xd,t,e)}var Cd={"cito-test-navigate":{kind:"request",scope:"test",deprecated:"qti-request-navigation"},"cito-test-end-attempt":{kind:"request",scope:"test",deprecated:"test-end-attempt"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-update-plugin-state":{kind:"request",scope:"test"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-navigated":{kind:"notification",scope:"test"},"cito-test-navigation-started":{kind:"notification",scope:"test",deprecated:"qti-navigation-loading-started"},"cito-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"qti-navigation-error"},"cito-test-rendered":{kind:"notification",scope:"test",deprecated:"qti-test-loaded"},"cito-test-loaded":{kind:"notification",scope:"test",deprecated:"qti-assessment-test-connected"},"cito-test-state-changed":{kind:"notification",scope:"test",deprecated:"qti-state-changed"},"cito-test-items-skipped":{kind:"notification",scope:"test"},"cito-test-end-reached":{kind:"notification",scope:"test"},"cito-item-ref-connected":{kind:"notification",scope:"item",deprecated:"qti-assessment-item-ref-connected"}};function V(o,t,e){pl(o,Cd,t,e)}function H(o,t,e){ul(o,Cd,t,e)}var Ee=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Sd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let n=e.getAttribute("identifier");if(!n)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${n}" has a non-numeric value, ignoring it`);continue}t.set(n,i)}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?qe(t):null,this.requestUpdate(),await this.updateComplete,V(this,"cito-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let n=e.items.find(i=>i.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)}};Ee([p({type:String})],Ct.prototype,"category",void 0);Ee([p({type:String})],Ct.prototype,"identifier",void 0);Ee([p({type:Boolean,converter:Sd})],Ct.prototype,"required",void 0);Ee([p({type:Boolean,converter:Sd})],Ct.prototype,"fixed",void 0);Ee([p({type:String})],Ct.prototype,"href",void 0);Ee([T(),_({context:j,subscribe:!0})],Ct.prototype,"computedContext",void 0);Ee([p({type:Object,attribute:!1})],Ct.prototype,"xmlDoc",void 0);Ee([_({context:ke,subscribe:!0})],Ct.prototype,"testHost",void 0);var Ae=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ml={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},St=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};Ae([p({type:String})],St.prototype,"identifier",void 0);Ae([p({type:String})],St.prototype,"required",void 0);Ae([p({type:Boolean,converter:ml})],St.prototype,"fixed",void 0);Ae([p({type:Boolean,converter:ml})],St.prototype,"visible",void 0);Ae([p({type:Boolean,converter:ml,attribute:"keep-together"})],St.prototype,"keepTogether",void 0);Ae([p({type:String,attribute:"navigation-mode"})],St.prototype,"navigationMode",void 0);Ae([p({type:String,attribute:"submission-mode"})],St.prototype,"submissionMode",void 0);Ae([_({context:rt,subscribe:!0})],St.prototype,"_testContext",void 0);var fl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},on=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,V(this,"cito-test-loaded",this)}render(){return b` <slot></slot>`}};fl([p({type:String})],on.prototype,"identifier",void 0);fl([p({type:String})],on.prototype,"title",null);fl([_({context:rt,subscribe:!0})],on.prototype,"_testContext",void 0);function oo(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 om=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},le=class extends C{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=q`
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(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};al([_({context:F,subscribe:!0})],E.prototype,"context",void 0);al([_({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);al([_({context:rt,subscribe:!0})],E.prototype,"_testContext",void 0);var Xt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var cv=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ot=o=>typeof o=="string"?o:o.toString();function ll(o){return o==null}function io(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Ui=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},mt=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new wt(this,{context:F,subscribe:!0,callback:t=>this.#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),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,r=this.#e===void 0?i>0:this.#e!==n||i>0;this.#e=n,r&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let n=!1;Array.isArray(e.value)?n=e.value.includes(this.identifier):n=!ll(this.identifier)&&!ll(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(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.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(i=>i.identifier==="numAttempts")?.value)||0)<e}};Ui([p({type:String,attribute:"show-hide"})],mt.prototype,"showHide",void 0);Ui([p({type:String,attribute:"outcome-identifier"})],mt.prototype,"outcomeIdentifier",void 0);Ui([p({type:String})],mt.prototype,"identifier",void 0);Ui([p({type:String,attribute:!1})],mt.prototype,"showStatus",void 0);Ui([_({context:j,subscribe:!0}),T()],mt.prototype,"_computedContext",void 0);function cl(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 dl(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*yv(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 vv(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 wv(o,t){return`${o} ${t}`}function xv(o){let[t,e,...n]=o.trim().split(/\s+/),i=Number(t),r=Number(e);if(!Number.isFinite(i)||!Number.isFinite(r)||n.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:r}}function qv(o,t){return`${o} ${t}`}function Yt(o){let{emptyAs:t}=o,e=n=>n===t||n==null||n===""||Array.isArray(n)&&n.length===0;return{fromAttribute:n=>{let i=cl(n);return i===null?t:i},toAttribute:n=>e(n)?null:dl(n)}}var Pt=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Hi=o=>{let t={},e={};for(let n of o){let i=n.getAttribute("field-identifier");if(!i)continue;t[i]=n.textContent?.trim()??"";let r=n.getAttribute("base-type");r&&(e[i]=r)}return{value:t,baseTypes:e}},bd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,ro=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(bd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(n=>bd.test(n))?"point":"string"};var yd=class extends C{},Nn=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},$n=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var nm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},hl=o=>t=>{let e=nm(t);return e===null?null:o(e)},im=["depcp","questify","qade"],rm={Trim:hl(o=>o.trim()),ToAscii:hl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:hl(o=>o.replace(",","."))},om=new Map(im.flatMap(o=>Object.entries(rm).map(([t,e])=>[`${o}:${t}`,e]))),pl=new Map,Av=(o,t)=>{pl.set(o,t)},Iv=o=>{pl.delete(o)},vd=o=>pl.get(o)??om.get(o)??null;var wd={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[i,r]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(r-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&r>=d&&r<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,v=(r-d)**2/f**2;return m+v<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:r},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let n=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){let s=e[i].x,a=e[i].y,l=e[r].x,c=e[r].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(n=!n)}return n}static compareSingleValues(t,e,n){switch(n){case"identifier":case"string":return t===e;case"boolean":{let i=wd[t.trim().toLowerCase()];return i!==void 0&&i===wd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),r=parseInt(e,10);if(!isNaN(i)&&!isNaN(r)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===r}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),r=parseFloat(e);if(!isNaN(i)&&!isNaN(r))return i===r;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),r=e.split(" ");if(i.length===2&&r.length===2)return n==="pair"&&(i.sort(),r.sort()),i.join(" ")===r.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var ke=Symbol("testHost");var qd={"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 ul(o,t,e,n,i=!1){let r={detail:n??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,r)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,r))&&s:s}var xd=new Set;function ml(o,t,e,n){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),n(s)});let{deprecated:r}=t[e];r&&o.addEventListener(r,s=>{i!==void 0&&s.detail===i||(xd.has(r)||(xd.add(r),console.warn(`[qti-components] The event "${r}" is deprecated; dispatch "${e}" instead.`)),n(s))})}function Ln(o,t,e,n=!1){return ul(o,qd,t,e,n)}function Cd(o,t,e){ml(o,qd,t,e)}var Sd={"cito-test-navigate":{kind:"request",scope:"test",deprecated:"qti-request-navigation"},"cito-test-end-attempt":{kind:"request",scope:"test",deprecated:"test-end-attempt"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-update-plugin-state":{kind:"request",scope:"test"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-navigated":{kind:"notification",scope:"test"},"cito-test-navigation-started":{kind:"notification",scope:"test",deprecated:"qti-navigation-loading-started"},"cito-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"qti-navigation-error"},"cito-test-rendered":{kind:"notification",scope:"test",deprecated:"qti-test-loaded"},"cito-test-loaded":{kind:"notification",scope:"test",deprecated:"qti-assessment-test-connected"},"cito-test-state-changed":{kind:"notification",scope:"test",deprecated:"qti-state-changed"},"cito-test-items-skipped":{kind:"notification",scope:"test"},"cito-test-end-reached":{kind:"notification",scope:"test"},"cito-item-ref-connected":{kind:"notification",scope:"item",deprecated:"qti-assessment-item-ref-connected"}};function V(o,t,e){ul(o,Sd,t,e)}function H(o,t,e){ml(o,Sd,t,e)}var Ee=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},kd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let n=e.getAttribute("identifier");if(!n)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${n}" has a non-numeric value, ignoring it`);continue}t.set(n,i)}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?qe(t):null,this.requestUpdate(),await this.updateComplete,V(this,"cito-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let n=e.items.find(i=>i.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)}};Ee([p({type:String})],Ct.prototype,"category",void 0);Ee([p({type:String})],Ct.prototype,"identifier",void 0);Ee([p({type:Boolean,converter:kd})],Ct.prototype,"required",void 0);Ee([p({type:Boolean,converter:kd})],Ct.prototype,"fixed",void 0);Ee([p({type:String})],Ct.prototype,"href",void 0);Ee([T(),_({context:j,subscribe:!0})],Ct.prototype,"computedContext",void 0);Ee([p({type:Object,attribute:!1})],Ct.prototype,"xmlDoc",void 0);Ee([_({context:ke,subscribe:!0})],Ct.prototype,"testHost",void 0);var Ae=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},fl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},St=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};Ae([p({type:String})],St.prototype,"identifier",void 0);Ae([p({type:String})],St.prototype,"required",void 0);Ae([p({type:Boolean,converter:fl})],St.prototype,"fixed",void 0);Ae([p({type:Boolean,converter:fl})],St.prototype,"visible",void 0);Ae([p({type:Boolean,converter:fl,attribute:"keep-together"})],St.prototype,"keepTogether",void 0);Ae([p({type:String,attribute:"navigation-mode"})],St.prototype,"navigationMode",void 0);Ae([p({type:String,attribute:"submission-mode"})],St.prototype,"submissionMode",void 0);Ae([_({context:rt,subscribe:!0})],St.prototype,"_testContext",void 0);var gl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},on=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,V(this,"cito-test-loaded",this)}render(){return b` <slot></slot>`}};gl([p({type:String})],on.prototype,"identifier",void 0);gl([p({type:String})],on.prototype,"title",null);gl([_({context:rt,subscribe:!0})],on.prototype,"_testContext",void 0);function oo(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 sm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},le=class extends C{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=q`
64
64
  :host {
65
65
  display: none;
66
66
  }
67
- `}evaluate(){return oo(this,!1)}render(){return b`<slot></slot>`}};om([p({type:String})],le.prototype,"target",void 0);var sn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Vn={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};sn([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);sn([p({type:Boolean,converter:Vn,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);sn([p({type:Boolean,converter:Vn,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);sn([p({type:Boolean,converter:Vn,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);sn([p({type:Boolean,converter:Vn,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);sn([p({type:Boolean,converter:Vn,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);sn([p({type:Boolean,converter:Vn,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var gl=o=>o?.split(/\s+/).filter(Boolean)??[],zn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:gl(o.getAttribute("include-category")),excludeCategories:gl(o.getAttribute("exclude-category"))}),jn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:n})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(r=>Array.from(r.querySelectorAll("qti-assessment-item-ref"))).filter(r=>{let s=gl(r.category);return!(e.length>0&&!s.some(a=>e.includes(a))||n.length>0&&s.some(a=>n.includes(a)))})};var sm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Wi=class extends E{#t=null;constructor(){super(),H(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 i=n.variables?.find(r=>r.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(n=>n.identifier));return jn(t,zn(this)).filter(n=>e.has(n.identifier)).length}calculate(){return this.getResult()}};sm([_({context:rt,subscribe:!0})],Wi.prototype,"_testContext",void 0);var so=class extends E{#t=null;constructor(){super(),H(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?jn(t,zn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var ao=class extends C{static{this.styles=q`
67
+ `}evaluate(){return oo(this,!1)}render(){return b`<slot></slot>`}};sm([p({type:String})],le.prototype,"target",void 0);var sn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Vn={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Mt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};sn([p({type:Number,attribute:"max-attempts"})],Mt.prototype,"maxAttempts",void 0);sn([p({type:Boolean,converter:Vn,attribute:"show-feedback"})],Mt.prototype,"showFeedback",void 0);sn([p({type:Boolean,converter:Vn,attribute:"allow-review"})],Mt.prototype,"allowReview",void 0);sn([p({type:Boolean,converter:Vn,attribute:"show-solution"})],Mt.prototype,"showSolution",void 0);sn([p({type:Boolean,converter:Vn,attribute:"allow-comment"})],Mt.prototype,"allowComment",void 0);sn([p({type:Boolean,converter:Vn,attribute:"allow-skipping"})],Mt.prototype,"allowSkipping",void 0);sn([p({type:Boolean,converter:Vn,attribute:"validate-responses"})],Mt.prototype,"validateResponses",void 0);var bl=o=>o?.split(/\s+/).filter(Boolean)??[],zn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:bl(o.getAttribute("include-category")),excludeCategories:bl(o.getAttribute("exclude-category"))}),jn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:n})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(r=>Array.from(r.querySelectorAll("qti-assessment-item-ref"))).filter(r=>{let s=bl(r.category);return!(e.length>0&&!s.some(a=>e.includes(a))||n.length>0&&s.some(a=>n.includes(a)))})};var am=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Wi=class extends E{#t=null;constructor(){super(),H(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 i=n.variables?.find(r=>r.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(n=>n.identifier));return jn(t,zn(this)).filter(n=>e.has(n.identifier)).length}calculate(){return this.getResult()}};am([_({context:rt,subscribe:!0})],Wi.prototype,"_testContext",void 0);var so=class extends E{#t=null;constructor(){super(),H(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?jn(t,zn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var ao=class extends C{static{this.styles=q`
68
68
  :host {
69
69
  display: none;
70
70
  }
@@ -72,7 +72,7 @@ Make sure to test your application with a production build as repeat registratio
72
72
  :host {
73
73
  display: none;
74
74
  }
75
- `]}render(){return b`<slot></slot>`}process(){let t=new bl,e=[...this.children];t.process(e)}},bl=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof $n))throw e}}};var an=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ft=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:md},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,i=n!==void 0?{...e,value:n}:e;this._context={...this._context,variables:[...this._context.variables,i]},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:i}=t.detail;this.updateResponseVariable(e,n),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),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(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,n=t.filter(r=>r.value!==null&&r.value!==void 0&&(r.type==="template"||e.some(s=>s.identifier===r.identifier&&s.type==="template")));n.forEach(r=>this.#i.set(r.identifier,r.value));let i=n.some(r=>JSON.stringify(e.find(s=>s.identifier===r.identifier)?.value)!==JSON.stringify(r.value));this._context={...this._context,variables:this._context.variables.map(r=>{let s=t.find(a=>a.identifier===r.identifier);return s?{...r,...s,interpolationTable:r.interpolationTable,matchTable:r.matchTable}:r})},this.#r&&i&&this.#b(),this.updateComplete.then(()=>this.#y())}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 i=this.interactionElements.find(r=>r.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),Ln(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(r=>r.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#v();let n=this.querySelector("qti-response-processing"),i=!!(n&&typeof n.process=="function");return i&&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}})),i}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(),Ln(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(r=>r.identifier===t&&r.type==="template");if(!n){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=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(r=>r.identifier!==t?r:{...r,value:i})},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 i=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(r=>r.identifier!==t?r:{...r,correctResponse:i})},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(i=>i.identifier!==t?i:{...i,value:n.cardinality==="single"||Array.isArray(e)?e:[e]})},Ln(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(i=>i.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})}#y(){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"}#v(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let i=("defaultValue"in t?t.defaultValue:null)??null;return i==null&&(t.baseType==="integer"||t.baseType==="float")&&(i="0"),{...t,value:i}})}}};an([p({type:String})],ft.prototype,"identifier",void 0);an([p({type:String})],ft.prototype,"adaptive",void 0);an([p({type:String,attribute:"time-dependent"})],ft.prototype,"timeDependent",void 0);an([p({type:String})],ft.prototype,"title",null);an([p({type:Boolean})],ft.prototype,"disabled",void 0);an([p({type:Boolean})],ft.prototype,"readonly",void 0);an([U({context:F})],ft.prototype,"_context",void 0);var kd=q`
75
+ `]}render(){return b`<slot></slot>`}process(){let t=new yl,e=[...this.children];t.process(e)}},yl=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof $n))throw e}}};var an=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ft=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:fd},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,i=n!==void 0?{...e,value:n}:e;this._context={...this._context,variables:[...this._context.variables,i]},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:i}=t.detail;this.updateResponseVariable(e,n),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),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(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,n=t.filter(r=>r.value!==null&&r.value!==void 0&&(r.type==="template"||e.some(s=>s.identifier===r.identifier&&s.type==="template")));n.forEach(r=>this.#i.set(r.identifier,r.value));let i=n.some(r=>JSON.stringify(e.find(s=>s.identifier===r.identifier)?.value)!==JSON.stringify(r.value));this._context={...this._context,variables:this._context.variables.map(r=>{let s=t.find(a=>a.identifier===r.identifier);return s?{...r,...s,interpolationTable:r.interpolationTable,matchTable:r.matchTable}:r})},this.#r&&i&&this.#b(),this.updateComplete.then(()=>this.#y())}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 i=this.interactionElements.find(r=>r.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),Ln(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(r=>r.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#v();let n=this.querySelector("qti-response-processing"),i=!!(n&&typeof n.process=="function");return i&&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}})),i}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(),Ln(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(r=>r.identifier===t&&r.type==="template");if(!n){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=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(r=>r.identifier!==t?r:{...r,value:i})},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 i=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(r=>r.identifier!==t?r:{...r,correctResponse:i})},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(i=>i.identifier!==t?i:{...i,value:n.cardinality==="single"||Array.isArray(e)?e:[e]})},Ln(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(i=>i.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})}#y(){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"}#v(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let i=("defaultValue"in t?t.defaultValue:null)??null;return i==null&&(t.baseType==="integer"||t.baseType==="float")&&(i="0"),{...t,value:i}})}}};an([p({type:String})],ft.prototype,"identifier",void 0);an([p({type:String})],ft.prototype,"adaptive",void 0);an([p({type:String,attribute:"time-dependent"})],ft.prototype,"timeDependent",void 0);an([p({type:String})],ft.prototype,"title",null);an([p({type:Boolean})],ft.prototype,"disabled",void 0);an([p({type:Boolean})],ft.prototype,"readonly",void 0);an([U({context:F})],ft.prototype,"_context",void 0);var Ed=q`
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 co=class extends C{static{this.styles=kd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function Ed(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 Ad(o,t,e,n="qti-portable-custom-interaction"){let i=[],r=o.querySelectorAll(n);if(r.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(r)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((y,w)=>{let I=u.length>w?u[w]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(w=>w.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let w=o.createElement("qti-interaction-module");y.fallbackPath&&w.setAttribute("fallback-path",y.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(w)}}}}}function Id(o,t,e){Array.from(o.getElementsByTagName("*")).filter(r=>r.localName===t||r.localName?.toLowerCase()===t.toLowerCase()).forEach(r=>{let s=`${t}-${e}`,a=Td(r,s);r.replaceWith(a)})}function _d(o,t){o.querySelectorAll("*").forEach(e=>{let n=e.classList;n&&n.forEach(i=>{if(i.startsWith(`${t}:`)){let r=i.slice(`${t}:`.length),s=`${e.nodeName}-${r}`,a=Td(e,s);e.replaceWith(a)}})})}function Td(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 Rd(o,t){let e=["hook","module"],n=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",n+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var yl=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=lm(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=am(`${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 ho(o){return yl.fromSeedKey(o)}function am(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 Od(t)}function lm(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 Od(t)}function Od(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var cm=o=>typeof o=="function"?o():o.random();function po(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let r=Math.floor(cm(t)*(i+1));[e[i],e[r]]=[e[r],e[i]]}let n=0;return o.map(i=>i.fixed?i:e[n++])}function dm(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 vl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),n=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,r=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of n){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=dm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let v=i?ho(`${t}:${r}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,y=po(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of y)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function Pd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Md=!1;function uo(o,t){Md||(Md=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function hm(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 Dd(o,t){let n=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=n.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??n.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(hm(i)));return n}function Fn(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=>Dd(e,n=>`is not well-formed XML: ${n}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Bn(o){return Dd(o,t=>`Failed to parse XML: ${t}`)}function Nd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let n=o,i;!n.namespaceURI||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(n.localName,{customElementRegistry:e}):t.createElement(n.localName):i=t.createElementNS(n.namespaceURI,n.tagName);for(let r=0;r<n.attributes.length;r++){let s=n.attributes[r];i.setAttribute(s.localName,s.value)}for(let r=0;r<n.childNodes.length;r++)i.appendChild(Nd(n.childNodes[r],t,e));return i}return o.cloneNode(!1)}function Un(o,t){let e=document.createDocumentFragment();for(let n=0;n<o.childNodes.length;n++)e.appendChild(Nd(o.childNodes[n],document,t));return e}function Hn(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(n=>{for(let i of["src","href","srcset","poster"]){let r=n.getAttribute(i)?.trim();if(r&&!/^(data:|https?:|blob:)/.test(r)){let s=t+encodeURI(r);n.setAttribute(i,s)}}})}var Yt=()=>{let o,t="",e={load(n,i){return t=n,Fn(n,i).then(r=>(o=r,e))},parse(n){return o=Bn(n),t="",e},path:n=>(Hn(o,n),t=null,e),fn(n){return n(o),e},pciHooks(n){return Rd(o,n),e},async configurePci(n,i,r="qti-portable-custom-interaction"){return await Ad(o,n,i,r),e},shuffleInteractions(n){let i=typeof n=="string"?n.trim():n;if(i==null||i===""){let r=t||"default-item-seed";return uo("qtiTransformItem",r),vl(o,r),e}return vl(o,i),e},extendElementName:(n,i)=>(Id(o,n,i),e),extendElementsWithClass:(n="extend")=>(_d(o,n),e),customInteraction(n,i){let r=o.querySelector("qti-custom-interaction"),s=r.querySelector("object");return r.setAttribute("data-base-ref",n),r.setAttribute("data-base-item",n+i),r.setAttribute("data",s.getAttribute("data")),r.setAttribute("width",s.getAttribute("width")),r.setAttribute("height",s.getAttribute("height")),r.removeChild(s),e},convertCDATAtoComment(){return Ed(o),e},stripStyleSheets(){return Pd(o),e},html(){return t!==null&&Hn(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Un(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return t!==null&&Hn(o,t.substring(0,t.lastIndexOf("/"))),Un(o,n)},xmlDoc(){return o}};return e};var $d=()=>{let o,t={async load(e,n){return o=await Fn(e,n),t},parse(e){o=Bn(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Ld(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let n=e.getAttribute("identifier"),i=e.getAttribute("href"),r=e.getAttribute("category");t.push({identifier:n,href:i,category:r})}),t}var mo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Vd=o=>mo(o,"qti-assessment-item-ref","assessmentitemref"),Gi=o=>mo(o,"qti-assessment-section","assessmentsection"),Qi=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="true"||n==="1"}),pm=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="false"||n==="0"}),wl=o=>mo(o,"qti-ordering","ordering"),um=o=>mo(o,"qti-selection","selection"),mm=o=>Array.from(o.children).filter(t=>wl(t)&&Qi(t,"shuffle")),fm=(o,t)=>ho(`${o}:${t}`);function gm(o){let t=[],e=[],n=i=>{for(let r of Array.from(i.children))Vd(r)?t.push(r):Gi(r)?n(r):!wl(r)&&!um(r)&&e.push(r.localName)};return n(o),{itemRefs:t,dropped:e}}function bm(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 zd(o,t){for(let l of Array.from(o.children))Gi(l)&&zd(l,t);let e=mm(o);if(e.length===0)return;let n=[],i=[];for(let l of Array.from(o.children))if(Vd(l))n.push({nodes:[l],fixed:Qi(l,"fixed")}),i.push(l);else if(Gi(l)){let{itemRefs:c,dropped:d}=gm(l);if(bm(l,d),pm(l,"keep-together","keeptogether"))for(let h of c)n.push({nodes:[h],fixed:Qi(h,"fixed")});else c.length>0&&n.push({nodes:c,fixed:Qi(l,"fixed")});i.push(l)}let r=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=po(n,fm(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,r);for(let l of e)l.remove()}function jd(o){return Array.from(o.getElementsByTagName("*")).some(t=>wl(t)&&Qi(t,"shuffle"))}function xl(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(n=>Gi(n));for(let n of e){if(!n.parentNode)continue;let i=n.parentElement;i&&Gi(i)||zd(n,t)}}var Wn=()=>{let o,t="",e={async load(n,i){return o=await Fn(n,i),t=n,e.path(n.substring(0,n.lastIndexOf("/"))),e},parse(n){return o=Bn(n),t="",e},path:n=>(Hn(o,n),e),fn(n){return n(o),e},shuffleOrdering(n){if(!jd(o))return e;let i=typeof n=="string"?n.trim():n;if(i==null||i===""){let r=t||"default-test-seed";return uo("qtiTransformTest",r),xl(o,r),e}return xl(o,i),e},items(){return Ld(o)},html(){return new XMLSerializer().serializeToString(Un(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return Un(o,n)},xmlDoc(){return o}};return e};var Fd=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ql=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}},Qn=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new ql(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 Yt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");n&&(t.innerHTML="",t.append(n))}};Fd([p({type:String})],Qn.prototype,"identifier",void 0);Fd([p({type:String})],Qn.prototype,"href",void 0);var fo=class extends C{};var ym=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Xi=class extends C{render(){return b`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let r=i;r.mathVariable!==!0||r.value===null||r.value===void 0||t.set(r.identifier,this.#e(r.value))}if(t.size===0)return;let n=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of n){let r=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(r);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",r);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",r),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};ym([_({context:F,subscribe:!0}),T()],Xi.prototype,"context",void 0);var Bd=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Gn=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
83
+ `;var co=class extends C{static{this.styles=Ed}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function Ad(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 Id(o,t,e,n="qti-portable-custom-interaction"){let i=[],r=o.querySelectorAll(n);if(r.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(r)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((y,w)=>{let I=u.length>w?u[w]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(w=>w.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let w=o.createElement("qti-interaction-module");y.fallbackPath&&w.setAttribute("fallback-path",y.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(w)}}}}}function _d(o,t,e){Array.from(o.getElementsByTagName("*")).filter(r=>r.localName===t||r.localName?.toLowerCase()===t.toLowerCase()).forEach(r=>{let s=`${t}-${e}`,a=Rd(r,s);r.replaceWith(a)})}function Td(o,t){o.querySelectorAll("*").forEach(e=>{let n=e.classList;n&&n.forEach(i=>{if(i.startsWith(`${t}:`)){let r=i.slice(`${t}:`.length),s=`${e.nodeName}-${r}`,a=Rd(e,s);e.replaceWith(a)}})})}function Rd(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 Od(o,t){let e=["hook","module"],n=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",n+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var vl=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=cm(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=lm(`${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 ho(o){return vl.fromSeedKey(o)}function lm(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 Pd(t)}function cm(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 Pd(t)}function Pd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var dm=o=>typeof o=="function"?o():o.random();function po(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let r=Math.floor(dm(t)*(i+1));[e[i],e[r]]=[e[r],e[i]]}let n=0;return o.map(i=>i.fixed?i:e[n++])}function hm(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 wl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),n=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,r=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of n){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=hm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let v=i?ho(`${t}:${r}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,y=po(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of y)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function Md(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Dd=!1;function uo(o,t){Dd||(Dd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function pm(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 Nd(o,t){let n=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=n.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??n.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(pm(i)));return n}function Fn(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=>Nd(e,n=>`is not well-formed XML: ${n}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Bn(o){return Nd(o,t=>`Failed to parse XML: ${t}`)}function $d(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let n=o,i;!n.namespaceURI||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(n.localName,{customElementRegistry:e}):t.createElement(n.localName):i=t.createElementNS(n.namespaceURI,n.tagName);for(let r=0;r<n.attributes.length;r++){let s=n.attributes[r];i.setAttribute(s.localName,s.value)}for(let r=0;r<n.childNodes.length;r++)i.appendChild($d(n.childNodes[r],t,e));return i}return o.cloneNode(!1)}function Un(o,t){let e=document.createDocumentFragment();for(let n=0;n<o.childNodes.length;n++)e.appendChild($d(o.childNodes[n],document,t));return e}function Hn(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(n=>{for(let i of["src","href","srcset","poster"]){let r=n.getAttribute(i)?.trim();if(r&&!/^(data:|https?:|blob:)/.test(r)){let s=t+encodeURI(r);n.setAttribute(i,s)}}})}var Jt=()=>{let o,t="",e={load(n,i){return t=n,Fn(n,i).then(r=>(o=r,e))},parse(n){return o=Bn(n),t="",e},path:n=>(Hn(o,n),t=null,e),fn(n){return n(o),e},pciHooks(n){return Od(o,n),e},async configurePci(n,i,r="qti-portable-custom-interaction"){return await Id(o,n,i,r),e},shuffleInteractions(n){let i=typeof n=="string"?n.trim():n;if(i==null||i===""){let r=t||"default-item-seed";return uo("qtiTransformItem",r),wl(o,r),e}return wl(o,i),e},extendElementName:(n,i)=>(_d(o,n,i),e),extendElementsWithClass:(n="extend")=>(Td(o,n),e),customInteraction(n,i){let r=o.querySelector("qti-custom-interaction"),s=r.querySelector("object");return r.setAttribute("data-base-ref",n),r.setAttribute("data-base-item",n+i),r.setAttribute("data",s.getAttribute("data")),r.setAttribute("width",s.getAttribute("width")),r.setAttribute("height",s.getAttribute("height")),r.removeChild(s),e},convertCDATAtoComment(){return Ad(o),e},stripStyleSheets(){return Md(o),e},html(){return t!==null&&Hn(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Un(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return t!==null&&Hn(o,t.substring(0,t.lastIndexOf("/"))),Un(o,n)},xmlDoc(){return o}};return e};var Ld=()=>{let o,t={async load(e,n){return o=await Fn(e,n),t},parse(e){o=Bn(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Vd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let n=e.getAttribute("identifier"),i=e.getAttribute("href"),r=e.getAttribute("category");t.push({identifier:n,href:i,category:r})}),t}var mo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),zd=o=>mo(o,"qti-assessment-item-ref","assessmentitemref"),Gi=o=>mo(o,"qti-assessment-section","assessmentsection"),Qi=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="true"||n==="1"}),um=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="false"||n==="0"}),xl=o=>mo(o,"qti-ordering","ordering"),mm=o=>mo(o,"qti-selection","selection"),fm=o=>Array.from(o.children).filter(t=>xl(t)&&Qi(t,"shuffle")),gm=(o,t)=>ho(`${o}:${t}`);function bm(o){let t=[],e=[],n=i=>{for(let r of Array.from(i.children))zd(r)?t.push(r):Gi(r)?n(r):!xl(r)&&!mm(r)&&e.push(r.localName)};return n(o),{itemRefs:t,dropped:e}}function ym(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 jd(o,t){for(let l of Array.from(o.children))Gi(l)&&jd(l,t);let e=fm(o);if(e.length===0)return;let n=[],i=[];for(let l of Array.from(o.children))if(zd(l))n.push({nodes:[l],fixed:Qi(l,"fixed")}),i.push(l);else if(Gi(l)){let{itemRefs:c,dropped:d}=bm(l);if(ym(l,d),um(l,"keep-together","keeptogether"))for(let h of c)n.push({nodes:[h],fixed:Qi(h,"fixed")});else c.length>0&&n.push({nodes:c,fixed:Qi(l,"fixed")});i.push(l)}let r=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=po(n,gm(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,r);for(let l of e)l.remove()}function Fd(o){return Array.from(o.getElementsByTagName("*")).some(t=>xl(t)&&Qi(t,"shuffle"))}function ql(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(n=>Gi(n));for(let n of e){if(!n.parentNode)continue;let i=n.parentElement;i&&Gi(i)||jd(n,t)}}var Wn=()=>{let o,t="",e={async load(n,i){return o=await Fn(n,i),t=n,e.path(n.substring(0,n.lastIndexOf("/"))),e},parse(n){return o=Bn(n),t="",e},path:n=>(Hn(o,n),e),fn(n){return n(o),e},shuffleOrdering(n){if(!Fd(o))return e;let i=typeof n=="string"?n.trim():n;if(i==null||i===""){let r=t||"default-test-seed";return uo("qtiTransformTest",r),ql(o,r),e}return ql(o,i),e},items(){return Vd(o)},html(){return new XMLSerializer().serializeToString(Un(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return Un(o,n)},xmlDoc(){return o}};return e};var Bd=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Cl=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Qn=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Cl(this,t);this.dispatchEvent(e);let n=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&n&&await this.updateStimulusRef(n)}async updateStimulusRef(t){let n=(await Jt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");n&&(t.innerHTML="",t.append(n))}};Bd([p({type:String})],Qn.prototype,"identifier",void 0);Bd([p({type:String})],Qn.prototype,"href",void 0);var fo=class extends C{};var vm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Xi=class extends C{render(){return b`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let r=i;r.mathVariable!==!0||r.value===null||r.value===void 0||t.set(r.identifier,this.#e(r.value))}if(t.size===0)return;let n=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of n){let r=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(r);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",r);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",r),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};vm([_({context:F,subscribe:!0}),T()],Xi.prototype,"context",void 0);var Ud=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Gn=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
84
84
  :host {
85
85
  display: none;
86
86
  }
87
- `]}render(){return b`<slot></slot>`}};Bd([p({type:String})],Gn.prototype,"identifier",void 0);Bd([p({type:String})],Gn.prototype,"cardinality",void 0);var vm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Yi=class extends C{#t;render(){return b`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(r=>r.identifier===i)?.value??"",correct:i=>this._context?.variables.find(r=>r.identifier===i)?.correctResponse??""},n={getVariable:i=>this._context?.variables.find(r=>r.identifier===i),updateOutcomeVariable:(i,r)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:r}}))},updateResponseVariable:(i,r)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:i,response:r}}))}};return this.#t(this._context,e,n)}#e(t){let e=yd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let n=Array.from(this.children).map(i=>{let r=i.calculate;return typeof r=="function"?r.call(i):null});return e(n)}};vm([_({context:F,subscribe:!0}),T()],Yi.prototype,"_context",void 0);var go=class extends mt{static{this.styles=q`
87
+ `]}render(){return b`<slot></slot>`}};Ud([p({type:String})],Gn.prototype,"identifier",void 0);Ud([p({type:String})],Gn.prototype,"cardinality",void 0);var wm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Yi=class extends C{#t;render(){return b`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(r=>r.identifier===i)?.value??"",correct:i=>this._context?.variables.find(r=>r.identifier===i)?.correctResponse??""},n={getVariable:i=>this._context?.variables.find(r=>r.identifier===i),updateOutcomeVariable:(i,r)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:r}}))},updateResponseVariable:(i,r)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:i,response:r}}))}};return this.#t(this._context,e,n)}#e(t){let e=vd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let n=Array.from(this.children).map(i=>{let r=i.calculate;return typeof r=="function"?r.call(i):null});return e(n)}};wm([_({context:F,subscribe:!0}),T()],Yi.prototype,"_context",void 0);var go=class extends mt{static{this.styles=q`
88
88
  :host {
89
89
  display: block;
90
90
  }
@@ -101,11 +101,11 @@ Make sure to test your application with a production build as repeat registratio
101
101
  .off {
102
102
  display: none;
103
103
  }
104
- `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ud=q`
104
+ `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Hd=q`
105
105
  :host {
106
106
  display: block;
107
107
  }
108
- `;var yo=class extends C{static{this.styles=Ud}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Xn=class extends mt{static{this.styles=q`
108
+ `;var yo=class extends C{static{this.styles=Hd}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Xn=class extends mt{static{this.styles=q`
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);
@@ -158,7 +158,7 @@ Make sure to test your application with a production build as repeat registratio
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(),i={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};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#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:i}=Hi(e);return e.forEach(r=>r.remove()),{correctResponse:Object.keys(n).length?n:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Hi(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 i=0;i<n.length;i++)t.push(n[i].textContent.trim()),n[i].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(r=>({mapKey:r.getAttribute("map-key")||"",mappedValue:Number(r.getAttribute("mapped-value"))||0,caseSensitive:r.hasAttribute("case-sensitive")?r.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,n=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),r=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(n)?null:n,upperBound:isNaN(i)?null:i,areaMapEntries:r}}};vo([p({type:String,attribute:"base-type"})],Ie.prototype,"baseType",void 0);vo([p({type:String})],Ie.prototype,"identifier",void 0);vo([p({type:String})],Ie.prototype,"cardinality",void 0);vo([_({context:F,subscribe:!0}),T()],Ie.prototype,"itemContext",void 0);var Hd=`<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(),i={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};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#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:i}=Hi(e);return e.forEach(r=>r.remove()),{correctResponse:Object.keys(n).length?n:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Hi(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 i=0;i<n.length;i++)t.push(n[i].textContent.trim()),n[i].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(r=>({mapKey:r.getAttribute("map-key")||"",mappedValue:Number(r.getAttribute("mapped-value"))||0,caseSensitive:r.hasAttribute("case-sensitive")?r.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,n=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),r=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(n)?null:n,upperBound:isNaN(i)?null:i,areaMapEntries:r}}};vo([p({type:String,attribute:"base-type"})],Ie.prototype,"baseType",void 0);vo([p({type:String})],Ie.prototype,"identifier",void 0);vo([p({type:String})],Ie.prototype,"cardinality",void 0);vo([_({context:F,subscribe:!0}),T()],Ie.prototype,"itemContext",void 0);var Wd=`<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>`,Wd=`<qti-response-condition>
176
+ </qti-response-condition>`,Qd=`<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>`,Qd=`<qti-response-condition>
190
+ </qti-response-condition>`,Gd=`<qti-response-condition>
191
191
  <qti-response-if>
192
192
  <qti-is-null>
193
193
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -201,11 +201,11 @@ 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 wm={map_response:Wd,map_response_point:Qd,match_correct:Hd},wo=class extends C{static{this.styles=[q`
204
+ </qti-response-condition>`;var xm={map_response:Qd,map_response_point:Gd,match_correct:Wd},wo=class extends C{static{this.styles=[q`
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 Nn))throw n}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let n=e.split("/").pop().replace(".xml",""),i=wm[n];i&&(this.innerHTML=i)}};function L(o,t){let e={waitUntilFirstUpdate:!1,...t};return(n,i)=>{let{update:r}=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[i](d,h)}}),r.call(this,a)}}}var Yn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Mt=o=>(...t)=>({_$litDirective$:o,values:t}),_e=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:xm}=nt,Gd=o=>o,Yd=o=>o===null||typeof o!="object"&&typeof o!="function";var Jd=o=>o.strings===void 0,Xd=()=>document.createComment(""),Jn=(o,t,e)=>{let n=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let r=n.insertBefore(Xd(),i),s=n.insertBefore(Xd(),i);e=new xm(r,s,o,o.options)}else{let r=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(r!==i||a){let l=e._$AA;for(;l!==r;){let c=Gd(l).nextSibling;Gd(n).insertBefore(l,i),l=c}}}return e},Te=(o,t,e=o)=>(o._$AI(t,e),o),qm={},Kd=(o,t=qm)=>o._$AH=t,Zd=o=>o._$AH,xo=o=>{o._$AR(),o._$AA.remove()};var Ki=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let n of e)n._$AO?.(t,!1),Ki(n,t);return!0},qo=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},th=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),km(t)}};function Cm(o){this._$AN!==void 0?(qo(this),this._$AM=o,th(this)):this._$AM=o}function Sm(o,t=!1,e=0){let n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(n))for(let r=e;r<n.length;r++)Ki(n[r],!1),qo(n[r]);else n!=null&&(Ki(n,!1),qo(n));else Ki(this,o)}var km=o=>{o.type==Yn.CHILD&&(o._$AP??=Sm,o._$AQ??=Cm)},Re=class extends _e{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),th(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Ki(this,t),qo(this))}setValue(t){if(Jd(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 Cl=class extends Re{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:i}=this;for(let r in e){let s=e[r];s!==n[r]&&(s===!0?i.setAttribute(r,""):s===!1?i.removeAttribute(r):s!=null?i.setAttribute(r,String(s)):i.removeAttribute(r))}}groom(t){let{prevData:e,element:n}=this;if(!e)return;let i=t?this.#t(t):{};for(let r in e)(!i||!(r in i))&&n.removeAttribute(r)}#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)))}},b0=Mt(Cl);var Zi=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},de=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!Ln(this,"cito-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
208
+ `]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let n of e)n.process()}catch(n){if(!(n instanceof Nn))throw n}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let n=e.split("/").pop().replace(".xml",""),i=xm[n];i&&(this.innerHTML=i)}};function L(o,t){let e={waitUntilFirstUpdate:!1,...t};return(n,i)=>{let{update:r}=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[i](d,h)}}),r.call(this,a)}}}var Yn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),_e=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:qm}=nt,Xd=o=>o,Jd=o=>o===null||typeof o!="object"&&typeof o!="function";var Kd=o=>o.strings===void 0,Yd=()=>document.createComment(""),Jn=(o,t,e)=>{let n=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let r=n.insertBefore(Yd(),i),s=n.insertBefore(Yd(),i);e=new qm(r,s,o,o.options)}else{let r=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(r!==i||a){let l=e._$AA;for(;l!==r;){let c=Xd(l).nextSibling;Xd(n).insertBefore(l,i),l=c}}}return e},Te=(o,t,e=o)=>(o._$AI(t,e),o),Cm={},Zd=(o,t=Cm)=>o._$AH=t,th=o=>o._$AH,xo=o=>{o._$AR(),o._$AA.remove()};var Ki=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let n of e)n._$AO?.(t,!1),Ki(n,t);return!0},qo=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},eh=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),Em(t)}};function Sm(o){this._$AN!==void 0?(qo(this),this._$AM=o,eh(this)):this._$AM=o}function km(o,t=!1,e=0){let n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(n))for(let r=e;r<n.length;r++)Ki(n[r],!1),qo(n[r]);else n!=null&&(Ki(n,!1),qo(n));else Ki(this,o)}var Em=o=>{o.type==Yn.CHILD&&(o._$AP??=km,o._$AQ??=Sm)},Re=class extends _e{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),eh(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Ki(this,t),qo(this))}setValue(t){if(Kd(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 Sl=class extends Re{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:i}=this;for(let r in e){let s=e[r];s!==n[r]&&(s===!0?i.setAttribute(r,""):s===!1?i.removeAttribute(r):s!=null?i.setAttribute(r,String(s)):i.removeAttribute(r))}}groom(t){let{prevData:e,element:n}=this;if(!e)return;let i=t?this.#t(t):{};for(let r in e)(!i||!(r in i))&&n.removeAttribute(r)}#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)))}},y0=Dt(Sl);var Zi=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},de=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!Ln(this,"cito-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
209
209
  :host {
210
210
  display: block;
211
211
  }
@@ -217,11 +217,11 @@ Make sure to test your application with a production build as repeat registratio
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 i=[...this.children];for(let r of i)if(r.tagName.toLowerCase()==="qti-template-constraint"){if(r.calculate()===!1){n=!0;break}}else r.process()}catch(i){console.error("Error during template processing:",i);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 eh=[{tag:"qti-assessment-item",ctor:ft},{tag:"qti-assessment-stimulus",ctor:co},{tag:"qti-assessment-stimulus-ref",ctor:Qn},{tag:"qti-companion-materials-info",ctor:fo},{tag:"qti-content-body",ctor:Xi},{tag:"qti-context-declaration",ctor:Gn},{tag:"qti-custom-operator",ctor:Yi},{tag:"qti-feedback-block",ctor:go},{tag:"qti-feedback-inline",ctor:bo},{tag:"qti-item-body",ctor:yo},{tag:"qti-modal-feedback",ctor:Xn},{tag:"qti-outcome-declaration",ctor:ce},{tag:"qti-response-declaration",ctor:Ie},{tag:"qti-response-processing",ctor:wo},{tag:"qti-rubric-block",ctor:de},{tag:"qti-stylesheet",ctor:Co},{tag:"qti-template-constraint",ctor:So},{tag:"qti-template-declaration",ctor:he},{tag:"qti-template-processing",ctor:ko}];var Em=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},er=class extends Xn{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=q`
220
+ `]}#t=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,n=!1;do{if(n=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let r of i)if(r.tagName.toLowerCase()==="qti-template-constraint"){if(r.calculate()===!1){n=!0;break}}else r.process()}catch(i){console.error("Error during template processing:",i);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 nh=[{tag:"qti-assessment-item",ctor:ft},{tag:"qti-assessment-stimulus",ctor:co},{tag:"qti-assessment-stimulus-ref",ctor:Qn},{tag:"qti-companion-materials-info",ctor:fo},{tag:"qti-content-body",ctor:Xi},{tag:"qti-context-declaration",ctor:Gn},{tag:"qti-custom-operator",ctor:Yi},{tag:"qti-feedback-block",ctor:go},{tag:"qti-feedback-inline",ctor:bo},{tag:"qti-item-body",ctor:yo},{tag:"qti-modal-feedback",ctor:Xn},{tag:"qti-outcome-declaration",ctor:ce},{tag:"qti-response-declaration",ctor:Ie},{tag:"qti-response-processing",ctor:wo},{tag:"qti-rubric-block",ctor:de},{tag:"qti-stylesheet",ctor:Co},{tag:"qti-template-constraint",ctor:So},{tag:"qti-template-declaration",ctor:he},{tag:"qti-template-processing",ctor:ko}];var Am=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},er=class extends Xn{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=q`
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``}};Em([p({type:String})],er.prototype,"access",void 0);var Eo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Oe=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Eo([p({type:String})],Oe.prototype,"identifier",void 0);Eo([p({type:String})],Oe.prototype,"class",void 0);Eo([p({type:String,attribute:"navigation-mode"})],Oe.prototype,"navigationMode",void 0);Eo([p({type:String,attribute:"submission-mode"})],Oe.prototype,"submissionMode",void 0);var Am=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},nr=class extends E{#t=null;constructor(){super(),H(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"),i=jn(t,zn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Sl(this._testContext,n,i).calculate()}calculate(){return this.getResult()}};Am([_({context:rt,subscribe:!0})],nr.prototype,"_testContext",void 0);var Sl=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(i=>i.item))];return t.forEach(i=>{if(n.includes(i.identifier)){let r=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(r){let a=Number(r.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var ir="qti-assessment-section",Ao="qti-test-part",Dt=o=>o.identifier||o.getAttribute("identifier")||"";function nh(o,t){let e=o[t],n=t+1,i=Im(e,o,t);if(i){let s=_m(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Dt)};s>t?n=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Dt(e)}", ignored`)}let r=o.slice(t+1,n).map(Dt);for(let s=n;s<o.length;s++){if(rh(o[s],e))return{id:Dt(o[s]),skipped:r};r.push(Dt(o[s]))}return{id:null,skipped:r}}function ih(o){let t=[];for(let e of o){if(rh(e,null))return{id:Dt(e),skipped:t};t.push(Dt(e))}return{id:null,skipped:t}}function Im(o,t,e){let n=[o];for(let i=o.parentElement;i&&(i.localName===ir||i.localName===Ao)&&!i.contains(t[e+1]??null);i=i.parentElement)n.push(i);for(let i of n)for(let r of i.querySelectorAll(":scope > qti-branch-rule"))if(r.evaluate?.())return r;return null}function _m(o,t,e){let n=o.parentElement,i=r=>{if(!r)return null;let s=t.findLastIndex(a=>r.contains(a));return s+1<t.length?s+1:null};switch(o.target){case le.EXIT_TEST:return null;case le.EXIT_TESTPART:return i(n.closest(Ao));case le.EXIT_SECTION:{let r=n.localName===ir?n:n.closest(ir);return i(r??n)}default:{let r=t.findIndex(l=>Dt(l)===o.target);if(r>=0)return r;let s=[...n.closest("qti-assessment-test")?.querySelectorAll(`${ir}, ${Ao}`)??[]].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 rh(o,t){let e=[o];for(let n=o.parentElement;n&&(n.localName===ir||n.localName===Ao);n=n.parentElement)(!t||!n.contains(t))&&e.push(n);return e.every(n=>[...n.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var Io=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},oh=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,i){let r=i||this._getDefaultNavigationId(n);r&&V(this,"cito-test-navigate",{type:n,id:r})}_bindEventHandlers(){H(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),H(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 i=n.detail;this._loadingState.connectedItems++;let r=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=r.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(n){n.preventDefault();let{element:i,item:r}=n;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:r.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,r),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.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 i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let r=ih(i);if(r.skipped.length&&V(this,"cito-test-items-skipped",{ids:r.skipped}),r.id===null){V(this,"cito-test-end-reached",{});return}n=r.id}}n&&this.navigateTo(this.navigate,n)}_isLinearNavigationRestricted(n,i){let r=this.sessionContext?.navItemRefId;if(!r||n==="item"&&i===r)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===r);if(n==="item"){let f=d.findIndex(m=>m.identifier===i);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(n,i){if(n!=="item"||!this._testElement)return;let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=r.findIndex(l=>Dt(l)===this.sessionContext?.navItemRefId);if(s<0||!r[s+1]||Dt(r[s+1])!==i||r[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=nh(r,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:n}){if(!n?.id)return;let i=this._resolveLinearNext(n.type,n.id);if(i?.id===null){i.skipped.length&&V(this,"cito-test-items-skipped",{ids:i.skipped}),V(this,"cito-test-end-reached",{});return}let r=i?.id??n.id;if(!i&&this._isLinearNavigationRestricted(n.type,r)){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,r),this._activeController=a,await this._executeNavigation(n.type,r,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&V(this,"cito-test-items-skipped",{ids:i.skipped})}catch(l){this._handleNavigationError(l,n.type,r)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(n.type,r)}}_handleNavigationError(n,i,r){n.name!=="AbortError"&&this._dispatchError(this._createNavigationError(n,i,r))}async _executeNavigation(n,i,r,s){n==="item"?await this._navigateToItem(i,r,s):await this._navigateToSection(i,r,s)}async _navigateToItem(n,i,r){let s=this._findItemRef(n);this._updateSessionContext(s,n),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([n],i,r),await this._waitForLoadingComplete(i,r),!this._isStaleNavigation(i,r)&&this._dispatchTestLoaded(this._loadResults,"item",n)}async _navigateToSection(n,i,r){let a=this._findSection(n)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:n,navItemRefId:null};let l=this._getSectionItemIds(n);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,r),await this._waitForLoadingComplete(i,r),!this._isStaleNavigation(i,r)&&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,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;n&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(n,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(n,i))return;await new Promise(r=>setTimeout(r,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(n,i){console.info("Loading stimulus:",n.href);let r=await this._loadStimulus(n.href);console.info("Stimulus loaded, applying content:",r?"has content":"no content"),this._applyStimulusContent(r,n,i)}_applyStimulusContent(n,i,r){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=r.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.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,i,r){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,i,r)))).filter(Boolean);this._isStaleNavigation(i,r)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(n,i,r){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Yt().load(n.href,r.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,n)),this._isStaleNavigation(i,r)?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 Yt().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 i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!i)throw new Error(`Item with identifier "${n}" not found`);return i}_findSection(n){return this._testElement?.querySelector(`qti-assessment-section[identifier="${n}"]`)||null}_updateSessionContext(n,i){let r=n.closest("qti-test-part")?.identifier,s=n.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:r,navSectionId:s,navItemRefId:i}}_getSectionItemIds(n){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${n}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let n=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(n||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(n=>n.innerHTML="")}_isStaleNavigation(n,i){return i.signal.aborted||n!==this._navigationId}_createNavigationError(n,i,r){return{message:n.message||`Failed to load ${i}: ${r}`,details:n,itemId:i==="item"?r:void 0,sectionId:i==="section"?r:void 0}}_dispatchLoadingStarted(n,i){V(this,"cito-test-navigation-started",{type:n,id:i})}_dispatchLoadingEnded(n,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:n,id:i},bubbles:!0,composed:!0}))}_dispatchError(n){V(this,"cito-test-navigation-failed",n)}_dispatchTestLoaded(n,i,r){requestAnimationFrame(()=>{V(this,"cito-test-rendered",n.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),V(this,"cito-test-navigated",{type:i,id:r})})}}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 sh=o=>{class t extends o{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},H(this,"cito-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),H(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.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 r=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;r&&this.updateAssessmentItemView(r,this.sessionContext.view)}}_setCorrectResponseVisibility(n){this.updateAssessmentItemView(n,this.sessionContext.view)}updateAssessmentItemView(n,i){}}return t};var ah=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},kl=o=>{class t extends o{constructor(...n){super(...n),this.testContext=rl,this.sessionContext=il,this._updateItemInTestContext=i=>{let r=i.itemContext,s=r.identifier,a=r.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,r.valid);else{let c=[...i.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)}i.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(i.state=l.state)}},this._initializeEventListeners()}updateItemVariables(n,i,r){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 i){let f=l.findIndex(v=>v.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...r?{state:{...r}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(n)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===n)?.variables??[]],r&&(s.state=r))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=rl,this.sessionContext=il}),H(this,"cito-test-loaded",n=>{this._testElement=n.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(r=>({href:r.href,identifier:r.identifier,category:r.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",n=>{let i=n.detail,r=i.closest("qti-assessment-item-ref")?.identifier;r&&(i.assessmentItemRefId=r),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,i,r,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:i.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...r!==void 0?{state:r?{...r}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(n,i){typeof i!="string"||i==="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:i}:l)})})}}return ah([p({attribute:!1,type:Object}),U({context:rt})],t.prototype,"testContext",void 0),ah([p({attribute:!1,type:Object}),U({context:Se})],t.prototype,"sessionContext",void 0),t},lh=class extends kl(C){};var _o=1;var El=o=>Array.isArray(o)?[...o]:o??null,Tm=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},Rm=(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:El(n.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:El(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}:{}}}),ch=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}),H(this,"cito-test-update-plugin-state",({detail:i})=>this.#i(i)),H(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}#i({plugin:n,value:i}){if(typeof n!="string"||n==="")return;let{[n]:r,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[n]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${n}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Rm(this.testContext,this.sessionContext)}set state(n){if(!Tm(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:i,navSectionId:r}=this.sessionContext;this.#r(n);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==r&&this.#s("section",s.navSectionId)}updated(n){if(super.updated(n),!this.#e||!(n.has("testContext")||n.has("sessionContext")))return;let i=this.state,r=JSON.stringify(i);r!==this.#n&&(this.#n=r,V(this,"cito-test-state-changed",i))}#r(n){for(let r of n.test.items)this.updateItemVariables(r.identifier,r.variables,r.state);let i=new Map(n.test.outcomes.map(r=>[r.identifier,r.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>i.has(r.identifier)?{...r,value:El(i.get(r.identifier))}:r)},this.sessionContext={...this.sessionContext,...this.#o(n.session),plugins:n.session.plugins&&typeof n.session.plugins=="object"?{...n.session.plugins}:{}}}#o(n){let i=(r,s)=>!!s&&!!this._testElement?.querySelector(`${r}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",n.navPartId)?{navPartId:n.navPartId}:{},...i("qti-assessment-section",n.navSectionId)?{navSectionId:n.navSectionId}:{},...this.testContext.items.some(r=>r.identifier===n.navItemRefId)?{navItemRefId:n.navItemRefId}:{}}}#s(n,i){V(this,"cito-test-navigate",{type:n,id:i})}}return t};var dh=o=>{class t extends o{constructor(...n){super(...n),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:r,value:s}=i.detail;this.updateOutcomeVariable(r,s),i.stopPropagation()})}outcomeProcessing(){let n=(this._testElement??this).querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}getTestFeedback(n){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(r=>(!n||r.access===n)&&r.matches(this.getOutcome(r.outcomeIdentifier)?.value))}updateOutcomeVariable(n,i){let r=this.getOutcome(n);if(!r){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:r.cardinality==="single"?i:[...s.value,i]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===n)||null}}return t};var hh=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Pe=class extends oh(sh(dh(ch(kl(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new xe(this,{context:ke,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};hh([T(),U({context:xt})],Pe.prototype,"configContext",void 0);hh([T(),U({context:qt})],Pe.prototype,"qtiContext",void 0);var To=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Ro=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 ph=o=>!Yd(o)&&typeof o.then=="function",uh=1073741823,Al=class extends Re{constructor(){super(...arguments),this._$Cwt=uh,this._$Cbt=[],this._$CK=new To(this),this._$CX=new Ro}render(...t){return t.find(e=>!ph(e))??it}update(t,e){let n=this._$Cbt,i=n.length;this._$Cbt=e;let r=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!ph(l))return this._$Cwt=a,l;a<i&&l===n[a]||(this._$Cwt=uh,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=r.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Oo=Mt(Al);var Po=`
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``}};Am([p({type:String})],er.prototype,"access",void 0);var Eo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Oe=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Eo([p({type:String})],Oe.prototype,"identifier",void 0);Eo([p({type:String})],Oe.prototype,"class",void 0);Eo([p({type:String,attribute:"navigation-mode"})],Oe.prototype,"navigationMode",void 0);Eo([p({type:String,attribute:"submission-mode"})],Oe.prototype,"submissionMode",void 0);var Im=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},nr=class extends E{#t=null;constructor(){super(),H(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"),i=jn(t,zn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new kl(this._testContext,n,i).calculate()}calculate(){return this.getResult()}};Im([_({context:rt,subscribe:!0})],nr.prototype,"_testContext",void 0);var kl=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(i=>i.item))];return t.forEach(i=>{if(n.includes(i.identifier)){let r=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(r){let a=Number(r.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var ir="qti-assessment-section",Ao="qti-test-part",Nt=o=>o.identifier||o.getAttribute("identifier")||"";function ih(o,t){let e=o[t],n=t+1,i=_m(e,o,t);if(i){let s=Tm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Nt)};s>t?n=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Nt(e)}", ignored`)}let r=o.slice(t+1,n).map(Nt);for(let s=n;s<o.length;s++){if(oh(o[s],e))return{id:Nt(o[s]),skipped:r};r.push(Nt(o[s]))}return{id:null,skipped:r}}function rh(o){let t=[];for(let e of o){if(oh(e,null))return{id:Nt(e),skipped:t};t.push(Nt(e))}return{id:null,skipped:t}}function _m(o,t,e){let n=[o];for(let i=o.parentElement;i&&(i.localName===ir||i.localName===Ao)&&!i.contains(t[e+1]??null);i=i.parentElement)n.push(i);for(let i of n)for(let r of i.querySelectorAll(":scope > qti-branch-rule"))if(r.evaluate?.())return r;return null}function Tm(o,t,e){let n=o.parentElement,i=r=>{if(!r)return null;let s=t.findLastIndex(a=>r.contains(a));return s+1<t.length?s+1:null};switch(o.target){case le.EXIT_TEST:return null;case le.EXIT_TESTPART:return i(n.closest(Ao));case le.EXIT_SECTION:{let r=n.localName===ir?n:n.closest(ir);return i(r??n)}default:{let r=t.findIndex(l=>Nt(l)===o.target);if(r>=0)return r;let s=[...n.closest("qti-assessment-test")?.querySelectorAll(`${ir}, ${Ao}`)??[]].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 oh(o,t){let e=[o];for(let n=o.parentElement;n&&(n.localName===ir||n.localName===Ao);n=n.parentElement)(!t||!n.contains(t))&&e.push(n);return e.every(n=>[...n.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var Io=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},sh=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,i){let r=i||this._getDefaultNavigationId(n);r&&V(this,"cito-test-navigate",{type:n,id:r})}_bindEventHandlers(){H(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),H(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 i=n.detail;this._loadingState.connectedItems++;let r=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=r.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(n){n.preventDefault();let{element:i,item:r}=n;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:r.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,r),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.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 i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let r=rh(i);if(r.skipped.length&&V(this,"cito-test-items-skipped",{ids:r.skipped}),r.id===null){V(this,"cito-test-end-reached",{});return}n=r.id}}n&&this.navigateTo(this.navigate,n)}_isLinearNavigationRestricted(n,i){let r=this.sessionContext?.navItemRefId;if(!r||n==="item"&&i===r)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===r);if(n==="item"){let f=d.findIndex(m=>m.identifier===i);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(n,i){if(n!=="item"||!this._testElement)return;let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=r.findIndex(l=>Nt(l)===this.sessionContext?.navItemRefId);if(s<0||!r[s+1]||Nt(r[s+1])!==i||r[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=ih(r,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:n}){if(!n?.id)return;let i=this._resolveLinearNext(n.type,n.id);if(i?.id===null){i.skipped.length&&V(this,"cito-test-items-skipped",{ids:i.skipped}),V(this,"cito-test-end-reached",{});return}let r=i?.id??n.id;if(!i&&this._isLinearNavigationRestricted(n.type,r)){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,r),this._activeController=a,await this._executeNavigation(n.type,r,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&V(this,"cito-test-items-skipped",{ids:i.skipped})}catch(l){this._handleNavigationError(l,n.type,r)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(n.type,r)}}_handleNavigationError(n,i,r){n.name!=="AbortError"&&this._dispatchError(this._createNavigationError(n,i,r))}async _executeNavigation(n,i,r,s){n==="item"?await this._navigateToItem(i,r,s):await this._navigateToSection(i,r,s)}async _navigateToItem(n,i,r){let s=this._findItemRef(n);this._updateSessionContext(s,n),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([n],i,r),await this._waitForLoadingComplete(i,r),!this._isStaleNavigation(i,r)&&this._dispatchTestLoaded(this._loadResults,"item",n)}async _navigateToSection(n,i,r){let a=this._findSection(n)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:n,navItemRefId:null};let l=this._getSectionItemIds(n);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,r),await this._waitForLoadingComplete(i,r),!this._isStaleNavigation(i,r)&&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,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;n&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(n,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(n,i))return;await new Promise(r=>setTimeout(r,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(n,i){console.info("Loading stimulus:",n.href);let r=await this._loadStimulus(n.href);console.info("Stimulus loaded, applying content:",r?"has content":"no content"),this._applyStimulusContent(r,n,i)}_applyStimulusContent(n,i,r){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=r.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.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,i,r){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,i,r)))).filter(Boolean);this._isStaleNavigation(i,r)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(n,i,r){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(n.href,r.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,n)),this._isStaleNavigation(i,r)?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 Jt().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 i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!i)throw new Error(`Item with identifier "${n}" not found`);return i}_findSection(n){return this._testElement?.querySelector(`qti-assessment-section[identifier="${n}"]`)||null}_updateSessionContext(n,i){let r=n.closest("qti-test-part")?.identifier,s=n.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:r,navSectionId:s,navItemRefId:i}}_getSectionItemIds(n){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${n}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let n=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(n||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(n=>n.innerHTML="")}_isStaleNavigation(n,i){return i.signal.aborted||n!==this._navigationId}_createNavigationError(n,i,r){return{message:n.message||`Failed to load ${i}: ${r}`,details:n,itemId:i==="item"?r:void 0,sectionId:i==="section"?r:void 0}}_dispatchLoadingStarted(n,i){V(this,"cito-test-navigation-started",{type:n,id:i})}_dispatchLoadingEnded(n,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:n,id:i},bubbles:!0,composed:!0}))}_dispatchError(n){V(this,"cito-test-navigation-failed",n)}_dispatchTestLoaded(n,i,r){requestAnimationFrame(()=>{V(this,"cito-test-rendered",n.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),V(this,"cito-test-navigated",{type:i,id:r})})}}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 ah=o=>{class t extends o{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},H(this,"cito-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),H(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.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 r=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;r&&this.updateAssessmentItemView(r,this.sessionContext.view)}}_setCorrectResponseVisibility(n){this.updateAssessmentItemView(n,this.sessionContext.view)}updateAssessmentItemView(n,i){}}return t};var lh=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},El=o=>{class t extends o{constructor(...n){super(...n),this.testContext=ol,this.sessionContext=rl,this._updateItemInTestContext=i=>{let r=i.itemContext,s=r.identifier,a=r.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,r.valid);else{let c=[...i.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)}i.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(i.state=l.state)}},this._initializeEventListeners()}updateItemVariables(n,i,r){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 i){let f=l.findIndex(v=>v.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...r?{state:{...r}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(n)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===n)?.variables??[]],r&&(s.state=r))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=ol,this.sessionContext=rl}),H(this,"cito-test-loaded",n=>{this._testElement=n.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(r=>({href:r.href,identifier:r.identifier,category:r.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",n=>{let i=n.detail,r=i.closest("qti-assessment-item-ref")?.identifier;r&&(i.assessmentItemRefId=r),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,i,r,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:i.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...r!==void 0?{state:r?{...r}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(n,i){typeof i!="string"||i==="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:i}:l)})})}}return lh([p({attribute:!1,type:Object}),U({context:rt})],t.prototype,"testContext",void 0),lh([p({attribute:!1,type:Object}),U({context:Se})],t.prototype,"sessionContext",void 0),t},ch=class extends El(C){};var _o=1;var Al=o=>Array.isArray(o)?[...o]:o??null,Rm=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},Om=(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:Al(n.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Al(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}:{}}}),dh=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}),H(this,"cito-test-update-plugin-state",({detail:i})=>this.#i(i)),H(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}#i({plugin:n,value:i}){if(typeof n!="string"||n==="")return;let{[n]:r,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[n]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${n}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Om(this.testContext,this.sessionContext)}set state(n){if(!Rm(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:i,navSectionId:r}=this.sessionContext;this.#r(n);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==r&&this.#s("section",s.navSectionId)}updated(n){if(super.updated(n),!this.#e||!(n.has("testContext")||n.has("sessionContext")))return;let i=this.state,r=JSON.stringify(i);r!==this.#n&&(this.#n=r,V(this,"cito-test-state-changed",i))}#r(n){for(let r of n.test.items)this.updateItemVariables(r.identifier,r.variables,r.state);let i=new Map(n.test.outcomes.map(r=>[r.identifier,r.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>i.has(r.identifier)?{...r,value:Al(i.get(r.identifier))}:r)},this.sessionContext={...this.sessionContext,...this.#o(n.session),plugins:n.session.plugins&&typeof n.session.plugins=="object"?{...n.session.plugins}:{}}}#o(n){let i=(r,s)=>!!s&&!!this._testElement?.querySelector(`${r}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",n.navPartId)?{navPartId:n.navPartId}:{},...i("qti-assessment-section",n.navSectionId)?{navSectionId:n.navSectionId}:{},...this.testContext.items.some(r=>r.identifier===n.navItemRefId)?{navItemRefId:n.navItemRefId}:{}}}#s(n,i){V(this,"cito-test-navigate",{type:n,id:i})}}return t};var hh=o=>{class t extends o{constructor(...n){super(...n),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:r,value:s}=i.detail;this.updateOutcomeVariable(r,s),i.stopPropagation()})}outcomeProcessing(){let n=(this._testElement??this).querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}getTestFeedback(n){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(r=>(!n||r.access===n)&&r.matches(this.getOutcome(r.outcomeIdentifier)?.value))}updateOutcomeVariable(n,i){let r=this.getOutcome(n);if(!r){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:r.cardinality==="single"?i:[...s.value,i]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===n)||null}}return t};var ph=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Pe=class extends sh(ah(hh(dh(El(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new xe(this,{context:ke,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};ph([T(),U({context:xt})],Pe.prototype,"configContext",void 0);ph([T(),U({context:qt})],Pe.prototype,"qtiContext",void 0);var To=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Ro=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 uh=o=>!Jd(o)&&typeof o.then=="function",mh=1073741823,Il=class extends Re{constructor(){super(...arguments),this._$Cwt=mh,this._$Cbt=[],this._$CK=new To(this),this._$CX=new Ro}render(...t){return t.find(e=>!uh(e))??it}update(t,e){let n=this._$Cbt,i=n.length;this._$Cbt=e;let r=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!uh(l))return this._$Cwt=a,l;a<i&&l===n[a]||(this._$Cwt=mh,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=r.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Oo=Dt(Il);var Po=`
225
225
  @layer qti-base, qti-components, qti-extended;
226
226
 
227
227
  @layer qti-components.reset, qti-components.global, qti-components.interactions.base,
@@ -6310,7 +6310,7 @@ div.full-correct-response-inline {
6310
6310
  ${this.#t}
6311
6311
  <slot></slot>
6312
6312
  ${Oo(this.testDoc,b`<span>Loading...</span>`)}
6313
- `}};Me([p({attribute:!1})],kt.prototype,"customElementRegistry",void 0);Me([p({type:String,attribute:"test-url"})],kt.prototype,"testURL",void 0);Me([T()],kt.prototype,"testDoc",void 0);Me([T()],kt.prototype,"testXML",void 0);Me([_({context:ke,subscribe:!0})],kt.prototype,"testHost",void 0);Me([T(),_({context:qt,subscribe:!0})],kt.prototype,"qtiContext",void 0);Me([L("testURL",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestURLChange",null);Me([L("testXML",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestXMLChange",null);var mh=q`
6313
+ `}};Me([p({attribute:!1})],kt.prototype,"customElementRegistry",void 0);Me([p({type:String,attribute:"test-url"})],kt.prototype,"testURL",void 0);Me([T()],kt.prototype,"testDoc",void 0);Me([T()],kt.prototype,"testXML",void 0);Me([_({context:ke,subscribe:!0})],kt.prototype,"testHost",void 0);Me([T(),_({context:qt,subscribe:!0})],kt.prototype,"qtiContext",void 0);Me([L("testURL",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestURLChange",null);Me([L("testXML",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestXMLChange",null);var fh=q`
6314
6314
  display: inline-flex;
6315
6315
  align-items: center;
6316
6316
  justify-content: center;
@@ -6324,7 +6324,7 @@ div.full-correct-response-inline {
6324
6324
  user-select: none;
6325
6325
  border-radius: var(--test-button-border-radius, var(--qti-component-border-radius, 0.2rem));
6326
6326
  `,ot=q`
6327
- ${mh};
6327
+ ${fh};
6328
6328
  background-color: var(--test-button-background-color, var(--qti-component-background-color, #fff));
6329
6329
  color: var(--test-button-color, var(--qti-component-color, inherit));
6330
6330
  border: var(--qti-component-border-width, 1px) var(--qti-component-border-style, solid)
@@ -6337,10 +6337,10 @@ div.full-correct-response-inline {
6337
6337
  `,lt=q`
6338
6338
  cursor: not-allowed;
6339
6339
  opacity: 0.45;
6340
- `,wS=q`
6341
- ${mh};
6340
+ `,xS=q`
6341
+ ${fh};
6342
6342
  border: 1px solid gray;
6343
- `;var Il=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ln=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6343
+ `;var _l=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ln=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6344
6344
  :host {
6345
6345
  ${ot};
6346
6346
  }
@@ -6353,7 +6353,7 @@ div.full-correct-response-inline {
6353
6353
  :host([disabled]) {
6354
6354
  ${lt};
6355
6355
  }
6356
- `}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||V(this,"cito-test-end-attempt",{})})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),n=e.findIndex(a=>a.active),i=e[n];if(!i){this._internalDisabled=!1;return}let r=i.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&r>0&&s>=r){this._internalDisabled=!0;return}i.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};Il([_({context:j,subscribe:!0}),p({attribute:!1})],ln.prototype,"computedContext",void 0);Il([p({type:Boolean,reflect:!0,attribute:"disabled"})],ln.prototype,"_internalDisabled",void 0);Il([L("computedContext")],ln.prototype,"_handleTestElementChange",null);var Om=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},rr=class extends C{static{this.styles=q`
6356
+ `}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||V(this,"cito-test-end-attempt",{})})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),n=e.findIndex(a=>a.active),i=e[n];if(!i){this._internalDisabled=!1;return}let r=i.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&r>0&&s>=r){this._internalDisabled=!0;return}i.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};_l([_({context:j,subscribe:!0}),p({attribute:!1})],ln.prototype,"computedContext",void 0);_l([p({type:Boolean,reflect:!0,attribute:"disabled"})],ln.prototype,"_internalDisabled",void 0);_l([L("computedContext")],ln.prototype,"_handleTestElementChange",null);var Pm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},rr=class extends C{static{this.styles=q`
6357
6357
  :host {
6358
6358
  ${ot};
6359
6359
  }
@@ -6366,7 +6366,7 @@ div.full-correct-response-inline {
6366
6366
  :host([disabled]) {
6367
6367
  ${lt};
6368
6368
  }
6369
- `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b` <slot></slot> `}};Om([p({type:String,attribute:"item-id"})],rr.prototype,"itemId",void 0);var cn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Pm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),gt=class extends C{get qtiContext(){return this.#r()?.qtiContext??(this.#t??=Pm())}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 wt(this,{context:ke,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,H(this,"cito-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#b.bind(this)),qd(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),H(this,"cito-test-end-attempt",this.#l.bind(this)),H(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.#y(e);this.#s.set(e.identifier,n);let i=this.computedItemFor(e.identifier),r=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#f(r,n,i?.maxAttempts,i?.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(i=>i.identifier==="SCORE");if(n&&n.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return b`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#n({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let r=this.#h(i);Object.keys(r).length>0&&this.#n({QTI_CONTEXT:{...r,...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(i=>{let r=[...i.querySelectorAll("qti-assessment-section")],s=i.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:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:a,sections:r.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),v=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:v,items:f.map(y=>{let w=y.querySelector(":scope > qti-item-session-control"),I=w?w.allowSkipping:v,A=w?w.maxAttempts:x,k=w?w.showFeedback:u,S=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===y.identifier),active:!1,identifier:y.identifier,categories:y.category?y.category?.split(" "):[],href:y.href,variables:[],allowSkipping:I,maxAttempts:A,showFeedback:k,showSolution:S}})}})}})}}#h(t){let e={},n=t.querySelector("qti-default-value");return n&&n.querySelectorAll("qti-value[field-identifier]").forEach(r=>{let s=r.getAttribute("field-identifier"),a=r.getAttribute("base-type")||"string",l=r.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#b(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(n=>({...n,sections:n.sections.map(i=>({...i,items:i.items.map(r=>{if(r.identifier!==e.parentElement.getAttribute("identifier"))return r;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let v=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return v?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...r,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(n=>({...n,active:this._sessionContext?.navPartId===n.identifier||!1,sections:n.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:i.items.every(r=>this._testContext.items.find(s=>s.identifier===r.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:i.items.map(r=>{let s=this._testContext?.items.find(k=>k.identifier===r.identifier),a={...r,...s,...this.initContext?.find(k=>k.identifier===r.identifier)},l=a.variables?.find(k=>k.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,v=s?.valid??!0,u=(s?.variables?.filter(k=>k.type==="response")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let S;switch(k.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=k.defaultValue??S;if(Array.isArray(k.value)){let N=Array.isArray(R)?R:[R];return k.value.length===N.length&&k.value.every((z,$)=>z===N[$])}return k.value===R}),g=r.categories.includes(this.configContext?.infoItemCategory)?null:e++,y=r.variables?.find(k=>k.identifier=="MAXSCORE")?.value,w=y==null?null:parseFloat(y?.toString()),I=this.#s.get(a.identifier);I===void 0&&(I=s?this.#y(s):"unscored",f>0&&this.#s.set(a.identifier,I));let A=this.#f(f,I,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:v,isDefaultResponse:u,maxScore:w,done: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,i,r){if(t===0)return!1;if(i)return r==="completed";if(e!=="suboptimal")return!0;let s=n??1;return s>0&&t>=s}#y(t){let e=t.variables??[],n=this.#g(e,"SCORE"),i=this.#g(e,"MAXSCORE");if(n!==null&&i!==null)return n>=i?"optimal":"suboptimal";let r=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return r.length===0?"unscored":r.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#g(t,e){let n=t?.find(r=>r.identifier===e)?.value;if(n==null||Array.isArray(n))return null;let i=parseFloat(n.toString());return Number.isNaN(i)?null:i}};cn([p({type:String})],gt.prototype,"identifier",void 0);cn([T()],gt.prototype,"initContext",void 0);cn([T(),_({context:xt,subscribe:!0})],gt.prototype,"configContext",void 0);cn([T(),_({context:rt,subscribe:!0})],gt.prototype,"_testContext",void 0);cn([T(),_({context:Se,subscribe:!0})],gt.prototype,"_sessionContext",void 0);cn([T(),U({context:j})],gt.prototype,"computedContext",void 0);cn([p({type:Boolean,attribute:"auto-score-items"})],gt.prototype,"autoScoreItems",void 0);var _l=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},dn=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6369
+ `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b` <slot></slot> `}};Pm([p({type:String,attribute:"item-id"})],rr.prototype,"itemId",void 0);var cn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Mm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),gt=class extends C{get qtiContext(){return this.#r()?.qtiContext??(this.#t??=Mm())}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 wt(this,{context:ke,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,H(this,"cito-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#b.bind(this)),Cd(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),H(this,"cito-test-end-attempt",this.#l.bind(this)),H(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.#y(e);this.#s.set(e.identifier,n);let i=this.computedItemFor(e.identifier),r=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#f(r,n,i?.maxAttempts,i?.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(i=>i.identifier==="SCORE");if(n&&n.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return b`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#n({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let r=this.#h(i);Object.keys(r).length>0&&this.#n({QTI_CONTEXT:{...r,...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(i=>{let r=[...i.querySelectorAll("qti-assessment-section")],s=i.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:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:a,sections:r.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),v=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:v,items:f.map(y=>{let w=y.querySelector(":scope > qti-item-session-control"),I=w?w.allowSkipping:v,A=w?w.maxAttempts:x,k=w?w.showFeedback:u,S=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===y.identifier),active:!1,identifier:y.identifier,categories:y.category?y.category?.split(" "):[],href:y.href,variables:[],allowSkipping:I,maxAttempts:A,showFeedback:k,showSolution:S}})}})}})}}#h(t){let e={},n=t.querySelector("qti-default-value");return n&&n.querySelectorAll("qti-value[field-identifier]").forEach(r=>{let s=r.getAttribute("field-identifier"),a=r.getAttribute("base-type")||"string",l=r.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#b(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(n=>({...n,sections:n.sections.map(i=>({...i,items:i.items.map(r=>{if(r.identifier!==e.parentElement.getAttribute("identifier"))return r;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let v=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return v?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...r,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(n=>({...n,active:this._sessionContext?.navPartId===n.identifier||!1,sections:n.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:i.items.every(r=>this._testContext.items.find(s=>s.identifier===r.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:i.items.map(r=>{let s=this._testContext?.items.find(k=>k.identifier===r.identifier),a={...r,...s,...this.initContext?.find(k=>k.identifier===r.identifier)},l=a.variables?.find(k=>k.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,v=s?.valid??!0,u=(s?.variables?.filter(k=>k.type==="response")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let S;switch(k.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=k.defaultValue??S;if(Array.isArray(k.value)){let N=Array.isArray(R)?R:[R];return k.value.length===N.length&&k.value.every((z,$)=>z===N[$])}return k.value===R}),g=r.categories.includes(this.configContext?.infoItemCategory)?null:e++,y=r.variables?.find(k=>k.identifier=="MAXSCORE")?.value,w=y==null?null:parseFloat(y?.toString()),I=this.#s.get(a.identifier);I===void 0&&(I=s?this.#y(s):"unscored",f>0&&this.#s.set(a.identifier,I));let A=this.#f(f,I,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:v,isDefaultResponse:u,maxScore:w,done: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,i,r){if(t===0)return!1;if(i)return r==="completed";if(e!=="suboptimal")return!0;let s=n??1;return s>0&&t>=s}#y(t){let e=t.variables??[],n=this.#g(e,"SCORE"),i=this.#g(e,"MAXSCORE");if(n!==null&&i!==null)return n>=i?"optimal":"suboptimal";let r=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return r.length===0?"unscored":r.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#g(t,e){let n=t?.find(r=>r.identifier===e)?.value;if(n==null||Array.isArray(n))return null;let i=parseFloat(n.toString());return Number.isNaN(i)?null:i}};cn([p({type:String})],gt.prototype,"identifier",void 0);cn([T()],gt.prototype,"initContext",void 0);cn([T(),_({context:xt,subscribe:!0})],gt.prototype,"configContext",void 0);cn([T(),_({context:rt,subscribe:!0})],gt.prototype,"_testContext",void 0);cn([T(),_({context:Se,subscribe:!0})],gt.prototype,"_sessionContext",void 0);cn([T(),U({context:j})],gt.prototype,"computedContext",void 0);cn([p({type:Boolean,attribute:"auto-score-items"})],gt.prototype,"autoScoreItems",void 0);var Tl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},dn=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6370
6370
  :host {
6371
6371
  ${ot};
6372
6372
  }
@@ -6379,7 +6379,7 @@ div.full-correct-response-inline {
6379
6379
  :host([disabled]) {
6380
6380
  ${lt};
6381
6381
  }
6382
- `}#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,i=e?.submissionMode||t.submissionMode,r=this.sectionItems[this.itemIndex],s=n==="linear"&&i==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!r?.done}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};_l([p({type:Boolean,reflect:!0,attribute:"disabled"})],dn.prototype,"_internalDisabled",void 0);_l([_({context:j,subscribe:!0})],dn.prototype,"computedContext",void 0);_l([L("computedContext")],dn.prototype,"_handleTestElementChange",null);var Tl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hn=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6382
+ `}#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,i=e?.submissionMode||t.submissionMode,r=this.sectionItems[this.itemIndex],s=n==="linear"&&i==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!r?.done}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};Tl([p({type:Boolean,reflect:!0,attribute:"disabled"})],dn.prototype,"_internalDisabled",void 0);Tl([_({context:j,subscribe:!0})],dn.prototype,"computedContext",void 0);Tl([L("computedContext")],dn.prototype,"_handleTestElementChange",null);var Rl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hn=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
6383
6383
  :host {
6384
6384
  ${ot};
6385
6385
  }
@@ -6392,7 +6392,7 @@ div.full-correct-response-inline {
6392
6392
  :host([disabled]) {
6393
6393
  ${lt};
6394
6394
  }
6395
- `}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(i=>i.active),n=t?.sections.find(i=>i.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=n==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};Tl([p({type:Boolean,reflect:!0,attribute:"disabled"})],hn.prototype,"_internalDisabled",void 0);Tl([_({context:j,subscribe:!0})],hn.prototype,"computedContext",void 0);Tl([L("computedContext")],hn.prototype,"_handleTestElementChange",null);var Mm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},or=class extends C{static{this.styles=q`
6395
+ `}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(i=>i.active),n=t?.sections.find(i=>i.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=n==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){V(this,"cito-test-navigate",{type:"item",id:t})}render(){return b`<slot></slot>`}};Rl([p({type:Boolean,reflect:!0,attribute:"disabled"})],hn.prototype,"_internalDisabled",void 0);Rl([_({context:j,subscribe:!0})],hn.prototype,"computedContext",void 0);Rl([L("computedContext")],hn.prototype,"_handleTestElementChange",null);var Dm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},or=class extends C{static{this.styles=q`
6396
6396
  :host {
6397
6397
  ${ot};
6398
6398
  }
@@ -6405,7 +6405,7 @@ div.full-correct-response-inline {
6405
6405
  :host([disabled]) {
6406
6406
  ${lt};
6407
6407
  }
6408
- `}#t(t){V(this,"cito-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return b` <slot></slot> `}};Mm([p({type:String,attribute:"section-id"})],or.prototype,"sectionId",void 0);var fh=(o,t)=>o?.plugins?.[t];var Mo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Rl=o=>fh(o,"bookmarks")??[],gh=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?gh(e.host):void 0},Ne=class extends C{static{this.styles=q`
6408
+ `}#t(t){V(this,"cito-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return b` <slot></slot> `}};Dm([p({type:String,attribute:"section-id"})],or.prototype,"sectionId",void 0);var gh=(o,t)=>o?.plugins?.[t];var Mo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ol=o=>gh(o,"bookmarks")??[],bh=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?bh(e.host):void 0},Ne=class extends C{static{this.styles=q`
6409
6409
  :host {
6410
6410
  ${ot};
6411
6411
  }
@@ -6438,7 +6438,7 @@ div.full-correct-response-inline {
6438
6438
  :host([disabled]) {
6439
6439
  ${lt};
6440
6440
  }
6441
- `}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||(gh(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&&Rl(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=Rl(this.computedContext),n=e.includes(t)?e.filter(i=>i!==t):[...e,t];V(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>`}};Mo([_({context:j,subscribe:!0}),p({attribute:!1})],Ne.prototype,"computedContext",void 0);Mo([p({reflect:!0})],Ne.prototype,"item",void 0);Mo([p({type:Boolean,reflect:!0})],Ne.prototype,"bookmarked",void 0);Mo([p({type:Boolean,reflect:!0})],Ne.prototype,"disabled",void 0);var Dm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pn=class extends C{static{this.styles=q`
6441
+ `}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||(bh(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&&Ol(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=Ol(this.computedContext),n=e.includes(t)?e.filter(i=>i!==t):[...e,t];V(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>`}};Mo([_({context:j,subscribe:!0}),p({attribute:!1})],Ne.prototype,"computedContext",void 0);Mo([p({reflect:!0})],Ne.prototype,"item",void 0);Mo([p({type:Boolean,reflect:!0})],Ne.prototype,"bookmarked",void 0);Mo([p({type:Boolean,reflect:!0})],Ne.prototype,"disabled",void 0);var Nm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pn=class extends C{static{this.styles=q`
6442
6442
  :host {
6443
6443
  ${ot};
6444
6444
  }
@@ -6451,7 +6451,7 @@ div.full-correct-response-inline {
6451
6451
  :host([disabled]) {
6452
6452
  ${lt};
6453
6453
  }
6454
- `}constructor(){super(),this.view="scorer",this.addEventListener("click",()=>{V(this,"cito-test-end-attempt",{}),V(this,"cito-test-switch-view",this.view)})}render(){return b` <slot></slot> `}};Dm([p({type:String})],pn.prototype,"view",void 0);var Nm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},sr=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};Nm([T(),_({context:j,subscribe:!0})],sr.prototype,"computedContext",void 0);var $m=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ar=class extends C{static{this.styles=q`
6454
+ `}constructor(){super(),this.view="scorer",this.addEventListener("click",()=>{V(this,"cito-test-end-attempt",{}),V(this,"cito-test-switch-view",this.view)})}render(){return b` <slot></slot> `}};Nm([p({type:String})],pn.prototype,"view",void 0);var $m=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},sr=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};$m([T(),_({context:j,subscribe:!0})],sr.prototype,"computedContext",void 0);var Lm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Do=o=>o==null?"":Array.isArray(o)?o.map(Do).join(", "):Pt(o)?Object.entries(o).map(([t,e])=>`${t}: ${Do(e)}`).join(", "):String(o),ar=class extends C{static{this.styles=q`
6455
6455
  table {
6456
6456
  width: 100%;
6457
6457
  border-collapse: collapse;
@@ -6485,10 +6485,10 @@ div.full-correct-response-inline {
6485
6485
  </tr>
6486
6486
  </thead>
6487
6487
  <tbody>
6488
- ${r.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
6488
+ ${r.map(a=>{let l=Do(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`
6489
6489
  <tr>
6490
6490
  <td>${a.identifier}</td>
6491
- <td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
6491
+ <td>${Do(a.value)}</td>
6492
6492
  <td>${a.cardinality}</td>
6493
6493
  <td>${a.baseType}</td>
6494
6494
  <td>${l||c||d}</td>
@@ -6498,8 +6498,8 @@ div.full-correct-response-inline {
6498
6498
  </table>
6499
6499
  `;return b`
6500
6500
  ${i(e,"Response Variables")} ${i(n,"Outcome Variables")}
6501
- `}};$m([_({context:j,subscribe:!0})],ar.prototype,"computedContext",void 0);var Ol=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},un=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=qe(t)}#t(t){let i=(this.computedContext?.testParts.find(r=>r.active)).sections.flatMap(r=>r.items).find(r=>r.active)?.identifier;V(this,"cito-test-update-outcome",{assessmentItemRefId:i,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"),i=n?.value,r=n?.externalScored!=="human";if(!e||!n)return P;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:i,disabled:r}):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)})}};Ol([p({type:String,attribute:"view"})],un.prototype,"view",void 0);Ol([p({type:Boolean})],un.prototype,"disabled",void 0);Ol([_({context:j,subscribe:!0})],un.prototype,"computedContext",void 0);var bh=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Kn=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;if(t.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(a=>a.identifier==="completionStatus")?.value,n=t?.variables.find(a=>a.identifier=="SCORE"),i=parseFloat(n?.value),r=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!r&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:r==="externalMachine"?Number.isNaN(i)||i===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${i===0?"geen punten":i==1?"\xE9\xE9n punt":`${i} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:r==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};bh([_({context:j,subscribe:!0})],Kn.prototype,"computedContext",void 0);bh([p({type:String,attribute:"view"})],Kn.prototype,"view",void 0);var Pl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},mn=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=qe(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),n=e?.sections.find(h=>h.active),i=n?.items.find(h=>h.active),{variables:r,...s}=i||{};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}
6502
- ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Pl([p({type:Boolean,reflect:!0})],mn.prototype,"debug",void 0);Pl([T(),_({context:j,subscribe:!0})],mn.prototype,"computedContext",void 0);Pl([T()],mn.prototype,"stampContext",void 0);var lr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Do,Jt=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=Do.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=>Do.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=Do.DEFAULT_VIEW_OPTIONS}_switchView(t){V(this,"cito-test-switch-view",t)}render(){return b`
6501
+ `}};Lm([_({context:j,subscribe:!0})],ar.prototype,"computedContext",void 0);var Pl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},un=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=qe(t)}#t(t){let i=(this.computedContext?.testParts.find(r=>r.active)).sections.flatMap(r=>r.items).find(r=>r.active)?.identifier;V(this,"cito-test-update-outcome",{assessmentItemRefId:i,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"),i=n?.value,r=n?.externalScored!=="human";if(!e||!n)return P;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:i,disabled:r}):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)})}};Pl([p({type:String,attribute:"view"})],un.prototype,"view",void 0);Pl([p({type:Boolean})],un.prototype,"disabled",void 0);Pl([_({context:j,subscribe:!0})],un.prototype,"computedContext",void 0);var yh=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Kn=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;if(t.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(a=>a.identifier==="completionStatus")?.value,n=t?.variables.find(a=>a.identifier=="SCORE"),i=parseFloat(n?.value),r=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!r&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:r==="externalMachine"?Number.isNaN(i)||i===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${i===0?"geen punten":i==1?"\xE9\xE9n punt":`${i} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:r==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};yh([_({context:j,subscribe:!0})],Kn.prototype,"computedContext",void 0);yh([p({type:String,attribute:"view"})],Kn.prototype,"view",void 0);var Ml=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},mn=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=qe(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),n=e?.sections.find(h=>h.active),i=n?.items.find(h=>h.active),{variables:r,...s}=i||{};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}
6502
+ ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Ml([p({type:Boolean,reflect:!0})],mn.prototype,"debug",void 0);Ml([T(),_({context:j,subscribe:!0})],mn.prototype,"computedContext",void 0);Ml([T()],mn.prototype,"stampContext",void 0);var lr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},No,Kt=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=No.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=>No.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=No.DEFAULT_VIEW_OPTIONS}_switchView(t){V(this,"cito-test-switch-view",t)}render(){return b`
6503
6503
  <label part="label" for="viewSelect">${this.label}</label>
6504
6504
  <select
6505
6505
  part="select"
@@ -6508,12 +6508,12 @@ div.full-correct-response-inline {
6508
6508
  >
6509
6509
  ${this._viewOptions.map(t=>b`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
6510
6510
  </select>
6511
- `}};Do=Jt;lr([_({context:Se,subscribe:!0})],Jt.prototype,"sessionContext",void 0);lr([p({type:String})],Jt.prototype,"label",void 0);lr([p({type:String,attribute:"view-options"})],Jt.prototype,"viewOptions",void 0);lr([L("viewOptions",{waitUntilFirstUpdate:!0})],Jt.prototype,"_handleViewOptionsChange",void 0);lr([T()],Jt.prototype,"_viewOptions",void 0);var Lm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},cr=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=qe(t)}_switchView(t){V(this,"cito-test-switch-view",t)}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};Lm([_({context:Se,subscribe:!0})],cr.prototype,"sessionContext",void 0);var Zn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},$o="tts-element",Lo="tts-word",No=null;function Vm(){return No||(No=new CSSStyleSheet,No.replaceSync(`
6512
- ::highlight(${$o}) { background-color: #dbeafe; color: inherit; }
6513
- ::highlight(${Lo}) { background-color: #ffe066; color: inherit; }
6514
- `)),No}var yh=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"},$e=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
6515
- <path d="${zm[o]}"></path>
6516
- </svg>`;return b`${e}<span class="label">${t}</span>`},Nt=class extends C{static{this.styles=q`
6511
+ `}};No=Kt;lr([_({context:Se,subscribe:!0})],Kt.prototype,"sessionContext",void 0);lr([p({type:String})],Kt.prototype,"label",void 0);lr([p({type:String,attribute:"view-options"})],Kt.prototype,"viewOptions",void 0);lr([L("viewOptions",{waitUntilFirstUpdate:!0})],Kt.prototype,"_handleViewOptionsChange",void 0);lr([T()],Kt.prototype,"_viewOptions",void 0);var Vm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},cr=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=qe(t)}_switchView(t){V(this,"cito-test-switch-view",t)}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};Vm([_({context:Se,subscribe:!0})],cr.prototype,"sessionContext",void 0);var Zn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Lo="tts-element",Vo="tts-word",$o=null;function zm(){return $o||($o=new CSSStyleSheet,$o.replaceSync(`
6512
+ ::highlight(${Lo}) { background-color: #dbeafe; color: inherit; }
6513
+ ::highlight(${Vo}) { background-color: #ffe066; color: inherit; }
6514
+ `)),$o}var vh=Symbol("tts-context"),jm={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"},$e=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
6515
+ <path d="${jm[o]}"></path>
6516
+ </svg>`;return b`${e}<span class="label">${t}</span>`},$t=class extends C{static{this.styles=q`
6517
6517
  :host {
6518
6518
  display: inline-flex;
6519
6519
  }
@@ -6558,18 +6558,18 @@ div.full-correct-response-inline {
6558
6558
  clip-path: inset(50%);
6559
6559
  white-space: nowrap;
6560
6560
  }
6561
- `}#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"))}};Zn([p({type:String})],Nt.prototype,"label",void 0);Zn([_({context:yh,subscribe:!0})],Nt.prototype,"_tts",void 0);var fn=class extends C{static{this.styles=q`
6561
+ `}#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"))}};Zn([p({type:String})],$t.prototype,"label",void 0);Zn([_({context:vh,subscribe:!0})],$t.prototype,"_tts",void 0);var fn=class extends C{static{this.styles=q`
6562
6562
  :host {
6563
6563
  display: inline-flex;
6564
6564
  flex-wrap: wrap;
6565
6565
  align-items: center;
6566
6566
  gap: var(--test-tts-gap, 0.25rem);
6567
6567
  }
6568
- `}#t;#e;#n;#i;#r;#o;#s;#a;#c;#p;#l;#m;#d;#u;#h;#b;#f;#y;#g;#v;#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.#y=this.#Q.bind(this),this.#g=!1,this.#v=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.#k(),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(),i=this.#c!==void 0&&this.#c!==e,r=this.#p!==void 0&&this.#p!==n,s=this.#l!==null&&this.#m!==null&&this.#m!==this.#D();(i||r||s)&&this.#C(),this.#c=e,this.#p=n}#C(){this.#k(),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.#k(),this.#_(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("cito-test-navigate",this.#a),this.#o?.removeEventListener("qti-request-navigation",this.#a),this.#o=null,this.#r=null,this.#n?.disconnect(),this.#n=null,this.#e=!1,this.#i=!1}render(){return b`<slot></slot>`}#E(){this.#l!==null&&this.#C()}#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.#k(),this.#_(),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.#V()?.querySelector("qti-item-body")??null}#V(){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.#S().length}}#S(){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.#z(t))}#z(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#j(t){let e=t;for(;e;){let i=e.getAttribute("lang")||e.getAttribute("xml:lang");if(i?.trim())return i.trim();e=e.parentElement??e.getRootNode().host??null}let n=document.documentElement.getAttribute("lang");return n?.trim()?n.trim():this.language}#F(){if(!this.#S().length){console.warn("test-item-to-speech: no readable elements found");return}this.#k(),speechSynthesis.cancel(),this.#g&&(this.#g=!1,this.#d=0),this.#i&&this.#d===0&&(this.#l=null),this.#T(this.#d)}#T(t){let e=this.#S();if(t>=e.length){this.#I(),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 i=this.#u.map(s=>s.textContent??"").join("");if(!i.trim()){this.#T(t+1);return}let r=new SpeechSynthesisUtterance(i);r.lang=this.#j(n),r.rate=1,r.onboundary=s=>{s.name==="word"&&this.#J(s.charIndex,s.charLength??0)},r.onend=()=>{this.#h===r&&(this.#h=null,this.#I(),this.#T(this.#d+1))},r.onerror=()=>{this.#h===r&&(this.#h=null,this.#_(),this.#q("idle"))},this.#h=r,speechSynthesis.speak(r),this.#q("playing")}#B(){speechSynthesis.pause(),this.#q("paused")}#U(){speechSynthesis.resume(),this.#q("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#_(),this.#q("idle")}#H(){this.#b?this.#k():this.#W()}#W(){this.#i&&(this.#l=null);let t=this.#S();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.#y,!0),this._ttsContext={...this._ttsContext,picking:!0}}#k(){this.#b&&(this.#b=!1,this.#t.states.delete("picking"),this.#f?.removeEventListener("click",this.#y,!0),this.#f=null,this.#_(),this._ttsContext={...this._ttsContext,picking:!1})}#Q(t){let e=this.#S(),n=t.composedPath(),i=e.findIndex(r=>n.includes(r));if(i<0){let r=n.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));r&&(i=e.findIndex(s=>r.contains(s)))}i<0||(t.preventDefault(),t.stopPropagation(),this.#k(),speechSynthesis.cancel(),this.#T(i))}#G(){let t=this.#S();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),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.#S();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),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),i;for(;i=n.nextNode();)(i.textContent??"").length>0&&!i.parentElement?.closest('[aria-hidden="true"]')&&e.push(i);return e}#O(t){this.#N([t])}#N(t){if("highlights"in CSS){this.#$(),this.#v.clear();for(let e of t){let n=new Range;n.selectNodeContents(e),this.#v.add(n)}CSS.highlights.set($o,this.#v)}}#J(t,e){if(!("highlights"in CSS))return;this.#$(),this.#x.clear();let n=this.#u.map(d=>d.textContent??"").join(""),i=t+(e>0?e:this.#K(t,n)),r=0,s=null,a=0,l=null,c=0;for(let d of this.#u){let h=d.textContent?.length??0;if(!s&&r+h>t&&(s=d,a=t-r),s&&r+h>=i){l=d,c=i-r;break}r+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#x.add(d),CSS.highlights.set(Lo,this.#x)}}#I(){"highlights"in CSS&&(this.#x.clear(),CSS.highlights.get(Lo)===this.#x&&CSS.highlights.delete(Lo))}#_(){"highlights"in CSS&&(this.#I(),this.#v.clear(),CSS.highlights.get($o)===this.#v&&CSS.highlights.delete($o))}#K(t,e){let n=e.slice(t).search(/\s/);return n<0?e.length-t:n}#$(){if(!("highlights"in CSS))return;let t=Vm();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let i=this.#l?.[0]?.getRootNode();i instanceof ShadowRoot&&e.add(i);for(let r of e)r.adoptedStyleSheets.includes(t)||(r.adoptedStyleSheets=[...r.adoptedStyleSheets,t])}};Zn([p({type:String})],fn.prototype,"language",void 0);Zn([_({context:j,subscribe:!0})],fn.prototype,"_computedContext",void 0);Zn([T(),U({context:yh})],fn.prototype,"_ttsContext",void 0);var dr=class extends Nt{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return b`
6568
+ `}#t;#e;#n;#i;#r;#o;#s;#a;#c;#p;#l;#m;#d;#u;#h;#b;#f;#y;#g;#v;#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.#y=this.#Q.bind(this),this.#g=!1,this.#v=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.#k(),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(),i=this.#c!==void 0&&this.#c!==e,r=this.#p!==void 0&&this.#p!==n,s=this.#l!==null&&this.#m!==null&&this.#m!==this.#D();(i||r||s)&&this.#C(),this.#c=e,this.#p=n}#C(){this.#k(),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.#k(),this.#_(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("cito-test-navigate",this.#a),this.#o?.removeEventListener("qti-request-navigation",this.#a),this.#o=null,this.#r=null,this.#n?.disconnect(),this.#n=null,this.#e=!1,this.#i=!1}render(){return b`<slot></slot>`}#E(){this.#l!==null&&this.#C()}#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.#k(),this.#_(),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.#V()?.querySelector("qti-item-body")??null}#V(){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.#S().length}}#S(){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.#z(t))}#z(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#j(t){let e=t;for(;e;){let i=e.getAttribute("lang")||e.getAttribute("xml:lang");if(i?.trim())return i.trim();e=e.parentElement??e.getRootNode().host??null}let n=document.documentElement.getAttribute("lang");return n?.trim()?n.trim():this.language}#F(){if(!this.#S().length){console.warn("test-item-to-speech: no readable elements found");return}this.#k(),speechSynthesis.cancel(),this.#g&&(this.#g=!1,this.#d=0),this.#i&&this.#d===0&&(this.#l=null),this.#T(this.#d)}#T(t){let e=this.#S();if(t>=e.length){this.#I(),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 i=this.#u.map(s=>s.textContent??"").join("");if(!i.trim()){this.#T(t+1);return}let r=new SpeechSynthesisUtterance(i);r.lang=this.#j(n),r.rate=1,r.onboundary=s=>{s.name==="word"&&this.#J(s.charIndex,s.charLength??0)},r.onend=()=>{this.#h===r&&(this.#h=null,this.#I(),this.#T(this.#d+1))},r.onerror=()=>{this.#h===r&&(this.#h=null,this.#_(),this.#q("idle"))},this.#h=r,speechSynthesis.speak(r),this.#q("playing")}#B(){speechSynthesis.pause(),this.#q("paused")}#U(){speechSynthesis.resume(),this.#q("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#_(),this.#q("idle")}#H(){this.#b?this.#k():this.#W()}#W(){this.#i&&(this.#l=null);let t=this.#S();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.#y,!0),this._ttsContext={...this._ttsContext,picking:!0}}#k(){this.#b&&(this.#b=!1,this.#t.states.delete("picking"),this.#f?.removeEventListener("click",this.#y,!0),this.#f=null,this.#_(),this._ttsContext={...this._ttsContext,picking:!1})}#Q(t){let e=this.#S(),n=t.composedPath(),i=e.findIndex(r=>n.includes(r));if(i<0){let r=n.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));r&&(i=e.findIndex(s=>r.contains(s)))}i<0||(t.preventDefault(),t.stopPropagation(),this.#k(),speechSynthesis.cancel(),this.#T(i))}#G(){let t=this.#S();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),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.#S();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),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),i;for(;i=n.nextNode();)(i.textContent??"").length>0&&!i.parentElement?.closest('[aria-hidden="true"]')&&e.push(i);return e}#O(t){this.#N([t])}#N(t){if("highlights"in CSS){this.#$(),this.#v.clear();for(let e of t){let n=new Range;n.selectNodeContents(e),this.#v.add(n)}CSS.highlights.set(Lo,this.#v)}}#J(t,e){if(!("highlights"in CSS))return;this.#$(),this.#x.clear();let n=this.#u.map(d=>d.textContent??"").join(""),i=t+(e>0?e:this.#K(t,n)),r=0,s=null,a=0,l=null,c=0;for(let d of this.#u){let h=d.textContent?.length??0;if(!s&&r+h>t&&(s=d,a=t-r),s&&r+h>=i){l=d,c=i-r;break}r+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#x.add(d),CSS.highlights.set(Vo,this.#x)}}#I(){"highlights"in CSS&&(this.#x.clear(),CSS.highlights.get(Vo)===this.#x&&CSS.highlights.delete(Vo))}#_(){"highlights"in CSS&&(this.#I(),this.#v.clear(),CSS.highlights.get(Lo)===this.#v&&CSS.highlights.delete(Lo))}#K(t,e){let n=e.slice(t).search(/\s/);return n<0?e.length-t:n}#$(){if(!("highlights"in CSS))return;let t=zm();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let i=this.#l?.[0]?.getRootNode();i instanceof ShadowRoot&&e.add(i);for(let r of e)r.adoptedStyleSheets.includes(t)||(r.adoptedStyleSheets=[...r.adoptedStyleSheets,t])}};Zn([p({type:String})],fn.prototype,"language",void 0);Zn([_({context:j,subscribe:!0})],fn.prototype,"_computedContext",void 0);Zn([T(),U({context:vh})],fn.prototype,"_ttsContext",void 0);var dr=class extends $t{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return b`
6569
6569
  <button part="button" aria-label=${Z(t?this.pauseLabel:this.label)} @click=${this.#t}>
6570
6570
  ${t?b`<slot name="pause">${$e("pause",this.pauseLabel??"Pause")}</slot>`:b`<slot name="play">${$e("play",this.label??"Play")}</slot>`}
6571
6571
  </button>
6572
- `}};Zn([p({type:String,attribute:"pause-label"})],dr.prototype,"pauseLabel",void 0);var Vo=class extends Nt{render(){return b`
6572
+ `}};Zn([p({type:String,attribute:"pause-label"})],dr.prototype,"pauseLabel",void 0);var zo=class extends $t{render(){return b`
6573
6573
  <button
6574
6574
  part="button"
6575
6575
  aria-label=${Z(this.label)}
@@ -6578,7 +6578,7 @@ div.full-correct-response-inline {
6578
6578
  >
6579
6579
  <slot>${$e("pause",this.label??"Pause")}</slot>
6580
6580
  </button>
6581
- `}},zo=class extends Nt{render(){return b`
6581
+ `}},jo=class extends $t{render(){return b`
6582
6582
  <button
6583
6583
  part="button"
6584
6584
  aria-label=${Z(this.label)}
@@ -6587,11 +6587,11 @@ div.full-correct-response-inline {
6587
6587
  >
6588
6588
  <slot>${$e("play",this.label??"Resume")}</slot>
6589
6589
  </button>
6590
- `}},jo=class extends Nt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
6590
+ `}},Fo=class extends $t{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
6591
6591
  <button part="button" aria-label=${Z(this.label)} ?disabled=${t} @click=${()=>this._tts?.stop()}>
6592
6592
  <slot>${$e("stop",this.label??"Stop")}</slot>
6593
6593
  </button>
6594
- `}},Fo=class extends Nt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
6594
+ `}},Bo=class extends $t{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
6595
6595
  <button
6596
6596
  part="button"
6597
6597
  aria-label=${Z(this.label)}
@@ -6600,7 +6600,7 @@ div.full-correct-response-inline {
6600
6600
  >
6601
6601
  <slot>${$e("prev",this.label??"Previous sentence")}</slot>
6602
6602
  </button>
6603
- `}},Bo=class extends Nt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
6603
+ `}},Uo=class extends $t{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
6604
6604
  <button
6605
6605
  part="button"
6606
6606
  aria-label=${Z(this.label)}
@@ -6609,7 +6609,7 @@ div.full-correct-response-inline {
6609
6609
  >
6610
6610
  <slot>${$e("next",this.label??"Next sentence")}</slot>
6611
6611
  </button>
6612
- `}},Uo=class extends Nt{render(){return b`
6612
+ `}},Ho=class extends $t{render(){return b`
6613
6613
  <button
6614
6614
  part="button"
6615
6615
  aria-label=${Z(this.label)}
@@ -6618,11 +6618,11 @@ div.full-correct-response-inline {
6618
6618
  >
6619
6619
  <slot>${$e("pick",this.label??"Read from here")}</slot>
6620
6620
  </button>
6621
- `}};var vh=[{tag:"test-item-to-speech",ctor:fn},{tag:"test-tts-next",ctor:Bo},{tag:"test-tts-pause",ctor:Vo},{tag:"test-tts-pick",ctor:Uo},{tag:"test-tts-play",ctor:dr},{tag:"test-tts-prev",ctor:Fo},{tag:"test-tts-resume",ctor:zo},{tag:"test-tts-stop",ctor:jo}];var wh=[{tag:"test-check-item",ctor:pn},{tag:"test-bookmark",ctor:Ne},{tag:"test-print-context",ctor:sr},{tag:"test-print-item-variables",ctor:ar},{tag:"test-scoring-buttons",ctor:un},{tag:"test-scoring-feedback",ctor:Kn},{tag:"test-stamp",ctor:mn},{tag:"test-view",ctor:Jt},{tag:"test-view-toggle",ctor:cr},...vh];var xh=[{tag:"qti-assessment-item-ref",ctor:Ct},{tag:"qti-assessment-section",ctor:St},{tag:"qti-assessment-test",ctor:on},{tag:"qti-branch-rule",ctor:le},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Wi},{tag:"qti-number-selected",ctor:so},{tag:"qti-outcome-processing",ctor:lo},{tag:"qti-pre-condition",ctor:ao},{tag:"qti-test",ctor:Pe},{tag:"qti-test-feedback",ctor:er},{tag:"qti-test-part",ctor:Oe},{tag:"qti-test-variables",ctor:nr},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ln},{tag:"test-item-link",ctor:rr},{tag:"test-navigation",ctor:gt},{tag:"test-next",ctor:dn},{tag:"test-prev",ctor:hn},{tag:"test-section-link",ctor:or},...wh];for(let{tag:o,ctor:t}of xh)customElements.get(o)||customElements.define(o,t);var gn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},$t=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Yt().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=Yt().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(Po),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
6621
+ `}};var wh=[{tag:"test-item-to-speech",ctor:fn},{tag:"test-tts-next",ctor:Uo},{tag:"test-tts-pause",ctor:zo},{tag:"test-tts-pick",ctor:Ho},{tag:"test-tts-play",ctor:dr},{tag:"test-tts-prev",ctor:Bo},{tag:"test-tts-resume",ctor:jo},{tag:"test-tts-stop",ctor:Fo}];var xh=[{tag:"test-check-item",ctor:pn},{tag:"test-bookmark",ctor:Ne},{tag:"test-print-context",ctor:sr},{tag:"test-print-item-variables",ctor:ar},{tag:"test-scoring-buttons",ctor:un},{tag:"test-scoring-feedback",ctor:Kn},{tag:"test-stamp",ctor:mn},{tag:"test-view",ctor:Kt},{tag:"test-view-toggle",ctor:cr},...wh];var qh=[{tag:"qti-assessment-item-ref",ctor:Ct},{tag:"qti-assessment-section",ctor:St},{tag:"qti-assessment-test",ctor:on},{tag:"qti-branch-rule",ctor:le},{tag:"qti-item-session-control",ctor:Mt},{tag:"qti-number-presented",ctor:Wi},{tag:"qti-number-selected",ctor:so},{tag:"qti-outcome-processing",ctor:lo},{tag:"qti-pre-condition",ctor:ao},{tag:"qti-test",ctor:Pe},{tag:"qti-test-feedback",ctor:er},{tag:"qti-test-part",ctor:Oe},{tag:"qti-test-variables",ctor:nr},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ln},{tag:"test-item-link",ctor:rr},{tag:"test-navigation",ctor:gt},{tag:"test-next",ctor:dn},{tag:"test-prev",ctor:hn},{tag:"test-section-link",ctor:or},...xh];for(let{tag:o,ctor:t}of qh)customElements.get(o)||customElements.define(o,t);var gn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Lt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Jt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Jt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#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(Po),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
6622
6622
  ${this.#t}
6623
6623
  <slot></slot>
6624
6624
  ${Oo(this.itemDoc,b`<span>Loading...</span>`)}
6625
- `}};gn([p({attribute:!1})],$t.prototype,"customElementRegistry",void 0);gn([p({type:String,attribute:"item-url"})],$t.prototype,"itemURL",void 0);gn([T()],$t.prototype,"itemDoc",void 0);gn([T()],$t.prototype,"itemXML",void 0);gn([T(),_({context:qt,subscribe:!0})],$t.prototype,"qtiContext",void 0);gn([L("itemURL",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemURLChange",null);gn([L("itemXML",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemXMLChange",null);var jm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hr=class extends C{static{this.styles=q`
6625
+ `}};gn([p({attribute:!1})],Lt.prototype,"customElementRegistry",void 0);gn([p({type:String,attribute:"item-url"})],Lt.prototype,"itemURL",void 0);gn([T()],Lt.prototype,"itemDoc",void 0);gn([T()],Lt.prototype,"itemXML",void 0);gn([T(),_({context:qt,subscribe:!0})],Lt.prototype,"qtiContext",void 0);gn([L("itemURL",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemURLChange",null);gn([L("itemXML",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemXMLChange",null);var Fm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hr=class extends C{static{this.styles=q`
6626
6626
  table {
6627
6627
  width: 100%;
6628
6628
  border-collapse: collapse;
@@ -6669,7 +6669,7 @@ div.full-correct-response-inline {
6669
6669
  </table>
6670
6670
  `;return b`
6671
6671
  ${i(e,"Response Variables")} ${i(n,"Outcome Variables")}
6672
- `}};jm([_({context:Ce,subscribe:!0})],hr.prototype,"computedContext",void 0);var Fm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},qh=o=>{class t extends o{#t;constructor(...n){super(...n),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(n){super.willUpdate(n),n.has("view")&&this.#e()}#e(){let n=this.#t;n&&(n.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(n,this.view))}updateAssessmentItemView(n,i){}}return Fm([p({type:String})],t.prototype,"view",void 0),t};var Ml=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pe=class extends qh(C){#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,i=parseFloat(n?.toString()),r=e?.find(c=>c.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,l=r==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};Ml([T(),U({context:Ce})],pe.prototype,"computedContext",void 0);Ml([T(),U({context:xt})],pe.prototype,"configContext",void 0);Ml([T(),U({context:qt})],pe.prototype,"qtiContext",void 0);var Ch=[{tag:"item-container",ctor:$t},{tag:"item-print-variables",ctor:hr},{tag:"qti-item",ctor:pe}];for(let{tag:o,ctor:t}of Ch)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of eh)customElements.get(o)||customElements.define(o,t);var Sh=(o,t,e)=>{let n=new Map;for(let i=t;i<=e;i++)n.set(o[i],i);return n},Q=Mt(class extends _e{constructor(o){if(super(o),o.type!==Yn.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 i=[],r=[],s=0;for(let a of o)i[s]=n?n(a,s):s,r[s]=e(a,s),s++;return{values:r,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,n]){let i=Zd(o),{values:r,keys:s}=this.dt(t,e,n);if(!Array.isArray(i))return this.ut=s,r;let a=this.ut??=[],l=[],c,d,h=0,f=i.length-1,m=0,v=r.length-1;for(;h<=f&&m<=v;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])l[m]=Te(i[h],r[m]),h++,m++;else if(a[f]===s[v])l[v]=Te(i[f],r[v]),f--,v--;else if(a[h]===s[v])l[v]=Te(i[h],r[v]),Jn(o,l[v+1],i[h]),h++,v--;else if(a[f]===s[m])l[m]=Te(i[f],r[m]),Jn(o,i[h],i[f]),f--,m++;else if(c===void 0&&(c=Sh(s,m,v),d=Sh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=Jn(o,i[h]);Te(g,r[m]),l[m]=g}else l[m]=Te(u,r[m]),Jn(o,i[h],u),i[x]=null;m++}else xo(i[f]),f--;else xo(i[h]),h++;for(;m<=v;){let x=Jn(o,l[v+1]);Te(x,r[m]),l[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&xo(x)}return this.ut=s,Kd(o,l),it}});var Le=Symbol("dragDropContext");var kh=[O,Qt,q`
6672
+ `}};Fm([_({context:Ce,subscribe:!0})],hr.prototype,"computedContext",void 0);var Bm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ch=o=>{class t extends o{#t;constructor(...n){super(...n),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(n){super.willUpdate(n),n.has("view")&&this.#e()}#e(){let n=this.#t;n&&(n.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(n,this.view))}updateAssessmentItemView(n,i){}}return Bm([p({type:String})],t.prototype,"view",void 0),t};var Dl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pe=class extends Ch(C){#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,i=parseFloat(n?.toString()),r=e?.find(c=>c.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,l=r==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};Dl([T(),U({context:Ce})],pe.prototype,"computedContext",void 0);Dl([T(),U({context:xt})],pe.prototype,"configContext",void 0);Dl([T(),U({context:qt})],pe.prototype,"qtiContext",void 0);var Sh=[{tag:"item-container",ctor:Lt},{tag:"item-print-variables",ctor:hr},{tag:"qti-item",ctor:pe}];for(let{tag:o,ctor:t}of Sh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of nh)customElements.get(o)||customElements.define(o,t);var kh=(o,t,e)=>{let n=new Map;for(let i=t;i<=e;i++)n.set(o[i],i);return n},Q=Dt(class extends _e{constructor(o){if(super(o),o.type!==Yn.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 i=[],r=[],s=0;for(let a of o)i[s]=n?n(a,s):s,r[s]=e(a,s),s++;return{values:r,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,n]){let i=th(o),{values:r,keys:s}=this.dt(t,e,n);if(!Array.isArray(i))return this.ut=s,r;let a=this.ut??=[],l=[],c,d,h=0,f=i.length-1,m=0,v=r.length-1;for(;h<=f&&m<=v;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])l[m]=Te(i[h],r[m]),h++,m++;else if(a[f]===s[v])l[v]=Te(i[f],r[v]),f--,v--;else if(a[h]===s[v])l[v]=Te(i[h],r[v]),Jn(o,l[v+1],i[h]),h++,v--;else if(a[f]===s[m])l[m]=Te(i[f],r[m]),Jn(o,i[h],i[f]),f--,m++;else if(c===void 0&&(c=kh(s,m,v),d=kh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=Jn(o,i[h]);Te(g,r[m]),l[m]=g}else l[m]=Te(u,r[m]),Jn(o,i[h],u),i[x]=null;m++}else xo(i[f]),f--;else xo(i[h]),h++;for(;m<=v;){let x=Jn(o,l[v+1]);Te(x,r[m]),l[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&xo(x)}return this.ut=s,Zd(o,l),it}});var Le=Symbol("dragDropContext");var Eh=[O,Gt,q`
6673
6673
  /* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
6674
6674
  custom properties on its host; the properties themselves live here. */
6675
6675
  :host {
@@ -6687,9 +6687,9 @@ div.full-correct-response-inline {
6687
6687
  width: 100%;
6688
6688
  height: 100%;
6689
6689
  }
6690
- `];var Eh=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ti=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=kh}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">
6690
+ `];var Ah=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ti=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Eh}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">
6691
6691
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6692
- </div>`}};Eh([p({type:String,reflect:!0})],ti.prototype,"identifier",void 0);Eh([_({context:Le,subscribe:!0}),T()],ti.prototype,"_dragDrop",void 0);var Ah=[{tag:"qti-associable-hotspot",ctor:ti}];var Ih=[O,Qt,q`
6692
+ </div>`}};Ah([p({type:String,reflect:!0})],ti.prototype,"identifier",void 0);Ah([_({context:Le,subscribe:!0}),T()],ti.prototype,"_dragDrop",void 0);var Ih=[{tag:"qti-associable-hotspot",ctor:ti}];var _h=[O,Gt,q`
6693
6693
  /*
6694
6694
  * A drop target. The interaction measures its chips and publishes the result as custom
6695
6695
  * properties on its own host; the actual CSS properties live here, not in a style attribute.
@@ -6734,9 +6734,9 @@ div.full-correct-response-inline {
6734
6734
  min-height: var(--qti-dropzone-min-height, 0);
6735
6735
  min-width: var(--qti-dropzone-min-width, 0);
6736
6736
  }
6737
- `];var Dl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},bn=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Ih}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
6737
+ `];var Nl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},bn=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=_h}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
6738
6738
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6739
- </div>`}};Dl([p({type:Number,reflect:!0})],bn.prototype,"tabindex",void 0);Dl([p({type:String,reflect:!0})],bn.prototype,"identifier",void 0);Dl([_({context:Le,subscribe:!0}),T()],bn.prototype,"_dragDrop",void 0);var _h=[{tag:"qti-gap",ctor:bn}];var Th=[O,q`
6739
+ </div>`}};Nl([p({type:Number,reflect:!0})],bn.prototype,"tabindex",void 0);Nl([p({type:String,reflect:!0})],bn.prototype,"identifier",void 0);Nl([_({context:Le,subscribe:!0}),T()],bn.prototype,"_dragDrop",void 0);var Th=[{tag:"qti-gap",ctor:bn}];var Rh=[O,q`
6740
6740
  /* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
6741
6741
  graphic-gap-match rules, on the host from the document. */
6742
6742
  :host {
@@ -6749,7 +6749,7 @@ div.full-correct-response-inline {
6749
6749
  anywhere else it is unset and the chip keeps its size. */
6750
6750
  zoom: var(--qti-graphic-scale, 1);
6751
6751
  }
6752
- `];var Bm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pr=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Th}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};Bm([p({type:Number,reflect:!0})],pr.prototype,"tabindex",void 0);var Rh=[{tag:"qti-gap-img",ctor:pr}];var yn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Oh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t){class e extends o{#t;#e(){let r=this._interactionContext?.choiceRole??null;r!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=r,this.internals.role=r,r&&this.internals.states.add(r))}handleDisabledChange(i,r){r?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=r?-1:0}handleReadonlyChange(i,r){r?(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=null,this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),this.#e()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return b`<slot></slot>`}}return yn([p({type:String})],e.prototype,"identifier",void 0),yn([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),yn([p({type:Boolean,attribute:"aria-disabled",converter:Oh})],e.prototype,"disabled",void 0),yn([p({type:Boolean,attribute:"aria-readonly",converter:Oh})],e.prototype,"readonly",void 0),yn([_({context:Pn,subscribe:!0}),T()],e.prototype,"_interactionContext",void 0),yn([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),yn([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var Ph=[O,q`
6752
+ `];var Um=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pr=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Rh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};Um([p({type:Number,reflect:!0})],pr.prototype,"tabindex",void 0);var Oh=[{tag:"qti-gap-img",ctor:pr}];var yn=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ph={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t){class e extends o{#t;#e(){let r=this._interactionContext?.choiceRole??null;r!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=r,this.internals.role=r,r&&this.internals.states.add(r))}handleDisabledChange(i,r){r?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=r?-1:0}handleReadonlyChange(i,r){r?(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=null,this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),this.#e()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return b`<slot></slot>`}}return yn([p({type:String})],e.prototype,"identifier",void 0),yn([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),yn([p({type:Boolean,attribute:"aria-disabled",converter:Ph})],e.prototype,"disabled",void 0),yn([p({type:Boolean,attribute:"aria-readonly",converter:Ph})],e.prototype,"readonly",void 0),yn([_({context:Pn,subscribe:!0}),T()],e.prototype,"_interactionContext",void 0),yn([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),yn([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var Mh=[O,q`
6753
6753
  /*
6754
6754
  * A chip's own box. Both drag-drop interactions that use this element laid it out from the
6755
6755
  * theme — gap-match with 'display: flex !important; align-items: center !important',
@@ -6792,8 +6792,8 @@ div.full-correct-response-inline {
6792
6792
  align-items: center;
6793
6793
  justify-content: center;
6794
6794
  }
6795
- `];var Um=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ve=class extends Et(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Ph}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
6796
- <slot part="label"></slot>`}};Um([p({type:Number,reflect:!0})],Ve.prototype,"tabindex",void 0);var Mh=[{tag:"qti-gap-text",ctor:Ve}];var Dh=[O,q`
6795
+ `];var Hm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ve=class extends Et(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Mh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
6796
+ <slot part="label"></slot>`}};Hm([p({type:Number,reflect:!0})],Ve.prototype,"tabindex",void 0);var Dh=[{tag:"qti-gap-text",ctor:Ve}];var Nh=[O,q`
6797
6797
  :host {
6798
6798
  display: flex;
6799
6799
  user-select: none;
@@ -6813,7 +6813,7 @@ div.full-correct-response-inline {
6813
6813
  display: grid;
6814
6814
  place-content: center;
6815
6815
  }
6816
- `];var Hm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},vn=class extends Et(C,"qti-hotspot-choice"){static{this.styles=Dh}};Hm([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],vn.prototype,"order",void 0);var Nh=[{tag:"qti-hotspot-choice",ctor:vn}];var $h=[O,q`
6816
+ `];var Wm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},vn=class extends Et(C,"qti-hotspot-choice"){static{this.styles=Nh}};Wm([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],vn.prototype,"order",void 0);var $h=[{tag:"qti-hotspot-choice",ctor:vn}];var Lh=[O,q`
6817
6817
  /* 'position: relative' is the containing block for the answer-key tick the theme draws as an
6818
6818
  absolutely positioned ::before. See CONTRACT.md §7. */
6819
6819
  :host {
@@ -6833,8 +6833,8 @@ div.full-correct-response-inline {
6833
6833
  [part='control'] {
6834
6834
  display: none;
6835
6835
  }
6836
- `];var wn=class extends Et(C,"qti-hottext"){static{this.styles=$h}render(){return b`<div part="control"><div part="control-mark"></div></div>
6837
- <slot part="label"></slot>`}};var Lh=[{tag:"qti-hottext",ctor:wn}];var Wm=q`
6836
+ `];var wn=class extends Et(C,"qti-hottext"){static{this.styles=Lh}render(){return b`<div part="control"><div part="control-mark"></div></div>
6837
+ <slot part="label"></slot>`}};var Vh=[{tag:"qti-hottext",ctor:wn}];var Qm=q`
6838
6838
  /*
6839
6839
  * An option row: one line, clipped, with its text centred against the row's min-height. All four
6840
6840
  * were in the theme, set on this host from the document — which is also why the 'display: block'
@@ -6851,13 +6851,13 @@ div.full-correct-response-inline {
6851
6851
  slot {
6852
6852
  display: inline;
6853
6853
  }
6854
- `,Vh=Wm;var Qm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ur=class extends Et(C,"qti-inline-choice"){static{this.styles=Vh}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}}))}};Qm([p({type:String})],ur.prototype,"identifier",void 0);var zh=[{tag:"qti-inline-choice",ctor:ur}];var jh=[O,q`
6854
+ `,zh=Qm;var Gm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ur=class extends Et(C,"qti-inline-choice"){static{this.styles=zh}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}}))}};Gm([p({type:String})],ur.prototype,"identifier",void 0);var jh=[{tag:"qti-inline-choice",ctor:ur}];var Fh=[O,q`
6855
6855
  :host {
6856
6856
  display: block;
6857
6857
  margin: var(--qti-gap) 0;
6858
6858
  width: 100%;
6859
6859
  }
6860
- `];var Ho=class extends C{static{this.styles=jh}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Fh=[{tag:"qti-prompt",ctor:Ho}];var Bh=[O,Qt,q`
6860
+ `];var Wo=class extends C{static{this.styles=Fh}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Bh=[{tag:"qti-prompt",ctor:Wo}];var Uh=[O,Gt,q`
6861
6861
  /*
6862
6862
  * 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
6863
6863
  * way. In tabular match this element is a light-DOM *grandchild* of the slotted
@@ -7006,13 +7006,13 @@ div.full-correct-response-inline {
7006
7006
  align-items: center;
7007
7007
  justify-content: center;
7008
7008
  }
7009
- `];var Wo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Lt=class extends Et(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Bh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
7009
+ `];var Qo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Vt=class extends Et(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Uh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
7010
7010
  <div part="control"></div>
7011
7011
  <slot part="label"></slot>
7012
7012
  <div part="drop">
7013
7013
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
7014
7014
  </div>
7015
- `}};Wo([p({type:Number,attribute:"match-min"})],Lt.prototype,"matchMin",void 0);Wo([p({type:Number,attribute:"match-max"})],Lt.prototype,"matchMax",void 0);Wo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Wo([_({context:Le,subscribe:!0}),T()],Lt.prototype,"_dragDrop",void 0);var Uh=[{tag:"qti-simple-associable-choice",ctor:Lt}];var Hh=[O,q`
7015
+ `}};Qo([p({type:Number,attribute:"match-min"})],Vt.prototype,"matchMin",void 0);Qo([p({type:Number,attribute:"match-max"})],Vt.prototype,"matchMax",void 0);Qo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Qo([_({context:Le,subscribe:!0}),T()],Vt.prototype,"_dragDrop",void 0);var Hh=[{tag:"qti-simple-associable-choice",ctor:Vt}];var Wh=[O,q`
7016
7016
  /*
7017
7017
  * 'position: relative' unconditionally, because this element can carry a correction badge and a
7018
7018
  * badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
@@ -7048,9 +7048,9 @@ div.full-correct-response-inline {
7048
7048
  align-items: center;
7049
7049
  justify-content: center;
7050
7050
  }
7051
- `];var Qo=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Vt=class extends Et(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Hh}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
7051
+ `];var Go=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},zt=class extends Et(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Wh}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
7052
7052
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
7053
- <slot part="label"></slot>`}};Qo([p({type:String,attribute:"template-identifier"})],Vt.prototype,"templateIdentifier",void 0);Qo([p({type:String,attribute:"show-hide"})],Vt.prototype,"showHide",void 0);Qo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Qo([p({type:String,attribute:!1})],Vt.prototype,"marker",void 0);var Wh=[{tag:"qti-simple-choice",ctor:Vt}];var Qh=[...Ah,..._h,...Rh,...Mh,...Nh,...Lh,...zh,...Fh,...Uh,...Wh];var Gm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};function Xm(o,t,e,n,i={}){let r=i.publishWidth??!0,s=i.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")}),i.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),r&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),n.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),r&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Nl=(o,t,e,n='slot[part="drags"]')=>{class i 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&&(Xm(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 Gm([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Kt,AbortSignal:$l,WeakMap:Ym,WeakRef:Jm,Window:Gh,reportError:Go=console.log}=globalThis,ze=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||ze(o.defaultView.parent.document)),xn=()=>!!Gh&&globalThis instanceof Gh,Ll=Symbol("unset"),[Xh,Km]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((y,w)=>(x=y,u=w)),resolve:x,reject:u}};function n(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new Ym,r={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(r);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let y=n(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return n(x,g)}let l="any"in $l?$l.any.bind($l):x=>{let u=new Kt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){i.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Go(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(xn()&&!ze(document))return;try{y()}catch(w){Go(w)}}}}function f(x,u,g={}){if(xn()&&!ze(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let w=i.get(x),I=w.weakSubscriber?.deref();if(I?.active){let k=I,S=i.get(k);S.observers.add(y),g.signal&&(g.signal.aborted?S.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=i.get(k);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(k,g.signal.reason))}));return}let A=new m(y);if(w.weakSubscriber=new Jm(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=i.get(A);k?.active&&(k.observers.delete(y),k.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(k){A.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Kt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||xn()&&!ze(document))return;let y=new Set(g.observers);for(let w of y)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Go(u);return}if(xn()&&!ze(document))return;h(this,u);let y=new Set(g.observers);for(let w of y)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||xn()&&!ze(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(xn()&&!ze(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Kt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(A,k){if(A.signal.aborted)return;let S;try{let R=k.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(z){A.error(z);return}if(w){A.complete();return}let N;try{N=R.value}catch(z){A.error(z);return}A.next(N),I(A,k)},R=>{A.error(R)})},w=!1;return new v(A=>{if(A.signal.aborted)return;let k;try{k=a(u,!0)}catch(R){A.error(R);return}let S=k;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let I;try{I=a(u,!1)}catch(S){w.error(S);return}let A=!1,k=I;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||A)return;let S=k.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=k.next();if({done:A}=S,A){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(I=>{w.next(I),w.complete()},I=>{w.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,y=v.from(u);return new v(w=>{let I=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(y,I,A),!w.active)return;let k=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,k,A)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,y.next(S)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}inspect(u={}){let g=null,y=null,w=null,I=null,A=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(w=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(A=u.abort));let k=this;return new v(S=>{if(g!==null)try{g()}catch($){S.error($);return}let R=()=>{try{A!==null&&A(S.signal.reason)}catch($){Go($)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next($){if(y!==null)try{y($)}catch(ut){S.signal.removeEventListener("abort",R),S.error(ut);return}S.next($)},error($){if(S.signal.removeEventListener("abort",R),w!==null)try{w($)}catch(ut){S.error(ut);return}S.error($)},complete(){if(S.signal.removeEventListener("abort",R),I!==null)try{I()}catch($){S.error($);return}S.complete()}}),z={signal:S.signal};f(k,N,z)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S=!1;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,S&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u;if(w==0)return y.complete();let I=new d({next(k){y.next(k),w-=1,w==0&&y.complete()},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u,I=new d({next(k){if(w>0)return w-=1;w==0&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=[];function k(z){let $;try{$=u(z,w)}catch(ee){return y.error(ee)}w+=1;let ut;try{ut=v.from($)}catch(ee){return y.error(ee)}let Ra=new d({next(ee){y.next(ee)},error(ee){y.error(ee)},complete(){if(A.length){let ee=A.shift();k(ee)}else S=!1,I&&y.complete()}}),Ut={signal:y.signal};f(ut,Ra,Ut)}let S=!1,R=new d({next(z){S?A.push(z):(S=!0,k(z))},error(z){y.error(z)},complete(){I=!0,!S&&!A.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=null;function k(N){let z;try{z=u(N,w)}catch(Ut){return y.error(Ut)}w+=1;let $;try{$=v.from(z)}catch(Ut){return y.error(Ut)}let ut=new d({next(Ut){y.next(Ut)},error(Ut){y.error(Ut)},complete(Ut){I?y.complete():A=null}}),Ra={signal:c([A.signal,y.signal])};f($,ut,Ra)}let S=new d({next(N){A&&A.abort(),A=new Kt,k(N)},error(N){y.error(N)},complete(){I=!0,A||y.complete()}}),R={signal:y.signal};f(g,S,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let I=new d({next(k){w.next(k)},error(k){let S;try{S=u(k)}catch($){w.error($);return}let R;try{R=v.from(S)}catch($){w.error($);return}let N=new d({next($){w.next($)},error($){w.error($)},complete(){w.complete()}}),z={signal:w.signal};f(R,N,z)},complete(){w.complete()}}),A={signal:w.signal};f(g,I,A)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{y.addTeardown(u);let w=new d({next(A){y.next(A)},error(A){y.error(A)},complete(){y.complete()}}),I={signal:y.signal};f(g,w,I)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=[],A=new d({next(k){I.push(k)},error(k){w(k)},complete(){y(I)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(z){I(z),A.abort(z)}S+=1},error(N){I(N)},complete(){w()}});return f(this,R,k),y}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){I($),A.abort($)}S+=1,z||(w(!1),A.abort())},error(N){I(N)},complete(){w(!0)}});return f(this,R,k),y}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e(),I=new Kt,A={signal:c([I.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let k=new d({next(S){y(S),I.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,k,A),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=null,A=!1,k=new d({next(S){A=!0,I=S},error(S){w(S)},complete(){A?y(I):w(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){I($),A.abort($)}S+=1,z&&(w(N),A.abort())},error(N){I(N)},complete(){w()}});return f(this,R,k),y}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){I($),A.abort($)}S+=1,z&&(w(!0),A.abort())},error(N){I(N)},complete(){w(!1)}});return f(this,R,k),y}reduce(u,g,y={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:I,reject:A}=e(),k=new Kt,S={signal:c([k.signal,y.signal])};if(S.signal.aborted)return A(S.signal.reason),w;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Ll,z=new d({next($){if(N===Ll){N=$,R++;return}try{let ut=u(N,$,R);R++,N=ut}catch(ut){A(ut),k.abort(ut);return}},error($){A($)},complete(){N!==Ll?I(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,z,S),w}}return o(v.prototype,"subscribe"),[v,m]})();function Yh(){return typeof globalThis.Observable=="function"}function Jh(){Object.defineProperties(globalThis,{Observable:{value:Xh,configurable:!0,writable:!0},Subscriber:{value:Km,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(xn()&&!ze(document))return;let e=this;return new Xh(n=>{if(!e||n.signal.aborted)return;let i=r=>{n.next(r)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:n.signal})})}}function Vl(o,t,e){let n=o.filter(i=>!i.hasAttribute("disabled"));for(let i of n){let r=i.getBoundingClientRect();if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return i}return null}function Kh(o,t,e,n){if(!n)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),r=n.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(r.right<a.left||r.left>a.right||r.bottom<a.top||r.top>a.bottom))return s}return null}function Zh(o,t,e,n){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let r,s;if(n){let c=n.getBoundingClientRect();r=c.left+c.width/2,s=c.top+c.height/2}else r=t,s=e;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(r-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function tp(o,t,e,n){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let r;if(n){let l=n.getBoundingClientRect();r=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else r=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let v of r)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function Zm(o,t,e){let n=o.getBoundingClientRect();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}function tf(o,t,e,n,i){let r=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!r.includes(g));if(r.length===0&&a.length===0)return null;let l;if(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 y=g.getBoundingClientRect(),w=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],I=0,A=0;for(let k of l)for(let S of w){let R=Math.sqrt(Math.pow(k.x-S.x,2)+Math.pow(k.y-S.y,2));I+=R,A++}return I/A},d=null,h=1/0;for(let g of r){let y=c(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=c(g);y<m&&(m=y,f=g)}if(d&&n){let g=n.getBoundingClientRect(),y=d.getBoundingClientRect(),w=g.left+g.width/2,I=g.top+g.height/2;if(w>=y.left&&w<=y.right&&I>=y.top&&I<=y.bottom)return d}if(f&&Zm(f,t,e))return f;let x=n?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function ep(o){switch(o){case"pointerWithin":return Vl;case"rectangleIntersection":return Kh;case"closestCenter":return Zh;case"closestCorners":return tp;case"closestCornersWithInventoryPriority":return tf;default:return Vl}}function ei(o,t,e,n,i="pointerWithin",r){return ep(i)(o,t,e,n,r)}function je(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 i=n.closest(t)||n.closest('[qti-draggable="true"]');if(i)return i}return null}function mr(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var zl=o=>o?.internals;function zt(o,t,e){let n=zl(o)?.states;n&&(e?n.add(t):n.delete(t))}function Xo(o,t){return zl(o)?.states?.has(t)??!1}function fr(o){zt(o,"dragging",!1),zt(o,"placeholder",!1),zt(o,"return-anchor",!1)}function qn(o){return Xo(o,"dragging")||Xo(o,"placeholder")}function ue(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let n=zl(o)?.states;if(n){e?n.add(t):n.delete(t);return}let i=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(e?i.add(t):i.delete(t),o.setAttribute("part",[...i].join(" ")))}function ni(o,t){ue(o,"filled",t)}function ii(o,t){let e=[];return o.forEach(n=>{let i=[];n.tagName.toLowerCase()==="slot"?i=n.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(n.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function np(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let n=e.getAttribute("match-max");return n?parseInt(n,10)||0:1}var jl={origin:{x:0,y:0},scale:{x:1,y:1}},Yo=100,ef=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},nf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},rf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Fl=(o,t)=>{let e=o.ownerDocument??document,n=t??e.body,i=ef(e);return i&&!rf(i,n)?nf(i):n},Bl=(o,t=1)=>{let n=(o.ownerDocument??document).createElement("div");n.style.cssText=`position:fixed;left:0;top:0;width:${Yo}px;height:${Yo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(n);let i=n.getBoundingClientRect();return n.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/Yo||1)*t,y:(i.height/Yo||1)*t}}},ip=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Yh()||Jh();var rp=new WeakSet;function of(o){!o||rp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),rp.add(o))}var op=o=>!!o.internals?.states,Jo=(o,t,e,n='slot[part="drags"]',i="pointerWithin")=>{class r extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=jl,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!==Pn)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}),of(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=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));let x=a(n,this),u=a(n,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),I=g?y:new Set,A=g?w:new Set,k=new Set([...y,...w].filter(op));for(let S of this.#t)k.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of k){let R=I.has(S),N=!R&&A.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=k,this.trackedDraggables.forEach(S=>{let R=qn(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let v=je(m,t),x=this.disabled||this.readonly,u=mr(v)||qn(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=je(m,t);if(!v){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let v=je(m,t),x=this.disabled||this.readonly,u=mr(v)||qn(v),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=je(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=je(m,t),x=this.disabled||this.readonly,u=mr(v)||qn(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=je(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let v=this.trackedDraggables.filter(u=>!qn(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=je(m,t),g=this.disabled||this.readonly,y=mr(u)||qn(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let v=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(y=>y.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let w=ii(this.trackedDragContainers,y);w.forEach(I=>zt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),zt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.setPointerCapture&&w.setPointerCapture(I)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),v=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=ei(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=>ue(m,"hover",!1)),c&&ue(c,"hover",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let v=l.getBoundingClientRect();h=ei(this.allDropzones,v.left+v.width/2,v.top+v.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),zt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{zt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){fr(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}let h=Fl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Bl(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.style.opacity="0.8",c.removeAttribute("qti-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=ip(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=Fl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Bl(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=>{ue(a,"enabled",!0),ue(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ue(a,"enabled",!1),ue(a,"active",!1),ue(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{zt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=jl,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)op(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return r};var sp={duration:250,easing:"ease",fill:"both"};function Ul(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function ap(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Fe(o){let t=new Map;return o.forEach(e=>{t.set(e,Ul(e))}),t}function lp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Ko(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 Hl(o){return Ko(o)>0}function Zo(o,t,e={}){let n=Ko(o);if(n<=0)return null;let i=Ul(o),{deltaX:r,deltaY:s,deltaW:a,deltaH:l}=lp(t,i);if(r===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...sp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${r}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*n,easing:d,fill:h})}function Be(o,t={}){let e=new Map;return o.forEach((n,i)=>{if(!(i instanceof HTMLElement))return;let r=Zo(i,n,t);r&&e.set(i,r)}),e}var gr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},jt=(o,t,e,n='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let r=Nl(o,t,e,n),s=Jo(r,t,e,n,i);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&&ni(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()),ni(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Hl(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(Xo(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{Zo(c,ap(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){fr(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=ii(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let I=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Fe(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let A=I.getAttribute("identifier"),k=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,I),ni(R,!0),this.animateReturn(I,k)):A&&this.restoreOriginalInInventory(A,k)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),ni(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Be(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),A=h.left-I.left,k=h.top-I.top;(A!==0||k!==0)&&y.animate([{transform:`translate(${A}px, ${k}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&ni(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=ii(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?Fe(m):null;h.forEach(x=>{fr(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&Be(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=ii(this.trackedDragContainers,c),h=np(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===c).length:m+v.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{zt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",v=!0;h?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):f?(m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return gr([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),gr([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),gr([U({context:Le})],a.prototype,"_dragDrop",void 0),gr([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),gr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var ts=class{getInsertPosition(t,e,n,i,r){let s=t.indexOf(n);if(s===-1)return null;let a=n.getBoundingClientRect(),l=(r-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var cp=new ts;var sf={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function br(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function es(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function ns(o,t,e={}){let n={...sf,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${n.borderStyle} ${n.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=n.background,i.style.transition=`transform ${n.transitionDuration*Ko(o)}ms ease`,i.style.pointerEvents="none",i}function Wl(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ft=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#n=br(),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(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return Wl(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let r=this.#c(i);return r===0||r>1}#c(i){let r=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(r)?1:r}#p(i){return i.querySelectorAll(t).length}#l(i){let r=this.#c(i);return r===0?!1:this.#p(i)>=r}#m(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let r=this.#s(i);if(!r){this.#n.placeholder&&i.appendChild(this.#n.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),this.#i.hoveredSlot=null;return}this.#n.placeholder&&i.appendChild(this.#n.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#n.placeholder?.parentElement&&this.#n.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=Fe([r]);this.#i.originalPositions.set(r,i),this.#n.placeholder&&this.#n.placeholder.parentElement&&this.#n.placeholder.remove(),this.#t.appendChild(r),this.#n.placeholder&&i.appendChild(this.#n.placeholder),this.#i.hoveredSlot=i,Be(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),r=i.length>0?Fe(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),r&&Be(r,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,r,s,a,...l){this.#t=null,this.#n=br(),this.#m();let c=this.findContainingDroppable(i);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#n.sortContainer=c;let h=i.getBoundingClientRect();this.#n.placeholder=ns(i,h,this.sortablePlaceholderConfig);let f=i.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(i,r,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[r,s]of this.#i.originalPositions)s.appendChild(r);this.#n.placeholder&&this.#n.placeholder.remove(),es(this.#n),this.#r.clear(),this.#t=null,this.#m()}onSortableDragMove(i,r){if(!this.isDraggingFromSlot)return;let s=ei(this.trackedDroppables,i,r,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#u()}handleDragMove(i,r){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,r),this.onSortableDragMove(i,r)}allowDrop(i,r){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&r!==this.#e&&this.trackedDroppables.includes(r)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(r)?this.#a(r)?!this.#l(r):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(r)?!0:super.allowDrop(i,r)}handleDrop(i,r){super.handleDrop(i,r),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var dp=[O,W,Qt,q`
7053
+ <slot part="label"></slot>`}};Go([p({type:String,attribute:"template-identifier"})],zt.prototype,"templateIdentifier",void 0);Go([p({type:String,attribute:"show-hide"})],zt.prototype,"showHide",void 0);Go([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],zt.prototype,"fixed",void 0);Go([p({type:String,attribute:!1})],zt.prototype,"marker",void 0);var Qh=[{tag:"qti-simple-choice",ctor:zt}];var Gh=[...Ih,...Th,...Oh,...Dh,...$h,...Vh,...jh,...Bh,...Hh,...Qh];var Xm=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r};function Ym(o,t,e,n,i={}){let r=i.publishWidth??!0,s=i.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")}),i.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),r&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),n.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),r&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var $l=(o,t,e,n='slot[part="drags"]')=>{class i 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&&(Ym(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 Xm([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Zt,AbortSignal:Ll,WeakMap:Jm,WeakRef:Km,Window:Xh,reportError:Xo=console.log}=globalThis,ze=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||ze(o.defaultView.parent.document)),xn=()=>!!Xh&&globalThis instanceof Xh,Vl=Symbol("unset"),[Yh,Zm]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((y,w)=>(x=y,u=w)),resolve:x,reject:u}};function n(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new Jm,r={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(r);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let y=n(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return n(x,g)}let l="any"in Ll?Ll.any.bind(Ll):x=>{let u=new Zt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){i.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Xo(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(xn()&&!ze(document))return;try{y()}catch(w){Xo(w)}}}}function f(x,u,g={}){if(xn()&&!ze(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let w=i.get(x),I=w.weakSubscriber?.deref();if(I?.active){let k=I,S=i.get(k);S.observers.add(y),g.signal&&(g.signal.aborted?S.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=i.get(k);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(k,g.signal.reason))}));return}let A=new m(y);if(w.weakSubscriber=new Km(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=i.get(A);k?.active&&(k.observers.delete(y),k.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(k){A.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Zt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||xn()&&!ze(document))return;let y=new Set(g.observers);for(let w of y)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Xo(u);return}if(xn()&&!ze(document))return;h(this,u);let y=new Set(g.observers);for(let w of y)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||xn()&&!ze(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(xn()&&!ze(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Zt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(A,k){if(A.signal.aborted)return;let S;try{let R=k.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(z){A.error(z);return}if(w){A.complete();return}let N;try{N=R.value}catch(z){A.error(z);return}A.next(N),I(A,k)},R=>{A.error(R)})},w=!1;return new v(A=>{if(A.signal.aborted)return;let k;try{k=a(u,!0)}catch(R){A.error(R);return}let S=k;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let I;try{I=a(u,!1)}catch(S){w.error(S);return}let A=!1,k=I;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||A)return;let S=k.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=k.next();if({done:A}=S,A){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(I=>{w.next(I),w.complete()},I=>{w.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,y=v.from(u);return new v(w=>{let I=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(y,I,A),!w.active)return;let k=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,k,A)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,y.next(S)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}inspect(u={}){let g=null,y=null,w=null,I=null,A=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(w=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(A=u.abort));let k=this;return new v(S=>{if(g!==null)try{g()}catch($){S.error($);return}let R=()=>{try{A!==null&&A(S.signal.reason)}catch($){Xo($)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next($){if(y!==null)try{y($)}catch(ut){S.signal.removeEventListener("abort",R),S.error(ut);return}S.next($)},error($){if(S.signal.removeEventListener("abort",R),w!==null)try{w($)}catch(ut){S.error(ut);return}S.error($)},complete(){if(S.signal.removeEventListener("abort",R),I!==null)try{I()}catch($){S.error($);return}S.complete()}}),z={signal:S.signal};f(k,N,z)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S=!1;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,S&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u;if(w==0)return y.complete();let I=new d({next(k){y.next(k),w-=1,w==0&&y.complete()},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u,I=new d({next(k){if(w>0)return w-=1;w==0&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=[];function k(z){let $;try{$=u(z,w)}catch(ne){return y.error(ne)}w+=1;let ut;try{ut=v.from($)}catch(ne){return y.error(ne)}let Oa=new d({next(ne){y.next(ne)},error(ne){y.error(ne)},complete(){if(A.length){let ne=A.shift();k(ne)}else S=!1,I&&y.complete()}}),Ht={signal:y.signal};f(ut,Oa,Ht)}let S=!1,R=new d({next(z){S?A.push(z):(S=!0,k(z))},error(z){y.error(z)},complete(){I=!0,!S&&!A.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=null;function k(N){let z;try{z=u(N,w)}catch(Ht){return y.error(Ht)}w+=1;let $;try{$=v.from(z)}catch(Ht){return y.error(Ht)}let ut=new d({next(Ht){y.next(Ht)},error(Ht){y.error(Ht)},complete(Ht){I?y.complete():A=null}}),Oa={signal:c([A.signal,y.signal])};f($,ut,Oa)}let S=new d({next(N){A&&A.abort(),A=new Zt,k(N)},error(N){y.error(N)},complete(){I=!0,A||y.complete()}}),R={signal:y.signal};f(g,S,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let I=new d({next(k){w.next(k)},error(k){let S;try{S=u(k)}catch($){w.error($);return}let R;try{R=v.from(S)}catch($){w.error($);return}let N=new d({next($){w.next($)},error($){w.error($)},complete(){w.complete()}}),z={signal:w.signal};f(R,N,z)},complete(){w.complete()}}),A={signal:w.signal};f(g,I,A)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{y.addTeardown(u);let w=new d({next(A){y.next(A)},error(A){y.error(A)},complete(){y.complete()}}),I={signal:y.signal};f(g,w,I)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=[],A=new d({next(k){I.push(k)},error(k){w(k)},complete(){y(I)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(z){I(z),A.abort(z)}S+=1},error(N){I(N)},complete(){w()}});return f(this,R,k),y}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){I($),A.abort($)}S+=1,z||(w(!1),A.abort())},error(N){I(N)},complete(){w(!0)}});return f(this,R,k),y}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e(),I=new Zt,A={signal:c([I.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let k=new d({next(S){y(S),I.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,k,A),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=null,A=!1,k=new d({next(S){A=!0,I=S},error(S){w(S)},complete(){A?y(I):w(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){I($),A.abort($)}S+=1,z&&(w(N),A.abort())},error(N){I(N)},complete(){w()}});return f(this,R,k),y}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Zt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let z=!1;try{z=u(N,S)}catch($){I($),A.abort($)}S+=1,z&&(w(!0),A.abort())},error(N){I(N)},complete(){w(!1)}});return f(this,R,k),y}reduce(u,g,y={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:I,reject:A}=e(),k=new Zt,S={signal:c([k.signal,y.signal])};if(S.signal.aborted)return A(S.signal.reason),w;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Vl,z=new d({next($){if(N===Vl){N=$,R++;return}try{let ut=u(N,$,R);R++,N=ut}catch(ut){A(ut),k.abort(ut);return}},error($){A($)},complete(){N!==Vl?I(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,z,S),w}}return o(v.prototype,"subscribe"),[v,m]})();function Jh(){return typeof globalThis.Observable=="function"}function Kh(){Object.defineProperties(globalThis,{Observable:{value:Yh,configurable:!0,writable:!0},Subscriber:{value:Zm,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(xn()&&!ze(document))return;let e=this;return new Yh(n=>{if(!e||n.signal.aborted)return;let i=r=>{n.next(r)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:n.signal})})}}function zl(o,t,e){let n=o.filter(i=>!i.hasAttribute("disabled"));for(let i of n){let r=i.getBoundingClientRect();if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return i}return null}function Zh(o,t,e,n){if(!n)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),r=n.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(r.right<a.left||r.left>a.right||r.bottom<a.top||r.top>a.bottom))return s}return null}function tp(o,t,e,n){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let r,s;if(n){let c=n.getBoundingClientRect();r=c.left+c.width/2,s=c.top+c.height/2}else r=t,s=e;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(r-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function ep(o,t,e,n){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let r;if(n){let l=n.getBoundingClientRect();r=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else r=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let v of r)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function tf(o,t,e){let n=o.getBoundingClientRect();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}function ef(o,t,e,n,i){let r=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!r.includes(g));if(r.length===0&&a.length===0)return null;let l;if(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 y=g.getBoundingClientRect(),w=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],I=0,A=0;for(let k of l)for(let S of w){let R=Math.sqrt(Math.pow(k.x-S.x,2)+Math.pow(k.y-S.y,2));I+=R,A++}return I/A},d=null,h=1/0;for(let g of r){let y=c(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=c(g);y<m&&(m=y,f=g)}if(d&&n){let g=n.getBoundingClientRect(),y=d.getBoundingClientRect(),w=g.left+g.width/2,I=g.top+g.height/2;if(w>=y.left&&w<=y.right&&I>=y.top&&I<=y.bottom)return d}if(f&&tf(f,t,e))return f;let x=n?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function np(o){switch(o){case"pointerWithin":return zl;case"rectangleIntersection":return Zh;case"closestCenter":return tp;case"closestCorners":return ep;case"closestCornersWithInventoryPriority":return ef;default:return zl}}function ei(o,t,e,n,i="pointerWithin",r){return np(i)(o,t,e,n,r)}function je(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 i=n.closest(t)||n.closest('[qti-draggable="true"]');if(i)return i}return null}function mr(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var jl=o=>o?.internals;function jt(o,t,e){let n=jl(o)?.states;n&&(e?n.add(t):n.delete(t))}function Yo(o,t){return jl(o)?.states?.has(t)??!1}function fr(o){jt(o,"dragging",!1),jt(o,"placeholder",!1),jt(o,"return-anchor",!1)}function qn(o){return Yo(o,"dragging")||Yo(o,"placeholder")}function ue(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let n=jl(o)?.states;if(n){e?n.add(t):n.delete(t);return}let i=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(e?i.add(t):i.delete(t),o.setAttribute("part",[...i].join(" ")))}function ni(o,t){ue(o,"filled",t)}function ii(o,t){let e=[];return o.forEach(n=>{let i=[];n.tagName.toLowerCase()==="slot"?i=n.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(n.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function ip(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let n=e.getAttribute("match-max");return n?parseInt(n,10)||0:1}var Fl={origin:{x:0,y:0},scale:{x:1,y:1}},Jo=100,nf=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},rf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},of=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Bl=(o,t)=>{let e=o.ownerDocument??document,n=t??e.body,i=nf(e);return i&&!of(i,n)?rf(i):n},Ul=(o,t=1)=>{let n=(o.ownerDocument??document).createElement("div");n.style.cssText=`position:fixed;left:0;top:0;width:${Jo}px;height:${Jo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(n);let i=n.getBoundingClientRect();return n.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/Jo||1)*t,y:(i.height/Jo||1)*t}}},rp=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Jh()||Kh();var op=new WeakSet;function sf(o){!o||op.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),op.add(o))}var sp=o=>!!o.internals?.states,Ko=(o,t,e,n='slot[part="drags"]',i="pointerWithin")=>{class r extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Fl,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!==Pn)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}),sf(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=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));let x=a(n,this),u=a(n,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),I=g?y:new Set,A=g?w:new Set,k=new Set([...y,...w].filter(sp));for(let S of this.#t)k.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of k){let R=I.has(S),N=!R&&A.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=k,this.trackedDraggables.forEach(S=>{let R=qn(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let v=je(m,t),x=this.disabled||this.readonly,u=mr(v)||qn(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=je(m,t);if(!v){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let v=je(m,t),x=this.disabled||this.readonly,u=mr(v)||qn(v),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=je(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=je(m,t),x=this.disabled||this.readonly,u=mr(v)||qn(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=je(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let v=this.trackedDraggables.filter(u=>!qn(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=je(m,t),g=this.disabled||this.readonly,y=mr(u)||qn(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let v=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(y=>y.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let w=ii(this.trackedDragContainers,y);w.forEach(I=>jt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),jt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.setPointerCapture&&w.setPointerCapture(I)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),v=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=ei(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=>ue(m,"hover",!1)),c&&ue(c,"hover",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let v=l.getBoundingClientRect();h=ei(this.allDropzones,v.left+v.width/2,v.top+v.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),jt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{jt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){fr(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}let h=Bl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Ul(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.style.opacity="0.8",c.removeAttribute("qti-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=rp(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=Bl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Ul(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=>{ue(a,"enabled",!0),ue(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ue(a,"enabled",!1),ue(a,"active",!1),ue(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{jt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Fl,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)sp(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return r};var ap={duration:250,easing:"ease",fill:"both"};function Hl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function lp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Fe(o){let t=new Map;return o.forEach(e=>{t.set(e,Hl(e))}),t}function cp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Zo(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Wl(o){return Zo(o)>0}function ts(o,t,e={}){let n=Zo(o);if(n<=0)return null;let i=Hl(o),{deltaX:r,deltaY:s,deltaW:a,deltaH:l}=cp(t,i);if(r===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...ap,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${r}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*n,easing:d,fill:h})}function Be(o,t={}){let e=new Map;return o.forEach((n,i)=>{if(!(i instanceof HTMLElement))return;let r=ts(i,n,t);r&&e.set(i,r)}),e}var gr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ft=(o,t,e,n='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let r=$l(o,t,e,n),s=Ko(r,t,e,n,i);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&&ni(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()),ni(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Wl(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(Yo(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{ts(c,lp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){fr(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=ii(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let I=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Fe(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let A=I.getAttribute("identifier"),k=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,I),ni(R,!0),this.animateReturn(I,k)):A&&this.restoreOriginalInInventory(A,k)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),ni(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Be(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),A=h.left-I.left,k=h.top-I.top;(A!==0||k!==0)&&y.animate([{transform:`translate(${A}px, ${k}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&ni(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=ii(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?Fe(m):null;h.forEach(x=>{fr(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&Be(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=ii(this.trackedDragContainers,c),h=ip(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===c).length:m+v.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{jt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",v=!0;h?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):f?(m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return gr([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),gr([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),gr([U({context:Le})],a.prototype,"_dragDrop",void 0),gr([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),gr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Yt({emptyAs:[]})})],a.prototype,"response",null),a};var es=class{getInsertPosition(t,e,n,i,r){let s=t.indexOf(n);if(s===-1)return null;let a=n.getBoundingClientRect(),l=(r-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var dp=new es;var af={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function br(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function ns(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function is(o,t,e={}){let n={...af,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${n.borderStyle} ${n.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=n.background,i.style.transition=`transform ${n.transitionDuration*Zo(o)}ms ease`,i.style.pointerEvents="none",i}function Ql(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Bt=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#n=br(),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(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return Ql(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let r=this.#c(i);return r===0||r>1}#c(i){let r=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(r)?1:r}#p(i){return i.querySelectorAll(t).length}#l(i){let r=this.#c(i);return r===0?!1:this.#p(i)>=r}#m(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let r=this.#s(i);if(!r){this.#n.placeholder&&i.appendChild(this.#n.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),this.#i.hoveredSlot=null;return}this.#n.placeholder&&i.appendChild(this.#n.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#n.placeholder?.parentElement&&this.#n.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=Fe([r]);this.#i.originalPositions.set(r,i),this.#n.placeholder&&this.#n.placeholder.parentElement&&this.#n.placeholder.remove(),this.#t.appendChild(r),this.#n.placeholder&&i.appendChild(this.#n.placeholder),this.#i.hoveredSlot=i,Be(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),r=i.length>0?Fe(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),r&&Be(r,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,r,s,a,...l){this.#t=null,this.#n=br(),this.#m();let c=this.findContainingDroppable(i);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#n.sortContainer=c;let h=i.getBoundingClientRect();this.#n.placeholder=is(i,h,this.sortablePlaceholderConfig);let f=i.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(i,r,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[r,s]of this.#i.originalPositions)s.appendChild(r);this.#n.placeholder&&this.#n.placeholder.remove(),ns(this.#n),this.#r.clear(),this.#t=null,this.#m()}onSortableDragMove(i,r){if(!this.isDraggingFromSlot)return;let s=ei(this.trackedDroppables,i,r,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#u()}handleDragMove(i,r){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,r),this.onSortableDragMove(i,r)}allowDrop(i,r){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&r!==this.#e&&this.trackedDroppables.includes(r)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(r)?this.#a(r)?!this.#l(r):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(r)?!0:super.allowDrop(i,r)}handleDrop(i,r){super.handleDrop(i,r),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var hp=[O,W,Gt,q`
7054
7054
  :host {
7055
7055
  display: block; /* necessary to calculate scaling position */
7056
7056
  }
@@ -7103,7 +7103,7 @@ div.full-correct-response-inline {
7103
7103
  :host([answer-key]) ::slotted(qti-simple-associable-choice) {
7104
7104
  display: none;
7105
7105
  }
7106
- `];var pf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},uf=jt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Cn=class extends Ft(uf,'[qti-draggable="true"]'){static{this.styles=dp}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}>
7106
+ `];var uf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},mf=Ft(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Cn=class extends Bt(mf,'[qti-draggable="true"]'){static{this.styles=hp}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}>
7107
7107
  ${Q(n,i=>i.getAttribute("identifier"),i=>i)}
7108
7108
  </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"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),r=n&&this.chipsIn(n)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");r&&s&&t.push(`${r} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,n)=>{let i=e.split(" ");return i.length!==2?[]:[`${i[0]} droplist${n}_left`,`${i[1]} droplist${n}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
7109
7109
  <slot part="drags" name="qti-simple-associable-choice"></slot>
@@ -7114,7 +7114,7 @@ div.full-correct-response-inline {
7114
7114
  </div>`)}
7115
7115
 
7116
7116
  <div role="alert" part="message" id="validation-message"></div>
7117
- </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};pf([T()],Cn.prototype,"_childrenMap",void 0);var is=[{tag:"qti-associate-interaction",ctor:Cn}];var Ue=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},He=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,r)=>{this._choiceElements.forEach(s=>s.disabled=r)},this._handleReadonlyChange=(i,r)=>{this._choiceElements.forEach(s=>s.readonly=r)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,r){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}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 i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let r=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>r.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!r.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let r=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&r>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):r<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let r=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&r&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,r){i.internals?.states&&(r?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let r=this._getChoiceChecked(i);this._setChoiceChecked(i,!r)}_handleChoiceSelection(){let r=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?r[0]||"":r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(r=>{let s=i.includes(r.identifier);this._setChoiceChecked(r,s)})}}return Ue([On("#validation-message")],e.prototype,"_validationMessageElement",void 0),Ue([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Ue([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Ue([L("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Ue([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Ue([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Ue([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:""})})],e.prototype,"response",void 0),Ue([L("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var mf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hp=(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(i){this.#t=this.#r(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,r,s){super.attributeChangedCallback(i,r,s),i==="class"&&r!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(r=>r.type==="childList"||r.type==="attributes"&&r.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(i){return i?i.split(/\s+/).map(r=>r.trim()).filter(Boolean).filter((r,s,a)=>a.indexOf(r)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),r=this.#s(i),s=this.#a(),a=this.#c();r.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(i){return i.map((r,s)=>{let a=Number(r.style.order);return{el:r,order:Number.isFinite(a)?a:s+1,index:s}}).sort((r,s)=>r.order-s.order||r.index-s.index).map(r=>r.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#n.includes(i)).pop()??null}#p(i,r,s){let a=r;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${i}`;break;case"qti-labels-lower-alpha":l=this.#l(i,"lower");break;case"qti-labels-upper-alpha":l=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(i,r){let s=i,a="",l=r==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return mf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var pp=[O,W,q`
7117
+ </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};uf([T()],Cn.prototype,"_childrenMap",void 0);var rs=[{tag:"qti-associate-interaction",ctor:Cn}];var Ue=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},He=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,r)=>{this._choiceElements.forEach(s=>s.disabled=r)},this._handleReadonlyChange=(i,r)=>{this._choiceElements.forEach(s=>s.readonly=r)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,r){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}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 i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let r=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>r.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!r.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let r=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&r>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):r<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let r=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&r&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,r){i.internals?.states&&(r?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let r=this._getChoiceChecked(i);this._setChoiceChecked(i,!r)}_handleChoiceSelection(){let r=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?r[0]||"":r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(r=>{let s=i.includes(r.identifier);this._setChoiceChecked(r,s)})}}return Ue([On("#validation-message")],e.prototype,"_validationMessageElement",void 0),Ue([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Ue([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Ue([L("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Ue([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Ue([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Ue([p({attribute:"response",reflect:!1,converter:Yt({emptyAs:""})})],e.prototype,"response",void 0),Ue([L("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var ff=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pp=(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(i){this.#t=this.#r(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,r,s){super.attributeChangedCallback(i,r,s),i==="class"&&r!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(r=>r.type==="childList"||r.type==="attributes"&&r.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(i){return i?i.split(/\s+/).map(r=>r.trim()).filter(Boolean).filter((r,s,a)=>a.indexOf(r)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),r=this.#s(i),s=this.#a(),a=this.#c();r.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(i){return i.map((r,s)=>{let a=Number(r.style.order);return{el:r,order:Number.isFinite(a)?a:s+1,index:s}}).sort((r,s)=>r.order-s.order||r.index-s.index).map(r=>r.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#n.includes(i)).pop()??null}#p(i,r,s){let a=r;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${i}`;break;case"qti-labels-lower-alpha":l=this.#l(i,"lower");break;case"qti-labels-upper-alpha":l=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(i,r){let s=i,a="",l=r==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return ff([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var up=[O,W,q`
7118
7118
  :host {
7119
7119
  display: block;
7120
7120
  }
@@ -7181,16 +7181,16 @@ div.full-correct-response-inline {
7181
7181
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
7182
7182
  grid-row: auto;
7183
7183
  }
7184
- `];var ff=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Sn=class extends hp(He(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=pp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
7184
+ `];var gf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Sn=class extends pp(He(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=up}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
7185
7185
  <slot part="prompt" name="prompt"></slot>
7186
7186
  <slot part="slot" @slotchange=${this.#t}></slot>
7187
7187
  <div part="message" role="alert" id="validation-message"></div>
7188
- `}};ff([p({type:String})],Sn.prototype,"orientation",void 0);var rs=[{tag:"qti-choice-interaction",ctor:Sn}];var up=[O,q`
7188
+ `}};gf([p({type:String})],Sn.prototype,"orientation",void 0);var os=[{tag:"qti-choice-interaction",ctor:Sn}];var mp=[O,q`
7189
7189
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7190
7190
  :host {
7191
7191
  display: block;
7192
7192
  }
7193
- `];var yr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ql=`
7193
+ `];var yr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Gl=`
7194
7194
  const postToParentWindows = (type, data) => {
7195
7195
  window.top.postMessage(data ? { type, data } : { type }, '*');
7196
7196
  let w = window.parent;
@@ -7257,7 +7257,7 @@ window.CES = {
7257
7257
  },
7258
7258
  };
7259
7259
  CES.load();
7260
- `,gf=`
7260
+ `,bf=`
7261
7261
  (function() {
7262
7262
  var blobUrlReceived = null;
7263
7263
 
@@ -7301,7 +7301,7 @@ CES.load();
7301
7301
  requestBlobUrl();
7302
7302
  }
7303
7303
  })();
7304
- `,me=class extends D{#t;#e;#n;static{this.styles=up}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 i=n.getAttribute("width"),r=n.getAttribute("height");i&&this.setAttribute("width",i),r&&this.setAttribute("height",r)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:io((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],i=this.#a(),r=await this.#l(n,i),s=r.url;if(r.baseUrl&&!this.#n&&(this.#n=r.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,i,{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>"+Ql+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",v=await this.#l(m,i,{returnText:!0});if(d=v.url,v.baseUrl&&!this.#n&&(this.#n=v.baseUrl),v.text){let x=v.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+Ql+"</script>",w=x.indexOf("<head>");w!==-1?x=x.slice(0,w+6)+y+x.slice(w+6):x=y+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Ql+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let v=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(v)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${gf}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
7304
+ `,me=class extends D{#t;#e;#n;static{this.styles=mp}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 i=n.getAttribute("width"),r=n.getAttribute("height");i&&this.setAttribute("width",i),r&&this.setAttribute("height",r)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:io((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],i=this.#a(),r=await this.#l(n,i),s=r.url;if(r.baseUrl&&!this.#n&&(this.#n=r.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,i,{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>"+Gl+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",v=await this.#l(m,i,{returnText:!0});if(d=v.url,v.baseUrl&&!this.#n&&(this.#n=v.baseUrl),v.text){let x=v.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+Gl+"</script>",w=x.indexOf("<head>");w!==-1?x=x.slice(0,w+6)+y+x.slice(w+6):x=y+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Gl+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let v=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(v)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${bf}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
7305
7305
  <!DOCTYPE html>
7306
7306
  <html>
7307
7307
  <head>
@@ -7321,7 +7321,7 @@ CES.load();
7321
7321
  ${this._errorMessage&&b`<div style="color:red">
7322
7322
  <h1>Error</h1>
7323
7323
  ${this._errorMessage}
7324
- </div>`}`}#a(){let e=[this.#n,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,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 i of e){let r=new URL(i,window.location.href).toString(),s=new URL(t,r.endsWith("/")?r:`${r}/`).toString();try{let a=await fetch(s);if(a.ok){if(n.returnText){let l=await a.text();return{url:s,baseUrl:r,text:l}}return{url:s,baseUrl:r}}}catch{}}return{url:"",baseUrl:null}}};yr([p({type:String,attribute:"data"})],me.prototype,"data",void 0);yr([p({type:String,attribute:"data-base-item"})],me.prototype,"baseItemUrl",void 0);yr([p({type:String,attribute:"data-base-ref"})],me.prototype,"baseRefUrl",void 0);yr([p({type:String,attribute:"id"})],me.prototype,"id",void 0);yr([T()],me.prototype,"_errorMessage",void 0);var os=[{tag:"qti-custom-interaction",ctor:me}];var mp=[O];var ss=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},We=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=mp}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"}}))}};ss([p({type:String,attribute:"response-identifier"})],We.prototype,"responseIdentifier",void 0);ss([p({reflect:!0,type:Boolean})],We.prototype,"disabled",void 0);ss([p({type:String,attribute:"count-attempt"})],We.prototype,"countAttempt",void 0);ss([p({type:String})],We.prototype,"title",void 0);var as=[{tag:"qti-end-attempt-interaction",ctor:We}];var fp=[O,q`
7324
+ </div>`}`}#a(){let e=[this.#n,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,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 i of e){let r=new URL(i,window.location.href).toString(),s=new URL(t,r.endsWith("/")?r:`${r}/`).toString();try{let a=await fetch(s);if(a.ok){if(n.returnText){let l=await a.text();return{url:s,baseUrl:r,text:l}}return{url:s,baseUrl:r}}}catch{}}return{url:"",baseUrl:null}}};yr([p({type:String,attribute:"data"})],me.prototype,"data",void 0);yr([p({type:String,attribute:"data-base-item"})],me.prototype,"baseItemUrl",void 0);yr([p({type:String,attribute:"data-base-ref"})],me.prototype,"baseRefUrl",void 0);yr([p({type:String,attribute:"id"})],me.prototype,"id",void 0);yr([T()],me.prototype,"_errorMessage",void 0);var ss=[{tag:"qti-custom-interaction",ctor:me}];var fp=[O];var as=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},We=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=fp}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"}}))}};as([p({type:String,attribute:"response-identifier"})],We.prototype,"responseIdentifier",void 0);as([p({reflect:!0,type:Boolean})],We.prototype,"disabled",void 0);as([p({type:String,attribute:"count-attempt"})],We.prototype,"countAttempt",void 0);as([p({type:String})],We.prototype,"title",void 0);var ls=[{tag:"qti-end-attempt-interaction",ctor:We}];var gp=[O,q`
7325
7325
  /* PK: display host as block, else design will be collapsed */
7326
7326
  /* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
7327
7327
  :host {
@@ -7334,7 +7334,7 @@ CES.load();
7334
7334
  height: 100%;
7335
7335
  border: 0;
7336
7336
  }
7337
- `];var bt=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},gp=5,bf=50,bp="qti-height-lines-",yp=!1,G=class extends D{constructor(){super(...arguments),this._rows=gp,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||yp||(yp=!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=fp}_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/bf):gp}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(bp))continue;let e=parseInt(t.slice(bp.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 i=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,r=new RegExp(i);n=t.checkValidity()&&r.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
7337
+ `];var bt=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},bp=5,yf=50,yp="qti-height-lines-",vp=!1,G=class extends D{constructor(){super(...arguments),this._rows=bp,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||vp||(vp=!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=gp}_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/yf):bp}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(yp))continue;let e=parseInt(t.slice(yp.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 i=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,r=new RegExp(i);n=t.checkValidity()&&r.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
7338
7338
  part="textarea"
7339
7339
  name="${this.responseIdentifier}"
7340
7340
  spellcheck="false"
@@ -7349,7 +7349,7 @@ CES.load();
7349
7349
  ?disabled="${this.disabled}"
7350
7350
  ?readonly="${this.readonly}"
7351
7351
  .value=${this.response}
7352
- ></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};bt([T()],G.prototype,"_rows",void 0);bt([p({type:Number,attribute:"expected-length"})],G.prototype,"expectedLength",void 0);bt([p({type:Number,attribute:"expected-lines"})],G.prototype,"expectedLines",void 0);bt([p({type:String,reflect:!0})],G.prototype,"format",void 0);bt([L("format")],G.prototype,"_handleFormatChange",void 0);bt([p({type:Number,attribute:"min-strings"})],G.prototype,"minStrings",void 0);bt([p({type:String,attribute:"pattern-mask"})],G.prototype,"patternMask",void 0);bt([p({type:String,attribute:"placeholder-text"})],G.prototype,"placeholderText",void 0);bt([p({type:String,attribute:"data-patternmask-message"})],G.prototype,"dataPatternmaskMessage",void 0);bt([p({type:String,attribute:"class"})],G.prototype,"classNames",void 0);bt([L(["classNames","expectedLines","expectedLength"])],G.prototype,"_handleRowsInputChange",null);bt([p({type:String,attribute:"response",reflect:!1})],G.prototype,"response",void 0);bt([L("response",{waitUntilFirstUpdate:!0})],G.prototype,"_handleResponseChange",void 0);var ls=[{tag:"qti-extended-text-interaction",ctor:G}];var vp=[O,W,q`
7352
+ ></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};bt([T()],G.prototype,"_rows",void 0);bt([p({type:Number,attribute:"expected-length"})],G.prototype,"expectedLength",void 0);bt([p({type:Number,attribute:"expected-lines"})],G.prototype,"expectedLines",void 0);bt([p({type:String,reflect:!0})],G.prototype,"format",void 0);bt([L("format")],G.prototype,"_handleFormatChange",void 0);bt([p({type:Number,attribute:"min-strings"})],G.prototype,"minStrings",void 0);bt([p({type:String,attribute:"pattern-mask"})],G.prototype,"patternMask",void 0);bt([p({type:String,attribute:"placeholder-text"})],G.prototype,"placeholderText",void 0);bt([p({type:String,attribute:"data-patternmask-message"})],G.prototype,"dataPatternmaskMessage",void 0);bt([p({type:String,attribute:"class"})],G.prototype,"classNames",void 0);bt([L(["classNames","expectedLines","expectedLength"])],G.prototype,"_handleRowsInputChange",null);bt([p({type:String,attribute:"response",reflect:!1})],G.prototype,"response",void 0);bt([L("response",{waitUntilFirstUpdate:!0})],G.prototype,"_handleResponseChange",void 0);var cs=[{tag:"qti-extended-text-interaction",ctor:G}];var wp=[O,W,q`
7353
7353
  :host {
7354
7354
  display: flex;
7355
7355
  align-items: flex-start;
@@ -7393,10 +7393,10 @@ CES.load();
7393
7393
  :host([answer-key]) [part~='drags'] {
7394
7394
  display: none;
7395
7395
  }
7396
- `];var ri=class extends Ft(jt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=vp}render(){return b`<slot name="prompt"> </slot>
7396
+ `];var ri=class extends Bt(Ft(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=wp}render(){return b`<slot name="prompt"> </slot>
7397
7397
  <slot part="drags" name="drags"></slot>
7398
7398
  <slot part="drops"></slot>
7399
- <div role="alert" part="message" id="validation-message"></div>`}};var cs=[{tag:"qti-gap-match-interaction",ctor:ri}];function Cp(o){return o.querySelector('img, object[type^="image"]')}function wp(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 Sp=new WeakMap,xp=new WeakMap;function yf(o){let t=xp.get(o);return t||(t=new Promise(e=>{let n=o.data;if(!n){e(null);return}let i=new Image;i.onload=()=>{let r={width:i.naturalWidth,height:i.naturalHeight};if(!(r.width>0)||!(r.height>0)){e(null);return}Sp.set(o,r),e(r)},i.onerror=()=>e(null),i.src=n}),xp.set(o,t)),t}function vf(o){if(o.localName==="object")return Sp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function ds(o){let t=wp(o,"width"),e=wp(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let n=vf(o);return n?{width:t??n.width,height:e??n.height}:null}function wf(o){let t=ds(o);if(t)return Promise.resolve(t);if(o.localName==="object")return yf(o).then(()=>ds(o));let e=o;return e.complete?Promise.resolve(null):new Promise(n=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),n(ds(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function Zt(o,t,e,n){let i=ds(e);if(i){qp(o,t,i,n);return}wf(e).then(r=>{if(!r){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}qp(o,t,r,n)})}function qp(o,t,{width:e,height:n},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[r,s,a]=t,l=r/e*100,c=s/n*100,d=a/e*100,h=a/n*100;i.style.left=l-d+"%",i.style.top=c-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[r,s,a,l]=t,c=r/e*100,d=s/n*100,h=a/e*100,f=l/n*100;i.style.left=c+"%",i.style.top=d+"%",i.style.width=h-c+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[r,s,a,l]=t,c=r/e*100,d=s/n*100,h=a/e*100,f=l/n*100;i.style.left=c-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let r=[];for(let y=0;y<t.length;y+=2)r.push({x:t[y],y:t[y+1]});let s=Math.min(...r.map(y=>y.x)),a=Math.max(...r.map(y=>y.x)),l=Math.min(...r.map(y=>y.y)),c=Math.max(...r.map(y=>y.y)),d=s/e*100,h=l/n*100,f=a/e*100,m=c/n*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let v=r.map(y=>({x:(y.x-s)/(a-s)*100,y:(y.y-l)/(c-l)*100})),x=v.map(y=>`${y.x}% ${y.y}%`).join(",");i.style.clipPath=`polygon(${x})`;let u=v.map(y=>`${y.x},${y.y}`).join(" "),g=y=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${y}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var kp=[O,W,q`
7399
+ <div role="alert" part="message" id="validation-message"></div>`}};var ds=[{tag:"qti-gap-match-interaction",ctor:ri}];function Sp(o){return o.querySelector('img, object[type^="image"]')}function xp(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 kp=new WeakMap,qp=new WeakMap;function vf(o){let t=qp.get(o);return t||(t=new Promise(e=>{let n=o.data;if(!n){e(null);return}let i=new Image;i.onload=()=>{let r={width:i.naturalWidth,height:i.naturalHeight};if(!(r.width>0)||!(r.height>0)){e(null);return}kp.set(o,r),e(r)},i.onerror=()=>e(null),i.src=n}),qp.set(o,t)),t}function wf(o){if(o.localName==="object")return kp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function hs(o){let t=xp(o,"width"),e=xp(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let n=wf(o);return n?{width:t??n.width,height:e??n.height}:null}function xf(o){let t=hs(o);if(t)return Promise.resolve(t);if(o.localName==="object")return vf(o).then(()=>hs(o));let e=o;return e.complete?Promise.resolve(null):new Promise(n=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),n(hs(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function te(o,t,e,n){let i=hs(e);if(i){Cp(o,t,i,n);return}xf(e).then(r=>{if(!r){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Cp(o,t,r,n)})}function Cp(o,t,{width:e,height:n},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[r,s,a]=t,l=r/e*100,c=s/n*100,d=a/e*100,h=a/n*100;i.style.left=l-d+"%",i.style.top=c-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[r,s,a,l]=t,c=r/e*100,d=s/n*100,h=a/e*100,f=l/n*100;i.style.left=c+"%",i.style.top=d+"%",i.style.width=h-c+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[r,s,a,l]=t,c=r/e*100,d=s/n*100,h=a/e*100,f=l/n*100;i.style.left=c-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let r=[];for(let y=0;y<t.length;y+=2)r.push({x:t[y],y:t[y+1]});let s=Math.min(...r.map(y=>y.x)),a=Math.max(...r.map(y=>y.x)),l=Math.min(...r.map(y=>y.y)),c=Math.max(...r.map(y=>y.y)),d=s/e*100,h=l/n*100,f=a/e*100,m=c/n*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let v=r.map(y=>({x:(y.x-s)/(a-s)*100,y:(y.y-l)/(c-l)*100})),x=v.map(y=>`${y.x}% ${y.y}%`).join(",");i.style.clipPath=`polygon(${x})`;let u=v.map(y=>`${y.x},${y.y}`).join(" "),g=y=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${y}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Ep=[O,W,q`
7400
7400
  /* Containing block for the absolutely positioned hotspots over the image. Was on this host in
7401
7401
  the theme, together with a 'display: block' this component now owns. */
7402
7402
  :host {
@@ -7426,7 +7426,7 @@ CES.load();
7426
7426
  top: 0px;
7427
7427
  left: 0px;
7428
7428
  }
7429
- `];var vr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Bt=class extends D{static{this.styles=kp}#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>
7429
+ `];var vr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ut=class extends D{static{this.styles=Ep}#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>
7430
7430
  <line-container>
7431
7431
  <svg
7432
7432
  width=${Z(this.grImage[0]?.width)}
@@ -7458,7 +7458,7 @@ CES.load();
7458
7458
  </svg>
7459
7459
  <slot></slot>
7460
7460
  </line-container>
7461
- <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),n=t.target,i=n.getAttribute("coords"),r=n.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));Zt(r,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)}};vr([T()],Bt.prototype,"startCoord",void 0);vr([T()],Bt.prototype,"mouseCoord",void 0);vr([td({selector:"img"})],Bt.prototype,"grImage",void 0);vr([T()],Bt.prototype,"_response",void 0);vr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],Bt.prototype,"response",null);var hs=[{tag:"qti-graphic-associate-interaction",ctor:Bt}];var Ep=[O,W,q`
7461
+ <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),n=t.target,i=n.getAttribute("coords"),r=n.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));te(r,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)}};vr([T()],Ut.prototype,"startCoord",void 0);vr([T()],Ut.prototype,"mouseCoord",void 0);vr([ed({selector:"img"})],Ut.prototype,"grImage",void 0);vr([T()],Ut.prototype,"_response",void 0);vr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Yt({emptyAs:[]})})],Ut.prototype,"response",null);var ps=[{tag:"qti-graphic-associate-interaction",ctor:Ut}];var Ap=[O,W,q`
7462
7462
  :host {
7463
7463
  display: flex;
7464
7464
  align-items: flex-start;
@@ -7543,10 +7543,10 @@ CES.load();
7543
7543
  user-select: none;
7544
7544
  pointer-events: none;
7545
7545
  }
7546
- `];var xf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},qf=jt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),kn=class extends Ft(qf,'[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=Ep}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return b` <slot name="prompt"></slot>
7546
+ `];var qf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Cf=Ft(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),kn=class extends Bt(Cf,'[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=Ap}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return b` <slot name="prompt"></slot>
7547
7547
  <slot part="image" style=${t}></slot>
7548
7548
  <slot part="drags" name="drags" class="hover-border" style=${t}></slot>
7549
- <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=r=>{let s=(t.getAttribute(r)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},n=e("width"),i=e("height");n&&i&&(t.style.aspectRatio=`${n} / ${i}`)}#r(t){let e=this.#n(),n=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!n||!i||(this.#i(e),this.#o(e),Zt(i,n.split(",").map(r=>parseFloat(r)),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,i=e>0&&n>0?Math.min(1,n/e):1,r=Math.round(i*1e3)/1e3;r!==this._graphicScale&&(this._graphicScale=r)}),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}};xf([T()],kn.prototype,"_graphicScale",void 0);var ps=[{tag:"qti-graphic-gap-match-interaction",ctor:kn}];var Ap=[O,W,q`
7549
+ <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=r=>{let s=(t.getAttribute(r)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},n=e("width"),i=e("height");n&&i&&(t.style.aspectRatio=`${n} / ${i}`)}#r(t){let e=this.#n(),n=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!n||!i||(this.#i(e),this.#o(e),te(i,n.split(",").map(r=>parseFloat(r)),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,i=e>0&&n>0?Math.min(1,n/e):1,r=Math.round(i*1e3)/1e3;r!==this._graphicScale&&(this._graphicScale=r)}),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}};qf([T()],kn.prototype,"_graphicScale",void 0);var us=[{tag:"qti-graphic-gap-match-interaction",ctor:kn}];var Ip=[O,W,q`
7550
7550
  /* The order pins are anchored outside their hotspot's box. */
7551
7551
  :host {
7552
7552
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
@@ -7584,11 +7584,11 @@ CES.load();
7584
7584
  pointer-events: none;
7585
7585
  user-select: none;
7586
7586
  }
7587
- `];var Ip=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Qe=class o extends He(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#r=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=Ap}static#t="cito-graphic-order-marker";render(){return b`
7587
+ `];var _p=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Qe=class o extends He(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#r=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=Ip}static#t="cito-graphic-order-marker";render(){return b`
7588
7588
  <slot name="prompt"></slot>
7589
7589
  <slot></slot>
7590
7590
  <div role="alert" part="message" id="validation-message"></div>
7591
- `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(r=>r.identifier===e))return;let n=[...this.#e()],i=n.indexOf(e);if(i>=0)n.splice(i,1);else{let r=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(n.length>=r)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 r of this._choiceElements){let s=t.indexOf(r.identifier);r.order=s>=0?s+1:null}let e=this._choiceElements.filter(r=>r.order!=null).sort((r,s)=>r.order-s.order),n=Array.from(this.querySelectorAll(`.${o.#t}`));n.length===e.length&&e.every((r,s)=>{let a=n[s];return a.textContent===String(r.order)&&a.style.getPropertyValue("position-anchor")===this.#n(r)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(r)})||(n.forEach(r=>r.remove()),this._choiceElements.forEach(r=>{r.style.removeProperty("anchor-name")}),e.forEach(r=>{let s=this.#n(r);r.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(r)),r.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(r.order),this.append(a)}))}#i(t){let e=Cp(this),n=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let r=n.split(",").map(s=>parseInt(s));Zt(i,r,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)}};Ip([p({type:Number,attribute:"max-choices"})],Qe.prototype,"maxChoices",void 0);Ip([L("response")],Qe.prototype,"handleOrderedResponseChange",null);var us=[{tag:"qti-graphic-order-interaction",ctor:Qe}];var _p=[O,W,q`
7591
+ `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(r=>r.identifier===e))return;let n=[...this.#e()],i=n.indexOf(e);if(i>=0)n.splice(i,1);else{let r=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(n.length>=r)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 r of this._choiceElements){let s=t.indexOf(r.identifier);r.order=s>=0?s+1:null}let e=this._choiceElements.filter(r=>r.order!=null).sort((r,s)=>r.order-s.order),n=Array.from(this.querySelectorAll(`.${o.#t}`));n.length===e.length&&e.every((r,s)=>{let a=n[s];return a.textContent===String(r.order)&&a.style.getPropertyValue("position-anchor")===this.#n(r)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(r)})||(n.forEach(r=>r.remove()),this._choiceElements.forEach(r=>{r.style.removeProperty("anchor-name")}),e.forEach(r=>{let s=this.#n(r);r.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(r)),r.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(r.order),this.append(a)}))}#i(t){let e=Sp(this),n=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let r=n.split(",").map(s=>parseInt(s));te(i,r,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)}};_p([p({type:Number,attribute:"max-choices"})],Qe.prototype,"maxChoices",void 0);_p([L("response")],Qe.prototype,"handleOrderedResponseChange",null);var ms=[{tag:"qti-graphic-order-interaction",ctor:Qe}];var Tp=[O,W,q`
7592
7592
  :host {
7593
7593
  display: block;
7594
7594
  }
@@ -7637,17 +7637,17 @@ CES.load();
7637
7637
  max-width: 100%;
7638
7638
  height: auto;
7639
7639
  }
7640
- `];var oi=class extends He(D,"qti-hotspot-choice"){static{this.styles=_p}render(){return b`
7640
+ `];var oi=class extends He(D,"qti-hotspot-choice"){static{this.styles=Tp}render(){return b`
7641
7641
  <slot name="prompt"></slot>
7642
7642
  <slot></slot>
7643
7643
  <div part="message" role="alert" id="validation-message"></div>
7644
- `}#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"),i=t.getAttribute("shape"),r=n.split(",").map(a=>parseInt(a)),s=await this.#e(e);Zt(i,r,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 ms=[{tag:"qti-hotspot-interaction",ctor:oi}];var Tp=[O,W,q`
7644
+ `}#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"),i=t.getAttribute("shape"),r=n.split(",").map(a=>parseInt(a)),s=await this.#e(e);te(i,r,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 fs=[{tag:"qti-hotspot-interaction",ctor:oi}];var Rp=[O,W,q`
7645
7645
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7646
7646
  :host {
7647
7647
  display: block;
7648
7648
  }
7649
7649
  `];var si=class extends He(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
7650
- <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Tp}};var fs=[{tag:"qti-hottext-interaction",ctor:si}];var Gl=(o,t="[part='menu']",e="[part='trigger']",n="--qti-inline-choice-width")=>{class i 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 i};var Cf=q`
7650
+ <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Rp}};var gs=[{tag:"qti-hottext-interaction",ctor:si}];var Xl=(o,t="[part='menu']",e="[part='trigger']",n="--qti-inline-choice-width")=>{class i 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 i};var Sf=q`
7651
7651
  /* ── Host ──────────────────────────────────────────────────────────────────
7652
7652
  Inline-block so the element flows with surrounding text.
7653
7653
  --qti-inline-choice-width is the single width control surface:
@@ -7828,7 +7828,7 @@ CES.load();
7828
7828
  z-index: var(--qti-overlay-z-index);
7829
7829
  white-space: nowrap;
7830
7830
  }
7831
- `,Sf=Cf,Rp=Sf;var fe=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},kf=0,ct=class extends Gl(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${kf++}`,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.#y(),n=this.renderRoot.activeElement,i=this.#p(),r=n||(i instanceof HTMLElement&&this.#l(i)?i:null),s=e.findIndex(a=>a===r);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!r)return;if(t.preventDefault(),r instanceof HTMLButtonElement)r.click();else{let a=r.getAttribute("identifier")??"";this.#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[Rp]}renderTrigger(){let t=this.#t();return b`
7831
+ `,kf=Sf,Op=kf;var fe=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ef=0,ct=class extends Xl(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Ef++}`,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.#y(),n=this.renderRoot.activeElement,i=this.#p(),r=n||(i instanceof HTMLElement&&this.#l(i)?i:null),s=e.findIndex(a=>a===r);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!r)return;if(t.preventDefault(),r instanceof HTMLButtonElement)r.click();else{let a=r.getAttribute("identifier")??"";this.#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[Op]}renderTrigger(){let t=this.#t();return b`
7832
7832
  <button
7833
7833
  part="trigger"
7834
7834
  type="button"
@@ -7868,7 +7868,7 @@ CES.load();
7868
7868
  </button>
7869
7869
  <slot @slotchange=${this.#u}></slot>
7870
7870
  </div>
7871
- `}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.#y()[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,i=n!==void 0?n??"":this.options.find(a=>a.selected)?.value??"",r=[{content:e,value:"",selected:i===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],s=r.some(a=>a.selected);this.options=s?r:r.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,i=e||!n,r=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":r,this,{suppressInline:!0}),i}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 r=(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=r?"true":"false",n.internals.ariaChecked=r?"true":"false",n.internals.ariaDisabled=this.disabled?"true":"false",n.internals.ariaReadOnly=this.readonly?"true":"false",r?n.internals.states.add("checked"):n.internals.states.delete("checked"),n.tabIndex=-1}}#y(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};fe([T()],ct.prototype,"options",void 0);fe([T()],ct.prototype,"_dropdownOpen",void 0);fe([_({context:xt,subscribe:!0}),p({attribute:!1})],ct.prototype,"configContext",void 0);fe([p({type:String,attribute:"data-prompt"})],ct.prototype,"dataPrompt",void 0);fe([L("dataPrompt",{waitUntilFirstUpdate:!0})],ct.prototype,"_handleDataPromptChange",void 0);fe([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],ct.prototype,"required",void 0);fe([p({type:Number,attribute:"min-choices"})],ct.prototype,"minChoices",void 0);fe([L(["required","minChoices"],{waitUntilFirstUpdate:!0})],ct.prototype,"_handleRequiredChange",void 0);fe([p({attribute:"response",reflect:!1,noAccessor:!0})],ct.prototype,"response",null);var gs=[{tag:"qti-inline-choice-interaction",ctor:ct}];var Op=[O,W,q`
7871
+ `}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.#y()[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,i=n!==void 0?n??"":this.options.find(a=>a.selected)?.value??"",r=[{content:e,value:"",selected:i===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],s=r.some(a=>a.selected);this.options=s?r:r.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,i=e||!n,r=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":r,this,{suppressInline:!0}),i}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 r=(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=r?"true":"false",n.internals.ariaChecked=r?"true":"false",n.internals.ariaDisabled=this.disabled?"true":"false",n.internals.ariaReadOnly=this.readonly?"true":"false",r?n.internals.states.add("checked"):n.internals.states.delete("checked"),n.tabIndex=-1}}#y(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};fe([T()],ct.prototype,"options",void 0);fe([T()],ct.prototype,"_dropdownOpen",void 0);fe([_({context:xt,subscribe:!0}),p({attribute:!1})],ct.prototype,"configContext",void 0);fe([p({type:String,attribute:"data-prompt"})],ct.prototype,"dataPrompt",void 0);fe([L("dataPrompt",{waitUntilFirstUpdate:!0})],ct.prototype,"_handleDataPromptChange",void 0);fe([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],ct.prototype,"required",void 0);fe([p({type:Number,attribute:"min-choices"})],ct.prototype,"minChoices",void 0);fe([L(["required","minChoices"],{waitUntilFirstUpdate:!0})],ct.prototype,"_handleRequiredChange",void 0);fe([p({attribute:"response",reflect:!1,noAccessor:!0})],ct.prototype,"response",null);var bs=[{tag:"qti-inline-choice-interaction",ctor:ct}];var Pp=[O,W,q`
7872
7872
  /*
7873
7873
  * A custom element is inline unless it says otherwise, and this one never did. Its shadow content
7874
7874
  * is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
@@ -7974,7 +7974,7 @@ CES.load();
7974
7974
  :host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
7975
7975
  display: none;
7976
7976
  }
7977
- `];var Pp=[O,q`
7977
+ `];var Mp=[O,q`
7978
7978
  :host(.qti-match-tabular) slot:not([hidden]) {
7979
7979
  display: contents;
7980
7980
  }
@@ -8030,7 +8030,7 @@ CES.load();
8030
8030
  justify-content: center;
8031
8031
  flex-shrink: 0;
8032
8032
  }
8033
- `];var Xl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ge=class extends Ft(jt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,n=e.value,i=e.name,r=e.type;e.checked?(this.response?this.response.indexOf(n)===-1&&(r==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-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=[Op,Pp]}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],i=e[1],r=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(n?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{r(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{r(s),s.setAttribute("role","columnheader")})):(n?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return b`
8033
+ `];var Yl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ge=class extends Bt(Ft(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,n=e.value,i=e.name,r=e.type;e.checked?(this.response?this.response.indexOf(n)===-1&&(r==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-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=[Pp,Mp]}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],i=e[1],r=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(n?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{r(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{r(s),s.setAttribute("role","columnheader")})):(n?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return b`
8034
8034
  <slot name="prompt"></slot>
8035
8035
  <slot ?hidden=${t}></slot>
8036
8036
 
@@ -8074,13 +8074,13 @@ CES.load();
8074
8074
  `:P}
8075
8075
 
8076
8076
  <div role="alert" part="message" id="validation-message"></div>
8077
- `}};Xl([p({type:String})],ge.prototype,"class",void 0);Xl([T()],ge.prototype,"_response",void 0);Xl([p({type:String,attribute:"response-identifier"})],ge.prototype,"responseIdentifier",void 0);var bs=[{tag:"qti-match-interaction",ctor:ge}];var Mp=[O,q`
8077
+ `}};Yl([p({type:String})],ge.prototype,"class",void 0);Yl([T()],ge.prototype,"_response",void 0);Yl([p({type:String,attribute:"response-identifier"})],ge.prototype,"responseIdentifier",void 0);var ys=[{tag:"qti-match-interaction",ctor:ge}];var Dp=[O,q`
8078
8078
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8079
8079
  :host {
8080
8080
  display: block;
8081
8081
  }
8082
- `];var ys=class extends D{static{this.styles=Mp}#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>
8083
- <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 vs=[{tag:"qti-media-interaction",ctor:ys}];var Dp=[O,W,Qt,q`
8082
+ `];var vs=class extends D{static{this.styles=Dp}#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>
8083
+ <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 ws=[{tag:"qti-media-interaction",ctor:vs}];var Np=[O,W,Gt,q`
8084
8084
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8085
8085
  :host {
8086
8086
  display: block;
@@ -8290,7 +8290,7 @@ CES.load();
8290
8290
  :host([answer-key]) [part~='drags'] {
8291
8291
  display: none;
8292
8292
  }
8293
- `];var Np=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ef=jt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Ge=class extends Ft(Ef,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Dp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
8293
+ `];var $p=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Af=Ft(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Ge=class extends Bt(Af,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Np}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
8294
8294
  <div part="container">
8295
8295
  <slot part="drags"> </slot>
8296
8296
  <div part="drops">
@@ -8299,7 +8299,7 @@ CES.load();
8299
8299
  </div>`})}
8300
8300
  </div>
8301
8301
  <div id="validation-message" part="message" role="alert" style="display:none;"></div>
8302
- </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"))}};Np([T()],Ge.prototype,"nrChoices",void 0);Np([p({type:String})],Ge.prototype,"orientation",void 0);var ws=[{tag:"qti-order-interaction",ctor:Ge}];var $p=`@layer qti-base {
8302
+ </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"))}};$p([T()],Ge.prototype,"nrChoices",void 0);$p([p({type:String})],Ge.prototype,"orientation",void 0);var xs=[{tag:"qti-order-interaction",ctor:Ge}];var Lp=`@layer qti-base {
8303
8303
  /* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
8304
8304
  /* ============================
8305
8305
  QTI 3 shared css
@@ -9848,7 +9848,7 @@ CES.load();
9848
9848
  }
9849
9849
  }
9850
9850
  }
9851
- `;var Lp=[O,q`
9851
+ `;var Vp=[O,q`
9852
9852
  :host {
9853
9853
  display: block;
9854
9854
  width: 100%;
@@ -9858,18 +9858,18 @@ CES.load();
9858
9858
  ::slotted(qti-interaction-markup) {
9859
9859
  display: none;
9860
9860
  }
9861
- `];var Af=new Set(["point","pair","directedPair"]),ai=(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(i=>typeof i=="number"?i:parseFloat(String(i)));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)}},If=(o,t,e)=>{if(e)return Array.isArray(t)&&!Af.has(e)?{name:o,list:{[e]:t.map(n=>ai(n,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ai(t,e)}};if(Array.isArray(t)){let n=t.filter(i=>i!=null);if(n.length&&n.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:n}};if(n.length&&n.every(i=>typeof i=="number")){let i=n,r=i.every(s=>Number.isInteger(s));return{name:o,list:{[r?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}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)}}},xs=(o,t={})=>{if(!ae(o))return{record:[]};let e=[];for(let[n,i]of Object.entries(o))e.push(If(n,i,t[n]));return{record:e}},_f=(o,t={})=>{if(!ae(o))return{...t};let e={};for(let[n,i]of Object.entries(o))e[n]=t[n]??ro(Array.isArray(i)?i[0]:i);return e},jp=(o,t={})=>xs(o,_f(o,t)),Vp=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)},zp=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Fp=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let n=zp(e.list);t[e.name]=Array.isArray(n)?n.map(Vp).filter(i=>i!==null):[]}else t[e.name]=Vp(zp(e.base));return t};var Bp=`/** vim: et:ts=4:sw=4:sts=4
9861
+ `];var If=new Set(["point","pair","directedPair"]),ai=(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(i=>typeof i=="number"?i:parseFloat(String(i)));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)}},_f=(o,t,e)=>{if(e)return Array.isArray(t)&&!If.has(e)?{name:o,list:{[e]:t.map(n=>ai(n,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ai(t,e)}};if(Array.isArray(t)){let n=t.filter(i=>i!=null);if(n.length&&n.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:n}};if(n.length&&n.every(i=>typeof i=="number")){let i=n,r=i.every(s=>Number.isInteger(s));return{name:o,list:{[r?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}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)}}},qs=(o,t={})=>{if(!Pt(o))return{record:[]};let e=[];for(let[n,i]of Object.entries(o))e.push(_f(n,i,t[n]));return{record:e}},Tf=(o,t={})=>{if(!Pt(o))return{...t};let e={};for(let[n,i]of Object.entries(o))e[n]=t[n]??ro(Array.isArray(i)?i[0]:i);return e},Fp=(o,t={})=>qs(o,Tf(o,t)),zp=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}},Bp=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(zp).filter(i=>i!==null):[]}else t[e.name]=zp(jp(e.base));return t};var Up=`/** vim: et:ts=4:sw=4:sts=4
9862
9862
  * @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
9863
9863
  * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
9864
9864
  */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+\`
9865
- 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 At=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Tf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Rf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Of=["solution","review"];function Pf(o){return o==null?!1:Array.isArray(o)?o.length>0:ae(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`,this.iframe.style.width=`${e.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let n=e?.params?.value,i=n&&typeof n=="object"?this.#m(n):null,r=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;r!==null&&(this.#o=r,r&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=i;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=[Lp,q`
9865
+ 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 At=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Rf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Of=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Pf=["solution","review"];function Mf(o){return o==null?!1:Array.isArray(o)?o.length>0:Pt(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,i=n&&typeof n=="object"?this.#m(n):null,r=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;r!==null&&(this.#o=r,r&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=i;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=[Vp,q`
9866
9866
  :host {
9867
9867
  display: block;
9868
9868
  width: 100%;
9869
9869
  min-height: 50px;
9870
9870
  }
9871
- `]}#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 Pf(n)&&(e.correctResponse={value:n}),e}#n(){let t=this.responseDeclaration;if(!t?.correctResponse||Of.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=Fp(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 i in n)if(n.hasOwnProperty(i)){let r=n[i];if(Array.isArray(r))return r.map(String);if(r!=null)return String(r)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(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 xs(t);if(e!=="single"){let i=this.normalizeListValue(t).map(r=>ai(r,n));return{list:{[n]:i}}}return{base:{[n]:ai(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(i=>{let r=i.querySelector("qti-default-value");if(!r)return;let{value:s,baseTypes:a}=Hi(r.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=ai(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 i={candidateIdentifier:n.candidateIdentifier??"",testIdentifier:n.testIdentifier??"",environmentIdentifier:n.environmentIdentifier??"",...n};return xs(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(n=>{let i=n.getAttribute("template-identifier")||n.getAttribute("identifier")||"";if(!i)return;let r=this.context?.variables?.find(l=>l.identifier===i);if(!r)return;let s=r.cardinality||"single",a=r.baseType||"string";t[i]=this.variableToQtiVariableJSON(r.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(n=>{let i=n.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[i]=l);return}let r=this.context?.variables?.find(l=>l.identifier===i);if(!r)return;let s=r.cardinality||"single",a=r.baseType||"string";t[i]=this.variableToQtiVariableJSON(r.value,s,a)}),t}#d(t){let e={...t};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);e[i]=t[n]}return e}#u(t){let e={...t},n=(i,r,s)=>{let a=i;for(let l=0;l<r.length;l+=1){let c=r[l];if(l===r.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[i,r]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||n(e,s,r)}return e}responseVariablesToQtiVariableJSON(t,e,n,i){if(e==="record")return jp(t,i);if(e!=="single"){let r={list:{}};return r.list[n]=t,r}else{let r={base:{}};return r.base[n]=t,r}}#h(){return this.response===null||this.response===void 0?!1:ae(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.",i=t?"":e&&e.trim().length>0?e:n;this._internals.setValidity(t?{}:{customError:!0},i)}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:ae(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",i=e.baseType||"string",r=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(r,n,i,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,"=")}#y(t){let e={};for(let[n,i]of Object.entries(t))typeof i=="string"?e[n]=this.#f(i):e[n]=i;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.#C(),this.#v()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#v(){let t=this.#d(this.#u(this.#y({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],n=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:io(`${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",i)}#x(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let n=e.querySelectorAll("qti-interaction-module");for(let i of n)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#C(){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 i=e.map(r=>r.outerHTML).join(`
9872
- `);this.sendMessageToIframe("setStylesheets",i)}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()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",r=i?i.endsWith("/")?i:`${i}/`:`${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>${Tf(Bp)}</script>`,d=`
9871
+ `]}#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 Mf(n)&&(e.correctResponse={value:n}),e}#n(){let t=this.responseDeclaration;if(!t?.correctResponse||Pf.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=Bp(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 i in n)if(n.hasOwnProperty(i)){let r=n[i];if(Array.isArray(r))return r.map(String);if(r!=null)return String(r)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(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 qs(t);if(e!=="single"){let i=this.normalizeListValue(t).map(r=>ai(r,n));return{list:{[n]:i}}}return{base:{[n]:ai(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(i=>{let r=i.querySelector("qti-default-value");if(!r)return;let{value:s,baseTypes:a}=Hi(r.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=ai(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 i={candidateIdentifier:n.candidateIdentifier??"",testIdentifier:n.testIdentifier??"",environmentIdentifier:n.environmentIdentifier??"",...n};return qs(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(n=>{let i=n.getAttribute("template-identifier")||n.getAttribute("identifier")||"";if(!i)return;let r=this.context?.variables?.find(l=>l.identifier===i);if(!r)return;let s=r.cardinality||"single",a=r.baseType||"string";t[i]=this.variableToQtiVariableJSON(r.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(n=>{let i=n.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[i]=l);return}let r=this.context?.variables?.find(l=>l.identifier===i);if(!r)return;let s=r.cardinality||"single",a=r.baseType||"string";t[i]=this.variableToQtiVariableJSON(r.value,s,a)}),t}#d(t){let e={...t};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);e[i]=t[n]}return e}#u(t){let e={...t},n=(i,r,s)=>{let a=i;for(let l=0;l<r.length;l+=1){let c=r[l];if(l===r.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[i,r]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||n(e,s,r)}return e}responseVariablesToQtiVariableJSON(t,e,n,i){if(e==="record")return Fp(t,i);if(e!=="single"){let r={list:{}};return r.list[n]=t,r}else{let r={base:{}};return r.base[n]=t,r}}#h(){return this.response===null||this.response===void 0?!1:Pt(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.",i=t?"":e&&e.trim().length>0?e:n;this._internals.setValidity(t?{}:{customError:!0},i)}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:Pt(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",i=e.baseType||"string",r=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(r,n,i,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,"=")}#y(t){let e={};for(let[n,i]of Object.entries(t))typeof i=="string"?e[n]=this.#f(i):e[n]=i;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.#C(),this.#v()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#v(){let t=this.#d(this.#u(this.#y({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],n=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:io(`${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",i)}#x(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let n=e.querySelectorAll("qti-interaction-module");for(let i of n)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#C(){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 i=e.map(r=>r.outerHTML).join(`
9872
+ `);this.sendMessageToIframe("setStylesheets",i)}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()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",r=i?i.endsWith("/")?i:`${i}/`:`${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>${Rf(Up)}</script>`,d=`
9873
9873
  font-family: ${t.getPropertyValue("font-family")};
9874
9874
  font-size: ${t.getPropertyValue("font-size")};
9875
9875
  line-height: ${t.getPropertyValue("line-height")};
@@ -9882,7 +9882,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
9882
9882
  <title>QTI PCI Container</title>
9883
9883
  <base href="${r}" />
9884
9884
  ${a?`<script type="module">import '${a}';</script>`:""}
9885
- <style>${Rf($p)}</style>
9885
+ <style>${Of(Lp)}</style>
9886
9886
  <style>
9887
9887
  body, html {
9888
9888
  margin: 0;
@@ -9899,6 +9899,8 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
9899
9899
  }
9900
9900
  #pci-container {
9901
9901
  width: 100%;
9902
+ /* Keeps the first and last child's margins inside, so scrollHeight is the full height. */
9903
+ display: flow-root;
9902
9904
  }
9903
9905
  qti-interaction-markup {
9904
9906
  display: block;
@@ -10652,7 +10654,8 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10652
10654
  let previousHeight = 0;
10653
10655
  const notifyResize = () => {
10654
10656
  const container = document.getElementById('pci-container');
10655
- const newHeight = container.scrollHeight + 100;
10657
+ // The content's own height (subpixel, rounded up) or what overflows it, e.g. an open popup.
10658
+ const newHeight = Math.max(Math.ceil(container.getBoundingClientRect().height), container.scrollHeight);
10656
10659
  if (newHeight !== previousHeight) {
10657
10660
  previousHeight = newHeight;
10658
10661
  clearTimeout(resizeTimeout);
@@ -10765,7 +10768,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10765
10768
  <h1>Error</h1>
10766
10769
  ${this._errorMessage}
10767
10770
  </div>`:""}
10768
- `}};At([p({type:String,attribute:"module"})],X.prototype,"module",void 0);At([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);At([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);At([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);At([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);At([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);At([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);At([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);At([T()],X.prototype,"_errorMessage",void 0);At([_({context:F,subscribe:!0}),T()],X.prototype,"context",void 0);At([_({context:qt,subscribe:!0}),T()],X.prototype,"qtiContext",void 0);At([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:null})})],X.prototype,"response",void 0);var qs=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,n)=>{let i=()=>{window.clearTimeout(r),e()},r=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),n(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,n=i=>{let{data:r}=i;r?.source==="qti-pci-iframe"&&(!r?.responseIdentifier||r?.responseIdentifier===this.responseIdentifier)&&r?.method==="getContentResponse"&&r?.messageId===e&&(window.removeEventListener("message",n),t(r.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 i=`click-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",r),n())};window.addEventListener("message",r),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),n()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let n=`click-selector-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let n=`click-text-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(n=>{let i=`set-value-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",r),n(a.success))};window.addEventListener("message",r),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),n(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let n=`get-bounding-rect-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(n=>{let i=`set-value-text-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",r),n(a.success))};window.addEventListener("message",r),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),n(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let n=`mousedown-selector-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
10771
+ `}};At([p({type:String,attribute:"module"})],X.prototype,"module",void 0);At([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);At([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);At([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);At([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);At([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);At([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);At([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);At([T()],X.prototype,"_errorMessage",void 0);At([_({context:F,subscribe:!0}),T()],X.prototype,"context",void 0);At([_({context:qt,subscribe:!0}),T()],X.prototype,"qtiContext",void 0);At([p({attribute:"response",reflect:!1,converter:Yt({emptyAs:null})})],X.prototype,"response",void 0);var Cs=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,n)=>{let i=()=>{window.clearTimeout(r),e()},r=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),n(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,n=i=>{let{data:r}=i;r?.source==="qti-pci-iframe"&&(!r?.responseIdentifier||r?.responseIdentifier===this.responseIdentifier)&&r?.method==="getContentResponse"&&r?.messageId===e&&(window.removeEventListener("message",n),t(r.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 i=`click-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",r),n())};window.addEventListener("message",r),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),n()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let n=`click-selector-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let n=`click-text-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(n=>{let i=`set-value-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",r),n(a.success))};window.addEventListener("message",r),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),n(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let n=`get-bounding-rect-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(n=>{let i=`set-value-text-${Date.now()}`,r=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",r),n(a.success))};window.addEventListener("message",r),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),n(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let n=`mousedown-selector-${Date.now()}`,i=r=>{let{data:s}=r;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===n&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
10769
10772
  // Test helper functions for QtiPortableCustomInteractionTest
10770
10773
  // Base iframe implementation already provides PCIManager.getContent
10771
10774
 
@@ -10958,7 +10961,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10958
10961
  }
10959
10962
  },
10960
10963
  true
10961
- );`,n=t.lastIndexOf("</script>");return t.substring(0,n)+e+t.substring(n)}};var Cs=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:qs}];var Up=[O,q`
10964
+ );`,n=t.lastIndexOf("</script>");return t.substring(0,n)+e+t.substring(n)}};var Ss=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:Cs}];var Hp=[O,q`
10962
10965
  :host {
10963
10966
  display: block;
10964
10967
  }
@@ -10969,12 +10972,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10969
10972
  left: 50%;
10970
10973
  transform: translateX(-50%);
10971
10974
  }
10972
- `];var Ss=class extends C{static{this.styles=Up}render(){return b`<slot></slot>`}};var Hp=[O,q`
10975
+ `];var ks=class extends C{static{this.styles=Hp}render(){return b`<slot></slot>`}};var Wp=[O,q`
10973
10976
  :host {
10974
10977
  display: inline-block;
10975
10978
  position: relative;
10976
10979
  }
10977
- `];var ks=class extends C{static{this.styles=Hp}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 Es=[{tag:"qti-position-object-interaction",ctor:Ss},{tag:"qti-position-object-stage",ctor:ks}];var Wp="important",Mf=" !"+Wp,As=Mt(class extends _e{constructor(o){if(super(o),o.type!==Yn.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 i=t[n];if(i!=null){this.ft.add(n);let r=typeof i=="string"&&i.endsWith(Mf);n.includes("-")||r?e.setProperty(n,r?i.slice(0,-11):i,r?Wp:""):e[n]=i}}return it}});var Qp=[O,q`
10980
+ `];var Es=class extends C{static{this.styles=Wp}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 As=[{tag:"qti-position-object-interaction",ctor:ks},{tag:"qti-position-object-stage",ctor:Es}];var Qp="important",Df=" !"+Qp,Is=Dt(class extends _e{constructor(o){if(super(o),o.type!==Yn.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 i=t[n];if(i!=null){this.ft.add(n);let r=typeof i=="string"&&i.endsWith(Df);n.includes("-")||r?e.setProperty(n,r?i.slice(0,-11):i,r?Qp:""):e[n]=i}}return it}});var Gp=[O,q`
10978
10981
  :host {
10979
10982
  display: block;
10980
10983
  --qti-select-point-marker-size: 1.5rem;
@@ -11009,12 +11012,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11009
11012
  -webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
11010
11013
  mask: var(--qti-select-point-icon) no-repeat center / contain;
11011
11014
  }
11012
- `];var li=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},yt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#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,i=(t.clientY-e.top)*this.#i,r=`${n.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[r]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],r]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=Qp}#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[i,r]=n.split(" ").map(Number);return{x:i,y:r}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let n of t){let i=n.dataset.coord,r=n.dataset.shape;!i||!r||Zt(r,i.split(",").map(s=>+s),e,n)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
11015
+ `];var li=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},yt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#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,i=(t.clientY-e.top)*this.#i,r=`${n.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[r]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],r]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=Gp}#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[i,r]=n.split(" ").map(Number);return{x:i,y:r}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let n of t){let i=n.dataset.coord,r=n.dataset.shape;!i||!r||te(r,i.split(",").map(s=>+s),e,n)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
11013
11016
  <point-container>
11014
11017
  ${Q(e.filter(n=>n),n=>n,(n,i)=>{let[r,s]=n.split(" ").map(Number),a=r/(this.#r||1)*100,l=s/(this.#o||1)*100;return b`
11015
11018
  <button
11016
11019
  part=${this.pointPart(n,i)}
11017
- style=${As({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
11020
+ style=${Is({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
11018
11021
  aria-label="Remove point at ${n}"
11019
11022
  ?disabled=${this.disabled}
11020
11023
  @click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==i),this.saveResponse(this.response)}}
@@ -11022,7 +11025,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11022
11025
  `})}
11023
11026
  ${this.renderSupplementalLayer()}
11024
11027
  <slot></slot>
11025
- </point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,n=t<this.minChoices,i=!0,r="";return e?(i=!1,r=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):n&&(i=!1,r=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,r,this.#e??this,{suppressInline:!0}),i}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.#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)}};li([p({type:Number,attribute:"max-choices"})],yt.prototype,"maxChoices",void 0);li([p({type:Number,attribute:"min-choices"})],yt.prototype,"minChoices",void 0);li([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=ll(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>cl(o)}})],yt.prototype,"response",void 0);li([p({attribute:"area-mappings"})],yt.prototype,"areaMappings",void 0);li([T()],yt.prototype,"_areaEntries",void 0);li([L("areaMappings")],yt.prototype,"_handleAreaMappingsChange",void 0);var Is=[{tag:"qti-select-point-interaction",ctor:yt}];var Gp=[O,q`
11028
+ </point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,n=t<this.minChoices,i=!0,r="";return e?(i=!1,r=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):n&&(i=!1,r=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,r,this.#e??this,{suppressInline:!0}),i}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.#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)}};li([p({type:Number,attribute:"max-choices"})],yt.prototype,"maxChoices",void 0);li([p({type:Number,attribute:"min-choices"})],yt.prototype,"minChoices",void 0);li([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=cl(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>dl(o)}})],yt.prototype,"response",void 0);li([p({attribute:"area-mappings"})],yt.prototype,"areaMappings",void 0);li([T()],yt.prototype,"_areaEntries",void 0);li([L("areaMappings")],yt.prototype,"_handleAreaMappingsChange",void 0);var _s=[{tag:"qti-select-point-interaction",ctor:yt}];var Xp=[O,q`
11026
11029
  :host {
11027
11030
  display: block;
11028
11031
  --show-bounds: true;
@@ -11090,7 +11093,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11090
11093
  text-align: center;
11091
11094
  color: #6b7280; /* text-gray-500 */
11092
11095
  }
11093
- `];var wr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},It=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=Gp}#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`
11096
+ `];var wr=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},It=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=Xp}#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`
11094
11097
  <slot name="prompt"></slot>
11095
11098
  <div id="slider" part="slider">
11096
11099
  <div id="bounds" part="bounds">
@@ -11108,7 +11111,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11108
11111
  ${this.renderRailSupplement()}
11109
11112
  </div>
11110
11113
  </div>
11111
- `}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.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=i=>this.#s(i.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,i=Math.min(1,Math.max(0,n/e.width)),r=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#n(r)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};wr([On("#rail")],It.prototype,"_rail",void 0);wr([p({type:Number,attribute:"lower-bound"})],It.prototype,"min",void 0);wr([p({type:Number,attribute:"upper-bound"})],It.prototype,"max",void 0);wr([p({type:Number,attribute:"step"})],It.prototype,"step",void 0);wr([p({attribute:"response",reflect:!1,noAccessor:!0})],It.prototype,"response",null);var _s=[{tag:"qti-slider-interaction",ctor:It}];var Xp=()=>new Jl,Jl=class{},Yl=new WeakMap,kD=Mt(class extends Re{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=Yl.get(t);e===void 0&&(e=new WeakMap,Yl.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"?Yl.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 Yp=[O,q`
11114
+ `}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.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=i=>this.#s(i.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,i=Math.min(1,Math.max(0,n/e.width)),r=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#n(r)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};wr([On("#rail")],It.prototype,"_rail",void 0);wr([p({type:Number,attribute:"lower-bound"})],It.prototype,"min",void 0);wr([p({type:Number,attribute:"upper-bound"})],It.prototype,"max",void 0);wr([p({type:Number,attribute:"step"})],It.prototype,"step",void 0);wr([p({attribute:"response",reflect:!1,noAccessor:!0})],It.prototype,"response",null);var Ts=[{tag:"qti-slider-interaction",ctor:It}];var Yp=()=>new Kl,Kl=class{},Jl=new WeakMap,ED=Dt(class extends Re{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=Jl.get(t);e===void 0&&(e=new WeakMap,Jl.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"?Jl.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 Jp=[O,q`
11112
11115
  :host {
11113
11116
  display: inline-flex;
11114
11117
  align-items: center;
@@ -11197,7 +11200,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11197
11200
  :host(.qti-input-width-72) {
11198
11201
  --qti-input-width: 72;
11199
11202
  }
11200
- `];var En=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pt=class extends D{constructor(){super(...arguments),this.inputRef=Xp(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Yp}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
11203
+ `];var En=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pt=class extends D{constructor(){super(...arguments),this.inputRef=Yp(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Jp}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
11201
11204
  part="input"
11202
11205
  name="${this.responseIdentifier}"
11203
11206
  spellcheck="false"
@@ -11213,7 +11216,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11213
11216
  maxlength=${1e3}
11214
11217
  ?disabled="${this.disabled}"
11215
11218
  ?readonly="${this.readonly}"
11216
- />`}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=""}};En([p({type:Number,attribute:"expected-length"})],pt.prototype,"expectedLength",void 0);En([p({type:String,attribute:"pattern-mask"})],pt.prototype,"patternMask",void 0);En([p({type:String,attribute:"placeholder-text"})],pt.prototype,"placeholderText",void 0);En([p({type:String,attribute:"data-patternmask-message"})],pt.prototype,"dataPatternmaskMessage",void 0);En([p({type:String,attribute:"response",reflect:!1})],pt.prototype,"response",void 0);En([On("input")],pt.prototype,"_input",void 0);En([L("response",{waitUntilFirstUpdate:!0})],pt.prototype,"_handleValueChange",void 0);var Ts=[{tag:"qti-text-entry-interaction",ctor:pt}];var Jp=[O,q`
11219
+ />`}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=""}};En([p({type:Number,attribute:"expected-length"})],pt.prototype,"expectedLength",void 0);En([p({type:String,attribute:"pattern-mask"})],pt.prototype,"patternMask",void 0);En([p({type:String,attribute:"placeholder-text"})],pt.prototype,"placeholderText",void 0);En([p({type:String,attribute:"data-patternmask-message"})],pt.prototype,"dataPatternmaskMessage",void 0);En([p({type:String,attribute:"response",reflect:!1})],pt.prototype,"response",void 0);En([On("input")],pt.prototype,"_input",void 0);En([L("response",{waitUntilFirstUpdate:!0})],pt.prototype,"_handleValueChange",void 0);var Rs=[{tag:"qti-text-entry-interaction",ctor:pt}];var Kp=[O,q`
11217
11220
  :host {
11218
11221
  display: block;
11219
11222
  margin: 1em 0;
@@ -11222,12 +11225,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11222
11225
  display: block;
11223
11226
  margin-top: 0.5em;
11224
11227
  }
11225
- `];var Rs=class extends D{static{this.styles=Jp}#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`
11228
+ `];var Os=class extends D{static{this.styles=Kp}#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`
11226
11229
  <div>
11227
11230
  <slot name="prompt"></slot>
11228
11231
  <input type="file" @change="${this.#n}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
11229
11232
  </div>
11230
- `}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 i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>n(i.error),i.readAsDataURL(t)})}};var Os=[{tag:"qti-upload-interaction",ctor:Rs}];var Kp=[...is,...rs,...os,...as,...ls,...cs,...hs,...ps,...us,...ms,...fs,...gs,...bs,...vs,...ws,...Cs,...Es,...Is,..._s,...Ts,...Os,...Qh];for(let{tag:o,ctor:t}of Kp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)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 fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)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 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 _s)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 Os)customElements.get(o)||customElements.define(o,t);var e2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await $d().load(`${o}`).then(a=>a.assessmentTest()),n=await Wn().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Wn().load(`${t}/${e.href}`).then(a=>a.items()),r=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:n,testURI:s,testURL:r,items:i,testIdentifier:e.identifier}},n2=async o=>Yt().load(o).then(t=>t.htmlDoc().firstElementChild);var Ps=class extends Df(Gt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Df(o){return class extends o{calculateChildren(e){return e.map(i=>{let r=i;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var Zp=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ci=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}};Zp([p({type:Number})],ci.prototype,"min",void 0);Zp([p({type:Number})],ci.prototype,"max",void 0);var Nf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},xr=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Nf([p({type:String,attribute:"base-type"})],xr.prototype,"baseType",void 0);var Ms=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 Ds=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 i=this.#t(t.value),r=this.#t(e.value);return r.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,r,n):this.#n(i,r,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 i=[...t];return e.every(r=>{let s=i.findIndex(a=>this.#e(a,r,n));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,n){for(let i=0;i+e.length<=t.length;i++)if(e.every((r,s)=>this.#e(t[i+s],r,n)))return!0;return!1}};var Ns=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 Kl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},An=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 r=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!r)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===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 i=this.context.variables.find(r=>r.identifier===n);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item context`),null)}};Kl([p({type:String})],An.prototype,"identifier",void 0);Kl([_({context:F,subscribe:!0}),T()],An.prototype,"context",void 0);Kl([T(),_({context:rt,subscribe:!0})],An.prototype,"_testContext",void 0);var $s=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(r=>!e.value.includes(r))}return null}};var Ls=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 i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};var Vs=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 zs=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 $f=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},qr=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 i=parseFloat(e.value),r=parseFloat(n.value);if(!isNaN(i)&&!isNaN(r))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===r.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(r*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${r}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};$f([p({type:String,attribute:"rounding-mode"})],qr.prototype,"roundingMode",void 0);var tu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},di=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[i,r=i]=n,[s,a]=this.toleranceMode==="absolute"?[e-i,e+r]:[e*(1-i/100),e*(1+r/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};tu([p({type:String,attribute:"tolerance-mode"})],di.prototype,"toleranceMode",void 0);tu([p({type:String})],di.prototype,"tolerance",void 0);var Y=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var js=class extends Y{process(){throw new Nn}};var Fs=class extends Y{process(){throw new $n}};var Bs=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||!ae(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??ro(Array.isArray(i)?i[0]:i),i)}};var Us=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 i=parseInt(n.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}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 i of n.value){if(i==null)return null;let r=parseInt(i,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let 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 Hs=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 Ws=class extends Gt{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 Lf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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)}};Lf([p({type:String})],Cr.prototype,"n",void 0);var eu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hi=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()),i=this.#e(this.coords);if(!n||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#n(n,i);case"rect":return this.#i(n,i);case"ellipse":return this.#r(n,i);case"poly":case"polygon":return this.#o(n,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(r=>r.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let n=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(n)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:n,y:i}}#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,i,r]=e;return(t.x-n)**2+(t.y-i)**2<=r**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[n,i,r,s]=e,a=Math.min(n,r),l=Math.max(n,r),c=Math.min(i,s),d=Math.max(i,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,i,r,s]=e;return r===0||s===0?!1:(t.x-n)**2/r**2+(t.y-i)**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 i=0,r=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],l=e[r],c=e[r+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(n=!n),r=i}return n}};eu([p({type:String})],hi.prototype,"shape",void 0);eu([p({type:String})],hi.prototype,"coords",void 0);var Qs=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 i=Number.parseInt(n.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var Gs=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 i=Number.parseInt(n.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Xs=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 Ys=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 Js=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 i=Number.parseInt(n.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);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 i of n.value){let r=Number.parseInt(i,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r)}}return e}#e(t,e){let n=Math.abs(t),i=Math.abs(e);for(;i!==0;){let r=n%i;n=i,i=r}return n}#n(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var nu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pi=class extends Y{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(r=>r.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let n=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(n):e.interpolationTable&&(i=this.#t(n,e.interpolationTable)),i==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:Ot(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(n=>n.includeBoundary?t>=n.sourceValue:t>n.sourceValue)?.targetValue}};nu([p({type:String})],pi.prototype,"identifier",void 0);nu([_({context:F,subscribe:!0}),T()],pi.prototype,"context",void 0);var Ks=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 Zs=class extends Gt{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 Vf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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 i=0,r=new Set;for(let s of n)for(let a of e.areaMapEntries){if(r.has(a.coords))continue;if(J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,r.add(a.coords);break}}return r.size<n.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Vf([p({type:String})],Sr.prototype,"identifier",void 0);var zf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},kr=class extends E{getResult(){let t=this.context.variables.find(r=>r.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,n=Array.isArray(t.value)?t.value:[t.value],i=0;for(let r of n){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),r.toLowerCase(),t.baseType):J.compareSingleValues(l.mapKey,r,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};zf([p({type:String})],kr.prototype,"identifier",void 0);var ta=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 i of e.value){let r=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){r=a;break}if(r!==null)s.splice(s.indexOf(r),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 i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Er=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})],Er.prototype,"name",void 0);var Ff=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ar=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 i=parseFloat(n.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}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],i=e[1];return n===0&&i<=0||n<0&&!Number.isInteger(i)?null:Math.pow(n,i)}case"log_base":{if(e.length!==2)return null;let n=e[0],i=e[1];return n<=0||i<=0||i===1?null:Math.log(n)/Math.log(i)}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}}};Ff([p({type:String})],Ar.prototype,"name",void 0);var ea=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 i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};var na=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 i=e.value;return n.value.includes(i)}};var ia=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 i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};var ra=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 oa=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var sa=class extends E{getResult(){return null}};var aa=class extends Gt{getResult(){return Array.from(this.children).map(e=>{let n=e;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=n.calculate(),r=!1;if(typeof i=="string")if(i==="true")r=!0;else if(i==="false")r=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(r=i);return r}).some(e=>typeof e=="boolean"&&e)}};var la=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 ca=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},ui=class extends ca{shouldProcess(){return!0}getSubRules(){return[...this.children]}},mi=class extends ca{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},fi=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 da=class extends fi{};var gi=class extends mi{};var ha=class extends gi{};var pa=class extends ui{};var Bf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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}}}};Bf([p({type:String})],Ir.prototype,"pattern",void 0);var ua=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 i=parseFloat(e.value),r=parseFloat(n.value);if(isNaN(i)||isNaN(r))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&r<=0||i<0&&!Number.isInteger(r))return null;let s;try{s=Math.pow(i,r)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var Uf=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Hf(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function _r(o,t){return Hf(t===void 0?o.toExponential():o.toExponential(t))}function iu(o){let[t,e]=o.split(/e/i),n=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${n}${i}`}function ru(o,t){let e=t===0?1:t,n=o===0?0:Math.floor(Math.log10(o));return n<-4||n>=e?iu(_r(o,e-1)):iu(o.toFixed(Math.max(0,e-1-n)))}function Wf(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 i=Number(n);if(n.trim()===""||!Number.isFinite(i))return n;let r=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(r));break;case"u":s=String(Math.trunc(r)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(r).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(r).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(r).toString(16).toUpperCase()}`;break;case"f":case"F":s=r.toFixed(e??6);break;case"e":s=_r(r,e??6);break;case"E":s=_r(r,e??6).toUpperCase();break;case"g":s=ru(r,e??6);break;case"G":s=ru(r,e??6).toUpperCase();break;default:return n}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Qf(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[,i,r]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(n)}${r}`}return`${" ".repeat(n)}${o}`}function ou(o,t){return o.replace(Uf,(e,n,i,r,s,a)=>n?"%":Qf(Wf(a,i??"",s===void 0?void 0:Number(s),t),i??"",r===void 0?0:Number(r)))}var be=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},vt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(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 r=n[this.field];return r==null?null:this.#e(r,t.baseType)}let i=Object.entries(n).filter(([,r])=>r!=null);return i.length===0?null:i.map(([r,s])=>`${r}${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 ou(this.format,n);if(e==="integer"&&this.base!==10){let i=Number.parseInt(n,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(n);if(n.trim()!==""&&Number.isFinite(i))return _r(i)}return n}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};be([p({type:String})],vt.prototype,"identifier",void 0);be([p({type:String})],vt.prototype,"format",void 0);be([p({type:Number})],vt.prototype,"base",void 0);be([p({type:Number})],vt.prototype,"index",void 0);be([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);be([p({type:String})],vt.prototype,"field",void 0);be([p({type:String})],vt.prototype,"delimiter",void 0);be([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);be([_({context:F,subscribe:!0}),T()],vt.prototype,"context",void 0);var ma=class extends E{getResult(){return this.getVariables().reduce((n,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return n*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return n},1)}};var Zl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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 i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),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)]}};Zl([p({type:Number})],In.prototype,"min",void 0);Zl([p({type:Number})],In.prototype,"max",void 0);Zl([p({type:Number})],In.prototype,"step",void 0);var fa=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 Gf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},tc=1e3,Tr=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 i=0;i<t;i++){let r=e.calculate(),s=this.#n(r);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 i=Array.isArray(n.value)?n.value[0]:n.value,r=parseInt(i?.toString()??"",10);return Number.isNaN(r)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(r)}#e(t){return t>tc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${tc} limit, truncating`),tc):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"}}};Gf([p({type:String,attribute:"number-repeats"})],Tr.prototype,"numberRepeats",void 0);var ga=class extends fi{};var bi=class extends mi{};var ba=class extends bi{};var ya=class extends ui{};var va=class extends Y{process(){for(let t of[...this.children])t.process()}};var su=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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))),i=Math.pow(10,e-n-1);return Math.round(t*i)/i}};su([p({type:String,attribute:"rounding-mode"})],yi.prototype,"roundingMode",void 0);su([p({type:Number})],yi.prototype,"figures",void 0);var wa=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 xa=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 i=new ec(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},ec=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 qa=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 i=new nc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Ot):t!==null?Ot(t):null}},nc=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 Ca=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 i=new ic(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},ic=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 Xf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Rr=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((i,r)=>i-r),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((i,r)=>i+Math.pow(r-n,2),0)/e}#i(t){let e=[];for(let n of t){if(!n)continue;let i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};Xf([p({type:String})],Rr.prototype,"name",void 0);var Yf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Or=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 i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),r=this.caseSensitive==="true"?n.value:n.value.toLowerCase();return J.compareSingleValues(i,r,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Yf([p({type:String,attribute:"case-sensitive"})],Or.prototype,"caseSensitive",void 0);var Jf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Pr=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 i=e.value.toString(),r=n.value.toString();return this.caseSensitive!=="true"?r.toLowerCase().includes(i.toLowerCase()):r.includes(i)}};Jf([p({type:String,attribute:"case-sensitive"})],Pr.prototype,"caseSensitive",void 0);var Sa=class extends Kf(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Kf(o){return class extends o{calculateChildren(e){let n=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=i.calculate();return Number.isNaN(r)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(r)});return n.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):n[0]-n[1]}}}var ka=class extends E{getResult(){return new rc(Array.from(this.children)).calculate()}},rc=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 i=n.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((n,i)=>n+i,0)}};var Ea=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 Aa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var au=[{tag:"qti-and",ctor:Ps},{tag:"qti-any-n",ctor:ci},{tag:"qti-base-value",ctor:xr},{tag:"qti-container-size",ctor:Ms},{tag:"qti-contains",ctor:Ds},{tag:"qti-correct",ctor:Ns},{tag:"qti-default",ctor:An},{tag:"qti-delete",ctor:$s},{tag:"qti-divide",ctor:Ls},{tag:"qti-duration-gte",ctor:Vs},{tag:"qti-duration-lt",ctor:zs},{tag:"qti-equal",ctor:di},{tag:"qti-equal-rounded",ctor:qr},{tag:"qti-exit-response",ctor:js},{tag:"qti-exit-test",ctor:Fs},{tag:"qti-field-value",ctor:Bs},{tag:"qti-gcd",ctor:Us},{tag:"qti-gt",ctor:Hs},{tag:"qti-gte",ctor:Ws},{tag:"qti-index",ctor:Cr},{tag:"qti-inside",ctor:hi},{tag:"qti-integer-divide",ctor:Qs},{tag:"qti-integer-modulus",ctor:Gs},{tag:"qti-integer-to-float",ctor:Xs},{tag:"qti-is-null",ctor:Ys},{tag:"qti-lcm",ctor:Js},{tag:"qti-lookup-outcome-value",ctor:pi},{tag:"qti-lt",ctor:Ks},{tag:"qti-lte",ctor:Zs},{tag:"qti-map-response",ctor:kr},{tag:"qti-map-response-point",ctor:Sr},{tag:"qti-match",ctor:ta},{tag:"qti-math-constant",ctor:Er},{tag:"qti-math-operator",ctor:Ar},{tag:"qti-max",ctor:ea},{tag:"qti-member",ctor:na},{tag:"qti-min",ctor:ia},{tag:"qti-multiple",ctor:ra},{tag:"qti-not",ctor:oa},{tag:"qti-null",ctor:sa},{tag:"qti-or",ctor:aa},{tag:"qti-ordered",ctor:la},{tag:"qti-outcome-condition",ctor:da},{tag:"qti-outcome-else",ctor:pa},{tag:"qti-outcome-else-if",ctor:ha},{tag:"qti-outcome-if",ctor:gi},{tag:"qti-pattern-match",ctor:Ir},{tag:"qti-power",ctor:ua},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ma},{tag:"qti-random",ctor:fa},{tag:"qti-random-integer",ctor:In},{tag:"qti-repeat",ctor:Tr},{tag:"qti-response-condition",ctor:ga},{tag:"qti-response-else",ctor:ya},{tag:"qti-response-else-if",ctor:ba},{tag:"qti-response-if",ctor:bi},{tag:"qti-response-processing-fragment",ctor:va},{tag:"qti-round",ctor:wa},{tag:"qti-round-to",ctor:yi},{tag:"qti-rule",ctor:Y},{tag:"qti-set-correct-response",ctor:xa},{tag:"qti-set-outcome-value",ctor:qa},{tag:"qti-set-template-value",ctor:Ca},{tag:"qti-stats-operator",ctor:Rr},{tag:"qti-string-match",ctor:Or},{tag:"qti-substring",ctor:Pr},{tag:"qti-subtract",ctor:Sa},{tag:"qti-sum",ctor:ka},{tag:"qti-truncate",ctor:Ea},{tag:"qti-variable",ctor:Aa}];for(let{tag:o,ctor:t}of au)customElements.get(o)||customElements.define(o,t);var ye=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},tt;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(tt||(tt={}));var oc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(n,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(n,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(n,i)=>{this.toggleCandidateCorrection(i)},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 i=this._correctResponse;this._correctResponse=n,n==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(n)?n.join(","):n),this.requestUpdate("_correctResponse",i)}get correctness(){let n=this.correctResponse;if(!n)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let r=Array.isArray(n)?n:[n],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>r.includes(d)).length,c=a.filter(d=>!r.includes(d)).length;return l===r.length&&c===0&&a.length===r.length?tt.Correct:l>0&&(l<r.length||c>0)?tt.PartiallyCorrect:tt.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(n){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(n):this.toggleInternalCorrectResponse(n)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(n){let i=this.nextSibling,r=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(n&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==tt.Correct))){if(!r)return;this.parentElement?.removeChild(i);return}if(r)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(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 ye([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ye([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ye([L("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ye([L("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ye([L("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ye([T()],t.prototype,"_isFullCorrectResponse",void 0),ye([T()],t.prototype,"_correctResponse",void 0),t};var ht=q`
11233
+ `}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 i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>n(i.error),i.readAsDataURL(t)})}};var Ps=[{tag:"qti-upload-interaction",ctor:Os}];var Zp=[...rs,...os,...ss,...ls,...cs,...ds,...ps,...us,...ms,...fs,...gs,...bs,...ys,...ws,...xs,...Ss,...As,..._s,...Ts,...Rs,...Ps,...Gh];for(let{tag:o,ctor:t}of Zp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of 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 fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of 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 Ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of As)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of _s)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);var n2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Ld().load(`${o}`).then(a=>a.assessmentTest()),n=await Wn().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Wn().load(`${t}/${e.href}`).then(a=>a.items()),r=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:n,testURI:s,testURL:r,items:i,testIdentifier:e.identifier}},i2=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Ms=class extends Nf(Xt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Nf(o){return class extends o{calculateChildren(e){return e.map(i=>{let r=i;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var tu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ci=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}};tu([p({type:Number})],ci.prototype,"min",void 0);tu([p({type:Number})],ci.prototype,"max",void 0);var $f=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},xr=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};$f([p({type:String,attribute:"base-type"})],xr.prototype,"baseType",void 0);var Ds=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 Ns=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 i=this.#t(t.value),r=this.#t(e.value);return r.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,r,n):this.#n(i,r,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 i=[...t];return e.every(r=>{let s=i.findIndex(a=>this.#e(a,r,n));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,n){for(let i=0;i+e.length<=t.length;i++)if(e.every((r,s)=>this.#e(t[i+s],r,n)))return!0;return!1}};var $s=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(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 Zl=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},An=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 r=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!r)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===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 i=this.context.variables.find(r=>r.identifier===n);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item context`),null)}};Zl([p({type:String})],An.prototype,"identifier",void 0);Zl([_({context:F,subscribe:!0}),T()],An.prototype,"context",void 0);Zl([T(),_({context:rt,subscribe:!0})],An.prototype,"_testContext",void 0);var Ls=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(r=>!e.value.includes(r))}return null}};var Vs=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 i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};var zs=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 js=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 Lf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},qr=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 i=parseFloat(e.value),r=parseFloat(n.value);if(!isNaN(i)&&!isNaN(r))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===r.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(r*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${r}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};Lf([p({type:String,attribute:"rounding-mode"})],qr.prototype,"roundingMode",void 0);var eu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},di=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[i,r=i]=n,[s,a]=this.toleranceMode==="absolute"?[e-i,e+r]:[e*(1-i/100),e*(1+r/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};eu([p({type:String,attribute:"tolerance-mode"})],di.prototype,"toleranceMode",void 0);eu([p({type:String})],di.prototype,"tolerance",void 0);var Y=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Fs=class extends Y{process(){throw new Nn}};var Bs=class extends Y{process(){throw new $n}};var Us=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||!Pt(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??ro(Array.isArray(i)?i[0]:i),i)}};var Hs=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 i=parseInt(n.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}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 i of n.value){if(i==null)return null;let r=parseInt(i,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let 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 Ws=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 Qs=class extends Xt{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 Vf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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)}};Vf([p({type:String})],Cr.prototype,"n",void 0);var nu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},hi=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()),i=this.#e(this.coords);if(!n||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#n(n,i);case"rect":return this.#i(n,i);case"ellipse":return this.#r(n,i);case"poly":case"polygon":return this.#o(n,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(r=>r.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let n=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(n)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:n,y:i}}#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,i,r]=e;return(t.x-n)**2+(t.y-i)**2<=r**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[n,i,r,s]=e,a=Math.min(n,r),l=Math.max(n,r),c=Math.min(i,s),d=Math.max(i,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,i,r,s]=e;return r===0||s===0?!1:(t.x-n)**2/r**2+(t.y-i)**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 i=0,r=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],l=e[r],c=e[r+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(n=!n),r=i}return n}};nu([p({type:String})],hi.prototype,"shape",void 0);nu([p({type:String})],hi.prototype,"coords",void 0);var Gs=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 i=Number.parseInt(n.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var Xs=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 i=Number.parseInt(n.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Ys=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 Js=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 Ks=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 i=Number.parseInt(n.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);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 i of n.value){let r=Number.parseInt(i,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r)}}return e}#e(t,e){let n=Math.abs(t),i=Math.abs(e);for(;i!==0;){let r=n%i;n=i,i=r}return n}#n(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var iu=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},pi=class extends Y{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(r=>r.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let n=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(n):e.interpolationTable&&(i=this.#t(n,e.interpolationTable)),i==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:Ot(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(n=>n.includeBoundary?t>=n.sourceValue:t>n.sourceValue)?.targetValue}};iu([p({type:String})],pi.prototype,"identifier",void 0);iu([_({context:F,subscribe:!0}),T()],pi.prototype,"context",void 0);var Zs=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 ta=class extends Xt{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 zf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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 i=0,r=new Set;for(let s of n)for(let a of e.areaMapEntries){if(r.has(a.coords))continue;if(J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,r.add(a.coords);break}}return r.size<n.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};zf([p({type:String})],Sr.prototype,"identifier",void 0);var jf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},kr=class extends E{getResult(){let t=this.context.variables.find(r=>r.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,n=Array.isArray(t.value)?t.value:[t.value],i=0;for(let r of n){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),r.toLowerCase(),t.baseType):J.compareSingleValues(l.mapKey,r,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};jf([p({type:String})],kr.prototype,"identifier",void 0);var ea=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 i of e.value){let r=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){r=a;break}if(r!==null)s.splice(s.indexOf(r),1);else return!1;n++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Ff=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Er=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}}};Ff([p({type:String})],Er.prototype,"name",void 0);var Bf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ar=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 i=parseFloat(n.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}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],i=e[1];return n===0&&i<=0||n<0&&!Number.isInteger(i)?null:Math.pow(n,i)}case"log_base":{if(e.length!==2)return null;let n=e[0],i=e[1];return n<=0||i<=0||i===1?null:Math.log(n)/Math.log(i)}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}}};Bf([p({type:String})],Ar.prototype,"name",void 0);var na=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 i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};var ia=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 i=e.value;return n.value.includes(i)}};var ra=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 i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};var oa=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 sa=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var aa=class extends E{getResult(){return null}};var la=class extends Xt{getResult(){return Array.from(this.children).map(e=>{let n=e;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=n.calculate(),r=!1;if(typeof i=="string")if(i==="true")r=!0;else if(i==="false")r=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(r=i);return r}).some(e=>typeof e=="boolean"&&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!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var da=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},ui=class extends da{shouldProcess(){return!0}getSubRules(){return[...this.children]}},mi=class extends da{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},fi=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 ha=class extends fi{};var gi=class extends mi{};var pa=class extends gi{};var ua=class extends ui{};var Uf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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}}}};Uf([p({type:String})],Ir.prototype,"pattern",void 0);var ma=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 i=parseFloat(e.value),r=parseFloat(n.value);if(isNaN(i)||isNaN(r))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&r<=0||i<0&&!Number.isInteger(r))return null;let s;try{s=Math.pow(i,r)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var Hf=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Wf(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function _r(o,t){return Wf(t===void 0?o.toExponential():o.toExponential(t))}function ru(o){let[t,e]=o.split(/e/i),n=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${n}${i}`}function ou(o,t){let e=t===0?1:t,n=o===0?0:Math.floor(Math.log10(o));return n<-4||n>=e?ru(_r(o,e-1)):ru(o.toFixed(Math.max(0,e-1-n)))}function Qf(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 i=Number(n);if(n.trim()===""||!Number.isFinite(i))return n;let r=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(r));break;case"u":s=String(Math.trunc(r)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(r).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(r).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(r).toString(16).toUpperCase()}`;break;case"f":case"F":s=r.toFixed(e??6);break;case"e":s=_r(r,e??6);break;case"E":s=_r(r,e??6).toUpperCase();break;case"g":s=ou(r,e??6);break;case"G":s=ou(r,e??6).toUpperCase();break;default:return n}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Gf(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[,i,r]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(n)}${r}`}return`${" ".repeat(n)}${o}`}function su(o,t){return o.replace(Hf,(e,n,i,r,s,a)=>n?"%":Gf(Qf(a,i??"",s===void 0?void 0:Number(s),t),i??"",r===void 0?0:Number(r)))}var be=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},vt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(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 r=n[this.field];return r==null?null:this.#e(r,t.baseType)}let i=Object.entries(n).filter(([,r])=>r!=null);return i.length===0?null:i.map(([r,s])=>`${r}${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 su(this.format,n);if(e==="integer"&&this.base!==10){let i=Number.parseInt(n,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(n);if(n.trim()!==""&&Number.isFinite(i))return _r(i)}return n}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};be([p({type:String})],vt.prototype,"identifier",void 0);be([p({type:String})],vt.prototype,"format",void 0);be([p({type:Number})],vt.prototype,"base",void 0);be([p({type:Number})],vt.prototype,"index",void 0);be([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);be([p({type:String})],vt.prototype,"field",void 0);be([p({type:String})],vt.prototype,"delimiter",void 0);be([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);be([_({context:F,subscribe:!0}),T()],vt.prototype,"context",void 0);var fa=class extends E{getResult(){return this.getVariables().reduce((n,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return n*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return n},1)}};var tc=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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 i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),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)]}};tc([p({type:Number})],In.prototype,"min",void 0);tc([p({type:Number})],In.prototype,"max",void 0);tc([p({type:Number})],In.prototype,"step",void 0);var ga=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 Xf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},ec=1e3,Tr=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 i=0;i<t;i++){let r=e.calculate(),s=this.#n(r);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 i=Array.isArray(n.value)?n.value[0]:n.value,r=parseInt(i?.toString()??"",10);return Number.isNaN(r)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(r)}#e(t){return t>ec?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${ec} limit, truncating`),ec):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"}}};Xf([p({type:String,attribute:"number-repeats"})],Tr.prototype,"numberRepeats",void 0);var ba=class extends fi{};var bi=class extends mi{};var ya=class extends bi{};var va=class extends ui{};var wa=class extends Y{process(){for(let t of[...this.children])t.process()}};var au=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},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))),i=Math.pow(10,e-n-1);return Math.round(t*i)/i}};au([p({type:String,attribute:"rounding-mode"})],yi.prototype,"roundingMode",void 0);au([p({type:Number})],yi.prototype,"figures",void 0);var xa=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 qa=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 i=new nc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},nc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Ca=class extends 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 i=new ic(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Ot):t!==null?Ot(t):null}},ic=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 Sa=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 i=new rc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ot(this.#e(e))):Ot(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},rc=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 Yf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Rr=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((i,r)=>i-r),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((i,r)=>i+Math.pow(r-n,2),0)/e}#i(t){let e=[];for(let n of t){if(!n)continue;let i=r=>{if(r==null)return;let s=parseFloat(r.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(n.value)){n.value.forEach(r=>i(r));continue}i(n.value)}return e}};Yf([p({type:String})],Rr.prototype,"name",void 0);var Jf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Or=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 i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),r=this.caseSensitive==="true"?n.value:n.value.toLowerCase();return J.compareSingleValues(i,r,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Jf([p({type:String,attribute:"case-sensitive"})],Or.prototype,"caseSensitive",void 0);var Kf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Pr=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 i=e.value.toString(),r=n.value.toString();return this.caseSensitive!=="true"?r.toLowerCase().includes(i.toLowerCase()):r.includes(i)}};Kf([p({type:String,attribute:"case-sensitive"})],Pr.prototype,"caseSensitive",void 0);var ka=class extends Zf(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Zf(o){return class extends o{calculateChildren(e){let n=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=i.calculate();return Number.isNaN(r)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(r)});return n.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):n[0]-n[1]}}}var Ea=class extends E{getResult(){return new oc(Array.from(this.children)).calculate()}},oc=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 i=n.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((n,i)=>n+i,0)}};var Aa=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 Ia=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var lu=[{tag:"qti-and",ctor:Ms},{tag:"qti-any-n",ctor:ci},{tag:"qti-base-value",ctor:xr},{tag:"qti-container-size",ctor:Ds},{tag:"qti-contains",ctor:Ns},{tag:"qti-correct",ctor:$s},{tag:"qti-default",ctor:An},{tag:"qti-delete",ctor:Ls},{tag:"qti-divide",ctor:Vs},{tag:"qti-duration-gte",ctor:zs},{tag:"qti-duration-lt",ctor:js},{tag:"qti-equal",ctor:di},{tag:"qti-equal-rounded",ctor:qr},{tag:"qti-exit-response",ctor:Fs},{tag:"qti-exit-test",ctor:Bs},{tag:"qti-field-value",ctor:Us},{tag:"qti-gcd",ctor:Hs},{tag:"qti-gt",ctor:Ws},{tag:"qti-gte",ctor:Qs},{tag:"qti-index",ctor:Cr},{tag:"qti-inside",ctor:hi},{tag:"qti-integer-divide",ctor:Gs},{tag:"qti-integer-modulus",ctor:Xs},{tag:"qti-integer-to-float",ctor:Ys},{tag:"qti-is-null",ctor:Js},{tag:"qti-lcm",ctor:Ks},{tag:"qti-lookup-outcome-value",ctor:pi},{tag:"qti-lt",ctor:Zs},{tag:"qti-lte",ctor:ta},{tag:"qti-map-response",ctor:kr},{tag:"qti-map-response-point",ctor:Sr},{tag:"qti-match",ctor:ea},{tag:"qti-math-constant",ctor:Er},{tag:"qti-math-operator",ctor:Ar},{tag:"qti-max",ctor:na},{tag:"qti-member",ctor:ia},{tag:"qti-min",ctor:ra},{tag:"qti-multiple",ctor:oa},{tag:"qti-not",ctor:sa},{tag:"qti-null",ctor:aa},{tag:"qti-or",ctor:la},{tag:"qti-ordered",ctor:ca},{tag:"qti-outcome-condition",ctor:ha},{tag:"qti-outcome-else",ctor:ua},{tag:"qti-outcome-else-if",ctor:pa},{tag:"qti-outcome-if",ctor:gi},{tag:"qti-pattern-match",ctor:Ir},{tag:"qti-power",ctor:ma},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:fa},{tag:"qti-random",ctor:ga},{tag:"qti-random-integer",ctor:In},{tag:"qti-repeat",ctor:Tr},{tag:"qti-response-condition",ctor:ba},{tag:"qti-response-else",ctor:va},{tag:"qti-response-else-if",ctor:ya},{tag:"qti-response-if",ctor:bi},{tag:"qti-response-processing-fragment",ctor:wa},{tag:"qti-round",ctor:xa},{tag:"qti-round-to",ctor:yi},{tag:"qti-rule",ctor:Y},{tag:"qti-set-correct-response",ctor:qa},{tag:"qti-set-outcome-value",ctor:Ca},{tag:"qti-set-template-value",ctor:Sa},{tag:"qti-stats-operator",ctor:Rr},{tag:"qti-string-match",ctor:Or},{tag:"qti-substring",ctor:Pr},{tag:"qti-subtract",ctor:ka},{tag:"qti-sum",ctor:Ea},{tag:"qti-truncate",ctor:Aa},{tag:"qti-variable",ctor:Ia}];for(let{tag:o,ctor:t}of lu)customElements.get(o)||customElements.define(o,t);var ye=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},tt;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(tt||(tt={}));var sc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(n,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(n,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(n,i)=>{this.toggleCandidateCorrection(i)},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 i=this._correctResponse;this._correctResponse=n,n==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(n)?n.join(","):n),this.requestUpdate("_correctResponse",i)}get correctness(){let n=this.correctResponse;if(!n)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let r=Array.isArray(n)?n:[n],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>r.includes(d)).length,c=a.filter(d=>!r.includes(d)).length;return l===r.length&&c===0&&a.length===r.length?tt.Correct:l>0&&(l<r.length||c>0)?tt.PartiallyCorrect:tt.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(n){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(n):this.toggleInternalCorrectResponse(n)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(n){let i=this.nextSibling,r=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(n&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==tt.Correct))){if(!r)return;this.parentElement?.removeChild(i);return}if(r)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(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 ye([p({attribute:"correct-response",reflect:!0,converter:Yt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ye([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ye([L("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ye([L("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ye([L("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ye([T()],t.prototype,"_isFullCorrectResponse",void 0),ye([T()],t.prototype,"_correctResponse",void 0),t};var ht=q`
11231
11234
  /* Nothing at all until the item judges this element. */
11232
11235
  [part~='correction'] {
11233
11236
  display: none;
@@ -11260,21 +11263,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11260
11263
 
11261
11264
  pointer-events: none;
11262
11265
  }
11263
- `;var Zf=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},K=o=>{class t extends oc(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 i=this._internals;i.states.delete("candidate-correct"),i.states.delete("candidate-partially-correct"),i.states.delete("candidate-incorrect");let r=null;n&&(this.correctness===tt.Correct&&(i.states.add("candidate-correct"),r="correct"),this.correctness===tt.PartiallyCorrect&&(i.states.add("candidate-partially-correct"),r="partially-correct"),this.correctness===tt.Incorrect&&(i.states.add("candidate-incorrect"),r="incorrect")),this._candidateCorrection!==r&&(this._candidateCorrection=r)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Zf([T()],t.prototype,"_candidateCorrection",void 0),t};var _n=o=>{class t extends K(o){toggleInternalCorrectResponse(n){super.toggleInternalCorrectResponse(n);let i=this.correctResponse,r=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),n&&r.length>0&&s.internals.states.add(r.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 i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],r=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)r.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var Tt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(n){if(this.#t===n)return;let i=this.#t;this.#t=n;let r=this.internals.states;r.delete("candidate-correct"),r.delete("candidate-incorrect"),r.delete("candidate-partially-correct"),n&&r.add(`candidate-${n}`),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var sc=class extends Tt(Ve){static{this.styles=[Ve.styles,ht]}render(){return b`<div part="control"></div>
11266
+ `;var tg=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},K=o=>{class t extends sc(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 i=this._internals;i.states.delete("candidate-correct"),i.states.delete("candidate-partially-correct"),i.states.delete("candidate-incorrect");let r=null;n&&(this.correctness===tt.Correct&&(i.states.add("candidate-correct"),r="correct"),this.correctness===tt.PartiallyCorrect&&(i.states.add("candidate-partially-correct"),r="partially-correct"),this.correctness===tt.Incorrect&&(i.states.add("candidate-incorrect"),r="incorrect")),this._candidateCorrection!==r&&(this._candidateCorrection=r)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return tg([T()],t.prototype,"_candidateCorrection",void 0),t};var _n=o=>{class t extends K(o){toggleInternalCorrectResponse(n){super.toggleInternalCorrectResponse(n);let i=this.correctResponse,r=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),n&&r.length>0&&s.internals.states.add(r.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 i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],r=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)r.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var Tt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(n){if(this.#t===n)return;let i=this.#t;this.#t=n;let r=this.internals.states;r.delete("candidate-correct"),r.delete("candidate-incorrect"),r.delete("candidate-partially-correct"),n&&r.add(`candidate-${n}`),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var ac=class extends Tt(Ve){static{this.styles=[Ve.styles,ht]}render(){return b`<div part="control"></div>
11264
11267
  <slot part="label"></slot>
11265
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var tg=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ia=class extends Tt(vn){constructor(){super(...arguments),this.orderCorrect=null}};tg([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Ia.prototype,"orderCorrect",void 0);var ac=class extends Tt(wn){static{this.styles=[wn.styles,ht]}render(){return b`<div part="control"><div part="control-mark"></div></div>
11268
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var eg=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},_a=class extends Tt(vn){constructor(){super(...arguments),this.orderCorrect=null}};eg([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],_a.prototype,"orderCorrect",void 0);var lc=class extends Tt(wn){static{this.styles=[wn.styles,ht]}render(){return b`<div part="control"><div part="control-mark"></div></div>
11266
11269
  <slot part="label"></slot>
11267
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var lc=class extends Tt(Lt){static{this.styles=[Lt.styles,ht]}render(){return b`
11270
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var cc=class extends Tt(Vt){static{this.styles=[Vt.styles,ht]}render(){return b`
11268
11271
  <div part="control"></div>
11269
11272
  <slot part="label"></slot>
11270
11273
  <span part=${this.correctionPart} aria-hidden="true"></span>
11271
11274
  <div part="drop">
11272
11275
  ${Q(this.drags,t=>t.getAttribute("identifier"),t=>t)}
11273
11276
  </div>
11274
- `}};var cc=class extends Tt(Vt){static{this.styles=[Vt.styles,ht]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
11277
+ `}};var dc=class extends Tt(zt){static{this.styles=[zt.styles,ht]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
11275
11278
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
11276
11279
  <slot part="label"></slot>
11277
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var lu=class extends ft{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let n=this.getRootNode();for(;;){if(n.querySelectorAll(t).forEach(i=>i.shown=e),!(n instanceof ShadowRoot))return;n=n.host.getRootNode()}}};var cu=class extends pe{#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 du=class extends gt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,n){if(!t||!e?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(n)}},hu=class extends Pe{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},pu=class extends pn{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var dc=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Mr=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return b`
11280
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var cu=class extends ft{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let n=this.getRootNode();for(;;){if(n.querySelectorAll(t).forEach(i=>i.shown=e),!(n instanceof ShadowRoot))return;n=n.host.getRootNode()}}};var du=class extends pe{#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 hu=class extends gt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,n){if(!t||!e?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(n)}},pu=class extends Pe{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},uu=class extends pn{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var hc=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Mr=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return b`
11278
11281
  <label part="label" for="modeSelect">${this.label}</label>
11279
11282
  <select
11280
11283
  part="select"
@@ -11285,7 +11288,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11285
11288
  ${this._options[t]}
11286
11289
  </option>`)}
11287
11290
  </select>
11288
- `}};dc([_({context:xt,subscribe:!0})],Mr.prototype,"itemContext",void 0);dc([p({type:String})],Mr.prototype,"label",void 0);dc([T()],Mr.prototype,"_options",void 0);var uu=q`
11291
+ `}};hc([_({context:xt,subscribe:!0})],Mr.prototype,"itemContext",void 0);hc([p({type:String})],Mr.prototype,"label",void 0);hc([T()],Mr.prototype,"_options",void 0);var mu=q`
11289
11292
  display: inline-flex;
11290
11293
  align-items: center;
11291
11294
  cursor: pointer;
@@ -11294,12 +11297,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11294
11297
  user-select: none;
11295
11298
  `,vi=q`
11296
11299
  background-color: lightgray;
11297
- ${uu};
11300
+ ${mu};
11298
11301
  `,wi=q`
11299
11302
  cursor: not-allowed;
11300
11303
  opacity: 0.8;
11301
- `,k4=q`
11302
- ${uu};
11304
+ `,EB=q`
11305
+ ${mu};
11303
11306
  border: 1px solid gray;
11304
11307
  `;var xi=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Xe=class extends C{static{this.styles=q`
11305
11308
  :host {
@@ -11322,7 +11325,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11322
11325
  :host([disabled]) {
11323
11326
  ${wi};
11324
11327
  }
11325
- `}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(i=>i.items)).find(n=>n.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let n=!!e?.variables?.some(r=>r.correctResponse),i=!!e?.variables?.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.disabled=!n&&!i}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([_({context:j,subscribe:!0})],Je.prototype,"computedContext",void 0);Ci([p({type:Boolean,reflect:!0})],Je.prototype,"shown",void 0);Ci([p({type:Boolean,reflect:!0})],Je.prototype,"disabled",void 0);Ci([p({type:String})],Je.prototype,"showCorrectText",void 0);Ci([p({type:String})],Je.prototype,"hideCorrectText",void 0);Ci([p({type:String})],Je.prototype,"noCorrectResponseText",void 0);var te=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 pc=class extends te(Cn){};var uc=class extends _n(Sn){};var eg=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},_a=class extends Tt(G){static{this.styles=[G.styles,ht,q`
11328
+ `}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(i=>i.items)).find(n=>n.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let n=!!e?.variables?.some(r=>r.correctResponse),i=!!e?.variables?.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.disabled=!n&&!i}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([_({context:j,subscribe:!0})],Je.prototype,"computedContext",void 0);Ci([p({type:Boolean,reflect:!0})],Je.prototype,"shown",void 0);Ci([p({type:Boolean,reflect:!0})],Je.prototype,"disabled",void 0);Ci([p({type:String})],Je.prototype,"showCorrectText",void 0);Ci([p({type:String})],Je.prototype,"hideCorrectText",void 0);Ci([p({type:String})],Je.prototype,"noCorrectResponseText",void 0);var ee=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 uc=class extends ee(Cn){};var mc=class extends _n(Sn){};var ng=function(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r},Ta=class extends Tt(G){static{this.styles=[G.styles,ht,q`
11326
11329
  /*
11327
11330
  * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
11328
11331
  * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
@@ -11385,7 +11388,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11385
11388
  }
11386
11389
  `]}render(){return b`${this.renderPrompt()}${this.renderTextarea()}
11387
11390
  <span part=${this.correctionPart} aria-hidden="true"></span>
11388
- ${this.renderValidationMessage()}`}};eg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],_a.prototype,"candidateCorrection",void 0);var Ta=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[n,i]=e.split(" ");return{source:n,target:i}}):[];var mc=class extends te(ri){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ta(this.correctResponse);for(let n of this.querySelectorAll("qti-gap")){let i=n.getAttribute("identifier"),r=n.drags;for(let s of r)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var fc=class extends K(Bt){#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=>Li`
11391
+ ${this.renderValidationMessage()}`}};ng([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Ta.prototype,"candidateCorrection",void 0);var Ra=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[n,i]=e.split(" ");return{source:n,target:i}}):[];var fc=class extends ee(ri){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ra(this.correctResponse);for(let n of this.querySelectorAll("qti-gap")){let i=n.getAttribute("identifier"),r=n.drags;for(let s of r)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var gc=class extends K(Ut){#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=>Li`
11389
11392
  <line
11390
11393
  part="correct-line"
11391
11394
  x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
@@ -11396,7 +11399,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11396
11399
  stroke-width="3"
11397
11400
  stroke-dasharray="5,5"
11398
11401
  />
11399
- `)}};var gc=class extends te(kn){};var bc=class extends K(Qe){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 i of this._choiceElements){let r=n.indexOf(i.identifier);i.orderCorrect=t&&r>=0?r+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,n=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=n[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var yc=class extends _n(oi){};var vc=class extends _n(si){};var wc=class extends K(ct){static get styles(){return[ct.styles,ht,q`
11402
+ `)}};var bc=class extends ee(kn){};var yc=class extends K(Qe){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 i of this._choiceElements){let r=n.indexOf(i.identifier);i.orderCorrect=t&&r>=0?r+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,n=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=n[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var vc=class extends _n(oi){};var wc=class extends _n(si){};var xc=class extends K(ct){static get styles(){return[ct.styles,ht,q`
11400
11403
  /*
11401
11404
  * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
11402
11405
  * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
@@ -11415,7 +11418,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11415
11418
  `]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return b`
11416
11419
  ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
11417
11420
  <span part=${this.correctionPart} aria-hidden="true"></span>
11418
- `}};var xc=class extends te(ge){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ta(this.correctResponse);this.#t=t?new Set(e.map(n=>`${n.source} ${n.target}`)):new Set;for(let n of this.targetChoices){let i=n.getAttribute("identifier"),r=n.drags;for(let s of r)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function ng(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let r=0;r<o.length;r++)for(let s=0;s<r;s++)o[s]<o[r]&&t[s]+1>t[r]&&(t[r]=t[s]+1,e[r]=s);let n=0;for(let r=1;r<o.length;r++)t[r]>t[n]&&(n=r);let i=new Set;for(let r=n;r!==-1;r=e[r])i.add(r);return i}function mu(o,t){let e=new Map(t.map((a,l)=>[a,l])),n=o.filter(a=>e.has(a)),i=n.map(a=>e.get(a)),r=ng(i),s=new Set;return r.forEach(a=>s.add(n[a])),s}var qc=class extends te(Ge){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 i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).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=mu(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var Cc=class extends K(X){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,n=e?.correctResponse??this.correctResponse;this.correctResponse=t?n:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let r=document.createElement("div");r.id=i,r.className="pci-correct-response-container",Object.assign(r.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),r.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",r.append(a),this.after(r)}};var Sc=class extends K(yt){#t=[];#e=[];static{this.styles=[yt.styles,q`
11421
+ `}};var qc=class extends ee(ge){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ra(this.correctResponse);this.#t=t?new Set(e.map(n=>`${n.source} ${n.target}`)):new Set;for(let n of this.targetChoices){let i=n.getAttribute("identifier"),r=n.drags;for(let s of r)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function ig(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let r=0;r<o.length;r++)for(let s=0;s<r;s++)o[s]<o[r]&&t[s]+1>t[r]&&(t[r]=t[s]+1,e[r]=s);let n=0;for(let r=1;r<o.length;r++)t[r]>t[n]&&(n=r);let i=new Set;for(let r=n;r!==-1;r=e[r])i.add(r);return i}function fu(o,t){let e=new Map(t.map((a,l)=>[a,l])),n=o.filter(a=>e.has(a)),i=n.map(a=>e.get(a)),r=ig(i),s=new Set;return r.forEach(a=>s.add(n[a])),s}var Cc=class extends ee(Ge){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 i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).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=fu(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var Sc=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 i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let r=document.createElement("div");r.id=i,r.className="pci-correct-response-container",Object.assign(r.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),r.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",r.append(a),this.after(r)}};var kc=class extends K(yt){#t=[];#e=[];static{this.styles=[yt.styles,q`
11419
11422
  [part~='correct'] {
11420
11423
  --qti-select-point-marker-color: var(--qti-correct);
11421
11424
  }
@@ -11423,12 +11426,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11423
11426
  --qti-select-point-marker-color: var(--qti-incorrect);
11424
11427
  }
11425
11428
  `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let n=this._effectiveAreaEntries,i=this.responseVariable?.baseType,r=this.correctResponse;for(let s of this.responsePoints){let a=n.some(l=>J.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,i));!n.length&&r&&(a=(Array.isArray(r)?r:[r]).some(c=>{let[d,h]=c.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let i=this.#t;this.#t=[],this.requestUpdate("correctAreas",i);return}let e=this._effectiveAreaEntries;if(!e.length){let i=this.correctResponse,r=i?Array.isArray(i)?i:[i]:[];if(r.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=r.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let n=this.#t;this.#t=e.map(i=>({shape:i.shape,coords:i.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
11426
- style=${As({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
11429
+ style=${Is({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
11427
11430
  data-correction-area
11428
11431
  data-coord=${t.coords}
11429
11432
  data-shape=${t.shape}
11430
11433
  alt=${`correct-response-${e+1}`}
11431
- ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var kc=class extends K(It){#t=null;static{this.styles=[It.styles,q`
11434
+ ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Ec=class extends K(It){#t=null;static{this.styles=[It.styles,q`
11432
11435
  [part='knob-correct'] {
11433
11436
  background-color: var(--qti-correct-light);
11434
11437
  border: 2px solid var(--qti-correct);
@@ -11443,7 +11446,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11443
11446
  }
11444
11447
  `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,n=Array.isArray(e)?e[0]:e,i=t&&n?parseFloat(n):NaN,r=this.#t;if(this.#t=Number.isFinite(i)?i:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",r)}renderRailSupplement(){return this.#t===null?P:b`<div id="knob-correct" part="knob-correct">
11445
11448
  <div id="value" part="value">${this.#t}</div>
11446
- </div>`}};var Ec=class extends K(pt){static{this.styles=[pt.styles,ht,q`
11449
+ </div>`}};var Ac=class extends K(pt){static{this.styles=[pt.styles,ht,q`
11447
11450
  /*
11448
11451
  * The trailing inset only — size and leading gap come from the shared sheet.
11449
11452
  *
@@ -11476,7 +11479,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11476
11479
  ${this.renderAnswer()} ${this.renderInput()}
11477
11480
  <span part=${this.correctionPart} aria-hidden="true"></span>
11478
11481
  ${this.renderValidationMessage()}
11479
- `}};export{K as CandidateCorrectionMixin,_n as ChoiceCorrectionMixin,oc as CorrectResponseMixin,tt as Correctness,nl as CustomStateSetShim,il as INITIAL_SESSION_CONTEXT,rl as INITIAL_TEST_CONTEXT,D as Interaction,al as IsNullOrUndefined,$t as ItemContainer,Mr as ItemCorrectResponseMode,hr as ItemPrintVariables,Xe as ItemShowCandidateCorrection,Ye as ItemShowCorrectResponse,qh as ItemViewMixin,xd as PUBLIC_ITEM_EVENTS,_o as QTI_TEST_STATE_VERSION,Ps as QtiAnd,ci as QtiAnyN,ft as QtiAssessmentItem,lu as QtiAssessmentItemCorrection,Ct as QtiAssessmentItemRef,St as QtiAssessmentSection,co as QtiAssessmentStimulus,Qn as QtiAssessmentStimulusRef,ql as QtiAssessmentStimulusRefConnectedEvent,on as QtiAssessmentTest,ti as QtiAssociableHotspot,Cn as QtiAssociateInteraction,pc as QtiAssociateInteractionCorrection,xr as QtiBaseValue,le as QtiBranchRule,Sn as QtiChoiceInteraction,uc as QtiChoiceInteractionCorrection,fo as QtiCompanionMaterialsInfo,Gt as QtiConditionExpression,Ms as QtiContainerSize,Ds as QtiContains,Xi as QtiContentBody,Gn as QtiContextDeclaration,Ns as QtiCorrect,me as QtiCustomInteraction,Yi as QtiCustomOperator,An as QtiDefault,$s as QtiDelete,Ls as QtiDivide,Vs as QtiDurationGte,zs as QtiDurationLt,We as QtiEndAttemptInteraction,di as QtiEqual,qr as QtiEqualRounded,js as QtiExitResponse,Nn as QtiExitResponseSignal,Fs as QtiExitTest,$n as QtiExitTestSignal,E as QtiExpression,G as QtiExtendedTextInteraction,_a as QtiExtendedTextInteractionCorrection,mt as QtiFeedback,go as QtiFeedbackBlock,bo as QtiFeedbackInline,Bs as QtiFieldValue,bn as QtiGap,pr as QtiGapImg,ri as QtiGapMatchInteraction,mc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,sc as QtiGapTextCorrection,Us as QtiGcd,Bt as QtiGraphicAssociateInteraction,fc as QtiGraphicAssociateInteractionCorrection,kn as QtiGraphicGapMatchInteraction,gc as QtiGraphicGapMatchInteractionCorrection,Qe as QtiGraphicOrderInteraction,bc as QtiGraphicOrderInteractionCorrection,Hs as QtiGt,Ws as QtiGte,vn as QtiHotspotChoice,Ia as QtiHotspotChoiceCorrection,oi as QtiHotspotInteraction,yc as QtiHotspotInteractionCorrection,wn as QtiHottext,ac as QtiHottextCorrection,si as QtiHottextInteraction,vc as QtiHottextInteractionCorrection,Cr as QtiIndex,ur as QtiInlineChoice,ct as QtiInlineChoiceInteraction,wc as QtiInlineChoiceInteractionCorrection,hi as QtiInside,Qs as QtiIntegerDivide,Gs as QtiIntegerModulus,Xs as QtiIntegerToFloat,Ys as QtiIsNull,pe as QtiItem,yo as QtiItemBody,cu as QtiItemCorrection,Pt as QtiItemSessionControl,Js as QtiLcm,pi as QtiLookupOutcomeValue,Ks as QtiLt,Zs as QtiLte,kr as QtiMapResponse,Sr as QtiMapResponsePoint,ta as QtiMatch,ge as QtiMatchInteraction,xc as QtiMatchInteractionCorrection,Er as QtiMathConstant,Ar as QtiMathOperator,ea as QtiMax,ys as QtiMediaInteraction,na as QtiMember,ia as QtiMin,Xn as QtiModalFeedback,ra as QtiMultiple,oa as QtiNot,sa as QtiNull,Wi as QtiNumberPresented,so as QtiNumberSelected,aa as QtiOr,Ge as QtiOrderInteraction,qc as QtiOrderInteractionCorrection,la as QtiOrdered,da as QtiOutcomeCondition,ce as QtiOutcomeDeclaration,pa as QtiOutcomeElse,ha as QtiOutcomeElseIf,gi as QtiOutcomeIf,lo as QtiOutcomeProcessing,bl as QtiOutcomeProcessingProcessor,Ir as QtiPatternMatch,X as QtiPortableCustomInteraction,Cc as QtiPortableCustomInteractionCorrection,Ss as QtiPositionObjectInteraction,ks as QtiPositionObjectStage,ua as QtiPower,ao as QtiPreCondition,vt as QtiPrintedVariable,ma as QtiProduct,Ho as QtiPrompt,fa as QtiRandom,In as QtiRandomInteger,Tr as QtiRepeat,ga as QtiResponseCondition,Ie as QtiResponseDeclaration,ya as QtiResponseElse,ba as QtiResponseElseIf,bi as QtiResponseIf,wo as QtiResponseProcessing,va as QtiResponseProcessingFragment,wa as QtiRound,yi as QtiRoundTo,de as QtiRubricBlock,bd as QtiRuleElement,yt as QtiSelectPointInteraction,Sc as QtiSelectPointInteractionCorrection,xa as QtiSetCorrectResponse,ec as QtiSetCorrectResponseRule,qa as QtiSetOutcomeValue,nc as QtiSetOutcomeValueRule,Ca as QtiSetTemplateValue,ic as QtiSetTemplateValueRule,Lt as QtiSimpleAssociableChoice,lc as QtiSimpleAssociableChoiceCorrection,Vt as QtiSimpleChoice,cc as QtiSimpleChoiceCorrection,It as QtiSliderInteraction,kc as QtiSliderInteractionCorrection,Rr as QtiStatsOperator,Or as QtiStringMatch,Co as QtiStylesheet,Pr as QtiSubstring,Sa as QtiSubtract,ka as QtiSum,rc as QtiSumExpression,So as QtiTemplateConstraint,he as QtiTemplateDeclaration,ko as QtiTemplateProcessing,Pe as QtiTest,hu as QtiTestCorrection,er as QtiTestFeedback,Oe as QtiTestPart,nr as QtiTestVariables,Sl as QtiTestVariablesExpression,pt as QtiTextEntryInteraction,Ec as QtiTextEntryInteractionCorrection,Ea as QtiTruncate,Rs as QtiUploadInteraction,Aa as QtiVariable,Dn as QtiVariableDeclaration,J as ScoringHelper,Ne as TestBookmark,pn as TestCheckItem,pu as TestCheckItemCorrection,kt as TestContainer,ln as TestEndAttempt,rr as TestItemLink,fn as TestItemToSpeech,gt as TestNavigation,du as TestNavigationCorrection,dn as TestNext,hn as TestPrev,sr as TestPrintContext,ar as TestPrintVariables,un as TestScoringButtons,Kn as TestScoringFeedback,or as TestSectionLink,Je as TestShowCorrectResponse,mn as TestStamp,Bo as TestTtsNext,Vo as TestTtsPause,Uo as TestTtsPick,dr as TestTtsPlay,Fo as TestTtsPrev,zo as TestTtsResume,jo as TestTtsStop,Jt as TestView,cr as TestViewToggle,Py as asSeed,Rl as bookmarkedItems,O as boxSizing,Ju as classifyCustomStateSupport,j as computedContext,Ce as computedItemContext,xt as configContext,Ot as convertNumberToUniversalFormat,ht as correctionPart,lv as decimalSeparator,pl as dispatchDeclared,Ln as dispatchPublic,Qt as dropRegion,yd as getCustomOperator,n2 as getItemByUri,e2 as getManifestInfo,ro as inferRecordFieldBaseType,Tf as inlineScriptText,Rf as inlineStyleText,ud as installCustomStateSetFallback,Pn as interactionContext,ae as isRecordValue,Zu as isSeed,F as itemContext,md as itemContextVariables,bv as iterResponseValues,ul as listenDeclared,qd as listenPublic,yv as parsePair,wv as parsePoint,ll as parseResponseAttribute,wh as pluginElements,fh as pluginState,Df as qtiAndMixin,qt as qtiContext,Kp as qtiInteractionElements,Kf as qtiSubtractMixin,Yt as qtiTransformItem,$d as qtiTransformManifest,Wn as qtiTransformTest,Hi as readRecordFieldValues,Ev as registerCustomOperator,io as removeDoubleSlashes,Xt as responseAttributeConverter,vv as serializePair,xv as serializePoint,cl as serializeResponseAttribute,Se as sessionContext,rt as testContext,vh as ttsElements,Av as unregisterCustomOperator,W as validationMessage};
11482
+ `}};export{K as CandidateCorrectionMixin,_n as ChoiceCorrectionMixin,sc as CorrectResponseMixin,tt as Correctness,il as CustomStateSetShim,rl as INITIAL_SESSION_CONTEXT,ol as INITIAL_TEST_CONTEXT,D as Interaction,ll as IsNullOrUndefined,Lt as ItemContainer,Mr as ItemCorrectResponseMode,hr as ItemPrintVariables,Xe as ItemShowCandidateCorrection,Ye as ItemShowCorrectResponse,Ch as ItemViewMixin,qd as PUBLIC_ITEM_EVENTS,_o as QTI_TEST_STATE_VERSION,Ms as QtiAnd,ci as QtiAnyN,ft as QtiAssessmentItem,cu as QtiAssessmentItemCorrection,Ct as QtiAssessmentItemRef,St as QtiAssessmentSection,co as QtiAssessmentStimulus,Qn as QtiAssessmentStimulusRef,Cl as QtiAssessmentStimulusRefConnectedEvent,on as QtiAssessmentTest,ti as QtiAssociableHotspot,Cn as QtiAssociateInteraction,uc as QtiAssociateInteractionCorrection,xr as QtiBaseValue,le as QtiBranchRule,Sn as QtiChoiceInteraction,mc as QtiChoiceInteractionCorrection,fo as QtiCompanionMaterialsInfo,Xt as QtiConditionExpression,Ds as QtiContainerSize,Ns as QtiContains,Xi as QtiContentBody,Gn as QtiContextDeclaration,$s as QtiCorrect,me as QtiCustomInteraction,Yi as QtiCustomOperator,An as QtiDefault,Ls as QtiDelete,Vs as QtiDivide,zs as QtiDurationGte,js as QtiDurationLt,We as QtiEndAttemptInteraction,di as QtiEqual,qr as QtiEqualRounded,Fs as QtiExitResponse,Nn as QtiExitResponseSignal,Bs as QtiExitTest,$n as QtiExitTestSignal,E as QtiExpression,G as QtiExtendedTextInteraction,Ta as QtiExtendedTextInteractionCorrection,mt as QtiFeedback,go as QtiFeedbackBlock,bo as QtiFeedbackInline,Us as QtiFieldValue,bn as QtiGap,pr as QtiGapImg,ri as QtiGapMatchInteraction,fc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,ac as QtiGapTextCorrection,Hs as QtiGcd,Ut as QtiGraphicAssociateInteraction,gc as QtiGraphicAssociateInteractionCorrection,kn as QtiGraphicGapMatchInteraction,bc as QtiGraphicGapMatchInteractionCorrection,Qe as QtiGraphicOrderInteraction,yc as QtiGraphicOrderInteractionCorrection,Ws as QtiGt,Qs as QtiGte,vn as QtiHotspotChoice,_a as QtiHotspotChoiceCorrection,oi as QtiHotspotInteraction,vc as QtiHotspotInteractionCorrection,wn as QtiHottext,lc as QtiHottextCorrection,si as QtiHottextInteraction,wc as QtiHottextInteractionCorrection,Cr as QtiIndex,ur as QtiInlineChoice,ct as QtiInlineChoiceInteraction,xc as QtiInlineChoiceInteractionCorrection,hi as QtiInside,Gs as QtiIntegerDivide,Xs as QtiIntegerModulus,Ys as QtiIntegerToFloat,Js as QtiIsNull,pe as QtiItem,yo as QtiItemBody,du as QtiItemCorrection,Mt as QtiItemSessionControl,Ks as QtiLcm,pi as QtiLookupOutcomeValue,Zs as QtiLt,ta as QtiLte,kr as QtiMapResponse,Sr as QtiMapResponsePoint,ea as QtiMatch,ge as QtiMatchInteraction,qc as QtiMatchInteractionCorrection,Er as QtiMathConstant,Ar as QtiMathOperator,na as QtiMax,vs as QtiMediaInteraction,ia as QtiMember,ra as QtiMin,Xn as QtiModalFeedback,oa as QtiMultiple,sa as QtiNot,aa as QtiNull,Wi as QtiNumberPresented,so as QtiNumberSelected,la as QtiOr,Ge as QtiOrderInteraction,Cc as QtiOrderInteractionCorrection,ca as QtiOrdered,ha as QtiOutcomeCondition,ce as QtiOutcomeDeclaration,ua as QtiOutcomeElse,pa as QtiOutcomeElseIf,gi as QtiOutcomeIf,lo as QtiOutcomeProcessing,yl as QtiOutcomeProcessingProcessor,Ir as QtiPatternMatch,X as QtiPortableCustomInteraction,Sc as QtiPortableCustomInteractionCorrection,ks as QtiPositionObjectInteraction,Es as QtiPositionObjectStage,ma as QtiPower,ao as QtiPreCondition,vt as QtiPrintedVariable,fa as QtiProduct,Wo as QtiPrompt,ga as QtiRandom,In as QtiRandomInteger,Tr as QtiRepeat,ba as QtiResponseCondition,Ie as QtiResponseDeclaration,va as QtiResponseElse,ya as QtiResponseElseIf,bi as QtiResponseIf,wo as QtiResponseProcessing,wa as QtiResponseProcessingFragment,xa as QtiRound,yi as QtiRoundTo,de as QtiRubricBlock,yd as QtiRuleElement,yt as QtiSelectPointInteraction,kc as QtiSelectPointInteractionCorrection,qa as QtiSetCorrectResponse,nc as QtiSetCorrectResponseRule,Ca as QtiSetOutcomeValue,ic as QtiSetOutcomeValueRule,Sa as QtiSetTemplateValue,rc as QtiSetTemplateValueRule,Vt as QtiSimpleAssociableChoice,cc as QtiSimpleAssociableChoiceCorrection,zt as QtiSimpleChoice,dc as QtiSimpleChoiceCorrection,It as QtiSliderInteraction,Ec as QtiSliderInteractionCorrection,Rr as QtiStatsOperator,Or as QtiStringMatch,Co as QtiStylesheet,Pr as QtiSubstring,ka as QtiSubtract,Ea as QtiSum,oc as QtiSumExpression,So as QtiTemplateConstraint,he as QtiTemplateDeclaration,ko as QtiTemplateProcessing,Pe as QtiTest,pu as QtiTestCorrection,er as QtiTestFeedback,Oe as QtiTestPart,nr as QtiTestVariables,kl as QtiTestVariablesExpression,pt as QtiTextEntryInteraction,Ac as QtiTextEntryInteractionCorrection,Aa as QtiTruncate,Os as QtiUploadInteraction,Ia as QtiVariable,Dn as QtiVariableDeclaration,J as ScoringHelper,Ne as TestBookmark,pn as TestCheckItem,uu as TestCheckItemCorrection,kt as TestContainer,ln as TestEndAttempt,rr as TestItemLink,fn as TestItemToSpeech,gt as TestNavigation,hu as TestNavigationCorrection,dn as TestNext,hn as TestPrev,sr as TestPrintContext,ar as TestPrintVariables,un as TestScoringButtons,Kn as TestScoringFeedback,or as TestSectionLink,Je as TestShowCorrectResponse,mn as TestStamp,Uo as TestTtsNext,zo as TestTtsPause,Ho as TestTtsPick,dr as TestTtsPlay,Bo as TestTtsPrev,jo as TestTtsResume,Fo as TestTtsStop,Kt as TestView,cr as TestViewToggle,My as asSeed,Ol as bookmarkedItems,O as boxSizing,Ku as classifyCustomStateSupport,j as computedContext,Ce as computedItemContext,xt as configContext,Ot as convertNumberToUniversalFormat,ht as correctionPart,cv as decimalSeparator,ul as dispatchDeclared,Ln as dispatchPublic,Gt as dropRegion,vd as getCustomOperator,i2 as getItemByUri,n2 as getManifestInfo,ro as inferRecordFieldBaseType,Rf as inlineScriptText,Of as inlineStyleText,md as installCustomStateSetFallback,Pn as interactionContext,Pt as isRecordValue,tm as isSeed,F as itemContext,fd as itemContextVariables,yv as iterResponseValues,ml as listenDeclared,Cd as listenPublic,vv as parsePair,xv as parsePoint,cl as parseResponseAttribute,xh as pluginElements,gh as pluginState,Nf as qtiAndMixin,qt as qtiContext,Zp as qtiInteractionElements,Zf as qtiSubtractMixin,Jt as qtiTransformItem,Ld as qtiTransformManifest,Wn as qtiTransformTest,Hi as readRecordFieldValues,Av as registerCustomOperator,io as removeDoubleSlashes,Yt as responseAttributeConverter,wv as serializePair,qv as serializePoint,dl as serializeResponseAttribute,Se as sessionContext,rt as testContext,wh as ttsElements,Iv as unregisterCustomOperator,W as validationMessage};
11480
11483
  /*! Bundled license information:
11481
11484
 
11482
11485
  @lit-labs/ssr-dom-shim/lib/element-internals.js: