@citolab/qti-components 7.21.1 → 7.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +173 -79
- package/custom-elements.json +22 -0
- package/dist/{chunk-EZL3MMGB.js → chunk-K7HR6ZAY.js} +14 -17
- package/dist/chunk-K7HR6ZAY.js.map +1 -0
- package/dist/{chunk-GXGMEWRF.js → chunk-MF25NAZ4.js} +3 -3
- package/dist/{chunk-WVQHQNRT.js → chunk-NUNAE73U.js} +139 -7
- package/dist/chunk-NUNAE73U.js.map +1 -0
- package/dist/{chunk-TEMACJLU.js → chunk-RXRKP6P7.js} +2 -2
- package/dist/{chunk-Q67QWJ64.js → chunk-ULXR5TWK.js} +2 -2
- package/dist/{chunk-FQVLAL65.js → chunk-YAGFD5RQ.js} +2 -2
- package/dist/elements.js +2 -2
- package/dist/index.js +6 -6
- package/dist/interactions.js +1 -1
- package/dist/item.js +2 -2
- package/dist/loader.js +2 -2
- package/dist/qti-components-jsx.d.ts +11567 -0
- package/dist/test.js +3 -3
- package/dist/transformers.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-EZL3MMGB.js.map +0 -1
- package/dist/chunk-WVQHQNRT.js.map +0 -1
- /package/dist/{chunk-GXGMEWRF.js.map → chunk-MF25NAZ4.js.map} +0 -0
- /package/dist/{chunk-TEMACJLU.js.map → chunk-RXRKP6P7.js.map} +0 -0
- /package/dist/{chunk-Q67QWJ64.js.map → chunk-ULXR5TWK.js.map} +0 -0
- /package/dist/{chunk-FQVLAL65.js.map → chunk-YAGFD5RQ.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var ol=Object.defineProperty;var nl=Object.getOwnPropertyDescriptor;var jo=
|
|
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 "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=cl(),this.__pendingWhenDefineds.set(r,t)),t.promise}},dl=
|
|
1
|
+
var ol=Object.defineProperty;var nl=Object.getOwnPropertyDescriptor;var jo=n=>{throw TypeError(n)};var c=(n,r,e,t)=>{for(var i=t>1?void 0:t?nl(r,e):r,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(t?o(r,e,i):o(i))||i);return t&&i&&ol(r,e,i),i};var ks=(n,r,e)=>r.has(n)||jo("Cannot "+e);var x=(n,r,e)=>(ks(n,r,"read from private field"),e?e.call(n):r.get(n)),T=(n,r,e)=>r.has(n)?jo("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,e),$=(n,r,e,t)=>(ks(n,r,"write to private field"),t?t.call(n,e):r.set(n,e),e),R=(n,r,e)=>(ks(n,r,"access private method"),e);var Wo=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){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=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var be=function(n,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?n!==r||!i:!r.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(n,e):i?i.value=e:r.set(n,e),e},j=function(n,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?n!==r||!t:!r.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(n):t?t.value:r.get(n)},wt,vi,yi,sr,Ms,or,xi,lt,nr,ze,qi,Xo,Go=n=>typeof n=="boolean"?n:n?.capture??!1;var Rs=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=Go(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);if(s===void 0)s=new Map,i.set(r,s);else if(s.has(e))return;let o=typeof t=="object"&&t?t:{};o.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),s.set(e,o??{})}removeEventListener(r,e,t){if(e==null)return;let i=Go(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);s!==void 0&&(s.delete(e),s.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,s=!1,o=0,a=null,l=null,d=null,p=r.stopPropagation,m=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??l},...V},srcElement:{get(){return r.target},...V},currentTarget:{get(){return d},...V},eventPhase:{get(){return o},...V},composedPath:{value:()=>e,...V},stopPropagation:{value:()=>{i=!0,p.call(r)},...V},stopImmediatePropagation:{value:()=>{s=!0,m.call(r)},...V}});let f=(q,M,O)=>{typeof q=="function"?q(r):typeof q?.handleEvent=="function"&&q.handleEvent(r),M.once&&O.delete(q)},g=()=>(d=null,o=0,!r.defaultPrevented),v=e.slice().reverse();a=!this.__host||!r.composed?this:null;let E=q=>{for(l=this;l.__host&&q.includes(l.__host);)l=l.__host};for(let q of v){!a&&(!l||l===q.__host)&&E(v.slice(v.indexOf(q))),d=q,o=q===r.target?2:1;let M=q.__captureEventListeners.get(r.type);if(M){for(let[O,H]of M)if(f(O,H,M),s)return g()}if(i)return g()}let S=r.bubbles?e:[this];l=null;for(let q of S){!a&&(!l||q===l.__host)&&E(S.slice(0,S.indexOf(q)+1)),d=q,o=q===r.target?2:3;let M=q.__eventListeners.get(r.type);if(M){for(let[O,H]of M)if(f(O,H,M),s)return g()}if(i)return g()}return g()}},Is=Rs;var V={__proto__:null};V.enumerable=!0;Object.freeze(V);var _s=(ze=class{constructor(r,e={}){if(wt.set(this,!1),vi.set(this,!1),yi.set(this,!1),sr.set(this,!1),Ms.set(this,Date.now()),or.set(this,!1),xi.set(this,void 0),lt.set(this,void 0),nr.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:s}=e;be(this,wt,!!i,"f"),be(this,vi,!!t,"f"),be(this,yi,!!s,"f"),be(this,xi,`${r}`,"f"),be(this,lt,null,"f"),be(this,nr,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){be(this,sr,!0,"f")}get target(){return j(this,lt,"f")}get currentTarget(){return j(this,lt,"f")}get srcElement(){return j(this,lt,"f")}get type(){return j(this,xi,"f")}get cancelable(){return j(this,wt,"f")}get defaultPrevented(){return j(this,wt,"f")&&j(this,sr,"f")}get timeStamp(){return j(this,Ms,"f")}composedPath(){return j(this,nr,"f")?[j(this,lt,"f")]:[]}get returnValue(){return!j(this,wt,"f")||!j(this,sr,"f")}get bubbles(){return j(this,vi,"f")}get composed(){return j(this,yi,"f")}get eventPhase(){return j(this,nr,"f")?ze.AT_TARGET:ze.NONE}get cancelBubble(){return j(this,or,"f")}set cancelBubble(r){r&&be(this,or,!0,"f")}stopPropagation(){be(this,or,!0,"f")}get isTrusted(){return!1}},wt=new WeakMap,vi=new WeakMap,yi=new WeakMap,sr=new WeakMap,Ms=new WeakMap,or=new WeakMap,xi=new WeakMap,lt=new WeakMap,nr=new WeakMap,ze.NONE=0,ze.CAPTURING_PHASE=1,ze.AT_TARGET=2,ze.BUBBLING_PHASE=3,ze);Object.defineProperties(_s.prototype,{initEvent:V,stopImmediatePropagation:V,preventDefault:V,target:V,currentTarget:V,srcElement:V,type:V,cancelable:V,defaultPrevented:V,timeStamp:V,composedPath:V,returnValue:V,bubbles:V,composed:V,eventPhase:V,cancelBubble:V,stopPropagation:V,isTrusted:V});var Qo=(Xo=class extends _s{constructor(r,e={}){super(r,e),qi.set(this,void 0),be(this,qi,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return j(this,qi,"f")}},qi=new WeakMap,Xo);Object.defineProperties(Qo.prototype,{detail:V});var Ls=_s,$s=Qo;globalThis.Event??=Ls;globalThis.CustomEvent??=$s;var Yo=new WeakMap,ar=n=>{let r=Yo.get(n);return r===void 0&&Yo.set(n,r=new Map),r},al=class extends Is{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ar(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){ar(this).set(r,String(e))}removeAttribute(r){ar(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return ar(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.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 r=new Wo(this);return this.__internals=r,r}getAttribute(r){return ar(this).get(r)??null}};var ll=class extends al{},Os=ll;globalThis.litServerRoot??=Object.defineProperty(new Os,"localName",{get(){return"lit-server-root"}});function cl(){let n,r;return{promise:new Promise((t,i)=>{n=t,r=i}),resolve:n,reject:r}}var Ps=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" 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 "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=cl(),this.__pendingWhenDefineds.set(r,t)),t.promise}},dl=Ps;var Jo=new dl;var lr=globalThis,Ci=lr.ShadowRoot&&(lr.ShadyCSS===void 0||lr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vs=Symbol(),Ko=new WeakMap,cr=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Vs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(Ci&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ko.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ko.set(e,r))}return r}toString(){return this.cssText}},Zo=n=>new cr(typeof n=="string"?n:n+"",void 0,Vs),y=(n,...r)=>{let e=n.length===1?n[0]:r.reduce(((t,i,s)=>t+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1]),n[0]);return new cr(e,n,Vs)},en=(n,r)=>{if(Ci)n.adoptedStyleSheets=r.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of r){let t=document.createElement("style"),i=lr.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,n.appendChild(t)}},Ns=Ci||lr.CSSStyleSheet===void 0?n=>n:n=>n instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Zo(e)})(n):n;var{is:pl,defineProperty:ul,getOwnPropertyDescriptor:ml,getOwnPropertyNames:hl,getOwnPropertySymbols:fl,getPrototypeOf:gl}=Object,ur=globalThis;ur.customElements??=Jo;var tn=ur.trustedTypes,bl=tn?tn.emptyScript:"",vl=ur.reactiveElementPolyfillSupport,dr=(n,r)=>n,pr={toAttribute(n,r){switch(r){case Boolean:n=n?bl:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,r){let e=n;switch(r){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},wi=(n,r)=>!pl(n,r),rn={attribute:!0,type:String,converter:pr,reflect:!1,useDefault:!1,hasChanged:wi};Symbol.metadata??=Symbol("metadata"),ur.litPropertyMetadata??=new WeakMap;var Re=class extends(globalThis.HTMLElement??Os){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=rn){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&ul(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:s}=ml(this.prototype,r)??{get(){return this[e]},set(o){this[e]=o}};return{get:i,set(o){let a=i?.call(this);s?.call(this,o),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??rn}static _$Ei(){if(this.hasOwnProperty(dr("elementProperties")))return;let r=gl(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(dr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(dr("properties"))){let e=this.properties,t=[...hl(e),...fl(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ns(i))}else r!==void 0&&e.push(Ns(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.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((r=>this.enableUpdating=r)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((r=>r(this)))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return en(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((r=>r.hostConnected?.()))}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach((r=>r.hostDisconnected?.()))}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:pr).toAttribute(e,t.type);this._$Em=r,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:pr;this._$Em=i;let a=o.fromAttribute(e,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t){if(r!==void 0){let i=this.constructor,s=this[r];if(t??=i.getPropertyOptions(r),!((t.hasChanged??wi)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(r)&&!this.hasAttribute(i._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:s},o){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,o??e??this[r]),s!==!0||o!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(r){}firstUpdated(r){}};Re.elementStyles=[],Re.shadowRootOptions={mode:"open"},Re[dr("elementProperties")]=new Map,Re[dr("finalized")]=new Map,vl?.({ReactiveElement:Re}),(ur.reactiveElementVersions??=[]).push("2.1.1");var Ri=globalThis,Ei=Ri.trustedTypes,sn=Ei?Ei.createPolicy("lit-html",{createHTML:n=>n}):void 0,Hs="$lit$",Ie=`lit$${Math.random().toFixed(9).slice(2)}$`,zs="?"+Ie,yl=`<${zs}>`,pt=Ri.document===void 0?{createTreeWalker:()=>({})}:document,hr=()=>pt.createComment(""),fr=n=>n===null||typeof n!="object"&&typeof n!="function",Us=Array.isArray,dn=n=>Us(n)||typeof n?.[Symbol.iterator]=="function",Ds=`[
|
|
3
3
|
\f\r]`,mr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,on=/-->/g,nn=/>/g,ct=RegExp(`>|${Ds}(?:([^\\s"'>=/]+)(${Ds}*=${Ds}*(?:[^
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),an=/'/g,ln=/"/g,pn=/^(?:script|style|textarea|title)$/i,Bs=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Bs(1),_i=Bs(2),qc=Bs(3),z=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),cn=new WeakMap,dt=pt.createTreeWalker(pt,129);function un(o,r){if(!Us(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return sn!==void 0?sn.createHTML(r):r}var mn=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=mr;for(let a=0;a<e;a++){let l=o[a],d,p,m=-1,f=0;for(;f<l.length&&(n.lastIndex=f,p=n.exec(l),p!==null);)f=n.lastIndex,n===mr?p[1]==="!--"?n=on:p[1]!==void 0?n=nn:p[2]!==void 0?(pn.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=ct):p[3]!==void 0&&(n=ct):n===ct?p[0]===">"?(n=i??mr,m=-1):p[1]===void 0?m=-2:(m=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?ct:p[3]==='"'?ln:an):n===ln||n===an?n=ct:n===on||n===nn?n=mr:(n=ct,i=void 0);let g=n===ct&&o[a+1].startsWith("/>")?" ":"";s+=n===mr?l+yl:m>=0?(t.push(d),l.slice(0,m)+Hs+l.slice(m)+_e+g):l+_e+(m===-2?a:g)}return[un(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},gr=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,l=this.parts,[d,p]=mn(r,e);if(this.el=o.createElement(d,t),dt.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=dt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Hs)){let f=p[n++],g=i.getAttribute(m).split(_e),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:v[2],strings:g,ctor:v[1]==="."?Si:v[1]==="?"?Ai:v[1]==="@"?ki:mt}),i.removeAttribute(m)}else m.startsWith(_e)&&(l.push({type:6,index:s}),i.removeAttribute(m));if(pn.test(i.tagName)){let m=i.textContent.split(_e),f=m.length-1;if(f>0){i.textContent=Ei?Ei.emptyScript:"";for(let g=0;g<f;g++)i.append(m[g],hr()),dt.nextNode(),l.push({type:2,index:++s});i.append(m[f],hr())}}}else if(i.nodeType===8)if(i.data===zs)l.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(_e,m+1))!==-1;)l.push({type:7,index:s}),m+=_e.length-1}s++}}static createElement(r,e){let t=pt.createElement("template");return t.innerHTML=r,t}};function ut(o,r,e=o,t){if(r===z)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=fr(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=ut(o,i._$AS(o,r.values),i,t)),r}var Ti=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??pt).importNode(e,!0);dt.currentNode=i;let s=dt.nextNode(),n=0,a=0,l=t[0];for(;l!==void 0;){if(n===l.index){let d;l.type===2?d=new Et(s,s.nextSibling,this,r):l.type===1?d=new l.ctor(s,l.name,l.strings,this,r):l.type===6&&(d=new Mi(s,this,r)),this._$AV.push(d),l=t[++a]}n!==l?.index&&(s=dt.nextNode(),n++)}return dt.currentNode=pt,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Et=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=L,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=ut(this,r,e),fr(r)?r===L||r==null||r===""?(this._$AH!==L&&this._$AR(),this._$AH=L):r!==this._$AH&&r!==z&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):dn(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==L&&fr(this._$AH)?this._$AA.nextSibling.data=r:this.T(pt.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=gr.createElement(un(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Ti(i,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(r){let e=cn.get(r.strings);return e===void 0&&cn.set(r.strings,e=new gr(r)),e}k(r){Us(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new o(this.O(hr()),this.O(hr()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},mt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=L,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=L}_$AI(r,e=this,t,i){let s=this.strings,n=!1;if(s===void 0)r=ut(this,r,e,0),n=!fr(r)||r!==this._$AH&&r!==z,n&&(this._$AH=r);else{let a=r,l,d;for(r=s[0],l=0;l<s.length-1;l++)d=ut(this,a[t+l],e,l),d===z&&(d=this._$AH[l]),n||=!fr(d)||d!==this._$AH[l],d===L?r=L:r!==L&&(r+=(d??"")+s[l+1]),this._$AH[l]=d}n&&!i&&this.j(r)}j(r){r===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Si=class extends mt{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===L?void 0:r}},Ai=class extends mt{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==L)}},ki=class extends mt{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=ut(this,r,e,0)??L)===z)return;let t=this._$AH,i=r===L&&t!==L||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==L&&(t===L||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},Mi=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){ut(this,r)}},W={M:Hs,P:_e,A:zs,C:1,L:mn,R:Ti,D:dn,V:ut,I:Et,H:mt,N:Ai,U:ki,B:Si,F:Mi},xl=Ri.litHtmlPolyfillSupport;xl?.(gr,Et),(Ri.litHtmlVersions??=[]).push("3.3.1");var Fs=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new Et(r.insertBefore(hr(),s),s,void 0,e??{})}return i._$AI(o),i};var js=globalThis,b=class extends Re{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Fs(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};b._$litElement$=!0,b.finalized=!0,js.litElementHydrateSupport?.({LitElement:b});var ql=js.litElementPolyfillSupport;ql?.({LitElement:b});(js.litElementVersions??=[]).push("4.2.1");var C=o=>(r,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(o,r)})):customElements.define(o,r)};var Cl={attribute:!0,type:String,converter:pr,reflect:!1,hasChanged:wi},wl=(o=Cl,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(e.name,o),t==="accessor"){let{name:n}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,l,o)},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let l=this[n];r.call(this,a),this.requestUpdate(n,l,o)}}throw Error("Unsupported decorator location: "+t)};function u(o){return(r,e)=>typeof e=="object"?wl(o,r,e):((t,i,s)=>{let n=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),n?Object.getOwnPropertyDescriptor(i,s):void 0})(o,r,e)}function w(o){return u({...o,state:!0,attribute:!1})}var Ue=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function Tt(o,r){return(e,t,i)=>{let s=n=>n.renderRoot?.querySelector(o)??null;if(r){let{get:n,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(d){this[l]=d}}})();return Ue(e,t,{get(){let l=n.call(this);return l===void 0&&(l=s(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ue(e,t,{get(){return s(this)}})}}function hn(o){return(r,e)=>{let{slot:t,selector:i}=o??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Ue(r,e,{get(){let n=this.renderRoot?.querySelector(s),a=n?.assignedElements(o)??[];return i===void 0?a:a.filter((l=>l.matches(i)))}})}}function fn(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=bn(t,i);t.replaceWith(s)})}function gn(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=bn(e,n);e.replaceWith(a)}})})}function bn(o,r){let e=o.ownerDocument.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function vn(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function St(o,r){return fetch(o,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function At(o){return new DOMParser().parseFromString(o,"text/xml")}function yn(o,r){if(o.nodeType===Node.ELEMENT_NODE){let e=o,t=r.createElement(e.localName);for(let i=0;i<e.attributes.length;i++){let s=e.attributes[i];t.setAttribute(s.localName,s.value)}for(let i=0;i<e.childNodes.length;i++)t.appendChild(yn(e.childNodes[i],r));return t}return o.cloneNode(!1)}function kt(o){let r=document.createDocumentFragment();for(let e=0;e<o.childNodes.length;e++)r.appendChild(yn(o.childNodes[e],document));return r}function Mt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function xn(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function qn(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function Cn(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}var ve=(o=!1)=>{let r,e="",t={load(i,s){e=i;let n=encodeURI(i);return o&&sessionStorage.getItem(n)?Promise.resolve(t.parse(sessionStorage.getItem(n))):St(i,s).then(a=>(r=a,t.shuffleInteractions(),o&&sessionStorage.setItem(n,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=At(i),t},path:i=>(Mt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n);if(l.length===0)return t;let d=null,p=null,m=async()=>{if(d===null)try{d=await s(i,"/modules/module_resolution.js")}catch{d=null}if(p===null)try{p=await s(i,"/modules/fallback_module_resolution.js")}catch{p=null}};for(let f of Array.from(l)){f.setAttribute("data-base-url",i);let g=f.getAttribute("custom-interaction-type-identifier");g&&a.includes(g)&&(g=g+a.length,f.setAttribute("custom-interaction-type-identifier",g),a.push(g)),g&&a.push(g);let v=f.querySelector("qti-interaction-modules");if(v&&v.getAttribute("primary-configuration")){await m();let E=v.getAttribute("primary-configuration");if(E)try{let S=await s(i,`/${E}`),q=Array.from(v.querySelectorAll("qti-interaction-module"));for(let M of q){let P=M.getAttribute("id");if(P&&S.paths&&S.paths[P]){let H=S.paths[P],ee=Array.isArray(H)?H[0]:H;if(M.setAttribute("primary-path",ee),p&&p.paths&&p.paths[P]){let F=p.paths[P];Array.isArray(F)?M.setAttribute("fallback-path",F[0]):M.setAttribute("fallback-path",F)}}}if(S.paths){for(let M in S.paths)if(!v.querySelector(`qti-interaction-module[id="${M}"]`)){let H=r.createElement("qti-interaction-module");H.setAttribute("id",M);let ee=Array.isArray(S.paths[M])?S.paths[M][0]:S.paths[M];if(H.setAttribute("primary-path",ee),p&&p.paths&&p.paths[M]){let F=p.paths[M];Array.isArray(F)?H.setAttribute("fallback-path",F[0]):H.setAttribute("fallback-path",F)}v.appendChild(H)}}S.urlArgs&&v.setAttribute("url-args",S.urlArgs)}catch(S){console.warn(`Failed to load primary configuration: ${E}`,S)}}else if(await m(),d){f.querySelector("qti-interaction-modules")===null?(v=r.createElement("qti-interaction-modules"),f.appendChild(v)):v=f.querySelector("qti-interaction-modules");for(let E in d.paths){let S=d.paths[E],q="";p&&p.paths&&p.paths[E]&&(q=p.paths[E]);let M=Array.isArray(S)?S:[S],P=Array.isArray(q)?q:[q],H=M.map((ee,F)=>{let sl=P.length>F?P[F]:"";return{primaryPath:ee,fallbackPath:sl}});for(let ee of P)H.some(F=>F.fallbackPath===ee)||H.push({primaryPath:M.length>0?M[0]:ee,fallbackPath:ee});for(let ee of H){let F=r.createElement("qti-interaction-module");ee.fallbackPath&&F.setAttribute("fallback-path",ee.fallbackPath),F.setAttribute("id",E),F.setAttribute("primary-path",ee.primaryPath),v&&v.appendChild(F)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=Cn(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let d of l){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,M)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:M})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let g=[...f],v=!1,E=0;for(;!v&&E<20;){E++;for(let q=f.length-1;q>0;q--){let M=Math.floor(Math.random()*(q+1));[f[q],f[M]]=[f[M],f[q]]}v=!f.every((q,M)=>q===g[M])}if(!v)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let S=0;for(let q of f)q.parentElement.insertBefore(q,m[S]?.element),S++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(fn(r,i,s),t),extendElementsWithClass:(i="extend")=>(gn(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return xn(r),t},stripStyleSheets(){return qn(r),t},html(){return e!==null&&Mt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(kt(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&Mt(r,e.substring(0,e.lastIndexOf("/"))),kt(r)},xmlDoc(){return r}};return t};var wn=()=>{let o,r={async load(e,t){return new Promise(i=>{St(e,t).then(s=>(o=s,i(r)))})},parse(e){o=At(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return r};var Rt=()=>{let o,r={async load(e,t){return new Promise((i,s)=>{St(e,t).then(n=>(o=n,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return o=At(e),r},path:e=>(Mt(o,e),r),fn(e){return e(o),r},items(){return vn(o)},html(){return new XMLSerializer().serializeToString(kt(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return kt(o)},xmlDoc(){return o}};return r};var En=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._activeController=null;this._loadResults=[];this._navigationId=0;this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1};this._loadedStimulusHrefs=new Set;this._loadingStimulusHrefs=new Set;this._bindEventHandlers()}navigateTo(i,s){let n=s||this._getDefaultNavigationId(i);n&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let s=i.detail;this._loadingState.connectedItems++;let n=s.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:s,item:n}=i;if(console.info("Stimulus ref connected:",{identifier:s.identifier,href:s.href,item:n.identifier}),this._loadedStimulusHrefs.has(s.href)){console.info("Stimulus already loaded, skipping:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(s.href)){console.info("Stimulus already loading, skipping duplicate:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(s.href),console.info("Starting stimulus load:",s.href);try{await this._loadStimulusRef(s,n),this._loadedStimulusHrefs.add(s.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",s.href),this._checkLoadingComplete()}catch(a){a.name!=="AbortError"&&console.warn(`Failed to load stimulus ${s.identifier}:`,a),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(s.href)}}_getDefaultNavigationId(i){return i==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);i&&this.navigateTo(this.navigate,i)}async _handleNavigationRequest({detail:i}){if(!i?.id)return;this._cancelPreviousNavigation();let s=++this._navigationId,n=new AbortController;try{this._dispatchLoadingStarted(i.type,i.id),this._activeController=n,await this._executeNavigation(i.type,i.id,s,n)}catch(a){this._handleNavigationError(a,i.type,i.id)}finally{this._activeController===n&&(this._activeController=null),this._dispatchLoadingEnded(i.type,i.id)}}_handleNavigationError(i,s,n){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,s,n))}async _executeNavigation(i,s,n,a){i==="item"?await this._navigateToItem(s,n,a):await this._navigateToSection(s,n,a)}async _navigateToItem(i,s,n){let a=this._findItemRef(i);this._updateSessionContext(a,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],s,n),await this._waitForLoadingComplete(s,n),!this._isStaleNavigation(s,n)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(i,s,n){let l=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:l,navSectionId:i,navItemRefId:null};let d=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=d.length,await this._loadItems(d,s,n),await this._waitForLoadingComplete(s,n),!this._isStaleNavigation(s,n)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,s=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&s&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,s){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,s))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,s){console.info("Loading stimulus:",i.href);let n=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,i,s)}_applyStimulusContent(i,s,n){if(!i){console.warn("No stimulus content to apply");return}let a=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${a.length} stimulus elements to apply for ${s.identifier}`),a.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let l=[],d=document.querySelector(`qti-assessment-item[identifier="${n.identifier}"] [data-stimulus-idref="${s.identifier}"]`);if(d)l.push(d),console.info("Found specific target:",d);else{let p=Array.from(this.querySelectorAll(`[data-stimulus-idref="${s.identifier}"]`));if(p.length>0)l=p,console.info("Found targets by identifier:",p.length);else{let m=Array.from(this.querySelectorAll("[data-stimulus-idref]"));l=m,console.info("Using fallback targets:",m.length)}}if(l.length===0){console.warn("No targets found for stimulus content");return}l.forEach((p,m)=>{p.innerHTML="";let f=Array.from(a).map(g=>g.cloneNode(!0));p.append(...f),console.info(`Applied stimulus content to target ${m+1}/${l.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,s,n){if(!this._testElement||i.length===0)return;let a=i.map(p=>this._findItemRef(p));this._clearLoadedItems(),this._clearStimulusRef();let d=(await Promise.all(a.map(p=>this._loadSingleItem(p,s,n)))).filter(Boolean);this._isStaleNavigation(s,n)||(d.forEach(({itemRef:p,doc:m})=>{p&&m&&(p.xmlDoc=m)}),d.forEach(({itemRef:p})=>{let m=p?.identifier;if(!p||!m)return;let f=this.testContext.items.find(g=>g.identifier===m)?.state;f!==void 0&&p.updateComplete.then(()=>{let g=p.assessmentItem;g&&(g.state=f)})}),this._loadResults=d)}async _loadSingleItem(i,s,n){try{let a=await ve(this.cacheTransform).load(i.href,n.signal);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(s,n)?null:{itemRef:i,doc:a.htmlDoc()}}catch(a){if(a.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),a;return console.warn(`Failed to load item ${i.identifier}:`,a),null}}async _loadStimulus(i){return(await ve().load(i,this._activeController?.signal)).htmlDoc()}_findItemRef(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw new Error(`Item with identifier "${i}" not found`);return s}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,s){let n=i.closest("qti-test-part")?.identifier,a=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:s}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(s=>s.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,s){return s.signal.aborted||i!==this._navigationId}_createNavigationError(i,s,n){return{message:i.message||`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchLoadingStarted(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchError(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchTestLoaded(i){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:i.map(({itemRef:s})=>({identifier:s?.identifier,element:s})),bubbles:!0,composed:!0}))})}}return c([u({type:String})],r.prototype,"navigate",2),c([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),c([u({type:Number})],r.prototype,"requestTimeout",2),c([u({attribute:!1})],r.prototype,"postLoadTransformCallback",2),c([u({attribute:!1})],r.prototype,"postLoadTestTransformCallback",2),r};var Tn=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,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(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var Be=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var _t=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,n)),this.unsubscribe=n},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,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 Be(this.context,this.host,this.t,this.subscribe))}};var Ii=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ws=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},It=class extends Ii{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Be(this.context,a,n,!0)));i.stopPropagation()},this.host=r,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 Ws(this.context,this.host))}};function te({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new It(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer((n=>{t.set(n,new It(n,{context:o}))}));let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let n=new WeakMap;s={get(){return n.get(this)},set(a){t.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;s={...i,set(a){t.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function k({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new _t(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new _t(i,{context:o,callback:s=>{i[t]=s},subscribe:r})}))}}var Fe=Symbol("computedItemContext");var N=Symbol("computedContext");var le=Symbol("configContext");var Sn=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var D=Symbol("item");var Lt=Symbol("qtiContext");var Xs={view:"candidate"},je=Symbol("testContext");var Gs={items:[],testOutcomeVariables:[]},ye=Symbol("testContext");function Li(o,r){return(e,t)=>{let{connectedCallback:i,disconnectedCallback:s}=e;e.connectedCallback=function(){i.call(this);let n=this[t],a=m=>{let f=[],g=[];for(let q of m)q.type==="childList"&&(q.addedNodes.forEach(M=>{if(M.nodeType!==1)return;let P=M;P.matches?.(o)&&f.push(P),f.push(...P.querySelectorAll?.(o)??[])}),q.removedNodes.forEach(M=>{if(M.nodeType!==1)return;let P=M;P.matches?.(o)&&g.push(P),g.push(...P.querySelectorAll?.(o)??[])}));let v=q=>Array.from(new Set(q)),E=v(f),S=v(g);(E.length||S.length)&&n.call(this,E,S)},l=new MutationObserver(a);l.observe(this,{childList:!0,subtree:!0});let d=this.shadowRoot?new MutationObserver(a):null;d?.observe(this.shadowRoot,{childList:!0,subtree:!0}),this.__lqObservers=[l,d].filter(m=>!!m),(async()=>{r?.waitUntilFirstUpdate&&"updateComplete"in this&&await this.updateComplete;let m=[...this.querySelectorAll(o),...this.shadowRoot?.querySelectorAll(o)??[]];m.length&&n.call(this,m,[])})()},e.disconnectedCallback=function(){s.call(this),this.__lqObservers?.forEach(n=>n.disconnect()),this.__lqObservers=void 0}}}function O(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(l=>{let d=l;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,m)}}),s.call(this,a)}}}var We={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},re=o=>(...r)=>({_$litDirective$:o,values:r}),xe=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:El}=W,kn=o=>o===null||typeof o!="object"&&typeof o!="function";var Mn=o=>o.strings===void 0,An=()=>document.createComment(""),$t=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(An(),i),n=t.insertBefore(An(),i);e=new El(s,n,o,o.options)}else{let s=e._$AB.nextSibling,n=e._$AM,a=n!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==n._$AU&&e._$AP(l)}if(s!==i||a){let l=e._$AA;for(;l!==s;){let d=l.nextSibling;t.insertBefore(l,i),l=d}}}return e},Xe=(o,r,e=o)=>(o._$AI(r,e),o),Tl={},Rn=(o,r=Tl)=>o._$AH=r,_n=o=>o._$AH,$i=o=>{o._$AR(),o._$AA.remove()};var br=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),br(t,r);return!0},Oi=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},In=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),kl(r)}};function Sl(o){this._$AN!==void 0?(Oi(this),this._$AM=o,In(this)):this._$AM=o}function Al(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)br(t[s],!1),Oi(t[s]);else t!=null&&(br(t,!1),Oi(t));else br(this,o)}var kl=o=>{o.type==We.CHILD&&(o._$AP??=Al,o._$AQ??=Sl)},Ge=class extends xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),In(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(br(this,r),Oi(this))}setValue(r){if(Mn(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Qs=class extends Ge{constructor(){super(...arguments);this.prevData={}}render(e){return L}update(e,[t]){return this.element!==e.element&&(this.element=e.element),this.host=e.options?.host||this.element,this.apply(t),this.groom(t),this.prevData={...t},L}apply(e){let t=this.#e(e),{prevData:i,element:s}=this;for(let n in t){let a=t[n];a!==i[n]&&(a===!0?s.setAttribute(n,""):a===!1?s.removeAttribute(n):a!=null?s.setAttribute(n,String(a)):s.removeAttribute(n))}}groom(e){let{prevData:t,element:i}=this;if(!t)return;let s=e?this.#e(e):{};for(let n in t)(!s||!(n in s))&&i.removeAttribute(n)}#e(e){return Object.fromEntries(Object.entries(e).filter(([t,i])=>typeof i=="function"?!1:t==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},_p=re(Qs);var Ln=(t=>(t.Correct="correct",t.PartiallyCorrect="partially-correct",t.Incorrect="incorrect",t))(Ln||{}),_=class extends b{constructor(){super();this.disabled=!1;this.readonly=!1;this.showCorrectResponse=!1;this._handleShowCorrectResponseChange=(e,t)=>{this.toggleInternalCorrectResponse(t)};this.showFullCorrectResponse=!1;this._handleShowFullCorrectResponseChange=(e,t)=>{this.toggleFullCorrectResponse(t)};this.showCandidateCorrection=!1;this._handleShowCandidateCorrectionChange=(e,t)=>{this.toggleCandidateCorrection(t)};this._correctResponse=null;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}set correctResponseAttr(e){e===null?this._correctResponse=null:e.includes(",")?this._correctResponse=e.split(",").map(t=>t.trim()):this._correctResponse=e}get correctResponseAttr(){return this._correctResponse===null||this._correctResponse===void 0?null:Array.isArray(this._correctResponse)?this._correctResponse.join(","):this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){let e=this.responseVariable;return e?.correctResponse?e.correctResponse:this._correctResponse}set correctResponse(e){let t=this._correctResponse;this._correctResponse=e,e==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(e)?e.join(","):e),this.requestUpdate("_correctResponse",t)}get correctness(){let e=this.correctResponse;if(!e)return null;let t=this.response;if(t==null||t===""||Array.isArray(t)&&t.length===0)return null;let i=Array.isArray(e)?e:[e],n=(Array.isArray(t)?t:[t]).filter(d=>d!=="");if(n.length===0)return null;let a=n.filter(d=>i.includes(d)).length,l=n.filter(d=>!i.includes(d)).length;return a===i.length&&l===0&&n.length===i.length?"correct":a>0&&(a<i.length||l>0)?"partially-correct":"incorrect"}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(e&&(this?.configContext?.fullCorrectResponseOnlyWhenIncorrect===!1||this.correctness!=="correct"))){if(!i)return;this.parentElement?.removeChild(t);return}if(i)return;let a=this.cloneNode(!0);a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(a),a.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await a.updateComplete,a.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(e){this._internals.states.delete("show-correct-response"),e&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(e){this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect"))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}firstUpdated(){this.isFullCorrectResponse||(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0))}saveResponse(e,t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e,...t!==void 0?{state:t}:{}}}))}};c([k({context:D,subscribe:!0})],_.prototype,"_context",2),c([k({context:le,subscribe:!0})],_.prototype,"configContext",2),c([u({type:String,attribute:"response-identifier"})],_.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],_.prototype,"disabled",2),c([u({reflect:!0,type:Boolean})],_.prototype,"readonly",2),c([u({type:String})],_.prototype,"name",2),c([u({type:String,attribute:"correct-response",reflect:!0})],_.prototype,"correctResponseAttr",1),c([u({type:Boolean,attribute:"show-correct-response",reflect:!0})],_.prototype,"showCorrectResponse",2),c([O("showCorrectResponse",{waitUntilFirstUpdate:!0})],_.prototype,"_handleShowCorrectResponseChange",2),c([u({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],_.prototype,"showFullCorrectResponse",2),c([O("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],_.prototype,"_handleShowFullCorrectResponseChange",2),c([u({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],_.prototype,"showCandidateCorrection",2),c([O("showCandidateCorrection",{waitUntilFirstUpdate:!0})],_.prototype,"_handleShowCandidateCorrectionChange",2),c([w()],_.prototype,"_isFullCorrectResponse",2),c([w()],_.prototype,"_correctResponse",2);var Ot=class extends b{render(){return h`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};var A=class extends b{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(s=>s.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.value),cardinality:"ordered",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context?.variables?.find(s=>s.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}static{this.styles=y`
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),an=/'/g,ln=/"/g,pn=/^(?:script|style|textarea|title)$/i,Bs=n=>(r,...e)=>({_$litType$:n,strings:r,values:e}),h=Bs(1),Ii=Bs(2),qc=Bs(3),z=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),cn=new WeakMap,dt=pt.createTreeWalker(pt,129);function un(n,r){if(!Us(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return sn!==void 0?sn.createHTML(r):r}var mn=(n,r)=>{let e=n.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",o=mr;for(let a=0;a<e;a++){let l=n[a],d,p,m=-1,f=0;for(;f<l.length&&(o.lastIndex=f,p=o.exec(l),p!==null);)f=o.lastIndex,o===mr?p[1]==="!--"?o=on:p[1]!==void 0?o=nn:p[2]!==void 0?(pn.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=ct):p[3]!==void 0&&(o=ct):o===ct?p[0]===">"?(o=i??mr,m=-1):p[1]===void 0?m=-2:(m=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?ct:p[3]==='"'?ln:an):o===ln||o===an?o=ct:o===on||o===nn?o=mr:(o=ct,i=void 0);let g=o===ct&&n[a+1].startsWith("/>")?" ":"";s+=o===mr?l+yl:m>=0?(t.push(d),l.slice(0,m)+Hs+l.slice(m)+Ie+g):l+Ie+(m===-2?a:g)}return[un(n,s+(n[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},gr=class n{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,o=0,a=r.length-1,l=this.parts,[d,p]=mn(r,e);if(this.el=n.createElement(d,t),dt.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=dt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Hs)){let f=p[o++],g=i.getAttribute(m).split(Ie),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:v[2],strings:g,ctor:v[1]==="."?Si:v[1]==="?"?Ai:v[1]==="@"?ki:mt}),i.removeAttribute(m)}else m.startsWith(Ie)&&(l.push({type:6,index:s}),i.removeAttribute(m));if(pn.test(i.tagName)){let m=i.textContent.split(Ie),f=m.length-1;if(f>0){i.textContent=Ei?Ei.emptyScript:"";for(let g=0;g<f;g++)i.append(m[g],hr()),dt.nextNode(),l.push({type:2,index:++s});i.append(m[f],hr())}}}else if(i.nodeType===8)if(i.data===zs)l.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(Ie,m+1))!==-1;)l.push({type:7,index:s}),m+=Ie.length-1}s++}}static createElement(r,e){let t=pt.createElement("template");return t.innerHTML=r,t}};function ut(n,r,e=n,t){if(r===z)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=fr(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=ut(n,i._$AS(n,r.values),i,t)),r}var Ti=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??pt).importNode(e,!0);dt.currentNode=i;let s=dt.nextNode(),o=0,a=0,l=t[0];for(;l!==void 0;){if(o===l.index){let d;l.type===2?d=new Et(s,s.nextSibling,this,r):l.type===1?d=new l.ctor(s,l.name,l.strings,this,r):l.type===6&&(d=new Mi(s,this,r)),this._$AV.push(d),l=t[++a]}o!==l?.index&&(s=dt.nextNode(),o++)}return dt.currentNode=pt,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},Et=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=L,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=ut(this,r,e),fr(r)?r===L||r==null||r===""?(this._$AH!==L&&this._$AR(),this._$AH=L):r!==this._$AH&&r!==z&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):dn(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==L&&fr(this._$AH)?this._$AA.nextSibling.data=r:this.T(pt.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=gr.createElement(un(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Ti(i,this),o=s.u(this.options);s.p(e),this.T(o),this._$AH=s}}_$AC(r){let e=cn.get(r.strings);return e===void 0&&cn.set(r.strings,e=new gr(r)),e}k(r){Us(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new n(this.O(hr()),this.O(hr()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},mt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=L,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=L}_$AI(r,e=this,t,i){let s=this.strings,o=!1;if(s===void 0)r=ut(this,r,e,0),o=!fr(r)||r!==this._$AH&&r!==z,o&&(this._$AH=r);else{let a=r,l,d;for(r=s[0],l=0;l<s.length-1;l++)d=ut(this,a[t+l],e,l),d===z&&(d=this._$AH[l]),o||=!fr(d)||d!==this._$AH[l],d===L?r=L:r!==L&&(r+=(d??"")+s[l+1]),this._$AH[l]=d}o&&!i&&this.j(r)}j(r){r===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Si=class extends mt{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===L?void 0:r}},Ai=class extends mt{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==L)}},ki=class extends mt{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=ut(this,r,e,0)??L)===z)return;let t=this._$AH,i=r===L&&t!==L||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==L&&(t===L||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},Mi=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){ut(this,r)}},W={M:Hs,P:Ie,A:zs,C:1,L:mn,R:Ti,D:dn,V:ut,I:Et,H:mt,N:Ai,U:ki,B:Si,F:Mi},xl=Ri.litHtmlPolyfillSupport;xl?.(gr,Et),(Ri.litHtmlVersions??=[]).push("3.3.1");var Fs=(n,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new Et(r.insertBefore(hr(),s),s,void 0,e??{})}return i._$AI(n),i};var js=globalThis,b=class extends Re{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Fs(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};b._$litElement$=!0,b.finalized=!0,js.litElementHydrateSupport?.({LitElement:b});var ql=js.litElementPolyfillSupport;ql?.({LitElement:b});(js.litElementVersions??=[]).push("4.2.1");var C=n=>(r,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(n,r)})):customElements.define(n,r)};var Cl={attribute:!0,type:String,converter:pr,reflect:!1,hasChanged:wi},wl=(n=Cl,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((n=Object.create(n)).wrapped=!0),s.set(e.name,n),t==="accessor"){let{name:o}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(o,l,n)},init(a){return a!==void 0&&this.C(o,void 0,n,a),a}}}if(t==="setter"){let{name:o}=e;return function(a){let l=this[o];r.call(this,a),this.requestUpdate(o,l,n)}}throw Error("Unsupported decorator location: "+t)};function u(n){return(r,e)=>typeof e=="object"?wl(n,r,e):((t,i,s)=>{let o=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),o?Object.getOwnPropertyDescriptor(i,s):void 0})(n,r,e)}function w(n){return u({...n,state:!0,attribute:!1})}var Ue=(n,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(n,r,e),e);function Tt(n,r){return(e,t,i)=>{let s=o=>o.renderRoot?.querySelector(n)??null;if(r){let{get:o,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(d){this[l]=d}}})();return Ue(e,t,{get(){let l=o.call(this);return l===void 0&&(l=s(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ue(e,t,{get(){return s(this)}})}}function hn(n){return(r,e)=>{let{slot:t,selector:i}=n??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Ue(r,e,{get(){let o=this.renderRoot?.querySelector(s),a=o?.assignedElements(n)??[];return i===void 0?a:a.filter((l=>l.matches(i)))}})}}function fn(n,r,e){Array.from(n.getElementsByTagName("*")).filter(s=>s.localName===r||s.localName?.toLowerCase()===r.toLowerCase()).forEach(s=>{let o=`${r}-${e}`,a=bn(s,o);s.replaceWith(a)})}function gn(n,r){n.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),o=`${e.nodeName}-${s}`,a=bn(e,o);e.replaceWith(a)}})})}function bn(n,r){let e=n.ownerDocument.createElement(r);for(let t of n.attributes)e.setAttribute(t.name,t.value);for(;n.firstChild;)e.appendChild(n.firstChild);return e}function vn(n){let r=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function St(n,r){return fetch(n,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function At(n){return new DOMParser().parseFromString(n,"text/xml")}function yn(n,r){if(n.nodeType===Node.ELEMENT_NODE){let e=n,t=r.createElement(e.localName);for(let i=0;i<e.attributes.length;i++){let s=e.attributes[i];t.setAttribute(s.localName,s.value)}for(let i=0;i<e.childNodes.length;i++)t.appendChild(yn(e.childNodes[i],r));return t}return n.cloneNode(!1)}function kt(n){let r=document.createDocumentFragment();for(let e=0;e<n.childNodes.length;e++)r.appendChild(yn(n.childNodes[e],document));return r}function Mt(n,r){r.endsWith("/")||(r+="/"),n.querySelectorAll("*").forEach(t=>{for(let i of["src","href"]){let s=t.getAttribute(i)?.trim();if(s&&!/^(data:|https?:|blob:)/.test(s)){let o=r+encodeURI(s);t.setAttribute(i,o)}}})}function xn(n){n.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function qn(n){n.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function Cn(n){switch(n){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}var ve=(n=!1)=>{let r,e="",t={load(i,s){e=i;let o=encodeURI(i);return n&&sessionStorage.getItem(o)?Promise.resolve(t.parse(sessionStorage.getItem(o))):St(i,s).then(a=>(r=a,t.shuffleInteractions(),n&&sessionStorage.setItem(o,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=At(i),t},path:i=>(Mt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],o=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",o+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,o="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(o);if(l.length===0)return t;let d=null,p=null,m=async()=>{if(d===null)try{d=await s(i,"/modules/module_resolution.js")}catch{d=null}if(p===null)try{p=await s(i,"/modules/fallback_module_resolution.js")}catch{p=null}};for(let f of Array.from(l)){f.setAttribute("data-base-url",i);let g=f.getAttribute("custom-interaction-type-identifier");g&&a.includes(g)&&(g=g+a.length,f.setAttribute("custom-interaction-type-identifier",g),a.push(g)),g&&a.push(g);let v=f.querySelector("qti-interaction-modules");if(v&&v.getAttribute("primary-configuration")){await m();let E=v.getAttribute("primary-configuration");if(E)try{let S=await s(i,`/${E}`),q=Array.from(v.querySelectorAll("qti-interaction-module"));for(let M of q){let O=M.getAttribute("id");if(O&&S.paths&&S.paths[O]){let H=S.paths[O],ee=Array.isArray(H)?H[0]:H;if(M.setAttribute("primary-path",ee),p&&p.paths&&p.paths[O]){let F=p.paths[O];Array.isArray(F)?M.setAttribute("fallback-path",F[0]):M.setAttribute("fallback-path",F)}}}if(S.paths){for(let M in S.paths)if(!v.querySelector(`qti-interaction-module[id="${M}"]`)){let H=r.createElement("qti-interaction-module");H.setAttribute("id",M);let ee=Array.isArray(S.paths[M])?S.paths[M][0]:S.paths[M];if(H.setAttribute("primary-path",ee),p&&p.paths&&p.paths[M]){let F=p.paths[M];Array.isArray(F)?H.setAttribute("fallback-path",F[0]):H.setAttribute("fallback-path",F)}v.appendChild(H)}}S.urlArgs&&v.setAttribute("url-args",S.urlArgs)}catch(S){console.warn(`Failed to load primary configuration: ${E}`,S)}}else if(await m(),d){f.querySelector("qti-interaction-modules")===null?(v=r.createElement("qti-interaction-modules"),f.appendChild(v)):v=f.querySelector("qti-interaction-modules");for(let E in d.paths){let S=d.paths[E],q="";p&&p.paths&&p.paths[E]&&(q=p.paths[E]);let M=Array.isArray(S)?S:[S],O=Array.isArray(q)?q:[q],H=M.map((ee,F)=>{let sl=O.length>F?O[F]:"";return{primaryPath:ee,fallbackPath:sl}});for(let ee of O)H.some(F=>F.fallbackPath===ee)||H.push({primaryPath:M.length>0?M[0]:ee,fallbackPath:ee});for(let ee of H){let F=r.createElement("qti-interaction-module");ee.fallbackPath&&F.setAttribute("fallback-path",ee.fallbackPath),F.setAttribute("id",E),F.setAttribute("primary-path",ee.primaryPath),v&&v.appendChild(F)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(o=>o.tagName?.toLowerCase().endsWith("-interaction"));for(let o of s){let a=Cn(o.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let d of l){let p=Array.from(o.querySelectorAll(d)),m=p.map((q,M)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:M})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let g=[...f],v=!1,E=0;for(;!v&&E<20;){E++;for(let q=f.length-1;q>0;q--){let M=Math.floor(Math.random()*(q+1));[f[q],f[M]]=[f[M],f[q]]}v=!f.every((q,M)=>q===g[M])}if(!v)return console.warn("Failed to shuffle the choices after multiple attempts."),null;o.removeAttribute("shuffle");let S=0;for(let q of f)q.parentElement.insertBefore(q,m[S]?.element),S++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(fn(r,i,s),t),extendElementsWithClass:(i="extend")=>(gn(r,i),t),customInteraction(i,s){let o=r.querySelector("qti-custom-interaction"),a=o.querySelector("object");return o.setAttribute("data-base-ref",i),o.setAttribute("data-base-item",i+s),o.setAttribute("data",a.getAttribute("data")),o.setAttribute("width",a.getAttribute("width")),o.setAttribute("height",a.getAttribute("height")),o.removeChild(a),t},convertCDATAtoComment(){return xn(r),t},stripStyleSheets(){return qn(r),t},html(){return e!==null&&Mt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(kt(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&Mt(r,e.substring(0,e.lastIndexOf("/"))),kt(r)},xmlDoc(){return r}};return t};var wn=()=>{let n,r={async load(e,t){return new Promise(i=>{St(e,t).then(s=>(n=s,i(r)))})},parse(e){n=At(e)},assessmentTest(){let e=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return r};var Rt=()=>{let n,r={async load(e,t){return new Promise((i,s)=>{St(e,t).then(o=>(n=o,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return n=At(e),r},path:e=>(Mt(n,e),r),fn(e){return e(n),r},items(){return vn(n)},html(){return new XMLSerializer().serializeToString(kt(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(){return kt(n)},xmlDoc(){return n}};return r};var En=n=>{class r extends n{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._activeController=null;this._loadResults=[];this._navigationId=0;this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1};this._loadedStimulusHrefs=new Set;this._loadingStimulusHrefs=new Set;this._bindEventHandlers()}navigateTo(i,s){let o=s||this._getDefaultNavigationId(i);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:o},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let s=i.detail;this._loadingState.connectedItems++;let o=s.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:s,item:o}=i;if(console.info("Stimulus ref connected:",{identifier:s.identifier,href:s.href,item:o.identifier}),this._loadedStimulusHrefs.has(s.href)){console.info("Stimulus already loaded, skipping:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(s.href)){console.info("Stimulus already loading, skipping duplicate:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(s.href),console.info("Starting stimulus load:",s.href);try{await this._loadStimulusRef(s,o),this._loadedStimulusHrefs.add(s.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",s.href),this._checkLoadingComplete()}catch(a){a.name!=="AbortError"&&console.warn(`Failed to load stimulus ${s.identifier}:`,a),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(s.href)}}_getDefaultNavigationId(i){return i==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);i&&this.navigateTo(this.navigate,i)}async _handleNavigationRequest({detail:i}){if(!i?.id)return;this._cancelPreviousNavigation();let s=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(i.type,i.id),this._activeController=o,await this._executeNavigation(i.type,i.id,s,o)}catch(a){this._handleNavigationError(a,i.type,i.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(i.type,i.id)}}_handleNavigationError(i,s,o){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,s,o))}async _executeNavigation(i,s,o,a){i==="item"?await this._navigateToItem(s,o,a):await this._navigateToSection(s,o,a)}async _navigateToItem(i,s,o){let a=this._findItemRef(i);this._updateSessionContext(a,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],s,o),await this._waitForLoadingComplete(s,o),!this._isStaleNavigation(s,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(i,s,o){let l=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:l,navSectionId:i,navItemRefId:null};let d=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=d.length,await this._loadItems(d,s,o),await this._waitForLoadingComplete(s,o),!this._isStaleNavigation(s,o)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,s=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&s&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,s){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,s))return;await new Promise(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,s){console.info("Loading stimulus:",i.href);let o=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,i,s)}_applyStimulusContent(i,s,o){if(!i){console.warn("No stimulus content to apply");return}let a=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${a.length} stimulus elements to apply for ${s.identifier}`),a.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let l=[],d=document.querySelector(`qti-assessment-item[identifier="${o.identifier}"] [data-stimulus-idref="${s.identifier}"]`);if(d)l.push(d),console.info("Found specific target:",d);else{let p=Array.from(this.querySelectorAll(`[data-stimulus-idref="${s.identifier}"]`));if(p.length>0)l=p,console.info("Found targets by identifier:",p.length);else{let m=Array.from(this.querySelectorAll("[data-stimulus-idref]"));l=m,console.info("Using fallback targets:",m.length)}}if(l.length===0){console.warn("No targets found for stimulus content");return}l.forEach((p,m)=>{p.innerHTML="";let f=Array.from(a).map(g=>g.cloneNode(!0));p.append(...f),console.info(`Applied stimulus content to target ${m+1}/${l.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,s,o){if(!this._testElement||i.length===0)return;let a=i.map(p=>this._findItemRef(p));this._clearLoadedItems(),this._clearStimulusRef();let d=(await Promise.all(a.map(p=>this._loadSingleItem(p,s,o)))).filter(Boolean);this._isStaleNavigation(s,o)||(d.forEach(({itemRef:p,doc:m})=>{p&&m&&(p.xmlDoc=m)}),d.forEach(({itemRef:p})=>{let m=p?.identifier;if(!p||!m)return;let f=this.testContext.items.find(g=>g.identifier===m)?.state;f!==void 0&&p.updateComplete.then(()=>{let g=p.assessmentItem;g&&(g.state=f)})}),this._loadResults=d)}async _loadSingleItem(i,s,o){try{let a=await ve(this.cacheTransform).load(i.href,o.signal);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(s,o)?null:{itemRef:i,doc:a.htmlDoc()}}catch(a){if(a.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),a;return console.warn(`Failed to load item ${i.identifier}:`,a),null}}async _loadStimulus(i){return(await ve().load(i,this._activeController?.signal)).htmlDoc()}_findItemRef(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw new Error(`Item with identifier "${i}" not found`);return s}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,s){let o=i.closest("qti-test-part")?.identifier,a=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,navSectionId:a,navItemRefId:s}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(s=>s.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,s){return s.signal.aborted||i!==this._navigationId}_createNavigationError(i,s,o){return{message:i.message||`Failed to load ${s}: ${o}`,details:i,itemId:s==="item"?o:void 0,sectionId:s==="section"?o:void 0}}_dispatchLoadingStarted(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchError(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchTestLoaded(i){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:i.map(({itemRef:s})=>({identifier:s?.identifier,element:s})),bubbles:!0,composed:!0}))})}}return c([u({type:String})],r.prototype,"navigate",2),c([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),c([u({type:Number})],r.prototype,"requestTimeout",2),c([u({attribute:!1})],r.prototype,"postLoadTransformCallback",2),c([u({attribute:!1})],r.prototype,"postLoadTestTransformCallback",2),r};var Tn=n=>{class r extends n{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,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(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(o=>{o.classList.toggle("show",o.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var Be=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var It=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,o)=>{this.unsubscribe&&(this.unsubscribe!==o&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,o)),this.unsubscribe=o},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,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 Be(this.context,this.host,this.t,this.subscribe))}};var _i=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ws=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},_t=class extends _i{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[o,{consumerHost:a}]of this.subscriptions)s.has(o)||(s.add(o),a.dispatchEvent(new Be(this.context,a,o,!0)));i.stopPropagation()},this.host=r,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 Ws(this.context,this.host))}};function te({context:n}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new _t(this,{context:n,initialValue:i})),i}};{r.constructor.addInitializer((o=>{t.set(o,new _t(o,{context:n}))}));let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let o=new WeakMap;s={get(){return o.get(this)},set(a){t.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{let o=i.set;s={...i,set(a){t.get(this).setValue(a),o?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function k({context:n,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new It(this,{context:n,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new It(i,{context:n,callback:s=>{i[t]=s},subscribe:r})}))}}var Fe=Symbol("computedItemContext");var N=Symbol("computedContext");var le=Symbol("configContext");var Sn=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var D=Symbol("item");var Lt=Symbol("qtiContext");var Xs={view:"candidate"},je=Symbol("testContext");var Gs={items:[],testOutcomeVariables:[]},ye=Symbol("testContext");function Li(n,r){return(e,t)=>{let{connectedCallback:i,disconnectedCallback:s}=e;e.connectedCallback=function(){i.call(this);let o=this[t],a=m=>{let f=[],g=[];for(let q of m)q.type==="childList"&&(q.addedNodes.forEach(M=>{if(M.nodeType!==1)return;let O=M;O.matches?.(n)&&f.push(O),f.push(...O.querySelectorAll?.(n)??[])}),q.removedNodes.forEach(M=>{if(M.nodeType!==1)return;let O=M;O.matches?.(n)&&g.push(O),g.push(...O.querySelectorAll?.(n)??[])}));let v=q=>Array.from(new Set(q)),E=v(f),S=v(g);(E.length||S.length)&&o.call(this,E,S)},l=new MutationObserver(a);l.observe(this,{childList:!0,subtree:!0});let d=this.shadowRoot?new MutationObserver(a):null;d?.observe(this.shadowRoot,{childList:!0,subtree:!0}),this.__lqObservers=[l,d].filter(m=>!!m),(async()=>{r?.waitUntilFirstUpdate&&"updateComplete"in this&&await this.updateComplete;let m=[...this.querySelectorAll(n),...this.shadowRoot?.querySelectorAll(n)??[]];m.length&&o.call(this,m,[])})()},e.disconnectedCallback=function(){s.call(this),this.__lqObservers?.forEach(o=>o.disconnect()),this.__lqObservers=void 0}}}function P(n,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,o=Array.isArray(n)?n:[n];t.update=function(a){o.forEach(l=>{let d=l;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,m)}}),s.call(this,a)}}}var We={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},re=n=>(...r)=>({_$litDirective$:n,values:r}),xe=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:El}=W,kn=n=>n===null||typeof n!="object"&&typeof n!="function";var Mn=n=>n.strings===void 0,An=()=>document.createComment(""),$t=(n,r,e)=>{let t=n._$AA.parentNode,i=r===void 0?n._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(An(),i),o=t.insertBefore(An(),i);e=new El(s,o,n,n.options)}else{let s=e._$AB.nextSibling,o=e._$AM,a=o!==n;if(a){let l;e._$AQ?.(n),e._$AM=n,e._$AP!==void 0&&(l=n._$AU)!==o._$AU&&e._$AP(l)}if(s!==i||a){let l=e._$AA;for(;l!==s;){let d=l.nextSibling;t.insertBefore(l,i),l=d}}}return e},Xe=(n,r,e=n)=>(n._$AI(r,e),n),Tl={},Rn=(n,r=Tl)=>n._$AH=r,In=n=>n._$AH,$i=n=>{n._$AR(),n._$AA.remove()};var br=(n,r)=>{let e=n._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),br(t,r);return!0},Pi=n=>{let r,e;do{if((r=n._$AM)===void 0)break;e=r._$AN,e.delete(n),n=r}while(e?.size===0)},_n=n=>{for(let r;r=n._$AM;n=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(n))break;e.add(n),kl(r)}};function Sl(n){this._$AN!==void 0?(Pi(this),this._$AM=n,_n(this)):this._$AM=n}function Al(n,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)br(t[s],!1),Pi(t[s]);else t!=null&&(br(t,!1),Pi(t));else br(this,n)}var kl=n=>{n.type==We.CHILD&&(n._$AP??=Al,n._$AQ??=Sl)},Ge=class extends xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),_n(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(br(this,r),Pi(this))}setValue(r){if(Mn(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Qs=class extends Ge{constructor(){super(...arguments);this.prevData={}}render(e){return L}update(e,[t]){return this.element!==e.element&&(this.element=e.element),this.host=e.options?.host||this.element,this.apply(t),this.groom(t),this.prevData={...t},L}apply(e){let t=this.#e(e),{prevData:i,element:s}=this;for(let o in t){let a=t[o];a!==i[o]&&(a===!0?s.setAttribute(o,""):a===!1?s.removeAttribute(o):a!=null?s.setAttribute(o,String(a)):s.removeAttribute(o))}}groom(e){let{prevData:t,element:i}=this;if(!t)return;let s=e?this.#e(e):{};for(let o in t)(!s||!(o in s))&&i.removeAttribute(o)}#e(e){return Object.fromEntries(Object.entries(e).filter(([t,i])=>typeof i=="function"?!1:t==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},Ip=re(Qs);var Ln=(t=>(t.Correct="correct",t.PartiallyCorrect="partially-correct",t.Incorrect="incorrect",t))(Ln||{}),I=class extends b{constructor(){super();this.disabled=!1;this.readonly=!1;this.showCorrectResponse=!1;this._handleShowCorrectResponseChange=(e,t)=>{this.toggleInternalCorrectResponse(t)};this.showFullCorrectResponse=!1;this._handleShowFullCorrectResponseChange=(e,t)=>{this.toggleFullCorrectResponse(t)};this.showCandidateCorrection=!1;this._handleShowCandidateCorrectionChange=(e,t)=>{this.toggleCandidateCorrection(t)};this._correctResponse=null;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}set correctResponseAttr(e){e===null?this._correctResponse=null:e.includes(",")?this._correctResponse=e.split(",").map(t=>t.trim()):this._correctResponse=e}get correctResponseAttr(){return this._correctResponse===null||this._correctResponse===void 0?null:Array.isArray(this._correctResponse)?this._correctResponse.join(","):this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){let e=this.responseVariable;return e?.correctResponse?e.correctResponse:this._correctResponse}set correctResponse(e){let t=this._correctResponse;this._correctResponse=e,e==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(e)?e.join(","):e),this.requestUpdate("_correctResponse",t)}get correctness(){let e=this.correctResponse;if(!e)return null;let t=this.response;if(t==null||t===""||Array.isArray(t)&&t.length===0)return null;let i=Array.isArray(e)?e:[e],o=(Array.isArray(t)?t:[t]).filter(d=>d!=="");if(o.length===0)return null;let a=o.filter(d=>i.includes(d)).length,l=o.filter(d=>!i.includes(d)).length;return a===i.length&&l===0&&o.length===i.length?"correct":a>0&&(a<i.length||l>0)?"partially-correct":"incorrect"}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(e&&(this?.configContext?.fullCorrectResponseOnlyWhenIncorrect===!1||this.correctness!=="correct"))){if(!i)return;this.parentElement?.removeChild(t);return}if(i)return;let a=this.cloneNode(!0);a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(a),a.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await a.updateComplete,a.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(e){this._internals.states.delete("show-correct-response"),e&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(e){this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect"))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}firstUpdated(){this.isFullCorrectResponse||(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0))}saveResponse(e,t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e,...t!==void 0?{state:t}:{}}}))}};c([k({context:D,subscribe:!0})],I.prototype,"_context",2),c([k({context:le,subscribe:!0})],I.prototype,"configContext",2),c([u({type:String,attribute:"response-identifier"})],I.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],I.prototype,"disabled",2),c([u({reflect:!0,type:Boolean})],I.prototype,"readonly",2),c([u({type:String})],I.prototype,"name",2),c([u({type:String,attribute:"correct-response",reflect:!0})],I.prototype,"correctResponseAttr",1),c([u({type:Boolean,attribute:"show-correct-response",reflect:!0})],I.prototype,"showCorrectResponse",2),c([P("showCorrectResponse",{waitUntilFirstUpdate:!0})],I.prototype,"_handleShowCorrectResponseChange",2),c([u({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],I.prototype,"showFullCorrectResponse",2),c([P("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],I.prototype,"_handleShowFullCorrectResponseChange",2),c([u({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],I.prototype,"showCandidateCorrection",2),c([P("showCandidateCorrection",{waitUntilFirstUpdate:!0})],I.prototype,"_handleShowCandidateCorrectionChange",2),c([w()],I.prototype,"_isFullCorrectResponse",2),c([w()],I.prototype,"_correctResponse",2);var Pt=class extends b{render(){return h`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};var A=class extends b{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(s=>s.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.value),cardinality:"ordered",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context?.variables?.find(s=>s.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}static{this.styles=y`
|
|
5
5
|
slot {
|
|
6
6
|
display: none;
|
|
7
7
|
}
|
|
8
8
|
`}render(){return h`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
9
|
-
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};c([w()],A.prototype,"result",2),c([k({context:D,subscribe:!0}),w()],A.prototype,"context",2),c([k({context:Lt,subscribe:!0}),w()],A.prototype,"qtiContext",2);var ce=class extends A{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Ml=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),vr=o=>{if(typeof o=="string")return o;let r=Ml();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Ys(o){return o==null}function yr(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var ie=class extends b{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ys(this.identifier)&&!Ys(e?.value)&&this.identifier===e.value||!1,this.#e(t)}#e(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],ie.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],ie.prototype,"outcomeIdentifier",2),c([u({type:String})],ie.prototype,"identifier",2),c([u({type:String,attribute:!1})],ie.prototype,"showStatus",2),c([k({context:D,subscribe:!0}),w()],ie.prototype,"_context",2);var $n=class extends b{};var X=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[n,...a]=e.split(","),l=a.map(Number);switch(n.toLowerCase()){case"circle":case"default":{let[d,p,m]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-d)**2+(s-p)**2)<=m}case"rect":{let[d,p,m,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=d&&i<=m&&s>=p&&s<=f}case"ellipse":{let[d,p,m,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let g=(i-d)**2/m**2,v=(s-p)**2/f**2;return g+v<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let d=[];for(let p=0;p<l.length;p+=2)d.push({x:l[p],y:l[p+1]});return this.isPointInPolygon({x:i,y:s},d)}default:return console.warn(`Unsupported shape type: ${n}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let n=e[i].x,a=e[i].y,l=e[s].x,d=e[s].y;a>r.y!=d>r.y&&r.x<(l-n)*(r.y-a)/(d-a)+n&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var Js=o=>{class r extends o{constructor(...i){super(...i);this.testContext=Gs;this.sessionContext=Xs;this._updateItemInTestContext=i=>{let s=i._context,n=s.identifier,a=s.variables,l=this.testContext.items.find(d=>d?.identifier===n);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${n} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(n,a);else{let d=[...i.variables];for(let p of l.variables){let m=d.find(f=>f.identifier===p.identifier);m?m.value=p.value:d.push(p)}i.variables=d}};this._initializeEventListeners()}updateItemVariables(i,s){let n=this.testContext.items.find(l=>l.identifier===i);n&&(n.variables=n.variables.map(l=>{let d=s.find(p=>p.identifier===l.identifier);return d?{...l,...d}:l}));let a=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);a&&a.assessmentItem&&(a.assessmentItem.variables=s)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",i=>{if(this.testContext=Gs,this.sessionContext=Xs,this.testContext&&this.testContext.items.length>0)return;this._testElement=i.detail;let s=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:s}}),this.addEventListener("qti-assessment-item-connected",i=>{let s=i.detail,n=s.closest("qti-assessment-item-ref")?.identifier;n&&(s.assessmentItemRefId=n),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables,i.detail.itemContext.state)})}_updateItemVariablesInTestContext(i,s,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:s.map(l=>{let d=a.variables.find(p=>p.identifier===l.identifier);return d?{...d,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return c([u({attribute:!1,type:Object}),te({context:ye})],r.prototype,"testContext",2),c([u({attribute:!1,type:Object}),te({context:je})],r.prototype,"sessionContext",2),r},On=class extends Js(b){};var Pn=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var Pi=class extends En(Tn(Pn(Js(b)))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};Pi=c([C("qti-test")],Pi);var Vn={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ie=class extends b{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 this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};c([u({type:String})],Ie.prototype,"category",2),c([u({type:String})],Ie.prototype,"identifier",2),c([u({type:Boolean,converter:Vn})],Ie.prototype,"required",2),c([u({type:Boolean,converter:Vn})],Ie.prototype,"fixed",2),c([u({type:String})],Ie.prototype,"href",2),c([u({type:Object,attribute:!1})],Ie.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",Ie);var Ks={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Le=class extends b{get title(){return this.#e}set title(r){this.#e=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}#e="";async connectedCallback(){this.#e=this.getAttribute("title")||"",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>`}};c([u({type:String})],Le.prototype,"identifier",2),c([u({type:String})],Le.prototype,"required",2),c([u({type:Boolean,converter:Ks})],Le.prototype,"fixed",2),c([u({type:Boolean,converter:Ks})],Le.prototype,"visible",2),c([u({type:Boolean,converter:Ks,attribute:"keep-together"})],Le.prototype,"keepTogether",2),c([k({context:ye,subscribe:!0})],Le.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",Le);var xr,ft=class extends b{constructor(){super(...arguments);T(this,xr,"")}get title(){return x(this,xr)}set title(e){$(this,xr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}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>`}};xr=new WeakMap,c([u({type:String})],ft.prototype,"identifier",2),c([u({type:String})],ft.prototype,"title",1),c([k({context:ye,subscribe:!0})],ft.prototype,"_testContext",2),ft=c([C("qti-assessment-test")],ft);var qr,$e=class extends b{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";T(this,qr,"")}get title(){return x(this,qr)}set title(e){$(this,qr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};qr=new WeakMap,c([u({type:String})],$e.prototype,"identifier",2),c([u({type:String})],$e.prototype,"class",2),c([u({type:String,attribute:"navigation-mode"})],$e.prototype,"navigationMode",2),c([u({type:String,attribute:"submission-mode"})],$e.prototype,"submissionMode",2),$e=c([C("qti-test-part")],$e);customElements.get("qti-test-part")||customElements.define("qti-test-part",$e);var Cr,Pt,wr,Vt,de,ue,Nn,Dn,Er,Tr,Sr,Ar,kr,Mr,Hn,Zs,se=class extends b{constructor(){super(...arguments);T(this,ue);T(this,Cr);T(this,Pt,null);this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{x(this,de).forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>x(this,de).forEach(i=>i.readonly=t);this._context={variables:Sn};T(this,wr,{...this._context,variables:this._context.variables});T(this,Vt,[]);T(this,de,[]);T(this,Er,e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},$(this,wr,this._context),e.stopPropagation()});T(this,Tr,e=>{e.stopImmediatePropagation();let t=e.detail;x(this,Vt).push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)});T(this,Sr,e=>{e.stopImmediatePropagation(),x(this,de).push(e.detail.interactionElement)});T(this,Ar,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)});T(this,kr,e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()});T(this,Mr,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i,state:s}=e.detail;this.updateResponseVariable(t,i),s!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[t]:s}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))})}get title(){return x(this,Cr)}set title(e){$(this,Cr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}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(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=x(this,de).find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&x(this,Vt).forEach(i=>i.checkShowFeedback(t.identifier))})}get state(){return this._context.state}set state(e){this._context={...this._context,state:e?{...e}:void 0}}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=x(this,de).find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){R(this,ue,Nn).call(this),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),R(this,ue,Hn).call(this)})}disconnectedCallback(){R(this,ue,Dn).call(this),super.disconnectedCallback()}showCorrectResponse(e){for(let t of x(this,de))t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of x(this,de))t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(n=>n.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing"),s=!!(i&&typeof i.process=="function");return s&&i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",R(this,ue,Zs).call(this)),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),s}resetResponses(){this._context=x(this,wr)}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",R(this,ue,Zs).call(this))}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){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(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},x(this,Vt).forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=x(this,de).every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of x(this,de))e.reportValidity()}};Cr=new WeakMap,Pt=new WeakMap,wr=new WeakMap,Vt=new WeakMap,de=new WeakMap,ue=new WeakSet,Nn=function(){this.addEventListener("qti-register-variable",x(this,Er)),this.addEventListener("qti-register-feedback",x(this,Tr)),this.addEventListener("qti-register-interaction",x(this,Sr)),this.addEventListener("end-attempt",x(this,Ar)),this.addEventListener("qti-set-outcome-value",x(this,kr)),this.addEventListener("qti-interaction-response",x(this,Mr))},Dn=function(){this.removeEventListener("qti-register-variable",x(this,Er)),this.removeEventListener("qti-register-feedback",x(this,Tr)),this.removeEventListener("qti-register-interaction",x(this,Sr)),this.removeEventListener("end-attempt",x(this,Ar)),this.removeEventListener("qti-set-outcome-value",x(this,kr)),this.removeEventListener("qti-interaction-response",x(this,Mr))},Er=new WeakMap,Tr=new WeakMap,Sr=new WeakMap,Ar=new WeakMap,kr=new WeakMap,Mr=new WeakMap,Hn=function(){$(this,Pt,this.querySelector("qti-template-processing")),x(this,Pt)&&x(this,Pt).process()},Zs=function(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"},c([u({type:String})],se.prototype,"identifier",2),c([u({type:String})],se.prototype,"adaptive",2),c([u({type:String})],se.prototype,"timeDependent",2),c([u({type:String})],se.prototype,"title",1),c([u({type:Boolean})],se.prototype,"disabled",2),c([O("disabled",{waitUntilFirstUpdate:!0})],se.prototype,"_handleDisabledChange",2),c([u({type:Boolean})],se.prototype,"readonly",2),c([O("readonly",{waitUntilFirstUpdate:!0})],se.prototype,"_handleReadonlyChange",2),c([te({context:D})],se.prototype,"_context",2),se=c([C("qti-assessment-item")],se);var eo=class o extends Event{constructor(e,t){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},Nt=class extends b{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new eo(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await ve().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],Nt.prototype,"identifier",2),c([u({type:String})],Nt.prototype,"href",2),Nt=c([C("qti-assessment-stimulus-ref")],Nt);var Vi=class extends b{};Vi=c([C("qti-companion-materials-info")],Vi);var _r,Rr=class extends b{constructor(){super(...arguments);T(this,_r)}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,_r,new Function("context","fn","item",e?.textContent??""))}catch(t){console.error("custom-operator contains invalid javascript code",t)}}calculate(){let e={variable:i=>this._context?.variables.find(s=>s.identifier===i)?.value??"",correct:i=>this._context?.variables.find(s=>s.identifier===i)?.correctResponse??""},t={getVariable:i=>this._context?.variables.find(s=>s.identifier===i),updateOutcomeVariable:(i,s)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:s}}))},updateResponseVariable:(i,s)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:i,response:s}}))}};return x(this,_r).call(this,this._context,e,t)}};_r=new WeakMap,c([k({context:D,subscribe:!0}),w()],Rr.prototype,"_context",2),Rr=c([C("qti-custom-operator")],Rr);var Ir=class extends ie{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Ir.styles=y`
|
|
9
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};c([w()],A.prototype,"result",2),c([k({context:D,subscribe:!0}),w()],A.prototype,"context",2),c([k({context:Lt,subscribe:!0}),w()],A.prototype,"qtiContext",2);var ce=class extends A{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Ml=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),vr=n=>{if(typeof n=="string")return n;let r=Ml();return r==="."?n.toLocaleString():n.toString().replace(".","").replace(r,".")};function Ys(n){return n==null}function yr(n){return n.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var ie=class extends b{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ys(this.identifier)&&!Ys(e?.value)&&this.identifier===e.value||!1,this.#e(t)}#e(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],ie.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],ie.prototype,"outcomeIdentifier",2),c([u({type:String})],ie.prototype,"identifier",2),c([u({type:String,attribute:!1})],ie.prototype,"showStatus",2),c([k({context:D,subscribe:!0}),w()],ie.prototype,"_context",2);var $n=class extends b{};var X=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[o,...a]=e.split(","),l=a.map(Number);switch(o.toLowerCase()){case"circle":case"default":{let[d,p,m]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-d)**2+(s-p)**2)<=m}case"rect":{let[d,p,m,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=d&&i<=m&&s>=p&&s<=f}case"ellipse":{let[d,p,m,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let g=(i-d)**2/m**2,v=(s-p)**2/f**2;return g+v<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let d=[];for(let p=0;p<l.length;p+=2)d.push({x:l[p],y:l[p+1]});return this.isPointInPolygon({x:i,y:s},d)}default:return console.warn(`Unsupported shape type: ${o}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let o=e[i].x,a=e[i].y,l=e[s].x,d=e[s].y;a>r.y!=d>r.y&&r.x<(l-o)*(r.y-a)/(d-a)+o&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var Js=n=>{class r extends n{constructor(...i){super(...i);this.testContext=Gs;this.sessionContext=Xs;this._updateItemInTestContext=i=>{let s=i._context,o=s.identifier,a=s.variables,l=this.testContext.items.find(d=>d?.identifier===o);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${o} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(o,a);else{let d=[...i.variables];for(let p of l.variables){let m=d.find(f=>f.identifier===p.identifier);m?m.value=p.value:d.push(p)}i.variables=d}};this._initializeEventListeners()}updateItemVariables(i,s){let o=this.testContext.items.find(l=>l.identifier===i);o&&(o.variables=o.variables.map(l=>{let d=s.find(p=>p.identifier===l.identifier);return d?{...l,...d}:l}));let a=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);a&&a.assessmentItem&&(a.assessmentItem.variables=s)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",i=>{if(this.testContext=Gs,this.sessionContext=Xs,this.testContext&&this.testContext.items.length>0)return;this._testElement=i.detail;let s=Array.from(this._testElement.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.testContext={...this.testContext,items:s}}),this.addEventListener("qti-assessment-item-connected",i=>{let s=i.detail,o=s.closest("qti-assessment-item-ref")?.identifier;o&&(s.assessmentItemRefId=o),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables,i.detail.itemContext.state)})}_updateItemVariablesInTestContext(i,s,o){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:s.map(l=>{let d=a.variables.find(p=>p.identifier===l.identifier);return d?{...d,...l}:l}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return c([u({attribute:!1,type:Object}),te({context:ye})],r.prototype,"testContext",2),c([u({attribute:!1,type:Object}),te({context:je})],r.prototype,"sessionContext",2),r},Pn=class extends Js(b){};var On=n=>{class r extends n{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:o}=i.detail;this.updateOutcomeVariable(s,o),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(o=>o.identifier!==t?o:{...o,value:s.cardinality==="single"?i:[...o.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var Oi=class extends En(Tn(On(Js(b)))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};Oi=c([C("qti-test")],Oi);var Vn={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},_e=class extends b{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 this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};c([u({type:String})],_e.prototype,"category",2),c([u({type:String})],_e.prototype,"identifier",2),c([u({type:Boolean,converter:Vn})],_e.prototype,"required",2),c([u({type:Boolean,converter:Vn})],_e.prototype,"fixed",2),c([u({type:String})],_e.prototype,"href",2),c([u({type:Object,attribute:!1})],_e.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",_e);var Ks={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Le=class extends b{get title(){return this.#e}set title(r){this.#e=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}#e="";async connectedCallback(){this.#e=this.getAttribute("title")||"",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>`}};c([u({type:String})],Le.prototype,"identifier",2),c([u({type:String})],Le.prototype,"required",2),c([u({type:Boolean,converter:Ks})],Le.prototype,"fixed",2),c([u({type:Boolean,converter:Ks})],Le.prototype,"visible",2),c([u({type:Boolean,converter:Ks,attribute:"keep-together"})],Le.prototype,"keepTogether",2),c([k({context:ye,subscribe:!0})],Le.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",Le);var xr,ft=class extends b{constructor(){super(...arguments);T(this,xr,"")}get title(){return x(this,xr)}set title(e){$(this,xr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}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>`}};xr=new WeakMap,c([u({type:String})],ft.prototype,"identifier",2),c([u({type:String})],ft.prototype,"title",1),c([k({context:ye,subscribe:!0})],ft.prototype,"_testContext",2),ft=c([C("qti-assessment-test")],ft);var qr,$e=class extends b{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";T(this,qr,"")}get title(){return x(this,qr)}set title(e){$(this,qr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};qr=new WeakMap,c([u({type:String})],$e.prototype,"identifier",2),c([u({type:String})],$e.prototype,"class",2),c([u({type:String,attribute:"navigation-mode"})],$e.prototype,"navigationMode",2),c([u({type:String,attribute:"submission-mode"})],$e.prototype,"submissionMode",2),$e=c([C("qti-test-part")],$e);customElements.get("qti-test-part")||customElements.define("qti-test-part",$e);var Cr,Ot,wr,Vt,de,ue,Nn,Dn,Er,Tr,Sr,Ar,kr,Mr,Hn,Zs,se=class extends b{constructor(){super(...arguments);T(this,ue);T(this,Cr);T(this,Ot,null);this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{x(this,de).forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>x(this,de).forEach(i=>i.readonly=t);this._context={variables:Sn};T(this,wr,{...this._context,variables:this._context.variables});T(this,Vt,[]);T(this,de,[]);T(this,Er,e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},$(this,wr,this._context),e.stopPropagation()});T(this,Tr,e=>{e.stopImmediatePropagation();let t=e.detail;x(this,Vt).push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)});T(this,Sr,e=>{e.stopImmediatePropagation(),x(this,de).push(e.detail.interactionElement)});T(this,Ar,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)});T(this,kr,e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()});T(this,Mr,e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i,state:s}=e.detail;this.updateResponseVariable(t,i),s!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[t]:s}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))})}get title(){return x(this,Cr)}set title(e){$(this,Cr,e),this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}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(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=x(this,de).find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&x(this,Vt).forEach(i=>i.checkShowFeedback(t.identifier))})}get state(){return this._context.state}set state(e){this._context={...this._context,state:e?{...e}:void 0}}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=x(this,de).find(o=>o.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){R(this,ue,Nn).call(this),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),R(this,ue,Hn).call(this)})}disconnectedCallback(){R(this,ue,Dn).call(this),super.disconnectedCallback()}showCorrectResponse(e){for(let t of x(this,de))t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of x(this,de))t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(o=>o.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing"),s=!!(i&&typeof i.process=="function");return s&&i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",R(this,ue,Zs).call(this)),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),s}resetResponses(){this._context=x(this,wr)}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",R(this,ue,Zs).call(this))}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){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(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},x(this,Vt).forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=x(this,de).every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of x(this,de))e.reportValidity()}};Cr=new WeakMap,Ot=new WeakMap,wr=new WeakMap,Vt=new WeakMap,de=new WeakMap,ue=new WeakSet,Nn=function(){this.addEventListener("qti-register-variable",x(this,Er)),this.addEventListener("qti-register-feedback",x(this,Tr)),this.addEventListener("qti-register-interaction",x(this,Sr)),this.addEventListener("end-attempt",x(this,Ar)),this.addEventListener("qti-set-outcome-value",x(this,kr)),this.addEventListener("qti-interaction-response",x(this,Mr))},Dn=function(){this.removeEventListener("qti-register-variable",x(this,Er)),this.removeEventListener("qti-register-feedback",x(this,Tr)),this.removeEventListener("qti-register-interaction",x(this,Sr)),this.removeEventListener("end-attempt",x(this,Ar)),this.removeEventListener("qti-set-outcome-value",x(this,kr)),this.removeEventListener("qti-interaction-response",x(this,Mr))},Er=new WeakMap,Tr=new WeakMap,Sr=new WeakMap,Ar=new WeakMap,kr=new WeakMap,Mr=new WeakMap,Hn=function(){$(this,Ot,this.querySelector("qti-template-processing")),x(this,Ot)&&x(this,Ot).process()},Zs=function(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"},c([u({type:String})],se.prototype,"identifier",2),c([u({type:String})],se.prototype,"adaptive",2),c([u({type:String})],se.prototype,"timeDependent",2),c([u({type:String})],se.prototype,"title",1),c([u({type:Boolean})],se.prototype,"disabled",2),c([P("disabled",{waitUntilFirstUpdate:!0})],se.prototype,"_handleDisabledChange",2),c([u({type:Boolean})],se.prototype,"readonly",2),c([P("readonly",{waitUntilFirstUpdate:!0})],se.prototype,"_handleReadonlyChange",2),c([te({context:D})],se.prototype,"_context",2),se=c([C("qti-assessment-item")],se);var eo=class n extends Event{constructor(e,t){super(n.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},Nt=class extends b{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new eo(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await ve().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],Nt.prototype,"identifier",2),c([u({type:String})],Nt.prototype,"href",2),Nt=c([C("qti-assessment-stimulus-ref")],Nt);var Vi=class extends b{};Vi=c([C("qti-companion-materials-info")],Vi);var Ir,Rr=class extends b{constructor(){super(...arguments);T(this,Ir)}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,Ir,new Function("context","fn","item",e?.textContent??""))}catch(t){console.error("custom-operator contains invalid javascript code",t)}}calculate(){let e={variable:i=>this._context?.variables.find(s=>s.identifier===i)?.value??"",correct:i=>this._context?.variables.find(s=>s.identifier===i)?.correctResponse??""},t={getVariable:i=>this._context?.variables.find(s=>s.identifier===i),updateOutcomeVariable:(i,s)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:s}}))},updateResponseVariable:(i,s)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:i,response:s}}))}};return x(this,Ir).call(this,this._context,e,t)}};Ir=new WeakMap,c([k({context:D,subscribe:!0}),w()],Rr.prototype,"_context",2),Rr=c([C("qti-custom-operator")],Rr);var _r=class extends ie{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};_r.styles=y`
|
|
10
10
|
:host {
|
|
11
11
|
display: block;
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
16
16
|
.off {
|
|
17
17
|
display: none;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,_r=c([C("qti-feedback-block")],_r);var qe=n=>n??L;var Lr=class extends ie{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${qe(this.showStatus)}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Lr.styles=y`
|
|
20
20
|
.on {
|
|
21
21
|
display: inline-block;
|
|
22
22
|
}
|
|
@@ -77,11 +77,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
77
77
|
:host {
|
|
78
78
|
display: block;
|
|
79
79
|
}
|
|
80
|
-
`,c([u({type:String})],Ce.prototype,"id",2),c([u({type:String})],Ce.prototype,"use",2),c([u({type:String})],Ce.prototype,"view",2),c([u({type:String,attribute:"class"})],Ce.prototype,"classNames",2),c([
|
|
80
|
+
`,c([u({type:String})],Ce.prototype,"id",2),c([u({type:String})],Ce.prototype,"use",2),c([u({type:String})],Ce.prototype,"view",2),c([u({type:String,attribute:"class"})],Ce.prototype,"classNames",2),c([P("classNames",{waitUntilFirstUpdate:!0})],Ce.prototype,"handleclassNamesChange",1),Ce=c([C("qti-rubric-block")],Ce);var oe,Pr,to,Di=class extends b{constructor(){super(...arguments);T(this,Pr);T(this,oe,null)}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(i=>i.text()).then(i=>{let s=R(this,Pr,to).call(this,i);$(this,oe,document.createElement("style")),x(this,oe).media="screen",x(this,oe).textContent=`@scope {${s}}`,this.parentElement?this.parentElement.appendChild(x(this,oe)):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=R(this,Pr,to).call(this,this.textContent);$(this,oe,document.createElement("style")),x(this,oe).media="screen",x(this,oe).textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(x(this,oe)):console.warn("No parent element to append the scoped stylesheet to.")}}disconnectedCallback(){if(x(this,oe))try{x(this,oe).remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};oe=new WeakMap,Pr=new WeakSet,to=function(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()},Di=c([C("qti-stylesheet")],Di);var Qe,Un,Bn,Fn,Pe=class extends Pt{constructor(){super(...arguments);T(this,Qe)}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=this.defaultValues(this.cardinality),t={baseType:this.baseType,identifier:this.identifier,correctResponse:x(this,Qe,Un),cardinality:this.cardinality||"single",mapping:x(this,Qe,Bn),defaultValue:e,areaMapping:x(this,Qe,Fn),value:null,type:"response",candidateResponse:null};t.value=e,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};Qe=new WeakSet,Un=function(){let e,t=this.querySelector("qti-correct-response");if(t){let i=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&i.length>0)e=i[0].textContent.trim(),i[0].remove();else if(this.cardinality!=="single"){e=[];for(let s=0;s<i.length;s++)e.push(i[s].textContent.trim()),i[s].remove()}}return e},Bn=function(){let e=this.querySelector("qti-mapping"),t=parseFloat(e?.getAttribute("lower-bound")),i=parseFloat(e?.getAttribute("upper-bound"));return{defaultValue:Number(e?.getAttribute("default-value"))||0,lowerBound:isNaN(t)?null:t,upperBound:isNaN(i)?null:i,mapEntries:Array.from(e?.querySelectorAll("qti-map-entry")||[]).map(o=>({mapKey:o.getAttribute("map-key")||"",mappedValue:Number(o.getAttribute("mapped-value"))||0,caseSensitive:o.hasAttribute("case-sensitive")?o.getAttribute("case-sensitive")!=="false":!1}))}},Fn=function(){let e=this.querySelector("qti-area-mapping"),t=Number(e?.getAttribute("default-value"))||0,i=parseFloat(e?.getAttribute("lower-bound")),s=parseFloat(e?.getAttribute("upper-bound")),o=Array.from(e?.querySelectorAll("qti-area-map-entry")||[]).map(a=>({shape:a.getAttribute("shape")||"default",coords:a.getAttribute("coords")||"",mappedValue:Number(a.getAttribute("mapped-value"))||0,defaultValue:Number(a.getAttribute("default-value"))||0}));return{defaultValue:t,lowerBound:isNaN(i)?null:i,upperBound:isNaN(s)?null:s,areaMapEntries:o}},Pe.styles=[y`
|
|
81
81
|
:host {
|
|
82
82
|
display: none;
|
|
83
83
|
}
|
|
84
|
-
`],c([u({type:String,attribute:"base-type"})],
|
|
84
|
+
`],c([u({type:String,attribute:"base-type"})],Pe.prototype,"baseType",2),c([u({type:String})],Pe.prototype,"identifier",2),c([u({type:String})],Pe.prototype,"cardinality",2),c([k({context:D,subscribe:!0}),w()],Pe.prototype,"itemContext",2),Pe=c([C("qti-response-declaration")],Pe);var we=class extends Pt{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return h`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=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 s=parseFloat(i.getAttribute("source-value")),o=parseFloat(i.getAttribute("target-value"));(isNaN(s)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(s,o)}return t}return null}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:e,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=e,(t.value===null||t.value==null)&&(t.baseType==="integer"||t.baseType==="float")&&(t.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};we.styles=[y`
|
|
85
85
|
:host {
|
|
86
86
|
display: none;
|
|
87
87
|
}
|
|
@@ -134,11 +134,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
134
134
|
</qti-set-outcome-value>
|
|
135
135
|
</qti-response-else>
|
|
136
136
|
</qti-response-condition>
|
|
137
|
-
</qti-response-processing>`;var Dt,Hi,
|
|
137
|
+
</qti-response-processing>`;var Dt,Hi,Or=class extends b{constructor(){super(...arguments);T(this,Dt)}render(){return h`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let t=[...this.children];for(let i of t)i.process()}firstUpdated(e){if(this.getAttribute("template")){let t=this.getAttribute("template").split("/"),i=t[t.length-1].replace(".xml","");switch(this.innerHTML="",i){case"map_response":{this.appendChild(R(this,Dt,Hi).call(this,Wn).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(R(this,Dt,Hi).call(this,Xn).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(R(this,Dt,Hi).call(this,jn).firstElementChild.firstElementChild);break}}}};Dt=new WeakSet,Hi=function(e){return document.createRange().createContextualFragment(e)},Or.styles=[y`
|
|
138
138
|
:host {
|
|
139
139
|
display: none;
|
|
140
140
|
}
|
|
141
|
-
`],
|
|
141
|
+
`],Or=c([C("qti-response-processing")],Or);var Ye,Je,Gn,Qn,Yn,Ee=class extends b{constructor(){super(...arguments);T(this,Je);this.identifier="";this.cardinality="single";this.baseType="string";this.mathVariable=!1;this.paramVariable=!1;T(this,Ye,null)}render(){return h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{R(this,Je,Gn).call(this),R(this,Je,Yn).call(this)})}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:x(this,Ye),type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Ye=new WeakMap,Je=new WeakSet,Gn=function(){let e=this.querySelector("qti-default-value");if(!e)return;let t=e.textContent?.trim()||"";$(this,Ye,R(this,Je,Qn).call(this,t))},Qn=function(e){if(!e)return null;switch(this.baseType){case"integer":return parseInt(e,10);case"float":case"duration":return parseFloat(e);case"boolean":return e.toLowerCase()==="true";default:return e}},Yn=function(){let t={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:x(this,Ye),value:x(this,Ye),type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:x(this,Ye)?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))},Ee.styles=[y`
|
|
142
142
|
:host {
|
|
143
143
|
display: none;
|
|
144
144
|
}
|
|
@@ -150,7 +150,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
150
150
|
:host {
|
|
151
151
|
color: gray;
|
|
152
152
|
}
|
|
153
|
-
`,Vr=c([C("qti-test-feedback")],Vr);var ne,U,Jn,Kn,Zn,ea,ta,ra,ia,sa,pe=class extends b{constructor(){super();T(this,U);this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;T(this,ne);this.addEventListener("qti-assessment-test-connected",R(this,U,ra).bind(this)),this.addEventListener("qti-assessment-item-connected",R(this,U,sa).bind(this)),this.addEventListener("qti-interaction-changed",R(this,U,ta).bind(this)),this.addEventListener("test-end-attempt",R(this,U,Jn).bind(this)),this.addEventListener("test-show-correct-response",R(this,U,Kn).bind(this)),this.addEventListener("test-show-candidate-correction",R(this,U,Zn).bind(this)),this.addEventListener("test-update-outcome-variable",R(this,U,ea).bind(this))}render(){return h`<slot></slot>`}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(s=>({...s,active:this._sessionContext?.navSectionId===s.identifier||!1,completed:s.items.every(
|
|
153
|
+
`,Vr=c([C("qti-test-feedback")],Vr);var ne,U,Jn,Kn,Zn,ea,ta,ra,ia,sa,pe=class extends b{constructor(){super();T(this,U);this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;T(this,ne);this.addEventListener("qti-assessment-test-connected",R(this,U,ra).bind(this)),this.addEventListener("qti-assessment-item-connected",R(this,U,sa).bind(this)),this.addEventListener("qti-interaction-changed",R(this,U,ta).bind(this)),this.addEventListener("test-end-attempt",R(this,U,Jn).bind(this)),this.addEventListener("test-show-correct-response",R(this,U,Kn).bind(this)),this.addEventListener("test-show-candidate-correction",R(this,U,Zn).bind(this)),this.addEventListener("test-update-outcome-variable",R(this,U,ea).bind(this))}render(){return h`<slot></slot>`}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(s=>({...s,active:this._sessionContext?.navSectionId===s.identifier||!1,completed:s.items.every(o=>this._testContext.items.find(a=>a.identifier===o.identifier)?.variables.find(a=>a.identifier==="completionStatus").value==="completed"),items:s.items.map(o=>{let a=this._testContext?.items.find(M=>M.identifier===o.identifier),l={...o,...a,...this.initContext?.find(M=>M.identifier===o.identifier)},d=l.variables?.find(M=>M.identifier=="SCORE")?.value,p=d==null?null:parseFloat(d?.toString()),m=l.variables?.find(M=>M.identifier==="completionStatus")?.value,f=l.variables?.find(M=>M.identifier==="RESPONSE")?.value||"",g=l.variables?.find(M=>M.identifier==="numAttempts")?.value||0,v=this._sessionContext?.navItemRefId===l.identifier||!1,E=o.categories.includes(this.configContext?.infoItemCategory)?null:t++,S=o.variables?.find(M=>M.identifier=="MAXSCORE")?.value,q=S==null?null:parseFloat(S?.toString());return{...l,completionStatus:m,numAttempts:g,score:p,response:f,index:E,active:v,maxScore:q}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};ne=new WeakMap,U=new WeakSet,Jn=function(e){let i=x(this,ne).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,s=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,s)},Kn=function(e){let i=x(this,ne).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem;i&&i.showCorrectResponse(e.detail)},Zn=function(e){x(this,ne).querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCandidateCorrection(e.detail)},ea=function(e){x(this,ne).querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)},ta=function(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),i=t.variables.find(s=>s.identifier==="SCORE");if(i&&i.externalScored===null&&t.adaptive==="false"){let s=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,s)}}},ra=function(e){if($(this,ne,e.detail),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let s=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...s,testIdentifier:x(this,ne).identifier,environmentIdentifier:s.environmentIdentifier||"default"}}}x(this,ne).querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(s=>{let o=R(this,U,ia).call(this,s);Object.keys(o).length>0&&(this.qtiContext={QTI_CONTEXT:{...o,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(x(this,ne)?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:x(this,ne).identifier,title:x(this,ne).title,view:this._sessionContext?.view,testParts:i.map(s=>{let o=[...s.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:s.identifier,navigationMode:s.navigationMode,submissionMode:s.submissionMode,sections:o.map(a=>{let l=[...a.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:a.identifier,title:a.title,items:l.map(d=>({...this.initContext?.find(p=>p.identifier===d.identifier),active:!1,identifier:d.identifier,categories:d.category?d.category?.split(" "):[],href:d.href,variables:[]}))}})}})}},ia=function(e){let t={},i=e.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(o=>{let a=o.getAttribute("field-identifier"),l=o.getAttribute("base-type")||"string",d=o.textContent?.trim()||"";if(a){let p=d;switch(l){case"integer":p=parseInt(d,10);break;case"float":case"duration":p=parseFloat(d);break;case"boolean":p=d.toLowerCase()==="true";break;default:p=d;break}t[a]=p}}),t},sa=function(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(s=>({...s,items:s.items.map(o=>{if(o.identifier!==t.parentElement.getAttribute("identifier"))return o;let l=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),d=t.querySelectorAll("qti-response-declaration"),p=Array.from(d).some(v=>v.querySelector("qti-correct-response")),m=Array.from(d).some(v=>{let E=v.querySelector("qti-mapping"),S=v.querySelector("qti-area-mapping");return E?.querySelector("qti-map-entry")||S?.querySelector("qti-area-map-entry")}),f=p||m,g=!!t.querySelector("qti-response-processing");return{...o,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:l,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:f,hasResponseProcessing:g}})}))}))}},c([u({type:String})],pe.prototype,"identifier",2),c([w()],pe.prototype,"initContext",2),c([w(),te({context:Lt})],pe.prototype,"qtiContext",2),c([w(),te({context:le})],pe.prototype,"configContext",2),c([w(),k({context:ye,subscribe:!0})],pe.prototype,"_testContext",2),c([w(),k({context:je,subscribe:!0})],pe.prototype,"_sessionContext",2),c([w(),te({context:N})],pe.prototype,"computedContext",2),c([u({type:Boolean,attribute:"auto-score-items"})],pe.prototype,"autoScoreItems",2),pe=c([C("test-navigation")],pe);var oa=y`
|
|
154
154
|
display: inline-flex;
|
|
155
155
|
align-items: center;
|
|
156
156
|
cursor: pointer;
|
|
@@ -163,7 +163,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
163
163
|
`,Y=y`
|
|
164
164
|
cursor: not-allowed;
|
|
165
165
|
opacity: 0.8;
|
|
166
|
-
`,
|
|
166
|
+
`,Pf=y`
|
|
167
167
|
${oa};
|
|
168
168
|
border: 1px solid gray;
|
|
169
169
|
`;var Ht,Ke=class extends b{constructor(){super();this._internalDisabled=!0;T(this,Ht);$(this,Ht,this.attachInternals()),x(this,Ht).role="button",x(this,Ht).ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};Ht=new WeakMap,Ke.styles=y`
|
|
@@ -173,14 +173,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
173
173
|
:host([disabled]) {
|
|
174
174
|
${Y};
|
|
175
175
|
}
|
|
176
|
-
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Ke.prototype,"_internalDisabled",2),c([k({context:N,subscribe:!0})],Ke.prototype,"computedContext",2),c([
|
|
176
|
+
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Ke.prototype,"_internalDisabled",2),c([k({context:N,subscribe:!0})],Ke.prototype,"computedContext",2),c([P("computedContext")],Ke.prototype,"_handleTestElementChange",1),Ke=c([C("test-next")],Ke);var Ze=class extends b{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};Ze.styles=y`
|
|
177
177
|
:host {
|
|
178
178
|
${Q};
|
|
179
179
|
}
|
|
180
180
|
:host([disabled]) {
|
|
181
181
|
${Y};
|
|
182
182
|
}
|
|
183
|
-
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Ze.prototype,"_internalDisabled",2),c([k({context:N,subscribe:!0})],Ze.prototype,"computedContext",2),c([
|
|
183
|
+
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Ze.prototype,"_internalDisabled",2),c([k({context:N,subscribe:!0})],Ze.prototype,"computedContext",2),c([P("computedContext")],Ze.prototype,"_handleTestElementChange",1),Ze=c([C("test-prev")],Ze);var Nr,ro,J=class extends b{constructor(){super(...arguments);T(this,Nr);this.label="view";this._handleViewOptionsChange=()=>{R(this,Nr,ro).call(this)};this._viewOptions=J.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),R(this,Nr,ro).call(this)}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return h`
|
|
184
184
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
185
185
|
<select
|
|
186
186
|
part="select"
|
|
@@ -189,7 +189,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
189
189
|
>
|
|
190
190
|
${this._viewOptions.map(e=>h`<option value="${e}" ?selected=${e===this.sessionContext.view}>${e}</option>`)}
|
|
191
191
|
</select>
|
|
192
|
-
`}};Nr=new WeakSet,ro=function(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>J.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=J.DEFAULT_VIEW_OPTIONS},J.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],c([k({context:je,subscribe:!0})],J.prototype,"sessionContext",2),c([u({type:String})],J.prototype,"label",2),c([u({type:String,attribute:"view-options"})],J.prototype,"viewOptions",2),c([
|
|
192
|
+
`}};Nr=new WeakSet,ro=function(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>J.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=J.DEFAULT_VIEW_OPTIONS},J.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],c([k({context:je,subscribe:!0})],J.prototype,"sessionContext",2),c([u({type:String})],J.prototype,"label",2),c([u({type:String,attribute:"view-options"})],J.prototype,"viewOptions",2),c([P("viewOptions",{waitUntilFirstUpdate:!0})],J.prototype,"_handleViewOptionsChange",2),c([w()],J.prototype,"_viewOptions",2),J=c([C("test-view")],J);var zt=class extends b{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h` <slot></slot> `}};zt.styles=y`
|
|
193
193
|
:host {
|
|
194
194
|
${Q};
|
|
195
195
|
}
|
|
@@ -203,15 +203,15 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
203
203
|
:host([disabled]) {
|
|
204
204
|
${Y};
|
|
205
205
|
}
|
|
206
|
-
`,Dr=c([C("test-end-attempt")],Dr);var Hr,Ut,na,aa,me=class extends b{constructor(){super(...arguments);T(this,Ut);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";T(this,Hr)}willUpdate(e){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(s=>s.items)).find(i=>i.active);if(x(this,Hr)!==t&&(this.shown=!1,$(this,Hr,t)),t){let i=!!t?.variables?.some(
|
|
206
|
+
`,Dr=c([C("test-end-attempt")],Dr);var Hr,Ut,na,aa,me=class extends b{constructor(){super(...arguments);T(this,Ut);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";T(this,Hr)}willUpdate(e){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(s=>s.items)).find(i=>i.active);if(x(this,Hr)!==t&&(this.shown=!1,$(this,Hr,t)),t){let i=!!t?.variables?.some(o=>o.correctResponse),s=!!t?.variables?.some(o=>o.mapping?.mapEntries?.length>0||o.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!s}else this.disabled=!0}render(){return h` <div @click="${R(this,Ut,na)}">${R(this,Ut,aa).call(this)}</div> `}};Hr=new WeakMap,Ut=new WeakSet,na=function(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))},aa=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText},me.styles=y`
|
|
207
207
|
:host {
|
|
208
208
|
${Q};
|
|
209
209
|
}
|
|
210
210
|
:host([disabled]) {
|
|
211
211
|
${Y};
|
|
212
212
|
}
|
|
213
|
-
`,c([k({context:N,subscribe:!0})],me.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],me.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],me.prototype,"disabled",2),c([u({type:String})],me.prototype,"showCorrectText",2),c([u({type:String})],me.prototype,"hideCorrectText",2),c([u({type:String})],me.prototype,"noCorrectResponseText",2),me=c([C("test-show-correct-response")],me);var zi=["this"],la=["+","-","!"],ca=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],io={"!":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},Ui=13;var Rl=["==","!=","<=",">=","||","&&","??","|>"],
|
|
214
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Bi=class{#e;#t=-1;#r=0;#i;constructor(r){this.#e=r,this.#o()}nextToken(){for(;Il(this.#i);)this.#o(!0);if(Ol(this.#i))return this.#a();if(da(this.#i))return this.#d();if(zr(this.#i))return this.#c();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#m();if(Pl(this.#i))return this.#f();if(Vl(this.#i))return this.#g();if(this.#o(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#o(r){this.#t++,this.#t<this.#e.length?(this.#i=this.#e.charCodeAt(this.#t),r===!0&&(this.#r=this.#t)):this.#i=void 0}#s(r=0){let e=this.#e.substring(this.#r,this.#t+r);return r===0&&this.#n(),e}#n(){this.#r=this.#t}#a(){let r="unterminated string",e=this.#i;for(this.#o(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(r);if(this.#i===92&&(this.#o(),this.#i===void 0))throw new Error(r);this.#o()}let t=Te(I.STRING,Nl(this.#s()));return this.#o(),t}#d(){do this.#o();while(Ll(this.#i));let r=this.#s(),e=$l(r)?I.KEYWORD:I.IDENTIFIER;return Te(e,r)}#c(){do this.#o();while(zr(this.#i));return this.#i===46?this.#l():Te(I.INTEGER,this.#s())}#l(){return this.#o(),zr(this.#i)?this.#h():(this.#n(),Te(I.DOT,".",Ui))}#u(){return this.#o(!0),Te(I.COMMA,",")}#m(){return this.#o(!0),Te(I.COLON,":")}#h(){do this.#o();while(zr(this.#i));return Te(I.DECIMAL,this.#s())}#f(){this.#o();let r=this.#s(2);if(_l.indexOf(r)!==-1)this.#o(),this.#o();else{if(r=this.#s(1),r==="=>")return this.#o(),Te(I.ARROW,r);Rl.indexOf(r)!==-1&&this.#o()}return r=this.#s(),Te(I.OPERATOR,r,io[r])}#g(){let r=String.fromCharCode(this.#i),e=Te(I.GROUPER,r,io[r]);return this.#o(!0),e}};var so=(o,r)=>new Ur(o,r).parse(),Ur=class{#e;#t;#r;#i;#o;constructor(r,e){this.#t=new Bi(r),this.#r=e}parse(){return this.#s(),this.#n()}#s(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let t=this.#t.nextToken();this.#i=t,this.#e=t?.kind,this.#o=t?.value}_matches(r,e){return!(r&&this.#e!==r||e&&this.#o!==e)}#n(){if(!this.#i)return this.#r.empty();let r=this.#l();return r===void 0?void 0:this.#a(r,0)}#a(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(I.GROUPER,"(")){let t=this.#b();r=this.#r.invoke(r,void 0,t)}else if(this._matches(I.GROUPER,"[")){let t=this.#y();r=this.#r.index(r,t)}else if(this._matches(I.DOT)){this.#s();let t=this.#l();r=this.#d(r,t)}else{if(this._matches(I.KEYWORD))break;if(this._matches(I.OPERATOR)&&this.#i.precedence>=e)r=this.#o==="?"?this.#u(r):this.#c(r,this.#i);else break}return r}#d(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#r.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#c(r,e){if(ca.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#s();let t=this.#l();for(;(this.#e===I.OPERATOR||this.#e===I.DOT||this.#e===I.GROUPER)&&this.#i.precedence>e.precedence;)t=this.#a(t,this.#i.precedence);return this.#r.binary(r,e.value,t)}#l(){if(this._matches(I.OPERATOR)){let r=this.#o;if(this.#s(),r==="+"||r==="-"){if(this._matches(I.INTEGER))return this.#x(r);if(this._matches(I.DECIMAL))return this.#q(r)}if(la.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#a(this.#m(),Ui);return this.#r.unary(r,e)}return this.#m()}#u(r){this.#s(I.OPERATOR,"?");let e=this.#n();this.#s(I.COLON);let t=this.#n();return this.#r.ternary(r,e,t)}#m(){switch(this.#e){case I.KEYWORD:let r=this.#o;if(r==="this")return this.#s(),this.#r.id(r);throw zi.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case I.IDENTIFIER:return this.#g();case I.STRING:return this.#C();case I.INTEGER:return this.#x();case I.DECIMAL:return this.#q();case I.GROUPER:return this.#o==="("?this.#p():this.#o==="{"?this.#f():this.#o==="["?this.#h():void 0;case I.COLON:throw new Error('unexpected token ":"');default:return}}#h(){let r=[];do{if(this.#s(),this._matches(I.GROUPER,"]"))break;r.push(this.#n())}while(this._matches(I.COMMA));return this.#s(I.GROUPER,"]"),this.#r.list(r)}#f(){let r={};do{if(this.#s(),this._matches(I.GROUPER,"}"))break;let e=this.#o;(this._matches(I.STRING)||this._matches(I.IDENTIFIER))&&this.#s(),this.#s(I.COLON),r[e]=this.#n()}while(this._matches(I.COMMA));return this.#s(I.GROUPER,"}"),this.#r.map(r)}#g(){let r=this.#o;if(r==="true")return this.#s(),this.#r.literal(!0);if(r==="false")return this.#s(),this.#r.literal(!1);if(r==="null")return this.#s(),this.#r.literal(null);if(r==="undefined")return this.#s(),this.#r.literal(void 0);let e=this.#v(),t=this.#b();return t?this.#r.invoke(e,void 0,t):e}#v(){if(!this._matches(I.IDENTIFIER))throw new Error(`expected identifier: ${this.#o}`);let r=this.#o;return this.#s(),this.#r.id(r)}#b(){if(!this._matches(I.GROUPER,"("))return;let r=[];do{if(this.#s(),this._matches(I.GROUPER,")"))break;let e=this.#n();r.push(e)}while(this._matches(I.COMMA));return this.#s(I.GROUPER,")"),r}#y(){this.#s();let r=this.#n();return this.#s(I.GROUPER,"]"),r}#p(){let r=this.#b();if(this._matches(I.ARROW)){this.#s();let e=this.#n(),t=r?.map(i=>i.value)??[];return this.#r.arrowFunction(t,e)}else return this.#r.paren(r[0])}#C(){let r=this.#r.literal(this.#o);return this.#s(),r}#x(r=""){let e=this.#r.literal(parseInt(`${r}${this.#o}`,10));return this.#s(),e}#q(r=""){let e=this.#r.literal(parseFloat(`${r}${this.#o}`));return this.#s(),e}};var{hasOwn:pa,fromEntries:Dl}=Object,Hl={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},zl={"+":o=>o,"-":o=>-o,"!":o=>!o},Fi=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=zl[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Hl[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){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(s),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),l=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,l=this.left.value),a===void 0?void 0:a[l]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,d=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,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(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=Dl(i.map((d,p)=>[d,n[p]])),l=new Proxy(t??{},{set(d,p,m){return pa(a,p)&&(a[p]=m),d[p]=m},get(d,p){return pa(a,p)?a[p]:d[p]}});return s.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var oo=null,ua={boundAttributeSuffix:W.M,marker:W.P,markerMatch:W.A,HTML_RESULT:W.C,getTemplateHtml:W.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){oo??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(oo))return void(e[oo]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=z;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:W.V,AttributePart:W.H,PropertyPart:W.B,BooleanAttributePart:W.N,EventPart:W.U,ElementPart:W.F,TemplateInstance:W.R,isIterable:W.D,ChildPart:W.I};var{AttributePart:Ul,PropertyPart:Bl,BooleanAttributePart:Fl,EventPart:jl}=ua,ao=new Fi,no=new Map,ma=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ji=(o,r)=>{let e=no.get(o);if(e===void 0){if(no.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new Ur(t,ao).parse(),no.set(o,e)}}return e?.evaluate(r)},Wl=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&ji(i,r))return Wi(o,r,e,t)},ha=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,fa=o=>/(?:\\{{)|(?:\\}})/g.test(o),Br=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Xl=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=ji(i,r);if(!s[Symbol.iterator])return L;let n=Fr(o),a=-1,l=[];for(let d of s){a++;let p=Object.create(r);p.item=d,p.index=a,p.this=r.this??r;let m=[];for(let g of n.parts){let v=g.update(p,e,t);g.type===1?m.push(...v):m.push(v)}let f={_$litType$:n,values:m};l.push(f)}return l}},ba={if:Wl,repeat:Xl},Se=(o,r=ba,e={},t)=>{let s=Fr(o).renderers;if(t){let a=Fr(t).renderers,l=s.super;l!==void 0?e={...s,...e,super:(d,p,m)=>(m={...a,...m,super:(f,g,v)=>Wi(t,f,g,v)},l(d,p,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>Wi(o,n,r,e)};var Wi=(o,r,e=ba,t={})=>{let i=Fr(o),s=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?s.push(...l):s.push(l)}return{_$litType$:i,values:s}},ga=new Map,Fr=o=>{let r=ga.get(o);return r===void 0&&ga.set(o,r=Gl(o)),r},Gl=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let l=n.getAttribute("type"),d=n.getAttribute("name"),p=n.getAttribute("call");if(p!==null||l!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(p!==null){let f=p.trim(),g=f.startsWith("{{")&&f.endsWith("}}");m=(v,E,S)=>{let q=n.getAttribute("data"),M=q===null?void 0:ji(q,v);return(g?ji(f,v):S[p])?.(M,E,S)}}else l!==null?m=(f,g,v)=>{let E=g[l];return E?.(n,f,g,v)}:(d==="super"?r.renderers.super=(f,g,v)=>{let E=v.super,S=Fr(n);return v={...v,...S.renderers},E(f,g,v)}:r.renderers[d]=(f,g,v)=>Wi(n,f,g,v),m=(f,g,v)=>{let E=v[d];return E?.(f,g,v)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let l of a){let d=n.getAttribute(l),p=d.split(ha);if(p.length===1){fa(d)&&n.setAttribute(l,Br(d));continue}n.removeAttribute(l);let m=l,f=Ul,g=l[0];g==="."?(m=ma(l.substring(1)),f=Bl):g==="?"?(m=l.substring(1),f=Fl):g==="@"&&(m=ma(l.substring(1)),f=jl);let v=[Br(p[0])],E=[];for(let S=1;S<p.length;S+=2){let q=p[S];E.push(so(q,ao)),v.push(Br(p[S+1]))}r.parts.push({type:1,index:i,name:m,strings:v,ctor:f,update:(S,q,M)=>E.map(P=>P.evaluate(S))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,l=a.split(ha);l.length>1?n.textContent=Br(l[0]):fa(a)&&(n.textContent=Br(a));for(let d=1;d<l.length;d+=2){let p=l[d],m=so(p,ao);r.parts.push({type:2,index:++i,update:(g,v)=>m.evaluate(g)});let f=new Text(l[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 s)n.remove();return r};var Wr,jr=class extends b{constructor(){super();T(this,Wr);$(this,Wr,this.attachInternals()),x(this,Wr).ariaLabel="pagination"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Se(e)}render(){if(!this.computedContext)return h``;let e=this.computedContext.testParts.flatMap(t=>t.sections.flatMap(i=>i.items));return h` ${e.map(t=>this.myTemplate({item:t,view:this.computedContext.view}))} `}};Wr=new WeakMap,c([k({context:N,subscribe:!0})],jr.prototype,"computedContext",2),jr=c([C("test-paging-buttons-stamp")],jr);var Xi=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},Gi=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((r=>this.Z=r))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var va=o=>!kn(o)&&typeof o.then=="function",ya=1073741823,lo=class extends Ge{constructor(){super(...arguments),this._$Cwt=ya,this._$Cbt=[],this._$CK=new Xi(this),this._$CX=new Gi}render(...r){return r.find((e=>!va(e)))??z}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!va(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=ya,i=0,Promise.resolve(l).then((async d=>{for(;n.get();)await n.get();let p=s.deref();if(p!==void 0){let m=p._$Cbt.indexOf(l);m>-1&&m<p._$Cwt&&(p._$Cwt=m,p.setValue(d))}})))}return z}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Qi=re(lo);var Yi=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
213
|
+
`,c([k({context:N,subscribe:!0})],me.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],me.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],me.prototype,"disabled",2),c([u({type:String})],me.prototype,"showCorrectText",2),c([u({type:String})],me.prototype,"hideCorrectText",2),c([u({type:String})],me.prototype,"noCorrectResponseText",2),me=c([C("test-show-correct-response")],me);var zi=["this"],la=["+","-","!"],ca=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],io={"!":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},Ui=13;var Rl=["==","!=","<=",">=","||","&&","??","|>"],Il=["===","!=="],_;(function(n){n[n.STRING=1]="STRING",n[n.IDENTIFIER=2]="IDENTIFIER",n[n.DOT=3]="DOT",n[n.COMMA=4]="COMMA",n[n.COLON=5]="COLON",n[n.INTEGER=6]="INTEGER",n[n.DECIMAL=7]="DECIMAL",n[n.OPERATOR=8]="OPERATOR",n[n.GROUPER=9]="GROUPER",n[n.KEYWORD=10]="KEYWORD",n[n.ARROW=11]="ARROW"})(_||(_={}));var Te=(n,r,e=0)=>({kind:n,value:r,precedence:e}),_l=n=>n===9||n===10||n===13||n===32,da=n=>n===95||n===36||(n&=-33,65<=n&&n<=90),Ll=n=>da(n)||zr(n),$l=n=>zi.indexOf(n)!==-1,Pl=n=>n===34||n===39,zr=n=>48<=n&&n<=57,Ol=n=>n===43||n===45||n===42||n===47||n===33||n===38||n===37||n===60||n===61||n===62||n===63||n===94||n===124,Vl=n=>n===40||n===41||n===91||n===93||n===123||n===125,Nl=n=>n.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
|
|
214
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Bi=class{#e;#t=-1;#r=0;#i;constructor(r){this.#e=r,this.#o()}nextToken(){for(;_l(this.#i);)this.#o(!0);if(Pl(this.#i))return this.#a();if(da(this.#i))return this.#d();if(zr(this.#i))return this.#c();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#m();if(Ol(this.#i))return this.#f();if(Vl(this.#i))return this.#g();if(this.#o(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#o(r){this.#t++,this.#t<this.#e.length?(this.#i=this.#e.charCodeAt(this.#t),r===!0&&(this.#r=this.#t)):this.#i=void 0}#s(r=0){let e=this.#e.substring(this.#r,this.#t+r);return r===0&&this.#n(),e}#n(){this.#r=this.#t}#a(){let r="unterminated string",e=this.#i;for(this.#o(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(r);if(this.#i===92&&(this.#o(),this.#i===void 0))throw new Error(r);this.#o()}let t=Te(_.STRING,Nl(this.#s()));return this.#o(),t}#d(){do this.#o();while(Ll(this.#i));let r=this.#s(),e=$l(r)?_.KEYWORD:_.IDENTIFIER;return Te(e,r)}#c(){do this.#o();while(zr(this.#i));return this.#i===46?this.#l():Te(_.INTEGER,this.#s())}#l(){return this.#o(),zr(this.#i)?this.#h():(this.#n(),Te(_.DOT,".",Ui))}#u(){return this.#o(!0),Te(_.COMMA,",")}#m(){return this.#o(!0),Te(_.COLON,":")}#h(){do this.#o();while(zr(this.#i));return Te(_.DECIMAL,this.#s())}#f(){this.#o();let r=this.#s(2);if(Il.indexOf(r)!==-1)this.#o(),this.#o();else{if(r=this.#s(1),r==="=>")return this.#o(),Te(_.ARROW,r);Rl.indexOf(r)!==-1&&this.#o()}return r=this.#s(),Te(_.OPERATOR,r,io[r])}#g(){let r=String.fromCharCode(this.#i),e=Te(_.GROUPER,r,io[r]);return this.#o(!0),e}};var so=(n,r)=>new Ur(n,r).parse(),Ur=class{#e;#t;#r;#i;#o;constructor(r,e){this.#t=new Bi(r),this.#r=e}parse(){return this.#s(),this.#n()}#s(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let t=this.#t.nextToken();this.#i=t,this.#e=t?.kind,this.#o=t?.value}_matches(r,e){return!(r&&this.#e!==r||e&&this.#o!==e)}#n(){if(!this.#i)return this.#r.empty();let r=this.#l();return r===void 0?void 0:this.#a(r,0)}#a(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(_.GROUPER,"(")){let t=this.#b();r=this.#r.invoke(r,void 0,t)}else if(this._matches(_.GROUPER,"[")){let t=this.#y();r=this.#r.index(r,t)}else if(this._matches(_.DOT)){this.#s();let t=this.#l();r=this.#d(r,t)}else{if(this._matches(_.KEYWORD))break;if(this._matches(_.OPERATOR)&&this.#i.precedence>=e)r=this.#o==="?"?this.#u(r):this.#c(r,this.#i);else break}return r}#d(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#r.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#c(r,e){if(ca.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#s();let t=this.#l();for(;(this.#e===_.OPERATOR||this.#e===_.DOT||this.#e===_.GROUPER)&&this.#i.precedence>e.precedence;)t=this.#a(t,this.#i.precedence);return this.#r.binary(r,e.value,t)}#l(){if(this._matches(_.OPERATOR)){let r=this.#o;if(this.#s(),r==="+"||r==="-"){if(this._matches(_.INTEGER))return this.#x(r);if(this._matches(_.DECIMAL))return this.#q(r)}if(la.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#a(this.#m(),Ui);return this.#r.unary(r,e)}return this.#m()}#u(r){this.#s(_.OPERATOR,"?");let e=this.#n();this.#s(_.COLON);let t=this.#n();return this.#r.ternary(r,e,t)}#m(){switch(this.#e){case _.KEYWORD:let r=this.#o;if(r==="this")return this.#s(),this.#r.id(r);throw zi.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case _.IDENTIFIER:return this.#g();case _.STRING:return this.#C();case _.INTEGER:return this.#x();case _.DECIMAL:return this.#q();case _.GROUPER:return this.#o==="("?this.#p():this.#o==="{"?this.#f():this.#o==="["?this.#h():void 0;case _.COLON:throw new Error('unexpected token ":"');default:return}}#h(){let r=[];do{if(this.#s(),this._matches(_.GROUPER,"]"))break;r.push(this.#n())}while(this._matches(_.COMMA));return this.#s(_.GROUPER,"]"),this.#r.list(r)}#f(){let r={};do{if(this.#s(),this._matches(_.GROUPER,"}"))break;let e=this.#o;(this._matches(_.STRING)||this._matches(_.IDENTIFIER))&&this.#s(),this.#s(_.COLON),r[e]=this.#n()}while(this._matches(_.COMMA));return this.#s(_.GROUPER,"}"),this.#r.map(r)}#g(){let r=this.#o;if(r==="true")return this.#s(),this.#r.literal(!0);if(r==="false")return this.#s(),this.#r.literal(!1);if(r==="null")return this.#s(),this.#r.literal(null);if(r==="undefined")return this.#s(),this.#r.literal(void 0);let e=this.#v(),t=this.#b();return t?this.#r.invoke(e,void 0,t):e}#v(){if(!this._matches(_.IDENTIFIER))throw new Error(`expected identifier: ${this.#o}`);let r=this.#o;return this.#s(),this.#r.id(r)}#b(){if(!this._matches(_.GROUPER,"("))return;let r=[];do{if(this.#s(),this._matches(_.GROUPER,")"))break;let e=this.#n();r.push(e)}while(this._matches(_.COMMA));return this.#s(_.GROUPER,")"),r}#y(){this.#s();let r=this.#n();return this.#s(_.GROUPER,"]"),r}#p(){let r=this.#b();if(this._matches(_.ARROW)){this.#s();let e=this.#n(),t=r?.map(i=>i.value)??[];return this.#r.arrowFunction(t,e)}else return this.#r.paren(r[0])}#C(){let r=this.#r.literal(this.#o);return this.#s(),r}#x(r=""){let e=this.#r.literal(parseInt(`${r}${this.#o}`,10));return this.#s(),e}#q(r=""){let e=this.#r.literal(parseFloat(`${r}${this.#o}`));return this.#s(),e}};var{hasOwn:pa,fromEntries:Dl}=Object,Hl={"+":(n,r)=>n+r,"-":(n,r)=>n-r,"*":(n,r)=>n*r,"/":(n,r)=>n/r,"%":(n,r)=>n%r,"==":(n,r)=>n==r,"!=":(n,r)=>n!=r,"===":(n,r)=>n===r,"!==":(n,r)=>n!==r,">":(n,r)=>n>r,">=":(n,r)=>n>=r,"<":(n,r)=>n<r,"<=":(n,r)=>n<=r,"||":(n,r)=>n||r,"&&":(n,r)=>n&&r,"??":(n,r)=>n??r,"|":(n,r)=>r(n),"|>":(n,r)=>r(n)},zl={"+":n=>n,"-":n=>-n,"!":n=>!n},Fi=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=zl[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Hl[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){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 o=this.right.evaluate(s),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),l=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,l=this.left.value),a===void 0?void 0:a[l]=o}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),o=this.method?s:i?.this??i,a=this.method?s?.[e]:s,d=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(o,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,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(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...o){let a=Dl(i.map((d,p)=>[d,o[p]])),l=new Proxy(t??{},{set(d,p,m){return pa(a,p)&&(a[p]=m),d[p]=m},get(d,p){return pa(a,p)?a[p]:d[p]}});return s.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var oo=null,ua={boundAttributeSuffix:W.M,marker:W.P,markerMatch:W.A,HTML_RESULT:W.C,getTemplateHtml:W.L,overrideDirectiveResolve:(n,r)=>class extends n{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(n,r)=>{if(n.prototype._$AS.name!==r.name){oo??=n.prototype._$AS.name;for(let e=n.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(oo))return void(e[oo]=r);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(n,r){n._$litDirective$=r},getAttributePartCommittedValue:(n,r,e)=>{let t=z;return n.j=i=>t=i,n._$AI(r,n,e),t},connectedDisconnectable:n=>({...n,_$AU:!0}),resolveDirective:W.V,AttributePart:W.H,PropertyPart:W.B,BooleanAttributePart:W.N,EventPart:W.U,ElementPart:W.F,TemplateInstance:W.R,isIterable:W.D,ChildPart:W.I};var{AttributePart:Ul,PropertyPart:Bl,BooleanAttributePart:Fl,EventPart:jl}=ua,ao=new Fi,no=new Map,ma=n=>n.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ji=(n,r)=>{let e=no.get(n);if(e===void 0){if(no.has(n))return;if(n=n.trim(),n.startsWith("{{")&&n.endsWith("}}")){let t=n.substring(2,n.length-2).trim();e=new Ur(t,ao).parse(),no.set(n,e)}}return e?.evaluate(r)},Wl=(n,r,e,t)=>{let i=n.getAttribute("if");if(i!==null&&ji(i,r))return Wi(n,r,e,t)},ha=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,fa=n=>/(?:\\{{)|(?:\\}})/g.test(n),Br=n=>n.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Xl=(n,r,e,t)=>{let i=n.getAttribute("repeat");if(i!==null){let s=ji(i,r);if(!s[Symbol.iterator])return L;let o=Fr(n),a=-1,l=[];for(let d of s){a++;let p=Object.create(r);p.item=d,p.index=a,p.this=r.this??r;let m=[];for(let g of o.parts){let v=g.update(p,e,t);g.type===1?m.push(...v):m.push(v)}let f={_$litType$:o,values:m};l.push(f)}return l}},ba={if:Wl,repeat:Xl},Se=(n,r=ba,e={},t)=>{let s=Fr(n).renderers;if(t){let a=Fr(t).renderers,l=s.super;l!==void 0?e={...s,...e,super:(d,p,m)=>(m={...a,...m,super:(f,g,v)=>Wi(t,f,g,v)},l(d,p,m))}:(e={...a,...s,...e},n=t)}else e={...s,...e};return o=>Wi(n,o,r,e)};var Wi=(n,r,e=ba,t={})=>{let i=Fr(n),s=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?s.push(...l):s.push(l)}return{_$litType$:i,values:s}},ga=new Map,Fr=n=>{let r=ga.get(n);return r===void 0&&ga.set(n,r=Gl(n)),r},Gl=n=>{let r={h:void 0,el:n.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let o=t;if(o.tagName==="TEMPLATE"){let l=o.getAttribute("type"),d=o.getAttribute("name"),p=o.getAttribute("call");if(p!==null||l!==null||d!==null){o.parentNode.insertBefore(document.createComment(""),o),s.push(o);let m;if(p!==null){let f=p.trim(),g=f.startsWith("{{")&&f.endsWith("}}");m=(v,E,S)=>{let q=o.getAttribute("data"),M=q===null?void 0:ji(q,v);return(g?ji(f,v):S[p])?.(M,E,S)}}else l!==null?m=(f,g,v)=>{let E=g[l];return E?.(o,f,g,v)}:(d==="super"?r.renderers.super=(f,g,v)=>{let E=v.super,S=Fr(o);return v={...v,...S.renderers},E(f,g,v)}:r.renderers[d]=(f,g,v)=>Wi(o,f,g,v),m=(f,g,v)=>{let E=v[d];return E?.(f,g,v)});r.parts.push({type:2,index:i,update:m});continue}}let a=o.getAttributeNames();for(let l of a){let d=o.getAttribute(l),p=d.split(ha);if(p.length===1){fa(d)&&o.setAttribute(l,Br(d));continue}o.removeAttribute(l);let m=l,f=Ul,g=l[0];g==="."?(m=ma(l.substring(1)),f=Bl):g==="?"?(m=l.substring(1),f=Fl):g==="@"&&(m=ma(l.substring(1)),f=jl);let v=[Br(p[0])],E=[];for(let S=1;S<p.length;S+=2){let q=p[S];E.push(so(q,ao)),v.push(Br(p[S+1]))}r.parts.push({type:1,index:i,name:m,strings:v,ctor:f,update:(S,q,M)=>E.map(O=>O.evaluate(S))})}}else if(t.nodeType===Node.TEXT_NODE){let o=t,a=o.textContent,l=a.split(ha);l.length>1?o.textContent=Br(l[0]):fa(a)&&(o.textContent=Br(a));for(let d=1;d<l.length;d+=2){let p=l[d],m=so(p,ao);r.parts.push({type:2,index:++i,update:(g,v)=>m.evaluate(g)});let f=new Text(l[d+1].replace("\\{{","{{"));o.parentNode.insertBefore(f,o.nextSibling),o.parentNode.insertBefore(document.createComment(""),o.nextSibling),o=f,e.currentNode=f}}for(let o of s)o.remove();return r};var Wr,jr=class extends b{constructor(){super();T(this,Wr);$(this,Wr,this.attachInternals()),x(this,Wr).ariaLabel="pagination"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Se(e)}render(){if(!this.computedContext)return h``;let e=this.computedContext.testParts.flatMap(t=>t.sections.flatMap(i=>i.items));return h` ${e.map(t=>this.myTemplate({item:t,view:this.computedContext.view}))} `}};Wr=new WeakMap,c([k({context:N,subscribe:!0})],jr.prototype,"computedContext",2),jr=c([C("test-paging-buttons-stamp")],jr);var Xi=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},Gi=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((r=>this.Z=r))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var va=n=>!kn(n)&&typeof n.then=="function",ya=1073741823,lo=class extends Ge{constructor(){super(...arguments),this._$Cwt=ya,this._$Cbt=[],this._$CK=new Xi(this),this._$CX=new Gi}render(...r){return r.find((e=>!va(e)))??z}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!va(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=ya,i=0,Promise.resolve(l).then((async d=>{for(;o.get();)await o.get();let p=s.deref();if(p!==void 0){let m=p._$Cbt.indexOf(l);m>-1&&m<p._$Cwt&&(p._$Cwt=m,p.setValue(d))}})))}return z}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Qi=re(lo);var Yi=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
215
215
|
|
|
216
216
|
:root,
|
|
217
217
|
:host {
|
|
@@ -3952,12 +3952,12 @@ div.full-correct-response-inline {
|
|
|
3952
3952
|
margin-right: var(--qti-padding-horizontal);
|
|
3953
3953
|
padding: 0.2rem;
|
|
3954
3954
|
}
|
|
3955
|
-
`;var Xr,Bt,xa,qa,
|
|
3955
|
+
`;var Xr,Bt,xa,qa,Oe=class extends b{constructor(){super(...arguments);T(this,Bt);this.testURL=null;this.testDoc=null;this.testXML=null;T(this,Xr,null)}async handleTestURLChange(){if(this.testURL)try{let e=await Rt().load(this.testURL),t=this.closest("qti-test");if(t?.postLoadTestTransformCallback){let s=e.htmlDoc().querySelector("qti-assessment-test");s&&(e=await t.postLoadTestTransformCallback(e,s))}this.testDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=Rt().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),R(this,Bt,xa).call(this),R(this,Bt,qa).call(this),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}render(){return h`
|
|
3956
3956
|
${x(this,Xr)}
|
|
3957
3957
|
<slot></slot>
|
|
3958
3958
|
${Qi(this.testDoc,h`<span>Loading...</span>`)}
|
|
3959
|
-
`}};Xr=new WeakMap,Bt=new WeakSet,xa=function(){let e=this.querySelector("template");$(this,Xr,e?e.content:h``)},qa=function(){let e=new CSSStyleSheet;e.replaceSync(Yi),this.shadowRoot.adoptedStyleSheets=[e]},c([u({type:String,attribute:"test-url"})],
|
|
3960
|
-
<h3>${
|
|
3959
|
+
`}};Xr=new WeakMap,Bt=new WeakSet,xa=function(){let e=this.querySelector("template");$(this,Xr,e?e.content:h``)},qa=function(){let e=new CSSStyleSheet;e.replaceSync(Yi),this.shadowRoot.adoptedStyleSheets=[e]},c([u({type:String,attribute:"test-url"})],Oe.prototype,"testURL",2),c([w()],Oe.prototype,"testDoc",2),c([w()],Oe.prototype,"testXML",2),c([P("testURL",{waitUntilFirstUpdate:!0})],Oe.prototype,"handleTestURLChange",1),c([P("testXML",{waitUntilFirstUpdate:!0})],Oe.prototype,"handleTestXMLChange",1),Oe=c([C("test-container")],Oe);var Ft=class extends b{render(){let r=this.computedContext?.testParts.flatMap(s=>s.sections.flatMap(o=>o.items)).find(s=>s.active);if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,o)=>h`
|
|
3960
|
+
<h3>${o}</h3>
|
|
3961
3961
|
<table>
|
|
3962
3962
|
<thead>
|
|
3963
3963
|
<tr>
|
|
@@ -4010,8 +4010,8 @@ div.full-correct-response-inline {
|
|
|
4010
4010
|
:host([disabled]) {
|
|
4011
4011
|
${Y};
|
|
4012
4012
|
}
|
|
4013
|
-
`,c([u({type:String,attribute:"section-id"})],jt.prototype,"sectionId",2),jt=c([C("test-section-link")],jt);var Yr=class extends b{render(){return h` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};c([w(),k({context:N,subscribe:!0})],Yr.prototype,"computedContext",2),Yr=c([C("test-print-context")],Yr);var yt=class extends b{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Se(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(f=>f.active),i=t?.sections.find(f=>f.active),s=i?.items.find(f=>f.active),{variables:
|
|
4014
|
-
${this.myTemplate?this.myTemplate(this.stampContext):L}`}};c([u({type:Boolean,reflect:!0})],yt.prototype,"debug",2),c([w(),k({context:N,subscribe:!0})],yt.prototype,"computedContext",2),c([w()],yt.prototype,"stampContext",2),yt=c([C("test-stamp")],yt);var Ki,wa,xt=class extends b{constructor(){super();T(this,Ki);this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&R(this,Ki,wa).call(this,i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Se(e)}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(d=>d.items)).find(l=>l.active);if(!e||!e.variables)return h``;let t=e.variables.find(l=>l.identifier=="MAXSCORE")?.value,i=e.variables.find(l=>l.identifier=="SCORE"),s=i?.value,
|
|
4013
|
+
`,c([u({type:String,attribute:"section-id"})],jt.prototype,"sectionId",2),jt=c([C("test-section-link")],jt);var Yr=class extends b{render(){return h` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};c([w(),k({context:N,subscribe:!0})],Yr.prototype,"computedContext",2),Yr=c([C("test-print-context")],Yr);var yt=class extends b{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Se(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(f=>f.active),i=t?.sections.find(f=>f.active),s=i?.items.find(f=>f.active),{variables:o,...a}=s||{};if(!t||!i||!s)return;let l={...t,items:t.sections.flatMap(f=>f.items.map(({variables:g,...v})=>v)),sections:t.sections.map(f=>({...f,items:f.items.map(({variables:g,...v})=>v)}))},d={...i,items:i.items.map(({variables:f,...g})=>g)},{testParts:p,...m}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:a,activeSection:d,activeTestpart:l,test:m},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return h` ${this.debug?h`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:L}
|
|
4014
|
+
${this.myTemplate?this.myTemplate(this.stampContext):L}`}};c([u({type:Boolean,reflect:!0})],yt.prototype,"debug",2),c([w(),k({context:N,subscribe:!0})],yt.prototype,"computedContext",2),c([w()],yt.prototype,"stampContext",2),yt=c([C("test-stamp")],yt);var Ki,wa,xt=class extends b{constructor(){super();T(this,Ki);this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&R(this,Ki,wa).call(this,i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Se(e)}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(d=>d.items)).find(l=>l.active);if(!e||!e.variables)return h``;let t=e.variables.find(l=>l.identifier=="MAXSCORE")?.value,i=e.variables.find(l=>l.identifier=="SCORE"),s=i?.value,o=i?.externalScored!=="human";if(!t||!i)return L;let a=[...Array(Number(t)+1).keys()];return h`${this.myTemplate?this.myTemplate({scores:a,score:s,disabled:o}):L}`}};Ki=new WeakSet,wa=function(e){let s=(this.computedContext?.testParts.find(o=>o.active)).sections.flatMap(o=>o.items).find(o=>o.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:s,outcomeVariableId:"SCORE",value:e},bubbles:!0}))},c([u({type:String,attribute:"view"})],xt.prototype,"view",2),c([u({type:Boolean})],xt.prototype,"disabled",2),c([k({context:N,subscribe:!0})],xt.prototype,"computedContext",2),xt=c([C("test-scoring-buttons")],xt);var Jr=class extends b{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");if(!r){this.myTemplate=null;return}this.myTemplate=Se(r)}_switchView(r){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:r}))}firstUpdated(r){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return h`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):L}`}};c([k({context:je,subscribe:!0})],Jr.prototype,"sessionContext",2),Jr=c([C("test-view-toggle")],Jr);var Wt=class extends b{constructor(){super(...arguments);this.view=null}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(d=>d.items)).find(l=>l.active);if(!e||!e.variables)return h``;if(e.category==="dep-informational")return h`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(l=>l.identifier==="completionStatus")?.value,i=e?.variables.find(l=>l.identifier=="SCORE"),s=parseFloat(i?.value),o=e.externalScored;return h`<div>${t!=="completed"?this.dataset.textNoResponse:!o&&s!==void 0&&!Number.isNaN(s)?s>0?this.dataset.textCorrect:this.dataset.textIncorrect:o==="externalMachine"?Number.isNaN(s)||s===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${s===0?"geen punten":s==1?"\xE9\xE9n punt":`${s} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:o==="human"?Number.isNaN(s)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};c([k({context:N,subscribe:!0})],Wt.prototype,"computedContext",2),c([u({type:String,attribute:"view"})],Wt.prototype,"view",2),Wt=c([C("test-scoring-feedback")],Wt);var Kr=class extends b{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})),this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return h` <slot></slot> `}};Kr.styles=y`
|
|
4015
4015
|
:host {
|
|
4016
4016
|
${Q};
|
|
4017
4017
|
}
|
|
@@ -4022,7 +4022,7 @@ div.full-correct-response-inline {
|
|
|
4022
4022
|
${x(this,Zr)}
|
|
4023
4023
|
<slot></slot>
|
|
4024
4024
|
${Qi(this.itemDoc,h`<span>Loading...</span>`)}
|
|
4025
|
-
`}};Zr=new WeakMap,Xt=new WeakSet,Ea=function(){let e=this.querySelector("template");$(this,Zr,e?e.content:h``)},Ta=function(){let e=new CSSStyleSheet;e.replaceSync(Yi),this.shadowRoot.adoptedStyleSheets=[e]},c([u({type:String,attribute:"item-url"})],Ve.prototype,"itemURL",2),c([w()],Ve.prototype,"itemDoc",2),c([w()],Ve.prototype,"itemXML",2),c([
|
|
4025
|
+
`}};Zr=new WeakMap,Xt=new WeakSet,Ea=function(){let e=this.querySelector("template");$(this,Zr,e?e.content:h``)},Ta=function(){let e=new CSSStyleSheet;e.replaceSync(Yi),this.shadowRoot.adoptedStyleSheets=[e]},c([u({type:String,attribute:"item-url"})],Ve.prototype,"itemURL",2),c([w()],Ve.prototype,"itemDoc",2),c([w()],Ve.prototype,"itemXML",2),c([P("itemURL",{waitUntilFirstUpdate:!0})],Ve.prototype,"handleItemURLChange",1),c([P("itemXML",{waitUntilFirstUpdate:!0})],Ve.prototype,"handleItemXMLChange",1),Ve=c([C("item-container")],Ve);var Zi,Sa,qt=class extends b{constructor(){super(...arguments);T(this,Zi);this.label="Correct response mode";this._options={internal:"Internal",full:"Full (copy)"}}render(){return h`
|
|
4026
4026
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
4027
4027
|
<select
|
|
4028
4028
|
part="select"
|
|
@@ -4056,15 +4056,15 @@ div.full-correct-response-inline {
|
|
|
4056
4056
|
:host([disabled]) {
|
|
4057
4057
|
${ts};
|
|
4058
4058
|
}
|
|
4059
|
-
`,c([k({context:Fe,subscribe:!0})],he.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],he.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],he.prototype,"disabled",2),c([u({type:String})],he.prototype,"showCandidateCorrectionText",2),c([u({type:String})],he.prototype,"hideCandidateCorrectionText",2),c([u({type:String})],he.prototype,"noCorrectResponseText",2),he=c([C("item-show-candidate-correction")],he);var Yt,ti,Jt,_a,
|
|
4059
|
+
`,c([k({context:Fe,subscribe:!0})],he.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],he.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],he.prototype,"disabled",2),c([u({type:String})],he.prototype,"showCandidateCorrectionText",2),c([u({type:String})],he.prototype,"hideCandidateCorrectionText",2),c([u({type:String})],he.prototype,"noCorrectResponseText",2),he=c([C("item-show-candidate-correction")],he);var Yt,ti,Jt,Ia,_a,fe=class extends b{constructor(){super(...arguments);T(this,Jt);this.shown=!1;this.disabled=!1;this.showCorrectText="Show correct response";this.hideCorrectText="Hide correct response";this.noCorrectResponseText="No correct response specified";T(this,Yt,!1);T(this,ti,"")}updated(){if(!x(this,Yt)||x(this,ti)!==this.computedContext?.identifier){$(this,ti,this.computedContext?.identifier);let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);$(this,Yt,e||t)}this.disabled=!x(this,Yt)}render(){return h` <div @click="${R(this,Jt,Ia)}">${R(this,Jt,_a).call(this)}</div> `}};Yt=new WeakMap,ti=new WeakMap,Jt=new WeakSet,Ia=function(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))},_a=function(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText},fe.styles=y`
|
|
4060
4060
|
:host {
|
|
4061
4061
|
${es};
|
|
4062
4062
|
}
|
|
4063
4063
|
:host([disabled]) {
|
|
4064
4064
|
${ts};
|
|
4065
4065
|
}
|
|
4066
|
-
`,c([k({context:Fe,subscribe:!0})],fe.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],fe.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],fe.prototype,"disabled",2),c([u({type:String})],fe.prototype,"showCorrectText",2),c([u({type:String})],fe.prototype,"hideCorrectText",2),c([u({type:String})],fe.prototype,"noCorrectResponseText",2),fe=c([C("item-show-correct-response")],fe);var Kt=class extends b{render(){let r=this.computedContext;if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,
|
|
4067
|
-
<h3>${
|
|
4066
|
+
`,c([k({context:Fe,subscribe:!0})],fe.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],fe.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],fe.prototype,"disabled",2),c([u({type:String})],fe.prototype,"showCorrectText",2),c([u({type:String})],fe.prototype,"hideCorrectText",2),c([u({type:String})],fe.prototype,"noCorrectResponseText",2),fe=c([C("item-show-correct-response")],fe);var Kt=class extends b{render(){let r=this.computedContext;if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,o)=>h`
|
|
4067
|
+
<h3>${o}</h3>
|
|
4068
4068
|
<table>
|
|
4069
4069
|
<thead>
|
|
4070
4070
|
<tr>
|
|
@@ -4110,7 +4110,7 @@ div.full-correct-response-inline {
|
|
|
4110
4110
|
margin-top: 20px;
|
|
4111
4111
|
font-size: 16px;
|
|
4112
4112
|
}
|
|
4113
|
-
`,c([k({context:Fe,subscribe:!0})],Kt.prototype,"computedContext",2),Kt=c([C("item-print-variables")],Kt);var K,ri,ii,rs,is,ss,G,La,$a,co,Oa,Pa,po,Zt=class extends b{constructor(){super();T(this,G);T(this,K);this.configContext={};T(this,ri,R(this,G,La).bind(this));T(this,ii,R(this,G,$a).bind(this));T(this,rs,R(this,G,co).bind(this));T(this,is,R(this,G,Oa).bind(this));T(this,ss,R(this,G,Pa).bind(this));this.addEventListener("qti-item-context-updated",x(this,ri)),this.addEventListener("qti-assessment-item-connected",x(this,ii)),this.addEventListener("item-show-correct-response",x(this,rs)),this.addEventListener("item-show-candidate-correction",x(this,is)),this.addEventListener("item-switch-correct-response-mode",x(this,ss))}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",x(this,ri)),this.removeEventListener("qti-assessment-item-connected",x(this,ii))}};K=new WeakMap,ri=new WeakMap,ii=new WeakMap,rs=new WeakMap,is=new WeakMap,ss=new WeakMap,G=new WeakSet,La=function(e){R(this,G,po).call(this,e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])},$a=function(e){let t=e.detail._context.variables;$(this,K,e.detail),this.computedContext=this.computedContext?.identifier===x(this,K).identifier?{...this.computedContext,title:x(this,K).title}:{identifier:x(this,K).identifier,title:x(this,K).title,adaptive:x(this,K).getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},R(this,G,po).call(this,x(this,K).identifier,t||[])},co=function(e){x(this,K)&&x(this,K).showCorrectResponse(e.detail)},Oa=function(e){x(this,K)&&x(this,K).showCandidateCorrection(e.detail)},Pa=function(e){R(this,G,co).call(this,new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}},po=function(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),n=t?.find(p=>p.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,l=s!==void 0&&!isNaN(s)&&s<=0,d=n==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:d,variables:t}},c([w(),te({context:Fe})],Zt.prototype,"computedContext",2),c([w(),te({context:le})],Zt.prototype,"configContext",2),Zt=c([C("qti-item")],Zt);var Va=(o,r,e)=>{class t extends o{}return t};var Ae=(o,r,e,t)=>{class i extends Va(o,e,r){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.dragMoveRaf=0;this.pendingMove=null;this.dragBounds=null;this.dragCloneRect=null;this.dropzoneRects=new Map;this.dropzoneRectsDirty=!1;this.dragBoundsDirty=!1;this.dragCloneStyleCache=new WeakMap;this.onScrollOrResize=()=>{this.dropzoneRectsDirty=!0,this.dragBoundsDirty=!0,this.dragBoundsDirty=!0};this.onMove=this.handleTouchMove.bind(this);this.onEnd=this.handleTouchEnd.bind(this);this.onCancel=this.handleTouchCancel.bind(this);this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.MAX_DRAGGABLE_WIDTH=600;this.dataTransfer={data:{},setData(a,l){this.data[a]=l},getData(a){return this.data[a]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=0;this.draggablesModified=(a,l)=>{if(this.isMatchTabular())return;for(let p of l)this.draggables.includes(p)&&(this.draggables=this.draggables.filter(m=>m!==p),p.removeAttribute("tabindex"),p.removeEventListener("touchstart",this.handleTouchStart.bind(this)),p.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let p of a)this.draggables.includes(p)||(this.draggables.push(p),p.setAttribute("tabindex","0"),p.hasTouchStartListener||(p.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),p.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),p.hasTouchStartListener=!0));let d=0;this.draggables.forEach(p=>{p.style.viewTransitionName=`drag-${d}-${this.getAttribute("identifier")||crypto.randomUUID()}`,p.setAttribute("qti-draggable","true"),d++})};this.droppablesModified=(a,l)=>{if(!this.isMatchTabular()){for(let d of l)this.droppables.includes(d)&&(this.droppables=this.droppables.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.droppables.includes(d)||(this.droppables.push(d),this.allDropzones.push(d));for(let d of this.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box");this.dropzoneRectsDirty=!0,this.dragBoundsDirty=!0}}}handleDraggableContainerChange(a,l){this.isMatchTabular()||(a.length>0||l.length>0)&&this.dragContainersModified(a||[],l||[])}dragContainersModified(a,l){for(let d of l)this.dragContainers.includes(d)&&(this.dragContainers=this.dragContainers.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.dragContainers.includes(d)||(this.dragContainers.push(d),this.allDropzones.push(d));this.dropzoneRectsDirty=!0,this.dragBoundsDirty=!0}handleDraggablesChange(a,l){this.isMatchTabular()||(a.length>0||l.length>0)&&this.draggablesModified(a||[],l||[])}handleDroppablesChange(a,l){this.isMatchTabular()||(a.length>0||l.length>0)&&this.droppablesModified(a||[],l||[])}firstUpdated(){if(super.firstUpdated(),this.isMatchTabular())return;this.hasAttribute("disabled")||(document.addEventListener("mousemove",this.onMove,{passive:!1}),document.addEventListener("mouseup",this.onEnd,{passive:!1}),document.addEventListener("touchmove",this.onMove,{passive:!1}),document.addEventListener("touchend",this.onEnd,{passive:!1}),document.addEventListener("touchcancel",this.onCancel,{passive:!1}));let l=Array.from(this.querySelectorAll(r)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(r)||[])),d=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),p=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(p,[]),this.droppablesModified(d,[]),this.draggablesModified(l,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(f=>this.resizeObserver?.observe(f))}async moveDraggableToDroppable(a,l){if(this.isMatchTabular())return;a.style.transform="translate(0, 0)",l.tagName==="SLOT"?a.setAttribute("slot",l.getAttribute("name")):l.appendChild(a),this.checkAllMaxAssociations(),this.saveResponse()}activateDroppable(a){this.dragContainers.includes(a)?(this._internals.states.add("--dragzone-active"),a.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),a.setAttribute("active",""))}deactivateDroppable(a,l=!0){l&&this._internals.states.add("--dragzone-active"),a.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}async updateMinDimensionsForDropZones(){if(await this.updateComplete,this.isMatchTabular())return;this.dropzoneRectsDirty=!0;let a=this.querySelectorAll(r),l=this.querySelector(t)||this.shadowRoot?.querySelector(t),d=this.querySelectorAll(e),p=d[0]?.parentElement,m=this.determineMaxWidth(l,p),f=0,g=0;for(let v of a){v.style.maxWidth=m+"px";let{width:E,height:S}=await this.measureIntrinsicSize(v);f=Math.max(f,S),g=Math.max(g,E)}p&&(p.style.gridTemplateColumns=`repeat(auto-fit, minmax(calc(min(${m}px,${g}px + 2 * var(--qti-dropzone-padding))), 1fr))`),l&&(l.style.minHeight=`${f}px`);for(let v of d){v.style.minHeight=`${f}px`,v.style.minWidth=`${g}px`;let E=v.shadowRoot?.querySelector('slot[part="dropslot"]');E&&(E.style.minHeight=`${f}px`)}}determineMaxWidth(a,l){let d=l??a;if(!d||d.clientWidth==0)return this.MAX_DRAGGABLE_WIDTH;let p=window.getComputedStyle(d),m=parseFloat(p.paddingLeft),f=parseFloat(p.paddingRight);return Math.min(this.MAX_DRAGGABLE_WIDTH,d.clientWidth-m-f)}async measureIntrinsicSize(a){let l=a.style.position;a.style.position="fixed";let d=a.getBoundingClientRect();return a.style.position=l,{width:d.width,height:d.height}}activateDroppables(a){if(this.isMatchTabular())return;this.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.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.dragContainers.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")}),this.droppables.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("mousemove",this.onMove),document.removeEventListener("mouseup",this.onEnd),document.removeEventListener("touchmove",this.onMove),document.removeEventListener("touchend",this.onEnd),document.removeEventListener("touchcancel",this.onCancel),window.removeEventListener("scroll",this.onScrollOrResize,!0),window.removeEventListener("resize",this.onScrollOrResize)}handleTouchMove(a){if(!this.isMatchTabular()&&this.isDraggable&&this.dragClone){let{x:l,y:d}=this.getEventCoordinates(a);this.pendingMove={clientX:l,clientY:d},this.scheduleDragMove(),a.preventDefault()}}scheduleDragMove(){this.dragMoveRaf||(this.dragMoveRaf=requestAnimationFrame(()=>{if(this.dragMoveRaf=0,!this.pendingMove)return;let a=this.pendingMove;this.pendingMove=null,this.processDragMove(a),this.pendingMove&&this.scheduleDragMove()}))}processDragMove(a){if(!this.isDraggable||!this.dragClone||!this.touchStartPoint||(this.calculateDragDistance(a)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0),!this.isDragging))return;this.updateDragClonePosition(a),this.dropzoneRectsDirty&&this.refreshDropzoneRects();let l=this.findClosestDropzone();this.currentDropTarget=l,l!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),l&&(this.activateDroppable(l),this.dispatchCustomEvent(l,"dragenter")),this.lastTarget=l),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover")}handleTouchEnd(a){this.isMatchTabular()||((this.isDragging||this.isDraggable||this.dragClone)&&this.resetDragState(),this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(l=>{l.removeAttribute("dragging")}),a.preventDefault())}handleTouchCancel(a){this.resetDragState()}validate(){if(this.isMatchTabular())return null;if(!this.shadowRoot)return!1;let a=this.getValidAssociations(),l=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(l=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(l=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let p=this.lastElementChild;return this._internals.setValidity(l?{}:{customError:!0},d,p),l}reportValidity(){let a=this.shadowRoot.querySelector("#validation-message");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.setProperty("display","block","important"))),this._internals.validity.valid}checkMaxAssociations(a){let l=this.getMatchMaxValue(a),d=a.querySelectorAll('[qti-draggable="true"]').length;return!(l===0)&&d>=l}dropDraggableInDroppable(a,l){let d=a.cloneNode(!0);d.removeAttribute("style"),this.moveDraggableToDroppable(d,l),this.draggablesModified([d],[]);let p=this.getMatchMaxValue(a),m=this.draggables.filter(f=>f.getAttribute("identifier")===a.getAttribute("identifier"));p!==0&&m.length>=p?(a.style.opacity="0.0",a.style.pointerEvents="none"):a.style.opacity="1.0"}resetDragState(){if(this.dragMoveRaf&&(cancelAnimationFrame(this.dragMoveRaf),this.dragMoveRaf=0),this.pendingMove=null,this.dragClone){let a=this.currentDropTarget!==null,l=!a||this.dragContainers.includes(this.currentDropTarget);a&&this.currentDropTarget&&!l&&this.dropDraggableInDroppable(this.dragSource,this.currentDropTarget),l&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto",this.saveResponse()),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.dragBounds=null,this.dragCloneRect=null,this.dropzoneRects.clear(),this.dropzoneRectsDirty=!1,this.dragBoundsDirty=!1,window.removeEventListener("scroll",this.onScrollOrResize,!0),window.removeEventListener("resize",this.onScrollOrResize),this.deactivateDroppables()}checkAllMaxAssociations(){let a=this.getValidAssociations(),l=this.maxAssociations!==0&&a>=this.maxAssociations;this.droppables.forEach(d=>{l?this.disableDroppable(d):this.checkMaxAssociations(d)?this.disableDroppable(d):this.enableDroppable(d)})}getMatchMaxValue(a){let l=a.getAttribute("match-max");return l?parseInt(l,10):1}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get response(){let a;return typeof this.getResponse=="function"?a=this.getResponse():a=this.collectResponseData(),a.join(",")}set response(a){if(!this.isMatchTabular())if(typeof this.getValue=="function"&&(a=this.getValue(a)),Array.isArray(a)){this.reset(!1),a?.forEach(d=>this.placeResponse(d));let l=new FormData;a.forEach(d=>{l.append(this.responseIdentifier,d)}),this._internals.setFormValue(l)}else this._internals.setFormValue(a||"")}placeResponse(a){let[l,...d]=a.split(" ").reverse(),p=Array.from(this.draggables),m=Array.from(this.droppables);d.forEach(f=>{if(f==="")return;let g=p.find(E=>E.getAttribute("identifier")===f),v=m.find(E=>E.getAttribute("identifier")===l);this.dropDraggableInDroppable(g,v)})}getValidAssociations(){let a=0;for(let l of this.droppables)a=a+this.getDraggablesFromDroppable(l).length;return a}saveResponse(){let a;typeof this.getResponse=="function"?a=this.getResponse():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(l=>{let p=this.getDraggablesFromDroppable(l).map(f=>f.getAttribute("identifier")),m=l.getAttribute("identifier");return p.map(f=>`${f} ${m}`)}).flat()}getDraggablesFromDroppable(a){return this.draggables.map(p=>p.getAttribute("identifier")).filter((p,m,f)=>f.indexOf(p)===m).flatMap(p=>Array.from(a.querySelectorAll(`[identifier='${p}']`))).filter(p=>!!p).map(p=>p)}reset(a=!0){this.droppables.forEach(l=>{this.getDraggablesFromDroppable(l).forEach(p=>{p.remove(),this.draggablesModified([],[p])})}),this.dragContainers.forEach(l=>{Array.from(l.querySelectorAll('[qti-draggable="true"]')).forEach(p=>{p.style.opacity="1.0"})}),this.dragClone=null,this.dragSource=null,this.isDragging=!1,this.isDraggable=!1,this.currentDropTarget=null,this.lastTarget=null,a&&this.saveResponse()}updateDragClonePosition(a){if(!this.isDragging||!this.dragClone)return;(this.dragBoundsDirty||!this.dragBounds)&&this.refreshDragBounds();let l=a.clientX-this.cloneOffset.x,d=a.clientY-this.cloneOffset.y,{newLeft:p,newTop:m}=this.applyInteractionBoundaries(l,d);this.dragClone.style.left=`${p}px`,this.dragClone.style.top=`${m}px`;let f=this.dragBounds?.width??this.dragCloneRect?.width,g=this.dragBounds?.height??this.dragCloneRect?.height;if(!f||!g){let v=this.dragClone.getBoundingClientRect();f=v.width,g=v.height}this.dragCloneRect={left:p,top:m,right:p+f,bottom:m+g,width:f,height:g}}applyInteractionBoundaries(a,l){if(!this.dragBounds)return{newLeft:a,newTop:l};let d=Math.max(this.dragBounds.minLeft,Math.min(a,this.dragBounds.maxLeft)),p=Math.max(this.dragBounds.minTop,Math.min(l,this.dragBounds.maxTop));return{newLeft:d,newTop:p}}refreshDragBounds(){if(!this.dragClone)return;let a=this.getBoundingClientRect(),l=this.dragClone.getBoundingClientRect();this.dragBounds={minLeft:a.left,maxLeft:a.right-l.width,minTop:a.top,maxTop:a.bottom-l.height,width:l.width,height:l.height},this.dragCloneRect={left:l.left,top:l.top,right:l.left+l.width,bottom:l.top+l.height,width:l.width,height:l.height},this.dragBoundsDirty=!1}getEventCoordinates(a,l=!1){let d=a.touches?a.touches[0]:a;return{x:l?d.pageX:d.clientX,y:l?d.pageY:d.clientY}}calculateDragDistance(a){let l=Math.abs(a.clientX-this.touchStartPoint.x),d=Math.abs(a.clientY-this.touchStartPoint.y);return l+d}refreshDropzoneRects(){this.dropzoneRects.clear();let a=this.allDropzones.filter(l=>!l.hasAttribute("disabled"));for(let l of a)this.dropzoneRects.set(l,this.getDropzoneRect(l));this.dropzoneRectsDirty=!1}getCachedDropzoneRect(a){let l=this.dropzoneRects.get(a);if(l)return l;let d=this.getDropzoneRect(a);return this.dropzoneRects.set(a,d),d}getDropzoneRect(a){return(a.shadowRoot?.querySelector('slot[part="dropslot"]')??a).getBoundingClientRect()}findClosestDropzone(){let a=this.allDropzones.filter(f=>!f.hasAttribute("disabled"));if(!this.dragClone||a.length===0)return null;let l=this.dragCloneRect??this.dragClone.getBoundingClientRect(),d=null,p=0,m=f=>{for(let g of f){let v=this.getCachedDropzoneRect(g),E=this.calculateOverlapArea(l,v);E>p&&(p=E,d=g)}};if(m(this.droppables.filter(f=>!f.hasAttribute("disabled"))),d||m(this.dragContainers.filter(f=>!f.hasAttribute("disabled"))),!d){let f=Number.POSITIVE_INFINITY;for(let g of a){let v=this.getCachedDropzoneRect(g),E=Math.hypot(l.left-v.left,l.top-v.top);E<f&&(f=E,d=g)}}return d}calculateOverlapArea(a,l){let d=Math.max(0,Math.min(a.right,l.right)-Math.max(a.left,l.left)),p=Math.max(0,Math.min(a.bottom,l.bottom)-Math.max(a.top,l.top));return d*p}getComputedStyleText(a){let l=this.dragCloneStyleCache.get(a);if(l)return l;let d=window.getComputedStyle(a),p="";for(let m=0;m<d.length;m++){let f=d[m];p+=`${f}:${d.getPropertyValue(f)};`}return this.dragCloneStyleCache.set(a,p),p}dispatchCustomEvent(a,l,d=!0){if(!a)return;let p=new CustomEvent(l,{bubbles:d,cancelable:!0});p.dataTransfer=this.dataTransfer,a.dispatchEvent(p)}appendClone(){document.body.appendChild(this.dragClone)}handleTouchStart(a){if(this.isMatchTabular()||a instanceof MouseEvent&&a.button!==0||this.isDragging)return;let{x:l,y:d}=this.getEventCoordinates(a);this.touchStartPoint={x:l,y:d},this.dragSource=a.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let p=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),m=this.droppables.some(S=>Array.from(S.children).some(q=>q===this.dragSource)),f=this.dragSource.getBoundingClientRect();m&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=p),this.cloneOffset.x=l-f.left,this.cloneOffset.y=d-f.top,this.dragClone=p.cloneNode(!0),this.configuration.copyStylesDragClone&&(this.dragClone.style.cssText=this.getComputedStyleText(p));let g=p.getBoundingClientRect();this.dragClone.style.width=`${g.width}px`,this.dragClone.style.height=`${g.height}px`,f&&this.setDragCloneStyles(f),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone(),this.refreshDragBounds(),this.refreshDropzoneRects(),window.addEventListener("scroll",this.onScrollOrResize,!0),window.addEventListener("resize",this.onScrollOrResize);let v=this.getMatchMaxValue(this.dragSource),E=this.draggables.filter(S=>S.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));v!==0&&E.length>=v?(p.style.opacity="0.0",p.style.pointerEvents="none"):p.style.opacity="1.0",a.preventDefault(),this.dragClone.setAttribute("dragging","")}findDraggableInDraggableContainer(a){let l=this.dragContainers.flat();for(let d of l){if(d.getAttribute("identifier")===a)return d;let p;d instanceof HTMLSlotElement?p=Array.from(d?.assignedElements()||[]):p=Array.from(d.querySelectorAll(r));let m=p.find(f=>f.getAttribute("identifier")===a);if(m)return m}}setDragCloneStyles(a){this.dragClone.style.position="fixed",this.dragClone.style.top=`${a.top}px`,this.dragClone.style.left=`${a.left}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return c([u({attribute:!1,type:Object})],i.prototype,"configuration",2),c([u({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),c([u({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),c([Li(t)],i.prototype,"handleDraggableContainerChange",1),c([Li(r)],i.prototype,"handleDraggablesChange",1),c([Li(e)],i.prototype,"handleDroppablesChange",1),i};var Na=y`
|
|
4113
|
+
`,c([k({context:Fe,subscribe:!0})],Kt.prototype,"computedContext",2),Kt=c([C("item-print-variables")],Kt);var K,ri,ii,rs,is,ss,G,La,$a,co,Pa,Oa,po,Zt=class extends b{constructor(){super();T(this,G);T(this,K);this.configContext={};T(this,ri,R(this,G,La).bind(this));T(this,ii,R(this,G,$a).bind(this));T(this,rs,R(this,G,co).bind(this));T(this,is,R(this,G,Pa).bind(this));T(this,ss,R(this,G,Oa).bind(this));this.addEventListener("qti-item-context-updated",x(this,ri)),this.addEventListener("qti-assessment-item-connected",x(this,ii)),this.addEventListener("item-show-correct-response",x(this,rs)),this.addEventListener("item-show-candidate-correction",x(this,is)),this.addEventListener("item-switch-correct-response-mode",x(this,ss))}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",x(this,ri)),this.removeEventListener("qti-assessment-item-connected",x(this,ii))}};K=new WeakMap,ri=new WeakMap,ii=new WeakMap,rs=new WeakMap,is=new WeakMap,ss=new WeakMap,G=new WeakSet,La=function(e){R(this,G,po).call(this,e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])},$a=function(e){let t=e.detail._context.variables;$(this,K,e.detail),this.computedContext=this.computedContext?.identifier===x(this,K).identifier?{...this.computedContext,title:x(this,K).title}:{identifier:x(this,K).identifier,title:x(this,K).title,adaptive:x(this,K).getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},R(this,G,po).call(this,x(this,K).identifier,t||[])},co=function(e){x(this,K)&&x(this,K).showCorrectResponse(e.detail)},Pa=function(e){x(this,K)&&x(this,K).showCandidateCorrection(e.detail)},Oa=function(e){R(this,G,co).call(this,new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}},po=function(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),o=t?.find(p=>p.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,l=s!==void 0&&!isNaN(s)&&s<=0,d=o==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:d,variables:t}},c([w(),te({context:Fe})],Zt.prototype,"computedContext",2),c([w(),te({context:le})],Zt.prototype,"configContext",2),Zt=c([C("qti-item")],Zt);var Va=(n,r,e)=>{class t extends n{}return t};var Ae=(n,r,e,t)=>{class i extends Va(n,e,r){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.dragMoveRaf=0;this.pendingMove=null;this.dragBounds=null;this.dragCloneRect=null;this.dropzoneRects=new Map;this.dropzoneRectsDirty=!1;this.dragBoundsDirty=!1;this.dragCloneStyleCache=new WeakMap;this.onScrollOrResize=()=>{this.dropzoneRectsDirty=!0,this.dragBoundsDirty=!0,this.dragBoundsDirty=!0};this.onMove=this.handleTouchMove.bind(this);this.onEnd=this.handleTouchEnd.bind(this);this.onCancel=this.handleTouchCancel.bind(this);this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.MAX_DRAGGABLE_WIDTH=600;this.dataTransfer={data:{},setData(a,l){this.data[a]=l},getData(a){return this.data[a]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=0;this.draggablesModified=(a,l)=>{if(this.isMatchTabular())return;for(let p of l)this.draggables.includes(p)&&(this.draggables=this.draggables.filter(m=>m!==p),p.removeAttribute("tabindex"),p.removeEventListener("touchstart",this.handleTouchStart.bind(this)),p.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let p of a)this.draggables.includes(p)||(this.draggables.push(p),p.setAttribute("tabindex","0"),p.hasTouchStartListener||(p.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),p.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),p.hasTouchStartListener=!0));let d=0;this.draggables.forEach(p=>{p.style.viewTransitionName=`drag-${d}-${this.getAttribute("identifier")||crypto.randomUUID()}`,p.setAttribute("qti-draggable","true"),d++})};this.droppablesModified=(a,l)=>{if(!this.isMatchTabular()){for(let d of l)this.droppables.includes(d)&&(this.droppables=this.droppables.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.droppables.includes(d)||(this.droppables.push(d),this.allDropzones.push(d));for(let d of this.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box");this.dropzoneRectsDirty=!0,this.dragBoundsDirty=!0}}}handleDraggableContainerChange(a,l){this.isMatchTabular()||(a.length>0||l.length>0)&&this.dragContainersModified(a||[],l||[])}dragContainersModified(a,l){for(let d of l)this.dragContainers.includes(d)&&(this.dragContainers=this.dragContainers.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.dragContainers.includes(d)||(this.dragContainers.push(d),this.allDropzones.push(d));this.dropzoneRectsDirty=!0,this.dragBoundsDirty=!0}handleDraggablesChange(a,l){this.isMatchTabular()||(a.length>0||l.length>0)&&this.draggablesModified(a||[],l||[])}handleDroppablesChange(a,l){this.isMatchTabular()||(a.length>0||l.length>0)&&this.droppablesModified(a||[],l||[])}firstUpdated(){if(super.firstUpdated(),this.isMatchTabular())return;this.hasAttribute("disabled")||(document.addEventListener("mousemove",this.onMove,{passive:!1}),document.addEventListener("mouseup",this.onEnd,{passive:!1}),document.addEventListener("touchmove",this.onMove,{passive:!1}),document.addEventListener("touchend",this.onEnd,{passive:!1}),document.addEventListener("touchcancel",this.onCancel,{passive:!1}));let l=Array.from(this.querySelectorAll(r)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(r)||[])),d=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),p=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(p,[]),this.droppablesModified(d,[]),this.draggablesModified(l,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(f=>this.resizeObserver?.observe(f))}async moveDraggableToDroppable(a,l){if(this.isMatchTabular())return;a.style.transform="translate(0, 0)",l.tagName==="SLOT"?a.setAttribute("slot",l.getAttribute("name")):l.appendChild(a),this.checkAllMaxAssociations(),this.saveResponse()}activateDroppable(a){this.dragContainers.includes(a)?(this._internals.states.add("--dragzone-active"),a.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),a.setAttribute("active",""))}deactivateDroppable(a,l=!0){l&&this._internals.states.add("--dragzone-active"),a.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}async updateMinDimensionsForDropZones(){if(await this.updateComplete,this.isMatchTabular())return;this.dropzoneRectsDirty=!0;let a=this.querySelectorAll(r),l=this.querySelector(t)||this.shadowRoot?.querySelector(t),d=this.querySelectorAll(e),p=d[0]?.parentElement,m=this.determineMaxWidth(l,p),f=0,g=0;for(let v of a){v.style.maxWidth=m+"px";let{width:E,height:S}=await this.measureIntrinsicSize(v);f=Math.max(f,S),g=Math.max(g,E)}p&&(p.style.gridTemplateColumns=`repeat(auto-fit, minmax(calc(min(${m}px,${g}px + 2 * var(--qti-dropzone-padding))), 1fr))`),l&&(l.style.minHeight=`${f}px`);for(let v of d){v.style.minHeight=`${f}px`,v.style.minWidth=`${g}px`;let E=v.shadowRoot?.querySelector('slot[part="dropslot"]');E&&(E.style.minHeight=`${f}px`)}}determineMaxWidth(a,l){let d=l??a;if(!d||d.clientWidth==0)return this.MAX_DRAGGABLE_WIDTH;let p=window.getComputedStyle(d),m=parseFloat(p.paddingLeft),f=parseFloat(p.paddingRight);return Math.min(this.MAX_DRAGGABLE_WIDTH,d.clientWidth-m-f)}async measureIntrinsicSize(a){let l=a.style.position;a.style.position="fixed";let d=a.getBoundingClientRect();return a.style.position=l,{width:d.width,height:d.height}}activateDroppables(a){if(this.isMatchTabular())return;this.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.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.dragContainers.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")}),this.droppables.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("mousemove",this.onMove),document.removeEventListener("mouseup",this.onEnd),document.removeEventListener("touchmove",this.onMove),document.removeEventListener("touchend",this.onEnd),document.removeEventListener("touchcancel",this.onCancel),window.removeEventListener("scroll",this.onScrollOrResize,!0),window.removeEventListener("resize",this.onScrollOrResize)}handleTouchMove(a){if(!this.isMatchTabular()&&this.isDraggable&&this.dragClone){let{x:l,y:d}=this.getEventCoordinates(a);this.pendingMove={clientX:l,clientY:d},this.scheduleDragMove(),a.preventDefault()}}scheduleDragMove(){this.dragMoveRaf||(this.dragMoveRaf=requestAnimationFrame(()=>{if(this.dragMoveRaf=0,!this.pendingMove)return;let a=this.pendingMove;this.pendingMove=null,this.processDragMove(a),this.pendingMove&&this.scheduleDragMove()}))}processDragMove(a){if(!this.isDraggable||!this.dragClone||!this.touchStartPoint||(this.calculateDragDistance(a)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0),!this.isDragging))return;this.updateDragClonePosition(a),this.dropzoneRectsDirty&&this.refreshDropzoneRects();let l=this.findClosestDropzone();this.currentDropTarget=l,l!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),l&&(this.activateDroppable(l),this.dispatchCustomEvent(l,"dragenter")),this.lastTarget=l),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover")}handleTouchEnd(a){this.isMatchTabular()||((this.isDragging||this.isDraggable||this.dragClone)&&this.resetDragState(),this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(l=>{l.removeAttribute("dragging")}),a.preventDefault())}handleTouchCancel(a){this.resetDragState()}validate(){if(this.isMatchTabular())return null;if(!this.shadowRoot)return!1;let a=this.getValidAssociations(),l=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(l=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(l=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let p=this.lastElementChild;return this._internals.setValidity(l?{}:{customError:!0},d,p),l}reportValidity(){let a=this.shadowRoot.querySelector("#validation-message");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.setProperty("display","block","important"))),this._internals.validity.valid}checkMaxAssociations(a){let l=this.getMatchMaxValue(a),d=a.querySelectorAll('[qti-draggable="true"]').length;return!(l===0)&&d>=l}dropDraggableInDroppable(a,l){let d=a.cloneNode(!0);d.removeAttribute("style"),this.moveDraggableToDroppable(d,l),this.draggablesModified([d],[]);let p=this.getMatchMaxValue(a),m=this.draggables.filter(f=>f.getAttribute("identifier")===a.getAttribute("identifier"));p!==0&&m.length>=p?(a.style.opacity="0.0",a.style.pointerEvents="none"):a.style.opacity="1.0"}resetDragState(){if(this.dragMoveRaf&&(cancelAnimationFrame(this.dragMoveRaf),this.dragMoveRaf=0),this.pendingMove=null,this.dragClone){let a=this.currentDropTarget!==null,l=!a||this.dragContainers.includes(this.currentDropTarget);a&&this.currentDropTarget&&!l&&this.dropDraggableInDroppable(this.dragSource,this.currentDropTarget),l&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto",this.saveResponse()),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.dragBounds=null,this.dragCloneRect=null,this.dropzoneRects.clear(),this.dropzoneRectsDirty=!1,this.dragBoundsDirty=!1,window.removeEventListener("scroll",this.onScrollOrResize,!0),window.removeEventListener("resize",this.onScrollOrResize),this.deactivateDroppables()}checkAllMaxAssociations(){let a=this.getValidAssociations(),l=this.maxAssociations!==0&&a>=this.maxAssociations;this.droppables.forEach(d=>{l?this.disableDroppable(d):this.checkMaxAssociations(d)?this.disableDroppable(d):this.enableDroppable(d)})}getMatchMaxValue(a){let l=a.getAttribute("match-max");return l?parseInt(l,10):1}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get response(){let a;return typeof this.getResponse=="function"?a=this.getResponse():a=this.collectResponseData(),a.join(",")}set response(a){if(!this.isMatchTabular())if(typeof this.getValue=="function"&&(a=this.getValue(a)),Array.isArray(a)){this.reset(!1),a?.forEach(d=>this.placeResponse(d));let l=new FormData;a.forEach(d=>{l.append(this.responseIdentifier,d)}),this._internals.setFormValue(l)}else this._internals.setFormValue(a||"")}placeResponse(a){let[l,...d]=a.split(" ").reverse(),p=Array.from(this.draggables),m=Array.from(this.droppables);d.forEach(f=>{if(f==="")return;let g=p.find(E=>E.getAttribute("identifier")===f),v=m.find(E=>E.getAttribute("identifier")===l);this.dropDraggableInDroppable(g,v)})}getValidAssociations(){let a=0;for(let l of this.droppables)a=a+this.getDraggablesFromDroppable(l).length;return a}saveResponse(){let a;typeof this.getResponse=="function"?a=this.getResponse():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(l=>{let p=this.getDraggablesFromDroppable(l).map(f=>f.getAttribute("identifier")),m=l.getAttribute("identifier");return p.map(f=>`${f} ${m}`)}).flat()}getDraggablesFromDroppable(a){return this.draggables.map(p=>p.getAttribute("identifier")).filter((p,m,f)=>f.indexOf(p)===m).flatMap(p=>Array.from(a.querySelectorAll(`[identifier='${p}']`))).filter(p=>!!p).map(p=>p)}reset(a=!0){this.droppables.forEach(l=>{this.getDraggablesFromDroppable(l).forEach(p=>{p.remove(),this.draggablesModified([],[p])})}),this.dragContainers.forEach(l=>{Array.from(l.querySelectorAll('[qti-draggable="true"]')).forEach(p=>{p.style.opacity="1.0"})}),this.dragClone=null,this.dragSource=null,this.isDragging=!1,this.isDraggable=!1,this.currentDropTarget=null,this.lastTarget=null,a&&this.saveResponse()}updateDragClonePosition(a){if(!this.isDragging||!this.dragClone)return;(this.dragBoundsDirty||!this.dragBounds)&&this.refreshDragBounds();let l=a.clientX-this.cloneOffset.x,d=a.clientY-this.cloneOffset.y,{newLeft:p,newTop:m}=this.applyInteractionBoundaries(l,d);this.dragClone.style.left=`${p}px`,this.dragClone.style.top=`${m}px`;let f=this.dragBounds?.width??this.dragCloneRect?.width,g=this.dragBounds?.height??this.dragCloneRect?.height;if(!f||!g){let v=this.dragClone.getBoundingClientRect();f=v.width,g=v.height}this.dragCloneRect={left:p,top:m,right:p+f,bottom:m+g,width:f,height:g}}applyInteractionBoundaries(a,l){if(!this.dragBounds)return{newLeft:a,newTop:l};let d=Math.max(this.dragBounds.minLeft,Math.min(a,this.dragBounds.maxLeft)),p=Math.max(this.dragBounds.minTop,Math.min(l,this.dragBounds.maxTop));return{newLeft:d,newTop:p}}refreshDragBounds(){if(!this.dragClone)return;let a=this.getBoundingClientRect(),l=this.dragClone.getBoundingClientRect();this.dragBounds={minLeft:a.left,maxLeft:a.right-l.width,minTop:a.top,maxTop:a.bottom-l.height,width:l.width,height:l.height},this.dragCloneRect={left:l.left,top:l.top,right:l.left+l.width,bottom:l.top+l.height,width:l.width,height:l.height},this.dragBoundsDirty=!1}getEventCoordinates(a,l=!1){let d=a.touches?a.touches[0]:a;return{x:l?d.pageX:d.clientX,y:l?d.pageY:d.clientY}}calculateDragDistance(a){let l=Math.abs(a.clientX-this.touchStartPoint.x),d=Math.abs(a.clientY-this.touchStartPoint.y);return l+d}refreshDropzoneRects(){this.dropzoneRects.clear();let a=this.allDropzones.filter(l=>!l.hasAttribute("disabled"));for(let l of a)this.dropzoneRects.set(l,this.getDropzoneRect(l));this.dropzoneRectsDirty=!1}getCachedDropzoneRect(a){let l=this.dropzoneRects.get(a);if(l)return l;let d=this.getDropzoneRect(a);return this.dropzoneRects.set(a,d),d}getDropzoneRect(a){return(a.shadowRoot?.querySelector('slot[part="dropslot"]')??a).getBoundingClientRect()}findClosestDropzone(){let a=this.allDropzones.filter(f=>!f.hasAttribute("disabled"));if(!this.dragClone||a.length===0)return null;let l=this.dragCloneRect??this.dragClone.getBoundingClientRect(),d=null,p=0,m=f=>{for(let g of f){let v=this.getCachedDropzoneRect(g),E=this.calculateOverlapArea(l,v);E>p&&(p=E,d=g)}};if(m(this.droppables.filter(f=>!f.hasAttribute("disabled"))),d||m(this.dragContainers.filter(f=>!f.hasAttribute("disabled"))),!d){let f=Number.POSITIVE_INFINITY;for(let g of a){let v=this.getCachedDropzoneRect(g),E=Math.hypot(l.left-v.left,l.top-v.top);E<f&&(f=E,d=g)}}return d}calculateOverlapArea(a,l){let d=Math.max(0,Math.min(a.right,l.right)-Math.max(a.left,l.left)),p=Math.max(0,Math.min(a.bottom,l.bottom)-Math.max(a.top,l.top));return d*p}getComputedStyleText(a){let l=this.dragCloneStyleCache.get(a);if(l)return l;let d=window.getComputedStyle(a),p="";for(let m=0;m<d.length;m++){let f=d[m];p+=`${f}:${d.getPropertyValue(f)};`}return this.dragCloneStyleCache.set(a,p),p}dispatchCustomEvent(a,l,d=!0){if(!a)return;let p=new CustomEvent(l,{bubbles:d,cancelable:!0});p.dataTransfer=this.dataTransfer,a.dispatchEvent(p)}appendClone(){(document.fullscreenElement??document.body).appendChild(this.dragClone)}handleTouchStart(a){if(this.isMatchTabular()||a instanceof MouseEvent&&a.button!==0||this.isDragging)return;let{x:l,y:d}=this.getEventCoordinates(a);this.touchStartPoint={x:l,y:d},this.dragSource=a.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let p=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),m=this.droppables.some(S=>Array.from(S.children).some(q=>q===this.dragSource)),f=this.dragSource.getBoundingClientRect();m&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=p),this.cloneOffset.x=l-f.left,this.cloneOffset.y=d-f.top,this.dragClone=p.cloneNode(!0),this.configuration.copyStylesDragClone&&(this.dragClone.style.cssText=this.getComputedStyleText(p));let g=p.getBoundingClientRect();this.dragClone.style.width=`${g.width}px`,this.dragClone.style.height=`${g.height}px`,f&&this.setDragCloneStyles(f),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone(),this.refreshDragBounds(),this.refreshDropzoneRects(),window.addEventListener("scroll",this.onScrollOrResize,!0),window.addEventListener("resize",this.onScrollOrResize);let v=this.getMatchMaxValue(this.dragSource),E=this.draggables.filter(S=>S.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));v!==0&&E.length>=v?(p.style.opacity="0.0",p.style.pointerEvents="none"):p.style.opacity="1.0",a.preventDefault(),this.dragClone.setAttribute("dragging","")}findDraggableInDraggableContainer(a){let l=this.dragContainers.flat();for(let d of l){if(d.getAttribute("identifier")===a)return d;let p;d instanceof HTMLSlotElement?p=Array.from(d?.assignedElements()||[]):p=Array.from(d.querySelectorAll(r));let m=p.find(f=>f.getAttribute("identifier")===a);if(m)return m}}setDragCloneStyles(a){this.dragClone.style.position="fixed",this.dragClone.style.top=`${a.top}px`,this.dragClone.style.left=`${a.left}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return c([u({attribute:!1,type:Object})],i.prototype,"configuration",2),c([u({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),c([u({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),c([Li(t)],i.prototype,"handleDraggableContainerChange",1),c([Li(r)],i.prototype,"handleDraggablesChange",1),c([Li(e)],i.prototype,"handleDroppablesChange",1),i};var Na=y`
|
|
4114
4114
|
:host {
|
|
4115
4115
|
display: block; /* necessary to calculate scaling position */
|
|
4116
4116
|
}
|
|
@@ -4119,7 +4119,7 @@ div.full-correct-response-inline {
|
|
|
4119
4119
|
align-items: flex-start;
|
|
4120
4120
|
flex: 1;
|
|
4121
4121
|
border: 2px solid transparent;
|
|
4122
|
-
|
|
4122
|
+
margin: 1rem 0;
|
|
4123
4123
|
border-radius: 0.3rem;
|
|
4124
4124
|
gap: 0.5rem;
|
|
4125
4125
|
}
|
|
@@ -4129,22 +4129,27 @@ div.full-correct-response-inline {
|
|
|
4129
4129
|
background-color: var(--qti-bg-active) !important;
|
|
4130
4130
|
}
|
|
4131
4131
|
|
|
4132
|
+
[part='drop-container'] {
|
|
4133
|
+
display: flex;
|
|
4134
|
+
flex-direction: column;
|
|
4135
|
+
gap: 0.5rem;
|
|
4136
|
+
}
|
|
4137
|
+
|
|
4132
4138
|
[part='drop-list'][enabled] {
|
|
4133
4139
|
background-color: var(--qti-bg-active) !important;
|
|
4134
4140
|
}
|
|
4135
4141
|
|
|
4136
4142
|
:host::part(associables-container) {
|
|
4137
4143
|
display: flex;
|
|
4138
|
-
padding: 0.5rem;
|
|
4139
4144
|
justify-content: space-between;
|
|
4140
4145
|
background: linear-gradient(
|
|
4141
4146
|
180deg,
|
|
4142
4147
|
rgb(0 0 0 / 0%) calc(50% - 1px),
|
|
4143
|
-
var(--qti-border-color
|
|
4148
|
+
var(--qti-border-color) calc(50%),
|
|
4144
4149
|
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
4145
4150
|
);
|
|
4146
4151
|
}
|
|
4147
|
-
`;var si=class extends Ae(
|
|
4152
|
+
`;var si=class extends Ae(I,"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)}static{this.styles=Na}_registerChoice(e){let t=e.target;this._childrenMap.push(t)}render(){return h` <slot name="prompt"></slot>
|
|
4148
4153
|
<slot name="qti-simple-associable-choice"></slot>
|
|
4149
4154
|
<div part="drop-container">
|
|
4150
4155
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>h`<div part="associables-container">
|
|
@@ -4153,7 +4158,7 @@ div.full-correct-response-inline {
|
|
|
4153
4158
|
</div>`)}
|
|
4154
4159
|
|
|
4155
4160
|
<div role="alert" part="message" id="validation-message"></div>
|
|
4156
|
-
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};c([w()],si.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",si);var et=(
|
|
4161
|
+
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};c([w()],si.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",si);var et=(n,r)=>{class e extends n{constructor(){super(...arguments);this._choiceElements=[];this._mutationObserver=null;this._validationMessageShown=!1;this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(s,o)=>{this._choiceElements.forEach(a=>a.disabled=o)};this._handleReadonlyChange=(s,o)=>{this._choiceElements.forEach(a=>a.readonly=o)};this.response="";this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}_handleMaxChoicesChange(s,o){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(s){this.maxChoices>1&&(typeof s=="string"||s===null)?this.response=s?s.toString().split(","):[]:this.response=s||""}toggleInternalCorrectResponse(s){let o=this.correctResponse;if(o){let a=Array.isArray(o)?o:[o];this._choiceElements.forEach(l=>{l.internals.states.delete("correct-response"),l.internals.states.delete("incorrect-response"),s&&a.length>0&&(a.includes(l.identifier)?l.internals.states.add("correct-response"):l.internals.states.add("incorrect-response"))})}}toggleCandidateCorrection(s){let o=this.correctResponse;if(!o)return;let a=Array.isArray(o)?o:[o],l=this.response,d=Array.isArray(l)?l:l?[l]:[];this._choiceElements.forEach(p=>{p.internals.states.delete("candidate-correct"),p.internals.states.delete("candidate-incorrect"),s&&d.includes(p.identifier)&&(a.includes(p.identifier)?p.internals.states.add("candidate-correct"):p.internals.states.add("candidate-incorrect"))}),super.toggleCandidateCorrection(s)}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${r}`,this._choiceElementSelectedHandler),this._mutationObserver=new MutationObserver(()=>this._syncChoicesFromDOM()),this._mutationObserver.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${r}`,this._choiceElementSelectedHandler),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}_syncChoicesFromDOM(){let s=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(r)),this._choiceElements.forEach(a=>{s.has(a)||(this.disabled&&(a.disabled=!0),a.readonly=this.readonly,a.internals&&!a.internals.ariaChecked&&(a.internals.ariaChecked="false"),this._setInputType(a))});let o=new Set(this._choiceElements.map(a=>a.identifier));if(Array.isArray(this.response)){let a=this.response.filter(l=>o.has(l));a.length!==this.response.length&&(this.response=a)}else this.response&&!o.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let o=this._choiceElements.filter(p=>this._getChoiceChecked(p)).length,a=!0,l="";this.maxChoices!==0&&o>this.maxChoices?(a=!1,l=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):o<this.minChoices&&(a=!1,l=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let d=this._choiceElements.find(p=>this.contains(p))||this;return this._internals.setValidity(a?{}:{customError:!0},l,d),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.setProperty("display","block","important"),this._validationMessageShown=!0)),this._internals.validity.valid}_determineInputType(){this._choiceElements.forEach(s=>{this._setInputType(s)})}_setInputType(s){if(this._internals.role=this.maxChoices===1?"radiogroup":null,s.internals){let o=this.maxChoices===1?"radio":"checkbox";s.internals.role=o,s.internals.states.delete(o==="radio"?"checkbox":"radio"),s.internals.states.add(o)}}_choiceElementSelectedHandler(s){this._toggleChoiceChecked(s.target),this.maxChoices===1?this._choiceElements.forEach(o=>{o.identifier!==s.detail.identifier&&this._setChoiceChecked(o,!1)}):this.maxChoices!==0&&this._configContext?.disableAfterIfMaxChoicesReached&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(s,o){s.internals?.states&&(o?(s.internals.states.add("--checked"),s.internals.ariaChecked="true"):(s.internals.states.delete("--checked"),s.internals.ariaChecked="false"))}_getChoiceChecked(s){return s.internals.states.has("--checked")}_toggleChoiceChecked(s){let o=this._getChoiceChecked(s);this._setChoiceChecked(s,!o)}_handleChoiceSelection(){let o=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.response=this.maxChoices===1?o[0]||"":o,this.validate(),this._validationMessageShown&&(this.reportValidity(),this._internals.validity.valid&&(this._validationMessageShown=!1)),this.saveResponse(this.response)}_updateChoiceSelection(){let s=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(o=>{let a=s.includes(o.identifier);this._setChoiceChecked(o,a)})}}return c([Tt("#validation-message")],e.prototype,"_validationMessageElement",2),c([u({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),c([u({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),c([P("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),c([P("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),c([P("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),c([w()],e.prototype,"response",2),c([P("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",2),c([w(),k({context:le,subscribe:!0})],e.prototype,"_configContext",2),e};var Da=(n,r)=>{class e extends n{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"];this._mutationObserver=null}set class(s){s&&(this._classes=s.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(s){super.updated(s),this._addLabels()}connectedCallback(){super.connectedCallback(),this._mutationObserver=new MutationObserver(()=>this._addLabels()),this._mutationObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),this._mutationObserver?.disconnect(),this._mutationObserver=null}_addLabels(){let s=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),o=a=>!isNaN(+a);if(s){let l=Array.from(this.querySelectorAll("qti-simple-choice")).map(d=>d).map((d,p)=>({el:d,order:o(d.style.order)?+d.style.order:p+1})).sort((d,p)=>d.order-p.order).map(d=>d.el);for(let d=0;d<l.length;d++)l[d].marker=this._getLabel(d+1)}}_getLabel(s){let o=this._classes.filter(d=>this._allLabels.includes(d)).pop(),a=this._classes.filter(d=>this._allLabelSuffixes.includes(d)).pop();!o&&a&&(o="qti-labels-upper-alpha");let l="";switch(o){case"qti-labels-decimal":l=`${s}`;break;case"qti-labels-lower-alpha":l=`${String.fromCharCode(97+s-1)}`;break;case"qti-labels-upper-alpha":l=`${String.fromCharCode(65+s-1)}`;break}return a==="qti-labels-suffix-period"?l+=".":a==="qti-labels-suffix-parenthesis"&&(l+=")"),l}}return c([u({type:String})],e.prototype,"class",1),e};var Ha=y`
|
|
4157
4162
|
:host {
|
|
4158
4163
|
display: block;
|
|
4159
4164
|
}
|
|
@@ -4223,7 +4228,7 @@ div.full-correct-response-inline {
|
|
|
4223
4228
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
4224
4229
|
grid-row: auto;
|
|
4225
4230
|
}
|
|
4226
|
-
`;var oi=class extends Da(et(
|
|
4231
|
+
`;var oi=class extends Da(et(I,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments);this.orientation="vertical"}static{this.styles=Ha}#e(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return h`
|
|
4227
4232
|
<slot part="prompt" name="prompt"></slot>
|
|
4228
4233
|
<slot part="slot" @slotchange=${this.#e}></slot>
|
|
4229
4234
|
<div part="message" role="alert" id="validation-message"></div>
|
|
@@ -4338,7 +4343,7 @@ CES.load();
|
|
|
4338
4343
|
requestBlobUrl();
|
|
4339
4344
|
}
|
|
4340
4345
|
})();
|
|
4341
|
-
`,Ne=class extends
|
|
4346
|
+
`,Ne=class extends I{constructor(){super();this.#e="";this.#t=null;this.#r=null;this._errorMessage=null;this.#i=null;this.handlePostMessage=this.handlePostMessage.bind(this)}#e;#t;#r;#i;connectedCallback(){super.connectedCallback();let e=this.data;if(!e){let i=this.querySelector("object[data]");if(i){e=i.getAttribute("data");let s=i.getAttribute("width"),o=i.getAttribute("height");s&&this.setAttribute("width",s),o&&this.setAttribute("height",o)}}if(!e){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let t=e.startsWith("http")||e.startsWith("blob")?e:yr((this.baseItemUrl||"")+"/"+e);this.#t=new URL(t,window.location.href).toString(),fetch(t).then(i=>i.json()).then(i=>{this.manifest=i,this.setupCES()}).catch(i=>{this._errorMessage=i})}async setupCES(){await this.updateComplete;let e=this.shadowRoot?.querySelector("#pciContainer");if(!e){this._errorMessage="pciContainer iframe not found";return}e.getAttribute("src")||e.setAttribute("src","about:blank");let t=e.contentDocument??e.contentWindow?.document??null;if(t||(await new Promise(m=>e.addEventListener("load",()=>m(),{once:!0})),t=e.contentDocument??e.contentWindow?.document??null),!t){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let i=this.manifest.style[0],s=this.#a(),o=await this.#l(i,s),a=o.url;if(o.baseUrl&&!this.#r&&(this.#r=o.baseUrl),!0){let m="";if(this.manifest.media&&this.manifest.media.length>0){let f=this.manifest.media[0],g=await this.#l(f,s,{returnText:!0});if(m=g.url,g.baseUrl&&!this.#r&&(this.#r=g.baseUrl),g.text){let v=g.text;if(!(v.includes("postToParentWindows")||v.includes("window.CES"))){let q="<script>"+uo+"</script>",M=v.indexOf("<head>");M!==-1?v=v.slice(0,M+6)+q+v.slice(M+6):v=q+v}let S=new Blob([v],{type:"text/html"});this.#i=URL.createObjectURL(S)}}else{let f=this.data||"manifest.json",g=f.includes("/")?f.substring(0,f.lastIndexOf("/")):"",v=g?`${g}/index.html`:"index.html",E=await this.#l(v,s,{returnText:!0});if(m=E.url,E.baseUrl&&!this.#r&&(this.#r=E.baseUrl),E.text){let S=E.text;if(!(S.includes("postToParentWindows")||S.includes("window.CES"))){let O="<script>"+uo+"</script>",H=S.indexOf("<head>");H!==-1?S=S.slice(0,H+6)+O+S.slice(H+6):S=O+S}let M=new Blob([S],{type:"text/html"});this.#i=URL.createObjectURL(M)}}if(m&&!this.#i)try{let f=await fetch(m);if(f.ok){let g=await f.text();if(!(g.includes("postToParentWindows")||g.includes("window.CES"))){let S="<script>"+uo+"</script>",q=g.indexOf("<head>");q!==-1?g=g.slice(0,q+6)+S+g.slice(q+6):g=S+g}let E=new Blob([g],{type:"text/html"});this.#i=URL.createObjectURL(E)}else console.error(`Failed to fetch index.html: ${f.status}`)}catch(f){console.error(`Error fetching index.html: ${f}`)}}let d=`<script>${Yl}</script>`;window.addEventListener("message",this.handlePostMessage);let p=`
|
|
4342
4347
|
<!DOCTYPE html>
|
|
4343
4348
|
<html>
|
|
4344
4349
|
<head>
|
|
@@ -4347,7 +4352,7 @@ CES.load();
|
|
|
4347
4352
|
</head>
|
|
4348
4353
|
<body></body>
|
|
4349
4354
|
</html>
|
|
4350
|
-
`;e.srcdoc=p}#o(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),i=[...e,...t];for(let s of i){let
|
|
4355
|
+
`;e.srcdoc=p}#o(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),i=[...e,...t];for(let s of i){let o=s.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let l=s.contentDocument||s.contentWindow.document;l&&this.#s(l,i)}catch(l){console.error("Error accessing nested iframe:",l)}}return i.forEach((s,o)=>{i.indexOf(s)!==o&&i.splice(o,1)}),i}#s(e,t=[]){return e.querySelectorAll("iframe").forEach(s=>{t.push(s);let o=s.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let l=s.contentDocument||s.contentWindow.document;this.#s(l,t)}catch(l){console.error("Error accessing nested iframe:",l)}else console.warn("Skipped cross-origin iframe:",o)}),t}#n(e,t){window.postMessage({type:e,data:t},"*");let i=this.#o();for(let s of i)s.contentWindow&&s.contentWindow.postMessage({type:e,data:t},"*")}handlePostMessage(e){let{type:t,data:i}=e.data;switch(t){case"setResponse":(i===null||!(Array.isArray(i)&&i.length===1&&i[0]===""))&&(this.#e=i,this.saveResponse(i));break;case"getResponse":{this.#n("responseData",this.#e);break}case"getBlobUrl":{this.#i&&(this.#n("blobUrl",this.#i),e.source&&e.source!==window&&e.source.postMessage({type:"blobUrl",data:this.#i},"*"));break}case"getMedia":{let s=this.#a(),o=this.manifest.media.map(a=>{if(a.startsWith("http")||a.startsWith("blob"))return a;let l=this.#r||s[0];return l?new URL(a,l.endsWith("/")?l:`${l}/`).toString():a});this.#n("mediaData",o);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#e)return!1;if(Array.isArray(this.#e)){if(this.#e.length===0)return!1;for(let e of this.#e)if(e!==""&&e!==null)return!0}return!0}get response(){return this.#e||null}set response(e){if(typeof e=="string")this.#e=e,this.saveResponse(e);else if(Array.isArray(e))this.#e=e;else if(e)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return h`<iframe
|
|
4351
4356
|
width=${this.getAttribute("width")}
|
|
4352
4357
|
height=${this.getAttribute("height")}
|
|
4353
4358
|
frameborder="0"
|
|
@@ -4358,7 +4363,7 @@ CES.load();
|
|
|
4358
4363
|
${this._errorMessage&&h`<div style="color:red">
|
|
4359
4364
|
<h1>Error</h1>
|
|
4360
4365
|
${this._errorMessage}
|
|
4361
|
-
</div>`}`}#a(){let t=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#d()].filter(Boolean).map(s=>new URL(s,window.location.href).toString()),i=this.#c();return i&&t.push(i),[...new Set(t)]}#d(){return this.#t?new URL(".",this.#t).toString():null}#c(){return this.#t?new URL("..",this.#t).toString():null}async#l(e,t,i={}){if(!e)return{url:"",baseUrl:null};if(e.startsWith("http")||e.startsWith("blob"))return{url:e,baseUrl:null};for(let s of t){let
|
|
4366
|
+
</div>`}`}#a(){let t=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#d()].filter(Boolean).map(s=>new URL(s,window.location.href).toString()),i=this.#c();return i&&t.push(i),[...new Set(t)]}#d(){return this.#t?new URL(".",this.#t).toString():null}#c(){return this.#t?new URL("..",this.#t).toString():null}async#l(e,t,i={}){if(!e)return{url:"",baseUrl:null};if(e.startsWith("http")||e.startsWith("blob"))return{url:e,baseUrl:null};for(let s of t){let o=new URL(s,window.location.href).toString(),a=new URL(e,o.endsWith("/")?o:`${o}/`).toString();try{let l=await fetch(a);if(l.ok){if(i.returnText){let d=await l.text();return{url:a,baseUrl:o,text:d}}return{url:a,baseUrl:o}}}catch{}}return{url:"",baseUrl:null}}};c([u({type:String,attribute:"data"})],Ne.prototype,"data",2),c([u({type:String,attribute:"data-base-item"})],Ne.prototype,"baseItemUrl",2),c([u({type:String,attribute:"data-base-ref"})],Ne.prototype,"baseRefUrl",2),c([u({type:String,attribute:"id"})],Ne.prototype,"id",2),c([w()],Ne.prototype,"_errorMessage",2);customElements.define("qti-custom-interaction",Ne);var tt=class extends b{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}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"}}))}};c([u({type:String,attribute:"response-identifier"})],tt.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],tt.prototype,"disabled",2),c([u({type:String,attribute:"count-attempt"})],tt.prototype,"countAttempt",2),c([u({type:String})],tt.prototype,"title",2);customElements.define("qti-end-attempt-interaction",tt);var za=y`
|
|
4362
4367
|
/* PK: display host as block, else design will be collapsed */
|
|
4363
4368
|
:host {
|
|
4364
4369
|
display: block;
|
|
@@ -4369,7 +4374,7 @@ CES.load();
|
|
|
4369
4374
|
height: 100%;
|
|
4370
4375
|
border: 0;
|
|
4371
4376
|
}
|
|
4372
|
-
`;var ae=class extends
|
|
4377
|
+
`;var ae=class extends I{constructor(){super(...arguments);this._rows=5;this.response=null;this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=za}handleclassNamesChange(e,t){let i=t.split(" "),s=!1;if(i.forEach(o=>{if(o.startsWith("qti-height-lines-")){let a=o.replace("qti-height-lines-","");this._rows=parseInt(a),s=!0}}),!s&&this.expectedLength){let o=Math.ceil(this.expectedLength/50);this._rows=o}}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(t);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return!!this.response&&e.checkValidity()}toggleCorrectResponse(){}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return h`<slot name="prompt"></slot
|
|
4373
4378
|
><textarea
|
|
4374
4379
|
part="textarea"
|
|
4375
4380
|
name="${this.responseIdentifier}"
|
|
@@ -4385,7 +4390,7 @@ CES.load();
|
|
|
4385
4390
|
?disabled="${this.disabled}"
|
|
4386
4391
|
?readonly="${this.readonly}"
|
|
4387
4392
|
.value=${this.response}
|
|
4388
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};c([w()],ae.prototype,"_rows",2),c([u({type:Number,attribute:"expected-length"})],ae.prototype,"expectedLength",2),c([u({type:String,attribute:"pattern-mask"})],ae.prototype,"patternMask",2),c([u({type:String,attribute:"placeholder-text"})],ae.prototype,"placeholderText",2),c([u({type:String,attribute:"data-patternmask-message"})],ae.prototype,"dataPatternmaskMessage",2),c([u({type:String,attribute:"class"})],ae.prototype,"classNames",2),c([
|
|
4393
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};c([w()],ae.prototype,"_rows",2),c([u({type:Number,attribute:"expected-length"})],ae.prototype,"expectedLength",2),c([u({type:String,attribute:"pattern-mask"})],ae.prototype,"patternMask",2),c([u({type:String,attribute:"placeholder-text"})],ae.prototype,"placeholderText",2),c([u({type:String,attribute:"data-patternmask-message"})],ae.prototype,"dataPatternmaskMessage",2),c([u({type:String,attribute:"class"})],ae.prototype,"classNames",2),c([P("classNames")],ae.prototype,"handleclassNamesChange",1),c([w()],ae.prototype,"response",2),c([P("response",{waitUntilFirstUpdate:!0})],ae.prototype,"_handleResponseChange",2);customElements.define("qti-extended-text-interaction",ae);var Ua=y`
|
|
4389
4394
|
:host {
|
|
4390
4395
|
display: flex;
|
|
4391
4396
|
align-items: flex-start;
|
|
@@ -4419,10 +4424,10 @@ CES.load();
|
|
|
4419
4424
|
border-radius: 0.3rem;
|
|
4420
4425
|
gap: 0.5rem;
|
|
4421
4426
|
}
|
|
4422
|
-
`;var os=class extends Ae(
|
|
4427
|
+
`;var os=class extends Ae(I,"qti-gap-text","qti-gap","slot[part='drags']"){static{this.styles=Ua}render(){return h`<slot name="prompt"> </slot>
|
|
4423
4428
|
<slot part="drags" name="drags"></slot>
|
|
4424
4429
|
<slot part="drops"></slot>
|
|
4425
|
-
<div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(
|
|
4430
|
+
<div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(o=>{let a=o.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(o=>{let a=o.getAttribute("identifier"),l=t.find(p=>p.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${l}"]`)?.textContent.trim();if(l&&d){if(!o.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",o.insertAdjacentElement("afterend",p)}}else o.nextElementSibling?.classList.contains("correct-option")&&o.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}#e(r){if(!r.correctResponse)return[];let e=Array.isArray(r.correctResponse)?r.correctResponse:[r.correctResponse],t=[];return e&&e.forEach(i=>{let s=i.split(" ");t.push({source:s[0],target:s[1]})}),t}toggleCandidateCorrection(r){let e=this.responseVariable;if(!e?.correctResponse)return;let t=this.#e(e);Array.from(this.querySelectorAll("qti-gap")).forEach(s=>{let o=s.getAttribute("identifier"),a=t.filter(d=>d.target===o);s.querySelectorAll("qti-gap-text").forEach(d=>{if(d.internals.states.delete("candidate-correct"),d.internals.states.delete("candidate-incorrect"),!r)return;a.find(m=>m.source===d.identifier)?.source!==void 0?d.internals.states.add("candidate-correct"):d.internals.states.add("candidate-incorrect")})})}};customElements.define("qti-gap-match-interaction",os);var Ba=(n,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(n[i],i);return t},er=re(class extends xe{constructor(n){if(super(n),n.type!==We.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],s=[],o=0;for(let a of n)i[o]=t?t(a,o):o,s[o]=e(a,o),o++;return{values:s,keys:i}}render(n,r,e){return this.dt(n,r,e).values}update(n,[r,e,t]){let i=In(n),{values:s,keys:o}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=o,s;let a=this.ut??=[],l=[],d,p,m=0,f=i.length-1,g=0,v=s.length-1;for(;m<=f&&g<=v;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===o[g])l[g]=Xe(i[m],s[g]),m++,g++;else if(a[f]===o[v])l[v]=Xe(i[f],s[v]),f--,v--;else if(a[m]===o[v])l[v]=Xe(i[m],s[v]),$t(n,l[v+1],i[m]),m++,v--;else if(a[f]===o[g])l[g]=Xe(i[f],s[g]),$t(n,i[m],i[f]),f--,g++;else if(d===void 0&&(d=Ba(o,g,v),p=Ba(a,m,f)),d.has(a[m]))if(d.has(a[f])){let E=p.get(o[g]),S=E!==void 0?i[E]:null;if(S===null){let q=$t(n,i[m]);Xe(q,s[g]),l[g]=q}else l[g]=Xe(S,s[g]),$t(n,i[m],S),i[E]=null;g++}else $i(i[f]),f--;else $i(i[m]),m++;for(;g<=v;){let E=$t(n,l[v+1]);Xe(E,s[g]),l[g++]=E}for(;m<=f;){let E=i[m++];E!==null&&$i(E)}return this.ut=o,Rn(n,l),z}});function rt(n,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,s=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(n){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[o,a,l]=r,d=o/i*100,p=a/s*100,m=l/i*100,f=l/s*100;t.style.left=d-m+"%",t.style.top=p-f+"%",t.style.width=2*m+"%",t.style.height=2*f+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[o,a,l,d]=r,p=o/i*100,m=a/s*100,f=l/i*100,g=d/s*100;t.style.left=p+"%",t.style.top=m+"%",t.style.width=f-p+"%",t.style.height=g-m+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[o,a,l,d]=r,p=o/i*100,m=a/s*100,f=l/i*100,g=d/s*100;t.style.left=p-f+"%",t.style.top=m-g+"%",t.style.width=2*f+"%",t.style.height=2*g+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let o=[];for(let q=0;q<r.length;q+=2)o.push({x:r[q],y:r[q+1]});let a=Math.min(...o.map(q=>q.x)),l=Math.max(...o.map(q=>q.x)),d=Math.min(...o.map(q=>q.y)),p=Math.max(...o.map(q=>q.y)),m=a/i*100,f=d/s*100,g=l/i*100,v=p/s*100;t.style.left=m+"%",t.style.top=f+"%",t.style.width=g-m+"%",t.style.height=v-f+"%";let S=o.map(q=>({x:(q.x-a)/(l-a)*100,y:(q.y-d)/(p-d)*100})).map(q=>`${q.x}% ${q.y}%`).join(",");t.style.clipPath=`polygon(${S})`}break;default:console.error(`Unsupported shape: ${n}`);break}}var Fa=y`
|
|
4426
4431
|
slot:not([name='prompt']) {
|
|
4427
4432
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4428
4433
|
display: block;
|
|
@@ -4446,14 +4451,14 @@ CES.load();
|
|
|
4446
4451
|
top: 0px;
|
|
4447
4452
|
left: 0px;
|
|
4448
4453
|
}
|
|
4449
|
-
`;var De=class extends
|
|
4454
|
+
`;var De=class extends I{constructor(){super();this.#t=null;this.#r=null;this._correctLines=[];this._response=[];this.addEventListener("qti-register-hotspot",this.#s)}static{this.styles=Fa}#e;#t;#r;reset(){this._response=[],this._correctLines=[]}validate(){return this.#o().length>0}set response(e){this._response=this.#i(e)}get response(){return this._response}#i(e){return e==null||e===""?[]:Array.isArray(e)?e:[e]}#o(){return this.#i(this._response)}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctLines=[];return}if(!t.correctResponse){console.error("No correct response found for this interaction.");return}let i=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];this._correctLines=i}render(){return h`<slot name="prompt"></slot>
|
|
4450
4455
|
<line-container>
|
|
4451
4456
|
<svg
|
|
4452
4457
|
width=${qe(this.grImage[0]?.width)}
|
|
4453
4458
|
height=${qe(this.grImage[0]?.height)}
|
|
4454
4459
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
4455
4460
|
>
|
|
4456
|
-
${er(this.#o(),e=>e,(e,t)=>
|
|
4461
|
+
${er(this.#o(),e=>e,(e,t)=>Ii`
|
|
4457
4462
|
<line
|
|
4458
4463
|
part="line"
|
|
4459
4464
|
x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
|
|
@@ -4462,10 +4467,10 @@ CES.load();
|
|
|
4462
4467
|
y2=${parseInt(this.querySelector(`[identifier=${e.split(" ")[1]}]`).style.top)}
|
|
4463
4468
|
stroke="red"
|
|
4464
4469
|
stroke-width="3"
|
|
4465
|
-
@click=${i=>{i.stopPropagation(),this._response=this._response.filter((s,
|
|
4470
|
+
@click=${i=>{i.stopPropagation(),this._response=this._response.filter((s,o)=>o!==t),this.saveResponse(this.response)}}
|
|
4466
4471
|
/>
|
|
4467
4472
|
`)}
|
|
4468
|
-
${er(this._correctLines||[],e=>e,(e,t)=>
|
|
4473
|
+
${er(this._correctLines||[],e=>e,(e,t)=>Ii`
|
|
4469
4474
|
<line
|
|
4470
4475
|
part="correct-line"
|
|
4471
4476
|
x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
|
|
@@ -4477,7 +4482,7 @@ CES.load();
|
|
|
4477
4482
|
stroke-dasharray="5,5"
|
|
4478
4483
|
/>
|
|
4479
4484
|
`)}
|
|
4480
|
-
${this.#t&&
|
|
4485
|
+
${this.#t&&Ii`<line
|
|
4481
4486
|
part="point"
|
|
4482
4487
|
x1=${this.startCoord.x}
|
|
4483
4488
|
y1=${this.startCoord.y}
|
|
@@ -4489,7 +4494,7 @@ CES.load();
|
|
|
4489
4494
|
</svg>
|
|
4490
4495
|
<slot></slot>
|
|
4491
4496
|
</line-container>
|
|
4492
|
-
<div role="alert" part="message" id="validation-message"></div>`}#s(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),
|
|
4497
|
+
<div role="alert" part="message" id="validation-message"></div>`}#s(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),o=i.getAttribute("shape"),a=s.split(",").map(l=>parseInt(l));rt(o,a,t,i)}firstUpdated(){this.#e=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let i=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-i.left,y:e.clientY-i.top}}),this.#e.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.#t?this.#r||(this.#r=t.target,this._response=this.#o(),this._response=[...this._response,`${this.#t.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#t=null,this.#r=null):(this.#t=t.target,this.startCoord={x:parseInt(this.#t.getAttribute("coords").split(",")[0]),y:parseInt(this.#t.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s)}};c([w()],De.prototype,"_correctLines",2),c([w()],De.prototype,"startCoord",2),c([w()],De.prototype,"mouseCoord",2),c([hn({selector:"img"})],De.prototype,"grImage",2),c([w()],De.prototype,"_response",2);customElements.define("qti-graphic-associate-interaction",De);var ja=y`
|
|
4493
4498
|
:host {
|
|
4494
4499
|
display: flex;
|
|
4495
4500
|
align-items: flex-start;
|
|
@@ -4543,10 +4548,10 @@ CES.load();
|
|
|
4543
4548
|
user-select: none;
|
|
4544
4549
|
pointer-events: none;
|
|
4545
4550
|
}
|
|
4546
|
-
`;var ns=class extends Ae(
|
|
4551
|
+
`;var ns=class extends Ae(I,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){static{this.styles=ja}render(){return h` <slot name="prompt"></slot>
|
|
4547
4552
|
<slot part="image"></slot>
|
|
4548
4553
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
4549
|
-
<div role="alert" part="message" id="validation-message"></div>`}#e(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),s=t.split(",").map(
|
|
4554
|
+
<div role="alert" part="message" id="validation-message"></div>`}#e(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),s=t.split(",").map(o=>parseInt(o));switch(i){case"circle":{let[o,a,l]=s;e.style.left=o-l+"px",e.style.top=a-l+"px",e.style.width=e.style.height=2*l+"px"}break;case"rect":{let[o,a,l,d]=s;e.style.left=o+"px",e.style.top=a+"px",e.style.width=l-o+"px",e.style.height=d-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#e)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#e)}};customElements.define("qti-graphic-gap-match-interaction",ns);var Wa=y`
|
|
4550
4555
|
slot:not([name='prompt']) {
|
|
4551
4556
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4552
4557
|
display: block;
|
|
@@ -4557,11 +4562,11 @@ CES.load();
|
|
|
4557
4562
|
pointer-events: none;
|
|
4558
4563
|
user-select: none;
|
|
4559
4564
|
}
|
|
4560
|
-
`;var as=class extends et(
|
|
4565
|
+
`;var as=class extends et(I,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}static{this.styles=Wa}render(){return h`
|
|
4561
4566
|
<slot name="prompt"></slot>
|
|
4562
4567
|
<slot></slot>
|
|
4563
4568
|
<div role="alert" part="message" id="validation-message"></div>
|
|
4564
|
-
`}#e(e){let{identifier:t}=e.detail,i=this._choiceElements.find(
|
|
4569
|
+
`}#e(e){let{identifier:t}=e.detail,i=this._choiceElements.find(o=>o.getAttribute("identifier")===t);if(!i)return;let s=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){let o=this._choiceElements.filter(a=>a.order!=null).length;if(o>=s){this.choiceOrdering=!1;return}i.order=o+1}else{let o=i.order;i.order=null,this._choiceElements.forEach(a=>{a.order!=null&&a.order>o&&a.order--})}this.choiceOrdering=!1}}toggleCorrectResponse(e){let t=this.responseVariable,i=this._choiceElements;for(let s of i)if(e&&t?.correctResponse?.length>0&&Array.isArray(t.correctResponse)){let o=t.correctResponse.findIndex(a=>a===s.identifier);o>=0?s.orderCorrect=o+1:s.orderCorrect=null}else s.orderCorrect=null}#t(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),o=i.getAttribute("shape"),a=s.split(",").map(l=>parseInt(l));rt(o,a,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.#e),this.addEventListener("register-qti-hotspot-choice",this.#t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.#e),this.removeEventListener("register-qti-hotspot-choice",this.#t)}};customElements.define("qti-graphic-order-interaction",as);var Xa=y`
|
|
4565
4570
|
slot:not([name='prompt']) {
|
|
4566
4571
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4567
4572
|
display: inline-block;
|
|
@@ -4575,11 +4580,11 @@ CES.load();
|
|
|
4575
4580
|
user-select: none;
|
|
4576
4581
|
/* width:100%; */
|
|
4577
4582
|
}
|
|
4578
|
-
`;var ls=class extends et(
|
|
4583
|
+
`;var ls=class extends et(I,"qti-hotspot-choice"){static{this.styles=Xa}render(){return h`
|
|
4579
4584
|
<slot name="prompt"></slot>
|
|
4580
4585
|
<slot></slot>
|
|
4581
|
-
`}#e=null;#t(r){return this.#e||(r.naturalWidth>0&&r.naturalHeight>0?this.#e=Promise.resolve(r):this.#e=new Promise(e=>{let t=()=>{r.removeEventListener("load",t),e(r)};r.addEventListener("load",t)})),this.#e}async#r(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),s=t.getAttribute("shape"),
|
|
4582
|
-
<div part="message" role="alert" id="validation-message"></div>`}get#e(){let e={"qti-input-control-hidden":!0};return this.class&&this.class.split(" ").forEach(t=>{t.trim()&&(e[t.trim()]=!0)}),e}connectedCallback(){super.connectedCallback(),this.#t()}updated(e){super.updated(e),this.#t()}#t(){let e=Object.keys(this.#e).join(" ");this.className=e}};c([u({type:String,reflect:!0})],ni.prototype,"class",2);customElements.define("qti-hottext-interaction",ni);var ai=class extends xe{constructor(r){if(super(r),this.it=L,r.type!==We.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===L||r==null)return this._t=void 0,this.it=r;if(r===z)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ai.directiveName="unsafeHTML",ai.resultType=1;var it=re(ai);var Z=class Z extends
|
|
4586
|
+
`}#e=null;#t(r){return this.#e||(r.naturalWidth>0&&r.naturalHeight>0?this.#e=Promise.resolve(r):this.#e=new Promise(e=>{let t=()=>{r.removeEventListener("load",t),e(r)};r.addEventListener("load",t)})),this.#e}async#r(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),s=t.getAttribute("shape"),o=i.split(",").map(l=>parseInt(l)),a=await this.#t(e);rt(s,o,a,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.#r)}};customElements.define("qti-hotspot-interaction",ls);var ni=class extends et(I,"qti-hottext"){constructor(){super(...arguments);this.class="";this.render=()=>h`<slot></slot>
|
|
4587
|
+
<div part="message" role="alert" id="validation-message"></div>`}get#e(){let e={"qti-input-control-hidden":!0};return this.class&&this.class.split(" ").forEach(t=>{t.trim()&&(e[t.trim()]=!0)}),e}connectedCallback(){super.connectedCallback(),this.#t()}updated(e){super.updated(e),this.#t()}#t(){let e=Object.keys(this.#e).join(" ");this.className=e}};c([u({type:String,reflect:!0})],ni.prototype,"class",2);customElements.define("qti-hottext-interaction",ni);var ai=class extends xe{constructor(r){if(super(r),this.it=L,r.type!==We.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===L||r==null)return this._t=void 0,this.it=r;if(r===z)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ai.directiveName="unsafeHTML",ai.resultType=1;var it=re(ai);var Z=class Z extends I{constructor(){super(...arguments);this.options=[];this.correctOption="";this._dropdownOpen=!1;this._calculatedMinWidth=0;this._widthCalculationTimer=null;this.dataPrompt="";this.#i=e=>{if(this.readonly)return;let t=e.target.value;this.#o(t)};this.#n=()=>{this.disabled||this.readonly||this.#s(!this._dropdownOpen)};this.#a=e=>{this.disabled||this.readonly||(e.key==="ArrowDown"||e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(!0))};this.#d=e=>{if(!this._dropdownOpen)return;if(e.key==="Escape"){e.preventDefault(),this.#s(!1),this.#c();return}let t=Array.from(this.renderRoot.querySelectorAll('button[part="option"]')),i=this.renderRoot.activeElement,s=t.findIndex(o=>o===i);e.key==="ArrowDown"&&(e.preventDefault(),t[Math.min(t.length-1,Math.max(0,s+1))]?.focus()),e.key==="ArrowUp"&&(e.preventDefault(),t[Math.max(0,s-1)]?.focus())};this.#l=e=>{if(!this._dropdownOpen)return;let t=e.composedPath?.();t&&t.includes(this)||this.#s(!1)};this.#u=e=>{this._dropdownOpen&&e.key==="Escape"&&(e.preventDefault(),this.#s(!1),this.#c())}}get isInline(){return!0}static{this._supportsCustomizableSelectCache=null}static get styles(){return[y`
|
|
4583
4588
|
:host {
|
|
4584
4589
|
display: inline-block;
|
|
4585
4590
|
vertical-align: baseline;
|
|
@@ -4835,7 +4840,7 @@ CES.load();
|
|
|
4835
4840
|
`:null}
|
|
4836
4841
|
`}
|
|
4837
4842
|
${it(this.correctOption)}
|
|
4838
|
-
`}connectedCallback(){super.connectedCallback(),this.#r(),this.#t()||(document.addEventListener("pointerdown",this.#l,!0),document.addEventListener("keydown",this.#u,!0)),this._estimateOptimalWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#t()||(document.removeEventListener("pointerdown",this.#l,!0),document.removeEventListener("keydown",this.#u,!0)),this._widthCalculationTimer!==null&&(window.clearTimeout(this._widthCalculationTimer),this._widthCalculationTimer=null)}willUpdate(e){(e.has("configContext")||e.has("dataPrompt"))&&this.#r()}updated(e){e.has("_dropdownOpen")&&this._dropdownOpen&&(this.#m(),this.renderRoot.querySelector('button[part="option"][aria-selected="true"]')?.focus())}#e(){return this.options.find(e=>e.selected)??this.options[0]}#t(){if(Z._supportsCustomizableSelectCache!==null)return Z._supportsCustomizableSelectCache;if(typeof CSS>"u"||typeof CSS.supports!="function")return Z._supportsCustomizableSelectCache=!1,!1;let e=CSS.supports("selector(::picker(select))")||CSS.supports("selector(select::picker(select))"),t=CSS.supports("appearance: base-select")||CSS.supports("-webkit-appearance: base-select");if(!e||!t)return Z._supportsCustomizableSelectCache=!1,!1;try{let i=document.createElement("div");i.style.position="absolute",i.style.top="-9999px",i.style.left="-9999px";let s=document.createElement("select");s.style.appearance="base-select",s.style.webkitAppearance="base-select";let
|
|
4843
|
+
`}connectedCallback(){super.connectedCallback(),this.#r(),this.#t()||(document.addEventListener("pointerdown",this.#l,!0),document.addEventListener("keydown",this.#u,!0)),this._estimateOptimalWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#t()||(document.removeEventListener("pointerdown",this.#l,!0),document.removeEventListener("keydown",this.#u,!0)),this._widthCalculationTimer!==null&&(window.clearTimeout(this._widthCalculationTimer),this._widthCalculationTimer=null)}willUpdate(e){(e.has("configContext")||e.has("dataPrompt"))&&this.#r()}updated(e){e.has("_dropdownOpen")&&this._dropdownOpen&&(this.#m(),this.renderRoot.querySelector('button[part="option"][aria-selected="true"]')?.focus())}#e(){return this.options.find(e=>e.selected)??this.options[0]}#t(){if(Z._supportsCustomizableSelectCache!==null)return Z._supportsCustomizableSelectCache;if(typeof CSS>"u"||typeof CSS.supports!="function")return Z._supportsCustomizableSelectCache=!1,!1;let e=CSS.supports("selector(::picker(select))")||CSS.supports("selector(select::picker(select))"),t=CSS.supports("appearance: base-select")||CSS.supports("-webkit-appearance: base-select");if(!e||!t)return Z._supportsCustomizableSelectCache=!1,!1;try{let i=document.createElement("div");i.style.position="absolute",i.style.top="-9999px",i.style.left="-9999px";let s=document.createElement("select");s.style.appearance="base-select",s.style.webkitAppearance="base-select";let o=document.createElement("button");o.type="button";let a=document.createElement("selectedcontent");a.textContent="probe",o.appendChild(a);let l=document.createElement("option");l.value="probe",l.textContent="probe",s.appendChild(o),s.appendChild(l),i.appendChild(s),(document.body||document.documentElement).appendChild(i);let d=o.getBoundingClientRect();i.remove();let p=d.width>0&&d.height>0;return Z._supportsCustomizableSelectCache=p,p}catch{return Z._supportsCustomizableSelectCache=!1,!1}}#r(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select",i=this.options.find(a=>a.selected)?.value??"",s=[{textContent:t,value:"",selected:i===""},...e.map(a=>{let l=a.getAttribute("identifier")??"";return{textContent:a.innerHTML,value:l,selected:l!==""&&l===i}})],o=s.some(a=>a.selected);this.options=o?s:s.map((a,l)=>({...a,selected:l===0})),this._estimateOptimalWidth()}_estimateOptimalWidth(){if(this.options.length===0)return;let e=0;for(let s of this.options){let o=s.textContent.replace(/<[^>]*>/g,"").trim();e=Math.max(e,o.length)}let t=Math.max(e*.6+4,8.75),i=Math.min(t,40);this._calculatedMinWidth=i,this.style.setProperty("--qti-calculated-min-width",`${i}em`)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.#s(!1),this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set response(e){let t=e??"";this.options=this.options.map(i=>({...i,selected:i.value===t}))}get response(){let e=this.options.find(t=>t.selected)?.value??"";return e===""?null:e}toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse;if(!e||!t){this.correctOption="";return}let i=this.options.find(s=>t===s.value);if(!i){this.correctOption="";return}this.correctOption=`<span part="correct-option" style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block">${i.textContent}</span>`}#i;#o(e){this.options=this.options.map(t=>({...t,selected:t.value===e})),this.saveResponse(e),this.#s(!1)}#s(e){this._dropdownOpen!==e&&(this._dropdownOpen=e)}#n;#a;#d;#c(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l;#u;#m(){if(!this._dropdownOpen)return;let e=this.renderRoot.querySelector('[part="menu"]'),t=this.renderRoot.querySelector('button[part="trigger"]');if(!e||!t)return;e.dataset.placement="bottom",e.style.setProperty("--qti-menu-shift-x","0px"),e.style.setProperty("--qti-menu-shift-y","0px"),e.style.left="0px",e.style.right="auto";let i=document.documentElement?.clientWidth||window.innerWidth,s=document.documentElement?.clientHeight||window.innerHeight,o=8,a=t.getBoundingClientRect(),l=Math.max(0,i-o*2);e.style.maxWidth=`${l}px`,e.style.minWidth=`${Math.min(a.width,l)}px`;let d=e.getBoundingClientRect(),p=s-a.bottom,m=a.top;d.bottom>s-o&&m>p&&(e.dataset.placement="top",d=e.getBoundingClientRect());let f=Math.max(o,i-o-d.width),v=Math.min(f,Math.max(o,a.left))-a.left;e.style.left=`${v}px`}};c([w()],Z.prototype,"options",2),c([w()],Z.prototype,"correctOption",2),c([w()],Z.prototype,"_dropdownOpen",2),c([w()],Z.prototype,"_calculatedMinWidth",2),c([u({attribute:"data-prompt",type:String})],Z.prototype,"dataPrompt",2),c([k({context:le,subscribe:!0}),u({attribute:!1})],Z.prototype,"configContext",2);var cs=Z;customElements.define("qti-inline-choice-interaction",cs);var Ga=y`
|
|
4839
4844
|
slot:not([hidden]) {
|
|
4840
4845
|
/* slot where the */
|
|
4841
4846
|
display: flex;
|
|
@@ -4861,7 +4866,7 @@ CES.load();
|
|
|
4861
4866
|
/* Make sure the drag and drop container slots have the same width */
|
|
4862
4867
|
flex: 1;
|
|
4863
4868
|
}
|
|
4864
|
-
`;var st=class extends Ae(
|
|
4869
|
+
`;var st=class extends Ae(I,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=null;this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,s=t.name,o=t.type;t.checked?(this.response?this.response.indexOf(i)===-1&&(o==="radio"&&(this.response=(this.response||[]).filter(a=>a.indexOf(s)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=t):(this.response=(this.response||[]).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.response)?[...this.response]:this.response}}))}}static{this.styles=Ga}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}#e(e){if(!e.correctResponse)return[];let t=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse],i=[];return t&&t.forEach(s=>{let o=s.split(" ");i.push({source:o[0],target:o[1]})}),i}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!t?.correctResponse){this.querySelectorAll(".correct-option").forEach(s=>s.remove());return}let i=this.#e(t);this.class.split(" ").includes("qti-match-tabular")?e?this.correctOptions=i||[]:this.correctOptions=null:e?(this.querySelectorAll(".correct-option").forEach(s=>s.remove()),this.targetChoices.forEach(s=>{let o=s.getAttribute("identifier"),a=i.find(l=>l.target===o);if(a?.source){let d=this.querySelector(`qti-simple-associable-choice[identifier="${a.source}"]`)?.textContent?.trim();if(d&&!s.previousElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",s.insertAdjacentElement("beforebegin",p)}}})):this.correctOptions=null}toggleCandidateCorrection(e){let t=this.responseVariable;if(!t?.correctResponse)return;let i=this.#e(t);this.targetChoices.forEach(s=>{let o=s.getAttribute("identifier"),a=i.filter(d=>d.target===o);s.querySelectorAll("qti-simple-associable-choice").forEach(d=>{if(d.internals.states.delete("candidate-correct"),d.internals.states.delete("candidate-incorrect"),!e)return;a.find(m=>m.source===d.identifier)?.source!==void 0?d.internals.states.add("candidate-correct"):d.internals.states.add("candidate-incorrect")})})}render(){let e=this.class.split(" ").includes("qti-match-tabular"),t=this.correctOptions!==null;return h`
|
|
4865
4870
|
<slot name="prompt"></slot>
|
|
4866
4871
|
<slot ?hidden=${e}></slot>
|
|
4867
4872
|
|
|
@@ -4874,7 +4879,7 @@ CES.load();
|
|
|
4874
4879
|
|
|
4875
4880
|
${this.sourceChoices.map(i=>h`<tr part="row">
|
|
4876
4881
|
<td part="c-header">${it(i.innerHTML)}</td>
|
|
4877
|
-
${this.targetChoices.map(s=>{let
|
|
4882
|
+
${this.targetChoices.map(s=>{let o=i.getAttribute("identifier"),a=s.getAttribute("identifier"),l=`${o} ${a}`,d=(this.response||[]).filter(E=>E.split(" ")[0]===o).length||0,p=this.response?.includes(l)||!1,m=i.matchMax===1?"radio":"checkbox",f=!!this.correctOptions?.find(E=>E.source===o&&E.target===a),g=m==="radio"?`rb ${p?"rb-checked":""} ${t?f?"rb-correct":"rb-incorrect":""}`:`cb ${p?"cb-checked":""} ${t?f?"cb-correct":"cb-incorrect":""}`,v=this.correctOptions?.length>0?!0:i.matchMax===1?!1:i.matchMax!==0&&d>=i.matchMax&&!p;return h`<td part="input-cell">
|
|
4878
4883
|
<div
|
|
4879
4884
|
class="input-container"
|
|
4880
4885
|
style="position: relative; width: 24px; height: 24px; margin: 0 auto;"
|
|
@@ -4882,7 +4887,7 @@ CES.load();
|
|
|
4882
4887
|
<input
|
|
4883
4888
|
type=${m}
|
|
4884
4889
|
part=${g}
|
|
4885
|
-
name=${
|
|
4890
|
+
name=${o}
|
|
4886
4891
|
value=${l}
|
|
4887
4892
|
.disabled=${v}
|
|
4888
4893
|
@change=${E=>this.handleRadioChange(E)}
|
|
@@ -4904,7 +4909,7 @@ CES.load();
|
|
|
4904
4909
|
`:L}
|
|
4905
4910
|
|
|
4906
4911
|
<div role="alert" part="message" id="validation-message"></div>
|
|
4907
|
-
`}};c([u({type:String})],st.prototype,"class",2),c([w()],st.prototype,"_response",2),c([u({type:String,attribute:"response-identifier"})],st.prototype,"responseIdentifier",2),c([w()],st.prototype,"correctOptions",2);customElements.define("qti-match-interaction",st);var ds=class extends
|
|
4912
|
+
`}};c([u({type:String})],st.prototype,"class",2),c([w()],st.prototype,"_response",2),c([u({type:String,attribute:"response-identifier"})],st.prototype,"responseIdentifier",2),c([w()],st.prototype,"correctOptions",2);customElements.define("qti-match-interaction",st);var ds=class extends I{#e=null;reset(){this.#e=null}validate(){return!0}get response(){return this.#e?this.#e.toString():null}set response(r){if(r)if(!isNaN(parseInt(r?.toString())))this.#e=parseInt(r.toString());else throw new Error(`Value must be a number ${r}`)}static get properties(){return{...I.properties,step:{type:Number,attribute:"step",default:10}}}static{this.styles=[y``]}render(){return h` <slot name="prompt"></slot>
|
|
4908
4913
|
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let r=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");r&&r.addEventListener("ended",()=>{this.#e++,this.saveResponse(this.value)})}};customElements.define("qti-media-interaction",ds);var Qa=y`
|
|
4909
4914
|
[part='drags'] {
|
|
4910
4915
|
display: flex;
|
|
@@ -4963,26 +4968,26 @@ CES.load();
|
|
|
4963
4968
|
:host(.qti-choices-right) [part='container'] {
|
|
4964
4969
|
flex-direction: row-reverse;
|
|
4965
4970
|
}
|
|
4966
|
-
`;var ot=class extends Ae(
|
|
4971
|
+
`;var ot=class extends Ae(I,"qti-simple-choice","drop-list","slot[part='drags']"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}static{this.styles=Qa}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
|
|
4967
4972
|
<div part="container">
|
|
4968
4973
|
<slot part="drags"> </slot>
|
|
4969
4974
|
<div part="drops">
|
|
4970
4975
|
${[...Array(this.nrChoices)].map((t,i)=>h`<drop-list role="region" part="drop-list" identifier="droplist${i}"></drop-list>`)}
|
|
4971
4976
|
</div>
|
|
4972
|
-
</div>`}toggleCorrectResponse(e){let t=this.responseVariable;if(this.shadowRoot.querySelectorAll(".correct-option").forEach(i=>i.remove()),e&&t?.correctResponse){let s=(Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse]).map(l=>l.split(" ")[0]),
|
|
4977
|
+
</div>`}toggleCorrectResponse(e){let t=this.responseVariable;if(this.shadowRoot.querySelectorAll(".correct-option").forEach(i=>i.remove()),e&&t?.correctResponse){let s=(Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse]).map(l=>l.split(" ")[0]),o=new Set;this.querySelectorAll("qti-simple-choice").forEach((l,d)=>{let p=l.getAttribute("identifier");if(!p||!s.includes(p)||o.has(p))return;o.add(p);let m=l.textContent?.trim();if(!m)return;let f=this.shadowRoot.querySelector(`drop-list[identifier="droplist${d}"]`);if(!f)return;let g=document.createElement("span");g.classList.add("correct-option"),g.textContent=m,g.style.border="1px solid var(--qti-correct)",g.style.borderRadius="4px",g.style.padding="2px 4px",g.style.display="inline-block",g.style.marginTop="4px",f.insertAdjacentElement("afterend",g)})}}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let s=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(s).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};c([w()],ot.prototype,"nrChoices",2),c([w()],ot.prototype,"correctResponses",2),c([w()],ot.prototype,"showCorrectResponses",2),c([u({type:String})],ot.prototype,"orientation",2);customElements.define("qti-order-interaction",ot);var Ya=y`
|
|
4973
4978
|
::slotted(qti-interaction-markup) {
|
|
4974
4979
|
display: none;
|
|
4975
4980
|
}
|
|
4976
|
-
`;var B=class extends
|
|
4981
|
+
`;var B=class extends I{constructor(){super(...arguments);this._iframeLoaded=!1;this._pendingMessages=[];this._iframeMessageOrigin=null;this._iframeObjectUrl=null;this.requirePathsJson="";this.requireShimJson="";this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";this.baseUrl="";this.useDefaultShims=!1;this.useDefaultPaths=!1;this._errorMessage=null;this.response=null;this.#t=null;this.#r=null;this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||e.source!==this.iframe.contentWindow)&&!(t.responseIdentifier&&t.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=e.origin;else if(e.origin!==this._iframeMessageOrigin)return;switch(t.method){case"iframeReady":this.#y(),this.#f(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:t.level,args:t.args},bubbles:!0}));break;case"interactionChanged":{let i=t?.params?.value,s=i&&typeof i=="object"?this.#c(i):null,o=t?.params?.state,a;if(o===void 0)a=void 0;else if(o===null)a=null;else if(typeof o=="string")a=o;else try{a=`__qti_json__::${JSON.stringify(o)}`}catch{a=null}if(s===null){let l=this.responseVariable?.cardinality==="single"?"":[];this.response=l,this.validate(),this.saveResponse(l,a);break}this.response=s,this.validate(),this.saveResponse(s,a);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}}};this.#p=null}#e;static{this.styles=[Ya,y`
|
|
4977
4982
|
:host {
|
|
4978
4983
|
display: block;
|
|
4979
4984
|
width: 100%;
|
|
4980
4985
|
min-height: 50px;
|
|
4981
4986
|
}
|
|
4982
|
-
`]}#t;#r;#i(){if(this.#t===null&&this.requirePathsJson)try{let e=JSON.parse(this.requirePathsJson);Array.isArray(e)?(this.#t={},e.forEach(t=>{t.name&&t.value&&(this.#t[t.name]=t.value)})):this.#t=e}catch(e){console.error("Error parsing require paths JSON:",e),this._errorMessage=`Error parsing require paths JSON: ${e.message}`,this.#t={}}return this.#t||{}}#o(){if(this.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(e){console.error("Error parsing require shim JSON:",e),this._errorMessage=`Error parsing require shim JSON: ${e.message}`,this.#r={}}return this.#r||{}}#s(){return{"taoQtiItem/portableLib/OAT/util/event":"/assets/pci-scripts/portableLib/OAT/util/event","taoQtiItem/portableLib/OAT/util/html":"/assets/pci-scripts/portableLib/OAT/util/html","taoQtiItem/portableLib/OAT/util/EventMgr":"/assets/pci-scripts/portableLib/OAT/util/EventMgr","taoQtiItem/portableLib/OAT/util/math":"/assets/pci-scripts/portableLib/OAT/util/math","taoQtiItem/portableLib/OAT/util/xml":"/assets/pci-scripts/portableLib/OAT/util/xml","taoQtiItem/portableLib/OAT/util/tooltip":"/assets/pci-scripts/portableLib/OAT/util/tooltip","taoQtiItem/portableLib/OAT/util/tpl":"/assets/pci-scripts/portableLib/OAT/util/tpl","taoQtiItem/portableLib/OAT/util/asset":"/assets/pci-scripts/portableLib/OAT/util/asset","taoQtiItem/portableLib/OAT/waitForMedia":"/assets/pci-scripts/portableLib/OAT/waitForMedia","taoQtiItem/portableLib/OAT/mediaPlayer":"/assets/pci-scripts/portableLib/OAT/mediaPlayer","taoQtiItem/portableLib/OAT/scale.raphael":"/assets/pci-scripts/portableLib/OAT/scale.raphael","taoQtiItem/portableLib/OAT/interact-rotate":"/assets/pci-scripts/portableLib/OAT/interact-rotate","taoQtiItem/portableLib/OAT/promise":"/assets/pci-scripts/portableLib/OAT/promise","taoQtiItem/portableLib/OAT/sts/common":"/assets/pci-scripts/portableLib/OAT/sts/common","taoQtiItem/portableLib/OAT/sts/transform-helper":"/assets/pci-scripts/portableLib/OAT/sts/transform-helper","taoQtiItem/portableLib/OAT/sts/stsEventManager":"/assets/pci-scripts/portableLib/OAT/sts/stsEventManager","taoQtiItem/portableLib/async":"/assets/pci-scripts/portableLib/async","taoQtiItem/portableLib/interact":"/assets/pci-scripts/portableLib/interact","taoQtiItem/portableLib/es6-promise":"/assets/pci-scripts/portableLib/es6-promise","taoQtiItem/portableLib/jquery_2_1_1":"/assets/pci-scripts/portableLib/jquery_2_1_1","taoQtiItem/portableLib/jquery.qtip":"/assets/pci-scripts/portableLib/jquery.qtip","taoQtiItem/portableLib/lodash":"/assets/pci-scripts/portableLib/lodash","taoQtiItem/portableLib/handlebars":"/assets/pci-scripts/portableLib/handlebars","taoQtiItem/portableLib/raphael":"/assets/pci-scripts/portableLib/raphael","taoQtiItem/pci-scripts/portableLib/jquery.qtip":"/assets/pci-scripts/portableLib/jquery.qtip","taoQtiItem/pci-scripts/portableLib/lodash":"/assets/pci-scripts/portableLib/lodash","taoQtiItem/pci-scripts/portableLib/raphael":"/assets/pci-scripts/portableLib/raphael","IMSGlobal/jquery_2_1_1":"/assets/pci-scripts/IMSGlobal/jquery_2_1_1","OAT/util/event":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/event","OAT/util/html":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/html","OAT/util/EventMgr":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/EventMgr","OAT/util/math":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/math","OAT/util/xml":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/xml","OAT/util/tooltip":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/tooltip","OAT/lodash":"/assets/pci-scripts/legacyPortableSharedLib/lodash",mathJax:"/assets/pci-scripts/mathjax/mathJax",css:"/assets/pci-scripts/css/css"}}#n(){return{mathJax:{exports:"MathJax",init:function(){let e=window;if(e.MathJax)return e.MathJax.Hub.Config({showMathMenu:!1,showMathMenuMSIE:!1,menuSettings:{inTabOrder:!1}}),e.MathJax.Hub.Startup.MenuZoom=function(){},e.MathJax.Hub.Startup.onload(),e.MathJax}}}}#a(){let e=this.#s(),t=this.#i();return this.useDefaultPaths?{...e,...t}:t}#d(){let e=this.#o(),t=this.#n();return this.useDefaultShims?{...t,...e}:e}#c(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let s in i)if(i.hasOwnProperty(s)){let n=i[s];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(e){let t=e.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===t)}coerceBaseValue(e,t){if(e==null)return e;switch(t){case"integer":{if(typeof e=="number")return e;let i=parseInt(String(e),10);return Number.isNaN(i)?e:i}case"float":case"duration":{if(typeof e=="number")return e;let i=parseFloat(String(e));return Number.isNaN(i)?e:i}case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let i=e.toLowerCase();if(i==="true")return!0;if(i==="false")return!1}return e}default:return String(e)}}normalizeListValue(e){return e==null?[]:Array.isArray(e)?e:[e]}variableToQtiVariableJSON(e,t,i){if(t==="record"||i==="record")return this.recordToQtiVariableJSON(e);if(t!=="single"){let s=this.normalizeListValue(e).map(n=>this.coerceBaseValue(n,i));return{list:{[i]:s}}}return{base:{[i]:this.coerceBaseValue(e,i)}}}recordToQtiVariableJSON(e){if(!e||typeof e!="object")return{record:[]};let t=[];for(let[i,s]of Object.entries(e))t.push(this.recordEntryFromValue(i,s));return{record:t}}recordEntryFromValue(e,t){if(Array.isArray(t)){let i=t.filter(s=>s!=null);if(i.length&&i.every(s=>typeof s=="boolean"))return{name:e,list:{boolean:i}};if(i.length&&i.every(s=>typeof s=="number")){let s=i,n=s.every(a=>Number.isInteger(a));return{name:e,list:{[n?"integer":"float"]:s}}}return{name:e,list:{string:t.map(s=>s==null?"":String(s))}}}if(typeof t=="boolean")return{name:e,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:e,base:{integer:t}}:{name:e,base:{float:t}};if(t==null)return{name:e,base:{string:""}};if(typeof t=="object")try{return{name:e,base:{string:JSON.stringify(t)}}}catch{return{name:e,base:{string:String(t)}}}return{name:e,base:{string:String(t)}}}getQtiContextDefaultsFromItem(){let e=this.closest("qti-assessment-item");if(!e)return{};let t={};return e.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(s=>{let n=s.querySelector("qti-default-value");if(!n)return;n.querySelectorAll("qti-value[field-identifier]").forEach(l=>{let d=l.getAttribute("field-identifier");if(!d)return;let p=l.getAttribute("base-type")||"string",m=l.textContent?.trim()||"";t[d]=this.coerceBaseValue(m,p)})}),t}getQtiContextRecord(){let e=this.getQtiContextDefaultsFromItem(),t=this.qtiContext?.QTI_CONTEXT||{},i={...e,...t};if(!Object.keys(i).length)return null;let s={candidateIdentifier:i.candidateIdentifier??"",testIdentifier:i.testIdentifier??"",environmentIdentifier:i.environmentIdentifier??"",...i};return this.recordToQtiVariableJSON(s)}getTemplateVariables(){let e={},t=this.getDirectChildrenByTag("qti-template-variable");return t.length&&t.forEach(i=>{let s=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!s)return;let n=this.context?.variables?.find(d=>d.identifier===s);if(!n)return;let a=n.cardinality||"single",l=n.baseType||"string";e[s]=this.variableToQtiVariableJSON(n.value,a,l)}),e}getContextVariables(){let e={},t=this.getDirectChildrenByTag("qti-context-variable");return t.length&&t.forEach(i=>{let s=i.getAttribute("identifier")||"";if(!s)return;if(s==="QTI_CONTEXT"){let d=this.getQtiContextRecord();d&&(e[s]=d);return}let n=this.context?.variables?.find(d=>d.identifier===s);if(!n)return;let a=n.cardinality||"single",l=n.baseType||"string";e[s]=this.variableToQtiVariableJSON(n.value,a,l)}),e}#l(e){let t={...e};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let s=i.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);t[s]=e[i]}return t}responseVariablesToQtiVariableJSON(e,t,i){if(t!=="single"){let s={list:{}};return s.list[i]=e,s}else{let s={base:{}};return s.base[i]=e,s}}validate(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(e=>e!==""&&e!==null&&e!==void 0):this.response!==""}set value(e){e===null?this.#e=[]:this.#e=Array.isArray(e)?e:e.split(",")}get value(){return this.#e===null||this.#e===void 0?null:Array.isArray(this.#e)?this.#e.join(","):String(this.#e)}set boundTo(e){if(!e||!e[this.responseIdentifier])return;let t=this.#c(e[this.responseIdentifier]);this.#e=t,this.saveResponse(t)}get boundTo(){let e={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.cardinality||"single",s=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.baseType||"string",n=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.value||null,a=this.responseVariablesToQtiVariableJSON(n,i,s);e[this.responseIdentifier]=a}return e}#u(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#m(e){let t={};for(let[i,s]of Object.entries(e))typeof s=="string"?t[i]=this.#u(s):t[i]=s;return t}resolveStylesheetHref(e){if(!e||e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("//"))return`${window.location.protocol}${e}`;let t=this.baseUrl&&this.baseUrl.length>0?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:yr(`${window.location.origin}${this.baseUrl}`):window.location.origin,i=t.endsWith("/")?t:`${t}/`;try{return new URL(e,i).toString()}catch{return e}}getStylesheetConfigs(){let e=this.getDirectChildrenByTag("qti-stylesheet");return e.length?e.map((t,i)=>{let s=t.getAttribute("href");if(s){let a=this.resolveStylesheetHref(s);return{href:a,scoped:!1,key:a}}let n=t.textContent?.trim();return n?{content:n,scoped:!1,key:`inline-${i}`}:null}).filter(Boolean):[]}getSharedStylesheetContent(){let e="",t=new Set,i=Array.from(document.styleSheets||[]);for(let n of i)try{if(n.href&&!n.href.startsWith(window.location.origin))continue;let a=n.ownerNode;if(a&&a.tagName==="STYLE"){let d=a.textContent||"";d&&!t.has(d)&&(e+=`${d}
|
|
4983
|
-
`,t.add(d));continue}let l=
|
|
4987
|
+
`]}#t;#r;#i(){if(this.#t===null&&this.requirePathsJson)try{let e=JSON.parse(this.requirePathsJson);Array.isArray(e)?(this.#t={},e.forEach(t=>{t.name&&t.value&&(this.#t[t.name]=t.value)})):this.#t=e}catch(e){console.error("Error parsing require paths JSON:",e),this._errorMessage=`Error parsing require paths JSON: ${e.message}`,this.#t={}}return this.#t||{}}#o(){if(this.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(e){console.error("Error parsing require shim JSON:",e),this._errorMessage=`Error parsing require shim JSON: ${e.message}`,this.#r={}}return this.#r||{}}#s(){return{"taoQtiItem/portableLib/OAT/util/event":"/assets/pci-scripts/portableLib/OAT/util/event","taoQtiItem/portableLib/OAT/util/html":"/assets/pci-scripts/portableLib/OAT/util/html","taoQtiItem/portableLib/OAT/util/EventMgr":"/assets/pci-scripts/portableLib/OAT/util/EventMgr","taoQtiItem/portableLib/OAT/util/math":"/assets/pci-scripts/portableLib/OAT/util/math","taoQtiItem/portableLib/OAT/util/xml":"/assets/pci-scripts/portableLib/OAT/util/xml","taoQtiItem/portableLib/OAT/util/tooltip":"/assets/pci-scripts/portableLib/OAT/util/tooltip","taoQtiItem/portableLib/OAT/util/tpl":"/assets/pci-scripts/portableLib/OAT/util/tpl","taoQtiItem/portableLib/OAT/util/asset":"/assets/pci-scripts/portableLib/OAT/util/asset","taoQtiItem/portableLib/OAT/waitForMedia":"/assets/pci-scripts/portableLib/OAT/waitForMedia","taoQtiItem/portableLib/OAT/mediaPlayer":"/assets/pci-scripts/portableLib/OAT/mediaPlayer","taoQtiItem/portableLib/OAT/scale.raphael":"/assets/pci-scripts/portableLib/OAT/scale.raphael","taoQtiItem/portableLib/OAT/interact-rotate":"/assets/pci-scripts/portableLib/OAT/interact-rotate","taoQtiItem/portableLib/OAT/promise":"/assets/pci-scripts/portableLib/OAT/promise","taoQtiItem/portableLib/OAT/sts/common":"/assets/pci-scripts/portableLib/OAT/sts/common","taoQtiItem/portableLib/OAT/sts/transform-helper":"/assets/pci-scripts/portableLib/OAT/sts/transform-helper","taoQtiItem/portableLib/OAT/sts/stsEventManager":"/assets/pci-scripts/portableLib/OAT/sts/stsEventManager","taoQtiItem/portableLib/async":"/assets/pci-scripts/portableLib/async","taoQtiItem/portableLib/interact":"/assets/pci-scripts/portableLib/interact","taoQtiItem/portableLib/es6-promise":"/assets/pci-scripts/portableLib/es6-promise","taoQtiItem/portableLib/jquery_2_1_1":"/assets/pci-scripts/portableLib/jquery_2_1_1","taoQtiItem/portableLib/jquery.qtip":"/assets/pci-scripts/portableLib/jquery.qtip","taoQtiItem/portableLib/lodash":"/assets/pci-scripts/portableLib/lodash","taoQtiItem/portableLib/handlebars":"/assets/pci-scripts/portableLib/handlebars","taoQtiItem/portableLib/raphael":"/assets/pci-scripts/portableLib/raphael","taoQtiItem/pci-scripts/portableLib/jquery.qtip":"/assets/pci-scripts/portableLib/jquery.qtip","taoQtiItem/pci-scripts/portableLib/lodash":"/assets/pci-scripts/portableLib/lodash","taoQtiItem/pci-scripts/portableLib/raphael":"/assets/pci-scripts/portableLib/raphael","IMSGlobal/jquery_2_1_1":"/assets/pci-scripts/IMSGlobal/jquery_2_1_1","OAT/util/event":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/event","OAT/util/html":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/html","OAT/util/EventMgr":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/EventMgr","OAT/util/math":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/math","OAT/util/xml":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/xml","OAT/util/tooltip":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/tooltip","OAT/lodash":"/assets/pci-scripts/legacyPortableSharedLib/lodash",mathJax:"/assets/pci-scripts/mathjax/mathJax",css:"/assets/pci-scripts/css/css"}}#n(){return{mathJax:{exports:"MathJax",init:function(){let e=window;if(e.MathJax)return e.MathJax.Hub.Config({showMathMenu:!1,showMathMenuMSIE:!1,menuSettings:{inTabOrder:!1}}),e.MathJax.Hub.Startup.MenuZoom=function(){},e.MathJax.Hub.Startup.onload(),e.MathJax}}}}#a(){let e=this.#s(),t=this.#i();return this.useDefaultPaths?{...e,...t}:t}#d(){let e=this.#o(),t=this.#n();return this.useDefaultShims?{...t,...e}:e}#c(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let s in i)if(i.hasOwnProperty(s)){let o=i[s];if(Array.isArray(o))return o.map(String);if(o!=null)return String(o)}}}return null}getDirectChildrenByTag(e){let t=e.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===t)}coerceBaseValue(e,t){if(e==null)return e;switch(t){case"integer":{if(typeof e=="number")return e;let i=parseInt(String(e),10);return Number.isNaN(i)?e:i}case"float":case"duration":{if(typeof e=="number")return e;let i=parseFloat(String(e));return Number.isNaN(i)?e:i}case"boolean":{if(typeof e=="boolean")return e;if(typeof e=="string"){let i=e.toLowerCase();if(i==="true")return!0;if(i==="false")return!1}return e}default:return String(e)}}normalizeListValue(e){return e==null?[]:Array.isArray(e)?e:[e]}variableToQtiVariableJSON(e,t,i){if(t==="record"||i==="record")return this.recordToQtiVariableJSON(e);if(t!=="single"){let s=this.normalizeListValue(e).map(o=>this.coerceBaseValue(o,i));return{list:{[i]:s}}}return{base:{[i]:this.coerceBaseValue(e,i)}}}recordToQtiVariableJSON(e){if(!e||typeof e!="object")return{record:[]};let t=[];for(let[i,s]of Object.entries(e))t.push(this.recordEntryFromValue(i,s));return{record:t}}recordEntryFromValue(e,t){if(Array.isArray(t)){let i=t.filter(s=>s!=null);if(i.length&&i.every(s=>typeof s=="boolean"))return{name:e,list:{boolean:i}};if(i.length&&i.every(s=>typeof s=="number")){let s=i,o=s.every(a=>Number.isInteger(a));return{name:e,list:{[o?"integer":"float"]:s}}}return{name:e,list:{string:t.map(s=>s==null?"":String(s))}}}if(typeof t=="boolean")return{name:e,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:e,base:{integer:t}}:{name:e,base:{float:t}};if(t==null)return{name:e,base:{string:""}};if(typeof t=="object")try{return{name:e,base:{string:JSON.stringify(t)}}}catch{return{name:e,base:{string:String(t)}}}return{name:e,base:{string:String(t)}}}getQtiContextDefaultsFromItem(){let e=this.closest("qti-assessment-item");if(!e)return{};let t={};return e.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(s=>{let o=s.querySelector("qti-default-value");if(!o)return;o.querySelectorAll("qti-value[field-identifier]").forEach(l=>{let d=l.getAttribute("field-identifier");if(!d)return;let p=l.getAttribute("base-type")||"string",m=l.textContent?.trim()||"";t[d]=this.coerceBaseValue(m,p)})}),t}getQtiContextRecord(){let e=this.getQtiContextDefaultsFromItem(),t=this.qtiContext?.QTI_CONTEXT||{},i={...e,...t};if(!Object.keys(i).length)return null;let s={candidateIdentifier:i.candidateIdentifier??"",testIdentifier:i.testIdentifier??"",environmentIdentifier:i.environmentIdentifier??"",...i};return this.recordToQtiVariableJSON(s)}getTemplateVariables(){let e={},t=this.getDirectChildrenByTag("qti-template-variable");return t.length&&t.forEach(i=>{let s=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!s)return;let o=this.context?.variables?.find(d=>d.identifier===s);if(!o)return;let a=o.cardinality||"single",l=o.baseType||"string";e[s]=this.variableToQtiVariableJSON(o.value,a,l)}),e}getContextVariables(){let e={},t=this.getDirectChildrenByTag("qti-context-variable");return t.length&&t.forEach(i=>{let s=i.getAttribute("identifier")||"";if(!s)return;if(s==="QTI_CONTEXT"){let d=this.getQtiContextRecord();d&&(e[s]=d);return}let o=this.context?.variables?.find(d=>d.identifier===s);if(!o)return;let a=o.cardinality||"single",l=o.baseType||"string";e[s]=this.variableToQtiVariableJSON(o.value,a,l)}),e}#l(e){let t={...e};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let s=i.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);t[s]=e[i]}return t}responseVariablesToQtiVariableJSON(e,t,i){if(t!=="single"){let s={list:{}};return s.list[i]=e,s}else{let s={base:{}};return s.base[i]=e,s}}validate(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(e=>e!==""&&e!==null&&e!==void 0):this.response!==""}set value(e){e===null?this.#e=[]:this.#e=Array.isArray(e)?e:e.split(",")}get value(){return this.#e===null||this.#e===void 0?null:Array.isArray(this.#e)?this.#e.join(","):String(this.#e)}set boundTo(e){if(!e||!e[this.responseIdentifier])return;let t=this.#c(e[this.responseIdentifier]);this.#e=t,this.saveResponse(t)}get boundTo(){let e={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.cardinality||"single",s=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.baseType||"string",o=this.context?.variables?.find(l=>l.identifier===this.responseIdentifier)?.value||null,a=this.responseVariablesToQtiVariableJSON(o,i,s);e[this.responseIdentifier]=a}return e}#u(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#m(e){let t={};for(let[i,s]of Object.entries(e))typeof s=="string"?t[i]=this.#u(s):t[i]=s;return t}resolveStylesheetHref(e){if(!e||e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("//"))return`${window.location.protocol}${e}`;let t=this.baseUrl&&this.baseUrl.length>0?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:yr(`${window.location.origin}${this.baseUrl}`):window.location.origin,i=t.endsWith("/")?t:`${t}/`;try{return new URL(e,i).toString()}catch{return e}}getStylesheetConfigs(){let e=this.getDirectChildrenByTag("qti-stylesheet");return e.length?e.map((t,i)=>{let s=t.getAttribute("href");if(s){let a=this.resolveStylesheetHref(s);return{href:a,scoped:!1,key:a}}let o=t.textContent?.trim();return o?{content:o,scoped:!1,key:`inline-${i}`}:null}).filter(Boolean):[]}getSharedStylesheetContent(){let e="",t=new Set,i=Array.from(document.styleSheets||[]);for(let o of i)try{if(o.href&&!o.href.startsWith(window.location.origin))continue;let a=o.ownerNode;if(a&&a.tagName==="STYLE"){let d=a.textContent||"";d&&!t.has(d)&&(e+=`${d}
|
|
4988
|
+
`,t.add(d));continue}let l=o.cssRules?Array.from(o.cssRules):[];if(l.length){let d=l.map(p=>p.cssText).join(`
|
|
4984
4989
|
`);d&&!t.has(d)&&(e+=`${d}
|
|
4985
|
-
`,t.add(d))}}catch{}let s=e.trim();return s.length?s:null}getSharedStylesheetConfig(){let e=this.getSharedStylesheetContent();return e?{content:e,scoped:!1,key:"__qti_shared_css__"}:null}#h(){let e=this.getStylesheetConfigs(),t=this.getSharedStylesheetConfig(),i=t?[t,...e]:e;i.length>0&&this.sendMessageToIframe("setStylesheets",i)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage),this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null)}sendMessageToIframe(e,t){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:e,params:t});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:e,params:t},"*")}#f(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}createIframe(){this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.#b(),this.#h(),this.#g()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent();try{let i=new Blob([t],{type:"text/html"});this._iframeObjectUrl=URL.createObjectURL(i),this.iframe.src=this._iframeObjectUrl}catch{let i=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${i}`}this.appendChild(this.iframe)}#g(){let e=this.#l(this.#m({...this.dataset})),t=this.context?.state?.[this.responseIdentifier],i=typeof t=="string"&&t.length>0?t:null,s={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:yr(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:e,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#v(),boundTo:i?null:this.boundTo,state:i};this.sendMessageToIframe("initialize",s)}#v(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let i=t.querySelectorAll("qti-interaction-module");for(let s of i)e.push({id:s.getAttribute("id"),primaryPath:s.getAttribute("primary-path"),fallbackPath:s.getAttribute("fallback-path")})}return e}#b(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=this.querySelector("properties");t&&this.sendMessageToIframe("setProperties",t.innerHTML)}#y(){}connectedCallback(){super.connectedCallback(),this.response=this.responseVariable?.value??null,window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let e=window.getComputedStyle(document.body),t=JSON.stringify(this.#a()),i=JSON.stringify(this.#d()),s=`
|
|
4990
|
+
`,t.add(d))}}catch{}let s=e.trim();return s.length?s:null}getSharedStylesheetConfig(){let e=this.getSharedStylesheetContent();return e?{content:e,scoped:!1,key:"__qti_shared_css__"}:null}#h(){let e=this.getStylesheetConfigs(),t=this.getSharedStylesheetConfig(),i=t?[t,...e]:e;i.length>0&&this.sendMessageToIframe("setStylesheets",i)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage),this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null)}sendMessageToIframe(e,t){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:e,params:t});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:e,params:t},"*")}#f(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}createIframe(){this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this._iframeObjectUrl&&(URL.revokeObjectURL(this._iframeObjectUrl),this._iframeObjectUrl=null),this.#b(),this.#h(),this.#g()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent();try{let i=new Blob([t],{type:"text/html"});this._iframeObjectUrl=URL.createObjectURL(i),this.iframe.src=this._iframeObjectUrl}catch{let i=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${i}`}this.appendChild(this.iframe)}#g(){let e=this.#l(this.#m({...this.dataset})),t=this.context?.state?.[this.responseIdentifier],i=typeof t=="string"&&t.length>0?t:null,s={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:yr(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:e,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#v(),boundTo:i?null:this.boundTo,state:i};this.sendMessageToIframe("initialize",s)}#v(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let i=t.querySelectorAll("qti-interaction-module");for(let s of i)e.push({id:s.getAttribute("id"),primaryPath:s.getAttribute("primary-path"),fallbackPath:s.getAttribute("fallback-path")})}return e}#b(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=this.querySelector("properties");t&&this.sendMessageToIframe("setProperties",t.innerHTML)}#y(){}connectedCallback(){super.connectedCallback(),this.response=this.responseVariable?.value??null,window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let e=window.getComputedStyle(document.body),t=JSON.stringify(this.#a()),i=JSON.stringify(this.#d()),s=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",o=this.dataset.forwardConsole==="true",a=`
|
|
4986
4991
|
font-family: ${e.getPropertyValue("font-family")};
|
|
4987
4992
|
font-size: ${e.getPropertyValue("font-size")};
|
|
4988
4993
|
line-height: ${e.getPropertyValue("line-height")};
|
|
@@ -5002,7 +5007,7 @@ CES.load();
|
|
|
5002
5007
|
height: auto;
|
|
5003
5008
|
overflow: hidden;
|
|
5004
5009
|
/* Add the extracted font styles here */
|
|
5005
|
-
${
|
|
5010
|
+
${a}
|
|
5006
5011
|
}
|
|
5007
5012
|
.qti-customInteraction {
|
|
5008
5013
|
width: 100%;
|
|
@@ -5019,6 +5024,46 @@ CES.load();
|
|
|
5019
5024
|
</style>
|
|
5020
5025
|
<script src="${this.requireJsUrl}"></script>
|
|
5021
5026
|
<script>
|
|
5027
|
+
const forwardConsole = ${o?"true":"false"};
|
|
5028
|
+
if (forwardConsole) {
|
|
5029
|
+
const originalLog = console.log.bind(console);
|
|
5030
|
+
const originalError = console.error.bind(console);
|
|
5031
|
+
const stringifyArgs = args =>
|
|
5032
|
+
args.map(arg => {
|
|
5033
|
+
if (typeof arg === 'string') return arg;
|
|
5034
|
+
try {
|
|
5035
|
+
return JSON.stringify(arg);
|
|
5036
|
+
} catch (e) {
|
|
5037
|
+
return String(arg);
|
|
5038
|
+
}
|
|
5039
|
+
});
|
|
5040
|
+
console.log = (...args) => {
|
|
5041
|
+
originalLog(...args);
|
|
5042
|
+
window.parent.postMessage(
|
|
5043
|
+
{
|
|
5044
|
+
source: 'qti-pci-iframe',
|
|
5045
|
+
responseIdentifier: (window.PCIManager && window.PCIManager.responseIdentifier) || null,
|
|
5046
|
+
method: 'console',
|
|
5047
|
+
level: 'log',
|
|
5048
|
+
args: stringifyArgs(args)
|
|
5049
|
+
},
|
|
5050
|
+
'*'
|
|
5051
|
+
);
|
|
5052
|
+
};
|
|
5053
|
+
console.error = (...args) => {
|
|
5054
|
+
originalError(...args);
|
|
5055
|
+
window.parent.postMessage(
|
|
5056
|
+
{
|
|
5057
|
+
source: 'qti-pci-iframe',
|
|
5058
|
+
responseIdentifier: (window.PCIManager && window.PCIManager.responseIdentifier) || null,
|
|
5059
|
+
method: 'console',
|
|
5060
|
+
level: 'error',
|
|
5061
|
+
args: stringifyArgs(args)
|
|
5062
|
+
},
|
|
5063
|
+
'*'
|
|
5064
|
+
);
|
|
5065
|
+
};
|
|
5066
|
+
}
|
|
5022
5067
|
// Define standard paths and shims
|
|
5023
5068
|
window.requirePaths = ${t};
|
|
5024
5069
|
|
|
@@ -5029,7 +5074,7 @@ CES.load();
|
|
|
5029
5074
|
catchError: true,
|
|
5030
5075
|
waitSeconds: 30,
|
|
5031
5076
|
paths: window.requirePaths,
|
|
5032
|
-
baseUrl: '${
|
|
5077
|
+
baseUrl: '${s}',
|
|
5033
5078
|
shim: window.requireShim,
|
|
5034
5079
|
onNodeCreated: function(node, config, moduleName, url) {
|
|
5035
5080
|
// Add error handler to script node
|
|
@@ -5579,7 +5624,18 @@ CES.load();
|
|
|
5579
5624
|
const x = data.params && data.params.x;
|
|
5580
5625
|
const y = data.params && data.params.y;
|
|
5581
5626
|
const el = typeof x === 'number' && typeof y === 'number' ? document.elementFromPoint(x, y) : null;
|
|
5582
|
-
|
|
5627
|
+
const target = (el && el.closest && el.closest('.hitbox')) || document.querySelector('.hitbox') || el;
|
|
5628
|
+
if (target) {
|
|
5629
|
+
const evt = new MouseEvent('click', {
|
|
5630
|
+
bubbles: true,
|
|
5631
|
+
clientX: x,
|
|
5632
|
+
clientY: y,
|
|
5633
|
+
screenX: x,
|
|
5634
|
+
screenY: y,
|
|
5635
|
+
view: window
|
|
5636
|
+
});
|
|
5637
|
+
target.dispatchEvent(evt);
|
|
5638
|
+
}
|
|
5583
5639
|
window.parent.postMessage(
|
|
5584
5640
|
{
|
|
5585
5641
|
source: 'qti-pci-iframe',
|
|
@@ -5592,6 +5648,31 @@ CES.load();
|
|
|
5592
5648
|
break;
|
|
5593
5649
|
}
|
|
5594
5650
|
|
|
5651
|
+
case 'getBoundingRect': {
|
|
5652
|
+
const messageId = data.params && data.params.messageId;
|
|
5653
|
+
const selector = data.params && data.params.selector;
|
|
5654
|
+
const el = selector ? deepQuerySelector(document, selector) : null;
|
|
5655
|
+
const rect = el && typeof el.getBoundingClientRect === 'function' ? el.getBoundingClientRect() : null;
|
|
5656
|
+
window.parent.postMessage(
|
|
5657
|
+
{
|
|
5658
|
+
source: 'qti-pci-iframe',
|
|
5659
|
+
responseIdentifier: PCIManager.responseIdentifier,
|
|
5660
|
+
method: 'getBoundingRectResponse',
|
|
5661
|
+
messageId: messageId,
|
|
5662
|
+
rect: rect
|
|
5663
|
+
? {
|
|
5664
|
+
left: rect.left,
|
|
5665
|
+
top: rect.top,
|
|
5666
|
+
width: rect.width,
|
|
5667
|
+
height: rect.height
|
|
5668
|
+
}
|
|
5669
|
+
: null
|
|
5670
|
+
},
|
|
5671
|
+
'*'
|
|
5672
|
+
);
|
|
5673
|
+
break;
|
|
5674
|
+
}
|
|
5675
|
+
|
|
5595
5676
|
case 'clickOnSelector': {
|
|
5596
5677
|
const messageId = data.params && data.params.messageId;
|
|
5597
5678
|
const selector = data.params && data.params.selector;
|
|
@@ -5658,6 +5739,19 @@ CES.load();
|
|
|
5658
5739
|
);
|
|
5659
5740
|
break;
|
|
5660
5741
|
}
|
|
5742
|
+
|
|
5743
|
+
case 'console':
|
|
5744
|
+
window.parent.postMessage(
|
|
5745
|
+
{
|
|
5746
|
+
source: 'qti-pci-iframe',
|
|
5747
|
+
responseIdentifier: PCIManager.responseIdentifier,
|
|
5748
|
+
method: 'console',
|
|
5749
|
+
level: data.level,
|
|
5750
|
+
args: data.args
|
|
5751
|
+
},
|
|
5752
|
+
'*'
|
|
5753
|
+
);
|
|
5754
|
+
break;
|
|
5661
5755
|
}
|
|
5662
5756
|
});
|
|
5663
5757
|
|
|
@@ -5755,13 +5849,13 @@ CES.load();
|
|
|
5755
5849
|
<body>
|
|
5756
5850
|
<div id="pci-container"></div>
|
|
5757
5851
|
</body>
|
|
5758
|
-
</html>`}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`,s=this.parentElement?.querySelectorAll(`#${i}`);if(s&&s.forEach(f=>{f.remove()}),e)this.disable();else{this.enable();return}if(!e||!t?.correctResponse)return;let
|
|
5852
|
+
</html>`}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`,s=this.parentElement?.querySelectorAll(`#${i}`);if(s&&s.forEach(f=>{f.remove()}),e)this.disable();else{this.enable();return}if(!e||!t?.correctResponse)return;let o=document.createElement("div");o.id=i,o.className="pci-correct-response-container",o.style.position="relative",o.style.marginTop="20px",o.style.border="2px solid green",o.style.padding="16px",o.style.borderRadius="4px",o.style.backgroundColor="rgba(0, 128, 0, 0.05)";let a=document.createElement("div");a.textContent="Correct Response:",a.style.fontWeight="bold",a.style.marginBottom="10px",a.style.color="green",o.appendChild(a);let l=document.createElement("qti-portable-custom-interaction");Array.from(this.attributes).forEach(f=>{f.name!=="id"&&f.name!=="response-identifier"&&l.setAttribute(f.name,f.value)});let d=this.responseIdentifier;l.responseIdentifier=`${d}-correct`,Array.from(this.children).forEach(f=>{let g=f.cloneNode(!0);l.appendChild(g)});let p=t.correctResponse,m=l.connectedCallback;l.connectedCallback=function(){m.call(this);let f=()=>this._iframeLoaded?(setTimeout(()=>{let g=this.responseVariablesToQtiVariableJSON(p,t.cardinality,t.baseType);this.sendMessageToIframe("setBoundTo",{[d]:g}),this.sendMessageToIframe("setState",{state:"review"})},1e3),!0):!1;if(!f()){let g=setInterval(()=>{f()&&clearInterval(g)},100);setTimeout(()=>{clearInterval(g)},1e4)}},l.style.pointerEvents="none",o.appendChild(l),this.after(o)}disable(){if(this.#p={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let t=document.createElement("div");t.className="pci-interaction-overlay",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(200, 200, 200, 0.3)",t.style.zIndex="100",t.style.pointerEvents="all",t.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(t)}}enable(){let e=this.querySelector(".pci-interaction-overlay");e&&e.remove(),this.#p&&(this.#p.pointerEvents&&(this.style.pointerEvents=this.#p.pointerEvents),this.#p.position&&(this.style.position=this.#p.position),this.#p=null),this.sendMessageToIframe("setState",{state:"interacting"})}#p;render(){return h`
|
|
5759
5853
|
<slot></slot>
|
|
5760
5854
|
${this._errorMessage?h`<div style="color:red">
|
|
5761
5855
|
<h1>Error</h1>
|
|
5762
5856
|
${this._errorMessage}
|
|
5763
5857
|
</div>`:""}
|
|
5764
|
-
`}};c([u({type:String,attribute:"module"})],B.prototype,"module",2),c([u({type:String,attribute:"custom-interaction-type-identifier"})],B.prototype,"customInteractionTypeIdentifier",2),c([u({type:String,attribute:"data-require-paths"})],B.prototype,"requirePathsJson",2),c([u({type:String,attribute:"data-require-shim"})],B.prototype,"requireShimJson",2),c([u({type:String,attribute:"data-require-js-url"})],B.prototype,"requireJsUrl",2),c([u({type:String,attribute:"data-base-url"})],B.prototype,"baseUrl",2),c([u({type:Boolean,attribute:"data-use-default-shims"})],B.prototype,"useDefaultShims",2),c([u({type:Boolean,attribute:"data-use-default-paths"})],B.prototype,"useDefaultPaths",2),c([w()],B.prototype,"_errorMessage",2),c([k({context:D,subscribe:!0}),w()],B.prototype,"context",2),c([k({context:Lt,subscribe:!0}),w()],B.prototype,"qtiContext",2),c([w()],B.prototype,"response",2);var ps=class extends B{#e=!1;async getIFrameContent(){return new Promise(r=>{let e=`get-content-${Date.now()}`,t=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getContentResponse"&&s?.messageId===e&&(window.removeEventListener("message",t),r(s.content))};window.addEventListener("message",t),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",t),r("")},5e3)})}setTestContext(r){this.context=r,this.updateComplete.then(()=>{this.value=r?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#e=!0;try{return this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),new Promise(r=>{let e=()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()};this.addEventListener("qti-portable-custom-interaction-loaded",e),setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()},5e3)})}finally{this.#e=!1}}disconnectedCallback(){this.#e||super.disconnectedCallback()}async iFrameMouseClick(r,e){return new Promise(t=>{let i=`click-${Date.now()}`,s=
|
|
5858
|
+
`}};c([u({type:String,attribute:"module"})],B.prototype,"module",2),c([u({type:String,attribute:"custom-interaction-type-identifier"})],B.prototype,"customInteractionTypeIdentifier",2),c([u({type:String,attribute:"data-require-paths"})],B.prototype,"requirePathsJson",2),c([u({type:String,attribute:"data-require-shim"})],B.prototype,"requireShimJson",2),c([u({type:String,attribute:"data-require-js-url"})],B.prototype,"requireJsUrl",2),c([u({type:String,attribute:"data-base-url"})],B.prototype,"baseUrl",2),c([u({type:Boolean,attribute:"data-use-default-shims"})],B.prototype,"useDefaultShims",2),c([u({type:Boolean,attribute:"data-use-default-paths"})],B.prototype,"useDefaultPaths",2),c([w()],B.prototype,"_errorMessage",2),c([k({context:D,subscribe:!0}),w()],B.prototype,"context",2),c([k({context:Lt,subscribe:!0}),w()],B.prototype,"qtiContext",2),c([w()],B.prototype,"response",2);var ps=class extends B{#e=!1;async getIFrameContent(){return new Promise(r=>{let e=`get-content-${Date.now()}`,t=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getContentResponse"&&s?.messageId===e&&(window.removeEventListener("message",t),r(s.content))};window.addEventListener("message",t),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",t),r("")},5e3)})}setTestContext(r){this.context=r,this.updateComplete.then(()=>{this.value=r?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#e=!0;try{return this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),new Promise(r=>{let e=()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()};this.addEventListener("qti-portable-custom-interaction-loaded",e),setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",e),r()},5e3)})}finally{this.#e=!1}}disconnectedCallback(){this.#e||super.disconnectedCallback()}async iFrameMouseClick(r,e){return new Promise(t=>{let i=`click-${Date.now()}`,s=o=>{let{data:a}=o;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",s),t())};window.addEventListener("message",s),this.sendMessageToIframe("simulateClick",{x:r,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",s),t()},5e3)})}async iFrameClickOnElement(r){return new Promise(e=>{let t=`click-selector-${Date.now()}`,i=s=>{let{data:o}=s;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="clickSelectorResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(r){return new Promise(e=>{let t=`click-text-${Date.now()}`,i=s=>{let{data:o}=s;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="clickTextResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(r,e){return new Promise(t=>{let i=`set-value-${Date.now()}`,s=o=>{let{data:a}=o;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",s),t(a.success))};window.addEventListener("message",s),this.sendMessageToIframe("setValueElement",{selector:r,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",s),t(!1)},5e3)})}async iFrameGetBoundingClientRect(r){return new Promise(e=>{let t=`get-bounding-rect-${Date.now()}`,i=s=>{let{data:o}=s;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="getBoundingRectResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(r,e){return new Promise(t=>{let i=`set-value-text-${Date.now()}`,s=o=>{let{data:a}=o;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",s),t(a.success))};window.addEventListener("message",s),this.sendMessageToIframe("setValueElementByText",{text:r,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",s),t(!1)},5e3)})}async iFrameMousedownOnElement(r){return new Promise(e=>{let t=`mousedown-selector-${Date.now()}`,i=s=>{let{data:o}=s;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="mousedownSelectorResponse"&&o?.messageId===t&&(window.removeEventListener("message",i),e(o.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:r,messageId:t}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let r=super.generateIframeContent(),e=`
|
|
5765
5859
|
// Test helper functions for QtiPortableCustomInteractionTest
|
|
5766
5860
|
// Base iframe implementation already provides PCIManager.getContent
|
|
5767
5861
|
|
|
@@ -5970,7 +6064,7 @@ CES.load();
|
|
|
5970
6064
|
display: inline-block;
|
|
5971
6065
|
position: relative;
|
|
5972
6066
|
}
|
|
5973
|
-
`]}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(r){r.preventDefault();let e=r.clientX-this.startX,t=r.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=r.clientX,this.startY=r.clientY}firstUpdated(r){super.firstUpdated(r),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)}};customElements.define("qti-position-object-interaction",us);customElements.define("qti-position-object-stage",ms);var Ja="important",Jl=" !"+Ja,mo=re(class extends xe{constructor(
|
|
6067
|
+
`]}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(r){r.preventDefault();let e=r.clientX-this.startX,t=r.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=r.clientX,this.startY=r.clientY}firstUpdated(r){super.firstUpdated(r),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)}};customElements.define("qti-position-object-interaction",us);customElements.define("qti-position-object-stage",ms);var Ja="important",Jl=" !"+Ja,mo=re(class extends xe{constructor(n){if(super(n),n.type!==We.ATTRIBUTE||n.name!=="style"||n.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(n){return Object.keys(n).reduce(((r,e)=>{let t=n[e];return t==null?r:r+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`}),"")}update(n,[r]){let{style:e}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)r[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in r){let i=r[t];if(i!=null){this.ft.add(t);let s=typeof i=="string"&&i.endsWith(Jl);t.includes("-")||s?e.setProperty(t,s?i.slice(0,-11):i,s?Ja:""):e[t]=i}}return z}});var He=class extends I{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=null;this._correctAreas=[];this._responseCorrection=[];this.#e=null;this.#t=1;this.#r=1;this.#i=0;this.#o=0;this.#s=e=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#a();let t=this.#e.getBoundingClientRect(),i=(e.clientX-t.left)*this.#t,s=(e.clientY-t.top)*this.#r,o=`${i.toFixed()} ${s.toFixed()}`;this.maxChoices===1?this.response=[o]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],o]),this.saveResponse(this.response)};this.#n=()=>{this.#a()}}static{this.styles=[y`
|
|
5974
6068
|
:host {
|
|
5975
6069
|
display: block;
|
|
5976
6070
|
}
|
|
@@ -5985,12 +6079,12 @@ CES.load();
|
|
|
5985
6079
|
height: auto;
|
|
5986
6080
|
display: block;
|
|
5987
6081
|
}
|
|
5988
|
-
`]}#e;#t;#r;#i;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#n)}#n;get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(s=>X.isPointInArea(`${t.x} ${t.y}`,`${s.shape},${s.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,s=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let
|
|
6082
|
+
`]}#e;#t;#r;#i;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#n)}#n;get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(s=>X.isPointInArea(`${t.x} ${t.y}`,`${s.shape},${s.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,s=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let o=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];if(o.length===0||o.find(a=>a.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),s=o.map(a=>({shape:"circle",coords:a.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else s=i.areaMapEntries;this._correctAreas=s.map(o=>({coords:o.coords,shape:o.shape}))}updated(e){super.updated(e);let t=this.#e;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.#a(),this.shadowRoot.querySelectorAll("div").forEach(i=>{let s=i.dataset.coord,o=i.dataset.shape;s&&o&&rt(o,s.split(",").map(a=>+a),t,i)}))}render(){return h` <slot name="prompt"></slot>
|
|
5989
6083
|
<point-container>
|
|
5990
|
-
${er((this.response||[]).filter(e=>e),e=>e,(e,t)=>{let[i,s]=e.split(" ").map(Number),
|
|
6084
|
+
${er((this.response||[]).filter(e=>e),e=>e,(e,t)=>{let[i,s]=e.split(" ").map(Number),o=i/(this.#i||1)*100,a=s/(this.#o||1)*100,l=16,d=l/(this.#i||1)*100,p=l/(this.#o||1)*100,m="";return this._responseCorrection[t]===!0?m=" correct":this._responseCorrection[t]===!1&&(m=" incorrect"),h`
|
|
5991
6085
|
<button
|
|
5992
6086
|
part="point${m}"
|
|
5993
|
-
style=${mo({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",transform:"translate(-50%, -50%)",left:`${
|
|
6087
|
+
style=${mo({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",transform:"translate(-50%, -50%)",left:`${o}%`,top:`${a}%`,width:`min(${d}%, 1rem)`,height:`min(${p}%, 1rem)`,minWidth:`min(${d}%, 1rem)`,minHeight:`min(${p}%, 1rem)`,borderRadius:"50%",background:"red"})}
|
|
5994
6088
|
aria-label="Remove point at ${e}"
|
|
5995
6089
|
?disabled=${this.disabled}
|
|
5996
6090
|
@click=${f=>{f.stopPropagation(),this.response=(this.response||[]).filter((g,v)=>v!==t),this.saveResponse(this.response)}}
|
|
@@ -6083,7 +6177,7 @@ CES.load();
|
|
|
6083
6177
|
text-align: center;
|
|
6084
6178
|
color: #6b7280; /* text-gray-500 */
|
|
6085
6179
|
}
|
|
6086
|
-
`;var nt=class extends
|
|
6180
|
+
`;var nt=class extends I{constructor(){super(...arguments);this.#e=0;this.#t=null;this.min=0;this.max=100;this.step=1}static{this.styles=Ka}#e;#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.#r(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#e.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this.#r(t)}toggleCorrectResponse(e){let t=this.responseVariable;if(t?.correctResponse){if(e){this._correctResponse=t.correctResponse.toString();let i=parseFloat(t.correctResponse.toString());if(isNaN(i))this.#t=null;else{this.#t=i;let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}}else this.#t=null;this.requestUpdate()}}#r(e){let t=this.#e;if(this.#e=Math.min(this.max,Math.max(this.min,e)),this.#e===t)return;let i=(this.#e-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return h`
|
|
6087
6181
|
<slot name="prompt"></slot>
|
|
6088
6182
|
<div id="slider" part="slider">
|
|
6089
6183
|
<div id="bounds" part="bounds">
|
|
@@ -6105,7 +6199,7 @@ CES.load();
|
|
|
6105
6199
|
`:null}
|
|
6106
6200
|
</div>
|
|
6107
6201
|
</div>
|
|
6108
|
-
`}#i(e){this.#s(e.pageX);let t=s=>this.#n(s.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}#o(e){this.#s(e.touches[0].pageX);let t=s=>this.#n(s.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}#s(e){this.#n(e)}#n(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,s=Math.min(1,Math.max(0,i/t.width)),
|
|
6202
|
+
`}#i(e){this.#s(e.pageX);let t=s=>this.#n(s.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}#o(e){this.#s(e.touches[0].pageX);let t=s=>this.#n(s.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}#s(e){this.#n(e)}#n(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,s=Math.min(1,Math.max(0,i/t.width)),o=this.min+Math.round(s*(this.max-this.min)/this.step)*this.step;this.#r(o)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};c([Tt("#rail")],nt.prototype,"_rail",2),c([u({type:Number,attribute:"lower-bound"})],nt.prototype,"min",2),c([u({type:Number,attribute:"upper-bound"})],nt.prototype,"max",2),c([u({type:Number,attribute:"step"})],nt.prototype,"step",2);customElements.define("qti-slider-interaction",nt);var Za=()=>new fo,fo=class{},ho=new WeakMap,Sw=re(class extends Ge{render(n){return L}update(n,[r]){let e=r!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=r,this.ht=n.options?.host,this.rt(this.ct=n.element)),L}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){let r=this.ht??globalThis,e=ho.get(r);e===void 0&&(e=new WeakMap,ho.set(r,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?ho.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var el=y`
|
|
6109
6203
|
:host {
|
|
6110
6204
|
display: inline-block;
|
|
6111
6205
|
}
|
|
@@ -6213,7 +6307,7 @@ CES.load();
|
|
|
6213
6307
|
bottom: 0;
|
|
6214
6308
|
}
|
|
6215
6309
|
}
|
|
6216
|
-
`;var ge=class extends
|
|
6310
|
+
`;var ge=class extends I{constructor(){super(...arguments);this.inputRef=Za();this.response=null;this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=el}get value(){return this.response||null}set value(e){this.response=e||null}get correctness(){let e=this.responseVariable;if(!e)return null;if(e.value===null)return"incorrect";if(e.mapping){let t=e.mapping.mapEntries.reduce((i,s)=>Math.max(s.mappedValue,i),0);for(let i of e.mapping.mapEntries){let s=i.mapKey,o=e.value;if(i.caseSensitive||(s=s.toLowerCase(),o=o.toLowerCase()),s===o)return i.mappedValue===t?"correct":i.mappedValue<=(e.mapping.defaultValue||0)?"incorrect":"partially-correct"}}return e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!0}validate(){if(!this._input)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),this._input.setCustomValidity(""),this._input.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),this._input.setCustomValidity(this.dataPatternmaskMessage));else{let e=this._input.checkValidity();this._internals.setValidity(e?{}:{customError:!1})}return this.response!==""&&this._input.checkValidity()}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(e&&t?.correctResponse){let i=t.correctResponse.toString();this._correctResponse=i}else this._correctResponse=null}render(){return h`
|
|
6217
6311
|
<input
|
|
6218
6312
|
part="input"
|
|
6219
6313
|
name="${this.responseIdentifier}"
|
|
@@ -6232,7 +6326,7 @@ CES.load();
|
|
|
6232
6326
|
?readonly="${this.readonly}"
|
|
6233
6327
|
/>
|
|
6234
6328
|
${this._correctResponse?h`<div part="correct">${this._correctResponse}</div>`:L}
|
|
6235
|
-
`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.#e(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}#e(e){this.setAttribute("empty",e===""?"true":"false")}};c([u({type:Number,attribute:"expected-length"})],ge.prototype,"expectedLength",2),c([u({type:String,attribute:"pattern-mask"})],ge.prototype,"patternMask",2),c([u({type:String,attribute:"placeholder-text"})],ge.prototype,"placeholderText",2),c([u({type:String,attribute:"data-patternmask-message"})],ge.prototype,"dataPatternmaskMessage",2),c([w()],ge.prototype,"response",2),c([Tt("input")],ge.prototype,"_input",2),c([
|
|
6329
|
+
`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.#e(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}#e(e){this.setAttribute("empty",e===""?"true":"false")}};c([u({type:Number,attribute:"expected-length"})],ge.prototype,"expectedLength",2),c([u({type:String,attribute:"pattern-mask"})],ge.prototype,"patternMask",2),c([u({type:String,attribute:"placeholder-text"})],ge.prototype,"placeholderText",2),c([u({type:String,attribute:"data-patternmask-message"})],ge.prototype,"dataPatternmaskMessage",2),c([w()],ge.prototype,"response",2),c([Tt("input")],ge.prototype,"_input",2),c([P("response",{waitUntilFirstUpdate:!0})],ge.prototype,"_handleValueChange",2);customElements.define("qti-text-entry-interaction",ge);var hs=class extends I{#e=null;#t=null;reset(){this.#e=null,this.#t=null,this.saveResponse(null)}validate(){return this.#t!==null}get response(){return this.#t}set response(r){if(typeof r=="string")this.#t=r,this.saveResponse(r);else if(r===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...I.properties}}static{this.styles=[y`
|
|
6236
6330
|
:host {
|
|
6237
6331
|
display: block;
|
|
6238
6332
|
margin: 1em 0;
|
|
@@ -6262,7 +6356,7 @@ CES.load();
|
|
|
6262
6356
|
display: flex;
|
|
6263
6357
|
user-select: none;
|
|
6264
6358
|
}
|
|
6265
|
-
`}connectedCallback(){this.setAttribute("slot","drags")}};c([u({type:Number,reflect:!0})],ci.prototype,"tabindex",2);customElements.define("qti-gap-img",ci);var tl={toAttribute:
|
|
6359
|
+
`}connectedCallback(){this.setAttribute("slot","drags")}};c([u({type:Number,reflect:!0})],ci.prototype,"tabindex",2);customElements.define("qti-gap-img",ci);var tl={toAttribute:n=>n?"true":"false",fromAttribute:n=>n==="true"};function ke(n,r){class e extends n{constructor(...s){super(...s);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(s,o){this.tabIndex=o?-1:0,o&&this.blur()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.tabIndex=-1),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${r}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${r}`,{bubbles:!0,composed:!0}))}_onKeyUp(s){s.altKey||(s.code==="Space"||s.code==="Enter")&&(s.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${r}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return h`<slot></slot>`}}return c([u({type:String})],e.prototype,"identifier",2),c([u({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),c([u({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:tl})],e.prototype,"disabled",2),c([u({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:tl})],e.prototype,"readonly",2),c([P("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var di=class extends ke(b,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}static{this.styles=y`
|
|
6266
6360
|
:host {
|
|
6267
6361
|
display: inline-flex;
|
|
6268
6362
|
user-select: none;
|
|
@@ -6320,7 +6414,7 @@ CES.load();
|
|
|
6320
6414
|
<div part="cha"></div>
|
|
6321
6415
|
</div>
|
|
6322
6416
|
${this.marker?h`<div id="label">${this.marker}</div>`:L}
|
|
6323
|
-
<slot part="slot"></slot>`}};c([u({type:String,attribute:"template-identifier"})],at.prototype,"templateIdentifier",2),c([u({type:String,attribute:"show-hide"})],at.prototype,"showHide",2),c([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],at.prototype,"fixed",2),c([u({type:String,attribute:!1})],at.prototype,"marker",2);customElements.define("qti-simple-choice",at);var RT=async o=>{let r=o.substring(0,o.lastIndexOf("/")),e=await wn().load(`${o}`).then(a=>a.assessmentTest()),t=await Rt().load(`${r}/${e.href}`).then(a=>a.htmlDoc()),i=await Rt().load(`${r}/${e.href}`).then(a=>a.items()),s=`${r}/${e.href}`,n=`${r}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:n,testURL:s,items:i,testIdentifier:e.identifier}},_T=async o=>ve().load(o).then(r=>r.htmlDoc().firstElementChild);var Me=class extends b{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};Me=c([C("qti-rule")],Me);var ui=class extends Me{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==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:vr(t)}})),t)}};c([u({type:String})],ui.prototype,"identifier",2),c([k({context:D,subscribe:!0}),w()],ui.prototype,"context",2);customElements.define("qti-lookup-outcome-value",ui);var go=class extends Me{render(){return h`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",go);var bo=class extends Me{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new vo(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.#e(i)}}))}#e(r){return Array.isArray(r)?r.map(vr):r!==null?vr(r):null}},vo=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",bo);var mi=class extends b{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",mi);var hi=class extends mi{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",hi);var yo=class extends hi{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",yo);var vs=class extends Kl(ce){calculate(){return this.calculateChildren(Array.from(this.children))}};vs=c([C("qti-and")],vs);function Kl(o){return class extends o{calculateChildren(e){return e.map(i=>{let s=i;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=s.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)}}}var ys=class extends A{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};c([u({type:String,attribute:"base-type"})],ys.prototype,"baseType",2);customElements.define("qti-base-value",ys);var xo=class extends A{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};customElements.define("qti-container-size",xo);var qo=class extends ce{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,s=t.value;return i.filter(l=>s.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.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",qo);var Co=class extends A{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Co);var rr=class extends A{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let n=this._testContext.items.find(l=>l.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(n)}`),!this._testContext||!n)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(l=>l.identifier===t)?.variables.find(l=>l.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let s=this.context.variables.find(n=>n.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};c([u({type:String})],rr.prototype,"identifier",2),c([k({context:D,subscribe:!0}),w()],rr.prototype,"context",2),c([w(),k({context:ye,subscribe:!0})],rr.prototype,"_testContext",2);customElements.define("qti-default",rr);var xs=class extends A{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),n=parseFloat(i.value);if(!isNaN(s)&&!isNaN(n))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(s*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: ${s}, ${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}};c([u({type:String})],xs.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",xs);var wo=class extends A{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",wo);var fi=class extends A{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#e(i,this.figures):this.#t(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#e(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}#t(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),s=Math.pow(10,t-i-1);return Math.round(e*s)/s}};c([u({type:String,attribute:"rounding-mode"})],fi.prototype,"roundingMode",2),c([u({type:Number})],fi.prototype,"figures",2);customElements.define("qti-round-to",fi);var qs=class extends A{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):X.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};c([u({type:String})],qs.prototype,"toleranceMode",2);customElements.define("qti-equal",qs);var Eo=class extends A{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let s=parseInt(i,10);if(isNaN(s))return console.error("qti-gcd non-numerical value"),null;e.push(s)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#e(e)}#e(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this.#t(e,Math.abs(r[t])),e!==1);t++);return e}#t(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",Eo);var To=class extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",To);var So=class extends ce{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.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",So);var Ao=class extends A{getResult(){return null}};customElements.define("qti-null",Ao);var ko=class extends A{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ko);var Mo=class extends A{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",Mo);var Ro=class extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",Ro);var _o=class extends ce{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.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",_o);var Cs=class extends A{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let s of t){let n=e.mapEntries.filter(l=>r.baseType==="string"&&!l.caseSensitive?X.compareSingleValues(l.mapKey.toLowerCase(),s.toLowerCase(),r.baseType):X.compareSingleValues(l.mapKey,s,r.baseType)),a=n.reduce((l,d)=>l.mappedValue>d.mappedValue?l:d,n.length>0?n[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};c([u({type:String})],Cs.prototype,"identifier",2);customElements.define("qti-map-response",Cs);var ws=class extends A{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,s=new Set;for(let n of t)for(let a of e.areaMapEntries){if(s.has(a.coords))continue;X.isPointInArea(n,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,s.add(a.coords))}return s.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};c([u({type:String})],ws.prototype,"identifier",2);customElements.define("qti-map-response-point",ws);var Es=class extends A{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let s=parseFloat(i.value);if(isNaN(s))return console.error("qti-math-operator non-numerical value"),null;t.push(s)}return this.#e(this.name,t)}#e(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],s=t[1];return i===0&&s<=0||i<0&&!Number.isInteger(s)?null:Math.pow(i,s)}case"log_base":{if(t.length!==2)return null;let i=t[0],s=t[1];return i<=0||s<=0||s===1?null:Math.log(i)/Math.log(s)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};c([u({type:String})],Es.prototype,"name",2);customElements.define("qti-math-operator",Es);var Io=class o extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return o.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):X.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!X.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let s=null,n=[...r.value];for(let a of n)if(X.compareSingleValues(i,a,e.baseType)){s=a;break}if(s!==null)n.splice(n.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",Io);var Lo=class extends A{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",Lo);var $o=class extends A{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",$o);var Oo=class extends A{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Oo);var Po=class extends ce{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),s=!1;if(typeof i=="string")if(i==="true")s=!0;else if(i==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(s=i);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Po);var Vo=class extends A{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",Vo);var No=class extends A{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),s=parseFloat(t.value);if(isNaN(i)||isNaN(s))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&s<=0||i<0&&!Number.isInteger(s))return null;let n;try{n=Math.pow(i,s)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(n))return null;if(n===1/0||n===-1/0)return n;if(!isFinite(n)||Math.abs(n)>Number.MAX_VALUE||n!==0&&Math.abs(n)<Number.MIN_VALUE)return null;if(isFinite(n)&&n!==0){let a=Math.floor(Math.log10(Math.abs(n))),l=Math.max(0,14-a),d=Math.pow(10,l);n=Math.round(n*d)/d}return n}};customElements.define("qti-power",No);var gi=class extends b{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?L:h`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};c([u({type:String})],gi.prototype,"identifier",2),c([k({context:D,subscribe:!0}),w()],gi.prototype,"context",2);customElements.define("qti-printed-variable",gi);var Do=class extends A{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",Do);var Ts=class extends Zl(A){getResult(){return this.calculateChildren(Array.from(this.children))}};function Zl(o){return class extends o{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",Ts);var Ss=class extends A{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return X.compareSingleValues(s,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};c([u({type:String,attribute:"case-sensitive"})],Ss.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ss);var Ho=class extends A{#e;constructor(){super(),this.#e=new zo(Array.from(this.children))}getResult(){return this.#e.calculate()}},zo=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",Ho);var Uo=class extends A{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",Uo);var ir=class extends A{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let s=this.min+this.step*t;if(s>this.max)break;Number.isInteger(s)&&e.push(s),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};c([u({type:Number})],ir.prototype,"min",2),c([u({type:Number})],ir.prototype,"max",2),c([u({type:Number})],ir.prototype,"step",2);customElements.define("qti-random-integer",ir);var Bo=class extends A{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",Bo);var Fo=class extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}return null}};customElements.define("qti-delete",Fo);var As,il,bi=class extends A{constructor(){super(...arguments);T(this,As)}getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let e=this.getVariables()[0];if(!e)return console.error("qti-index: missing container"),null;let t;if(!isNaN(Number(this.n)))t=Number(this.n);else{let i=R(this,As,il).call(this,this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;t=Number(i)}if(t<=0||!Number.isInteger(t))return console.error("qti-index: index must be a positive integer"),null;if(e.cardinality==="ordered"){let i=Array.isArray(e.value)?e.value:[e.value];return e.value===null||t>i.length?null:i[t-1]}else return console.error("qti-index: child must have ordered cardinality"),null}};As=new WeakSet,il=function(e){let t=this.context.variables.find(i=>i.identifier===e)?.value;return t===null||isNaN(Number(t))?null:Number(t)},c([u({type:String})],bi.prototype,"n",2),bi=c([C("qti-index")],bi);export{Ln as Correctness,Xs as INITIAL_SESSION_CONTEXT,Gs as INITIAL_TEST_CONTEXT,_ as Interaction,Ys as IsNullOrUndefined,Ve as ItemContainer,qt as ItemCorrectResponseMode,Kt as ItemPrintVariables,he as ItemShowCandidateCorrection,fe as ItemShowCorrectResponse,vs as QtiAnd,se as QtiAssessmentItem,Ie as QtiAssessmentItemRef,Le as QtiAssessmentSection,Nt as QtiAssessmentStimulusRef,eo as QtiAssessmentStimulusRefConnectedEvent,ft as QtiAssessmentTest,fs as QtiAssociableHotspot,si as QtiAssociateInteraction,ys as QtiBaseValue,oi as QtiChoiceInteraction,Vi as QtiCompanionMaterialsInfo,ce as QtiConditionExpression,xo as QtiContainerSize,qo as QtiContains,Ni as QtiContentBody,bt as QtiContextDeclaration,Co as QtiCorrect,Ne as QtiCustomInteraction,Rr as QtiCustomOperator,rr as QtiDefault,Fo as QtiDelete,tt as QtiEndAttemptInteraction,qs as QtiEqual,xs as QtiEqualRounded,A as QtiExpression,ae as QtiExtendedTextInteraction,ie as QtiFeedback,Ir as QtiFeedbackBlock,Lr as QtiFeedbackInline,Mo as QtiFieldValue,li as QtiGap,ci as QtiGapImg,os as QtiGapMatchInteraction,di as QtiGapText,Eo as QtiGcd,De as QtiGraphicAssociateInteraction,ns as QtiGraphicGapMatchInteraction,as as QtiGraphicOrderInteraction,To as QtiGt,So as QtiGte,tr as QtiHotspotChoice,ls as QtiHotspotInteraction,gs as QtiHottext,ni as QtiHottextInteraction,bi as QtiIndex,pi as QtiInlineChoice,cs as QtiInlineChoiceInteraction,ko as QtiIsNull,Zt as QtiItem,$r as QtiItemBody,ui as QtiLookupOutcomeValue,Ro as QtiLt,_o as QtiLte,Cs as QtiMapResponse,ws as QtiMapResponsePoint,Io as QtiMatch,st as QtiMatchInteraction,Es as QtiMathOperator,ds as QtiMediaInteraction,Lo as QtiMember,gt as QtiModalFeedback,$o as QtiMultiple,Oo as QtiNot,Ao as QtiNull,Po as QtiOr,ot as QtiOrderInteraction,Vo as QtiOrdered,we as QtiOutcomeDeclaration,B as QtiPortableCustomInteraction,us as QtiPositionObjectInteraction,ms as QtiPositionObjectStage,No as QtiPower,gi as QtiPrintedVariable,Do as QtiProduct,bs as QtiPrompt,Bo as QtiRandom,ir as QtiRandomInteger,go as QtiResponseCondition,Oe as QtiResponseDeclaration,mi as QtiResponseElse,yo as QtiResponseElseIf,hi as QtiResponseIf,Pr as QtiResponseProcessing,wo as QtiRound,fi as QtiRoundTo,Ce as QtiRubricBlock,$n as QtiRuleElement,He as QtiSelectPointInteraction,bo as QtiSetOutcomeValue,vo as QtiSetOutcomeValueRule,Ct as QtiSimpleAssociableChoice,at as QtiSimpleChoice,nt as QtiSliderInteraction,Ss as QtiStringMatch,Di as QtiStylesheet,Ts as QtiSubtract,Ho as QtiSum,zo as QtiSumExpression,Ee as QtiTemplateDeclaration,Pi as QtiTest,Vr as QtiTestFeedback,$e as QtiTestPart,ge as QtiTextEntryInteraction,hs as QtiUploadInteraction,Uo as QtiVariable,Ot as QtiVariableDeclaration,X as ScoringHelper,Kr as TestCheckItem,Pe as TestContainer,Dr as TestEndAttempt,zt as TestItemLink,pe as TestNavigation,Ke as TestNext,jr as TestPagingButtonsStamp,Ze as TestPrev,Yr as TestPrintContext,Ft as TestPrintVariables,xt as TestScoringButtons,Wt as TestScoringFeedback,Gr as TestSectionButtonsStamp,jt as TestSectionLink,me as TestShowCorrectResponse,yt as TestStamp,J as TestView,Jr as TestViewToggle,N as computedContext,Fe as computedItemContext,le as configContext,vr as convertNumberToUniversalFormat,Ml as decimalSeparator,_T as getItemByUri,RT as getManifestInfo,D as itemContext,Sn as itemContextVariables,Kl as qtiAndMixin,Lt as qtiContext,Zl as qtiSubtractMixin,ve as qtiTransformItem,wn as qtiTransformManifest,Rt as qtiTransformTest,yr as removeDoubleSlashes,je as sessionContext,ye as testContext};
|
|
6417
|
+
<slot part="slot"></slot>`}};c([u({type:String,attribute:"template-identifier"})],at.prototype,"templateIdentifier",2),c([u({type:String,attribute:"show-hide"})],at.prototype,"showHide",2),c([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],at.prototype,"fixed",2),c([u({type:String,attribute:!1})],at.prototype,"marker",2);customElements.define("qti-simple-choice",at);var RT=async n=>{let r=n.substring(0,n.lastIndexOf("/")),e=await wn().load(`${n}`).then(a=>a.assessmentTest()),t=await Rt().load(`${r}/${e.href}`).then(a=>a.htmlDoc()),i=await Rt().load(`${r}/${e.href}`).then(a=>a.items()),s=`${r}/${e.href}`,o=`${r}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:o,testURL:s,items:i,testIdentifier:e.identifier}},IT=async n=>ve().load(n).then(r=>r.htmlDoc().firstElementChild);var Me=class extends b{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};Me=c([C("qti-rule")],Me);var ui=class extends Me{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==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:vr(t)}})),t)}};c([u({type:String})],ui.prototype,"identifier",2),c([k({context:D,subscribe:!0}),w()],ui.prototype,"context",2);customElements.define("qti-lookup-outcome-value",ui);var go=class extends Me{render(){return h`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",go);var bo=class extends Me{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new vo(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.#e(i)}}))}#e(r){return Array.isArray(r)?r.map(vr):r!==null?vr(r):null}},vo=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",bo);var mi=class extends b{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",mi);var hi=class extends mi{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",hi);var yo=class extends hi{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",yo);var vs=class extends Kl(ce){calculate(){return this.calculateChildren(Array.from(this.children))}};vs=c([C("qti-and")],vs);function Kl(n){return class extends n{calculateChildren(e){return e.map(i=>{let s=i;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=s.calculate(),a=!1;if(typeof o=="string")if(o==="true")a=!0;else if(o==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof o=="boolean"&&(a=o);return a}).every(i=>typeof i=="boolean"&&i)}}}var ys=class extends A{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};c([u({type:String,attribute:"base-type"})],ys.prototype,"baseType",2);customElements.define("qti-base-value",ys);var xo=class extends A{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};customElements.define("qti-container-size",xo);var qo=class extends ce{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,s=t.value;return i.filter(l=>s.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.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",qo);var Co=class extends A{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Co);var rr=class extends A{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let o=this._testContext.items.find(l=>l.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(l=>l.identifier===t)?.variables.find(l=>l.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let s=this.context.variables.find(o=>o.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};c([u({type:String})],rr.prototype,"identifier",2),c([k({context:D,subscribe:!0}),w()],rr.prototype,"context",2),c([w(),k({context:ye,subscribe:!0})],rr.prototype,"_testContext",2);customElements.define("qti-default",rr);var xs=class extends A{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),o=parseFloat(i.value);if(!isNaN(s)&&!isNaN(o))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(s*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${s}, ${o}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};c([u({type:String})],xs.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",xs);var wo=class extends A{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",wo);var fi=class extends A{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#e(i,this.figures):this.#t(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#e(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}#t(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),s=Math.pow(10,t-i-1);return Math.round(e*s)/s}};c([u({type:String,attribute:"rounding-mode"})],fi.prototype,"roundingMode",2),c([u({type:Number})],fi.prototype,"figures",2);customElements.define("qti-round-to",fi);var qs=class extends A{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):X.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};c([u({type:String})],qs.prototype,"toleranceMode",2);customElements.define("qti-equal",qs);var Eo=class extends A{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let s=parseInt(i,10);if(isNaN(s))return console.error("qti-gcd non-numerical value"),null;e.push(s)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#e(e)}#e(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this.#t(e,Math.abs(r[t])),e!==1);t++);return e}#t(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",Eo);var To=class extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",To);var So=class extends ce{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.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",So);var Ao=class extends A{getResult(){return null}};customElements.define("qti-null",Ao);var ko=class extends A{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ko);var Mo=class extends A{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",Mo);var Ro=class extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",Ro);var Io=class extends ce{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.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",Io);var Cs=class extends A{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let s of t){let o=e.mapEntries.filter(l=>r.baseType==="string"&&!l.caseSensitive?X.compareSingleValues(l.mapKey.toLowerCase(),s.toLowerCase(),r.baseType):X.compareSingleValues(l.mapKey,s,r.baseType)),a=o.reduce((l,d)=>l.mappedValue>d.mappedValue?l:d,o.length>0?o[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};c([u({type:String})],Cs.prototype,"identifier",2);customElements.define("qti-map-response",Cs);var ws=class extends A{getResult(){let r=this.context.variables.find(o=>o.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,s=new Set;for(let o of t)for(let a of e.areaMapEntries){if(s.has(a.coords))continue;X.isPointInArea(o,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,s.add(a.coords))}return s.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};c([u({type:String})],ws.prototype,"identifier",2);customElements.define("qti-map-response-point",ws);var Es=class extends A{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let s=parseFloat(i.value);if(isNaN(s))return console.error("qti-math-operator non-numerical value"),null;t.push(s)}return this.#e(this.name,t)}#e(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],s=t[1];return i===0&&s<=0||i<0&&!Number.isInteger(s)?null:Math.pow(i,s)}case"log_base":{if(t.length!==2)return null;let i=t[0],s=t[1];return i<=0||s<=0||s===1?null:Math.log(i)/Math.log(s)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};c([u({type:String})],Es.prototype,"name",2);customElements.define("qti-math-operator",Es);var _o=class n extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return n.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):X.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!X.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let s=null,o=[...r.value];for(let a of o)if(X.compareSingleValues(i,a,e.baseType)){s=a;break}if(s!==null)o.splice(o.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",_o);var Lo=class extends A{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",Lo);var $o=class extends A{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",$o);var Po=class extends A{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Po);var Oo=class extends ce{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),s=!1;if(typeof i=="string")if(i==="true")s=!0;else if(i==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(s=i);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Oo);var Vo=class extends A{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",Vo);var No=class extends A{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),s=parseFloat(t.value);if(isNaN(i)||isNaN(s))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&s<=0||i<0&&!Number.isInteger(s))return null;let o;try{o=Math.pow(i,s)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(o))return null;if(o===1/0||o===-1/0)return o;if(!isFinite(o)||Math.abs(o)>Number.MAX_VALUE||o!==0&&Math.abs(o)<Number.MIN_VALUE)return null;if(isFinite(o)&&o!==0){let a=Math.floor(Math.log10(Math.abs(o))),l=Math.max(0,14-a),d=Math.pow(10,l);o=Math.round(o*d)/d}return o}};customElements.define("qti-power",No);var gi=class extends b{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?L:h`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};c([u({type:String})],gi.prototype,"identifier",2),c([k({context:D,subscribe:!0}),w()],gi.prototype,"context",2);customElements.define("qti-printed-variable",gi);var Do=class extends A{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",Do);var Ts=class extends Zl(A){getResult(){return this.calculateChildren(Array.from(this.children))}};function Zl(n){return class extends n{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",Ts);var Ss=class extends A{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),o=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return X.compareSingleValues(s,o,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};c([u({type:String,attribute:"case-sensitive"})],Ss.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ss);var Ho=class extends A{#e;constructor(){super(),this.#e=new zo(Array.from(this.children))}getResult(){return this.#e.calculate()}},zo=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",Ho);var Uo=class extends A{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",Uo);var ir=class extends A{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let s=this.min+this.step*t;if(s>this.max)break;Number.isInteger(s)&&e.push(s),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};c([u({type:Number})],ir.prototype,"min",2),c([u({type:Number})],ir.prototype,"max",2),c([u({type:Number})],ir.prototype,"step",2);customElements.define("qti-random-integer",ir);var Bo=class extends A{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",Bo);var Fo=class extends A{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}return null}};customElements.define("qti-delete",Fo);var As,il,bi=class extends A{constructor(){super(...arguments);T(this,As)}getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let e=this.getVariables()[0];if(!e)return console.error("qti-index: missing container"),null;let t;if(!isNaN(Number(this.n)))t=Number(this.n);else{let i=R(this,As,il).call(this,this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;t=Number(i)}if(t<=0||!Number.isInteger(t))return console.error("qti-index: index must be a positive integer"),null;if(e.cardinality==="ordered"){let i=Array.isArray(e.value)?e.value:[e.value];return e.value===null||t>i.length?null:i[t-1]}else return console.error("qti-index: child must have ordered cardinality"),null}};As=new WeakSet,il=function(e){let t=this.context.variables.find(i=>i.identifier===e)?.value;return t===null||isNaN(Number(t))?null:Number(t)},c([u({type:String})],bi.prototype,"n",2),bi=c([C("qti-index")],bi);export{Ln as Correctness,Xs as INITIAL_SESSION_CONTEXT,Gs as INITIAL_TEST_CONTEXT,I as Interaction,Ys as IsNullOrUndefined,Ve as ItemContainer,qt as ItemCorrectResponseMode,Kt as ItemPrintVariables,he as ItemShowCandidateCorrection,fe as ItemShowCorrectResponse,vs as QtiAnd,se as QtiAssessmentItem,_e as QtiAssessmentItemRef,Le as QtiAssessmentSection,Nt as QtiAssessmentStimulusRef,eo as QtiAssessmentStimulusRefConnectedEvent,ft as QtiAssessmentTest,fs as QtiAssociableHotspot,si as QtiAssociateInteraction,ys as QtiBaseValue,oi as QtiChoiceInteraction,Vi as QtiCompanionMaterialsInfo,ce as QtiConditionExpression,xo as QtiContainerSize,qo as QtiContains,Ni as QtiContentBody,bt as QtiContextDeclaration,Co as QtiCorrect,Ne as QtiCustomInteraction,Rr as QtiCustomOperator,rr as QtiDefault,Fo as QtiDelete,tt as QtiEndAttemptInteraction,qs as QtiEqual,xs as QtiEqualRounded,A as QtiExpression,ae as QtiExtendedTextInteraction,ie as QtiFeedback,_r as QtiFeedbackBlock,Lr as QtiFeedbackInline,Mo as QtiFieldValue,li as QtiGap,ci as QtiGapImg,os as QtiGapMatchInteraction,di as QtiGapText,Eo as QtiGcd,De as QtiGraphicAssociateInteraction,ns as QtiGraphicGapMatchInteraction,as as QtiGraphicOrderInteraction,To as QtiGt,So as QtiGte,tr as QtiHotspotChoice,ls as QtiHotspotInteraction,gs as QtiHottext,ni as QtiHottextInteraction,bi as QtiIndex,pi as QtiInlineChoice,cs as QtiInlineChoiceInteraction,ko as QtiIsNull,Zt as QtiItem,$r as QtiItemBody,ui as QtiLookupOutcomeValue,Ro as QtiLt,Io as QtiLte,Cs as QtiMapResponse,ws as QtiMapResponsePoint,_o as QtiMatch,st as QtiMatchInteraction,Es as QtiMathOperator,ds as QtiMediaInteraction,Lo as QtiMember,gt as QtiModalFeedback,$o as QtiMultiple,Po as QtiNot,Ao as QtiNull,Oo as QtiOr,ot as QtiOrderInteraction,Vo as QtiOrdered,we as QtiOutcomeDeclaration,B as QtiPortableCustomInteraction,us as QtiPositionObjectInteraction,ms as QtiPositionObjectStage,No as QtiPower,gi as QtiPrintedVariable,Do as QtiProduct,bs as QtiPrompt,Bo as QtiRandom,ir as QtiRandomInteger,go as QtiResponseCondition,Pe as QtiResponseDeclaration,mi as QtiResponseElse,yo as QtiResponseElseIf,hi as QtiResponseIf,Or as QtiResponseProcessing,wo as QtiRound,fi as QtiRoundTo,Ce as QtiRubricBlock,$n as QtiRuleElement,He as QtiSelectPointInteraction,bo as QtiSetOutcomeValue,vo as QtiSetOutcomeValueRule,Ct as QtiSimpleAssociableChoice,at as QtiSimpleChoice,nt as QtiSliderInteraction,Ss as QtiStringMatch,Di as QtiStylesheet,Ts as QtiSubtract,Ho as QtiSum,zo as QtiSumExpression,Ee as QtiTemplateDeclaration,Oi as QtiTest,Vr as QtiTestFeedback,$e as QtiTestPart,ge as QtiTextEntryInteraction,hs as QtiUploadInteraction,Uo as QtiVariable,Pt as QtiVariableDeclaration,X as ScoringHelper,Kr as TestCheckItem,Oe as TestContainer,Dr as TestEndAttempt,zt as TestItemLink,pe as TestNavigation,Ke as TestNext,jr as TestPagingButtonsStamp,Ze as TestPrev,Yr as TestPrintContext,Ft as TestPrintVariables,xt as TestScoringButtons,Wt as TestScoringFeedback,Gr as TestSectionButtonsStamp,jt as TestSectionLink,me as TestShowCorrectResponse,yt as TestStamp,J as TestView,Jr as TestViewToggle,N as computedContext,Fe as computedItemContext,le as configContext,vr as convertNumberToUniversalFormat,Ml as decimalSeparator,IT as getItemByUri,RT as getManifestInfo,D as itemContext,Sn as itemContextVariables,Kl as qtiAndMixin,Lt as qtiContext,Zl as qtiSubtractMixin,ve as qtiTransformItem,wn as qtiTransformManifest,Rt as qtiTransformTest,yr as removeDoubleSlashes,je as sessionContext,ye as testContext};
|
|
6324
6418
|
/*! Bundled license information:
|
|
6325
6419
|
|
|
6326
6420
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|