@citolab/qti-components 7.0.1 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/{index.min.js → index.js} +378 -186
  3. package/dist/custom-elements.json +27088 -0
  4. package/dist/{qti-test/index.d.ts → index.d.ts} +163 -2
  5. package/dist/index.js +13601 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/item.css +223 -32
  8. package/dist/{qti-loader → loader}/index.d.ts +1 -1
  9. package/dist/qti-components-jsx.d.ts +29 -25
  10. package/dist/{qti-simple-choice-CynLWb8d.d.cts → qti-simple-choice-DG8ImdPz.d.ts} +2 -2
  11. package/dist/vscode.html-custom-data.json +12 -9
  12. package/package.json +40 -59
  13. package/cdn/index.min.cjs +0 -4489
  14. package/dist/qti-components/index.cjs +0 -6704
  15. package/dist/qti-components/index.cjs.map +0 -1
  16. package/dist/qti-components/index.d.cts +0 -150
  17. package/dist/qti-components/index.d.ts +0 -150
  18. package/dist/qti-components/index.js +0 -6593
  19. package/dist/qti-components/index.js.map +0 -1
  20. package/dist/qti-item/index.cjs +0 -89
  21. package/dist/qti-item/index.cjs.map +0 -1
  22. package/dist/qti-item/index.d.cts +0 -24
  23. package/dist/qti-item/index.d.ts +0 -24
  24. package/dist/qti-item/index.js +0 -65
  25. package/dist/qti-item/index.js.map +0 -1
  26. package/dist/qti-loader/index.cjs +0 -332
  27. package/dist/qti-loader/index.cjs.map +0 -1
  28. package/dist/qti-loader/index.d.cts +0 -20
  29. package/dist/qti-simple-choice-CynLWb8d.d.ts +0 -1185
  30. package/dist/qti-test/index.cjs +0 -4632
  31. package/dist/qti-test/index.cjs.map +0 -1
  32. package/dist/qti-test/index.d.cts +0 -304
  33. package/dist/qti-test/index.js +0 -4599
  34. package/dist/qti-test/index.js.map +0 -1
  35. package/dist/qti-transformers/index.cjs +0 -316
  36. package/dist/qti-transformers/index.cjs.map +0 -1
  37. package/dist/qti-transformers/index.d.cts +0 -75
  38. /package/dist/{qti-loader → loader}/index.js +0 -0
  39. /package/dist/{qti-loader → loader}/index.js.map +0 -0
  40. /package/dist/{qti-transformers → transformers}/index.d.ts +0 -0
  41. /package/dist/{qti-transformers → transformers}/index.js +0 -0
  42. /package/dist/{qti-transformers → transformers}/index.js.map +0 -0
@@ -1,7 +1,7 @@
1
- var yi=Object.defineProperty;var Us=Object.getOwnPropertyDescriptor;var Fs=(s,e,t)=>e in s?yi(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t,r)=>{for(var i=r>1?void 0:r?Us(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(e,t,i):n(i))||i);return r&&i&&yi(e,t,i),i};var z=(s,e,t)=>Fs(s,typeof e!="symbol"?e+"":e,t);var dt=class extends Event{constructor(e,t,r){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.callback=t,this.subscribe=r??!1}};var Rt=class{constructor(e,t,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(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,n)),this.unsubscribe=n},this.host=e,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new dt(this.context,this.t,this.subscribe))}};var Ue=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Rr=class extends Event{constructor(e){super("context-provider",{bubbles:!0,composed:!0}),this.context=e}},Mt=class extends Ue{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=i=>{let o=i.composedPath()[0];i.context===this.context&&o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{let o=i.composedPath()[0];if(i.context!==this.context||o===this.host)return;let n=new Set;for(let[a,{consumerHost:c}]of this.subscriptions)n.has(a)||(n.add(a),c.dispatchEvent(new dt(this.context,a,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Rr(this.context))}};function Lt({context:s}){return(e,t)=>{let r=new WeakMap;if(typeof t=="object")return t.addInitializer(function(){r.set(this,new Mt(this,{context:s}))}),{get(){return e.get.call(this)},set(i){return r.get(this)?.setValue(i),e.set.call(this,i)},init(i){return r.get(this)?.setValue(i),i}};{e.constructor.addInitializer(n=>{r.set(n,new Mt(n,{context:s}))});let i=Object.getOwnPropertyDescriptor(e,t),o;if(i===void 0){let n=new WeakMap;o={get(){return n.get(this)},set(a){r.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;o={...i,set(a){r.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(e,t,o)}}}function T({context:s,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new Rt(this,{context:s,callback:i=>{t.set.call(this,i)},subscribe:e})}):t.constructor.addInitializer(i=>{new Rt(i,{context:s,callback:o=>{i[r]=o},subscribe:e})})}}var qi=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",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=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var wi=new WeakMap,ie=s=>{let e=wi.get(s);return e===void 0&&wi.set(s,e=new Map),e},Bs=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ie(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){ie(this).set(e,String(t))}removeAttribute(e){ie(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return ie(this).has(e)}attachShadow(e){let t={host:this};return this.__shadowRootMode=e.mode,e&&e.mode==="open"&&(this.__shadowRoot=t),t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new qi(this);return this.__internals=e,e}getAttribute(e){return ie(this).get(e)??null}};var js=class extends Bs{},Ei=js;var Ws=class{constructor(){this.__definitions=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
- Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]})}get(e){return this.__definitions.get(e)?.ctor}},Xs=Ws;var Ci=new Xs;var se=globalThis,Fe=se.ShadowRoot&&(se.ShadyCSS===void 0||se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Mr=Symbol(),_i=new WeakMap,oe=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Mr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Fe&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=_i.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&_i.set(t,e))}return e}toString(){return this.cssText}},ki=s=>new oe(typeof s=="string"?s:s+"",void 0,Mr),b=(s,...e)=>{let t=s.length===1?s[0]:e.reduce((r,i,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.")})(i)+s[o+1],s[0]);return new oe(t,s,Mr)},Lr=(s,e)=>{if(Fe)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=se.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,s.appendChild(r)}},Be=Fe||se.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ki(t)})(s):s;var{is:Ys,defineProperty:Gs,getOwnPropertyDescriptor:Ks,getOwnPropertyNames:Zs,getOwnPropertySymbols:Js,getPrototypeOf:Qs}=Object,U=globalThis;U.customElements??(U.customElements=Ci);var Ti=U.trustedTypes,to=Ti?Ti.emptyScript:"",eo=U.reactiveElementPolyfillSupport,ne=(s,e)=>s,ae={toAttribute(s,e){switch(e){case Boolean:s=s?to:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},je=(s,e)=>!Ys(s,e),Ai={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:je};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),U.litPropertyMetadata??(U.litPropertyMetadata=new WeakMap);var st=class extends(globalThis.HTMLElement??Ei){static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ai){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Gs(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Ks(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get(){return i?.call(this)},set(n){let a=i?.call(this);o.call(this,n),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ai}static _$Ei(){if(this.hasOwnProperty(ne("elementProperties")))return;let e=Qs(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ne("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ne("properties"))){let t=this.properties,r=[...Zs(t),...Js(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Be(i))}else e!==void 0&&t.push(Be(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Lr(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ae).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ae;this._$Em=i,this[i]=n.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??je)(this[e],t))return;this.P(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r)o.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}};st.elementStyles=[],st.shadowRootOptions={mode:"open"},st[ne("elementProperties")]=new Map,st[ne("finalized")]=new Map,eo?.({ReactiveElement:st}),(U.reactiveElementVersions??(U.reactiveElementVersions=[])).push("2.0.4");var $t=globalThis,We=$t.trustedTypes,Si=We?We.createPolicy("lit-html",{createHTML:s=>s}):void 0,Dr="$lit$",ot=`lit$${Math.random().toFixed(9).slice(2)}$`,Ir="?"+ot,ro=`<${Ir}>`,Ct=$t.document===void 0?{createTreeWalker:()=>({})}:document,ce=()=>Ct.createComment(""),de=s=>s===null||typeof s!="object"&&typeof s!="function",Nr=Array.isArray,Ii=s=>Nr(s)||typeof s?.[Symbol.iterator]=="function",$r=`[
3
- \f\r]`,le=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ri=/-->/g,Mi=/>/g,wt=RegExp(`>|${$r}(?:([^\\s"'>=/]+)(${$r}*=${$r}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Li=/'/g,$i=/"/g,Ni=/^(?:script|style|textarea|title)$/i,Pr=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),h=Pr(1),Or=Pr(2),_n=Pr(3),R=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Di=new WeakMap,Et=Ct.createTreeWalker(Ct,129);function Pi(s,e){if(!Nr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Si!==void 0?Si.createHTML(e):e}var Oi=(s,e)=>{let t=s.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",n=le;for(let a=0;a<t;a++){let c=s[a],d,u,m=-1,f=0;for(;f<c.length&&(n.lastIndex=f,u=n.exec(c),u!==null);)f=n.lastIndex,n===le?u[1]==="!--"?n=Ri:u[1]!==void 0?n=Mi:u[2]!==void 0?(Ni.test(u[2])&&(i=RegExp("</"+u[2],"g")),n=wt):u[3]!==void 0&&(n=wt):n===wt?u[0]===">"?(n=i??le,m=-1):u[1]===void 0?m=-2:(m=n.lastIndex-u[2].length,d=u[1],n=u[3]===void 0?wt:u[3]==='"'?$i:Li):n===$i||n===Li?n=wt:n===Ri||n===Mi?n=le:(n=wt,i=void 0);let y=n===wt&&s[a+1].startsWith("/>")?" ":"";o+=n===le?c+ro:m>=0?(r.push(d),c.slice(0,m)+Dr+c.slice(m)+ot+y):c+ot+(m===-2?a:y)}return[Pi(s,o+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},pe=class s{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,n=0,a=e.length-1,c=this.parts,[d,u]=Oi(e,t);if(this.el=s.createElement(d,r),Et.currentNode=this.el.content,t===2||t===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Et.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Dr)){let f=u[n++],y=i.getAttribute(m).split(ot),x=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:x[2],strings:y,ctor:x[1]==="."?Ye:x[1]==="?"?Ge:x[1]==="@"?Ke:kt}),i.removeAttribute(m)}else m.startsWith(ot)&&(c.push({type:6,index:o}),i.removeAttribute(m));if(Ni.test(i.tagName)){let m=i.textContent.split(ot),f=m.length-1;if(f>0){i.textContent=We?We.emptyScript:"";for(let y=0;y<f;y++)i.append(m[y],ce()),Et.nextNode(),c.push({type:2,index:++o});i.append(m[f],ce())}}}else if(i.nodeType===8)if(i.data===Ir)c.push({type:2,index:o});else{let m=-1;for(;(m=i.data.indexOf(ot,m+1))!==-1;)c.push({type:7,index:o}),m+=ot.length-1}o++}}static createElement(e,t){let r=Ct.createElement("template");return r.innerHTML=e,r}};function _t(s,e,t=s,r){if(e===R)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=de(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=_t(s,i._$AS(s,e.values),i,r)),e}var Xe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??Ct).importNode(t,!0);Et.currentNode=i;let o=Et.nextNode(),n=0,a=0,c=r[0];for(;c!==void 0;){if(n===c.index){let d;c.type===2?d=new Dt(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new Ze(o,this,e)),this._$AV.push(d),c=r[++a]}n!==c?.index&&(o=Et.nextNode(),n++)}return Et.currentNode=Ct,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},Dt=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=_t(this,e,t),de(e)?e===k||e==null||e===""?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==R&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ii(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&de(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ct.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=pe.createElement(Pi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Xe(i,this),n=o.u(this.options);o.p(t),this.T(n),this._$AH=o}}_$AC(e){let t=Di.get(e.strings);return t===void 0&&Di.set(e.strings,t=new pe(e)),t}k(e){Nr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new s(this.O(ce()),this.O(ce()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},kt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=k}_$AI(e,t=this,r,i){let o=this.strings,n=!1;if(o===void 0)e=_t(this,e,t,0),n=!de(e)||e!==this._$AH&&e!==R,n&&(this._$AH=e);else{let a=e,c,d;for(e=o[0],c=0;c<o.length-1;c++)d=_t(this,a[r+c],t,c),d===R&&(d=this._$AH[c]),n||(n=!de(d)||d!==this._$AH[c]),d===k?e=k:e!==k&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}n&&!i&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ye=class extends kt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},Ge=class extends kt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ke=class extends kt{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=_t(this,e,t,0)??k)===R)return;let r=this._$AH,i=e===k&&r!==k||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==k&&(r===k||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ze=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){_t(this,e)}},M={M:Dr,P:ot,A:Ir,C:1,L:Oi,R:Xe,D:Ii,V:_t,I:Dt,H:kt,N:Ge,U:Ke,B:Ye,F:Ze},io=$t.litHtmlPolyfillSupport;io?.(pe,Dt),($t.litHtmlVersions??($t.litHtmlVersions=[])).push("3.2.1");var Hr=(s,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new Dt(e.insertBefore(ce(),o),o,void 0,t??{})}return i._$AI(s),i};var v=class extends st{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Hr(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return R}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var so=globalThis.litElementPolyfillSupport;so?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var g=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};var oo={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:je},no=(s=oo,e,t)=>{let{kind:r,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(t.name,s),r==="accessor"){let{name:n}=t;return{set(a){let c=e.get.call(this);e.set.call(this,a),this.requestUpdate(n,c,s)},init(a){return a!==void 0&&this.P(n,void 0,s),a}}}if(r==="setter"){let{name:n}=t;return function(a){let c=this[n];e.call(this,a),this.requestUpdate(n,c,s)}}throw Error("Unsupported decorator location: "+r)};function p(s){return(e,t)=>typeof t=="object"?no(s,e,t):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,e,t)}function w(s){return p({...s,state:!0,attribute:!1})}var pt=(s,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(s,e,t),t);function It(s,e){return(t,r,i)=>{let o=n=>n.renderRoot?.querySelector(s)??null;if(e){let{get:n,set:a}=typeof r=="object"?t:i??(()=>{let c=Symbol();return{get(){return this[c]},set(d){this[c]=d}}})();return pt(t,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return pt(t,r,{get(){return o(this)}})}}function Hi(s){return(e,t)=>{let{slot:r,selector:i}=s??{},o="slot"+(r?`[name=${r}]`:":not([name])");return pt(e,t,{get(){let n=this.renderRoot?.querySelector(o),a=n?.assignedElements(s)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var B=Symbol("test"),Je=Symbol("testElement");var Vi={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},j=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return h`${this.xmlDoc}`}};l([p({type:String})],j.prototype,"category",2),l([p({type:String})],j.prototype,"identifier",2),l([p({type:Boolean,converter:Vi})],j.prototype,"required",2),l([p({type:Boolean,converter:Vi})],j.prototype,"fixed",2),l([p({type:String})],j.prototype,"href",2),l([T({context:B,subscribe:!0})],j.prototype,"_testContext",2),l([p({type:Object,attribute:!1})],j.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",j);var Vr={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},W=class extends v{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};l([p({type:String})],W.prototype,"identifier",2),l([p({type:String})],W.prototype,"required",2),l([p({type:Boolean,converter:Vr})],W.prototype,"fixed",2),l([p({type:String})],W.prototype,"title",2),l([p({type:Boolean,converter:Vr})],W.prototype,"visible",2),l([p({type:Boolean,converter:Vr,attribute:"keep-together"})],W.prototype,"keepTogether",2),l([T({context:B,subscribe:!0})],W.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",W);var Tt=class extends v{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([p({type:String})],Tt.prototype,"identifier",2),l([p({type:String})],Tt.prototype,"title",2),l([T({context:B,subscribe:!0})],Tt.prototype,"_testContext",2),Tt=l([g("qti-assessment-test")],Tt);var X=class extends v{constructor(){super(...arguments);this.identifier="";this.title="";this.class="";this.NavigationMode="nonlinear";this.submissionMode="individual"}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([p({type:String})],X.prototype,"identifier",2),l([p({type:String})],X.prototype,"title",2),l([p({type:String})],X.prototype,"class",2),l([p({type:String,attribute:"navigation-mode"})],X.prototype,"NavigationMode",2),l([p({type:String,attribute:"submission-mode"})],X.prototype,"submissionMode",2),X=l([g("qti-test-part")],X);customElements.get("qti-test-part")||customElements.define("qti-test-part",X);var ao=String.raw,lo=ao`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
1
+ var yi=Object.defineProperty;var Us=Object.getOwnPropertyDescriptor;var Fs=(s,t,e)=>t in s?yi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var l=(s,t,e,r)=>{for(var i=r>1?void 0:r?Us(t,e):t,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(t,e,i):n(i))||i);return r&&i&&yi(t,e,i),i};var z=(s,t,e)=>Fs(s,typeof t!="symbol"?t+"":t,e);var de=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r??!1}};var Re=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(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,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new de(this.context,this.t,this.subscribe))}};var Vt=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:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Rr=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},Me=class extends Vt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{let o=i.composedPath()[0];i.context===this.context&&o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{let o=i.composedPath()[0];if(i.context!==this.context||o===this.host)return;let n=new Set;for(let[a,{consumerHost:c}]of this.subscriptions)n.has(a)||(n.add(a),c.dispatchEvent(new de(this.context,a,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Rr(this.context))}};function Le({context:s}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new Me(this,{context:s}))}),{get(){return t.get.call(this)},set(i){return r.get(this)?.setValue(i),t.set.call(this,i)},init(i){return r.get(this)?.setValue(i),i}};{t.constructor.addInitializer(n=>{r.set(n,new Me(n,{context:s}))});let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let n=new WeakMap;o={get(){return n.get(this)},set(a){r.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;o={...i,set(a){r.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}function T({context:s,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Re(this,{context:s,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new Re(i,{context:s,callback:o=>{i[r]=o},subscribe:t})})}}var qi=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",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 wi=new WeakMap,et=s=>{let t=wi.get(s);return t===void 0&&wi.set(s,t=new Map),t},Bs=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(et(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){et(this).set(t,String(e))}removeAttribute(t){et(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 et(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 qi(this);return this.__internals=t,t}getAttribute(t){return et(this).get(t)??null}};var js=class extends Bs{},Ei=js;var Ws=class{constructor(){this.__definitions=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]})}get(t){return this.__definitions.get(t)?.ctor}},Xs=Ws;var Ci=new Xs;var tt=globalThis,zt=tt.ShadowRoot&&(tt.ShadyCSS===void 0||tt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Mr=Symbol(),_i=new WeakMap,rt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Mr)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(zt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=_i.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&_i.set(e,t))}return t}toString(){return this.cssText}},ki=s=>new rt(typeof s=="string"?s:s+"",void 0,Mr),b=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((r,i,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.")})(i)+s[o+1],s[0]);return new rt(e,s,Mr)},Lr=(s,t)=>{if(zt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=tt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},Ut=zt||tt.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ki(e)})(s):s;var{is:Ys,defineProperty:Gs,getOwnPropertyDescriptor:Ks,getOwnPropertyNames:Zs,getOwnPropertySymbols:Js,getPrototypeOf:Qs}=Object,U=globalThis;U.customElements??(U.customElements=Ci);var Ti=U.trustedTypes,eo=Ti?Ti.emptyScript:"",to=U.reactiveElementPolyfillSupport,it=(s,t)=>s,st={toAttribute(s,t){switch(t){case Boolean:s=s?eo:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Ft=(s,t)=>!Ys(s,t),Ai={attribute:!0,type:String,converter:st,reflect:!1,hasChanged:Ft};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),U.litPropertyMetadata??(U.litPropertyMetadata=new WeakMap);var se=class extends(globalThis.HTMLElement??Ei){static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ai){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&Gs(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:o}=Ks(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return i?.call(this)},set(n){let a=i?.call(this);o.call(this,n),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ai}static _$Ei(){if(this.hasOwnProperty(it("elementProperties")))return;let t=Qs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(it("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(it("properties"))){let e=this.properties,r=[...Zs(e),...Js(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,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 i of r)e.unshift(Ut(i))}else t!==void 0&&e.push(Ut(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Lr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:st).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:st;this._$Em=i,this[i]=n.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??Ft)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(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(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r)o.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$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){}};se.elementStyles=[],se.shadowRootOptions={mode:"open"},se[it("elementProperties")]=new Map,se[it("finalized")]=new Map,to?.({ReactiveElement:se}),(U.reactiveElementVersions??(U.reactiveElementVersions=[])).push("2.0.4");var $e=globalThis,Bt=$e.trustedTypes,Si=Bt?Bt.createPolicy("lit-html",{createHTML:s=>s}):void 0,Dr="$lit$",oe=`lit$${Math.random().toFixed(9).slice(2)}$`,Ir="?"+oe,ro=`<${Ir}>`,Ce=$e.document===void 0?{createTreeWalker:()=>({})}:document,nt=()=>Ce.createComment(""),at=s=>s===null||typeof s!="object"&&typeof s!="function",Nr=Array.isArray,Ii=s=>Nr(s)||typeof s?.[Symbol.iterator]=="function",$r=`[
3
+ \f\r]`,ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ri=/-->/g,Mi=/>/g,we=RegExp(`>|${$r}(?:([^\\s"'>=/]+)(${$r}*=${$r}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Li=/'/g,$i=/"/g,Ni=/^(?:script|style|textarea|title)$/i,Pr=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),h=Pr(1),Hr=Pr(2),_n=Pr(3),R=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Di=new WeakMap,Ee=Ce.createTreeWalker(Ce,129);function Pi(s,t){if(!Nr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Si!==void 0?Si.createHTML(t):t}var Hi=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=ot;for(let a=0;a<e;a++){let c=s[a],d,u,m=-1,f=0;for(;f<c.length&&(n.lastIndex=f,u=n.exec(c),u!==null);)f=n.lastIndex,n===ot?u[1]==="!--"?n=Ri:u[1]!==void 0?n=Mi:u[2]!==void 0?(Ni.test(u[2])&&(i=RegExp("</"+u[2],"g")),n=we):u[3]!==void 0&&(n=we):n===we?u[0]===">"?(n=i??ot,m=-1):u[1]===void 0?m=-2:(m=n.lastIndex-u[2].length,d=u[1],n=u[3]===void 0?we:u[3]==='"'?$i:Li):n===$i||n===Li?n=we:n===Ri||n===Mi?n=ot:(n=we,i=void 0);let y=n===we&&s[a+1].startsWith("/>")?" ":"";o+=n===ot?c+ro:m>=0?(r.push(d),c.slice(0,m)+Dr+c.slice(m)+oe+y):c+oe+(m===-2?a:y)}return[Pi(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},lt=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[d,u]=Hi(t,e);if(this.el=s.createElement(d,r),Ee.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Ee.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Dr)){let f=u[n++],y=i.getAttribute(m).split(oe),x=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:x[2],strings:y,ctor:x[1]==="."?Wt:x[1]==="?"?Xt:x[1]==="@"?Yt:ke}),i.removeAttribute(m)}else m.startsWith(oe)&&(c.push({type:6,index:o}),i.removeAttribute(m));if(Ni.test(i.tagName)){let m=i.textContent.split(oe),f=m.length-1;if(f>0){i.textContent=Bt?Bt.emptyScript:"";for(let y=0;y<f;y++)i.append(m[y],nt()),Ee.nextNode(),c.push({type:2,index:++o});i.append(m[f],nt())}}}else if(i.nodeType===8)if(i.data===Ir)c.push({type:2,index:o});else{let m=-1;for(;(m=i.data.indexOf(oe,m+1))!==-1;)c.push({type:7,index:o}),m+=oe.length-1}o++}}static createElement(t,e){let r=Ce.createElement("template");return r.innerHTML=t,r}};function _e(s,t,e=s,r){if(t===R)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=at(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=_e(s,i._$AS(s,t.values),i,r)),t}var jt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??Ce).importNode(e,!0);Ee.currentNode=i;let o=Ee.nextNode(),n=0,a=0,c=r[0];for(;c!==void 0;){if(n===c.index){let d;c.type===2?d=new De(o,o.nextSibling,this,t):c.type===1?d=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(d=new Gt(o,this,t)),this._$AV.push(d),c=r[++a]}n!==c?.index&&(o=Ee.nextNode(),n++)}return Ee.currentNode=Ce,i}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++}},De=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=_e(this,t,e),at(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==R&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ii(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==k&&at(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ce.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=lt.createElement(Pi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new jt(i,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Di.get(t.strings);return e===void 0&&Di.set(t.strings,e=new lt(t)),e}k(t){Nr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(nt()),this.O(nt()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ke=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=k}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=_e(this,t,e,0),n=!at(t)||t!==this._$AH&&t!==R,n&&(this._$AH=t);else{let a=t,c,d;for(t=o[0],c=0;c<o.length-1;c++)d=_e(this,a[r+c],e,c),d===R&&(d=this._$AH[c]),n||(n=!at(d)||d!==this._$AH[c]),d===k?t=k:t!==k&&(t+=(d??"")+o[c+1]),this._$AH[c]=d}n&&!i&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Wt=class extends ke{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},Xt=class extends ke{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},Yt=class extends ke{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=_e(this,t,e,0)??k)===R)return;let r=this._$AH,i=t===k&&r!==k||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==k&&(r===k||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Gt=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){_e(this,t)}},M={M:Dr,P:oe,A:Ir,C:1,L:Hi,R:jt,D:Ii,V:_e,I:De,H:ke,N:Xt,U:Yt,B:Wt,F:Gt},io=$e.litHtmlPolyfillSupport;io?.(lt,De),($e.litHtmlVersions??($e.litHtmlVersions=[])).push("3.2.1");var Or=(s,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new De(t.insertBefore(nt(),o),o,void 0,e??{})}return i._$AI(s),i};var v=class extends se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Or(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return R}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var so=globalThis.litElementPolyfillSupport;so?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var g=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};var oo={attribute:!0,type:String,converter:st,reflect:!1,hasChanged:Ft},no=(s=oo,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,s),r==="accessor"){let{name:n}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,s)},init(a){return a!==void 0&&this.P(n,void 0,s),a}}}if(r==="setter"){let{name:n}=e;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,s)}}throw Error("Unsupported decorator location: "+r)};function p(s){return(t,e)=>typeof e=="object"?no(s,t,e):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?{...r,wrapped:!0}:r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,t,e)}function q(s){return p({...s,state:!0,attribute:!1})}var pe=(s,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(s,t,e),e);function Ie(s,t){return(e,r,i)=>{let o=n=>n.renderRoot?.querySelector(s)??null;if(t){let{get:n,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(d){this[c]=d}}})();return pe(e,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return pe(e,r,{get(){return o(this)}})}}function Oi(s){return(t,e)=>{let{slot:r,selector:i}=s??{},o="slot"+(r?`[name=${r}]`:":not([name])");return pe(t,e,{get(){let n=this.renderRoot?.querySelector(o),a=n?.assignedElements(s)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var B=Symbol("test"),Kt=Symbol("testElement");var Vi={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},j=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return h`${this.xmlDoc}`}};l([p({type:String})],j.prototype,"category",2),l([p({type:String})],j.prototype,"identifier",2),l([p({type:Boolean,converter:Vi})],j.prototype,"required",2),l([p({type:Boolean,converter:Vi})],j.prototype,"fixed",2),l([p({type:String})],j.prototype,"href",2),l([T({context:B,subscribe:!0})],j.prototype,"_testContext",2),l([p({type:Object,attribute:!1})],j.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",j);var Vr={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}},W=class extends v{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};l([p({type:String})],W.prototype,"identifier",2),l([p({type:String})],W.prototype,"required",2),l([p({type:Boolean,converter:Vr})],W.prototype,"fixed",2),l([p({type:String})],W.prototype,"title",2),l([p({type:Boolean,converter:Vr})],W.prototype,"visible",2),l([p({type:Boolean,converter:Vr,attribute:"keep-together"})],W.prototype,"keepTogether",2),l([T({context:B,subscribe:!0})],W.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",W);var Te=class extends v{async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([p({type:String})],Te.prototype,"identifier",2),l([p({type:String})],Te.prototype,"title",2),l([T({context:B,subscribe:!0})],Te.prototype,"_testContext",2),Te=l([g("qti-assessment-test")],Te);var X=class extends v{constructor(){super(...arguments);this.identifier="";this.title="";this.class="";this.NavigationMode="nonlinear";this.submissionMode="individual"}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([p({type:String})],X.prototype,"identifier",2),l([p({type:String})],X.prototype,"title",2),l([p({type:String})],X.prototype,"class",2),l([p({type:String,attribute:"navigation-mode"})],X.prototype,"NavigationMode",2),l([p({type:String,attribute:"submission-mode"})],X.prototype,"submissionMode",2),X=l([g("qti-test-part")],X);customElements.get("qti-test-part")||customElements.define("qti-test-part",X);var ao=String.raw,lo=ao`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
5
  <xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
6
6
  <xsl:template match="@*|node()">
7
7
  <xsl:copy>
@@ -23,14 +23,14 @@ Make sure to test your application with a production build as repeat registratio
23
23
  <xsl:apply-templates/>
24
24
  </xsl:element>
25
25
  </xsl:template>
26
- </xsl:stylesheet>`;function zi(s,e,t){s.querySelectorAll(e).forEach(r=>{let i=`${e}-${t}`,o=Fi(r,i);r.replaceWith(o)})}function Ui(s,e){s.querySelectorAll("*").forEach(t=>{let r=t.classList;r&&r.forEach(i=>{if(i.startsWith(`${e}:`)){let o=i.slice(`${e}:`.length),n=`${t.nodeName}-${o}`,a=Fi(t,n);t.replaceWith(a)}})})}function Fi(s,e){let t=document.createElement(e);for(let r of s.attributes)t.setAttribute(r.name,r.value);for(;s.firstChild;)t.appendChild(s.firstChild);return t}function Bi(s){let e=[];return s.querySelectorAll("qti-assessment-item-ref").forEach(t=>{let r=t.getAttribute("identifier"),i=t.getAttribute("href"),o=t.getAttribute("category");e.push({identifier:r,href:i,category:o})}),e}var zr=null;function Nt(s,e=!1){return e&&zr!==null&&zr.abort(),new Promise((t,r)=>{let i=new XMLHttpRequest;zr=i,i.open("GET",s,!0),i.responseType="document",i.onload=()=>{i.status>=200&&i.status<300?t(i.responseXML):r(i.statusText)},i.onerror=()=>{r(i.statusText)},i.send()})}function Pt(s){return new DOMParser().parseFromString(s,"text/xml")}function Ot(s){let e=new XSLTProcessor,t=new DOMParser().parseFromString(lo,"text/xml");return e.importStylesheet(t),e.transformToFragment(s,document)}function ji(s,e){e.endsWith("/")||(e+="/"),s.querySelectorAll("[src],[href],[primary-path]").forEach(t=>{let r="";t.getAttribute("src")&&(r="src"),t.getAttribute("href")&&(r="href"),t.getAttribute("primary-path")&&(r="primary-path");let i=t.getAttribute(r)?.trim();if(!i.startsWith("data:")&&!i.startsWith("http")){let o=e+encodeURI(i);t.setAttribute(r,o)}})}function Wi(s){s.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(t=>{let r=document.createComment(t.textContent);t.replaceChild(r,t.firstChild)})}function Xi(s){s.querySelectorAll("qti-stylesheet").forEach(e=>e.remove())}var Ht=()=>{let s,e={async load(t,r=!1){return new Promise(i=>{Nt(t,r).then(o=>(s=o,e.path(t.substring(0,t.lastIndexOf("/"))),i(e)))})},parse(t){return s=Pt(t),e},path:t=>(ji(s,t),e),fn(t){return t(s),e},pciHooks(t){let r=["hook","module"],i=t.substring(0,t.lastIndexOf("/"));for(let o of r)s.querySelectorAll("["+o+"]").forEach(a=>{let c=a.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",t),a.setAttribute("module",i+"/"+encodeURI(c+(c.endsWith(".js")?"":".js"))))});return e},extendElementName:(t,r)=>(zi(s,t,r),e),extendElementsWithClass:(t="extend")=>(Ui(s,t),e),customInteraction(t,r){let i=s.querySelector("qti-custom-interaction"),o=i.querySelector("object");return i.setAttribute("data-base-ref",t),i.setAttribute("data-base-item",t+r),i.setAttribute("data",o.getAttribute("data")),i.setAttribute("width",o.getAttribute("width")),i.setAttribute("height",o.getAttribute("height")),i.removeChild(o),e},convertCDATAtoComment(){return Wi(s),e},stripStyleSheets(){return Xi(s),e},html(){return new XMLSerializer().serializeToString(Ot(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Ot(s)},xmlDoc(){return s}};return e};var Yi=()=>{let s,e={async load(t){return new Promise(r=>{Nt(t).then(i=>(s=i,r(e)))})},parse(t){s=Pt(t)},assessmentTest(){let t=s.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:t.getAttribute("href"),identifier:t.getAttribute("identifier")}}};return e};var he=()=>{let s,e={async load(t){return new Promise((r,i)=>{Nt(t).then(o=>(s=o,r(e)))})},parse(t){return s=Pt(t),e},fn(t){return t(s),e},items(){return Bi(s)},html(){return new XMLSerializer().serializeToString(Ot(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Ot(s)},xmlDoc(){return s}};return e};var Gi=s=>{class e extends s{constructor(...i){super(...i);this.testURL="";this.addEventListener("qti-load-test-request",o=>{let{testURL:n}=o.detail;n?this.testURL=n:console.warn("No test found, there should be an aattribute test-url with the path to the test on the test-container"),o.detail.promise=(async()=>(o.preventDefault(),(await he().load(`${this.testURL}`)).htmlDoc()))()}),this.addEventListener("qti-assessment-test-connected",()=>{}),this.addEventListener("qti-load-item-request",({detail:o})=>{this.testURL&&(o.promise=(async()=>(await Ht().load(`${this.testURL.slice(0,this.testURL.lastIndexOf("/"))}/${o.href}`,o.cancelPreviousRequest)).htmlDoc())())}),this.addEventListener("qti-interaction-changed",o=>{}),this.addEventListener("qti-outcome-changed",()=>{})}}return e};var Ki=s=>{class e extends s{constructor(...r){super(...r),this.addEventListener("qti-request-test-item",({detail:i})=>{if(!i)return;this._clearLoadedItems();let o=this.testElement.el.querySelector(`qti-assessment-item-ref[identifier="${i}"]`),n=this._loadItemRequest(o.href,!0),a=o.closest("qti-test-part").identifier,c=o.closest("qti-assessment-section").identifier;this._testContext={...this._testContext,navPartId:a,navSectionId:c,navItemId:i,navItemLoading:!0},n?n.then(d=>{o.xmlDoc=d,requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0}))),this._testContext={...this._testContext,navItemLoading:!1}}).catch(d=>console.error("Failed to load item:",d)):console.info("Load item request was not handled:",o.href)}),this.addEventListener("qti-assessment-test-connected",()=>{let i=this._testContext.navItemId;i||(i=this.testElement.el.querySelector("qti-assessment-item-ref").identifier),this.dispatchEvent(new CustomEvent("qti-request-test-item",{detail:i,bubbles:!0,composed:!0}))})}_clearLoadedItems(){let r=this.testElement.el.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(r).forEach(i=>{i.xmlDoc=null})}_loadItemRequest(r,i=!0){let o=new CustomEvent("qti-load-item-request",{bubbles:!0,composed:!0,detail:{href:r,promise:null,cancelPreviousRequest:i}});return this.dispatchEvent(o),o.detail.promise}}return e};var Zi=s=>{class e extends s{constructor(...r){super(...r),this._testContext={...this._testContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this._testContext={...this._testContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("_testContext")&&this._updateElementView()}_updateElementView(){if(this.testElement&&this.testElement.el){Array.from(this.testElement.el.querySelectorAll("[view]")).forEach(o=>{o.classList.toggle("show",o.getAttribute("view")===this._testContext.view)});let i=this.testElement.el.querySelector(`qti-assessment-item[identifier="${this._testContext.navItemId}"]`);i&&i.showCorrectResponse(this._testContext.view==="scorer")}}_setCorrectResponseVisibility(r){r.showCorrectResponse(this._testContext.view==="scorer")}}return e};var Vt=class extends v{constructor(){super();this._testContext={items:[],testOutcomeVariables:[]};this.testElement={el:null};this._updateItemInTestContext=t=>{let{identifier:r,variables:i}=t,o=this._testContext.items.find(n=>n?.identifier===r);if(!o){console.warn(`Item IDs between assessment.xml and item.xml should match: ${r} is not found!`);return}o.variables?.length===1?this._updateItemVariablesInTestContext(r,i):t.variables=[...o.variables||[]]};this.addEventListener("qti-assessment-test-connected",t=>{let r=t.detail,i=Array.from(r.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testElement={el:r},this._testContext={...this._testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",t=>{this._updateItemInTestContext(t.detail)}),this.addEventListener("qti-outcome-changed",t=>{let r=t.composedPath()[0];this._updateItemVariablesInTestContext(r.identifier,r.variables)})}get context(){return this._testContext}set context(t){t!=null&&(this._testContext={...t},t.items?.forEach(r=>{let i=this._testContext.items.find(o=>o.identifier===r.identifier);i?i.variables=r.variables:this._testContext.items.push(r)}))}_updateItemVariablesInTestContext(t,r){this._testContext={...this._testContext,items:this._testContext.items.map(i=>i.identifier!==t?i:{...i,variables:r.map(o=>{let n=i.variables.find(a=>a.identifier===o.identifier);return n?{...n,...o}:o})})}}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-test","")}};l([w(),Lt({context:B})],Vt.prototype,"_testContext",2),l([w(),Lt({context:Je})],Vt.prototype,"testElement",2);var Qe=class extends Gi(Ki(Zi(Vt))){connectedCallback(){super.connectedCallback();let e=this.querySelector(":scope > template");e&&this.shadowRoot?.appendChild(e.content)}render(){return h`<slot></slot>`}};Qe=l([g("qti-test")],Qe);var Ji=b`
26
+ </xsl:stylesheet>`;function zi(s,t,e){s.querySelectorAll(t).forEach(r=>{let i=`${t}-${e}`,o=Fi(r,i);r.replaceWith(o)})}function Ui(s,t){s.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let o=i.slice(`${t}:`.length),n=`${e.nodeName}-${o}`,a=Fi(e,n);e.replaceWith(a)}})})}function Fi(s,t){let e=document.createElement(t);for(let r of s.attributes)e.setAttribute(r.name,r.value);for(;s.firstChild;)e.appendChild(s.firstChild);return e}function Bi(s){let t=[];return s.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var zr=null;function ct(s,t=!1){return t&&zr!==null&&zr.abort(),new Promise((e,r)=>{let i=new XMLHttpRequest;zr=i,i.open("GET",s,!0),i.responseType="document",i.onload=()=>{i.status>=200&&i.status<300?e(i.responseXML):r(i.statusText)},i.onerror=()=>{r(i.statusText)},i.send()})}function dt(s){return new DOMParser().parseFromString(s,"text/xml")}function Ne(s){let t=new XSLTProcessor,e=new DOMParser().parseFromString(lo,"text/xml");return t.importStylesheet(e),t.transformToFragment(s,document)}function ji(s,t){t.endsWith("/")||(t+="/"),s.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href"),e.getAttribute("primary-path")&&(r="primary-path");let i=e.getAttribute(r)?.trim();if(!i.startsWith("data:")&&!i.startsWith("http")){let o=t+encodeURI(i);e.setAttribute(r,o)}})}function Wi(s){s.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function Xi(s){s.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Zt=()=>{let s,t={async load(e,r=!1){return new Promise(i=>{ct(e,r).then(o=>(s=o,t.path(e.substring(0,e.lastIndexOf("/"))),i(t)))})},parse(e){return s=dt(e),t},path:e=>(ji(s,e),t),fn(e){return e(s),t},pciHooks(e){let r=["hook","module"],i=e.substring(0,e.lastIndexOf("/"));for(let o of r)s.querySelectorAll("["+o+"]").forEach(a=>{let c=a.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",i+"/"+encodeURI(c+(c.endsWith(".js")?"":".js"))))});return t},extendElementName:(e,r)=>(zi(s,e,r),t),extendElementsWithClass:(e="extend")=>(Ui(s,e),t),customInteraction(e,r){let i=s.querySelector("qti-custom-interaction"),o=i.querySelector("object");return i.setAttribute("data-base-ref",e),i.setAttribute("data-base-item",e+r),i.setAttribute("data",o.getAttribute("data")),i.setAttribute("width",o.getAttribute("width")),i.setAttribute("height",o.getAttribute("height")),i.removeChild(o),t},convertCDATAtoComment(){return Wi(s),t},stripStyleSheets(){return Xi(s),t},html(){return new XMLSerializer().serializeToString(Ne(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Ne(s)},xmlDoc(){return s}};return t};var Yi=()=>{let s,t={async load(e){return new Promise((r,i)=>{ct(e).then(o=>(s=o,r(t)))})},parse(e){return s=dt(e),t},fn(e){return e(s),t},items(){return Bi(s)},html(){return new XMLSerializer().serializeToString(Ne(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Ne(s)},xmlDoc(){return s}};return t};var Gi=s=>{class t extends s{constructor(...i){super(...i);this.testURL="";this.addEventListener("qti-load-test-request",o=>{let{testURL:n}=o.detail;n?this.testURL=n:console.warn("No test found, there should be an attribute test-url with the path to the test on the test-container"),o.detail.promise=(async()=>(o.preventDefault(),(await Yi().load(`${this.testURL}`)).htmlDoc()))()}),this.addEventListener("qti-assessment-test-connected",()=>{}),this.addEventListener("qti-load-item-request",({detail:o})=>{this.testURL&&(o.promise=(async()=>(await Zt().load(`${this.testURL.slice(0,this.testURL.lastIndexOf("/"))}/${o.href}`,o.cancelPreviousRequest)).htmlDoc())())}),this.addEventListener("qti-interaction-changed",o=>{}),this.addEventListener("qti-outcome-changed",()=>{})}}return t};var Ki=s=>{class t extends s{constructor(...r){super(...r),this.addEventListener("qti-request-test-item",({detail:i})=>{if(!i)return;this._clearLoadedItems();let o=this.testElement.el.querySelector(`qti-assessment-item-ref[identifier="${i}"]`),n=this._loadItemRequest(o.href,!1),a=o.closest("qti-test-part").identifier,c=o.closest("qti-assessment-section").identifier;this._testContext={...this._testContext,navPartId:a,navSectionId:c,navItemId:i,navItemLoading:!0},n?n.then(d=>{o.xmlDoc=d,requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0}))),this._testContext={...this._testContext,navItemLoading:!1}}).catch(d=>console.error("Failed to load item:",d)):console.info("Load item request was not handled:",o.href)}),this.addEventListener("qti-assessment-test-connected",()=>{let i=this._testContext.navItemId;i||(i=this.testElement.el.querySelector("qti-assessment-item-ref").identifier),this.dispatchEvent(new CustomEvent("qti-request-test-item",{detail:i,bubbles:!0,composed:!0}))})}_clearLoadedItems(){let r=this.testElement.el.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(r).forEach(i=>{i.xmlDoc=null})}_loadItemRequest(r,i=!0){let o=new CustomEvent("qti-load-item-request",{bubbles:!0,composed:!0,detail:{href:r,promise:null,cancelPreviousRequest:i}});return this.dispatchEvent(o),o.detail.promise}}return t};var Zi=s=>{class t extends s{constructor(...r){super(...r),this._testContext={...this._testContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this._testContext={...this._testContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("_testContext")&&this._updateElementView()}_updateElementView(){if(this.testElement&&this.testElement.el){Array.from(this.testElement.el.querySelectorAll("[view]")).forEach(o=>{o.classList.toggle("show",o.getAttribute("view")===this._testContext.view)});let i=this.testElement.el.querySelector(`qti-assessment-item[identifier="${this._testContext.navItemId}"]`);i&&i.showCorrectResponse(this._testContext.view==="scorer")}}_setCorrectResponseVisibility(r){r.showCorrectResponse(this._testContext.view==="scorer")}}return t};var Pe=class extends v{constructor(){super();this._testContext={items:[],testOutcomeVariables:[]};this.testElement={el:null};this._updateItemInTestContext=e=>{let{identifier:r,variables:i}=e,o=this._testContext.items.find(n=>n?.identifier===r);if(!o){console.warn(`Item IDs between assessment.xml and item.xml should match: ${r} is not found!`);return}o.variables?.length===1?this._updateItemVariablesInTestContext(r,i):e.variables=[...o.variables||[]]};this.addEventListener("qti-assessment-test-connected",e=>{let r=e.detail,i=Array.from(r.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testElement={el:r},this._testContext={...this._testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",e=>{this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-outcome-changed",e=>{let r=e.composedPath()[0];this._updateItemVariablesInTestContext(r.identifier,r.variables)})}get context(){return this._testContext}set context(e){e!=null&&(this._testContext={...e},e.items?.forEach(r=>{let i=this._testContext.items.find(o=>o.identifier===r.identifier);i?i.variables=r.variables:this._testContext.items.push(r)}))}_updateItemVariablesInTestContext(e,r){this._testContext={...this._testContext,items:this._testContext.items.map(i=>i.identifier!==e?i:{...i,variables:r.map(o=>{let n=i.variables.find(a=>a.identifier===o.identifier);return n?{...n,...o}:o})})}}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-test","")}};l([q(),Le({context:B})],Pe.prototype,"_testContext",2),l([q(),Le({context:Kt})],Pe.prototype,"testElement",2);var Jt=class extends Gi(Ki(Zi(Pe))){connectedCallback(){super.connectedCallback();let t=this.querySelector(":scope > template");t&&this.shadowRoot?.appendChild(t.content)}render(){return h`<slot></slot>`}};Jt=l([g("qti-test")],Jt);var Ji=b`
27
27
  display: inline-flex;
28
28
  align-items: center;
29
29
  cursor: pointer;
30
30
  padding: 0.5rem 1rem;
31
31
  border-radius: 0.25rem;
32
32
  user-select: none;
33
- `,tr=b`
33
+ `,Qt=b`
34
34
  background-color: lightgray;
35
35
  ${Ji};
36
36
  `,er=b`
@@ -39,31 +39,31 @@ Make sure to test your application with a production build as repeat registratio
39
39
  `,_l=b`
40
40
  ${Ji};
41
41
  border: 1px solid gray;
42
- `;function ts(s,e){let t,r={...e};return(i,o)=>{let{connectedCallback:n,disconnectedCallback:a}=i;i.connectedCallback=function(){n.call(this);let c=u=>{let m=Array.from(this.querySelectorAll(s));for(let f of u){let y=Array.from(f.addedNodes).map(q=>q),x=Array.from(f.addedNodes).map(q=>q);f.type==="childList"&&y.find(q=>m.includes(q))&&this[o](y,x)}};t=new MutationObserver(c),t.observe(this,{childList:!0,subtree:!0});let d=this.querySelectorAll(s)??[];this[o](Array.from(d),[])},i.disconnectedCallback=function(){a.call(this),t.disconnect()}}}function S(s,e){let t={waitUntilFirstUpdate:!1,...e};return(r,i)=>{let{update:o}=r,n=Array.isArray(s)?s:[s];r.update=function(a){n.forEach(c=>{let d=c;if(a.has(d)){let u=a.get(d),m=this[d];u!==m&&(!t.waitUntilFirstUpdate||this.hasUpdated)&&this[i](u,m)}}),o.call(this,a)}}}function es(s){return(e,t)=>{p(s)(e,t);let r=`__${t}`;Object.defineProperty(e,t,{get(){return this[r]},set(i){let o=this[r];if(this[r]=i,o!==i){if(this._internals?.states){let n=t.toLowerCase();i?this._internals.states.add(`--${n}`):this._internals.states.delete(`--${n}`)}if(s.aria&&this._internals){let n=s.aria;i?this._internals[n]="true":this._internals[n]=null}this.requestUpdate(t,o)}},configurable:!0,enumerable:!0})}}var L=class extends v{constructor(){super();this.disabled=!0;this._internals=this.attachInternals()}_handleTestElementChange(t,r){r.el&&(this.disabled=!1)}willUpdate(t){if(t.has("_testContext")){let{items:r=[],navItemId:i}=this._testContext??{};this.itemIndex=r.findIndex(o=>o.identifier===i),this.items=r,this.view=this._testContext?.view}}_switchView(t){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:t}))}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-test-item",{composed:!0,bubbles:!0,detail:t}))}};l([es({type:Boolean,reflect:!0,aria:"ariaDisabled"})],L.prototype,"disabled",2),l([w(),T({context:B,subscribe:!0})],L.prototype,"_testContext",2),l([w(),T({context:Je,subscribe:!0})],L.prototype,"_testElement",2),l([S("_testElement")],L.prototype,"_handleTestElementChange",1);var ue=class extends L{constructor(){super(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this.disabled||this._requestItem(this.items[this.itemIndex+1].identifier)})}willUpdate(e){super.willUpdate(e),e.has("_testContext")&&(this.disabled=!this._testElement?.el||this.itemIndex<0||this.itemIndex>=this.items.length-1)}render(){return h`<slot></slot>`}};ue.styles=b`
42
+ `;function tr(s,t){let e;return(r,i)=>{let{connectedCallback:o,disconnectedCallback:n}=r;r.connectedCallback=function(){o.call(this);let a=d=>{let u=Array.from(this.querySelectorAll(s)).concat(Array.from(this.shadowRoot?.querySelectorAll(s)||[]));for(let m of d){let f=Array.from(m.addedNodes).map(x=>x),y=Array.from(m.addedNodes).map(x=>x);m.type==="childList"&&f.find(x=>u.includes(x))&&this[i](f,y)}};e=new MutationObserver(a),e.observe(this,{childList:!0,subtree:!0});let c=Array.from(this.querySelectorAll(s)).concat(Array.from(this.shadowRoot?.querySelectorAll(s)||[]));this[i](Array.from(c),[])},r.disconnectedCallback=function(){n.call(this),e.disconnect()}}}function A(s,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:o}=r,n=Array.isArray(s)?s:[s];r.update=function(a){n.forEach(c=>{let d=c;if(a.has(d)){let u=a.get(d),m=this[d];u!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](u,m)}}),o.call(this,a)}}}function es(s){return(t,e)=>{p(s)(t,e);let r=`__${e}`;Object.defineProperty(t,e,{get(){return this[r]},set(i){let o=this[r];if(this[r]=i,o!==i){if(this._internals?.states){let n=e.toLowerCase();i?this._internals.states.add(`--${n}`):this._internals.states.delete(`--${n}`)}if(s.aria&&this._internals){let n=s.aria;i?this._internals[n]="true":this._internals[n]=null}this.requestUpdate(e,o)}},configurable:!0,enumerable:!0})}}var L=class extends v{constructor(){super();this.disabled=!0;this._internals=this.attachInternals()}_handleTestElementChange(e,r){r.el&&(this.disabled=!1)}willUpdate(e){if(e.has("_testContext")){let{items:r=[],navItemId:i}=this._testContext??{};this.itemIndex=r.findIndex(o=>o.identifier===i),this.items=r,this.view=this._testContext?.view}}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-test-item",{composed:!0,bubbles:!0,detail:e}))}};l([es({type:Boolean,reflect:!0,aria:"ariaDisabled"})],L.prototype,"disabled",2),l([q(),T({context:B,subscribe:!0})],L.prototype,"_testContext",2),l([q(),T({context:Kt,subscribe:!0})],L.prototype,"_testElement",2),l([A("_testElement")],L.prototype,"_handleTestElementChange",1);var pt=class extends L{constructor(){super(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this.disabled||this._requestItem(this.items[this.itemIndex+1].identifier)})}willUpdate(t){super.willUpdate(t),t.has("_testContext")&&(this.disabled=!this._testElement?.el||this.itemIndex<0||this.itemIndex>=this.items.length-1)}render(){return h`<slot></slot>`}};pt.styles=b`
43
43
  :host {
44
- ${tr};
44
+ ${Qt};
45
45
  }
46
46
  :host([disabled]) {
47
47
  ${er};
48
48
  }
49
- `,ue=l([g("test-next")],ue);var me=class extends L{constructor(){super(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this.disabled||this._requestItem(this.items[this.itemIndex-1].identifier)})}willUpdate(e){super.willUpdate(e),e.has("_testContext")&&(this.disabled=!this._testElement?.el||this.itemIndex===0||this.itemIndex===-1)}render(){return h`<slot></slot>`}};me.styles=b`
49
+ `,pt=l([g("test-next")],pt);var ht=class extends L{constructor(){super(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this.disabled||this._requestItem(this.items[this.itemIndex-1].identifier)})}willUpdate(t){super.willUpdate(t),t.has("_testContext")&&(this.disabled=!this._testElement?.el||this.itemIndex===0||this.itemIndex===-1)}render(){return h`<slot></slot>`}};ht.styles=b`
50
50
  :host {
51
- ${tr};
51
+ ${Qt};
52
52
  }
53
53
  :host([disabled]) {
54
54
  ${er};
55
55
  }
56
- `,me=l([g("test-prev")],me);var Y=class extends L{constructor(){super(...arguments);this.label="view";this.viewOptions="";this._handleViewOptionsChange=(t,r)=>{console.log(r)};this._viewOptions=Y.DEFAULT_VIEW_OPTIONS}render(){return h`
56
+ `,ht=l([g("test-prev")],ht);var Y=class extends L{constructor(){super(...arguments);this.label="view";this.viewOptions="";this._handleViewOptionsChange=(e,r)=>{console.log(r)};this._viewOptions=Y.DEFAULT_VIEW_OPTIONS}render(){return h`
57
57
  <label part="label" for="viewSelect">${this.label}</label>
58
58
  <select
59
59
  part="select"
60
60
  id="viewSelect"
61
61
  .disabled=${this.disabled}
62
- @change=${t=>{let r=t.target;this._switchView(r.value)}}
62
+ @change=${e=>{let r=e.target;this._switchView(r.value)}}
63
63
  >
64
- ${this._viewOptions.map(t=>h`<option value="${t}" ?selected=${t===this.view}>${t}</option>`)}
64
+ ${this._viewOptions.map(e=>h`<option value="${e}" ?selected=${e===this.view}>${e}</option>`)}
65
65
  </select>
66
- `}};Y.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],l([p({type:String})],Y.prototype,"label",2),l([p({type:String,attribute:"view-options"})],Y.prototype,"viewOptions",2),l([S("viewOptions")],Y.prototype,"_handleViewOptionsChange",2),Y=l([g("test-view")],Y);var ge=class extends L{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}render(){return h` <slot></slot> `}};l([p({type:String,attribute:"item-id"})],ge.prototype,"itemId",2),ge=l([g("test-item-link")],ge);var{I:co}=M,is=s=>s===null||typeof s!="object"&&typeof s!="function";var ss=s=>s.strings===void 0,rs=()=>document.createComment(""),zt=(s,e,t)=>{let r=s._$AA.parentNode,i=e===void 0?s._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(rs(),i),n=r.insertBefore(rs(),i);t=new co(o,n,s,s.options)}else{let o=t._$AB.nextSibling,n=t._$AM,a=n!==s;if(a){let c;t._$AQ?.(s),t._$AM=s,t._$AP!==void 0&&(c=s._$AU)!==n._$AU&&t._$AP(c)}if(o!==i||a){let c=t._$AA;for(;c!==o;){let d=c.nextSibling;r.insertBefore(c,i),c=d}}}return t},ht=(s,e,t=s)=>(s._$AI(e,t),s),po={},os=(s,e=po)=>s._$AH=e,ns=s=>s._$AH,rr=s=>{s._$AP?.(!1,!0);let e=s._$AA,t=s._$AB.nextSibling;for(;e!==t;){let r=e.nextSibling;e.remove(),e=r}};var ut={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},F=s=>(...e)=>({_$litDirective$:s,values:e}),G=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var fe=(s,e)=>{let t=s._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),fe(r,e);return!0},ir=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while(t?.size===0)},as=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),mo(e)}};function ho(s){this._$AN!==void 0?(ir(this),this._$AM=s,as(this)):this._$AM=s}function uo(s,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let o=t;o<r.length;o++)fe(r[o],!1),ir(r[o]);else r!=null&&(fe(r,!1),ir(r));else fe(this,s)}var mo=s=>{s.type==ut.CHILD&&(s._$AP??(s._$AP=uo),s._$AQ??(s._$AQ=ho))},Ut=class extends G{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),as(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(fe(this,e),ir(this))}setValue(e){if(ss(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var sr=class{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}},or=class{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??(this.Z=new Promise(e=>this.q=e))}resume(){this.q?.(),this.Z=this.q=void 0}};var ls=s=>!is(s)&&typeof s.then=="function",cs=1073741823,Ur=class extends Ut{constructor(){super(...arguments),this._$Cwt=cs,this._$Cbt=[],this._$CK=new sr(this),this._$CX=new or}render(...e){return e.find(t=>!ls(t))??R}update(e,t){let r=this._$Cbt,i=r.length;this._$Cbt=t;let o=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let c=t[a];if(!ls(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=cs,i=0,Promise.resolve(c).then(async d=>{for(;n.get();)await n.get();let u=o.deref();if(u!==void 0){let m=u._$Cbt.indexOf(c);m>-1&&m<u._$Cwt&&(u._$Cwt=m,u.setValue(d))}}))}return R}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},ds=F(Ur);var ps=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
66
+ `}};Y.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],l([p({type:String})],Y.prototype,"label",2),l([p({type:String,attribute:"view-options"})],Y.prototype,"viewOptions",2),l([A("viewOptions")],Y.prototype,"_handleViewOptionsChange",2),Y=l([g("test-view")],Y);var ut=class extends L{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}render(){return h` <slot></slot> `}};l([p({type:String,attribute:"item-id"})],ut.prototype,"itemId",2),ut=l([g("test-item-link")],ut);var{I:co}=M,rs=s=>s===null||typeof s!="object"&&typeof s!="function";var is=s=>s.strings===void 0,ts=()=>document.createComment(""),He=(s,t,e)=>{let r=s._$AA.parentNode,i=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(ts(),i),n=r.insertBefore(ts(),i);e=new co(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,a=n!==s;if(a){let c;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(c=s._$AU)!==n._$AU&&e._$AP(c)}if(o!==i||a){let c=e._$AA;for(;c!==o;){let d=c.nextSibling;r.insertBefore(c,i),c=d}}}return e},he=(s,t,e=s)=>(s._$AI(t,e),s),po={},ss=(s,t=po)=>s._$AH=t,os=s=>s._$AH,rr=s=>{s._$AP?.(!1,!0);let t=s._$AA,e=s._$AB.nextSibling;for(;t!==e;){let r=t.nextSibling;t.remove(),t=r}};var ue={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},F=s=>(...t)=>({_$litDirective$:s,values:t}),G=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 mt=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),mt(r,t);return!0},ir=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},ns=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),mo(t)}};function ho(s){this._$AN!==void 0?(ir(this),this._$AM=s,ns(this)):this._$AM=s}function uo(s,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)mt(r[o],!1),ir(r[o]);else r!=null&&(mt(r,!1),ir(r));else mt(this,s)}var mo=s=>{s.type==ue.CHILD&&(s._$AP??(s._$AP=uo),s._$AQ??(s._$AQ=ho))},Oe=class extends G{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ns(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(mt(this,t),ir(this))}setValue(t){if(is(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 sr=class{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}},or=class{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??(this.Z=new Promise(t=>this.q=t))}resume(){this.q?.(),this.Z=this.q=void 0}};var as=s=>!rs(s)&&typeof s.then=="function",ls=1073741823,Ur=class extends Oe{constructor(){super(...arguments),this._$Cwt=ls,this._$Cbt=[],this._$CK=new sr(this),this._$CX=new or}render(...t){return t.find(e=>!as(e))??R}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let o=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!as(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=ls,i=0,Promise.resolve(c).then(async d=>{for(;n.get();)await n.get();let u=o.deref();if(u!==void 0){let m=u._$Cbt.indexOf(c);m>-1&&m<u._$Cwt&&(u._$Cwt=m,u.setValue(d))}}))}return R}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},cs=F(Ur);var ds=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
67
67
 
68
68
  :root,
69
69
  :host {
@@ -2158,37 +2158,44 @@ qti-response-declaration {
2158
2158
  }
2159
2159
  }
2160
2160
 
2161
- qti-graphic-gap-match-interaction:state(--dragzone-active)::part(drags) {
2162
- border-color: var(--qti-border-active);
2163
- background-color: var(--qti-bg-active);
2161
+ .hover-border {
2162
+ border: 2px solid #000; /* Adjust the border style and color as needed */
2164
2163
  }
2165
2164
 
2166
- qti-graphic-gap-match-interaction:state(--dragzone-enabled)::part(drags) {
2167
- background-color: var(--qti-bg-active);
2168
- }
2165
+ qti-graphic-gap-match-interaction {
2166
+ position: relative;
2169
2167
 
2170
- /* Active state */
2171
- qti-graphic-gap-match-interaction.qti-selections-light:state(--dragzone-active)::part(drags) {
2172
- background-color: var(--qti-light-bg-active);
2173
- border-color: var(--qti-light-border-active);
2174
- }
2168
+ &.qti-selections-light {
2169
+ &:state(--dragzone-active)::part(drags) {
2170
+ background-color: var(--qti-light-bg-active);
2171
+ border-color: var(--qti-light-border-active);
2172
+ }
2175
2173
 
2176
- qti-graphic-gap-match-interaction.qti-selections-dark:state(--dragzone-active)::part(drags) {
2177
- background-color: var(--qti-dark-bg-active);
2178
- border-color: var(--qti-dark-border-active);
2179
- }
2174
+ &:state(--dragzone-enabled)::part(drags) {
2175
+ background-color: var(--qti-light-bg-active);
2176
+ }
2177
+ }
2180
2178
 
2181
- /* Enabled state */
2182
- qti-graphic-gap-match-interaction.qti-selections-light:state(--dragzone-enabled)::part(drags) {
2183
- background-color: var(--qti-light-bg-active);
2184
- }
2179
+ &.qti-selections-dark {
2180
+ &:state(--dragzone-active)::part(drags) {
2181
+ background-color: var(--qti-dark-bg-active);
2182
+ border-color: var(--qti-dark-border-active);
2183
+ }
2185
2184
 
2186
- qti-graphic-gap-match-interaction.qti-selections-dark:state(--dragzone-enabled)::part(drags) {
2187
- background-color: var(--qti-dark-bg-active);
2188
- }
2185
+ &:state(--dragzone-enabled)::part(drags) {
2186
+ background-color: var(--qti-dark-bg-active);
2187
+ }
2188
+ }
2189
2189
 
2190
- qti-graphic-gap-match-interaction {
2191
- position: relative;
2190
+ /* General styles for active and enabled states */
2191
+ &:state(--dragzone-active)::part(drags) {
2192
+ border-color: var(--qti-border-active);
2193
+ background-color: var(--qti-bg-active);
2194
+ }
2195
+
2196
+ &:state(--dragzone-enabled)::part(drags) {
2197
+ background-color: var(--qti-bg-active);
2198
+ }
2192
2199
 
2193
2200
  & qti-gap-img,
2194
2201
  qti-gap-text {
@@ -2319,16 +2326,39 @@ qti-response-declaration {
2319
2326
  }
2320
2327
  }
2321
2328
 
2322
- qti-gap-match-interaction:state(--dragzone-active)::part(drags) {
2323
- border-color: var(--qti-border-active);
2324
- background-color: var(--qti-bg-active);
2325
- }
2329
+ qti-gap-match-interaction {
2330
+ &.qti-selections-light {
2331
+ &:state(--dragzone-active)::part(drags) {
2332
+ background-color: var(--qti-light-bg-active);
2333
+ border-color: var(--qti-light-border-active);
2334
+ }
2326
2335
 
2327
- qti-gap-match-interaction:state(--dragzone-enabled)::part(drags) {
2328
- background-color: var(--qti-bg-active);
2329
- }
2336
+ &:state(--dragzone-enabled)::part(drags) {
2337
+ background-color: var(--qti-light-bg-active);
2338
+ }
2339
+ }
2340
+
2341
+ &.qti-selections-dark {
2342
+ &:state(--dragzone-active)::part(drags) {
2343
+ background-color: var(--qti-dark-bg-active);
2344
+ border-color: var(--qti-dark-border-active);
2345
+ }
2346
+
2347
+ &:state(--dragzone-enabled)::part(drags) {
2348
+ background-color: var(--qti-dark-bg-active);
2349
+ }
2350
+ }
2351
+
2352
+ /* General styles for active and enabled states */
2353
+ &:state(--dragzone-active)::part(drags) {
2354
+ border-color: var(--qti-border-active);
2355
+ background-color: var(--qti-bg-active);
2356
+ }
2357
+
2358
+ &:state(--dragzone-enabled)::part(drags) {
2359
+ background-color: var(--qti-bg-active);
2360
+ }
2330
2361
 
2331
- qti-gap-match-interaction {
2332
2362
  & qti-gap-text {
2333
2363
 
2334
2364
  &[dragging] {
@@ -2984,6 +3014,15 @@ qti-response-declaration {
2984
3014
  }
2985
3015
  }
2986
3016
 
3017
+ qti-order-interaction:state(--dragzone-active)::part(drags) {
3018
+ border-color: var(--qti-border-active);
3019
+ background-color: var(--qti-bg-active);
3020
+ }
3021
+
3022
+ qti-order-interaction:state(--dragzone-enabled)::part(drags) {
3023
+ background-color: var(--qti-bg-active);
3024
+ }
3025
+
2987
3026
  qti-order-interaction {
2988
3027
  &::part(qti-simple-choice),
2989
3028
  & qti-simple-choice {
@@ -3091,6 +3130,94 @@ qti-response-declaration {
3091
3130
  border-color: var(--qti-border-active);
3092
3131
  background-color: var(--qti-bg-active);
3093
3132
  }
3133
+
3134
+ & drop-list {
3135
+ &[shape='circle'] {
3136
+
3137
+ &:hover {
3138
+ background-color: var(--qti-hover-bg);
3139
+ }
3140
+
3141
+ &:focus {
3142
+ box-shadow: 0 0 0 var(--qti-focus-border-width) var(--qti-focus-color);
3143
+ }
3144
+
3145
+ &[aria-checked='true'] {
3146
+ border-color: var(--qti-border-active);
3147
+ background-color: var(--qti-bg-active);
3148
+ }
3149
+
3150
+ &[aria-readonly='true'] {
3151
+ cursor: pointer;
3152
+ background-color: var(--qti-bg);
3153
+ outline: 0;
3154
+ border: none;
3155
+ }
3156
+
3157
+ &[aria-disabled='true'] {
3158
+ cursor: not-allowed;
3159
+ background-color: var(--qti-disabled-bg);
3160
+ color: var(--qti-disabled-color);
3161
+ border-color: var(--qti-border-color);
3162
+ outline: 4px solid var(--qti-disabled-bg);
3163
+ }
3164
+
3165
+ width: 100%;
3166
+
3167
+ height: 100%;
3168
+
3169
+ background-color: transparent;
3170
+
3171
+ padding: 0;
3172
+
3173
+ border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
3174
+
3175
+ outline: none
3176
+ }
3177
+
3178
+ &[shape='square'] {
3179
+
3180
+ &:hover {
3181
+ background-color: var(--qti-hover-bg);
3182
+ }
3183
+
3184
+ &:focus {
3185
+ box-shadow: 0 0 0 var(--qti-focus-border-width) var(--qti-focus-color);
3186
+ }
3187
+
3188
+ &[aria-checked='true'] {
3189
+ border-color: var(--qti-border-active);
3190
+ background-color: var(--qti-bg-active);
3191
+ }
3192
+
3193
+ &[aria-readonly='true'] {
3194
+ cursor: pointer;
3195
+ background-color: var(--qti-bg);
3196
+ outline: 0;
3197
+ border: none;
3198
+ }
3199
+
3200
+ &[aria-disabled='true'] {
3201
+ cursor: not-allowed;
3202
+ background-color: var(--qti-disabled-bg);
3203
+ color: var(--qti-disabled-color);
3204
+ border-color: var(--qti-border-color);
3205
+ outline: 4px solid var(--qti-disabled-bg);
3206
+ }
3207
+
3208
+ width: 100%;
3209
+
3210
+ height: 100%;
3211
+
3212
+ background-color: transparent;
3213
+
3214
+ padding: 0;
3215
+
3216
+ border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
3217
+
3218
+ outline: none
3219
+ }
3220
+ }
3094
3221
  }
3095
3222
 
3096
3223
  qti-associate-interaction {
@@ -3236,6 +3363,38 @@ qti-response-declaration {
3236
3363
 
3237
3364
  outline: none
3238
3365
  }
3366
+
3367
+ &.qti-selections-light {
3368
+ &:state(--dragzone-active)::part(drags) {
3369
+ background-color: var(--qti-light-bg-active);
3370
+ border-color: var(--qti-light-border-active);
3371
+ }
3372
+
3373
+ &:state(--dragzone-enabled)::part(drags) {
3374
+ background-color: var(--qti-light-bg-active);
3375
+ }
3376
+ }
3377
+
3378
+ &.qti-selections-dark {
3379
+ &:state(--dragzone-active)::part(drags) {
3380
+ background-color: var(--qti-dark-bg-active);
3381
+ border-color: var(--qti-dark-border-active);
3382
+ }
3383
+
3384
+ &:state(--dragzone-enabled)::part(drags) {
3385
+ background-color: var(--qti-dark-bg-active);
3386
+ }
3387
+ }
3388
+
3389
+ /* General styles for active and enabled states */
3390
+ &:state(--dragzone-active)::part(drags) {
3391
+ border-color: var(--qti-border-active);
3392
+ background-color: var(--qti-bg-active);
3393
+ }
3394
+
3395
+ &:state(--dragzone-enabled)::part(drags) {
3396
+ background-color: var(--qti-bg-active);
3397
+ }
3239
3398
  }
3240
3399
 
3241
3400
  qti-graphic-associate-interaction {
@@ -3329,6 +3488,38 @@ qti-response-declaration {
3329
3488
  outline: none
3330
3489
  }
3331
3490
  }
3491
+
3492
+ &.qti-selections-light {
3493
+ &:state(--dragzone-active)::part(drags) {
3494
+ background-color: var(--qti-light-bg-active);
3495
+ border-color: var(--qti-light-border-active);
3496
+ }
3497
+
3498
+ &:state(--dragzone-enabled)::part(drags) {
3499
+ background-color: var(--qti-light-bg-active);
3500
+ }
3501
+ }
3502
+
3503
+ &.qti-selections-dark {
3504
+ &:state(--dragzone-active)::part(drags) {
3505
+ background-color: var(--qti-dark-bg-active);
3506
+ border-color: var(--qti-dark-border-active);
3507
+ }
3508
+
3509
+ &:state(--dragzone-enabled)::part(drags) {
3510
+ background-color: var(--qti-dark-bg-active);
3511
+ }
3512
+ }
3513
+
3514
+ /* General styles for active and enabled states */
3515
+ &:state(--dragzone-active)::part(drags) {
3516
+ border-color: var(--qti-border-active);
3517
+ background-color: var(--qti-bg-active);
3518
+ }
3519
+
3520
+ &:state(--dragzone-enabled)::part(drags) {
3521
+ background-color: var(--qti-bg-active);
3522
+ }
3332
3523
  }
3333
3524
 
3334
3525
  qti-slider-interaction {
@@ -3442,30 +3633,30 @@ qti-response-declaration {
3442
3633
  width: 100%;
3443
3634
  }
3444
3635
  }
3445
- `;var Ft=class extends v{constructor(){super(...arguments);this.testURL=""}async connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(t)this.preContent=t.content;else{this.preContent=h``;let r=new CSSStyleSheet;r.replaceSync(ps),this.shadowRoot.adoptedStyleSheets=[r],await this.updateComplete;let i=new CustomEvent("qti-load-test-request",{bubbles:!0,composed:!0,detail:{promise:null,testURL:this.testURL}});this.dispatchEvent(i)?this.content=(async()=>await i.detail.promise)():(console.warn("No qti-load-test-request listener found"),this.preContent=h`<span>qti-load-test-request was not catched</span>`)}}render(){return h`
3636
+ `;var Ve=class extends v{constructor(){super(...arguments);this.testURL=""}async connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(e)this.preContent=e.content;else{this.preContent=h``;let r=new CSSStyleSheet;r.replaceSync(ds),this.shadowRoot.adoptedStyleSheets=[r],await this.updateComplete;let i=new CustomEvent("qti-load-test-request",{bubbles:!0,composed:!0,detail:{promise:null,testURL:this.testURL}});this.dispatchEvent(i)?this.content=(async()=>await i.detail.promise)():(console.warn("No qti-load-test-request listener found"),this.preContent=h`<span>qti-load-test-request was not catched</span>`)}}render(){return h`
3446
3637
  ${this.preContent}
3447
3638
  <slot></slot>
3448
- ${ds(this.content,h`<span>Loading...</span>`)}
3449
- `}};l([w()],Ft.prototype,"content",2),l([p({type:String,attribute:"test-url"})],Ft.prototype,"testURL",2),Ft=l([g("test-container")],Ft);var nr=["this"],hs=["+","-","!"],us=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Fr={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},ar=13;var fo=["==","!=","<=",">=","||","&&","??","|>"],bo=["===","!=="],E;(function(s){s[s.STRING=1]="STRING",s[s.IDENTIFIER=2]="IDENTIFIER",s[s.DOT=3]="DOT",s[s.COMMA=4]="COMMA",s[s.COLON=5]="COLON",s[s.INTEGER=6]="INTEGER",s[s.DECIMAL=7]="DECIMAL",s[s.OPERATOR=8]="OPERATOR",s[s.GROUPER=9]="GROUPER",s[s.KEYWORD=10]="KEYWORD",s[s.ARROW=11]="ARROW"})(E||(E={}));var K=(s,e,t=0)=>({kind:s,value:e,precedence:t}),vo=s=>s===9||s===10||s===13||s===32,ms=s=>s===95||s===36||(s&=-33,65<=s&&s<=90),yo=s=>ms(s)||be(s),xo=s=>nr.indexOf(s)!==-1,qo=s=>s===34||s===39,be=s=>48<=s&&s<=57,wo=s=>s===43||s===45||s===42||s===47||s===33||s===38||s===37||s===60||s===61||s===62||s===63||s===94||s===124,Eo=s=>s===40||s===41||s===91||s===93||s===123||s===125,Co=s=>s.replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return`
3450
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return t}}),lr=class{constructor(e){z(this,"_input");z(this,"_index",-1);z(this,"_tokenStart",0);z(this,"_next");this._input=e,this._advance()}nextToken(){for(;vo(this._next);)this._advance(!0);if(qo(this._next))return this._tokenizeString();if(ms(this._next))return this._tokenizeIdentOrKeyword();if(be(this._next))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(wo(this._next))return this._tokenizeOperator();if(Eo(this._next))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw new Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e="unterminated string",t=this._next;for(this._advance(!0);this._next!==t;){if(this._next===void 0)throw new Error(e);if(this._next===92&&(this._advance(),this._next===void 0))throw new Error(e);this._advance()}let r=K(E.STRING,Co(this._getValue()));return this._advance(),r}_tokenizeIdentOrKeyword(){do this._advance();while(yo(this._next));let e=this._getValue(),t=xo(e)?E.KEYWORD:E.IDENTIFIER;return K(t,e)}_tokenizeNumber(){do this._advance();while(be(this._next));return this._next===46?this._tokenizeDot():K(E.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),be(this._next)?this._tokenizeFraction():(this._clearValue(),K(E.DOT,".",ar))}_tokenizeComma(){return this._advance(!0),K(E.COMMA,",")}_tokenizeColon(){return this._advance(!0),K(E.COLON,":")}_tokenizeFraction(){do this._advance();while(be(this._next));return K(E.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(bo.indexOf(e)!==-1)this._advance(),this._advance();else{if(e=this._getValue(1),e==="=>")return this._advance(),K(E.ARROW,e);fo.indexOf(e)!==-1&&this._advance()}return e=this._getValue(),K(E.OPERATOR,e,Fr[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next),t=K(E.GROUPER,e,Fr[e]);return this._advance(!0),t}};var Br=(s,e)=>new ve(s,e).parse(),ve=class{constructor(e,t){z(this,"_kind");z(this,"_tokenizer");z(this,"_ast");z(this,"_token");z(this,"_value");this._tokenizer=new lr(e),this._ast=t}parse(){return this._advance(),this._parseExpression()}_advance(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let r=this._tokenizer.nextToken();this._token=r,this._kind=r?.kind,this._value=r?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(E.GROUPER,"(")){let r=this._parseArguments();e=this._ast.invoke(e,void 0,r)}else if(this._matches(E.GROUPER,"[")){let r=this._parseIndex();e=this._ast.index(e,r)}else if(this._matches(E.DOT)){this._advance();let r=this._parseUnary();e=this._makeInvokeOrGetter(e,r)}else{if(this._matches(E.KEYWORD))break;if(this._matches(E.OPERATOR)&&this._token.precedence>=t)e=this._value==="?"?this._parseTernary(e):this._parseBinary(e,this._token);else break}return e}_makeInvokeOrGetter(e,t){if(t===void 0)throw new Error("expected identifier");if(t.type==="ID")return this._ast.getter(e,t.value);if(t.type==="Invoke"&&t.receiver.type==="ID"){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments)}else throw new Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(us.indexOf(t.value)===-1)throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===E.OPERATOR||this._kind===E.DOT||this._kind===E.GROUPER)&&this._token.precedence>t.precedence;)r=this._parsePrecedence(r,this._token.precedence);return this._ast.binary(e,t.value,r)}_parseUnary(){if(this._matches(E.OPERATOR)){let e=this._value;if(this._advance(),e==="+"||e==="-"){if(this._matches(E.INTEGER))return this._parseInteger(e);if(this._matches(E.DECIMAL))return this._parseDecimal(e)}if(hs.indexOf(e)===-1)throw new Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),ar);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(E.OPERATOR,"?");let t=this._parseExpression();this._advance(E.COLON);let r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case E.KEYWORD:let e=this._value;if(e==="this")return this._advance(),this._ast.id(e);throw nr.indexOf(e)!==-1?new Error(`unexpected keyword: ${e}`):new Error(`unrecognized keyword: ${e}`);case E.IDENTIFIER:return this._parseInvokeOrIdentifier();case E.STRING:return this._parseString();case E.INTEGER:return this._parseInteger();case E.DECIMAL:return this._parseDecimal();case E.GROUPER:return this._value==="("?this._parseParenOrFunction():this._value==="{"?this._parseMap():this._value==="["?this._parseList():void 0;case E.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(E.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(E.COMMA));return this._advance(E.GROUPER,"]"),this._ast.list(e)}_parseMap(){let e={};do{if(this._advance(),this._matches(E.GROUPER,"}"))break;let t=this._value;(this._matches(E.STRING)||this._matches(E.IDENTIFIER))&&this._advance(),this._advance(E.COLON),e[t]=this._parseExpression()}while(this._matches(E.COMMA));return this._advance(E.GROUPER,"}"),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e==="true")return this._advance(),this._ast.literal(!0);if(e==="false")return this._advance(),this._ast.literal(!1);if(e==="null")return this._advance(),this._ast.literal(null);if(e==="undefined")return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),r=this._parseArguments();return r?this._ast.invoke(t,void 0,r):t}_parseIdentifier(){if(!this._matches(E.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(E.GROUPER,"("))return;let e=[];do{if(this._advance(),this._matches(E.GROUPER,")"))break;let t=this._parseExpression();e.push(t)}while(this._matches(E.COMMA));return this._advance(E.GROUPER,")"),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(E.GROUPER,"]"),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(E.ARROW)){this._advance();let t=this._parseExpression(),r=e?.map(i=>i.value)??[];return this._ast.arrowFunction(r,t)}else return this._ast.paren(e[0])}_parseString(){let e=this._ast.literal(this._value);return this._advance(),e}_parseInteger(e=""){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=""){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};var _o={"+":(s,e)=>s+e,"-":(s,e)=>s-e,"*":(s,e)=>s*e,"/":(s,e)=>s/e,"%":(s,e)=>s%e,"==":(s,e)=>s==e,"!=":(s,e)=>s!=e,"===":(s,e)=>s===e,"!==":(s,e)=>s!==e,">":(s,e)=>s>e,">=":(s,e)=>s>=e,"<":(s,e)=>s<e,"<=":(s,e)=>s<=e,"||":(s,e)=>s||e,"&&":(s,e)=>s&&e,"??":(s,e)=>s??e,"|":(s,e)=>e(s),"|>":(s,e)=>e(s)},ko={"+":s=>s,"-":s=>-s,"!":s=>!s},cr=class{empty(){return{type:"Empty",evaluate(e){return e},getIds(e){return e}}}literal(e){return{type:"Literal",value:e,evaluate(t){return this.value},getIds(t){return t}}}id(e){return{type:"ID",value:e,evaluate(t){return this.value==="this"?t:t?.[this.value]},getIds(t){return t.push(this.value),t}}}unary(e,t){let r=ko[e];return{type:"Unary",operator:e,child:t,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(e,t,r){let i=_o[t];return{type:"Binary",operator:t,left:e,right:r,evaluate(o){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(o),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),c=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,c=this.left.value),a===void 0?void 0:a[c]=n}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(e,t){return{type:"Getter",receiver:e,name:t,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(e,t,r){if(t!=null&&typeof t!="string")throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),n=this.method?o:i?.this??i,a=this.method?o?.[t]:o,d=(this.arguments??[]).map(u=>u?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(e){return e}index(e,t){return{type:"Index",receiver:e,argument:t,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(e,t,r){return{type:"Ternary",condition:e,trueExpr:t,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(e){return{type:"Map",entries:e,evaluate(t){let r={};if(e&&this.entries)for(let i in e){let o=this.entries[i];o&&(r[i]=o.evaluate(t))}return r},getIds(t){if(e&&this.entries)for(let r in e){let i=this.entries[r];i&&i.getIds(t)}return t}}}list(e){return{type:"List",items:e,evaluate(t){return this.items?.map(r=>r?.evaluate(t))},getIds(t){return this.items?.forEach(r=>r?.getIds(t)),t}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(r){let i=this.params,o=this.body;return function(...n){let a=Object.fromEntries(i.map((d,u)=>[d,n[u]])),c=new Proxy(r??{},{set(d,u,m){return a.hasOwnProperty(u)&&(a[u]=m),d[u]=m},get(d,u){return a.hasOwnProperty(u)?a[u]:d[u]}});return o.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var jr=null,gs={boundAttributeSuffix:M.M,marker:M.P,markerMatch:M.A,HTML_RESULT:M.C,getTemplateHtml:M.L,overrideDirectiveResolve:(s,e)=>class extends s{_$AS(t,r){return e(this,r)}},patchDirectiveResolve:(s,e)=>{if(s.prototype._$AS!==e){jr??(jr=s.prototype._$AS.name);for(let t=s.prototype;t!==Object.prototype;t=Object.getPrototypeOf(t))if(t.hasOwnProperty(jr))return void(t[jr]=e);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(s,e){s._$litDirective$=e},getAttributePartCommittedValue:(s,e,t)=>{let r=R;return s.j=i=>r=i,s._$AI(e,s,t),r},connectedDisconnectable:s=>({...s,_$AU:!0}),resolveDirective:M.V,AttributePart:M.H,PropertyPart:M.B,BooleanAttributePart:M.N,EventPart:M.U,ElementPart:M.F,TemplateInstance:M.R,isIterable:M.D,ChildPart:M.I};var{AttributePart:To,PropertyPart:Ao,BooleanAttributePart:So,EventPart:Ro}=gs,Xr=new cr,Wr=new Map,fs=s=>s.replace(/-(-|\w)/g,(e,t)=>t.toUpperCase()),dr=(s,e)=>{let t=Wr.get(s);if(t===void 0){if(Wr.has(s))return;if(s=s.trim(),s.startsWith("{{")&&s.endsWith("}}")){let r=s.substring(2,s.length-2).trim();t=new ve(r,Xr).parse(),Wr.set(s,t)}}return t?.evaluate(e)},Mo=(s,e,t,r)=>{let i=s.getAttribute("if");if(i!==null&&dr(i,e))return pr(s,e,t,r)},bs=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,vs=s=>/(?:\\{{)|(?:\\}})/g.test(s),ye=s=>s.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Lo=(s,e,t,r)=>{let i=s.getAttribute("repeat");if(i!==null){let o=dr(i,e);if(!o[Symbol.iterator])return k;let n=xe(s),a=-1,c=[];for(let d of o){a++;let u=Object.create(e);u.item=d,u.index=a,u.this=e.this??e;let m=[];for(let y of n.parts){let x=y.update(u,t,r);y.type===1?m.push(...x):m.push(x)}let f={_$litType$:n,values:m};c.push(f)}return c}},xs={if:Mo,repeat:Lo},qs=(s,e=xs,t={},r)=>{let o=xe(s).renderers;if(r){let a=xe(r).renderers,c=o.super;c!==void 0?t={...o,...t,super:(d,u,m)=>(m={...a,...m,super:(f,y,x)=>pr(r,f,y,x)},c(d,u,m))}:(t={...a,...o,...t},s=r)}else t={...o,...t};return n=>pr(s,n,e,t)};var pr=(s,e,t=xs,r={})=>{let i=xe(s),o=[];for(let a of i.parts){let c=a.update(e,t,r);a.type===1?o.push(...c):o.push(c)}return{_$litType$:i,values:o}},ys=new Map,xe=s=>{let e=ys.get(s);return e===void 0&&ys.set(s,e=$o(s)),e},$o=s=>{let e={h:void 0,el:s.cloneNode(!0),parts:[],renderers:{}},t=document.createTreeWalker(e.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=t.currentNode,i=-1,o=[];for(;(r=t.nextNode())!==null;)if(r.nodeType===Node.ELEMENT_NODE){i++;let n=r;if(n.tagName==="TEMPLATE"){let c=n.getAttribute("type"),d=n.getAttribute("name"),u=n.getAttribute("call");if(u!==null||c!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),o.push(n);let m;if(u!==null){let f=u.trim(),y=f.startsWith("{{")&&f.endsWith("}}");m=(x,q,A)=>{let D=n.getAttribute("data"),re=D===null?void 0:dr(D,x);return(y?dr(f,x):A[u])?.(re,q,A)}}else c!==null?m=(f,y,x)=>{let q=y[c];return q?.(n,f,y,x)}:(d==="super"?e.renderers.super=(f,y,x)=>{let q=x.super,A=xe(n);return x={...x,...A.renderers},q(f,y,x)}:e.renderers[d]=(f,y,x)=>pr(n,f,y,x),m=(f,y,x)=>{let q=x[d];return q?.(f,y,x)});e.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let c of a){let d=n.getAttribute(c),u=d.split(bs);if(u.length===1){vs(d)&&n.setAttribute(c,ye(d));continue}n.removeAttribute(c);let m=c,f=To,y=c[0];y==="."?(m=fs(c.substring(1)),f=Ao):y==="?"?(m=c.substring(1),f=So):y==="@"&&(m=fs(c.substring(1)),f=Ro);let x=[ye(u[0])],q=[];for(let A=1;A<u.length;A+=2){let D=u[A];q.push(Br(D,Xr)),x.push(ye(u[A+1]))}e.parts.push({type:1,index:i,name:m,strings:x,ctor:f,update:(A,D,re)=>q.map(ct=>ct.evaluate(A))})}}else if(r.nodeType===Node.TEXT_NODE){let n=r,a=n.textContent,c=a.split(bs);c.length>1?n.textContent=ye(c[0]):vs(a)&&(n.textContent=ye(a));for(let d=1;d<c.length;d+=2){let u=c[d],m=Br(u,Xr);e.parts.push({type:2,index:++i,update:(y,x)=>m.evaluate(y)});let f=new Text(c[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,t.currentNode=f}}for(let n of o)n.remove();return e};var Bt=class extends L{constructor(){super();this.maxDisplayedItems=2;this.skipOnCategory="dep-informational";this._internals.ariaLabel="pagination"}createRenderRoot(){return this}render(){let t=this._testContext.items.reduce((a,c)=>{let u=c.category?.split(" ").includes(this.skipOnCategory)?"i":a.counter++;return a.result.push({...c,newIndex:u}),a},{counter:0,result:[]}).result,r=t.findIndex(a=>a.identifier===this._testContext.navItemId),i=Math.max(0,r-this.maxDisplayedItems),o=Math.min(t.length,r+this.maxDisplayedItems+1),n=t.slice(i,o);return h`
3451
- ${n.map(a=>{let c=a.variables.find(ct=>ct.identifier=="SCORE"),d=parseInt(c?.value?.toString()),u=a.variables.find(ct=>ct.identifier==="completionStatus")?.value,m=a.category!==this.skipOnCategory?"regular":"info",f=this._testContext.navItemId===a.identifier,y=this._testContext.view==="scorer"&&m=="regular"&&d!==void 0&&!isNaN(d)&&d>0,x=this._testContext.view==="scorer"&&m=="regular"&&d!==void 0&&!isNaN(d)&&d<=0,q=this._testContext.view==="candidate"&&u==="completed"&&a.category!==this.skipOnCategory,A={...a,type:m,active:f,correct:y,incorrect:x,answered:q},D=this.firstElementChild;return qs(D)({item:A})})}
3452
- `}};l([p({type:Number,attribute:"max-displayed-items"})],Bt.prototype,"maxDisplayedItems",2),l([p({type:String,attribute:"skip-on-category"})],Bt.prototype,"skipOnCategory",2),Bt=l([g("test-paging-buttons-stamp")],Bt);var ws=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],$=Symbol("item");var I=class extends v{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(t,r)=>{this._interactionElements.forEach(i=>i.disabled=r)};this._handleReadonlyChange=(t,r)=>this._interactionElements.forEach(i=>i.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:ws};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",t=>{this._context={...this._context,variables:[...this._context.variables,t.detail.variable]},this._initialContext=this._context,t.stopPropagation()}),this.addEventListener("qti-register-feedback",t=>{t.stopPropagation();let r=t.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",t=>{t.stopPropagation(),this._interactionElements.push(t.target)}),this.addEventListener("end-attempt",t=>{let{responseIdentifier:r,countAttempt:i}=t.detail;this.validate(),this.updateResponseVariable(r,"true"),this.processResponse(i)}),this.addEventListener("qti-set-outcome-value",t=>{let{outcomeIdentifier:r,value:i}=t.detail;this.updateOutcomeVariable(r,i),t.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(r=>{let i=t.find(o=>o.identifier===r.identifier);return i?{...r,...i}:r})},this._context.variables.forEach(r=>{if(r.type==="response"){let i=this._interactionElements.find(o=>o.responseIdentifier===r.identifier);i&&(i.value=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(r.identifier))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(t){if(t)for(let r of t){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===r.responseIdentifier);o&&(o.value=r.response)}}render(){return h`<slot></slot>`}showCorrectResponse(t){let i=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of i){let n=this._interactionElements.find(a=>a.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=t?o.response:"")}}processResponse(t=!0){this.validate();let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.value+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(r=>r.identifier===t)||null}handleUpdateResponseVariable(t){let{responseIdentifier:r,response:i}=t.detail;this.updateResponseVariable(r,i)}updateResponseVariable(t,r){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:r})},this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(r)?[...r]:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(t,r){let i=this.getOutcome(t);if(!i){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,value:i.cardinality==="single"?r:[...o.value,r]})},this._feedbackElements.forEach(o=>o.checkShowFeedback(t)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(o=>o.identifier===t)?.value})}validate(){return this._interactionElements.every(t=>t.validate())?!0:this._interactionElements.some(t=>t.validate())?!1:null}_getCompletionStatus(){let t=this.validate();return t===!0?"completed":t===!1?"incomplete":"not_attempted"}_emit(t,r=null){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:r}))}};l([p({type:String})],I.prototype,"title",2),l([p({type:String})],I.prototype,"identifier",2),l([p({type:String})],I.prototype,"adaptive",2),l([p({type:String})],I.prototype,"timeDependent",2),l([p({type:Boolean})],I.prototype,"disabled",2),l([S("disabled",{waitUntilFirstUpdate:!0})],I.prototype,"_handleDisabledChange",2),l([p({type:Boolean})],I.prototype,"readonly",2),l([S("readonly",{waitUntilFirstUpdate:!0})],I.prototype,"_handleReadonlyChange",2),l([Lt({context:$})],I.prototype,"_context",2),I=l([g("qti-assessment-item")],I);var jt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let t=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0});if(this.dispatchEvent(t)){let o=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);o?await this.updateStimulusRef(o):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(t){let r=await Ht().load(this.href).then(i=>i.htmlDoc());if(r){let i=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");t.innerHTML="",t.append(...i)}}};l([p({type:String})],jt.prototype,"identifier",2),l([p({type:String})],jt.prototype,"href",2),jt=l([g("qti-assessment-stimulus-ref")],jt);var Es={toAttribute:s=>s?"true":"false",fromAttribute:s=>s==="true"};function Z(s,e){class t extends s{constructor(...o){super(...o);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(o,n){this.tabIndex=n?-1:0,n&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${e}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${e}`,{bubbles:!0,composed:!0}))}_onKeyUp(o){o.altKey||o.code==="Space"&&(o.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${e}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return h`<slot></slot>`}}return l([p({type:String})],t.prototype,"identifier",2),l([p({type:Number,reflect:!0,attribute:"tabindex"})],t.prototype,"tabIndex",2),l([p({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Es})],t.prototype,"disabled",2),l([p({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Es})],t.prototype,"readonly",2),l([S("disabled",{waitUntilFirstUpdate:!0})],t.prototype,"handleDisabledChange",1),t}var Cs=b`
3639
+ ${cs(this.content,h`<span>Loading...</span>`)}
3640
+ `}};l([q()],Ve.prototype,"content",2),l([p({type:String,attribute:"test-url"})],Ve.prototype,"testURL",2),Ve=l([g("test-container")],Ve);var nr=["this"],ps=["+","-","!"],hs=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Fr={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},ar=13;var fo=["==","!=","<=",">=","||","&&","??","|>"],bo=["===","!=="],w;(function(s){s[s.STRING=1]="STRING",s[s.IDENTIFIER=2]="IDENTIFIER",s[s.DOT=3]="DOT",s[s.COMMA=4]="COMMA",s[s.COLON=5]="COLON",s[s.INTEGER=6]="INTEGER",s[s.DECIMAL=7]="DECIMAL",s[s.OPERATOR=8]="OPERATOR",s[s.GROUPER=9]="GROUPER",s[s.KEYWORD=10]="KEYWORD",s[s.ARROW=11]="ARROW"})(w||(w={}));var K=(s,t,e=0)=>({kind:s,value:t,precedence:e}),vo=s=>s===9||s===10||s===13||s===32,us=s=>s===95||s===36||(s&=-33,65<=s&&s<=90),yo=s=>us(s)||gt(s),xo=s=>nr.indexOf(s)!==-1,qo=s=>s===34||s===39,gt=s=>48<=s&&s<=57,wo=s=>s===43||s===45||s===42||s===47||s===33||s===38||s===37||s===60||s===61||s===62||s===63||s===94||s===124,Eo=s=>s===40||s===41||s===91||s===93||s===123||s===125,Co=s=>s.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
3641
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),lr=class{constructor(t){z(this,"_input");z(this,"_index",-1);z(this,"_tokenStart",0);z(this,"_next");this._input=t,this._advance()}nextToken(){for(;vo(this._next);)this._advance(!0);if(qo(this._next))return this._tokenizeString();if(us(this._next))return this._tokenizeIdentOrKeyword();if(gt(this._next))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(wo(this._next))return this._tokenizeOperator();if(Eo(this._next))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw new Error(`Expected end of input, got ${this._next}`)}_advance(t){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),t===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(t=0){let e=this._input.substring(this._tokenStart,this._index+t);return t===0&&this._clearValue(),e}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let t="unterminated string",e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0)throw new Error(t);if(this._next===92&&(this._advance(),this._next===void 0))throw new Error(t);this._advance()}let r=K(w.STRING,Co(this._getValue()));return this._advance(),r}_tokenizeIdentOrKeyword(){do this._advance();while(yo(this._next));let t=this._getValue(),e=xo(t)?w.KEYWORD:w.IDENTIFIER;return K(e,t)}_tokenizeNumber(){do this._advance();while(gt(this._next));return this._next===46?this._tokenizeDot():K(w.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),gt(this._next)?this._tokenizeFraction():(this._clearValue(),K(w.DOT,".",ar))}_tokenizeComma(){return this._advance(!0),K(w.COMMA,",")}_tokenizeColon(){return this._advance(!0),K(w.COLON,":")}_tokenizeFraction(){do this._advance();while(gt(this._next));return K(w.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let t=this._getValue(2);if(bo.indexOf(t)!==-1)this._advance(),this._advance();else{if(t=this._getValue(1),t==="=>")return this._advance(),K(w.ARROW,t);fo.indexOf(t)!==-1&&this._advance()}return t=this._getValue(),K(w.OPERATOR,t,Fr[t])}_tokenizeGrouper(){let t=String.fromCharCode(this._next),e=K(w.GROUPER,t,Fr[t]);return this._advance(!0),e}};var Br=(s,t)=>new ft(s,t).parse(),ft=class{constructor(t,e){z(this,"_kind");z(this,"_tokenizer");z(this,"_ast");z(this,"_token");z(this,"_value");this._tokenizer=new lr(t),this._ast=e}parse(){return this._advance(),this._parseExpression()}_advance(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this._token?.kind} (${this._token?.value})`);let r=this._tokenizer.nextToken();this._token=r,this._kind=r?.kind,this._value=r?.value}_matches(t,e){return!(t&&this._kind!==t||e&&this._value!==e)}_parseExpression(){if(!this._token)return this._ast.empty();let t=this._parseUnary();return t===void 0?void 0:this._parsePrecedence(t,0)}_parsePrecedence(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(w.GROUPER,"(")){let r=this._parseArguments();t=this._ast.invoke(t,void 0,r)}else if(this._matches(w.GROUPER,"[")){let r=this._parseIndex();t=this._ast.index(t,r)}else if(this._matches(w.DOT)){this._advance();let r=this._parseUnary();t=this._makeInvokeOrGetter(t,r)}else{if(this._matches(w.KEYWORD))break;if(this._matches(w.OPERATOR)&&this._token.precedence>=e)t=this._value==="?"?this._parseTernary(t):this._parseBinary(t,this._token);else break}return t}_makeInvokeOrGetter(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this._ast.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this._ast.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}_parseBinary(t,e){if(hs.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===w.OPERATOR||this._kind===w.DOT||this._kind===w.GROUPER)&&this._token.precedence>e.precedence;)r=this._parsePrecedence(r,this._token.precedence);return this._ast.binary(t,e.value,r)}_parseUnary(){if(this._matches(w.OPERATOR)){let t=this._value;if(this._advance(),t==="+"||t==="-"){if(this._matches(w.INTEGER))return this._parseInteger(t);if(this._matches(w.DECIMAL))return this._parseDecimal(t)}if(ps.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this._parsePrecedence(this._parsePrimary(),ar);return this._ast.unary(t,e)}return this._parsePrimary()}_parseTernary(t){this._advance(w.OPERATOR,"?");let e=this._parseExpression();this._advance(w.COLON);let r=this._parseExpression();return this._ast.ternary(t,e,r)}_parsePrimary(){switch(this._kind){case w.KEYWORD:let t=this._value;if(t==="this")return this._advance(),this._ast.id(t);throw nr.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case w.IDENTIFIER:return this._parseInvokeOrIdentifier();case w.STRING:return this._parseString();case w.INTEGER:return this._parseInteger();case w.DECIMAL:return this._parseDecimal();case w.GROUPER:return this._value==="("?this._parseParenOrFunction():this._value==="{"?this._parseMap():this._value==="["?this._parseList():void 0;case w.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){let t=[];do{if(this._advance(),this._matches(w.GROUPER,"]"))break;t.push(this._parseExpression())}while(this._matches(w.COMMA));return this._advance(w.GROUPER,"]"),this._ast.list(t)}_parseMap(){let t={};do{if(this._advance(),this._matches(w.GROUPER,"}"))break;let e=this._value;(this._matches(w.STRING)||this._matches(w.IDENTIFIER))&&this._advance(),this._advance(w.COLON),t[e]=this._parseExpression()}while(this._matches(w.COMMA));return this._advance(w.GROUPER,"}"),this._ast.map(t)}_parseInvokeOrIdentifier(){let t=this._value;if(t==="true")return this._advance(),this._ast.literal(!0);if(t==="false")return this._advance(),this._ast.literal(!1);if(t==="null")return this._advance(),this._ast.literal(null);if(t==="undefined")return this._advance(),this._ast.literal(void 0);let e=this._parseIdentifier(),r=this._parseArguments();return r?this._ast.invoke(e,void 0,r):e}_parseIdentifier(){if(!this._matches(w.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);let t=this._value;return this._advance(),this._ast.id(t)}_parseArguments(){if(!this._matches(w.GROUPER,"("))return;let t=[];do{if(this._advance(),this._matches(w.GROUPER,")"))break;let e=this._parseExpression();t.push(e)}while(this._matches(w.COMMA));return this._advance(w.GROUPER,")"),t}_parseIndex(){this._advance();let t=this._parseExpression();return this._advance(w.GROUPER,"]"),t}_parseParenOrFunction(){let t=this._parseArguments();if(this._matches(w.ARROW)){this._advance();let e=this._parseExpression(),r=t?.map(i=>i.value)??[];return this._ast.arrowFunction(r,e)}else return this._ast.paren(t[0])}_parseString(){let t=this._ast.literal(this._value);return this._advance(),t}_parseInteger(t=""){let e=this._ast.literal(parseInt(`${t}${this._value}`,10));return this._advance(),e}_parseDecimal(t=""){let e=this._ast.literal(parseFloat(`${t}${this._value}`));return this._advance(),e}};var _o={"+":(s,t)=>s+t,"-":(s,t)=>s-t,"*":(s,t)=>s*t,"/":(s,t)=>s/t,"%":(s,t)=>s%t,"==":(s,t)=>s==t,"!=":(s,t)=>s!=t,"===":(s,t)=>s===t,"!==":(s,t)=>s!==t,">":(s,t)=>s>t,">=":(s,t)=>s>=t,"<":(s,t)=>s<t,"<=":(s,t)=>s<=t,"||":(s,t)=>s||t,"&&":(s,t)=>s&&t,"??":(s,t)=>s??t,"|":(s,t)=>t(s),"|>":(s,t)=>t(s)},ko={"+":s=>s,"-":s=>-s,"!":s=>!s},cr=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=ko[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=_o[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(o){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(o),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),c=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,c=this.left.value),a===void 0?void 0:a[c]=n}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),n=this.method?o:i?.this??i,a=this.method?o?.[e]:o,d=(this.arguments??[]).map(u=>u?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let o=this.entries[i];o&&(r[i]=o.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,o=this.body;return function(...n){let a=Object.fromEntries(i.map((d,u)=>[d,n[u]])),c=new Proxy(r??{},{set(d,u,m){return a.hasOwnProperty(u)&&(a[u]=m),d[u]=m},get(d,u){return a.hasOwnProperty(u)?a[u]:d[u]}});return o.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var jr=null,ms={boundAttributeSuffix:M.M,marker:M.P,markerMatch:M.A,HTML_RESULT:M.C,getTemplateHtml:M.L,overrideDirectiveResolve:(s,t)=>class extends s{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(s,t)=>{if(s.prototype._$AS!==t){jr??(jr=s.prototype._$AS.name);for(let e=s.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(jr))return void(e[jr]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(s,t){s._$litDirective$=t},getAttributePartCommittedValue:(s,t,e)=>{let r=R;return s.j=i=>r=i,s._$AI(t,s,e),r},connectedDisconnectable:s=>({...s,_$AU:!0}),resolveDirective:M.V,AttributePart:M.H,PropertyPart:M.B,BooleanAttributePart:M.N,EventPart:M.U,ElementPart:M.F,TemplateInstance:M.R,isIterable:M.D,ChildPart:M.I};var{AttributePart:To,PropertyPart:Ao,BooleanAttributePart:So,EventPart:Ro}=ms,Xr=new cr,Wr=new Map,gs=s=>s.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),dr=(s,t)=>{let e=Wr.get(s);if(e===void 0){if(Wr.has(s))return;if(s=s.trim(),s.startsWith("{{")&&s.endsWith("}}")){let r=s.substring(2,s.length-2).trim();e=new ft(r,Xr).parse(),Wr.set(s,e)}}return e?.evaluate(t)},Mo=(s,t,e,r)=>{let i=s.getAttribute("if");if(i!==null&&dr(i,t))return pr(s,t,e,r)},fs=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,bs=s=>/(?:\\{{)|(?:\\}})/g.test(s),bt=s=>s.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Lo=(s,t,e,r)=>{let i=s.getAttribute("repeat");if(i!==null){let o=dr(i,t);if(!o[Symbol.iterator])return k;let n=vt(s),a=-1,c=[];for(let d of o){a++;let u=Object.create(t);u.item=d,u.index=a,u.this=t.this??t;let m=[];for(let y of n.parts){let x=y.update(u,e,r);y.type===1?m.push(...x):m.push(x)}let f={_$litType$:n,values:m};c.push(f)}return c}},ys={if:Mo,repeat:Lo},xs=(s,t=ys,e={},r)=>{let o=vt(s).renderers;if(r){let a=vt(r).renderers,c=o.super;c!==void 0?e={...o,...e,super:(d,u,m)=>(m={...a,...m,super:(f,y,x)=>pr(r,f,y,x)},c(d,u,m))}:(e={...a,...o,...e},s=r)}else e={...o,...e};return n=>pr(s,n,t,e)};var pr=(s,t,e=ys,r={})=>{let i=vt(s),o=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?o.push(...c):o.push(c)}return{_$litType$:i,values:o}},vs=new Map,vt=s=>{let t=vs.get(s);return t===void 0&&vs.set(s,t=$o(s)),t},$o=s=>{let t={h:void 0,el:s.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,o=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.ELEMENT_NODE){i++;let n=r;if(n.tagName==="TEMPLATE"){let c=n.getAttribute("type"),d=n.getAttribute("name"),u=n.getAttribute("call");if(u!==null||c!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),o.push(n);let m;if(u!==null){let f=u.trim(),y=f.startsWith("{{")&&f.endsWith("}}");m=(x,_,S)=>{let D=n.getAttribute("data"),Qe=D===null?void 0:dr(D,x);return(y?dr(f,x):S[u])?.(Qe,_,S)}}else c!==null?m=(f,y,x)=>{let _=y[c];return _?.(n,f,y,x)}:(d==="super"?t.renderers.super=(f,y,x)=>{let _=x.super,S=vt(n);return x={...x,...S.renderers},_(f,y,x)}:t.renderers[d]=(f,y,x)=>pr(n,f,y,x),m=(f,y,x)=>{let _=x[d];return _?.(f,y,x)});t.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let c of a){let d=n.getAttribute(c),u=d.split(fs);if(u.length===1){bs(d)&&n.setAttribute(c,bt(d));continue}n.removeAttribute(c);let m=c,f=To,y=c[0];y==="."?(m=gs(c.substring(1)),f=Ao):y==="?"?(m=c.substring(1),f=So):y==="@"&&(m=gs(c.substring(1)),f=Ro);let x=[bt(u[0])],_=[];for(let S=1;S<u.length;S+=2){let D=u[S];_.push(Br(D,Xr)),x.push(bt(u[S+1]))}t.parts.push({type:1,index:i,name:m,strings:x,ctor:f,update:(S,D,Qe)=>_.map(ce=>ce.evaluate(S))})}}else if(r.nodeType===Node.TEXT_NODE){let n=r,a=n.textContent,c=a.split(fs);c.length>1?n.textContent=bt(c[0]):bs(a)&&(n.textContent=bt(a));for(let d=1;d<c.length;d+=2){let u=c[d],m=Br(u,Xr);t.parts.push({type:2,index:++i,update:(y,x)=>m.evaluate(y)});let f=new Text(c[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of o)n.remove();return t};var ze=class extends L{constructor(){super();this.maxDisplayedItems=2;this.skipOnCategory="dep-informational";this._internals.ariaLabel="pagination"}createRenderRoot(){return this}render(){let e=this._testContext.items.reduce((a,c)=>{let u=c.category?.split(" ").includes(this.skipOnCategory)?"i":a.counter++;return a.result.push({...c,newIndex:u}),a},{counter:0,result:[]}).result,r=e.findIndex(a=>a.identifier===this._testContext.navItemId),i=Math.max(0,r-this.maxDisplayedItems),o=Math.min(e.length,r+this.maxDisplayedItems+1),n=e.slice(i,o);return h`
3642
+ ${n.map(a=>{let c=a.variables.find(ce=>ce.identifier=="SCORE"),d=parseInt(c?.value?.toString()),u=a.variables.find(ce=>ce.identifier==="completionStatus")?.value,m=a.category!==this.skipOnCategory?"regular":"info",f=this._testContext.navItemId===a.identifier,y=this._testContext.view==="scorer"&&m=="regular"&&d!==void 0&&!isNaN(d)&&d>0,x=this._testContext.view==="scorer"&&m=="regular"&&d!==void 0&&!isNaN(d)&&d<=0,_=this._testContext.view==="candidate"&&u==="completed"&&a.category!==this.skipOnCategory,S={...a,type:m,active:f,correct:y,incorrect:x,answered:_},D=this.firstElementChild;return xs(D)({item:S})})}
3643
+ `}};l([p({type:Number,attribute:"max-displayed-items"})],ze.prototype,"maxDisplayedItems",2),l([p({type:String,attribute:"skip-on-category"})],ze.prototype,"skipOnCategory",2),ze=l([g("test-paging-buttons-stamp")],ze);function qs(s){class t extends s{createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href}}))}render(){return h`${this.xmlDoc}`}}return l([p({type:String,reflect:!0})],t.prototype,"identifier",2),l([p({type:String})],t.prototype,"href",2),l([p({type:Object,attribute:!1})],t.prototype,"xmlDoc",2),t}var hr=class extends qs(v){};hr=l([g("qti-item")],hr);var ws=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],$=Symbol("item");var I=class extends v{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(i=>i.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(i=>i.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:ws};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context={...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:i}=e.detail;this.validate(),this.updateResponseVariable(r,"true"),this.processResponse(i)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:i}=e.detail;this.updateOutcomeVariable(r,i),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,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}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={...this._context,variables:this._context.variables.map(r=>{let i=e.find(o=>o.identifier===r.identifier);return i?{...r,...i}:r})},this._context.variables.forEach(r=>{if(r.type==="response"){let i=this._interactionElements.find(o=>o.responseIdentifier===r.identifier);i&&(i.value=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(i=>i.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.value=r.response)}}render(){return h`<slot></slot>`}showCorrectResponse(e){let i=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of i){let n=this._interactionElements.find(a=>a.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=e?o.response:"")}}processResponse(e=!0){this.validate();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",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.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:i}=e.detail;this.updateResponseVariable(r,i)}updateResponseVariable(e,r){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:r})},this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:Array.isArray(r)?[...r]:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,value:i.cardinality==="single"?r:[...o.value,r]})},this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(o=>o.identifier===e)?.value})}validate(){return this._interactionElements.every(e=>e.validate())?!0:this._interactionElements.some(e=>e.validate())?!1:null}_getCompletionStatus(){let e=this.validate();return e===!0?"completed":e===!1?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([p({type:String})],I.prototype,"title",2),l([p({type:String})],I.prototype,"identifier",2),l([p({type:String})],I.prototype,"adaptive",2),l([p({type:String})],I.prototype,"timeDependent",2),l([p({type:Boolean})],I.prototype,"disabled",2),l([A("disabled",{waitUntilFirstUpdate:!0})],I.prototype,"_handleDisabledChange",2),l([p({type:Boolean})],I.prototype,"readonly",2),l([A("readonly",{waitUntilFirstUpdate:!0})],I.prototype,"_handleReadonlyChange",2),l([Le({context:$})],I.prototype,"_context",2),I=l([g("qti-assessment-item")],I);var Ue=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0});if(this.dispatchEvent(e)){let o=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);o?await this.updateStimulusRef(o):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let r=await Zt().load(this.href).then(i=>i.htmlDoc());if(r){let i=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};l([p({type:String})],Ue.prototype,"identifier",2),l([p({type:String})],Ue.prototype,"href",2),Ue=l([g("qti-assessment-stimulus-ref")],Ue);var Es={toAttribute:s=>s?"true":"false",fromAttribute:s=>s==="true"};function Z(s,t){class e extends s{constructor(...o){super(...o);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(o,n){this.tabIndex=n?-1:0,n&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(o){o.altKey||o.code==="Space"&&(o.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return h`<slot></slot>`}}return l([p({type:String})],e.prototype,"identifier",2),l([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),l([p({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Es})],e.prototype,"disabled",2),l([p({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Es})],e.prototype,"readonly",2),l([A("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var Cs=b`
3453
3644
  :host {
3454
3645
  display: block;
3455
3646
  }
3456
- `;var qe=class extends v{render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};qe.styles=Cs,qe=l([g("qti-item-body")],qe);var hr=class extends v{render(){return h`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};hr=l([g("qti-prompt")],hr);var ur=class extends v{constructor(){super(...arguments);this.styleElement=null}firstUpdated(t){super.firstUpdated(t);let r=this.getAttribute("href");if(r!==null&&fetch(r).then(i=>i.text()).then(i=>{let o=this.minifyCss(i);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${o}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};ur=l([g("qti-stylesheet")],ur);var mt=class extends v{render(){return h`<slot></slot>`}defaultValues(e){let t=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(t.length===0)return null;let r=t.map(i=>i.innerHTML.trim());return r.length>1||e.cardinality==="multiple"||e.cardinality==="ordered"?r:r[0]}};mt=l([g("qti-variabledeclaration")],mt);var J=class extends mt{constructor(){super(...arguments);this.externalScored=null}render(){let t=this.itemContext?.variables.find(r=>r.identifier===this.identifier)?.value;return h`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(t){let r=new Map;for(let i of t.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(i.getAttribute("source-value")),n=parseInt(i.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 t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=this.defaultValues(t),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};J.styles=[b`
3647
+ `;var yt=class extends v{render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};yt.styles=Cs,yt=l([g("qti-item-body")],yt);var ur=class extends v{render(){return h`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};ur=l([g("qti-prompt")],ur);var mr=class extends v{constructor(){super(...arguments);this.styleElement=null}firstUpdated(e){super.firstUpdated(e);let r=this.getAttribute("href");if(r!==null&&fetch(r).then(i=>i.text()).then(i=>{let o=this.minifyCss(i);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${o}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};mr=l([g("qti-stylesheet")],mr);var me=class extends v{render(){return h`<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(i=>i.innerHTML.trim());return r.length>1||t.cardinality==="multiple"||t.cardinality==="ordered"?r:r[0]}};me=l([g("qti-variabledeclaration")],me);var J=class extends me{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(r=>r.identifier===this.identifier)?.value;return h`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let r=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(i.getAttribute("source-value")),n=parseInt(i.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,externalScored:this.externalScored};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};J.styles=[b`
3457
3648
  :host {
3458
3649
  display: none;
3459
3650
  }
3460
- `],l([p({type:String,attribute:"base-type"})],J.prototype,"baseType",2),l([p({type:String,attribute:"external-scored"})],J.prototype,"externalScored",2),l([p({type:String})],J.prototype,"identifier",2),l([p({type:String})],J.prototype,"cardinality",2),l([T({context:$,subscribe:!0}),w()],J.prototype,"itemContext",2),J=l([g("qti-outcome-declaration")],J);var nt=class extends mt{render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return h`${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,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){e=[];for(let i=0;i<r.length;i++)e.push(r[i].textContent),r[i].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};nt.styles=[b`
3651
+ `],l([p({type:String,attribute:"base-type"})],J.prototype,"baseType",2),l([p({type:String,attribute:"external-scored"})],J.prototype,"externalScored",2),l([p({type:String})],J.prototype,"identifier",2),l([p({type:String})],J.prototype,"cardinality",2),l([T({context:$,subscribe:!0}),q()],J.prototype,"itemContext",2),J=l([g("qti-outcome-declaration")],J);var ne=class extends me{render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return h`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};t.value=this.defaultValues(t),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}get correctResponse(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent),r[i].remove()}}return t}get mapping(){return this.querySelector("qti-mapping")}};ne.styles=[b`
3461
3652
  :host {
3462
3653
  display: none;
3463
3654
  }
3464
- `],l([p({type:String,attribute:"base-type"})],nt.prototype,"baseType",2),l([p({type:String})],nt.prototype,"identifier",2),l([p({type:String})],nt.prototype,"cardinality",2),l([T({context:$,subscribe:!0}),w()],nt.prototype,"itemContext",2),nt=l([g("qti-response-declaration")],nt);var mr=class extends v{};mr=l([g("qti-companion-materials-info")],mr);var gr=class extends v{render(){return h`<slot></slot>`}};gr=l([g("qti-content-body")],gr);var Q=class extends v{handleclassNamesChange(){this.classNames.split(" ").forEach(t=>{switch(t){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};Q.styles=b`
3655
+ `],l([p({type:String,attribute:"base-type"})],ne.prototype,"baseType",2),l([p({type:String})],ne.prototype,"identifier",2),l([p({type:String})],ne.prototype,"cardinality",2),l([T({context:$,subscribe:!0}),q()],ne.prototype,"itemContext",2),ne=l([g("qti-response-declaration")],ne);var gr=class extends v{};gr=l([g("qti-companion-materials-info")],gr);var fr=class extends v{render(){return h`<slot></slot>`}};fr=l([g("qti-content-body")],fr);var Q=class extends v{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};Q.styles=b`
3465
3656
  :host {
3466
3657
  display: block;
3467
3658
  }
3468
- `,l([p({type:String})],Q.prototype,"id",2),l([p({type:String})],Q.prototype,"use",2),l([p({type:String})],Q.prototype,"view",2),l([p({type:String,attribute:"class"})],Q.prototype,"classNames",2),l([S("classNames",{waitUntilFirstUpdate:!0})],Q.prototype,"handleclassNamesChange",1),Q=l([g("qti-rubric-block")],Q);var Do=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),we=s=>{if(typeof s=="string")return s;let e=Do();return e==="."?s.toLocaleString():s.toString().replace(".","").replace(e,".")};function Yr(s){return s==null}function Ee(s){return s.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var N=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this._context.variables.find(i=>i.identifier===e)||null;if(this.outcomeIdentifier!==e||!t)return;let r=!1;Array.isArray(t.value)?r=t.value.includes(this.identifier):r=!Yr(this.identifier)&&!Yr(t?.value)&&this.identifier===t.value||!1,this.showFeedback(r)}showFeedback(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};l([p({type:String,attribute:"show-hide"})],N.prototype,"showHide",2),l([p({type:String,attribute:"outcome-identifier"})],N.prototype,"outcomeIdentifier",2),l([p({type:String})],N.prototype,"identifier",2),l([p({type:String,attribute:!1})],N.prototype,"showStatus",2),l([T({context:$,subscribe:!0}),w()],N.prototype,"_context",2);var Ce=class extends N{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(e){this.checkShowFeedback(this.outcomeIdentifier)}};Ce.styles=b`
3659
+ `,l([p({type:String})],Q.prototype,"id",2),l([p({type:String})],Q.prototype,"use",2),l([p({type:String})],Q.prototype,"view",2),l([p({type:String,attribute:"class"})],Q.prototype,"classNames",2),l([A("classNames",{waitUntilFirstUpdate:!0})],Q.prototype,"handleclassNamesChange",1),Q=l([g("qti-rubric-block")],Q);var Do=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),xt=s=>{if(typeof s=="string")return s;let t=Do();return t==="."?s.toLocaleString():s.toString().replace(".","").replace(t,".")};function Yr(s){return s==null}function qt(s){return s.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var N=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Yr(this.identifier)&&!Yr(e?.value)&&this.identifier===e.value||!1,this.showFeedback(r)}showFeedback(t){this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}};l([p({type:String,attribute:"show-hide"})],N.prototype,"showHide",2),l([p({type:String,attribute:"outcome-identifier"})],N.prototype,"outcomeIdentifier",2),l([p({type:String})],N.prototype,"identifier",2),l([p({type:String,attribute:!1})],N.prototype,"showStatus",2),l([T({context:$,subscribe:!0}),q()],N.prototype,"_context",2);var wt=class extends N{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(t){this.checkShowFeedback(this.outcomeIdentifier)}};wt.styles=b`
3469
3660
  :host {
3470
3661
  display: block;
3471
3662
  }
@@ -3475,21 +3666,21 @@ qti-response-declaration {
3475
3666
  .off {
3476
3667
  display: none;
3477
3668
  }
3478
- `,Ce=l([g("qti-feedback-block")],Ce);var _e=class extends N{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${this.showStatus}"></slot> `}};_e.styles=b`
3669
+ `,wt=l([g("qti-feedback-block")],wt);var Et=class extends N{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${this.showStatus}"></slot> `}};Et.styles=b`
3479
3670
  .on {
3480
3671
  display: inline-block;
3481
3672
  }
3482
3673
  .off {
3483
3674
  display: none;
3484
3675
  }
3485
- `,_e=l([g("qti-feedback-inline")],_e);var ke=class extends N{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${this.showStatus}"></slot> `}};ke.styles=b`
3676
+ `,Et=l([g("qti-feedback-inline")],Et);var Ct=class extends N{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${this.showStatus}"></slot> `}};Ct.styles=b`
3486
3677
  .on {
3487
3678
  display: inline-block;
3488
3679
  }
3489
3680
  .off {
3490
3681
  display: none;
3491
3682
  }
3492
- `,ke=l([g("qti-modal-feedback")],ke);var gt=s=>s??k;var C=class extends v{constructor(){super();this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}reportValidity(){return this._internals.reportValidity()}reset(){this.value=""}get correctResponse(){return this._correctResponse}set correctResponse(t){this._correctResponse=t}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1}))}saveResponse(t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t}}))}};C.formAssociated=!0,l([p({type:String,attribute:"response-identifier"})],C.prototype,"responseIdentifier",2),l([p({reflect:!0,type:Boolean})],C.prototype,"disabled",2),l([p({reflect:!0,type:Boolean})],C.prototype,"readonly",2),l([w()],C.prototype,"_correctResponse",2);var O=class extends C{constructor(){super(...arguments);this._rows=5;this._value=""}handleclassNamesChange(t,r){let i=r.split(" "),o=!1;if(i.forEach(n=>{if(n.startsWith("qti-height-lines-")){let a=n.replace("qti-height-lines-","");this._rows=parseInt(a),o=!0}}),!o&&this.expectedLength){let n=Math.ceil(this.expectedLength/50);this._rows=n}}get value(){return this._value}set value(t){if(typeof t=="string"){this._value=t;let r=new FormData;r.append(this.responseIdentifier,t),this._internals.setFormValue(r),this.validate()}else throw new Error("Value must be a string")}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),t.setCustomValidity("");let r=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(r);t.checkValidity()&&i.test(t.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),t.setCustomValidity(this.dataPatternmaskMessage))}else{let r=t.checkValidity();this._internals.setValidity(r?{}:{customError:!1})}return this._value!==""&&t.checkValidity()}reportValidity(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let r=this.validate();return r||t.reportValidity(),r}static get styles(){return[b`
3683
+ `,Ct=l([g("qti-modal-feedback")],Ct);var ge=s=>s??k;var E=class extends v{constructor(){super();this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}reportValidity(){return this._internals.reportValidity()}reset(){this.value=""}get correctResponse(){return this._correctResponse}set correctResponse(e){this._correctResponse=e}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier}}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};E.formAssociated=!0,l([p({type:String,attribute:"response-identifier"})],E.prototype,"responseIdentifier",2),l([p({reflect:!0,type:Boolean})],E.prototype,"disabled",2),l([p({reflect:!0,type:Boolean})],E.prototype,"readonly",2),l([q()],E.prototype,"_correctResponse",2);var H=class extends E{constructor(){super(...arguments);this._rows=5;this._value=""}handleclassNamesChange(e,r){let i=r.split(" "),o=!1;if(i.forEach(n=>{if(n.startsWith("qti-height-lines-")){let a=n.replace("qti-height-lines-","");this._rows=parseInt(a),o=!0}}),!o&&this.expectedLength){let n=Math.ceil(this.expectedLength/50);this._rows=n}}get value(){return this._value}set value(e){if(typeof e=="string"){this._value=e;let r=new FormData;r.append(this.responseIdentifier,e),this._internals.setFormValue(r),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let r=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(r);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let r=e.checkValidity();this._internals.setValidity(r?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let r=this.validate();return r||e.reportValidity(),r}static get styles(){return[b`
3493
3684
  /* PK: display host as block, else design will be collapsed */
3494
3685
  :host {
3495
3686
  display: block;
@@ -3507,16 +3698,16 @@ qti-response-declaration {
3507
3698
  spellcheck="false"
3508
3699
  autocomplete="off"
3509
3700
  maxlength="${5e3}"
3510
- @keydown="${t=>t.stopImmediatePropagation()}"
3701
+ @keydown="${e=>e.stopImmediatePropagation()}"
3511
3702
  @keyup="${this.textChanged}"
3512
3703
  @change="${this.textChanged}"
3513
- @blur="${t=>{this.reportValidity()}}"
3514
- placeholder="${gt(this.placeholderText?this.placeholderText:void 0)}"
3704
+ @blur="${e=>{this.reportValidity()}}"
3705
+ placeholder="${ge(this.placeholderText?this.placeholderText:void 0)}"
3515
3706
  rows="${this._rows}"
3516
3707
  ?disabled="${this.disabled}"
3517
3708
  ?readonly="${this.readonly}"
3518
3709
  .value=${this._value}
3519
- ></textarea>`}textChanged(t){if(this.disabled||this.readonly)return;let r=t.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this.value=r.value,this.saveResponse(r.value))}setEmptyAttribute(t){this.setAttribute("empty",t===""?"true":"false")}};l([w()],O.prototype,"_rows",2),l([p({type:Number,attribute:"expected-length"})],O.prototype,"expectedLength",2),l([p({type:String,attribute:"pattern-mask"})],O.prototype,"patternMask",2),l([p({type:String,attribute:"placeholder-text"})],O.prototype,"placeholderText",2),l([p({type:String,attribute:"data-patternmask-message"})],O.prototype,"dataPatternmaskMessage",2),l([w()],O.prototype,"_value",2),l([p({type:String,attribute:"class"})],O.prototype,"classNames",2),l([S("classNames")],O.prototype,"handleclassNamesChange",1),O=l([g("qti-extended-text-interaction")],O);var _s=()=>new Kr,Kr=class{},Gr=new WeakMap,kh=F(class extends Ut{render(s){return k}update(s,[e]){let t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=s.options?.host,this.rt(this.ct=s.element)),k}rt(s){if(this.isConnected||(s=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=Gr.get(e);t===void 0&&(t=new WeakMap,Gr.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){return typeof this.Y=="function"?Gr.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var ks=b`
3710
+ ></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))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([q()],H.prototype,"_rows",2),l([p({type:Number,attribute:"expected-length"})],H.prototype,"expectedLength",2),l([p({type:String,attribute:"pattern-mask"})],H.prototype,"patternMask",2),l([p({type:String,attribute:"placeholder-text"})],H.prototype,"placeholderText",2),l([p({type:String,attribute:"data-patternmask-message"})],H.prototype,"dataPatternmaskMessage",2),l([q()],H.prototype,"_value",2),l([p({type:String,attribute:"class"})],H.prototype,"classNames",2),l([A("classNames")],H.prototype,"handleclassNamesChange",1),H=l([g("qti-extended-text-interaction")],H);var _s=()=>new Kr,Kr=class{},Gr=new WeakMap,Oh=F(class extends Oe{render(s){return k}update(s,[t]){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=s.options?.host,this.rt(this.ct=s.element)),k}rt(s){if(this.isConnected||(s=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=Gr.get(t);e===void 0&&(e=new WeakMap,Gr.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){return typeof this.Y=="function"?Gr.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var ks=b`
3520
3711
  :host {
3521
3712
  display: inline-block;
3522
3713
  }
@@ -3598,26 +3789,26 @@ qti-response-declaration {
3598
3789
  width: 57rem;
3599
3790
  min-width: 57rem;
3600
3791
  }
3601
- `;var tt=class extends C{constructor(){super(...arguments);this._value="";this.inputRef=_s()}get value(){return this._value}set value(t){if(typeof t=="string"){this._value=t;let r=new FormData;r.append(this.responseIdentifier,t),this._internals.setFormValue(r),this.validate()}else throw new Error("Value must be a string")}validate(){let t=this.shadowRoot.querySelector("input");if(!t)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),t.setCustomValidity(""),t.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),t.setCustomValidity(this.dataPatternmaskMessage));else{let r=t.checkValidity();this._internals.setValidity(r?{}:{customError:!1})}return this._value!==""&&t.checkValidity()}render(){return h`
3792
+ `;var ee=class extends E{constructor(){super(...arguments);this._value="";this.inputRef=_s()}get value(){return this._value}set value(e){if(typeof e=="string"){this._value=e;let r=new FormData;r.append(this.responseIdentifier,e),this._internals.setFormValue(r),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),e.setCustomValidity(""),e.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage));else{let r=e.checkValidity();this._internals.setValidity(r?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}render(){return h`
3602
3793
  <input
3603
3794
  part="input"
3604
3795
  name="${this.responseIdentifier}"
3605
3796
  spellcheck="false"
3606
3797
  autocomplete="off"
3607
- @blur="${t=>{this.reportValidity()}}"
3608
- @keydown="${t=>t.stopImmediatePropagation()}"
3798
+ @blur="${e=>{this.reportValidity()}}"
3799
+ @keydown="${e=>e.stopImmediatePropagation()}"
3609
3800
  @keyup="${this.textChanged}"
3610
3801
  @change="${this.textChanged}"
3611
3802
  type="${this.patternMask=="[0-9]*"?"number":"text"}"
3612
- placeholder="${gt(this.placeholderText?this.placeholderText:void 0)}"
3803
+ placeholder="${ge(this.placeholderText?this.placeholderText:void 0)}"
3613
3804
  .value="${this._value}"
3614
- pattern="${gt(this.patternMask?this.patternMask:void 0)}"
3805
+ pattern="${ge(this.patternMask?this.patternMask:void 0)}"
3615
3806
  maxlength=${1e3}
3616
3807
  ?disabled="${this.disabled}"
3617
3808
  ?readonly="${this.readonly}"
3618
3809
  />
3619
3810
  <div part="correct">${this._correctResponse}</div>
3620
- `}textChanged(t){if(this.disabled||this.readonly)return;let r=t.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this.value=r.value,this.saveResponse(r.value))}reportValidity(){let t=this.shadowRoot.querySelector("input");if(!t)return!1;let r=this.validate();return r||t.reportValidity(),r}reset(){this._value=""}setEmptyAttribute(t){this.setAttribute("empty",t===""?"true":"false")}};tt.styles=ks,l([p({type:Number,attribute:"expected-length"})],tt.prototype,"expectedLength",2),l([p({type:String,attribute:"pattern-mask"})],tt.prototype,"patternMask",2),l([p({type:String,attribute:"placeholder-text"})],tt.prototype,"placeholderText",2),l([p({type:String,attribute:"data-patternmask-message"})],tt.prototype,"dataPatternmaskMessage",2),l([w()],tt.prototype,"_value",2),tt=l([g("qti-text-entry-interaction")],tt);var ft=(s,e)=>{class t extends s{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(o,n)=>{this._choiceElements.forEach(a=>a.disabled=n)};this._handleReadonlyChange=(o,n)=>{this._choiceElements.forEach(a=>a.readonly=n)};this._value=""}_handleMaxChoicesChange(o,n){this._determineInputType()}get value(){return Array.isArray(this._value)?this._value.join(","):this._value}set value(o){if(this.maxChoices>1&&typeof o=="string"?this._value=o.split(","):this._value=o,Array.isArray(this._value)){let n=new FormData;this._value.forEach(a=>{n.append(this.responseIdentifier,a)}),this._internals.setFormValue(n)}else this._internals.setFormValue(this._value);this._updateChoiceSelection()}get correctResponse(){return this._correctResponse}set correctResponse(o){this._correctResponse=o;let n=Array.isArray(o)?o:[o];this._choiceElements.forEach(a=>{a.internals.states.delete("correct-response"),a.internals.states.delete("incorrect-response"),n.length>0&&(n.includes(a.identifier)?a.internals.states.add("correct-response"):a.internals.states.add("incorrect-response"))})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${e}`,this._registerChoiceElement),this.addEventListener(`unregister-${e}`,this._unregisterChoiceElement),this.addEventListener(`activate-${e}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${e}`,this._registerChoiceElement),this.removeEventListener(`unregister-${e}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${e}`,this._choiceElementSelectedHandler)}validate(){let o=this._choiceElements.filter(d=>this._getChoiceChecked(d)),n=o.length,a=!0,c="";return this.maxChoices!==0&&n>this.maxChoices?(a=!1,c=this.dataset.maxSelectionsMessage||`You can select at most ${this.maxChoices} choices.`):n<this.minChoices&&(a=!1,c=this.dataset.minSelectionsMessage||`You must select at least ${this.minChoices} choices.`),o.length>0&&this._internals.setValidity(a?{}:{customError:!0},c,o[n-1]||this._choiceElements[0]||this),this.reportValidity(),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.display="block")),this._internals.validity.valid}_registerChoiceElement(o){o.stopPropagation();let n=o.target;n.disabled=this.disabled,this._choiceElements.push(n),this._setInputType(n)}_unregisterChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(o=>{this._setInputType(o)})}_setInputType(o){this._internals.ariaLabel=this.maxChoices===1?"radio-group":"checkbox-group";let n=this.maxChoices===1?"radio":"checkbox";o.internals.role=n,o.internals.states.delete(n==="radio"?"checkbox":"radio"),o.internals.states.add(n)}_choiceElementSelectedHandler(o){this._toggleChoiceChecked(o.target),this.maxChoices===1&&this._choiceElements.forEach(n=>{n.identifier!==o.detail.identifier&&this._setChoiceChecked(n,!1)}),this._handleChoiceSelection()}_setChoiceChecked(o,n){o.internals?.states&&(n?(o.internals.states.add("--checked"),o.internals.ariaChecked="true"):(o.internals.states.delete("--checked"),o.internals.ariaChecked="false"))}_getChoiceChecked(o){return o.internals.states.has("--checked")}_toggleChoiceChecked(o){let n=this._getChoiceChecked(o);this._setChoiceChecked(o,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.value=this.maxChoices===1?n[0]||"":n,this.validate(),this.saveResponse(this._value)}_updateChoiceSelection(){let o=Array.isArray(this._value)?this._value:[this._value];this._choiceElements.forEach(n=>{let a=o.includes(n.identifier);this._setChoiceChecked(n,a)})}}return l([It("#validationMessage")],t.prototype,"_validationMessageElement",2),l([p({type:Number,attribute:"min-choices"})],t.prototype,"minChoices",2),l([p({type:Number,attribute:"max-choices"})],t.prototype,"maxChoices",2),l([S("maxChoices",{waitUntilFirstUpdate:!0})],t.prototype,"_handleMaxChoicesChange",1),l([S("disabled",{waitUntilFirstUpdate:!0})],t.prototype,"_handleDisabledChange",2),l([S("readonly",{waitUntilFirstUpdate:!0})],t.prototype,"_handleReadonlyChange",2),t};var fr=class extends ft(C,"qti-hottext"){constructor(){super(...arguments);this.render=()=>h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};fr=l([g("qti-hottext-interaction")],fr);var Te=class extends G{constructor(e){if(super(e),this.it=k,e.type!==ut.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===R)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Te.directiveName="unsafeHTML",Te.resultType=1;var bt=F(Te);var vt=class extends C{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
3811
+ `}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))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let r=this.validate();return r||e.reportValidity(),r}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};ee.styles=ks,l([p({type:Number,attribute:"expected-length"})],ee.prototype,"expectedLength",2),l([p({type:String,attribute:"pattern-mask"})],ee.prototype,"patternMask",2),l([p({type:String,attribute:"placeholder-text"})],ee.prototype,"placeholderText",2),l([p({type:String,attribute:"data-patternmask-message"})],ee.prototype,"dataPatternmaskMessage",2),l([q()],ee.prototype,"_value",2),ee=l([g("qti-text-entry-interaction")],ee);var fe=(s,t)=>{class e extends s{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(o,n)=>{this._choiceElements.forEach(a=>a.disabled=n)};this._handleReadonlyChange=(o,n)=>{this._choiceElements.forEach(a=>a.readonly=n)};this._value=""}_handleMaxChoicesChange(o,n){this._determineInputType()}get value(){return Array.isArray(this._value)?this._value.join(","):this._value}set value(o){if(this.maxChoices>1&&typeof o=="string"?this._value=o.split(","):this._value=o,Array.isArray(this._value)){let n=new FormData;this._value.forEach(a=>{n.append(this.responseIdentifier,a)}),this._internals.setFormValue(n)}else this._internals.setFormValue(this._value);this._updateChoiceSelection()}get correctResponse(){return this._correctResponse}set correctResponse(o){this._correctResponse=o;let n=Array.isArray(o)?o:[o];this._choiceElements.forEach(a=>{a.internals.states.delete("correct-response"),a.internals.states.delete("incorrect-response"),n.length>0&&(n.includes(a.identifier)?a.internals.states.add("correct-response"):a.internals.states.add("incorrect-response"))})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${t}`,this._registerChoiceElement),this.addEventListener(`unregister-${t}`,this._unregisterChoiceElement),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${t}`,this._registerChoiceElement),this.removeEventListener(`unregister-${t}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler)}validate(){let o=this._choiceElements.filter(d=>this._getChoiceChecked(d)),n=o.length,a=!0,c="";return this.maxChoices!==0&&n>this.maxChoices?(a=!1,c=this.dataset.maxSelectionsMessage||`You can select at most ${this.maxChoices} choices.`):n<this.minChoices&&(a=!1,c=this.dataset.minSelectionsMessage||`You must select at least ${this.minChoices} choices.`),o.length>0&&this._internals.setValidity(a?{}:{customError:!0},c,o[n-1]||this._choiceElements[0]||this),this.reportValidity(),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.display="block")),this._internals.validity.valid}_registerChoiceElement(o){o.stopPropagation();let n=o.target;n.disabled=this.disabled,this._choiceElements.push(n),this._setInputType(n)}_unregisterChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(o=>{this._setInputType(o)})}_setInputType(o){this._internals.ariaLabel=this.maxChoices===1?"radio-group":"checkbox-group";let n=this.maxChoices===1?"radio":"checkbox";o.internals.role=n,o.internals.states.delete(n==="radio"?"checkbox":"radio"),o.internals.states.add(n)}_choiceElementSelectedHandler(o){this._toggleChoiceChecked(o.target),this.maxChoices===1&&this._choiceElements.forEach(n=>{n.identifier!==o.detail.identifier&&this._setChoiceChecked(n,!1)}),this._handleChoiceSelection()}_setChoiceChecked(o,n){o.internals?.states&&(n?(o.internals.states.add("--checked"),o.internals.ariaChecked="true"):(o.internals.states.delete("--checked"),o.internals.ariaChecked="false"))}_getChoiceChecked(o){return o.internals.states.has("--checked")}_toggleChoiceChecked(o){let n=this._getChoiceChecked(o);this._setChoiceChecked(o,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.value=this.maxChoices===1?n[0]||"":n,this.validate(),this.saveResponse(this._value)}_updateChoiceSelection(){let o=Array.isArray(this._value)?this._value:[this._value];this._choiceElements.forEach(n=>{let a=o.includes(n.identifier);this._setChoiceChecked(n,a)})}}return l([Ie("#validationMessage")],e.prototype,"_validationMessageElement",2),l([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),l([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),l([A("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),l([A("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),l([A("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),e};var br=class extends fe(E,"qti-hottext"){constructor(){super(...arguments);this.render=()=>h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};br=l([g("qti-hottext-interaction")],br);var _t=class extends G{constructor(t){if(super(t),this.it=k,t.type!==ue.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===k||t==null)return this._t=void 0,this.it=t;if(t===R)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:[]}}};_t.directiveName="unsafeHTML",_t.resultType=1;var be=F(_t);var ve=class extends E{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
3621
3812
  :host {
3622
3813
  display: inline-block;
3623
3814
  }
@@ -3641,13 +3832,13 @@ qti-response-declaration {
3641
3832
  }
3642
3833
  `]}render(){return h`
3643
3834
  <select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
3644
- ${this.options.map(t=>h`
3645
- <option value="${t.value}" ?selected="${t.selected}">${bt(t.textContent)}</option>
3835
+ ${this.options.map(e=>h`
3836
+ <option value="${e.value}" ?selected="${e.selected}">${be(e.textContent)}</option>
3646
3837
  `)}
3647
3838
  </select>
3648
3839
 
3649
- ${bt(this.correctOption)}
3650
- `}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let t=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...t.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let t=this.options.find(r=>r.selected);return t?t.value!=="":!1}reset(){this.options=this.options.map((t,r)=>({...t,selected:r===0}))}set value(t){this.options=this.options.map(r=>(t===r.value&&(r.selected=!0),r))}get value(){return this.options.find(t=>t.selected).value}set correctResponse(t){if(t===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(r=>t===r.value).textContent}</span>`}choiceSelected(t){let r=t.target.value;this.options=this.options.map(i=>({...i,selected:i.value===r})),this.saveResponse(r)}};vt.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],l([w()],vt.prototype,"options",2),l([w()],vt.prototype,"correctOption",2),l([p({attribute:"data-prompt",type:String})],vt.prototype,"dataPrompt",2),vt=l([g("qti-inline-choice-interaction")],vt);var br=(s,e)=>{class t extends s{constructor(){super(...arguments);this.shuffle="false"}connectedCallback(){super.connectedCallback(),this._applyShuffle()}updated(o){o.has("shuffle")&&this._applyShuffle()}_applyShuffle(){this.shuffle==="true"?this._shuffleChoices():this._resetShuffleChoices()}_shuffleChoices(){let o=Array.from(this.querySelectorAll(e)),n=o.filter(f=>f.hasAttribute("fixed")),a=o.filter(f=>!f.hasAttribute("fixed"));if(a.length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");return}let c=[...a],d=!1,u=0;for(;!d&&u<10;){u++;for(let f=a.length-1;f>0;f--){let y=Math.floor(Math.random()*(f+1));[a[f],a[y]]=[a[y],a[f]]}d=!a.every((f,y)=>f===c[y])}d||console.warn("Failed to shuffle the choices after multiple attempts.");let m=1;[...n,...a].forEach(f=>{f.style.setProperty("order",String(m++))})}_resetShuffleChoices(){this.querySelectorAll(e).forEach(o=>{o.style.setProperty("order","initial")})}}return l([p({type:String,reflect:!0})],t.prototype,"shuffle",2),t};var Ts=(s,e)=>{class t extends s{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(o){o&&(this._classes=o.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(o){super.updated(o),o.has("shuffle")&&this._addLabels()}_addLabels(){let o=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),n=a=>!isNaN(+a);if(o){let c=Array.from(this.querySelectorAll("qti-simple-choice")).map(d=>d).map((d,u)=>({el:d,order:n(d.style.order)?+d.style.order:u+1})).sort((d,u)=>d.order-u.order).map(d=>d.el);for(let d=0;d<c.length;d++)c[d].marker=this._getLabel(d+1)}}_getLabel(o){let n=this._classes.filter(d=>this._allLabels.includes(d)).pop(),a=this._classes.filter(d=>this._allLabelSuffixes.includes(d)).pop();!n&&a&&(n="qti-labels-upper-alpha");let c="";switch(n){case"qti-labels-decimal":c=`${o}`;break;case"qti-labels-lower-alpha":c=`${String.fromCharCode(97+o-1)}`;break;case"qti-labels-upper-alpha":c=`${String.fromCharCode(65+o-1)}`;break}return a==="qti-labels-suffix-period"?c+=".":a==="qti-labels-suffix-parenthesis"&&(c+=")"),c}}return l([p({type:String,reflect:!0})],t.prototype,"class",1),t};var As=b`
3840
+ ${be(this.correctOption)}
3841
+ `}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(r=>r.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,r)=>({...e,selected:r===0}))}set value(e){this.options=this.options.map(r=>(e===r.value&&(r.selected=!0),r))}get value(){return this.options.find(e=>e.selected).value}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(r=>e===r.value).textContent}</span>`}choiceSelected(e){let r=e.target.value;this.options=this.options.map(i=>({...i,selected:i.value===r})),this.saveResponse(r)}};ve.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],l([q()],ve.prototype,"options",2),l([q()],ve.prototype,"correctOption",2),l([p({attribute:"data-prompt",type:String})],ve.prototype,"dataPrompt",2),ve=l([g("qti-inline-choice-interaction")],ve);var vr=(s,t)=>{class e extends s{constructor(){super(...arguments);this.shuffle="false"}connectedCallback(){super.connectedCallback(),this._applyShuffle()}updated(o){o.has("shuffle")&&this._applyShuffle()}_applyShuffle(){this.shuffle==="true"?this._shuffleChoices():this._resetShuffleChoices()}_shuffleChoices(){let o=Array.from(this.querySelectorAll(t)),n=o.filter(f=>f.hasAttribute("fixed")),a=o.filter(f=>!f.hasAttribute("fixed"));if(a.length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");return}let c=[...a],d=!1,u=0;for(;!d&&u<10;){u++;for(let f=a.length-1;f>0;f--){let y=Math.floor(Math.random()*(f+1));[a[f],a[y]]=[a[y],a[f]]}d=!a.every((f,y)=>f===c[y])}d||console.warn("Failed to shuffle the choices after multiple attempts.");let m=1;[...n,...a].forEach(f=>{f.style.setProperty("order",String(m++))})}_resetShuffleChoices(){this.querySelectorAll(t).forEach(o=>{o.style.setProperty("order","initial")})}}return l([p({type:String,reflect:!0})],e.prototype,"shuffle",2),e};var Ts=(s,t)=>{class e extends s{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(o){o&&(this._classes=o.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(o){super.updated(o),o.has("shuffle")&&this._addLabels()}_addLabels(){let o=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),n=a=>!isNaN(+a);if(o){let c=Array.from(this.querySelectorAll("qti-simple-choice")).map(d=>d).map((d,u)=>({el:d,order:n(d.style.order)?+d.style.order:u+1})).sort((d,u)=>d.order-u.order).map(d=>d.el);for(let d=0;d<c.length;d++)c[d].marker=this._getLabel(d+1)}}_getLabel(o){let n=this._classes.filter(d=>this._allLabels.includes(d)).pop(),a=this._classes.filter(d=>this._allLabelSuffixes.includes(d)).pop();!n&&a&&(n="qti-labels-upper-alpha");let c="";switch(n){case"qti-labels-decimal":c=`${o}`;break;case"qti-labels-lower-alpha":c=`${String.fromCharCode(97+o-1)}`;break;case"qti-labels-upper-alpha":c=`${String.fromCharCode(65+o-1)}`;break}return a==="qti-labels-suffix-period"?c+=".":a==="qti-labels-suffix-parenthesis"&&(c+=")"),c}}return l([p({type:String,reflect:!0})],e.prototype,"class",1),e};var As=b`
3651
3842
  [part='slot'] {
3652
3843
  display: flex;
3653
3844
  flex-direction: column;
@@ -3685,14 +3876,14 @@ qti-response-declaration {
3685
3876
  :host([orientation='horizontal']) [part='slot'] {
3686
3877
  flex-direction: row;
3687
3878
  }
3688
- `;var Wt=class extends Ts(br(ft(C,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){constructor(){super(),this._internals.role="group"}render(){return h`
3879
+ `;var Fe=class extends Ts(vr(fe(E,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){constructor(){super(),this._internals.role="group"}render(){return h`
3689
3880
  <slot part="prompt" name="prompt"></slot><slot part="slot"></slot>
3690
3881
  <div part="message" role="alert" id="validationMessage"></div>
3691
- `}};Wt.styles=As,l([p({type:String})],Wt.prototype,"orientation",2),Wt=l([g("qti-choice-interaction")],Wt);var Ae=class extends v{render(){return h`<slot></slot>`}process(){let e=new Zr,t=[...this.children];e.process(t)}};Ae.styles=[b`
3882
+ `}};Fe.styles=As,l([p({type:String})],Fe.prototype,"orientation",2),Fe=l([g("qti-choice-interaction")],Fe);var kt=class extends v{render(){return h`<slot></slot>`}process(){let t=new Zr,e=[...this.children];t.process(e)}};kt.styles=[b`
3692
3883
  :host {
3693
3884
  display: none;
3694
3885
  }
3695
- `],Ae=l([g("qti-outcome-processing")],Ae);var Zr=class{process(e){for(let t of e)t.process()}};var Ss=`<qti-response-processing>
3886
+ `],kt=l([g("qti-outcome-processing")],kt);var Zr=class{process(t){for(let e of t)e.process()}};var Ss=`<qti-response-processing>
3696
3887
  <qti-response-condition>
3697
3888
  <qti-response-if>
3698
3889
  <qti-match>
@@ -3741,19 +3932,19 @@ qti-response-declaration {
3741
3932
  </qti-set-outcome-value>
3742
3933
  </qti-response-else>
3743
3934
  </qti-response-condition>
3744
- </qti-response-processing>`;var At=class extends v{render(){return h`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let t=[...this.children];for(let r of t)r.process()}firstUpdated(e){if(this.getAttribute("template")){let t=this.getAttribute("template").split("/"),r=t[t.length-1].replace(".xml","");switch(this.innerHTML="",r){case"map_response":{this.appendChild(this.fragmentFromString(Rs).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Ms).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(Ss).firstElementChild.firstElementChild);break}}}fragmentFromString(e){return document.createRange().createContextualFragment(e)}};At.styles=[b`
3935
+ </qti-response-processing>`;var Ae=class extends v{render(){return h`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let r of e)r.process()}firstUpdated(t){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),r=e[e.length-1].replace(".xml","");switch(this.innerHTML="",r){case"map_response":{this.appendChild(this.fragmentFromString(Rs).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Ms).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(Ss).firstElementChild.firstElementChild);break}}}fragmentFromString(t){return document.createRange().createContextualFragment(t)}};Ae.styles=[b`
3745
3936
  :host {
3746
3937
  display: none;
3747
3938
  }
3748
- `],At=l([g("qti-response-processing")],At);var et=class extends v{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};et=l([g("qti-rule")],et);var vr=class extends et{get childExpression(){return this.firstElementChild}process(){let e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getVariable(e),r;return t.interpolationTable&&(r=t.interpolationTable.get(parseInt(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:we(r)}})),r)}};l([p({type:String})],vr.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",vr);var Jr=class extends et{render(){return h`<slot></slot>`}process(){let e=[...this.children];for(let t=0;t<e.length;t++){let r=e[t];if(r.calculate()){r.process();return}}}};customElements.define("qti-response-condition",Jr);var Qr=class extends et{process(){let e=this.getAttribute("identifier"),t=this.firstElementChild,i=new ti(t).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:e,value:Array.isArray(i)?i.map(o=>we(o)):we(i)}}))}},ti=class{constructor(e){this.expression=e}process(){let e=this.expression?this.expression.calculate():null;if(e==null){console.warn("setOutcomeValue: value is null or undefined");return}return e}};customElements.define("qti-set-outcome-value",Qr);var Se=class extends v{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let e=this.getSubRules();for(let t=0;t<e.length;t++)e[t].process()}};customElements.define("qti-response-else",Se);var Re=class extends Se{calculate(){return this.firstElementChild.calculate()}getSubRules(){let e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}};customElements.define("qti-response-if",Re);var ei=class extends Re{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",ei);var _=class extends v{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(t=>{switch(t.tagName.toLowerCase()){case"qti-base-value":return{baseType:t.getAttribute("base-type"),value:t.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=t.getAttribute("identifier")||"";return this.context.variables.find(o=>o.identifier===r)||null}case"qti-multiple":{let i=t.getResult();return i.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(o=>o.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=t.getAttribute("identifier")||"",i=this.context.variables.find(o=>o.identifier===r)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:t.getResult().toString(),cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(t=>t!==null)}render(){return h`<pre>${JSON.stringify(this.result,null,2)}</pre>
3749
- <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};_.styles=b`
3939
+ `],Ae=l([g("qti-response-processing")],Ae);var te=class extends v{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};te=l([g("qti-rule")],te);var yr=class extends te{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.closest("qti-assessment-item").getVariable(t),r;return e.interpolationTable&&(r=e.interpolationTable.get(parseInt(this.childExpression.calculate()))),r==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:xt(r)}})),r)}};l([p({type:String})],yr.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",yr);var Jr=class extends te{render(){return h`<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",Jr);var Qr=class extends te{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,i=new ei(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(i)?i.map(o=>xt(o)):xt(i)}}))}},ei=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",Qr);var Tt=class extends v{render(){return h`<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",Tt);var At=class extends Tt{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",At);var ti=class extends At{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",ti);var C=class extends v{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.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.context.variables.find(o=>o.identifier===r)||null}case"qti-multiple":{let i=e.getResult();return i.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(o=>o.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context.variables.find(o=>o.identifier===r)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return h`<pre>${JSON.stringify(this.result,null,2)}</pre>
3940
+ <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};C.styles=b`
3750
3941
  slot {
3751
3942
  display: none;
3752
3943
  }
3753
- `,l([w()],_.prototype,"result",2),l([T({context:$,subscribe:!0}),w()],_.prototype,"context",2);var H=class extends _{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var yr=class extends Io(H){calculate(){return this.calculateChildren(Array.from(this.children))}};function Io(s){return class extends s{calculateChildren(t){return t.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}customElements.define("qti-and",yr);var xr=class extends _{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};l([p({type:String,attribute:"base-type"})],xr.prototype,"baseType",2);customElements.define("qti-base-value",xr);var ri=class extends H{getResult(){let e=this.getVariables();if(this.children.length===2){let t=e[0],r=e[1];if(t.baseType==="directedPair"&&r.baseType==="directedPair"&&t.cardinality==="multiple"){let i=t.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(t.baseType==="directedPair"&&r.baseType==="directedPair"&&t.cardinality==="single"){let i=t.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",ri);var ii=class extends _{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let e=this.getAttribute("identifier")||"",t=this.context.variables.find(r=>r.identifier===e)||null;return t.cardinality!=="single"?t.correctResponse.length>0?t.correctResponse[0]:"":t.correctResponse}};customElements.define("qti-correct",ii);var qr=class extends _{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 t=this.getVariables(),r=t[0],i=t[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let o=parseFloat(r.value),n=parseFloat(i.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}};l([p({type:String})],qr.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",qr);var V=class{static compareSingleValues(e,t,r){switch(r){case"identifier":case"string":return e===t;case"integer":{let i=parseInt(e,10),o=parseInt(t,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${e} and/or ${t} to int.`);break}case"float":{let i=parseFloat(e),o=parseFloat(t);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${e} and/or ${t} to float.`);break}case"pair":case"directedPair":{let i=e.split(" ").sort(),o=t.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${e} 2: ${t}`);break}}return!1}};var wr=class extends _{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let t=this.getVariables(),r=t[0],i=t[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):V.compareSingleValues(r.value,i.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([p({type:String})],wr.prototype,"toleranceMode",2);customElements.define("qti-equal",wr);var si=class extends _{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if((t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+t.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",si);var oi=class extends H{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return(t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+t.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",oi);var ni=class extends _{getResult(){if(this.children.length===1){let e=this.getVariables();if(!e)return!0;let t=e[0].value;return t==null||t==null||t===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ni);var ai=class extends _{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if((t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+t.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",ai);var li=class extends H{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return(t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+t.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",li);var Er=class extends _{getResult(){let e=this.context.variables.find(o=>o.identifier===this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],i=0;for(let o of r){let n=t.mapEntries.find(a=>V.compareSingleValues(a.mapKey,o,e.baseType));n==null||n.mappedValue==null?i+=t.defaultValue:i+=n.mappedValue}return t.lowerBound!=null&&(i=Math.max(t.lowerBound,i)),t.upperBound!=null&&(i=Math.min(t.upperBound,i)),i}};l([p({type:String})],Er.prototype,"identifier",2);customElements.define("qti-map-response",Er);var Xt=class extends v{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(t=>({mapKey:t.getAttribute("map-key"),mappedValue:+t.getAttribute("mapped-value")}))}};l([p({attribute:"default-value",type:Number})],Xt.prototype,"defaultValue",2),l([p({attribute:"lower-bound",type:Number})],Xt.prototype,"lowerBound",2),l([p({attribute:"upper-bound",type:Number})],Xt.prototype,"upperBound",2);customElements.define("qti-mapping",Xt);var ci=class s extends _{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return s.match(t,r)}return console.error("unexpected number of children in match"),null}static match(e,t){switch(t.cardinality){case"single":return e.value===null?!1:Array.isArray(e.value)||Array.isArray(t.value)?(console.error("unexpected cardinality in qti match"),!1):V.compareSingleValues(e.value?.toString(),t.value.toString(),t.baseType);case"ordered":{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;for(let r=0;r<e.value.length;r++)if(!V.compareSingleValues(t.value[r],e.value[r],t.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;let r=0;for(let i of t.value){let o=null,n=[...e.value];for(let a of n)if(V.compareSingleValues(i,a,t.baseType)){o=a;break}if(o!==null)n.splice(n.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",ci);var di=class extends _{getResult(){let e=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[t,r]=e;if(t.baseType===r.baseType||t.baseType==="integer"&&r.baseType==="float"||t.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(t.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(t.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),t.value===null||r.value===null)return null;let i=t.value;return r.value.includes(i)}};customElements.define("qti-member",di);var pi=class extends _{getResult(){let e=this.getVariables();if(e.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let t of e)if(t.cardinality!=="multiple"&&t.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return e}};customElements.define("qti-multiple",pi);var hi=class extends _{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",hi);var ui=class extends H{getResult(){return Array.from(this.children).map(t=>{let r=t;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(t=>typeof t=="boolean"&&t)}};customElements.define("qti-or",ui);var mi=class extends _{getResult(){let e=this.getVariables();if(e.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let t of e)if(t.cardinality!=="ordered"&&t.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return e}};customElements.define("qti-ordered",mi);var Me=class extends v{render(){let e=this.context?.variables.find(t=>t.identifier===this.identifier)?.value;return h`${JSON.stringify(e,null,2)}`}calculate(){return this.context.variables.find(t=>t.identifier===this.identifier)||null}};l([p({type:String})],Me.prototype,"identifier",2),l([T({context:$,subscribe:!0}),w()],Me.prototype,"context",2);customElements.define("qti-printed-variable",Me);var gi=class extends _{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseInt(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};customElements.define("qti-product",gi);var Cr=class extends No(_){getResult(){return this.calculateChildren(Array.from(this.children))}};function No(s){return class extends s{calculateChildren(t){let r=t.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}customElements.define("qti-subtract",Cr);var _r=class extends _{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),r=t[0],i=t[1];if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.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"?i.value:i.value.toLowerCase();return V.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([p({type:String,attribute:"case-sensitive"})],_r.prototype,"caseSensitive",2);customElements.define("qti-string-match",_r);var fi=class extends _{constructor(){super(),this._expression=new bi(Array.from(this.children))}getResult(){return this._expression.calculate()}},bi=class{constructor(e){this.expressions=e}calculate(){return this.expressions.map(t=>{if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((t,r)=>t+r,0)}};customElements.define("qti-sum",fi);var vi=class extends _{getResult(){let e=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===e).value}};customElements.define("qti-variable",vi);var St=class extends C{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(t,r)=>{t=this.removeDoubleSlashes(t);try{let i=await fetch(t);if(i.ok){let n=await i.json();for(let a in n.paths)r&&(n.paths[a]=this.getResolvablePath(n.paths[a],r));return n}}catch{}return null};this.getResolvablePathString=(t,r)=>(t=t.replace(/\.js$/,""),t?.toLocaleLowerCase().startsWith("http")||!r?t:this.removeDoubleSlashes(`${r}/${t}`));this.getResolvablePath=(t,r)=>Array.isArray(t)?t.map(i=>this.getResolvablePathString(i,r)):this.getResolvablePathString(t,r)}convertQtiVariableJSON(t){for(let r in t)if(t.hasOwnProperty(r)){let i=t[r];if(i){for(let o in i)if(i.hasOwnProperty(o)){let n=i[o];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let t=this.pci.getResponse(),r=this.pci.getResponse(),i=JSON.stringify(t);if(i!==this.rawResponse){this.rawResponse=i;let o=this.convertQtiVariableJSON(r);this.value=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set value(t){}get value(){return this.rawResponse}getTAOConfig(t){let r=t.querySelectorAll("properties"),i={},o=a=>{let c={},d=a.getAttribute("key");if(d){let u=Array.from(a.children),m=u.map(y=>y.getAttribute("key"));m.length>0&&!m.find(y=>!Number.isInteger(+y))?c[d]=u.map(y=>n(y)):c[d]=a.textContent}return c},n=a=>{if(a){let c={};for(let d of a.children)c={...c,...o(d)};return c}};for(let a of r)return a.getAttribute("key")||(i={...i,...n(a)}),i;return console.log("Can not find qti-custom-interaction config"),null}register(t){this.pci=t;let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",i=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.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"?t.getInstance(i,o,void 0):t.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,i.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let t=this.buildRequireConfig();requirejs.config(t)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let t=requirejs.s.contexts;delete t[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let t={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let r=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let o=i.querySelectorAll("qti-interaction-module");for(let n of o){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),d=n.getAttribute("fallback-path");if(a&&c){let u=d?this.combineRequireResolvePaths(this.getResolvablePath(c,r),this.getResolvablePath(d,r)):this.getResolvablePath(c,r),m=t.paths[a]||[];t.paths[a]=this.combineRequireResolvePaths(m,u)}}}return t}combineRequireResolvePaths(t,r){let i=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];return i.concat(o)}removeDoubleSlashes(t){return t.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return h`<slot></slot>${this._errorMessage&&h`<div style="color:red">
3944
+ `,l([q()],C.prototype,"result",2),l([T({context:$,subscribe:!0}),q()],C.prototype,"context",2);var O=class extends C{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var xr=class extends Io(O){calculate(){return this.calculateChildren(Array.from(this.children))}};function Io(s){return class extends s{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}customElements.define("qti-and",xr);var qr=class extends C{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};l([p({type:String,attribute:"base-type"})],qr.prototype,"baseType",2);customElements.define("qti-base-value",qr);var ri=class extends O{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 i=e.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",ri);var ii=class extends C{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",ii);var wr=class extends C{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],i=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.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(i.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}};l([p({type:String})],wr.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",wr);var V=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.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 Er=class extends C{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):V.compareSingleValues(r.value,i.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([p({type:String})],Er.prototype,"toleranceMode",2);customElements.define("qti-equal",Er);var si=class extends C{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",si);var oi=class extends O{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",oi);var ni=class extends C{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",ni);var ai=class extends C{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",ai);var li=class extends O{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",li);var Cr=class extends C{getResult(){let t=this.context.variables.find(o=>o.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let n=e.mapEntries.find(a=>V.compareSingleValues(a.mapKey,o,t.baseType));n==null||n.mappedValue==null?i+=e.defaultValue:i+=n.mappedValue}return e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([p({type:String})],Cr.prototype,"identifier",2);customElements.define("qti-map-response",Cr);var Be=class extends v{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")}))}};l([p({attribute:"default-value",type:Number})],Be.prototype,"defaultValue",2),l([p({attribute:"lower-bound",type:Number})],Be.prototype,"lowerBound",2),l([p({attribute:"upper-bound",type:Number})],Be.prototype,"upperBound",2);customElements.define("qti-mapping",Be);var ci=class s extends C{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return s.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){switch(e.cardinality){case"single":return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):V.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!V.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let o=null,n=[...t.value];for(let a of n)if(V.compareSingleValues(i,a,e.baseType)){o=a;break}if(o!==null)n.splice(n.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",ci);var di=class extends C{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};customElements.define("qti-member",di);var pi=class extends C{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",pi);var hi=class extends C{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",hi);var ui=class extends O{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ui);var mi=class extends C{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",mi);var St=class extends v{render(){let t=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return h`${JSON.stringify(t,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};l([p({type:String})],St.prototype,"identifier",2),l([T({context:$,subscribe:!0}),q()],St.prototype,"context",2);customElements.define("qti-printed-variable",St);var gi=class extends C{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseInt(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};customElements.define("qti-product",gi);var _r=class extends No(C){getResult(){return this.calculateChildren(Array.from(this.children))}};function No(s){return class extends s{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}customElements.define("qti-subtract",_r);var kr=class extends C{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.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"?i.value:i.value.toLowerCase();return V.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([p({type:String,attribute:"case-sensitive"})],kr.prototype,"caseSensitive",2);customElements.define("qti-string-match",kr);var fi=class extends C{constructor(){super(),this._expression=new bi(Array.from(this.children))}getResult(){return this._expression.calculate()}},bi=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",fi);var vi=class extends C{getResult(){let t=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===t).value}};customElements.define("qti-variable",vi);var Se=class extends E{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)r&&(n.paths[a]=this.getResolvablePath(n.paths[a],r));return n}}catch{}return null};this.getResolvablePathString=(e,r)=>(e=e.replace(/\.js$/,""),e?.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`));this.getResolvablePath=(e,r)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,r)):this.getResolvablePathString(e,r)}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];if(i){for(let o in i)if(i.hasOwnProperty(o)){let n=i[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(),i=JSON.stringify(e);if(i!==this.rawResponse){this.rawResponse=i;let o=this.convertQtiVariableJSON(r);this.value=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set value(e){}get value(){return this.rawResponse}getTAOConfig(e){let r=e.querySelectorAll("properties"),i={},o=a=>{let c={},d=a.getAttribute("key");if(d){let u=Array.from(a.children),m=u.map(y=>y.getAttribute("key"));m.length>0&&!m.find(y=>!Number.isInteger(+y))?c[d]=u.map(y=>n(y)):c[d]=a.textContent}return c},n=a=>{if(a){let c={};for(let d of a.children)c={...c,...o(d)};return c}};for(let a of r)return a.getAttribute("key")||(i={...i,...n(a)}),i;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",i=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.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(i,o,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,i.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let r=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let o=i.querySelectorAll("qti-interaction-module");for(let n of o){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),d=n.getAttribute("fallback-path");if(a&&c){let u=d?this.combineRequireResolvePaths(this.getResolvablePath(c,r),this.getResolvablePath(d,r)):this.getResolvablePath(c,r),m=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(m,u)}}}return e}combineRequireResolvePaths(e,r){let i=Array.isArray(e)?e:[e],o=Array.isArray(r)?r:[r];return i.concat(o)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return h`<slot></slot>${this._errorMessage&&h`<div style="color:red">
3754
3945
  <h1>Error</h1>
3755
3946
  ${this._errorMessage}
3756
- </div>`}`}};l([p({type:String,attribute:"module"})],St.prototype,"module",2),l([p({type:String,attribute:"custom-interaction-type-identifier"})],St.prototype,"customInteractionTypeIdentifier",2),l([w()],St.prototype,"_errorMessage",2),St=l([g("qti-portable-custom-interaction")],St);var kr=class s{constructor(){this.touchStartTime=0;this.touchStartPoint=null;this.lastClickTime=0;this.isDraggable=!1;this.dragSource=null;this.dragClone=null;this.touchEndTriggered=!1;this.isDragging=!1;this.initialTransform="";this.hasDispatchedDragStart=!1;this.rootNode=null;this.allDropzones=[];this.dataTransfer={data:{},setData(e,t){this.data[e]=t},getData(e){return this.data[e]},effectAllowed:"move"};this.cloneOffset={x:0,y:0};this.lastTarget=null;this.currentDropTarget=null;this.allowClick=!0;this.copyStylesForDragClone=!0;this.dragOnClickEnabled=!1;this.useDragClone=!1;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;if(s.instance)return s.instance;s.instance=this,document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1})}addDraggableElements(e){e.forEach(t=>{t.setAttribute("tabindex","0"),t.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),t.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1})})}getInteraction(e){let t=e;for(;t&&!t.tagName.toLocaleLowerCase().endsWith("-interaction");)t=t.parentElement;return t}handleTouchStart(e){this.touchStartTime=Date.now();let{x:t,y:r}=this.getEventCoordinates(e);if(this.touchStartPoint={x:t,y:r},this.dragSource=e.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode(),this.dragOnClickEnabled&&(this.isDragging=!0,this.createDragClone(e,{clientX:t,clientY:r})),!this.useDragClone){let i=window.getComputedStyle(this.dragSource);this.initialTransform=i.transform==="none"?"":i.transform,this.initialTransition=i.transition||"",this.dragSource.style.transition="none";let o=this.dragSource.getBoundingClientRect();this.cloneOffset.x=t-o.left,this.cloneOffset.y=r-o.top,this.dragSource.style.zIndex="9999",this.dragSource.focus()}e.preventDefault()}handleTouchMove(e){if(this.isDraggable&&this.dragSource){let t=this.getInteraction(this.dragSource);this.allDropzones=[...Array.from(t.querySelectorAll("[dropzone]")),...Array.from(t.shadowRoot?.querySelectorAll("[dropzone]"))];let{x:r,y:i}=this.getEventCoordinates(e),o={clientX:r,clientY:i};this.calculateDragDistance(o)>=this.MIN_DRAG_DISTANCE&&(this.dragSource.style.pointerEvents="none",this.isDragging=!0),this.createDragClone(e,o),e.preventDefault();let n=this.findClosestDropzone();this.currentDropTarget=n,n!==this.lastTarget&&(this.lastTarget&&this.dispatchCustomEvent(this.lastTarget,"dragleave"),n&&this.dispatchCustomEvent(n,"dragenter"),this.lastTarget=n),this.lastTarget&&this.dispatchCustomEvent(this.lastTarget,"dragover")}}createDragClone(e,t){if(!this.isDragging)return;if(this.useDragClone){if(!this.dragClone){if(this.dragSource.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone=this.dragSource.cloneNode(!0),this.copyStylesForDragClone){let i=window.getComputedStyle(this.dragSource);for(let o of i)this.dragClone.style[o]=i.getPropertyValue(o)}this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),this.calculateClonePosition(t),this.setDragCloneStyles(t),this.dispatchCustomEvent(this.dragSource,"dragstart")}this.updateDragClonePosition(t)}else if(this.touchStartPoint){let i=t.clientX-this.touchStartPoint.x,o=t.clientY-this.touchStartPoint.y;this.dragSource.style.transform=`${this.initialTransform} translate(${i}px, ${o}px)`,this.hasDispatchedDragStart||(this.dispatchCustomEvent(this.dragSource,"dragstart"),this.hasDispatchedDragStart=!0)}let r=this.currentDropTarget;r!==this.lastTarget&&(this.dispatchCustomEvent(r,"dragenter"),this.dispatchCustomEvent(this.lastTarget,"dragleave"),this.lastTarget=r),this.currentDropTarget=r,this.currentDropTarget&&this.dispatchCustomEvent(r,"dragover")}handleTouchEnd(e){this.allDropzones=[],this.touchEndTriggered=!0,this.isDraggable=!1;let t=!1;if(this.currentDropTarget)this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),t=!0;else if(this.isDragging){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},this.dragSource?.dispatchEvent(r)}this.resetDragState(t)}handleTouchCancel(e){this.resetDragState()}findClosestDropzone(){if(!this.dragSource||this.allDropzones.length===0)return null;let e=this.dragSource.getBoundingClientRect(),t=this.getCorners(e),r=this.getCenter(e),i=null,o=1/0;for(let n of this.allDropzones){let a=n.getBoundingClientRect(),c=this.getCorners(a),d=this.getCenter(a),u=this.calculateTotalCornerDistance(t,c)/this.getRectDiagonal(a),m=this.calculateDistance(r,d),f=u*.5+m*.5;f<o&&(o=f,i=n)}return i}getCenter(e){return{x:e.left+e.width/2,y:e.top+e.height/2}}getRectDiagonal(e){return Math.sqrt(e.width**2+e.height**2)}getCorners(e){return{topLeft:{x:e.left,y:e.top},topRight:{x:e.right,y:e.top},bottomLeft:{x:e.left,y:e.bottom},bottomRight:{x:e.right,y:e.bottom}}}calculateTotalCornerDistance(e,t){return this.calculateDistance(e.topLeft,t.topLeft)+this.calculateDistance(e.topRight,t.topRight)+this.calculateDistance(e.bottomLeft,t.bottomLeft)+this.calculateDistance(e.bottomRight,t.bottomRight)}calculateDistance(e,t){let r=e.x-t.x,i=e.y-t.y;return Math.sqrt(r*r+i*i)}findDropTarget(e){let{x:t,y:r}=this.getEventCoordinates(e);return this.getDropTargetAtPoint(document,t,r)}getDropTargetAtPoint(e,t,r,i=0){if(i>2)return null;let n=e.elementFromPoint(t,r);if(!n)return null;if(n.hasAttribute("dropzone"))return n;let a=n.parentElement;for(;a;){if(a.hasAttribute("dropzone"))return a;a=a.parentElement}if(n.shadowRoot&&i<2){let c=this.getDropTargetAtPoint(n.shadowRoot,t,r,i+1);if(c)return c}return null}getEventCoordinates(e,t=!1){let r=e.touches?e.touches[0]:e;return{x:t?r.pageX:r.clientX,y:t?r.pageY:r.clientY}}calculateClonePosition(e){let t=this.dragSource.getBoundingClientRect();this.cloneOffset.x=e.clientX-t.left,this.cloneOffset.y=e.clientY-t.top}setDragCloneStyles(e){this.dragClone.style.position="fixed",this.dragClone.style.top=`${e.clientY-this.cloneOffset.y}px`,this.dragClone.style.left=`${e.clientX-this.cloneOffset.x}px`,this.dragClone.style.pointerEvents="none",this.dragClone.style.zIndex="999999"}updateDragClonePosition(e){requestAnimationFrame(()=>{if(this.touchEndTriggered||!this.dragClone)return;let t=e.clientX-this.cloneOffset.x,r=e.clientY-this.cloneOffset.y,{newLeft:i,newTop:o}=this.applyBoundaries(t,r,this.dragClone);this.dragClone.style.left=`${i}px`,this.dragClone.style.top=`${o}px`})}applyBoundaries(e,t,r){let i;this.rootNode instanceof ShadowRoot?i=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?i=document.documentElement.getBoundingClientRect():i=new DOMRect(0,0,window.innerWidth,window.innerHeight);let o=r.getBoundingClientRect(),n=o.width,a=o.height,c=Math.max(i.left,Math.min(e,i.right-n)),d=Math.max(i.top,Math.min(t,i.bottom-a));return{newLeft:c,newTop:d}}calculateDragDistance(e){let t=Math.abs(e.clientX-this.touchStartPoint.x),r=Math.abs(e.clientY-this.touchStartPoint.y);return t+r}dispatchCustomEvent(e,t,r=!0){if(!e)return;let i=new CustomEvent(t,{bubbles:r,cancelable:!0});i.dataTransfer=this.dataTransfer,e.dispatchEvent(i)}resetDragState(e=!1){this.isDragging&&(this.useDragClone?(this.dragSource.style.opacity="1.0",this.dragClone?.parentElement.removeChild(this.dragClone)):(e||(this.dragSource.style.transform="translate(0, 0)"),this.dragSource.style.zIndex="",this.dragSource.style.pointerEvents="",this.dragSource.style.transition=this.initialTransition,this.initialTransition="")),this.isDragging=!1,this.dragSource=null,this.dragClone=null,this.isDraggable=!1,this.touchStartTime=0,this.touchStartPoint=null,this.touchEndTriggered=!1,this.allDropzones=[],this.dataTransfer={data:{},setData(t,r){this.data[t]=r},getData(t){return this.data[t]},effectAllowed:"move"},this.cloneOffset={x:0,y:0},this.lastTarget=null,this.currentDropTarget=null,this.allowClick=!0,this.initialTransform="",this.hasDispatchedDragStart=!1,this.rootNode=null}};var Ls=(s,e,t)=>{class r extends s{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.isMatchTabular())return;super.firstUpdated(n);let a=this.getDroppableElements();this.initializeEventHandlers(),a.forEach(c=>{this.prepareDroppable(c),this.observeDroppableAttributes(c)})}isMatchTabular(){return this.classList.contains("qti-match-tabular")}getDroppableElements(){return Array.from(e?this.shadowRoot.querySelectorAll(t):this.querySelectorAll(t))}initializeEventHandlers(){this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this)}prepareDroppable(n){n.setAttribute("dropzone","move"),n.addEventListener("dragleave",this.dragleaveHandler),this.attachEventListeners(n)}observeDroppableAttributes(n){this.observer=new MutationObserver(a=>{a.forEach(({attributeName:c})=>{c==="disabled"&&this.toggleDroppableHandlers(n)})}),this.observer.observe(n,{attributes:!0})}toggleDroppableHandlers(n){n.hasAttribute("disabled")?this.removeEventListeners(n):this.attachEventListeners(n)}attachEventListeners(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeEventListeners(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){this.isMatchTabular()||(super.disconnectedCallback(),this.observer?.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){let a=n.dataTransfer.getData("responseIdentifier");return n.preventDefault(),a===this.responseIdentifier&&(this.activateDroppable(n.currentTarget),n.dataTransfer.dropEffect="move"),!1}activateDroppable(n){this._internals.states.delete("--dragzone-active"),n.setAttribute("active","")}async dropHandler(n){n.preventDefault();let a=n.currentTarget,c=n.dataTransfer.getData("text"),d=n.dataTransfer.getData("responseIdentifier"),u=this.findDraggable(d,c);return u?u&&!this.isValidDrop(a,u,d)?(u.style.transform="translate(0, 0)",!1):(await this.moveDraggableToDroppable(u,a),this.deactivateDroppable(a,!1),!1):!1}findDraggable(n,a){return a?n===this.responseIdentifier?this.querySelector(`[identifier=${a}]`)||this.shadowRoot.querySelector(`[identifier=${a}]`):this.closest("qti-assessment-item").querySelector(`[response-identifier=${n}]`).querySelector(`[identifier=${a}]`):null}isValidDrop(n,a,c){return this.responseIdentifier===c}async moveDraggableToDroppable(n,a){let c=()=>{n.style.transform="translate(0, 0)",a.appendChild(n),this.checkMaxAssociations(),this.saveResponse(null)};if(!document.startViewTransition){c();return}await document.startViewTransition(c).finished}deactivateDroppable(n,a=!0){a&&this._internals.states.add("--dragzone-active"),n.removeAttribute("active")}dragleaveHandler(n){return n.preventDefault(),this.deactivateDroppable(n.currentTarget),n.dataTransfer.dropEffect="none",!1}}return l([p({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var $s=(s,e,t)=>{class r extends s{}return r};var rt=(s,e,t,r)=>{class i extends $s(Ls(s,t,r),r,e){constructor(){super(...arguments);this.draggables=new Map;this.droppables=[];this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),this.responseIdentifier&&a.dataTransfer.setData("responseIdentifier",this.responseIdentifier),this._internals.states.add("--dragzone-enabled"),c.setAttribute("dragging",""),this.activateDragLocation(),this.activateDroppables(c)};this.handleDragEnd=async a=>{a.preventDefault(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables();let c=a.currentTarget;c.removeAttribute("dragging"),await this.wasDropped(a)||this.configuration.dragCanBePlacedBack&&this.restoreInitialDraggablePosition(c)}}handleDraggablesChange(a,c){if(this.isMatchTabular())return;let d=this.filterExistingDraggables(a);d.length>0&&this.addNewDraggables(d)}firstUpdated(a){super.firstUpdated(a),this.initializeDroppables()}connectedCallback(){super.connectedCallback(),this.initializeDragDropApi()}initializeDragDropApi(){this.dragDropApi=new kr,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}isMatchTabular(){return this.classList.contains("qti-match-tabular")}filterExistingDraggables(a){return a.filter(c=>!this.draggables.has(c))}addNewDraggables(a){this.dragDropApi.addDraggableElements(a),a.forEach(c=>this.storeDraggable(c))}storeDraggable(a){let c=Array.from(a.parentNode.children).indexOf(a);this.draggables.set(a,{parent:a.parentElement,index:c}),a.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")||crypto.randomUUID()}`,a.setAttribute("qti-draggable","true"),a.addEventListener("dragstart",this.handleDragStart),a.addEventListener("dragend",this.handleDragEnd)}initializeDroppables(){this.droppables=Array.from(t?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r));let a=this.dataset.choicesContainerWidth;a&&this.droppables.forEach(c=>{c.style.width=`${a}px`,c.style.boxSizing="border-box"})}getDragContainers(){let a=Array.from(this.querySelectorAll("[part='drags']")||[]),c=this.shadowRoot?Array.from(this.shadowRoot.querySelectorAll("[part='drags']")||[]):[];return a.concat(c)}activateDroppables(a){this.getDragContainers().forEach(d=>{d.setAttribute("enabled",""),d.setAttribute("dropzone","move"),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&(d.removeAttribute("disabled"),d.setAttribute("dropzone","move"))}),this.droppables.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&(d.removeAttribute("disabled"),d.setAttribute("dropzone","move"))})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.getDragContainers().forEach(c=>{c.removeAttribute("enabled")}),this.droppables.forEach(c=>c.removeAttribute("enabled"))}async wasDropped(a){return a.dataTransfer.dropEffect!=="none"}wasMoved(a){return a.dataTransfer.dropEffect==="move"}async restoreInitialDraggablePosition(a){let{parent:c,index:d}=this.draggables.get(a),u=Math.min(d,c.children.length),m=(y,x,q)=>{let A=Math.min(q,x.children.length);x.insertBefore(y,x.children[A]),y.style.transform="translate(0, 0)",this.checkMaxAssociations()};if(!document.startViewTransition){m(a,c,d);return}let f=document.startViewTransition(()=>{a.style.transform="",m(a,c,d)})}validate(){let a=this.getValidAssociations(),c=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(c=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(c=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let u=this.lastElementChild;return this._internals.setValidity(c?{}:{customError:!0},d,u),this.reportValidity(),c}reportValidity(){let a=this.shadowRoot.querySelector("#validationMessage");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.display="block")),this._internals.validity.valid}checkMaxAssociations(){this.droppables.forEach((a,c)=>{let d=+(a.getAttribute("match-max")||1);a.querySelectorAll('[qti-draggable="true"]').length>=d?this.disableDroppable(a):this.enableDroppable(a)})}disableDroppable(a){a.setAttribute("disabled",""),a.removeAttribute("dropzone")}enableDroppable(a){a.removeAttribute("disabled"),a.setAttribute("dropzone","move")}get value(){return this.collectResponseData()}set value(a){if(!this.isMatchTabular())if(this.resetDroppables(),a?.forEach(c=>this.placeResponse(c)),Array.isArray(a)){let c=new FormData;a.forEach(d=>{c.append(this.responseIdentifier,d)}),this._internals.setFormValue(c)}else this._internals.setFormValue(a)}placeResponse(a){let[c,...d]=a.split(" ").reverse(),u=this.findDroppableById(c);d.forEach(m=>this.placeDraggableInDroppable(m,u))}findDroppableById(a){return this.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let d=this.querySelector(`[identifier=${a}]`);if(!c||!d){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let u=()=>{d.style.transform="translate(0, 0)",c.appendChild(d),this.checkMaxAssociations()};document.startViewTransition?await document.startViewTransition(u).finished:u()}getValidAssociations(){return this.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){this.validate();let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(c=>{let d=c.querySelectorAll('[qti-draggable="true"]'),u=Array.from(d).map(f=>f.getAttribute("identifier")),m=c.getAttribute("identifier");return u.map(f=>`${f} ${m}`)}).flat()}reset(a=!0){this.resetDroppables(),a&&this.saveResponse()}async resetDroppables(){let a=(d,u,m)=>{d.style.transform="translate(0, 0)";let f=Math.min(m,u.children.length);u.insertBefore(d,u.children[f])};if(!document.startViewTransition){this.draggables.forEach(({parent:d,index:u},m)=>{a(m,d,u)});return}await document.startViewTransition(()=>{this.draggables.forEach(({parent:d,index:u},m)=>{a(m,d,u)})}).finished}}return l([p({attribute:!1,type:Object})],i.prototype,"configuration",2),l([p({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([p({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([ts(e)],i.prototype,"handleDraggablesChange",1),i};var Ds=b`
3947
+ </div>`}`}};l([p({type:String,attribute:"module"})],Se.prototype,"module",2),l([p({type:String,attribute:"custom-interaction-type-identifier"})],Se.prototype,"customInteractionTypeIdentifier",2),l([q()],Se.prototype,"_errorMessage",2),Se=l([g("qti-portable-custom-interaction")],Se);var Tr=class s{constructor(){this.draggables=[];this.droppables=[];this.dragContainers=[];this.touchStartPoint=null;this.isDraggable=!1;this.dragSource=null;this.dragClone=null;this.touchEndTriggered=!1;this.isDragging=!1;this.initialTransform="";this.hasDispatchedDragStart=!1;this.rootNode=null;this.allDropzones=[];this.dataTransfer={data:{},setData(t,e){this.data[t]=e},getData(t){return this.data[t]},effectAllowed:"move"};this.cloneOffset={x:0,y:0};this.lastTarget=null;this.currentDropTarget=null;this.copyStylesForDragClone=!0;this.dragOnClickEnabled=!1;this.useDragClone=!1;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;if(s.instance)return s.instance;s.instance=this,document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1})}dragContainersModified(t,e){for(let r of e)this.dragContainers.includes(r)&&(this.dragContainers=this.dragContainers.filter(i=>i!==r),this.allDropzones=this.allDropzones.filter(i=>i!==r));for(let r of t)this.dragContainers.includes(r)||(this.dragContainers.push(r),this.allDropzones.push(r))}draggablesModified(t,e){for(let r of e)this.draggables.includes(r)&&(this.draggables=this.draggables.filter(i=>i!==r),r.removeAttribute("tabindex"),r.removeEventListener("touchstart",this.handleTouchStart.bind(this)),r.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let r of t)this.draggables.includes(r)||(this.draggables.push(r),r.setAttribute("tabindex","0"),r.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),r.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}))}droppablesModified(t,e){for(let r of e)this.droppables.includes(r)&&(this.droppables=this.droppables.filter(i=>i!==r),this.allDropzones=this.allDropzones.filter(i=>i!==r));for(let r of t)this.droppables.includes(r)||(this.droppables.push(r),this.allDropzones.push(r))}handleTouchStart(t){let{x:e,y:r}=this.getEventCoordinates(t);if(this.touchStartPoint={x:e,y:r},this.dragSource=t.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode(),this.dragOnClickEnabled&&(this.isDragging=!0,this.createDragClone(t,{clientX:e,clientY:r})),!this.useDragClone){let i=window.getComputedStyle(this.dragSource);this.initialTransform=i.transform==="none"?"":i.transform,this.initialTransition=i.transition||"",this.dragSource.style.transition="none";let o=this.dragSource.getBoundingClientRect();this.cloneOffset.x=e-o.left,this.cloneOffset.y=r-o.top,this.dragSource.style.zIndex="9999",this.dragSource.focus()}t.preventDefault()}handleTouchMove(t){if(this.isDraggable&&this.dragSource){let{x:e,y:r}=this.getEventCoordinates(t),i={clientX:e,clientY:r};this.calculateDragDistance(i)>=this.MIN_DRAG_DISTANCE&&(this.dragSource.style.pointerEvents="none",this.isDragging=!0),this.createDragClone(t,i),t.preventDefault();let o=this.findClosestDropzone();this.currentDropTarget=o,o!==this.lastTarget&&(this.lastTarget&&this.dispatchCustomEvent(this.lastTarget,"dragleave"),o&&this.dispatchCustomEvent(o,"dragenter"),this.lastTarget=o),this.lastTarget&&this.dispatchCustomEvent(this.lastTarget,"dragover")}}createDragClone(t,e){if(!this.isDragging)return;if(this.useDragClone){if(!this.dragClone){if(this.dragSource.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone=this.dragSource.cloneNode(!0),this.copyStylesForDragClone){let i=window.getComputedStyle(this.dragSource);for(let o of i)this.dragClone.style[o]=i.getPropertyValue(o)}this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),this.calculateClonePosition(e),this.setDragCloneStyles(e),this.dispatchCustomEvent(this.dragSource,"dragstart")}this.updateDragClonePosition(e)}else if(this.touchStartPoint){let i=e.clientX-this.touchStartPoint.x,o=e.clientY-this.touchStartPoint.y;this.dragSource.style.transform=`${this.initialTransform} translate(${i}px, ${o}px)`,this.hasDispatchedDragStart||(this.dispatchCustomEvent(this.dragSource,"dragstart"),this.hasDispatchedDragStart=!0)}let r=this.currentDropTarget;r!==this.lastTarget&&(this.dispatchCustomEvent(r,"dragenter"),this.dispatchCustomEvent(this.lastTarget,"dragleave"),this.lastTarget=r),this.currentDropTarget=r,this.currentDropTarget&&this.dispatchCustomEvent(r,"dragover")}handleTouchEnd(t){this.touchEndTriggered=!0,this.isDraggable=!1;let e=!1;if(this.currentDropTarget)this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),e=!0;else if(this.isDragging){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},this.dragSource?.dispatchEvent(r)}this.resetDragState(e)}handleTouchCancel(t){this.resetDragState()}findClosestDropzone(){if(!this.dragSource||this.allDropzones.length===0)return null;let t=this.dragSource.getBoundingClientRect(),e=this.getCorners(t),r=this.getCenter(t),i=null,o=1/0;for(let n of this.allDropzones){let a=n.getBoundingClientRect(),c=this.getCorners(a),d=this.getCenter(a),u=this.calculateTotalCornerDistance(e,c)/this.getRectDiagonal(a),m=this.calculateDistance(r,d),f=u*.5+m*.5;f<o&&(o=f,i=n)}return i}getCenter(t){return{x:t.left+t.width/2,y:t.top+t.height/2}}getRectDiagonal(t){return Math.sqrt(t.width**2+t.height**2)}getCorners(t){return{topLeft:{x:t.left,y:t.top},topRight:{x:t.right,y:t.top},bottomLeft:{x:t.left,y:t.bottom},bottomRight:{x:t.right,y:t.bottom}}}calculateTotalCornerDistance(t,e){return this.calculateDistance(t.topLeft,e.topLeft)+this.calculateDistance(t.topRight,e.topRight)+this.calculateDistance(t.bottomLeft,e.bottomLeft)+this.calculateDistance(t.bottomRight,e.bottomRight)}calculateDistance(t,e){let r=t.x-e.x,i=t.y-e.y;return Math.sqrt(r*r+i*i)}getEventCoordinates(t,e=!1){let r=t.touches?t.touches[0]:t;return{x:e?r.pageX:r.clientX,y:e?r.pageY:r.clientY}}calculateClonePosition(t){let e=this.dragSource.getBoundingClientRect();this.cloneOffset.x=t.clientX-e.left,this.cloneOffset.y=t.clientY-e.top}setDragCloneStyles(t){this.dragClone.style.position="fixed",this.dragClone.style.top=`${t.clientY-this.cloneOffset.y}px`,this.dragClone.style.left=`${t.clientX-this.cloneOffset.x}px`,this.dragClone.style.pointerEvents="none",this.dragClone.style.zIndex="999999"}updateDragClonePosition(t){requestAnimationFrame(()=>{if(this.touchEndTriggered||!this.dragClone)return;let e=t.clientX-this.cloneOffset.x,r=t.clientY-this.cloneOffset.y,{newLeft:i,newTop:o}=this.applyBoundaries(e,r,this.dragClone);this.dragClone.style.left=`${i}px`,this.dragClone.style.top=`${o}px`})}applyBoundaries(t,e,r){let i;this.rootNode instanceof ShadowRoot?i=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?i=document.documentElement.getBoundingClientRect():i=new DOMRect(0,0,window.innerWidth,window.innerHeight);let o=r.getBoundingClientRect(),n=o.width,a=o.height,c=Math.max(i.left,Math.min(t,i.right-n)),d=Math.max(i.top,Math.min(e,i.bottom-a));return{newLeft:c,newTop:d}}calculateDragDistance(t){let e=Math.abs(t.clientX-this.touchStartPoint.x),r=Math.abs(t.clientY-this.touchStartPoint.y);return e+r}dispatchCustomEvent(t,e,r=!0){if(!t)return;let i=new CustomEvent(e,{bubbles:r,cancelable:!0});i.dataTransfer=this.dataTransfer,t.dispatchEvent(i)}resetDragState(t=!1){this.isDragging&&(this.useDragClone?(this.dragSource.style.opacity="1.0",this.dragClone?.parentElement.removeChild(this.dragClone)):(t||(this.dragSource.style.transform="translate(0, 0)"),this.dragSource.style.zIndex="",this.dragSource.style.pointerEvents="",this.dragSource.style.transition=this.initialTransition,this.initialTransition="")),this.isDragging=!1,this.dragSource=null,this.dragClone=null,this.isDraggable=!1,this.touchStartPoint=null,this.touchEndTriggered=!1,this.dataTransfer={data:{},setData(e,r){this.data[e]=r},getData(e){return this.data[e]},effectAllowed:"move"},this.cloneOffset={x:0,y:0},this.lastTarget=null,this.currentDropTarget=null,this.initialTransform="",this.hasDispatchedDragStart=!1,this.rootNode=null}};var Ls=(s,t)=>{class e extends s{constructor(){super(...arguments);this.disabled=!1}firstUpdated(o){if(this.isMatchTabular())return;super.firstUpdated(o);let n=this.getDroppableElements();this.initializeEventHandlers(),n.forEach(a=>{this.prepareDroppable(a),this.observeDroppableAttributes(a)})}isMatchTabular(){return this.classList.contains("qti-match-tabular")}getDroppableElements(){return Array.from(this.shadowRoot?.querySelectorAll(t)||[]).concat(Array.from(this.querySelectorAll(t)||[]))}initializeEventHandlers(){this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this)}prepareDroppable(o){o.addEventListener("dragleave",this.dragleaveHandler),this.attachEventListeners(o)}observeDroppableAttributes(o){this.observer=new MutationObserver(n=>{n.forEach(({attributeName:a})=>{a==="disabled"&&this.toggleDroppableHandlers(o)})}),this.observer.observe(o,{attributes:!0})}toggleDroppableHandlers(o){o.hasAttribute("disabled")?this.removeEventListeners(o):this.attachEventListeners(o)}attachEventListeners(o){o.addEventListener("dragover",this.dragoverHandler),o.addEventListener("dragenter",this.dragenterHandler),o.addEventListener("drop",this.dropHandler)}removeEventListeners(o){o.removeEventListener("dragover",this.dragoverHandler),o.removeEventListener("dragenter",this.dragenterHandler),o.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){this.isMatchTabular()||(super.disconnectedCallback(),this.observer?.disconnect())}dragenterHandler(o){o.preventDefault()}dragoverHandler(o){let n=o.dataTransfer.getData("responseIdentifier");return o.preventDefault(),n===this.responseIdentifier&&(this.activateDroppable(o.currentTarget),o.dataTransfer.dropEffect="move"),!1}activateDroppable(o){this._internals.states.delete("--dragzone-active"),o.setAttribute("active","")}async dropHandler(o){o.preventDefault();let n=o.currentTarget,a=o.dataTransfer.getData("text"),c=o.dataTransfer.getData("responseIdentifier"),d=this.findDraggable(c,a);return d?d&&!this.isValidDrop(n,d,c)?(d.style.transform="translate(0, 0)",!1):(await this.moveDraggableToDroppable(d,n),this.deactivateDroppable(n,!1),!1):!1}findDraggable(o,n){return n?o===this.responseIdentifier?this.querySelector(`[identifier=${n}]`)||this.shadowRoot.querySelector(`[identifier=${n}]`):this.closest("qti-assessment-item").querySelector(`[response-identifier=${o}]`).querySelector(`[identifier=${n}]`):null}isValidDrop(o,n,a){return this.responseIdentifier===a}async moveDraggableToDroppable(o,n){console.log(`moveDraggableToDroppable, draggable: ${o.tagName}, droppable: ${n.tagName}`);let a=()=>{o.style.transform="translate(0, 0)",n.tagName==="SLOT"?o.setAttribute("slot",n.getAttribute("name")):n.appendChild(o),this.checkMaxAssociations(),this.saveResponse(null)};if(!document.startViewTransition){a();return}await document.startViewTransition(a).finished}deactivateDroppable(o,n=!0){n&&this._internals.states.add("--dragzone-active"),o.removeAttribute("active")}dragleaveHandler(o){return o.preventDefault(),this.deactivateDroppable(o.currentTarget),o.dataTransfer.dropEffect="none",!1}}return l([p({type:Boolean,reflect:!0})],e.prototype,"disabled",2),e};var $s=(s,t,e)=>{class r extends s{}return r};var re=(s,t,e,r)=>{class i extends $s(Ls(s,e),e,t){constructor(){super(...arguments);this.draggables=new Map;this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.dragContainersModified=(a,c)=>{this.dragDropApi.dragContainersModified(a,c)};this.draggablesModified=(a,c)=>{this.dragDropApi.draggablesModified(a,c),this.dragDropApi.draggables.forEach(d=>{this.storeDraggable(d)})};this.droppablesModified=(a,c)=>{this.dragDropApi.droppablesModified(a,c);for(let d of this.dragDropApi.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box")};this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),this.responseIdentifier&&a.dataTransfer.setData("responseIdentifier",this.responseIdentifier),this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),c.setAttribute("dragging",""),this.activateDragLocation(),this.activateDroppables(c)};this.handleDragEnd=async a=>{a.preventDefault(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables();let c=a.currentTarget;c.removeAttribute("dragging"),await this.wasDropped(a)||this.configuration.dragCanBePlacedBack&&this.restoreInitialDraggablePosition(c)}}handleDraggableContainerChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.dragContainersModified(a||[],c||[])}handleDraggablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.draggablesModified(a||[],c||[])}handleDroppablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.droppablesModified(a||[],c||[])}firstUpdated(a){super.firstUpdated(a);let c=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[])),d=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),u=Array.from(this.querySelectorAll(r)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(r)||[]));this.dragContainersModified(u,[]),this.droppablesModified(d,[]),this.draggablesModified(c,[])}connectedCallback(){super.connectedCallback(),this.initializeDragDropApi()}initializeDragDropApi(){this.dragDropApi=new Tr,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}isMatchTabular(){return this.classList.contains("qti-match-tabular")}storeDraggable(a){let c=Array.from(a.parentNode.children).indexOf(a);this.draggables.has(a)||this.draggables.set(a,{parent:a.parentElement,index:c}),a.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")||crypto.randomUUID()}`,a.setAttribute("qti-draggable","true"),a.addEventListener("dragstart",this.handleDragStart),a.addEventListener("dragend",this.handleDragEnd)}activateDroppables(a){this.dragDropApi.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.dragDropApi.droppables.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragDropApi.dragContainers.forEach(c=>{c.removeAttribute("enabled")}),this.dragDropApi.droppables.forEach(c=>c.removeAttribute("enabled"))}async wasDropped(a){return a.dataTransfer.dropEffect!=="none"}async restoreInitialDraggablePosition(a){let{parent:c,index:d}=this.draggables.get(a),u=(m,f,y)=>{console.log("moveDraggable",m,f,y);let x=Math.min(y,f.children.length);f.insertBefore(m,f.children[x]),m.style.transform="translate(0, 0)",this.checkMaxAssociations()};if(!document.startViewTransition){u(a,c,d);return}}validate(){let a=this.getValidAssociations(),c=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(c=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(c=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let u=this.lastElementChild;return this._internals.setValidity(c?{}:{customError:!0},d,u),this.reportValidity(),c}reportValidity(){let a=this.shadowRoot.querySelector("#validationMessage");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.display="block")),this._internals.validity.valid}checkMaxAssociations(){this.dragDropApi.droppables.forEach(a=>{let c=+(a.getAttribute("match-max")||1);a.querySelectorAll('[qti-draggable="true"]').length>=c?this.disableDroppable(a):this.enableDroppable(a)})}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get value(){return this.collectResponseData()}set value(a){if(!this.isMatchTabular())if(this.resetDroppables(),a?.forEach(c=>this.placeResponse(c)),Array.isArray(a)){let c=new FormData;a.forEach(d=>{c.append(this.responseIdentifier,d)}),this._internals.setFormValue(c)}else this._internals.setFormValue(a)}placeResponse(a){let[c,...d]=a.split(" ").reverse(),u=this.findDroppableById(c);d.forEach(m=>this.placeDraggableInDroppable(m,u))}findDroppableById(a){return this.dragDropApi.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let d=this.querySelector(`[identifier=${a}]`);if(!c||!d){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let u=()=>{d.style.transform="translate(0, 0)",c.appendChild(d),this.checkMaxAssociations()};document.startViewTransition?await document.startViewTransition(u).finished:u()}getValidAssociations(){return this.dragDropApi.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){this.validate();let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.dragDropApi.droppables.map(c=>{let d=c.querySelectorAll('[qti-draggable="true"]'),u=Array.from(d).map(f=>f.getAttribute("identifier")),m=c.getAttribute("identifier");return u.map(f=>`${f} ${m}`)}).flat()}reset(a=!0){this.resetDroppables(),a&&this.saveResponse()}async resetDroppables(){let a=(d,u,m)=>{d.style.transform="translate(0, 0)";let f=Math.min(m,u.children.length);u.insertBefore(d,u.children[f])};if(!document.startViewTransition){this.draggables.forEach(({parent:d,index:u},m)=>{a(m,d,u)});return}await document.startViewTransition(()=>{this.draggables.forEach(({parent:d,index:u},m)=>{a(m,d,u)})}).finished}}return l([p({attribute:!1,type:Object})],i.prototype,"configuration",2),l([p({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([p({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([tr(r)],i.prototype,"handleDraggableContainerChange",1),l([tr(t)],i.prototype,"handleDraggablesChange",1),l([tr(e)],i.prototype,"handleDroppablesChange",1),i};var Ds=b`
3757
3948
  :host {
3758
3949
  display: block; /* necessary to calculate scaling position */
3759
3950
  }
@@ -3773,23 +3964,23 @@ qti-response-declaration {
3773
3964
  rgb(0 0 0 / 0%) calc(50% + 1px)
3774
3965
  );
3775
3966
  }
3776
- `;var Yt=class extends rt(C,"qti-simple-associable-choice",!0,".dl"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let r=t.target;this._childrenMap.push(r)}render(){return h` <slot name="prompt"></slot>
3967
+ `;var je=class extends re(E,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let r=e.target;this._childrenMap.push(r)}render(){return h` <slot name="prompt"></slot>
3777
3968
  <slot name="qti-simple-associable-choice"></slot>
3778
3969
  <div part="drop-container">
3779
- ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((t,r)=>h`<div part="associables-container">
3970
+ ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,r)=>h`<div part="associables-container">
3780
3971
  <div name="left${r}" part="drop-list" class="dl" identifier="droplist${r}_left"></div>
3781
3972
  <div name="right${r}" part="drop-list" class="dl" identifier="droplist${r}_right"></div>
3782
3973
  </div>
3783
3974
  <div role="alert" id="validationMessage"></div>`)}
3784
- </div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Yt.styles=Ds,l([w()],Yt.prototype,"_childrenMap",2),Yt=l([g("qti-associate-interaction")],Yt);var at=class extends C{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let t=this.data.startsWith("http")?this.data:Ee(this.baseItemUrl+"/"+this.data);fetch(t).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}setupCES(){let t=this.shadowRoot.querySelector("#pciContainer"),r=t.contentDocument;window.addEventListener("message",this.handlePostMessage),r.open(),r.write(`
3975
+ </div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};je.styles=Ds,l([q()],je.prototype,"_childrenMap",2),je=l([g("qti-associate-interaction")],je);var ae=class extends E{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:qt(this.baseItemUrl+"/"+this.data);fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}setupCES(){let e=this.shadowRoot.querySelector("#pciContainer"),r=e.contentDocument;window.addEventListener("message",this.handlePostMessage),r.open(),r.write(`
3785
3976
  <html>
3786
3977
  <head>
3787
- <link href='${Ee(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
3788
- <script src='${Ee(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
3978
+ <link href='${qt(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
3979
+ <script src='${qt(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
3789
3980
  </head>
3790
3981
  <body></body>
3791
3982
  </html>
3792
- `),r.close()}getIFrames(){let t=this.shadowRoot.querySelectorAll("iframe"),r=this.querySelectorAll("iframe"),i=[...t,...r];for(let o of i){let n=o.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let c=o.contentDocument||o.contentWindow.document;c&&this.getInnerIFrames(c,i)}catch(c){console.error("Error accessing nested iframe:",c)}}return i.forEach((o,n)=>{i.indexOf(o)!==n&&i.splice(n,1)}),i}getInnerIFrames(t,r=[]){return t.querySelectorAll("iframe").forEach(o=>{r.push(o);let n=o.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let c=o.contentDocument||o.contentWindow.document;this.getInnerIFrames(c,r)}catch(c){console.error("Error accessing nested iframe:",c)}else console.warn("Skipped cross-origin iframe:",n)}),r}postToWindowAndIframes(t,r){window.postMessage({type:t,data:r},"*");let i=this.getIFrames();for(let o of i)o.contentWindow&&o.contentWindow.postMessage({type:t,data:r},"*")}handlePostMessage(t){let{type:r,data:i}=t.data;switch(r){case"setResponse":this.rawResponse=i,this.saveResponse(i);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let o=this.manifest.media.map(n=>n.startsWith("http")?n:Ee(this.baseRefUrl+"/"+n));this.postToWindowAndIframes("mediaData",o);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}get value(){return this.rawResponse}set value(t){if(typeof t=="string")this.rawResponse=t,this.saveResponse(t);else throw new Error("Value must be a string")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return h`<iframe
3983
+ `),r.close()}getIFrames(){let e=this.shadowRoot.querySelectorAll("iframe"),r=this.querySelectorAll("iframe"),i=[...e,...r];for(let o of i){let n=o.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let c=o.contentDocument||o.contentWindow.document;c&&this.getInnerIFrames(c,i)}catch(c){console.error("Error accessing nested iframe:",c)}}return i.forEach((o,n)=>{i.indexOf(o)!==n&&i.splice(n,1)}),i}getInnerIFrames(e,r=[]){return e.querySelectorAll("iframe").forEach(o=>{r.push(o);let n=o.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let c=o.contentDocument||o.contentWindow.document;this.getInnerIFrames(c,r)}catch(c){console.error("Error accessing nested iframe:",c)}else console.warn("Skipped cross-origin iframe:",n)}),r}postToWindowAndIframes(e,r){window.postMessage({type:e,data:r},"*");let i=this.getIFrames();for(let o of i)o.contentWindow&&o.contentWindow.postMessage({type:e,data:r},"*")}handlePostMessage(e){let{type:r,data:i}=e.data;switch(r){case"setResponse":this.rawResponse=i,this.saveResponse(i);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let o=this.manifest.media.map(n=>n.startsWith("http")?n:qt(this.baseRefUrl+"/"+n));this.postToWindowAndIframes("mediaData",o);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}get value(){return this.rawResponse}set value(e){if(typeof e=="string")this.rawResponse=e,this.saveResponse(e);else throw new Error("Value must be a string")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return h`<iframe
3793
3984
  width=${this.getAttribute("width")}
3794
3985
  height=${this.getAttribute("height")}
3795
3986
  frameborder="0"
@@ -3800,7 +3991,7 @@ qti-response-declaration {
3800
3991
  ${this._errorMessage&&h`<div style="color:red">
3801
3992
  <h1>Error</h1>
3802
3993
  ${this._errorMessage}
3803
- </div>`}`}};l([p({type:String,attribute:"data"})],at.prototype,"data",2),l([p({type:String,attribute:"data-base-item"})],at.prototype,"baseItemUrl",2),l([p({type:String,attribute:"data-base-ref"})],at.prototype,"baseRefUrl",2),l([p({type:String,attribute:"id"})],at.prototype,"id",2),l([w()],at.prototype,"_errorMessage",2),at=l([g("qti-custom-interaction")],at);var Gt=class extends C{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}get value(){return""}set value(t){}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(t){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};l([p({type:String,attribute:"count-attempt"})],Gt.prototype,"countAttempt",2),l([p({type:String})],Gt.prototype,"title",2),Gt=l([g("qti-end-attempt-interaction")],Gt);var Is=b`
3994
+ </div>`}`}};l([p({type:String,attribute:"data"})],ae.prototype,"data",2),l([p({type:String,attribute:"data-base-item"})],ae.prototype,"baseItemUrl",2),l([p({type:String,attribute:"data-base-ref"})],ae.prototype,"baseRefUrl",2),l([p({type:String,attribute:"id"})],ae.prototype,"id",2),l([q()],ae.prototype,"_errorMessage",2),ae=l([g("qti-custom-interaction")],ae);var We=class extends E{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}get value(){return""}set value(e){}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};l([p({type:String,attribute:"count-attempt"})],We.prototype,"countAttempt",2),l([p({type:String})],We.prototype,"title",2),We=l([g("qti-end-attempt-interaction")],We);var Is=b`
3804
3995
  :host {
3805
3996
  display: flex;
3806
3997
  align-items: flex-start;
@@ -3834,29 +4025,29 @@ qti-response-declaration {
3834
4025
  border-radius: 0.3rem;
3835
4026
  gap: 0.5rem;
3836
4027
  }
3837
- `;var Le=class extends rt(C,"qti-gap-text",!1,"qti-gap"){constructor(){super(...arguments);this.observer=null;this.resizeObserver=null}render(){return h`<slot name="prompt"> </slot>
4028
+ `;var Rt=class extends re(E,"qti-gap-text","qti-gap","slot[part='drags']"){constructor(){super(...arguments);this.observer=null;this.resizeObserver=null}render(){return h`<slot name="prompt"> </slot>
3838
4029
  <slot part="drags" name="drags"></slot>
3839
4030
  <slot part="drops"></slot>
3840
- <div role="alert" id="validationMessage"></div>`}firstUpdated(t){super.firstUpdated(t),this.updateMinDimensionsForDrowZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDrowZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDrowZones()),this.querySelectorAll("qti-gap-text").forEach(i=>this.resizeObserver?.observe(i))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}updateMinDimensionsForDrowZones(){let t=this.querySelectorAll("qti-gap-text"),r=this.querySelectorAll("qti-gap"),i=0,o=0;t.forEach(a=>{let c=a.getBoundingClientRect();i=Math.max(i,c.height),o=Math.max(o,c.width)});let n=this.shadowRoot?.querySelector('[part="drags"]');n&&(n.style.minHeight=`${i}px`,n.style.minWidth=`${o}px`);for(let a of r)a.style.minHeight=`${i}px`,a.style.minWidth=`${o}px`}set correctResponse(t){let r=[],i=Array.isArray(t)?t:[t];i&&(r=i.map(n=>{let a=n.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(n=>{let a=n.getAttribute("identifier"),c=r.find(u=>u.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${c}"]`)?.textContent.trim();if(c&&d){if(!n.nextElementSibling?.classList.contains("correct-option")){let u=document.createElement("span");u.classList.add("correct-option"),u.textContent=d,n.insertAdjacentElement("afterend",u)}}else n.nextElementSibling?.classList.contains("correct-option")&&n.nextElementSibling.remove()})}};Le.styles=Is,Le=l([g("qti-gap-match-interaction")],Le);var Ns=(s,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(s[i],i);return r},Tr=F(class extends G{constructor(s){if(super(s),s.type!==ut.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],o=[],n=0;for(let a of s)i[n]=r?r(a,n):n,o[n]=t(a,n),n++;return{values:o,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,r]){let i=ns(s),{values:o,keys:n}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=n,o;let a=this.ut??(this.ut=[]),c=[],d,u,m=0,f=i.length-1,y=0,x=o.length-1;for(;m<=f&&y<=x;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[y])c[y]=ht(i[m],o[y]),m++,y++;else if(a[f]===n[x])c[x]=ht(i[f],o[x]),f--,x--;else if(a[m]===n[x])c[x]=ht(i[m],o[x]),zt(s,c[x+1],i[m]),m++,x--;else if(a[f]===n[y])c[y]=ht(i[f],o[y]),zt(s,i[m],i[f]),f--,y++;else if(d===void 0&&(d=Ns(n,y,x),u=Ns(a,m,f)),d.has(a[m]))if(d.has(a[f])){let q=u.get(n[y]),A=q!==void 0?i[q]:null;if(A===null){let D=zt(s,i[m]);ht(D,o[y]),c[y]=D}else c[y]=ht(A,o[y]),zt(s,i[m],A),i[q]=null;y++}else rr(i[f]),f--;else rr(i[m]),m++;for(;y<=x;){let q=zt(s,c[x+1]);ht(q,o[y]),c[y++]=q}for(;m<=f;){let q=i[m++];q!==null&&rr(q)}return this.ut=n,os(s,c),R}});function Kt(s,e,t,r){switch(s){case"circle":{let[i,o,n]=e,a=i/t.width*100,c=o/t.height*100,d=n/t.width*100;r.style.left=a-d+"%",r.style.top=c-d+"%",r.style.width=r.style.height=4*d+"px",r.style.borderRadius="9999px"}break;case"rect":{let[i,o,n,a]=e,c=i/t.width*100,d=o/t.height*100,u=n/t.width*100,m=a/t.height*100;r.style.left=c+"%",r.style.top=d+"%",r.style.width=u-c+"%",r.style.height=m-d+"%"}break;case"poly":{let i=e.reduce((q,A,D,re)=>{if(D%2===1){let ct=q.pop();q[q.length]={x:ct,y:re[D]}}else q.push(A);return q},[]),o=Math.min(...i.map(q=>q.x)),n=Math.max(...i.map(q=>q.x)),a=Math.min(...i.map(q=>q.y)),c=Math.max(...i.map(q=>q.y)),d=o/t.width*100,u=a/t.height*100,m=n/t.width*100,f=c/t.height*100;r.style.left=o/t.width*100+"%",r.style.top=a/t.height*100+"%",r.style.width=m-d+"%",r.style.height=f-u+"%";let x=i.map(q=>({x:(q.x-o)/(n-o)*100,y:(q.y-a)/(c-a)*100})).map(q=>Math.round(q.x)+"% "+Math.round(q.y)+"%").join(",");r.style.clipPath=`polygon(${x})`}break;default:break}}var it=class extends C{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 value(t){Array.isArray(t)&&(this._lines=t)}get value(){return this._lines}render(){return h`<slot name="prompt"></slot>
4031
+ <div role="alert" id="validationMessage"></div>`}firstUpdated(e){super.firstUpdated(e),this.updateMinDimensionsForDrowZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDrowZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDrowZones()),this.querySelectorAll("qti-gap-text").forEach(i=>this.resizeObserver?.observe(i))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}updateMinDimensionsForDrowZones(){let e=this.querySelectorAll("qti-gap-text"),r=this.querySelectorAll("qti-gap"),i=0,o=0;e.forEach(a=>{let c=a.getBoundingClientRect();i=Math.max(i,c.height),o=Math.max(o,c.width)});let n=this.shadowRoot?.querySelector('[part="drags"]');n&&(n.style.minHeight=`${i}px`,n.style.minWidth=`${o}px`);for(let a of r)a.style.minHeight=`${i}px`,a.style.minWidth=`${o}px`}set correctResponse(e){let r=[],i=Array.isArray(e)?e:[e];i&&(r=i.map(n=>{let a=n.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(n=>{let a=n.getAttribute("identifier"),c=r.find(u=>u.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${c}"]`)?.textContent.trim();if(c&&d){if(!n.nextElementSibling?.classList.contains("correct-option")){let u=document.createElement("span");u.classList.add("correct-option"),u.textContent=d,n.insertAdjacentElement("afterend",u)}}else n.nextElementSibling?.classList.contains("correct-option")&&n.nextElementSibling.remove()})}};Rt.styles=Is,Rt=l([g("qti-gap-match-interaction")],Rt);var Ns=(s,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(s[i],i);return r},Ar=F(class extends G{constructor(s){if(super(s),s.type!==ue.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],o=[],n=0;for(let a of s)i[n]=r?r(a,n):n,o[n]=e(a,n),n++;return{values:o,keys:i}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,r]){let i=os(s),{values:o,keys:n}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=n,o;let a=this.ut??(this.ut=[]),c=[],d,u,m=0,f=i.length-1,y=0,x=o.length-1;for(;m<=f&&y<=x;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[y])c[y]=he(i[m],o[y]),m++,y++;else if(a[f]===n[x])c[x]=he(i[f],o[x]),f--,x--;else if(a[m]===n[x])c[x]=he(i[m],o[x]),He(s,c[x+1],i[m]),m++,x--;else if(a[f]===n[y])c[y]=he(i[f],o[y]),He(s,i[m],i[f]),f--,y++;else if(d===void 0&&(d=Ns(n,y,x),u=Ns(a,m,f)),d.has(a[m]))if(d.has(a[f])){let _=u.get(n[y]),S=_!==void 0?i[_]:null;if(S===null){let D=He(s,i[m]);he(D,o[y]),c[y]=D}else c[y]=he(S,o[y]),He(s,i[m],S),i[_]=null;y++}else rr(i[f]),f--;else rr(i[m]),m++;for(;y<=x;){let _=He(s,c[x+1]);he(_,o[y]),c[y++]=_}for(;m<=f;){let _=i[m++];_!==null&&rr(_)}return this.ut=n,ss(s,c),R}});function Xe(s,t,e,r){switch(s){case"circle":{let[i,o,n]=t,a=i/e.width*100,c=o/e.height*100,d=n/e.width*100;r.style.left=a-d+"%",r.style.top=c-d+"%",r.style.width=r.style.height=4*d+"px",r.style.borderRadius="9999px"}break;case"rect":{let[i,o,n,a]=t,c=i/e.width*100,d=o/e.height*100,u=n/e.width*100,m=a/e.height*100;r.style.left=c+"%",r.style.top=d+"%",r.style.width=u-c+"%",r.style.height=m-d+"%"}break;case"poly":{let i=t.reduce((_,S,D,Qe)=>{if(D%2===1){let ce=_.pop();_[_.length]={x:ce,y:Qe[D]}}else _.push(S);return _},[]),o=Math.min(...i.map(_=>_.x)),n=Math.max(...i.map(_=>_.x)),a=Math.min(...i.map(_=>_.y)),c=Math.max(...i.map(_=>_.y)),d=o/e.width*100,u=a/e.height*100,m=n/e.width*100,f=c/e.height*100;r.style.left=o/e.width*100+"%",r.style.top=a/e.height*100+"%",r.style.width=m-d+"%",r.style.height=f-u+"%";let x=i.map(_=>({x:(_.x-o)/(n-o)*100,y:(_.y-a)/(c-a)*100})).map(_=>Math.round(_.x)+"% "+Math.round(_.y)+"%").join(",");r.style.clipPath=`polygon(${x})`}break;default:break}}var ie=class extends E{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 value(e){Array.isArray(e)&&(this._lines=e)}get value(){return this._lines}render(){return h`<slot name="prompt"></slot>
3841
4032
  <line-container>
3842
4033
  <svg
3843
- width=${gt(this.grImage[0]?.width)}
3844
- height=${gt(this.grImage[0]?.height)}
4034
+ width=${ge(this.grImage[0]?.width)}
4035
+ height=${ge(this.grImage[0]?.height)}
3845
4036
  viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
3846
4037
  >
3847
- ${Tr(this._lines,t=>t,(t,r)=>Or`
4038
+ ${Ar(this._lines,e=>e,(e,r)=>Hr`
3848
4039
  <line
3849
4040
  part="line"
3850
- x1=${parseInt(this.querySelector("[identifier="+t.split(" ")[0]+"]").style.left)}
3851
- y1=${parseInt(this.querySelector("[identifier="+t.split(" ")[0]+"]").style.top)}
3852
- x2=${parseInt(this.querySelector("[identifier="+t.split(" ")[1]+"]").style.left)}
3853
- y2=${parseInt(this.querySelector("[identifier="+t.split(" ")[1]+"]").style.top)}
4041
+ x1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.left)}
4042
+ y1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.top)}
4043
+ x2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.left)}
4044
+ y2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.top)}
3854
4045
  stroke="red"
3855
4046
  stroke-width="3"
3856
4047
  @click=${i=>{i.stopPropagation(),this._lines=this._lines.filter((o,n)=>n!==r),this.saveResponse(this._lines)}}
3857
4048
  />
3858
4049
  `)}
3859
- ${this.startPoint&&Or`<line
4050
+ ${this.startPoint&&Hr`<line
3860
4051
  part="point"
3861
4052
  x1=${this.startCoord.x}
3862
4053
  y1=${this.startCoord.y}
@@ -3868,7 +4059,7 @@ qti-response-declaration {
3868
4059
  </svg>
3869
4060
  <slot></slot>
3870
4061
  </line-container>
3871
- <div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(t){let r=this.querySelector("img"),i=t.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));Kt(n,a,r,i)}firstUpdated(t){super.firstUpdated(t),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",i=>{this.startPoint?this.endPoint||(this.endPoint=i.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=i.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)}};it.styles=[b`
4062
+ <div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),i=e.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));Xe(n,a,r,i)}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",i=>{this.startPoint?this.endPoint||(this.endPoint=i.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=i.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)}};ie.styles=[b`
3872
4063
  slot:not([name='prompt']) {
3873
4064
  // position: relative; /* qti-hotspot-choice relative to the slot */
3874
4065
  display: block;
@@ -3891,7 +4082,7 @@ qti-response-declaration {
3891
4082
  top: 0px;
3892
4083
  left: 0px;
3893
4084
  }
3894
- `],l([w()],it.prototype,"_lines",2),l([w()],it.prototype,"startCoord",2),l([w()],it.prototype,"mouseCoord",2),l([It("svg")],it.prototype,"svgContainer",2),l([Hi({selector:"img"})],it.prototype,"grImage",2),it=l([g("qti-graphic-associate-interaction")],it);var Ps=b`
4085
+ `],l([q()],ie.prototype,"_lines",2),l([q()],ie.prototype,"startCoord",2),l([q()],ie.prototype,"mouseCoord",2),l([Ie("svg")],ie.prototype,"svgContainer",2),l([Oi({selector:"img"})],ie.prototype,"grImage",2),ie=l([g("qti-graphic-associate-interaction")],ie);var Ps=b`
3895
4086
  :host {
3896
4087
  display: flex;
3897
4088
  align-items: flex-start;
@@ -3945,16 +4136,16 @@ qti-response-declaration {
3945
4136
  user-select: none;
3946
4137
  pointer-events: none;
3947
4138
  }
3948
- `;var $e=class extends rt(C,"qti-gap-img, qti-gap-text",!1,"qti-associable-hotspot"){constructor(){super(...arguments);this.observer=null;this.resizeObserver=null}render(){return h` <slot name="prompt"></slot>
4139
+ `;var Mt=class extends re(E,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){constructor(){super(...arguments);this.observer=null;this.resizeObserver=null}render(){return h` <slot name="prompt"></slot>
3949
4140
  <slot part="image"></slot>
3950
- <slot part="drags" name="drags"></slot>
3951
- <div role="alert" id="validationMessage"></div>`}firstUpdated(t){super.firstUpdated(t),this.updateMinDimensionsForDrowZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDrowZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDrowZones()),this.querySelectorAll("qti-gap-img, qti-gap-text").forEach(i=>this.resizeObserver?.observe(i))}updateMinDimensionsForDrowZones(){let t=this.querySelectorAll("qti-gap-img, qti-gap-text"),r=this.querySelectorAll("qti-associable-hotspot"),i=0,o=0;t.forEach(c=>{let d=c.getBoundingClientRect();i=Math.max(i,d.height),o=Math.max(o,d.width)});let n=this.shadowRoot.querySelectorAll("slot"),a=Array.from(n).find(c=>c.name==="drags");a&&(a.style.minHeight=`${i}px`,a.style.minWidth=`${o}px`);for(let c of r)c.style.minHeight=`${i}px`,c.style.minWidth=`${o}px`}positionHotspotOnRegister(t){let r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));switch(o){case"circle":{let[a,c,d]=n;r.style.left=a-d+"px",r.style.top=c-d+"px",r.style.width=r.style.height=2*d+"px"}break;case"rect":{let[a,c,d,u]=n;r.style.left=a+"px",r.style.top=c+"px",r.style.width=d-a+"px",r.style.height=u-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)}};$e.styles=Ps,$e=l([g("qti-graphic-gap-match-interaction")],$e);var De=class extends ft(C,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return h`
4141
+ <slot part="drags" name="drags" class="hover-border"></slot>
4142
+ <div role="alert" id="validationMessage"></div>`}firstUpdated(e){super.firstUpdated(e),this.updateMinDimensionsForDrowZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDrowZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDrowZones()),this.querySelectorAll("qti-gap-img, qti-gap-text").forEach(i=>this.resizeObserver?.observe(i))}updateMinDimensionsForDrowZones(){let e=this.querySelectorAll("qti-gap-img, qti-gap-text"),r=this.querySelectorAll("qti-associable-hotspot"),i=0,o=0;e.forEach(c=>{let d=c.getBoundingClientRect();i=Math.max(i,d.height),o=Math.max(o,d.width)});let n=this.shadowRoot.querySelectorAll("slot"),a=Array.from(n).find(c=>c.name==="drags");a&&(a.style.minHeight=`${i}px`,a.style.minWidth=`${o}px`);for(let c of r)c.style.minHeight=`${i}px`,c.style.minWidth=`${o}px`}positionHotspotOnRegister(e){let r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));switch(o){case"circle":{let[a,c,d]=n;r.style.left=a-d+"px",r.style.top=c-d+"px",r.style.width=r.style.height=2*d+"px"}break;case"rect":{let[a,c,d,u]=n;r.style.left=a+"px",r.style.top=c+"px",r.style.width=d-a+"px",r.style.height=u-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)}};Mt.styles=Ps,Mt=l([g("qti-graphic-gap-match-interaction")],Mt);var Lt=class extends fe(E,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return h`
3952
4143
  <slot name="prompt"></slot>
3953
4144
  <!-- slot for the prompt -->
3954
4145
  <slot></slot>
3955
4146
  <!-- slot for the image and hotspots -->
3956
4147
  <div role="alert" id="validationMessage"></div>
3957
- `}setHotspotOrder(t){let{identifier:r}=t.detail,i=this._choiceElements.find(n=>n.getAttribute("identifier")===r),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}i.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)),i.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(t){let r=this.querySelector("img"),i=t.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));Kt(n,a,r,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};De.styles=[b`
4148
+ `}setHotspotOrder(e){let{identifier:r}=e.detail,i=this._choiceElements.find(n=>n.getAttribute("identifier")===r),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}i.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)),i.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),i=e.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));Xe(n,a,r,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};Lt.styles=[b`
3958
4149
  slot:not([name='prompt']) {
3959
4150
  position: relative; /* qti-hotspot-choice relative to the slot */
3960
4151
  display: block;
@@ -3965,12 +4156,12 @@ qti-response-declaration {
3965
4156
  pointer-events: none;
3966
4157
  user-select: none;
3967
4158
  }
3968
- `],De=l([g("qti-graphic-order-interaction")],De);var Ie=class extends ft(C,"qti-hotspot-choice"){render(){return h`
4159
+ `],Lt=l([g("qti-graphic-order-interaction")],Lt);var $t=class extends fe(E,"qti-hotspot-choice"){render(){return h`
3969
4160
  <slot name="prompt"></slot>
3970
4161
  <!-- slot for the prompt -->
3971
4162
  <slot></slot>
3972
4163
  <!-- slot for the image and hotspots -->
3973
- `}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));Kt(o,n,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};Ie.styles=[b`
4164
+ `}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));Xe(o,n,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};$t.styles=[b`
3974
4165
  slot:not([name='prompt']) {
3975
4166
  position: relative; /* qti-hotspot-choice relative to the slot */
3976
4167
  display: block;
@@ -3982,10 +4173,10 @@ qti-response-declaration {
3982
4173
  user-select: none;
3983
4174
  /* width:100%; */
3984
4175
  }
3985
- `],Ie=l([g("qti-hotspot-interaction")],Ie);var yt=class extends Z(v,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return h`
4176
+ `],$t=l([g("qti-hotspot-interaction")],$t);var ye=class extends Z(v,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return h`
3986
4177
  <slot part="slot"></slot>
3987
4178
  <slot part="dropslot" name="qti-simple-associable-choice"></slot>
3988
- `}};yt.styles=b`
4179
+ `}};ye.styles=b`
3989
4180
  :host {
3990
4181
  display: flex;
3991
4182
  user-select: none;
@@ -3997,7 +4188,7 @@ qti-response-declaration {
3997
4188
  slot[name='qti-simple-associable-choice'] {
3998
4189
  width: 100%;
3999
4190
  }
4000
- `,l([p({type:Number,attribute:"match-min"})],yt.prototype,"matchMin",2),l([p({type:Number,attribute:"match-max"})],yt.prototype,"matchMax",2),l([p({type:Boolean,attribute:"fixed"})],yt.prototype,"fixed",2),yt=l([g("qti-simple-associable-choice")],yt);var Os=b`
4191
+ `,l([p({type:Number,attribute:"match-min"})],ye.prototype,"matchMin",2),l([p({type:Number,attribute:"match-max"})],ye.prototype,"matchMax",2),l([p({type:Boolean,attribute:"fixed"})],ye.prototype,"fixed",2),ye=l([g("qti-simple-associable-choice")],ye);var Hs=b`
4001
4192
  slot {
4002
4193
  /* slot where the */
4003
4194
  display: flex;
@@ -4024,86 +4215,87 @@ qti-response-declaration {
4024
4215
  /* Make sure the drag and drop container slots have the same width */
4025
4216
  flex: 1;
4026
4217
  }
4027
- `;var xt=class extends rt(C,"qti-simple-match-set:first-of-type qti-simple-associable-choice",!1,"qti-simple-match-set:last-of-type qti-simple-associable-choice"){constructor(){super(...arguments);this.lastCheckedRadio=null;this._response=[];this.correctOptions=[];this.responseIdentifier="";this.handleRadioClick=t=>{let r=t.target;this.lastCheckedRadio===r?(r.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=r};this.handleRadioChange=t=>{let r=t.target,i=r.value,o=r.name,n=r.type;r.checked?(this.value?this.value.indexOf(i)===-1&&(n==="radio"&&(this.value=this.value.filter(a=>a.indexOf(o)===-1)),this.value=[...this.value,i]):this.value=[i],this.lastCheckedRadio=r):(this.value=this.value.filter(a=>a!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.value)?[...this.value]:this.value}}))}}get value(){return this.classList.contains("qti-match-tabular")?this._response:super.value}set value(t){this.classList.contains("qti-match-tabular")?this._response=t:super.value=t}async connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.value=[]}set correctResponse(t){if(t===""){this.correctOptions=[];return}else Array.isArray(t)&&(this.correctOptions=t)}render(){return this.classList.contains("qti-match-tabular")?h`
4218
+ `;var xe=class extends re(E,"qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type qti-simple-associable-choice","qti-simple-match-set"){constructor(){super(...arguments);this.lastCheckedRadio=null;this._response=[];this.correctOptions=[];this.responseIdentifier="";this.handleRadioClick=e=>{let r=e.target;this.lastCheckedRadio===r?(r.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=r};this.handleRadioChange=e=>{let r=e.target,i=r.value,o=r.name,n=r.type;r.checked?(this.value?this.value.indexOf(i)===-1&&(n==="radio"&&(this.value=this.value.filter(a=>a.indexOf(o)===-1)),this.value=[...this.value,i]):this.value=[i],this.lastCheckedRadio=r):(this.value=this.value.filter(a=>a!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.value)?[...this.value]:this.value}}))}}get value(){return this.classList.contains("qti-match-tabular")?this._response:super.value}set value(e){this.classList.contains("qti-match-tabular")?this._response=e:super.value=e}async connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.value=[]}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e)}render(){return this.classList.contains("qti-match-tabular")?h`
4028
4219
  <slot name="prompt"></slot>
4029
4220
  <table>
4030
4221
  <tr>
4031
4222
  <td></td>
4032
- ${this.cols.map(t=>h`<th part="r-header">${bt(t.innerHTML)}</th>`)}
4223
+ ${this.cols.map(e=>h`<th part="r-header">${be(e.innerHTML)}</th>`)}
4033
4224
  </tr>
4034
4225
 
4035
- ${this.rows.map(t=>h`<tr>
4036
- <td part="c-header">${bt(t.innerHTML)}</td>
4037
- ${this.cols.map(r=>{let i=t.getAttribute("identifier"),o=r.getAttribute("identifier"),n=`${i} ${o}`,a=this.value.filter(m=>m.split(" ")[0]===i).length||0,c=this.value.includes(n),d=`rb ${c?"rb-checked":""} ${this.correctOptions.includes(n)?"rb-correct":""}`,u=this.correctOptions.length>0?!0:t.matchMax===1?!1:a>=t.matchMax&&!c;return h`<td>
4226
+ ${this.rows.map(e=>h`<tr>
4227
+ <td part="c-header">${be(e.innerHTML)}</td>
4228
+ ${this.cols.map(r=>{let i=e.getAttribute("identifier"),o=r.getAttribute("identifier"),n=`${i} ${o}`,a=this.value.filter(m=>m.split(" ")[0]===i).length||0,c=this.value.includes(n),d=`rb ${c?"rb-checked":""} ${this.correctOptions.includes(n)?"rb-correct":""}`,u=this.correctOptions.length>0?!0:e.matchMax===1?!1:a>=e.matchMax&&!c;return h`<td>
4038
4229
  <input
4039
- type=${t.matchMax===1?"radio":"checkbox"}
4230
+ type=${e.matchMax===1?"radio":"checkbox"}
4040
4231
  part=${d}
4041
4232
  name=${i}
4042
4233
  value=${n}
4043
4234
  .disabled=${u}
4044
4235
  @change=${m=>this.handleRadioChange(m)}
4045
- @click=${m=>t.matchMax===1?this.handleRadioClick(m):null}
4236
+ @click=${m=>e.matchMax===1?this.handleRadioClick(m):null}
4046
4237
  />
4047
4238
  </td>`})}
4048
4239
  </tr>`)}
4049
4240
  </table>
4050
4241
  `:h`<slot name="prompt"></slot> <slot></slot>
4051
- <div role="alert" id="validationMessage"></div>`}};xt.styles=Os,l([w()],xt.prototype,"_response",2),l([w()],xt.prototype,"correctOptions",2),l([p({type:String,attribute:"response-identifier"})],xt.prototype,"responseIdentifier",2),xt=l([g("qti-match-interaction")],xt);var Ne=class extends C{constructor(){super();this._value=0}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(t){if(!isNaN(parseInt(t.toString())))this._value=parseInt(t.toString());else throw new Error("Value must be a number")}static get properties(){return{...C.properties,step:{type:Number,attribute:"step",default:10}}}render(){return h` <slot name="prompt"></slot>
4052
- <slot></slot>`}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};Ne.styles=[b``],Ne=l([g("qti-media-interaction")],Ne);var lt=class extends br(rt(C,"qti-simple-choice",!0,"drop-list"),"qti-simple-choice"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),h` <slot name="prompt"> </slot>
4053
- <div part="container">
4054
- <slot part="drags"> </slot>
4055
- <div part="drops">
4056
- ${Array.from(Array(this.nrChoices)).map((r,i)=>h`<drop-list part="drop-list" identifier="droplist${i}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>i?bt(`<span part='correct-response'>${this.correctResponses[i]}</span>`):""}`)}
4057
- </div>
4058
- </div>`}set correctResponse(t){if(t===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(t)?t:[t]).forEach(i=>{let o=this.querySelector(`qti-simple-choice[identifier="${i}"]`);o||(o=this.shadowRoot.querySelector(`qti-simple-choice[identifier="${i}"]`));let n=o?.textContent.trim();this.correctResponses=[...this.correctResponses,n]}),this.showCorrectResponses=!0}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let o=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(o).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(t){super.firstUpdated(t),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(r=>r.setAttribute("part","qti-simple-choice"))}};lt.styles=[b`
4059
- [part='drags'] {
4060
- display: flex;
4061
- align-items: flex-start;
4062
- flex: 1;
4063
- }
4242
+ <div role="alert" id="validationMessage"></div>`}};xe.styles=Hs,l([q()],xe.prototype,"_response",2),l([q()],xe.prototype,"correctOptions",2),l([p({type:String,attribute:"response-identifier"})],xe.prototype,"responseIdentifier",2),xe=l([g("qti-match-interaction")],xe);var Dt=class extends E{constructor(){super();this._value=0}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(e){if(!isNaN(parseInt(e.toString())))this._value=parseInt(e.toString());else throw new Error("Value must be a number")}static get properties(){return{...E.properties,step:{type:Number,attribute:"step",default:10}}}render(){return h` <slot name="prompt"></slot>
4243
+ <slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};Dt.styles=[b``],Dt=l([g("qti-media-interaction")],Dt);var Os=b`
4244
+ [part='drags'] {
4245
+ display: flex;
4246
+ align-items: flex-start;
4247
+ flex: 1;
4248
+ border: 2px solid transparent;
4249
+ }
4064
4250
 
4065
- [part='drops'] {
4066
- flex: 1;
4067
- display: grid;
4068
- grid-auto-flow: column;
4069
- grid-auto-columns: 1fr;
4070
- }
4251
+ [part='drops'] {
4252
+ flex: 1;
4253
+ display: grid;
4254
+ grid-auto-flow: column;
4255
+ grid-auto-columns: 1fr;
4256
+ }
4071
4257
 
4072
- :host([orientation='horizontal']) [part='drags'] {
4073
- flex-direction: row;
4074
- }
4075
- :host([orientation='horizontal']) [part='drops'] {
4076
- grid-auto-flow: column;
4077
- }
4078
- :host([orientation='vertical']) [part='drags'] {
4079
- flex-direction: column;
4080
- }
4081
- :host([orientation='vertical']) [part='drops'] {
4082
- grid-auto-flow: row;
4083
- }
4258
+ :host([orientation='horizontal']) [part='drags'] {
4259
+ flex-direction: row;
4260
+ }
4261
+ :host([orientation='horizontal']) [part='drops'] {
4262
+ grid-auto-flow: column;
4263
+ }
4264
+ :host([orientation='vertical']) [part='drags'] {
4265
+ flex-direction: column;
4266
+ }
4267
+ :host([orientation='vertical']) [part='drops'] {
4268
+ grid-auto-flow: row;
4269
+ }
4084
4270
 
4085
- [part='drop-list'] {
4086
- display: block;
4087
- flex: 1;
4088
- }
4271
+ [part='drop-list'] {
4272
+ display: block;
4273
+ flex: 1;
4274
+ }
4089
4275
 
4090
- [part='container'] {
4091
- display: flex;
4092
- gap: 0.5rem;
4093
- }
4094
- :host(.qti-choices-top) [part='container'] {
4095
- flex-direction: column;
4096
- }
4097
- :host(.qti-choices-bottom) [part='container'] {
4098
- flex-direction: column-reverse;
4099
- }
4100
- :host(.qti-choices-left) [part='container'] {
4101
- flex-direction: row;
4102
- }
4103
- :host(.qti-choices-right) [part='container'] {
4104
- flex-direction: row-reverse;
4105
- }
4106
- `],l([w()],lt.prototype,"nrChoices",2),l([w()],lt.prototype,"correctResponses",2),l([w()],lt.prototype,"showCorrectResponses",2),l([p({type:String})],lt.prototype,"orientation",2),lt=l([g("qti-order-interaction")],lt);var Ar=class extends v{render(){return h`<slot></slot>`}};Ar.styles=[b`
4276
+ [part='container'] {
4277
+ display: flex;
4278
+ gap: 0.5rem;
4279
+ }
4280
+ :host(.qti-choices-top) [part='container'] {
4281
+ flex-direction: column;
4282
+ }
4283
+ :host(.qti-choices-bottom) [part='container'] {
4284
+ flex-direction: column-reverse;
4285
+ }
4286
+ :host(.qti-choices-left) [part='container'] {
4287
+ flex-direction: row;
4288
+ }
4289
+ :host(.qti-choices-right) [part='container'] {
4290
+ flex-direction: row-reverse;
4291
+ }
4292
+ `;var le=class extends vr(re(E,"qti-simple-choice","drop-list","slot[part='drags']"),"qti-simple-choice"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
4293
+ <div part="container">
4294
+ <slot part="drags"> </slot>
4295
+ <div part="drops">
4296
+ ${Array.from(Array(this.nrChoices)).map((r,i)=>h`<drop-list part="drop-list" identifier="droplist${i}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>i?be(`<span part='correct-response'>${this.correctResponses[i]}</span>`):""}`)}
4297
+ </div>
4298
+ </div>`}set correctResponse(e){if(e===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(e)?e:[e]).forEach(i=>{let o=this.querySelector(`qti-simple-choice[identifier="${i}"]`);o||(o=this.shadowRoot.querySelector(`qti-simple-choice[identifier="${i}"]`));let n=o?.textContent.trim();this.correctResponses=[...this.correctResponses,n]}),this.showCorrectResponses=!0}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let o=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(o).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(r=>r.setAttribute("part","qti-simple-choice"))}};le.styles=Os,l([q()],le.prototype,"nrChoices",2),l([q()],le.prototype,"correctResponses",2),l([q()],le.prototype,"showCorrectResponses",2),l([p({type:String})],le.prototype,"orientation",2),le=l([g("qti-order-interaction")],le);var Sr=class extends v{render(){return h`<slot></slot>`}};Sr.styles=[b`
4107
4299
  :host {
4108
4300
  display: block;
4109
4301
  }
@@ -4114,23 +4306,23 @@ qti-response-declaration {
4114
4306
  left: 50%;
4115
4307
  transform: translateX(-50%);
4116
4308
  }
4117
- `];customElements.define("qti-position-object-interaction",Ar);var Pe=class extends v{render(){return h`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(e){e.preventDefault();let t=e.clientX-this.startX,r=e.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+t+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=e.clientX,this.startY=e.clientY}firstUpdated(e){super.firstUpdated(e),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",t=>{this.startX=t.clientX,this.startY=t.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};Pe.styles=[b`
4309
+ `];customElements.define("qti-position-object-interaction",Sr);var It=class extends v{render(){return h`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,r=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};It.styles=[b`
4118
4310
  :host {
4119
4311
  display: inline-block;
4120
4312
  position: relative;
4121
4313
  }
4122
- `],Pe=l([g("qti-position-object-stage")],Pe);var Hs="important",Po=" !"+Hs,Vs=F(class extends G{constructor(s){if(super(s),s.type!==ut.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{let r=s[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(s,[e]){let{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(Po);r.includes("-")||o?t.setProperty(r,o?i.slice(0,-11):i,o?Hs:""):t[r]=i}}return R}});var qt=class extends C{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=t=>{if(this._points.length<this.maxChoices){let r=t.offsetX,i=t.offsetY;this._points=[...this._points,`${r} ${i}`],this.saveResponse(this._points)}}}render(){return h` <slot name="prompt"></slot>
4314
+ `],It=l([g("qti-position-object-stage")],It);var Vs="important",Po=" !"+Vs,zs=F(class extends G{constructor(s){if(super(s),s.type!==ue.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((t,e)=>{let r=s[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(s,[t]){let{style:e}=s.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 i=t[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(Po);r.includes("-")||o?e.setProperty(r,o?i.slice(0,-11):i,o?Vs:""):e[r]=i}}return R}});var qe=class extends E{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=e=>{if(this._points.length<this.maxChoices){let r=e.offsetX,i=e.offsetY;this._points=[...this._points,`${r} ${i}`],this.saveResponse(this._points)}}}render(){return h` <slot name="prompt"></slot>
4123
4315
  <point-container>
4124
- ${Tr(this._points,t=>t,(t,r)=>h`
4316
+ ${Ar(this._points,e=>e,(e,r)=>h`
4125
4317
  <button
4126
4318
  part="point"
4127
- style=${Vs({position:"absolute",transform:"translate(-50%, -50%)",left:`${t.split(" ")[0]}px`,top:`${t.split(" ")[1]}px`})}
4128
- aria-label="Remove point at ${t}"
4319
+ style=${zs({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
4320
+ aria-label="Remove point at ${e}"
4129
4321
  @click=${i=>{i.stopPropagation(),this._points=this._points.filter((o,n)=>n!==r),this.saveResponse(this._points)}}
4130
4322
  ></button>
4131
4323
  `)}
4132
4324
  <slot></slot>
4133
- </point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set value(t){this._points=Array.isArray(t)?t:[t]}get value(){return this._points}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?this._imgElement.addEventListener("click",this._onImageClick):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};qt.styles=[b`
4325
+ </point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set value(e){this._points=Array.isArray(e)?e:[e]}get value(){return this._points}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?this._imgElement.addEventListener("click",this._onImageClick):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};qe.styles=[b`
4134
4326
  :host {
4135
4327
  display: block;
4136
4328
  }
@@ -4138,7 +4330,7 @@ qti-response-declaration {
4138
4330
  display: block;
4139
4331
  position: relative;
4140
4332
  }
4141
- `],l([p({type:Number,attribute:"max-choices"})],qt.prototype,"maxChoices",2),l([p({type:Number,attribute:"min-choices"})],qt.prototype,"minChoices",2),l([w()],qt.prototype,"_points",2),qt=l([g("qti-select-point-interaction")],qt);var P=class extends C{constructor(){super();this._value=0;this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=()=>{};this._handleReadonlyChange=()=>{};this.csLive=getComputedStyle(this)}set min(t){this._min=t,this._value=t,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(t){this._max=t,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(t){this._step=t,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(t){if(!isNaN(parseInt(t.toString())))this._value=parseInt(t.toString());else throw new Error("Value must be a number")}set response(t){if(Array.isArray(t)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let r=parseInt(t);if(Number.isNaN(r)){console.error("QtiSliderInteraction: response is not a number");return}this._value=r}render(){this._value<this.min&&(this._value=this.min),this._value>this.max&&(this._value=this.max);let t=(this._value-this.min)/(this.max-this.min)*100;return this.style.setProperty("--value-percentage",`${t}%`),this.setAttribute("aria-valuenow",this.value.toString()),h`<slot name="prompt"></slot>
4333
+ `],l([p({type:Number,attribute:"max-choices"})],qe.prototype,"maxChoices",2),l([p({type:Number,attribute:"min-choices"})],qe.prototype,"minChoices",2),l([q()],qe.prototype,"_points",2),qe=l([g("qti-select-point-interaction")],qe);var P=class extends E{constructor(){super();this._value=0;this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=()=>{};this._handleReadonlyChange=()=>{};this.csLive=getComputedStyle(this)}set min(e){this._min=e,this._value=e,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(e){if(!isNaN(parseInt(e.toString())))this._value=parseInt(e.toString());else throw new Error("Value must be a number")}set response(e){if(Array.isArray(e)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let r=parseInt(e);if(Number.isNaN(r)){console.error("QtiSliderInteraction: response is not a number");return}this._value=r}render(){this._value<this.min&&(this._value=this.min),this._value>this.max&&(this._value=this.max);let e=(this._value-this.min)/(this.max-this.min)*100;return this.style.setProperty("--value-percentage",`${e}%`),this.setAttribute("aria-valuenow",this.value.toString()),h`<slot name="prompt"></slot>
4142
4334
  <div id="slider" part="slider">
4143
4335
  ${this.csLive.getPropertyValue("--show-bounds")=="true"?h`<div id="bounds" part="bounds">
4144
4336
  <div>${this._min}</div>
@@ -4150,49 +4342,49 @@ qti-response-declaration {
4150
4342
  ${this.csLive.getPropertyValue("--show-value")=="true"?h`<div id="value" part="value">${this.value}</div>`:k}
4151
4343
  </div>
4152
4344
  </div>
4153
- </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(t){let r=a=>{let{x:c}=this.getPositionFromEvent(a),d=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(d),a.stopPropagation()},i=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",i),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",i);let{x:o}=this.getPositionFromEvent(t),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),t.stopPropagation()}_onMouseDown(t){let r=n=>{let a=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),n.preventDefault(),n.stopPropagation()},i=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i);let o=t.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),t.preventDefault(),t.stopPropagation()}calculateValue(t){let r=this.min+(this.max-this.min)*t/this._rail.getBoundingClientRect().width,i=this.min+Math.round((r-this.min)/this._step)*this._step;this._value=i}getPositionFromEvent(t){let r;if(t.type=="touchstart"||t.type=="touchmove"||t.type=="touchend"||t.type=="touchcancel"){let i=typeof t.originalEvent>"u"?t:t.originalEvent,o=i.touches[0]||i.changedTouches[0];r={x:o.pageX,y:o.pageY}}else(t.type=="mousedown"||t.type=="mouseup"||t.type=="mousemove"||t.type=="mouseover"||t.type=="mouseout"||t.type=="mouseenter"||t.type=="mouseleave")&&(r={x:t.clientX,y:t.clientY});return r}};P.styles=[b``],l([It("#rail")],P.prototype,"_rail",2),l([p({type:Boolean,attribute:"step-label"})],P.prototype,"stepLabel",2),l([p({type:Boolean})],P.prototype,"reverse",2),l([p({type:Number,attribute:"lower-bound"})],P.prototype,"min",1),l([p({type:Number,attribute:"upper-bound"})],P.prototype,"max",1),l([p({type:Number,attribute:"step"})],P.prototype,"step",1),l([S("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([S("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),P=l([g("qti-slider-interaction")],P);var Oe=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let e=Array.from(this.firstElementChild?.childNodes??[]).find(t=>t.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",e.textContent??"")}catch(t){console.error("custom-operator contains invalid javascript code",t)}}calculate(){let e={variable:r=>this._context?.variables.find(i=>i.identifier===r)?.value??"",correct:r=>this._context?.variables.find(i=>i.identifier===r)?.correctResponse??""},t={getVariable:r=>this._context?.variables.find(i=>i.identifier===r),updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.operatorFunction(this._context,e,t)}};l([T({context:$,subscribe:!0}),w()],Oe.prototype,"_context",2),Oe=l([g("qti-custom-operator")],Oe);var He=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return h` <slot name="drags"></slot> `}};He.styles=b`
4345
+ </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:c}=this.getPositionFromEvent(a),d=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(d),a.stopPropagation()},i=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",i),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",i);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 a=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),n.preventDefault(),n.stopPropagation()},i=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i);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,i=this.min+Math.round((r-this.min)/this._step)*this._step;this._value=i}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let i=typeof e.originalEvent>"u"?e:e.originalEvent,o=i.touches[0]||i.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}};P.styles=[b``],l([Ie("#rail")],P.prototype,"_rail",2),l([p({type:Boolean,attribute:"step-label"})],P.prototype,"stepLabel",2),l([p({type:Boolean})],P.prototype,"reverse",2),l([p({type:Number,attribute:"lower-bound"})],P.prototype,"min",1),l([p({type:Number,attribute:"upper-bound"})],P.prototype,"max",1),l([p({type:Number,attribute:"step"})],P.prototype,"step",1),l([A("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([A("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),P=l([g("qti-slider-interaction")],P);var Nt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",t.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t={variable:r=>this._context?.variables.find(i=>i.identifier===r)?.value??"",correct:r=>this._context?.variables.find(i=>i.identifier===r)?.correctResponse??""},e={getVariable:r=>this._context?.variables.find(i=>i.identifier===r),updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.operatorFunction(this._context,t,e)}};l([T({context:$,subscribe:!0}),q()],Nt.prototype,"_context",2),Nt=l([g("qti-custom-operator")],Nt);var Pt=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return h` <slot name="drags"></slot> `}};Pt.styles=b`
4154
4346
  :host {
4155
4347
  display: flex;
4156
4348
  user-select: none;
4157
4349
  position: absolute;
4158
4350
  }
4159
- `,He=l([g("qti-associable-hotspot")],He);var Zt=class extends v{constructor(){super(...arguments);this.tabindex=0}render(){return h` <slot name="drags"></slot>`}};Zt.styles=b`
4351
+ `,Pt=l([g("qti-associable-hotspot")],Pt);var Ye=class extends v{constructor(){super(...arguments);this.tabindex=0}render(){return h` <slot name="drags"></slot>`}};Ye.styles=b`
4160
4352
  :host {
4161
4353
  display: flex;
4162
4354
  user-select: none;
4163
4355
  }
4164
- `,l([p({type:Number,reflect:!0})],Zt.prototype,"tabindex",2),Zt=l([g("qti-gap")],Zt);var Jt=class extends v{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};Jt.styles=b`
4356
+ `,l([p({type:Number,reflect:!0})],Ye.prototype,"tabindex",2),Ye=l([g("qti-gap")],Ye);var Ge=class extends v{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};Ge.styles=b`
4165
4357
  :host {
4166
4358
  display: flex;
4167
4359
  user-select: none;
4168
4360
  }
4169
- `,l([p({type:Number,reflect:!0})],Jt.prototype,"tabindex",2),Jt=l([g("qti-gap-img")],Jt);var Qt=class extends Z(v,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return h`<slot></slot>`}};Qt.styles=b`
4361
+ `,l([p({type:Number,reflect:!0})],Ge.prototype,"tabindex",2),Ge=l([g("qti-gap-img")],Ge);var Ke=class extends Z(v,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return h`<slot></slot>`}};Ke.styles=b`
4170
4362
  :host {
4171
4363
  display: inline-flex;
4172
4364
  user-select: none;
4173
4365
  }
4174
- `,l([p({type:Number,reflect:!0})],Qt.prototype,"tabindex",2),Qt=l([g("qti-gap-text")],Qt);var te=class extends Z(v,"qti-hotspot-choice"){};te.styles=b`
4366
+ `,l([p({type:Number,reflect:!0})],Ke.prototype,"tabindex",2),Ke=l([g("qti-gap-text")],Ke);var Ze=class extends Z(v,"qti-hotspot-choice"){};Ze.styles=b`
4175
4367
  :host {
4176
4368
  display: flex;
4177
4369
  user-select: none;
4178
4370
  position: absolute;
4179
4371
  }
4180
- `,l([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],te.prototype,"order",2),te=l([g("qti-hotspot-choice")],te);var Ve=class extends Z(v,"qti-hottext"){render(){return h`<div part="ch"><div part="cha"></div></div>
4181
- <slot></slot> `}};Ve.styles=b`
4372
+ `,l([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],Ze.prototype,"order",2),Ze=l([g("qti-hotspot-choice")],Ze);var Ht=class extends Z(v,"qti-hottext"){render(){return h`<div part="ch"><div part="cha"></div></div>
4373
+ <slot></slot> `}};Ht.styles=b`
4182
4374
  :host {
4183
4375
  display: flex;
4184
4376
  user-select: none;
4185
4377
  }
4186
- `,Ve=l([g("qti-hottext")],Ve);var ze=class extends v{static get styles(){return[b`
4378
+ `,Ht=l([g("qti-hottext")],Ht);var Ot=class extends v{static get styles(){return[b`
4187
4379
  :host {
4188
4380
  display: block;
4189
4381
  cursor: pointer;
4190
4382
  }
4191
- `]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return h` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};l([p({type:String})],ze.prototype,"identifier",2),ze=l([g("qti-inline-choice")],ze);var ee=class extends Z(v,"qti-simple-choice"){get checked(){return this.internals.states.has("--checked")}render(){return h`<div part="ch">
4383
+ `]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return h` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};l([p({type:String})],Ot.prototype,"identifier",2),Ot=l([g("qti-inline-choice")],Ot);var Je=class extends Z(v,"qti-simple-choice"){get checked(){return this.internals.states.has("--checked")}render(){return h`<div part="ch">
4192
4384
  <div part="cha"></div>
4193
4385
  </div>
4194
4386
  ${this.marker?h`<div id="label">${this.marker}</div>`:k}
4195
- <slot part="slot"></slot> `}};ee.styles=b`
4387
+ <slot part="slot"></slot> `}};Je.styles=b`
4196
4388
  :host {
4197
4389
  display: flex;
4198
4390
  align-items: center;
@@ -4209,7 +4401,7 @@ qti-response-declaration {
4209
4401
  align-items: center;
4210
4402
  justify-content: center;
4211
4403
  }
4212
- `,l([p({type:String,attribute:!1})],ee.prototype,"marker",2),ee=l([g("qti-simple-choice")],ee);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");function zs(s){class e extends s{createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href}}))}render(){return h`${this.xmlDoc}`}}return l([p({type:String,reflect:!0})],e.prototype,"identifier",2),l([p({type:String})],e.prototype,"href",2),l([p({type:Object,attribute:!1})],e.prototype,"xmlDoc",2),e}var Sr=class extends zs(v){};Sr=l([g("qti-item")],Sr);var wq=async s=>{let e=s.substring(0,s.lastIndexOf("/")),t=await Yi().load(`${s}`).then(a=>a.assessmentTest()),r=await he().load(`${e}/${t.href}`).then(a=>a.htmlDoc()),i=await he().load(`${e}/${t.href}`).then(a=>a.items()),o=`${e}/${t.href}`,n=`${e}/${t.href.substring(0,t.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:n,testURL:o,items:i,testIdentifier:t.identifier}},Eq=async s=>Ht().load(s).then(e=>e.htmlDoc().firstElementChild);export{Z as ActiveElementMixin,C as Interaction,yr as QtiAnd,I as QtiAssessmentItem,j as QtiAssessmentItemRef,W as QtiAssessmentSection,jt as QtiAssessmentStimulusRef,Tt as QtiAssessmentTest,He as QtiAssociableHotspot,Yt as QtiAssociateInteraction,xr as QtiBaseValue,Wt as QtiChoiceInteraction,mr as QtiCompanionMaterialsInfo,H as QtiConditionExpression,ri as QtiContains,gr as QtiContentBody,ii as QtiCorrect,at as QtiCustomInteraction,Oe as QtiCustomOperator,Gt as QtiEndAttemptInteraction,wr as QtiEqual,qr as QtiEqualRounded,_ as QtiExpression,O as QtiExtendedTextInteraction,Ce as QtiFeedbackBlock,_e as QtiFeedbackInline,Zt as QtiGap,Jt as QtiGapImg,Le as QtiGapMatchInteraction,Qt as QtiGapText,it as QtiGraphicAssociateInteraction,$e as QtiGraphicGapMatchInteraction,De as QtiGraphicOrderInteraction,si as QtiGt,oi as QtiGte,te as QtiHotspotChoice,Ie as QtiHotspotInteraction,Ve as QtiHottext,fr as QtiHottextInteraction,ze as QtiInlineChoice,vt as QtiInlineChoiceInteraction,ni as QtiIsNull,Sr as QtiItem,qe as QtiItemBody,zs as QtiItemMixin,vr as QtiLookupOutcomeValue,ai as QtiLt,li as QtiLte,Er as QtiMapResponse,Xt as QtiMapping,ci as QtiMatch,xt as QtiMatchInteraction,Ne as QtiMediaInteraction,di as QtiMember,ke as QtiModalFeedback,pi as QtiMultiple,hi as QtiNot,ui as QtiOr,lt as QtiOrderInteraction,mi as QtiOrdered,J as QtiOutcomeDeclaration,Ae as QtiOutcomeProcessing,Zr as QtiOutcomeProcessingProcessor,St as QtiPortableCustomInteraction,Ar as QtiPositionObjectInteraction,Pe as QtiPositionObjectStage,Me as QtiPrintedVariable,gi as QtiProduct,hr as QtiPrompt,Jr as QtiResponseCondition,nt as QtiResponseDeclaration,Se as QtiResponseElse,ei as QtiResponseElseIf,Re as QtiResponseIf,At as QtiResponseProcessing,Q as QtiRubricBlock,et as QtiRule,qt as QtiSelectPointInteraction,Qr as QtiSetOutcomeValue,ti as QtiSetOutcomeValueRule,yt as QtiSimpleAssociableChoice,ee as QtiSimpleChoice,P as QtiSliderInteraction,_r as QtiStringMatch,ur as QtiStylesheet,Cr as QtiSubtract,fi as QtiSum,bi as QtiSumExpression,Qe as QtiTest,X as QtiTestPart,tt as QtiTextEntryInteraction,vi as QtiVariable,Ft as TestContainer,ge as TestItemLink,ue as TestNext,Bt as TestPagingButtonsStamp,me as TestPrev,Y as TestView,Eq as getItemByUri,wq as getManifestInfo,$ as itemContext,ws as itemContextVariables,Io as qtiAndMixin,No as qtiSubtractMixin,Ht as qtiTransformItem,Yi as qtiTransformManifest,he as qtiTransformTest};
4404
+ `,l([p({type:String,attribute:!1})],Je.prototype,"marker",2),Je=l([g("qti-simple-choice")],Je);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");export{Z as ActiveElementMixin,E as Interaction,xr as QtiAnd,I as QtiAssessmentItem,j as QtiAssessmentItemRef,W as QtiAssessmentSection,Ue as QtiAssessmentStimulusRef,Te as QtiAssessmentTest,Pt as QtiAssociableHotspot,je as QtiAssociateInteraction,qr as QtiBaseValue,Fe as QtiChoiceInteraction,gr as QtiCompanionMaterialsInfo,O as QtiConditionExpression,ri as QtiContains,fr as QtiContentBody,ii as QtiCorrect,ae as QtiCustomInteraction,Nt as QtiCustomOperator,We as QtiEndAttemptInteraction,Er as QtiEqual,wr as QtiEqualRounded,C as QtiExpression,H as QtiExtendedTextInteraction,wt as QtiFeedbackBlock,Et as QtiFeedbackInline,Ye as QtiGap,Ge as QtiGapImg,Rt as QtiGapMatchInteraction,Ke as QtiGapText,ie as QtiGraphicAssociateInteraction,Mt as QtiGraphicGapMatchInteraction,Lt as QtiGraphicOrderInteraction,si as QtiGt,oi as QtiGte,Ze as QtiHotspotChoice,$t as QtiHotspotInteraction,Ht as QtiHottext,br as QtiHottextInteraction,Ot as QtiInlineChoice,ve as QtiInlineChoiceInteraction,ni as QtiIsNull,hr as QtiItem,yt as QtiItemBody,qs as QtiItemMixin,yr as QtiLookupOutcomeValue,ai as QtiLt,li as QtiLte,Cr as QtiMapResponse,Be as QtiMapping,ci as QtiMatch,xe as QtiMatchInteraction,Dt as QtiMediaInteraction,di as QtiMember,Ct as QtiModalFeedback,pi as QtiMultiple,hi as QtiNot,ui as QtiOr,le as QtiOrderInteraction,mi as QtiOrdered,J as QtiOutcomeDeclaration,kt as QtiOutcomeProcessing,Zr as QtiOutcomeProcessingProcessor,Se as QtiPortableCustomInteraction,Sr as QtiPositionObjectInteraction,It as QtiPositionObjectStage,St as QtiPrintedVariable,gi as QtiProduct,ur as QtiPrompt,Jr as QtiResponseCondition,ne as QtiResponseDeclaration,Tt as QtiResponseElse,ti as QtiResponseElseIf,At as QtiResponseIf,Ae as QtiResponseProcessing,Q as QtiRubricBlock,te as QtiRule,qe as QtiSelectPointInteraction,Qr as QtiSetOutcomeValue,ei as QtiSetOutcomeValueRule,ye as QtiSimpleAssociableChoice,Je as QtiSimpleChoice,P as QtiSliderInteraction,kr as QtiStringMatch,mr as QtiStylesheet,_r as QtiSubtract,fi as QtiSum,bi as QtiSumExpression,Jt as QtiTest,X as QtiTestPart,ee as QtiTextEntryInteraction,vi as QtiVariable,Ve as TestContainer,ut as TestItemLink,pt as TestNext,ze as TestPagingButtonsStamp,ht as TestPrev,Y as TestView,$ as itemContext,ws as itemContextVariables,Io as qtiAndMixin,No as qtiSubtractMixin};
4213
4405
  /*! Bundled license information:
4214
4406
 
4215
4407
  @lit/context/lib/context-request-event.js: