@citolab/qti-components 6.7.1-42 → 6.7.1-43

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/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnPropertyDescriptor,$s=Object.getOwnPropertyDescriptors;var qr=Object.getOwnPropertySymbols;var Ss=Object.prototype.hasOwnProperty,Rs=Object.prototype.propertyIsEnumerable;var wr=(i,t,e)=>t in i?Tr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t)=>{for(var e in t||(t={}))Ss.call(t,e)&&wr(i,e,t[e]);if(qr)for(var e of qr(t))Rs.call(t,e)&&wr(i,e,t[e]);return i},T=(i,t)=>ws(i,$s(t));var a=(i,t,e,r)=>{for(var s=r>1?void 0:r?Ts(t,e):t,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(t,e,s):n(s))||s);return r&&s&&Tr(t,e,s),s};var te=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var ge=class{constructor(t,e,r,s){var o;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,l)),this.unsubscribe=l},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=(o=n.subscribe)!=null?o:!1}else this.context=e,this.callback=r,this.subscribe=s!=null?s:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new te(this.context,this.t,this.subscribe))}};var lt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}};var Ft=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},be=class extends lt{constructor(t,e,r){var s,o;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{let l=n.composedPath()[0];n.context===this.context&&l!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,l,n.subscribe))},this.onProviderRequest=n=>{let l=n.composedPath()[0];if(n.context!==this.context||l===this.host)return;let c=new Set;for(let[u,{consumerHost:h}]of this.subscriptions)c.has(u)||(c.add(u),h.dispatchEvent(new te(this.context,u,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(s=this.host).addController)==null||o.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ft(this.context))}};function Bt({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new be(this,{context:i}))}),{get(){return t.get.call(this)},set(s){var o;return(o=r.get(this))==null||o.setValue(s),t.set.call(this,s)},init(s){var o;return(o=r.get(this))==null||o.setValue(s),s}};{t.constructor.addInitializer(n=>{r.set(n,new be(n,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),o;if(s===void 0){let n=new WeakMap;o={get:function(){return n.get(this)},set:function(l){r.get(this).setValue(l),n.set(this,l)},configurable:!0,enumerable:!0}}else{let n=s.set;o=T(E({},s),{set:function(l){r.get(this).setValue(l),n==null||n.call(this,l)}})}return void Object.defineProperty(t,e,o)}}}function K({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new ge(this,{context:i,callback:s=>{this[r.name]=s},subscribe:t})}):e.constructor.addInitializer(s=>{new ge(s,{context:i,callback:o=>{s[r]=o},subscribe:t})})}}var $r=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",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 Sr=new WeakMap,Se=i=>{let t=Sr.get(i);return t===void 0&&Sr.set(i,t=new Map),t},Ms=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Se(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){Se(this).set(t,String(e))}removeAttribute(t){Se(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 Se(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new $r(this);return this.__internals=t,t}getAttribute(t){let e=Se(this).get(t);return e!=null?e:null}};var Ls=class extends Ms{},Rr=Ls;var Ns=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},Hs=Ns;var kr=new Hs;var Re=globalThis,ct=Re.ShadowRoot&&(Re.ShadyCSS===void 0||Re.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jt=Symbol(),Mr=new WeakMap,ke=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==jt)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(ct&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Mr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Mr.set(e,t))}return t}toString(){return this.cssText}},Lr=i=>new ke(typeof i=="string"?i:i+"",void 0,jt),b=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,s,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[o+1],i[0]);return new ke(e,i,jt)},Xt=(i,t)=>{if(ct)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Re.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},pt=ct||Re.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Lr(e)})(i):i;var{is:Ps,defineProperty:Vs,getOwnPropertyDescriptor:Ds,getOwnPropertyNames:Os,getOwnPropertySymbols:Us,getPrototypeOf:Is}=Object,O=globalThis,Pr;(Pr=O.customElements)!=null||(O.customElements=kr);var Nr=O.trustedTypes,Fs=Nr?Nr.emptyScript:"",Yt=O.reactiveElementPolyfillSupport,Me=(i,t)=>i,Le={toAttribute(i,t){switch(t){case Boolean:i=i?Fs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},dt=(i,t)=>!Ps(i,t),Hr={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:dt},Vr,Dr;(Vr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Dr=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var Or,J=class extends((Or=globalThis.HTMLElement)!=null?Or:Rr){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Hr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Vs(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var n;let{get:s,set:o}=(n=Ds(this.prototype,t))!=null?n:{get(){return this[e]},set(l){this[e]=l}};return{get(){return s==null?void 0:s.call(this)},set(l){let c=s==null?void 0:s.call(this);o.call(this,l),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Hr}static _$Ei(){if(this.hasOwnProperty(Me("elementProperties")))return;let t=Is(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Me("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Me("properties"))){let e=this.properties,r=[...Os(e),...Us(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(pt(s))}else t!==void 0&&e.push(pt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Xt(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var o;let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let n=(((o=r.converter)==null?void 0:o.toAttribute)!==void 0?r.converter:Le).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){var o;let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let n=r.getPropertyOptions(s),l=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:Le;this._$Em=s,this[s]=l.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,r){var s;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((s=r.hasChanged)!=null?s:dt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){var s;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((s=this._$Ej)!=null?s:this._$Ej=new Set).add(t)}async _$ET(){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(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,l]of this._$Ep)this[n]=l;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[n,l]of o)l.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],l)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(o=>{var n;return(n=o.hostUpdate)==null?void 0:n.call(o)}),this.update(e)):this._$EU()}catch(o){throw t=!1,this._$EU(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}},Ur;J.elementStyles=[],J.shadowRootOptions={mode:"open"},J[Me("elementProperties")]=new Map,J[Me("finalized")]=new Map,Yt==null||Yt({ReactiveElement:J}),((Ur=O.reactiveElementVersions)!=null?Ur:O.reactiveElementVersions=[]).push("2.0.4");var ve=globalThis,ut=ve.trustedTypes,Ir=ut?ut.createPolicy("lit-html",{createHTML:i=>i}):void 0,Kt="$lit$",Z=`lit$${(Math.random()+"").slice(9)}$`,Jt="?"+Z,Bs=`<${Jt}>`,ce=ve.document===void 0?{createTreeWalker:()=>({})}:document,He=()=>ce.createComment(""),Pe=i=>i===null||typeof i!="object"&&typeof i!="function",Wr=Array.isArray,Kr=i=>Wr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",zt=`[
1
+ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnPropertyDescriptor,$s=Object.getOwnPropertyDescriptors;var qr=Object.getOwnPropertySymbols;var Ss=Object.prototype.hasOwnProperty,Rs=Object.prototype.propertyIsEnumerable;var wr=(i,t,e)=>t in i?Tr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t)=>{for(var e in t||(t={}))Ss.call(t,e)&&wr(i,e,t[e]);if(qr)for(var e of qr(t))Rs.call(t,e)&&wr(i,e,t[e]);return i},T=(i,t)=>ws(i,$s(t));var a=(i,t,e,r)=>{for(var s=r>1?void 0:r?Ts(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&Tr(t,e,s),s};var te=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var ge=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,l)),this.unsubscribe=l},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=(n=o.subscribe)!=null?n:!1}else this.context=e,this.callback=r,this.subscribe=s!=null?s:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new te(this.context,this.t,this.subscribe))}};var lt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}};var Ft=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},be=class extends lt{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let l=o.composedPath()[0];o.context===this.context&&l!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,l,o.subscribe))},this.onProviderRequest=o=>{let l=o.composedPath()[0];if(o.context!==this.context||l===this.host)return;let c=new Set;for(let[u,{consumerHost:h}]of this.subscriptions)c.has(u)||(c.add(u),h.dispatchEvent(new te(this.context,u,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(n=(s=this.host).addController)==null||n.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ft(this.context))}};function Bt({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new be(this,{context:i}))}),{get(){return t.get.call(this)},set(s){var n;return(n=r.get(this))==null||n.setValue(s),t.set.call(this,s)},init(s){var n;return(n=r.get(this))==null||n.setValue(s),s}};{t.constructor.addInitializer(o=>{r.set(o,new be(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get:function(){return o.get(this)},set:function(l){r.get(this).setValue(l),o.set(this,l)},configurable:!0,enumerable:!0}}else{let o=s.set;n=T(E({},s),{set:function(l){r.get(this).setValue(l),o==null||o.call(this,l)}})}return void Object.defineProperty(t,e,n)}}}function K({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new ge(this,{context:i,callback:s=>{this[r.name]=s},subscribe:t})}):e.constructor.addInitializer(s=>{new ge(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var $r=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",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 Sr=new WeakMap,Se=i=>{let t=Sr.get(i);return t===void 0&&Sr.set(i,t=new Map),t},Ms=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Se(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){Se(this).set(t,String(e))}removeAttribute(t){Se(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 Se(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new $r(this);return this.__internals=t,t}getAttribute(t){let e=Se(this).get(t);return e!=null?e:null}};var Ls=class extends Ms{},Rr=Ls;var Ns=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},Hs=Ns;var kr=new Hs;var Re=globalThis,ct=Re.ShadowRoot&&(Re.ShadyCSS===void 0||Re.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jt=Symbol(),Mr=new WeakMap,ke=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==jt)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(ct&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Mr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Mr.set(e,t))}return t}toString(){return this.cssText}},Lr=i=>new ke(typeof i=="string"?i:i+"",void 0,jt),b=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new ke(e,i,jt)},Xt=(i,t)=>{if(ct)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Re.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},pt=ct||Re.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Lr(e)})(i):i;var{is:Ps,defineProperty:Vs,getOwnPropertyDescriptor:Ds,getOwnPropertyNames:Os,getOwnPropertySymbols:Us,getPrototypeOf:Is}=Object,O=globalThis,Pr;(Pr=O.customElements)!=null||(O.customElements=kr);var Nr=O.trustedTypes,Fs=Nr?Nr.emptyScript:"",Yt=O.reactiveElementPolyfillSupport,Me=(i,t)=>i,Le={toAttribute(i,t){switch(t){case Boolean:i=i?Fs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},dt=(i,t)=>!Ps(i,t),Hr={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:dt},Vr,Dr;(Vr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Dr=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var Or,J=class extends((Or=globalThis.HTMLElement)!=null?Or:Rr){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Hr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Vs(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Ds(this.prototype,t))!=null?o:{get(){return this[e]},set(l){this[e]=l}};return{get(){return s==null?void 0:s.call(this)},set(l){let c=s==null?void 0:s.call(this);n.call(this,l),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Hr}static _$Ei(){if(this.hasOwnProperty(Me("elementProperties")))return;let t=Is(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Me("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Me("properties"))){let e=this.properties,r=[...Os(e),...Us(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(pt(s))}else t!==void 0&&e.push(pt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Xt(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var n;let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Le).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),l=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Le;this._$Em=s,this[s]=l.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){var s;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((s=r.hasChanged)!=null?s:dt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){var s;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((s=this._$Ej)!=null?s:this._$Ej=new Set).add(t)}async _$ET(){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(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,l]of this._$Ep)this[o]=l;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,l]of n)l.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],l)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}},Ur;J.elementStyles=[],J.shadowRootOptions={mode:"open"},J[Me("elementProperties")]=new Map,J[Me("finalized")]=new Map,Yt==null||Yt({ReactiveElement:J}),((Ur=O.reactiveElementVersions)!=null?Ur:O.reactiveElementVersions=[]).push("2.0.4");var ve=globalThis,ut=ve.trustedTypes,Ir=ut?ut.createPolicy("lit-html",{createHTML:i=>i}):void 0,Kt="$lit$",Z=`lit$${(Math.random()+"").slice(9)}$`,Jt="?"+Z,Bs=`<${Jt}>`,ce=ve.document===void 0?{createTreeWalker:()=>({})}:document,He=()=>ce.createComment(""),Pe=i=>i===null||typeof i!="object"&&typeof i!="function",Wr=Array.isArray,Kr=i=>Wr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",zt=`[
2
2
  \f\r]`,Ne=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fr=/-->/g,Br=/>/g,ae=RegExp(`>|${zt}(?:([^\\s"'>=/]+)(${zt}*=${zt}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),jr=/'/g,Xr=/"/g,Jr=/^(?:script|style|textarea|title)$/i,Zr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=Zr(1),Zt=Zr(2),L=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yr=new WeakMap,le=ce.createTreeWalker(ce,129);function Gr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ir!==void 0?Ir.createHTML(t):t}var Qr=(i,t)=>{let e=i.length-1,r=[],s,o=t===2?"<svg>":"",n=Ne;for(let l=0;l<e;l++){let c=i[l],u,h,f=-1,x=0;for(;x<c.length&&(n.lastIndex=x,h=n.exec(c),h!==null);)x=n.lastIndex,n===Ne?h[1]==="!--"?n=Fr:h[1]!==void 0?n=Br:h[2]!==void 0?(Jr.test(h[2])&&(s=RegExp("</"+h[2],"g")),n=ae):h[3]!==void 0&&(n=ae):n===ae?h[0]===">"?(n=s!=null?s:Ne,f=-1):h[1]===void 0?f=-2:(f=n.lastIndex-h[2].length,u=h[1],n=h[3]===void 0?ae:h[3]==='"'?Xr:jr):n===Xr||n===jr?n=ae:n===Fr||n===Br?n=Ne:(n=ae,s=void 0);let v=n===ae&&i[l+1].startsWith("/>")?" ":"";o+=n===Ne?c+Bs:f>=0?(r.push(u),c.slice(0,f)+Kt+c.slice(f)+Z+v):c+Z+(f===-2?l:v)}return[Gr(i,o+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let o=0,n=0,l=t.length-1,c=this.parts,[u,h]=Qr(t,e);if(this.el=i.createElement(u,r),le.currentNode=this.el.content,e===2){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(s=le.nextNode())!==null&&c.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let f of s.getAttributeNames())if(f.endsWith(Kt)){let x=h[n++],v=s.getAttribute(f).split(Z),w=/([.?@])?(.*)/.exec(x);c.push({type:1,index:o,name:w[2],strings:v,ctor:w[1]==="."?ht:w[1]==="?"?ft:w[1]==="@"?gt:de}),s.removeAttribute(f)}else f.startsWith(Z)&&(c.push({type:6,index:o}),s.removeAttribute(f));if(Jr.test(s.tagName)){let f=s.textContent.split(Z),x=f.length-1;if(x>0){s.textContent=ut?ut.emptyScript:"";for(let v=0;v<x;v++)s.append(f[v],He()),le.nextNode(),c.push({type:2,index:++o});s.append(f[x],He())}}}else if(s.nodeType===8)if(s.data===Jt)c.push({type:2,index:o});else{let f=-1;for(;(f=s.data.indexOf(Z,f+1))!==-1;)c.push({type:7,index:o}),f+=Z.length-1}o++}}static createElement(t,e){let r=ce.createElement("template");return r.innerHTML=t,r}};function pe(i,t,e=i,r){var n,l,c;if(t===L)return t;let s=r!==void 0?(n=e._$Co)==null?void 0:n[r]:e._$Cl,o=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((l=s==null?void 0:s._$AO)==null||l.call(s,!1),o===void 0?s=void 0:(s=new o(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=pe(i,s._$AS(i,t.values),s,r)),t}var mt=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){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ce).importNode(e,!0);le.currentNode=s;let o=le.nextNode(),n=0,l=0,c=r[0];for(;c!==void 0;){if(n===c.index){let h;c.type===2?h=new ye(o,o.nextSibling,this,t):c.type===1?h=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(h=new bt(o,this,t)),this._$AV.push(h),c=r[++l]}n!==(c==null?void 0:c.index)&&(o=le.nextNode(),n++)}return le.currentNode=ce,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ye=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var o;this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(o=s==null?void 0:s.isConnected)!=null?o:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=pe(this,t,e),Pe(t)?t===_||t==null||t===""?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Kr(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==_&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.T(ce.createTextNode(t)),this._$AH=t}$(t){var o;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(Gr(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(e);else{let n=new mt(s,this),l=n.u(this.options);n.p(e),this.T(l),this._$AH=n}}_$AC(t){let e=Yr.get(t.strings);return e===void 0&&Yr.set(t.strings,e=new Ve(t)),e}k(t){Wr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let o of t)s===e.length?e.push(r=new i(this.S(He()),this.S(He()),this,this.options)):r=e[s],r._$AI(o),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},de=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_}_$AI(t,e=this,r,s){let o=this.strings,n=!1;if(o===void 0)t=pe(this,t,e,0),n=!Pe(t)||t!==this._$AH&&t!==L,n&&(this._$AH=t);else{let l=t,c,u;for(t=o[0],c=0;c<o.length-1;c++)u=pe(this,l[r+c],e,c),u===L&&(u=this._$AH[c]),n||(n=!Pe(u)||u!==this._$AH[c]),u===_?t=_:t!==_&&(t+=(u!=null?u:"")+o[c+1]),this._$AH[c]=u}n&&!s&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},ht=class extends de{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}},ft=class extends de{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}},gt=class extends de{constructor(t,e,r,s,o){super(t,e,r,s,o),this.type=5}_$AI(t,e=this){var n;if((t=(n=pe(this,t,e,0))!=null?n:_)===L)return;let r=this._$AH,s=t===_&&r!==_||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==_&&(r===_||s);s&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},bt=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){pe(this,t)}},es={P:Kt,A:Z,C:Jt,M:1,L:Qr,R:mt,D:Kr,V:pe,I:ye,H:de,N:ft,U:gt,B:ht,F:bt},Wt=ve.litHtmlPolyfillSupport,zr;Wt==null||Wt(Ve,ye),((zr=ve.litHtmlVersions)!=null?zr:ve.litHtmlVersions=[]).push("3.1.2");var ts=(i,t,e)=>{var o,n;let r=(o=e==null?void 0:e.renderBefore)!=null?o:t,s=r._$litPart$;if(s===void 0){let l=(n=e==null?void 0:e.renderBefore)!=null?n:null;r._$litPart$=s=new ye(t.insertBefore(He(),l),l,void 0,e!=null?e:{})}return s._$AI(i),s};var g=class extends J{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ts(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return L}},rs;g._$litElement$=!0,g.finalized=!0,(rs=globalThis.litElementHydrateSupport)==null||rs.call(globalThis,{LitElement:g});var Gt=globalThis.litElementPolyfillSupport;Gt==null||Gt({LitElement:g});var ss;((ss=globalThis.litElementVersions)!=null?ss:globalThis.litElementVersions=[]).push("4.0.4");var m=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var js={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:dt},Xs=(i=js,t,e)=>{let{kind:r,metadata:s}=e,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),o.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(l){let c=t.get.call(this);t.set.call(this,l),this.requestUpdate(n,c,i)},init(l){return l!==void 0&&this.P(n,void 0,i),l}}}if(r==="setter"){let{name:n}=e;return function(l){let c=this[n];t.call(this,l),this.requestUpdate(n,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Xs(i,t,e):((r,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,n?T(E({},r),{wrapped:!0}):r),n?Object.getOwnPropertyDescriptor(s,o):void 0})(i,t,e)}function C(i){return d(T(E({},i),{state:!0,attribute:!1}))}var re=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function De(i,t){return(e,r,s)=>{let o=n=>{var l,c;return(c=(l=n.renderRoot)==null?void 0:l.querySelector(i))!=null?c:null};if(t){let{get:n,set:l}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return re(e,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&l.call(this,c)),c}})}return re(e,r,{get(){return o(this)}})}}function is(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},o="slot"+(r?`[name=${r}]`:":not([name])");return re(t,e,{get(){var c,u;let n=(c=this.renderRoot)==null?void 0:c.querySelector(o),l=(u=n==null?void 0:n.assignedElements(i))!=null?u:[];return s===void 0?l:l.filter(h=>h.matches(s))}})}}function $(i,t){let e=E({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:o}=r,n=Array.isArray(i)?i:[i];r.update=function(l){n.forEach(c=>{let u=c;if(l.has(u)){let h=l.get(u),f=this[u];h!==f&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,f)}}),o.call(this,l)}}}var os=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var N=class extends g{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:os};this._initialContext=T(E({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=T(E({},this._context),{variables:[...this._context.variables,e.detail.variable]}),this._initialContext=this._context,e.stopPropagation()}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=T(E({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(o=>o.identifier===r.identifier);return s?E(E({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(o=>o.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===r.responseIdentifier);o&&(o.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of s){let n=this._interactionElements.find(l=>l.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=e?o.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(o=>o.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=T(E({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:T(E({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var o;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=T(E({},this._context),{variables:this._context.variables.map(n=>n.identifier!==e?n:T(E({},n),{value:s.cardinality==="single"?r:[...n.value,r]}))}),this._feedbackElements.forEach(n=>n.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(o=this._context.variables.find(n=>n.identifier===e))==null?void 0:o.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};a([d({type:String})],N.prototype,"title",2),a([d({type:String})],N.prototype,"identifier",2),a([d({type:String})],N.prototype,"adaptive",2),a([d({type:String})],N.prototype,"timeDependent",2),a([d({type:Boolean})],N.prototype,"disabled",2),a([$("disabled",{waitUntilFirstUpdate:!0})],N.prototype,"_handleDisabledChange",2),a([d({type:Boolean})],N.prototype,"readonly",2),a([$("readonly",{waitUntilFirstUpdate:!0})],N.prototype,"_handleReadonlyChange",2),a([Bt({context:I})],N.prototype,"_context",2),N=a([m("qti-assessment-item")],N);var Ys={SPACE:32},M=class extends g{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Ys.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};a([d({type:String})],M.prototype,"identifier",2),a([d({type:Number,reflect:!0})],M.prototype,"tabindex",2),a([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],M.prototype,"disabled",2),a([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],M.prototype,"readonly",2),a([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],M.prototype,"checked",2),a([$("disabled",{waitUntilFirstUpdate:!0})],M.prototype,"handleDisabledChange",1);var ns=b`
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),jr=/'/g,Xr=/"/g,Jr=/^(?:script|style|textarea|title)$/i,Zr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=Zr(1),Zt=Zr(2),L=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yr=new WeakMap,le=ce.createTreeWalker(ce,129);function Gr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ir!==void 0?Ir.createHTML(t):t}var Qr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Ne;for(let l=0;l<e;l++){let c=i[l],u,h,f=-1,x=0;for(;x<c.length&&(o.lastIndex=x,h=o.exec(c),h!==null);)x=o.lastIndex,o===Ne?h[1]==="!--"?o=Fr:h[1]!==void 0?o=Br:h[2]!==void 0?(Jr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ae):h[3]!==void 0&&(o=ae):o===ae?h[0]===">"?(o=s!=null?s:Ne,f=-1):h[1]===void 0?f=-2:(f=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ae:h[3]==='"'?Xr:jr):o===Xr||o===jr?o=ae:o===Fr||o===Br?o=Ne:(o=ae,s=void 0);let v=o===ae&&i[l+1].startsWith("/>")?" ":"";n+=o===Ne?c+Bs:f>=0?(r.push(u),c.slice(0,f)+Kt+c.slice(f)+Z+v):c+Z+(f===-2?l:v)}return[Gr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,l=t.length-1,c=this.parts,[u,h]=Qr(t,e);if(this.el=i.createElement(u,r),le.currentNode=this.el.content,e===2){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(s=le.nextNode())!==null&&c.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let f of s.getAttributeNames())if(f.endsWith(Kt)){let x=h[o++],v=s.getAttribute(f).split(Z),w=/([.?@])?(.*)/.exec(x);c.push({type:1,index:n,name:w[2],strings:v,ctor:w[1]==="."?ht:w[1]==="?"?ft:w[1]==="@"?gt:de}),s.removeAttribute(f)}else f.startsWith(Z)&&(c.push({type:6,index:n}),s.removeAttribute(f));if(Jr.test(s.tagName)){let f=s.textContent.split(Z),x=f.length-1;if(x>0){s.textContent=ut?ut.emptyScript:"";for(let v=0;v<x;v++)s.append(f[v],He()),le.nextNode(),c.push({type:2,index:++n});s.append(f[x],He())}}}else if(s.nodeType===8)if(s.data===Jt)c.push({type:2,index:n});else{let f=-1;for(;(f=s.data.indexOf(Z,f+1))!==-1;)c.push({type:7,index:n}),f+=Z.length-1}n++}}static createElement(t,e){let r=ce.createElement("template");return r.innerHTML=t,r}};function pe(i,t,e=i,r){var o,l,c;if(t===L)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((l=s==null?void 0:s._$AO)==null||l.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=pe(i,s._$AS(i,t.values),s,r)),t}var mt=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){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ce).importNode(e,!0);le.currentNode=s;let n=le.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ye(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new bt(n,this,t)),this._$AV.push(h),c=r[++l]}o!==(c==null?void 0:c.index)&&(n=le.nextNode(),o++)}return le.currentNode=ce,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ye=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=pe(this,t,e),Pe(t)?t===_||t==null||t===""?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Kr(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==_&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.T(ce.createTextNode(t)),this._$AH=t}$(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(Gr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new mt(s,this),l=o.u(this.options);o.p(e),this.T(l),this._$AH=o}}_$AC(t){let e=Yr.get(t.strings);return e===void 0&&Yr.set(t.strings,e=new Ve(t)),e}k(t){Wr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.S(He()),this.S(He()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},de=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=pe(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==L,o&&(this._$AH=t);else{let l=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=pe(this,l[r+c],e,c),u===L&&(u=this._$AH[c]),o||(o=!Pe(u)||u!==this._$AH[c]),u===_?t=_:t!==_&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},ht=class extends de{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}},ft=class extends de{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}},gt=class extends de{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=pe(this,t,e,0))!=null?o:_)===L)return;let r=this._$AH,s=t===_&&r!==_||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==_&&(r===_||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},bt=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){pe(this,t)}},es={P:Kt,A:Z,C:Jt,M:1,L:Qr,R:mt,D:Kr,V:pe,I:ye,H:de,N:ft,U:gt,B:ht,F:bt},Wt=ve.litHtmlPolyfillSupport,zr;Wt==null||Wt(Ve,ye),((zr=ve.litHtmlVersions)!=null?zr:ve.litHtmlVersions=[]).push("3.1.2");var ts=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let l=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ye(t.insertBefore(He(),l),l,void 0,e!=null?e:{})}return s._$AI(i),s};var g=class extends J{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ts(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return L}},rs;g._$litElement$=!0,g.finalized=!0,(rs=globalThis.litElementHydrateSupport)==null||rs.call(globalThis,{LitElement:g});var Gt=globalThis.litElementPolyfillSupport;Gt==null||Gt({LitElement:g});var ss;((ss=globalThis.litElementVersions)!=null?ss:globalThis.litElementVersions=[]).push("4.0.4");var m=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var js={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:dt},Xs=(i=js,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(l){let c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,i)},init(l){return l!==void 0&&this.P(o,void 0,i),l}}}if(r==="setter"){let{name:o}=e;return function(l){let c=this[o];t.call(this,l),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Xs(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?T(E({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(T(E({},i),{state:!0,attribute:!1}))}var re=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function De(i,t){return(e,r,s)=>{let n=o=>{var l,c;return(c=(l=o.renderRoot)==null?void 0:l.querySelector(i))!=null?c:null};if(t){let{get:o,set:l}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return re(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&l.call(this,c)),c}})}return re(e,r,{get(){return n(this)}})}}function is(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return re(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),l=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?l:l.filter(h=>h.matches(s))}})}}function $(i,t){let e=E({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(l){o.forEach(c=>{let u=c;if(l.has(u)){let h=l.get(u),f=this[u];h!==f&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,f)}}),n.call(this,l)}}}var os=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var N=class extends g{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:os};this._initialContext=T(E({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=T(E({},this._context),{variables:[...this._context.variables,e.detail.variable]}),this._initialContext=this._context,e.stopPropagation()}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=T(E({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?E(E({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(l=>l.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=T(E({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:T(E({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=T(E({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:T(E({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};a([d({type:String})],N.prototype,"title",2),a([d({type:String})],N.prototype,"identifier",2),a([d({type:String})],N.prototype,"adaptive",2),a([d({type:String})],N.prototype,"timeDependent",2),a([d({type:Boolean})],N.prototype,"disabled",2),a([$("disabled",{waitUntilFirstUpdate:!0})],N.prototype,"_handleDisabledChange",2),a([d({type:Boolean})],N.prototype,"readonly",2),a([$("readonly",{waitUntilFirstUpdate:!0})],N.prototype,"_handleReadonlyChange",2),a([Bt({context:I})],N.prototype,"_context",2),N=a([m("qti-assessment-item")],N);var Ys={SPACE:32},M=class extends g{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Ys.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};a([d({type:String})],M.prototype,"identifier",2),a([d({type:Number,reflect:!0})],M.prototype,"tabindex",2),a([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],M.prototype,"disabled",2),a([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],M.prototype,"readonly",2),a([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],M.prototype,"checked",2),a([$("disabled",{waitUntilFirstUpdate:!0})],M.prototype,"handleDisabledChange",1);var ns=b`
4
4
  :host {
5
5
  display: block;
6
6
  }
7
- `;var xe=class extends g{render(){return p`<slot name="qti-rubric-block"></slot><slot></slot>`}};xe.styles=ns,xe=a([m("qti-item-body")],xe);var vt=class extends g{render(){return p`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};vt=a([m("qti-prompt")],vt);var yt=class extends g{constructor(){super()}firstUpdated(e){super.firstUpdated(e);let r=this.closest("qti-assessment-item"),s=this.getAttribute("href");if(s!==null){let o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.media="screen",o.href=s,r.appendChild(o),this.styleLink=o}if(this.textContent!==null){let o=document.createElement("style");o.media="screen",o.textContent=this.textContent,r.appendChild(o),this.styleLink=o}}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(r){console.log("could not remove stylesheet")}}};yt=a([m("qti-stylesheet")],yt);var se=class extends g{render(){return p`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(s=>s.innerHTML);return r.length>1||t.cardinality==="multiple"||t.cardinality==="ordered"?r:r[0]}};se=a([m("qti-variabledeclaration")],se);var F=class extends se{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(o=>o.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let r=new Map;for(let s of e.querySelectorAll("qti-interpolation-table-entry")){!s.getAttribute("source-value")&&s.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(s.getAttribute("source-value")),n=parseInt(s.getAttribute("target-value"));(isNaN(o)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),r.set(o,n)}return r}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};F.styles=[b`
7
+ `;var xe=class extends g{render(){return p`<slot name="qti-rubric-block"></slot><slot></slot>`}};xe.styles=ns,xe=a([m("qti-item-body")],xe);var vt=class extends g{render(){return p`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};vt=a([m("qti-prompt")],vt);var yt=class extends g{constructor(){super()}firstUpdated(e){super.firstUpdated(e);let r=this.closest("qti-assessment-item"),s=this.getAttribute("href");if(s!==null){let n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.media="screen",n.href=s,r.appendChild(n),this.styleLink=n}if(this.textContent!==null){let n=document.createElement("style");n.media="screen",n.textContent=this.textContent,r.appendChild(n),this.styleLink=n}}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(r){console.log("could not remove stylesheet")}}};yt=a([m("qti-stylesheet")],yt);var se=class extends g{render(){return p`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(s=>s.innerHTML);return r.length>1||t.cardinality==="multiple"||t.cardinality==="ordered"?r:r[0]}};se=a([m("qti-variabledeclaration")],se);var F=class extends se{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let r=new Map;for(let s of e.querySelectorAll("qti-interpolation-table-entry")){!s.getAttribute("source-value")&&s.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let n=parseInt(s.getAttribute("source-value")),o=parseInt(s.getAttribute("target-value"));(isNaN(n)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),r.set(n,o)}return r}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};F.styles=[b`
8
8
  :host {
9
9
  display: none;
10
10
  }
11
- `],a([d({type:String,attribute:"base-type"})],F.prototype,"baseType",2),a([d({type:String,attribute:"external-scored"})],F.prototype,"externalScored",2),a([d({type:String})],F.prototype,"identifier",2),a([d({type:String})],F.prototype,"cardinality",2),a([K({context:I,subscribe:!0}),C()],F.prototype,"itemContext",2),F=a([m("qti-outcome-declaration")],F);var G=class extends se{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(o=>o.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,r=this.querySelector("qti-correct-response");if(r){let s=r.querySelectorAll("qti-value");if(this.cardinality==="single"&&s.length>0)e=s[0].textContent,s[0].remove();else if(this.cardinality!=="single"){e=[];for(let o=0;o<s.length;o++)e.push(s[o].textContent),s[o].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};G.styles=[b`
11
+ `],a([d({type:String,attribute:"base-type"})],F.prototype,"baseType",2),a([d({type:String,attribute:"external-scored"})],F.prototype,"externalScored",2),a([d({type:String})],F.prototype,"identifier",2),a([d({type:String})],F.prototype,"cardinality",2),a([K({context:I,subscribe:!0}),C()],F.prototype,"itemContext",2),F=a([m("qti-outcome-declaration")],F);var G=class extends se{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,r=this.querySelector("qti-correct-response");if(r){let s=r.querySelectorAll("qti-value");if(this.cardinality==="single"&&s.length>0)e=s[0].textContent,s[0].remove();else if(this.cardinality!=="single"){e=[];for(let n=0;n<s.length;n++)e.push(s[n].textContent),s[n].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};G.styles=[b`
12
12
  :host {
13
13
  display: none;
14
14
  }
15
- `],a([d({type:String,attribute:"base-type"})],G.prototype,"baseType",2),a([d({type:String})],G.prototype,"identifier",2),a([d({type:String})],G.prototype,"cardinality",2),a([K({context:I,subscribe:!0}),C()],G.prototype,"itemContext",2),G=a([m("qti-response-declaration")],G);var xt=class extends g{};xt=a([m("qti-companion-materials-info")],xt);var Et=class extends g{render(){return p`<slot></slot>`}};Et=a([m("qti-content-body")],Et);var B=class extends g{handleclassNamesChange(e,r){this.classNames.split(" ").forEach(o=>{switch(o){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return p`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};B.styles=b`
15
+ `],a([d({type:String,attribute:"base-type"})],G.prototype,"baseType",2),a([d({type:String})],G.prototype,"identifier",2),a([d({type:String})],G.prototype,"cardinality",2),a([K({context:I,subscribe:!0}),C()],G.prototype,"itemContext",2),G=a([m("qti-response-declaration")],G);var xt=class extends g{};xt=a([m("qti-companion-materials-info")],xt);var Et=class extends g{render(){return p`<slot></slot>`}};Et=a([m("qti-content-body")],Et);var B=class extends g{handleclassNamesChange(e,r){this.classNames.split(" ").forEach(n=>{switch(n){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return p`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};B.styles=b`
16
16
  :host {
17
17
  display: block;
18
18
  }
@@ -40,7 +40,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
40
40
  .off {
41
41
  display: none;
42
42
  }
43
- `,Fe=a([m("qti-modal-feedback")],Fe);var j=i=>i!=null?i:_;var q=class extends g{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}set correctResponse(e){console.warn("correctResponse is not implemented")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:e}}))}};a([d({attribute:"response-identifier"})],q.prototype,"responseIdentifier",2),a([d({reflect:!0,type:Boolean})],q.prototype,"disabled",2),a([d({reflect:!0,type:Boolean})],q.prototype,"readonly",2);var{I:Ws}=es;var ls=i=>i.strings===void 0,as=()=>document.createComment(""),Ee=(i,t,e)=>{var o;let r=i._$AA.parentNode,s=t===void 0?i._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(as(),s),l=r.insertBefore(as(),s);e=new Ws(n,l,i,i.options)}else{let n=e._$AB.nextSibling,l=e._$AM,c=l!==i;if(c){let u;(o=e._$AQ)==null||o.call(e,i),e._$AM=i,e._$AP!==void 0&&(u=i._$AU)!==l._$AU&&e._$AP(u)}if(n!==s||c){let u=e._$AA;for(;u!==n;){let h=u.nextSibling;r.insertBefore(u,s),u=h}}}return e},ie=(i,t,e=i)=>(i._$AI(t,e),i),Ks={},cs=(i,t=Ks)=>i._$AH=t,ps=i=>i._$AH,_t=i=>{var r;(r=i._$AP)==null||r.call(i,!1,!0);let t=i._$AA,e=i._$AB.nextSibling;for(;t!==e;){let s=t.nextSibling;t.remove(),t=s}};var Q={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ee=i=>(...t)=>({_$litDirective$:i,values:t}),U=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var Be=(i,t)=>{var r;let e=i._$AN;if(e===void 0)return!1;for(let s of e)(r=s._$AO)==null||r.call(s,t,!1),Be(s,t);return!0},Ct=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},ds=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),Gs(t)}};function Js(i){this._$AN!==void 0?(Ct(this),this._$AM=i,ds(this)):this._$AM=i}function Zs(i,t=!1,e=0){let r=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)Be(r[o],!1),Ct(r[o]);else r!=null&&(Be(r,!1),Ct(r));else Be(this,i)}var Gs=i=>{var t,e;i.type==Q.CHILD&&((t=i._$AP)!=null||(i._$AP=Zs),(e=i._$AQ)!=null||(i._$AQ=Js))},At=class extends U{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ds(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,s;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(s=this.disconnected)==null||s.call(this)),e&&(Be(this,t),Ct(this))}setValue(t){if(ls(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 qt=()=>new tr,tr=class{},er=new WeakMap,us=ee(class extends At{render(i){return _}update(i,[t]){var r;let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=(r=i.options)==null?void 0:r.host,this.rt(this.ct=i.element)),_}rt(i){var t;if(typeof this.Y=="function"){let e=(t=this.ht)!=null?t:globalThis,r=er.get(e);r===void 0&&(r=new WeakMap,er.set(e,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){var i,t,e;return typeof this.Y=="function"?(t=er.get((i=this.ht)!=null?i:globalThis))==null?void 0:t.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var X=class extends q{constructor(){super(...arguments);this.textareaRef=qt();this._value=""}handleclassNamesChange(e,r){this.classNames.split(" ").forEach(o=>{if(o.startsWith("qti-height-lines")){let n=o.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(n))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
43
+ `,Fe=a([m("qti-modal-feedback")],Fe);var j=i=>i!=null?i:_;var q=class extends g{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}set correctResponse(e){console.warn("correctResponse is not implemented")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:e}}))}};a([d({attribute:"response-identifier"})],q.prototype,"responseIdentifier",2),a([d({reflect:!0,type:Boolean})],q.prototype,"disabled",2),a([d({reflect:!0,type:Boolean})],q.prototype,"readonly",2);var{I:Ws}=es;var ls=i=>i.strings===void 0,as=()=>document.createComment(""),Ee=(i,t,e)=>{var n;let r=i._$AA.parentNode,s=t===void 0?i._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(as(),s),l=r.insertBefore(as(),s);e=new Ws(o,l,i,i.options)}else{let o=e._$AB.nextSibling,l=e._$AM,c=l!==i;if(c){let u;(n=e._$AQ)==null||n.call(e,i),e._$AM=i,e._$AP!==void 0&&(u=i._$AU)!==l._$AU&&e._$AP(u)}if(o!==s||c){let u=e._$AA;for(;u!==o;){let h=u.nextSibling;r.insertBefore(u,s),u=h}}}return e},ie=(i,t,e=i)=>(i._$AI(t,e),i),Ks={},cs=(i,t=Ks)=>i._$AH=t,ps=i=>i._$AH,_t=i=>{var r;(r=i._$AP)==null||r.call(i,!1,!0);let t=i._$AA,e=i._$AB.nextSibling;for(;t!==e;){let s=t.nextSibling;t.remove(),t=s}};var Q={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ee=i=>(...t)=>({_$litDirective$:i,values:t}),U=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var Be=(i,t)=>{var r;let e=i._$AN;if(e===void 0)return!1;for(let s of e)(r=s._$AO)==null||r.call(s,t,!1),Be(s,t);return!0},Ct=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},ds=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),Gs(t)}};function Js(i){this._$AN!==void 0?(Ct(this),this._$AM=i,ds(this)):this._$AM=i}function Zs(i,t=!1,e=0){let r=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)Be(r[n],!1),Ct(r[n]);else r!=null&&(Be(r,!1),Ct(r));else Be(this,i)}var Gs=i=>{var t,e;i.type==Q.CHILD&&((t=i._$AP)!=null||(i._$AP=Zs),(e=i._$AQ)!=null||(i._$AQ=Js))},At=class extends U{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ds(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,s;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(s=this.disconnected)==null||s.call(this)),e&&(Be(this,t),Ct(this))}setValue(t){if(ls(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 qt=()=>new tr,tr=class{},er=new WeakMap,us=ee(class extends At{render(i){return _}update(i,[t]){var r;let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=(r=i.options)==null?void 0:r.host,this.rt(this.ct=i.element)),_}rt(i){var t;if(typeof this.Y=="function"){let e=(t=this.ht)!=null?t:globalThis,r=er.get(e);r===void 0&&(r=new WeakMap,er.set(e,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){var i,t,e;return typeof this.Y=="function"?(t=er.get((i=this.ht)!=null?i:globalThis))==null?void 0:t.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var X=class extends q{constructor(){super(...arguments);this.textareaRef=qt();this._value=""}handleclassNamesChange(e,r){this.classNames.split(" ").forEach(n=>{if(n.startsWith("qti-height-lines")){let o=n.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(o))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
44
44
  /* PK: display host as block, else design will be collapsed */
45
45
  :host {
46
46
  display: block;
@@ -65,7 +65,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
65
65
  ?disabled="${this.disabled}"
66
66
  ?readonly="${this.readonly}"
67
67
  .value=${this._value}
68
- ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};a([d({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",2),a([d({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",2),a([d({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",2),a([C()],X.prototype,"_value",2),a([d({type:String,attribute:"class"})],X.prototype,"classNames",2),a([$("classNames",{waitUntilFirstUpdate:!0})],X.prototype,"handleclassNamesChange",1),X=a([m("qti-extended-text-interaction")],X);function ms(i,t){let e,r=E({},t);return(s,o)=>{let{connectedCallback:n,disconnectedCallback:l}=s;s.connectedCallback=function(){var h;n.call(this);let c=f=>{let x=Array.from(this.querySelectorAll(i));for(let v of f){let w=Array.from(v.addedNodes).map(S=>S),A=Array.from(v.addedNodes).map(S=>S);v.type==="childList"&&w.find(S=>x.includes(S))&&this[o](w,A)}};e=new MutationObserver(c),e.observe(this,{childList:!0,subtree:!0});let u=(h=this.querySelectorAll(i))!=null?h:[];this[o](Array.from(u),[])},s.disconnectedCallback=function(){l.call(this),e.disconnect()}}}var P=class extends q{constructor(){super(...arguments);this._value="";this._correctValue="";this._size=5;this.inputRef=qt()}handleclassNamesChange(e,r){r.split(" ").forEach(o=>{if(o.startsWith("qti-input-width")){let n=o.replace("qti-input-width-","");this._size=parseInt(n)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
68
+ ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};a([d({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",2),a([d({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",2),a([d({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",2),a([C()],X.prototype,"_value",2),a([d({type:String,attribute:"class"})],X.prototype,"classNames",2),a([$("classNames",{waitUntilFirstUpdate:!0})],X.prototype,"handleclassNamesChange",1),X=a([m("qti-extended-text-interaction")],X);function ms(i,t){let e,r=E({},t);return(s,n)=>{let{connectedCallback:o,disconnectedCallback:l}=s;s.connectedCallback=function(){var h;o.call(this);let c=f=>{let x=Array.from(this.querySelectorAll(i));for(let v of f){let w=Array.from(v.addedNodes).map(S=>S),A=Array.from(v.addedNodes).map(S=>S);v.type==="childList"&&w.find(S=>x.includes(S))&&this[n](w,A)}};e=new MutationObserver(c),e.observe(this,{childList:!0,subtree:!0});let u=(h=this.querySelectorAll(i))!=null?h:[];this[n](Array.from(u),[])},s.disconnectedCallback=function(){l.call(this),e.disconnect()}}}var P=class extends q{constructor(){super(...arguments);this._value="";this._correctValue="";this._size=5;this.inputRef=qt()}handleclassNamesChange(e,r){r.split(" ").forEach(n=>{if(n.startsWith("qti-input-width")){let o=n.replace("qti-input-width-","");this._size=parseInt(o)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
69
69
  [part='correct'] {
70
70
  position: absolute;
71
71
  width: 100%;
@@ -87,7 +87,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
87
87
  ?disabled="${this.disabled}"
88
88
  ?readonly="${this.readonly}"
89
89
  />
90
- `}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};a([d({type:Number,attribute:"expected-length"})],P.prototype,"expectedLength",2),a([d({type:String,attribute:"pattern-mask"})],P.prototype,"patternMask",2),a([d({type:String,attribute:"placeholder-text"})],P.prototype,"placeholderText",2),a([C()],P.prototype,"_value",2),a([C()],P.prototype,"_correctValue",2),a([C()],P.prototype,"_size",2),a([d({type:String,attribute:"class"})],P.prototype,"classNames",2),a([$("classNames")],P.prototype,"handleclassNamesChange",1),P=a([m("qti-text-entry-interaction")],P);var R=class extends q{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,r)=>this._choiceElements.forEach(s=>s.disabled=r);this._handleReadonlyChange=(e,r)=>this._choiceElements.forEach(s=>s.readonly=r);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}validate(){return this._choiceElements.reduce((r,s)=>r+(s.checked?1:0),0)>=this.minChoices}set response(e){let r=Array.isArray(e)?e:[e];this._choiceElements.forEach(s=>{s.checked=!!r.find(o=>o===s.identifier)})}set correctResponse(e){let r=Array.isArray(e)?e:[e];if(e==""){this._choiceElements.forEach(s=>{s.removeAttribute("data-correct-response")});return}this._choiceElements.forEach(s=>{s.setAttribute("data-correct-response",r.find(o=>o===s.identifier)?"true":"false")})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let r=e.target;this._choiceElements.push(r),this._setInputType(r)}_looseChoiceElement(e){e.stopPropagation();let r=e.target;this._choiceElements.push(r),this._choiceElements=this._choiceElements.filter(s=>s!==r)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(r=>r.identifier!==e.detail.identifier).forEach(r=>{r.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(s=>s.checked).map(s=>s.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(s=>s.disabled=!s.checked):this._choiceElements.forEach(s=>s.disabled=!1));let r;this.maxChoices===1?r=e.length>0?e[0]:void 0:r=e,this.saveResponse(r)}};a([d({type:Number,attribute:"min-choices"})],R.prototype,"minChoices",2),a([d({type:Number,attribute:"max-choices"})],R.prototype,"maxChoices",2),a([$("disabled",{waitUntilFirstUpdate:!0})],R.prototype,"_handleDisabledChange",2),a([$("readonly",{waitUntilFirstUpdate:!0})],R.prototype,"_handleReadonlyChange",2),a([$("maxChoices",{waitUntilFirstUpdate:!0})],R.prototype,"_handleMaxChoicesChange",2);var wt=class extends R{constructor(){super(...arguments);this.render=()=>p`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};wt=a([m("qti-hottext-interaction")],wt);var je=class extends U{constructor(t){if(super(t),this.it=_,t.type!==Q.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===_||t==null)return this._t=void 0,this.it=t;if(t===L)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};je.directiveName="unsafeHTML",je.resultType=1;var _e=ee(je);var oe=class extends q{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
90
+ `}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};a([d({type:Number,attribute:"expected-length"})],P.prototype,"expectedLength",2),a([d({type:String,attribute:"pattern-mask"})],P.prototype,"patternMask",2),a([d({type:String,attribute:"placeholder-text"})],P.prototype,"placeholderText",2),a([C()],P.prototype,"_value",2),a([C()],P.prototype,"_correctValue",2),a([C()],P.prototype,"_size",2),a([d({type:String,attribute:"class"})],P.prototype,"classNames",2),a([$("classNames")],P.prototype,"handleclassNamesChange",1),P=a([m("qti-text-entry-interaction")],P);var R=class extends q{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,r)=>this._choiceElements.forEach(s=>s.disabled=r);this._handleReadonlyChange=(e,r)=>this._choiceElements.forEach(s=>s.readonly=r);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}validate(){return this._choiceElements.reduce((r,s)=>r+(s.checked?1:0),0)>=this.minChoices}set response(e){let r=Array.isArray(e)?e:[e];this._choiceElements.forEach(s=>{s.checked=!!r.find(n=>n===s.identifier)})}set correctResponse(e){let r=Array.isArray(e)?e:[e];if(e==""){this._choiceElements.forEach(s=>{s.removeAttribute("data-correct-response")});return}this._choiceElements.forEach(s=>{s.setAttribute("data-correct-response",r.find(n=>n===s.identifier)?"true":"false")})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let r=e.target;this._choiceElements.push(r),this._setInputType(r)}_looseChoiceElement(e){e.stopPropagation();let r=e.target;this._choiceElements.push(r),this._choiceElements=this._choiceElements.filter(s=>s!==r)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(r=>r.identifier!==e.detail.identifier).forEach(r=>{r.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(s=>s.checked).map(s=>s.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(s=>s.disabled=!s.checked):this._choiceElements.forEach(s=>s.disabled=!1));let r;this.maxChoices===1?r=e.length>0?e[0]:void 0:r=e,this.saveResponse(r)}};a([d({type:Number,attribute:"min-choices"})],R.prototype,"minChoices",2),a([d({type:Number,attribute:"max-choices"})],R.prototype,"maxChoices",2),a([$("disabled",{waitUntilFirstUpdate:!0})],R.prototype,"_handleDisabledChange",2),a([$("readonly",{waitUntilFirstUpdate:!0})],R.prototype,"_handleReadonlyChange",2),a([$("maxChoices",{waitUntilFirstUpdate:!0})],R.prototype,"_handleMaxChoicesChange",2);var wt=class extends R{constructor(){super(...arguments);this.render=()=>p`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};wt=a([m("qti-hottext-interaction")],wt);var je=class extends U{constructor(t){if(super(t),this.it=_,t.type!==Q.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===_||t==null)return this._t=void 0,this.it=t;if(t===L)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};je.directiveName="unsafeHTML",je.resultType=1;var _e=ee(je);var oe=class extends q{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
91
91
  :host {
92
92
  display: inline-block;
93
93
  }
@@ -158,19 +158,19 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
158
158
  :host {
159
159
  display: none;
160
160
  }
161
- `],ue=a([m("qti-response-processing")],ue);var Y=class extends g{render(){return p`<slot></slot>`}process(){throw new Error("Not implemented")}};Y=a([m("qti-rule")],Y);var Tt=class extends Y{get childExpression(){return this.firstElementChild}process(){let e=this.getAttribute("identifier"),r=this.closest("qti-assessment-item").getVariable(e),s;return r.interpolationTable&&(s=r.interpolationTable.get(parseInt(this.childExpression.calculate()))),s==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Oe(s)}})),s)}};a([d({type:String})],Tt.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",Tt);var rr=class extends Y{render(){return p`<slot></slot>`}process(){let t=[...this.children];for(let e=0;e<t.length;e++){let r=t[e];if(r.calculate()){r.process();return}}}};customElements.define("qti-response-condition",rr);var sr=class extends Y{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,s=new ir(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(s)?s.map(o=>Oe(o)):Oe(s)}}))}},ir=class{constructor(t){this.expression=t}process(){let t=this.expression?this.expression.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}return t}};customElements.define("qti-set-outcome-value",sr);var Xe=class extends g{render(){return p`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}};customElements.define("qti-response-else",Xe);var Ye=class extends Xe{calculate(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}};customElements.define("qti-response-if",Ye);var or=class extends Ye{render(){return p`${super.render()}`}};customElements.define("qti-response-else-if",or);var y=class extends g{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(r)}case"qti-multiple":{let s=e.getResult();return s.length>0?{identifier:"",baseType:s[0].baseType,value:s.map(o=>o.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",s=this.assessmentItem.getResponse(r);return{baseType:s.baseType,value:s.correctResponse,cardinality:s.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch(r){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return p`<pre>${JSON.stringify(this.result,null,2)}</pre>
161
+ `],ue=a([m("qti-response-processing")],ue);var Y=class extends g{render(){return p`<slot></slot>`}process(){throw new Error("Not implemented")}};Y=a([m("qti-rule")],Y);var Tt=class extends Y{get childExpression(){return this.firstElementChild}process(){let e=this.getAttribute("identifier"),r=this.closest("qti-assessment-item").getVariable(e),s;return r.interpolationTable&&(s=r.interpolationTable.get(parseInt(this.childExpression.calculate()))),s==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Oe(s)}})),s)}};a([d({type:String})],Tt.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",Tt);var rr=class extends Y{render(){return p`<slot></slot>`}process(){let t=[...this.children];for(let e=0;e<t.length;e++){let r=t[e];if(r.calculate()){r.process();return}}}};customElements.define("qti-response-condition",rr);var sr=class extends Y{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,s=new ir(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(s)?s.map(n=>Oe(n)):Oe(s)}}))}},ir=class{constructor(t){this.expression=t}process(){let t=this.expression?this.expression.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}return t}};customElements.define("qti-set-outcome-value",sr);var Xe=class extends g{render(){return p`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}};customElements.define("qti-response-else",Xe);var Ye=class extends Xe{calculate(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}};customElements.define("qti-response-if",Ye);var or=class extends Ye{render(){return p`${super.render()}`}};customElements.define("qti-response-else-if",or);var y=class extends g{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(r)}case"qti-multiple":{let s=e.getResult();return s.length>0?{identifier:"",baseType:s[0].baseType,value:s.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",s=this.assessmentItem.getResponse(r);return{baseType:s.baseType,value:s.correctResponse,cardinality:s.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch(r){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return p`<pre>${JSON.stringify(this.result,null,2)}</pre>
162
162
  <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};y.styles=b`
163
163
  slot {
164
164
  display: none;
165
165
  }
166
- `,a([C()],y.prototype,"result",2);var V=class extends y{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var $t=class extends Qs(V){calculate(){return this.calculateChildren(Array.from(this.children))}};function Qs(i){return class extends i{calculateChildren(e){return e.map(s=>{let o=s;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate();if(typeof n=="string")if(n==="true")n=!0;else if(n==="false")n=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return n}).every(s=>typeof s=="boolean"&&s)}}}customElements.define("qti-and",$t);var St=class extends y{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};a([d({type:String,attribute:"base-type"})],St.prototype,"baseType",2);customElements.define("qti-base-value",St);var nr=class extends V{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let s=e.value,o=r.value;return s.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let s=e.value;return r.value.includes(s)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",nr);var ar=class extends y{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(t);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",ar);var Rt=class extends y{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(r.value),n=parseFloat(s.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);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}};a([d({type:String})],Rt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Rt);var D=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let s=parseInt(t,10),o=parseInt(e,10);if(!isNaN(s)&&!isNaN(o))return s===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let s=parseFloat(t),o=parseFloat(e);if(!isNaN(s)&&!isNaN(o))return s===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let s=t.split(" ").sort(),o=e.split(" ").sort();if(s.length===2&&o.length===2)return r==="pair"&&(s.sort(),o.sort()),s.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var kt=class extends y{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value)?(console.error("unexpected cardinality in qti equal"),!1):D.compareSingleValues(r.value,s.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};a([d({type:String})],kt.prototype,"toleranceMode",2);customElements.define("qti-equal",kt);var lr=class extends y{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",lr);var cr=class extends V{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",cr);var pr=class extends y{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",pr);var dr=class extends y{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",dr);var ur=class extends V{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",ur);var Mt=class extends y{getResult(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let r=e.mapping,s=Array.isArray(e.value)?e.value:[e.value],o=0;for(let n of s){let l=r.mapEntries.find(c=>D.compareSingleValues(c.mapKey,n,e.baseType));l==null||l.mappedValue==null?o+=r.defaultValue:o+=l.mappedValue}return r.lowerBound!=null&&(o=Math.max(r.lowerBound,o)),r.upperBound!=null&&(o=Math.min(r.upperBound,o)),o}};a([d({type:String})],Mt.prototype,"identifier",2);customElements.define("qti-map-response",Mt);var Ae=class extends g{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};a([d({attribute:"default-value",type:Number})],Ae.prototype,"defaultValue",2),a([d({attribute:"lower-bound",type:Number})],Ae.prototype,"lowerBound",2),a([d({attribute:"upper-bound",type:Number})],Ae.prototype,"upperBound",2);customElements.define("qti-mapping",Ae);var mr=class i extends y{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return i.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;if(e.cardinality==="single")return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):D.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);{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 s=0;for(let o of e.value){if(e.cardinality==="ordered"){let n=t[s];if(!D.compareSingleValues(o,n,e.baseType))return!1}else{let n=null;for(let l of t.value)if(D.compareSingleValues(o,l,e.baseType)){n=l;break}if(n!==null)t.value.splice(t.value.indexOf(n),1);else return!1}s++}return!0}}};customElements.define("qti-match",mr);var hr=class extends y{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType!==r.baseType&&console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let s=e.value;return r.value.includes(s)}};customElements.define("qti-member",hr);var fr=class extends y{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}};customElements.define("qti-multiple",fr);var gr=class extends y{render(){return p`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",gr);var br=class extends V{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();if(typeof s=="string")if(s==="true")s=!0;else if(s==="false")s=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",br);var vr=class extends y{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}};customElements.define("qti-ordered",vr);var ze=class extends g{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(o=>o.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}calculate(){let e=this.closest("qti-assessment-item"),r=this.identifier;return e.getVariable(r).value}};a([d({type:String})],ze.prototype,"identifier",2),a([K({context:I,subscribe:!0}),C()],ze.prototype,"itemContext",2);customElements.define("qti-printed-variable",ze);var yr=class extends y{getResult(){return this.getVariables().reduce((r,s)=>{if(s.baseType=="float"||s.baseType=="integer")try{return r*parseInt(s.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${s.baseType}`);return r},1)}};customElements.define("qti-product",yr);var Lt=class extends y{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),n=this.caseSensitive==="true"?s.value:s.value.toLowerCase();return D.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};a([d({type:String,attribute:"case-sensitive"})],Lt.prototype,"caseSensitive",2);customElements.define("qti-string-match",Lt);var xr=class extends y{constructor(){super();this._expression=new Er(Array.from(this.children))}getResult(){return this._expression.calculate()}},Er=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",xr);var _r=class extends y{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",_r);var We=class extends g{render(){return p`<slot></slot>`}process(){let t=new Cr,e=[...this.children];t.process(e)}};We.styles=[b`
166
+ `,a([C()],y.prototype,"result",2);var V=class extends y{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var $t=class extends Qs(V){calculate(){return this.calculateChildren(Array.from(this.children))}};function Qs(i){return class extends i{calculateChildren(e){return e.map(s=>{let n=s;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=n.calculate();if(typeof o=="string")if(o==="true")o=!0;else if(o==="false")o=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return o}).every(s=>typeof s=="boolean"&&s)}}}customElements.define("qti-and",$t);var St=class extends y{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};a([d({type:String,attribute:"base-type"})],St.prototype,"baseType",2);customElements.define("qti-base-value",St);var nr=class extends V{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let s=e.value,n=r.value;return s.filter(c=>n.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let s=e.value;return r.value.includes(s)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",nr);var ar=class extends y{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(t);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",ar);var Rt=class extends y{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let n=parseFloat(r.value),o=parseFloat(s.value);if(!isNaN(n)&&!isNaN(o))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${o}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};a([d({type:String})],Rt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Rt);var D=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let s=parseInt(t,10),n=parseInt(e,10);if(!isNaN(s)&&!isNaN(n))return s===n;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let s=parseFloat(t),n=parseFloat(e);if(!isNaN(s)&&!isNaN(n))return s===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let s=t.split(" ").sort(),n=e.split(" ").sort();if(s.length===2&&n.length===2)return r==="pair"&&(s.sort(),n.sort()),s.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var kt=class extends y{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value)?(console.error("unexpected cardinality in qti equal"),!1):D.compareSingleValues(r.value,s.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};a([d({type:String})],kt.prototype,"toleranceMode",2);customElements.define("qti-equal",kt);var lr=class extends y{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",lr);var cr=class extends V{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",cr);var pr=class extends y{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",pr);var dr=class extends y{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",dr);var ur=class extends V{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",ur);var Mt=class extends y{getResult(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let r=e.mapping,s=Array.isArray(e.value)?e.value:[e.value],n=0;for(let o of s){let l=r.mapEntries.find(c=>D.compareSingleValues(c.mapKey,o,e.baseType));l==null||l.mappedValue==null?n+=r.defaultValue:n+=l.mappedValue}return r.lowerBound!=null&&(n=Math.max(r.lowerBound,n)),r.upperBound!=null&&(n=Math.min(r.upperBound,n)),n}};a([d({type:String})],Mt.prototype,"identifier",2);customElements.define("qti-map-response",Mt);var Ae=class extends g{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};a([d({attribute:"default-value",type:Number})],Ae.prototype,"defaultValue",2),a([d({attribute:"lower-bound",type:Number})],Ae.prototype,"lowerBound",2),a([d({attribute:"upper-bound",type:Number})],Ae.prototype,"upperBound",2);customElements.define("qti-mapping",Ae);var mr=class i extends y{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return i.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;if(e.cardinality==="single")return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):D.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);{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 s=0;for(let n of e.value){if(e.cardinality==="ordered"){let o=t[s];if(!D.compareSingleValues(n,o,e.baseType))return!1}else{let o=null;for(let l of t.value)if(D.compareSingleValues(n,l,e.baseType)){o=l;break}if(o!==null)t.value.splice(t.value.indexOf(o),1);else return!1}s++}return!0}}};customElements.define("qti-match",mr);var hr=class extends y{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType!==r.baseType&&console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let s=e.value;return r.value.includes(s)}};customElements.define("qti-member",hr);var fr=class extends y{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}};customElements.define("qti-multiple",fr);var gr=class extends y{render(){return p`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",gr);var br=class extends V{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();if(typeof s=="string")if(s==="true")s=!0;else if(s==="false")s=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",br);var vr=class extends y{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}};customElements.define("qti-ordered",vr);var ze=class extends g{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}calculate(){let e=this.closest("qti-assessment-item"),r=this.identifier;return e.getVariable(r).value}};a([d({type:String})],ze.prototype,"identifier",2),a([K({context:I,subscribe:!0}),C()],ze.prototype,"itemContext",2);customElements.define("qti-printed-variable",ze);var yr=class extends y{getResult(){return this.getVariables().reduce((r,s)=>{if(s.baseType=="float"||s.baseType=="integer")try{return r*parseInt(s.value.toString())}catch(n){console.warn("can not convert to number")}else console.warn(`has another baseType ${s.baseType}`);return r},1)}};customElements.define("qti-product",yr);var Lt=class extends y{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),o=this.caseSensitive==="true"?s.value:s.value.toLowerCase();return D.compareSingleValues(n,o,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};a([d({type:String,attribute:"case-sensitive"})],Lt.prototype,"caseSensitive",2);customElements.define("qti-string-match",Lt);var xr=class extends y{constructor(){super();this._expression=new Er(Array.from(this.children))}getResult(){return this._expression.calculate()}},Er=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",xr);var _r=class extends y{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",_r);var We=class extends g{render(){return p`<slot></slot>`}process(){let t=new Cr,e=[...this.children];t.process(e)}};We.styles=[b`
167
167
  :host {
168
168
  display: none;
169
169
  }
170
- `],We=a([m("qti-outcome-processing")],We);var Cr=class{process(t){for(let e of t)e.process()}};var Nt=class extends q{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async e=>{e=this.removeDoubleSlashes(e);try{let r=await fetch(e);if(r.ok)return await r.json()}catch(r){}return null};this.mergeConfigs=async(e,r,s)=>{for(let o in r==null?void 0:r.paths)if(!e.paths[o]){let n=!1;try{let l=r.paths[o].endsWith(".js")?r.paths[o]:r.paths[o]+".js";(await fetch(l)).ok?e.paths[o]=r.paths[o].replace(/\.js$/,""):n=!0}catch(l){n=!0}n&&(s!=null&&s.paths[o])?e.paths[o]=s.paths[o].replace(/\.js$/,""):n&&console.error("Failed to resolve module: "+o)}}}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},_errorMessage:{type:String,state:!0}}}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let s=e[r];if(s){for(let o in s)if(s.hasOwnProperty(o)){let n=s[o];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),s=JSON.stringify(e);if(s!==this.rawResponse){this.rawResponse=s;let o=this.convertQtiVariableJSON(r);this.response=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set response(e){}getTAOConfig(e){let r=e.querySelectorAll("properties"),s={},o=l=>{let c={},u=l.getAttribute("key");if(u){let h=Array.from(l.children),f=h.map(v=>v.getAttribute("key"));f.length>0&&!f.find(v=>!Number.isInteger(+v))?c[u]=h.map(v=>n(v)):c[u]=l.textContent}return c},n=l=>{if(l){let c={};for(let u of l.children)c=E(E({},c),o(u));return c}};for(let l of r)return l.getAttribute("key")||(s=E(E({},s),n(l))),s;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",s=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=r=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);r=="IMS"?e.getInstance(s,o,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,s.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:{}};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}this.registerModules(e).then(()=>{requirejs.config(e)(["require"],s=>{!s.defined("qtiCustomInteractionContext")&&define("qtiCustomInteractionContext",()=>({register:n=>{this.register(n)},notifyReady:()=>{}}));let o=s.defined(this.module);s([this.module],n=>{o&&this.register(n)},n=>{this._errorMessage=n})},s=>{this._errorMessage=s})})}disconnectedCallback(){super.disconnectedCallback(),this.stopChecking()}async registerModules(e){if(this.getAttribute("data-base-url")){let o=`${this.getAttribute("data-base-url")}/modules/module_resolution.js`,n=`${this.getAttribute("data-base-url")}/modules/modules_resolution.js`;if(o){let l=await this.loadConfig(o),c=await this.loadConfig(n);await this.mergeConfigs(e,l,c)}}let s=this.querySelector("qti-interaction-modules");if(s){let o=s.querySelectorAll("qti-interaction-module");for(let n of o){let l=n.getAttribute("id"),c=n.getAttribute("primary-path"),u=n.getAttribute("fallback-path"),h=c?{paths:T(E({},e.paths),{[l]:c})}:null,f=u?{paths:T(E({},e.paths),{[l]:u})}:null;l&&h&&await this.mergeConfigs(e,h,f)}}}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return p`<slot></slot>${this._errorMessage&&p`<div style="color:red">
170
+ `],We=a([m("qti-outcome-processing")],We);var Cr=class{process(t){for(let e of t)e.process()}};var Nt=class extends q{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let s=await fetch(e);if(s.ok){let o=await s.json();for(let l in o.paths)r&&(o.paths[l]=this.removeDoubleSlashes(`${r}/${o.paths[l]}`));return o}}catch(s){}return null};this.mergeConfigs=async(e,r,s)=>{var n;for(let o in r==null?void 0:r.paths)if(!e.paths[o]){let l=!1;try{let c=(n=r.paths[o])!=null&&n.toLocaleLowerCase().endsWith(".js")?r.paths[o]:r.paths[o]+".js";(await fetch(c)).ok?e.paths[o]=r.paths[o].replace(/\.js$/,""):l=!0}catch(c){l=!0}if(l&&s)if(typeof s=="string")try{let c=await this.loadConfig(s);c!=null&&c.paths[o]&&(e.paths[o]=c.paths[o].replace(/\.js$/,""))}catch(c){}else typeof s=="object"&&s!=null&&s.paths[o]&&(e.paths[o]=s.paths[o].replace(/\.js$/,""));else l&&console.error("Failed to resolve module: "+o)}}}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},_errorMessage:{type:String,state:!0}}}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let s=e[r];if(s){for(let n in s)if(s.hasOwnProperty(n)){let o=s[n];if(Array.isArray(o))return o.map(String);if(o!=null)return String(o)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),s=JSON.stringify(e);if(s!==this.rawResponse){this.rawResponse=s;let n=this.convertQtiVariableJSON(r);this.response=n,this.saveResponse(n)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set response(e){}getTAOConfig(e){let r=e.querySelectorAll("properties"),s={},n=l=>{let c={},u=l.getAttribute("key");if(u){let h=Array.from(l.children),f=h.map(v=>v.getAttribute("key"));f.length>0&&!f.find(v=>!Number.isInteger(+v))?c[u]=h.map(v=>o(v)):c[u]=l.textContent}return c},o=l=>{if(l){let c={};for(let u of l.children)c=E(E({},c),n(u));return c}};for(let l of r)return l.getAttribute("key")||(s=E(E({},s),o(l))),s;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",s=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let n=r=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);r=="IMS"?e.getInstance(s,n,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,n),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,s.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:{}};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}this.registerModules(e).then(()=>{requirejs.config(e)(["require"],s=>{!s.defined("qtiCustomInteractionContext")&&define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}}));let n=s.defined(this.module);s([this.module],o=>{n&&this.register(o)},o=>{this._errorMessage=o})},s=>{this._errorMessage=s})})}disconnectedCallback(){super.disconnectedCallback(),this.stopChecking()}async registerModules(e){let r=this.getAttribute("data-base-url");if(r){let n=`${r}/modules/module_resolution.js`,o=`${r}/modules/module_resolution_fallback.js`;if(n){let l=await this.loadConfig(n,r);await this.mergeConfigs(e,l,o)}}let s=this.querySelector("qti-interaction-modules");if(s){let n=s.querySelectorAll("qti-interaction-module");for(let o of n){let l=o.getAttribute("id"),c=o.getAttribute("primary-path"),u=o.getAttribute("fallback-path"),h=c?{paths:T(E({},e.paths),{[l]:c})}:null,f=u?{paths:T(E({},e.paths),{[l]:u})}:null;l&&h&&await this.mergeConfigs(e,h,f)}}}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return p`<slot></slot>${this._errorMessage&&p`<div style="color:red">
171
171
  <h1>Error</h1>
172
172
  ${this._errorMessage}
173
- </div>`}`}};Nt=a([m("qti-portable-custom-interaction")],Nt);var Ht=class i{constructor(){this._touchBegin=0;this._touchDown=null;this._lastClick=0;this._canDrag=!1;this._dragSrc=null;this._dragCopy=null;this._touchEndCalled=!1;this._dragRunning=!1;this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"};this._copyOffset={x:0,y:0};this._lastTarget=null;this._currentDropContainer=null;this._handleClick=!0;this._DBLCLICKDELAY=500;this._CONTEXTMENUDELAY=1e3;this._DRAGDELTA=5;this._COPYOPACITY=.7;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(t,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let r=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let s of r)this._dragCopy.style[s]=r.getPropertyValue(s);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let r=this;requestAnimationFrame(function(){r._touchEndCalled||r._dragCopy===null||(r._dragCopy.style.top=e.clientY-r._copyOffset.y+"px",r._dragCopy.style.left=e.clientX-r._copyOffset.x+"px")});let s=this._findDroppable(t);s!=this._lastTarget&&(this._dispatchEvent(s,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=s),this._currentDropContainer=s,this._currentDropContainer&&this._dispatchEvent(s,"dragover")}};return i._instance?i._instance:(i._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(t){t.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(t){this._touchBegin=Date.now();let{x:e,y:r}=this._getPoint(t);if(this._touchDown={x:e,y:r},this._dragSrc=t.currentTarget,this._canDrag=!0,this.dragOnClick){let s={clientX:e,clientY:r};this._dragRunning=!0,this._createDragCopy(t,s)}t.preventDefault()}_touchMove(t){if(this._canDrag&&this._dragSrc){let{x:e,y:r}=this._getPoint(t),s={clientX:e,clientY:r};this._getDelta(s)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(t,s),t.preventDefault()}}_touchEnd(t){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(r)}this._reset()}_touchCancel(t){this._reset()}_findDroppable(t){let e=this._getPoint(t);return this.elementFromPoint(e.x,e.y)}elementFromPoint(t,e){let r=document.elementFromPoint(t,e);if(r){for(;r.shadowRoot;){let s=r.shadowRoot.elementFromPoint(t,e);if(s===null||s===r)break;r=s}return r}return null}_getPoint(t,e){return t&&t.touches&&(t=t.touches[0]),{x:e?t.pageX:t.clientX,y:e?t.pageY:t.clientY}}_calculateDragCopyPosition(t){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=t.clientX-e.left,this._copyOffset.y=t.clientY-e.top}_getDelta(t){let e=Math.abs(t.clientX-this._touchDown.x),r=Math.abs(t.clientY-this._touchDown.y);return e+r}_dispatchEvent(t,e,r=!0){if(!t)return!1;let s=new CustomEvent(e,{bubbles:r,cancelable:!0});return s.dataTransfer=this._dataTransfer,t.dispatchEvent(s),s.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};var vs=(i,t,e)=>{class r extends i{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(n);let l=Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(u=>{u.forEach(h=>{if(h.type==="attributes")switch(h.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeHandler(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),n.currentTarget.setAttribute("active",""),n.dataTransfer.dropEffect="move",!1}dropHandler(n){n.preventDefault();let l=n.currentTarget,c=this.querySelector(`[identifier=${n.dataTransfer.getData("text")}`),u=c||this.shadowRoot.querySelector(`[identifier=${n.dataTransfer.getData("text")}`);return l?u.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(u):console.error(`cannot find droppable, target: ${n.target?JSON.stringify(n.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(n){return n.preventDefault(),n.currentTarget.removeAttribute("active"),n.dataTransfer.dropEffect="none",!1}}return a([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var ys=(i,t,e)=>{class r extends i{}return r};var z=(i,t,e,r)=>{class s extends ys(vs(i,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(h=>!this.draggables||!this.draggables.get(h)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(h=>{this.draggables.set(h,{parent:h.parentElement,index:Array.from(h.parentNode.children).indexOf(h)}),h.setAttribute("qti-draggable","true"),h.addEventListener("dragstart",f=>{f.dataTransfer.setData("text",f.currentTarget.getAttribute("identifier")),h.setAttribute("dragging","")}),h.addEventListener("dragend",f=>{if(f.preventDefault(),h.removeAttribute("over"),h.removeAttribute("dragging"),(f.dataTransfer.dropEffect==="none"||f.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let x=f.currentTarget,v=this.draggables.get(x),w=v.index<v.parent.children.length?v.index:v.parent.children.length-1,A=v.parent,S=v.parent.children[w];A.insertBefore(x,S),this.saveResponse(),this.checkMaxMatchAssociations()}f.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((u,h)=>{c?h.setAttribute("disabled",""):h.removeAttribute("disabled"),c?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((u,h)=>{c?h.setAttribute("readonly",""):h.removeAttribute("readonly"),c?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ht,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,u)=>{let h=c.parent.children,f=c.index<h.length?c.index:h.length;c.parent.insertBefore(u,h[f])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let u=+(l.getAttribute("match-max")||1)<=(l.children.length||0);u?l.setAttribute("disabled",""):l.removeAttribute("disabled"),u?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[u,...h]=c.split(" ").reverse();if(u){let f=this.droppables.find(x=>x.getAttribute("identifier")===u);h.forEach(x=>{let v=this.querySelector(`[identifier=${x}]`);f?v?(f.appendChild(v),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${x}`):console.error(`cannot find droppable with identifier: ${u}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(r)):Array.from(this.querySelectorAll(r))).filter(u=>u.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let l=this.droppables.map(c=>{var h;let u="";return((h=c.children)==null?void 0:h.length)>0&&(u+=Array.from(c.children).map(f=>f.getAttribute("identifier")).join(" ")+" "),u+=c.getAttribute("identifier"),u});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return a([ms(t)],s.prototype,"reInitDragAndDrop",1),a([d({type:String,attribute:"response-identifier"})],s.prototype,"responseIdentifier",2),a([d({attribute:!1,type:Object})],s.prototype,"configuration",2),a([$("configuration")],s.prototype,"handleDragOptionsChanged",1),a([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2),a([$("disabled",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),a([d({type:Boolean,reflect:!0})],s.prototype,"readonly",2),a([$("readonly",{waitUntilFirstUpdate:!0})],s.prototype,"handleReadonlyChange",1),a([d({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),a([d({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",2),s};var qe=class extends z(g,"qti-simple-associable-choice",!0,".dl"){render(){return p` <slot name="prompt"></slot>
173
+ </div>`}`}};Nt=a([m("qti-portable-custom-interaction")],Nt);var Ht=class i{constructor(){this._touchBegin=0;this._touchDown=null;this._lastClick=0;this._canDrag=!1;this._dragSrc=null;this._dragCopy=null;this._touchEndCalled=!1;this._dragRunning=!1;this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"};this._copyOffset={x:0,y:0};this._lastTarget=null;this._currentDropContainer=null;this._handleClick=!0;this._DBLCLICKDELAY=500;this._CONTEXTMENUDELAY=1e3;this._DRAGDELTA=5;this._COPYOPACITY=.7;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(t,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let r=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let s of r)this._dragCopy.style[s]=r.getPropertyValue(s);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let r=this;requestAnimationFrame(function(){r._touchEndCalled||r._dragCopy===null||(r._dragCopy.style.top=e.clientY-r._copyOffset.y+"px",r._dragCopy.style.left=e.clientX-r._copyOffset.x+"px")});let s=this._findDroppable(t);s!=this._lastTarget&&(this._dispatchEvent(s,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=s),this._currentDropContainer=s,this._currentDropContainer&&this._dispatchEvent(s,"dragover")}};return i._instance?i._instance:(i._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(t){t.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(t){this._touchBegin=Date.now();let{x:e,y:r}=this._getPoint(t);if(this._touchDown={x:e,y:r},this._dragSrc=t.currentTarget,this._canDrag=!0,this.dragOnClick){let s={clientX:e,clientY:r};this._dragRunning=!0,this._createDragCopy(t,s)}t.preventDefault()}_touchMove(t){if(this._canDrag&&this._dragSrc){let{x:e,y:r}=this._getPoint(t),s={clientX:e,clientY:r};this._getDelta(s)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(t,s),t.preventDefault()}}_touchEnd(t){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(r)}this._reset()}_touchCancel(t){this._reset()}_findDroppable(t){let e=this._getPoint(t);return this.elementFromPoint(e.x,e.y)}elementFromPoint(t,e){let r=document.elementFromPoint(t,e);if(r){for(;r.shadowRoot;){let s=r.shadowRoot.elementFromPoint(t,e);if(s===null||s===r)break;r=s}return r}return null}_getPoint(t,e){return t&&t.touches&&(t=t.touches[0]),{x:e?t.pageX:t.clientX,y:e?t.pageY:t.clientY}}_calculateDragCopyPosition(t){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=t.clientX-e.left,this._copyOffset.y=t.clientY-e.top}_getDelta(t){let e=Math.abs(t.clientX-this._touchDown.x),r=Math.abs(t.clientY-this._touchDown.y);return e+r}_dispatchEvent(t,e,r=!0){if(!t)return!1;let s=new CustomEvent(e,{bubbles:r,cancelable:!0});return s.dataTransfer=this._dataTransfer,t.dispatchEvent(s),s.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};var vs=(i,t,e)=>{class r extends i{constructor(){super(...arguments);this.disabled=!1}firstUpdated(o){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(o);let l=Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(u=>{u.forEach(h=>{if(h.type==="attributes")switch(h.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(o){o.addEventListener("dragover",this.dragoverHandler),o.addEventListener("dragenter",this.dragenterHandler),o.addEventListener("drop",this.dropHandler)}removeHandler(o){o.removeEventListener("dragover",this.dragoverHandler),o.removeEventListener("dragenter",this.dragenterHandler),o.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var o;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(o=this.observer)==null||o.disconnect())}dragenterHandler(o){o.preventDefault()}dragoverHandler(o){return o.preventDefault(),o.currentTarget.setAttribute("active",""),o.dataTransfer.dropEffect="move",!1}dropHandler(o){o.preventDefault();let l=o.currentTarget,c=this.querySelector(`[identifier=${o.dataTransfer.getData("text")}`),u=c||this.shadowRoot.querySelector(`[identifier=${o.dataTransfer.getData("text")}`);return l?u.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(u):console.error(`cannot find droppable, target: ${o.target?JSON.stringify(o.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(o){return o.preventDefault(),o.currentTarget.removeAttribute("active"),o.dataTransfer.dropEffect="none",!1}}return a([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var ys=(i,t,e)=>{class r extends i{}return r};var z=(i,t,e,r)=>{class s extends ys(vs(i,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(h=>!this.draggables||!this.draggables.get(h)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(h=>{this.draggables.set(h,{parent:h.parentElement,index:Array.from(h.parentNode.children).indexOf(h)}),h.setAttribute("qti-draggable","true"),h.addEventListener("dragstart",f=>{f.dataTransfer.setData("text",f.currentTarget.getAttribute("identifier")),h.setAttribute("dragging","")}),h.addEventListener("dragend",f=>{if(f.preventDefault(),h.removeAttribute("over"),h.removeAttribute("dragging"),(f.dataTransfer.dropEffect==="none"||f.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let x=f.currentTarget,v=this.draggables.get(x),w=v.index<v.parent.children.length?v.index:v.parent.children.length-1,A=v.parent,S=v.parent.children[w];A.insertBefore(x,S),this.saveResponse(),this.checkMaxMatchAssociations()}f.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((u,h)=>{c?h.setAttribute("disabled",""):h.removeAttribute("disabled"),c?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((u,h)=>{c?h.setAttribute("readonly",""):h.removeAttribute("readonly"),c?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ht,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,u)=>{let h=c.parent.children,f=c.index<h.length?c.index:h.length;c.parent.insertBefore(u,h[f])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let u=+(l.getAttribute("match-max")||1)<=(l.children.length||0);u?l.setAttribute("disabled",""):l.removeAttribute("disabled"),u?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[u,...h]=c.split(" ").reverse();if(u){let f=this.droppables.find(x=>x.getAttribute("identifier")===u);h.forEach(x=>{let v=this.querySelector(`[identifier=${x}]`);f?v?(f.appendChild(v),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${x}`):console.error(`cannot find droppable with identifier: ${u}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(r)):Array.from(this.querySelectorAll(r))).filter(u=>u.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let l=this.droppables.map(c=>{var h;let u="";return((h=c.children)==null?void 0:h.length)>0&&(u+=Array.from(c.children).map(f=>f.getAttribute("identifier")).join(" ")+" "),u+=c.getAttribute("identifier"),u});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return a([ms(t)],s.prototype,"reInitDragAndDrop",1),a([d({type:String,attribute:"response-identifier"})],s.prototype,"responseIdentifier",2),a([d({attribute:!1,type:Object})],s.prototype,"configuration",2),a([$("configuration")],s.prototype,"handleDragOptionsChanged",1),a([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2),a([$("disabled",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),a([d({type:Boolean,reflect:!0})],s.prototype,"readonly",2),a([$("readonly",{waitUntilFirstUpdate:!0})],s.prototype,"handleReadonlyChange",1),a([d({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),a([d({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",2),s};var qe=class extends z(g,"qti-simple-associable-choice",!0,".dl"){render(){return p` <slot name="prompt"></slot>
174
174
  <slot name="qti-simple-associable-choice"></slot>
175
175
  ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,r)=>p`<div part="associables-container">
176
176
  <div name="left${r}" part="drop-list" class="dl" identifier="droplist${r}_left"></div>
@@ -211,20 +211,20 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
211
211
  flex: 1;
212
212
  gap: 0.5rem;
213
213
  }
214
- `],Ke=a([m("qti-gap-match-interaction")],Ke);var xs=(i,t,e)=>{let r=new Map;for(let s=t;s<=e;s++)r.set(i[s],s);return r},Pt=ee(class extends U{constructor(i){if(super(i),i.type!==Q.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let s=[],o=[],n=0;for(let l of i)s[n]=r?r(l,n):n,o[n]=e(l,n),n++;return{values:o,keys:s}}render(i,t,e){return this.dt(i,t,e).values}update(i,[t,e,r]){var A;let s=ps(i),{values:o,keys:n}=this.dt(t,e,r);if(!Array.isArray(s))return this.ut=n,o;let l=(A=this.ut)!=null?A:this.ut=[],c=[],u,h,f=0,x=s.length-1,v=0,w=o.length-1;for(;f<=x&&v<=w;)if(s[f]===null)f++;else if(s[x]===null)x--;else if(l[f]===n[v])c[v]=ie(s[f],o[v]),f++,v++;else if(l[x]===n[w])c[w]=ie(s[x],o[w]),x--,w--;else if(l[f]===n[w])c[w]=ie(s[f],o[w]),Ee(i,c[w+1],s[f]),f++,w--;else if(l[x]===n[v])c[v]=ie(s[x],o[v]),Ee(i,s[f],s[x]),x--,v++;else if(u===void 0&&(u=xs(n,v,w),h=xs(l,f,x)),u.has(l[f]))if(u.has(l[x])){let S=h.get(n[v]),fe=S!==void 0?s[S]:null;if(fe===null){let at=Ee(i,s[f]);ie(at,o[v]),c[v]=at}else c[v]=ie(fe,o[v]),Ee(i,s[f],fe),s[S]=null;v++}else _t(s[x]),x--;else _t(s[f]),f++;for(;v<=w;){let S=Ee(i,c[w+1]);ie(S,o[v]),c[v++]=S}for(;f<=x;){let S=s[f++];S!==null&&_t(S)}return this.ut=n,cs(i,c),L}});function Te(i,t,e,r){switch(i){case"circle":{let[s,o,n]=t,l=s/e.width*100,c=o/e.height*100,u=n/e.width*100;r.style.left=l-u+"%",r.style.top=c-u+"%",r.style.width=r.style.height=4*u+"px",r.style.borderRadius="9999px"}break;case"rect":{let[s,o,n,l]=t,c=s/e.width*100,u=o/e.height*100,h=n/e.width*100,f=l/e.height*100;r.style.left=c+"%",r.style.top=u+"%",r.style.width=h-c+"%",r.style.height=f-u+"%"}break;case"poly":{let s=t.reduce((A,S,fe,at)=>{if(fe%2===1){let qs=A.pop();A[A.length]={x:qs,y:at[fe]}}else A.push(S);return A},[]),o=Math.min(...s.map(A=>A.x)),n=Math.max(...s.map(A=>A.x)),l=Math.min(...s.map(A=>A.y)),c=Math.max(...s.map(A=>A.y)),u=o/e.width*100,h=l/e.height*100,f=n/e.width*100,x=c/e.height*100;r.style.left=o/e.width*100+"%",r.style.top=l/e.height*100+"%",r.style.width=f-u+"%",r.style.height=x-h+"%";let w=s.map(A=>({x:(A.x-o)/(n-o)*100,y:(A.y-l)/(c-l)*100})).map(A=>Math.round(A.x)+"% "+Math.round(A.y)+"%").join(",");r.style.clipPath=`polygon(${w})`}break;default:break}}var W=class extends q{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,r,s,o;return p`<slot name="prompt"></slot>
214
+ `],Ke=a([m("qti-gap-match-interaction")],Ke);var xs=(i,t,e)=>{let r=new Map;for(let s=t;s<=e;s++)r.set(i[s],s);return r},Pt=ee(class extends U{constructor(i){if(super(i),i.type!==Q.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let s=[],n=[],o=0;for(let l of i)s[o]=r?r(l,o):o,n[o]=e(l,o),o++;return{values:n,keys:s}}render(i,t,e){return this.dt(i,t,e).values}update(i,[t,e,r]){var A;let s=ps(i),{values:n,keys:o}=this.dt(t,e,r);if(!Array.isArray(s))return this.ut=o,n;let l=(A=this.ut)!=null?A:this.ut=[],c=[],u,h,f=0,x=s.length-1,v=0,w=n.length-1;for(;f<=x&&v<=w;)if(s[f]===null)f++;else if(s[x]===null)x--;else if(l[f]===o[v])c[v]=ie(s[f],n[v]),f++,v++;else if(l[x]===o[w])c[w]=ie(s[x],n[w]),x--,w--;else if(l[f]===o[w])c[w]=ie(s[f],n[w]),Ee(i,c[w+1],s[f]),f++,w--;else if(l[x]===o[v])c[v]=ie(s[x],n[v]),Ee(i,s[f],s[x]),x--,v++;else if(u===void 0&&(u=xs(o,v,w),h=xs(l,f,x)),u.has(l[f]))if(u.has(l[x])){let S=h.get(o[v]),fe=S!==void 0?s[S]:null;if(fe===null){let at=Ee(i,s[f]);ie(at,n[v]),c[v]=at}else c[v]=ie(fe,n[v]),Ee(i,s[f],fe),s[S]=null;v++}else _t(s[x]),x--;else _t(s[f]),f++;for(;v<=w;){let S=Ee(i,c[w+1]);ie(S,n[v]),c[v++]=S}for(;f<=x;){let S=s[f++];S!==null&&_t(S)}return this.ut=o,cs(i,c),L}});function Te(i,t,e,r){switch(i){case"circle":{let[s,n,o]=t,l=s/e.width*100,c=n/e.height*100,u=o/e.width*100;r.style.left=l-u+"%",r.style.top=c-u+"%",r.style.width=r.style.height=4*u+"px",r.style.borderRadius="9999px"}break;case"rect":{let[s,n,o,l]=t,c=s/e.width*100,u=n/e.height*100,h=o/e.width*100,f=l/e.height*100;r.style.left=c+"%",r.style.top=u+"%",r.style.width=h-c+"%",r.style.height=f-u+"%"}break;case"poly":{let s=t.reduce((A,S,fe,at)=>{if(fe%2===1){let qs=A.pop();A[A.length]={x:qs,y:at[fe]}}else A.push(S);return A},[]),n=Math.min(...s.map(A=>A.x)),o=Math.max(...s.map(A=>A.x)),l=Math.min(...s.map(A=>A.y)),c=Math.max(...s.map(A=>A.y)),u=n/e.width*100,h=l/e.height*100,f=o/e.width*100,x=c/e.height*100;r.style.left=n/e.width*100+"%",r.style.top=l/e.height*100+"%",r.style.width=f-u+"%",r.style.height=x-h+"%";let w=s.map(A=>({x:(A.x-n)/(o-n)*100,y:(A.y-l)/(c-l)*100})).map(A=>Math.round(A.x)+"% "+Math.round(A.y)+"%").join(",");r.style.clipPath=`polygon(${w})`}break;default:break}}var W=class extends q{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,r,s,n;return p`<slot name="prompt"></slot>
215
215
  <line-container>
216
216
  <svg
217
217
  width=${j((e=this.grImage[0])==null?void 0:e.width)}
218
218
  height=${j((r=this.grImage[0])==null?void 0:r.height)}
219
- viewbox="0 0 ${(s=this.grImage[0])==null?void 0:s.width} ${(o=this.grImage[0])==null?void 0:o.height}"
219
+ viewbox="0 0 ${(s=this.grImage[0])==null?void 0:s.width} ${(n=this.grImage[0])==null?void 0:n.height}"
220
220
  >
221
- ${Pt(this._lines,n=>n,(n,l)=>Zt`
221
+ ${Pt(this._lines,o=>o,(o,l)=>Zt`
222
222
  <line
223
223
  part="line"
224
- x1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.left)}
225
- y1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.top)}
226
- x2=${parseInt(this.querySelector("[identifier="+n.split(" ")[1]+"]").style.left)}
227
- y2=${parseInt(this.querySelector("[identifier="+n.split(" ")[1]+"]").style.top)}
224
+ x1=${parseInt(this.querySelector("[identifier="+o.split(" ")[0]+"]").style.left)}
225
+ y1=${parseInt(this.querySelector("[identifier="+o.split(" ")[0]+"]").style.top)}
226
+ x2=${parseInt(this.querySelector("[identifier="+o.split(" ")[1]+"]").style.left)}
227
+ y2=${parseInt(this.querySelector("[identifier="+o.split(" ")[1]+"]").style.top)}
228
228
  stroke="red"
229
229
  stroke-width="3"
230
230
  @click=${c=>{c.stopPropagation(),this._lines=this._lines.filter((u,h)=>h!==l),this.saveResponse(this._lines)}}
@@ -241,7 +241,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
241
241
  />`}
242
242
  </svg>
243
243
  <slot></slot>
244
- </line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,o=s.getAttribute("coords"),n=s.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));Te(n,l,r,s)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",s=>{this.startPoint?this.endPoint||(this.endPoint=s.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=s.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};W.styles=[b`
244
+ </line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),l=n.split(",").map(c=>parseInt(c));Te(o,l,r,s)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",s=>{this.startPoint?this.endPoint||(this.endPoint=s.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=s.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};W.styles=[b`
245
245
  slot:not([name='prompt']) {
246
246
  // position: relative; /* qti-hotspot-choice relative to the slot */
247
247
  display: block;
@@ -265,7 +265,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
265
265
  left: 0px;
266
266
  }
267
267
  `],a([C()],W.prototype,"_lines",2),a([C()],W.prototype,"startCoord",2),a([C()],W.prototype,"mouseCoord",2),a([De("svg")],W.prototype,"svgContainer",2),a([is({selector:"img"})],W.prototype,"grImage",2),W=a([m("qti-graphic-associate-interaction")],W);var Je=class extends z(g,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return p` <slot></slot>
268
- <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),o=r.getAttribute("shape"),n=s.split(",").map(l=>parseInt(l));switch(o){case"circle":{let[l,c,u]=n;r.style.left=l-u+"px",r.style.top=c-u+"px",r.style.width=r.style.height=2*u+"px"}break;case"rect":{let[l,c,u,h]=n;r.style.left=l+"px",r.style.top=c+"px",r.style.width=u-l+"px",r.style.height=h-c+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Je.styles=b`
268
+ <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),n=r.getAttribute("shape"),o=s.split(",").map(l=>parseInt(l));switch(n){case"circle":{let[l,c,u]=o;r.style.left=l-u+"px",r.style.top=c-u+"px",r.style.width=r.style.height=2*u+"px"}break;case"rect":{let[l,c,u,h]=o;r.style.left=l+"px",r.style.top=c+"px",r.style.width=u-l+"px",r.style.height=h-c+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Je.styles=b`
269
269
  :host {
270
270
  display: inline-block;
271
271
  position: relative;
@@ -279,7 +279,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
279
279
  <!-- slot for the prompt -->
280
280
  <slot></slot>
281
281
  <!-- slot for the image and hotspots -->
282
- `}setHotspotOrder(e){let{identifier:r}=e.detail,s=this._choiceElements.find(n=>n.getAttribute("identifier")===r),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,s.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}s.order=this._choiceElements.filter(n=>!!n.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(n=>(n.order>n.order&&n.order--,n)),s.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,o=s.getAttribute("coords"),n=s.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));Te(n,l,r,s)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Ze.styles=[b`
282
+ `}setHotspotOrder(e){let{identifier:r}=e.detail,s=this._choiceElements.find(o=>o.getAttribute("identifier")===r),n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,s.order==null){if(this._choiceElements.filter(o=>o.order>0).length>=n){this.choiceOrdering=!1;return}s.order=this._choiceElements.filter(o=>!!o.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(o=>(o.order>o.order&&o.order--,o)),s.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),l=n.split(",").map(c=>parseInt(c));Te(o,l,r,s)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Ze.styles=[b`
283
283
  slot:not([name='prompt']) {
284
284
  position: relative; /* qti-hotspot-choice relative to the slot */
285
285
  display: block;
@@ -295,7 +295,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
295
295
  <!-- slot for the prompt -->
296
296
  <slot></slot>
297
297
  <!-- slot for the image and hotspots -->
298
- `}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),o=r.getAttribute("shape"),n=s.split(",").map(l=>parseInt(l));Te(o,n,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Ge.styles=[b`
298
+ `}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),n=r.getAttribute("shape"),o=s.split(",").map(l=>parseInt(l));Te(n,o,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Ge.styles=[b`
299
299
  slot:not([name='prompt']) {
300
300
  position: relative; /* qti-hotspot-choice relative to the slot */
301
301
  display: block;
@@ -319,12 +319,12 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
319
319
  </tr>
320
320
  ${this.rows.map((e,r)=>p`<tr>
321
321
  <td part="c-header">${_e(e.innerHTML)}</td>
322
- ${this.cols.map((s,o)=>{let n=`${e.getAttribute("identifier")} ${s.getAttribute("identifier")}`;return p`<td>
322
+ ${this.cols.map((s,n)=>{let o=`${e.getAttribute("identifier")} ${s.getAttribute("identifier")}`;return p`<td>
323
323
  <input
324
324
  type="checkbox"
325
325
  value=${s.getAttribute("identifier")}
326
- .checked=${this.response.includes(n)}
327
- @change=${l=>{l.target.checked?this.response.push(n):this.response=this.response.filter(u=>u!==n),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:this.response}}))}}
326
+ .checked=${this.response.includes(o)}
327
+ @change=${l=>{l.target.checked?this.response.push(o):this.response=this.response.filter(u=>u!==o),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:this.response}}))}}
328
328
  />
329
329
  </td>`})}
330
330
  </tr>`)}
@@ -400,18 +400,18 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
400
400
  display: inline-block;
401
401
  position: relative;
402
402
  }
403
- `],et=a([m("qti-position-object-stage")],et);var Es="important",ei=" !"+Es,_s=ee(class extends U{constructor(i){var t;if(super(i),i.type!==Q.ATTRIBUTE||i.name!=="style"||((t=i.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{let r=i[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(i,[t]){let{style:e}=i.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let s=t[r];if(s!=null){this.ft.add(r);let o=typeof s=="string"&&s.endsWith(ei);r.includes("-")||o?e.setProperty(r,o?s.slice(0,-11):s,o?Es:""):e[r]=s}}return L}});var ne=class extends q{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return p` <slot name="prompt"></slot>
403
+ `],et=a([m("qti-position-object-stage")],et);var Es="important",ei=" !"+Es,_s=ee(class extends U{constructor(i){var t;if(super(i),i.type!==Q.ATTRIBUTE||i.name!=="style"||((t=i.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{let r=i[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(i,[t]){let{style:e}=i.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let s=t[r];if(s!=null){this.ft.add(r);let n=typeof s=="string"&&s.endsWith(ei);r.includes("-")||n?e.setProperty(r,n?s.slice(0,-11):s,n?Es:""):e[r]=s}}return L}});var ne=class extends q{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return p` <slot name="prompt"></slot>
404
404
  <point-container>
405
405
  ${Pt(this._points,e=>e,(e,r)=>p`
406
406
  <button
407
407
  part="point"
408
408
  style=${_s({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
409
409
  aria-label="Remove point at ${e}"
410
- @click=${s=>{s.stopPropagation(),this._points=this._points.filter((o,n)=>n!==r),this.saveResponse(this._points)}}
410
+ @click=${s=>{s.stopPropagation(),this._points=this._points.filter((n,o)=>o!==r),this.saveResponse(this._points)}}
411
411
  ></button>
412
412
  `)}
413
413
  <slot></slot>
414
- </point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",r=>{let s=r.offsetX,o=r.offsetY;this._points=[...this._points,s+" "+o],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};ne.styles=[b`
414
+ </point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",r=>{let s=r.offsetX,n=r.offsetY;this._points=[...this._points,s+" "+n],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};ne.styles=[b`
415
415
  :host {
416
416
  display: block;
417
417
  }
@@ -431,7 +431,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
431
431
  ${this.csLive.getPropertyValue("--show-value")=="true"?p`<div id="value" part="value">${this.value}</div>`:_}
432
432
  </div>
433
433
  </div>
434
- </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=l=>{let{x:c}=this.getPositionFromEvent(l),u=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),l.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let r=n=>{let l=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),n.preventDefault(),n.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=s.touches[0]||s.changedTouches[0];r={x:o.pageX,y:o.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};k.styles=[b``],a([De("#knob")],k.prototype,"_knob",2),a([De("#rail")],k.prototype,"_rail",2),a([d({type:Number})],k.prototype,"value",2),a([d({type:Boolean,attribute:"step-label"})],k.prototype,"stepLabel",2),a([d({type:Boolean})],k.prototype,"reverse",2),a([d({type:Number,attribute:"lower-bound"})],k.prototype,"min",1),a([d({type:Number,attribute:"upper-bound"})],k.prototype,"max",1),a([d({type:Number,attribute:"step"})],k.prototype,"step",1),a([$("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),a([$("readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),k=a([m("qti-slider-interaction")],k);var tt=class extends g{render(){return p`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(e){var s,o,n;let r=Array.from((o=(s=this.firstElementChild)==null?void 0:s.childNodes)!=null?o:[]).find(l=>l.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(n=r.textContent)!=null?n:"")}catch(l){console.error("custom-operator contains invalid javascript code",l)}}calculate(){let e={variable:s=>{var o,n,l;return(l=(n=(o=this._context)==null?void 0:o.variables.find(c=>c.identifier===s))==null?void 0:n.value)!=null?l:""},correct:s=>{var o,n,l;return(l=(n=(o=this._context)==null?void 0:o.variables.find(c=>c.identifier===s))==null?void 0:n.correctResponse)!=null?l:""}},r={getVariable:s=>{var o;return(o=this._context)==null?void 0:o.variables.find(n=>n.identifier===s)},updateOutcomeVariable:(s,o)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:s,value:o}}))}};return this.operatorFunction(this._context,e,r)}};a([K({context:I,subscribe:!0}),C()],tt.prototype,"_context",2),tt=a([m("qti-custom-operator")],tt);var rt=class extends g{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return p` <slot name="qti-gap-img"></slot> `}};rt.styles=b`
434
+ </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=l=>{let{x:c}=this.getPositionFromEvent(l),u=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),l.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:n}=this.getPositionFromEvent(e),o=n-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.stopPropagation()}_onMouseDown(e){let r=o=>{let l=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),o.preventDefault(),o.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let n=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,n=s.touches[0]||s.changedTouches[0];r={x:n.pageX,y:n.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};k.styles=[b``],a([De("#knob")],k.prototype,"_knob",2),a([De("#rail")],k.prototype,"_rail",2),a([d({type:Number})],k.prototype,"value",2),a([d({type:Boolean,attribute:"step-label"})],k.prototype,"stepLabel",2),a([d({type:Boolean})],k.prototype,"reverse",2),a([d({type:Number,attribute:"lower-bound"})],k.prototype,"min",1),a([d({type:Number,attribute:"upper-bound"})],k.prototype,"max",1),a([d({type:Number,attribute:"step"})],k.prototype,"step",1),a([$("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),a([$("readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),k=a([m("qti-slider-interaction")],k);var tt=class extends g{render(){return p`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(e){var s,n,o;let r=Array.from((n=(s=this.firstElementChild)==null?void 0:s.childNodes)!=null?n:[]).find(l=>l.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(o=r.textContent)!=null?o:"")}catch(l){console.error("custom-operator contains invalid javascript code",l)}}calculate(){let e={variable:s=>{var n,o,l;return(l=(o=(n=this._context)==null?void 0:n.variables.find(c=>c.identifier===s))==null?void 0:o.value)!=null?l:""},correct:s=>{var n,o,l;return(l=(o=(n=this._context)==null?void 0:n.variables.find(c=>c.identifier===s))==null?void 0:o.correctResponse)!=null?l:""}},r={getVariable:s=>{var n;return(n=this._context)==null?void 0:n.variables.find(o=>o.identifier===s)},updateOutcomeVariable:(s,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:s,value:n}}))}};return this.operatorFunction(this._context,e,r)}};a([K({context:I,subscribe:!0}),C()],tt.prototype,"_context",2),tt=a([m("qti-custom-operator")],tt);var rt=class extends g{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return p` <slot name="qti-gap-img"></slot> `}};rt.styles=b`
435
435
  :host {
436
436
  position: absolute;
437
437
  }
@@ -449,7 +449,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
449
449
  width: 100%;
450
450
  display: block;
451
451
  }
452
- `,nt=a([m("qti-simple-choice")],nt);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");var ti=String.raw,Nf=()=>{let i,t={async load(e){return new Promise((r,s)=>{Cs(e).then(o=>(i=o,r(t)))})},parse(e){return i=As(e),t},path:e=>(ii(i,e),t),pciHooks(e){let r=["hook","module"],s=e.substring(0,e.lastIndexOf("/"));for(let o of r)i.querySelectorAll("["+o+"]").forEach(l=>{let c=l.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(l.setAttribute("base-url",e),l.setAttribute("module",s+"/"+encodeURIComponent(c+(c.endsWith(".js")?"":".js"))))});return t},convertCDATAtoComment(){return oi(i),t},stripStyleSheets(){return ni(i),t},html(){return new XMLSerializer().serializeToString(It(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return It(i)},xmldoc(){return i}};return t},Hf=()=>{let i,t={async load(e){return new Promise((r,s)=>{Cs(e).then(o=>(i=o,r(t)))})},parse(e){return i=As(e),t},items(){return si(i)},html(){return new XMLSerializer().serializeToString(It(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return It(i)},xmldoc(){return i}};return t},ri=ti`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
452
+ `,nt=a([m("qti-simple-choice")],nt);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");var ti=String.raw,Nf=()=>{let i,t={async load(e){return new Promise((r,s)=>{Cs(e).then(n=>(i=n,r(t)))})},parse(e){return i=As(e),t},path:e=>(ii(i,e),t),pciHooks(e){let r=["hook","module"],s=e.substring(0,e.lastIndexOf("/"));for(let n of r)i.querySelectorAll("["+n+"]").forEach(l=>{let c=l.getAttribute(n);!c.startsWith("data:")&&!c.startsWith("http")&&(l.setAttribute("base-url",e),l.setAttribute("module",s+"/"+encodeURIComponent(c+(c.endsWith(".js")?"":".js"))))});return t},convertCDATAtoComment(){return oi(i),t},stripStyleSheets(){return ni(i),t},html(){return new XMLSerializer().serializeToString(It(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return It(i)},xmldoc(){return i}};return t},Hf=()=>{let i,t={async load(e){return new Promise((r,s)=>{Cs(e).then(n=>(i=n,r(t)))})},parse(e){return i=As(e),t},items(){return si(i)},html(){return new XMLSerializer().serializeToString(It(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return It(i)},xmldoc(){return i}};return t},ri=ti`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
453
453
  <xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
454
454
  <xsl:template match="@*|node()">
455
455
  <xsl:copy>
@@ -471,7 +471,7 @@ var Tr=Object.defineProperty,ws=Object.defineProperties,Ts=Object.getOwnProperty
471
471
  <xsl:apply-templates/>
472
472
  </xsl:element>
473
473
  </xsl:template>
474
- </xsl:stylesheet>`;function si(i){let t=[];return i.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),s=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:s,category:o})}),t}var Ar=null;function Cs(i){return Ar!==null&&Ar.abort(),new Promise((t,e)=>{let r=new XMLHttpRequest;Ar=r,r.open("GET",i,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?t(r.responseXML):e(r.statusText)},r.onerror=()=>{e(r.statusText)},r.send()})}function As(i){return new DOMParser().parseFromString(i,"text/xml")}function It(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(ri,"text/xml");return t.importStylesheet(e),t.transformToFragment(i,document)}function ii(i,t){t.endsWith("/")||(t+="/"),i.querySelectorAll("[src],[href]").forEach(e=>{var o;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href");let s=(o=e.getAttribute(r))==null?void 0:o.trim();if(!s.startsWith("data:")&&!s.startsWith("http")){let n=t+encodeURI(s);e.setAttribute(r,n)}})}function oi(i){i.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function ni(i){i.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}export{q as Interaction,ze as QtPrintedVariable,$t as QtiAnd,N as QtiAssessmentItem,rt as QtiAssociableHotspot,qe as QtiAssociateInteraction,St as QtiBaseValue,M as QtiChoice,Ce as QtiChoiceInteraction,xt as QtiCompanionMaterialsInfo,V as QtiConditionExpression,nr as QtiContains,Et as QtiContentBody,ar as QtiCorrect,tt as QtiCustomOperator,we as QtiEndAttemptInteraction,kt as QtiEqual,Rt as QtiEqualRounded,y as QtiExpression,X as QtiExtendedTextInteraction,Ue as QtiFeedbackBlock,Ie as QtiFeedbackInline,st as QtiGap,it as QtiGapImg,Ke as QtiGapMatchInteraction,ot as QtiGapText,W as QtiGraphicAssociateInteraction,Je as QtiGraphicGapMatchInteraction,Ze as QtiGraphicOrderInteraction,lr as QtiGt,cr as QtiGte,$e as QtiHotspotChoice,Ge as QtiHotspotInteraction,Ot as QtiHottext,wt as QtiHottextInteraction,Ut as QtiInlineChoice,oe as QtiInlineChoiceInteraction,pr as QtiIsNull,Tt as QtiLookupOutcomeValue,dr as QtiLt,ur as QtiLte,Mt as QtiMapResponse,Ae as QtiMapping,mr as QtiMatch,me as QtiMatchInteraction,Qe as QtiMediaInteraction,hr as QtiMember,Fe as QtiModalFeedback,fr as QtiMultiple,gr as QtiNot,br as QtiOr,he as QtiOrderInteraction,vr as QtiOrdered,F as QtiOutcomeDeclaration,We as QtiOutcomeProcessing,Cr as QtiOutcomeProcessingProcessor,Nt as QtiPortableCustomInteraction,et as QtiPositionObjectStage,yr as QtiProduct,vt as QtiPrompt,rr as QtiResponseCondition,G as QtiResponseDeclaration,Xe as QtiResponseElse,or as QtiResponseElseIf,Ye as QtiResponseIf,ue as QtiResponseProcessing,B as QtiRubricBlock,Y as QtiRule,Dt as QtiSPositionObjectInteraction,ne as QtiSelectPointInteraction,sr as QtiSetOutcomeValue,ir as QtiSetOutcomeValueRule,Vt as QtiSimpleAssociableChoice,nt as QtiSimpleChoice,k as QtiSliderInteraction,Lt as QtiStringMatch,yt as QtiStylesheet,xr as QtiSum,Er as QtiSumExpression,P as QtiTextEntryInteraction,_r as QtiVariable,I as itemContext,os as itemContextVariables,Qs as qtiAndMixin,Nf as qtiTransformItem,Hf as qtiTransformTest};
474
+ </xsl:stylesheet>`;function si(i){let t=[];return i.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),s=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:s,category:n})}),t}var Ar=null;function Cs(i){return Ar!==null&&Ar.abort(),new Promise((t,e)=>{let r=new XMLHttpRequest;Ar=r,r.open("GET",i,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?t(r.responseXML):e(r.statusText)},r.onerror=()=>{e(r.statusText)},r.send()})}function As(i){return new DOMParser().parseFromString(i,"text/xml")}function It(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(ri,"text/xml");return t.importStylesheet(e),t.transformToFragment(i,document)}function ii(i,t){t.endsWith("/")||(t+="/"),i.querySelectorAll("[src],[href]").forEach(e=>{var n;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href");let s=(n=e.getAttribute(r))==null?void 0:n.trim();if(!s.startsWith("data:")&&!s.startsWith("http")){let o=t+encodeURI(s);e.setAttribute(r,o)}})}function oi(i){i.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function ni(i){i.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}export{q as Interaction,ze as QtPrintedVariable,$t as QtiAnd,N as QtiAssessmentItem,rt as QtiAssociableHotspot,qe as QtiAssociateInteraction,St as QtiBaseValue,M as QtiChoice,Ce as QtiChoiceInteraction,xt as QtiCompanionMaterialsInfo,V as QtiConditionExpression,nr as QtiContains,Et as QtiContentBody,ar as QtiCorrect,tt as QtiCustomOperator,we as QtiEndAttemptInteraction,kt as QtiEqual,Rt as QtiEqualRounded,y as QtiExpression,X as QtiExtendedTextInteraction,Ue as QtiFeedbackBlock,Ie as QtiFeedbackInline,st as QtiGap,it as QtiGapImg,Ke as QtiGapMatchInteraction,ot as QtiGapText,W as QtiGraphicAssociateInteraction,Je as QtiGraphicGapMatchInteraction,Ze as QtiGraphicOrderInteraction,lr as QtiGt,cr as QtiGte,$e as QtiHotspotChoice,Ge as QtiHotspotInteraction,Ot as QtiHottext,wt as QtiHottextInteraction,Ut as QtiInlineChoice,oe as QtiInlineChoiceInteraction,pr as QtiIsNull,Tt as QtiLookupOutcomeValue,dr as QtiLt,ur as QtiLte,Mt as QtiMapResponse,Ae as QtiMapping,mr as QtiMatch,me as QtiMatchInteraction,Qe as QtiMediaInteraction,hr as QtiMember,Fe as QtiModalFeedback,fr as QtiMultiple,gr as QtiNot,br as QtiOr,he as QtiOrderInteraction,vr as QtiOrdered,F as QtiOutcomeDeclaration,We as QtiOutcomeProcessing,Cr as QtiOutcomeProcessingProcessor,Nt as QtiPortableCustomInteraction,et as QtiPositionObjectStage,yr as QtiProduct,vt as QtiPrompt,rr as QtiResponseCondition,G as QtiResponseDeclaration,Xe as QtiResponseElse,or as QtiResponseElseIf,Ye as QtiResponseIf,ue as QtiResponseProcessing,B as QtiRubricBlock,Y as QtiRule,Dt as QtiSPositionObjectInteraction,ne as QtiSelectPointInteraction,sr as QtiSetOutcomeValue,ir as QtiSetOutcomeValueRule,Vt as QtiSimpleAssociableChoice,nt as QtiSimpleChoice,k as QtiSliderInteraction,Lt as QtiStringMatch,yt as QtiStylesheet,xr as QtiSum,Er as QtiSumExpression,P as QtiTextEntryInteraction,_r as QtiVariable,I as itemContext,os as itemContextVariables,Qs as qtiAndMixin,Nf as qtiTransformItem,Hf as qtiTransformTest};
475
475
  /*! Bundled license information:
476
476
 
477
477
  @lit/context/lib/context-request-event.js: