@citolab/qti-components 9.0.0 → 9.2.0
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 +220 -212
- package/dist/base.d.ts +54 -11
- package/dist/base.js +11 -1
- package/dist/{chunk-GBDTBHUQ.js → chunk-7PXUE2GR.js} +3376 -3252
- package/dist/chunk-7PXUE2GR.js.map +1 -0
- package/dist/chunk-A32YH4H5.js +7 -0
- package/dist/chunk-A32YH4H5.js.map +1 -0
- package/dist/{chunk-MKZ374OJ.js → chunk-FG5JAWSN.js} +2 -2
- package/dist/{chunk-3VQSUWCK.js → chunk-G5RQ5GKG.js} +407 -131
- package/dist/chunk-G5RQ5GKG.js.map +1 -0
- package/dist/{chunk-WTV7NQHO.js → chunk-GPGUXZ3X.js} +20 -6
- package/dist/{chunk-WTV7NQHO.js.map → chunk-GPGUXZ3X.js.map} +1 -1
- package/dist/{chunk-5BXJRO5O.js → chunk-JGPWBIVD.js} +389 -229
- package/dist/chunk-JGPWBIVD.js.map +1 -0
- package/dist/{chunk-RT6WZ3P7.js → chunk-JLZCZVRX.js} +2 -2
- package/dist/{chunk-6ITD55QE.js → chunk-LFVPS7KB.js} +2 -2
- package/dist/{chunk-3MQNPN7A.js → chunk-RAJQKCQ3.js} +68 -11
- package/dist/chunk-RAJQKCQ3.js.map +1 -0
- package/dist/{chunk-WKWCOV5P.js → chunk-REKCRWJV.js} +83 -21
- package/dist/chunk-REKCRWJV.js.map +1 -0
- package/dist/{chunk-HDEG6BAZ.js → chunk-TLAVOBEM.js} +16 -8
- package/dist/chunk-TLAVOBEM.js.map +1 -0
- package/dist/{chunk-3NPCS4IT.js → chunk-YIYHCHHM.js} +2 -2
- package/dist/{chunk-WCWJPIUQ.js → chunk-YVZWNLF4.js} +191 -52
- package/dist/chunk-YVZWNLF4.js.map +1 -0
- package/dist/{chunk-KCK27QBP.js → chunk-ZG7FBQFP.js} +2 -2
- package/dist/{chunk-DXEWBTJB.js → chunk-ZOQVTG5L.js} +2 -2
- package/dist/{computed.types.d-CJarqC6s.d.ts → computed.types.d-DB5gfOh9.d.ts} +2 -16
- package/dist/corrections.d.ts +21 -10
- package/dist/corrections.js +20 -20
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +43 -11
- package/dist/elements.js +4 -4
- package/dist/index.d.ts +14 -13
- package/dist/index.js +37 -15
- package/dist/{interaction.d-CJiMv8H7.d.ts → interaction.d-DegNJ5ZA.d.ts} +1 -1
- package/dist/interactions.d.ts +35 -35
- package/dist/interactions.js +3 -3
- package/dist/item.css +11 -2
- package/dist/item.d.ts +31 -82
- package/dist/item.js +7 -5
- package/dist/{item.types.d-QU7LljEK.d.ts → item.types.d-BDFrq19E.d.ts} +18 -2
- package/dist/loader.d.ts +3 -3
- package/dist/loader.js +2 -2
- package/dist/processing.d.ts +139 -20
- package/dist/processing.js +11 -3
- package/dist/qti-components-jsx.d.ts +1947 -98
- package/dist/{qti-condition-expression.d-CYwXOUb1.d.ts → qti-condition-expression.d-DLboq8bR.d.ts} +1 -1
- package/dist/{qti-expression.d-B_-m9emA.d.ts → qti-expression.d-BksT9iLB.d.ts} +26 -3
- package/dist/{qti-feedback.d-B1EIF-fU.d.ts → qti-feedback.d-D-w6-mJv.d.ts} +1 -1
- package/dist/qti-item.d-D_-9_0e6.d.ts +101 -0
- package/dist/qti-rule-base.d-Bdzg8eGH.d.ts +41 -0
- package/dist/{qti-test.d-C6lCEMRB.d.ts → qti-test.d-BfAZE6UF.d.ts} +61 -9
- package/dist/{qti-text-entry-interaction.d-BGdfV9qG.d.ts → qti-text-entry-interaction.d-CATtcPyX.d.ts} +10 -9
- package/dist/session.context.d-Cjs0BkJB.d.ts +33 -0
- package/dist/test.d.ts +8 -8
- package/dist/test.js +8 -6
- package/dist/transformers.js +1 -1
- package/package.json +13 -12
- package/dist/chunk-3MQNPN7A.js.map +0 -1
- package/dist/chunk-3VQSUWCK.js.map +0 -1
- package/dist/chunk-5BXJRO5O.js.map +0 -1
- package/dist/chunk-GBDTBHUQ.js.map +0 -1
- package/dist/chunk-HDEG6BAZ.js.map +0 -1
- package/dist/chunk-TLTYXWW7.js +0 -7
- package/dist/chunk-TLTYXWW7.js.map +0 -1
- package/dist/chunk-WCWJPIUQ.js.map +0 -1
- package/dist/chunk-WKWCOV5P.js.map +0 -1
- package/dist/computed-item.types.d-BKZdSLLJ.d.ts +0 -19
- package/dist/qti-rule-base.d-ajOnfGXY.d.ts +0 -16
- /package/dist/{chunk-MKZ374OJ.js.map → chunk-FG5JAWSN.js.map} +0 -0
- /package/dist/{chunk-RT6WZ3P7.js.map → chunk-JLZCZVRX.js.map} +0 -0
- /package/dist/{chunk-6ITD55QE.js.map → chunk-LFVPS7KB.js.map} +0 -0
- /package/dist/{chunk-3NPCS4IT.js.map → chunk-YIYHCHHM.js.map} +0 -0
- /package/dist/{chunk-KCK27QBP.js.map → chunk-ZG7FBQFP.js.map} +0 -0
- /package/dist/{chunk-DXEWBTJB.js.map → chunk-ZOQVTG5L.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
var $c=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Dt=function(n,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Y=function(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)},pr,po,uo,ni,Js,si,mo,Ne,ai,he,fo,Lc;var F={__proto__:null};F.enumerable=!0;Object.freeze(F);var Zs=(he=class{constructor(t,e={}){if(pr.set(this,!1),po.set(this,!1),uo.set(this,!1),ni.set(this,!1),Js.set(this,Date.now()),si.set(this,!1),mo.set(this,void 0),Ne.set(this,void 0),ai.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:o}=e;Dt(this,pr,!!i,"f"),Dt(this,po,!!r,"f"),Dt(this,uo,!!o,"f"),Dt(this,mo,`${t}`,"f"),Dt(this,Ne,null,"f"),Dt(this,ai,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Dt(this,ni,!0,"f")}get target(){return Y(this,Ne,"f")}get currentTarget(){return Y(this,Ne,"f")}get srcElement(){return Y(this,Ne,"f")}get type(){return Y(this,mo,"f")}get cancelable(){return Y(this,pr,"f")}get defaultPrevented(){return Y(this,pr,"f")&&Y(this,ni,"f")}get timeStamp(){return Y(this,Js,"f")}composedPath(){return Y(this,ai,"f")?[Y(this,Ne,"f")]:[]}get returnValue(){return!Y(this,pr,"f")||!Y(this,ni,"f")}get bubbles(){return Y(this,po,"f")}get composed(){return Y(this,uo,"f")}get eventPhase(){return Y(this,ai,"f")?he.AT_TARGET:he.NONE}get cancelBubble(){return Y(this,si,"f")}set cancelBubble(t){t&&Dt(this,si,!0,"f")}stopPropagation(){Dt(this,si,!0,"f")}get isTrusted(){return!1}},pr=new WeakMap,po=new WeakMap,uo=new WeakMap,ni=new WeakMap,Js=new WeakMap,si=new WeakMap,mo=new WeakMap,Ne=new WeakMap,ai=new WeakMap,he.NONE=0,he.CAPTURING_PHASE=1,he.AT_TARGET=2,he.BUBBLING_PHASE=3,he);Object.defineProperties(Zs.prototype,{initEvent:F,stopImmediatePropagation:F,preventDefault:F,target:F,currentTarget:F,srcElement:F,type:F,cancelable:F,defaultPrevented:F,timeStamp:F,composedPath:F,returnValue:F,bubbles:F,composed:F,eventPhase:F,cancelBubble:F,stopPropagation:F,isTrusted:F});var Vc=(Lc=class extends Zs{constructor(t,e={}){super(t,e),fo.set(this,void 0),Dt(this,fo,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return Y(this,fo,"f")}},fo=new WeakMap,Lc);Object.defineProperties(Vc.prototype,{detail:F});var Xt=Zs,ta=Vc;var et;var gm=(et=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},et.STYLE_RULE=1,et.CHARSET_RULE=2,et.IMPORT_RULE=3,et.MEDIA_RULE=4,et.FONT_FACE_RULE=5,et.PAGE_RULE=6,et.NAMESPACE_RULE=10,et.KEYFRAMES_RULE=7,et.KEYFRAME_RULE=8,et.SUPPORTS_RULE=12,et.COUNTER_STYLE_RULE=11,et.FONT_FEATURE_VALUES_RULE=14,et.MARGIN_RULE=9,et);globalThis.Event??=Xt;globalThis.CustomEvent??=ta;var ra=Symbol(),zc=n=>typeof n=="boolean"?n:n?.capture??!1,Yt={__proto__:null};Yt.enumerable=!0;Object.freeze(Yt);var go=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=zc(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(t);if(o===void 0)o=new Map,i.set(t,o);else if(o.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),o.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=zc(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(t);o!==void 0&&(o.delete(e),o.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,o=Xt.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...Yt},srcElement:{get(){return t.target},...Yt},currentTarget:{get(){return l},...Yt},eventPhase:{get(){return o},...Yt},composedPath:{value:()=>e,...Yt},stopPropagation:{value:()=>{r=!0,c.call(t)},...Yt},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...Yt}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(l=null,o=Xt.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let w=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&w(m.slice(m.indexOf(u))),l=u,o=u===t.target?Xt.AT_TARGET:Xt.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,v]of g)if(h(y,v,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&w(x.slice(0,x.indexOf(u)+1)),l=u,o=u===t.target?Xt.AT_TARGET:Xt.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,v]of g)if(h(y,v,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Bc,Gh]}};var jc=new WeakMap,ci=n=>{let t=jc.get(n);return t===void 0&&jc.set(n,t=new Map),t},li=class extends go{getRootNode(t){return t?.composed?ea:this.__host?.__shadowRoot??ea}};var Fc=class extends li{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Bc=new Fc,ea=Bc;var Uc=class extends li{constructor(t){if(super(),t!==ra)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:bo,customElements:oa,document:ea,Document:Fc,Element:Hc,EventTarget:go,HTMLElement:Wc,Node:li,ShadowRoot:Qc,window:this,Window:Uc})}};var Hc=class extends li{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ci(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){ci(this).set(t,String(e))}removeAttribute(t){ci(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return ci(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Qc(ra,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new $c(this);return this.__internals=t,t}getAttribute(t){return ci(this).get(t)??null}};var Wc=class extends Hc{},ia=Wc;var Qc=class extends li{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new ia,"localName",{get(){return"lit-server-root"}});function Wh(){let n,t;return{promise:new Promise((r,i)=>{n=r,t=i}),resolve:n,reject:t}}var bo=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
-
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=
|
|
3
|
-
\f\r]`,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),il=/'/g,ol=/"/g,al=/^(?:script|style|textarea|title)$/i,ha=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),b=ha(1),vi=ha(2),Xm=ha(3),Z=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),nl=new WeakMap,Le=Ve.createTreeWalker(Ve,129);function cl(n,t){if(!da(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return tl!==void 0?tl.createHTML(t):t}var ll=(n,t)=>{let e=n.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",s=fi;for(let a=0;a<e;a++){let l=n[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===fi?d[1]==="!--"?s=el:d[1]!==void 0?s=rl:d[2]!==void 0?(al.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=$e):d[3]!==void 0&&(s=$e):s===$e?d[0]===">"?(s=i??fi,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?$e:d[3]==='"'?ol:il):s===ol||s===il?s=$e:s===el||s===rl?s=fi:(s=$e,i=void 0);let m=s===$e&&n[a+1].startsWith("/>")?" ":"";o+=s===fi?l+ip:h>=0?(r.push(c),l.slice(0,h)+ca+l.slice(h)+Jt+m):l+Jt+(h===-2?a:m)}return[cl(n,o+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},yi=class n{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,s=0,a=t.length-1,l=this.parts,[c,d]=ll(t,e);if(this.el=n.createElement(c,r),Le.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Le.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(ca)){let f=d[s++],m=i.getAttribute(h).split(Jt),w=/([.?@])?(.*)/.exec(f);l.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?qo:w[1]==="?"?Co:w[1]==="@"?ko:je}),i.removeAttribute(h)}else h.startsWith(Jt)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(al.test(i.tagName)){let h=i.textContent.split(Jt),f=h.length-1;if(f>0){i.textContent=wo?wo.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],gi()),Le.nextNode(),l.push({type:2,index:++o});i.append(h[f],gi())}}}else if(i.nodeType===8)if(i.data===la)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Jt,h+1))!==-1;)l.push({type:7,index:o}),h+=Jt.length-1}o++}}static createElement(t,e){let r=Ve.createElement("template");return r.innerHTML=t,r}};function ze(n,t,e=n,r){if(t===Z)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=bi(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=ze(n,i._$AS(n,t.values),i,r)),t}var xo=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??Ve).importNode(e,!0);Le.currentNode=i;let o=Le.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new ur(o,o.nextSibling,this,t):l.type===1?c=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(c=new Eo(o,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=Le.nextNode(),s++)}return Le.currentNode=Ve,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ur=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ze(this,t,e),bi(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==Z&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):sl(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&bi(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ve.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=yi.createElement(cl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new xo(i,this),s=o.u(this.options);o.p(e),this.T(s),this._$AH=o}}_$AC(t){let e=nl.get(t.strings);return e===void 0&&nl.set(t.strings,e=new yi(t)),e}k(t){da(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new n(this.O(gi()),this.O(gi()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Zc(t).nextSibling;Zc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let o=this.strings,s=!1;if(o===void 0)t=ze(this,t,e,0),s=!bi(t)||t!==this._$AH&&t!==Z,s&&(this._$AH=t);else{let a=t,l,c;for(t=o[0],l=0;l<o.length-1;l++)c=ze(this,a[r+l],e,l),c===Z&&(c=this._$AH[l]),s||=!bi(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+o[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},qo=class extends je{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Co=class extends je{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},ko=class extends je{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=ze(this,t,e,0)??P)===Z)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Eo=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ze(this,t)}},K={M:ca,P:Jt,A:la,C:1,L:ll,R:xo,D:sl,V:ze,I:ur,H:je,N:Co,U:ko,B:qo,F:Eo},op=So.litHtmlPolyfillSupport;op?.(yi,ur),(So.litHtmlVersions??=[]).push("3.3.3");var pa=(n,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new ur(t.insertBefore(gi(),o),o,void 0,e??{})}return i._$AI(n),i};var ua=globalThis,C=class extends Kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=pa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z}};C._$litElement$=!0,C.finalized=!0,ua.litElementHydrateSupport?.({LitElement:C});var np=ua.litElementPolyfillSupport;np?.({LitElement:C});(ua.litElementVersions??=[]).push("4.2.2");var sp={attribute:!0,type:String,converter:ui,reflect:!1,hasChanged:vo},ap=(n=sp,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),o.set(e.name,n),r==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,n,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(n){return(t,e)=>typeof e=="object"?ap(n,t,e):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,t,e)}function _(n){return p({...n,state:!0,attribute:!1})}var pe=(n,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(n,t,e),e);function mr(n,t){return(e,r,i)=>{let o=s=>s.renderRoot?.querySelector(n)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return pe(e,r,{get(){let l=s.call(this);return l===void 0&&(l=o(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return pe(e,r,{get(){return o(this)}})}}function dl(n){return(t,e)=>{let{slot:r,selector:i}=n??{},o="slot"+(r?`[name=${r}]`:":not([name])");return pe(t,e,{get(){let s=this.renderRoot?.querySelector(o),a=s?.assignedElements(n)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var fr=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},hl={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Nt=class extends C{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}};fr([p({type:String})],Nt.prototype,"category",void 0);fr([p({type:String})],Nt.prototype,"identifier",void 0);fr([p({type:Boolean,converter:hl})],Nt.prototype,"required",void 0);fr([p({type:Boolean,converter:hl})],Nt.prototype,"fixed",void 0);fr([p({type:String})],Nt.prototype,"href",void 0);fr([p({type:Object,attribute:!1})],Nt.prototype,"xmlDoc",void 0);var ue=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var gr=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ue(this.context,this.host,this.t,this.subscribe))}};var Ao=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var ma=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},br=class extends Ao{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let o=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)o.has(s)||(o.add(s),a.dispatchEvent(new ue(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new ma(this.context,this.host))}};function B({context:n}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new br(this,{context:n,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new br(s,{context:n}))}));let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let s=new WeakMap;o={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;o={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}function T({context:n,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new gr(this,{context:n,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new gr(i,{context:n,callback:o=>{i[r]=o},subscribe:t})}))}}var pl=[];var ga=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},fa="custom-state-support-probe";function cp(n){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(fa)||customElements.define(fa,class extends HTMLElement{});let t=n.call(document.createElement(fa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var ul=!1;function ml(){if(ul)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let n=HTMLElement.prototype.attachInternals;if(!n)return"modern";let t=cp(n);return t==="modern"||(ul=!0,HTMLElement.prototype.attachInternals=function(){let r=n.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new ga(this)}),r}),t}ml();for(let{tag:n,ctor:t}of pl)customElements.get(n)||customElements.define(n,t);var me=Symbol("computedItemContext");var z=Symbol("computedContext");var pt=Symbol("configContext");var yr=Symbol("interactionContext");var j=Symbol("item");var fl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var lp=/^[A-Za-z0-9-]+$/,dp=n=>typeof n=="string"&&lp.test(n),Eg=n=>dp(n)?n:void 0,ut=Symbol("qtiContext");var ba={view:"candidate"},Lt=Symbol("testContext");var ya={items:[],testOutcomeVariables:[]},ot=Symbol("testContext");var O=q`
|
|
1
|
+
var Jl=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Dt=function(o,t,e,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(o,e):n?n.value=e:t.set(o,e),e},J=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},ur,fi,gi,cn,aa,dn,bi,$e,hn,he,yi,Zl;var F={__proto__:null};F.enumerable=!0;Object.freeze(F);var la=(he=class{constructor(t,e={}){if(ur.set(this,!1),fi.set(this,!1),gi.set(this,!1),cn.set(this,!1),aa.set(this,Date.now()),dn.set(this,!1),bi.set(this,void 0),$e.set(this,void 0),hn.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:r,cancelable:n,composed:i}=e;Dt(this,ur,!!n,"f"),Dt(this,fi,!!r,"f"),Dt(this,gi,!!i,"f"),Dt(this,bi,`${t}`,"f"),Dt(this,$e,null,"f"),Dt(this,hn,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Dt(this,cn,!0,"f")}get target(){return J(this,$e,"f")}get currentTarget(){return J(this,$e,"f")}get srcElement(){return J(this,$e,"f")}get type(){return J(this,bi,"f")}get cancelable(){return J(this,ur,"f")}get defaultPrevented(){return J(this,ur,"f")&&J(this,cn,"f")}get timeStamp(){return J(this,aa,"f")}composedPath(){return J(this,hn,"f")?[J(this,$e,"f")]:[]}get returnValue(){return!J(this,ur,"f")||!J(this,cn,"f")}get bubbles(){return J(this,fi,"f")}get composed(){return J(this,gi,"f")}get eventPhase(){return J(this,hn,"f")?he.AT_TARGET:he.NONE}get cancelBubble(){return J(this,dn,"f")}set cancelBubble(t){t&&Dt(this,dn,!0,"f")}stopPropagation(){Dt(this,dn,!0,"f")}get isTrusted(){return!1}},ur=new WeakMap,fi=new WeakMap,gi=new WeakMap,cn=new WeakMap,aa=new WeakMap,dn=new WeakMap,bi=new WeakMap,$e=new WeakMap,hn=new WeakMap,he.NONE=0,he.CAPTURING_PHASE=1,he.AT_TARGET=2,he.BUBBLING_PHASE=3,he);Object.defineProperties(la.prototype,{initEvent:F,stopImmediatePropagation:F,preventDefault:F,target:F,currentTarget:F,srcElement:F,type:F,cancelable:F,defaultPrevented:F,timeStamp:F,composedPath:F,returnValue:F,bubbles:F,composed:F,eventPhase:F,cancelBubble:F,stopPropagation:F,isTrusted:F});var tc=(Zl=class extends la{constructor(t,e={}){super(t,e),yi.set(this,void 0),Dt(this,yi,e?.detail??null,"f")}initCustomEvent(t,e,r,n){throw new Error("Method not implemented.")}get detail(){return J(this,yi,"f")}},yi=new WeakMap,Zl);Object.defineProperties(tc.prototype,{detail:F});var Xt=la,ca=tc;var rt;var Ym=(rt=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},rt.STYLE_RULE=1,rt.CHARSET_RULE=2,rt.IMPORT_RULE=3,rt.MEDIA_RULE=4,rt.FONT_FACE_RULE=5,rt.PAGE_RULE=6,rt.NAMESPACE_RULE=10,rt.KEYFRAMES_RULE=7,rt.KEYFRAME_RULE=8,rt.SUPPORTS_RULE=12,rt.COUNTER_STYLE_RULE=11,rt.FONT_FEATURE_VALUES_RULE=14,rt.MARGIN_RULE=9,rt);globalThis.Event??=Xt;globalThis.CustomEvent??=ca;var ha=Symbol(),ec=o=>typeof o=="boolean"?o:o?.capture??!1,Yt={__proto__:null};Yt.enumerable=!0;Object.freeze(Yt);var vi=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let n=ec(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);if(i===void 0)i=new Map,n.set(t,i);else if(i.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),i.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let n=ec(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);i!==void 0&&(i.delete(e),i.size||n.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,n=!1,i=Xt.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...Yt},srcElement:{get(){return t.target},...Yt},currentTarget:{get(){return c},...Yt},eventPhase:{get(){return i},...Yt},composedPath:{value:()=>e,...Yt},stopPropagation:{value:()=>{r=!0,l.call(t)},...Yt},stopImmediatePropagation:{value:()=>{n=!0,d.call(t)},...Yt}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(c=null,i=Xt.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),c=u,i=u===t.target?Xt.AT_TARGET:Xt.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,w]of g)if(h(b,w,g),n)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),c=u,i=u===t.target?Xt.AT_TARGET:Xt.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,w]of g)if(h(b,w,g),n)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,ic,wp]}};var rc=new WeakMap,pn=o=>{let t=rc.get(o);return t===void 0&&rc.set(o,t=new Map),t},un=class extends vi{getRootNode(t){return t?.composed?da:this.__host?.__shadowRoot??da}};var nc=class extends un{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var ic=new nc,da=ic;var oc=class extends un{constructor(t){if(super(),t!==ha)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:wi,customElements:ua,document:da,Document:nc,Element:sc,EventTarget:vi,HTMLElement:ac,Node:un,ShadowRoot:lc,window:this,Window:oc})}};var sc=class extends un{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(pn(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){pn(this).set(t,String(e))}removeAttribute(t){pn(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return pn(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new lc(ha,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Jl(this);return this.__internals=t,t}getAttribute(t){return pn(this).get(t)??null}};var ac=class extends sc{},pa=ac;var lc=class extends un{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new pa,"localName",{get(){return"lit-server-root"}});function yp(){let o,t;return{promise:new Promise((r,n)=>{o=r,t=n}),resolve:o,reject:t}}var wi=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=yp(),this.__pendingWhenDefineds.set(t,r)),r.promise}},vp=wi;var ua=new vp,wp=new oc(ha);var mn=globalThis,xi=mn.ShadowRoot&&(mn.ShadyCSS===void 0||mn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ma=Symbol(),cc=new WeakMap,fn=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==ma)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(xi&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=cc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&cc.set(e,t))}return t}toString(){return this.cssText}},dc=o=>new fn(typeof o=="string"?o:o+"",void 0,ma),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,n,i)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+o[i+1],o[0]);return new fn(e,o,ma)},hc=(o,t)=>{if(xi)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),n=mn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=e.cssText,o.appendChild(r)}},fa=xi||mn.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return dc(e)})(o):o;var{is:xp,defineProperty:qp,getOwnPropertyDescriptor:Cp,getOwnPropertyNames:Ep,getOwnPropertySymbols:kp,getPrototypeOf:Sp}=Object,yn=globalThis;yn.customElements??=ua;var pc=yn.trustedTypes,Ap=pc?pc.emptyScript:"",Ip=yn.reactiveElementPolyfillSupport,gn=(o,t)=>o,bn={toAttribute(o,t){switch(t){case Boolean:o=o?Ap:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},qi=(o,t)=>!xp(o,t),uc={attribute:!0,type:String,converter:bn,reflect:!1,useDefault:!1,hasChanged:qi};Symbol.metadata??=Symbol("metadata"),yn.litPropertyMetadata??=new WeakMap;var Kt=class extends(globalThis.HTMLElement??pa){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=uc){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(t,r,e);n!==void 0&&qp(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){let{get:n,set:i}=Cp(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:n,set(s){let a=n?.call(this);i?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??uc}static _$Ei(){if(this.hasOwnProperty(gn("elementProperties")))return;let t=Sp(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(gn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(gn("properties"))){let e=this.properties,r=[...Ep(e),...kp(e)];for(let n of r)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,n]of e)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let n=this._$Eu(e,r);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)e.unshift(fa(n))}else t!==void 0&&e.push(fa(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return hc(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(n!==void 0&&r.reflect===!0){let i=(r.converter?.toAttribute!==void 0?r.converter:bn).toAttribute(e,r.type);this._$Em=t,i==null?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){let r=this.constructor,n=r._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let i=r.getPropertyOptions(n),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:bn;this._$Em=n;let a=s.fromAttribute(e,i.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,r,n=!1,i){if(t!==void 0){let s=this.constructor;if(n===!1&&(i=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??qi)(i,e)||r.useDefault&&r.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:i},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),i!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,i]of this._$Ep)this[n]=i;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,i]of r){let{wrapped:s}=i,a=this[n];s!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,i,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};Kt.elementStyles=[],Kt.shadowRootOptions={mode:"open"},Kt[gn("elementProperties")]=new Map,Kt[gn("finalized")]=new Map,Ip?.({ReactiveElement:Kt}),(yn.reactiveElementVersions??=[]).push("2.1.2");var _i=globalThis,mc=o=>o,Ci=_i.trustedTypes,fc=Ci?Ci.createPolicy("lit-html",{createHTML:o=>o}):void 0,ba="$lit$",Jt=`lit$${Math.random().toFixed(9).slice(2)}$`,ya="?"+Jt,_p=`<${ya}>`,ze=_i.document===void 0?{createTreeWalker:()=>({})}:document,wn=()=>ze.createComment(""),xn=o=>o===null||typeof o!="object"&&typeof o!="function",va=Array.isArray,xc=o=>va(o)||typeof o?.[Symbol.iterator]=="function",ga=`[
|
|
3
|
+
\f\r]`,vn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gc=/-->/g,bc=/>/g,Le=RegExp(`>|${ga}(?:([^\\s"'>=/]+)(${ga}*=${ga}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),yc=/'/g,vc=/"/g,qc=/^(?:script|style|textarea|title)$/i,wa=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),y=wa(1),Cn=wa(2),Tf=wa(3),tt=Symbol.for("lit-noChange"),M=Symbol.for("lit-nothing"),wc=new WeakMap,Ve=ze.createTreeWalker(ze,129);function Cc(o,t){if(!va(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return fc!==void 0?fc.createHTML(t):t}var Ec=(o,t)=>{let e=o.length-1,r=[],n,i=t===2?"<svg>":t===3?"<math>":"",s=vn;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===vn?d[1]==="!--"?s=gc:d[1]!==void 0?s=bc:d[2]!==void 0?(qc.test(d[2])&&(n=RegExp("</"+d[2],"g")),s=Le):d[3]!==void 0&&(s=Le):s===Le?d[0]===">"?(s=n??vn,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?Le:d[3]==='"'?vc:yc):s===vc||s===yc?s=Le:s===gc||s===bc?s=vn:(s=Le,n=void 0);let m=s===Le&&o[a+1].startsWith("/>")?" ":"";i+=s===vn?c+_p:h>=0?(r.push(l),c.slice(0,h)+ba+c.slice(h)+Jt+m):c+Jt+(h===-2?a:m)}return[Cc(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},qn=class o{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0,a=t.length-1,c=this.parts,[l,d]=Ec(t,e);if(this.el=o.createElement(l,r),Ve.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=Ve.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(ba)){let f=d[s++],m=n.getAttribute(h).split(Jt),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:i,name:v[2],strings:m,ctor:v[1]==="."?ki:v[1]==="?"?Si:v[1]==="@"?Ai:Fe}),n.removeAttribute(h)}else h.startsWith(Jt)&&(c.push({type:6,index:i}),n.removeAttribute(h));if(qc.test(n.tagName)){let h=n.textContent.split(Jt),f=h.length-1;if(f>0){n.textContent=Ci?Ci.emptyScript:"";for(let m=0;m<f;m++)n.append(h[m],wn()),Ve.nextNode(),c.push({type:2,index:++i});n.append(h[f],wn())}}}else if(n.nodeType===8)if(n.data===ya)c.push({type:2,index:i});else{let h=-1;for(;(h=n.data.indexOf(Jt,h+1))!==-1;)c.push({type:7,index:i}),h+=Jt.length-1}i++}}static createElement(t,e){let r=ze.createElement("template");return r.innerHTML=t,r}};function je(o,t,e=o,r){if(t===tt)return t;let n=r!==void 0?e._$Co?.[r]:e._$Cl,i=xn(t)?void 0:t._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),i===void 0?n=void 0:(n=new i(o),n._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=n:e._$Cl=n),n!==void 0&&(t=je(o,n._$AS(o,t.values),n,r)),t}var Ei=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??ze).importNode(e,!0);Ve.currentNode=n;let i=Ve.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new mr(i,i.nextSibling,this,t):c.type===1?l=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(l=new Ii(i,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(i=Ve.nextNode(),s++)}return Ve.currentNode=ze,n}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},mr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=M,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=je(this,t,e),xn(t)?t===M||t==null||t===""?(this._$AH!==M&&this._$AR(),this._$AH=M):t!==this._$AH&&t!==tt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):xc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==M&&xn(this._$AH)?this._$AA.nextSibling.data=t:this.T(ze.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=qn.createElement(Cc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{let i=new Ei(n,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=wc.get(t.strings);return e===void 0&&wc.set(t.strings,e=new qn(t)),e}k(t){va(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,n=0;for(let i of t)n===e.length?e.push(r=new o(this.O(wn()),this.O(wn()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=mc(t).nextSibling;mc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Fe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=M,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=M}_$AI(t,e=this,r,n){let i=this.strings,s=!1;if(i===void 0)t=je(this,t,e,0),s=!xn(t)||t!==this._$AH&&t!==tt,s&&(this._$AH=t);else{let a=t,c,l;for(t=i[0],c=0;c<i.length-1;c++)l=je(this,a[r+c],e,c),l===tt&&(l=this._$AH[c]),s||=!xn(l)||l!==this._$AH[c],l===M?t=M:t!==M&&(t+=(l??"")+i[c+1]),this._$AH[c]=l}s&&!n&&this.j(t)}j(t){t===M?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ki=class extends Fe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===M?void 0:t}},Si=class extends Fe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==M)}},Ai=class extends Fe{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=je(this,t,e,0)??M)===tt)return;let r=this._$AH,n=t===M&&r!==M||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==M&&(r===M||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ii=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){je(this,t)}},Z={M:ba,P:Jt,A:ya,C:1,L:Ec,R:Ei,D:xc,V:je,I:mr,H:Fe,N:Si,U:Ai,B:ki,F:Ii},Tp=_i.litHtmlPolyfillSupport;Tp?.(qn,mr),(_i.litHtmlVersions??=[]).push("3.3.3");var xa=(o,t,e)=>{let r=e?.renderBefore??t,n=r._$litPart$;if(n===void 0){let i=e?.renderBefore??null;r._$litPart$=n=new mr(t.insertBefore(wn(),i),i,void 0,e??{})}return n._$AI(o),n};var qa=globalThis,C=class extends Kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=xa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tt}};C._$litElement$=!0,C.finalized=!0,qa.litElementHydrateSupport?.({LitElement:C});var Rp=qa.litElementPolyfillSupport;Rp?.({LitElement:C});(qa.litElementVersions??=[]).push("4.2.2");var Op={attribute:!0,type:String,converter:bn,reflect:!1,hasChanged:qi},Mp=(o=Op,t,e)=>{let{kind:r,metadata:n}=e,i=globalThis.litPropertyMetadata.get(n);if(i===void 0&&globalThis.litPropertyMetadata.set(n,i=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),i.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?Mp(o,t,e):((r,n,i)=>{let s=n.hasOwnProperty(i);return n.constructor.createProperty(i,r),s?Object.getOwnPropertyDescriptor(n,i):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var pe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function fr(o,t){return(e,r,n)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:n??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return pe(e,r,{get(){let c=s.call(this);return c===void 0&&(c=i(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return pe(e,r,{get(){return i(this)}})}}function kc(o){return(t,e)=>{let{slot:r,selector:n}=o??{},i="slot"+(r?`[name=${r}]`:":not([name])");return pe(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return n===void 0?a:a.filter(c=>c.matches(n))}})}}var Ti=["this"],Sc=["+","-","!"],Ac=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Ca={"!":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},Ri=13;var Pp=["==","!=","<=",">=","||","&&","??","|>"],Dp=["===","!=="],P;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(P||(P={}));var Nt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Np=o=>o===9||o===10||o===13||o===32,Ic=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),$p=o=>Ic(o)||En(o),Lp=o=>Ti.indexOf(o)!==-1,Vp=o=>o===34||o===39,En=o=>48<=o&&o<=57,zp=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,jp=o=>o===40||o===41||o===91||o===93||o===123||o===125,Fp=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
|
|
5
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Oi=class{#t;#e=-1;#r=0;#n;constructor(t){this.#t=t,this.#i()}nextToken(){for(;Np(this.#n);)this.#i(!0);if(Vp(this.#n))return this.#a();if(Ic(this.#n))return this.#l();if(En(this.#n))return this.#h();if(this.#n===46)return this.#c();if(this.#n===44)return this.#u();if(this.#n===58)return this.#d();if(zp(this.#n))return this.#m();if(jp(this.#n))return this.#b();if(this.#i(),this.#n!==void 0)throw new Error(`Expected end of input, got ${this.#n}`)}#i(t){this.#e++,this.#e<this.#t.length?(this.#n=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#n=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#n;for(this.#i(!0);this.#n!==e;){if(this.#n===void 0)throw new Error(t);if(this.#n===92&&(this.#i(),this.#n===void 0))throw new Error(t);this.#i()}let r=Nt(P.STRING,Fp(this.#o()));return this.#i(),r}#l(){do this.#i();while($p(this.#n));let t=this.#o(),e=Lp(t)?P.KEYWORD:P.IDENTIFIER;return Nt(e,t)}#h(){do this.#i();while(En(this.#n));return this.#n===46?this.#c():Nt(P.INTEGER,this.#o())}#c(){return this.#i(),En(this.#n)?this.#p():(this.#s(),Nt(P.DOT,".",Ri))}#u(){return this.#i(!0),Nt(P.COMMA,",")}#d(){return this.#i(!0),Nt(P.COLON,":")}#p(){do this.#i();while(En(this.#n));return Nt(P.DECIMAL,this.#o())}#m(){this.#i();let t=this.#o(2);if(Dp.indexOf(t)!==-1)this.#i(),this.#i();else{if(t=this.#o(1),t==="=>")return this.#i(),Nt(P.ARROW,t);Pp.indexOf(t)!==-1&&this.#i()}return t=this.#o(),Nt(P.OPERATOR,t,Ca[t])}#b(){let t=String.fromCharCode(this.#n),e=Nt(P.GROUPER,t,Ca[t]);return this.#i(!0),e}};var Ea=(o,t)=>new kn(o,t).parse(),kn=class{#t;#e;#r;#n;#i;constructor(t,e){this.#e=new Oi(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#n?.kind} (${this.#n?.value})`);let r=this.#e.nextToken();this.#n=r,this.#t=r?.kind,this.#i=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#i!==e)}#s(){if(!this.#n)return this.#r.empty();let t=this.#c();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#n;)if(this._matches(P.GROUPER,"(")){let r=this.#y();t=this.#r.invoke(t,void 0,r)}else if(this._matches(P.GROUPER,"[")){let r=this.#q();t=this.#r.index(t,r)}else if(this._matches(P.DOT)){this.#o();let r=this.#c();t=this.#l(t,r)}else{if(this._matches(P.KEYWORD))break;if(this._matches(P.OPERATOR)&&this.#n.precedence>=e)t=this.#i==="?"?this.#u(t):this.#h(t,this.#n);else break}return t}#l(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#h(t,e){if(Ac.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#c();for(;(this.#t===P.OPERATOR||this.#t===P.DOT||this.#t===P.GROUPER)&&this.#n.precedence>e.precedence;)r=this.#a(r,this.#n.precedence);return this.#r.binary(t,e.value,r)}#c(){if(this._matches(P.OPERATOR)){let t=this.#i;if(this.#o(),t==="+"||t==="-"){if(this._matches(P.INTEGER))return this.#w(t);if(this._matches(P.DECIMAL))return this.#x(t)}if(Sc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),Ri);return this.#r.unary(t,e)}return this.#d()}#u(t){this.#o(P.OPERATOR,"?");let e=this.#s();this.#o(P.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#d(){switch(this.#t){case P.KEYWORD:let t=this.#i;if(t==="this")return this.#o(),this.#r.id(t);throw Ti.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case P.IDENTIFIER:return this.#b();case P.STRING:return this.#C();case P.INTEGER:return this.#w();case P.DECIMAL:return this.#x();case P.GROUPER:return this.#i==="("?this.#v():this.#i==="{"?this.#m():this.#i==="["?this.#p():void 0;case P.COLON:throw new Error('unexpected token ":"');default:return}}#p(){let t=[];do{if(this.#o(),this._matches(P.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(P.COMMA));return this.#o(P.GROUPER,"]"),this.#r.list(t)}#m(){let t={};do{if(this.#o(),this._matches(P.GROUPER,"}"))break;let e=this.#i;(this._matches(P.STRING)||this._matches(P.IDENTIFIER))&&this.#o(),this.#o(P.COLON),t[e]=this.#s()}while(this._matches(P.COMMA));return this.#o(P.GROUPER,"}"),this.#r.map(t)}#b(){let t=this.#i;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#f(),r=this.#y();return r?this.#r.invoke(e,void 0,r):e}#f(){if(!this._matches(P.IDENTIFIER))throw new Error(`expected identifier: ${this.#i}`);let t=this.#i;return this.#o(),this.#r.id(t)}#y(){if(!this._matches(P.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(P.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(P.COMMA));return this.#o(P.GROUPER,")"),t}#q(){this.#o();let t=this.#s();return this.#o(P.GROUPER,"]"),t}#v(){let t=this.#y();if(this._matches(P.ARROW)){this.#o();let e=this.#s(),r=t?.map(n=>n.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#C(){let t=this.#r.literal(this.#i);return this.#o(),t}#w(t=""){let e=this.#r.literal(parseInt(`${t}${this.#i}`,10));return this.#o(),e}#x(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#i}`));return this.#o(),e}};var{hasOwn:_c,fromEntries:Bp}=Object,Up={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Hp={"+":o=>o,"-":o=>-o,"!":o=>!o},Mi=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Hp[t];return{type:"Unary",operator:t,child:e,evaluate(n){return r(this.child.evaluate(n))},getIds(n){return this.child.getIds(n)}}}binary(t,e,r){let n=Up[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(i){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(i),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(i),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(i),c=this.left.argument.evaluate(i)):this.left.type==="ID"&&(a=i,c=this.left.value),a===void 0?void 0:a[c]=s}return n(this.left.evaluate(i),this.right.evaluate(i))},getIds(i){return this.left.getIds(i),this.right.getIds(i),i}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(n){let i=this.receiver.evaluate(n),s=this.method?i:n?.this??n,a=this.method?i?.[e]:i,l=(this.arguments??[]).map(d=>d?.evaluate(n));return a?.apply?.(s,l)},getIds(n){return this.receiver.getIds(n),this.arguments?.forEach(i=>i?.getIds(n)),n}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(n){return this.condition.evaluate(n)?this.trueExpr.evaluate(n):this.falseExpr.evaluate(n)},getIds(n){return this.condition.getIds(n),this.trueExpr.getIds(n),this.falseExpr.getIds(n),n}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let n in t){let i=this.entries[n];i&&(r[n]=i.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let n=this.entries[r];n&&n.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let n=this.params,i=this.body;return function(...s){let a=Bp(n.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return _c(a,d)&&(a[d]=h),l[d]=h},get(l,d){return _c(a,d)?a[d]:l[d]}});return i.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(n=>!this.params.includes(n))}}}};var ka=null,Tc={boundAttributeSuffix:Z.M,marker:Z.P,markerMatch:Z.A,HTML_RESULT:Z.C,getTemplateHtml:Z.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){ka??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(ka))return void(e[ka]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=tt;return o.j=n=>r=n,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:Z.V,AttributePart:Z.H,PropertyPart:Z.B,BooleanAttributePart:Z.N,EventPart:Z.U,ElementPart:Z.F,TemplateInstance:Z.R,isIterable:Z.D,ChildPart:Z.I};var{AttributePart:Wp,PropertyPart:Qp,BooleanAttributePart:Gp,EventPart:Xp}=Tc,Aa=new Mi,Sa=new Map,Rc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Pi=(o,t)=>{let e=Sa.get(o);if(e===void 0){if(Sa.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new kn(r,Aa).parse(),Sa.set(o,e)}}return e?.evaluate(t)},Yp=(o,t,e,r)=>{let n=o.getAttribute("if");if(n!==null&&Pi(n,t))return Di(o,t,e,r)},Oc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Mc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Sn=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Kp=(o,t,e,r)=>{let n=o.getAttribute("repeat");if(n!==null){let i=Pi(n,t);if(!i[Symbol.iterator])return M;let s=An(o),a=-1,c=[];for(let l of i){a++;let d=Object.create(t);d.item=l,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let v=m.update(d,e,r);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};c.push(f)}return c}},Dc={if:Yp,repeat:Kp},pt=(o,t=Dc,e={},r)=>{let i=An(o).renderers;if(r){let a=An(r).renderers,c=i.super;c!==void 0?e={...i,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,v)=>Di(r,f,m,v)},c(l,d,h))}:(e={...a,...i,...e},o=r)}else e={...i,...e};return s=>Di(o,s,t,e)};var Di=(o,t,e=Dc,r={})=>{let n=An(o),i=[];for(let a of n.parts){let c=a.update(t,e,r);a.type===1?i.push(...c):i.push(c)}return{_$litType$:n,values:i}},Pc=new Map,An=o=>{let t=Pc.get(o);return t===void 0&&Pc.set(o,t=Jp(o)),t},Jp=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,n=-1,i=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)n++;else if(r.nodeType===Node.ELEMENT_NODE){n++;let s=r;if(s.tagName==="TEMPLATE"){let c=s.getAttribute("type"),l=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||c!==null||l!==null){s.parentNode.insertBefore(document.createComment(""),s),i.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Pi(g,v);return(m?Pi(f,v):u[d])?.(b,x,u)}}else c!==null?h=(f,m,v)=>{let x=m[c];return x?.(s,f,m,v)}:(l==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=An(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[l]=(f,m,v)=>Di(s,f,m,v),h=(f,m,v)=>{let x=v[l];return x?.(f,m,v)});t.parts.push({type:2,index:n,update:h});continue}}let a=s.getAttributeNames();for(let c of a){let l=s.getAttribute(c),d=l.split(Oc);if(d.length===1){Mc(l)&&s.setAttribute(c,Sn(l));continue}s.removeAttribute(c);let h=c,f=Wp,m=c[0];m==="."?(h=Rc(c.substring(1)),f=Qp):m==="?"?(h=c.substring(1),f=Gp):m==="@"&&(h=Rc(c.substring(1)),f=Xp);let v=[Sn(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ea(g,Aa)),v.push(Sn(d[u+1]))}t.parts.push({type:1,index:n,name:h,strings:v,ctor:f,update:(u,g,b)=>x.map(w=>w.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(Oc);c.length>1?s.textContent=Sn(c[0]):Mc(a)&&(s.textContent=Sn(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=Ea(d,Aa);t.parts.push({type:2,index:++n,update:(m,v)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of i)s.remove();return t};var gr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Nc={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},$t=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let n=Number(e.getAttribute("value"));if(Number.isNaN(n)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,n)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}#t(){let t=this.closest("qti-test");if(t)return t;let e=this.getRootNode();for(;e instanceof ShadowRoot;){let r=e.host.closest("qti-test");if(r)return r;e=e.host.getRootNode()}return null}async connectedCallback(){super.connectedCallback();let t=this.#t()?.querySelector("template[item-ref]");this.myTemplate=t?pt(t):null,this.requestUpdate(),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(){if(!this.xmlDoc)return M;let t=this.xmlDoc.cloneNode(!0);if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,itemRef:this};return this.myTemplate(e)}};gr([p({type:String})],$t.prototype,"category",void 0);gr([p({type:String})],$t.prototype,"identifier",void 0);gr([p({type:Boolean,converter:Nc})],$t.prototype,"required",void 0);gr([p({type:Boolean,converter:Nc})],$t.prototype,"fixed",void 0);gr([p({type:String})],$t.prototype,"href",void 0);gr([p({type:Object,attribute:!1})],$t.prototype,"xmlDoc",void 0);var ue=class extends Event{constructor(t,e,r,n){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=n??!1}};var br=class{constructor(t,e,r,n){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(i,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=i,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(i,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let i=e;this.context=i.context,this.callback=i.callback,this.subscribe=i.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=n??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ue(this.context,this.host,this.t,this.subscribe))}};var Ni=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:n}=this.subscriptions.get(t);t(this.value,n)}clearCallbacks(){this.subscriptions.clear()}};var Ia=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},yr=class extends Ni{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{if(n.context!==this.context)return;let i=n.contextTarget??n.composedPath()[0];i!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,i,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;let i=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)i.has(s)||(i.add(s),a.dispatchEvent(new ue(this.context,a,s,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ia(this.context,this.host))}};function B({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(n){return r.get(this).setValue(n),t.set.call(this,n)},init(n){return r.set(this,new yr(this,{context:o,initialValue:n})),n}};{t.constructor.addInitializer((s=>{r.set(s,new yr(s,{context:o}))}));let n=Object.getOwnPropertyDescriptor(t,e),i;if(n===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=n.set;i={...n,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function _({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new br(this,{context:o,callback:n=>{e.set.call(this,n)},subscribe:t})})):e.constructor.addInitializer((n=>{new br(n,{context:o,callback:i=>{n[r]=i},subscribe:t})}))}}var $c=[];var Ta=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},_a="custom-state-support-probe";function Zp(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(_a)||customElements.define(_a,class extends HTMLElement{});let t=o.call(document.createElement(_a)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Lc=!1;function Vc(){if(Lc)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Zp(o);return t==="modern"||(Lc=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Ta(this)}),r}),t}Vc();for(let{tag:o,ctor:t}of $c)customElements.get(o)||customElements.define(o,t);var me=Symbol("computedItemContext");var z=Symbol("computedContext");var ut=Symbol("configContext");var vr=Symbol("interactionContext");var j=Symbol("item");var zc=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var tu=/^[A-Za-z0-9-]+$/,eu=o=>typeof o=="string"&&tu.test(o),kb=o=>eu(o)?o:void 0,mt=Symbol("qtiContext");var Ra={view:"candidate"},Vt=Symbol("testContext");var Oa={items:[],testOutcomeVariables:[]},ot=Symbol("testContext");var O=q`
|
|
5
6
|
:host {
|
|
6
7
|
box-sizing: border-box;
|
|
7
8
|
}
|
|
@@ -11,7 +12,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
11
12
|
*::after {
|
|
12
13
|
box-sizing: inherit;
|
|
13
14
|
}
|
|
14
|
-
`;var
|
|
15
|
+
`;var zt=q`
|
|
15
16
|
[part~='drop'] {
|
|
16
17
|
/*
|
|
17
18
|
* The one deliberate opt-out from the border-box reset.
|
|
@@ -55,20 +56,19 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
55
56
|
[part~='message'] {
|
|
56
57
|
display: none;
|
|
57
58
|
}
|
|
58
|
-
`;var
|
|
59
|
+
`;var Be=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},D=class extends C{#t;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}reportValidity(){let t=this._internals.validity.valid,e=this.validationDisplayMode;return(e==="native"||e==="both")&&this._internals.reportValidity(),e==="inline"||e==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),e==="none"&&this.clearInlineValidationMessage(),t}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#t||(this.#t=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,n){let i=r??this;this._internals.setValidity(t?{}:{customError:!0},e,i),n?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}constructor(){super(),this.#t=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals()}firstUpdated(t){}};Be([_({context:j,subscribe:!0})],D.prototype,"_context",void 0);Be([_({context:ut,subscribe:!0})],D.prototype,"configContext",void 0);Be([B({context:vr})],D.prototype,"_interactionContext",void 0);Be([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Be([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Be([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Be([p({type:String})],D.prototype,"name",void 0);var wr=class extends C{render(){return y`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(n=>n.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var Pa=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ma=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??jc(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??jc(o),value:String(o),cardinality:"single",type:"response"},jc=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",ru=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},S=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let n=e.getResult();return n?.length>0?n:null}case"qti-custom-operator":return Ma(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",n=this.context?.variables?.find(i=>i.identifier===r);return n?{baseType:n.baseType,value:n.correctResponse,cardinality:n.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),Ma(null))}default:{try{let r=e,n=r.getResult();return Ma(n,r.resultBaseType??ru(r,n))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=q`
|
|
59
60
|
slot {
|
|
60
61
|
display: none;
|
|
61
62
|
}
|
|
62
|
-
`}render(){return b`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
63
|
-
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??null}};Io([_()],A.prototype,"result",void 0);Io([T({context:j,subscribe:!0}),_()],A.prototype,"context",void 0);Io([T({context:ut,subscribe:!0}),_()],A.prototype,"qtiContext",void 0);Io([T({context:ot,subscribe:!0}),_()],A.prototype,"_testContext",void 0);var mt=class extends A{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var hp=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ct=n=>{if(typeof n=="string")return n;let t=hp();return t==="."?n.toLocaleString():n.toString().replace(".","").replace(t,".")};function va(n){return n==null}function _o(n){return n.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var wr=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},nt=class extends C{constructor(){super(...arguments),this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!va(this.identifier)&&!va(e?.value)&&this.identifier===e.value||!1,this.#t(r)}#t(t){if(!this.#e()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#e(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(i=>i.identifier==="numAttempts")?.value)||0)<e}};wr([p({type:String,attribute:"show-hide"})],nt.prototype,"showHide",void 0);wr([p({type:String,attribute:"outcome-identifier"})],nt.prototype,"outcomeIdentifier",void 0);wr([p({type:String})],nt.prototype,"identifier",void 0);wr([p({type:String,attribute:!1})],nt.prototype,"showStatus",void 0);wr([T({context:j,subscribe:!0}),_()],nt.prototype,"_context",void 0);wr([T({context:z,subscribe:!0}),_()],nt.prototype,"_computedContext",void 0);function wa(n){if(n==null)return null;if(!n.includes(",")){let e=n.trim();return e.length>0?e:null}let t=n.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function xa(n){if(n==null)return null;if(Array.isArray(n)){let e=n.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=n.trim();return t.length>0?t:null}function*lb(n){if(n!=null){if(Array.isArray(n)){for(let t of n){let e=t.trim();e&&(yield e)}return}if(!n.includes(",")){let t=n.trim();t&&(yield t);return}for(let t of n.split(",")){let e=t.trim();e&&(yield e)}}}function db(n){let[t,e,...r]=n.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${n}" (expected "source target")`);return{source:t,target:e}}function hb(n,t){return`${n} ${t}`}function pb(n){let[t,e,...r]=n.trim().split(/\s+/),i=Number(t),o=Number(e);if(!Number.isFinite(i)||!Number.isFinite(o)||r.length>0)throw new Error(`malformed point value: "${n}" (expected "x y" numeric coords)`);return{x:i,y:o}}function ub(n,t){return`${n} ${t}`}function zt(n){let{emptyAs:t}=n,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=wa(r);return i===null?t:i},toAttribute:r=>e(r)?null:xa(r)}}var gl=class extends C{};var J=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,o]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"circle":case"default":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(o-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&o>=d&&o<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,w=(o-d)**2/f**2;return m+w<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:o},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i].x,a=e[i].y,l=e[o].x,c=e[o].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var fe=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},qa={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},ft=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};fe([p({type:String})],ft.prototype,"identifier",void 0);fe([p({type:String})],ft.prototype,"required",void 0);fe([p({type:Boolean,converter:qa})],ft.prototype,"fixed",void 0);fe([p({type:Boolean,converter:qa})],ft.prototype,"visible",void 0);fe([p({type:Boolean,converter:qa,attribute:"keep-together"})],ft.prototype,"keepTogether",void 0);fe([p({type:String,attribute:"navigation-mode"})],ft.prototype,"navigationMode",void 0);fe([p({type:String,attribute:"submission-mode"})],ft.prototype,"submissionMode",void 0);fe([T({context:ot,subscribe:!0})],ft.prototype,"_testContext",void 0);var Ca=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Be=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Ca([p({type:String})],Be.prototype,"identifier",void 0);Ca([p({type:String})],Be.prototype,"title",null);Ca([T({context:ot,subscribe:!0})],Be.prototype,"_testContext",void 0);var Ue=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},xr={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},kt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};Ue([p({type:Number,attribute:"max-attempts"})],kt.prototype,"maxAttempts",void 0);Ue([p({type:Boolean,converter:xr,attribute:"show-feedback"})],kt.prototype,"showFeedback",void 0);Ue([p({type:Boolean,converter:xr,attribute:"allow-review"})],kt.prototype,"allowReview",void 0);Ue([p({type:Boolean,converter:xr,attribute:"show-solution"})],kt.prototype,"showSolution",void 0);Ue([p({type:Boolean,converter:xr,attribute:"allow-comment"})],kt.prototype,"allowComment",void 0);Ue([p({type:Boolean,converter:xr,attribute:"allow-skipping"})],kt.prototype,"allowSkipping",void 0);Ue([p({type:Boolean,converter:xr,attribute:"validate-responses"})],kt.prototype,"validateResponses",void 0);var To=class extends C{static{this.styles=[q`
|
|
63
|
+
`}render(){return y`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??null}};Pa([_({context:j,subscribe:!0})],S.prototype,"context",void 0);Pa([_({context:mt,subscribe:!0})],S.prototype,"qtiContext",void 0);Pa([_({context:ot,subscribe:!0})],S.prototype,"_testContext",void 0);var jt=class extends S{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ty=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ct=o=>typeof o=="string"?o:o.toString();function Da(o){return o==null}function $i(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var xr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},st=class extends C{constructor(){super(...arguments),this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this._context.variables.find(n=>n.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Da(this.identifier)&&!Da(e?.value)&&this.identifier===e.value||!1,this.#t(r)}#t(t){if(!this.#e()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#e(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(n=>n.active)?.sections.flatMap(n=>n.items).find(n=>n.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(n=>n.identifier==="numAttempts")?.value)||0)<e}};xr([p({type:String,attribute:"show-hide"})],st.prototype,"showHide",void 0);xr([p({type:String,attribute:"outcome-identifier"})],st.prototype,"outcomeIdentifier",void 0);xr([p({type:String})],st.prototype,"identifier",void 0);xr([p({type:String,attribute:!1})],st.prototype,"showStatus",void 0);xr([_({context:j,subscribe:!0}),T()],st.prototype,"_context",void 0);xr([_({context:z,subscribe:!0}),T()],st.prototype,"_computedContext",void 0);function Na(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function $a(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*cy(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function dy(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function hy(o,t){return`${o} ${t}`}function py(o){let[t,e,...r]=o.trim().split(/\s+/),n=Number(t),i=Number(e);if(!Number.isFinite(n)||!Number.isFinite(i)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:n,y:i}}function uy(o,t){return`${o} ${t}`}function Ft(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let n=Na(r);return n===null?t:n},toAttribute:r=>e(r)?null:$a(r)}}var Fc=class extends C{},qr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Cr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var nu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},La=o=>t=>{let e=nu(t);return e===null?null:o(e)},iu=["depcp","questify","qade"],ou={Trim:La(o=>o.trim()),ToAscii:La(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:La(o=>o.replace(",","."))},su=new Map(iu.flatMap(o=>Object.entries(ou).map(([t,e])=>[`${o}:${t}`,e]))),Va=new Map,by=(o,t)=>{Va.set(o,t)},yy=o=>{Va.delete(o)},Bc=o=>Va.get(o)??su.get(o)??null;var G=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[n,i]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((n-l)**2+(i-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):n>=l&&n<=h&&i>=d&&i<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(n-l)**2/h**2,v=(i-d)**2/f**2;return m+v<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:n,y:i},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let s=e[n].x,a=e[n].y,c=e[i].x,l=e[i].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let n=parseInt(t,10),i=parseInt(e,10);if(!isNaN(n)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:n===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let n=parseFloat(t),i=parseFloat(e);if(!isNaN(n)&&!isNaN(i))return n===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let n=t.split(" "),i=e.split(" ");if(n.length===2&&i.length===2)return r==="pair"&&(n.sort(),i.sort()),n.join(" ")===i.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var fe=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},za={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},ft=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return y`<slot name="qti-rubric-block"></slot><slot></slot>`}};fe([p({type:String})],ft.prototype,"identifier",void 0);fe([p({type:String})],ft.prototype,"required",void 0);fe([p({type:Boolean,converter:za})],ft.prototype,"fixed",void 0);fe([p({type:Boolean,converter:za})],ft.prototype,"visible",void 0);fe([p({type:Boolean,converter:za,attribute:"keep-together"})],ft.prototype,"keepTogether",void 0);fe([p({type:String,attribute:"navigation-mode"})],ft.prototype,"navigationMode",void 0);fe([p({type:String,attribute:"submission-mode"})],ft.prototype,"submissionMode",void 0);fe([_({context:ot,subscribe:!0})],ft.prototype,"_testContext",void 0);var ja=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ue=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return y` <slot></slot>`}};ja([p({type:String})],Ue.prototype,"identifier",void 0);ja([p({type:String})],Ue.prototype,"title",null);ja([_({context:ot,subscribe:!0})],Ue.prototype,"_testContext",void 0);var He=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Er={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Et=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return y`<slot></slot>`}};He([p({type:Number,attribute:"max-attempts"})],Et.prototype,"maxAttempts",void 0);He([p({type:Boolean,converter:Er,attribute:"show-feedback"})],Et.prototype,"showFeedback",void 0);He([p({type:Boolean,converter:Er,attribute:"allow-review"})],Et.prototype,"allowReview",void 0);He([p({type:Boolean,converter:Er,attribute:"show-solution"})],Et.prototype,"showSolution",void 0);He([p({type:Boolean,converter:Er,attribute:"allow-comment"})],Et.prototype,"allowComment",void 0);He([p({type:Boolean,converter:Er,attribute:"allow-skipping"})],Et.prototype,"allowSkipping",void 0);He([p({type:Boolean,converter:Er,attribute:"validate-responses"})],Et.prototype,"validateResponses",void 0);var Fa=o=>o?.split(/\s+/).filter(Boolean)??[],Li=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:Fa(o.getAttribute("include-category")),excludeCategories:Fa(o.getAttribute("exclude-category"))}),Vi=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let n=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return n.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):n.flatMap(i=>Array.from(i.querySelectorAll("qti-assessment-item-ref"))).filter(i=>{let s=Fa(i.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var zi=class extends S{#t=null;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Vi(t,Li(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var ji=class extends C{static{this.styles=[q`
|
|
64
64
|
:host {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
`]}render(){return b`<slot></slot>`}process(){let t=new ka,e=[...this.children];t.process(e)}},ka=class{process(t){for(let e of t)e.process()}};function $(n,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:o}=r,s=Array.isArray(n)?n:[n];r.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),o.call(this,a)}}}var qr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Et=n=>(...t)=>({_$litDirective$:n,values:t}),ge=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:pp}=K,bl=n=>n,vl=n=>n===null||typeof n!="object"&&typeof n!="function";var wl=n=>n.strings===void 0,yl=()=>document.createComment(""),Cr=(n,t,e)=>{let r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(yl(),i),s=r.insertBefore(yl(),i);e=new pp(o,s,n,n.options)}else{let o=e._$AB.nextSibling,s=e._$AM,a=s!==n;if(a){let l;e._$AQ?.(n),e._$AM=n,e._$AP!==void 0&&(l=n._$AU)!==s._$AU&&e._$AP(l)}if(o!==i||a){let l=e._$AA;for(;l!==o;){let c=bl(l).nextSibling;bl(r).insertBefore(l,i),l=c}}}return e},be=(n,t,e=n)=>(n._$AI(t,e),n),up={},xl=(n,t=up)=>n._$AH=t,ql=n=>n._$AH,Ro=n=>{n._$AR(),n._$AA.remove()};var wi=(n,t)=>{let e=n._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),wi(r,t);return!0},Oo=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while(e?.size===0)},Cl=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),gp(t)}};function mp(n){this._$AN!==void 0?(Oo(this),this._$AM=n,Cl(this)):this._$AM=n}function fp(n,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)wi(r[o],!1),Oo(r[o]);else r!=null&&(wi(r,!1),Oo(r));else wi(this,n)}var gp=n=>{n.type==qr.CHILD&&(n._$AP??=fp,n._$AQ??=mp)},ye=class extends ge{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Cl(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(wi(this,t),Oo(this))}setValue(t){if(wl(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ea=class extends ye{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let o in e){let s=e[o];s!==r[o]&&(s===!0?i.setAttribute(o,""):s===!1?i.removeAttribute(o):s!=null?i.setAttribute(o,String(s)):i.removeAttribute(o))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let o in e)(!i||!(o in i))&&r.removeAttribute(o)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},_y=Et(Ea);var Zt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},rt=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._handleDisabledChange=(t,e)=>{this.interactionElements.forEach(r=>r.disabled=e)},this._handleReadonlyChange=(t,e)=>this.interactionElements.forEach(r=>r.readonly=e),this._context={variables:fl},this.#r={...this._context,variables:this._context.variables},this.#i=[],this.interactionElements=[],this.#s=t=>{t.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,t.detail.variable]},this.#r=this._context,t.stopPropagation()},this.#a=t=>{t.stopImmediatePropagation();let e=t.detail;this.#i.push(e),(Number(this._context.variables.find(i=>i.identifier==="numAttempts")?.value)||0)>0&&e.checkShowFeedback(e.outcomeIdentifier)},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(r)},this.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(e=>!("identifier"in e))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(e=>{let r=t.find(i=>i.identifier===e.identifier);return r?{...e,...r,interpolationTable:e.interpolationTable}:e})},this._context.variables.forEach(e=>{if(e.type==="response"){let r=this.interactionElements.find(i=>i.responseIdentifier===e.identifier);r&&(r.response=e.value)}}),this.variables.forEach(e=>{e.type==="outcome"&&this.#i.forEach(r=>r.checkShowFeedback(e.identifier))})}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(o=>o.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#n(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#l),this.addEventListener("qti-set-template-value",this.#u),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#p)}#n(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#l),this.removeEventListener("qti-set-template-value",this.#u),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#p)}#s;#a;#c;#h;#l;#u;#d;#p;async#m(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){this.validate(e),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(o=>o.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),i=!!(r&&typeof r.process=="function");return i&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),i}resetResponses(){this._context=this.#r}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b())}updateTemplateVariable(t,e){let r=this._context.variables.find(o=>o.identifier===t&&o.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){let r=this.getOutcome(t);if(!r){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},this.#i.forEach(i=>i.checkShowFeedback(t)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(i=>i.identifier===t)?.value}}))}validate(t=!0){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}#b(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#f(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let i=("defaultValue"in t?t.defaultValue:null)??null;return i==null&&(t.baseType==="integer"||t.baseType==="float")&&(i="0"),{...t,value:i}})}}};Zt([p({type:String})],rt.prototype,"identifier",void 0);Zt([p({type:String})],rt.prototype,"adaptive",void 0);Zt([p({type:String})],rt.prototype,"timeDependent",void 0);Zt([p({type:String})],rt.prototype,"title",null);Zt([p({type:Boolean})],rt.prototype,"disabled",void 0);Zt([$("disabled",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDisabledChange",void 0);Zt([p({type:Boolean})],rt.prototype,"readonly",void 0);Zt([$("readonly",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleReadonlyChange",void 0);Zt([B({context:j})],rt.prototype,"_context",void 0);function kl(n){n.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function El(n,t,e,r="qti-portable-custom-interaction"){let i=[],o=n.querySelectorAll(r);if(o.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(o)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),w=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of w){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let v=a.paths[u];Array.isArray(v)?x.setAttribute("fallback-path",v[0]):x.setAttribute("fallback-path",v)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=n.createElement("qti-interaction-module");g.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let v=a.paths[x];Array.isArray(v)?g.setAttribute("fallback-path",v[0]):g.setAttribute("fallback-path",v)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=n.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],w="";a&&a.paths&&a.paths[f]&&(w=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(w)?w:[w],g=x.map((y,v)=>{let I=u.length>v?u[v]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(v=>v.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let v=n.createElement("qti-interaction-module");y.fallbackPath&&v.setAttribute("fallback-path",y.fallbackPath),v.setAttribute("id",f),v.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(v)}}}}}function Sl(n,t,e){Array.from(n.getElementsByTagName("*")).filter(o=>o.localName===t||o.localName?.toLowerCase()===t.toLowerCase()).forEach(o=>{let s=`${t}-${e}`,a=Il(o,s);o.replaceWith(a)})}function Al(n,t){n.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let o=i.slice(`${t}:`.length),s=`${e.nodeName}-${o}`,a=Il(e,s);e.replaceWith(a)}})})}function Il(n,t){let e=n.ownerDocument.createElement(t);for(let r of n.attributes)e.setAttribute(r.name,r.value);for(;n.firstChild;)e.appendChild(n.firstChild);return e}function _l(n,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)n.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Sa=class n{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=yp(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new n(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new n(e)}static fromSeedKey(t){let e=new n(new Uint8Array);return e.#t=bp(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function Po(n){return Sa.fromSeedKey(n)}function bp(n){let t=1779033703^n.length;for(let e=0;e<n.length;e++)t=Math.imul(t^n.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Tl(t)}function yp(n){let t=1779033703^n.length;for(let e=0;e<n.length;e++)t=Math.imul(t^n[e],3432918353),t=t<<13|t>>>19;return Tl(t)}function Tl(n){let t=Math.imul(n^n>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var vp=n=>typeof n=="function"?n():n.random();function Mo(n,t){let e=n.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let o=Math.floor(vp(t)*(i+1));[e[i],e[o]]=[e[o],e[i]]}let r=0;return n.map(i=>i.fixed?i:e[r++])}function wp(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}}function Aa(n,t){let e=n.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,o=n.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=wp(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let w=i?Po(`${t}:${o}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(v=>v.parentElement!==null);if(x.filter(v=>v.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(v=>v.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,y=Mo(x.map(v=>({element:v,fixed:v.getAttribute("fixed")==="true"})),w);for(let v of x)v.remove();for(let{element:v}of y)u.insertBefore(v,g);h=!0}h&&a.removeAttribute("shuffle")}}function Rl(n){n.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Ol=!1;function Do(n,t){Ol||(Ol=!0,console.warn(`[${n}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function kr(n,t){return fetch(n,{signal:t}).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 Er(n){return new DOMParser().parseFromString(n,"text/xml")}function Pl(n,t,e){if(n.nodeType===Node.ELEMENT_NODE){let r=n,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let o=0;o<r.attributes.length;o++){let s=r.attributes[o];i.setAttribute(s.localName,s.value)}for(let o=0;o<r.childNodes.length;o++)i.appendChild(Pl(r.childNodes[o],t,e));return i}return n.cloneNode(!1)}function Sr(n,t){let e=document.createDocumentFragment();for(let r=0;r<n.childNodes.length;r++)e.appendChild(Pl(n.childNodes[r],document,t));return e}function Ar(n,t){t.endsWith("/")||(t+="/"),n.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let o=r.getAttribute(i)?.trim();if(o&&!/^(data:|https?:|blob:)/.test(o)){let s=t+encodeURI(o);r.setAttribute(i,s)}}})}var jt=()=>{let n,t="",e={load(r,i){return t=r,kr(r,i).then(o=>(n=o,e))},parse(r){return n=Er(r),t="",e},path:r=>(Ar(n,r),t=null,e),fn(r){return r(n),e},pciHooks(r){return _l(n,r),e},async configurePci(r,i,o="qti-portable-custom-interaction"){return await El(n,r,i,o),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=t||"default-item-seed";return Do("qtiTransformItem",o),Aa(n,o),e}return Aa(n,i),e},extendElementName:(r,i)=>(Sl(n,r,i),e),extendElementsWithClass:(r="extend")=>(Al(n,r),e),customInteraction(r,i){let o=n.querySelector("qti-custom-interaction"),s=o.querySelector("object");return o.setAttribute("data-base-ref",r),o.setAttribute("data-base-item",r+i),o.setAttribute("data",s.getAttribute("data")),o.setAttribute("width",s.getAttribute("width")),o.setAttribute("height",s.getAttribute("height")),o.removeChild(s),e},convertCDATAtoComment(){return kl(n),e},stripStyleSheets(){return Rl(n),e},html(){return t!==null&&Ar(n,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Sr(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return t!==null&&Ar(n,t.substring(0,t.lastIndexOf("/"))),Sr(n,r)},xmlDoc(){return n}};return e};var Ml=()=>{let n,t={async load(e,r){return n=await kr(e,r),t},parse(e){n=Er(e)},assessmentTest(){let e=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Dl(n){let t=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var No=(n,...t)=>t.includes(n.localName)||t.includes(n.localName?.toLowerCase?.()),Nl=n=>No(n,"qti-assessment-item-ref","assessmentitemref"),qi=n=>No(n,"qti-assessment-section","assessmentsection"),xi=(n,...t)=>t.some(e=>{let r=(n.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),xp=(n,...t)=>t.some(e=>{let r=(n.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),Ia=n=>No(n,"qti-ordering","ordering"),qp=n=>No(n,"qti-selection","selection"),Cp=n=>Array.from(n.children).filter(t=>Ia(t)&&xi(t,"shuffle")),kp=(n,t)=>Po(`${n}:${t}`);function Ep(n){let t=[],e=[],r=i=>{for(let o of Array.from(i.children))Nl(o)?t.push(o):qi(o)?r(o):!Ia(o)&&!qp(o)&&e.push(o.localName)};return r(n),{itemRefs:t,dropped:e}}function Sp(n,t){if(t.length===0)return;let e=n.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function $l(n,t){for(let l of Array.from(n.children))qi(l)&&$l(l,t);let e=Cp(n);if(e.length===0)return;let r=[],i=[];for(let l of Array.from(n.children))if(Nl(l))r.push({nodes:[l],fixed:xi(l,"fixed")}),i.push(l);else if(qi(l)){let{itemRefs:c,dropped:d}=Ep(l);if(Sp(l,d),xp(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:xi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:xi(l,"fixed")});i.push(l)}let o=i.length>0?i[i.length-1].nextSibling:null,s=n.getAttribute("identifier")??"",a=Mo(r,kp(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)n.insertBefore(c,o);for(let l of e)l.remove()}function Ll(n){return Array.from(n.getElementsByTagName("*")).some(t=>Ia(t)&&xi(t,"shuffle"))}function _a(n,t){let e=Array.from(n.getElementsByTagName("*")).filter(r=>qi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&qi(i)||$l(r,t)}}var Ir=()=>{let n,t="",e={async load(r,i){return n=await kr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return n=Er(r),t="",e},path:r=>(Ar(n,r),e),fn(r){return r(n),e},shuffleOrdering(r){if(!Ll(n))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=t||"default-test-seed";return Do("qtiTransformTest",o),_a(n,o),e}return _a(n,i),e},items(){return Dl(n)},html(){return new XMLSerializer().serializeToString(Sr(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return Sr(n,r)},xmlDoc(){return n}};return e};var Vl=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ta=class n extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(n.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},_r=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Ta(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let e=await jt().load(this.href).then(r=>r.htmlDoc());if(e){let r=e.querySelectorAll("qti-stimulus-body, qti-stylesheet");t.innerHTML="",t.append(...r)}}};Vl([p({type:String})],_r.prototype,"identifier",void 0);Vl([p({type:String})],_r.prototype,"href",void 0);var $o=class extends C{};var Ap=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ci=class extends C{render(){return b`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let o=i;o.mathVariable!==!0||o.value===null||o.value===void 0||t.set(o.identifier,this.#e(o.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let o=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(o);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",o);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",o),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Ap([T({context:j,subscribe:!0}),_()],Ci.prototype,"context",void 0);var zl=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Tr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
67
|
+
`]}render(){return y`<slot></slot>`}process(){let t=new Ba,e=[...this.children];t.process(e)}},Ba=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Cr))throw e}}};function $(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,n)=>{let{update:i}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(c=>{let l=c;if(a.has(l)){let d=a.get(l),h=this[l];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[n](d,h)}}),i.call(this,a)}}}var kr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},kt=o=>(...t)=>({_$litDirective$:o,values:t}),ge=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:au}=Z,Uc=o=>o,Wc=o=>o===null||typeof o!="object"&&typeof o!="function";var Qc=o=>o.strings===void 0,Hc=()=>document.createComment(""),Sr=(o,t,e)=>{let r=o._$AA.parentNode,n=t===void 0?o._$AB:t._$AA;if(e===void 0){let i=r.insertBefore(Hc(),n),s=r.insertBefore(Hc(),n);e=new au(i,s,o,o.options)}else{let i=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==s._$AU&&e._$AP(c)}if(i!==n||a){let c=e._$AA;for(;c!==i;){let l=Uc(c).nextSibling;Uc(r).insertBefore(c,n),c=l}}}return e},be=(o,t,e=o)=>(o._$AI(t,e),o),lu={},Gc=(o,t=lu)=>o._$AH=t,Xc=o=>o._$AH,Fi=o=>{o._$AR(),o._$AA.remove()};var In=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),In(r,t);return!0},Bi=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Yc=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),hu(t)}};function cu(o){this._$AN!==void 0?(Bi(this),this._$AM=o,Yc(this)):this._$AM=o}function du(o,t=!1,e=0){let r=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)In(r[i],!1),Bi(r[i]);else r!=null&&(In(r,!1),Bi(r));else In(this,o)}var hu=o=>{o.type==kr.CHILD&&(o._$AP??=du,o._$AQ??=cu)},ye=class extends ge{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Yc(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(In(this,t),Bi(this))}setValue(t){if(Qc(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ua=class extends ye{constructor(){super(...arguments),this.prevData={}}render(t){return M}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},M}apply(t){let e=this.#t(t),{prevData:r,element:n}=this;for(let i in e){let s=e[i];s!==r[i]&&(s===!0?n.setAttribute(i,""):s===!1?n.removeAttribute(i):s!=null?n.setAttribute(i,String(s)):n.removeAttribute(i))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let n=t?this.#t(t):{};for(let i in e)(!n||!(i in n))&&r.removeAttribute(i)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},Lv=kt(Ua);var Zt=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},nt=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._handleDisabledChange=(t,e)=>{this.interactionElements.forEach(r=>r.disabled=e)},this._handleReadonlyChange=(t,e)=>this.interactionElements.forEach(r=>r.readonly=e),this._context={variables:zc},this.#r={...this._context,variables:this._context.variables},this.#n=[],this.interactionElements=[],this.#s=t=>{t.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,t.detail.variable]},this.#r=this._context,t.stopPropagation()},this.#a=t=>{t.stopImmediatePropagation();let e=t.detail;this.#n.push(e),(Number(this._context.variables.find(n=>n.identifier==="numAttempts")?.value)||0)>0&&e.checkShowFeedback(e.outcomeIdentifier)},this.#l=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(r)},this.#c=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:n}=t.detail;this.updateResponseVariable(e,r),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:n}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(e=>!("identifier"in e))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(e=>{let r=t.find(n=>n.identifier===e.identifier);return r?{...e,...r,interpolationTable:e.interpolationTable,matchTable:e.matchTable}:e})},this._context.variables.forEach(e=>{if(e.type==="response"){let r=this.interactionElements.find(n=>n.responseIdentifier===e.identifier);r&&(r.response=e.value)}}),this.variables.forEach(e=>{e.type==="outcome"&&this.#n.forEach(r=>r.checkShowFeedback(e.identifier))})}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let n=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);n&&(n.response=e.response)}}render(){return y`<slot></slot>`}connectedCallback(){this.#i(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#o(),super.disconnectedCallback()}#i(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#c),this.addEventListener("qti-set-template-value",this.#u),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#p)}#o(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#l),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#c),this.removeEventListener("qti-set-template-value",this.#u),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#p)}#s;#a;#l;#h;#c;#u;#d;#p;async#m(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){this.validate(e),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),n=!!(r&&typeof r.process=="function");return n&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),n}resetResponses(){this._context=this.#r}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b())}updateTemplateVariable(t,e){let r=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let n=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let n=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,correctResponse:n})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){let r=this.getOutcome(t);if(!r){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},this.#n.forEach(n=>n.checkShowFeedback(t)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(n=>n.identifier===t)?.value}}))}validate(t=!0){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}#b(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#f(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let n=("defaultValue"in t?t.defaultValue:null)??null;return n==null&&(t.baseType==="integer"||t.baseType==="float")&&(n="0"),{...t,value:n}})}}};Zt([p({type:String})],nt.prototype,"identifier",void 0);Zt([p({type:String})],nt.prototype,"adaptive",void 0);Zt([p({type:String,attribute:"time-dependent"})],nt.prototype,"timeDependent",void 0);Zt([p({type:String})],nt.prototype,"title",null);Zt([p({type:Boolean})],nt.prototype,"disabled",void 0);Zt([$("disabled",{waitUntilFirstUpdate:!0})],nt.prototype,"_handleDisabledChange",void 0);Zt([p({type:Boolean})],nt.prototype,"readonly",void 0);Zt([$("readonly",{waitUntilFirstUpdate:!0})],nt.prototype,"_handleReadonlyChange",void 0);Zt([B({context:j})],nt.prototype,"_context",void 0);function Kc(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function Jc(o,t,e,r="qti-portable-custom-interaction"){let n=[],i=o.querySelectorAll(r);if(i.length===0)return;let s=null,a=null,c=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let l of Array.from(i)){l.setAttribute("data-base-url",t);let d=l.getAttribute("custom-interaction-type-identifier");d&&n.includes(d)&&(d=d+n.length,l.setAttribute("custom-interaction-type-identifier",d),n.push(d)),d&&n.push(d);let h=l.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await c();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((b,w)=>{let I=u.length>w?u[w]:"";return{primaryPath:b,fallbackPath:I}});for(let b of u)g.some(w=>w.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let w=o.createElement("qti-interaction-module");b.fallbackPath&&w.setAttribute("fallback-path",b.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(w)}}}}}function Zc(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=ed(i,s);i.replaceWith(a)})}function td(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(n=>{if(n.startsWith(`${t}:`)){let i=n.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=ed(e,s);e.replaceWith(a)}})})}function ed(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function rd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let n of e)o.querySelectorAll("["+n+"]").forEach(s=>{let a=s.getAttribute(n);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Ha=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=uu(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=pu(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function Ui(o){return Ha.fromSeedKey(o)}function pu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return nd(t)}function uu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return nd(t)}function nd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var mu=o=>typeof o=="function"?o():o.random();function Hi(o,t){let e=o.filter(n=>!n.fixed);for(let n=e.length-1;n>0;n--){let i=Math.floor(mu(t)*(n+1));[e[n],e[i]]=[e[i],e[n]]}let r=0;return o.map(n=>n.fixed?n:e[r++])}function fu(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function Wa(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),n=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=fu(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let v=n?Ui(`${t}:${i}:${c}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=Hi(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of b)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function id(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var od=!1;function Wi(o,t){od||(od=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function gu(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function sd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),n=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(n)throw new Error(t(gu(n)));return r}function Ar(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>sd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Ir(o){return sd(o,t=>`Failed to parse XML: ${t}`)}function ad(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,n;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?n=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):n=t.createElementNS(r.namespaceURI,r.tagName);for(let i=0;i<r.attributes.length;i++){let s=r.attributes[i];n.setAttribute(s.localName,s.value)}for(let i=0;i<r.childNodes.length;i++)n.appendChild(ad(r.childNodes[i],t,e));return n}return o.cloneNode(!1)}function _r(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(ad(o.childNodes[r],document,t));return e}function Tr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let n of["src","href","srcset","poster"]){let i=r.getAttribute(n)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);r.setAttribute(n,s)}}})}var Bt=()=>{let o,t="",e={load(r,n){return t=r,Ar(r,n).then(i=>(o=i,e))},parse(r){return o=Ir(r),t="",e},path:r=>(Tr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return rd(o,r),e},async configurePci(r,n,i="qti-portable-custom-interaction"){return await Jc(o,r,n,i),e},shuffleInteractions(r){let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-item-seed";return Wi("qtiTransformItem",i),Wa(o,i),e}return Wa(o,n),e},extendElementName:(r,n)=>(Zc(o,r,n),e),extendElementsWithClass:(r="extend")=>(td(o,r),e),customInteraction(r,n){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",r),i.setAttribute("data-base-item",r+n),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return Kc(o),e},stripStyleSheets(){return id(o),e},html(){return t!==null&&Tr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(_r(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Tr(o,t.substring(0,t.lastIndexOf("/"))),_r(o,r)},xmlDoc(){return o}};return e};var ld=()=>{let o,t={async load(e,r){return o=await Ar(e,r),t},parse(e){o=Ir(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function cd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),n=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:r,href:n,category:i})}),t}var Qi=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),dd=o=>Qi(o,"qti-assessment-item-ref","assessmentitemref"),Tn=o=>Qi(o,"qti-assessment-section","assessmentsection"),_n=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),bu=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),Qa=o=>Qi(o,"qti-ordering","ordering"),yu=o=>Qi(o,"qti-selection","selection"),vu=o=>Array.from(o.children).filter(t=>Qa(t)&&_n(t,"shuffle")),wu=(o,t)=>Ui(`${o}:${t}`);function xu(o){let t=[],e=[],r=n=>{for(let i of Array.from(n.children))dd(i)?t.push(i):Tn(i)?r(i):!Qa(i)&&!yu(i)&&e.push(i.localName)};return r(o),{itemRefs:t,dropped:e}}function qu(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function hd(o,t){for(let c of Array.from(o.children))Tn(c)&&hd(c,t);let e=vu(o);if(e.length===0)return;let r=[],n=[];for(let c of Array.from(o.children))if(dd(c))r.push({nodes:[c],fixed:_n(c,"fixed")}),n.push(c);else if(Tn(c)){let{itemRefs:l,dropped:d}=xu(c);if(qu(c,d),bu(c,"keep-together","keeptogether"))for(let h of l)r.push({nodes:[h],fixed:_n(h,"fixed")});else l.length>0&&r.push({nodes:l,fixed:_n(c,"fixed")});n.push(c)}let i=n.length>0?n[n.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=Hi(r,wu(t,s));for(let c of n)c.remove();for(let c of a)for(let l of c.nodes)o.insertBefore(l,i);for(let c of e)c.remove()}function pd(o){return Array.from(o.getElementsByTagName("*")).some(t=>Qa(t)&&_n(t,"shuffle"))}function Ga(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Tn(r));for(let r of e){if(!r.parentNode)continue;let n=r.parentElement;n&&Tn(n)||hd(r,t)}}var Rr=()=>{let o,t="",e={async load(r,n){return o=await Ar(r,n),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Ir(r),t="",e},path:r=>(Tr(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!pd(o))return e;let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-test-seed";return Wi("qtiTransformTest",i),Ga(o,i),e}return Ga(o,n),e},items(){return cd(o)},html(){return new XMLSerializer().serializeToString(_r(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return _r(o,r)},xmlDoc(){return o}};return e};var ud=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Xa=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Or=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Xa(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let e=await Bt().load(this.href).then(r=>r.htmlDoc());if(e){let r=e.querySelectorAll("qti-stimulus-body, qti-stylesheet");t.innerHTML="",t.append(...r)}}};ud([p({type:String})],Or.prototype,"identifier",void 0);ud([p({type:String})],Or.prototype,"href",void 0);var Gi=class extends C{};var Cu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Rn=class extends C{render(){return y`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(n=>n.type==="template");for(let n of e){let i=n;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(n=>n.localName.toLowerCase()==="mi"||n.localName.toLowerCase()==="mn");for(let n of r){let i=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=s,n.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),n.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Cu([_({context:j,subscribe:!0}),T()],Rn.prototype,"context",void 0);var md=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Mr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
68
68
|
:host {
|
|
69
69
|
display: none;
|
|
70
70
|
}
|
|
71
|
-
`]}render(){return
|
|
71
|
+
`]}render(){return y`<slot></slot>`}};md([p({type:String})],Mr.prototype,"identifier",void 0);md([p({type:String})],Mr.prototype,"cardinality",void 0);var Eu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},On=class extends C{#t;render(){return y`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:n=>this._context?.variables.find(i=>i.identifier===n)?.value??"",correct:n=>this._context?.variables.find(i=>i.identifier===n)?.correctResponse??""},r={getVariable:n=>this._context?.variables.find(i=>i.identifier===n),updateOutcomeVariable:(n,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:n,value:i}}))},updateResponseVariable:(n,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:n,response:i}}))}};return this.#t(this._context,e,r)}#e(t){let e=Bc(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(n=>{let i=n.calculate;return typeof i=="function"?i.call(n):null});return e(r)}};Eu([_({context:j,subscribe:!0}),T()],On.prototype,"_context",void 0);var Xi=class extends st{static{this.styles=q`
|
|
72
72
|
:host {
|
|
73
73
|
display: block;
|
|
74
74
|
}
|
|
@@ -78,18 +78,18 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
78
78
|
.off {
|
|
79
79
|
display: none;
|
|
80
80
|
}
|
|
81
|
-
`}render(){return
|
|
81
|
+
`}render(){return y` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ut=o=>o??M;var Yi=class extends st{constructor(){super(...arguments),this.render=()=>y` <slot part="feedback" class="${Ut(this.showStatus)}"></slot> `}static{this.styles=q`
|
|
82
82
|
.on {
|
|
83
83
|
display: inline-block;
|
|
84
84
|
}
|
|
85
85
|
.off {
|
|
86
86
|
display: none;
|
|
87
87
|
}
|
|
88
|
-
`}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var
|
|
88
|
+
`}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var fd=q`
|
|
89
89
|
:host {
|
|
90
90
|
display: block;
|
|
91
91
|
}
|
|
92
|
-
`;var
|
|
92
|
+
`;var Ki=class extends C{static{this.styles=fd}render(){return y`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Pr=class extends st{static{this.styles=q`
|
|
93
93
|
.cito-dialog {
|
|
94
94
|
background: var(--qti-bg);
|
|
95
95
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -127,22 +127,22 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
127
127
|
.button:focus {
|
|
128
128
|
outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
|
|
129
129
|
}
|
|
130
|
-
`}render(){return
|
|
130
|
+
`}render(){return y`
|
|
131
131
|
<dialog class="cito-dialog" part="feedback" ?open="${this.showStatus==="on"}">
|
|
132
132
|
<slot></slot>
|
|
133
133
|
<div style="margin-top: var(--qti-gap); text-align: center;">
|
|
134
134
|
<button class="button close-button" @click="${this.closeFeedback}">Close</button>
|
|
135
135
|
</div>
|
|
136
136
|
</dialog>
|
|
137
|
-
`}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var
|
|
137
|
+
`}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var Mn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},te=class extends wr{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
|
|
138
138
|
:host {
|
|
139
139
|
display: none;
|
|
140
140
|
}
|
|
141
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return
|
|
141
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return y`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let n=parseFloat(r.getAttribute("source-value")),i=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(n)||Number.isNaN(i)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:n,targetValue:i,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let n=parseFloat(r.getAttribute("source-value")),i=r.getAttribute("target-value");if(Number.isNaN(n)||i===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(n,i)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Mn([p({type:String,attribute:"base-type"})],te.prototype,"baseType",void 0);Mn([p({type:String,attribute:"external-scored"})],te.prototype,"externalScored",void 0);Mn([p({type:String})],te.prototype,"identifier",void 0);Mn([p({type:String})],te.prototype,"cardinality",void 0);Mn([_({context:j,subscribe:!0}),T()],te.prototype,"itemContext",void 0);var Ji=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ve=class extends wr{static{this.styles=[q`
|
|
142
142
|
:host {
|
|
143
143
|
display: none;
|
|
144
144
|
}
|
|
145
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return
|
|
145
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return y`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#t,cardinality:this.cardinality||"single",mapping:this.#e,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};e.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get#t(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let n=0;n<r.length;n++)t.push(r[n].textContent.trim()),r[n].remove()}}return t}get#e(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(i=>({mapKey:i.getAttribute("map-key")||"",mappedValue:Number(i.getAttribute("mapped-value"))||0,caseSensitive:i.hasAttribute("case-sensitive")?i.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),n=parseFloat(t?.getAttribute("upper-bound")),i=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(n)?null:n,areaMapEntries:i}}};Ji([p({type:String,attribute:"base-type"})],ve.prototype,"baseType",void 0);Ji([p({type:String})],ve.prototype,"identifier",void 0);Ji([p({type:String})],ve.prototype,"cardinality",void 0);Ji([_({context:j,subscribe:!0}),T()],ve.prototype,"itemContext",void 0);var gd=`<qti-response-condition>
|
|
146
146
|
<qti-response-if>
|
|
147
147
|
<qti-match>
|
|
148
148
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -157,7 +157,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
157
157
|
<qti-base-value base-type="float">0</qti-base-value>
|
|
158
158
|
</qti-set-outcome-value>
|
|
159
159
|
</qti-response-else>
|
|
160
|
-
</qti-response-condition>`,
|
|
160
|
+
</qti-response-condition>`,bd=`<qti-response-condition>
|
|
161
161
|
<qti-response-if>
|
|
162
162
|
<qti-is-null>
|
|
163
163
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -171,7 +171,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
171
171
|
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
172
172
|
</qti-set-outcome-value>
|
|
173
173
|
</qti-response-else>
|
|
174
|
-
</qti-response-condition>`,
|
|
174
|
+
</qti-response-condition>`,yd=`<qti-response-condition>
|
|
175
175
|
<qti-response-if>
|
|
176
176
|
<qti-is-null>
|
|
177
177
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -185,27 +185,27 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
185
185
|
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
186
186
|
</qti-set-outcome-value>
|
|
187
187
|
</qti-response-else>
|
|
188
|
-
</qti-response-condition>`;var
|
|
188
|
+
</qti-response-condition>`;var ku={map_response:bd,map_response_point:yd,match_correct:gd},Zi=class extends C{static{this.styles=[q`
|
|
189
189
|
:host {
|
|
190
190
|
display: none;
|
|
191
191
|
}
|
|
192
|
-
`]}render(){return
|
|
192
|
+
`]}render(){return y`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let r of e)r.process()}catch(r){if(!(r instanceof qr))throw r}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),n=ku[r];n&&(this.innerHTML=n)}};var Pn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ee=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{let r=new CustomEvent("qti-rubric:discretionary-placement",{detail:{className:e,element:this},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(r))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
|
|
193
193
|
:host {
|
|
194
194
|
display: block;
|
|
195
195
|
}
|
|
196
|
-
`}render(){return
|
|
196
|
+
`}render(){return y`<slot></slot>`}};Pn([p({type:String})],ee.prototype,"id",void 0);Pn([p({type:String})],ee.prototype,"use",void 0);Pn([p({type:String})],ee.prototype,"view",void 0);Pn([p({type:String,attribute:"class"})],ee.prototype,"classNames",void 0);Pn([$("classNames",{waitUntilFirstUpdate:!0})],ee.prototype,"handleclassNamesChange",null);var to=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let n=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${n}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var eo=class extends C{render(){return y`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var Dn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},re=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[q`
|
|
197
197
|
:host {
|
|
198
198
|
display: none;
|
|
199
199
|
}
|
|
200
|
-
`]}render(){return
|
|
200
|
+
`]}render(){return y`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#n()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#n(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Dn([p({type:String})],re.prototype,"identifier",void 0);Dn([p({type:String})],re.prototype,"cardinality",void 0);Dn([p({type:String,attribute:"base-type"})],re.prototype,"baseType",void 0);Dn([p({type:Boolean,attribute:"math-variable"})],re.prototype,"mathVariable",void 0);Dn([p({type:Boolean,attribute:"param-variable"})],re.prototype,"paramVariable",void 0);var ro=class extends C{static{this.styles=[q`
|
|
201
201
|
:host {
|
|
202
202
|
display: none;
|
|
203
203
|
}
|
|
204
|
-
`]}#t=100;render(){return
|
|
204
|
+
`]}#t=100;render(){return y`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let n=[...this.children];for(let i of n)if(i.tagName.toLowerCase()==="qti-template-constraint"){if(i.calculate()===!1){r=!0;break}}else i.process()}catch(n){console.error("Error during template processing:",n);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var vd=[{tag:"qti-assessment-item",ctor:nt},{tag:"qti-assessment-stimulus-ref",ctor:Or},{tag:"qti-companion-materials-info",ctor:Gi},{tag:"qti-content-body",ctor:Rn},{tag:"qti-context-declaration",ctor:Mr},{tag:"qti-custom-operator",ctor:On},{tag:"qti-feedback-block",ctor:Xi},{tag:"qti-feedback-inline",ctor:Yi},{tag:"qti-item-body",ctor:Ki},{tag:"qti-modal-feedback",ctor:Pr},{tag:"qti-outcome-declaration",ctor:te},{tag:"qti-response-declaration",ctor:ve},{tag:"qti-response-processing",ctor:Zi},{tag:"qti-rubric-block",ctor:ee},{tag:"qti-stylesheet",ctor:to},{tag:"qti-template-constraint",ctor:eo},{tag:"qti-template-declaration",ctor:re},{tag:"qti-template-processing",ctor:ro}];var no=class extends Pr{static{this.styles=q`
|
|
205
205
|
:host {
|
|
206
206
|
color: gray;
|
|
207
207
|
}
|
|
208
|
-
`}render(){return b``}};var Qo=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},we=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Qo([p({type:String})],we.prototype,"identifier",void 0);Qo([p({type:String})],we.prototype,"class",void 0);Qo([p({type:String,attribute:"navigation-mode"})],we.prototype,"navigationMode",void 0);Qo([p({type:String,attribute:"submission-mode"})],we.prototype,"submissionMode",void 0);var Tp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ii=class extends A{#t;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}getResult(){let t=this.getAttribute("include-category")?.split(" ")??[],e=this.getAttribute("exclude-category")?.split(" ")??[],r=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),s=Array.from(this.#t.querySelectorAll("qti-asssessment-test qti-assessment-item-ref")).filter(c=>{let d=!0;return t.length>0&&(d=t.includes(c.category)),e.length>0&&(d=!e.includes(c.category)),d}).map(c=>{let d=1;if(r){let h=c.weigths.get(r);h!=null&&(d=h)}return{item:c.identifier,weight:d}});return new Ra(this._testContext,i,s).calculate()}calculate(){return this.getResult()}};Tp([T({context:ot,subscribe:!0})],Ii.prototype,"_testContext",void 0);var Ra=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let{items:t}=this.testContext,e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let o=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;o&&(e+=Number(o.value)*s)}}),e}};var Go=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Wl=n=>{class t extends n{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let o=i||this._getDefaultNavigationId(r);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,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(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let o=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:o}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:o.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,o),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="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 r=this._getDefaultNavigationId(this.navigate);r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let o=this.sessionContext?.navItemRefId;if(!o||r==="item"&&i===o)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${o}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===o);if(r==="item"){let f=d.findIndex(m=>m.identifier===i);return f===-1||h===-1?!1:f!==h+1}return!0}async _handleNavigationRequest({detail:r}){if(!r?.id)return;if(this._isLinearNavigationRestricted(r.type,r.id)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let i=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=o,await this._executeNavigation(r.type,r.id,i,o)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,i,o){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,o))}async _executeNavigation(r,i,o,s){r==="item"?await this._navigateToItem(i,o,s):await this._navigateToSection(i,o,s)}async _navigateToItem(r,i,o){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,i,o){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let l=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,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 r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let o=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,r,i)}_applyStimulusContent(r,i,o){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${s.length} stimulus elements to apply for ${i.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],l=o.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="";let h=Array.from(s).map(f=>f.cloneNode(!0));c.append(...h),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,o){if(!this._testElement||r.length===0)return;let s=r.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,i,o)))).filter(Boolean);this._isStaleNavigation(i,o)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(r,i,o){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await jt().load(r.href,o.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,o)?null:{itemRef:r,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await jt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let o=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,o){return{message:r.message||`Failed to load ${i}: ${o}`,details:r,itemId:i==="item"?o:void 0,sectionId:i==="section"?o:void 0}}_dispatchLoadingStarted(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:r,bubbles:!0,composed:!0}))}_dispatchTestLoaded(r){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:r.map(({itemRef:i})=>({identifier:i?.identifier,element:i})),bubbles:!0,composed:!0}))})}}return Go([p({type:String})],t.prototype,"navigate",void 0),Go([p({type:Number})],t.prototype,"requestTimeout",void 0),Go([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),Go([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Ql=n=>{class t extends n{constructor(...r){super(...r),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(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let o=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;o&&this.updateAssessmentItemView(o,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Gl=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Oa=n=>{class t extends n{constructor(...r){super(...r),this.testContext=ya,this.sessionContext=ba,this._updateItemInTestContext=i=>{let o=i._context,s=o.identifier,a=o.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a);else{let c=[...i.variables];for(let d of l.variables){let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c}},this._initializeEventListeners()}updateItemVariables(r,i){let o=this.testContext.items.find(a=>a.identifier===r);o&&(o.variables=o.variables.map(a=>{let l=i.find(c=>c.identifier===a.identifier);return l?{...a,...l}:a}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=i)}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=ya,this.sessionContext=ba}),this.addEventListener("qti-assessment-test-connected",r=>{this._testElement=r.detail;let i=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:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,o=i.closest("qti-assessment-item-ref")?.identifier;o&&(i.assessmentItemRefId=o),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state)})}_updateItemVariablesInTestContext(r,i,o){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:i.map(a=>{let l=s.variables.find(c=>c.identifier===a.identifier);return l?{...l,...a}:a}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Gl([p({attribute:!1,type:Object}),B({context:ot})],t.prototype,"testContext",void 0),Gl([p({attribute:!1,type:Object}),B({context:Lt})],t.prototype,"sessionContext",void 0),t},Xl=class extends Oa(C){};var Yl=n=>{class t extends n{constructor(...r){super(...r),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:o,value:s}=i.detail;this.updateOutcomeVariable(o,s),i.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,i){let o=this.getOutcome(r);if(!o){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:o.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Rp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},He=class extends Wl(Ql(Yl(Oa(C)))){constructor(){super(...arguments),this.configContext={}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};Rp([_(),B({context:pt})],He.prototype,"configContext",void 0);var Kl=q`
|
|
208
|
+
`}render(){return y``}};var io=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},we=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return y` <slot></slot>`}};io([p({type:String})],we.prototype,"identifier",void 0);io([p({type:String})],we.prototype,"class",void 0);io([p({type:String,attribute:"navigation-mode"})],we.prototype,"navigationMode",void 0);io([p({type:String,attribute:"submission-mode"})],we.prototype,"submissionMode",void 0);var Su=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Nn=class extends S{#t=null;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),n=Vi(t,Li(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Ya(this._testContext,r,n).calculate()}calculate(){return this.getResult()}};Su([_({context:ot,subscribe:!0})],Nn.prototype,"_testContext",void 0);var Ya=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(n=>n.item))];return t.forEach(n=>{if(r.includes(n.identifier)){let i=n.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===n.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var oo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},wd=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,n){let i=n||this._getDefaultNavigationId(r);i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:i},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(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let n=r.detail;this._loadingState.connectedItems++;let i=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:n,item:i}=r;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:i.identifier}),this._loadedStimulusHrefs.has(n.href)){console.info("Stimulus already loaded, skipping:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(n.href)){console.info("Stimulus already loading, skipping duplicate:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(n.href),console.info("Starting stimulus load:",n.href);try{await this._loadStimulusRef(n,i),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.href)}}_getDefaultNavigationId(r){return r==="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 r=this._getDefaultNavigationId(this.navigate);r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,n){let i=this.sessionContext?.navItemRefId;if(!i||r==="item"&&n===i)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),c=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||c?.navigationMode||c?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===i);if(r==="item"){let f=d.findIndex(m=>m.identifier===n);return f===-1||h===-1?!1:f!==h+1}return!0}async _handleNavigationRequest({detail:r}){if(!r?.id)return;if(this._isLinearNavigationRestricted(r.type,r.id)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let n=++this._navigationId,i=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=i,await this._executeNavigation(r.type,r.id,n,i)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===i&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,n,i){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,n,i))}async _executeNavigation(r,n,i,s){r==="item"?await this._navigateToItem(n,i,s):await this._navigateToSection(n,i,s)}async _navigateToItem(r,n,i){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,n,i){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let c=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&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 r=this._loadingState.connectedItems>=this._loadingState.expectedItems,n=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&n&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,n){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,n))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,n){console.info("Loading stimulus:",r.href);let i=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,r,n)}_applyStimulusContent(r,n,i){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${s.length} stimulus elements to apply for ${n.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],c=i.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(c)a.push(c),console.info("Found specific target:",c);else{let l=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.identifier}"]`));if(l.length>0)a=l,console.info("Found targets by identifier:",l.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((l,d)=>{l.innerHTML="";let h=Array.from(s).map(f=>f.cloneNode(!0));l.append(...h),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,n,i){if(!this._testElement||r.length===0)return;let s=r.map(l=>this._findItemRef(l));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(l=>this._loadSingleItem(l,n,i)))).filter(Boolean);this._isStaleNavigation(n,i)||(c.forEach(({itemRef:l,doc:d})=>{l&&d&&(l.xmlDoc=d)}),c.forEach(({itemRef:l})=>{let d=l?.identifier;if(!l||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&l.updateComplete.then(()=>{let f=l.assessmentItem;f&&(f.state=h)})}),this._loadResults=c)}async _loadSingleItem(r,n,i){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await Bt().load(r.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(n,i)?null:{itemRef:r,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Bt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let n=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!n)throw new Error(`Item with identifier "${r}" not found`);return n}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,n){let i=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:n}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(n=>n.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(n=>{n.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,n){return n.signal.aborted||r!==this._navigationId}_createNavigationError(r,n,i){return{message:r.message||`Failed to load ${n}: ${i}`,details:r,itemId:n==="item"?i:void 0,sectionId:n==="section"?i:void 0}}_dispatchLoadingStarted(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchError(r){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:r,bubbles:!0,composed:!0}))}_dispatchTestLoaded(r){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:r.map(({itemRef:n})=>({identifier:n?.identifier,element:n})),bubbles:!0,composed:!0}))})}}return oo([p({type:String})],t.prototype,"navigate",void 0),oo([p({type:Number})],t.prototype,"requestTimeout",void 0),oo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),oo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var xd=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",n=>{this.sessionContext={...this.sessionContext,view:n.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",n=>{this._updateElementView(),this._setCorrectResponseVisibility(n.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;i&&this.updateAssessmentItemView(i,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,n){}}return t};var qd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ka=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Oa,this.sessionContext=Ra,this._updateItemInTestContext=n=>{let i=n._context,s=i.identifier,a=i.variables,c=this.testContext.items.find(l=>l?.identifier===s);if(!c){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(c.variables?.length===1)this._updateItemVariablesInTestContext(s,a);else{let l=[...n.variables];for(let d of c.variables){let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}n.variables=l}},this._initializeEventListeners()}updateItemVariables(r,n){let i=this.testContext.items.find(a=>a.identifier===r);i&&(i.variables=i.variables.map(a=>{let c=n.find(l=>l.identifier===a.identifier);return c?{...a,...c}:a}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=n)}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Oa,this.sessionContext=Ra}),this.addEventListener("qti-assessment-test-connected",r=>{this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,i=n.closest("qti-assessment-item-ref")?.identifier;i&&(n.assessmentItemRefId=i),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state)})}_updateItemVariablesInTestContext(r,n,i){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:n.map(a=>{let c=s.variables.find(l=>l.identifier===a.identifier);return c?{...c,...a}:a}),...i!==void 0?{state:i?{...i}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return qd([p({attribute:!1,type:Object}),B({context:ot})],t.prototype,"testContext",void 0),qd([p({attribute:!1,type:Object}),B({context:Vt})],t.prototype,"sessionContext",void 0),t},Cd=class extends Ka(C){};var Ed=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",n=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],n.detail.variable]},n.stopPropagation()}),this.addEventListener("qti-set-outcome-value",n=>{let{outcomeIdentifier:i,value:s}=n.detail;this.updateOutcomeVariable(i,s),n.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,n){let i=this.getOutcome(r);if(!i){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:i.cardinality==="single"?n:[...s.value,n]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(n=>n.identifier===r)||null}}return t};var Au=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},We=class extends wd(xd(Ed(Ka(C)))){constructor(){super(...arguments),this.configContext={}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return y`<slot></slot>`}};Au([T(),B({context:ut})],We.prototype,"configContext",void 0);var kd=q`
|
|
209
209
|
display: inline-flex;
|
|
210
210
|
align-items: center;
|
|
211
211
|
cursor: pointer;
|
|
@@ -214,21 +214,21 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
214
214
|
user-select: none;
|
|
215
215
|
`,gt=q`
|
|
216
216
|
background-color: lightgray;
|
|
217
|
-
${
|
|
217
|
+
${kd};
|
|
218
218
|
`,bt=q`
|
|
219
219
|
cursor: not-allowed;
|
|
220
220
|
opacity: 0.8;
|
|
221
|
-
`,
|
|
222
|
-
${
|
|
221
|
+
`,Qq=q`
|
|
222
|
+
${kd};
|
|
223
223
|
border: 1px solid gray;
|
|
224
|
-
`;var
|
|
224
|
+
`;var Nr=class extends C{static{this.styles=q`
|
|
225
225
|
:host {
|
|
226
226
|
${gt};
|
|
227
227
|
}
|
|
228
228
|
:host([disabled]) {
|
|
229
229
|
${bt};
|
|
230
230
|
}
|
|
231
|
-
`}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(
|
|
231
|
+
`}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",!0)})})}render(){return y` <slot></slot> `}};var so=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},ao=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Sd=o=>!Wc(o)&&typeof o.then=="function",Ad=1073741823,Ja=class extends ye{constructor(){super(...arguments),this._$Cwt=Ad,this._$Cbt=[],this._$CK=new so(this),this._$CX=new ao}render(...t){return t.find(e=>!Sd(e))??tt}update(t,e){let r=this._$Cbt,n=r.length;this._$Cbt=e;let i=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!Sd(c))return this._$Cwt=a,c;a<n&&c===r[a]||(this._$Cwt=Ad,n=0,Promise.resolve(c).then(async l=>{for(;s.get();)await s.get();let d=i.deref();if(d!==void 0){let h=d._$Cbt.indexOf(c);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(l))}}))}return tt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},lo=kt(Ja);var co=`
|
|
232
232
|
@layer qti-base, qti-components, qti-extended;
|
|
233
233
|
|
|
234
234
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
@@ -6264,13 +6264,22 @@ qti-feedback-block::part(feedback) {
|
|
|
6264
6264
|
* including the \`qti-extended\` slot consumers are told to author in.
|
|
6265
6265
|
*/
|
|
6266
6266
|
|
|
6267
|
-
|
|
6267
|
+
/*
|
|
6268
|
+
* \`view\` on content marks WHO it is for, and content not addressed to the current audience is
|
|
6269
|
+
* hidden until \`TestViewMixin\` / \`ItemViewMixin\` marks it \`.show\`.
|
|
6270
|
+
*
|
|
6271
|
+
* \`qti-item\` is excluded because its \`view\` says which audience to resolve, not who the element
|
|
6272
|
+
* is for. Without the exclusion \`<qti-item view="scorer">\` would hide the item it configures,
|
|
6273
|
+
* wherever this sheet reaches the host \u2014 which it does in a shadow root that adopts it above
|
|
6274
|
+
* \`qti-item\` rather than inside \`item-container\`.
|
|
6275
|
+
*/
|
|
6276
|
+
[view]:not(qti-item),
|
|
6268
6277
|
qti-outcome-declaration,
|
|
6269
6278
|
qti-response-declaration {
|
|
6270
6279
|
display: none;
|
|
6271
6280
|
}
|
|
6272
6281
|
|
|
6273
|
-
[view].show {
|
|
6282
|
+
[view]:not(qti-item).show {
|
|
6274
6283
|
display: block;
|
|
6275
6284
|
}
|
|
6276
6285
|
|
|
@@ -6292,28 +6301,28 @@ div.full-correct-response-inline {
|
|
|
6292
6301
|
display: inline-block;
|
|
6293
6302
|
}
|
|
6294
6303
|
}
|
|
6295
|
-
`;var
|
|
6304
|
+
`;var Qe=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},St=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Rr().load(this.testURL)).shuffleOrdering(t),r=this.closest("qti-test");if(r?.postLoadTestTransformCallback){let i=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");i&&(e=await r.postLoadTestTransformCallback(e,i))}this.#r(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#r(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#r(Rr().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#n(),this.#i(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#n(){let t=this.querySelector("template");this.#t=t?t.content:y``}#i(){let t=new CSSStyleSheet;t.replaceSync(co),this.shadowRoot.adoptedStyleSheets=[t]}render(){return y`
|
|
6296
6305
|
${this.#t}
|
|
6297
6306
|
<slot></slot>
|
|
6298
|
-
${
|
|
6299
|
-
`}};
|
|
6307
|
+
${lo(this.testDoc,y`<span>Loading...</span>`)}
|
|
6308
|
+
`}};Qe([p({attribute:!1})],St.prototype,"customElementRegistry",void 0);Qe([p({type:String,attribute:"test-url"})],St.prototype,"testURL",void 0);Qe([T()],St.prototype,"testDoc",void 0);Qe([T()],St.prototype,"testXML",void 0);Qe([T(),_({context:mt,subscribe:!0})],St.prototype,"qtiContext",void 0);Qe([$("testURL",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestURLChange",null);Qe([$("testXML",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestXMLChange",null);var Za=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ge=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6300
6309
|
:host {
|
|
6301
6310
|
${gt};
|
|
6302
6311
|
}
|
|
6303
6312
|
:host([disabled]) {
|
|
6304
6313
|
${bt};
|
|
6305
6314
|
}
|
|
6306
|
-
`}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}))})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),r=e.findIndex(a=>a.active),
|
|
6315
|
+
`}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}))})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),r=e.findIndex(a=>a.active),n=e[r];if(!n){this._internalDisabled=!1;return}let i=n.maxAttempts??1,s=n.numAttempts||0;if(!n.adaptive&&n.optimal){this._internalDisabled=!0;return}if(!n.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}n.allowSkipping===!1?this._internalDisabled=n.valid===!1||n.isDefaultResponse:this._internalDisabled=!1}render(){return y` <slot></slot> `}};Za([_({context:z,subscribe:!0}),p({attribute:!1})],Ge.prototype,"computedContext",void 0);Za([p({type:Boolean,reflect:!0,attribute:"disabled"})],Ge.prototype,"_internalDisabled",void 0);Za([$("computedContext")],Ge.prototype,"_handleTestElementChange",null);var Iu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$n=class extends C{static{this.styles=q`
|
|
6307
6316
|
:host {
|
|
6308
6317
|
${gt};
|
|
6309
6318
|
}
|
|
6310
6319
|
:host([disabled]) {
|
|
6311
6320
|
${bt};
|
|
6312
6321
|
}
|
|
6313
|
-
`}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return
|
|
6314
|
-
::highlight(${
|
|
6315
|
-
::highlight(${
|
|
6316
|
-
`)),
|
|
6322
|
+
`}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return y` <slot></slot> `}};Iu([p({type:String,attribute:"item-id"})],$n.prototype,"itemId",void 0);var vo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},tl="tts-element",po="tts-word",ho=null;function _u(){return ho||(ho=new CSSStyleSheet,ho.replaceSync(`
|
|
6323
|
+
::highlight(${tl}) { background-color: #dbeafe; color: inherit; }
|
|
6324
|
+
::highlight(${po}) { background-color: #ffe066; color: inherit; }
|
|
6325
|
+
`)),ho}var Id=Symbol("tts-context"),ne=class extends C{static{this.styles=q`
|
|
6317
6326
|
:host {
|
|
6318
6327
|
display: inline-block;
|
|
6319
6328
|
}
|
|
@@ -6324,46 +6333,45 @@ div.full-correct-response-inline {
|
|
|
6324
6333
|
opacity: 0.4;
|
|
6325
6334
|
cursor: default;
|
|
6326
6335
|
}
|
|
6327
|
-
`}#t=this.attachInternals();updated(t){t.has("_tts")&&(this.#t.states.clear(),this._tts?.state&&this.#t.states.add(this._tts.state))}};
|
|
6336
|
+
`}#t=this.attachInternals();updated(t){t.has("_tts")&&(this.#t.states.clear(),this._tts?.state&&this.#t.states.add(this._tts.state))}};vo([_({context:Id,subscribe:!0})],ne.prototype,"_tts",void 0);var Xe=class extends C{#t;#e;#r;#n;#i;#o;#s;#a;#l;#h;#c;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=new Map,this.#r=this.#u.bind(this),this.#n=null,this.#i=null,this.#o=0,this.#s=[],this.#a=new Highlight,this.#l=new Highlight,this.#h=void 0,this.#c=()=>this.#v(),this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#b(),pause:()=>this.#y(),resume:()=>this.#q(),stop:()=>this.#v(),prevElement:()=>this.#C(),nextElement:()=>this.#w()}}willUpdate(t){}updated(t){let e=this._sessionContext?.navItemRefId??null;this.#h!==void 0&&this.#h!==e&&(this.#v(),this.#i=null,this.#o=0,this.#p()),this.#h=e}connectedCallback(){super.connectedCallback(),this.#d("idle"),this.#n=this.closest("test-navigation")??this.closest("qti-test")??this.getRootNode(),this.#n.addEventListener("qti-assessment-item-connected",this.#r),this.#n.addEventListener("qti-request-navigation",this.#c)}disconnectedCallback(){super.disconnectedCallback(),speechSynthesis.cancel(),this.#k(),this.#n?.removeEventListener("qti-assessment-item-connected",this.#r),this.#n?.removeEventListener("qti-request-navigation",this.#c),this.#n=null,this.#e.clear()}render(){return y`<slot></slot>`}#u(t){let e=t.detail;e?.identifier&&this.#e.set(e.identifier,e)}#d(t){this._ttsContext={...this._ttsContext,state:t},this.#t.states.delete("idle"),this.#t.states.delete("playing"),this.#t.states.delete("paused"),this.#t.states.add(t)}#p(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#o,elementCount:this.#i?.length??0}}#m(){if(this.#i!==null)return this.#i;let t=this._sessionContext?.navItemRefId;if(!t)return[];let e=this.#e.get(t);if(!e)return[];let r=e.querySelector("qti-item-body");if(!r)return[];let n="p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption";return this.#i=Array.from(r.querySelectorAll(n)).filter(i=>(i.textContent??"").trim().length>0),this.#i}#b(){if(!this.#m().length){console.warn("test-item-to-speech: no readable elements found in qti-item-body");return}this.#f(this.#o)}#f(t){let e=this.#i??[];if(t>=e.length){this.#E(),this.#o=e.length-1,e.length>0&&this.#g(e[this.#o]),this.#d("idle"),this.#p();return}this.#o=t,this.#p();let r=e[t];r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(r),this.#s=this.#x(r);let n=this.#s.map(s=>s.textContent??"").join("");if(!n.trim()){this.#f(t+1);return}let i=new SpeechSynthesisUtterance(n);i.lang=this.language,i.rate=1,i.onboundary=s=>{s.name==="word"&&this.#A(s.charIndex,s.charLength??0)},i.onend=()=>{this.#E(),this.#f(this.#o+1)},speechSynthesis.speak(i),this.#d("playing")}#y(){speechSynthesis.pause(),this.#d("paused")}#q(){speechSynthesis.resume(),this.#d("playing")}#v(){speechSynthesis.cancel(),this.#k(),this.#d("idle")}#C(){let t=this.#m();if(!t.length)return;speechSynthesis.cancel(),this.#E(),this.#o=Math.max(0,this.#o-1),this.#p();let e=t[this.#o];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(e),this.#d("idle")}#w(){let t=this.#m();if(!t.length)return;speechSynthesis.cancel(),this.#E(),this.#o=Math.min(t.length-1,this.#o+1),this.#p();let e=t[this.#o];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(e),this.#d("idle")}#x(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),n;for(;n=r.nextNode();)(n.textContent??"").length>0&&e.push(n);return e}#g(t){if(!("highlights"in CSS))return;this.#S(),this.#a.clear();let e=new Range;e.selectNodeContents(t),this.#a.add(e),CSS.highlights.set(tl,this.#a)}#A(t,e){if(!("highlights"in CSS))return;this.#S(),this.#l.clear();let r=this.#s.map(d=>d.textContent??"").join(""),n=t+(e>0?e:this.#I(t,r)),i=0,s=null,a=0,c=null,l=0;for(let d of this.#s){let h=d.textContent?.length??0;if(!s&&i+h>t&&(s=d,a=t-i),s&&i+h>=n){c=d,l=n-i;break}i+=h}if(s&&c){let d=new Range;d.setStart(s,a),d.setEnd(c,l),this.#l.add(d),CSS.highlights.set(po,this.#l)}}#E(){"highlights"in CSS&&(this.#l.clear(),CSS.highlights.delete(po))}#k(){"highlights"in CSS&&(this.#l.clear(),CSS.highlights.delete(po),this.#a.clear(),CSS.highlights.delete(tl))}#I(t,e){let r=e.slice(t).search(/\s/);return r<0?e.length-t:r}#S(){if(!("highlights"in CSS))return;let t=_u();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let r=(this.closest("test-navigation")?.querySelector("test-container")??this.closest("qti-test")?.querySelector("test-container"))?.shadowRoot;r&&!r.adoptedStyleSheets.includes(t)&&(r.adoptedStyleSheets=[...r.adoptedStyleSheets,t])}};vo([p({type:String})],Xe.prototype,"language",void 0);vo([_({context:Vt,subscribe:!0})],Xe.prototype,"_sessionContext",void 0);vo([T(),B({context:Id})],Xe.prototype,"_ttsContext",void 0);var uo=class extends ne{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return y`
|
|
6328
6337
|
<button part="button" @click=${this.#t}>
|
|
6329
|
-
${t?
|
|
6338
|
+
${t?y`<slot name="pause">⏸</slot>`:y`<slot name="play">▶</slot>`}
|
|
6330
6339
|
</button>
|
|
6331
|
-
`}},
|
|
6340
|
+
`}},mo=class extends ne{render(){return y`
|
|
6332
6341
|
<button part="button" ?disabled=${this._tts?.state!=="playing"} @click=${()=>this._tts?.pause()}>
|
|
6333
6342
|
<slot>⏸</slot>
|
|
6334
6343
|
</button>
|
|
6335
|
-
`}},
|
|
6344
|
+
`}},fo=class extends ne{render(){return y`
|
|
6336
6345
|
<button part="button" ?disabled=${this._tts?.state!=="paused"} @click=${()=>this._tts?.resume()}>
|
|
6337
6346
|
<slot>▶</slot>
|
|
6338
6347
|
</button>
|
|
6339
|
-
`}},
|
|
6348
|
+
`}},go=class extends ne{render(){return y`
|
|
6340
6349
|
<button part="button" ?disabled=${this._tts?.state==="idle"} @click=${()=>this._tts?.stop()}>
|
|
6341
6350
|
<slot>■</slot>
|
|
6342
6351
|
</button>
|
|
6343
|
-
`}},
|
|
6352
|
+
`}},bo=class extends ne{render(){let t=(this._tts?.currentElementIndex??0)===0,e=(this._tts?.elementCount??0)===0;return y`
|
|
6344
6353
|
<button part="button" ?disabled=${e||t} @click=${()=>this._tts?.prevElement()}>
|
|
6345
6354
|
<slot>◀◀</slot>
|
|
6346
6355
|
</button>
|
|
6347
|
-
`}},
|
|
6356
|
+
`}},yo=class extends ne{render(){let t=(this._tts?.elementCount??0)>0&&(this._tts?.currentElementIndex??0)>=(this._tts?.elementCount??0)-1,e=(this._tts?.elementCount??0)===0;return y`
|
|
6348
6357
|
<button part="button" ?disabled=${e||t} @click=${()=>this._tts?.nextElement()}>
|
|
6349
6358
|
<slot>▶▶</slot>
|
|
6350
6359
|
</button>
|
|
6351
|
-
`}};var xe=function(
|
|
6360
|
+
`}};var xe=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},at=class extends C{#t;#e;constructor(){super(),this.identifier=void 0,this.initContext=[],this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.configContext={},this.autoScoreItems=!1,this.#e=new Map,this.addEventListener("qti-assessment-test-connected",this.#a.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#h.bind(this)),this.addEventListener("qti-interaction-changed",this.#s.bind(this)),this.addEventListener("qti-item-context-updated",this.#r.bind(this)),this.addEventListener("test-end-attempt",this.#i.bind(this)),this.addEventListener("test-update-outcome-variable",this.#o.bind(this))}#r(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#u(e);this.#e.set(e.identifier,r);let n=this.computedItemFor(e.identifier),i=Number(e.variables?.find(s=>s.identifier==="numAttempts")?.value)||0;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),n,this.#c(i,r,n?.maxAttempts))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#n(t){return t?this.#t?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`)?.assessmentItem??void 0:void 0}get activeAssessmentItem(){if(!(!this.#t||!this._sessionContext?.navItemRefId))return this.#t.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#i(t){let e=this.activeAssessmentItem;if(!e)return;let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}#o(t){let e=this.#n(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#s(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(n=>n.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let n=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,n)}}}render(){return y`<slot></slot>`}#a(t){if(this.#t=t.detail,this.#e.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let n=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...n,testIdentifier:this.#t.identifier,environmentIdentifier:n.environmentIdentifier||"default"}}}this.#t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let i=this.#l(n);Object.keys(i).length>0&&(this.qtiContext={QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#t?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#t.identifier,title:this.#t.title,view:this._sessionContext?.view,testParts:r.map(n=>{let i=[...n.querySelectorAll("qti-assessment-section")],s=n.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,c=s?s.maxAttempts:1,l=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,allowSkipping:a,sections:i.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),v=m?m.allowSkipping:a,x=m?m.maxAttempts:c,u=m?m.showFeedback:l,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:v,items:f.map(b=>{let w=b.querySelector(":scope > qti-item-session-control"),I=w?w.allowSkipping:v,A=w?w.maxAttempts:x,k=w?w.showFeedback:u,E=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===b.identifier),active:!1,identifier:b.identifier,categories:b.category?b.category?.split(" "):[],href:b.href,variables:[],allowSkipping:I,maxAttempts:A,showFeedback:k,showSolution:E}})}})}})}}#l(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(i=>{let s=i.getAttribute("field-identifier"),a=i.getAttribute("base-type")||"string",c=i.textContent?.trim()||"";if(s){let l=c;switch(a){case"integer":l=parseInt(c,10);break;case"float":case"duration":l=parseFloat(c);break;case"boolean":l=c.toLowerCase()==="true";break;default:l=c;break}e[s]=l}}),e}#h(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(n=>({...n,items:n.items.map(i=>{if(i.identifier!==e.parentElement.getAttribute("identifier"))return i;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),c=e.querySelectorAll("qti-response-declaration"),l=Array.from(c).some(m=>m.querySelector("qti-correct-response")),d=Array.from(c).some(m=>{let v=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return v?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=l||d,f=!!e.querySelector("qti-response-processing");return{...i,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(n=>({...n,active:this._sessionContext?.navSectionId===n.identifier||!1,completed:n.items.every(i=>this._testContext.items.find(s=>s.identifier===i.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:n.items.map(i=>{let s=this._testContext?.items.find(k=>k.identifier===i.identifier),a={...i,...s,...this.initContext?.find(k=>k.identifier===i.identifier)},c=a.variables?.find(k=>k.identifier=="SCORE")?.value,l=c==null?null:parseFloat(c?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,v=this.#n(a.identifier)?.validate(!1)??!0,u=(s?.variables?.filter(k=>k.type==="response")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let E;switch(k.baseType){case"integer":case"float":case"duration":E="0";break;case"boolean":E="false";break;default:E="";break}let R=k.defaultValue??E;if(Array.isArray(k.value)){let N=Array.isArray(R)?R:[R];return k.value.length===N.length&&k.value.every((V,L)=>V===N[L])}return k.value===R}),g=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=i.variables?.find(k=>k.identifier=="MAXSCORE")?.value,w=b==null?null:parseFloat(b?.toString()),I=this.#e.get(a.identifier);I===void 0&&(I=s?this.#u(s):"unscored",f>0&&this.#e.set(a.identifier,I));let A=this.#c(f,I,a.maxAttempts);return{...a,completionStatus:d,numAttempts:f,score:l,response:h,index:g,active:m,valid:v,isDefaultResponse:u,maxScore:w,done:A,optimal:this.#e.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}#c(t,e,r){if(t===0)return!1;if(e!=="suboptimal")return!0;let n=r??1;return n>0&&t>=n}#u(t){let e=t.variables??[],r=this.#d(e,"SCORE"),n=this.#d(e,"MAXSCORE");if(r!==null&&n!==null)return r>=n?"optimal":"suboptimal";let i=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return i.length===0?"unscored":i.every(a=>{let c=a.correctResponse,l=a.value;return l==null?!1:Array.isArray(c)&&Array.isArray(l)?c.length===l.length&&c.every(d=>l.includes(d)):Array.isArray(c)||Array.isArray(l)?!1:c===l})?"optimal":"suboptimal"}#d(t,e){let r=t?.find(i=>i.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let n=parseFloat(r.toString());return Number.isNaN(n)?null:n}};xe([p({type:String})],at.prototype,"identifier",void 0);xe([T()],at.prototype,"initContext",void 0);xe([T(),B({context:mt})],at.prototype,"qtiContext",void 0);xe([T(),_({context:ut,subscribe:!0})],at.prototype,"configContext",void 0);xe([T(),_({context:ot,subscribe:!0})],at.prototype,"_testContext",void 0);xe([T(),_({context:Vt,subscribe:!0})],at.prototype,"_sessionContext",void 0);xe([T(),B({context:z})],at.prototype,"computedContext",void 0);xe([p({type:Boolean,attribute:"auto-score-items"})],at.prototype,"autoScoreItems",void 0);var el=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ye=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6352
6361
|
:host {
|
|
6353
6362
|
${gt};
|
|
6354
6363
|
}
|
|
6355
6364
|
:host([disabled]) {
|
|
6356
6365
|
${bt};
|
|
6357
6366
|
}
|
|
6358
|
-
`}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),r=e?.navigationMode||t.navigationMode,
|
|
6359
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),hn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#o()}nextToken(){for(;$p(this.#i);)this.#o(!0);if(zp(this.#i))return this.#a();if(id(this.#i))return this.#c();if(Ti(this.#i))return this.#h();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#d();if(jp(this.#i))return this.#m();if(Fp(this.#i))return this.#b();if(this.#o(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#o(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#n(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#o(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#o(),this.#i===void 0))throw new Error(t);this.#o()}let r=Bt(M.STRING,Bp(this.#n()));return this.#o(),r}#c(){do this.#o();while(Lp(this.#i));let t=this.#n(),e=Vp(t)?M.KEYWORD:M.IDENTIFIER;return Bt(e,t)}#h(){do this.#o();while(Ti(this.#i));return this.#i===46?this.#l():Bt(M.INTEGER,this.#n())}#l(){return this.#o(),Ti(this.#i)?this.#p():(this.#s(),Bt(M.DOT,".",dn))}#u(){return this.#o(!0),Bt(M.COMMA,",")}#d(){return this.#o(!0),Bt(M.COLON,":")}#p(){do this.#o();while(Ti(this.#i));return Bt(M.DECIMAL,this.#n())}#m(){this.#o();let t=this.#n(2);if(Np.indexOf(t)!==-1)this.#o(),this.#o();else{if(t=this.#n(1),t==="=>")return this.#o(),Bt(M.ARROW,t);Dp.indexOf(t)!==-1&&this.#o()}return t=this.#n(),Bt(M.OPERATOR,t,$a[t])}#b(){let t=String.fromCharCode(this.#i),e=Bt(M.GROUPER,t,$a[t]);return this.#o(!0),e}};var La=(n,t)=>new Ri(n,t).parse(),Ri=class{#t;#e;#r;#i;#o;constructor(t,e){this.#e=new hn(t),this.#r=e}parse(){return this.#n(),this.#s()}#n(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#o=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#o!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(M.GROUPER,"(")){let r=this.#y();t=this.#r.invoke(t,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#q();t=this.#r.index(t,r)}else if(this._matches(M.DOT)){this.#n();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=e)t=this.#o==="?"?this.#u(t):this.#h(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#h(t,e){if(rd.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#n();let r=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(M.OPERATOR)){let t=this.#o;if(this.#n(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#w(t);if(this._matches(M.DECIMAL))return this.#x(t)}if(ed.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),dn);return this.#r.unary(t,e)}return this.#d()}#u(t){this.#n(M.OPERATOR,"?");let e=this.#s();this.#n(M.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#o;if(t==="this")return this.#n(),this.#r.id(t);throw ln.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#C();case M.INTEGER:return this.#w();case M.DECIMAL:return this.#x();case M.GROUPER:return this.#o==="("?this.#v():this.#o==="{"?this.#m():this.#o==="["?this.#p():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#p(){let t=[];do{if(this.#n(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#n(M.GROUPER,"]"),this.#r.list(t)}#m(){let t={};do{if(this.#n(),this._matches(M.GROUPER,"}"))break;let e=this.#o;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#n(),this.#n(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#n(M.GROUPER,"}"),this.#r.map(t)}#b(){let t=this.#o;if(t==="true")return this.#n(),this.#r.literal(!0);if(t==="false")return this.#n(),this.#r.literal(!1);if(t==="null")return this.#n(),this.#r.literal(null);if(t==="undefined")return this.#n(),this.#r.literal(void 0);let e=this.#f(),r=this.#y();return r?this.#r.invoke(e,void 0,r):e}#f(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#o}`);let t=this.#o;return this.#n(),this.#r.id(t)}#y(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#n(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#n(M.GROUPER,")"),t}#q(){this.#n();let t=this.#s();return this.#n(M.GROUPER,"]"),t}#v(){let t=this.#y();if(this._matches(M.ARROW)){this.#n();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#C(){let t=this.#r.literal(this.#o);return this.#n(),t}#w(t=""){let e=this.#r.literal(parseInt(`${t}${this.#o}`,10));return this.#n(),e}#x(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#o}`));return this.#n(),e}};var{hasOwn:od,fromEntries:Up}=Object,Hp={"+":(n,t)=>n+t,"-":(n,t)=>n-t,"*":(n,t)=>n*t,"/":(n,t)=>n/t,"%":(n,t)=>n%t,"==":(n,t)=>n==t,"!=":(n,t)=>n!=t,"===":(n,t)=>n===t,"!==":(n,t)=>n!==t,">":(n,t)=>n>t,">=":(n,t)=>n>=t,"<":(n,t)=>n<t,"<=":(n,t)=>n<=t,"||":(n,t)=>n||t,"&&":(n,t)=>n&&t,"??":(n,t)=>n??t,"|":(n,t)=>t(n),"|>":(n,t)=>t(n)},Wp={"+":n=>n,"-":n=>-n,"!":n=>!n},pn=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Wp[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=Hp[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(o){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(o),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),l=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),s=this.method?o:i?.this??i,a=this.method?o?.[e]:o,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let o=this.entries[i];o&&(r[i]=o.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,o=this.body;return function(...s){let a=Up(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return od(a,d)&&(a[d]=h),c[d]=h},get(c,d){return od(a,d)?a[d]:c[d]}});return o.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Va=null,nd={boundAttributeSuffix:K.M,marker:K.P,markerMatch:K.A,HTML_RESULT:K.C,getTemplateHtml:K.L,overrideDirectiveResolve:(n,t)=>class extends n{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(n,t)=>{if(n.prototype._$AS.name!==t.name){Va??=n.prototype._$AS.name;for(let e=n.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Va))return void(e[Va]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(n,t){n._$litDirective$=t},getAttributePartCommittedValue:(n,t,e)=>{let r=Z;return n.j=i=>r=i,n._$AI(t,n,e),r},connectedDisconnectable:n=>({...n,_$AU:!0}),resolveDirective:K.V,AttributePart:K.H,PropertyPart:K.B,BooleanAttributePart:K.N,EventPart:K.U,ElementPart:K.F,TemplateInstance:K.R,isIterable:K.D,ChildPart:K.I};var{AttributePart:Qp,PropertyPart:Gp,BooleanAttributePart:Xp,EventPart:Yp}=nd,ja=new pn,za=new Map,sd=n=>n.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),un=(n,t)=>{let e=za.get(n);if(e===void 0){if(za.has(n))return;if(n=n.trim(),n.startsWith("{{")&&n.endsWith("}}")){let r=n.substring(2,n.length-2).trim();e=new Ri(r,ja).parse(),za.set(n,e)}}return e?.evaluate(t)},Kp=(n,t,e,r)=>{let i=n.getAttribute("if");if(i!==null&&un(i,t))return mn(n,t,e,r)},ad=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,cd=n=>/(?:\\{{)|(?:\\}})/g.test(n),Oi=n=>n.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Jp=(n,t,e,r)=>{let i=n.getAttribute("repeat");if(i!==null){let o=un(i,t);if(!o[Symbol.iterator])return P;let s=Pi(n),a=-1,l=[];for(let c of o){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let w=m.update(d,e,r);m.type===1?h.push(...w):h.push(w)}let f={_$litType$:s,values:h};l.push(f)}return l}},dd={if:Kp,repeat:Jp},Ut=(n,t=dd,e={},r)=>{let o=Pi(n).renderers;if(r){let a=Pi(r).renderers,l=o.super;l!==void 0?e={...o,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,w)=>mn(r,f,m,w)},l(c,d,h))}:(e={...a,...o,...e},n=r)}else e={...o,...e};return s=>mn(n,s,t,e)};var mn=(n,t,e=dd,r={})=>{let i=Pi(n),o=[];for(let a of i.parts){let l=a.update(t,e,r);a.type===1?o.push(...l):o.push(l)}return{_$litType$:i,values:o}},ld=new Map,Pi=n=>{let t=ld.get(n);return t===void 0&&ld.set(n,t=Zp(n)),t},Zp=n=>{let t={h:void 0,el:n.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,o=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),o.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(w,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:un(g,w);return(m?un(f,w):u[d])?.(y,x,u)}}else l!==null?h=(f,m,w)=>{let x=m[l];return x?.(s,f,m,w)}:(c==="super"?t.renderers.super=(f,m,w)=>{let x=w.super,u=Pi(s);return w={...w,...u.renderers},x(f,m,w)}:t.renderers[c]=(f,m,w)=>mn(s,f,m,w),h=(f,m,w)=>{let x=w[c];return x?.(f,m,w)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(ad);if(d.length===1){cd(c)&&s.setAttribute(l,Oi(c));continue}s.removeAttribute(l);let h=l,f=Qp,m=l[0];m==="."?(h=sd(l.substring(1)),f=Gp):m==="?"?(h=l.substring(1),f=Xp):m==="@"&&(h=sd(l.substring(1)),f=Yp);let w=[Oi(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(La(g,ja)),w.push(Oi(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:w,ctor:f,update:(u,g,y)=>x.map(v=>v.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(ad);l.length>1?s.textContent=Oi(l[0]):cd(a)&&(s.textContent=Oi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=La(d,ja);t.parts.push({type:2,index:++i,update:(m,w)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of o)s.remove();return t};var tu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Mi=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=Ut(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>r.items));return b` ${t.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};tu([T({context:z,subscribe:!0})],Mi.prototype,"computedContext",void 0);var Fa=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ye=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6367
|
+
`}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),r=e?.navigationMode||t.navigationMode,n=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=r==="linear"&&n==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return y`<slot></slot>`}};el([p({type:Boolean,reflect:!0,attribute:"disabled"})],Ye.prototype,"_internalDisabled",void 0);el([_({context:z,subscribe:!0})],Ye.prototype,"computedContext",void 0);el([$("computedContext")],Ye.prototype,"_handleTestElementChange",null);var Tu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ln=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=pt(t)}render(){if(!this.computedContext)return y``;let t=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>r.items));return y` ${t.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};Tu([_({context:z,subscribe:!0})],Ln.prototype,"computedContext",void 0);var rl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ke=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6360
6368
|
:host {
|
|
6361
6369
|
${gt};
|
|
6362
6370
|
}
|
|
6363
6371
|
:host([disabled]) {
|
|
6364
6372
|
${bt};
|
|
6365
6373
|
}
|
|
6366
|
-
`}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(
|
|
6374
|
+
`}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(n=>n.active),r=t?.sections.find(n=>n.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=r==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return y`<slot></slot>`}};rl([p({type:Boolean,reflect:!0,attribute:"disabled"})],Ke.prototype,"_internalDisabled",void 0);rl([_({context:z,subscribe:!0})],Ke.prototype,"computedContext",void 0);rl([$("computedContext")],Ke.prototype,"_handleTestElementChange",null);var Ru=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Vn=class extends C{render(){return y` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};Ru([T(),_({context:z,subscribe:!0})],Vn.prototype,"computedContext",void 0);var Ou=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},zn=class extends C{static{this.styles=q`
|
|
6367
6375
|
table {
|
|
6368
6376
|
width: 100%;
|
|
6369
6377
|
border-collapse: collapse;
|
|
@@ -6384,7 +6392,7 @@ div.full-correct-response-inline {
|
|
|
6384
6392
|
margin-top: 20px;
|
|
6385
6393
|
font-size: 16px;
|
|
6386
6394
|
}
|
|
6387
|
-
`}render(){let t=this.computedContext?.testParts.flatMap(
|
|
6395
|
+
`}render(){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(s=>s.items)).find(i=>i.active);if(!t||!t.variables)return y``;let e=t.variables.filter(i=>i.type==="response"),r=t.variables.filter(i=>i.type==="outcome"),n=(i,s)=>y`
|
|
6388
6396
|
<h3>${s}</h3>
|
|
6389
6397
|
<table>
|
|
6390
6398
|
<thead>
|
|
@@ -6397,41 +6405,41 @@ div.full-correct-response-inline {
|
|
|
6397
6405
|
</tr>
|
|
6398
6406
|
</thead>
|
|
6399
6407
|
<tbody>
|
|
6400
|
-
${
|
|
6408
|
+
${i.map(a=>{let c=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",l=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return y`
|
|
6401
6409
|
<tr>
|
|
6402
6410
|
<td>${a.identifier}</td>
|
|
6403
6411
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
6404
6412
|
<td>${a.cardinality}</td>
|
|
6405
6413
|
<td>${a.baseType}</td>
|
|
6406
|
-
<td>${l||
|
|
6414
|
+
<td>${c||l||d}</td>
|
|
6407
6415
|
</tr>
|
|
6408
6416
|
`})}
|
|
6409
6417
|
</tbody>
|
|
6410
6418
|
</table>
|
|
6411
|
-
`;return
|
|
6412
|
-
${
|
|
6413
|
-
`}};
|
|
6419
|
+
`;return y`
|
|
6420
|
+
${n(e,"Response Variables")} ${n(r,"Outcome Variables")}
|
|
6421
|
+
`}};Ou([_({context:z,subscribe:!0})],zn.prototype,"computedContext",void 0);var nl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Je=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=pt(t)}#t(t){let n=(this.computedContext?.testParts.find(i=>i.active)).sections.flatMap(i=>i.items).find(i=>i.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:n,outcomeVariableId:"SCORE",value:t},bubbles:!0}))}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.active);if(!t||!t.variables)return y``;let e=t.variables.find(a=>a.identifier=="MAXSCORE")?.value,r=t.variables.find(a=>a.identifier=="SCORE"),n=r?.value,i=r?.externalScored!=="human";if(!e||!r)return M;let s=[...Array(Number(e)+1).keys()];return y`${this.myTemplate?this.myTemplate({scores:s,score:n,disabled:i}):M}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,r=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(r)})}};nl([p({type:String,attribute:"view"})],Je.prototype,"view",void 0);nl([p({type:Boolean})],Je.prototype,"disabled",void 0);nl([_({context:z,subscribe:!0})],Je.prototype,"computedContext",void 0);var _d=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$r=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.active);if(!t||!t.variables)return y``;if(t.category==="dep-informational")return y`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(a=>a.identifier==="completionStatus")?.value,r=t?.variables.find(a=>a.identifier=="SCORE"),n=parseFloat(r?.value),i=t.externalScored;return y`<div>${e!=="completed"?this.dataset.textNoResponse:!i&&n!==void 0&&!Number.isNaN(n)?n>0?this.dataset.textCorrect:this.dataset.textIncorrect:i==="externalMachine"?Number.isNaN(n)||n===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${n===0?"geen punten":n==1?"\xE9\xE9n punt":`${n} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:i==="human"?Number.isNaN(n)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};_d([_({context:z,subscribe:!0})],$r.prototype,"computedContext",void 0);_d([p({type:String,attribute:"view"})],$r.prototype,"view",void 0);var Mu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},jn=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=pt(t)}render(){if(!this.computedContext)return y``;let t=this.computedContext.testParts.flatMap(e=>e.sections);return y` ${t.map(e=>this.myTemplate({item:e}))} `}};Mu([_({context:z,subscribe:!0})],jn.prototype,"computedContext",void 0);var Pu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Fn=class extends C{static{this.styles=q`
|
|
6414
6422
|
:host {
|
|
6415
6423
|
${gt};
|
|
6416
6424
|
}
|
|
6417
6425
|
:host([disabled]) {
|
|
6418
6426
|
${bt};
|
|
6419
6427
|
}
|
|
6420
|
-
`}#t(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:t}}))}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return
|
|
6421
|
-
${this.myTemplate?this.myTemplate(this.stampContext):
|
|
6428
|
+
`}#t(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:t}}))}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return y` <slot></slot> `}};Pu([p({type:String,attribute:"section-id"})],Fn.prototype,"sectionId",void 0);var il=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ze=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=pt(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),r=e?.sections.find(h=>h.active),n=r?.items.find(h=>h.active),{variables:i,...s}=n||{};if(!e||!r||!n)return;let a={...e,items:e.sections.flatMap(h=>h.items.map(({variables:f,...m})=>m)),sections:e.sections.map(h=>({...h,items:h.items.map(({variables:f,...m})=>m)}))},c={...r,items:r.items.map(({variables:h,...f})=>f)},{testParts:l,...d}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:s,activeSection:c,activeTestpart:a,test:d},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return y` ${this.debug?y`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:M}
|
|
6429
|
+
${this.myTemplate?this.myTemplate(this.stampContext):M}`}};il([p({type:Boolean,reflect:!0})],Ze.prototype,"debug",void 0);il([T(),_({context:z,subscribe:!0})],Ze.prototype,"computedContext",void 0);il([T()],Ze.prototype,"stampContext",void 0);var Bn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},wo,Ht=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=wo.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#t()}#t(){if(this.viewOptions){let t=this.viewOptions.split(",").map(e=>e.trim());this._viewOptions=t.filter(e=>wo.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=wo.DEFAULT_VIEW_OPTIONS}_switchView(t){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:t}))}render(){return y`
|
|
6422
6430
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
6423
6431
|
<select
|
|
6424
6432
|
part="select"
|
|
6425
6433
|
id="viewSelect"
|
|
6426
6434
|
@change=${t=>{let e=t.target;this._switchView(e.value)}}
|
|
6427
6435
|
>
|
|
6428
|
-
${this._viewOptions.map(t=>
|
|
6436
|
+
${this._viewOptions.map(t=>y`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
|
|
6429
6437
|
</select>
|
|
6430
|
-
`}};
|
|
6438
|
+
`}};wo=Ht;Bn([_({context:Vt,subscribe:!0})],Ht.prototype,"sessionContext",void 0);Bn([p({type:String})],Ht.prototype,"label",void 0);Bn([p({type:String,attribute:"view-options"})],Ht.prototype,"viewOptions",void 0);Bn([$("viewOptions",{waitUntilFirstUpdate:!0})],Ht.prototype,"_handleViewOptionsChange",void 0);Bn([T()],Ht.prototype,"_viewOptions",void 0);var Du=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Un=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=pt(t)}_switchView(t){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:t}))}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return y`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):M}`}};Du([_({context:Vt,subscribe:!0})],Un.prototype,"sessionContext",void 0);var Td=[{tag:"qti-assessment-item-ref",ctor:$t},{tag:"qti-assessment-section",ctor:ft},{tag:"qti-assessment-test",ctor:Ue},{tag:"qti-item-session-control",ctor:Et},{tag:"qti-number-selected",ctor:zi},{tag:"qti-outcome-processing",ctor:ji},{tag:"qti-test",ctor:We},{tag:"qti-test-feedback",ctor:no},{tag:"qti-test-part",ctor:we},{tag:"qti-test-variables",ctor:Nn},{tag:"test-check-item",ctor:Nr},{tag:"test-container",ctor:St},{tag:"test-end-attempt",ctor:Ge},{tag:"test-item-link",ctor:$n},{tag:"test-item-to-speech",ctor:Xe},{tag:"test-navigation",ctor:at},{tag:"test-next",ctor:Ye},{tag:"test-paging-buttons-stamp",ctor:Ln},{tag:"test-prev",ctor:Ke},{tag:"test-print-context",ctor:Vn},{tag:"test-print-item-variables",ctor:zn},{tag:"test-scoring-buttons",ctor:Je},{tag:"test-scoring-feedback",ctor:$r},{tag:"test-section-buttons-stamp",ctor:jn},{tag:"test-section-link",ctor:Fn},{tag:"test-stamp",ctor:Ze},{tag:"test-tts-next",ctor:yo},{tag:"test-tts-pause",ctor:mo},{tag:"test-tts-play",ctor:uo},{tag:"test-tts-prev",ctor:bo},{tag:"test-tts-resume",ctor:fo},{tag:"test-tts-stop",ctor:go},{tag:"test-view",ctor:Ht},{tag:"test-view-toggle",ctor:Un}];for(let{tag:o,ctor:t}of Td)customElements.get(o)||customElements.define(o,t);var tr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},At=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Bt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Bt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#n(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:y``}#n(){let t=new CSSStyleSheet;t.replaceSync(co),this.shadowRoot.adoptedStyleSheets=[t]}render(){return y`
|
|
6431
6439
|
${this.#t}
|
|
6432
6440
|
<slot></slot>
|
|
6433
|
-
${
|
|
6434
|
-
`}};
|
|
6441
|
+
${lo(this.itemDoc,y`<span>Loading...</span>`)}
|
|
6442
|
+
`}};tr([p({attribute:!1})],At.prototype,"customElementRegistry",void 0);tr([p({type:String,attribute:"item-url"})],At.prototype,"itemURL",void 0);tr([T()],At.prototype,"itemDoc",void 0);tr([T()],At.prototype,"itemXML",void 0);tr([T(),_({context:mt,subscribe:!0})],At.prototype,"qtiContext",void 0);tr([$("itemURL",{waitUntilFirstUpdate:!0})],At.prototype,"handleItemURLChange",null);tr([$("itemXML",{waitUntilFirstUpdate:!0})],At.prototype,"handleItemXMLChange",null);var Nu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Hn=class extends C{static{this.styles=q`
|
|
6435
6443
|
table {
|
|
6436
6444
|
width: 100%;
|
|
6437
6445
|
border-collapse: collapse;
|
|
@@ -6452,7 +6460,7 @@ div.full-correct-response-inline {
|
|
|
6452
6460
|
margin-top: 20px;
|
|
6453
6461
|
font-size: 16px;
|
|
6454
6462
|
}
|
|
6455
|
-
`}render(){let t=this.computedContext;if(!t||!t.variables)return
|
|
6463
|
+
`}render(){let t=this.computedContext;if(!t||!t.variables)return y``;let e=t.variables.filter(i=>i.type==="response"),r=t.variables.filter(i=>i.type==="outcome"),n=(i,s)=>y`
|
|
6456
6464
|
<h3>${s}</h3>
|
|
6457
6465
|
<table>
|
|
6458
6466
|
<thead>
|
|
@@ -6465,20 +6473,20 @@ div.full-correct-response-inline {
|
|
|
6465
6473
|
</tr>
|
|
6466
6474
|
</thead>
|
|
6467
6475
|
<tbody>
|
|
6468
|
-
${
|
|
6476
|
+
${i.map(a=>{let c=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",l=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return y`
|
|
6469
6477
|
<tr>
|
|
6470
6478
|
<td>${a.identifier}</td>
|
|
6471
6479
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
6472
6480
|
<td>${a.cardinality}</td>
|
|
6473
6481
|
<td>${a.baseType}</td>
|
|
6474
|
-
<td>${l||
|
|
6482
|
+
<td>${c||l||d}</td>
|
|
6475
6483
|
</tr>
|
|
6476
6484
|
`})}
|
|
6477
6485
|
</tbody>
|
|
6478
6486
|
</table>
|
|
6479
|
-
`;return
|
|
6480
|
-
${
|
|
6481
|
-
`}};
|
|
6487
|
+
`;return y`
|
|
6488
|
+
${n(e,"Response Variables")} ${n(r,"Outcome Variables")}
|
|
6489
|
+
`}};Nu([_({context:me,subscribe:!0})],Hn.prototype,"computedContext",void 0);var $u=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Rd=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",n=>{this.#t=n.detail,this.#e()}),this.addEventListener("item-switch-view",n=>{this.view=n.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,n){}}return $u([p({type:String})],t.prototype,"view",void 0),t};var ol=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ie=class extends Rd(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#n.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#i(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#n(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#i(this.assessmentItem.identifier,e||[])}#i(t,e){let r=e?.find(l=>l.identifier=="SCORE")?.value,n=parseFloat(r?.toString()),i=e?.find(l=>l.identifier==="completionStatus")?.value,s=n!==void 0&&!isNaN(n)&&n>0,a=n!==void 0&&!isNaN(n)&&n<=0,c=i==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:c,variables:e}}render(){return y`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};ol([T(),B({context:me})],ie.prototype,"computedContext",void 0);ol([T(),B({context:ut})],ie.prototype,"configContext",void 0);ol([T(),B({context:mt})],ie.prototype,"qtiContext",void 0);var Od=[{tag:"item-container",ctor:At},{tag:"item-print-variables",ctor:Hn},{tag:"qti-item",ctor:ie}];for(let{tag:o,ctor:t}of Od)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vd)customElements.get(o)||customElements.define(o,t);var Md=(o,t,e)=>{let r=new Map;for(let n=t;n<=e;n++)r.set(o[n],n);return r},H=kt(class extends ge{constructor(o){if(super(o),o.type!==kr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let n=[],i=[],s=0;for(let a of o)n[s]=r?r(a,s):s,i[s]=e(a,s),s++;return{values:i,keys:n}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let n=Xc(o),{values:i,keys:s}=this.dt(t,e,r);if(!Array.isArray(n))return this.ut=s,i;let a=this.ut??=[],c=[],l,d,h=0,f=n.length-1,m=0,v=i.length-1;for(;h<=f&&m<=v;)if(n[h]===null)h++;else if(n[f]===null)f--;else if(a[h]===s[m])c[m]=be(n[h],i[m]),h++,m++;else if(a[f]===s[v])c[v]=be(n[f],i[v]),f--,v--;else if(a[h]===s[v])c[v]=be(n[h],i[v]),Sr(o,c[v+1],n[h]),h++,v--;else if(a[f]===s[m])c[m]=be(n[f],i[m]),Sr(o,n[h],n[f]),f--,m++;else if(l===void 0&&(l=Md(s,m,v),d=Md(a,h,f)),l.has(a[h]))if(l.has(a[f])){let x=d.get(s[m]),u=x!==void 0?n[x]:null;if(u===null){let g=Sr(o,n[h]);be(g,i[m]),c[m]=g}else c[m]=be(u,i[m]),Sr(o,n[h],u),n[x]=null;m++}else Fi(n[f]),f--;else Fi(n[h]),h++;for(;m<=v;){let x=Sr(o,c[v+1]);be(x,i[m]),c[m++]=x}for(;h<=f;){let x=n[h++];x!==null&&Fi(x)}return this.ut=s,Gc(o,c),tt}});var qe=Symbol("dragDropContext");var Pd=[O,zt,q`
|
|
6482
6490
|
/* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
|
|
6483
6491
|
custom properties on its host; the properties themselves live here. */
|
|
6484
6492
|
:host {
|
|
@@ -6496,9 +6504,9 @@ div.full-correct-response-inline {
|
|
|
6496
6504
|
width: 100%;
|
|
6497
6505
|
height: 100%;
|
|
6498
6506
|
}
|
|
6499
|
-
`];var
|
|
6507
|
+
`];var Dd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Lr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Pd}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return y`<div part="drop">
|
|
6500
6508
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6501
|
-
</div>`}};
|
|
6509
|
+
</div>`}};Dd([p({type:String,reflect:!0})],Lr.prototype,"identifier",void 0);Dd([_({context:qe,subscribe:!0}),T()],Lr.prototype,"_dragDrop",void 0);var Nd=[{tag:"qti-associable-hotspot",ctor:Lr}];var $d=[O,zt,q`
|
|
6502
6510
|
/*
|
|
6503
6511
|
* A drop target. The interaction measures its chips and publishes the result as custom
|
|
6504
6512
|
* properties on its own host; the actual CSS properties live here, not in a style attribute.
|
|
@@ -6543,9 +6551,9 @@ div.full-correct-response-inline {
|
|
|
6543
6551
|
min-height: var(--qti-dropzone-min-height, 0);
|
|
6544
6552
|
min-width: var(--qti-dropzone-min-width, 0);
|
|
6545
6553
|
}
|
|
6546
|
-
`];var
|
|
6554
|
+
`];var sl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},er=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=$d}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return y`<div part="drop">
|
|
6547
6555
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6548
|
-
</div>`}};
|
|
6556
|
+
</div>`}};sl([p({type:Number,reflect:!0})],er.prototype,"tabindex",void 0);sl([p({type:String,reflect:!0})],er.prototype,"identifier",void 0);sl([_({context:qe,subscribe:!0}),T()],er.prototype,"_dragDrop",void 0);var Ld=[{tag:"qti-gap",ctor:er}];var Vd=[O,q`
|
|
6549
6557
|
/* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
|
|
6550
6558
|
graphic-gap-match rules, on the host from the document. */
|
|
6551
6559
|
:host {
|
|
@@ -6554,7 +6562,7 @@ div.full-correct-response-inline {
|
|
|
6554
6562
|
justify-content: center;
|
|
6555
6563
|
user-select: none;
|
|
6556
6564
|
}
|
|
6557
|
-
`];var
|
|
6565
|
+
`];var Lu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Wn=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Vd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return y`<slot part="label"></slot>`}};Lu([p({type:Number,reflect:!0})],Wn.prototype,"tabindex",void 0);var zd=[{tag:"qti-gap-img",ctor:Wn}];var rr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},jd={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function yt(o,t){class e extends o{#t;#e(){let i=this._interactionContext?.choiceRole??null;i!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=i,this.internals.role=i,i&&this.internals.states.add(i))}handleDisabledChange(n,i){i?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=i?-1:0}handleReadonlyChange(n,i){i?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=null,this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#e()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return y`<slot></slot>`}}return rr([p({type:String})],e.prototype,"identifier",void 0),rr([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),rr([p({type:Boolean,attribute:"aria-disabled",converter:jd})],e.prototype,"disabled",void 0),rr([p({type:Boolean,attribute:"aria-readonly",converter:jd})],e.prototype,"readonly",void 0),rr([_({context:vr,subscribe:!0}),T()],e.prototype,"_interactionContext",void 0),rr([$("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),rr([$("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var Fd=[O,q`
|
|
6558
6566
|
/*
|
|
6559
6567
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
6560
6568
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -6597,8 +6605,8 @@ div.full-correct-response-inline {
|
|
|
6597
6605
|
align-items: center;
|
|
6598
6606
|
justify-content: center;
|
|
6599
6607
|
}
|
|
6600
|
-
`];var
|
|
6601
|
-
<slot part="label"></slot>`}};
|
|
6608
|
+
`];var Vu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ce=class extends yt(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Fd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return y`<div part="control"></div>
|
|
6609
|
+
<slot part="label"></slot>`}};Vu([p({type:Number,reflect:!0})],Ce.prototype,"tabindex",void 0);var Bd=[{tag:"qti-gap-text",ctor:Ce}];var Ud=[O,q`
|
|
6602
6610
|
:host {
|
|
6603
6611
|
display: flex;
|
|
6604
6612
|
user-select: none;
|
|
@@ -6618,7 +6626,7 @@ div.full-correct-response-inline {
|
|
|
6618
6626
|
display: grid;
|
|
6619
6627
|
place-content: center;
|
|
6620
6628
|
}
|
|
6621
|
-
`];var
|
|
6629
|
+
`];var zu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},nr=class extends yt(C,"qti-hotspot-choice"){static{this.styles=Ud}};zu([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],nr.prototype,"order",void 0);var Hd=[{tag:"qti-hotspot-choice",ctor:nr}];var Wd=[O,q`
|
|
6622
6630
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
6623
6631
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
6624
6632
|
:host {
|
|
@@ -6638,8 +6646,8 @@ div.full-correct-response-inline {
|
|
|
6638
6646
|
[part='control'] {
|
|
6639
6647
|
display: none;
|
|
6640
6648
|
}
|
|
6641
|
-
`];var ir=class extends yt(C,"qti-hottext"){static{this.styles=
|
|
6642
|
-
<slot part="label"></slot>`}};var
|
|
6649
|
+
`];var ir=class extends yt(C,"qti-hottext"){static{this.styles=Wd}render(){return y`<div part="control"><div part="control-mark"></div></div>
|
|
6650
|
+
<slot part="label"></slot>`}};var Qd=[{tag:"qti-hottext",ctor:ir}];var ju=q`
|
|
6643
6651
|
/*
|
|
6644
6652
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
6645
6653
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
@@ -6656,13 +6664,13 @@ div.full-correct-response-inline {
|
|
|
6656
6664
|
slot {
|
|
6657
6665
|
display: inline;
|
|
6658
6666
|
}
|
|
6659
|
-
`,
|
|
6667
|
+
`,Gd=ju;var Fu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qn=class extends yt(C,"qti-inline-choice"){static{this.styles=Gd}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return y` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Fu([p({type:String})],Qn.prototype,"identifier",void 0);var Xd=[{tag:"qti-inline-choice",ctor:Qn}];var Yd=[O,q`
|
|
6660
6668
|
:host {
|
|
6661
6669
|
display: block;
|
|
6662
6670
|
margin: var(--qti-gap) 0;
|
|
6663
6671
|
width: 100%;
|
|
6664
6672
|
}
|
|
6665
|
-
`];var
|
|
6673
|
+
`];var xo=class extends C{static{this.styles=Yd}render(){return y`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Kd=[{tag:"qti-prompt",ctor:xo}];var Jd=[O,zt,q`
|
|
6666
6674
|
/*
|
|
6667
6675
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
6668
6676
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -6811,13 +6819,13 @@ div.full-correct-response-inline {
|
|
|
6811
6819
|
align-items: center;
|
|
6812
6820
|
justify-content: center;
|
|
6813
6821
|
}
|
|
6814
|
-
`];var
|
|
6822
|
+
`];var qo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},It=class extends yt(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Jd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return y`
|
|
6815
6823
|
<div part="control"></div>
|
|
6816
6824
|
<slot part="label"></slot>
|
|
6817
6825
|
<div part="drop">
|
|
6818
6826
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6819
6827
|
</div>
|
|
6820
|
-
`}};
|
|
6828
|
+
`}};qo([p({type:Number,attribute:"match-min"})],It.prototype,"matchMin",void 0);qo([p({type:Number,attribute:"match-max"})],It.prototype,"matchMax",void 0);qo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],It.prototype,"fixed",void 0);qo([_({context:qe,subscribe:!0}),T()],It.prototype,"_dragDrop",void 0);var Zd=[{tag:"qti-simple-associable-choice",ctor:It}];var th=[O,q`
|
|
6821
6829
|
/*
|
|
6822
6830
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
6823
6831
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -6853,9 +6861,9 @@ div.full-correct-response-inline {
|
|
|
6853
6861
|
align-items: center;
|
|
6854
6862
|
justify-content: center;
|
|
6855
6863
|
}
|
|
6856
|
-
`];var
|
|
6857
|
-
${this.marker?
|
|
6858
|
-
<slot part="label"></slot>`}};yn([p({type:String,attribute:"template-identifier"})],_t.prototype,"templateIdentifier",void 0);yn([p({type:String,attribute:"show-hide"})],_t.prototype,"showHide",void 0);yn([p({type:Boolean,converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],_t.prototype,"fixed",void 0);yn([p({type:String,attribute:!1})],_t.prototype,"marker",void 0);var Nd=[{tag:"qti-simple-choice",ctor:_t}];var $d=[...bd,...vd,...xd,...kd,...Sd,...Id,...Td,...Od,...Md,...Nd];var pu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o};function uu(n,t,e,r,i={}){let o=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=r.length?r:[n],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:l})!==!1&&(n.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(n.style.setProperty("--qti-dropzone-min-width",`${l}px`),n.style.setProperty("--qti-drag-min-width",`${l}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Qa=(n,t,e,r='slot[part="drags"]')=>{class i extends n{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#o=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#o;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(uu(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#o;return d&&d.height===c.height&&d.width===c.width?!1:(this.#o=c,!0)}}),this.#a(s),this.#n())}#n(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return pu([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Wt,AbortSignal:Ga,WeakMap:mu,WeakRef:fu,Window:Ld,reportError:vn=console.log}=globalThis,ke=n=>n&&n.defaultView!==null&&n.defaultView.document===n&&(n.defaultView.top===n.defaultView||ke(n.defaultView.parent.document)),or=()=>!!Ld&&globalThis instanceof Ld,Xa=Symbol("unset"),[Vd,gu]=(()=>{function n(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((y,v)=>(x=y,u=v)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new mu,o={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(o);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let y=r(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let l="any"in Ga?Ga.any.bind(Ga):x=>{let u=new Wt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){i.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):vn(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(or()&&!ke(document))return;try{y()}catch(v){vn(v)}}}}function f(x,u,g={}){if(or()&&!ke(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let v=i.get(x),I=v.weakSubscriber?.deref();if(I?.active){let E=I,k=i.get(E);k.observers.add(y),g.signal&&(g.signal.aborted?k.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=i.get(E);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(E,g.signal.reason))}));return}let S=new m(y);if(v.weakSubscriber=new fu(S),"signal"in g&&(g.signal.aborted?h(S,g.signal.reason):g.signal.addEventListener("abort",()=>{let E=i.get(S);E?.active&&(E.observers.delete(y),E.observers.size==0&&h(S,g.signal.reason))})),v.subscribeCallback)try{v.subscribeCallback(S)}catch(E){S.error(E)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Wt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||or()&&!ke(document))return;let y=new Set(g.observers);for(let v of y)v.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){vn(u);return}if(or()&&!ke(document))return;h(this,u);let y=new Set(g.observers);for(let v of y)v.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||or()&&!ke(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(or()&&!ke(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Wt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}n(m.prototype,"next"),n(m.prototype,"error"),n(m.prototype,"complete"),n(m.prototype,"addTeardown"),n(m.prototype,"active"),n(m.prototype,"signal");class w{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof w)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(S,E){if(S.signal.aborted)return;let k;try{let R=E.next();k=Promise.resolve(R)}catch(R){k=Promise.reject(R)}k.then(R=>{if(R===null||typeof R!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:v}=R)}catch(V){S.error(V);return}if(v){S.complete();return}let N;try{N=R.value}catch(V){S.error(V);return}S.next(N),I(S,E)},R=>{S.error(R)})},v=!1;return new w(S=>{if(S.signal.aborted)return;let E;try{E=a(u,!0)}catch(R){S.error(R);return}let k=E;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||v)return;t(()=>k.return(S.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(S,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new w(v=>{if(v.signal.aborted)return;let I;try{I=a(u,!1)}catch(k){v.error(k);return}let S=!1,E=I;if(!v.signal.aborted)for(v.signal.addEventListener("abort",()=>{if(typeof E.return!="function"||S)return;let k=E.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=E.next();if({done:S}=k,S){v.complete();return}if(v.next(k.value),v.signal.aborted)break}catch(k){v.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new w(v=>{u.then(I=>{v.next(I),v.complete()},I=>{v.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof w))throw new TypeError("illegal invocation");let g=this,y=w.from(u);return new w(v=>{let I=new d({next(){v.complete()},error(){v.complete()}}),S={signal:v.signal};if(f(y,I,S),!v.active)return;let E=new d({next(k){v.next(k)},error(k){v.error(k)},complete(){v.complete()}});f(g,E,S)})}map(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=new d({next(E){let k;try{k=u(E,v)}catch(R){y.error(R);return}v+=1,y.next(k)},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}inspect(u={}){let g=null,y=null,v=null,I=null,S=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(v=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(S=u.abort));let E=this;return new w(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let R=()=>{try{S!==null&&S(k.signal.reason)}catch(L){vn(L)}};k.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(y!==null)try{y(L)}catch(lt){k.signal.removeEventListener("abort",R),k.error(lt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",R),v!==null)try{v(L)}catch(lt){k.error(lt);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",R),I!==null)try{I()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(E,N,V)})}filter(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=new d({next(E){let k=!1;try{k=u(E,v)}catch(R){y.error(R);return}v+=1,k&&y.next(E)},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}take(u){if(!(this instanceof w))throw new TypeError("illegal invocation");let g=this;return new w(y=>{let v=u;if(v==0)return y.complete();let I=new d({next(E){y.next(E),v-=1,v==0&&y.complete()},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}drop(u){if(!(this instanceof w))throw new TypeError("illegal invocation");let g=this;return new w(y=>{let v=u,I=new d({next(E){if(v>0)return v-=1;v==0&&y.next(E)},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}flatMap(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=!1,S=[];function E(V){let L;try{L=u(V,v)}catch(Gt){return y.error(Gt)}v+=1;let lt;try{lt=w.from(L)}catch(Gt){return y.error(Gt)}let Ks=new d({next(Gt){y.next(Gt)},error(Gt){y.error(Gt)},complete(){if(S.length){let Gt=S.shift();E(Gt)}else k=!1,I&&y.complete()}}),Mt={signal:y.signal};f(lt,Ks,Mt)}let k=!1,R=new d({next(V){k?S.push(V):(k=!0,E(V))},error(V){y.error(V)},complete(){I=!0,!k&&!S.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=!1,S=null;function E(N){let V;try{V=u(N,v)}catch(Mt){return y.error(Mt)}v+=1;let L;try{L=w.from(V)}catch(Mt){return y.error(Mt)}let lt=new d({next(Mt){y.next(Mt)},error(Mt){y.error(Mt)},complete(Mt){I?y.complete():S=null}}),Ks={signal:c([S.signal,y.signal])};f(L,lt,Ks)}let k=new d({next(N){S&&S.abort(),S=new Wt,E(N)},error(N){y.error(N)},complete(){I=!0,S||y.complete()}}),R={signal:y.signal};f(g,k,R)})}catch(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(v=>{let I=new d({next(E){v.next(E)},error(E){let k;try{k=u(E)}catch(L){v.error(L);return}let R;try{R=w.from(k)}catch(L){v.error(L);return}let N=new d({next(L){v.next(L)},error(L){v.error(L)},complete(){v.complete()}}),V={signal:v.signal};f(R,N,V)},complete(){v.complete()}}),S={signal:v.signal};f(g,I,S)})}finally(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{y.addTeardown(u);let v=new d({next(S){y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),I={signal:y.signal};f(g,v,I)})}toArray(u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:v}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{v(u.signal.reason)})}let I=[],S=new d({next(E){I.push(E)},error(E){v(E)},complete(){y(I)}});return f(this,S,u),g}forEach(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Wt,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){try{u(N,k)}catch(V){I(V),S.abort(V)}k+=1},error(N){I(N)},complete(){v()}});return f(this,R,E),y}every(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Wt,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),S.abort(L)}k+=1,V||(v(!1),S.abort())},error(N){I(N)},complete(){v(!0)}});return f(this,R,E),y}first(u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:v}=e(),I=new Wt,S={signal:c([I.signal,u.signal])};if(S.signal.aborted)return v(S.signal.reason),g;S.signal.addEventListener("abort",()=>{v(S.signal.reason)});let E=new d({next(k){y(k),I.abort()},error(k){v(k)},complete(){v(new RangeError("No values in Observable"))}});return f(this,E,S),g}last(u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:v}=e();if(u.signal){if(u.signal.aborted)return v(u.signal.reason),g;u.signal.addEventListener("abort",()=>{v(u.signal.reason)})}let I=null,S=!1,E=new d({next(k){S=!0,I=k},error(k){v(k)},complete(){S?y(I):v(new RangeError("No values in Observable"))}});return f(this,E,u),g}find(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Wt,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),S.abort(L)}k+=1,V&&(v(N),S.abort())},error(N){I(N)},complete(){v()}});return f(this,R,E),y}some(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Wt,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),S.abort(L)}k+=1,V&&(v(!0),S.abort())},error(N){I(N)},complete(){v(!1)}});return f(this,R,E),y}reduce(u,g,y={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:I,reject:S}=e(),E=new Wt,k={signal:c([E.signal,y.signal])};if(k.signal.aborted)return S(k.signal.reason),v;k.signal.addEventListener("abort",()=>{S(k.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Xa,V=new d({next(L){if(N===Xa){N=L,R++;return}try{let lt=u(N,L,R);R++,N=lt}catch(lt){S(lt),E.abort(lt);return}},error(L){S(L)},complete(){N!==Xa?I(N):S(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),v}}return n(w.prototype,"subscribe"),[w,m]})();function zd(){return typeof globalThis.Observable=="function"}function jd(){Object.defineProperties(globalThis,{Observable:{value:Vd,configurable:!0,writable:!0},Subscriber:{value:gu,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(n,t={}){if(or()&&!ke(document))return;let e=this;return new Vd(r=>{if(!e||r.signal.aborted)return;let i=o=>{r.next(o)};e.addEventListener(n,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function Ya(n,t,e){let r=n.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let o=i.getBoundingClientRect();if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}function Fd(n,t,e,r){if(!r)return null;let i=n.filter(s=>!s.hasAttribute("disabled")),o=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(o.right<a.left||o.left>a.right||o.bottom<a.top||o.top>a.bottom))return s}return null}function Bd(n,t,e,r){let i=n.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let o,s;if(r){let c=r.getBoundingClientRect();o=c.left+c.width/2,s=c.top+c.height/2}else o=t,s=e;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(o-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function Ud(n,t,e,r){let i=n.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let o;if(r){let l=r.getBoundingClientRect();o=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else o=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let w of o)for(let x of d){let u=Math.sqrt(Math.pow(w.x-x.x,2)+Math.pow(w.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function bu(n,t,e){let r=n.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function yu(n,t,e,r,i){let o=i&&i.length>0?n.filter(g=>i.includes(g)):n.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=n.filter(g=>!o.includes(g));if(o.length===0&&a.length===0)return null;let l;if(r){let g=r.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let y=g.getBoundingClientRect(),v=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],I=0,S=0;for(let E of l)for(let k of v){let R=Math.sqrt(Math.pow(E.x-k.x,2)+Math.pow(E.y-k.y,2));I+=R,S++}return I/S},d=null,h=1/0;for(let g of o){let y=c(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=c(g);y<m&&(m=y,f=g)}if(d&&r){let g=r.getBoundingClientRect(),y=d.getBoundingClientRect(),v=g.left+g.width/2,I=g.top+g.height/2;if(v>=y.left&&v<=y.right&&I>=y.top&&I<=y.bottom)return d}if(f&&bu(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Hd(n){switch(n){case"pointerWithin":return Ya;case"rectangleIntersection":return Fd;case"closestCenter":return Bd;case"closestCorners":return Ud;case"closestCornersWithInventoryPriority":return yu;default:return Ya}}function Nr(n,t,e,r,i="pointerWithin",o){return Hd(i)(n,t,e,r,o)}function Ee(n,t){let e=n.composedPath?n.composedPath():[n.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("qti-draggable"))return r;let i=r.closest(t)||r.closest('[qti-draggable="true"]');if(i)return i}return null}function Ui(n){return n?n.hasAttribute("disabled")?!0:n.internals?.states?.has("disabled")??!1:!1}var Ka=n=>n?.internals;function Tt(n,t,e){let r=Ka(n)?.states;r&&(e?r.add(t):r.delete(t))}function wn(n,t){return Ka(n)?.states?.has(t)??!1}function Hi(n){Tt(n,"dragging",!1),Tt(n,"placeholder",!1),Tt(n,"return-anchor",!1)}function nr(n){return wn(n,"dragging")||wn(n,"placeholder")}function ne(n,t,e){if(!n)return;e?n.setAttribute(t,""):n.removeAttribute(t);let r=Ka(n)?.states;if(r){e?r.add(t):r.delete(t);return}let i=new Set((n.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(e?i.add(t):i.delete(t),n.setAttribute("part",[...i].join(" ")))}function $r(n,t){ne(n,"filled",t)}function Lr(n,t){let e=[];return n.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Wd(n,t){let e=n.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Ja={origin:{x:0,y:0},scale:{x:1,y:1}},xn=100,vu=n=>{let t=n.fullscreenElement??n.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},wu=n=>{let t=n.shadowRoot;return t?t.querySelector("slot:not([name])")?n:t:n},xu=(n,t)=>{let e=t;for(;e;){if(e===n)return!0;e=e.parentNode??e.host??null}return!1},Za=(n,t)=>{let e=n.ownerDocument??document,r=t??e.body,i=vu(e);return i&&!xu(i,r)?wu(i):r},tc=n=>{let e=(n.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${xn}px;height:${xn}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,n.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/xn||1,y:r.height/xn||1}}},Qd=(n,t,e)=>({x:(t-n.origin.x)/n.scale.x,y:(e-n.origin.y)/n.scale.y});zd()||jd();var Gd=new WeakSet;function qu(n){!n||Gd.has(n)||(n.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Gd.add(n))}var Xd=n=>!!n.internals?.states,qn=(n,t,e,r='slot[part="drags"]',i="pointerWithin")=>{class o extends n{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Ja,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let l=a;if(l.context!==yr)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),qu(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#r;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(k,R)=>Array.from(R?.querySelectorAll(k)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),w=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...w]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),v=new Set(this.trackedDroppables),I=g?y:new Set,S=g?v:new Set,E=new Set([...y,...v].filter(Xd));for(let k of this.#t)E.has(k)||(k.internals.states.delete("drag"),k.internals.states.delete("droppable"));for(let k of E){let R=I.has(k),N=!R&&S.has(k);R?k.internals.states.add("drag"):k.internals.states.delete("drag"),N?k.internals.states.add("droppable"):k.internals.states.delete("droppable")}this.#t=E,this.trackedDraggables.forEach(k=>{let R=nr(k);g&&!R?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("qti-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("qti-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let w=Ee(m,t),x=this.disabled||this.readonly,u=Ui(w)||nr(w),g=Date.now()-this.lastTouchStartAt<50;return w&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let w=Ee(m,t);if(!w){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let w=Ee(m,t),x=this.disabled||this.readonly,u=Ui(w)||nr(w),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return w&&g&&!x&&!u&&!y}).subscribe(m=>{let w=Ee(m,t);!w||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(w,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let w=Ee(m,t),x=this.disabled||this.readonly,u=Ui(w)||nr(w),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return w&&g&&!x&&!u&&!y}).subscribe(m=>{let w=Ee(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!w||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(w,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let w=this.trackedDraggables.filter(u=>!nr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Ee(m,t),g=this.disabled||this.readonly,y=Ui(u)||nr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:w.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let w=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(w),u=this.trackedDroppables.find(w)||null;a.getAnimations().forEach(y=>y.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let v=Lr(this.trackedDragContainers,y);v.forEach(I=>Tt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=v}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Tt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let v=this.dragState.dragSource,I=this.dragState.pointerId;v&&I!==void 0&&v.setPointerCapture&&v.setPointerCapture(I)}catch{}let g=v=>{v.cancelable&&(v.preventDefault(),l==="pointer"&&v.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let v=this.dragState.dragSource,I=this.dragState.pointerId;v&&I!==void 0&&v.releasePointerCapture&&v.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),w=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];w&&u.push(w),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Nr(this.allDropzones,a,l,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);c!==this.dragState.currentTarget&&(c===null||h>=50)&&(this.allDropzones.forEach(m=>ne(m,"hover",!1)),c&&ne(c,"hover",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let w=l.getBoundingClientRect();h=Nr(this.allDropzones,w.left+w.width/2,w.top+w.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Tt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(w=>{Tt(w,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){Hi(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}let h=Za(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=tc(h),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.style.opacity="0.8",c.removeAttribute("qti-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=Qd(this.cloneFrame,a-c.x,l-c.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,l=()=>{let{dragClone:c,dragSource:d,lastCoordinates:h}=this.dragState;if(!c)return;let f=d?.isConnected?d:this,m=Za(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=tc(m),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{ne(a,"enabled",!0),ne(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ne(a,"enabled",!1),ne(a,"active",!1),ne(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Tt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Ja,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)Xd(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return o};var Yd={duration:250,easing:"ease",fill:"both"};function ec(n){let t=n.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Kd(n){return{left:n.left,top:n.top,width:n.width,height:n.height}}function Se(n){let t=new Map;return n.forEach(e=>{t.set(e,ec(e))}),t}function Jd(n,t){return{deltaX:n.left-t.left,deltaY:n.top-t.top,deltaW:n.width/t.width,deltaH:n.height/t.height}}function Cn(n){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!n)return 1;let t=getComputedStyle(n).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function rc(n){return Cn(n)>0}function kn(n,t,e={}){let r=Cn(n);if(r<=0)return null;let i=ec(n),{deltaX:o,deltaY:s,deltaW:a,deltaH:l}=Jd(t,i);if(o===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Yd,...e};return n.animate([{transformOrigin:"top left",transform:`translate(${o}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function Ae(n,t={}){let e=new Map;return n.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let o=kn(i,r,t);o&&e.set(i,o)}),e}var Wi=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Rt=(n,t,e,r='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let o=Qa(n,t,e,r),s=qn(o,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let c=this.tagName?.toLowerCase()||"";(c==="qti-graphic-gap-match-interaction"||c==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(c){let d=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",d)}#t;isSwapTarget(c){let d=this.dragState.sourceDroppable,h=parseInt(c.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(c)&&!!d&&d!==c&&this.trackedDroppables.includes(d)}isDeclarativeTarget(c){return c?c.acceptsDeclarativeDrops===!0?!0:c.hasAttribute("data-declarative-drops"):!1}chipsIn(c){return this.isDeclarativeTarget(c)?[...this.#t.get(c)??[]]:Array.from(c.querySelectorAll(t))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#t.set(c,[...this.#t.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&$r(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#t.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),$r(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let w=this.chipsIn(f),x=this.isDeclarativeTarget(f)?w:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=w.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(w.length,x.length),h[m]=w}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&rc(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,w=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(w)?w:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(wn(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let w=this.totalAssociationsFromState(),x=this.maxAssociations>0&&w>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{kn(c,Kd(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){Hi(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Lr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let I=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),w=Number.isNaN(m)?1:m,x=w===0||w>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Se(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let S=I.getAttribute("identifier"),E=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let k=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;R?(this.placeChip(R,I),$r(R,!0),this.animateReturn(I,E)):S&&this.restoreOriginalInInventory(S,E)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),$r(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Ae(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),S=h.left-I.left,E=h.top-I.top;(S!==0||E!==0)&&y.animate([{transform:`translate(${S}px, ${E}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let v=c.getAttribute("identifier");v&&this.updateInventoryBasedOnMatchMax(v),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(w=>w.getAttribute("identifier")===h);m.forEach(w=>this.removeChipFromDroppable(f,w)),m.length>0&&this.chipsIn(f).length===0&&$r(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Lr(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let w=this.enableFlipAnimations&&m.length>0?Se(m):null;h.forEach(x=>{Hi(x),x.style.display="",x.style.visibility="visible"}),w&&this.enableFlipAnimations&&Ae(w,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Lr(this.trackedDragContainers,c),h=Wd(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,w)=>this.isDeclarativeTarget(w)?m+this.chipsIn(w).filter(x=>x.getAttribute("identifier")===c).length:m+w.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{Tt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",w=!0;h?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,w=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,w=!1):f?(m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,w=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(w,m,x,{suppressInline:!0}),w}reportValidity(){return super.reportValidity()}}return Wi([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),Wi([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),Wi([B({context:qe})],a.prototype,"_dragDrop",void 0),Wi([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),Wi([p({attribute:"response",reflect:!1,noAccessor:!0,converter:zt({emptyAs:[]})})],a.prototype,"response",null),a};var En=class{getInsertPosition(t,e,r,i,o){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(o-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Zd=new En;var Cu={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function Qi(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Sn(n){n.placeholder?.remove(),n.placeholder=null,n.lastHoverTarget=null,n.lastPlacement=null,n.sortContainer=null}function An(n,t,e={}){let r={...Cu,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(n).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(n).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*Cn(n)}ms ease`,i.style.pointerEvents="none",i}function ic(n,t){for(let e of t)if(e.contains(n)&&e!==n)return e;return null}var Ot=(n,t='[qti-draggable="true"]')=>{class e extends n{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=Qi(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#o=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#o;#n;set allowReorder(i){this.#n=i}get allowReorder(){return this.#n??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return ic(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let o=this.#c(i);return o===0||o>1}#c(i){let o=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(o)?1:o}#h(i){return i.querySelectorAll(t).length}#l(i){let o=this.#c(i);return o===0?!1:this.#h(i)>=o}#u(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#t||i===this.#t){this.#p();return}if(this.#i.hoveredSlot===i)return;this.#p();let o=this.#s(i);if(!o){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=Se([o]);this.#i.originalPositions.set(o,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(o),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,Ae(a,this.sortableAnimationConfig)}#p(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),o=i.length>0?Se(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),o&&Ae(o,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,o,s,a,...l){this.#t=null,this.#r=Qi(),this.#u();let c=this.findContainingDroppable(i);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#r.sortContainer=c;let h=i.getBoundingClientRect();this.#r.placeholder=An(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#o.add(m)}})}let[d]=l;super.initiateDrag(i,o,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[o,s]of this.#i.originalPositions)s.appendChild(o);this.#r.placeholder&&this.#r.placeholder.remove(),Sn(this.#r),this.#o.clear(),this.#t=null,this.#u()}onSortableDragMove(i,o){if(!this.isDraggingFromSlot)return;let s=Nr(this.trackedDroppables,i,o,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#p()}handleDragMove(i,o){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,o),this.onSortableDragMove(i,o)}allowDrop(i,o){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&o!==this.#e&&this.trackedDroppables.includes(o)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(o)?this.#a(o)?!this.#l(o):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(o)?!0:super.allowDrop(i,o)}handleDrop(i,o){super.handleDrop(i,o),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var th=[O,U,Vt,q`
|
|
6864
|
+
`];var Co=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},_t=class extends yt(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=th}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return y`<div part="control" tabindex="0"><div part="control-mark"></div></div>
|
|
6865
|
+
${this.marker?y`<div id="label" part="marker">${this.marker}</div>`:M}
|
|
6866
|
+
<slot part="label"></slot>`}};Co([p({type:String,attribute:"template-identifier"})],_t.prototype,"templateIdentifier",void 0);Co([p({type:String,attribute:"show-hide"})],_t.prototype,"showHide",void 0);Co([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],_t.prototype,"fixed",void 0);Co([p({type:String,attribute:!1})],_t.prototype,"marker",void 0);var eh=[{tag:"qti-simple-choice",ctor:_t}];var rh=[...Nd,...Ld,...zd,...Bd,...Hd,...Qd,...Xd,...Kd,...Zd,...eh];var Bu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i};function Uu(o,t,e,r,n={}){let i=n.publishWidth??!0,s=n.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),n.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var al=(o,t,e,r='slot[part="drags"]')=>{class n extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#n=0,this.#i=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#n;#i;collectAutoSizeTargets(){let s=(a,c)=>Array.from(c?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:c}=this.collectAutoSizeTargets();s.length!==0&&(Uu(this.dropzonePropertyTarget(),s,a,c,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:l=>{let d=this.#i;return d&&d.height===l.height&&d.width===l.width?!1:(this.#i=l,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#n||(this.#n=requestAnimationFrame(()=>{this.#n=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let c of this.#e)a.has(c)||this.#t.unobserve(c);for(let c of a)this.#e.has(c)||this.#t.observe(c);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#n&&cancelAnimationFrame(this.#n),this.#n=0,super.disconnectedCallback()}}return Bu([p({type:Boolean,attribute:"auto-size-dropzones"})],n.prototype,"autoSizeDropzones",void 0),n};var{AbortController:Wt,AbortSignal:ll,WeakMap:Hu,WeakRef:Wu,Window:nh,reportError:Eo=console.log}=globalThis,Ee=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ee(o.defaultView.parent.document)),or=()=>!!nh&&globalThis instanceof nh,cl=Symbol("unset"),[ih,Qu]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,w)=>(x=b,u=w)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let n=new Hu,i={next(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(i);return n.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let c="any"in ll?ll.any.bind(ll):x=>{let u=new Wt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){n.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=n.get(this)||{};g&&g(u)}error(u){let{error:g}=n.get(this)||{};g?g(u):Eo(u)}complete(){let{complete:u}=n.get(this)||{};u&&u()}}function h(x,u){let g=n.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(or()&&!Ee(document))return;try{b()}catch(w){Eo(w)}}}}function f(x,u,g={}){if(or()&&!Ee(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let w=n.get(x),I=w.weakSubscriber?.deref();if(I?.active){let k=I,E=n.get(k);E.observers.add(b),g.signal&&(g.signal.aborted?E.observers.delete(b):g.signal.addEventListener("abort",()=>{let R=n.get(k);R?.active&&(R.observers.delete(b),R.observers.size==0&&h(k,g.signal.reason))}));return}let A=new m(b);if(w.weakSubscriber=new Wu(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=n.get(A);k?.active&&(k.observers.delete(b),k.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(k){A.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");n.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Wt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active||or()&&!Ee(document))return;let b=new Set(g.observers);for(let w of b)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active){Eo(u);return}if(or()&&!Ee(document))return;h(this,u);let b=new Set(g.observers);for(let w of b)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=n.get(this);if(!u?.active||or()&&!Ee(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(or()&&!Ee(document))return;let g=n.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!n.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!n.has(this)){let u=new Wt;return u.abort(),u.signal}return n.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");n.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(A,k){if(A.signal.aborted)return;let E;try{let R=k.next();E=Promise.resolve(R)}catch(R){E=Promise.reject(R)}E.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(V){A.error(V);return}if(w){A.complete();return}let N;try{N=R.value}catch(V){A.error(V);return}A.next(N),I(A,k)},R=>{A.error(R)})},w=!1;return new v(A=>{if(A.signal.aborted)return;let k;try{k=a(u,!0)}catch(R){A.error(R);return}let E=k;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof E.return!="function"||w)return;t(()=>E.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(A,E))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let I;try{I=a(u,!1)}catch(E){w.error(E);return}let A=!1,k=I;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||A)return;let E=k.return();if(E===null||typeof E!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let E=k.next();if({done:A}=E,A){w.complete();return}if(w.next(E.value),w.signal.aborted)break}catch(E){w.error(E);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(I=>{w.next(I),w.complete()},I=>{w.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,b=v.from(u);return new v(w=>{let I=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(b,I,A),!w.active)return;let k=new d({next(E){w.next(E)},error(E){w.error(E)},complete(){w.complete()}});f(g,k,A)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(b=>{let w=0,I=new d({next(k){let E;try{E=u(k,w)}catch(R){b.error(R);return}w+=1,b.next(E)},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,I,A)})}inspect(u={}){let g=null,b=null,w=null,I=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(w=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(A=u.abort));let k=this;return new v(E=>{if(g!==null)try{g()}catch(L){E.error(L);return}let R=()=>{try{A!==null&&A(E.signal.reason)}catch(L){Eo(L)}};E.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(b!==null)try{b(L)}catch(ct){E.signal.removeEventListener("abort",R),E.error(ct);return}E.next(L)},error(L){if(E.signal.removeEventListener("abort",R),w!==null)try{w(L)}catch(ct){E.error(ct);return}E.error(L)},complete(){if(E.signal.removeEventListener("abort",R),I!==null)try{I()}catch(L){E.error(L);return}E.complete()}}),V={signal:E.signal};f(k,N,V)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(b=>{let w=0,I=new d({next(k){let E=!1;try{E=u(k,w)}catch(R){b.error(R);return}w+=1,E&&b.next(k)},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,I,A)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(b=>{let w=u;if(w==0)return b.complete();let I=new d({next(k){b.next(k),w-=1,w==0&&b.complete()},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,I,A)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(b=>{let w=u,I=new d({next(k){if(w>0)return w-=1;w==0&&b.next(k)},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,I,A)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(b=>{let w=0,I=!1,A=[];function k(V){let L;try{L=u(V,w)}catch(Gt){return b.error(Gt)}w+=1;let ct;try{ct=v.from(L)}catch(Gt){return b.error(Gt)}let sa=new d({next(Gt){b.next(Gt)},error(Gt){b.error(Gt)},complete(){if(A.length){let Gt=A.shift();k(Gt)}else E=!1,I&&b.complete()}}),Pt={signal:b.signal};f(ct,sa,Pt)}let E=!1,R=new d({next(V){E?A.push(V):(E=!0,k(V))},error(V){b.error(V)},complete(){I=!0,!E&&!A.length&&b.complete()}}),N={signal:b.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(b=>{let w=0,I=!1,A=null;function k(N){let V;try{V=u(N,w)}catch(Pt){return b.error(Pt)}w+=1;let L;try{L=v.from(V)}catch(Pt){return b.error(Pt)}let ct=new d({next(Pt){b.next(Pt)},error(Pt){b.error(Pt)},complete(Pt){I?b.complete():A=null}}),sa={signal:l([A.signal,b.signal])};f(L,ct,sa)}let E=new d({next(N){A&&A.abort(),A=new Wt,k(N)},error(N){b.error(N)},complete(){I=!0,A||b.complete()}}),R={signal:b.signal};f(g,E,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let I=new d({next(k){w.next(k)},error(k){let E;try{E=u(k)}catch(L){w.error(L);return}let R;try{R=v.from(E)}catch(L){w.error(L);return}let N=new d({next(L){w.next(L)},error(L){w.error(L)},complete(){w.complete()}}),V={signal:w.signal};f(R,N,V)},complete(){w.complete()}}),A={signal:w.signal};f(g,I,A)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(b=>{b.addTeardown(u);let w=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),I={signal:b.signal};f(g,w,I)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=[],A=new d({next(k){I.push(k)},error(k){w(k)},complete(){b(I)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:w,reject:I}=e(),A=new Wt,k={signal:l([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),b;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let E=0,R=new d({next(N){try{u(N,E)}catch(V){I(V),A.abort(V)}E+=1},error(N){I(N)},complete(){w()}});return f(this,R,k),b}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:w,reject:I}=e(),A=new Wt,k={signal:l([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),b;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let E=0,R=new d({next(N){let V=!1;try{V=u(N,E)}catch(L){I(L),A.abort(L)}E+=1,V||(w(!1),A.abort())},error(N){I(N)},complete(){w(!0)}});return f(this,R,k),b}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:w}=e(),I=new Wt,A={signal:l([I.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let k=new d({next(E){b(E),I.abort()},error(E){w(E)},complete(){w(new RangeError("No values in Observable"))}});return f(this,k,A),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=null,A=!1,k=new d({next(E){A=!0,I=E},error(E){w(E)},complete(){A?b(I):w(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:w,reject:I}=e(),A=new Wt,k={signal:l([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),b;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let E=0,R=new d({next(N){let V=!1;try{V=u(N,E)}catch(L){I(L),A.abort(L)}E+=1,V&&(w(N),A.abort())},error(N){I(N)},complete(){w()}});return f(this,R,k),b}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:w,reject:I}=e(),A=new Wt,k={signal:l([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),b;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let E=0,R=new d({next(N){let V=!1;try{V=u(N,E)}catch(L){I(L),A.abort(L)}E+=1,V&&(w(!0),A.abort())},error(N){I(N)},complete(){w(!1)}});return f(this,R,k),b}reduce(u,g,b={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:I,reject:A}=e(),k=new Wt,E={signal:l([k.signal,b.signal])};if(E.signal.aborted)return A(E.signal.reason),w;E.signal.addEventListener("abort",()=>{A(E.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:cl,V=new d({next(L){if(N===cl){N=L,R++;return}try{let ct=u(N,L,R);R++,N=ct}catch(ct){A(ct),k.abort(ct);return}},error(L){A(L)},complete(){N!==cl?I(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,E),w}}return o(v.prototype,"subscribe"),[v,m]})();function oh(){return typeof globalThis.Observable=="function"}function sh(){Object.defineProperties(globalThis,{Observable:{value:ih,configurable:!0,writable:!0},Subscriber:{value:Qu,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(or()&&!Ee(document))return;let e=this;return new ih(r=>{if(!e||r.signal.aborted)return;let n=i=>{r.next(i)};e.addEventListener(o,n,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function dl(o,t,e){let r=o.filter(n=>!n.hasAttribute("disabled"));for(let n of r){let i=n.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return n}return null}function ah(o,t,e,r){if(!r)return null;let n=o.filter(s=>!s.hasAttribute("disabled")),i=r.getBoundingClientRect();for(let s of n){let a=s.getBoundingClientRect();if(!(i.right<a.left||i.left>a.right||i.bottom<a.top||i.top>a.bottom))return s}return null}function lh(o,t,e,r){let n=o.filter(l=>!l.hasAttribute("disabled"));if(n.length===0)return null;let i,s;if(r){let l=r.getBoundingClientRect();i=l.left+l.width/2,s=l.top+l.height/2}else i=t,s=e;let a=null,c=1/0;for(let l of n){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(i-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function ch(o,t,e,r){let n=o.filter(c=>!c.hasAttribute("disabled"));if(n.length===0)return null;let i;if(r){let c=r.getBoundingClientRect();i=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}]}else i=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let c of n){let l=c.getBoundingClientRect(),d=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}],h=0,f=0;for(let v of i)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function Gu(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function Xu(o,t,e,r,n){let i=n&&n.length>0?o.filter(g=>n.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!i.includes(g));if(i.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let b=g.getBoundingClientRect(),w=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],I=0,A=0;for(let k of c)for(let E of w){let R=Math.sqrt(Math.pow(k.x-E.x,2)+Math.pow(k.y-E.y,2));I+=R,A++}return I/A},d=null,h=1/0;for(let g of i){let b=l(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=l(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),w=g.left+g.width/2,I=g.top+g.height/2;if(w>=b.left&&w<=b.right&&I>=b.top&&I<=b.bottom)return d}if(f&&Gu(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function dh(o){switch(o){case"pointerWithin":return dl;case"rectangleIntersection":return ah;case"closestCenter":return lh;case"closestCorners":return ch;case"closestCornersWithInventoryPriority":return Xu;default:return dl}}function Vr(o,t,e,r,n="pointerWithin",i){return dh(n)(o,t,e,r,i)}function ke(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("qti-draggable"))return r;let n=r.closest(t)||r.closest('[qti-draggable="true"]');if(n)return n}return null}function Gn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var hl=o=>o?.internals;function Tt(o,t,e){let r=hl(o)?.states;r&&(e?r.add(t):r.delete(t))}function ko(o,t){return hl(o)?.states?.has(t)??!1}function Xn(o){Tt(o,"dragging",!1),Tt(o,"placeholder",!1),Tt(o,"return-anchor",!1)}function sr(o){return ko(o,"dragging")||ko(o,"placeholder")}function oe(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let r=hl(o)?.states;if(r){e?r.add(t):r.delete(t);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));n.has("drop")&&(e?n.add(t):n.delete(t),o.setAttribute("part",[...n].join(" ")))}function zr(o,t){oe(o,"filled",t)}function jr(o,t){let e=[];return o.forEach(r=>{let n=[];r.tagName.toLowerCase()==="slot"?n=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):n=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...n)}),e}function hh(o,t){let e=o.find(n=>n.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var pl={origin:{x:0,y:0},scale:{x:1,y:1}},So=100,Yu=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Ku=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Ju=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},ul=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,n=Yu(e);return n&&!Ju(n,r)?Ku(n):r},ml=o=>{let e=(o.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${So}px;height:${So}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/So||1,y:r.height/So||1}}},ph=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});oh()||sh();var uh=new WeakSet;function Zu(o){!o||uh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),uh.add(o))}var mh=o=>!!o.internals?.states,Ao=(o,t,e,r='slot[part="drags"]',n="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=n,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=pl,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==vr)return;let l=c.contextTarget;l instanceof HTMLElement&&this.#e.add(l)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),Zu(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,c){c.remove()}#e;#r;registeredMatching(a){for(let c of this.#e)c.isConnected||this.#e.delete(c);return[...this.#e].filter(c=>c.matches(a))}cacheInteractiveElements(){let a=(E,R)=>Array.from(R?.querySelectorAll(E)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),I=g?b:new Set,A=g?w:new Set,k=new Set([...b,...w].filter(mh));for(let E of this.#t)k.has(E)||(E.internals.states.delete("drag"),E.internals.states.delete("droppable"));for(let E of k){let R=I.has(E),N=!R&&A.has(E);R?E.internals.states.add("drag"):E.internals.states.delete("drag"),N?E.internals.states.add("droppable"):E.internals.states.delete("droppable")}this.#t=k,this.trackedDraggables.forEach(E=>{let R=sr(E);g&&!R?(E.style.cursor="grab",E.style.userSelect="none",E.style.touchAction="none",E.style.webkitUserSelect="none",E.style.webkitTouchCallout="none",E.setAttribute("qti-draggable","true"),E.setAttribute("tabindex","0")):(E.style.cursor="",E.style.userSelect="",E.style.touchAction="",E.style.webkitUserSelect="",E.style.webkitTouchCallout="",E.removeAttribute("qti-draggable"),E.getAttribute("tabindex")==="0"&&E.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let v=ke(m,t),x=this.disabled||this.readonly,u=Gn(v)||sr(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=ke(m,t);if(!v){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let v=ke(m,t),x=this.disabled||this.readonly,u=Gn(v)||sr(v),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!b}).subscribe(m=>{let v=ke(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=ke(m,t),x=this.disabled||this.readonly,u=Gn(v)||sr(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!b}).subscribe(m=>{let v=ke(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let v=this.trackedDraggables.filter(u=>!sr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=ke(m,t),g=this.disabled||this.readonly,b=Gn(u)||sr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let v=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let w=jr(this.trackedDragContainers,b);w.forEach(I=>Tt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Tt(a,"dragging",!0);this.updateClonePosition(c,l),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.setPointerCapture&&w.setPointerCapture(I)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),c==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=b}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(c==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),v=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=Vr(this.allDropzones,a,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);l!==this.dragState.currentTarget&&(l===null||h>=50)&&(this.allDropzones.forEach(m=>oe(m,"hover",!1)),l&&oe(l,"hover",!0),this.dragState.currentTarget=l,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:c,currentTarget:l,sourceDroppable:d}=this.dragState,h=l;if(c){let v=c.getBoundingClientRect();h=Vr(this.allDropzones,v.left+v.width/2,v.top+v.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Tt(a,"dragging",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{Tt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){Xn(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}let h=ul(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=ml(h),l.style.position="fixed",l.style.width=`${c.width/this.cloneFrame.scale.x}px`,l.style.height=`${c.height/this.cloneFrame.scale.y}px`,l.style.zIndex="9999",l.style.pointerEvents="none",l.style.touchAction="none",l.style.userSelect="none",l.style.opacity="0.8",l.removeAttribute("qti-draggable"),l.removeAttribute("tabindex"),l.setAttribute("data-drag-clone","true"),l.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(l),l}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,c){if(this.dragState.lastCoordinates={x:a,y:c},!this.dragState.dragClone)return;let{startOffset:l}=this.dragState,{x:d,y:h}=ph(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=ul(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=ml(m),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",c),a.addEventListener("webkitfullscreenchange",c),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",c),a.removeEventListener("webkitfullscreenchange",c)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{oe(a,"enabled",!0),oe(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{oe(a,"enabled",!1),oe(a,"active",!1),oe(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Tt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=pl,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,c){let l=this._internals;l?.states&&(c?l.states.add(a):l.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)mh(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var fh={duration:250,easing:"ease",fill:"both"};function fl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function gh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Se(o){let t=new Map;return o.forEach(e=>{t.set(e,fl(e))}),t}function bh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Io(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function gl(o){return Io(o)>0}function _o(o,t,e={}){let r=Io(o);if(r<=0)return null;let n=fl(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:c}=bh(t,n);if(i===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...fh,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function Ae(o,t={}){let e=new Map;return o.forEach((r,n)=>{if(!(n instanceof HTMLElement))return;let i=_o(n,r,t);i&&e.set(n,i)}),e}var Yn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Rt=(o,t,e,r='slot[part="drags"]',n="closestCornersWithInventoryPriority")=>{let i=al(o,t,e,r),s=Ao(i,t,e,r,n);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let l=this.tagName?.toLowerCase()||"";(l==="qti-graphic-gap-match-interaction"||l==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(l){let d=this._maxAssociations;this._maxAssociations=l,this.requestUpdate("maxAssociations",d)}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&zr(h,!1),this.syncDragDropState();return}d.remove()}clearChips(l){this.isDeclarativeTarget(l)?(this.#t.set(l,[]),this.syncDragDropState()):this.chipsIn(l).forEach(d=>d.remove()),zr(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));l[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&gl(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if(ko(l,"dragging")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{_o(l,gh(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){Xn(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=jr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let I=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Se(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let A=I.getAttribute("identifier"),k=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let E=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&E&&E!==d&&this.isDeclarativeTarget(E)?E:null;R?(this.placeChip(R,I),zr(R,!0),this.animateReturn(I,k)):A&&this.restoreOriginalInInventory(A,k)}}let b=l.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("qti-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part","drag"),b.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),zr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Ae(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=b.getBoundingClientRect(),A=h.left-I.left,k=h.top-I.top;(A!==0||k!==0)&&b.animate([{transform:`translate(${A}px, ${k}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=l.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&zr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=jr(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?Se(m):null;h.forEach(x=>{Xn(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&Ae(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=jr(this.trackedDragContainers,l),h=hh(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===l).length:m+v.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{Tt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",v=!0;h?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):f?(m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return Yn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),Yn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),Yn([B({context:qe})],a.prototype,"_dragDrop",void 0),Yn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),Yn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Ft({emptyAs:[]})})],a.prototype,"response",null),a};var To=class{getInsertPosition(t,e,r,n,i){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(i-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var yh=new To;var tm={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function Kn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Ro(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Oo(o,t,e={}){let r={...tm,...e},n=document.createElement("div");return n.setAttribute("data-drop-placeholder","true"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.style.margin=window.getComputedStyle(o).margin,n.style.boxSizing="border-box",n.style.border=`${r.borderStyle} ${r.borderColor}`,n.style.borderRadius=getComputedStyle(o).borderRadius,n.style.background=r.background,n.style.transition=`transform ${r.transitionDuration*Io(o)}ms ease`,n.style.pointerEvents="none",n}function bl(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ot=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=Kn(),this.#n={hoveredSlot:null,originalPositions:new Map},this.#i=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#n;#i;#o;set allowReorder(n){this.#o=n}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(n){return bl(n,this.trackedDroppables)}#s(n){return n.querySelector(t)}#a(n){let i=this.#l(n);return i===0||i>1}#l(n){let i=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#h(n){return n.querySelectorAll(t).length}#c(n){let i=this.#l(n);return i===0?!1:this.#h(n)>=i}#u(){this.#n={hoveredSlot:null,originalPositions:new Map}}#d(n){if(!this.#t||n===this.#t){this.#p();return}if(this.#n.hoveredSlot===n)return;this.#p();let i=this.#s(n);if(!i){this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#n.hoveredSlot=n;return}if(this.#a(n)){if(this.#c(n)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#n.hoveredSlot=null;return}this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#n.hoveredSlot=n;return}if(this.isDeclarativeTarget(n)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#n.hoveredSlot=n;return}let a=Se([i]);this.#n.originalPositions.set(i,n),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(i),this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#n.hoveredSlot=n,Ae(a,this.sortableAnimationConfig)}#p(){if(this.#n.originalPositions.size===0&&this.#n.hoveredSlot===null)return;let n=Array.from(this.#n.originalPositions.keys()),i=n.length>0?Se(n):null;for(let[s,a]of this.#n.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),i&&Ae(i,this.sortableAnimationConfig),this.#n.originalPositions.clear(),this.#n.hoveredSlot=null}initiateDrag(n,i,s,a,...c){this.#t=null,this.#r=Kn(),this.#u();let l=this.findContainingDroppable(n);if(this.#e=l,l&&this.allowReorder){this.#t=l,this.#r.sortContainer=l;let h=n.getBoundingClientRect();this.#r.placeholder=Oo(n,h,this.sortablePlaceholderConfig);let f=n.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#c(m))return;m.removeAttribute("disabled"),this.#i.add(m)}})}let[d]=c;super.initiateDrag(n,i,s,a,d)}cleanupSortableState(n=!0){if(n)for(let[i,s]of this.#n.originalPositions)s.appendChild(i);this.#r.placeholder&&this.#r.placeholder.remove(),Ro(this.#r),this.#i.clear(),this.#t=null,this.#u()}onSortableDragMove(n,i){if(!this.isDraggingFromSlot)return;let s=Vr(this.trackedDroppables,n,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#p()}handleDragMove(n,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,i),this.onSortableDragMove(n,i)}allowDrop(n,i){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&i!==this.#e&&this.trackedDroppables.includes(i)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(i)?this.#a(i)?!this.#c(i):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(i)?!0:super.allowDrop(n,i)}handleDrop(n,i){super.handleDrop(n,i),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var vh=[O,U,zt,q`
|
|
6859
6867
|
:host {
|
|
6860
6868
|
display: block; /* necessary to calculate scaling position */
|
|
6861
6869
|
}
|
|
@@ -6908,18 +6916,18 @@ div.full-correct-response-inline {
|
|
|
6908
6916
|
:host([answer-key]) ::slotted(qti-simple-associable-choice) {
|
|
6909
6917
|
display: none;
|
|
6910
6918
|
}
|
|
6911
|
-
`];var
|
|
6912
|
-
${H(r,
|
|
6913
|
-
</div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),
|
|
6919
|
+
`];var sm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},am=Rt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),ar=class extends Ot(am,'[qti-draggable="true"]'){static{this.styles=vh}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return y`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
|
|
6920
|
+
${H(r,n=>n.getAttribute("identifier"),n=>n)}
|
|
6921
|
+
</div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),n=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),i=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=n&&this.chipsIn(n)[0]?.getAttribute("identifier");i&&s&&t.push(`${i} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let n=e.split(" ");return n.length!==2?[]:[`${n[0]} droplist${r}_left`,`${n[1]} droplist${r}_right`]})??[]}render(){return y` <slot name="prompt"></slot>
|
|
6914
6922
|
<slot part="drags" name="qti-simple-associable-choice"></slot>
|
|
6915
6923
|
<div part="drops">
|
|
6916
|
-
${this._childrenMap.length>0&&Array.from({length:this.#e},(t,e)=>
|
|
6924
|
+
${this._childrenMap.length>0&&Array.from({length:this.#e},(t,e)=>y`<div part="drop-row">
|
|
6917
6925
|
${this.#t(`droplist${e}_left`,`left${e}`)}
|
|
6918
6926
|
${this.#t(`droplist${e}_right`,`right${e}`)}
|
|
6919
6927
|
</div>`)}
|
|
6920
6928
|
|
|
6921
6929
|
<div role="alert" part="message" id="validation-message"></div>
|
|
6922
|
-
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};
|
|
6930
|
+
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};sm([T()],ar.prototype,"_childrenMap",void 0);var Mo=[{tag:"qti-associate-interaction",ctor:ar}];var Ie=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},_e=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(n,i)=>{this._choiceElements.forEach(s=>s.disabled=i)},this._handleReadonlyChange=(n,i)=>{this._choiceElements.forEach(s=>s.readonly=i)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(n,i){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(n){this.maxChoices>1&&(typeof n=="string"||n===null)?this.response=n?n.toString().split(","):[]:this.response=n||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let n=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{n.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let i=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>i.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!i.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let i=this._choiceElements.filter(l=>this._getChoiceChecked(l)).length,s=!0,a="";this.maxChoices!==0&&i>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):i<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let c=this._choiceElements.find(l=>this.contains(l))||this;return this.setInteractionValidity(s,a,c,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let n=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==n&&(this._interactionContext={...this._interactionContext,choiceRole:n})}_choiceElementSelectedHandler(n){this._toggleChoiceChecked(n.target);let i=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==n.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&i&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(n,i){n.internals?.states&&(i?(n.internals.states.add("checked"),n.internals.ariaChecked="true"):(n.internals.states.delete("checked"),n.internals.ariaChecked="false"))}_getChoiceChecked(n){return n.internals.states.has("checked")}_toggleChoiceChecked(n){let i=this._getChoiceChecked(n);this._setChoiceChecked(n,!i)}_handleChoiceSelection(){let i=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?i[0]||"":i,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let n=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(i=>{let s=n.includes(i.identifier);this._setChoiceChecked(i,s)})}}return Ie([fr("#validation-message")],e.prototype,"_validationMessageElement",void 0),Ie([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Ie([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Ie([$("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Ie([$("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Ie([$("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Ie([p({attribute:"response",reflect:!1,converter:Ft({emptyAs:""})})],e.prototype,"response",void 0),Ie([$("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var lm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},wh=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#n=null;set class(n){this.#t=this.#i(n),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(n,i,s){super.attributeChangedCallback(n,i,s),n==="class"&&i!==s&&(this.class=s??"")}updated(n){super.updated(n),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#n=new MutationObserver(n=>{n.some(i=>i.type==="childList"||i.type==="attributes"&&i.attributeName==="style")&&this.#o()}),this.#n.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#n?.disconnect(),this.#n=null}#i(n){return n?n.split(/\s+/).map(i=>i.trim()).filter(Boolean).filter((i,s,a)=>a.indexOf(i)===s):[]}#o(){let n=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c),i=this.#s(n),s=this.#a(),a=this.#l();i.forEach((c,l)=>{c.marker=this.#h(l+1,s,a)})}#s(n){return n.map((i,s)=>{let a=Number(i.style.order);return{el:i,order:Number.isFinite(a)?a:s+1,index:s}}).sort((i,s)=>i.order-s.order||i.index-s.index).map(i=>i.el)}#a(){return this.#t.filter(n=>this.#e.includes(n)).pop()??null}#l(){return this.#t.filter(n=>this.#r.includes(n)).pop()??null}#h(n,i,s){let a=i;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let c="";switch(a){case"qti-labels-decimal":c=`${n}`;break;case"qti-labels-lower-alpha":c=this.#c(n,"lower");break;case"qti-labels-upper-alpha":c=this.#c(n,"upper");break}return s==="qti-labels-suffix-period"?`${c}.`:s==="qti-labels-suffix-parenthesis"?`${c})`:c}#c(n,i){let s=n,a="",c=i==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(c+s%26)+a,s=Math.floor(s/26);return a}}return lm([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var xh=[O,U,q`
|
|
6923
6931
|
:host {
|
|
6924
6932
|
display: block;
|
|
6925
6933
|
}
|
|
@@ -6986,16 +6994,16 @@ div.full-correct-response-inline {
|
|
|
6986
6994
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
6987
6995
|
grid-row: auto;
|
|
6988
6996
|
}
|
|
6989
|
-
`];var
|
|
6997
|
+
`];var cm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},lr=class extends wh(_e(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=xh}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return y`
|
|
6990
6998
|
<slot part="prompt" name="prompt"></slot>
|
|
6991
6999
|
<slot part="slot" @slotchange=${this.#t}></slot>
|
|
6992
7000
|
<div part="message" role="alert" id="validation-message"></div>
|
|
6993
|
-
`}};
|
|
7001
|
+
`}};cm([p({type:String})],lr.prototype,"orientation",void 0);var Po=[{tag:"qti-choice-interaction",ctor:lr}];var qh=[O,q`
|
|
6994
7002
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
6995
7003
|
:host {
|
|
6996
7004
|
display: block;
|
|
6997
7005
|
}
|
|
6998
|
-
`];var
|
|
7006
|
+
`];var Jn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},yl=`
|
|
6999
7007
|
const postToParentWindows = (type, data) => {
|
|
7000
7008
|
window.top.postMessage(data ? { type, data } : { type }, '*');
|
|
7001
7009
|
let w = window.parent;
|
|
@@ -7062,7 +7070,7 @@ window.CES = {
|
|
|
7062
7070
|
},
|
|
7063
7071
|
};
|
|
7064
7072
|
CES.load();
|
|
7065
|
-
`,
|
|
7073
|
+
`,dm=`
|
|
7066
7074
|
(function() {
|
|
7067
7075
|
var blobUrlReceived = null;
|
|
7068
7076
|
|
|
@@ -7106,16 +7114,16 @@ CES.load();
|
|
|
7106
7114
|
requestBlobUrl();
|
|
7107
7115
|
}
|
|
7108
7116
|
})();
|
|
7109
|
-
`,se=class extends D{#t;#e;#r;static{this.styles=
|
|
7117
|
+
`,se=class extends D{#t;#e;#r;static{this.styles=qh}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#n=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#n;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let n=r.getAttribute("width"),i=r.getAttribute("height");n&&this.setAttribute("width",n),i&&this.setAttribute("height",i)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:$i((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],n=this.#a(),i=await this.#c(r,n),s=i.url;if(i.baseUrl&&!this.#r&&(this.#r=i.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#c(h,n,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+yl+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#n=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",v=await this.#c(m,n,{returnText:!0});if(d=v.url,v.baseUrl&&!this.#r&&(this.#r=v.baseUrl),v.text){let x=v.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+yl+"</script>",w=x.indexOf("<head>");w!==-1?x=x.slice(0,w+6)+b+x.slice(w+6):x=b+x}let g=new Blob([x],{type:"text/html"});this.#n=URL.createObjectURL(g)}}if(d&&!this.#n)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+yl+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let v=new Blob([f],{type:"text/html"});this.#n=URL.createObjectURL(v)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let c=`<script>${dm}</script>`;window.addEventListener("message",this.handlePostMessage);let l=`
|
|
7110
7118
|
<!DOCTYPE html>
|
|
7111
7119
|
<html>
|
|
7112
7120
|
<head>
|
|
7113
7121
|
${s?`<link href='${s}' rel="stylesheet" />`:""}
|
|
7114
|
-
${
|
|
7122
|
+
${c}
|
|
7115
7123
|
</head>
|
|
7116
7124
|
<body></body>
|
|
7117
7125
|
</html>
|
|
7118
|
-
`;t.srcdoc=
|
|
7126
|
+
`;t.srcdoc=l}#i(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),r=[...t,...e];for(let n of r){let i=n.src;if(new URL(i,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;a&&this.#o(a,r)}catch(a){console.error("Error accessing nested iframe:",a)}}return r.forEach((n,i)=>{r.indexOf(n)!==i&&r.splice(i,1)}),r}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(n=>{e.push(n);let i=n.src;if(new URL(i,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",i)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let r=this.#i();for(let n of r)n.contentWindow&&n.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:r}=t.data;switch(e){case"setResponse":(r===null||!(Array.isArray(r)&&r.length===1&&r[0]===""))&&(this.#t=r,this.saveResponse(r));break;case"getResponse":{this.#s("responseData",this.#t);break}case"getBlobUrl":{this.#n&&(this.#s("blobUrl",this.#n),t.source&&t.source!==window&&t.source.postMessage({type:"blobUrl",data:this.#n},"*"));break}case"getMedia":{let n=this.#a(),i=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#r||n[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",i);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#t)return!1;if(Array.isArray(this.#t)){if(this.#t.length===0)return!1;for(let t of this.#t)if(t!==""&&t!==null)return!0}return!0}get response(){return this.#t||null}set response(t){if(typeof t=="string")this.#t=t,this.saveResponse(t);else if(Array.isArray(t))this.#t=t;else if(t)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return y`<iframe
|
|
7119
7127
|
width=${this.getAttribute("width")}
|
|
7120
7128
|
height=${this.getAttribute("height")}
|
|
7121
7129
|
frameborder="0"
|
|
@@ -7123,10 +7131,10 @@ CES.load();
|
|
|
7123
7131
|
id="pciContainer"
|
|
7124
7132
|
>
|
|
7125
7133
|
</iframe>
|
|
7126
|
-
${this._errorMessage&&
|
|
7134
|
+
${this._errorMessage&&y`<div style="color:red">
|
|
7127
7135
|
<h1>Error</h1>
|
|
7128
7136
|
${this._errorMessage}
|
|
7129
|
-
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#
|
|
7137
|
+
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#l()].filter(Boolean).map(n=>new URL(n,window.location.href).toString()),r=this.#h();return r&&e.push(r),[...new Set(e)]}#l(){return this.#e?new URL(".",this.#e).toString():null}#h(){return this.#e?new URL("..",this.#e).toString():null}async#c(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let n of e){let i=new URL(n,window.location.href).toString(),s=new URL(t,i.endsWith("/")?i:`${i}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let c=await a.text();return{url:s,baseUrl:i,text:c}}return{url:s,baseUrl:i}}}catch{}}return{url:"",baseUrl:null}}};Jn([p({type:String,attribute:"data"})],se.prototype,"data",void 0);Jn([p({type:String,attribute:"data-base-item"})],se.prototype,"baseItemUrl",void 0);Jn([p({type:String,attribute:"data-base-ref"})],se.prototype,"baseRefUrl",void 0);Jn([p({type:String,attribute:"id"})],se.prototype,"id",void 0);Jn([T()],se.prototype,"_errorMessage",void 0);var Do=[{tag:"qti-custom-interaction",ctor:se}];var Ch=[O];var No=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Te=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Ch}render(){return y`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(t){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};No([p({type:String,attribute:"response-identifier"})],Te.prototype,"responseIdentifier",void 0);No([p({reflect:!0,type:Boolean})],Te.prototype,"disabled",void 0);No([p({type:String,attribute:"count-attempt"})],Te.prototype,"countAttempt",void 0);No([p({type:String})],Te.prototype,"title",void 0);var $o=[{tag:"qti-end-attempt-interaction",ctor:Te}];var Eh=[O,q`
|
|
7130
7138
|
/* PK: display host as block, else design will be collapsed */
|
|
7131
7139
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
7132
7140
|
:host {
|
|
@@ -7139,7 +7147,7 @@ CES.load();
|
|
|
7139
7147
|
height: 100%;
|
|
7140
7148
|
border: 0;
|
|
7141
7149
|
}
|
|
7142
|
-
`];var vt=function(
|
|
7150
|
+
`];var vt=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},kh=5,hm=50,Sh="qti-height-lines-",Ah=!1,X=class extends D{constructor(){super(...arguments),this._rows=kh,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Ah||(Ah=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Eh}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/hm):kh}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Sh))continue;let e=parseInt(t.slice(Sh.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(n);r=t.checkValidity()&&i.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();return r&&!this.response&&(r=!1),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0}),r}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return y`<slot name="prompt"></slot>`}renderTextarea(){return y`<textarea
|
|
7143
7151
|
part="textarea"
|
|
7144
7152
|
name="${this.responseIdentifier}"
|
|
7145
7153
|
spellcheck="false"
|
|
@@ -7149,12 +7157,12 @@ CES.load();
|
|
|
7149
7157
|
@keyup="${this.textChanged}"
|
|
7150
7158
|
@change="${this.textChanged}"
|
|
7151
7159
|
@blur="${t=>{this.reportValidity()}}"
|
|
7152
|
-
placeholder="${
|
|
7160
|
+
placeholder="${Ut(this.placeholderText?this.placeholderText:void 0)}"
|
|
7153
7161
|
rows="${this._rows}"
|
|
7154
7162
|
?disabled="${this.disabled}"
|
|
7155
7163
|
?readonly="${this.readonly}"
|
|
7156
7164
|
.value=${this.response}
|
|
7157
|
-
></textarea>`}renderValidationMessage(){return
|
|
7165
|
+
></textarea>`}renderValidationMessage(){return y`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return y`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};vt([T()],X.prototype,"_rows",void 0);vt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);vt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);vt([p({type:String,reflect:!0})],X.prototype,"format",void 0);vt([$("format")],X.prototype,"_handleFormatChange",void 0);vt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);vt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);vt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);vt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);vt([$(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);vt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);vt([$("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var Lo=[{tag:"qti-extended-text-interaction",ctor:X}];var Ih=[O,U,q`
|
|
7158
7166
|
:host {
|
|
7159
7167
|
display: flex;
|
|
7160
7168
|
align-items: flex-start;
|
|
@@ -7198,10 +7206,10 @@ CES.load();
|
|
|
7198
7206
|
:host([answer-key]) [part~='drags'] {
|
|
7199
7207
|
display: none;
|
|
7200
7208
|
}
|
|
7201
|
-
`];var
|
|
7209
|
+
`];var Fr=class extends Ot(Rt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=Ih}render(){return y`<slot name="prompt"> </slot>
|
|
7202
7210
|
<slot part="drags" name="drags"></slot>
|
|
7203
7211
|
<slot part="drops"></slot>
|
|
7204
|
-
<div role="alert" part="message" id="validation-message"></div>`}};var
|
|
7212
|
+
<div role="alert" part="message" id="validation-message"></div>`}};var Vo=[{tag:"qti-gap-match-interaction",ctor:Fr}];function Oh(o){return o.querySelector('img, object[type^="image"]')}function _h(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var Mh=new WeakMap,Th=new WeakMap;function pm(o){let t=Th.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let n=new Image;n.onload=()=>{let i={width:n.naturalWidth,height:n.naturalHeight};if(!(i.width>0)||!(i.height>0)){e(null);return}Mh.set(o,i),e(i)},n.onerror=()=>e(null),n.src=r}),Th.set(o,t)),t}function um(o){if(o.localName==="object")return Mh.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function zo(o){let t=_h(o,"width"),e=_h(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=um(o);return r?{width:t??r.width,height:e??r.height}:null}function mm(o){let t=zo(o);if(t)return Promise.resolve(t);if(o.localName==="object")return pm(o).then(()=>zo(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let n=()=>{e.removeEventListener("load",n),e.removeEventListener("error",n),r(zo(o))};e.addEventListener("load",n),e.addEventListener("error",n)})}function Re(o,t,e,r){let n=zo(e);if(n){Rh(o,t,n,r);return}mm(e).then(i=>{if(!i){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Rh(o,t,i,r)})}function Rh(o,t,{width:e,height:r},n){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[i,s,a]=t,c=i/e*100,l=s/r*100,d=a/e*100,h=a/r*100;n.style.left=c-d+"%",n.style.top=l-h+"%",n.style.width=2*d+"%",n.style.height=2*h+"%",n.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[i,s,a,c]=t,l=i/e*100,d=s/r*100,h=a/e*100,f=c/r*100;n.style.left=l+"%",n.style.top=d+"%",n.style.width=h-l+"%",n.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[i,s,a,c]=t,l=i/e*100,d=s/r*100,h=a/e*100,f=c/r*100;n.style.left=l-h+"%",n.style.top=d-f+"%",n.style.width=2*h+"%",n.style.height=2*f+"%",n.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let i=[];for(let b=0;b<t.length;b+=2)i.push({x:t[b],y:t[b+1]});let s=Math.min(...i.map(b=>b.x)),a=Math.max(...i.map(b=>b.x)),c=Math.min(...i.map(b=>b.y)),l=Math.max(...i.map(b=>b.y)),d=s/e*100,h=c/r*100,f=a/e*100,m=l/r*100;n.style.left=d+"%",n.style.top=h+"%",n.style.width=f-d+"%",n.style.height=m-h+"%";let v=i.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-c)/(l-c)*100})),x=v.map(b=>`${b.x}% ${b.y}%`).join(",");n.style.clipPath=`polygon(${x})`;let u=v.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;n.style.setProperty("--qti-shape-outline",g(4)),n.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":n.style.left="0%",n.style.top="0%",n.style.width="100%",n.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Ph=[O,U,q`
|
|
7205
7213
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
7206
7214
|
the theme, together with a 'display: block' this component now owns. */
|
|
7207
7215
|
:host {
|
|
@@ -7231,14 +7239,14 @@ CES.load();
|
|
|
7231
7239
|
top: 0px;
|
|
7232
7240
|
left: 0px;
|
|
7233
7241
|
}
|
|
7234
|
-
`];var
|
|
7242
|
+
`];var Zn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Mt=class extends D{static{this.styles=Ph}#t;#e;#r;constructor(){super(),this.#t=[],this.#e=null,this.#r=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#i().length>0}set response(t){this._response=this.#n(t)}get response(){return this._response}#n(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#i(){return this.#n(this._response)}renderSupplementalLines(){return M}render(){return y`<slot name="prompt"></slot>
|
|
7235
7243
|
<line-container>
|
|
7236
7244
|
<svg
|
|
7237
|
-
width=${
|
|
7238
|
-
height=${
|
|
7245
|
+
width=${Ut(this.grImage[0]?.width)}
|
|
7246
|
+
height=${Ut(this.grImage[0]?.height)}
|
|
7239
7247
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
7240
7248
|
>
|
|
7241
|
-
${H(this.#
|
|
7249
|
+
${H(this.#i(),t=>t,(t,e)=>Cn`
|
|
7242
7250
|
<line
|
|
7243
7251
|
part="line"
|
|
7244
7252
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -7247,11 +7255,11 @@ CES.load();
|
|
|
7247
7255
|
y2=${parseInt(this.querySelector(`[identifier=${t.split(" ")[1]}]`).style.top)}
|
|
7248
7256
|
stroke="red"
|
|
7249
7257
|
stroke-width="3"
|
|
7250
|
-
@click=${r=>{r.stopPropagation(),this._response=this._response.filter((i
|
|
7258
|
+
@click=${r=>{r.stopPropagation(),this._response=this._response.filter((n,i)=>i!==e),this.saveResponse(this.response)}}
|
|
7251
7259
|
/>
|
|
7252
7260
|
`)}
|
|
7253
7261
|
${this.renderSupplementalLines()}
|
|
7254
|
-
${this.#e&&
|
|
7262
|
+
${this.#e&&Cn`<line
|
|
7255
7263
|
part="point"
|
|
7256
7264
|
x1=${this.startCoord.x}
|
|
7257
7265
|
y1=${this.startCoord.y}
|
|
@@ -7263,7 +7271,7 @@ CES.load();
|
|
|
7263
7271
|
</svg>
|
|
7264
7272
|
<slot></slot>
|
|
7265
7273
|
</line-container>
|
|
7266
|
-
<div role="alert" part="message" id="validation-message"></div>`}#
|
|
7274
|
+
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,n=r.getAttribute("coords"),i=r.getAttribute("shape"),s=n.split(",").map(a=>parseInt(a));Re(i,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",e=>{this.#e?this.#r||(this.#r=e.target,this._response=this.#i(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#r=null):(this.#e=e.target,this.startCoord={x:parseInt(this.#e.getAttribute("coords").split(",")[0]),y:parseInt(this.#e.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};Zn([T()],Mt.prototype,"startCoord",void 0);Zn([T()],Mt.prototype,"mouseCoord",void 0);Zn([kc({selector:"img"})],Mt.prototype,"grImage",void 0);Zn([T()],Mt.prototype,"_response",void 0);Zn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Ft({emptyAs:[]})})],Mt.prototype,"response",null);var jo=[{tag:"qti-graphic-associate-interaction",ctor:Mt}];var Dh=[O,U,q`
|
|
7267
7275
|
:host {
|
|
7268
7276
|
display: flex;
|
|
7269
7277
|
align-items: flex-start;
|
|
@@ -7320,10 +7328,10 @@ CES.load();
|
|
|
7320
7328
|
user-select: none;
|
|
7321
7329
|
pointer-events: none;
|
|
7322
7330
|
}
|
|
7323
|
-
`];var
|
|
7331
|
+
`];var fm=Rt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Br=class extends Ot(fm,'[qti-draggable="true"]'){static{this.styles=Dh}render(){return y` <slot name="prompt"></slot>
|
|
7324
7332
|
<slot part="image"></slot>
|
|
7325
7333
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
7326
|
-
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(t){let e=t.target,r=e.getAttribute("coords"),
|
|
7334
|
+
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(t){let e=t.target,r=e.getAttribute("coords"),n=e.getAttribute("shape"),i=r.split(",").map(s=>parseInt(s));switch(n){case"circle":{let[s,a,c]=i;e.style.left=s-c+"px",e.style.top=a-c+"px",e.style.width=e.style.height=2*c+"px"}break;case"rect":{let[s,a,c,l]=i;e.style.left=s+"px",e.style.top=a+"px",e.style.width=c-s+"px",e.style.height=l-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#t)}};var Fo=[{tag:"qti-graphic-gap-match-interaction",ctor:Br}];var Nh=[O,U,q`
|
|
7327
7335
|
/* The order pins are anchored outside their hotspot's box. */
|
|
7328
7336
|
:host {
|
|
7329
7337
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -7361,11 +7369,11 @@ CES.load();
|
|
|
7361
7369
|
pointer-events: none;
|
|
7362
7370
|
user-select: none;
|
|
7363
7371
|
}
|
|
7364
|
-
`];var
|
|
7372
|
+
`];var $h=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Oe=class o extends _e(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#i=t=>{this.#n(t.target),this.refreshLocatorPins()}}static{this.styles=Nh}static#t="cito-graphic-order-marker";render(){return y`
|
|
7365
7373
|
<slot name="prompt"></slot>
|
|
7366
7374
|
<slot></slot>
|
|
7367
7375
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7368
|
-
`}
|
|
7376
|
+
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(i=>i.identifier===e))return;let r=[...this.#e()],n=r.indexOf(e);if(n>=0)r.splice(n,1);else{let i=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=i)return;r.push(e)}this.response=r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let i of this._choiceElements){let s=t.indexOf(i.identifier);i.order=s>=0?s+1:null}let e=this._choiceElements.filter(i=>i.order!=null).sort((i,s)=>i.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((i,s)=>{let a=r[s];return a.textContent===String(i.order)&&a.style.getPropertyValue("position-anchor")===this.#r(i)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(i)})||(r.forEach(i=>i.remove()),this._choiceElements.forEach(i=>{i.style.removeProperty("anchor-name")}),e.forEach(i=>{let s=this.#r(i);i.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(i)),i.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(i.order),this.append(a)}))}#n(t){let e=Oh(this),r=t.getAttribute("coords"),n=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let i=r.split(",").map(s=>parseInt(s));Re(n,i,e,t)}#i;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#n(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};$h([p({type:Number,attribute:"max-choices"})],Oe.prototype,"maxChoices",void 0);$h([$("response")],Oe.prototype,"handleOrderedResponseChange",null);var Bo=[{tag:"qti-graphic-order-interaction",ctor:Oe}];var Lh=[O,U,q`
|
|
7369
7377
|
:host {
|
|
7370
7378
|
display: block;
|
|
7371
7379
|
}
|
|
@@ -7414,17 +7422,17 @@ CES.load();
|
|
|
7414
7422
|
max-width: 100%;
|
|
7415
7423
|
height: auto;
|
|
7416
7424
|
}
|
|
7417
|
-
`];var
|
|
7425
|
+
`];var Ur=class extends _e(D,"qti-hotspot-choice"){static{this.styles=Lh}render(){return y`
|
|
7418
7426
|
<slot name="prompt"></slot>
|
|
7419
7427
|
<slot></slot>
|
|
7420
7428
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7421
|
-
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img"),r=t.
|
|
7429
|
+
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img"),r=t.getAttribute("coords"),n=t.getAttribute("shape"),i=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Re(n,i,s,t)}#n=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};var Uo=[{tag:"qti-hotspot-interaction",ctor:Ur}];var Vh=[O,U,q`
|
|
7422
7430
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7423
7431
|
:host {
|
|
7424
7432
|
display: block;
|
|
7425
7433
|
}
|
|
7426
|
-
`];var
|
|
7427
|
-
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=
|
|
7434
|
+
`];var Hr=class extends _e(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>y`<slot></slot>
|
|
7435
|
+
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Vh}};var Ho=[{tag:"qti-hottext-interaction",ctor:Hr}];var vl=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class n extends o{#t=null;#e=null;#r=null;#n=0;#i=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(c=>c instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let c=a.matches(":popover-open"),l=a.style.visibility,d=a.style.display;c||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{c||(a.hidePopover?.(),a.style.visibility=l,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#l(a),this.#s();let c=this.#o()+this.menuAutoSizeExtraWidth();c<=0||c===this.#i||(this.#i=c,s.style.setProperty(r,`${c}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let l of this.menuAutoSizeRows()){let d=l.style.width;l.style.width="max-content",s=Math.max(s,l.getBoundingClientRect().width),l.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let c=getComputedStyle(a);return s+parseFloat(c.paddingLeft)+parseFloat(c.paddingRight)+parseFloat(c.borderLeftWidth)+parseFloat(c.borderRightWidth)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#n||(this.#n=requestAnimationFrame(()=>{this.#n=0,this.updateMenuWidth()}))}#l(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#n&&cancelAnimationFrame(this.#n),this.#n=0,super.disconnectedCallback()}}return n};var gm=q`
|
|
7428
7436
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
7429
7437
|
Inline-block so the element flows with surrounding text.
|
|
7430
7438
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -7605,12 +7613,12 @@ CES.load();
|
|
|
7605
7613
|
z-index: var(--qti-overlay-z-index);
|
|
7606
7614
|
white-space: nowrap;
|
|
7607
7615
|
}
|
|
7608
|
-
|
|
7616
|
+
`,bm=gm,zh=bm;var ae=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ym=0,et=class extends vl(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${ym++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#i=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#o=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#s=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#a=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#l();return}let e=this.#y(),r=this.renderRoot.activeElement,n=this.#h(),i=r||(n instanceof HTMLElement&&this.#c(n)?n:null),s=e.findIndex(a=>a===i);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!i)return;if(t.preventDefault(),i instanceof HTMLButtonElement)i.click();else{let a=i.getAttribute("identifier")??"";this.#r(a)}}},this.#p=()=>{this.#e()},this.#m=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#r(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[zh]}renderTrigger(){let t=this.#t();return y`
|
|
7609
7617
|
<button
|
|
7610
7618
|
part="trigger"
|
|
7611
7619
|
type="button"
|
|
7612
|
-
@click=${this.#
|
|
7613
|
-
@keydown=${this.#
|
|
7620
|
+
@click=${this.#i}
|
|
7621
|
+
@keydown=${this.#o}
|
|
7614
7622
|
aria-haspopup="listbox"
|
|
7615
7623
|
aria-expanded="${this._dropdownOpen?"true":"false"}"
|
|
7616
7624
|
aria-controls="${this._menuId}"
|
|
@@ -7625,7 +7633,7 @@ CES.load();
|
|
|
7625
7633
|
aria-hidden="true"
|
|
7626
7634
|
></span>
|
|
7627
7635
|
</button>
|
|
7628
|
-
`}renderMenu(){return
|
|
7636
|
+
`}renderMenu(){return y`
|
|
7629
7637
|
<div
|
|
7630
7638
|
id="${this._menuId}"
|
|
7631
7639
|
part="menu"
|
|
@@ -7645,7 +7653,7 @@ CES.load();
|
|
|
7645
7653
|
</button>
|
|
7646
7654
|
<slot @slotchange=${this.#p}></slot>
|
|
7647
7655
|
</div>
|
|
7648
|
-
`}renderValidationMessage(){return
|
|
7656
|
+
`}renderValidationMessage(){return y`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return y` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#e(),this.#d(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#y()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#t(){return this.options.find(t=>t.selected)??this.options[0]}#e(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select",r=this._pendingResponse,n=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",i=[{content:e,value:"",selected:n===""},...t.map(a=>{let c=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(l=>l.cloneNode(!0)),value:c,selected:c!==""&&c===n}})],s=i.some(a=>a.selected);this.options=s?i:i.map((a,c)=>({...a,selected:c===0})),this._pendingResponse=void 0,this.#f(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize?!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-")):!1}menuAutoSizeExtraWidth(){return this.renderRoot.querySelector('span[part~="dropdown-icon"]')?.offsetWidth??0}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,n=e||!r,i=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(n,n?"":i,this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}reset(){this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#f()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#f()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#r(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#f(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#u();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#i;#o;#s;#a;#l(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#h(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#c(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#u(){return this.renderRoot.querySelector(`#${this._menuId}`)}#d(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#p;#m;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#m),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#f(){await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let i=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=i?"true":"false",r.internals.ariaChecked=i?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",i?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#y(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};ae([T()],et.prototype,"options",void 0);ae([T()],et.prototype,"_dropdownOpen",void 0);ae([_({context:ut,subscribe:!0}),p({attribute:!1})],et.prototype,"configContext",void 0);ae([p({type:String,attribute:"data-prompt"})],et.prototype,"dataPrompt",void 0);ae([$("dataPrompt",{waitUntilFirstUpdate:!0})],et.prototype,"_handleDataPromptChange",void 0);ae([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],et.prototype,"required",void 0);ae([p({type:Number,attribute:"min-choices"})],et.prototype,"minChoices",void 0);ae([$(["required","minChoices"],{waitUntilFirstUpdate:!0})],et.prototype,"_handleRequiredChange",void 0);ae([p({attribute:"response",reflect:!1,noAccessor:!0})],et.prototype,"response",null);var Wo=[{tag:"qti-inline-choice-interaction",ctor:et}];var jh=[O,U,q`
|
|
7649
7657
|
/*
|
|
7650
7658
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
7651
7659
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -7751,7 +7759,7 @@ CES.load();
|
|
|
7751
7759
|
:host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
|
|
7752
7760
|
display: none;
|
|
7753
7761
|
}
|
|
7754
|
-
`];var
|
|
7762
|
+
`];var Fh=[O,q`
|
|
7755
7763
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
7756
7764
|
display: contents;
|
|
7757
7765
|
}
|
|
@@ -7807,11 +7815,11 @@ CES.load();
|
|
|
7807
7815
|
justify-content: center;
|
|
7808
7816
|
flex-shrink: 0;
|
|
7809
7817
|
}
|
|
7810
|
-
`];var
|
|
7818
|
+
`];var wl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},le=class extends Ot(Rt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,n=e.name,i=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(i==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(n)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),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=[jh,Fh]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],n=e[1],i=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),n?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{i(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{i(s),s.setAttribute("role","columnheader")})):(r?.removeAttribute("slot"),n?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return y`
|
|
7811
7819
|
<slot name="prompt"></slot>
|
|
7812
7820
|
<slot ?hidden=${t}></slot>
|
|
7813
7821
|
|
|
7814
|
-
${t?
|
|
7822
|
+
${t?y`
|
|
7815
7823
|
<div
|
|
7816
7824
|
part="grid"
|
|
7817
7825
|
role="grid"
|
|
@@ -7821,25 +7829,25 @@ CES.load();
|
|
|
7821
7829
|
<div part="cols-wrap" role="row"><slot name="match-cols" part="c-header"></slot></div>
|
|
7822
7830
|
<div part="rows-wrap"><slot name="match-rows" part="r-header"></slot></div>
|
|
7823
7831
|
<div part="checkbox-grid">
|
|
7824
|
-
${this.sourceChoices.map((e,r)=>
|
|
7832
|
+
${this.sourceChoices.map((e,r)=>y`
|
|
7825
7833
|
<div role="row" style="display: contents;">
|
|
7826
|
-
${this.targetChoices.map((i
|
|
7834
|
+
${this.targetChoices.map((n,i)=>{let s=e.getAttribute("identifier"),a=n.getAttribute("identifier"),c=`${s} ${a}`,l=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(c)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(c,d),m=d?"checked":"",v=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&l>=e.matchMax&&!d;return y`
|
|
7827
7835
|
<label
|
|
7828
7836
|
part="input-cell"
|
|
7829
7837
|
role="gridcell"
|
|
7830
|
-
style="grid-row: ${r+1}; grid-column: ${
|
|
7838
|
+
style="grid-row: ${r+1}; grid-column: ${i+1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
|
|
7831
7839
|
>
|
|
7832
7840
|
<input
|
|
7833
7841
|
type=${h}
|
|
7834
7842
|
hidden
|
|
7835
7843
|
name=${s}
|
|
7836
|
-
value=${
|
|
7844
|
+
value=${c}
|
|
7837
7845
|
.checked=${d}
|
|
7838
7846
|
.disabled=${u}
|
|
7839
7847
|
@change=${g=>this.handleRadioChange(g)}
|
|
7840
7848
|
@click=${g=>e.matchMax===1?this.handleRadioClick(g):null}
|
|
7841
7849
|
/>
|
|
7842
|
-
<span part=${
|
|
7850
|
+
<span part=${v} role=${h} aria-checked=${d?"true":"false"}>
|
|
7843
7851
|
<span part=${x}></span>
|
|
7844
7852
|
</span>
|
|
7845
7853
|
</label>
|
|
@@ -7848,16 +7856,16 @@ CES.load();
|
|
|
7848
7856
|
`)}
|
|
7849
7857
|
</div>
|
|
7850
7858
|
</div>
|
|
7851
|
-
`:
|
|
7859
|
+
`:M}
|
|
7852
7860
|
|
|
7853
7861
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7854
|
-
`}};
|
|
7862
|
+
`}};wl([p({type:String})],le.prototype,"class",void 0);wl([T()],le.prototype,"_response",void 0);wl([p({type:String,attribute:"response-identifier"})],le.prototype,"responseIdentifier",void 0);var Qo=[{tag:"qti-match-interaction",ctor:le}];var Bh=[O,q`
|
|
7855
7863
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7856
7864
|
:host {
|
|
7857
7865
|
display: block;
|
|
7858
7866
|
}
|
|
7859
|
-
`];var
|
|
7860
|
-
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var
|
|
7867
|
+
`];var Go=class extends D{static{this.styles=Bh}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return y` <slot name="prompt"></slot>
|
|
7868
|
+
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var Xo=[{tag:"qti-media-interaction",ctor:Go}];var Uh=[O,U,zt,q`
|
|
7861
7869
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7862
7870
|
:host {
|
|
7863
7871
|
display: block;
|
|
@@ -8067,16 +8075,16 @@ CES.load();
|
|
|
8067
8075
|
:host([answer-key]) [part~='drags'] {
|
|
8068
8076
|
display: none;
|
|
8069
8077
|
}
|
|
8070
|
-
`];var
|
|
8078
|
+
`];var Hh=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},vm=Rt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Me=class extends Ot(vm,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Uh}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),y` <slot name="prompt"> </slot>
|
|
8071
8079
|
<div part="container">
|
|
8072
8080
|
<slot part="drags"> </slot>
|
|
8073
8081
|
<div part="drops">
|
|
8074
|
-
${[...Array(this.nrChoices)].map((e,r)=>{let
|
|
8075
|
-
${H(
|
|
8082
|
+
${[...Array(this.nrChoices)].map((e,r)=>{let n=`droplist${r}`,i=this._dragDrop?.nodesByTarget?.[n]??[];return y`<div role="region" part="drop" data-declarative-drops identifier=${n}>
|
|
8083
|
+
${H(i,s=>s.getAttribute("identifier"),s=>s)}
|
|
8076
8084
|
</div>`})}
|
|
8077
8085
|
</div>
|
|
8078
8086
|
<div id="validation-message" part="message" role="alert" style="display:none;"></div>
|
|
8079
|
-
</div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};
|
|
8087
|
+
</div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Hh([T()],Me.prototype,"nrChoices",void 0);Hh([p({type:String})],Me.prototype,"orientation",void 0);var Yo=[{tag:"qti-order-interaction",ctor:Me}];var Wh=[O,q`
|
|
8080
8088
|
:host {
|
|
8081
8089
|
display: block;
|
|
8082
8090
|
width: 100%;
|
|
@@ -8086,14 +8094,14 @@ CES.load();
|
|
|
8086
8094
|
::slotted(qti-interaction-markup) {
|
|
8087
8095
|
display: none;
|
|
8088
8096
|
}
|
|
8089
|
-
`];var wt=function(
|
|
8097
|
+
`];var wt=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},wm=["solution","review"];function xm(o){return o==null?!1:Array.isArray(o)?o.length>0:o!==""}var W=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#n=null,this.#i=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#x(),this.#q(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`,this.iframe.style.width=`${e.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,n=r&&typeof r=="object"?this.#u(r):null,i=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;i!==null&&(this.#o=i,i&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,c;if(a===void 0)c=void 0;else if(a===null)c=null;else if(typeof a=="string")c=a;else try{c=`__qti_json__::${JSON.stringify(a)}`}catch{c=null}if(n===null){let l=this.responseVariable?.cardinality==="single"?"":[];this.response=l,this.validate(),this.saveResponse(l,c);break}this.response=n,this.validate(),this.saveResponse(n,c);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#g=null}#t;static{this.styles=[Wh,q`
|
|
8090
8098
|
:host {
|
|
8091
8099
|
display: block;
|
|
8092
8100
|
width: 100%;
|
|
8093
8101
|
min-height: 50px;
|
|
8094
8102
|
}
|
|
8095
|
-
`]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return
|
|
8096
|
-
`);this.sendMessageToIframe("setStylesheets",
|
|
8103
|
+
`]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return xm(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||wm.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#n;#i;#o;#s;#a(){if(this.#n===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#n=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#n={}}return this.#n||{}}#l(){if(this.#i===null&&this.requireShimJson)try{this.#i=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#i={}}return this.#i||{}}#h(){return this.#a()}#c(){return this.#l()}#u(t){for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let n in r)if(r.hasOwnProperty(n)){let i=r[n];if(Array.isArray(i))return i.map(String);if(i!=null)return String(i)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}coerceBaseValue(t,e){if(t==null)return t;switch(e){case"integer":{if(typeof t=="number")return t;let r=parseInt(String(t),10);return Number.isNaN(r)?t:r}case"float":case"duration":{if(typeof t=="number")return t;let r=parseFloat(String(t));return Number.isNaN(r)?t:r}case"boolean":{if(typeof t=="boolean")return t;if(typeof t=="string"){let r=t.toLowerCase();if(r==="true")return!0;if(r==="false")return!1}return t}default:return String(t)}}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return this.recordToQtiVariableJSON(t);if(e!=="single"){let n=this.normalizeListValue(t).map(i=>this.coerceBaseValue(i,r));return{list:{[r]:n}}}return{base:{[r]:this.coerceBaseValue(t,r)}}}recordToQtiVariableJSON(t){if(!t||typeof t!="object")return{record:[]};let e=[];for(let[r,n]of Object.entries(t))e.push(this.recordEntryFromValue(r,n));return{record:e}}recordEntryFromValue(t,e){if(Array.isArray(e)){let r=e.filter(n=>n!=null);if(r.length&&r.every(n=>typeof n=="boolean"))return{name:t,list:{boolean:r}};if(r.length&&r.every(n=>typeof n=="number")){let n=r,i=n.every(s=>Number.isInteger(s));return{name:t,list:{[i?"integer":"float"]:n}}}return{name:t,list:{string:e.map(n=>n==null?"":String(n))}}}if(typeof e=="boolean")return{name:t,base:{boolean:e}};if(typeof e=="number")return Number.isInteger(e)?{name:t,base:{integer:e}}:{name:t,base:{float:e}};if(e==null)return{name:t,base:{string:""}};if(typeof e=="object")try{return{name:t,base:{string:JSON.stringify(e)}}}catch{return{name:t,base:{string:String(e)}}}return{name:t,base:{string:String(e)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let i=n.querySelector("qti-default-value");if(!i)return;i.querySelectorAll("qti-value[field-identifier]").forEach(a=>{let c=a.getAttribute("field-identifier");if(!c)return;let l=a.getAttribute("base-type")||"string",d=a.textContent?.trim()||"";e[c]=this.coerceBaseValue(d,l)})}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let n={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return this.recordToQtiVariableJSON(n)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let n=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!n)return;let i=this.context?.variables?.find(c=>c.identifier===n);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[n]=this.variableToQtiVariableJSON(i.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let n=r.getAttribute("identifier")||"";if(!n)return;if(n==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(t[n]=c);return}let i=this.context?.variables?.find(c=>c.identifier===n);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[n]=this.variableToQtiVariableJSON(i.value,s,a)}),t}#d(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);e[n]=t[r]}return e}#p(t){let e={...t},r=(n,i,s)=>{let a=n;for(let c=0;c<i.length;c+=1){let l=i[c];if(c===i.length-1){a[l]=s;return}(!a[l]||typeof a[l]!="object"||Array.isArray(a[l]))&&(a[l]={}),a=a[l]}};for(let[n,i]of Object.entries(t)){if(!n.includes("__"))continue;let s=n.split("__").filter(Boolean);s.length<2||r(e,s,i)}return e}responseVariablesToQtiVariableJSON(t,e,r){if(e!=="single"){let n={list:{}};return n.list[r]=t,n}else{let n={base:{}};return n.base[r]=t,n}}#m(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#b(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",n=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},n)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#m();return this.#b(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#u(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={};if(this.context?.variables?.find(r=>r.identifier===this.responseIdentifier)){let r=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.cardinality||"single",n=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.baseType||"string",i=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.value||null,s=this.responseVariablesToQtiVariableJSON(i,r,n);t[this.responseIdentifier]=s}return t}#f(t){return t&&t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#y(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"?e[r]=this.#f(n):e[r]=n;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#q(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#w(),this.#v()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#v(){let t=this.#d(this.#p(this.#y({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,n={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:$i(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#C(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",n)}#C(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let n of r)t.push({id:n.getAttribute("id"),primaryPath:n.getAttribute("primary-path"),fallbackPath:n.getAttribute("fallback-path")})}return t}#w(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let n=e.map(i=>i.outerHTML).join(`
|
|
8104
|
+
`);this.sendMessageToIframe("setStylesheets",n)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#x(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#h()),r=JSON.stringify(this.#c()),n=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",i=n?n.endsWith("/")?n:`${n}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",c=a?`${window.location.origin}/cdn/index.js`:"https://unpkg.com/@citolab/qti-components/cdn",l=a?`${window.location.origin}/dist/item.css`:"https://unpkg.com/@citolab/qti-components@latest/dist/item.css",d=this.dataset.componentsCdnUrl||c,h=this.dataset.componentsCssUrl||l,f=`
|
|
8097
8105
|
font-family: ${t.getPropertyValue("font-family")};
|
|
8098
8106
|
font-size: ${t.getPropertyValue("font-size")};
|
|
8099
8107
|
line-height: ${t.getPropertyValue("line-height")};
|
|
@@ -8104,7 +8112,7 @@ CES.load();
|
|
|
8104
8112
|
<head>
|
|
8105
8113
|
<meta charset="utf-8" />
|
|
8106
8114
|
<title>QTI PCI Container</title>
|
|
8107
|
-
<base href="${
|
|
8115
|
+
<base href="${i}" />
|
|
8108
8116
|
<script type="module">
|
|
8109
8117
|
import '${d}';
|
|
8110
8118
|
</script>
|
|
@@ -8184,7 +8192,7 @@ CES.load();
|
|
|
8184
8192
|
catchError: true,
|
|
8185
8193
|
waitSeconds: 30,
|
|
8186
8194
|
paths: window.requirePaths,
|
|
8187
|
-
baseUrl: '${
|
|
8195
|
+
baseUrl: '${n}',
|
|
8188
8196
|
shim: window.requireShim,
|
|
8189
8197
|
onNodeCreated: function (node, config, moduleName, url) {
|
|
8190
8198
|
// Add error handler to script node
|
|
@@ -8984,13 +8992,13 @@ CES.load();
|
|
|
8984
8992
|
<body>
|
|
8985
8993
|
<div id="pci-container"></div>
|
|
8986
8994
|
</body>
|
|
8987
|
-
</html>`}disable(){if(this.#g={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let e=document.createElement("div");e.className="pci-interaction-overlay",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(200, 200, 200, 0.3)",e.style.zIndex="100",e.style.pointerEvents="all",e.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(e)}}enable(){let t=this.querySelector(".pci-interaction-overlay");t&&t.remove(),this.#g&&(this.#g.pointerEvents&&(this.style.pointerEvents=this.#g.pointerEvents),this.#g.position&&(this.style.position=this.#g.position),this.#g=null),this.sendMessageToIframe("setState",{state:"interacting"})}#g;render(){return
|
|
8995
|
+
</html>`}disable(){if(this.#g={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let e=document.createElement("div");e.className="pci-interaction-overlay",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(200, 200, 200, 0.3)",e.style.zIndex="100",e.style.pointerEvents="all",e.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(e)}}enable(){let t=this.querySelector(".pci-interaction-overlay");t&&t.remove(),this.#g&&(this.#g.pointerEvents&&(this.style.pointerEvents=this.#g.pointerEvents),this.#g.position&&(this.style.position=this.#g.position),this.#g=null),this.sendMessageToIframe("setState",{state:"interacting"})}#g;render(){return y`
|
|
8988
8996
|
<slot></slot>
|
|
8989
|
-
${this._errorMessage?
|
|
8997
|
+
${this._errorMessage?y`<div style="color:red">
|
|
8990
8998
|
<h1>Error</h1>
|
|
8991
8999
|
${this._errorMessage}
|
|
8992
9000
|
</div>`:""}
|
|
8993
|
-
`}};wt([p({type:String,attribute:"module"})],W.prototype,"module",void 0);wt([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);wt([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);wt([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);wt([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);wt([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);wt([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);wt([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);wt([
|
|
9001
|
+
`}};wt([p({type:String,attribute:"module"})],W.prototype,"module",void 0);wt([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);wt([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);wt([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);wt([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);wt([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);wt([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);wt([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);wt([T()],W.prototype,"_errorMessage",void 0);wt([_({context:j,subscribe:!0}),T()],W.prototype,"context",void 0);wt([_({context:mt,subscribe:!0}),T()],W.prototype,"qtiContext",void 0);wt([p({attribute:"response",reflect:!1,converter:Ft({emptyAs:null})})],W.prototype,"response",void 0);var Ko=class extends W{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let n=()=>{window.clearTimeout(i),e()},i=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",n),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",n,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=n=>{let{data:i}=n;i?.source==="qti-pci-iframe"&&(!i?.responseIdentifier||i?.responseIdentifier===this.responseIdentifier)&&i?.method==="getContentResponse"&&i?.messageId===e&&(window.removeEventListener("message",r),t(i.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let n=`click-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r())};window.addEventListener("message",i),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let n=`set-value-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.rect??null))};window.addEventListener("message",n),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let n=`set-value-text-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
|
|
8994
9002
|
// Test helper functions for QtiPortableCustomInteractionTest
|
|
8995
9003
|
// Base iframe implementation already provides PCIManager.getContent
|
|
8996
9004
|
|
|
@@ -9183,7 +9191,7 @@ CES.load();
|
|
|
9183
9191
|
}
|
|
9184
9192
|
},
|
|
9185
9193
|
true
|
|
9186
|
-
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var
|
|
9194
|
+
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var Jo=[{tag:"qti-portable-custom-interaction",ctor:W},{tag:"qti-portable-custom-interaction-test",ctor:Ko}];var Qh=[O,q`
|
|
9187
9195
|
:host {
|
|
9188
9196
|
display: block;
|
|
9189
9197
|
}
|
|
@@ -9194,12 +9202,12 @@ CES.load();
|
|
|
9194
9202
|
left: 50%;
|
|
9195
9203
|
transform: translateX(-50%);
|
|
9196
9204
|
}
|
|
9197
|
-
`];var
|
|
9205
|
+
`];var Zo=class extends C{static{this.styles=Qh}render(){return y`<slot></slot>`}};var Gh=[O,q`
|
|
9198
9206
|
:host {
|
|
9199
9207
|
display: inline-block;
|
|
9200
9208
|
position: relative;
|
|
9201
9209
|
}
|
|
9202
|
-
`];var
|
|
9210
|
+
`];var ts=class extends C{static{this.styles=Gh}render(){return y`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,r=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};var es=[{tag:"qti-position-object-interaction",ctor:Zo},{tag:"qti-position-object-stage",ctor:ts}];var Xh="important",qm=" !"+Xh,rs=kt(class extends ge{constructor(o){if(super(o),o.type!==kr.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let n=t[r];if(n!=null){this.ft.add(r);let i=typeof n=="string"&&n.endsWith(qm);r.includes("-")||i?e.setProperty(r,i?n.slice(0,-11):n,i?Xh:""):e[r]=n}}return tt}});var Yh=[O,q`
|
|
9203
9211
|
:host {
|
|
9204
9212
|
display: block;
|
|
9205
9213
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -9234,20 +9242,20 @@ CES.load();
|
|
|
9234
9242
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
9235
9243
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
9236
9244
|
}
|
|
9237
|
-
`];var
|
|
9245
|
+
`];var Wr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},dt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#n=1,this.#i=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#l();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,n=(t.clientY-e.top)*this.#n,i=`${r.toFixed()} ${n.toFixed()}`;this.maxChoices===1?this.response=[i]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],i]),this.saveResponse(this.response)},this.#a=()=>{this.#l()}}static{this.styles=Yh}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#n;#i;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[n,i]=r.split(" ").map(Number);return{x:n,y:i}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return M}positionOverlayElements(t){let e=this.#e;if(e){this.#l();for(let r of t){let n=r.dataset.coord,i=r.dataset.shape;!n||!i||Re(i,n.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return y` <slot name="prompt"></slot>
|
|
9238
9246
|
<point-container>
|
|
9239
|
-
${H(e.filter(r=>r),r=>r,(r,
|
|
9247
|
+
${H(e.filter(r=>r),r=>r,(r,n)=>{let[i,s]=r.split(" ").map(Number),a=i/(this.#i||1)*100,c=s/(this.#o||1)*100;return y`
|
|
9240
9248
|
<button
|
|
9241
|
-
part=${this.pointPart(r,
|
|
9242
|
-
style=${
|
|
9249
|
+
part=${this.pointPart(r,n)}
|
|
9250
|
+
style=${rs({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${c}%`})}
|
|
9243
9251
|
aria-label="Remove point at ${r}"
|
|
9244
9252
|
?disabled=${this.disabled}
|
|
9245
|
-
@click=${
|
|
9253
|
+
@click=${l=>{l.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==n),this.saveResponse(this.response)}}
|
|
9246
9254
|
></button>
|
|
9247
9255
|
`})}
|
|
9248
9256
|
${this.renderSupplementalLayer()}
|
|
9249
9257
|
<slot></slot>
|
|
9250
|
-
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,
|
|
9258
|
+
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,n=!0,i="";return e?(n=!1,i=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(n=!1,i=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(n,i,this.#e??this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}#l(){this.#i=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#i/t.width,this.#n=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#l(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Wr([p({type:Number,attribute:"max-choices"})],dt.prototype,"maxChoices",void 0);Wr([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);Wr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Na(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>$a(o)}})],dt.prototype,"response",void 0);Wr([p({attribute:"area-mappings"})],dt.prototype,"areaMappings",void 0);Wr([T()],dt.prototype,"_areaEntries",void 0);Wr([$("areaMappings")],dt.prototype,"_handleAreaMappingsChange",void 0);var ns=[{tag:"qti-select-point-interaction",ctor:dt}];var Kh=[O,q`
|
|
9251
9259
|
:host {
|
|
9252
9260
|
display: block;
|
|
9253
9261
|
--show-bounds: true;
|
|
@@ -9315,7 +9323,7 @@ CES.load();
|
|
|
9315
9323
|
text-align: center;
|
|
9316
9324
|
color: #6b7280; /* text-gray-500 */
|
|
9317
9325
|
}
|
|
9318
|
-
`];var
|
|
9326
|
+
`];var ti=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},xt=class extends D{constructor(){super(...arguments),this.#t=0,this.min=0,this.max=100,this.step=1}static{this.styles=Kh}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.hasAttribute("response")||this.#e(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#t.toString()}set response(t){if(t===null||t==="")return;let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return M}#e(t){let e=this.#t;if(this.#t=Math.min(this.max,Math.max(this.min,t)),this.#t===e)return;let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return y`
|
|
9319
9327
|
<slot name="prompt"></slot>
|
|
9320
9328
|
<div id="slider" part="slider">
|
|
9321
9329
|
<div id="bounds" part="bounds">
|
|
@@ -9325,7 +9333,7 @@ CES.load();
|
|
|
9325
9333
|
|
|
9326
9334
|
<div id="ticks" part="ticks"></div>
|
|
9327
9335
|
|
|
9328
|
-
<div id="rail" part="rail" @mousedown=${this.#r} @touchstart=${this.#
|
|
9336
|
+
<div id="rail" part="rail" @mousedown=${this.#r} @touchstart=${this.#n}>
|
|
9329
9337
|
<div id="knob" part="knob">
|
|
9330
9338
|
<div id="value" part="value">${this.response}</div>
|
|
9331
9339
|
</div>
|
|
@@ -9333,7 +9341,7 @@ CES.load();
|
|
|
9333
9341
|
${this.renderRailSupplement()}
|
|
9334
9342
|
</div>
|
|
9335
9343
|
</div>
|
|
9336
|
-
`}#r(t){this.#
|
|
9344
|
+
`}#r(t){this.#i(t.pageX);let e=n=>this.#o(n.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#s()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#i(t.touches[0].pageX);let e=n=>this.#o(n.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#s()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#i(t){this.#o(t)}#o(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,n=Math.min(1,Math.max(0,r/e.width)),i=this.min+Math.round(n*(this.max-this.min)/this.step)*this.step;this.#e(i)}#s(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};ti([fr("#rail")],xt.prototype,"_rail",void 0);ti([p({type:Number,attribute:"lower-bound"})],xt.prototype,"min",void 0);ti([p({type:Number,attribute:"upper-bound"})],xt.prototype,"max",void 0);ti([p({type:Number,attribute:"step"})],xt.prototype,"step",void 0);ti([p({attribute:"response",reflect:!1,noAccessor:!0})],xt.prototype,"response",null);var is=[{tag:"qti-slider-interaction",ctor:xt}];var Jh=()=>new ql,ql=class{},xl=new WeakMap,BO=kt(class extends ye{render(o){return M}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),M}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=xl.get(t);e===void 0&&(e=new WeakMap,xl.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?xl.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 Zh=[O,q`
|
|
9337
9345
|
:host {
|
|
9338
9346
|
display: inline-flex;
|
|
9339
9347
|
align-items: center;
|
|
@@ -9422,7 +9430,7 @@ CES.load();
|
|
|
9422
9430
|
:host(.qti-input-width-72) {
|
|
9423
9431
|
--qti-input-width: 72;
|
|
9424
9432
|
}
|
|
9425
|
-
`];var cr=function(
|
|
9433
|
+
`];var cr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},lt=class extends D{constructor(){super(...arguments),this.inputRef=Jh(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Zh}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;return this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity(),e&&this.response===""&&(e=!1),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0}),e}renderAnswer(){return y`<div part="answer" aria-hidden="true"></div>`}renderInput(){return y`<input
|
|
9426
9434
|
part="input"
|
|
9427
9435
|
name="${this.responseIdentifier}"
|
|
9428
9436
|
spellcheck="false"
|
|
@@ -9432,13 +9440,13 @@ CES.load();
|
|
|
9432
9440
|
@keyup="${this.textChanged}"
|
|
9433
9441
|
@change="${this.textChanged}"
|
|
9434
9442
|
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
9435
|
-
placeholder="${
|
|
9443
|
+
placeholder="${Ut(this.placeholderText?this.placeholderText:void 0)}"
|
|
9436
9444
|
.value="${this.response}"
|
|
9437
|
-
pattern="${
|
|
9445
|
+
pattern="${Ut(this.patternMask?this.patternMask:void 0)}"
|
|
9438
9446
|
maxlength=${1e3}
|
|
9439
9447
|
?disabled="${this.disabled}"
|
|
9440
9448
|
?readonly="${this.readonly}"
|
|
9441
|
-
/>`}renderValidationMessage(){return
|
|
9449
|
+
/>`}renderValidationMessage(){return y`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return y` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};cr([p({type:Number,attribute:"expected-length"})],lt.prototype,"expectedLength",void 0);cr([p({type:String,attribute:"pattern-mask"})],lt.prototype,"patternMask",void 0);cr([p({type:String,attribute:"placeholder-text"})],lt.prototype,"placeholderText",void 0);cr([p({type:String,attribute:"data-patternmask-message"})],lt.prototype,"dataPatternmaskMessage",void 0);cr([p({type:String,attribute:"response",reflect:!1})],lt.prototype,"response",void 0);cr([fr("input")],lt.prototype,"_input",void 0);cr([$("response",{waitUntilFirstUpdate:!0})],lt.prototype,"_handleValueChange",void 0);var os=[{tag:"qti-text-entry-interaction",ctor:lt}];var tp=[O,q`
|
|
9442
9450
|
:host {
|
|
9443
9451
|
display: block;
|
|
9444
9452
|
margin: 1em 0;
|
|
@@ -9447,12 +9455,12 @@ CES.load();
|
|
|
9447
9455
|
display: block;
|
|
9448
9456
|
margin-top: 0.5em;
|
|
9449
9457
|
}
|
|
9450
|
-
`];var
|
|
9458
|
+
`];var ss=class extends D{static{this.styles=tp}#t=null;#e=null;reset(){this.#t=null,this.#e=null,this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return y`
|
|
9451
9459
|
<div>
|
|
9452
9460
|
<slot name="prompt"></slot>
|
|
9453
9461
|
<input type="file" @change="${this.#r}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
9454
9462
|
</div>
|
|
9455
|
-
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var es=[{tag:"qti-upload-interaction",ctor:ts}];var Th=[...$d,...In,..._n,...Tn,...On,...Pn,...Mn,...Dn,...Nn,...$n,...Ln,...Vn,...zn,...jn,...Bn,...Un,...Wn,...Xn,...Kn,...Jn,...Zn,...es];for(let{tag:n,ctor:t}of Th)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of In)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of _n)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Tn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of On)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Pn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Mn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Dn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Nn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of $n)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Ln)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Vn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of zn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of jn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Bn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Un)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Wn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Xn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Kn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Jn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Zn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of es)customElements.get(n)||customElements.define(n,t);var bD=async n=>{let t=n.substring(0,n.lastIndexOf("/")),e=await Ml().load(`${n}`).then(a=>a.assessmentTest()),r=await Ir().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Ir().load(`${t}/${e.href}`).then(a=>a.items()),o=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:o,items:i,testIdentifier:e.identifier}},yD=async n=>jt().load(n).then(t=>t.htmlDoc().firstElementChild);var rs=class extends Bu(mt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Bu(n){return class extends n{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=o.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var Rh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Hr=class extends A{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};Rh([p({type:Number})],Hr.prototype,"min",void 0);Rh([p({type:Number})],Hr.prototype,"max",void 0);var Uu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ki=class extends A{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Uu([p({type:String,attribute:"base-type"})],Ki.prototype,"baseType",void 0);var is=class extends A{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var os=class extends mt{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(l=>o.includes(l)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};var ns=class extends A{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var lc=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},lr=class extends A{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let o=this._testContext.items.find(a=>a.identifier===e);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(o=>o.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};lc([p({type:String})],lr.prototype,"identifier",void 0);lc([T({context:j,subscribe:!0}),_()],lr.prototype,"context",void 0);lc([_(),T({context:ot,subscribe:!0})],lr.prototype,"_testContext",void 0);var ss=class extends A{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(o=>!e.value.includes(o))}return null}};var as=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return e}};var cs=class extends A{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var ls=class extends A{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Hu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ji=class extends A{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),o=parseFloat(r.value);if(!isNaN(i)&&!isNaN(o))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(i*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: ${i}, ${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}};Hu([p({type:String})],Ji.prototype,"roundingMode",void 0);var Wu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Zi=class extends A{constructor(){super(...arguments),this.toleranceMode="exact"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:J.compareSingleValues(e.value,r.value,e.baseType)}return console.error("unexpected number of children in qti-equal"),null}};Wu([p({type:String})],Zi.prototype,"toleranceMode",void 0);var ds=class extends A{getResult(){let t=this.getAttribute("field-identifier");if(!t)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 r=this.getVariables()[0];if(r.baseType!=="record"||r.value===null)throw new Error("qti-field-value child expression must return a record");let i=r.value[t];if(i===void 0)throw new Error(`Field "${t}" not found in record`);return i}};var hs=class extends A{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let o=parseInt(i,10);if(isNaN(o))return console.error("qti-gcd non-numerical value"),null;e.push(o)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var ps=class extends A{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var us=class extends mt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};var Qu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},to=class extends A{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Qu([p({type:String})],to.prototype,"n",void 0);var Oh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Wr=class extends A{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#o(r,i);case"poly":case"polygon":return this.#n(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(o=>o.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,o]=e;return(t.x-r)**2+(t.y-i)**2<=o**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,o,s]=e,a=Math.min(r,o),l=Math.max(r,o),c=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#o(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,o,s]=e;return o===0||s===0?!1:(t.x-r)**2/o**2+(t.y-i)**2/s**2<=1}#n(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,o=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],l=e[o],c=e[o+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),o=i}return r}};Oh([p({type:String})],Wr.prototype,"shape",void 0);Oh([p({type:String})],Wr.prototype,"coords",void 0);var ms=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var fs=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]%t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var gs=class extends A{getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var bs=class extends A{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var ys=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let o=Number.parseInt(i,10);if(Number.isNaN(o))return console.error("qti-lcm requires integer values"),[];e.push(o)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let o=r%i;r=i,i=o}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var ct=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ph=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Qr=class extends ct{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===t)||null,r;return e.interpolationTable&&(r=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ct(r)}})),r)}};Ph([p({type:String})],Qr.prototype,"identifier",void 0);Ph([T({context:j,subscribe:!0}),_()],Qr.prototype,"context",void 0);var vs=class extends A{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var ws=class extends mt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};var Gu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},eo=class extends A{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(t.value)?t.value:[t.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,o=new Set;for(let s of r)for(let a of e.areaMapEntries){if(o.has(a.coords))continue;J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)&&(i+=a.mappedValue??0,o.add(a.coords))}return o.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Gu([p({type:String})],eo.prototype,"identifier",void 0);var Xu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ro=class extends A{getResult(){let t=this.context.variables.find(o=>o.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),o.toLowerCase(),t.baseType):J.compareSingleValues(l.mapKey,o,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Xu([p({type:String})],ro.prototype,"identifier",void 0);var xs=class n extends A{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return n.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!J.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let o=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){o=a;break}if(o!==null)s.splice(s.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Yu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},io=class extends A{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#t(this.name,e)}#t(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"log":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Yu([p({type:String})],io.prototype,"name",void 0);var qs=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return e}};var Cs=class extends A{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var ks=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return e}};var Es=class extends A{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Ss=class extends A{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var As=class extends A{getResult(){return null}};var Is=class extends mt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(e=>typeof e=="boolean"&&e)}};var _s=class extends A{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var Ts=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},Gr=class extends Ts{shouldProcess(){return!0}getSubRules(){return[...this.children]}},Xr=class extends Ts{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},Yr=class extends ct{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Rs=class extends Yr{};var Kr=class extends Xr{};var Os=class extends Kr{};var Ps=class extends Gr{};var Ku=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},oo=class extends A{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;try{return new RegExp(this.pattern).test(e.value.toString())}catch(r){return console.error("qti-pattern-match requires a valid regular expression",r),null}}};Ku([p({type:String})],oo.prototype,"pattern",void 0);var Ms=class extends A{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),o=parseFloat(r.value);if(isNaN(i)||isNaN(o))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&o<=0||i<0&&!Number.isInteger(o))return null;let s;try{s=Math.pow(i,o)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var Ju=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Zu(n){return n.replace(/e([+-])(\d)$/,"e$10$2")}function no(n,t){return Zu(t===void 0?n.toExponential():n.toExponential(t))}function Mh(n){let[t,e]=n.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function Dh(n,t){let e=t===0?1:t,r=n===0?0:Math.floor(Math.log10(n));return r<-4||r>=e?Mh(no(n,e-1)):Mh(n.toFixed(Math.max(0,e-1-r)))}function tm(n,t,e,r){if(n==="s"||n==="c"){let c=n==="c"?r.slice(0,1):r;return e===void 0?c:c.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let o=Math.abs(i),s,a=i<0;switch(n){case"d":case"i":s=String(Math.trunc(o));break;case"u":s=String(Math.trunc(o)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(o).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(o).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(o).toString(16).toUpperCase()}`;break;case"f":case"F":s=o.toFixed(e??6);break;case"e":s=no(o,e??6);break;case"E":s=no(o,e??6).toUpperCase();break;case"g":s=Dh(o,e??6);break;case"G":s=Dh(o,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function em(n,t,e){if(n.length>=e)return n;let r=e-n.length;if(t.includes("-"))return`${n}${" ".repeat(r)}`;if(t.includes("0")){let[,i,o]=/^([-+ ]?)(.*)$/.exec(n);return`${i}${"0".repeat(r)}${o}`}return`${" ".repeat(r)}${n}`}function Nh(n,t){return n.replace(Ju,(e,r,i,o,s,a)=>r?"%":em(tm(a,i??"",s===void 0?void 0:Number(s),t),i??"",o===void 0?0:Number(o)))}var le=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ht=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:b`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let o=r[this.field];return o==null?null:this.#e(o,t.baseType)}let i=Object.entries(r).filter(([,o])=>o!=null);return i.length===0?null:i.map(([o,s])=>`${o}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return Nh(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return no(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};le([p({type:String})],ht.prototype,"identifier",void 0);le([p({type:String})],ht.prototype,"format",void 0);le([p({type:Number})],ht.prototype,"base",void 0);le([p({type:Number})],ht.prototype,"index",void 0);le([p({type:Boolean,attribute:"power-form"})],ht.prototype,"powerForm",void 0);le([p({type:String})],ht.prototype,"field",void 0);le([p({type:String})],ht.prototype,"delimiter",void 0);le([p({type:String,attribute:"mapping-indicator"})],ht.prototype,"mappingIndicator",void 0);le([T({context:j,subscribe:!0}),_()],ht.prototype,"context",void 0);var Ds=class extends A{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var dc=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},dr=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 t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};dc([p({type:Number})],dr.prototype,"min",void 0);dc([p({type:Number})],dr.prototype,"max",void 0);dc([p({type:Number})],dr.prototype,"step",void 0);var Ns=class extends A{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var rm=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},so=class extends A{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let o=e.calculate(),s=this.#e(o);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return t;let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,o=parseInt(i?.toString()??"",10);return Number.isNaN(o)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):o}#e(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};rm([p({type:String,attribute:"number-repeats"})],so.prototype,"numberRepeats",void 0);var $s=class extends Yr{};var Jr=class extends Xr{};var Ls=class extends Jr{};var Vs=class extends Gr{};var $h=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Zr=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 t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};$h([p({type:String,attribute:"rounding-mode"})],Zr.prototype,"roundingMode",void 0);$h([p({type:Number})],Zr.prototype,"figures",void 0);var zs=class extends A{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var js=class extends ct{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new hc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ct(this.#e(e))):Ct(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},hc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Fs=class extends ct{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new pc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Ct):t!==null?Ct(t):null}},pc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var Bs=class extends ct{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new uc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ct(this.#e(e))):Ct(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},uc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var im=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ao=class extends A{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#e(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return t.reduce((e,r)=>e+r,0)/t.length;case"popsd":return this.#t(t);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){let e=t.reduce((i,o)=>i+o,0)/t.length,r=t.reduce((i,o)=>i+Math.pow(o-e,2),0)/t.length;return Math.sqrt(r)}#e(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return e}};im([p({type:String})],ao.prototype,"name",void 0);var om=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},co=class extends A{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),o=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,o,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};om([p({type:String,attribute:"case-sensitive"})],co.prototype,"caseSensitive",void 0);var nm=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},lo=class extends A{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),o=r.value.toString();return this.caseSensitive!=="true"?o.toLowerCase().includes(i.toLowerCase()):o.includes(i)}};nm([p({type:String,attribute:"case-sensitive"})],lo.prototype,"caseSensitive",void 0);var Us=class extends sm(A){getResult(){return this.calculateChildren(Array.from(this.children))}};function sm(n){return class extends n{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Hs=class extends A{getResult(){return new mc(Array.from(this.children)).calculate()}},mc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var Ws=class extends A{getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var Qs=class extends A{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Lh=[{tag:"qti-and",ctor:rs},{tag:"qti-any-n",ctor:Hr},{tag:"qti-base-value",ctor:Ki},{tag:"qti-container-size",ctor:is},{tag:"qti-contains",ctor:os},{tag:"qti-correct",ctor:ns},{tag:"qti-default",ctor:lr},{tag:"qti-delete",ctor:ss},{tag:"qti-divide",ctor:as},{tag:"qti-duration-gte",ctor:cs},{tag:"qti-duration-lt",ctor:ls},{tag:"qti-equal",ctor:Zi},{tag:"qti-equal-rounded",ctor:Ji},{tag:"qti-field-value",ctor:ds},{tag:"qti-gcd",ctor:hs},{tag:"qti-gt",ctor:ps},{tag:"qti-gte",ctor:us},{tag:"qti-index",ctor:to},{tag:"qti-inside",ctor:Wr},{tag:"qti-integer-divide",ctor:ms},{tag:"qti-integer-modulus",ctor:fs},{tag:"qti-integer-to-float",ctor:gs},{tag:"qti-is-null",ctor:bs},{tag:"qti-lcm",ctor:ys},{tag:"qti-lookup-outcome-value",ctor:Qr},{tag:"qti-lt",ctor:vs},{tag:"qti-lte",ctor:ws},{tag:"qti-map-response",ctor:ro},{tag:"qti-map-response-point",ctor:eo},{tag:"qti-match",ctor:xs},{tag:"qti-math-operator",ctor:io},{tag:"qti-max",ctor:qs},{tag:"qti-member",ctor:Cs},{tag:"qti-min",ctor:ks},{tag:"qti-multiple",ctor:Es},{tag:"qti-not",ctor:Ss},{tag:"qti-null",ctor:As},{tag:"qti-or",ctor:Is},{tag:"qti-ordered",ctor:_s},{tag:"qti-outcome-condition",ctor:Rs},{tag:"qti-outcome-else",ctor:Ps},{tag:"qti-outcome-else-if",ctor:Os},{tag:"qti-outcome-if",ctor:Kr},{tag:"qti-pattern-match",ctor:oo},{tag:"qti-power",ctor:Ms},{tag:"qti-printed-variable",ctor:ht},{tag:"qti-product",ctor:Ds},{tag:"qti-random",ctor:Ns},{tag:"qti-random-integer",ctor:dr},{tag:"qti-repeat",ctor:so},{tag:"qti-response-condition",ctor:$s},{tag:"qti-response-else",ctor:Vs},{tag:"qti-response-else-if",ctor:Ls},{tag:"qti-response-if",ctor:Jr},{tag:"qti-round",ctor:zs},{tag:"qti-round-to",ctor:Zr},{tag:"qti-rule",ctor:ct},{tag:"qti-set-correct-response",ctor:js},{tag:"qti-set-outcome-value",ctor:Fs},{tag:"qti-set-template-value",ctor:Bs},{tag:"qti-stats-operator",ctor:ao},{tag:"qti-string-match",ctor:co},{tag:"qti-substring",ctor:lo},{tag:"qti-subtract",ctor:Us},{tag:"qti-sum",ctor:Hs},{tag:"qti-truncate",ctor:Ws},{tag:"qti-variable",ctor:Qs}];for(let{tag:n,ctor:t}of Lh)customElements.get(n)||customElements.define(n,t);var de=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},X;(function(n){n.Correct="correct",n.PartiallyCorrect="partially-correct",n.Incorrect="incorrect"})(X||(X={}));var fc=n=>{class t extends n{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let o=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>o.includes(d)).length,c=a.filter(d=>!o.includes(d)).length;return l===o.length&&c===0&&a.length===o.length?X.Correct:l>0&&(l<o.length||c>0)?X.PartiallyCorrect:X.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,o=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==X.Correct))){if(!o)return;this.parentElement?.removeChild(i);return}if(o)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return de([p({attribute:"correct-response",reflect:!0,converter:zt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),de([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),de([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),de([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),de([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),de([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),de([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),de([_()],t.prototype,"_isFullCorrectResponse",void 0),de([_()],t.prototype,"_correctResponse",void 0),t};var it=q`
|
|
9463
|
+
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#n(this.#t),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#n(t){return new Promise((e,r)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}};var as=[{tag:"qti-upload-interaction",ctor:ss}];var ep=[...Mo,...Po,...Do,...$o,...Lo,...Vo,...jo,...Fo,...Bo,...Uo,...Ho,...Wo,...Qo,...Xo,...Yo,...Jo,...es,...ns,...is,...os,...as,...rh];for(let{tag:o,ctor:t}of ep)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Mo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Po)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Do)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of $o)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Lo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Vo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Fo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Bo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Uo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ho)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Qo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Xo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);var vN=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await ld().load(`${o}`).then(a=>a.assessmentTest()),r=await Rr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),n=await Rr().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:i,items:n,testIdentifier:e.identifier}},wN=async o=>Bt().load(o).then(t=>t.htmlDoc().firstElementChild);var ls=class extends Cm(jt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Cm(o){return class extends o{calculateChildren(e){return e.map(n=>{let i=n;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(n=>typeof n=="boolean"&&n)}}}var rp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qr=class extends S{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};rp([p({type:Number})],Qr.prototype,"min",void 0);rp([p({type:Number})],Qr.prototype,"max",void 0);var Em=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ei=class extends S{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Em([p({type:String,attribute:"base-type"})],ei.prototype,"baseType",void 0);var cs=class extends S{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var ds=class extends S{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let n=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#n(n,i,r):this.#r(n,i,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return G.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let n=[...t];return e.every(i=>{let s=n.findIndex(a=>this.#e(a,i,r));return s===-1?!1:(n.splice(s,1),!0)})}#n(t,e,r){for(let n=0;n+e.length<=t.length;n++)if(e.every((i,s)=>this.#e(t[n+s],i,r)))return!0;return!1}};var hs=class extends S{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Cl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},dr=class extends S{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let i=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!i)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let n=this.context.variables.find(i=>i.identifier===r);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Cl([p({type:String})],dr.prototype,"identifier",void 0);Cl([_({context:j,subscribe:!0}),T()],dr.prototype,"context",void 0);Cl([T(),_({context:ot,subscribe:!0})],dr.prototype,"_testContext",void 0);var ps=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(i=>!e.value.includes(i))}return null}};var us=class extends S{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};var ms=class extends S{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var fs=class extends S{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var km=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ri=class extends S{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let n=parseFloat(e.value),i=parseFloat(r.value);if(!isNaN(n)&&!isNaN(i))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${i}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};km([p({type:String,attribute:"rounding-mode"})],ri.prototype,"roundingMode",void 0);var np=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Gr=class extends S{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?G.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[n,i=n]=r,[s,a]=this.toleranceMode==="absolute"?[e-n,e+i]:[e*(1-n/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};np([p({type:String,attribute:"tolerance-mode"})],Gr.prototype,"toleranceMode",void 0);np([p({type:String})],Gr.prototype,"tolerance",void 0);var Q=class extends C{render(){return y`<slot></slot>`}process(){throw new Error("Not implemented")}};var gs=class extends Q{process(){throw new qr}};var bs=class extends Q{process(){throw new Cr}};var ys=class extends S{getResult(){let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0];if(!e||e.baseType!=="record"||e.value===null||e.value===void 0)return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r===void 0?null:r}};var vs=class extends S{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let n=parseInt(r.value,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let n of r.value){if(n==null)return null;let i=parseInt(n,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var ws=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var xs=class extends jt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Sm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ni=class extends S{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Sm([p({type:String})],ni.prototype,"n",void 0);var ip=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Xr=class extends S{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),n=this.#e(this.coords);if(!r||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,n);case"rect":return this.#n(r,n);case"ellipse":return this.#i(r,n);case"poly":case"polygon":return this.#o(r,n);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),n=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:n}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,n,i]=e;return(t.x-r)**2+(t.y-n)**2<=i**2}#n(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,n,i,s]=e,a=Math.min(r,i),c=Math.max(r,i),l=Math.min(n,s),d=Math.max(n,s);return t.x>=a&&t.x<=c&&t.y>=l&&t.y<=d}#i(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,n,i,s]=e;return i===0||s===0?!1:(t.x-r)**2/i**2+(t.y-n)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let n=0,i=e.length-2;n<e.length;n+=2){let s=e[n],a=e[n+1],c=e[i],l=e[i+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),i=n}return r}};ip([p({type:String})],Xr.prototype,"shape",void 0);ip([p({type:String})],Xr.prototype,"coords",void 0);var qs=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-divide requires integer values"),[];e.push(n)}return e}};var Cs=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-modulus requires integer values"),[];e.push(n)}return e}};var Es=class extends S{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var ks=class extends S{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Ss=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let n of r.value){let i=Number.parseInt(n,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let r=Math.abs(t),n=Math.abs(e);for(;n!==0;){let i=r%n;r=n,n=i}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var op=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Yr=class extends Q{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(i=>i.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),n;return e.matchTable?.size?n=e.matchTable.get(r):e.interpolationTable&&(n=this.#t(r,e.interpolationTable)),n==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ct(n)}})),n)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};op([p({type:String})],Yr.prototype,"identifier",void 0);op([_({context:j,subscribe:!0}),T()],Yr.prototype,"context",void 0);var As=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Is=class extends jt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Am=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ii=class extends S{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(t.value)?t.value:[t.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let n=0,i=new Set;for(let s of r)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(G.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){n+=a.mappedValue??0,i.add(a.coords);break}}return i.size<r.length&&(n+=e.defaultValue),e.lowerBound!=null&&(n=Math.max(e.lowerBound,n)),e.upperBound!=null&&(n=Math.min(e.upperBound,n)),n}};Am([p({type:String})],ii.prototype,"identifier",void 0);var Im=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},oi=class extends S{getResult(){let t=this.context.variables.find(i=>i.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],n=0;for(let i of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?G.compareSingleValues(c.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):G.compareSingleValues(c.mapKey,i,t.baseType)),a=s.reduce((c,l)=>c.mappedValue>l.mappedValue?c:l,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?n+=e.defaultValue:n+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(n=Math.max(e.lowerBound,n)),e?.upperBound!==null&&e?.upperBound!==void 0&&(n=Math.min(e.upperBound,n)),n}};Im([p({type:String})],oi.prototype,"identifier",void 0);var _s=class o extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):G.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!G.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let n of e.value){let i=null,s=[...t.value];for(let a of s)if(G.compareSingleValues(n,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var _m=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},si=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};_m([p({type:String})],si.prototype,"name",void 0);var Tm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ai=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let n=parseFloat(r.value);if(isNaN(n))return console.error("qti-math-operator non-numerical value"),null;e.push(n)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],n=e[1];return r===0&&n<=0||r<0&&!Number.isInteger(n)?null:Math.pow(r,n)}case"log_base":{if(e.length!==2)return null;let r=e[0],n=e[1];return r<=0||n<=0||n===1?null:Math.log(r)/Math.log(n)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Tm([p({type:String})],ai.prototype,"name",void 0);var Ts=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};var Rs=class extends S{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let n=e.value;return r.value.includes(n)}};var Os=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};var Ms=class extends S{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Ps=class extends S{render(){return y`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ds=class extends S{getResult(){return null}};var Ns=class extends jt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=r.calculate(),i=!1;if(typeof n=="string")if(n==="true")i=!0;else if(n==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(i=n);return i}).some(e=>typeof e=="boolean"&&e)}};var $s=class extends S{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var Ls=class extends C{render(){return y`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},Kr=class extends Ls{shouldProcess(){return!0}getSubRules(){return[...this.children]}},Jr=class extends Ls{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},Zr=class extends Q{render(){return y`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Vs=class extends Zr{};var tn=class extends Jr{};var zs=class extends tn{};var js=class extends Kr{};var Rm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},li=class extends S{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Rm([p({type:String})],li.prototype,"pattern",void 0);var Fs=class extends S{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let n=parseFloat(e.value),i=parseFloat(r.value);if(isNaN(n)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(n===0&&i<=0||n<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(n,i)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var Om=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Mm(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function ci(o,t){return Mm(t===void 0?o.toExponential():o.toExponential(t))}function sp(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,n=e===void 0?"":`e${e}`;return`${r}${n}`}function ap(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?sp(ci(o,e-1)):sp(o.toFixed(Math.max(0,e-1-r)))}function Pm(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let n=Number(r);if(r.trim()===""||!Number.isFinite(n))return r;let i=Math.abs(n),s,a=n<0;switch(o){case"d":case"i":s=String(Math.trunc(i));break;case"u":s=String(Math.trunc(i)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(i).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(i).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(i).toString(16).toUpperCase()}`;break;case"f":case"F":s=i.toFixed(e??6);break;case"e":s=ci(i,e??6);break;case"E":s=ci(i,e??6).toUpperCase();break;case"g":s=ap(i,e??6);break;case"G":s=ap(i,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Dm(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,n,i]=/^([-+ ]?)(.*)$/.exec(o);return`${n}${"0".repeat(r)}${i}`}return`${" ".repeat(r)}${o}`}function lp(o,t){return o.replace(Om,(e,r,n,i,s,a)=>r?"%":Dm(Pm(a,n??"",s===void 0?void 0:Number(s),t),n??"",i===void 0?0:Number(i)))}var ce=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ht=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?M:y`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let i=r[this.field];return i==null?null:this.#e(i,t.baseType)}let n=Object.entries(r).filter(([,i])=>i!=null);return n.length===0?null:n.map(([i,s])=>`${i}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return lp(this.format,r);if(e==="integer"&&this.base!==10){let n=Number.parseInt(r,10);if(Number.isFinite(n))return n.toString(this.base)}if(this.powerForm){let n=Number(r);if(r.trim()!==""&&Number.isFinite(n))return ci(n)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ce([p({type:String})],ht.prototype,"identifier",void 0);ce([p({type:String})],ht.prototype,"format",void 0);ce([p({type:Number})],ht.prototype,"base",void 0);ce([p({type:Number})],ht.prototype,"index",void 0);ce([p({type:Boolean,attribute:"power-form"})],ht.prototype,"powerForm",void 0);ce([p({type:String})],ht.prototype,"field",void 0);ce([p({type:String})],ht.prototype,"delimiter",void 0);ce([p({type:String,attribute:"mapping-indicator"})],ht.prototype,"mappingIndicator",void 0);ce([_({context:j,subscribe:!0}),T()],ht.prototype,"context",void 0);var Bs=class extends S{getResult(){return this.getVariables().reduce((r,n)=>{if(n.baseType=="float"||n.baseType=="integer")try{return r*parseFloat(n.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${n.baseType}`);return r},1)}};var El=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},hr=class extends S{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};El([p({type:Number})],hr.prototype,"min",void 0);El([p({type:Number})],hr.prototype,"max",void 0);El([p({type:Number})],hr.prototype,"step",void 0);var Us=class extends S{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var Nm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},kl=1e3,di=class extends S{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let n=0;n<t;n++){let i=e.calculate(),s=this.#r(i);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let n=Array.isArray(r.value)?r.value[0]:r.value,i=parseInt(n?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>kl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${kl} limit, truncating`),kl):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Nm([p({type:String,attribute:"number-repeats"})],di.prototype,"numberRepeats",void 0);var Hs=class extends Zr{};var en=class extends Jr{};var Ws=class extends en{};var Qs=class extends Kr{};var Gs=class extends Q{process(){for(let t of[...this.children])t.process()}};var cp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},rn=class extends S{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),n=Math.pow(10,e-r-1);return Math.round(t*n)/n}};cp([p({type:String,attribute:"rounding-mode"})],rn.prototype,"roundingMode",void 0);cp([p({type:Number})],rn.prototype,"figures",void 0);var Xs=class extends S{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var Ys=class extends Q{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let n=new Sl(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ct(this.#e(e))):Ct(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Sl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Ks=class extends Q{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let n=new Al(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(n)}}))}#t(t){return Array.isArray(t)?t.map(Ct):t!==null?Ct(t):null}},Al=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var Js=class extends Q{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let n=new Il(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Ct(this.#e(e))):Ct(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Il=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var $m=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},hi=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#n(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((n,i)=>n-i),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((n,i)=>n+Math.pow(i-r,2),0)/e}#n(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(i=>n(i));continue}n(r.value)}return e}};$m([p({type:String})],hi.prototype,"name",void 0);var Lm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pi=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return G.compareSingleValues(n,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Lm([p({type:String,attribute:"case-sensitive"})],pi.prototype,"caseSensitive",void 0);var Vm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ui=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let n=e.value.toString(),i=r.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(n.toLowerCase()):i.includes(n)}};Vm([p({type:String,attribute:"case-sensitive"})],ui.prototype,"caseSensitive",void 0);var Zs=class extends zm(S){getResult(){return this.calculateChildren(Array.from(this.children))}};function zm(o){return class extends o{calculateChildren(e){let r=e.map(n=>{if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=n.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return r.some(n=>n===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var ta=class extends S{getResult(){return new _l(Array.from(this.children)).calculate()}},_l=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let n=r.calculate();return Number.isNaN(n)?(console.error("unexpected value in qti-sum, expected number"),null):Number(n)}).reduce((r,n)=>r+n,0)}};var ea=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ra=class extends S{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var dp=[{tag:"qti-and",ctor:ls},{tag:"qti-any-n",ctor:Qr},{tag:"qti-base-value",ctor:ei},{tag:"qti-container-size",ctor:cs},{tag:"qti-contains",ctor:ds},{tag:"qti-correct",ctor:hs},{tag:"qti-default",ctor:dr},{tag:"qti-delete",ctor:ps},{tag:"qti-divide",ctor:us},{tag:"qti-duration-gte",ctor:ms},{tag:"qti-duration-lt",ctor:fs},{tag:"qti-equal",ctor:Gr},{tag:"qti-equal-rounded",ctor:ri},{tag:"qti-exit-response",ctor:gs},{tag:"qti-exit-test",ctor:bs},{tag:"qti-field-value",ctor:ys},{tag:"qti-gcd",ctor:vs},{tag:"qti-gt",ctor:ws},{tag:"qti-gte",ctor:xs},{tag:"qti-index",ctor:ni},{tag:"qti-inside",ctor:Xr},{tag:"qti-integer-divide",ctor:qs},{tag:"qti-integer-modulus",ctor:Cs},{tag:"qti-integer-to-float",ctor:Es},{tag:"qti-is-null",ctor:ks},{tag:"qti-lcm",ctor:Ss},{tag:"qti-lookup-outcome-value",ctor:Yr},{tag:"qti-lt",ctor:As},{tag:"qti-lte",ctor:Is},{tag:"qti-map-response",ctor:oi},{tag:"qti-map-response-point",ctor:ii},{tag:"qti-match",ctor:_s},{tag:"qti-math-constant",ctor:si},{tag:"qti-math-operator",ctor:ai},{tag:"qti-max",ctor:Ts},{tag:"qti-member",ctor:Rs},{tag:"qti-min",ctor:Os},{tag:"qti-multiple",ctor:Ms},{tag:"qti-not",ctor:Ps},{tag:"qti-null",ctor:Ds},{tag:"qti-or",ctor:Ns},{tag:"qti-ordered",ctor:$s},{tag:"qti-outcome-condition",ctor:Vs},{tag:"qti-outcome-else",ctor:js},{tag:"qti-outcome-else-if",ctor:zs},{tag:"qti-outcome-if",ctor:tn},{tag:"qti-pattern-match",ctor:li},{tag:"qti-power",ctor:Fs},{tag:"qti-printed-variable",ctor:ht},{tag:"qti-product",ctor:Bs},{tag:"qti-random",ctor:Us},{tag:"qti-random-integer",ctor:hr},{tag:"qti-repeat",ctor:di},{tag:"qti-response-condition",ctor:Hs},{tag:"qti-response-else",ctor:Qs},{tag:"qti-response-else-if",ctor:Ws},{tag:"qti-response-if",ctor:en},{tag:"qti-response-processing-fragment",ctor:Gs},{tag:"qti-round",ctor:Xs},{tag:"qti-round-to",ctor:rn},{tag:"qti-rule",ctor:Q},{tag:"qti-set-correct-response",ctor:Ys},{tag:"qti-set-outcome-value",ctor:Ks},{tag:"qti-set-template-value",ctor:Js},{tag:"qti-stats-operator",ctor:hi},{tag:"qti-string-match",ctor:pi},{tag:"qti-substring",ctor:ui},{tag:"qti-subtract",ctor:Zs},{tag:"qti-sum",ctor:ta},{tag:"qti-truncate",ctor:ea},{tag:"qti-variable",ctor:ra}];for(let{tag:o,ctor:t}of dp)customElements.get(o)||customElements.define(o,t);var de=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},K;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(K||(K={}));var Tl=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,n)=>{this.toggleInternalCorrectResponse(n)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,n)=>{this.toggleFullCorrectResponse(n)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,n)=>{this.toggleCandidateCorrection(n)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let n=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",n)}get correctness(){let r=this.correctResponse;if(!r)return null;let n=this.response;if(n==null||n===""||Array.isArray(n)&&n.length===0)return null;let i=Array.isArray(r)?r:[r],a=(Array.isArray(n)?n:[n]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>i.includes(d)).length,l=a.filter(d=>!i.includes(d)).length;return c===i.length&&l===0&&a.length===i.length?K.Correct:c>0&&(c<i.length||l>0)?K.PartiallyCorrect:K.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let n=this.nextSibling,i=n instanceof HTMLDivElement&&n?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==K.Correct))){if(!i)return;this.parentElement?.removeChild(n);return}if(i)return;let c=this.cloneNode(!0);c.removeAttribute("show-full-correct-response"),c.removeAttribute("show-correct-response"),c.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(c),c.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await c.updateComplete,c.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return de([p({attribute:"correct-response",reflect:!0,converter:Ft({emptyAs:null})})],t.prototype,"correctResponseAttr",null),de([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),de([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),de([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),de([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),de([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),de([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),de([T()],t.prototype,"_isFullCorrectResponse",void 0),de([T()],t.prototype,"_correctResponse",void 0),t};var it=q`
|
|
9456
9464
|
/* Nothing at all until the item judges this element. */
|
|
9457
9465
|
[part~='correction'] {
|
|
9458
9466
|
display: none;
|
|
@@ -9485,69 +9493,69 @@ CES.load();
|
|
|
9485
9493
|
|
|
9486
9494
|
pointer-events: none;
|
|
9487
9495
|
}
|
|
9488
|
-
`;var
|
|
9496
|
+
`;var jm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Y=o=>{class t extends Tl(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let n=this._internals;n.states.delete("candidate-correct"),n.states.delete("candidate-partially-correct"),n.states.delete("candidate-incorrect");let i=null;r&&(this.correctness===K.Correct&&(n.states.add("candidate-correct"),i="correct"),this.correctness===K.PartiallyCorrect&&(n.states.add("candidate-partially-correct"),i="partially-correct"),this.correctness===K.Incorrect&&(n.states.add("candidate-incorrect"),i="incorrect")),this._candidateCorrection!==i&&(this._candidateCorrection=i)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return jm([T()],t.prototype,"_candidateCorrection",void 0),t};var pr=o=>{class t extends Y(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let n=this.correctResponse,i=n?Array.isArray(n)?n:[n]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),r&&i.length>0&&s.internals.states.add(i.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let n=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],i=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)i.includes(s.identifier)&&(s.candidateCorrection=n.includes(s.identifier)?"correct":"incorrect")}}return t};var qt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let n=this.#t;this.#t=r;let i=this.internals.states;i.delete("candidate-correct"),i.delete("candidate-incorrect"),i.delete("candidate-partially-correct"),r&&i.add(`candidate-${r}`),this.requestUpdate("candidateCorrection",n)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var Rl=class extends qt(Ce){static{this.styles=[Ce.styles,it]}render(){return y`<div part="control"></div>
|
|
9489
9497
|
<slot part="label"></slot>
|
|
9490
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9498
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Fm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},na=class extends qt(nr){constructor(){super(...arguments),this.orderCorrect=null}};Fm([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],na.prototype,"orderCorrect",void 0);var Ol=class extends qt(ir){static{this.styles=[ir.styles,it]}render(){return y`<div part="control"><div part="control-mark"></div></div>
|
|
9491
9499
|
<slot part="label"></slot>
|
|
9492
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9500
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Ml=class extends qt(It){static{this.styles=[It.styles,it]}render(){return y`
|
|
9493
9501
|
<div part="control"></div>
|
|
9494
9502
|
<slot part="label"></slot>
|
|
9495
9503
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9496
9504
|
<div part="drop">
|
|
9497
9505
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
9498
9506
|
</div>
|
|
9499
|
-
`}};var
|
|
9500
|
-
${this.marker?
|
|
9507
|
+
`}};var Pl=class extends qt(_t){static{this.styles=[_t.styles,it]}render(){return y`<div part="control" tabindex="0"><div part="control-mark"></div></div>
|
|
9508
|
+
${this.marker?y`<div id="label" part="marker">${this.marker}</div>`:M}
|
|
9501
9509
|
<slot part="label"></slot>
|
|
9502
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9510
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var hp=class extends nt{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(n=>n.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var pp=class extends ie{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var up=class extends at{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.showSolution)return;let n=t;n.showCandidateCorrection?.(!0),n.showCorrectResponse?.(r)}},mp=class extends We{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},fp=class extends Nr{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var Dl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},mi=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return y`
|
|
9503
9511
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
9504
9512
|
<select
|
|
9505
9513
|
part="select"
|
|
9506
9514
|
id="modeSelect"
|
|
9507
9515
|
@change=${t=>{let e=t.target;this.#t(e.value)}}
|
|
9508
9516
|
>
|
|
9509
|
-
${Object.keys(this._options).map(t=>
|
|
9517
|
+
${Object.keys(this._options).map(t=>y`<option value="${t}" ?selected=${t===this.itemContext?.correctResponseMode}>
|
|
9510
9518
|
${this._options[t]}
|
|
9511
9519
|
</option>`)}
|
|
9512
9520
|
</select>
|
|
9513
|
-
`}};
|
|
9521
|
+
`}};Dl([_({context:ut,subscribe:!0})],mi.prototype,"itemContext",void 0);Dl([p({type:String})],mi.prototype,"label",void 0);Dl([T()],mi.prototype,"_options",void 0);var gp=q`
|
|
9514
9522
|
display: inline-flex;
|
|
9515
9523
|
align-items: center;
|
|
9516
9524
|
cursor: pointer;
|
|
9517
9525
|
padding: 0.5rem 1rem;
|
|
9518
9526
|
border-radius: 0.25rem;
|
|
9519
9527
|
user-select: none;
|
|
9520
|
-
`,
|
|
9528
|
+
`,nn=q`
|
|
9521
9529
|
background-color: lightgray;
|
|
9522
|
-
${
|
|
9523
|
-
`,
|
|
9530
|
+
${gp};
|
|
9531
|
+
`,on=q`
|
|
9524
9532
|
cursor: not-allowed;
|
|
9525
9533
|
opacity: 0.8;
|
|
9526
|
-
`,
|
|
9527
|
-
${
|
|
9534
|
+
`,L5=q`
|
|
9535
|
+
${gp};
|
|
9528
9536
|
border: 1px solid gray;
|
|
9529
|
-
`;var
|
|
9537
|
+
`;var sn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Pe=class extends C{static{this.styles=q`
|
|
9530
9538
|
:host {
|
|
9531
|
-
${
|
|
9539
|
+
${nn};
|
|
9532
9540
|
}
|
|
9533
9541
|
:host([disabled]) {
|
|
9534
|
-
${
|
|
9542
|
+
${on};
|
|
9535
9543
|
}
|
|
9536
|
-
`}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#
|
|
9544
|
+
`}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#n(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return y` <div @click="${this.#r}">${this.#n()}</div> `}};sn([_({context:me,subscribe:!0})],Pe.prototype,"computedContext",void 0);sn([p({type:Boolean,reflect:!0})],Pe.prototype,"shown",void 0);sn([p({type:Boolean,reflect:!0})],Pe.prototype,"disabled",void 0);sn([p({type:String})],Pe.prototype,"showCandidateCorrectionText",void 0);sn([p({type:String})],Pe.prototype,"hideCandidateCorrectionText",void 0);sn([p({type:String})],Pe.prototype,"noCorrectResponseText",void 0);var an=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},De=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=q`
|
|
9537
9545
|
:host {
|
|
9538
|
-
${
|
|
9546
|
+
${nn};
|
|
9539
9547
|
}
|
|
9540
9548
|
:host([disabled]) {
|
|
9541
|
-
${
|
|
9549
|
+
${on};
|
|
9542
9550
|
}
|
|
9543
|
-
`}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#
|
|
9551
|
+
`}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#n(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return y` <div @click="${this.#r}">${this.#n()}</div> `}};an([_({context:me,subscribe:!0})],De.prototype,"computedContext",void 0);an([p({type:Boolean,reflect:!0})],De.prototype,"shown",void 0);an([p({type:Boolean,reflect:!0})],De.prototype,"disabled",void 0);an([p({type:String})],De.prototype,"showCorrectText",void 0);an([p({type:String})],De.prototype,"hideCorrectText",void 0);an([p({type:String})],De.prototype,"noCorrectResponseText",void 0);var ln=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ne=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified"}static{this.styles=q`
|
|
9544
9552
|
:host {
|
|
9545
|
-
${
|
|
9553
|
+
${nn};
|
|
9546
9554
|
}
|
|
9547
9555
|
:host([disabled]) {
|
|
9548
|
-
${
|
|
9556
|
+
${on};
|
|
9549
9557
|
}
|
|
9550
|
-
`}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(
|
|
9558
|
+
`}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(n=>n.items)).find(r=>r.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let r=!!e?.variables?.some(i=>i.correctResponse),n=!!e?.variables?.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!n}else this.disabled=!0}#e(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return y` <div @click="${this.#e}">${this.#r()}</div> `}};ln([_({context:z,subscribe:!0})],Ne.prototype,"computedContext",void 0);ln([p({type:Boolean,reflect:!0})],Ne.prototype,"shown",void 0);ln([p({type:Boolean,reflect:!0})],Ne.prototype,"disabled",void 0);ln([p({type:String})],Ne.prototype,"showCorrectText",void 0);ln([p({type:String})],Ne.prototype,"hideCorrectText",void 0);ln([p({type:String})],Ne.prototype,"noCorrectResponseText",void 0);var Qt=o=>{class t extends Y(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var $l=class extends Qt(ar){};var Ll=class extends pr(lr){};var Bm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ia=class extends qt(X){static{this.styles=[X.styles,it,q`
|
|
9551
9559
|
/*
|
|
9552
9560
|
* Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
|
|
9553
9561
|
* is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
|
|
@@ -9608,9 +9616,9 @@ CES.load();
|
|
|
9608
9616
|
bottom: var(--qti-correction-inset);
|
|
9609
9617
|
}
|
|
9610
9618
|
}
|
|
9611
|
-
`]}render(){return
|
|
9619
|
+
`]}render(){return y`${this.renderPrompt()}${this.renderTextarea()}
|
|
9612
9620
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9613
|
-
${this.renderValidationMessage()}`}};
|
|
9621
|
+
${this.renderValidationMessage()}`}};Bm([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],ia.prototype,"candidateCorrection",void 0);var oa=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,n]=e.split(" ");return{source:r,target:n}}):[];var Vl=class extends Qt(Fr){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=oa(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let n=r.getAttribute("identifier"),i=r.drags;for(let s of i)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===n)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var zl=class extends Y(Mt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#t,t=>t,t=>Cn`
|
|
9614
9622
|
<line
|
|
9615
9623
|
part="correct-line"
|
|
9616
9624
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -9621,7 +9629,7 @@ CES.load();
|
|
|
9621
9629
|
stroke-width="3"
|
|
9622
9630
|
stroke-dasharray="5,5"
|
|
9623
9631
|
/>
|
|
9624
|
-
`)}};var
|
|
9632
|
+
`)}};var jl=class extends Qt(Br){};var Fl=class extends Y(Oe){resolvePinColor(t){let e=t;return e.matches(":state(candidate-incorrect)")?"var(--qti-incorrect)":e.matches(":state(candidate-correct)")?"var(--qti-correct)":e.matches(":state(correct-response)")?"var(--qti-answer-border)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements){let i=r.indexOf(n.identifier);n.orderCorrect=t&&i>=0?i+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements)n.candidateCorrection=null,t&&n.order!=null&&(n.candidateCorrection=r[n.order-1]===n.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var Bl=class extends pr(Ur){};var Ul=class extends pr(Hr){};var Hl=class extends Y(et){static get styles(){return[et.styles,it,q`
|
|
9625
9633
|
/*
|
|
9626
9634
|
* Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
|
|
9627
9635
|
* badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
|
|
@@ -9637,23 +9645,23 @@ CES.load();
|
|
|
9637
9645
|
[part~='correction'] {
|
|
9638
9646
|
margin-inline-end: var(--qti-correction-inset);
|
|
9639
9647
|
}
|
|
9640
|
-
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return
|
|
9648
|
+
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return y`
|
|
9641
9649
|
${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
|
|
9642
9650
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9643
|
-
`}};var
|
|
9651
|
+
`}};var Wl=class extends Qt(le){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=oa(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let n=r.getAttribute("identifier"),i=r.drags;for(let s of i)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${n}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function Um(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let i=0;i<o.length;i++)for(let s=0;s<i;s++)o[s]<o[i]&&t[s]+1>t[i]&&(t[i]=t[s]+1,e[i]=s);let r=0;for(let i=1;i<o.length;i++)t[i]>t[r]&&(r=i);let n=new Set;for(let i=r;i!==-1;i=e[i])n.add(i);return n}function bp(o,t){let e=new Map(t.map((a,c)=>[a,c])),r=o.filter(a=>e.has(a)),n=r.map(a=>e.get(a)),i=Um(n),s=new Set;return i.forEach(a=>s.add(r[a])),s}var Ql=class extends Qt(Me){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(l=>this.chipsIn(l));for(let l of r)l.candidateCorrection=null;if(!t)return;let n=this.correctResponse,s=(n?Array.isArray(n)?n:[n]:[]).map((l,d)=>{let[h,f]=l.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(l=>l.identifier).sort((l,d)=>l.dropIndex-d.dropIndex).map(l=>l.identifier);if(s.length===0)return;let a=r.map(l=>({choice:l,identifier:l.getAttribute("identifier")})).filter(l=>!!l.identifier),c=bp(a.map(l=>l.identifier),s);for(let{choice:l,identifier:d}of a)l.candidateCorrection=c.has(d)?"correct":"incorrect"}};var Gl=class extends Y(W){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let n=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${n}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let i=document.createElement("div");i.id=n,i.className="pci-correct-response-container",Object.assign(i.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),i.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let c=this.responseIdentifier;a.responseIdentifier=`${c}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let l=this.correctResponse,d=e?.cardinality??(Array.isArray(l)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:l}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(l,d,h);a.sendMessageToIframe("setBoundTo",{[c]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",i.append(a),this.after(i)}};var Xl=class extends Y(dt){#t=[];#e=[];static{this.styles=[dt.styles,q`
|
|
9644
9652
|
[part~='correct'] {
|
|
9645
9653
|
--qti-select-point-marker-color: var(--qti-correct);
|
|
9646
9654
|
}
|
|
9647
9655
|
[part~='incorrect'] {
|
|
9648
9656
|
--qti-select-point-marker-color: var(--qti-incorrect);
|
|
9649
9657
|
}
|
|
9650
|
-
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,
|
|
9651
|
-
style=${
|
|
9658
|
+
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,n=this.responseVariable?.baseType,i=this.correctResponse;for(let s of this.responsePoints){let a=r.some(c=>G.isPointInArea(`${s.x} ${s.y}`,`${c.shape},${c.coords}`,n));!r.length&&i&&(a=(Array.isArray(i)?i:[i]).some(l=>{let[d,h]=l.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let n=this.#t;this.#t=[],this.requestUpdate("correctAreas",n);return}let e=this._effectiveAreaEntries;if(!e.length){let n=this.correctResponse,i=n?Array.isArray(n)?n:[n]:[];if(i.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=i.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let r=this.#t;this.#t=e.map(n=>({shape:n.shape,coords:n.coords})),this.requestUpdate("correctAreas",r)}pointPart(t,e){let r=this.#e[e];return r===void 0?"point":`point ${r?"correct":"incorrect"}`}renderSupplementalLayer(){return H(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>y`<div
|
|
9659
|
+
style=${rs({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
|
|
9652
9660
|
data-correction-area
|
|
9653
9661
|
data-coord=${t.coords}
|
|
9654
9662
|
data-shape=${t.shape}
|
|
9655
9663
|
alt=${`correct-response-${e+1}`}
|
|
9656
|
-
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var
|
|
9664
|
+
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Yl=class extends Y(xt){#t=null;static{this.styles=[xt.styles,q`
|
|
9657
9665
|
[part='knob-correct'] {
|
|
9658
9666
|
background-color: var(--qti-correct-light);
|
|
9659
9667
|
border: 2px solid var(--qti-correct);
|
|
@@ -9666,9 +9674,9 @@ CES.load();
|
|
|
9666
9674
|
border-radius: 9999px;
|
|
9667
9675
|
left: var(--value-percentage-correct);
|
|
9668
9676
|
}
|
|
9669
|
-
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,
|
|
9677
|
+
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,n=t&&r?parseFloat(r):NaN,i=this.#t;if(this.#t=Number.isFinite(n)?n:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",i)}renderRailSupplement(){return this.#t===null?M:y`<div id="knob-correct" part="knob-correct">
|
|
9670
9678
|
<div id="value" part="value">${this.#t}</div>
|
|
9671
|
-
</div>`}};var
|
|
9679
|
+
</div>`}};var Kl=class extends Y(lt){static{this.styles=[lt.styles,it,q`
|
|
9672
9680
|
/*
|
|
9673
9681
|
* The trailing inset only — size and leading gap come from the shared sheet.
|
|
9674
9682
|
*
|
|
@@ -9697,11 +9705,11 @@ CES.load();
|
|
|
9697
9705
|
background-color: var(--qti-bg);
|
|
9698
9706
|
white-space: nowrap;
|
|
9699
9707
|
}
|
|
9700
|
-
`]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return
|
|
9708
|
+
`]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return K.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((r,n)=>Math.max(n.mappedValue,r),0);for(let r of t.mapping.mapEntries){let n=r.mapKey,i=t.value;if(r.caseSensitive||(n=n.toLowerCase(),i=i.toLowerCase()),n===i)return r.mappedValue===e?K.Correct:r.mappedValue<=(t.mapping.defaultValue||0)?K.Incorrect:K.PartiallyCorrect}}return t.correctResponse===t.value?K.Correct:K.Incorrect}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}render(){return y`
|
|
9701
9709
|
${this.renderAnswer()} ${this.renderInput()}
|
|
9702
9710
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9703
9711
|
${this.renderValidationMessage()}
|
|
9704
|
-
`}};export{
|
|
9712
|
+
`}};export{Y as CandidateCorrectionMixin,pr as ChoiceCorrectionMixin,Tl as CorrectResponseMixin,K as Correctness,Ta as CustomStateSetShim,Ra as INITIAL_SESSION_CONTEXT,Oa as INITIAL_TEST_CONTEXT,D as Interaction,Da as IsNullOrUndefined,At as ItemContainer,mi as ItemCorrectResponseMode,Hn as ItemPrintVariables,Pe as ItemShowCandidateCorrection,De as ItemShowCorrectResponse,Rd as ItemViewMixin,ls as QtiAnd,Qr as QtiAnyN,nt as QtiAssessmentItem,hp as QtiAssessmentItemCorrection,$t as QtiAssessmentItemRef,ft as QtiAssessmentSection,Or as QtiAssessmentStimulusRef,Xa as QtiAssessmentStimulusRefConnectedEvent,Ue as QtiAssessmentTest,Lr as QtiAssociableHotspot,ar as QtiAssociateInteraction,$l as QtiAssociateInteractionCorrection,ei as QtiBaseValue,lr as QtiChoiceInteraction,Ll as QtiChoiceInteractionCorrection,Gi as QtiCompanionMaterialsInfo,jt as QtiConditionExpression,cs as QtiContainerSize,ds as QtiContains,Rn as QtiContentBody,Mr as QtiContextDeclaration,hs as QtiCorrect,se as QtiCustomInteraction,On as QtiCustomOperator,dr as QtiDefault,ps as QtiDelete,us as QtiDivide,ms as QtiDurationGte,fs as QtiDurationLt,Te as QtiEndAttemptInteraction,Gr as QtiEqual,ri as QtiEqualRounded,gs as QtiExitResponse,qr as QtiExitResponseSignal,bs as QtiExitTest,Cr as QtiExitTestSignal,S as QtiExpression,X as QtiExtendedTextInteraction,ia as QtiExtendedTextInteractionCorrection,st as QtiFeedback,Xi as QtiFeedbackBlock,Yi as QtiFeedbackInline,ys as QtiFieldValue,er as QtiGap,Wn as QtiGapImg,Fr as QtiGapMatchInteraction,Vl as QtiGapMatchInteractionCorrection,Ce as QtiGapText,Rl as QtiGapTextCorrection,vs as QtiGcd,Mt as QtiGraphicAssociateInteraction,zl as QtiGraphicAssociateInteractionCorrection,Br as QtiGraphicGapMatchInteraction,jl as QtiGraphicGapMatchInteractionCorrection,Oe as QtiGraphicOrderInteraction,Fl as QtiGraphicOrderInteractionCorrection,ws as QtiGt,xs as QtiGte,nr as QtiHotspotChoice,na as QtiHotspotChoiceCorrection,Ur as QtiHotspotInteraction,Bl as QtiHotspotInteractionCorrection,ir as QtiHottext,Ol as QtiHottextCorrection,Hr as QtiHottextInteraction,Ul as QtiHottextInteractionCorrection,ni as QtiIndex,Qn as QtiInlineChoice,et as QtiInlineChoiceInteraction,Hl as QtiInlineChoiceInteractionCorrection,Xr as QtiInside,qs as QtiIntegerDivide,Cs as QtiIntegerModulus,Es as QtiIntegerToFloat,ks as QtiIsNull,ie as QtiItem,Ki as QtiItemBody,pp as QtiItemCorrection,Et as QtiItemSessionControl,Ss as QtiLcm,Yr as QtiLookupOutcomeValue,As as QtiLt,Is as QtiLte,oi as QtiMapResponse,ii as QtiMapResponsePoint,_s as QtiMatch,le as QtiMatchInteraction,Wl as QtiMatchInteractionCorrection,si as QtiMathConstant,ai as QtiMathOperator,Ts as QtiMax,Go as QtiMediaInteraction,Rs as QtiMember,Os as QtiMin,Pr as QtiModalFeedback,Ms as QtiMultiple,Ps as QtiNot,Ds as QtiNull,zi as QtiNumberSelected,Ns as QtiOr,Me as QtiOrderInteraction,Ql as QtiOrderInteractionCorrection,$s as QtiOrdered,Vs as QtiOutcomeCondition,te as QtiOutcomeDeclaration,js as QtiOutcomeElse,zs as QtiOutcomeElseIf,tn as QtiOutcomeIf,ji as QtiOutcomeProcessing,Ba as QtiOutcomeProcessingProcessor,li as QtiPatternMatch,W as QtiPortableCustomInteraction,Gl as QtiPortableCustomInteractionCorrection,Zo as QtiPositionObjectInteraction,ts as QtiPositionObjectStage,Fs as QtiPower,ht as QtiPrintedVariable,Bs as QtiProduct,xo as QtiPrompt,Us as QtiRandom,hr as QtiRandomInteger,di as QtiRepeat,Hs as QtiResponseCondition,ve as QtiResponseDeclaration,Qs as QtiResponseElse,Ws as QtiResponseElseIf,en as QtiResponseIf,Zi as QtiResponseProcessing,Gs as QtiResponseProcessingFragment,Xs as QtiRound,rn as QtiRoundTo,ee as QtiRubricBlock,Fc as QtiRuleElement,dt as QtiSelectPointInteraction,Xl as QtiSelectPointInteractionCorrection,Ys as QtiSetCorrectResponse,Sl as QtiSetCorrectResponseRule,Ks as QtiSetOutcomeValue,Al as QtiSetOutcomeValueRule,Js as QtiSetTemplateValue,Il as QtiSetTemplateValueRule,It as QtiSimpleAssociableChoice,Ml as QtiSimpleAssociableChoiceCorrection,_t as QtiSimpleChoice,Pl as QtiSimpleChoiceCorrection,xt as QtiSliderInteraction,Yl as QtiSliderInteractionCorrection,hi as QtiStatsOperator,pi as QtiStringMatch,to as QtiStylesheet,ui as QtiSubstring,Zs as QtiSubtract,ta as QtiSum,_l as QtiSumExpression,eo as QtiTemplateConstraint,re as QtiTemplateDeclaration,ro as QtiTemplateProcessing,We as QtiTest,mp as QtiTestCorrection,no as QtiTestFeedback,we as QtiTestPart,Nn as QtiTestVariables,Ya as QtiTestVariablesExpression,lt as QtiTextEntryInteraction,Kl as QtiTextEntryInteractionCorrection,ea as QtiTruncate,ss as QtiUploadInteraction,ra as QtiVariable,wr as QtiVariableDeclaration,G as ScoringHelper,Nr as TestCheckItem,fp as TestCheckItemCorrection,St as TestContainer,Ge as TestEndAttempt,$n as TestItemLink,Xe as TestItemToSpeech,at as TestNavigation,up as TestNavigationCorrection,Ye as TestNext,Ln as TestPagingButtonsStamp,Ke as TestPrev,Vn as TestPrintContext,zn as TestPrintVariables,Je as TestScoringButtons,$r as TestScoringFeedback,jn as TestSectionButtonsStamp,Fn as TestSectionLink,Ne as TestShowCorrectResponse,Ze as TestStamp,yo as TestTtsNext,mo as TestTtsPause,uo as TestTtsPlay,bo as TestTtsPrev,fo as TestTtsResume,go as TestTtsStop,Ht as TestView,Un as TestViewToggle,kb as asSeed,O as boxSizing,Zp as classifyCustomStateSupport,z as computedContext,me as computedItemContext,ut as configContext,Ct as convertNumberToUniversalFormat,it as correctionPart,ty as decimalSeparator,zt as dropRegion,Bc as getCustomOperator,wN as getItemByUri,vN as getManifestInfo,Vc as installCustomStateSetFallback,vr as interactionContext,eu as isSeed,j as itemContext,zc as itemContextVariables,cy as iterResponseValues,dy as parsePair,py as parsePoint,Na as parseResponseAttribute,Cm as qtiAndMixin,mt as qtiContext,ep as qtiInteractionElements,zm as qtiSubtractMixin,Bt as qtiTransformItem,ld as qtiTransformManifest,Rr as qtiTransformTest,by as registerCustomOperator,$i as removeDoubleSlashes,Ft as responseAttributeConverter,hy as serializePair,uy as serializePoint,$a as serializeResponseAttribute,Vt as sessionContext,ot as testContext,Id as ttsContext,yy as unregisterCustomOperator,U as validationMessage};
|
|
9705
9713
|
/*! Bundled license information:
|
|
9706
9714
|
|
|
9707
9715
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
@@ -9773,6 +9781,16 @@ lit-html/node/directives/private-async-helpers.js:
|
|
|
9773
9781
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9774
9782
|
*)
|
|
9775
9783
|
|
|
9784
|
+
@heximal/expressions/lib/constants.js:
|
|
9785
|
+
@heximal/expressions/lib/tokenizer.js:
|
|
9786
|
+
@heximal/expressions/lib/parser.js:
|
|
9787
|
+
@heximal/expressions/lib/ast_factory.js:
|
|
9788
|
+
@heximal/expressions/lib/eval.js:
|
|
9789
|
+
(*
|
|
9790
|
+
* @license
|
|
9791
|
+
* Portions Copyright (c) 2013, the Dart project authors.
|
|
9792
|
+
*)
|
|
9793
|
+
|
|
9776
9794
|
lit-html/node/directive-helpers.js:
|
|
9777
9795
|
lit-html/node/directives/ref.js:
|
|
9778
9796
|
(**
|
|
@@ -9788,14 +9806,4 @@ lit-html/node/directives/style-map.js:
|
|
|
9788
9806
|
* Copyright 2018 Google LLC
|
|
9789
9807
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9790
9808
|
*)
|
|
9791
|
-
|
|
9792
|
-
@heximal/expressions/lib/constants.js:
|
|
9793
|
-
@heximal/expressions/lib/tokenizer.js:
|
|
9794
|
-
@heximal/expressions/lib/parser.js:
|
|
9795
|
-
@heximal/expressions/lib/ast_factory.js:
|
|
9796
|
-
@heximal/expressions/lib/eval.js:
|
|
9797
|
-
(*
|
|
9798
|
-
* @license
|
|
9799
|
-
* Portions Copyright (c) 2013, the Dart project authors.
|
|
9800
|
-
*)
|
|
9801
9809
|
*/
|