@citolab/qti-components 10.0.0-next.14 → 10.0.0-next.15
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 +347 -244
- package/dist/base.d.ts +3 -3
- package/dist/base.js +1 -1
- package/dist/{chunk-NYNL5HSR.js → chunk-32PI7KWX.js} +2 -2
- package/dist/{chunk-TU34FFWF.js → chunk-5AJZGRWI.js} +2 -2
- package/dist/{chunk-LFVPS7KB.js → chunk-DAOLVUTR.js} +2 -2
- package/dist/{chunk-LEF7AAYZ.js → chunk-F553IZPL.js} +2 -2
- package/dist/{chunk-MP2SUN7J.js → chunk-G2EIC7H2.js} +30 -23
- package/dist/chunk-G2EIC7H2.js.map +1 -0
- package/dist/{chunk-S5GLISQA.js → chunk-HT3LSWXL.js} +2 -2
- package/dist/{chunk-O2ENNGKV.js → chunk-IM5AKPIJ.js} +32 -5
- package/dist/chunk-IM5AKPIJ.js.map +1 -0
- package/dist/{chunk-HGKLF7SP.js → chunk-IWNRQVNW.js} +2 -2
- package/dist/{chunk-TLAVOBEM.js → chunk-LORYM4U2.js} +120 -1
- package/dist/chunk-LORYM4U2.js.map +1 -0
- package/dist/{chunk-6XRNX574.js → chunk-MIQZBDTB.js} +5 -5
- package/dist/{chunk-C7SYDLMG.js → chunk-QT7WQXCS.js} +42 -4
- package/dist/chunk-QT7WQXCS.js.map +1 -0
- package/dist/chunk-RNLSNH4N.js +7 -0
- package/dist/chunk-RNLSNH4N.js.map +1 -0
- package/dist/{chunk-CCI3QMQA.js → chunk-URYYGVTA.js} +6 -6
- package/dist/{chunk-BZPMN57E.js → chunk-WIUPAUJV.js} +2 -2
- package/dist/{chunk-SWNFCQ4G.js → chunk-XY5DHYIH.js} +4 -4
- package/dist/{config.context.d-BniMHSBB.d.ts → config.context.d-CCqlJXpE.d.ts} +2 -1
- package/dist/corrections.d.ts +7 -7
- package/dist/corrections.js +9 -9
- package/dist/elements.d.ts +30 -2
- package/dist/elements.js +4 -4
- package/dist/index.d.ts +8 -8
- package/dist/index.js +15 -15
- package/dist/interactions.d.ts +4 -4
- package/dist/interactions.js +3 -3
- package/dist/item.css +99 -10
- package/dist/item.d.ts +3 -3
- package/dist/item.js +5 -5
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +2 -2
- package/dist/processing.js +3 -3
- package/dist/qti-components-jsx.d.ts +46 -18
- package/dist/{qti-feedback.d-DbzPSJuK.d.ts → qti-feedback.d-GAqMqAt6.d.ts} +7 -0
- package/dist/{qti-item.d-BqWYBdV2.d.ts → qti-item.d-pFcNk0th.d.ts} +1 -1
- package/dist/{qti-test.d-C0I1BIdH.d.ts → qti-test.d-BjhVQnQy.d.ts} +2 -2
- package/dist/{qti-text-entry-interaction.d-V4sWE9TO.d.ts → qti-text-entry-interaction.d-DECzpIzi.d.ts} +19 -9
- package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-Bb9vnLzP.d.ts} +1 -0
- package/dist/{record.d-C6m0Y4xr.d.ts → record.d-CljDLwRz.d.ts} +1 -1
- package/dist/test.d.ts +5 -5
- package/dist/test.js +6 -6
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-C7SYDLMG.js.map +0 -1
- package/dist/chunk-MP2SUN7J.js.map +0 -1
- package/dist/chunk-O2ENNGKV.js.map +0 -1
- package/dist/chunk-Q4MJCEDE.js +0 -7
- package/dist/chunk-Q4MJCEDE.js.map +0 -1
- package/dist/chunk-TLAVOBEM.js.map +0 -1
- /package/dist/{chunk-NYNL5HSR.js.map → chunk-32PI7KWX.js.map} +0 -0
- /package/dist/{chunk-TU34FFWF.js.map → chunk-5AJZGRWI.js.map} +0 -0
- /package/dist/{chunk-LFVPS7KB.js.map → chunk-DAOLVUTR.js.map} +0 -0
- /package/dist/{chunk-LEF7AAYZ.js.map → chunk-F553IZPL.js.map} +0 -0
- /package/dist/{chunk-S5GLISQA.js.map → chunk-HT3LSWXL.js.map} +0 -0
- /package/dist/{chunk-HGKLF7SP.js.map → chunk-IWNRQVNW.js.map} +0 -0
- /package/dist/{chunk-6XRNX574.js.map → chunk-MIQZBDTB.js.map} +0 -0
- /package/dist/{chunk-CCI3QMQA.js.map → chunk-URYYGVTA.js.map} +0 -0
- /package/dist/{chunk-BZPMN57E.js.map → chunk-WIUPAUJV.js.map} +0 -0
- /package/dist/{chunk-SWNFCQ4G.js.map → chunk-XY5DHYIH.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var Lc=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 Ut=function(o,t,e,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(o,e):r?r.value=e:t.set(o,e),e},et=function(o,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(o):n?n.value:t.get(o)},In,$r,Lr,ki,$a,Ci,zr,Ke,Si,qe,Vr,zc;var U={__proto__:null};U.enumerable=!0;Object.freeze(U);var La=(qe=class{constructor(t,e={}){if(In.set(this,!1),$r.set(this,!1),Lr.set(this,!1),ki.set(this,!1),$a.set(this,Date.now()),Ci.set(this,!1),zr.set(this,void 0),Ke.set(this,void 0),Si.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:n,cancelable:r,composed:i}=e;Ut(this,In,!!r,"f"),Ut(this,$r,!!n,"f"),Ut(this,Lr,!!i,"f"),Ut(this,zr,`${t}`,"f"),Ut(this,Ke,null,"f"),Ut(this,Si,!1,"f")}initEvent(t,e,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Ut(this,ki,!0,"f")}get target(){return et(this,Ke,"f")}get currentTarget(){return et(this,Ke,"f")}get srcElement(){return et(this,Ke,"f")}get type(){return et(this,zr,"f")}get cancelable(){return et(this,In,"f")}get defaultPrevented(){return et(this,In,"f")&&et(this,ki,"f")}get timeStamp(){return et(this,$a,"f")}composedPath(){return et(this,Si,"f")?[et(this,Ke,"f")]:[]}get returnValue(){return!et(this,In,"f")||!et(this,ki,"f")}get bubbles(){return et(this,$r,"f")}get composed(){return et(this,Lr,"f")}get eventPhase(){return et(this,Si,"f")?qe.AT_TARGET:qe.NONE}get cancelBubble(){return et(this,Ci,"f")}set cancelBubble(t){t&&Ut(this,Ci,!0,"f")}stopPropagation(){Ut(this,Ci,!0,"f")}get isTrusted(){return!1}},In=new WeakMap,$r=new WeakMap,Lr=new WeakMap,ki=new WeakMap,$a=new WeakMap,Ci=new WeakMap,zr=new WeakMap,Ke=new WeakMap,Si=new WeakMap,qe.NONE=0,qe.CAPTURING_PHASE=1,qe.AT_TARGET=2,qe.BUBBLING_PHASE=3,qe);Object.defineProperties(La.prototype,{initEvent:U,stopImmediatePropagation:U,preventDefault:U,target:U,currentTarget:U,srcElement:U,type:U,cancelable:U,defaultPrevented:U,timeStamp:U,composedPath:U,returnValue:U,bubbles:U,composed:U,eventPhase:U,cancelBubble:U,stopPropagation:U,isTrusted:U});var Vc=(zc=class extends La{constructor(t,e={}){super(t,e),Vr.set(this,void 0),Ut(this,Vr,e?.detail??null,"f")}initCustomEvent(t,e,n,r){throw new Error("Method not implemented.")}get detail(){return et(this,Vr,"f")}},Vr=new WeakMap,zc);Object.defineProperties(Vc.prototype,{detail:U});var re=La,za=Vc;var at;var Tg=(at=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}},at.STYLE_RULE=1,at.CHARSET_RULE=2,at.IMPORT_RULE=3,at.MEDIA_RULE=4,at.FONT_FACE_RULE=5,at.PAGE_RULE=6,at.NAMESPACE_RULE=10,at.KEYFRAMES_RULE=7,at.KEYFRAME_RULE=8,at.SUPPORTS_RULE=12,at.COUNTER_STYLE_RULE=11,at.FONT_FEATURE_VALUES_RULE=14,at.MARGIN_RULE=9,at);globalThis.Event??=re;globalThis.CustomEvent??=za;var ja=Symbol(),jc=o=>typeof o=="boolean"?o:o?.capture??!1,oe={__proto__:null};oe.enumerable=!0;Object.freeze(oe);var jr=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,n){if(e==null)return;let r=jc(n)?this.__captureEventListeners:this.__eventListeners,i=r.get(t);if(i===void 0)i=new Map,r.set(t,i);else if(i.has(e))return;let s=typeof n=="object"&&n?n:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,n)),i.set(e,s??{})}removeEventListener(t,e,n){if(e==null)return;let r=jc(n)?this.__captureEventListeners:this.__eventListeners,i=r.get(t);i!==void 0&&(i.delete(e),i.size||r.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let n=!1,r=!1,i=re.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...oe},srcElement:{get(){return t.target},...oe},currentTarget:{get(){return l},...oe},eventPhase:{get(){return i},...oe},composedPath:{value:()=>e,...oe},stopPropagation:{value:()=>{n=!0,c.call(t)},...oe},stopImmediatePropagation:{value:()=>{r=!0,d.call(t)},...oe}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(l=null,i=re.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,i=u===t.target?re.AT_TARGET:re.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,w]of g)if(h(b,w,g),r)return f()}if(n)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),l=u,i=u===t.target?re.AT_TARGET:re.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,w]of g)if(h(b,w,g),r)return f()}if(n)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Uc,_u]}};var Fc=new WeakMap,Ei=o=>{let t=Fc.get(o);return t===void 0&&Fc.set(o,t=new Map),t},Ai=class extends jr{getRootNode(t){return t?.composed?Va:this.__host?.__shadowRoot??Va}};var Bc=class extends Ai{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Uc=new Bc,Va=Uc;var Hc=class extends Ai{constructor(t){if(super(),t!==ja)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Fr,customElements:Ba,document:Va,Document:Bc,Element:Wc,EventTarget:jr,HTMLElement:Qc,Node:Ai,ShadowRoot:Gc,window:this,Window:Hc})}};var Wc=class extends Ai{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ei(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){Ei(this).set(t,String(e))}removeAttribute(t){Ei(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 Ei(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Gc(ja,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 Lc(this);return this.__internals=t,t}getAttribute(t){return Ei(this).get(t)??null}};var Qc=class extends Wc{},Fa=Qc;var Gc=class extends Ai{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 Fa,"localName",{get(){return"lit-server-root"}});function Tu(){let o,t;return{promise:new Promise((n,r)=>{o=n,t=r}),resolve:o,reject:t}}var Fr=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
|
|
3
|
-
\f\r]`,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),rd=/'/g,od=/"/g,ld=/^(?:script|style|textarea|title)$/i,Ya=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Ya(1),$i=Ya(2),ab=Ya(3),rt=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),sd=new WeakMap,tn=en.createTreeWalker(en,129);function cd(o,t){if(!Xa(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ed!==void 0?ed.createHTML(t):t}var dd=(o,t)=>{let e=o.length-1,n=[],r,i=t===2?"<svg>":t===3?"<math>":"",s=Pi;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===Pi?d[1]==="!--"?s=nd:d[1]!==void 0?s=id:d[2]!==void 0?(ld.test(d[2])&&(r=RegExp("</"+d[2],"g")),s=Ze):d[3]!==void 0&&(s=Ze):s===Ze?d[0]===">"?(s=r??Pi,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ze:d[3]==='"'?od:rd):s===od||s===rd?s=Ze:s===nd||s===id?s=Pi:(s=Ze,r=void 0);let m=s===Ze&&o[a+1].startsWith("/>")?" ":"";i+=s===Pi?l+zu:h>=0?(n.push(c),l.slice(0,h)+Qa+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[cd(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},Ni=class o{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,s=0,a=t.length-1,l=this.parts,[c,d]=dd(t,e);if(this.el=o.createElement(c,n),tn.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=tn.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(Qa)){let f=d[s++],m=r.getAttribute(h).split(ae),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:y[2],strings:m,ctor:y[1]==="."?Qr:y[1]==="?"?Gr:y[1]==="@"?Xr:rn}),r.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:i}),r.removeAttribute(h));if(ld.test(r.tagName)){let h=r.textContent.split(ae),f=h.length-1;if(f>0){r.textContent=Hr?Hr.emptyScript:"";for(let m=0;m<f;m++)r.append(h[m],Mi()),tn.nextNode(),l.push({type:2,index:++i});r.append(h[f],Mi())}}}else if(r.nodeType===8)if(r.data===Ga)l.push({type:2,index:i});else{let h=-1;for(;(h=r.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:i}),h+=ae.length-1}i++}}static createElement(t,e){let n=en.createElement("template");return n.innerHTML=t,n}};function nn(o,t,e=o,n){if(t===rt)return t;let r=n!==void 0?e._$Co?.[n]:e._$Cl,i=Di(t)?void 0:t._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),i===void 0?r=void 0:(r=new i(o),r._$AT(o,e,n)),n!==void 0?(e._$Co??=[])[n]=r:e._$Cl=r),r!==void 0&&(t=nn(o,r._$AS(o,t.values),r,n)),t}var Wr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:n}=this._$AD,r=(t?.creationScope??en).importNode(e,!0);tn.currentNode=r;let i=tn.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new _n(i,i.nextSibling,this,t):l.type===1?c=new l.ctor(i,l.name,l.strings,this,t):l.type===6&&(c=new Yr(i,this,t)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=tn.nextNode(),s++)}return tn.currentNode=en,r}p(t){let e=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}},_n=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=nn(this,t,e),Di(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==rt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ad(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&&Di(this._$AH)?this._$AA.nextSibling.data=t:this.T(en.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Ni.createElement(cd(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{let i=new Wr(r,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=sd.get(t.strings);return e===void 0&&sd.set(t.strings,e=new Ni(t)),e}k(t){Xa(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,n,r=0;for(let i of t)r===e.length?e.push(n=new o(this.O(Mi()),this.O(Mi()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let n=td(t).nextSibling;td(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},rn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,r,i){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=P}_$AI(t,e=this,n,r){let i=this.strings,s=!1;if(i===void 0)t=nn(this,t,e,0),s=!Di(t)||t!==this._$AH&&t!==rt,s&&(this._$AH=t);else{let a=t,l,c;for(t=i[0],l=0;l<i.length-1;l++)c=nn(this,a[n+l],e,l),c===rt&&(c=this._$AH[l]),s||=!Di(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!r&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Qr=class extends rn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Gr=class extends rn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Xr=class extends rn{constructor(t,e,n,r,i){super(t,e,n,r,i),this.type=5}_$AI(t,e=this){if((t=nn(this,t,e,0)??P)===rt)return;let n=this._$AH,r=t===P&&n!==P||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==P&&(n===P||r);r&&this.element.removeEventListener(this.name,this,n),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)}},Yr=class{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){nn(this,t)}},nt={M:Qa,P:ae,A:Ga,C:1,L:dd,R:Wr,D:ad,V:nn,I:_n,H:rn,N:Gr,U:Xr,B:Qr,F:Yr},Vu=Jr.litHtmlPolyfillSupport;Vu?.(Ni,_n),(Jr.litHtmlVersions??=[]).push("3.3.3");var Ja=(o,t,e)=>{let n=e?.renderBefore??t,r=n._$litPart$;if(r===void 0){let i=e?.renderBefore??null;n._$litPart$=r=new _n(t.insertBefore(Mi(),i),i,void 0,e??{})}return r._$AI(o),r};var Ka=globalThis,k=class extends se{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=Ja(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return rt}};k._$litElement$=!0,k.finalized=!0,Ka.litElementHydrateSupport?.({LitElement:k});var ju=Ka.litElementPolyfillSupport;ju?.({LitElement:k});(Ka.litElementVersions??=[]).push("4.2.2");var Fu={attribute:!0,type:String,converter:Ri,reflect:!1,hasChanged:Ur},Bu=(o=Fu,t,e)=>{let{kind:n,metadata:r}=e,i=globalThis.litPropertyMetadata.get(r);if(i===void 0&&globalThis.litPropertyMetadata.set(r,i=new Map),n==="setter"&&((o=Object.create(o)).wrapped=!0),i.set(e.name,o),n==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(n==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+n)};function p(o){return(t,e)=>typeof e=="object"?Bu(o,t,e):((n,r,i)=>{let s=r.hasOwnProperty(i);return r.constructor.createProperty(i,n),s?Object.getOwnPropertyDescriptor(r,i):void 0})(o,t,e)}function _(o){return p({...o,state:!0,attribute:!1})}var ke=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Rn(o,t){return(e,n,r)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof n=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return ke(e,n,{get(){let l=s.call(this);return l===void 0&&(l=i(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return ke(e,n,{get(){return i(this)}})}}function hd(o){return(t,e)=>{let{slot:n,selector:r}=o??{},i="slot"+(n?`[name=${n}]`:":not([name])");return ke(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return r===void 0?a:a.filter(l=>l.matches(r))}})}}var le=class extends Event{constructor(t,e,n,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=n,this.subscribe=r??!1}};var ct=class{constructor(t,e,n,r){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=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new le(this.context,this.host,this.t,this.subscribe))}};var Kr=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let n=e||!Object.is(t,this.o);this.o=t,n&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:n}]of this.subscriptions)e(this.o,n)},t!==void 0&&(this.value=t)}addCallback(t,e,n){if(!n)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:r}=this.subscriptions.get(t);t(this.value,r)}clearCallbacks(){this.subscriptions.clear()}};var Za=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Ht=class extends Kr{constructor(t,e,n){super(e.context!==void 0?e.initialValue:n),this.onContextRequest=r=>{if(r.context!==this.context)return;let i=r.contextTarget??r.composedPath()[0];i!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,i,r.subscribe))},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.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 le(this.context,a,s,!0)));r.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 Za(this.context,this.host))}};var Li=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:n}=e;for(let{elementRef:r,callbackRef:i}of n){let s=r.deref(),a=i.deref();s===void 0||a===void 0||s.dispatchEvent(new le(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],n=t.callback,r=this.pendingContextRequests.get(t.context);r===void 0&&this.pendingContextRequests.set(t.context,r={callbacks:new WeakMap,requests:[]});let i=r.callbacks.get(e);i===void 0&&r.callbacks.set(e,i=new WeakSet),i.has(n)||(i.add(n),r.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(n)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function H({context:o}){return(t,e)=>{let n=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(r){return n.get(this).setValue(r),t.set.call(this,r)},init(r){return n.set(this,new Ht(this,{context:o,initialValue:r})),r}};{t.constructor.addInitializer((s=>{n.set(s,new Ht(s,{context:o}))}));let r=Object.getOwnPropertyDescriptor(t,e),i;if(r===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){n.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=r.set;i={...r,set(a){n.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function I({context:o,subscribe:t}){return(e,n)=>{typeof n=="object"?n.addInitializer((function(){new ct(this,{context:o,callback:r=>{e.set.call(this,r)},subscribe:t})})):e.constructor.addInitializer((r=>{new ct(r,{context:o,callback:i=>{r[n]=i},subscribe:t})}))}}var Zr=["this"],pd=["+","-","!"],ud=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],tl={"!":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},to=13;var Uu=["==","!=","<=",">=","||","&&","??","|>"],Hu=["===","!=="],M;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(M||(M={}));var Wt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Wu=o=>o===9||o===10||o===13||o===32,md=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Qu=o=>md(o)||zi(o),Gu=o=>Zr.indexOf(o)!==-1,Xu=o=>o===34||o===39,zi=o=>48<=o&&o<=57,Yu=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,Ju=o=>o===40||o===41||o===91||o===93||o===123||o===125,Ku=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}}),eo=class{#t;#e=-1;#n=0;#i;constructor(t){this.#t=t,this.#r()}nextToken(){for(;Wu(this.#i);)this.#r(!0);if(Xu(this.#i))return this.#a();if(md(this.#i))return this.#c();if(zi(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#f();if(this.#i===58)return this.#d();if(Yu(this.#i))return this.#h();if(Ju(this.#i))return this.#g();if(this.#r(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#r(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#n=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#n,this.#e+t);return t===0&&this.#s(),e}#s(){this.#n=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#r(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#r(),this.#i===void 0))throw new Error(t);this.#r()}let n=Wt(M.STRING,Ku(this.#o()));return this.#r(),n}#c(){do this.#r();while(Qu(this.#i));let t=this.#o(),e=Gu(t)?M.KEYWORD:M.IDENTIFIER;return Wt(e,t)}#p(){do this.#r();while(zi(this.#i));return this.#i===46?this.#l():Wt(M.INTEGER,this.#o())}#l(){return this.#r(),zi(this.#i)?this.#u():(this.#s(),Wt(M.DOT,".",to))}#f(){return this.#r(!0),Wt(M.COMMA,",")}#d(){return this.#r(!0),Wt(M.COLON,":")}#u(){do this.#r();while(zi(this.#i));return Wt(M.DECIMAL,this.#o())}#h(){this.#r();let t=this.#o(2);if(Hu.indexOf(t)!==-1)this.#r(),this.#r();else{if(t=this.#o(1),t==="=>")return this.#r(),Wt(M.ARROW,t);Uu.indexOf(t)!==-1&&this.#r()}return t=this.#o(),Wt(M.OPERATOR,t,tl[t])}#g(){let t=String.fromCharCode(this.#i),e=Wt(M.GROUPER,t,tl[t]);return this.#r(!0),e}};var el=(o,t)=>new Vi(o,t).parse(),Vi=class{#t;#e;#n;#i;#r;constructor(t,e){this.#e=new eo(t),this.#n=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let n=this.#e.nextToken();this.#i=n,this.#t=n?.kind,this.#r=n?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#r!==e)}#s(){if(!this.#i)return this.#n.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(M.GROUPER,"(")){let n=this.#b();t=this.#n.invoke(t,void 0,n)}else if(this._matches(M.GROUPER,"[")){let n=this.#m();t=this.#n.index(t,n)}else if(this._matches(M.DOT)){this.#o();let n=this.#l();t=this.#c(t,n)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=e)t=this.#r==="?"?this.#f(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#n.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let n=e.receiver;return this.#n.invoke(t,n.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(ud.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let n=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#i.precedence>e.precedence;)n=this.#a(n,this.#i.precedence);return this.#n.binary(t,e.value,n)}#l(){if(this._matches(M.OPERATOR)){let t=this.#r;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#x(t);if(this._matches(M.DECIMAL))return this.#C(t)}if(pd.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),to);return this.#n.unary(t,e)}return this.#d()}#f(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let n=this.#s();return this.#n.ternary(t,e,n)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#r;if(t==="this")return this.#o(),this.#n.id(t);throw Zr.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#g();case M.STRING:return this.#w();case M.INTEGER:return this.#x();case M.DECIMAL:return this.#C();case M.GROUPER:return this.#r==="("?this.#y():this.#r==="{"?this.#h():this.#r==="["?this.#u():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#n.list(t)}#h(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#r;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#n.map(t)}#g(){let t=this.#r;if(t==="true")return this.#o(),this.#n.literal(!0);if(t==="false")return this.#o(),this.#n.literal(!1);if(t==="null")return this.#o(),this.#n.literal(null);if(t==="undefined")return this.#o(),this.#n.literal(void 0);let e=this.#v(),n=this.#b();return n?this.#n.invoke(e,void 0,n):e}#v(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#r}`);let t=this.#r;return this.#o(),this.#n.id(t)}#b(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),t}#m(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#y(){let t=this.#b();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),n=t?.map(r=>r.value)??[];return this.#n.arrowFunction(n,e)}else return this.#n.paren(t[0])}#w(){let t=this.#n.literal(this.#r);return this.#o(),t}#x(t=""){let e=this.#n.literal(parseInt(`${t}${this.#r}`,10));return this.#o(),e}#C(t=""){let e=this.#n.literal(parseFloat(`${t}${this.#r}`));return this.#o(),e}};var{hasOwn:fd,fromEntries:Zu}=Object,tm={"+":(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)},em={"+":o=>o,"-":o=>-o,"!":o=>!o},no=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let n=em[t];return{type:"Unary",operator:t,child:e,evaluate(r){return n(this.child.evaluate(r))},getIds(r){return this.child.getIds(r)}}}binary(t,e,n){let r=tm[e];return{type:"Binary",operator:e,left:t,right:n,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,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(i),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(i),l=this.left.argument.evaluate(i)):this.left.type==="ID"&&(a=i,l=this.left.value),a===void 0?void 0:a[l]=s}return r(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(n){return this.receiver.evaluate(n)?.[this.name]},getIds(n){return this.receiver.getIds(n),n}}}invoke(t,e,n){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:n,evaluate(r){let i=this.receiver.evaluate(r),s=this.method?i:r?.this??r,a=this.method?i?.[e]:i,c=(this.arguments??[]).map(d=>d?.evaluate(r));return a?.apply?.(s,c)},getIds(r){return this.receiver.getIds(r),this.arguments?.forEach(i=>i?.getIds(r)),r}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(n){return this.receiver.evaluate(n)?.[this.argument.evaluate(n)]},getIds(n){return this.receiver.getIds(n),n}}}ternary(t,e,n){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:n,evaluate(r){return this.condition.evaluate(r)?this.trueExpr.evaluate(r):this.falseExpr.evaluate(r)},getIds(r){return this.condition.getIds(r),this.trueExpr.getIds(r),this.falseExpr.getIds(r),r}}}map(t){return{type:"Map",entries:t,evaluate(e){let n={};if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&(n[r]=i.evaluate(e))}return n},getIds(e){if(t&&this.entries)for(let n in t){let r=this.entries[n];r&&r.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(n=>n?.evaluate(e))},getIds(e){return this.items?.forEach(n=>n?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(n){let r=this.params,i=this.body;return function(...s){let a=Zu(r.map((c,d)=>[c,s[d]])),l=new Proxy(n??{},{set(c,d,h){return fd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return fd(a,d)?a[d]:c[d]}});return i.evaluate(l)}},getIds(n){return this.body.getIds(n).filter(r=>!this.params.includes(r))}}}};var nl=null,gd={boundAttributeSuffix:nt.M,marker:nt.P,markerMatch:nt.A,HTML_RESULT:nt.C,getTemplateHtml:nt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,n){return t(this,n)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){nl??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(nl))return void(e[nl]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let n=rt;return o.j=r=>n=r,o._$AI(t,o,e),n},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:nt.V,AttributePart:nt.H,PropertyPart:nt.B,BooleanAttributePart:nt.N,EventPart:nt.U,ElementPart:nt.F,TemplateInstance:nt.R,isIterable:nt.D,ChildPart:nt.I};var{AttributePart:nm,PropertyPart:im,BooleanAttributePart:rm,EventPart:om}=gd,rl=new no,il=new Map,bd=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),io=(o,t)=>{let e=il.get(o);if(e===void 0){if(il.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let n=o.substring(2,o.length-2).trim();e=new Vi(n,rl).parse(),il.set(o,e)}}return e?.evaluate(t)},sm=(o,t,e,n)=>{let r=o.getAttribute("if");if(r!==null&&io(r,t))return ro(o,t,e,n)},vd=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,yd=o=>/(?:\\{{)|(?:\\}})/g.test(o),ji=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),am=(o,t,e,n)=>{let r=o.getAttribute("repeat");if(r!==null){let i=io(r,t);if(!i[Symbol.iterator])return P;let s=Fi(o),a=-1,l=[];for(let c of i){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 y=m.update(d,e,n);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},xd={if:sm,repeat:am},Ce=(o,t=xd,e={},n)=>{let i=Fi(o).renderers;if(n){let a=Fi(n).renderers,l=i.super;l!==void 0?e={...i,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>ro(n,f,m,y)},l(c,d,h))}:(e={...a,...i,...e},o=n)}else e={...i,...e};return s=>ro(o,s,t,e)};var ro=(o,t,e=xd,n={})=>{let r=Fi(o),i=[];for(let a of r.parts){let l=a.update(t,e,n);a.type===1?i.push(...l):i.push(l)}return{_$litType$:r,values:i}},wd=new Map,Fi=o=>{let t=wd.get(o);return t===void 0&&wd.set(o,t=lm(o)),t},lm=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),n=e.currentNode,r=-1,i=[];for(;(n=e.nextNode())!==null;)if(n.nodeType===Node.COMMENT_NODE)r++;else if(n.nodeType===Node.ELEMENT_NODE){r++;let s=n;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),i.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:io(g,y);return(m?io(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Fi(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>ro(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:r,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(vd);if(d.length===1){yd(c)&&s.setAttribute(l,ji(c));continue}s.removeAttribute(l);let h=l,f=nm,m=l[0];m==="."?(h=bd(l.substring(1)),f=im):m==="?"?(h=l.substring(1),f=rm):m==="@"&&(h=bd(l.substring(1)),f=om);let y=[ji(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(el(g,rl)),y.push(ji(d[u+1]))}t.parts.push({type:1,index:r,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(w=>w.evaluate(u))})}}else if(n.nodeType===Node.TEXT_NODE){let s=n,a=s.textContent,l=a.split(vd);l.length>1?s.textContent=ji(l[0]):yd(a)&&(s.textContent=ji(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=el(d,rl);t.parts.push({type:2,index:++r,update:(m,y)=>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 i)s.remove();return t};var ol=Symbol.for("qti-components.context-root"),cm=()=>{if(typeof document>"u")return;let o=globalThis;o[ol]||(o[ol]=new Li,o[ol].attach(document.documentElement))};cm();var qd=[];var al=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#n():queueMicrotask(()=>this.#n())}#n(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},sl="custom-state-support-probe";function dm(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(sl)||customElements.define(sl,class extends HTMLElement{});let t=o.call(document.createElement(sl)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var kd=!1;function Cd(){if(kd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=dm(o);return t==="modern"||(kd=!0,HTMLElement.prototype.attachInternals=function(){let n=o.call(this);return Object.defineProperty(n,"states",{configurable:!0,enumerable:!0,value:new al(this)}),n}),t}Cd();for(let{tag:o,ctor:t}of qd)customElements.get(o)||customElements.define(o,t);var Se=Symbol("computedItemContext");var F=Symbol("computedContext");var yt=Symbol("configContext");var On=Symbol("interactionContext");var j=Symbol("item");var Sd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var hm=/^[A-Za-z0-9-]+$/,pm=o=>typeof o=="string"&&hm.test(o),Zv=o=>pm(o)?o:void 0,wt=Symbol("qtiContext");var ll={view:"candidate"},Ee=Symbol("sessionContext");var cl={items:[],testOutcomeVariables:[]},ot=Symbol("testContext");var O=q`
|
|
1
|
+
var zc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ht=function(o,t,e,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(o,e):r?r.value=e:t.set(o,e),e},et=function(o,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(o):i?i.value:t.get(o)},Ii,Lr,zr,Cn,za,Sn,Vr,Ze,En,ke,jr,Vc;var U={__proto__:null};U.enumerable=!0;Object.freeze(U);var Va=(ke=class{constructor(t,e={}){if(Ii.set(this,!1),Lr.set(this,!1),zr.set(this,!1),Cn.set(this,!1),za.set(this,Date.now()),Sn.set(this,!1),Vr.set(this,void 0),Ze.set(this,void 0),En.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:i,cancelable:r,composed:n}=e;Ht(this,Ii,!!r,"f"),Ht(this,Lr,!!i,"f"),Ht(this,zr,!!n,"f"),Ht(this,Vr,`${t}`,"f"),Ht(this,Ze,null,"f"),Ht(this,En,!1,"f")}initEvent(t,e,i){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Ht(this,Cn,!0,"f")}get target(){return et(this,Ze,"f")}get currentTarget(){return et(this,Ze,"f")}get srcElement(){return et(this,Ze,"f")}get type(){return et(this,Vr,"f")}get cancelable(){return et(this,Ii,"f")}get defaultPrevented(){return et(this,Ii,"f")&&et(this,Cn,"f")}get timeStamp(){return et(this,za,"f")}composedPath(){return et(this,En,"f")?[et(this,Ze,"f")]:[]}get returnValue(){return!et(this,Ii,"f")||!et(this,Cn,"f")}get bubbles(){return et(this,Lr,"f")}get composed(){return et(this,zr,"f")}get eventPhase(){return et(this,En,"f")?ke.AT_TARGET:ke.NONE}get cancelBubble(){return et(this,Sn,"f")}set cancelBubble(t){t&&Ht(this,Sn,!0,"f")}stopPropagation(){Ht(this,Sn,!0,"f")}get isTrusted(){return!1}},Ii=new WeakMap,Lr=new WeakMap,zr=new WeakMap,Cn=new WeakMap,za=new WeakMap,Sn=new WeakMap,Vr=new WeakMap,Ze=new WeakMap,En=new WeakMap,ke.NONE=0,ke.CAPTURING_PHASE=1,ke.AT_TARGET=2,ke.BUBBLING_PHASE=3,ke);Object.defineProperties(Va.prototype,{initEvent:U,stopImmediatePropagation:U,preventDefault:U,target:U,currentTarget:U,srcElement:U,type:U,cancelable:U,defaultPrevented:U,timeStamp:U,composedPath:U,returnValue:U,bubbles:U,composed:U,eventPhase:U,cancelBubble:U,stopPropagation:U,isTrusted:U});var jc=(Vc=class extends Va{constructor(t,e={}){super(t,e),jr.set(this,void 0),Ht(this,jr,e?.detail??null,"f")}initCustomEvent(t,e,i,r){throw new Error("Method not implemented.")}get detail(){return et(this,jr,"f")}},jr=new WeakMap,Vc);Object.defineProperties(jc.prototype,{detail:U});var oe=Va,ja=jc;var at;var Og=(at=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}},at.STYLE_RULE=1,at.CHARSET_RULE=2,at.IMPORT_RULE=3,at.MEDIA_RULE=4,at.FONT_FACE_RULE=5,at.PAGE_RULE=6,at.NAMESPACE_RULE=10,at.KEYFRAMES_RULE=7,at.KEYFRAME_RULE=8,at.SUPPORTS_RULE=12,at.COUNTER_STYLE_RULE=11,at.FONT_FEATURE_VALUES_RULE=14,at.MARGIN_RULE=9,at);globalThis.Event??=oe;globalThis.CustomEvent??=ja;var Ba=Symbol(),Fc=o=>typeof o=="boolean"?o:o?.capture??!1,se={__proto__:null};se.enumerable=!0;Object.freeze(se);var Fr=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,i){if(e==null)return;let r=Fc(i)?this.__captureEventListeners:this.__eventListeners,n=r.get(t);if(n===void 0)n=new Map,r.set(t,n);else if(n.has(e))return;let s=typeof i=="object"&&i?i:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,i)),n.set(e,s??{})}removeEventListener(t,e,i){if(e==null)return;let r=Fc(i)?this.__captureEventListeners:this.__eventListeners,n=r.get(t);n!==void 0&&(n.delete(e),n.size||r.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let i=!1,r=!1,n=oe.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...se},srcElement:{get(){return t.target},...se},currentTarget:{get(){return l},...se},eventPhase:{get(){return n},...se},composedPath:{value:()=>e,...se},stopPropagation:{value:()=>{i=!0,c.call(t)},...se},stopImmediatePropagation:{value:()=>{r=!0,d.call(t)},...se}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(l=null,n=oe.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,n=u===t.target?oe.AT_TARGET:oe.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,w]of g)if(h(b,w,g),r)return f()}if(i)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),l=u,n=u===t.target?oe.AT_TARGET:oe.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,w]of g)if(h(b,w,g),r)return f()}if(i)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Hc,Pu]}};var Bc=new WeakMap,An=o=>{let t=Bc.get(o);return t===void 0&&Bc.set(o,t=new Map),t},Tn=class extends Fr{getRootNode(t){return t?.composed?Fa:this.__host?.__shadowRoot??Fa}};var Uc=class extends Tn{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Hc=new Uc,Fa=Hc;var Wc=class extends Tn{constructor(t){if(super(),t!==Ba)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Br,customElements:Ha,document:Fa,Document:Uc,Element:Qc,EventTarget:Fr,HTMLElement:Gc,Node:Tn,ShadowRoot:Xc,window:this,Window:Wc})}};var Qc=class extends Tn{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(An(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){An(this).set(t,String(e))}removeAttribute(t){An(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 An(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Xc(Ba,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 zc(this);return this.__internals=t,t}getAttribute(t){return An(this).get(t)??null}};var Gc=class extends Qc{},Ua=Gc;var Xc=class extends Tn{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 Ua,"localName",{get(){return"lit-server-root"}});function Ru(){let o,t;return{promise:new Promise((i,r)=>{o=i,t=r}),resolve:o,reject:t}}var Br=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 i=this.__pendingWhenDefineds.get(t);return i||(i=Ru(),this.__pendingWhenDefineds.set(t,i)),i.promise}},Ou=Br;var Ha=new Ou,Pu=new Wc(Ba);var In=globalThis,Ur=In.ShadowRoot&&(In.ShadyCSS===void 0||In.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wa=Symbol(),Yc=new WeakMap,_n=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==Wa)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(Ur&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Yc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Yc.set(e,t))}return t}toString(){return this.cssText}},Jc=o=>new _n(typeof o=="string"?o:o+"",void 0,Wa),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((i,r,n)=>i+(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.")})(r)+o[n+1],o[0]);return new _n(e,o,Wa)},Kc=(o,t)=>{if(Ur)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),r=In.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,o.appendChild(i)}},Qa=Ur||In.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return Jc(e)})(o):o;var{is:Mu,defineProperty:Du,getOwnPropertyDescriptor:Nu,getOwnPropertyNames:$u,getOwnPropertySymbols:Lu,getPrototypeOf:zu}=Object,Pn=globalThis;Pn.customElements??=Ha;var Zc=Pn.trustedTypes,Vu=Zc?Zc.emptyScript:"",ju=Pn.reactiveElementPolyfillSupport,Rn=(o,t)=>o,On={toAttribute(o,t){switch(t){case Boolean:o=o?Vu: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}},Hr=(o,t)=>!Mu(o,t),td={attribute:!0,type:String,converter:On,reflect:!1,useDefault:!1,hasChanged:Hr};Symbol.metadata??=Symbol("metadata"),Pn.litPropertyMetadata??=new WeakMap;var ae=class extends(globalThis.HTMLElement??Ua){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=td){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 i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Du(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){let{get:r,set:n}=Nu(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:r,set(s){let a=r?.call(this);n?.call(this,s),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??td}static _$Ei(){if(this.hasOwnProperty(Rn("elementProperties")))return;let t=zu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Rn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Rn("properties"))){let e=this.properties,i=[...$u(e),...Lu(e)];for(let r of i)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)e.unshift(Qa(r))}else t!==void 0&&e.push(Qa(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i: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 i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Kc(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,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let n=(i.converter?.toAttribute!==void 0?i.converter:On).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=i.getPropertyOptions(r),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:On;this._$Em=r;let a=s.fromAttribute(e,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,i,r=!1,n){if(t!==void 0){let s=this.constructor;if(r===!1&&(n=this[t]),i??=s.getPropertyOptions(t),!((i.hasChanged??Hr)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:r,wrapped:n},s){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),r===!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[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,n]of i){let{wrapped:s}=n,a=this[r];s!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}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){}};ae.elementStyles=[],ae.shadowRootOptions={mode:"open"},ae[Rn("elementProperties")]=new Map,ae[Rn("finalized")]=new Map,ju?.({ReactiveElement:ae}),(Pn.reactiveElementVersions??=[]).push("2.1.2");var Kr=globalThis,ed=o=>o,Wr=Kr.trustedTypes,id=Wr?Wr.createPolicy("lit-html",{createHTML:o=>o}):void 0,Xa="$lit$",le=`lit$${Math.random().toFixed(9).slice(2)}$`,Ya="?"+le,Fu=`<${Ya}>`,ii=Kr.document===void 0?{createTreeWalker:()=>({})}:document,Dn=()=>ii.createComment(""),Nn=o=>o===null||typeof o!="object"&&typeof o!="function",Ja=Array.isArray,ld=o=>Ja(o)||typeof o?.[Symbol.iterator]=="function",Ga=`[
|
|
3
|
+
\f\r]`,Mn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nd=/-->/g,rd=/>/g,ti=RegExp(`>|${Ga}(?:([^\\s"'>=/]+)(${Ga}*=${Ga}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),od=/'/g,sd=/"/g,cd=/^(?:script|style|textarea|title)$/i,Ka=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Ka(1),Ln=Ka(2),hb=Ka(3),rt=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),ad=new WeakMap,ei=ii.createTreeWalker(ii,129);function dd(o,t){if(!Ja(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return id!==void 0?id.createHTML(t):t}var hd=(o,t)=>{let e=o.length-1,i=[],r,n=t===2?"<svg>":t===3?"<math>":"",s=Mn;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===Mn?d[1]==="!--"?s=nd:d[1]!==void 0?s=rd:d[2]!==void 0?(cd.test(d[2])&&(r=RegExp("</"+d[2],"g")),s=ti):d[3]!==void 0&&(s=ti):s===ti?d[0]===">"?(s=r??Mn,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?ti:d[3]==='"'?sd:od):s===sd||s===od?s=ti:s===nd||s===rd?s=Mn:(s=ti,r=void 0);let m=s===ti&&o[a+1].startsWith("/>")?" ":"";n+=s===Mn?l+Fu:h>=0?(i.push(c),l.slice(0,h)+Xa+l.slice(h)+le+m):l+le+(h===-2?a:m)}return[dd(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},$n=class o{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let n=0,s=0,a=t.length-1,l=this.parts,[c,d]=hd(t,e);if(this.el=o.createElement(c,i),ei.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=ei.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(Xa)){let f=d[s++],m=r.getAttribute(h).split(le),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Gr:y[1]==="?"?Xr:y[1]==="@"?Yr:ri}),r.removeAttribute(h)}else h.startsWith(le)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(cd.test(r.tagName)){let h=r.textContent.split(le),f=h.length-1;if(f>0){r.textContent=Wr?Wr.emptyScript:"";for(let m=0;m<f;m++)r.append(h[m],Dn()),ei.nextNode(),l.push({type:2,index:++n});r.append(h[f],Dn())}}}else if(r.nodeType===8)if(r.data===Ya)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(le,h+1))!==-1;)l.push({type:7,index:n}),h+=le.length-1}n++}}static createElement(t,e){let i=ii.createElement("template");return i.innerHTML=t,i}};function ni(o,t,e=o,i){if(t===rt)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,n=Nn(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,i)),i!==void 0?(e._$Co??=[])[i]=r:e._$Cl=r),r!==void 0&&(t=ni(o,r._$AS(o,t.values),r,i)),t}var Qr=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:i}=this._$AD,r=(t?.creationScope??ii).importNode(e,!0);ei.currentNode=r;let n=ei.nextNode(),s=0,a=0,l=i[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new _i(n,n.nextSibling,this,t):l.type===1?c=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(c=new Jr(n,this,t)),this._$AV.push(c),l=i[++a]}s!==l?.index&&(n=ei.nextNode(),s++)}return ei.currentNode=ii,r}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},_i=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.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=ni(this,t,e),Nn(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==rt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ld(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&&Nn(this._$AH)?this._$AA.nextSibling.data=t:this.T(ii.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=$n.createElement(dd(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new Qr(r,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=ad.get(t.strings);return e===void 0&&ad.set(t.strings,e=new $n(t)),e}k(t){Ja(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let n of t)r===e.length?e.push(i=new o(this.O(Dn()),this.O(Dn()),this,this.options)):i=e[r],i._$AI(n),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=ed(t).nextSibling;ed(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ri=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=P}_$AI(t,e=this,i,r){let n=this.strings,s=!1;if(n===void 0)t=ni(this,t,e,0),s=!Nn(t)||t!==this._$AH&&t!==rt,s&&(this._$AH=t);else{let a=t,l,c;for(t=n[0],l=0;l<n.length-1;l++)c=ni(this,a[i+l],e,l),c===rt&&(c=this._$AH[l]),s||=!Nn(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!r&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Gr=class extends ri{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Xr=class extends ri{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Yr=class extends ri{constructor(t,e,i,r,n){super(t,e,i,r,n),this.type=5}_$AI(t,e=this){if((t=ni(this,t,e,0)??P)===rt)return;let i=this._$AH,r=t===P&&i!==P||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==P&&(i===P||r);r&&this.element.removeEventListener(this.name,this,i),n&&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)}},Jr=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){ni(this,t)}},it={M:Xa,P:le,A:Ya,C:1,L:hd,R:Qr,D:ld,V:ni,I:_i,H:ri,N:Xr,U:Yr,B:Gr,F:Jr},Bu=Kr.litHtmlPolyfillSupport;Bu?.($n,_i),(Kr.litHtmlVersions??=[]).push("3.3.3");var Za=(o,t,e)=>{let i=e?.renderBefore??t,r=i._$litPart$;if(r===void 0){let n=e?.renderBefore??null;i._$litPart$=r=new _i(t.insertBefore(Dn(),n),n,void 0,e??{})}return r._$AI(o),r};var tl=globalThis,k=class extends ae{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=Za(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return rt}};k._$litElement$=!0,k.finalized=!0,tl.litElementHydrateSupport?.({LitElement:k});var Uu=tl.litElementPolyfillSupport;Uu?.({LitElement:k});(tl.litElementVersions??=[]).push("4.2.2");var Hu={attribute:!0,type:String,converter:On,reflect:!1,hasChanged:Hr},Wu=(o=Hu,t,e)=>{let{kind:i,metadata:r}=e,n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),i==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),i==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(i==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+i)};function p(o){return(t,e)=>typeof e=="object"?Wu(o,t,e):((i,r,n)=>{let s=r.hasOwnProperty(n);return r.constructor.createProperty(n,i),s?Object.getOwnPropertyDescriptor(r,n):void 0})(o,t,e)}function _(o){return p({...o,state:!0,attribute:!1})}var Ce=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ri(o,t){return(e,i,r)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof i=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return Ce(e,i,{get(){let l=s.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ce(e,i,{get(){return n(this)}})}}function pd(o){return(t,e)=>{let{slot:i,selector:r}=o??{},n="slot"+(i?`[name=${i}]`:":not([name])");return Ce(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return r===void 0?a:a.filter(l=>l.matches(r))}})}}var ce=class extends Event{constructor(t,e,i,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=r??!1}};var ct=class{constructor(t,e,i,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ce(this.context,this.host,this.t,this.subscribe))}};var Zr=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:r}=this.subscriptions.get(t);t(this.value,r)}clearCallbacks(){this.subscriptions.clear()}};var el=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Wt=class extends Zr{constructor(t,e,i){super(e.context!==void 0?e.initialValue:i),this.onContextRequest=r=>{if(r.context!==this.context)return;let n=r.contextTarget??r.composedPath()[0];n!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,n,r.subscribe))},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new ce(this.context,a,s,!0)));r.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 el(this.context,this.host))}};var zn=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:i}=e;for(let{elementRef:r,callbackRef:n}of i){let s=r.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new ce(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],i=t.callback,r=this.pendingContextRequests.get(t.context);r===void 0&&this.pendingContextRequests.set(t.context,r={callbacks:new WeakMap,requests:[]});let n=r.callbacks.get(e);n===void 0&&r.callbacks.set(e,n=new WeakSet),n.has(i)||(n.add(i),r.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(i)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function H({context:o}){return(t,e)=>{let i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(r){return i.get(this).setValue(r),t.set.call(this,r)},init(r){return i.set(this,new Wt(this,{context:o,initialValue:r})),r}};{t.constructor.addInitializer((s=>{i.set(s,new Wt(s,{context:o}))}));let r=Object.getOwnPropertyDescriptor(t,e),n;if(r===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){i.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=r.set;n={...r,set(a){i.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function I({context:o,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new ct(this,{context:o,callback:r=>{e.set.call(this,r)},subscribe:t})})):e.constructor.addInitializer((r=>{new ct(r,{context:o,callback:n=>{r[i]=n},subscribe:t})}))}}var to=["this"],ud=["+","-","!"],md=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],il={"!":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},eo=13;var Qu=["==","!=","<=",">=","||","&&","??","|>"],Gu=["===","!=="],M;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(M||(M={}));var Qt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Xu=o=>o===9||o===10||o===13||o===32,fd=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Yu=o=>fd(o)||Vn(o),Ju=o=>to.indexOf(o)!==-1,Ku=o=>o===34||o===39,Vn=o=>48<=o&&o<=57,Zu=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,tm=o=>o===40||o===41||o===91||o===93||o===123||o===125,em=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}}),io=class{#t;#e=-1;#i=0;#n;constructor(t){this.#t=t,this.#r()}nextToken(){for(;Xu(this.#n);)this.#r(!0);if(Ku(this.#n))return this.#a();if(fd(this.#n))return this.#c();if(Vn(this.#n))return this.#p();if(this.#n===46)return this.#l();if(this.#n===44)return this.#f();if(this.#n===58)return this.#d();if(Zu(this.#n))return this.#h();if(tm(this.#n))return this.#g();if(this.#r(),this.#n!==void 0)throw new Error(`Expected end of input, got ${this.#n}`)}#r(t){this.#e++,this.#e<this.#t.length?(this.#n=this.#t.charCodeAt(this.#e),t===!0&&(this.#i=this.#e)):this.#n=void 0}#o(t=0){let e=this.#t.substring(this.#i,this.#e+t);return t===0&&this.#s(),e}#s(){this.#i=this.#e}#a(){let t="unterminated string",e=this.#n;for(this.#r(!0);this.#n!==e;){if(this.#n===void 0)throw new Error(t);if(this.#n===92&&(this.#r(),this.#n===void 0))throw new Error(t);this.#r()}let i=Qt(M.STRING,em(this.#o()));return this.#r(),i}#c(){do this.#r();while(Yu(this.#n));let t=this.#o(),e=Ju(t)?M.KEYWORD:M.IDENTIFIER;return Qt(e,t)}#p(){do this.#r();while(Vn(this.#n));return this.#n===46?this.#l():Qt(M.INTEGER,this.#o())}#l(){return this.#r(),Vn(this.#n)?this.#u():(this.#s(),Qt(M.DOT,".",eo))}#f(){return this.#r(!0),Qt(M.COMMA,",")}#d(){return this.#r(!0),Qt(M.COLON,":")}#u(){do this.#r();while(Vn(this.#n));return Qt(M.DECIMAL,this.#o())}#h(){this.#r();let t=this.#o(2);if(Gu.indexOf(t)!==-1)this.#r(),this.#r();else{if(t=this.#o(1),t==="=>")return this.#r(),Qt(M.ARROW,t);Qu.indexOf(t)!==-1&&this.#r()}return t=this.#o(),Qt(M.OPERATOR,t,il[t])}#g(){let t=String.fromCharCode(this.#n),e=Qt(M.GROUPER,t,il[t]);return this.#r(!0),e}};var nl=(o,t)=>new jn(o,t).parse(),jn=class{#t;#e;#i;#n;#r;constructor(t,e){this.#e=new io(t),this.#i=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 i=this.#e.nextToken();this.#n=i,this.#t=i?.kind,this.#r=i?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#r!==e)}#s(){if(!this.#n)return this.#i.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.#n;)if(this._matches(M.GROUPER,"(")){let i=this.#b();t=this.#i.invoke(t,void 0,i)}else if(this._matches(M.GROUPER,"[")){let i=this.#m();t=this.#i.index(t,i)}else if(this._matches(M.DOT)){this.#o();let i=this.#l();t=this.#c(t,i)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#n.precedence>=e)t=this.#r==="?"?this.#f(t):this.#p(t,this.#n);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let i=e.receiver;return this.#i.invoke(t,i.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(md.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let i=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#n.precedence>e.precedence;)i=this.#a(i,this.#n.precedence);return this.#i.binary(t,e.value,i)}#l(){if(this._matches(M.OPERATOR)){let t=this.#r;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#x(t);if(this._matches(M.DECIMAL))return this.#C(t)}if(ud.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),eo);return this.#i.unary(t,e)}return this.#d()}#f(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let i=this.#s();return this.#i.ternary(t,e,i)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#r;if(t==="this")return this.#o(),this.#i.id(t);throw to.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#g();case M.STRING:return this.#w();case M.INTEGER:return this.#x();case M.DECIMAL:return this.#C();case M.GROUPER:return this.#r==="("?this.#y():this.#r==="{"?this.#h():this.#r==="["?this.#u():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#i.list(t)}#h(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#r;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#i.map(t)}#g(){let t=this.#r;if(t==="true")return this.#o(),this.#i.literal(!0);if(t==="false")return this.#o(),this.#i.literal(!1);if(t==="null")return this.#o(),this.#i.literal(null);if(t==="undefined")return this.#o(),this.#i.literal(void 0);let e=this.#v(),i=this.#b();return i?this.#i.invoke(e,void 0,i):e}#v(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#r}`);let t=this.#r;return this.#o(),this.#i.id(t)}#b(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),t}#m(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#y(){let t=this.#b();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),i=t?.map(r=>r.value)??[];return this.#i.arrowFunction(i,e)}else return this.#i.paren(t[0])}#w(){let t=this.#i.literal(this.#r);return this.#o(),t}#x(t=""){let e=this.#i.literal(parseInt(`${t}${this.#r}`,10));return this.#o(),e}#C(t=""){let e=this.#i.literal(parseFloat(`${t}${this.#r}`));return this.#o(),e}};var{hasOwn:gd,fromEntries:im}=Object,nm={"+":(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)},rm={"+":o=>o,"-":o=>-o,"!":o=>!o},no=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 i=rm[t];return{type:"Unary",operator:t,child:e,evaluate(r){return i(this.child.evaluate(r))},getIds(r){return this.child.getIds(r)}}}binary(t,e,i){let r=nm[e];return{type:"Binary",operator:e,left:t,right:i,evaluate(n){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(n),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return r(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(i){return this.receiver.evaluate(i)?.[this.name]},getIds(i){return this.receiver.getIds(i),i}}}invoke(t,e,i){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:i,evaluate(r){let n=this.receiver.evaluate(r),s=this.method?n:r?.this??r,a=this.method?n?.[e]:n,c=(this.arguments??[]).map(d=>d?.evaluate(r));return a?.apply?.(s,c)},getIds(r){return this.receiver.getIds(r),this.arguments?.forEach(n=>n?.getIds(r)),r}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(i){return this.receiver.evaluate(i)?.[this.argument.evaluate(i)]},getIds(i){return this.receiver.getIds(i),i}}}ternary(t,e,i){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:i,evaluate(r){return this.condition.evaluate(r)?this.trueExpr.evaluate(r):this.falseExpr.evaluate(r)},getIds(r){return this.condition.getIds(r),this.trueExpr.getIds(r),this.falseExpr.getIds(r),r}}}map(t){return{type:"Map",entries:t,evaluate(e){let i={};if(t&&this.entries)for(let r in t){let n=this.entries[r];n&&(i[r]=n.evaluate(e))}return i},getIds(e){if(t&&this.entries)for(let i in t){let r=this.entries[i];r&&r.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(i=>i?.evaluate(e))},getIds(e){return this.items?.forEach(i=>i?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(i){let r=this.params,n=this.body;return function(...s){let a=im(r.map((c,d)=>[c,s[d]])),l=new Proxy(i??{},{set(c,d,h){return gd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return gd(a,d)?a[d]:c[d]}});return n.evaluate(l)}},getIds(i){return this.body.getIds(i).filter(r=>!this.params.includes(r))}}}};var rl=null,bd={boundAttributeSuffix:it.M,marker:it.P,markerMatch:it.A,HTML_RESULT:it.C,getTemplateHtml:it.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,i){return t(this,i)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){rl??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(rl))return void(e[rl]=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 i=rt;return o.j=r=>i=r,o._$AI(t,o,e),i},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:it.V,AttributePart:it.H,PropertyPart:it.B,BooleanAttributePart:it.N,EventPart:it.U,ElementPart:it.F,TemplateInstance:it.R,isIterable:it.D,ChildPart:it.I};var{AttributePart:om,PropertyPart:sm,BooleanAttributePart:am,EventPart:lm}=bd,sl=new no,ol=new Map,vd=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),ro=(o,t)=>{let e=ol.get(o);if(e===void 0){if(ol.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let i=o.substring(2,o.length-2).trim();e=new jn(i,sl).parse(),ol.set(o,e)}}return e?.evaluate(t)},cm=(o,t,e,i)=>{let r=o.getAttribute("if");if(r!==null&&ro(r,t))return oo(o,t,e,i)},yd=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,wd=o=>/(?:\\{{)|(?:\\}})/g.test(o),Fn=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),dm=(o,t,e,i)=>{let r=o.getAttribute("repeat");if(r!==null){let n=ro(r,t);if(!n[Symbol.iterator])return P;let s=Bn(o),a=-1,l=[];for(let c of n){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 y=m.update(d,e,i);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},qd={if:cm,repeat:dm},Se=(o,t=qd,e={},i)=>{let n=Bn(o).renderers;if(i){let a=Bn(i).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>oo(i,f,m,y)},l(c,d,h))}:(e={...a,...n,...e},o=i)}else e={...n,...e};return s=>oo(o,s,t,e)};var oo=(o,t,e=qd,i={})=>{let r=Bn(o),n=[];for(let a of r.parts){let l=a.update(t,e,i);a.type===1?n.push(...l):n.push(l)}return{_$litType$:r,values:n}},xd=new Map,Bn=o=>{let t=xd.get(o);return t===void 0&&xd.set(o,t=hm(o)),t},hm=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),i=e.currentNode,r=-1,n=[];for(;(i=e.nextNode())!==null;)if(i.nodeType===Node.COMMENT_NODE)r++;else if(i.nodeType===Node.ELEMENT_NODE){r++;let s=i;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),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:ro(g,y);return(m?ro(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Bn(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>oo(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:r,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(yd);if(d.length===1){wd(c)&&s.setAttribute(l,Fn(c));continue}s.removeAttribute(l);let h=l,f=om,m=l[0];m==="."?(h=vd(l.substring(1)),f=sm):m==="?"?(h=l.substring(1),f=am):m==="@"&&(h=vd(l.substring(1)),f=lm);let y=[Fn(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(nl(g,sl)),y.push(Fn(d[u+1]))}t.parts.push({type:1,index:r,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(w=>w.evaluate(u))})}}else if(i.nodeType===Node.TEXT_NODE){let s=i,a=s.textContent,l=a.split(yd);l.length>1?s.textContent=Fn(l[0]):wd(a)&&(s.textContent=Fn(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=nl(d,sl);t.parts.push({type:2,index:++r,update:(m,y)=>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 n)s.remove();return t};var al=Symbol.for("qti-components.context-root"),pm=()=>{if(typeof document>"u")return;let o=globalThis;o[al]||(o[al]=new zn,o[al].attach(document.documentElement))};pm();var kd=[];var cl=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.#i():queueMicrotask(()=>this.#i())}#i(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},ll="custom-state-support-probe";function um(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(ll)||customElements.define(ll,class extends HTMLElement{});let t=o.call(document.createElement(ll)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Cd=!1;function Sd(){if(Cd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=um(o);return t==="modern"||(Cd=!0,HTMLElement.prototype.attachInternals=function(){let i=o.call(this);return Object.defineProperty(i,"states",{configurable:!0,enumerable:!0,value:new cl(this)}),i}),t}Sd();for(let{tag:o,ctor:t}of kd)customElements.get(o)||customElements.define(o,t);var Ee=Symbol("computedItemContext");var F=Symbol("computedContext");var yt=Symbol("configContext");var Oi=Symbol("interactionContext");var j=Symbol("item");var Ed=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var mm=/^[A-Za-z0-9-]+$/,fm=o=>typeof o=="string"&&mm.test(o),ny=o=>fm(o)?o:void 0,wt=Symbol("qtiContext");var dl={view:"candidate"},Ae=Symbol("sessionContext");var hl={items:[],testOutcomeVariables:[]},ot=Symbol("testContext");var O=q`
|
|
6
6
|
:host {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
@@ -12,7 +12,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
12
12
|
*::after {
|
|
13
13
|
box-sizing: inherit;
|
|
14
14
|
}
|
|
15
|
-
`;var
|
|
15
|
+
`;var Gt=q`
|
|
16
16
|
[part~='drop'] {
|
|
17
17
|
/*
|
|
18
18
|
* The one deliberate opt-out from the border-box reset.
|
|
@@ -56,23 +56,23 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
56
56
|
[part~='message'] {
|
|
57
57
|
display: none;
|
|
58
58
|
}
|
|
59
|
-
`;var
|
|
59
|
+
`;var Pi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},D=class extends k{#t;get _context(){return this.#t.value}#e;#i;#n(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#i&&(this.#i=t.disabled,this.disabled=t.disabled),this.#a(t)}#r;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),i=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!i)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let r=this.#r===void 0,n=JSON.stringify(i.value??null);n!==this.#r&&(this.#r=n,!(r&&(i.value===null||i.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=i.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(i=>i.type==="response"),e=this.getAttribute("response-identifier");return t.find(i=>i.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,i=this.configContext;return i&&i.allowReorder!==void 0?i.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,i=this.configContext;return i?i.disableAfterMaxReached!==void 0?i.disableAfterMaxReached:i.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),i.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",i,r){let n=i??this;this._internals.setValidity(t?{}:{customError:!0},e,n),r?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}constructor(){super(),this.#t=new ct(this,{context:j,subscribe:!0,callback:t=>this.#n(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals(),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Pi([I({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Pi([H({context:Oi})],D.prototype,"_interactionContext",void 0);Pi([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Pi([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Pi([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Pi([p({type:String})],D.prototype,"name",void 0);var Mi=class extends k{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let i=e.map(r=>r.innerHTML.trim());return i.length>1||t==="multiple"||t==="ordered"?i:i[0]}};var ul=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},pl=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??Ad(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??Ad(o),value:String(o),cardinality:"single",type:"response"},Ad=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",gm=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends k{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 i=e.getAttribute("identifier")||"";return i==="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(i)}case"qti-multiple":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=e.getResult();return r?.length>0?r:null}case"qti-custom-operator":return pl(e.calculate?.());case"qti-correct":{let i=e.getAttribute("identifier")||"",r=this.context?.variables?.find(n=>n.identifier===i);return r?{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}:(console.warn(`qti-correct: no response declaration for "${i}"`),pl(null))}default:{try{let i=e,r=i.getResult();return pl(r,i.resultBaseType??gm(i,r))}catch(i){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,i)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=q`
|
|
60
60
|
slot {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
`}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(r=>r.identifier===e[0])?.variables?.find(r=>r.identifier===e[e.length-1])??null}};hl([I({context:j,subscribe:!0})],E.prototype,"context",void 0);hl([I({context:wt,subscribe:!0})],E.prototype,"qtiContext",void 0);hl([I({context:ot,subscribe:!0})],E.prototype,"_testContext",void 0);var Gt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Ty=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),_t=o=>typeof o=="string"?o:o.toString();function pl(o){return o==null}function oo(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Bi=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ut=class extends k{constructor(){super(...arguments),this.showHide="show",this.#t=new ct(this,{context:j,subscribe:!0,callback:t=>this.#n(t)})}#t;get _context(){return this.#t.value}#e;#n(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let n=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),r=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,i=this.#e===void 0?r>0:this.#e!==n||r>0;this.#e=n,i&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(r=>r.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let n=!1;Array.isArray(e.value)?n=e.value.includes(this.identifier):n=!pl(this.identifier)&&!pl(e?.value)&&this.identifier===e.value||!1,this.#i(n)}#i(t){if(!this.#r()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#r(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(r=>r.active)?.sections.flatMap(r=>r.items).find(r=>r.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(r=>r.identifier==="numAttempts")?.value)||0)<e}};Bi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Bi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Bi([p({type:String})],ut.prototype,"identifier",void 0);Bi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Bi([I({context:F,subscribe:!0}),_()],ut.prototype,"_computedContext",void 0);function ul(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 ml(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(n=>n.trim()).filter(n=>n.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*$y(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 Ly(o){let[t,e,...n]=o.trim().split(/\s+/);if(!t||!e||n.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function zy(o,t){return`${o} ${t}`}function Vy(o){let[t,e,...n]=o.trim().split(/\s+/),r=Number(t),i=Number(e);if(!Number.isFinite(r)||!Number.isFinite(i)||n.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:r,y:i}}function jy(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=n=>n===t||n==null||n===""||Array.isArray(n)&&n.length===0;return{fromAttribute:n=>{let r=ul(n);return r===null?t:r},toAttribute:n=>e(n)?null:ml(n)}}var Rt=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Ui=o=>{let t={},e={};for(let n of o){let r=n.getAttribute("field-identifier");if(!r)continue;t[r]=n.textContent?.trim()??"";let i=n.getAttribute("base-type");i&&(e[r]=i)}return{value:t,baseTypes:e}},Ad=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,so=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(Ad.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(n=>Ad.test(n))?"point":"string"};var Td=class extends k{},Dn=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Nn=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var mm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},fl=o=>t=>{let e=mm(t);return e===null?null:o(e)},fm=["depcp","questify","qade"],gm={Trim:fl(o=>o.trim()),ToAscii:fl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:fl(o=>o.replace(",","."))},bm=new Map(fm.flatMap(o=>Object.entries(gm).map(([t,e])=>[`${o}:${t}`,e]))),gl=new Map,Wy=(o,t)=>{gl.set(o,t)},Qy=o=>{gl.delete(o)},Id=o=>gl.get(o)??bm.get(o)??null;var _d={true:!0,1:!0,false:!1,0:!1},K=class{static isPointInArea(t,e,n){if(n!=="point")return console.warn(`Base type ${n} is not supported for point area mapping.`),!1;let[r,i]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((r-c)**2+(i-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):r>=c&&r<=h&&i>=d&&i<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(r-c)**2/h**2,y=(i-d)**2/f**2;return m+y<=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:r,y:i},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r].x,a=e[r].y,l=e[i].x,c=e[i].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(n=!n)}return n}static compareSingleValues(t,e,n){switch(n){case"identifier":case"string":return t===e;case"boolean":{let r=_d[t.trim().toLowerCase()];return r!==void 0&&r===_d[e.trim().toLowerCase()]}case"integer":{let r=parseInt(t,10),i=parseInt(e,10);if(!isNaN(r)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:r===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let r=parseFloat(t),i=parseFloat(e);if(!isNaN(r)&&!isNaN(i))return r===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=t.split(" "),i=e.split(" ");if(r.length===2&&i.length===2)return n==="pair"&&(r.sort(),i.sort()),r.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 Ae=Symbol("testHost");var Od={"cito-item-rendered":{kind:"notification",scope:"item"},"cito-item-response-changed":{kind:"notification",scope:"item",deprecated:"qti-interaction-changed"},"cito-item-set-outcomes":{kind:"request",scope:"item"},"cito-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"qti-outcome-changed"},"cito-item-outcomes-changed":{kind:"notification",scope:"item"},"cito-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"qti-rubric:discretionary-placement"}};function bl(o,t,e,n,r=!1){let i={detail:n??{},bubbles:!0,composed:!0,cancelable:r},s=o.dispatchEvent(new CustomEvent(e,i)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,i))&&s:s}var Rd=new Set;function vl(o,t,e,n){let r;o.addEventListener(e,s=>{r=s.detail,queueMicrotask(()=>r=void 0),n(s)});let{deprecated:i}=t[e];i&&o.addEventListener(i,s=>{r!==void 0&&s.detail===r||(Rd.has(i)||(Rd.add(i),console.warn(`[qti-components] The event "${i}" is deprecated; dispatch "${e}" instead.`)),n(s))})}function Yt(o,t,e,n=!1){return bl(o,Od,t,e,n)}function Pd(o,t,e){vl(o,Od,t,e)}var Md={"cito-test-navigate":{kind:"request",scope:"test",deprecated:"qti-request-navigation"},"cito-test-end-attempt":{kind:"request",scope:"test",deprecated:"test-end-attempt"},"cito-test-submit":{kind:"request",scope:"test"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-update-plugin-state":{kind:"request",scope:"test"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-submitted":{kind:"notification",scope:"test"},"cito-test-navigated":{kind:"notification",scope:"test"},"cito-test-navigation-started":{kind:"notification",scope:"test",deprecated:"qti-navigation-loading-started"},"cito-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"qti-navigation-error"},"cito-test-rendered":{kind:"notification",scope:"test",deprecated:"qti-test-loaded"},"cito-test-loaded":{kind:"notification",scope:"test",deprecated:"qti-assessment-test-connected"},"cito-test-state-changed":{kind:"notification",scope:"test",deprecated:"qti-state-changed"},"cito-test-items-skipped":{kind:"notification",scope:"test"},"cito-test-end-reached":{kind:"notification",scope:"test"},"cito-item-ref-connected":{kind:"notification",scope:"item",deprecated:"qti-assessment-item-ref-connected"}};function $(o,t,e){bl(o,Md,t,e)}function B(o,t,e){vl(o,Md,t,e)}var Te=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Dd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},xt=class extends k{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let n=e.getAttribute("identifier");if(!n)continue;let r=Number(e.getAttribute("value"));if(Number.isNaN(r)){console.warn(`qti-weight "${n}" has a non-numeric value, ignoring it`);continue}t.set(n,r)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?Ce(t):null,this.requestUpdate(),await this.updateComplete,$(this,"cito-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let n=e.items.find(r=>r.identifier===this.identifier);if(n)return n}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Te([p({type:String})],xt.prototype,"category",void 0);Te([p({type:String})],xt.prototype,"identifier",void 0);Te([p({type:Boolean,converter:Dd})],xt.prototype,"required",void 0);Te([p({type:Boolean,converter:Dd})],xt.prototype,"fixed",void 0);Te([p({type:String})],xt.prototype,"href",void 0);Te([_(),I({context:F,subscribe:!0})],xt.prototype,"computedContext",void 0);Te([p({type:Object,attribute:!1})],xt.prototype,"xmlDoc",void 0);Te([I({context:Ae,subscribe:!0})],xt.prototype,"testHost",void 0);var Ie=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},yl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},qt=class extends k{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 v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Ie([p({type:String})],qt.prototype,"identifier",void 0);Ie([p({type:String})],qt.prototype,"required",void 0);Ie([p({type:Boolean,converter:yl})],qt.prototype,"fixed",void 0);Ie([p({type:Boolean,converter:yl})],qt.prototype,"visible",void 0);Ie([p({type:Boolean,converter:yl,attribute:"keep-together"})],qt.prototype,"keepTogether",void 0);Ie([p({type:String,attribute:"navigation-mode"})],qt.prototype,"navigationMode",void 0);Ie([p({type:String,attribute:"submission-mode"})],qt.prototype,"submissionMode",void 0);Ie([I({context:ot,subscribe:!0})],qt.prototype,"_testContext",void 0);var wl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},on=class extends k{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,"cito-test-loaded",this)}render(){return v` <slot></slot>`}};wl([p({type:String})],on.prototype,"identifier",void 0);wl([p({type:String})],on.prototype,"title",null);wl([I({context:ot,subscribe:!0})],on.prototype,"_testContext",void 0);function ao(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let n=e.calculate();return n===!0||n==="true"}catch(n){return console.warn(`<${o.localName}> could not evaluate its expression`,n),t}}var vm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ce=class extends k{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=q`
|
|
63
|
+
`}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(r=>r.identifier===e[0])?.variables?.find(r=>r.identifier===e[e.length-1])??null}};ul([I({context:j,subscribe:!0})],E.prototype,"context",void 0);ul([I({context:wt,subscribe:!0})],E.prototype,"qtiContext",void 0);ul([I({context:ot,subscribe:!0})],E.prototype,"_testContext",void 0);var Xt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Oy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Rt=o=>typeof o=="string"?o:o.toString();function ml(o){return o==null}function so(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Un=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends k{constructor(){super(...arguments),this.showHide="show",this.#t=new ct(this,{context:j,subscribe:!0,callback:t=>this.#i(t)}),this.#n=!1}#t;get _context(){return this.#t.value}#e;#i(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let i=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),r=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?r>0:this.#e!==i||r>0;this.#e=i,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(r=>r.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let i=!1;Array.isArray(e.value)?i=e.value.includes(this.identifier):i=!ml(this.identifier)&&!ml(e?.value)&&this.identifier===e.value||!1,this.#r(i)}#n;#r(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#n)return;if(!this.feedbackShowing()){this.#n=!0,this.showStatus="off";return}}else if(this.#n=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(r=>r.active)?.sections.flatMap(r=>r.items).find(r=>r.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(r=>r.identifier==="numAttempts")?.value)||0)<e}};Un([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Un([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Un([p({type:String})],ut.prototype,"identifier",void 0);Un([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Un([I({context:F,subscribe:!0}),_()],ut.prototype,"_computedContext",void 0);function fl(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 gl(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(i=>i.trim()).filter(i=>i.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*jy(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 Fy(o){let[t,e,...i]=o.trim().split(/\s+/);if(!t||!e||i.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function By(o,t){return`${o} ${t}`}function Uy(o){let[t,e,...i]=o.trim().split(/\s+/),r=Number(t),n=Number(e);if(!Number.isFinite(r)||!Number.isFinite(n)||i.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:r,y:n}}function Hy(o,t){return`${o} ${t}`}function Yt(o){let{emptyAs:t}=o,e=i=>i===t||i==null||i===""||Array.isArray(i)&&i.length===0;return{fromAttribute:i=>{let r=fl(i);return r===null?t:r},toAttribute:i=>e(i)?null:gl(i)}}var Ot=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Hn=o=>{let t={},e={};for(let i of o){let r=i.getAttribute("field-identifier");if(!r)continue;t[r]=i.textContent?.trim()??"";let n=i.getAttribute("base-type");n&&(e[r]=n)}return{value:t,baseTypes:e}},Td=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,ao=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(Td.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(i=>Td.test(i))?"point":"string"};var Id=class extends k{},Di=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Ni=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var bm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},bl=o=>t=>{let e=bm(t);return e===null?null:o(e)},vm=["depcp","questify","qade"],ym={Trim:bl(o=>o.trim()),ToAscii:bl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:bl(o=>o.replace(",","."))},wm=new Map(vm.flatMap(o=>Object.entries(ym).map(([t,e])=>[`${o}:${t}`,e]))),vl=new Map,Yy=(o,t)=>{vl.set(o,t)},Jy=o=>{vl.delete(o)},_d=o=>vl.get(o)??wm.get(o)??null;var Rd={true:!0,1:!0,false:!1,0:!1},K=class{static isPointInArea(t,e,i){if(i!=="point")return console.warn(`Base type ${i} is not supported for point area mapping.`),!1;let[r,n]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((r-c)**2+(n-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):r>=c&&r<=h&&n>=d&&n<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(r-c)**2/h**2,y=(n-d)**2/f**2;return m+y<=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:r,y:n},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){let s=e[r].x,a=e[r].y,l=e[n].x,c=e[n].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(i=!i)}return i}static compareSingleValues(t,e,i){switch(i){case"identifier":case"string":return t===e;case"boolean":{let r=Rd[t.trim().toLowerCase()];return r!==void 0&&r===Rd[e.trim().toLowerCase()]}case"integer":{let r=parseInt(t,10),n=parseInt(e,10);if(!isNaN(r)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:r===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let r=parseFloat(t),n=parseFloat(e);if(!isNaN(r)&&!isNaN(n))return r===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=t.split(" "),n=e.split(" ");if(r.length===2&&n.length===2)return i==="pair"&&(r.sort(),n.sort()),r.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Te=Symbol("testHost");var Pd={"cito-item-rendered":{kind:"notification",scope:"item"},"cito-item-response-changed":{kind:"notification",scope:"item",deprecated:"qti-interaction-changed"},"cito-item-set-outcomes":{kind:"request",scope:"item"},"cito-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"qti-outcome-changed"},"cito-item-outcomes-changed":{kind:"notification",scope:"item"},"cito-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"qti-rubric:discretionary-placement"},"cito-feedback-show":{kind:"notification",scope:"item"},"cito-feedback-hide":{kind:"notification",scope:"item"}};function yl(o,t,e,i,r=!1){let n={detail:i??{},bubbles:!0,composed:!0,cancelable:r},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var Od=new Set;function wl(o,t,e,i){let r;o.addEventListener(e,s=>{r=s.detail,queueMicrotask(()=>r=void 0),i(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{r!==void 0&&s.detail===r||(Od.has(n)||(Od.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),i(s))})}function xt(o,t,e,i=!1){return yl(o,Pd,t,e,i)}function Md(o,t,e){wl(o,Pd,t,e)}var Dd={"cito-test-navigate":{kind:"request",scope:"test",deprecated:"qti-request-navigation"},"cito-test-end-attempt":{kind:"request",scope:"test",deprecated:"test-end-attempt"},"cito-test-submit":{kind:"request",scope:"test"},"cito-test-update-outcome":{kind:"request",scope:"test",deprecated:"test-update-outcome-variable"},"cito-test-update-plugin-state":{kind:"request",scope:"test"},"cito-test-switch-view":{kind:"request",scope:"test",deprecated:"on-test-switch-view"},"cito-test-submitted":{kind:"notification",scope:"test"},"cito-test-navigated":{kind:"notification",scope:"test"},"cito-test-navigation-started":{kind:"notification",scope:"test",deprecated:"qti-navigation-loading-started"},"cito-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"qti-navigation-error"},"cito-test-rendered":{kind:"notification",scope:"test",deprecated:"qti-test-loaded"},"cito-test-loaded":{kind:"notification",scope:"test",deprecated:"qti-assessment-test-connected"},"cito-test-state-changed":{kind:"notification",scope:"test",deprecated:"qti-state-changed"},"cito-test-items-skipped":{kind:"notification",scope:"test"},"cito-test-end-reached":{kind:"notification",scope:"test"},"cito-item-ref-connected":{kind:"notification",scope:"item",deprecated:"qti-assessment-item-ref-connected"}};function $(o,t,e){yl(o,Dd,t,e)}function B(o,t,e){wl(o,Dd,t,e)}var Ie=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Nd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},qt=class extends k{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let i=e.getAttribute("identifier");if(!i)continue;let r=Number(e.getAttribute("value"));if(Number.isNaN(r)){console.warn(`qti-weight "${i}" has a non-numeric value, ignoring it`);continue}t.set(i,r)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?Se(t):null,this.requestUpdate(),await this.updateComplete,$(this,"cito-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let i=e.items.find(r=>r.identifier===this.identifier);if(i)return i}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Ie([p({type:String})],qt.prototype,"category",void 0);Ie([p({type:String})],qt.prototype,"identifier",void 0);Ie([p({type:Boolean,converter:Nd})],qt.prototype,"required",void 0);Ie([p({type:Boolean,converter:Nd})],qt.prototype,"fixed",void 0);Ie([p({type:String})],qt.prototype,"href",void 0);Ie([_(),I({context:F,subscribe:!0})],qt.prototype,"computedContext",void 0);Ie([p({type:Object,attribute:!1})],qt.prototype,"xmlDoc",void 0);Ie([I({context:Te,subscribe:!0})],qt.prototype,"testHost",void 0);var _e=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},xl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},kt=class extends k{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 v`<slot name="qti-rubric-block"></slot><slot></slot>`}};_e([p({type:String})],kt.prototype,"identifier",void 0);_e([p({type:String})],kt.prototype,"required",void 0);_e([p({type:Boolean,converter:xl})],kt.prototype,"fixed",void 0);_e([p({type:Boolean,converter:xl})],kt.prototype,"visible",void 0);_e([p({type:Boolean,converter:xl,attribute:"keep-together"})],kt.prototype,"keepTogether",void 0);_e([p({type:String,attribute:"navigation-mode"})],kt.prototype,"navigationMode",void 0);_e([p({type:String,attribute:"submission-mode"})],kt.prototype,"submissionMode",void 0);_e([I({context:ot,subscribe:!0})],kt.prototype,"_testContext",void 0);var ql=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},oi=class extends k{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,"cito-test-loaded",this)}render(){return v` <slot></slot>`}};ql([p({type:String})],oi.prototype,"identifier",void 0);ql([p({type:String})],oi.prototype,"title",null);ql([I({context:ot,subscribe:!0})],oi.prototype,"_testContext",void 0);function lo(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let i=e.calculate();return i===!0||i==="true"}catch(i){return console.warn(`<${o.localName}> could not evaluate its expression`,i),t}}var xm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},de=class extends k{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=q`
|
|
64
64
|
:host {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
`}evaluate(){return
|
|
67
|
+
`}evaluate(){return lo(this,!1)}render(){return v`<slot></slot>`}};xm([p({type:String})],de.prototype,"target",void 0);var si=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},$i={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends k{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 v`<slot></slot>`}};si([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);si([p({type:Boolean,converter:$i,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);si([p({type:Boolean,converter:$i,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);si([p({type:Boolean,converter:$i,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);si([p({type:Boolean,converter:$i,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);si([p({type:Boolean,converter:$i,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);si([p({type:Boolean,converter:$i,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var kl=o=>o?.split(/\s+/).filter(Boolean)??[],Li=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:kl(o.getAttribute("include-category")),excludeCategories:kl(o.getAttribute("exclude-category"))}),zi=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:i})=>{let r=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return r.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):r.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=kl(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||i.length>0&&s.some(a=>i.includes(a)))})};var qm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Wn=class extends E{#t=null;constructor(){super(),B(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(i=>{let r=i.variables?.find(n=>n.identifier==="completionStatus")?.value;return r!=null&&r!=="not_attempted"}).map(i=>i.identifier));return zi(t,Li(this)).filter(i=>e.has(i.identifier)).length}calculate(){return this.getResult()}};qm([I({context:ot,subscribe:!0})],Wn.prototype,"_testContext",void 0);var co=class extends E{#t=null;constructor(){super(),B(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?zi(t,Li(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var ho=class extends k{static{this.styles=q`
|
|
68
68
|
:host {
|
|
69
69
|
display: none;
|
|
70
70
|
}
|
|
71
|
-
`}evaluate(){return
|
|
71
|
+
`}evaluate(){return lo(this,!0)}render(){return v`<slot></slot>`}};var po=class extends k{static{this.styles=[q`
|
|
72
72
|
:host {
|
|
73
73
|
display: none;
|
|
74
74
|
}
|
|
75
|
-
`]}render(){return v`<slot></slot>`}process(){let t=new ql,e=[...this.children];t.process(e)}},ql=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Nn))throw e}}};var an=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},mt=class extends k{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Sd},this.#n={...this._context,variables:this._context.variables},this.#i=new Map,this.#r=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,n=e.type==="template"?this.#i.get(e.identifier):void 0,r=n!==void 0?{...e,value:n}:e;this._context={...this._context,variables:[...this._context.variables,r]},this.#n=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:n}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#v(n,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:n=!1}=t.detail??{},r=[];n&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&r.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...r],this.#w(!1)),n&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#f=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:n}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,n??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:n}=t.detail;this.updateCorrectResponse(e,n??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:n,state:r}=t.detail;this.updateResponseVariable(e,n),r!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:r}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),n=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||n)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...n?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(i=>!("identifier"in i))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,n=t.filter(i=>i.value!==null&&i.value!==void 0&&(i.type==="template"||e.some(s=>s.identifier===i.identifier&&s.type==="template")));n.forEach(i=>this.#i.set(i.identifier,i.value));let r=n.some(i=>JSON.stringify(e.find(s=>s.identifier===i.identifier)?.value)!==JSON.stringify(i.value));this._context={...this._context,variables:this._context.variables.map(i=>{let s=t.find(a=>a.identifier===i.identifier);return s?{...i,...s,interpolationTable:i.interpolationTable,matchTable:i.matchTable}:i})},this.#r&&r&&this.#g(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#m()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#n;#i;#r;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let r=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);r&&(r.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#m(),Yt(this,"cito-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#h()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("cito-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#f),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("cito-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#f),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#f;#d;#u;async#h(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#r=!0,this.#g()}#g(){this.#e&&(this.#e.process(),this.#n={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#v(t,e)}#v(t,e,n){this.#w(e),this.#b(n);let r=+this.getVariable("numAttempts")?.value+(t?1:0),i=this.querySelector("qti-response-processing");if(typeof i?.processResponse=="function"){try{i.processResponse({numAttempts:r})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(r)}]),s}return!0}return Yt(this,"cito-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(r)}],responseProcessed:!0}),!1}#b(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),n=>n.getAttribute("response-identifier")).filter(n=>n&&n!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(n=>e.includes(n.identifier)?{...n,value:"false"}:n)})}resetResponses(){this._context=this.#n,this.isConnected&&this.#m()}#m(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:e})},this.afterResponseVariableUpdated(),Yt(this,"cito-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let n=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!n){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let r=n.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:r})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let n=this.getResponse(t);if(!n){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let r=n.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,correctResponse:r})},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){this.#y([{identifier:t,value:e}])}#y(t,e){let n=new Map;for(let{identifier:i,value:s}of t){let a=this.getVariable(i);if(!a){console.warn(`Can not set qti-outcome-identifier: ${i}, it is not available`);continue}n.set(i,a.cardinality==="single"||Array.isArray(s)?s:[s])}let r=e!==void 0&&e!==this._context.valid;if(!(n.size===0&&!r)&&(this._context={...this._context,...r?{valid:e}:{},variables:this._context.variables.map(i=>n.has(i.identifier)?{...i,value:n.get(i.identifier)}:i)},n.size>0)){for(let[i,s]of n)Yt(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:i,value:s});Yt(this,"cito-item-outcomes-changed",{item:this.identifier,outcomes:[...n].map(([i,s])=>({identifier:i,value:s}))})}}validate(t=!0){let e=this.#w(t);return this.#x(e),e}#w(t){let e=this.interactionElements.every(n=>n.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};an([p({type:String})],mt.prototype,"identifier",void 0);an([p({type:String})],mt.prototype,"adaptive",void 0);an([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);an([p({type:String})],mt.prototype,"title",null);an([p({type:Boolean})],mt.prototype,"disabled",void 0);an([p({type:Boolean})],mt.prototype,"readonly",void 0);an([H({context:j})],mt.prototype,"_context",void 0);var Nd=q`
|
|
75
|
+
`]}render(){return v`<slot></slot>`}process(){let t=new Cl,e=[...this.children];t.process(e)}},Cl=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Ni))throw e}}};var ai=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},mt=class extends k{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Ed},this.#i={...this._context,variables:this._context.variables},this.#n=new Map,this.#r=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,i=e.type==="template"?this.#n.get(e.identifier):void 0,r=i!==void 0?{...e,value:i}:e;this._context={...this._context,variables:[...this._context.variables,r]},this.#i=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:i}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#v(i,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:i=!1}=t.detail??{},r=[];i&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&r.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...r],this.#w(!1)),i&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#f=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:i}=t.detail;this.#n.has(e)||this.updateTemplateVariable(e,i??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:i}=t.detail;this.updateCorrectResponse(e,i??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:i,state:r}=t.detail;this.updateResponseVariable(e,i),r!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:r}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),i=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||i)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...i?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,i=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));i.forEach(n=>this.#n.set(n.identifier,n.value));let r=i.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#r&&r&&this.#g(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#m()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#i;#n;#r;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let r=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);r&&(r.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#m(),xt(this,"cito-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#h()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("cito-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#f),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("cito-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#f),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#f;#d;#u;async#h(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#r=!0,this.#g()}#g(){this.#e&&(this.#e.process(),this.#i={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#v(t,e)}#v(t,e,i){this.#w(e),this.#b(i);let r=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:r})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(r)}]),s}return!0}return xt(this,"cito-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(r)}],responseProcessed:!0}),!1}#b(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),i=>i.getAttribute("response-identifier")).filter(i=>i&&i!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(i=>e.includes(i.identifier)?{...i,value:"false"}:i)})}resetResponses(){this._context=this.#i,this.isConnected&&this.#m()}#m(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}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(i=>i.identifier!==t?i:{...i,value:e})},this.afterResponseVariableUpdated(),xt(this,"cito-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let i=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!i){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let r=i.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(n=>n.identifier!==t?n:{...n,value:r})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let i=this.getResponse(t);if(!i){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let r=i.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(n=>n.identifier!==t?n:{...n,correctResponse:r})},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){this.#y([{identifier:t,value:e}])}#y(t,e){let i=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}i.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let r=e!==void 0&&e!==this._context.valid;if(!(i.size===0&&!r)&&(this._context={...this._context,...r?{valid:e}:{},variables:this._context.variables.map(n=>i.has(n.identifier)?{...n,value:i.get(n.identifier)}:n)},i.size>0)){for(let[n,s]of i)xt(this,"cito-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"cito-item-outcomes-changed",{item:this.identifier,outcomes:[...i].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#w(t);return this.#x(e),e}#w(t){let e=this.interactionElements.every(i=>i.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};ai([p({type:String})],mt.prototype,"identifier",void 0);ai([p({type:String})],mt.prototype,"adaptive",void 0);ai([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);ai([p({type:String})],mt.prototype,"title",null);ai([p({type:Boolean})],mt.prototype,"disabled",void 0);ai([p({type:Boolean})],mt.prototype,"readonly",void 0);ai([H({context:j})],mt.prototype,"_context",void 0);var $d=q`
|
|
76
76
|
:host {
|
|
77
77
|
display: contents;
|
|
78
78
|
}
|
|
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
80
80
|
::slotted(qti-catalog-info) {
|
|
81
81
|
display: none;
|
|
82
82
|
}
|
|
83
|
-
`;var po=class extends k{static{this.styles=Nd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function $d(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let n=document.createComment(e.textContent);e.replaceChild(n,e.firstChild)})}async function Ld(o,t,e,n="qti-portable-custom-interaction"){let r=[],i=o.querySelectorAll(n);if(i.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(i)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&r.includes(d)&&(d=d+r.length,c.setAttribute("custom-interaction-type-identifier",d),r.push(d)),d&&r.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}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){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 l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,w)=>{let T=u.length>w?u[w]:"";return{primaryPath:b,fallbackPath:T}});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 zd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=jd(i,s);i.replaceWith(a)})}function Vd(o,t){o.querySelectorAll("*").forEach(e=>{let n=e.classList;n&&n.forEach(r=>{if(r.startsWith(`${t}:`)){let i=r.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=jd(e,s);e.replaceWith(a)}})})}function jd(o,t){let e=o.ownerDocument.createElement(t);for(let n of o.attributes)e.setAttribute(n.name,n.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Fd(o,t){let e=["hook","module"],n=t.substring(0,t.lastIndexOf("/"));for(let r of e)o.querySelectorAll("["+r+"]").forEach(s=>{let a=s.getAttribute(r);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",n+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var kl=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=xm(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=wm(`${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 uo(o){return kl.fromSeedKey(o)}function wm(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 Bd(t)}function xm(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 Bd(t)}function Bd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var qm=o=>typeof o=="function"?o():o.random();function mo(o,t){let e=o.filter(r=>!r.fixed);for(let r=e.length-1;r>0;r--){let i=Math.floor(qm(t)*(r+1));[e[r],e[i]]=[e[i],e[r]]}let n=0;return o.map(r=>r.fixed?r:e[n++])}function km(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 Cl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),n=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),r=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of n){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=km(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=r?uo(`${t}:${i}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=mo(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),y);for(let w of x)w.remove();for(let{element:w}of b)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function Ud(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Hd=!1;function fo(o,t){Hd||(Hd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Cm(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 Wd(o,t){let n=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),r=n.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??n.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(r)throw new Error(t(Cm(r)));return n}function Vn(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=>Wd(e,n=>`is not well-formed XML: ${n}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function jn(o){return Wd(o,t=>`Failed to parse XML: ${t}`)}function Qd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let n=o,r;!n.namespaceURI||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||n.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?r=e?t.createElement(n.localName,{customElementRegistry:e}):t.createElement(n.localName):r=t.createElementNS(n.namespaceURI,n.tagName);for(let i=0;i<n.attributes.length;i++){let s=n.attributes[i];r.setAttribute(s.localName,s.value)}for(let i=0;i<n.childNodes.length;i++)r.appendChild(Qd(n.childNodes[i],t,e));return r}return o.cloneNode(!1)}function Fn(o,t){let e=document.createDocumentFragment();for(let n=0;n<o.childNodes.length;n++)e.appendChild(Qd(o.childNodes[n],document,t));return e}function Bn(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(n=>{for(let r of["src","href","srcset","poster"]){let i=n.getAttribute(r)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);n.setAttribute(r,s)}}})}var Jt=()=>{let o,t="",e={load(n,r){return t=n,Vn(n,r).then(i=>(o=i,e))},parse(n){return o=jn(n),t="",e},path:n=>(Bn(o,n),t=null,e),fn(n){return n(o),e},pciHooks(n){return Fd(o,n),e},async configurePci(n,r,i="qti-portable-custom-interaction"){return await Ld(o,n,r,i),e},shuffleInteractions(n){let r=typeof n=="string"?n.trim():n;if(r==null||r===""){let i=t||"default-item-seed";return fo("qtiTransformItem",i),Cl(o,i),e}return Cl(o,r),e},extendElementName:(n,r)=>(zd(o,n,r),e),extendElementsWithClass:(n="extend")=>(Vd(o,n),e),customInteraction(n,r){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",n),i.setAttribute("data-base-item",n+r),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return $d(o),e},stripStyleSheets(){return Ud(o),e},html(){return t!==null&&Bn(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Fn(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return t!==null&&Bn(o,t.substring(0,t.lastIndexOf("/"))),Fn(o,n)},xmlDoc(){return o}};return e};var Gd=()=>{let o,t={async load(e,n){return o=await Vn(e,n),t},parse(e){o=jn(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Xd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let n=e.getAttribute("identifier"),r=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:n,href:r,category:i})}),t}var go=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Yd=o=>go(o,"qti-assessment-item-ref","assessmentitemref"),Qi=o=>go(o,"qti-assessment-section","assessmentsection"),Wi=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="true"||n==="1"}),Sm=(o,...t)=>t.some(e=>{let n=(o.getAttribute(e)??"").trim().toLowerCase();return n==="false"||n==="0"}),Sl=o=>go(o,"qti-ordering","ordering"),Em=o=>go(o,"qti-selection","selection"),Am=o=>Array.from(o.children).filter(t=>Sl(t)&&Wi(t,"shuffle")),Tm=(o,t)=>uo(`${o}:${t}`);function Im(o){let t=[],e=[],n=r=>{for(let i of Array.from(r.children))Yd(i)?t.push(i):Qi(i)?n(i):!Sl(i)&&!Em(i)&&e.push(i.localName)};return n(o),{itemRefs:t,dropped:e}}function _m(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Jd(o,t){for(let l of Array.from(o.children))Qi(l)&&Jd(l,t);let e=Am(o);if(e.length===0)return;let n=[],r=[];for(let l of Array.from(o.children))if(Yd(l))n.push({nodes:[l],fixed:Wi(l,"fixed")}),r.push(l);else if(Qi(l)){let{itemRefs:c,dropped:d}=Im(l);if(_m(l,d),Sm(l,"keep-together","keeptogether"))for(let h of c)n.push({nodes:[h],fixed:Wi(h,"fixed")});else c.length>0&&n.push({nodes:c,fixed:Wi(l,"fixed")});r.push(l)}let i=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=mo(n,Tm(t,s));for(let l of r)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,i);for(let l of e)l.remove()}function Kd(o){return Array.from(o.getElementsByTagName("*")).some(t=>Sl(t)&&Wi(t,"shuffle"))}function El(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(n=>Qi(n));for(let n of e){if(!n.parentNode)continue;let r=n.parentElement;r&&Qi(r)||Jd(n,t)}}var Un=()=>{let o,t="",e={async load(n,r){return o=await Vn(n,r),t=n,e.path(n.substring(0,n.lastIndexOf("/"))),e},parse(n){return o=jn(n),t="",e},path:n=>(Bn(o,n),e),fn(n){return n(o),e},shuffleOrdering(n){if(!Kd(o))return e;let r=typeof n=="string"?n.trim():n;if(r==null||r===""){let i=t||"default-test-seed";return fo("qtiTransformTest",i),El(o,i),e}return El(o,r),e},items(){return Xd(o)},html(){return new XMLSerializer().serializeToString(Fn(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(n){return Fn(o,n)},xmlDoc(){return o}};return e};var Zd=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Al=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}},Hn=class extends k{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Al(this,t);this.dispatchEvent(e);let n=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&n&&await this.updateStimulusRef(n)}async updateStimulusRef(t){let n=(await Jt().load(this.href).then(r=>r.htmlDoc()))?.querySelector("qti-assessment-stimulus");n&&(t.innerHTML="",t.append(n))}};Zd([p({type:String})],Hn.prototype,"identifier",void 0);Zd([p({type:String})],Hn.prototype,"href",void 0);var bo=class extends k{};var Rm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Gi=class extends k{render(){return v`<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(r=>r.type==="template");for(let r of e){let i=r;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let n=Array.from(this.querySelectorAll("*")).filter(r=>r.localName.toLowerCase()==="mi"||r.localName.toLowerCase()==="mn");for(let r of n){let i=r.getAttribute("data-qti-math-variable-source")??r.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(r.localName.toLowerCase()==="mn"){r.textContent=s,r.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),r.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Rm([I({context:j,subscribe:!0}),_()],Gi.prototype,"context",void 0);var th=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Wn=class extends k{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
83
|
+
`;var uo=class extends k{static{this.styles=$d}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function Ld(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let i=document.createComment(e.textContent);e.replaceChild(i,e.firstChild)})}async function zd(o,t,e,i="qti-portable-custom-interaction"){let r=[],n=o.querySelectorAll(i);if(n.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(n)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&r.includes(d)&&(d=d+r.length,c.setAttribute("custom-interaction-type-identifier",d),r.push(d)),d&&r.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}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){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 l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,w)=>{let T=u.length>w?u[w]:"";return{primaryPath:b,fallbackPath:T}});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 Vd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=Fd(n,s);n.replaceWith(a)})}function jd(o,t){o.querySelectorAll("*").forEach(e=>{let i=e.classList;i&&i.forEach(r=>{if(r.startsWith(`${t}:`)){let n=r.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=Fd(e,s);e.replaceWith(a)}})})}function Fd(o,t){let e=o.ownerDocument.createElement(t);for(let i of o.attributes)e.setAttribute(i.name,i.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Bd(o,t){let e=["hook","module"],i=t.substring(0,t.lastIndexOf("/"));for(let r of e)o.querySelectorAll("["+r+"]").forEach(s=>{let a=s.getAttribute(r);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",i+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Sl=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Cm(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=km(`${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 mo(o){return Sl.fromSeedKey(o)}function km(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 Ud(t)}function Cm(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return Ud(t)}function Ud(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Sm=o=>typeof o=="function"?o():o.random();function fo(o,t){let e=o.filter(r=>!r.fixed);for(let r=e.length-1;r>0;r--){let n=Math.floor(Sm(t)*(r+1));[e[r],e[n]]=[e[n],e[r]]}let i=0;return o.map(r=>r.fixed?r:e[i++])}function Em(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 El(o,t){let e=o.querySelectorAll('[shuffle="true"]'),i=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),r=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of i){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Em(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=r?mo(`${t}:${n}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(w=>w.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=fo(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),y);for(let w of x)w.remove();for(let{element:w}of b)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function Hd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Am={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},Wd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function Qd(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),i=>[i.getAttribute("identifier"),i])),e=[];for(let[i,r]of Object.entries(Am))for(let n of Array.from(o.querySelectorAll(i))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let l=`${i} (response "${s}")`,c=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(c&&!r.cardinalities.includes(c))e.push(`${l}: ${c} cardinality is not permitted; it must be ${Wd(r.cardinalities)}`);else if(c&&r.max&&c!=="multiple"){let h=n.getAttribute(r.max.attribute),f=h===null?r.max.default:Number(h);(f===0||f>1)&&e.push(`${l}: ${r.max.attribute} ${f} requires multiple cardinality, not ${c}`)}c!=="record"&&d&&!r.baseTypes.includes(d)&&e.push(`${l}: base-type ${d} is not permitted; it must be ${Wd(r.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var Gd=!1;function go(o,t){Gd||(Gd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Tm(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 Xd(o,t){let i=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),r=i.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??i.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(r)throw new Error(t(Tm(r)));return i}function Vi(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=>Xd(e,i=>`is not well-formed XML: ${i}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function ji(o){return Xd(o,t=>`Failed to parse XML: ${t}`)}function Yd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let i=o,r;!i.namespaceURI||i.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||i.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?r=e?t.createElement(i.localName,{customElementRegistry:e}):t.createElement(i.localName):r=t.createElementNS(i.namespaceURI,i.tagName);for(let n=0;n<i.attributes.length;n++){let s=i.attributes[n];r.setAttribute(s.localName,s.value)}for(let n=0;n<i.childNodes.length;n++)r.appendChild(Yd(i.childNodes[n],t,e));return r}return o.cloneNode(!1)}function Fi(o,t){let e=document.createDocumentFragment();for(let i=0;i<o.childNodes.length;i++)e.appendChild(Yd(o.childNodes[i],document,t));return e}function Bi(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(i=>{for(let r of["src","href","srcset","poster"]){let n=i.getAttribute(r)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);i.setAttribute(r,s)}}})}var Jt=()=>{let o,t="",e={load(i,r){return t=i,Vi(i,r).then(n=>(o=n,e))},parse(i){return o=ji(i),t="",e},path:i=>(Bi(o,i),t=null,e),fn(i){return i(o),e},pciHooks(i){return Bd(o,i),e},async configurePci(i,r,n="qti-portable-custom-interaction"){return await zd(o,i,r,n),e},shuffleInteractions(i){let r=typeof i=="string"?i.trim():i;if(r==null||r===""){let n=t||"default-item-seed";return go("qtiTransformItem",n),El(o,n),e}return El(o,r),e},extendElementName:(i,r)=>(Vd(o,i,r),e),extendElementsWithClass:(i="extend")=>(jd(o,i),e),customInteraction(i,r){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+r),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return Ld(o),e},stripStyleSheets(){return Hd(o),e},validateBindings(){return Qd(o),e},html(){return t!==null&&Bi(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Fi(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return t!==null&&Bi(o,t.substring(0,t.lastIndexOf("/"))),Fi(o,i)},xmlDoc(){return o}};return e};var Jd=()=>{let o,t={async load(e,i){return o=await Vi(e,i),t},parse(e){o=ji(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Kd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let i=e.getAttribute("identifier"),r=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:i,href:r,category:n})}),t}var bo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Zd=o=>bo(o,"qti-assessment-item-ref","assessmentitemref"),Gn=o=>bo(o,"qti-assessment-section","assessmentsection"),Qn=(o,...t)=>t.some(e=>{let i=(o.getAttribute(e)??"").trim().toLowerCase();return i==="true"||i==="1"}),Im=(o,...t)=>t.some(e=>{let i=(o.getAttribute(e)??"").trim().toLowerCase();return i==="false"||i==="0"}),Al=o=>bo(o,"qti-ordering","ordering"),_m=o=>bo(o,"qti-selection","selection"),Rm=o=>Array.from(o.children).filter(t=>Al(t)&&Qn(t,"shuffle")),Om=(o,t)=>mo(`${o}:${t}`);function Pm(o){let t=[],e=[],i=r=>{for(let n of Array.from(r.children))Zd(n)?t.push(n):Gn(n)?i(n):!Al(n)&&!_m(n)&&e.push(n.localName)};return i(o),{itemRefs:t,dropped:e}}function Mm(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 th(o,t){for(let l of Array.from(o.children))Gn(l)&&th(l,t);let e=Rm(o);if(e.length===0)return;let i=[],r=[];for(let l of Array.from(o.children))if(Zd(l))i.push({nodes:[l],fixed:Qn(l,"fixed")}),r.push(l);else if(Gn(l)){let{itemRefs:c,dropped:d}=Pm(l);if(Mm(l,d),Im(l,"keep-together","keeptogether"))for(let h of c)i.push({nodes:[h],fixed:Qn(h,"fixed")});else c.length>0&&i.push({nodes:c,fixed:Qn(l,"fixed")});r.push(l)}let n=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=fo(i,Om(t,s));for(let l of r)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,n);for(let l of e)l.remove()}function eh(o){return Array.from(o.getElementsByTagName("*")).some(t=>Al(t)&&Qn(t,"shuffle"))}function Tl(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(i=>Gn(i));for(let i of e){if(!i.parentNode)continue;let r=i.parentElement;r&&Gn(r)||th(i,t)}}var Ui=()=>{let o,t="",e={async load(i,r){return o=await Vi(i,r),t=i,e.path(i.substring(0,i.lastIndexOf("/"))),e},parse(i){return o=ji(i),t="",e},path:i=>(Bi(o,i),e),fn(i){return i(o),e},shuffleOrdering(i){if(!eh(o))return e;let r=typeof i=="string"?i.trim():i;if(r==null||r===""){let n=t||"default-test-seed";return go("qtiTransformTest",n),Tl(o,n),e}return Tl(o,r),e},items(){return Kd(o)},html(){return new XMLSerializer().serializeToString(Fi(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return Fi(o,i)},xmlDoc(){return o}};return e};var ih=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Il=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}},Hi=class extends k{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Il(this,t);this.dispatchEvent(e);let i=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(t){let i=(await Jt().load(this.href).then(r=>r.htmlDoc()))?.querySelector("qti-assessment-stimulus");i&&(t.innerHTML="",t.append(i))}};ih([p({type:String})],Hi.prototype,"identifier",void 0);ih([p({type:String})],Hi.prototype,"href",void 0);var vo=class extends k{};var Dm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Xn=class extends k{render(){return v`<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(r=>r.type==="template");for(let r of e){let n=r;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let i=Array.from(this.querySelectorAll("*")).filter(r=>r.localName.toLowerCase()==="mi"||r.localName.toLowerCase()==="mn");for(let r of i){let n=r.getAttribute("data-qti-math-variable-source")??r.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(r.localName.toLowerCase()==="mn"){r.textContent=s,r.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),r.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Dm([I({context:j,subscribe:!0}),_()],Xn.prototype,"context",void 0);var nh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Wi=class extends k{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
84
84
|
:host {
|
|
85
85
|
display: none;
|
|
86
86
|
}
|
|
87
|
-
`]}render(){return v`<slot></slot>`}};
|
|
87
|
+
`]}render(){return v`<slot></slot>`}};nh([p({type:String})],Wi.prototype,"identifier",void 0);nh([p({type:String})],Wi.prototype,"cardinality",void 0);var Nm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Yn=class extends k{#t;render(){return v`<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:r=>this._context?.variables.find(n=>n.identifier===r)?.value??"",correct:r=>this._context?.variables.find(n=>n.identifier===r)?.correctResponse??""},i={getVariable:r=>this._context?.variables.find(n=>n.identifier===r),updateOutcomeVariable:(r,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:n}}))}};return this.#t(this._context,e,i)}#e(t){let e=_d(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let i=Array.from(this.children).map(r=>{let n=r.calculate;return typeof n=="function"?n.call(r):null});return e(i)}};Nm([I({context:j,subscribe:!0}),_()],Yn.prototype,"_context",void 0);function he(o,t,e,i){let r=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:i,outcomeIdentifier:o.outcomeIdentifier,element:o,...r?{itemIdentifier:r}:{}};return xt(o,t,n,!0)}var yo=class extends ut{static{this.styles=q`
|
|
88
88
|
:host {
|
|
89
89
|
display: block;
|
|
90
90
|
}
|
|
@@ -94,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
94
94
|
.off {
|
|
95
95
|
display: none;
|
|
96
96
|
}
|
|
97
|
-
`}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Q=o=>o??P;var
|
|
97
|
+
`}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return he(this,"cito-feedback-show","block",this.identifier)}feedbackHiding(){return he(this,"cito-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Q=o=>o??P;var wo=class extends ut{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${Q(this.showStatus)}"></slot> `}static{this.styles=q`
|
|
98
98
|
.on {
|
|
99
99
|
display: inline-block;
|
|
100
100
|
}
|
|
101
101
|
.off {
|
|
102
102
|
display: none;
|
|
103
103
|
}
|
|
104
|
-
`}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var
|
|
104
|
+
`}feedbackShowing(){return he(this,"cito-feedback-show","inline",this.identifier)}feedbackHiding(){return he(this,"cito-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var rh=q`
|
|
105
105
|
:host {
|
|
106
106
|
display: block;
|
|
107
107
|
}
|
|
108
|
-
`;var
|
|
108
|
+
`;var xo=class extends k{static{this.styles=rh}render(){return v`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Qi=class extends ut{static{this.styles=q`
|
|
109
109
|
.cito-dialog {
|
|
110
110
|
background: var(--qti-bg);
|
|
111
111
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -150,15 +150,15 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
150
150
|
<button class="button close-button" @click="${this.closeFeedback}">Close</button>
|
|
151
151
|
</div>
|
|
152
152
|
</dialog>
|
|
153
|
-
`}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
|
|
153
|
+
`}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")}feedbackShowing(){return he(this,"cito-feedback-show","modal",this.identifier)}feedbackHiding(){return he(this,"cito-feedback-hide","modal",this.identifier)}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var Jn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},pe=class extends Mi{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
|
|
154
154
|
:host {
|
|
155
155
|
display: none;
|
|
156
156
|
}
|
|
157
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let
|
|
157
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let i of t.querySelectorAll("qti-interpolation-table-entry")){let r=parseFloat(i.getAttribute("source-value")),n=parseFloat(i.getAttribute("target-value"));if(Number.isNaN(r)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:r,targetValue:n,includeBoundary:i.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 i of t.querySelectorAll("qti-match-table-entry")){let r=parseFloat(i.getAttribute("source-value")),n=i.getAttribute("target-value");if(Number.isNaN(r)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(r,n)}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}}))}};Jn([p({type:String,attribute:"base-type"})],pe.prototype,"baseType",void 0);Jn([p({type:String,attribute:"external-scored"})],pe.prototype,"externalScored",void 0);Jn([p({type:String})],pe.prototype,"identifier",void 0);Jn([p({type:String})],pe.prototype,"cardinality",void 0);Jn([I({context:j,subscribe:!0}),_()],pe.prototype,"itemContext",void 0);var qo=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Re=class extends Mi{static{this.styles=[q`
|
|
158
158
|
:host {
|
|
159
159
|
display: none;
|
|
160
160
|
}
|
|
161
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:
|
|
161
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:i}=this.#t(),r={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...i?{fieldBaseTypes:i}:{},cardinality:this.cardinality||"single",mapping:this.#n,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};r.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:r}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#i};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:i,baseTypes:r}=Hn(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(i).length?i:void 0,fieldBaseTypes:r}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Hn(t);return Object.keys(e).length?e:null}get#i(){let t,e=this.querySelector("qti-correct-response");if(e){let i=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&i.length>0)t=i[0].textContent.trim(),i[0].remove();else if(this.cardinality!=="single"){t=[];for(let r=0;r<i.length;r++)t.push(i[r].textContent.trim()),i[r].remove()}}return t}get#n(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(i)?null:i,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,i=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound")),n=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(i)?null:i,upperBound:isNaN(r)?null:r,areaMapEntries:n}}};qo([p({type:String,attribute:"base-type"})],Re.prototype,"baseType",void 0);qo([p({type:String})],Re.prototype,"identifier",void 0);qo([p({type:String})],Re.prototype,"cardinality",void 0);qo([I({context:j,subscribe:!0}),_()],Re.prototype,"itemContext",void 0);var oh=`<qti-response-condition>
|
|
162
162
|
<qti-response-if>
|
|
163
163
|
<qti-match>
|
|
164
164
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -173,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
173
173
|
<qti-base-value base-type="float">0</qti-base-value>
|
|
174
174
|
</qti-set-outcome-value>
|
|
175
175
|
</qti-response-else>
|
|
176
|
-
</qti-response-condition>`,
|
|
176
|
+
</qti-response-condition>`,sh=`<qti-response-condition>
|
|
177
177
|
<qti-response-if>
|
|
178
178
|
<qti-is-null>
|
|
179
179
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -187,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
187
187
|
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
188
188
|
</qti-set-outcome-value>
|
|
189
189
|
</qti-response-else>
|
|
190
|
-
</qti-response-condition>`,
|
|
190
|
+
</qti-response-condition>`,ah=`<qti-response-condition>
|
|
191
191
|
<qti-response-if>
|
|
192
192
|
<qti-is-null>
|
|
193
193
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -201,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
201
201
|
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
202
202
|
</qti-set-outcome-value>
|
|
203
203
|
</qti-response-else>
|
|
204
|
-
</qti-response-condition>`;var
|
|
204
|
+
</qti-response-condition>`;var $m={map_response:sh,map_response_point:ah,match_correct:oh},ko=class extends k{static{this.styles=[q`
|
|
205
205
|
:host {
|
|
206
206
|
display: none;
|
|
207
207
|
}
|
|
208
|
-
`]}#t=new
|
|
208
|
+
`]}#t=new Wt(this,{context:j});#e;constructor(){super(),new ct(this,{context:j,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(r=>r.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:i}=t.detail;e.value=e.cardinality==="single"||Array.isArray(i)?i:[i]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let i=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let r of e.variables)r.identifier==="numAttempts"&&(r.value=String(t)),r.type==="outcome"&&i&&r.identifier!=="completionStatus"&&(r.value=Lm(r));this.#i(),xt(this,"cito-item-set-outcomes",{outcomes:e.variables.filter(r=>r.type==="outcome"||r.identifier==="numAttempts").map(({identifier:r,value:n})=>({identifier:r,value:n})),responseProcessed:!0})}#i(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Di))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let i=e.split("/").pop().replace(".xml",""),r=$m[i];r&&(this.innerHTML=r)}};function Lm(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function z(o,t){let e={waitUntilFirstUpdate:!1,...t};return(i,r)=>{let{update:n}=i,s=Array.isArray(o)?o:[o];i.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[r](d,h)}}),n.call(this,a)}}}var Gi={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Mt=o=>(...t)=>({_$litDirective$:o,values:t}),Oe=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:zm}=it,lh=o=>o,dh=o=>o===null||typeof o!="object"&&typeof o!="function";var hh=o=>o.strings===void 0,ch=()=>document.createComment(""),Xi=(o,t,e)=>{let i=o._$AA.parentNode,r=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=i.insertBefore(ch(),r),s=i.insertBefore(ch(),r);e=new zm(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(n!==r||a){let l=e._$AA;for(;l!==n;){let c=lh(l).nextSibling;lh(i).insertBefore(l,r),l=c}}}return e},Pe=(o,t,e=o)=>(o._$AI(t,e),o),Vm={},ph=(o,t=Vm)=>o._$AH=t,uh=o=>o._$AH,Co=o=>{o._$AR(),o._$AA.remove()};var Kn=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),Kn(i,t);return!0},So=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},mh=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),Bm(t)}};function jm(o){this._$AN!==void 0?(So(this),this._$AM=o,mh(this)):this._$AM=o}function Fm(o,t=!1,e=0){let i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let n=e;n<i.length;n++)Kn(i[n],!1),So(i[n]);else i!=null&&(Kn(i,!1),So(i));else Kn(this,o)}var Bm=o=>{o.type==Gi.CHILD&&(o._$AP??=Fm,o._$AQ??=jm)},Me=class extends Oe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),mh(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Kn(this,t),So(this))}setValue(t){if(hh(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 _l=class extends Me{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:i,element:r}=this;for(let n in e){let s=e[n];s!==i[n]&&(s===!0?r.setAttribute(n,""):s===!1?r.removeAttribute(n):s!=null?r.setAttribute(n,String(s)):r.removeAttribute(n))}}groom(t){let{prevData:e,element:i}=this;if(!e)return;let r=t?this.#t(t):{};for(let n in e)(!r||!(n in r))&&i.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,i])=>typeof i=="function"?!1:e==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},Y0=Mt(_l);var Zn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ue=class extends k{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!xt(this,"cito-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
|
|
209
209
|
:host {
|
|
210
210
|
display: block;
|
|
211
211
|
}
|
|
212
|
-
`}render(){return v`<slot></slot>`}};
|
|
212
|
+
`}render(){return v`<slot></slot>`}};Zn([p({type:String})],ue.prototype,"id",void 0);Zn([p({type:String})],ue.prototype,"use",void 0);Zn([p({type:String})],ue.prototype,"view",void 0);Zn([p({type:String,attribute:"class"})],ue.prototype,"classNames",void 0);Zn([z("classNames",{waitUntilFirstUpdate:!0})],ue.prototype,"handleclassNamesChange",null);var Eo=class extends k{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(i=>i.text()).then(i=>{let r=this.#e(i);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.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,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 Ao=class extends k{render(){return v`<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 tr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},me=class extends k{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`
|
|
213
213
|
:host {
|
|
214
214
|
display: none;
|
|
215
215
|
}
|
|
216
|
-
`]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#
|
|
216
|
+
`]}render(){return v`<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.#i(e)}#i(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}}};tr([p({type:String})],me.prototype,"identifier",void 0);tr([p({type:String})],me.prototype,"cardinality",void 0);tr([p({type:String,attribute:"base-type"})],me.prototype,"baseType",void 0);tr([p({type:Boolean,attribute:"math-variable"})],me.prototype,"mathVariable",void 0);tr([p({type:Boolean,attribute:"param-variable"})],me.prototype,"paramVariable",void 0);var To=class extends k{static{this.styles=[q`
|
|
217
217
|
:host {
|
|
218
218
|
display: none;
|
|
219
219
|
}
|
|
220
|
-
`]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,
|
|
220
|
+
`]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,i=!1;do{if(i=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let r=[...this.children];for(let n of r)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){i=!0;break}}else n.process()}catch(r){console.error("Error during template processing:",r);break}}while(i);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 fh=[{tag:"qti-assessment-item",ctor:mt},{tag:"qti-assessment-stimulus",ctor:uo},{tag:"qti-assessment-stimulus-ref",ctor:Hi},{tag:"qti-companion-materials-info",ctor:vo},{tag:"qti-content-body",ctor:Xn},{tag:"qti-context-declaration",ctor:Wi},{tag:"qti-custom-operator",ctor:Yn},{tag:"qti-feedback-block",ctor:yo},{tag:"qti-feedback-inline",ctor:wo},{tag:"qti-item-body",ctor:xo},{tag:"qti-modal-feedback",ctor:Qi},{tag:"qti-outcome-declaration",ctor:pe},{tag:"qti-response-declaration",ctor:Re},{tag:"qti-response-processing",ctor:ko},{tag:"qti-rubric-block",ctor:ue},{tag:"qti-stylesheet",ctor:Eo},{tag:"qti-template-constraint",ctor:Ao},{tag:"qti-template-declaration",ctor:me},{tag:"qti-template-processing",ctor:To}];var Um=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},er=class extends Qi{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=q`
|
|
221
221
|
:host {
|
|
222
222
|
color: gray;
|
|
223
223
|
}
|
|
224
|
-
`}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};Vm([p({type:String})],tr.prototype,"access",void 0);var To=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Me=class extends k{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 v` <slot></slot>`}};To([p({type:String})],Me.prototype,"identifier",void 0);To([p({type:String})],Me.prototype,"class",void 0);To([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);To([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);var jm=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},er=class extends E{#t=null;constructor(){super(),B(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",n=this.getAttribute("variable-identifier"),r=zn(t,Ln(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Il(this._testContext,n,r).calculate()}calculate(){return this.getResult()}};jm([I({context:ot,subscribe:!0})],er.prototype,"_testContext",void 0);var Il=class{constructor(t,e,n){this.testContext=t,this.itemVariable=e,this.includedItems=n}calculate(){let t=this.testContext?.items??[],e=0,n=[...new Set(this.includedItems.map(r=>r.item))];return t.forEach(r=>{if(n.includes(r.identifier)){let i=r.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===r.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var nr="qti-assessment-section",Io="qti-test-part",Mt=o=>o.identifier||o.getAttribute("identifier")||"";function uh(o,t){let e=o[t],n=t+1,r=Fm(e,o,t);if(r){let s=Bm(r,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Mt)};s>t?n=s:console.warn(`qti-branch-rule target "${r.target}" is not ahead of "${Mt(e)}", ignored`)}let i=o.slice(t+1,n).map(Mt);for(let s=n;s<o.length;s++){if(fh(o[s],e))return{id:Mt(o[s]),skipped:i};i.push(Mt(o[s]))}return{id:null,skipped:i}}function mh(o){let t=[];for(let e of o){if(fh(e,null))return{id:Mt(e),skipped:t};t.push(Mt(e))}return{id:null,skipped:t}}function Fm(o,t,e){let n=[o];for(let r=o.parentElement;r&&(r.localName===nr||r.localName===Io)&&!r.contains(t[e+1]??null);r=r.parentElement)n.push(r);for(let r of n)for(let i of r.querySelectorAll(":scope > qti-branch-rule"))if(i.evaluate?.())return i;return null}function Bm(o,t,e){let n=o.parentElement,r=i=>{if(!i)return null;let s=t.findLastIndex(a=>i.contains(a));return s+1<t.length?s+1:null};switch(o.target){case ce.EXIT_TEST:return null;case ce.EXIT_TESTPART:return r(n.closest(Io));case ce.EXIT_SECTION:{let i=n.localName===nr?n:n.closest(nr);return r(i??n)}default:{let i=t.findIndex(l=>Mt(l)===o.target);if(i>=0)return i;let s=[...n.closest("qti-assessment-test")?.querySelectorAll(`${nr}, ${Io}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function fh(o,t){let e=[o];for(let n=o.parentElement;n&&(n.localName===nr||n.localName===Io);n=n.parentElement)(!t||!n.contains(t))&&e.push(n);return e.every(n=>[...n.querySelectorAll(":scope > qti-pre-condition")].every(r=>r.evaluate?.()??!0))}var _o=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},gh=o=>{class t extends o{constructor(...n){super(...n),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(n,r){let i=r||this._getDefaultNavigationId(n);i&&$(this,"cito-test-navigate",{type:n,id:i})}_bindEventHandlers(){B(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"cito-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(n){this._testElement=n.detail,this._initializeNavigation()}_handleItemConnected(n){let r=n.detail;this._loadingState.connectedItems++;let i=r.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(n){n.preventDefault();let{element:r,item:i}=n;if(console.info("Stimulus ref connected:",{identifier:r.identifier,href:r.href,item:i.identifier}),this._loadedStimulusHrefs.has(r.href)){console.info("Stimulus already loaded, skipping:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(r.href)){console.info("Stimulus already loading, skipping duplicate:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(r.href),console.info("Starting stimulus load:",r.href);try{await this._loadStimulusRef(r,i),this._loadedStimulusHrefs.add(r.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",r.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${r.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(r.href)}}_getDefaultNavigationId(n){return n==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let n=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(r[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let i=mh(r);if(i.skipped.length&&$(this,"cito-test-items-skipped",{ids:i.skipped}),i.id===null){$(this,"cito-test-end-reached",{});return}n=i.id}}n&&this.navigateTo(this.navigate,n)}_isLinearNavigationRestricted(n,r){let i=this.sessionContext?.navItemRefId;if(!i||n==="item"&&r===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"),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===i);if(n==="item"){let f=d.findIndex(m=>m.identifier===r);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(n,r){if(n!=="item"||!this._testElement)return;let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=i.findIndex(l=>Mt(l)===this.sessionContext?.navItemRefId);if(s<0||!i[s+1]||Mt(i[s+1])!==r||i[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=uh(i,s);if(a.id!==r)return a}async _handleNavigationRequest({detail:n}){if(!n?.id)return;let r=this._resolveLinearNext(n.type,n.id);if(r?.id===null){r.skipped.length&&$(this,"cito-test-items-skipped",{ids:r.skipped}),$(this,"cito-test-end-reached",{});return}let i=r?.id??n.id;if(!r&&this._isLinearNavigationRestricted(n.type,i)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),n.type,n.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(n.type,i),this._activeController=a,await this._executeNavigation(n.type,i,s,a),r?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&$(this,"cito-test-items-skipped",{ids:r.skipped})}catch(l){this._handleNavigationError(l,n.type,i)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(n.type,i)}}_handleNavigationError(n,r,i){n.name!=="AbortError"&&this._dispatchError(this._createNavigationError(n,r,i))}async _executeNavigation(n,r,i,s){n==="item"?await this._navigateToItem(r,i,s):await this._navigateToSection(r,i,s)}async _navigateToItem(n,r,i){let s=this._findItemRef(n);this._updateSessionContext(s,n),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([n],r,i),await this._waitForLoadingComplete(r,i),!this._isStaleNavigation(r,i)&&this._dispatchTestLoaded(this._loadResults,"item",n)}async _navigateToSection(n,r,i){let a=this._findSection(n)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(n);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:n,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,r,i),await this._waitForLoadingComplete(r,i),!this._isStaleNavigation(r,i)&&this._dispatchTestLoaded(this._loadResults,"section",n)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let n=this._loadingState.connectedItems>=this._loadingState.expectedItems,r=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;n&&r&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(n,r){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(n,r))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(n,r){console.info("Loading stimulus:",n.href);let i=await this._loadStimulus(n.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,n,r)}_applyStimulusContent(n,r,i){if(!n){console.warn("No stimulus content to apply");return}let s=n.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=i.querySelector(`[data-stimulus-idref="${r.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${r.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(n,r,i){if(!this._testElement||n.length===0)return;let s=n.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,r,i)))).filter(Boolean);this._isStaleNavigation(r,i)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(n,r,i){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(n.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,n)),this._isStaleNavigation(r,i)?null:{itemRef:n,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${n.identifier} was aborted`),s;return console.warn(`Failed to load item ${n.identifier}:`,s),null}}async _loadStimulus(n){return(await Jt().load(n,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let n=this.querySelector("test-container");if(n)return n.customElementRegistry??void 0}_findItemRef(n){let r=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!r)throw new Error(`Item with identifier "${n}" not found`);return r}_findSection(n){return this._testElement?.querySelector(`qti-assessment-section[identifier="${n}"]`)||null}_updateSessionContext(n,r){let i=n.closest("qti-test-part")?.identifier,s=n.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:r}}_getSectionItemIds(n){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${n}"] > qti-assessment-item-ref`)).map(r=>r.identifier).filter(Boolean)}_clearLoadedItems(){let n=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(n||[]).forEach(r=>{r.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(n=>n.innerHTML="")}_isStaleNavigation(n,r){return r.signal.aborted||n!==this._navigationId}_createNavigationError(n,r,i){return{message:n.message||`Failed to load ${r}: ${i}`,details:n,itemId:r==="item"?i:void 0,sectionId:r==="section"?i:void 0}}_dispatchLoadingStarted(n,r){$(this,"cito-test-navigation-started",{type:n,id:r})}_dispatchLoadingEnded(n,r){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:n,id:r},bubbles:!0,composed:!0}))}_dispatchError(n){$(this,"cito-test-navigation-failed",n)}_dispatchTestLoaded(n,r,i){requestAnimationFrame(()=>{$(this,"cito-test-rendered",n.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),$(this,"cito-test-navigated",{type:r,id:i})})}}return _o([p({type:String})],t.prototype,"navigate",void 0),_o([p({type:Number})],t.prototype,"requestTimeout",void 0),_o([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),_o([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var bh=o=>{class t extends o{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"cito-test-switch-view",r=>{this.sessionContext={...this.sessionContext,view:r.detail},this._updateElementView()}),B(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",r=>{this._updateElementView(),this._setCorrectResponseVisibility(r.detail)})}willUpdate(n){super.willUpdate(n),n.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;i&&this.updateAssessmentItemView(i,this.sessionContext.view)}}_setCorrectResponseVisibility(n){this.updateAssessmentItemView(n,this.sessionContext.view)}updateAssessmentItemView(n,r){}}return t};var vh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},_l=o=>{class t extends o{constructor(...n){super(...n),this.testContext=cl,this.sessionContext=ll,this._updateItemInTestContext=r=>{let i=r.itemContext,s=i.identifier,a=i.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,i.valid);else{let c=[...r.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}r.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(r.state=l.state)}},this._initializeEventListeners()}updateItemVariables(n,r,i){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==n)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of r){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...i?{state:{...i}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(n)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===n)?.variables??[]],i&&(s.state=i))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=cl,this.sessionContext=ll}),B(this,"cito-test-loaded",n=>{this._testElement=n.detail;let r=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:r}}),this.addEventListener("qti-assessment-item-connected",n=>{let r=n.detail,i=r.closest("qti-assessment-item-ref")?.identifier;i&&(r.assessmentItemRefId=i),this._updateItemInTestContext(n.detail)}),this.addEventListener("qti-item-context-updated",n=>{this._updateItemVariablesInTestContext(n.detail.itemContext.identifier,n.detail.itemContext.variables,n.detail.itemContext.state,n.detail.itemContext.valid)})}_updateItemVariablesInTestContext(n,r,i,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:r.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...i!==void 0?{state:i?{...i}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(n,r){typeof r!="string"||r==="not_attempted"||this.testContext.items.find(a=>a.identifier===n)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==n?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:r}:l)})})}}return vh([p({attribute:!1,type:Object}),H({context:ot})],t.prototype,"testContext",void 0),vh([p({attribute:!1,type:Object}),H({context:Ee})],t.prototype,"sessionContext",void 0),t},yh=class extends _l(k){};var Ro=1;var Rl=o=>Array.isArray(o)?[...o]:o??null,Um=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},Hm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(n=>({identifier:n.identifier,...n.type?{type:n.type}:{},value:Rl(n.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Rl(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),wh=o=>{class t extends o{#t=null;#e=!1;#n=null;constructor(...n){super(...n),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#n=null}),B(this,"cito-test-update-plugin-state",({detail:r})=>this.#i(r)),B(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}#i({plugin:n,value:r}){if(typeof n!="string"||n==="")return;let{[n]:i,...s}=this.sessionContext.plugins??{},a=s;if(r!=null)try{a={...s,[n]:JSON.parse(JSON.stringify(r))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${n}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Hm(this.testContext,this.sessionContext)}set state(n){if(!Um(n)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=n;return}let{navItemRefId:r,navSectionId:i}=this.sessionContext;this.#r(n);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==r?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==i&&this.#s("section",s.navSectionId)}updated(n){if(super.updated(n),!this.#e||!(n.has("testContext")||n.has("sessionContext")))return;let r=this.state,i=JSON.stringify(r);i!==this.#n&&(this.#n=i,$(this,"cito-test-state-changed",r))}#r(n){for(let i of n.test.items)this.updateItemVariables(i.identifier,i.variables,i.state);let r=new Map(n.test.outcomes.map(i=>[i.identifier,i.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>r.has(i.identifier)?{...i,value:Rl(r.get(i.identifier))}:i)},this.sessionContext={...this.sessionContext,...this.#o(n.session),plugins:n.session.plugins&&typeof n.session.plugins=="object"?{...n.session.plugins}:{}}}#o(n){let r=(i,s)=>!!s&&!!this._testElement?.querySelector(`${i}[identifier="${CSS.escape(s)}"]`);return{...r("qti-test-part",n.navPartId)?{navPartId:n.navPartId}:{},...r("qti-assessment-section",n.navSectionId)?{navSectionId:n.navSectionId}:{},...this.testContext.items.some(i=>i.identifier===n.navItemRefId)?{navItemRefId:n.navItemRefId}:{}}}#s(n,r){$(this,"cito-test-navigate",{type:n,id:r})}}return t};var xh=o=>{class t extends o{constructor(...n){super(...n),this.addEventListener("qti-register-variable",r=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],r.detail.variable]},r.stopPropagation()}),B(this,"cito-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",r=>{let{outcomeIdentifier:i,value:s}=r.detail;this.updateOutcomeVariable(i,s),r.stopPropagation()})}outcomeProcessing(){let n=(this._testElement??this).querySelector("qti-outcome-processing");return n?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>({...r,value:r.defaultValue??null}))},n.process(),!0):!1}submit(){return this.outcomeProcessing()?($(this,"cito-test-submitted",{}),!0):!1}getTestFeedback(n){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(i=>(!n||i.access===n)&&i.matches(this.getOutcome(i.outcomeIdentifier)?.value))}updateOutcomeVariable(n,r){let i=this.getOutcome(n);if(!i){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:i.cardinality==="single"?r:[...s.value,r]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(r=>r.identifier===n)||null}}return t};var qh=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},De=class extends gh(bh(xh(wh(_l(k))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ht(this,{context:Ae,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};qh([_(),H({context:yt})],De.prototype,"configContext",void 0);qh([_(),H({context:wt})],De.prototype,"qtiContext",void 0);var Oo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Po=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 kh=o=>!ah(o)&&typeof o.then=="function",Ch=1073741823,Ol=class extends Pe{constructor(){super(...arguments),this._$Cwt=Ch,this._$Cbt=[],this._$CK=new Oo(this),this._$CX=new Po}render(...t){return t.find(e=>!kh(e))??rt}update(t,e){let n=this._$Cbt,r=n.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 l=e[a];if(!kh(l))return this._$Cwt=a,l;a<r&&l===n[a]||(this._$Cwt=Ch,r=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=i.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return rt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Mo=Pt(Ol);var Do=`
|
|
224
|
+
`}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};Um([p({type:String})],er.prototype,"access",void 0);var Io=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},De=class extends k{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 v` <slot></slot>`}};Io([p({type:String})],De.prototype,"identifier",void 0);Io([p({type:String})],De.prototype,"class",void 0);Io([p({type:String,attribute:"navigation-mode"})],De.prototype,"navigationMode",void 0);Io([p({type:String,attribute:"submission-mode"})],De.prototype,"submissionMode",void 0);var Hm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ir=class extends E{#t=null;constructor(){super(),B(this,"cito-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),r=zi(t,Li(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Rl(this._testContext,i,r).calculate()}calculate(){return this.getResult()}};Hm([I({context:ot,subscribe:!0})],ir.prototype,"_testContext",void 0);var Rl=class{constructor(t,e,i){this.testContext=t,this.itemVariable=e,this.includedItems=i}calculate(){let t=this.testContext?.items??[],e=0,i=[...new Set(this.includedItems.map(r=>r.item))];return t.forEach(r=>{if(i.includes(r.identifier)){let n=r.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===r.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var nr="qti-assessment-section",_o="qti-test-part",Dt=o=>o.identifier||o.getAttribute("identifier")||"";function gh(o,t){let e=o[t],i=t+1,r=Wm(e,o,t);if(r){let s=Qm(r,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Dt)};s>t?i=s:console.warn(`qti-branch-rule target "${r.target}" is not ahead of "${Dt(e)}", ignored`)}let n=o.slice(t+1,i).map(Dt);for(let s=i;s<o.length;s++){if(vh(o[s],e))return{id:Dt(o[s]),skipped:n};n.push(Dt(o[s]))}return{id:null,skipped:n}}function bh(o){let t=[];for(let e of o){if(vh(e,null))return{id:Dt(e),skipped:t};t.push(Dt(e))}return{id:null,skipped:t}}function Wm(o,t,e){let i=[o];for(let r=o.parentElement;r&&(r.localName===nr||r.localName===_o)&&!r.contains(t[e+1]??null);r=r.parentElement)i.push(r);for(let r of i)for(let n of r.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function Qm(o,t,e){let i=o.parentElement,r=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case de.EXIT_TEST:return null;case de.EXIT_TESTPART:return r(i.closest(_o));case de.EXIT_SECTION:{let n=i.localName===nr?i:i.closest(nr);return r(n??i)}default:{let n=t.findIndex(l=>Dt(l)===o.target);if(n>=0)return n;let s=[...i.closest("qti-assessment-test")?.querySelectorAll(`${nr}, ${_o}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function vh(o,t){let e=[o];for(let i=o.parentElement;i&&(i.localName===nr||i.localName===_o);i=i.parentElement)(!t||!i.contains(t))&&e.push(i);return e.every(i=>[...i.querySelectorAll(":scope > qti-pre-condition")].every(r=>r.evaluate?.()??!0))}var Ro=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},yh=o=>{class t extends o{constructor(...i){super(...i),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(i,r){let n=r||this._getDefaultNavigationId(i);n&&$(this,"cito-test-navigate",{type:i,id:n})}_bindEventHandlers(){B(this,"cito-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"cito-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let r=i.detail;this._loadingState.connectedItems++;let n=r.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:r,item:n}=i;if(console.info("Stimulus ref connected:",{identifier:r.identifier,href:r.href,item:n.identifier}),this._loadedStimulusHrefs.has(r.href)){console.info("Stimulus already loaded, skipping:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(r.href)){console.info("Stimulus already loading, skipping duplicate:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(r.href),console.info("Starting stimulus load:",r.href);try{await this._loadStimulusRef(r,n),this._loadedStimulusHrefs.add(r.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",r.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${r.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(r.href)}}_getDefaultNavigationId(i){return i==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(r[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=bh(r);if(n.skipped.length&&$(this,"cito-test-items-skipped",{ids:n.skipped}),n.id===null){$(this,"cito-test-end-reached",{});return}i=n.id}}i&&this.navigateTo(this.navigate,i)}_isLinearNavigationRestricted(i,r){let n=this.sessionContext?.navItemRefId;if(!n||i==="item"&&r===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);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===n);if(i==="item"){let f=d.findIndex(m=>m.identifier===r);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(i,r){if(i!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(l=>Dt(l)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Dt(n[s+1])!==r||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=gh(n,s);if(a.id!==r)return a}async _handleNavigationRequest({detail:i}){if(!i?.id)return;let r=this._resolveLinearNext(i.type,i.id);if(r?.id===null){r.skipped.length&&$(this,"cito-test-items-skipped",{ids:r.skipped}),$(this,"cito-test-end-reached",{});return}let n=r?.id??i.id;if(!r&&this._isLinearNavigationRestricted(i.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),i.type,i.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(i.type,n),this._activeController=a,await this._executeNavigation(i.type,n,s,a),r?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&$(this,"cito-test-items-skipped",{ids:r.skipped})}catch(l){this._handleNavigationError(l,i.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(i.type,n)}}_handleNavigationError(i,r,n){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,r,n))}async _executeNavigation(i,r,n,s){i==="item"?await this._navigateToItem(r,n,s):await this._navigateToSection(r,n,s)}async _navigateToItem(i,r,n){let s=this._findItemRef(i);this._updateSessionContext(s,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],r,n),await this._waitForLoadingComplete(r,n),!this._isStaleNavigation(r,n)&&this._dispatchTestLoaded(this._loadResults,"item",i)}async _navigateToSection(i,r,n){let a=this._findSection(i)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(i);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:i,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,r,n),await this._waitForLoadingComplete(r,n),!this._isStaleNavigation(r,n)&&this._dispatchTestLoaded(this._loadResults,"section",i)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,r=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&r&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,r){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,r))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,r){console.info("Loading stimulus:",i.href);let n=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,i,r)}_applyStimulusContent(i,r,n){if(!i){console.warn("No stimulus content to apply");return}let s=i.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=n.querySelector(`[data-stimulus-idref="${r.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${r.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,r,n){if(!this._testElement||i.length===0)return;let s=i.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,r,n)))).filter(Boolean);this._isStaleNavigation(r,n)||(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(i,r,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(i.href,n.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(r,n)?null:{itemRef:i,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),s;return console.warn(`Failed to load item ${i.identifier}:`,s),null}}async _loadStimulus(i){return(await Jt().load(i,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let i=this.querySelector("test-container");if(i)return i.customElementRegistry??void 0}_findItemRef(i){let r=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!r)throw new Error(`Item with identifier "${i}" not found`);return r}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,r){let n=i.closest("qti-test-part")?.identifier,s=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:r}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(r=>r.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(r=>{r.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,r){return r.signal.aborted||i!==this._navigationId}_createNavigationError(i,r,n){return{message:i.message||`Failed to load ${r}: ${n}`,details:i,itemId:r==="item"?n:void 0,sectionId:r==="section"?n:void 0}}_dispatchLoadingStarted(i,r){$(this,"cito-test-navigation-started",{type:i,id:r})}_dispatchLoadingEnded(i,r){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:r},bubbles:!0,composed:!0}))}_dispatchError(i){$(this,"cito-test-navigation-failed",i)}_dispatchTestLoaded(i,r,n){requestAnimationFrame(()=>{$(this,"cito-test-rendered",i.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),$(this,"cito-test-navigated",{type:r,id:n})})}}return Ro([p({type:String})],t.prototype,"navigate",void 0),Ro([p({type:Number})],t.prototype,"requestTimeout",void 0),Ro([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),Ro([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var wh=o=>{class t extends o{constructor(...i){super(...i),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"cito-test-switch-view",r=>{this.sessionContext={...this.sessionContext,view:r.detail},this._updateElementView()}),B(this,"cito-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",r=>{this._updateElementView(),this._setCorrectResponseVisibility(r.detail)})}willUpdate(i){super.willUpdate(i),i.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 n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(i){this.updateAssessmentItemView(i,this.sessionContext.view)}updateAssessmentItemView(i,r){}}return t};var xh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ol=o=>{class t extends o{constructor(...i){super(...i),this.testContext=hl,this.sessionContext=dl,this._updateItemInTestContext=r=>{let n=r.itemContext,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let c=[...r.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}r.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(r.state=l.state)}},this._initializeEventListeners()}updateItemVariables(i,r,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==i)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of r){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(i)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===i)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=hl,this.sessionContext=dl}),B(this,"cito-test-loaded",i=>{this._testElement=i.detail;let r=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:r}}),this.addEventListener("qti-assessment-item-connected",i=>{let r=i.detail,n=r.closest("qti-assessment-item-ref")?.identifier;n&&(r.assessmentItemRefId=n),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables,i.detail.itemContext.state,i.detail.itemContext.valid)})}_updateItemVariablesInTestContext(i,r,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:r.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(i,r){typeof r!="string"||r==="not_attempted"||this.testContext.items.find(a=>a.identifier===i)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:r}:l)})})}}return xh([p({attribute:!1,type:Object}),H({context:ot})],t.prototype,"testContext",void 0),xh([p({attribute:!1,type:Object}),H({context:Ae})],t.prototype,"sessionContext",void 0),t},qh=class extends Ol(k){};var Oo=1;var Pl=o=>Array.isArray(o)?[...o]:o??null,Gm=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},Xm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(i=>({identifier:i.identifier,...i.type?{type:i.type}:{},value:Pl(i.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Pl(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),kh=o=>{class t extends o{#t=null;#e=!1;#i=null;constructor(...i){super(...i),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#i=null}),B(this,"cito-test-update-plugin-state",({detail:r})=>this.#n(r)),B(this,"cito-test-loaded",()=>{this.#t&&(this.#r(this.#t),this.#t=null),this.#e=!0})}#n({plugin:i,value:r}){if(typeof i!="string"||i==="")return;let{[i]:n,...s}=this.sessionContext.plugins??{},a=s;if(r!=null)try{a={...s,[i]:JSON.parse(JSON.stringify(r))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${i}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Xm(this.testContext,this.sessionContext)}set state(i){if(!Gm(i)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=i;return}let{navItemRefId:r,navSectionId:n}=this.sessionContext;this.#r(i);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==r?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(i){if(super.updated(i),!this.#e||!(i.has("testContext")||i.has("sessionContext")))return;let r=this.state,n=JSON.stringify(r);n!==this.#i&&(this.#i=n,$(this,"cito-test-state-changed",r))}#r(i){for(let n of i.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let r=new Map(i.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>r.has(n.identifier)?{...n,value:Pl(r.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(i.session),plugins:i.session.plugins&&typeof i.session.plugins=="object"?{...i.session.plugins}:{}}}#o(i){let r=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...r("qti-test-part",i.navPartId)?{navPartId:i.navPartId}:{},...r("qti-assessment-section",i.navSectionId)?{navSectionId:i.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===i.navItemRefId)?{navItemRefId:i.navItemRefId}:{}}}#s(i,r){$(this,"cito-test-navigate",{type:i,id:r})}}return t};var Ch=o=>{class t extends o{constructor(...i){super(...i),this.addEventListener("qti-register-variable",r=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],r.detail.variable]},r.stopPropagation()}),B(this,"cito-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",r=>{let{outcomeIdentifier:n,value:s}=r.detail;this.updateOutcomeVariable(n,s),r.stopPropagation()})}outcomeProcessing(){let i=(this._testElement??this).querySelector("qti-outcome-processing");return i?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>({...r,value:r.defaultValue??null}))},i.process(),!0):!1}submit(){return this.outcomeProcessing()?($(this,"cito-test-submitted",{}),!0):!1}getTestFeedback(i){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!i||n.access===i)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(i,r){let n=this.getOutcome(i);if(!n){console.warn(`Can not set qti-outcome-identifier: ${i}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==i?s:{...s,value:n.cardinality==="single"?r:[...s.value,r]})}}getOutcome(i){return this.getVariable(i)}getVariable(i){return this.testContext.testOutcomeVariables?.find(r=>r.identifier===i)||null}}return t};var Sh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ne=class extends yh(wh(Ch(kh(Ol(k))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Wt(this,{context:Te,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Sh([_(),H({context:yt})],Ne.prototype,"configContext",void 0);Sh([_(),H({context:wt})],Ne.prototype,"qtiContext",void 0);var Po=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Mo=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 Eh=o=>!dh(o)&&typeof o.then=="function",Ah=1073741823,Ml=class extends Me{constructor(){super(...arguments),this._$Cwt=Ah,this._$Cbt=[],this._$CK=new Po(this),this._$CX=new Mo}render(...t){return t.find(e=>!Eh(e))??rt}update(t,e){let i=this._$Cbt,r=i.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!Eh(l))return this._$Cwt=a,l;a<r&&l===i[a]||(this._$Cwt=Ah,r=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return rt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Do=Mt(Ml);var No=`
|
|
225
225
|
@layer qti-base, qti-components, qti-extended;
|
|
226
226
|
|
|
227
227
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
@@ -2229,11 +2229,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2229
2229
|
without the theme a well got its padding and nothing else. Filled from the theme's own
|
|
2230
2230
|
tokens: a brand that restyles its borders restyles the well and the bordered box with them.
|
|
2231
2231
|
A well is a tinted surface inside the theme's border (\xA71.1.6.2: border plus background, the
|
|
2232
|
-
background chosen by the platform)
|
|
2233
|
-
|
|
2232
|
+
background chosen by the platform). The default is a white card, for items on a light-grey
|
|
2233
|
+
page; a brand sets --cito-color-well for another fill. */
|
|
2234
2234
|
--table-border-color: var(--qti-border-color);
|
|
2235
2235
|
--foreground: var(--qti-color-base-content);
|
|
2236
|
-
--well-bg: var(--cito-color-well, var(--qti-color-base-
|
|
2236
|
+
--well-bg: var(--cito-color-well, var(--qti-color-base-100)); /* t1 input: --cito-color-well, optional */
|
|
2237
2237
|
--well-border: var(--qti-border);
|
|
2238
2238
|
--well-box-shadow: none;
|
|
2239
2239
|
|
|
@@ -2344,8 +2344,10 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2344
2344
|
* The focus ring (\`@mixin foc\`): one outline on \`:focus-visible\`, for everything. The test
|
|
2345
2345
|
* controls read the same two tokens, so a page has one ring.
|
|
2346
2346
|
*
|
|
2347
|
-
*
|
|
2348
|
-
*
|
|
2347
|
+
* Not the answer key's info blue: it must not be mistaken for the answer key. The default theme is
|
|
2348
|
+
* black and white, and the ring is its one colour: a mid blue that keeps 3:1 against both
|
|
2349
|
+
* surfaces (WCAG 1.4.11). A brand that sets --cito-color-primary gets its primary as the ring, as
|
|
2350
|
+
* before; --cito-color-focus sets the ring on its own. 2px, a hairline, so a length in px. It sits that far outside
|
|
2349
2351
|
* the box, or that far inside it for a row in a list that clips (\`@mixin foc-inset\`).
|
|
2350
2352
|
*
|
|
2351
2353
|
* The four --qti-light-* and --qti-dark-* tokens that used to sit here are now
|
|
@@ -2353,7 +2355,26 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2353
2355
|
* and dark theme, which is what the old names suggested and why they were mistaken for dead.
|
|
2354
2356
|
*/
|
|
2355
2357
|
--qti-focus-border-width: 2px;
|
|
2356
|
-
--qti-focus
|
|
2358
|
+
--qti-color-focus: var(
|
|
2359
|
+
--cito-color-focus,
|
|
2360
|
+
var(--cito-color-primary, light-dark(oklch(60% 0.15 250), oklch(72% 0.13 250)))
|
|
2361
|
+
); /* t1 input: --cito-color-focus, optional; a brand's primary when it sets one */
|
|
2362
|
+
--qti-focus-color: var(--qti-color-focus);
|
|
2363
|
+
|
|
2364
|
+
/*
|
|
2365
|
+
* Rubric and feedback, told apart by shape so it holds in black and white. A rubric block is a
|
|
2366
|
+
* document: light grey, a thick grey bar on its start side. Feedback is a reply: a light-grey bubble
|
|
2367
|
+
* with large rounded corners, no border and a hard darker shadow just below it. Inline feedback is a
|
|
2368
|
+
* pill, padded only at its sides so its line keeps its height.
|
|
2369
|
+
*/
|
|
2370
|
+
--qti-callout-bg: var(--qti-color-base-300);
|
|
2371
|
+
--qti-callout-accent-width: calc(var(--qti-border-width) * 4);
|
|
2372
|
+
--qti-rubric-accent-color: color-mix(in oklab, var(--qti-color-base-content) 35%, var(--qti-color-base-100));
|
|
2373
|
+
--qti-feedback-radius: calc(var(--qti-spacing) * 2.5);
|
|
2374
|
+
--qti-feedback-radius-inline: calc(var(--qti-spacing) * 2);
|
|
2375
|
+
--qti-feedback-padding-inline: var(--qti-spacing);
|
|
2376
|
+
--qti-feedback-shadow-color: color-mix(in oklab, var(--qti-color-base-content) 22%, var(--qti-color-base-100));
|
|
2377
|
+
--qti-feedback-shadow: 0 calc(var(--qti-border-width) * 2) 0 var(--qti-feedback-shadow-color);
|
|
2357
2378
|
--qti-focus-offset: var(--qti-focus-border-width);
|
|
2358
2379
|
--qti-focus-offset-inset: calc(-1 * var(--qti-focus-border-width));
|
|
2359
2380
|
--qti-focus-offset-past-border: calc(var(--qti-focus-offset) + var(--qti-border-width));
|
|
@@ -7389,27 +7410,87 @@ qti-upload-interaction::part(input):disabled::file-selector-button {
|
|
|
7389
7410
|
}
|
|
7390
7411
|
|
|
7391
7412
|
@layer qti-components.elements{
|
|
7392
|
-
/*
|
|
7413
|
+
/*
|
|
7414
|
+
* A callout: light grey, a thick grey border on the start side, a little indentation. Information
|
|
7415
|
+
* for the candidate, so the border is grey; feedback has a full-strength one (qti-feedback-block.css).
|
|
7416
|
+
* \`display: block\` is declared by the element itself, in qti-rubric-block.ts.
|
|
7417
|
+
*/
|
|
7393
7418
|
qti-rubric-block {
|
|
7394
|
-
border: var(--qti-
|
|
7395
|
-
|
|
7396
|
-
border-radius: var(--qti-radius-box);
|
|
7419
|
+
border-inline-start: var(--qti-callout-accent-width) solid var(--qti-rubric-accent-color);
|
|
7420
|
+
border-start-end-radius: var(--qti-radius-box);
|
|
7421
|
+
border-end-end-radius: var(--qti-radius-box);
|
|
7422
|
+
background-color: var(--qti-callout-bg);
|
|
7397
7423
|
padding: var(--qti-padding-box);
|
|
7398
7424
|
margin-top: var(--qti-gap);
|
|
7399
7425
|
}
|
|
7426
|
+
|
|
7427
|
+
/* The callout's padding is its spacing: no extra margin above the first or below the last paragraph. */
|
|
7428
|
+
qti-rubric-block > :first-child {
|
|
7429
|
+
margin-top: 0;
|
|
7430
|
+
}
|
|
7431
|
+
qti-rubric-block > :last-child {
|
|
7432
|
+
margin-bottom: 0;
|
|
7433
|
+
}
|
|
7400
7434
|
}
|
|
7401
7435
|
|
|
7402
7436
|
@layer qti-components.elements{
|
|
7437
|
+
/*
|
|
7438
|
+
* The feedback bubble, small enough for a line of text: a light-grey pill with the bubble's hard
|
|
7439
|
+
* shadow. No border and no padding above or below, so the line it is on keeps the height of every
|
|
7440
|
+
* other line (a shadow takes no room either). Painted on the \`feedback\` part, which exists only while
|
|
7441
|
+
* the feedback shows.
|
|
7442
|
+
*/
|
|
7403
7443
|
qti-feedback-inline::part(feedback) {
|
|
7444
|
+
border-radius: var(--qti-feedback-radius-inline);
|
|
7445
|
+
background-color: var(--qti-callout-bg);
|
|
7446
|
+
box-shadow: var(--qti-feedback-shadow);
|
|
7447
|
+
padding: 0 var(--qti-feedback-padding-inline);
|
|
7404
7448
|
}
|
|
7405
7449
|
}
|
|
7406
7450
|
|
|
7407
7451
|
@layer qti-components.elements{
|
|
7452
|
+
/*
|
|
7453
|
+
* A speech bubble: a reply to the candidate's answer. Light grey, no border, large rounded corners and
|
|
7454
|
+
* a hard darker shadow just below it. Painted on the \`feedback\` part: that box exists only while the
|
|
7455
|
+
* feedback shows, so a hidden feedback draws nothing.
|
|
7456
|
+
*/
|
|
7408
7457
|
qti-feedback-block::part(feedback) {
|
|
7458
|
+
border-radius: var(--qti-feedback-radius);
|
|
7459
|
+
background-color: var(--qti-callout-bg);
|
|
7460
|
+
box-shadow: var(--qti-feedback-shadow);
|
|
7461
|
+
padding: var(--qti-padding-box);
|
|
7462
|
+
margin-top: var(--qti-gap);
|
|
7463
|
+
}
|
|
7464
|
+
|
|
7465
|
+
/* The bubble's padding is its spacing: no extra margin above the first or below the last paragraph. */
|
|
7466
|
+
qti-feedback-block > :first-child {
|
|
7467
|
+
margin-top: 0;
|
|
7468
|
+
}
|
|
7469
|
+
qti-feedback-block > :last-child {
|
|
7470
|
+
margin-bottom: 0;
|
|
7409
7471
|
}
|
|
7410
7472
|
}
|
|
7411
7473
|
|
|
7412
7474
|
@layer qti-components.elements{
|
|
7475
|
+
/*
|
|
7476
|
+
* The feedback bubble, the same as qti-feedback-block: light grey, no border, large rounded corners and
|
|
7477
|
+
* a hard darker shadow. Its box stays the dialog's own (qti-modal-feedback.ts); the theme paints it.
|
|
7478
|
+
*/
|
|
7479
|
+
qti-modal-feedback::part(feedback) {
|
|
7480
|
+
border: 0;
|
|
7481
|
+
border-radius: var(--qti-feedback-radius);
|
|
7482
|
+
background-color: var(--qti-callout-bg);
|
|
7483
|
+
box-shadow: var(--qti-feedback-shadow);
|
|
7484
|
+
}
|
|
7485
|
+
|
|
7486
|
+
/* The dialog's padding is its spacing: no extra margin above the first or below the last paragraph. */
|
|
7487
|
+
qti-modal-feedback > :first-child {
|
|
7488
|
+
margin-top: 0;
|
|
7489
|
+
}
|
|
7490
|
+
qti-modal-feedback > :last-child {
|
|
7491
|
+
margin-bottom: 0;
|
|
7492
|
+
}
|
|
7493
|
+
|
|
7413
7494
|
/*
|
|
7414
7495
|
* Neither selector below matches anything this repo renders \u2014 \`qti-modal-feedback-custom\` is not a
|
|
7415
7496
|
* registered element and nothing sets \`.custom-modal-feedback\`. They are kept as a downstream
|
|
@@ -7426,6 +7507,14 @@ qti-feedback-block::part(feedback) {
|
|
|
7426
7507
|
padding: var(--qti-padding-box);
|
|
7427
7508
|
margin-top: var(--qti-gap);
|
|
7428
7509
|
}
|
|
7510
|
+
|
|
7511
|
+
/* The dialog's padding is its spacing, and the icon lines up with the first line: no extra margin above the first or below the last paragraph. */
|
|
7512
|
+
qti-modal-feedback > :first-child {
|
|
7513
|
+
margin-top: 0;
|
|
7514
|
+
}
|
|
7515
|
+
qti-modal-feedback > :last-child {
|
|
7516
|
+
margin-bottom: 0;
|
|
7517
|
+
}
|
|
7429
7518
|
}
|
|
7430
7519
|
|
|
7431
7520
|
@layer qti-components.elements{
|
|
@@ -7544,16 +7633,16 @@ div.full-correct-response-inline {
|
|
|
7544
7633
|
display: inline-block;
|
|
7545
7634
|
}
|
|
7546
7635
|
}
|
|
7547
|
-
`;var
|
|
7636
|
+
`;var $e=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ct=class extends k{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 Ui().load(this.testURL)).shuffleOrdering(t),i=this.testHost;if(i?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await i.postLoadTestTransformCallback(e,n))}this.#i(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#i(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.#i(Ui().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.#r(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#n(){let t=this.querySelector("template");this.#t=t?t.content:v``}#r(){let t=new CSSStyleSheet;t.replaceSync(No),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
7548
7637
|
${this.#t}
|
|
7549
7638
|
<slot></slot>
|
|
7550
|
-
${
|
|
7551
|
-
`}}
|
|
7639
|
+
${Do(this.testDoc,v`<span>Loading...</span>`)}
|
|
7640
|
+
`}};$e([p({attribute:!1})],Ct.prototype,"customElementRegistry",void 0);$e([p({type:String,attribute:"test-url"})],Ct.prototype,"testURL",void 0);$e([_()],Ct.prototype,"testDoc",void 0);$e([_()],Ct.prototype,"testXML",void 0);$e([I({context:Te,subscribe:!0})],Ct.prototype,"testHost",void 0);$e([_(),I({context:wt,subscribe:!0})],Ct.prototype,"qtiContext",void 0);$e([z("testURL",{waitUntilFirstUpdate:!0})],Ct.prototype,"handleTestURLChange",null);$e([z("testXML",{waitUntilFirstUpdate:!0})],Ct.prototype,"handleTestXMLChange",null);var $o=q`var(--qti-color-base-100, var(--cito-color-base-100, Canvas))`,Dl=q`var(--qti-color-base-content, var(--cito-color-base-content, CanvasText))`,Lo=q`var(--qti-color-neutral, var(--cito-color-neutral, CanvasText))`,Nl=q`var(--qti-color-neutral-content, var(--cito-color-neutral-content, Canvas))`,Ym=q`
|
|
7552
7641
|
display: inline-flex;
|
|
7553
7642
|
cursor: pointer;
|
|
7554
7643
|
user-select: none;
|
|
7555
7644
|
border-radius: var(--test-button-border-radius, var(--qti-radius-field, var(--cito-radius-field, 0.2rem)));
|
|
7556
|
-
`,
|
|
7645
|
+
`,Th=q`
|
|
7557
7646
|
display: flex;
|
|
7558
7647
|
flex: 1 1 auto;
|
|
7559
7648
|
align-items: center;
|
|
@@ -7567,82 +7656,82 @@ div.full-correct-response-inline {
|
|
|
7567
7656
|
cursor: pointer;
|
|
7568
7657
|
user-select: none;
|
|
7569
7658
|
border-radius: var(--test-button-border-radius, var(--qti-radius-field, var(--cito-radius-field, 0.2rem)));
|
|
7570
|
-
|
|
7571
|
-
${
|
|
7572
|
-
background-color: var(--test-button-background-color, ${
|
|
7659
|
+
`,$l=q`
|
|
7660
|
+
${Th};
|
|
7661
|
+
background-color: var(--test-button-background-color, ${$o});
|
|
7573
7662
|
color: var(--test-button-color, inherit);
|
|
7574
7663
|
border: var(--qti-border-width, var(--cito-border-width, 1px)) solid
|
|
7575
|
-
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${
|
|
7576
|
-
`,
|
|
7577
|
-
background-color: var(--test-button-primary-background-color, ${
|
|
7578
|
-
color: var(--test-button-primary-color, ${
|
|
7579
|
-
border-color: var(--test-button-primary-background-color, ${
|
|
7580
|
-
`,
|
|
7664
|
+
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${Dl} 45%, ${$o})));
|
|
7665
|
+
`,Jm=q`
|
|
7666
|
+
background-color: var(--test-button-primary-background-color, ${Lo});
|
|
7667
|
+
color: var(--test-button-primary-color, ${Nl});
|
|
7668
|
+
border-color: var(--test-button-primary-background-color, ${Lo});
|
|
7669
|
+
`,Ll=q`
|
|
7581
7670
|
background-color: var(
|
|
7582
7671
|
--test-button-hover-background-color,
|
|
7583
|
-
color-mix(in oklab, ${
|
|
7672
|
+
color-mix(in oklab, ${$o}, ${Dl} var(--qti-hover-mix, 8%))
|
|
7584
7673
|
);
|
|
7585
|
-
`,
|
|
7674
|
+
`,Km=q`
|
|
7586
7675
|
background-color: var(
|
|
7587
7676
|
--test-button-primary-hover-background-color,
|
|
7588
|
-
color-mix(in oklab, ${
|
|
7677
|
+
color-mix(in oklab, ${Lo}, ${Nl} var(--qti-hover-mix, 8%))
|
|
7589
7678
|
);
|
|
7590
|
-
|
|
7679
|
+
`,zl=q`
|
|
7591
7680
|
background-color: var(
|
|
7592
7681
|
--test-button-active-background-color,
|
|
7593
|
-
color-mix(in oklab, ${
|
|
7682
|
+
color-mix(in oklab, ${$o}, ${Dl} var(--qti-active-mix, 16%))
|
|
7594
7683
|
);
|
|
7595
|
-
`,
|
|
7684
|
+
`,Zm=q`
|
|
7596
7685
|
background-color: var(
|
|
7597
7686
|
--test-button-primary-active-background-color,
|
|
7598
|
-
color-mix(in oklab, ${
|
|
7687
|
+
color-mix(in oklab, ${Lo}, ${Nl} var(--qti-active-mix, 16%))
|
|
7599
7688
|
);
|
|
7600
|
-
`,
|
|
7689
|
+
`,Vl=q`
|
|
7601
7690
|
outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
|
|
7602
7691
|
outline-offset: var(--qti-focus-offset, 2px);
|
|
7603
|
-
`,
|
|
7692
|
+
`,jl=q`
|
|
7604
7693
|
cursor: not-allowed;
|
|
7605
7694
|
opacity: 0.45;
|
|
7606
|
-
`,
|
|
7607
|
-
${
|
|
7695
|
+
`,tS=q`
|
|
7696
|
+
${Th};
|
|
7608
7697
|
border: var(--qti-border-width, var(--cito-border-width, 1px)) solid var(--qti-border-color, GrayText);
|
|
7609
7698
|
`,dt=v`<span class="control" part="button"><slot></slot></span>`,st=q`
|
|
7610
7699
|
:host {
|
|
7611
|
-
${
|
|
7700
|
+
${Ym};
|
|
7612
7701
|
}
|
|
7613
7702
|
.control {
|
|
7614
|
-
${
|
|
7703
|
+
${$l};
|
|
7615
7704
|
}
|
|
7616
7705
|
@media (hover: hover) and (pointer: fine) {
|
|
7617
7706
|
:host(:hover:not([disabled])) .control {
|
|
7618
|
-
${
|
|
7707
|
+
${Ll};
|
|
7619
7708
|
}
|
|
7620
7709
|
}
|
|
7621
7710
|
:host(:active:not([disabled])) .control {
|
|
7622
|
-
${
|
|
7711
|
+
${zl};
|
|
7623
7712
|
}
|
|
7624
7713
|
:host(:focus-visible) {
|
|
7625
|
-
${
|
|
7714
|
+
${Vl};
|
|
7626
7715
|
}
|
|
7627
7716
|
:host([disabled]) {
|
|
7628
|
-
${
|
|
7717
|
+
${jl};
|
|
7629
7718
|
}
|
|
7630
7719
|
:host([disabled]) .control {
|
|
7631
7720
|
cursor: not-allowed;
|
|
7632
7721
|
}
|
|
7633
|
-
`,
|
|
7722
|
+
`,Ih=q`
|
|
7634
7723
|
.control {
|
|
7635
|
-
${
|
|
7724
|
+
${Jm};
|
|
7636
7725
|
}
|
|
7637
7726
|
@media (hover: hover) and (pointer: fine) {
|
|
7638
7727
|
:host(:hover:not([disabled])) .control {
|
|
7639
|
-
${
|
|
7728
|
+
${Km};
|
|
7640
7729
|
}
|
|
7641
7730
|
}
|
|
7642
7731
|
:host(:active:not([disabled])) .control {
|
|
7643
|
-
${
|
|
7732
|
+
${Zm};
|
|
7644
7733
|
}
|
|
7645
|
-
`;var ir=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ah=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Ah(e.host):void 0},me=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=st}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;$(this,"cito-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||Ah(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,n=t?.find(a=>a.active);if(!t||!e&&!n)return;let r=e?t.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.identifier===e):n.sections.flatMap(a=>a.items).find(a=>a.active);if(!r){this._internalDisabled=!1;return}let i=r.maxAttempts??1,s=r.numAttempts||0;if(!r.adaptive&&r.optimal){this._internalDisabled=!0;return}if(r.adaptive&&r.completionStatus==="completed"){this._internalDisabled=!0;return}if(!r.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}this.requireAnswer||r.allowSkipping===!1?this._internalDisabled=r.valid===!1||r.isDefaultResponse:this._internalDisabled=!1}render(){return dt}};ir([I({context:F,subscribe:!0}),p({attribute:!1})],me.prototype,"computedContext",void 0);ir([p({type:Boolean,reflect:!0,attribute:"disabled"})],me.prototype,"_internalDisabled",void 0);ir([p({reflect:!0})],me.prototype,"item",void 0);ir([p({type:Boolean,reflect:!0,attribute:"require-answer"})],me.prototype,"requireAnswer",void 0);ir([z("computedContext")],me.prototype,"_handleTestElementChange",null);var Ym=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},rr=class extends k{static{this.styles=st}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return dt}};Ym([p({type:String,attribute:"item-id"})],rr.prototype,"itemId",void 0);var ln=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Jm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),ft=class extends k{get qtiContext(){return this.#r()?.qtiContext??(this.#t??=Jm())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#n(t)}#t;#e;#n(t){let e=this.#r();e?e.qtiContext=t:this.#t=t}#i;#r(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new ct(this,{context:Ae,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,this.#v=new WeakSet,B(this,"cito-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#g.bind(this)),Pd(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"cito-test-end-attempt",this.#l.bind(this)),B(this,"cito-test-update-outcome",this.#f.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let n=this.#w(e);this.#s.set(e.identifier,n);let r=this.computedItemFor(e.identifier),i=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),r,this.#y(i,n,r?.maxAttempts,r?.adaptive,s))}afterAttemptEnded(t,e,n){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,n=e?this.#c(e):this.activeAssessmentItem;if(!n)return;let r=this.configContext?.reportValidityAfterScoring===!0;n.processResponse(!0,r)}#f(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#d(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let n=e.variables.find(r=>r.identifier==="SCORE");if(n&&n.externalScored===null&&e.adaptive==="false"){let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#n({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=this.#h(r);Object.keys(i).length>0&&this.#n({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})});let n=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:n.map(r=>{let i=[...r.querySelectorAll("qti-assessment-section")],s=r.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,l=s?s.maxAttempts:1,c=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:r.identifier,navigationMode:r.navigationMode,submissionMode:r.submissionMode,allowSkipping:a,sections:i.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:y,items:f.map(b=>{let w=b.querySelector(":scope > qti-item-session-control"),T=w?w.allowSkipping:y,A=w?w.maxAttempts:x,C=w?w.showFeedback:u,S=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:T,maxAttempts:A,showFeedback:C,showSolution:S}})}})}})}}#h(t){let e={},n=t.querySelector("qti-default-value");return n&&n.querySelectorAll("qti-value[field-identifier]").forEach(i=>{let s=i.getAttribute("field-identifier"),a=i.getAttribute("base-type")||"string",l=i.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#g(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(n=>({...n,sections:n.sections.map(r=>({...r,items:r.items.map(i=>{if(i.identifier!==e.parentElement.getAttribute("identifier"))return i;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let y=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||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,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(n=>({...n,active:this._sessionContext?.navPartId===n.identifier||!1,sections:n.sections.map(r=>({...r,active:this._sessionContext?.navSectionId===r.identifier||!1,completed:r.items.every(i=>this._testContext.items.find(s=>s.identifier===i.identifier)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:r.items.map(i=>{let s=this._testContext?.items.find(C=>C.identifier===i.identifier),a={...i,...s,...this.initContext?.find(C=>C.identifier===i.identifier)},l=a.variables?.find(C=>C.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let S;switch(C.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=C.defaultValue??S;if(Array.isArray(C.value)){let N=Array.isArray(R)?R:[R];return C.value.length===N.length&&C.value.every((V,L)=>V===N[L])}return C.value===R}),g=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=i.variables?.find(C=>C.identifier=="MAXSCORE")?.value,w=b==null?null:parseFloat(b?.toString()),T=this.#s.get(a.identifier);T===void 0&&(T=s?this.#w(s):"unscored",f>0&&this.#s.set(a.identifier,T));let A=this.#y(f,T,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:w,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#b()}#v;#b(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.sections.flatMap(n=>(n.submissionMode||e.submissionMode)==="simultaneous"?[]:n.items.map(r=>[r.identifier,r]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let n=e.assessmentItem;if(!n)continue;let r=this.#m(t.get(e.identifier),n);r&&!n.disabled?(n.disabled=!0,this.#v.add(n)):!r&&this.#v.has(n)&&(this.#v.delete(n),n.disabled=!1)}}#m(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let n=t.maxAttempts??1;return n>0&&(t.numAttempts??0)>=n}#y(t,e,n,r,i){if(t===0)return!1;if(r)return i==="completed";if(e!=="suboptimal")return!0;let s=n??1;return s>0&&t>=s}#w(t){let e=t.variables??[],n=this.#x(e,"SCORE"),r=this.#x(e,"MAXSCORE");if(n!==null&&r!==null)return n>=r?"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 l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#x(t,e){let n=t?.find(i=>i.identifier===e)?.value;if(n==null||Array.isArray(n))return null;let r=parseFloat(n.toString());return Number.isNaN(r)?null:r}};ln([p({type:String})],ft.prototype,"identifier",void 0);ln([_()],ft.prototype,"initContext",void 0);ln([_(),I({context:yt,subscribe:!0})],ft.prototype,"configContext",void 0);ln([_(),I({context:ot,subscribe:!0})],ft.prototype,"_testContext",void 0);ln([_(),I({context:Ee,subscribe:!0})],ft.prototype,"_sessionContext",void 0);ln([_(),H({context:F})],ft.prototype,"computedContext",void 0);ln([p({type:Boolean,attribute:"auto-score-items"})],ft.prototype,"autoScoreItems",void 0);var Vl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},cn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[st,Eh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(n=>n.active);e&&(this.sectionItems=e.sections.flatMap(n=>n.items),this.itemIndex=this.sectionItems.findIndex(n=>n.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),n=e?.navigationMode||t.navigationMode,r=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=n==="linear"&&r==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return dt}};Vl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cn.prototype,"_internalDisabled",void 0);Vl([I({context:F,subscribe:!0})],cn.prototype,"computedContext",void 0);Vl([z("computedContext")],cn.prototype,"_handleTestElementChange",null);var jl=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},dn=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=st}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(n=>n.active);e&&(this.sectionItems=e.sections.flatMap(n=>n.items),this.itemIndex=this.sectionItems.findIndex(n=>n.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(r=>r.active),n=t?.sections.find(r=>r.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=n==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return dt}};jl([p({type:Boolean,reflect:!0,attribute:"disabled"})],dn.prototype,"_internalDisabled",void 0);jl([I({context:F,subscribe:!0})],dn.prototype,"computedContext",void 0);jl([z("computedContext")],dn.prototype,"_handleTestElementChange",null);var Km=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},or=class extends k{static{this.styles=st}#t(t){$(this,"cito-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return dt}};Km([p({type:String,attribute:"section-id"})],or.prototype,"sectionId",void 0);var Th=(o,t)=>o?.plugins?.[t];var Lo=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Fl=o=>Th(o,"bookmarks")??[],Ih=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Ih(e.host):void 0},$e=class extends k{static{this.styles=[st,q`
|
|
7734
|
+
`;var rr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},_h=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?_h(e.host):void 0},ge=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=st}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;$(this,"cito-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||_h(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,i=t?.find(a=>a.active);if(!t||!e&&!i)return;let r=e?t.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.identifier===e):i.sections.flatMap(a=>a.items).find(a=>a.active);if(!r){this._internalDisabled=!1;return}let n=r.maxAttempts??1,s=r.numAttempts||0;if(!r.adaptive&&r.optimal){this._internalDisabled=!0;return}if(r.adaptive&&r.completionStatus==="completed"){this._internalDisabled=!0;return}if(!r.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||r.allowSkipping===!1?this._internalDisabled=r.valid===!1||r.isDefaultResponse:this._internalDisabled=!1}render(){return dt}};rr([I({context:F,subscribe:!0}),p({attribute:!1})],ge.prototype,"computedContext",void 0);rr([p({type:Boolean,reflect:!0,attribute:"disabled"})],ge.prototype,"_internalDisabled",void 0);rr([p({reflect:!0})],ge.prototype,"item",void 0);rr([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ge.prototype,"requireAnswer",void 0);rr([z("computedContext")],ge.prototype,"_handleTestElementChange",null);var tf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},or=class extends k{static{this.styles=st}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return dt}};tf([p({type:String,attribute:"item-id"})],or.prototype,"itemId",void 0);var li=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ef=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),ft=class extends k{get qtiContext(){return this.#r()?.qtiContext??(this.#t??=ef())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#i(t)}#t;#e;#i(t){let e=this.#r();e?e.qtiContext=t:this.#t=t}#n;#r(){return this.#n.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#n=new ct(this,{context:Te,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,this.#v=new WeakSet,B(this,"cito-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#g.bind(this)),Md(this,"cito-item-response-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"cito-test-end-attempt",this.#l.bind(this)),B(this,"cito-test-update-outcome",this.#f.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let i=this.#w(e);this.#s.set(e.identifier,i);let r=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),r,this.#y(n,i,r?.maxAttempts,r?.adaptive,s))}afterAttemptEnded(t,e,i){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,i=e?this.#c(e):this.activeAssessmentItem;if(!i)return;let r=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,r)}#f(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#d(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let i=e.variables.find(r=>r.identifier==="SCORE");if(i&&i.externalScored===null&&e.adaptive==="false"){let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#i({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let n=this.#h(r);Object.keys(n).length>0&&this.#i({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:i.map(r=>{let n=[...r.querySelectorAll("qti-assessment-section")],s=r.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,l=s?s.maxAttempts:1,c=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:r.identifier,navigationMode:r.navigationMode,submissionMode:r.submissionMode,allowSkipping:a,sections:n.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:y,items:f.map(b=>{let w=b.querySelector(":scope > qti-item-session-control"),T=w?w.allowSkipping:y,A=w?w.maxAttempts:x,C=w?w.showFeedback:u,S=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:T,maxAttempts:A,showFeedback:C,showSolution:S}})}})}})}}#h(t){let e={},i=t.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",l=n.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#g(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(r=>({...r,items:r.items.map(n=>{if(n.identifier!==e.parentElement.getAttribute("identifier"))return n;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let y=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...n,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(r=>({...r,active:this._sessionContext?.navSectionId===r.identifier||!1,completed:r.items.every(n=>this._testContext.items.find(s=>s.identifier===n.identifier)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:r.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...s,...this.initContext?.find(C=>C.identifier===n.identifier)},l=a.variables?.find(C=>C.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let S;switch(C.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=C.defaultValue??S;if(Array.isArray(C.value)){let N=Array.isArray(R)?R:[R];return C.value.length===N.length&&C.value.every((V,L)=>V===N[L])}return C.value===R}),g=n.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,w=b==null?null:parseFloat(b?.toString()),T=this.#s.get(a.identifier);T===void 0&&(T=s?this.#w(s):"unscored",f>0&&this.#s.set(a.identifier,T));let A=this.#y(f,T,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:w,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#b()}#v;#b(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.sections.flatMap(i=>(i.submissionMode||e.submissionMode)==="simultaneous"?[]:i.items.map(r=>[r.identifier,r]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let i=e.assessmentItem;if(!i)continue;let r=this.#m(t.get(e.identifier),i);r&&!i.disabled?(i.disabled=!0,this.#v.add(i)):!r&&this.#v.has(i)&&(this.#v.delete(i),i.disabled=!1)}}#m(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let i=t.maxAttempts??1;return i>0&&(t.numAttempts??0)>=i}#y(t,e,i,r,n){if(t===0)return!1;if(r)return n==="completed";if(e!=="suboptimal")return!0;let s=i??1;return s>0&&t>=s}#w(t){let e=t.variables??[],i=this.#x(e,"SCORE"),r=this.#x(e,"MAXSCORE");if(i!==null&&r!==null)return i>=r?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#x(t,e){let i=t?.find(n=>n.identifier===e)?.value;if(i==null||Array.isArray(i))return null;let r=parseFloat(i.toString());return Number.isNaN(r)?null:r}};li([p({type:String})],ft.prototype,"identifier",void 0);li([_()],ft.prototype,"initContext",void 0);li([_(),I({context:yt,subscribe:!0})],ft.prototype,"configContext",void 0);li([_(),I({context:ot,subscribe:!0})],ft.prototype,"_testContext",void 0);li([_(),I({context:Ae,subscribe:!0})],ft.prototype,"_sessionContext",void 0);li([_(),H({context:F})],ft.prototype,"computedContext",void 0);li([p({type:Boolean,attribute:"auto-score-items"})],ft.prototype,"autoScoreItems",void 0);var Fl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ci=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[st,Ih]}#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(i=>i.active);e&&(this.sectionItems=e.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),i=e?.navigationMode||t.navigationMode,r=e?.submissionMode||t.submissionMode,n=this.sectionItems[this.itemIndex],s=i==="linear"&&r==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!n?.done}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return dt}};Fl([p({type:Boolean,reflect:!0,attribute:"disabled"})],ci.prototype,"_internalDisabled",void 0);Fl([I({context:F,subscribe:!0})],ci.prototype,"computedContext",void 0);Fl([z("computedContext")],ci.prototype,"_handleTestElementChange",null);var Bl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},di=class extends k{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=st}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(i=>i.active);e&&(this.sectionItems=e.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(r=>r.active),i=t?.sections.find(r=>r.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=i==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){$(this,"cito-test-navigate",{type:"item",id:t})}render(){return dt}};Bl([p({type:Boolean,reflect:!0,attribute:"disabled"})],di.prototype,"_internalDisabled",void 0);Bl([I({context:F,subscribe:!0})],di.prototype,"computedContext",void 0);Bl([z("computedContext")],di.prototype,"_handleTestElementChange",null);var nf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},sr=class extends k{static{this.styles=st}#t(t){$(this,"cito-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return dt}};nf([p({type:String,attribute:"section-id"})],sr.prototype,"sectionId",void 0);var Rh=(o,t)=>o?.plugins?.[t];var zo=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ul=o=>Rh(o,"bookmarks")??[],Oh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Oh(e.host):void 0},Le=class extends k{static{this.styles=[st,q`
|
|
7646
7735
|
svg {
|
|
7647
7736
|
width: 1.1em;
|
|
7648
7737
|
height: 1.1em;
|
|
@@ -7658,9 +7747,9 @@ div.full-correct-response-inline {
|
|
|
7658
7747
|
:host([bookmarked]) svg {
|
|
7659
7748
|
fill: currentColor;
|
|
7660
7749
|
}
|
|
7661
|
-
`]}constructor(){super(),this.bookmarked=!1,this.disabled=!1,this.addEventListener("click",()=>this.#e()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#e())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}get#t(){return this.item||(
|
|
7750
|
+
`]}constructor(){super(),this.bookmarked=!1,this.disabled=!1,this.addEventListener("click",()=>this.#e()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#e())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}get#t(){return this.item||(Oh(this)??this.computedContext?.testParts?.flatMap(t=>t.sections.flatMap(e=>e.items)).find(t=>t.active)?.identifier)}willUpdate(){let t=this.#t;this.disabled=!t,this.bookmarked=!!t&&Ul(this.computedContext).includes(t)}updated(){this.setAttribute("aria-pressed",String(this.bookmarked)),this.setAttribute("aria-disabled",String(this.disabled))}#e(){let t=this.#t;if(!t)return;let e=Ul(this.computedContext),i=e.includes(t)?e.filter(r=>r!==t):[...e,t];$(this,"cito-test-update-plugin-state",{plugin:"bookmarks",value:i.length>0?i:null})}render(){return v`<span class="control" part="button"
|
|
7662
7751
|
><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h12v18l-6-4.5L6 21z" /></svg><slot></slot
|
|
7663
|
-
></span>`}};
|
|
7752
|
+
></span>`}};zo([I({context:F,subscribe:!0}),p({attribute:!1})],Le.prototype,"computedContext",void 0);zo([p({reflect:!0})],Le.prototype,"item",void 0);zo([p({type:Boolean,reflect:!0})],Le.prototype,"bookmarked",void 0);zo([p({type:Boolean,reflect:!0})],Le.prototype,"disabled",void 0);var rf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},hi=class extends k{static{this.styles=st}constructor(){super(),this.view="scorer",this.addEventListener("click",()=>{$(this,"cito-test-end-attempt",{}),$(this,"cito-test-switch-view",this.view)})}render(){return dt}};rf([p({type:String})],hi.prototype,"view",void 0);var of=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ar=class extends k{render(){return v` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};of([_(),I({context:F,subscribe:!0})],ar.prototype,"computedContext",void 0);var sf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Vo=o=>o==null?"":Array.isArray(o)?o.map(Vo).join(", "):Ot(o)?Object.entries(o).map(([t,e])=>`${t}: ${Vo(e)}`).join(", "):String(o),lr=class extends k{static{this.styles=q`
|
|
7664
7753
|
table {
|
|
7665
7754
|
width: 100%;
|
|
7666
7755
|
border-collapse: collapse;
|
|
@@ -7681,7 +7770,7 @@ div.full-correct-response-inline {
|
|
|
7681
7770
|
margin-top: 20px;
|
|
7682
7771
|
font-size: 16px;
|
|
7683
7772
|
}
|
|
7684
|
-
`}render(){let t=this.computedContext?.testParts.flatMap(
|
|
7773
|
+
`}render(){let t=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(s=>s.items)).find(n=>n.active);if(!t||!t.variables)return v``;let e=t.variables.filter(n=>n.type==="response"),i=t.variables.filter(n=>n.type==="outcome"),r=(n,s)=>v`
|
|
7685
7774
|
<h3>${s}</h3>
|
|
7686
7775
|
<table>
|
|
7687
7776
|
<thead>
|
|
@@ -7694,10 +7783,10 @@ div.full-correct-response-inline {
|
|
|
7694
7783
|
</tr>
|
|
7695
7784
|
</thead>
|
|
7696
7785
|
<tbody>
|
|
7697
|
-
${
|
|
7786
|
+
${n.map(a=>{let l=Vo(a.correctResponse),c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return v`
|
|
7698
7787
|
<tr>
|
|
7699
7788
|
<td>${a.identifier}</td>
|
|
7700
|
-
<td>${
|
|
7789
|
+
<td>${Vo(a.value)}</td>
|
|
7701
7790
|
<td>${a.cardinality}</td>
|
|
7702
7791
|
<td>${a.baseType}</td>
|
|
7703
7792
|
<td>${l||c||d}</td>
|
|
@@ -7706,8 +7795,8 @@ div.full-correct-response-inline {
|
|
|
7706
7795
|
</tbody>
|
|
7707
7796
|
</table>
|
|
7708
7797
|
`;return v`
|
|
7709
|
-
${r(e,"Response Variables")} ${r(
|
|
7710
|
-
`}};
|
|
7798
|
+
${r(e,"Response Variables")} ${r(i,"Outcome Variables")}
|
|
7799
|
+
`}};sf([I({context:F,subscribe:!0})],lr.prototype,"computedContext",void 0);var af=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},cr=class extends k{#t=null;static{this.styles=q`
|
|
7711
7800
|
:host {
|
|
7712
7801
|
display: block;
|
|
7713
7802
|
}
|
|
@@ -7723,16 +7812,16 @@ div.full-correct-response-inline {
|
|
|
7723
7812
|
opacity: 0.7;
|
|
7724
7813
|
}
|
|
7725
7814
|
`}#e=t=>{this.testState=t.detail};connectedCallback(){super.connectedCallback(),this.#t=this.closest("qti-test"),this.#t?.addEventListener("cito-test-state-changed",this.#e),this.testState=this.#t?.state}disconnectedCallback(){super.disconnectedCallback(),this.#t?.removeEventListener("cito-test-state-changed",this.#e),this.#t=null}render(){return this.testState?v`<ul>
|
|
7726
|
-
${this.#
|
|
7727
|
-
</ul>`:P}#
|
|
7728
|
-
<details ?open=${
|
|
7729
|
-
<summary><span part="key">${t}</span> <span part="count">${
|
|
7815
|
+
${this.#i("state",this.testState,0)}
|
|
7816
|
+
</ul>`:P}#i(t,e,i){if(e===null||typeof e!="object")return v`<li><span part="key">${t}</span>: <span part="value">${JSON.stringify(e)}</span></li>`;let r=Array.isArray(e)?e.map((s,a)=>[lf(s,a),s]):Object.entries(e),n=Array.isArray(e)?`[${r.length}]`:`{${r.length}}`;return v`<li>
|
|
7817
|
+
<details ?open=${i<2}>
|
|
7818
|
+
<summary><span part="key">${t}</span> <span part="count">${n}</span></summary>
|
|
7730
7819
|
<ul>
|
|
7731
|
-
${r.map(([s,a])=>this.#
|
|
7820
|
+
${r.map(([s,a])=>this.#i(s,a,i+1))}
|
|
7732
7821
|
</ul>
|
|
7733
7822
|
</details>
|
|
7734
|
-
</li>`}};
|
|
7735
|
-
${this.myTemplate?this.myTemplate(this.stampContext):P}`}};
|
|
7823
|
+
</li>`}};af([_()],cr.prototype,"testState",void 0);var lf=(o,t)=>{let e=o?.identifier;return typeof e=="string"?`${t} \xB7 ${e}`:String(t)};var Hl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},pi=class extends k{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Se(t)}#t(t){let r=(this.computedContext?.testParts.find(n=>n.active)).sections.flatMap(n=>n.items).find(n=>n.active)?.identifier;$(this,"cito-test-update-outcome",{assessmentItemRefId:r,outcomeVariableId:"SCORE",value:t})}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return v``;let e=t.variables.find(a=>a.identifier=="MAXSCORE")?.value,i=t.variables.find(a=>a.identifier=="SCORE"),r=i?.value,n=i?.externalScored!=="human";if(!e||!i)return P;let s=[...Array(Number(e)+1).keys()];return v`${this.myTemplate?this.myTemplate({scores:s,score:r,disabled:n}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,i=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(i)})}};Hl([p({type:String,attribute:"view"})],pi.prototype,"view",void 0);Hl([p({type:Boolean})],pi.prototype,"disabled",void 0);Hl([I({context:F,subscribe:!0})],pi.prototype,"computedContext",void 0);var Ph=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Yi=class extends k{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(s=>s.sections.flatMap(a=>a.items)).find(s=>s.active);if(!t||!t.variables)return v``;if(t.category==="dep-informational")return v`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(s=>s.identifier=="SCORE"),i=parseFloat(e?.value),r=t.externalScored;return v`<div>${t.valid===!1||t.isDefaultResponse?this.dataset.textNoResponse:!r&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:r==="externalMachine"?Number.isNaN(i)||i===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${i===0?"geen punten":i==1?"\xE9\xE9n punt":`${i} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:r==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Ph([I({context:F,subscribe:!0})],Yi.prototype,"computedContext",void 0);Ph([p({type:String,attribute:"view"})],Yi.prototype,"view",void 0);var Wl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends k{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=Se(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),i=e?.sections.find(h=>h.active),r=i?.items.find(h=>h.active),{variables:n,...s}=r||{};if(!e)return;let a={...e,items:e.sections.flatMap(h=>h.items.map(({variables:f,...m})=>m)),sections:e.sections.map(h=>({...h,items:h.items.map(({variables:f,...m})=>m)}))},l={...i,items:(i?.items??[]).map(({variables:h,...f})=>f)},{testParts:c,...d}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:s,activeSection:l,activeTestpart:a,test:d},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return v` ${this.debug?v`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:P}
|
|
7824
|
+
${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Wl([p({type:Boolean,reflect:!0})],ui.prototype,"debug",void 0);Wl([_(),I({context:F,subscribe:!0})],ui.prototype,"computedContext",void 0);Wl([_()],ui.prototype,"stampContext",void 0);var jo=class extends k{static{this.styles=st}constructor(){super(),this.addEventListener("click",()=>$(this,"cito-test-submit",{}))}render(){return dt}};var dr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Fo,Kt=class extends k{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=Fo.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=>Fo.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=Fo.DEFAULT_VIEW_OPTIONS}_switchView(t){$(this,"cito-test-switch-view",t)}render(){return v`
|
|
7736
7825
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
7737
7826
|
<select
|
|
7738
7827
|
part="select"
|
|
@@ -7741,23 +7830,23 @@ div.full-correct-response-inline {
|
|
|
7741
7830
|
>
|
|
7742
7831
|
${this._viewOptions.map(t=>v`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
|
|
7743
7832
|
</select>
|
|
7744
|
-
`}};
|
|
7745
|
-
::highlight(${
|
|
7833
|
+
`}};Fo=Kt;dr([I({context:Ae,subscribe:!0})],Kt.prototype,"sessionContext",void 0);dr([p({type:String})],Kt.prototype,"label",void 0);dr([p({type:String,attribute:"view-options"})],Kt.prototype,"viewOptions",void 0);dr([z("viewOptions",{waitUntilFirstUpdate:!0})],Kt.prototype,"_handleViewOptionsChange",void 0);dr([_()],Kt.prototype,"_viewOptions",void 0);var cf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},hr=class extends k{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Se(t)}_switchView(t){$(this,"cito-test-switch-view",t)}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return v`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};cf([I({context:Ae,subscribe:!0})],hr.prototype,"sessionContext",void 0);var Ji=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Uo="tts-element",Ho="tts-word",Bo=null;function df(){return Bo||(Bo=new CSSStyleSheet,Bo.replaceSync(`
|
|
7834
|
+
::highlight(${Uo}) {
|
|
7746
7835
|
background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--cito-color-info, Highlight)) 15%, transparent));
|
|
7747
7836
|
color: inherit;
|
|
7748
7837
|
}
|
|
7749
|
-
::highlight(${
|
|
7838
|
+
::highlight(${Ho}) {
|
|
7750
7839
|
background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--cito-color-warning, Mark)) 55%, transparent));
|
|
7751
7840
|
color: inherit;
|
|
7752
7841
|
}
|
|
7753
|
-
`)),
|
|
7754
|
-
<path d="${
|
|
7755
|
-
</svg>`;return v`${e}<span class="label">${t}</span>`},
|
|
7842
|
+
`)),Bo}var Mh=Symbol("tts-context"),hf={play:"M8 5v14l11-7z",pause:"M6 5h4v14H6zM14 5h4v14h-4z",stop:"M6 6h12v12H6z",prev:"M6 5h2v14H6zM20 5v14L9 12z",next:"M16 5h2v14h-2zM4 5v14l11-7z",pick:"M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"},ze=(o,t)=>{let e=v`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
7843
|
+
<path d="${hf[o]}"></path>
|
|
7844
|
+
</svg>`;return v`${e}<span class="label">${t}</span>`},Nt=class extends k{static{this.styles=q`
|
|
7756
7845
|
:host {
|
|
7757
7846
|
display: inline-flex;
|
|
7758
7847
|
}
|
|
7759
7848
|
button {
|
|
7760
|
-
${
|
|
7849
|
+
${$l};
|
|
7761
7850
|
min-inline-size: var(--test-button-size, 2.25rem);
|
|
7762
7851
|
padding-inline: 0.5rem;
|
|
7763
7852
|
/* Containing block for the visually hidden .label. Without it the label is placed against
|
|
@@ -7767,17 +7856,17 @@ div.full-correct-response-inline {
|
|
|
7767
7856
|
}
|
|
7768
7857
|
@media (hover: hover) and (pointer: fine) {
|
|
7769
7858
|
button:hover:not(:disabled) {
|
|
7770
|
-
${
|
|
7859
|
+
${Ll};
|
|
7771
7860
|
}
|
|
7772
7861
|
}
|
|
7773
7862
|
button:active:not(:disabled) {
|
|
7774
|
-
${
|
|
7863
|
+
${zl};
|
|
7775
7864
|
}
|
|
7776
7865
|
button:focus-visible {
|
|
7777
|
-
${
|
|
7866
|
+
${Vl};
|
|
7778
7867
|
}
|
|
7779
7868
|
button:disabled {
|
|
7780
|
-
${
|
|
7869
|
+
${jl};
|
|
7781
7870
|
}
|
|
7782
7871
|
button[aria-pressed='true'],
|
|
7783
7872
|
button[aria-pressed='true']:hover {
|
|
@@ -7802,71 +7891,71 @@ div.full-correct-response-inline {
|
|
|
7802
7891
|
clip-path: inset(50%);
|
|
7803
7892
|
white-space: nowrap;
|
|
7804
7893
|
}
|
|
7805
|
-
`}#t=this.attachInternals();#e;#
|
|
7894
|
+
`}#t=this.attachInternals();#e;#i=!1;updated(t){let e=this._tts?.state,i=this._tts?.picking??!1;e===this.#e&&i===this.#i||(this.#e=e,this.#i=i,this.#t.states.clear(),e&&this.#t.states.add(e),i&&this.#t.states.add("picking"))}};Ji([p({type:String})],Nt.prototype,"label",void 0);Ji([I({context:Mh,subscribe:!0})],Nt.prototype,"_tts",void 0);var mi=class extends k{static{this.styles=q`
|
|
7806
7895
|
:host {
|
|
7807
7896
|
display: inline-flex;
|
|
7808
7897
|
flex-wrap: wrap;
|
|
7809
7898
|
align-items: center;
|
|
7810
7899
|
gap: var(--test-tts-gap, 0.25rem);
|
|
7811
7900
|
}
|
|
7812
|
-
`}#t;#e;#n;#
|
|
7901
|
+
`}#t;#e;#i;#n;#r;#o;#s;#a;#c;#p;#l;#f;#d;#u;#h;#g;#v;#b;#m;#y;#w;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#i=null,this.#n=!1,this.#r=null,this.#o=null,this.#s=this.#C.bind(this),this.#a=()=>this.#R(),this.#c=void 0,this.#p=void 0,this.#l=null,this.#f=null,this.#d=0,this.#u=[],this.#h=null,this.#g=!1,this.#v=null,this.#b=this.#Q.bind(this),this.#m=!1,this.#y=new Highlight,this.#w=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#F(),pause:()=>this.#B(),resume:()=>this.#U(),stop:()=>{this.#E(),this.#R()},prevElement:()=>this.#G(),nextElement:()=>this.#X(),togglePick:()=>this.#H(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#n||this.#r)return;let{item:e,section:i}=this.#q(),r=this.#c!==void 0&&this.#c!==e,n=this.#p!==void 0&&this.#p!==i,s=this.#l!==null&&this.#f!==null&&this.#f!==this.#D();(r||n||s)&&this.#x(),this.#c=e,this.#p=i}#x(){this.#E(),this.#R(),this.#l=null,this.#d=0,this.#m=!1,this.#A()}connectedCallback(){if(super.connectedCallback(),this.#k("idle"),this.#e=this.#P()!==null,this.#e){this.#i=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#L()}),this.#i.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#n=this.#M()!==null,!this.#n&&(this.#r=this.closest("qti-assessment-item-ref"),this.#r?(this.#o=this.#r,this.#o.addEventListener("qti-assessment-item-connected",this.#s)):(this.#o=this.closest("test-navigation")??this.getRootNode(),this.#o.addEventListener("cito-test-navigate",this.#a),this.#o.addEventListener("qti-request-navigation",this.#a)))}disconnectedCallback(){super.disconnectedCallback(),this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#E(),this.#I(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("cito-test-navigate",this.#a),this.#o?.removeEventListener("qti-request-navigation",this.#a),this.#o=null,this.#r=null,this.#i?.disconnect(),this.#i=null,this.#e=!1,this.#n=!1}render(){return v`<slot></slot>`}#C(){this.#l!==null&&this.#x()}#q(){for(let t of this._computedContext?.testParts??[])for(let e of t.sections)if(e.active)return{item:e.items.find(i=>i.active)?.identifier??null,section:e.identifier};return{item:null,section:null}}#L(){this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#E(),this.#I(),this.#k("idle"),this.#l=null,this.#d=0,this.#m=!1,this.#A()}#P(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#M(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#D(){return this.#e?this.#P()?.querySelector("qti-stimulus-body")??null:this.#n?this.#M():this.#z()?.querySelector("qti-item-body")??null}#z(){if(this.#r)return this.#r.assessmentItem;let{item:t}=this.#q();return t?this._computedContext?.itemElement?.(t)??null:null}#k(t){this._ttsContext={...this._ttsContext,state:t},this.#t.states.delete("idle"),this.#t.states.delete("playing"),this.#t.states.delete("paused"),this.#t.states.add(t)}#A(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#d,elementCount:this.#S().length}}#S(){if(this.#n&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#d=0,this.#m=!1),this.#l===null){let t=this.#D();if(!t)return[];this.#f=t;let e="p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";this.#l=Array.from(t.querySelectorAll(e)).filter(i=>(i.textContent??"").trim().length>0&&!i.querySelector(e)&&!i.closest('[aria-hidden="true"]'))}return this.#l.filter(t=>this.#V(t))}#V(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#j(t){let e=t;for(;e;){let r=e.getAttribute("lang")||e.getAttribute("xml:lang");if(r?.trim())return r.trim();e=e.parentElement??e.getRootNode().host??null}let i=document.documentElement.getAttribute("lang");return i?.trim()?i.trim():this.language}#F(){if(!this.#S().length){console.warn("test-item-to-speech: no readable elements found");return}this.#E(),speechSynthesis.cancel(),this.#m&&(this.#m=!1,this.#d=0),this.#n&&this.#d===0&&(this.#l=null),this.#_(this.#d)}#_(t){let e=this.#S();if(t>=e.length){this.#T(),this.#d=e.length-1,e.length>0&&this.#O(e[this.#d]),this.#m=!0,this.#k("idle"),this.#A();return}this.#d=t,this.#m=!1,this.#A();let i=e[t];i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(i),this.#u=this.#Y(i);let r=this.#u.map(s=>s.textContent??"").join("");if(!r.trim()){this.#_(t+1);return}let n=new SpeechSynthesisUtterance(r);n.lang=this.#j(i),n.rate=1,n.onboundary=s=>{s.name==="word"&&this.#J(s.charIndex,s.charLength??0)},n.onend=()=>{this.#h===n&&(this.#h=null,this.#T(),this.#_(this.#d+1))},n.onerror=()=>{this.#h===n&&(this.#h=null,this.#I(),this.#k("idle"))},this.#h=n,speechSynthesis.speak(n),this.#k("playing")}#B(){speechSynthesis.pause(),this.#k("paused")}#U(){speechSynthesis.resume(),this.#k("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#I(),this.#k("idle")}#H(){this.#g?this.#E():this.#W()}#W(){this.#n&&(this.#l=null);let t=this.#S();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#R(),this.#g=!0,this.#t.states.add("picking"),this.#N(t),this.#v=t[0].getRootNode(),this.#v.addEventListener("click",this.#b,!0),this._ttsContext={...this._ttsContext,picking:!0}}#E(){this.#g&&(this.#g=!1,this.#t.states.delete("picking"),this.#v?.removeEventListener("click",this.#b,!0),this.#v=null,this.#I(),this._ttsContext={...this._ttsContext,picking:!1})}#Q(t){let e=this.#S(),i=t.composedPath(),r=e.findIndex(n=>i.includes(n));if(r<0){let n=i.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));n&&(r=e.findIndex(s=>n.contains(s)))}r<0||(t.preventDefault(),t.stopPropagation(),this.#E(),speechSynthesis.cancel(),this.#_(r))}#G(){let t=this.#S();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#T(),this.#d=Math.max(0,this.#d-1),this.#m=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#k("idle")}#X(){let t=this.#S();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#T(),this.#d=Math.min(t.length-1,this.#d+1),this.#m=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#k("idle")}#Y(t){let e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r;for(;r=i.nextNode();)(r.textContent??"").length>0&&!r.parentElement?.closest('[aria-hidden="true"]')&&e.push(r);return e}#O(t){this.#N([t])}#N(t){if("highlights"in CSS){this.#$(),this.#y.clear();for(let e of t){let i=new Range;i.selectNodeContents(e),this.#y.add(i)}CSS.highlights.set(Uo,this.#y)}}#J(t,e){if(!("highlights"in CSS))return;this.#$(),this.#w.clear();let i=this.#u.map(d=>d.textContent??"").join(""),r=t+(e>0?e:this.#K(t,i)),n=0,s=null,a=0,l=null,c=0;for(let d of this.#u){let h=d.textContent?.length??0;if(!s&&n+h>t&&(s=d,a=t-n),s&&n+h>=r){l=d,c=r-n;break}n+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#w.add(d),CSS.highlights.set(Ho,this.#w)}}#T(){"highlights"in CSS&&(this.#w.clear(),CSS.highlights.get(Ho)===this.#w&&CSS.highlights.delete(Ho))}#I(){"highlights"in CSS&&(this.#T(),this.#y.clear(),CSS.highlights.get(Uo)===this.#y&&CSS.highlights.delete(Uo))}#K(t,e){let i=e.slice(t).search(/\s/);return i<0?e.length-t:i}#$(){if(!("highlights"in CSS))return;let t=df();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,i=this.getRootNode();i instanceof ShadowRoot&&e.add(i);let r=this.#l?.[0]?.getRootNode();r instanceof ShadowRoot&&e.add(r);for(let n of e)n.adoptedStyleSheets.includes(t)||(n.adoptedStyleSheets=[...n.adoptedStyleSheets,t])}};Ji([p({type:String})],mi.prototype,"language",void 0);Ji([I({context:F,subscribe:!0})],mi.prototype,"_computedContext",void 0);Ji([_(),H({context:Mh})],mi.prototype,"_ttsContext",void 0);var pr=class extends Nt{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return v`
|
|
7813
7902
|
<button part="button" aria-label=${Q(t?this.pauseLabel:this.label)} @click=${this.#t}>
|
|
7814
|
-
${t?v`<slot name="pause">${
|
|
7903
|
+
${t?v`<slot name="pause">${ze("pause",this.pauseLabel??"Pause")}</slot>`:v`<slot name="play">${ze("play",this.label??"Play")}</slot>`}
|
|
7815
7904
|
</button>
|
|
7816
|
-
`}};
|
|
7905
|
+
`}};Ji([p({type:String,attribute:"pause-label"})],pr.prototype,"pauseLabel",void 0);var Wo=class extends Nt{render(){return v`
|
|
7817
7906
|
<button
|
|
7818
7907
|
part="button"
|
|
7819
7908
|
aria-label=${Q(this.label)}
|
|
7820
7909
|
?disabled=${this._tts?.state!=="playing"}
|
|
7821
7910
|
@click=${()=>this._tts?.pause()}
|
|
7822
7911
|
>
|
|
7823
|
-
<slot>${
|
|
7912
|
+
<slot>${ze("pause",this.label??"Pause")}</slot>
|
|
7824
7913
|
</button>
|
|
7825
|
-
`}},
|
|
7914
|
+
`}},Qo=class extends Nt{render(){return v`
|
|
7826
7915
|
<button
|
|
7827
7916
|
part="button"
|
|
7828
7917
|
aria-label=${Q(this.label)}
|
|
7829
7918
|
?disabled=${this._tts?.state!=="paused"}
|
|
7830
7919
|
@click=${()=>this._tts?.resume()}
|
|
7831
7920
|
>
|
|
7832
|
-
<slot>${
|
|
7921
|
+
<slot>${ze("play",this.label??"Resume")}</slot>
|
|
7833
7922
|
</button>
|
|
7834
|
-
`}},
|
|
7923
|
+
`}},Go=class extends Nt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return v`
|
|
7835
7924
|
<button part="button" aria-label=${Q(this.label)} ?disabled=${t} @click=${()=>this._tts?.stop()}>
|
|
7836
|
-
<slot>${
|
|
7925
|
+
<slot>${ze("stop",this.label??"Stop")}</slot>
|
|
7837
7926
|
</button>
|
|
7838
|
-
`}},
|
|
7927
|
+
`}},Xo=class extends Nt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return v`
|
|
7839
7928
|
<button
|
|
7840
7929
|
part="button"
|
|
7841
7930
|
aria-label=${Q(this.label)}
|
|
7842
7931
|
?disabled=${t&&e}
|
|
7843
7932
|
@click=${()=>this._tts?.prevElement()}
|
|
7844
7933
|
>
|
|
7845
|
-
<slot>${
|
|
7934
|
+
<slot>${ze("prev",this.label??"Previous sentence")}</slot>
|
|
7846
7935
|
</button>
|
|
7847
|
-
`}},
|
|
7936
|
+
`}},Yo=class extends Nt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return v`
|
|
7848
7937
|
<button
|
|
7849
7938
|
part="button"
|
|
7850
7939
|
aria-label=${Q(this.label)}
|
|
7851
7940
|
?disabled=${e}
|
|
7852
7941
|
@click=${()=>this._tts?.nextElement()}
|
|
7853
7942
|
>
|
|
7854
|
-
<slot>${
|
|
7943
|
+
<slot>${ze("next",this.label??"Next sentence")}</slot>
|
|
7855
7944
|
</button>
|
|
7856
|
-
`}},
|
|
7945
|
+
`}},Jo=class extends Nt{render(){return v`
|
|
7857
7946
|
<button
|
|
7858
7947
|
part="button"
|
|
7859
7948
|
aria-label=${Q(this.label)}
|
|
7860
7949
|
aria-pressed=${this._tts?.picking?"true":"false"}
|
|
7861
7950
|
@click=${()=>this._tts?.togglePick()}
|
|
7862
7951
|
>
|
|
7863
|
-
<slot>${
|
|
7952
|
+
<slot>${ze("pick",this.label??"Read from here")}</slot>
|
|
7864
7953
|
</button>
|
|
7865
|
-
`}};var
|
|
7954
|
+
`}};var Dh=[{tag:"test-item-to-speech",ctor:mi},{tag:"test-tts-next",ctor:Yo},{tag:"test-tts-pause",ctor:Wo},{tag:"test-tts-pick",ctor:Jo},{tag:"test-tts-play",ctor:pr},{tag:"test-tts-prev",ctor:Xo},{tag:"test-tts-resume",ctor:Qo},{tag:"test-tts-stop",ctor:Go}];var Nh=[{tag:"test-check-item",ctor:hi},{tag:"test-bookmark",ctor:Le},{tag:"test-print-context",ctor:ar},{tag:"test-print-item-variables",ctor:lr},{tag:"test-print-state",ctor:cr},{tag:"test-scoring-buttons",ctor:pi},{tag:"test-scoring-feedback",ctor:Yi},{tag:"test-stamp",ctor:ui},{tag:"test-submit",ctor:jo},{tag:"test-view",ctor:Kt},{tag:"test-view-toggle",ctor:hr},...Dh];var $h=[{tag:"qti-assessment-item-ref",ctor:qt},{tag:"qti-assessment-section",ctor:kt},{tag:"qti-assessment-test",ctor:oi},{tag:"qti-branch-rule",ctor:de},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Wn},{tag:"qti-number-selected",ctor:co},{tag:"qti-outcome-processing",ctor:po},{tag:"qti-pre-condition",ctor:ho},{tag:"qti-test",ctor:Ne},{tag:"qti-test-feedback",ctor:er},{tag:"qti-test-part",ctor:De},{tag:"qti-test-variables",ctor:ir},{tag:"test-container",ctor:Ct},{tag:"test-end-attempt",ctor:ge},{tag:"test-item-link",ctor:or},{tag:"test-navigation",ctor:ft},{tag:"test-next",ctor:ci},{tag:"test-prev",ctor:di},{tag:"test-section-link",ctor:sr},...Nh];for(let{tag:o,ctor:t}of $h)customElements.get(o)||customElements.define(o,t);var fi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},$t=class extends k{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Jt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Jt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(No),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
7866
7955
|
${this.#t}
|
|
7867
7956
|
<slot></slot>
|
|
7868
|
-
${
|
|
7869
|
-
`}};
|
|
7957
|
+
${Do(this.itemDoc,v`<span>Loading...</span>`)}
|
|
7958
|
+
`}};fi([p({attribute:!1})],$t.prototype,"customElementRegistry",void 0);fi([p({type:String,attribute:"item-url"})],$t.prototype,"itemURL",void 0);fi([_()],$t.prototype,"itemDoc",void 0);fi([_()],$t.prototype,"itemXML",void 0);fi([_(),I({context:wt,subscribe:!0})],$t.prototype,"qtiContext",void 0);fi([z("itemURL",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemURLChange",null);fi([z("itemXML",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemXMLChange",null);var pf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ur=class extends k{static{this.styles=q`
|
|
7870
7959
|
table {
|
|
7871
7960
|
width: 100%;
|
|
7872
7961
|
border-collapse: collapse;
|
|
@@ -7887,7 +7976,7 @@ div.full-correct-response-inline {
|
|
|
7887
7976
|
margin-top: 20px;
|
|
7888
7977
|
font-size: 16px;
|
|
7889
7978
|
}
|
|
7890
|
-
`}render(){let t=this.computedContext;if(!t||!t.variables)return v``;let e=t.variables.filter(
|
|
7979
|
+
`}render(){let t=this.computedContext;if(!t||!t.variables)return v``;let e=t.variables.filter(n=>n.type==="response"),i=t.variables.filter(n=>n.type==="outcome"),r=(n,s)=>v`
|
|
7891
7980
|
<h3>${s}</h3>
|
|
7892
7981
|
<table>
|
|
7893
7982
|
<thead>
|
|
@@ -7900,7 +7989,7 @@ div.full-correct-response-inline {
|
|
|
7900
7989
|
</tr>
|
|
7901
7990
|
</thead>
|
|
7902
7991
|
<tbody>
|
|
7903
|
-
${
|
|
7992
|
+
${n.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return v`
|
|
7904
7993
|
<tr>
|
|
7905
7994
|
<td>${a.identifier}</td>
|
|
7906
7995
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
@@ -7912,8 +8001,8 @@ div.full-correct-response-inline {
|
|
|
7912
8001
|
</tbody>
|
|
7913
8002
|
</table>
|
|
7914
8003
|
`;return v`
|
|
7915
|
-
${r(e,"Response Variables")} ${r(
|
|
7916
|
-
`}};
|
|
8004
|
+
${r(e,"Response Variables")} ${r(i,"Outcome Variables")}
|
|
8005
|
+
`}};pf([I({context:Ee,subscribe:!0})],ur.prototype,"computedContext",void 0);var uf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Lh=o=>{class t extends o{#t;constructor(...i){super(...i),this.view="candidate",this.addEventListener("qti-assessment-item-connected",r=>{this.#t=r.detail,this.#e()}),this.addEventListener("item-switch-view",r=>{this.view=r.detail})}willUpdate(i){super.willUpdate(i),i.has("view")&&this.#e()}#e(){let i=this.#t;i&&(i.querySelectorAll("[view]").forEach(r=>{r.classList.toggle("show",r.getAttribute("view")===this.view)}),this.updateAssessmentItemView(i,this.view))}updateAssessmentItemView(i,r){}}return uf([p({type:String})],t.prototype,"view",void 0),t};var Ql=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},be=class extends Lh(k){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#i.bind(this),this.#e=this.#n.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#i(t){this.#r(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.#r(this.assessmentItem.identifier,e||[])}#r(t,e){let i=e?.find(c=>c.identifier=="SCORE")?.value,r=parseFloat(i?.toString()),n=e?.find(c=>c.identifier==="completionStatus")?.value,s=r!==void 0&&!isNaN(r)&&r>0,a=r!==void 0&&!isNaN(r)&&r<=0,l=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};Ql([_(),H({context:Ee})],be.prototype,"computedContext",void 0);Ql([_(),H({context:yt})],be.prototype,"configContext",void 0);Ql([_(),H({context:wt})],be.prototype,"qtiContext",void 0);var zh=[{tag:"item-container",ctor:$t},{tag:"item-print-variables",ctor:ur},{tag:"qti-item",ctor:be}];for(let{tag:o,ctor:t}of zh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fh)customElements.get(o)||customElements.define(o,t);var Vh=(o,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(o[r],r);return i},G=Mt(class extends Oe{constructor(o){if(super(o),o.type!==Gi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],n=[],s=0;for(let a of o)r[s]=i?i(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:r}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,i]){let r=uh(o),{values:n,keys:s}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=s,n;let a=this.ut??=[],l=[],c,d,h=0,f=r.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(a[h]===s[m])l[m]=Pe(r[h],n[m]),h++,m++;else if(a[f]===s[y])l[y]=Pe(r[f],n[y]),f--,y--;else if(a[h]===s[y])l[y]=Pe(r[h],n[y]),Xi(o,l[y+1],r[h]),h++,y--;else if(a[f]===s[m])l[m]=Pe(r[f],n[m]),Xi(o,r[h],r[f]),f--,m++;else if(c===void 0&&(c=Vh(s,m,y),d=Vh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?r[x]:null;if(u===null){let g=Xi(o,r[h]);Pe(g,n[m]),l[m]=g}else l[m]=Pe(u,n[m]),Xi(o,r[h],u),r[x]=null;m++}else Co(r[f]),f--;else Co(r[h]),h++;for(;m<=y;){let x=Xi(o,l[y+1]);Pe(x,n[m]),l[m++]=x}for(;h<=f;){let x=r[h++];x!==null&&Co(x)}return this.ut=s,ph(o,l),rt}});var Ve=Symbol("dragDropContext");var jh=[O,Gt,q`
|
|
7917
8006
|
/* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
|
|
7918
8007
|
custom properties on its host; the properties themselves live here. */
|
|
7919
8008
|
:host {
|
|
@@ -7937,9 +8026,9 @@ div.full-correct-response-inline {
|
|
|
7937
8026
|
[part~='drag'] {
|
|
7938
8027
|
flex-shrink: 0;
|
|
7939
8028
|
}
|
|
7940
|
-
`];var
|
|
8029
|
+
`];var Fh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ki=class extends k{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=jh}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 v`<div part="drop">
|
|
7941
8030
|
${G(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
7942
|
-
</div>`}};
|
|
8031
|
+
</div>`}};Fh([p({type:String,reflect:!0})],Ki.prototype,"identifier",void 0);Fh([I({context:Ve,subscribe:!0}),_()],Ki.prototype,"_dragDrop",void 0);var Bh=[{tag:"qti-associable-hotspot",ctor:Ki}];var Uh=[O,Gt,q`
|
|
7943
8032
|
/*
|
|
7944
8033
|
* A drop target. The interaction measures its chips and publishes the result as custom
|
|
7945
8034
|
* properties on its own host; the actual CSS properties live here, not in a style attribute.
|
|
@@ -7984,9 +8073,9 @@ div.full-correct-response-inline {
|
|
|
7984
8073
|
min-height: var(--qti-dropzone-min-height, 0);
|
|
7985
8074
|
min-width: var(--qti-dropzone-min-width, 0);
|
|
7986
8075
|
}
|
|
7987
|
-
`];var
|
|
8076
|
+
`];var Gl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gi=class extends k{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Uh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
|
|
7988
8077
|
${G(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
7989
|
-
</div>`}};
|
|
8078
|
+
</div>`}};Gl([p({type:Number,reflect:!0})],gi.prototype,"tabindex",void 0);Gl([p({type:String,reflect:!0})],gi.prototype,"identifier",void 0);Gl([I({context:Ve,subscribe:!0}),_()],gi.prototype,"_dragDrop",void 0);var Hh=[{tag:"qti-gap",ctor:gi}];var Wh=[O,q`
|
|
7990
8079
|
/* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
|
|
7991
8080
|
graphic-gap-match rules, on the host from the document. */
|
|
7992
8081
|
:host {
|
|
@@ -7999,7 +8088,7 @@ div.full-correct-response-inline {
|
|
|
7999
8088
|
anywhere else it is unset and the chip keeps its size. */
|
|
8000
8089
|
zoom: var(--qti-graphic-scale, 1);
|
|
8001
8090
|
}
|
|
8002
|
-
`];var
|
|
8091
|
+
`];var mf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},mr=class extends k{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Wh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};mf([p({type:Number,reflect:!0})],mr.prototype,"tabindex",void 0);var Qh=[{tag:"qti-gap-img",ctor:mr}];var bi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Gh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function St(o,t,{activateOn:e="click"}={}){class i extends o{#t;#e;#i(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(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=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("qti-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#i()}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.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),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(){if(this.#t){this.#t=!1;return}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 v`<slot></slot>`}}return bi([p({type:String})],i.prototype,"identifier",void 0),bi([p({type:Number,reflect:!0,attribute:"tabindex"})],i.prototype,"tabIndex",void 0),bi([p({type:Boolean,attribute:"aria-disabled",converter:Gh})],i.prototype,"disabled",void 0),bi([p({type:Boolean,attribute:"aria-readonly",converter:Gh})],i.prototype,"readonly",void 0),bi([I({context:Oi,subscribe:!0}),_()],i.prototype,"_interactionContext",void 0),bi([z("disabled",{waitUntilFirstUpdate:!0})],i.prototype,"handleDisabledChange",null),bi([z("readonly",{waitUntilFirstUpdate:!0})],i.prototype,"handleReadonlyChange",null),i}var Xh=[O,q`
|
|
8003
8092
|
/*
|
|
8004
8093
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
8005
8094
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -8042,8 +8131,8 @@ div.full-correct-response-inline {
|
|
|
8042
8131
|
align-items: center;
|
|
8043
8132
|
justify-content: center;
|
|
8044
8133
|
}
|
|
8045
|
-
`];var
|
|
8046
|
-
<slot part="label"></slot>`}};
|
|
8134
|
+
`];var ff=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},je=class extends St(k,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Xh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
|
|
8135
|
+
<slot part="label"></slot>`}};ff([p({type:Number,reflect:!0})],je.prototype,"tabindex",void 0);var Yh=[{tag:"qti-gap-text",ctor:je}];var Jh=[O,q`
|
|
8047
8136
|
:host {
|
|
8048
8137
|
display: flex;
|
|
8049
8138
|
user-select: none;
|
|
@@ -8063,7 +8152,7 @@ div.full-correct-response-inline {
|
|
|
8063
8152
|
display: grid;
|
|
8064
8153
|
place-content: center;
|
|
8065
8154
|
}
|
|
8066
|
-
`];var
|
|
8155
|
+
`];var gf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},vi=class extends St(k,"qti-hotspot-choice"){static{this.styles=Jh}};gf([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],vi.prototype,"order",void 0);var Kh=[{tag:"qti-hotspot-choice",ctor:vi}];var Zh=[O,q`
|
|
8067
8156
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
8068
8157
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
8069
8158
|
:host {
|
|
@@ -8083,8 +8172,8 @@ div.full-correct-response-inline {
|
|
|
8083
8172
|
[part='control'] {
|
|
8084
8173
|
display: none;
|
|
8085
8174
|
}
|
|
8086
|
-
`];var
|
|
8087
|
-
<slot part="label"></slot>`}};var
|
|
8175
|
+
`];var yi=class extends St(k,"qti-hottext"){static{this.styles=Zh}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
8176
|
+
<slot part="label"></slot>`}};var tp=[{tag:"qti-hottext",ctor:yi}];var bf=q`
|
|
8088
8177
|
/*
|
|
8089
8178
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
8090
8179
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
@@ -8107,13 +8196,13 @@ div.full-correct-response-inline {
|
|
|
8107
8196
|
slot {
|
|
8108
8197
|
display: inline;
|
|
8109
8198
|
}
|
|
8110
|
-
`,
|
|
8199
|
+
`,ep=bf;var vf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},fr=class extends St(k,"qti-inline-choice"){static{this.styles=ep}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 v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};vf([p({type:String})],fr.prototype,"identifier",void 0);var ip=[{tag:"qti-inline-choice",ctor:fr}];var np=[O,q`
|
|
8111
8200
|
:host {
|
|
8112
8201
|
display: block;
|
|
8113
8202
|
margin: var(--qti-gap) 0;
|
|
8114
8203
|
width: 100%;
|
|
8115
8204
|
}
|
|
8116
|
-
`];var
|
|
8205
|
+
`];var Ko=class extends k{static{this.styles=np}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var rp=[{tag:"qti-prompt",ctor:Ko}];var op=[O,Gt,q`
|
|
8117
8206
|
/*
|
|
8118
8207
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
8119
8208
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -8262,13 +8351,13 @@ div.full-correct-response-inline {
|
|
|
8262
8351
|
align-items: center;
|
|
8263
8352
|
justify-content: center;
|
|
8264
8353
|
}
|
|
8265
|
-
`];var
|
|
8354
|
+
`];var Zo=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends St(k,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=op}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
|
|
8266
8355
|
<div part="control"></div>
|
|
8267
8356
|
<slot part="label"></slot>
|
|
8268
8357
|
<div part="drop">
|
|
8269
8358
|
${G(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
8270
8359
|
</div>
|
|
8271
|
-
`}};
|
|
8360
|
+
`}};Zo([p({type:Number,attribute:"match-min"})],Lt.prototype,"matchMin",void 0);Zo([p({type:Number,attribute:"match-max"})],Lt.prototype,"matchMax",void 0);Zo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Zo([I({context:Ve,subscribe:!0}),_()],Lt.prototype,"_dragDrop",void 0);var sp=[{tag:"qti-simple-associable-choice",ctor:Lt}];var ap=[O,q`
|
|
8272
8361
|
/*
|
|
8273
8362
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
8274
8363
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -8304,9 +8393,9 @@ div.full-correct-response-inline {
|
|
|
8304
8393
|
align-items: center;
|
|
8305
8394
|
justify-content: center;
|
|
8306
8395
|
}
|
|
8307
|
-
`];var
|
|
8396
|
+
`];var ts=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},zt=class extends St(k,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=ap}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
8308
8397
|
${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
8309
|
-
<slot part="label"></slot>`}};Zo([p({type:String,attribute:"template-identifier"})],Lt.prototype,"templateIdentifier",void 0);Zo([p({type:String,attribute:"show-hide"})],Lt.prototype,"showHide",void 0);Zo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Zo([p({type:String,attribute:!1})],Lt.prototype,"marker",void 0);var op=[{tag:"qti-simple-choice",ctor:Lt}];var sp=[...Vh,...Fh,...Uh,...Qh,...Xh,...Jh,...Zh,...ep,...ip,...op];var ff=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i};function gf(o,t,e,n,r={}){let i=r.publishWidth??!0,s=r.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=n.length?n:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),r.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),n.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Ql=(o,t,e,n='slot[part="drags"]')=>{class r extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#n=null,this.#i=0,this.#r=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#n;#i;#r;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(n,this),...s(n,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(gf(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#r;return d&&d.height===c.height&&d.width===c.width?!1:(this.#r=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#n||(this.#n=new MutationObserver(()=>this.#s()),this.#n.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#n?.disconnect(),this.#n=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return ff([p({type:Boolean,attribute:"auto-size-dropzones"})],r.prototype,"autoSizeDropzones",void 0),r};var{AbortController:Zt,AbortSignal:Gl,WeakMap:bf,WeakRef:vf,Window:ap,reportError:ts=console.log}=globalThis,je=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||je(o.defaultView.parent.document)),wn=()=>!!ap&&globalThis instanceof ap,Xl=Symbol("unset"),[lp,yf]=(()=>{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 n(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let r=new bf,i={next(...x){let u=this,g=r.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=r.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=r.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 r.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=n(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return n(x,g)}let l="any"in Gl?Gl.any.bind(Gl):x=>{let u=new Zt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){r.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=r.get(this)||{};g&&g(u)}error(u){let{error:g}=r.get(this)||{};g?g(u):ts(u)}complete(){let{complete:u}=r.get(this)||{};u&&u()}}function h(x,u){let g=r.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(wn()&&!je(document))return;try{b()}catch(w){ts(w)}}}}function f(x,u,g={}){if(wn()&&!je(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=r.get(x),T=w.weakSubscriber?.deref();if(T?.active){let C=T,S=r.get(C);S.observers.add(b),g.signal&&(g.signal.aborted?S.observers.delete(b):g.signal.addEventListener("abort",()=>{let R=r.get(C);R?.active&&(R.observers.delete(b),R.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(w.weakSubscriber=new vf(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=r.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");r.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Zt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=r.get(this);if(!g?.active||wn()&&!je(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=r.get(this);if(!g?.active){ts(u);return}if(wn()&&!je(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=r.get(this);if(!u?.active||wn()&&!je(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(wn()&&!je(document))return;let g=r.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!r.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!r.has(this)){let u=new Zt;return u.abort(),u.signal}return r.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 y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");r.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 y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let T=function(A,C){if(A.signal.aborted)return;let S;try{let R=C.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(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),T(A,C)},R=>{A.error(R)})},w=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(R){A.error(R);return}let S=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),T(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(w=>{if(w.signal.aborted)return;let T;try{T=a(u,!1)}catch(S){w.error(S);return}let A=!1,C=T;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let S=C.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=C.next();if({done:A}=S,A){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new y(w=>{u.then(T=>{w.next(T),w.complete()},T=>{w.error(T)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(w=>{let T=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(b,T,A),!w.active)return;let C=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=new d({next(C){let S;try{S=u(C,w)}catch(R){b.error(R);return}w+=1,b.next(S)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}inspect(u={}){let g=null,b=null,w=null,T=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&&(T=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(S=>{if(g!==null)try{g()}catch(L){S.error(L);return}let R=()=>{try{A!==null&&A(S.signal.reason)}catch(L){ts(L)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(b!==null)try{b(L)}catch(pt){S.signal.removeEventListener("abort",R),S.error(pt);return}S.next(L)},error(L){if(S.signal.removeEventListener("abort",R),w!==null)try{w(L)}catch(pt){S.error(pt);return}S.error(L)},complete(){if(S.signal.removeEventListener("abort",R),T!==null)try{T()}catch(L){S.error(L);return}S.complete()}}),V={signal:S.signal};f(C,N,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=new d({next(C){let S=!1;try{S=u(C,w)}catch(R){b.error(R);return}w+=1,S&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let w=u;if(w==0)return b.complete();let T=new d({next(C){b.next(C),w-=1,w==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let w=u,T=new d({next(C){if(w>0)return w-=1;w==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=!1,A=[];function C(V){let L;try{L=u(V,w)}catch(ie){return b.error(ie)}w+=1;let pt;try{pt=y.from(L)}catch(ie){return b.error(ie)}let Na=new d({next(ie){b.next(ie)},error(ie){b.error(ie)},complete(){if(A.length){let ie=A.shift();C(ie)}else S=!1,T&&b.complete()}}),Bt={signal:b.signal};f(pt,Na,Bt)}let S=!1,R=new d({next(V){S?A.push(V):(S=!0,C(V))},error(V){b.error(V)},complete(){T=!0,!S&&!A.length&&b.complete()}}),N={signal:b.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=!1,A=null;function C(N){let V;try{V=u(N,w)}catch(Bt){return b.error(Bt)}w+=1;let L;try{L=y.from(V)}catch(Bt){return b.error(Bt)}let pt=new d({next(Bt){b.next(Bt)},error(Bt){b.error(Bt)},complete(Bt){T?b.complete():A=null}}),Na={signal:c([A.signal,b.signal])};f(L,pt,Na)}let S=new d({next(N){A&&A.abort(),A=new Zt,C(N)},error(N){b.error(N)},complete(){T=!0,A||b.complete()}}),R={signal:b.signal};f(g,S,R)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(w=>{let T=new d({next(C){w.next(C)},error(C){let S;try{S=u(C)}catch(L){w.error(L);return}let R;try{R=y.from(S)}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,T,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let w=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),T={signal:b.signal};f(g,w,T)})}toArray(u={}){if(!(this instanceof y))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 T=[],A=new d({next(C){T.push(C)},error(C){w(C)},complete(){b(T)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(V){T(V),A.abort(V)}S+=1},error(N){T(N)},complete(){w()}});return f(this,R,C),b}every(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch(L){T(L),A.abort(L)}S+=1,V||(w(!1),A.abort())},error(N){T(N)},complete(){w(!0)}});return f(this,R,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:w}=e(),T=new Zt,A={signal:c([T.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let C=new d({next(S){b(S),T.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))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 T=null,A=!1,C=new d({next(S){A=!0,T=S},error(S){w(S)},complete(){A?b(T):w(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch(L){T(L),A.abort(L)}S+=1,V&&(w(N),A.abort())},error(N){T(N)},complete(){w()}});return f(this,R,C),b}some(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch(L){T(L),A.abort(L)}S+=1,V&&(w(!0),A.abort())},error(N){T(N)},complete(){w(!1)}});return f(this,R,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:T,reject:A}=e(),C=new Zt,S={signal:c([C.signal,b.signal])};if(S.signal.aborted)return A(S.signal.reason),w;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Xl,V=new d({next(L){if(N===Xl){N=L,R++;return}try{let pt=u(N,L,R);R++,N=pt}catch(pt){A(pt),C.abort(pt);return}},error(L){A(L)},complete(){N!==Xl?T(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,S),w}}return o(y.prototype,"subscribe"),[y,m]})();function cp(){return typeof globalThis.Observable=="function"}function dp(){Object.defineProperties(globalThis,{Observable:{value:lp,configurable:!0,writable:!0},Subscriber:{value:yf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(wn()&&!je(document))return;let e=this;return new lp(n=>{if(!e||n.signal.aborted)return;let r=i=>{n.next(i)};e.addEventListener(o,r,{capture:t.capture||!1,passive:t.passive,once:!1,signal:n.signal})})}}function Yl(o,t,e){let n=o.filter(r=>!r.hasAttribute("disabled"));for(let r of n){let i=r.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return r}return null}function hp(o,t,e,n){if(!n)return null;let r=o.filter(s=>!s.hasAttribute("disabled")),i=n.getBoundingClientRect();for(let s of r){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 pp(o,t,e,n){let r=o.filter(c=>!c.hasAttribute("disabled"));if(r.length===0)return null;let i,s;if(n){let c=n.getBoundingClientRect();i=c.left+c.width/2,s=c.top+c.height/2}else i=t,s=e;let a=null,l=1/0;for(let c of r){let d=c.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<l&&(l=m,a=c)}return a}function up(o,t,e,n){let r=o.filter(l=>!l.hasAttribute("disabled"));if(r.length===0)return null;let i;if(n){let l=n.getBoundingClientRect();i=[{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 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 l of r){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 y of i)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function wf(o,t,e){let n=o.getBoundingClientRect();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}function xf(o,t,e,n,r){let i=r&&r.length>0?o.filter(g=>r.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 l;if(n){let g=n.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let 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}],T=0,A=0;for(let C of l)for(let S of w){let R=Math.sqrt(Math.pow(C.x-S.x,2)+Math.pow(C.y-S.y,2));T+=R,A++}return T/A},d=null,h=1/0;for(let g of i){let b=c(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=c(g);b<m&&(m=b,f=g)}if(d&&n){let g=n.getBoundingClientRect(),b=d.getBoundingClientRect(),w=g.left+g.width/2,T=g.top+g.height/2;if(w>=b.left&&w<=b.right&&T>=b.top&&T<=b.bottom)return d}if(f&&wf(f,t,e))return f;let x=n?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function mp(o){switch(o){case"pointerWithin":return Yl;case"rectangleIntersection":return hp;case"closestCenter":return pp;case"closestCorners":return up;case"closestCornersWithInventoryPriority":return xf;default:return Yl}}function Zn(o,t,e,n,r="pointerWithin",i){return mp(r)(o,t,e,n,i)}function Fe(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let n of e)if(n instanceof HTMLElement&&n.tagName!=="SLOT"){if(n.matches(t)||n.hasAttribute("qti-draggable"))return n;let r=n.closest(t)||n.closest('[qti-draggable="true"]');if(r)return r}return null}function fr(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Jl=o=>o?.internals;function zt(o,t,e){let n=Jl(o)?.states;n&&(e?n.add(t):n.delete(t))}function es(o,t){return Jl(o)?.states?.has(t)??!1}function gr(o){zt(o,"dragging",!1),zt(o,"placeholder",!1),zt(o,"return-anchor",!1)}function xn(o){return es(o,"dragging")||es(o,"placeholder")}function ge(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let n=Jl(o)?.states;if(n){e?n.add(t):n.delete(t);return}let r=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));r.has("drop")&&(e?r.add(t):r.delete(t),o.setAttribute("part",[...r].join(" ")))}function ti(o,t){ge(o,"filled",t)}function ei(o,t){let e=[];return o.forEach(n=>{let r=[];n.tagName.toLowerCase()==="slot"?r=n.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):r=Array.from(n.querySelectorAll(`[identifier="${t}"]`)),e.push(...r)}),e}function fp(o,t){let e=o.find(r=>r.getAttribute("identifier")===t);if(!e)return 1;let n=e.getAttribute("match-max");return n?parseInt(n,10)||0:1}var Kl={origin:{x:0,y:0},scale:{x:1,y:1}},ns=100,qf=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},kf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Cf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Zl=(o,t)=>{let e=o.ownerDocument??document,n=t??e.body,r=qf(e);return r&&!Cf(r,n)?kf(r):n},tc=(o,t=1)=>{let n=(o.ownerDocument??document).createElement("div");n.style.cssText=`position:fixed;left:0;top:0;width:${ns}px;height:${ns}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(n);let r=n.getBoundingClientRect();return n.remove(),{origin:{x:r.left,y:r.top},scale:{x:(r.width/ns||1)*t,y:(r.height/ns||1)*t}}},gp=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});cp()||dp();var bp=new WeakSet;function Sf(o){!o||bp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),bp.add(o))}var vp=o=>!!o.internals?.states,is=(o,t,e,n='slot[part="drags"]',r="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=r,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Kl,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#n=a=>{let l=a;if(l.context!==On)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#n,{capture:!0}),Sf(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#n,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#n;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(n,this),u=a(n,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),T=g?b:new Set,A=g?w:new Set,C=new Set([...b,...w].filter(vp));for(let S of this.#t)C.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of C){let R=T.has(S),N=!R&&A.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=C,this.trackedDraggables.forEach(S=>{let R=xn(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Fe(m,t),x=this.disabled||this.readonly,u=fr(y)||xn(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Fe(m,t);if(!y){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(y,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(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let y=Fe(m,t),x=this.disabled||this.readonly,u=fr(y)||xn(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Fe(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Fe(m,t),x=this.disabled||this.readonly,u=fr(y)||xn(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Fe(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,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 y=this.trackedDraggables.filter(u=>!xn(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=Fe(m,t),g=this.disabled||this.readonly,b=fr(u)||xn(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:y.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 y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||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: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 b=a.getAttribute("identifier");if(b){let w=ei(this.trackedDragContainers,b);w.forEach(T=>zt(T,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),zt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,T=this.dragState.pointerId;w&&T!==void 0&&w.setPointerCapture&&w.setPointerCapture(T)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let 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),l==="pointer")try{let w=this.dragState.dragSource,T=this.dragState.pointerId;w&&T!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(T)}catch{}};this.dragState.touchCleanup=b}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(l==="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())}}),y=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];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Zn(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=>ge(m,"hover",!1)),c&&ge(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 y=l.getBoundingClientRect();h=Zn(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),zt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{zt(y,"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){gr(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))}c.style.removeProperty("box-shadow");let h=Zl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=tc(h,this.cloneZoom),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.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}=gp(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=Zl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=tc(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{ge(a,"enabled",!0),ge(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ge(a,"enabled",!1),ge(a,"active",!1),ge(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{zt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Kl,this.cloneZoom=1,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)vp(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var yp={duration:250,easing:"ease",fill:"both"};function ec(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function wp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Be(o){let t=new Map;return o.forEach(e=>{t.set(e,ec(e))}),t}function xp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function rs(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 nc(o){return rs(o)>0}function os(o,t,e={}){let n=rs(o);if(n<=0)return null;let r=ec(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:l}=xp(t,r);if(i===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...yp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*n,easing:d,fill:h})}function Ue(o,t={}){let e=new Map;return o.forEach((n,r)=>{if(!(r instanceof HTMLElement))return;let i=os(r,n,t);i&&e.set(r,i)}),e}var br=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Vt=(o,t,e,n='slot[part="drags"]',r="closestCornersWithInventoryPriority")=>{let i=Ql(o,t,e,n),s=is(i,t,e,n,r);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&&ti(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()),ti(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}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&&nc(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,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(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(es(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=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(()=>{os(c,wp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){gr(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=ei(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 T=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),T&&this.restoreOriginalInInventory(T,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Be(u):null;if(!x){let T=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(T){let A=T.getAttribute("identifier"),C=T.getBoundingClientRect();this.removeChipFromDroppable(d,T);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,T),ti(R,!0),this.animateReturn(T,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=c.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",b.localName==="qti-gap-text"?"drag drag-text":"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)),ti(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Ue(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let T=b.getBoundingClientRect(),A=h.left-T.left,C=h.top-T.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&ti(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=ei(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 y=this.enableFlipAnimations&&m.length>0?Be(m):null;h.forEach(x=>{gr(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&Ue(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=ei(this.trackedDragContainers,c),h=fp(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{zt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",y=!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}.`,y=!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}.`,y=!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"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,x,{suppressInline:!0}),y}reportValidity(){return super.reportValidity()}}return br([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),br([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),br([H({context:ze})],a.prototype,"_dragDrop",void 0),br([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),br([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var ss=class{getInsertPosition(t,e,n,r,i){let s=t.indexOf(n);if(s===-1)return null;let a=n.getBoundingClientRect(),l=(i-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var qp=new ss;var Ef={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function vr(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function as(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function ls(o,t,e={}){let n={...Ef,...e},r=document.createElement("div");return r.setAttribute("data-drop-placeholder","true"),r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.margin=window.getComputedStyle(o).margin,r.style.boxSizing="border-box",r.style.border=`${n.borderStyle} ${n.borderColor}`,r.style.borderRadius=getComputedStyle(o).borderRadius,r.style.background=n.background,r.style.transition=`transform ${n.transitionDuration*rs(o)}ms ease`,r.style.pointerEvents="none",r}function ic(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var jt=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#n=vr(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#r=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#n;#i;#r;#o;set allowReorder(r){this.#o=r}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(r){return ic(r,this.trackedDroppables)}#s(r){return r.querySelector(t)}#a(r){let i=this.#c(r);return i===0||i>1}#c(r){let i=parseInt(r.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#p(r){return r.querySelectorAll(t).length}#l(r){let i=this.#c(r);return i===0?!1:this.#p(r)>=i}#f(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(r){if(!this.#t||r===this.#t){this.#u();return}if(this.#i.hoveredSlot===r)return;this.#u();let i=this.#s(r);if(!i){this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r;return}if(this.#a(r)){if(this.#l(r)){this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),this.#i.hoveredSlot=null;return}this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r;return}if(this.isDeclarativeTarget(r)){this.#n.placeholder?.parentElement&&this.#n.placeholder.remove(),this.#i.hoveredSlot=r;return}let a=Be([i]);this.#i.originalPositions.set(i,r),this.#n.placeholder&&this.#n.placeholder.parentElement&&this.#n.placeholder.remove(),this.#t.appendChild(i),this.#n.placeholder&&r.appendChild(this.#n.placeholder),this.#i.hoveredSlot=r,Ue(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let r=Array.from(this.#i.originalPositions.keys()),i=r.length>0?Be(r):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#n.placeholder&&this.#t&&this.#t.appendChild(this.#n.placeholder),i&&Ue(i,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(r,i,s,a,...l){this.#t=null,this.#n=vr(),this.#f();let c=this.findContainingDroppable(r);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#n.sortContainer=c;let h=r.getBoundingClientRect();this.#n.placeholder=ls(r,h,this.sortablePlaceholderConfig);let f=r.getAttribute("slot");f&&this.#n.placeholder.setAttribute("slot",f),this.#n.placeholder.style.visibility="hidden",c.appendChild(this.#n.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#r.add(m)}})}let[d]=l;super.initiateDrag(r,i,s,a,d)}cleanupSortableState(r=!0){if(r)for(let[i,s]of this.#i.originalPositions)s.appendChild(i);this.#n.placeholder&&this.#n.placeholder.remove(),as(this.#n),this.#r.clear(),this.#t=null,this.#f()}onSortableDragMove(r,i){if(!this.isDraggingFromSlot)return;let s=Zn(this.trackedDroppables,r,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#u()}handleDragMove(r,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,r,i),this.onSortableDragMove(r,i)}allowDrop(r,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.#l(i):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(i)?!0:super.allowDrop(r,i)}handleDrop(r,i){super.handleDrop(r,i),this.cleanupSortableState(!1)}handleInvalidDrop(r){this.cleanupSortableState(),super.handleInvalidDrop(r)}}return e};var kp=[O,W,Qt,q`
|
|
8398
|
+
<slot part="label"></slot>`}};ts([p({type:String,attribute:"template-identifier"})],zt.prototype,"templateIdentifier",void 0);ts([p({type:String,attribute:"show-hide"})],zt.prototype,"showHide",void 0);ts([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],zt.prototype,"fixed",void 0);ts([p({type:String,attribute:!1})],zt.prototype,"marker",void 0);var lp=[{tag:"qti-simple-choice",ctor:zt}];var cp=[...Bh,...Hh,...Qh,...Yh,...Kh,...tp,...ip,...rp,...sp,...lp];var yf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n};function wf(o,t,e,i,r={}){let n=r.publishWidth??!0,s=r.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=i.length?i:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),r.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),i.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Xl=(o,t,e,i='slot[part="drags"]')=>{class r extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#i=null,this.#n=0,this.#r=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#i;#n;#r;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(i,this),...s(i,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(wf(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#r;return d&&d.height===c.height&&d.width===c.width?!1:(this.#r=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#i||(this.#i=new MutationObserver(()=>this.#s()),this.#i.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 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.#i?.disconnect(),this.#i=null,this.#n&&cancelAnimationFrame(this.#n),this.#n=0,super.disconnectedCallback()}}return yf([p({type:Boolean,attribute:"auto-size-dropzones"})],r.prototype,"autoSizeDropzones",void 0),r};var{AbortController:Zt,AbortSignal:Yl,WeakMap:xf,WeakRef:qf,Window:dp,reportError:es=console.log}=globalThis,Fe=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Fe(o.defaultView.parent.document)),wi=()=>!!dp&&globalThis instanceof dp,Jl=Symbol("unset"),[hp,kf]=(()=>{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 i(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let r=new xf,n={next(...x){let u=this,g=r.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=r.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=r.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(n);return r.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=i(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return i(x,g)}let l="any"in Yl?Yl.any.bind(Yl):x=>{let u=new Zt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){r.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=r.get(this)||{};g&&g(u)}error(u){let{error:g}=r.get(this)||{};g?g(u):es(u)}complete(){let{complete:u}=r.get(this)||{};u&&u()}}function h(x,u){let g=r.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(wi()&&!Fe(document))return;try{b()}catch(w){es(w)}}}}function f(x,u,g={}){if(wi()&&!Fe(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=r.get(x),T=w.weakSubscriber?.deref();if(T?.active){let C=T,S=r.get(C);S.observers.add(b),g.signal&&(g.signal.aborted?S.observers.delete(b):g.signal.addEventListener("abort",()=>{let R=r.get(C);R?.active&&(R.observers.delete(b),R.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(w.weakSubscriber=new qf(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=r.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");r.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Zt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=r.get(this);if(!g?.active||wi()&&!Fe(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=r.get(this);if(!g?.active){es(u);return}if(wi()&&!Fe(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=r.get(this);if(!u?.active||wi()&&!Fe(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(wi()&&!Fe(document))return;let g=r.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!r.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!r.has(this)){let u=new Zt;return u.abort(),u.signal}return r.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 y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");r.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 y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let T=function(A,C){if(A.signal.aborted)return;let S;try{let R=C.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(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),T(A,C)},R=>{A.error(R)})},w=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(R){A.error(R);return}let S=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),T(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(w=>{if(w.signal.aborted)return;let T;try{T=a(u,!1)}catch(S){w.error(S);return}let A=!1,C=T;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let S=C.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=C.next();if({done:A}=S,A){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new y(w=>{u.then(T=>{w.next(T),w.complete()},T=>{w.error(T)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(w=>{let T=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(b,T,A),!w.active)return;let C=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=new d({next(C){let S;try{S=u(C,w)}catch(R){b.error(R);return}w+=1,b.next(S)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}inspect(u={}){let g=null,b=null,w=null,T=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&&(T=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(S=>{if(g!==null)try{g()}catch(L){S.error(L);return}let R=()=>{try{A!==null&&A(S.signal.reason)}catch(L){es(L)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(b!==null)try{b(L)}catch(pt){S.signal.removeEventListener("abort",R),S.error(pt);return}S.next(L)},error(L){if(S.signal.removeEventListener("abort",R),w!==null)try{w(L)}catch(pt){S.error(pt);return}S.error(L)},complete(){if(S.signal.removeEventListener("abort",R),T!==null)try{T()}catch(L){S.error(L);return}S.complete()}}),V={signal:S.signal};f(C,N,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=new d({next(C){let S=!1;try{S=u(C,w)}catch(R){b.error(R);return}w+=1,S&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let w=u;if(w==0)return b.complete();let T=new d({next(C){b.next(C),w-=1,w==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let w=u,T=new d({next(C){if(w>0)return w-=1;w==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,T,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=!1,A=[];function C(V){let L;try{L=u(V,w)}catch(re){return b.error(re)}w+=1;let pt;try{pt=y.from(L)}catch(re){return b.error(re)}let La=new d({next(re){b.next(re)},error(re){b.error(re)},complete(){if(A.length){let re=A.shift();C(re)}else S=!1,T&&b.complete()}}),Ut={signal:b.signal};f(pt,La,Ut)}let S=!1,R=new d({next(V){S?A.push(V):(S=!0,C(V))},error(V){b.error(V)},complete(){T=!0,!S&&!A.length&&b.complete()}}),N={signal:b.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let w=0,T=!1,A=null;function C(N){let V;try{V=u(N,w)}catch(Ut){return b.error(Ut)}w+=1;let L;try{L=y.from(V)}catch(Ut){return b.error(Ut)}let pt=new d({next(Ut){b.next(Ut)},error(Ut){b.error(Ut)},complete(Ut){T?b.complete():A=null}}),La={signal:c([A.signal,b.signal])};f(L,pt,La)}let S=new d({next(N){A&&A.abort(),A=new Zt,C(N)},error(N){b.error(N)},complete(){T=!0,A||b.complete()}}),R={signal:b.signal};f(g,S,R)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(w=>{let T=new d({next(C){w.next(C)},error(C){let S;try{S=u(C)}catch(L){w.error(L);return}let R;try{R=y.from(S)}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,T,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let w=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),T={signal:b.signal};f(g,w,T)})}toArray(u={}){if(!(this instanceof y))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 T=[],A=new d({next(C){T.push(C)},error(C){w(C)},complete(){b(T)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(V){T(V),A.abort(V)}S+=1},error(N){T(N)},complete(){w()}});return f(this,R,C),b}every(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch(L){T(L),A.abort(L)}S+=1,V||(w(!1),A.abort())},error(N){T(N)},complete(){w(!0)}});return f(this,R,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:w}=e(),T=new Zt,A={signal:c([T.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let C=new d({next(S){b(S),T.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))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 T=null,A=!1,C=new d({next(S){A=!0,T=S},error(S){w(S)},complete(){A?b(T):w(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch(L){T(L),A.abort(L)}S+=1,V&&(w(N),A.abort())},error(N){T(N)},complete(){w()}});return f(this,R,C),b}some(u,g={}){if(!(this instanceof y))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:T}=e(),A=new Zt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return T(C.signal.reason),b;C.signal.addEventListener("abort",()=>{T(C.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch(L){T(L),A.abort(L)}S+=1,V&&(w(!0),A.abort())},error(N){T(N)},complete(){w(!1)}});return f(this,R,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:T,reject:A}=e(),C=new Zt,S={signal:c([C.signal,b.signal])};if(S.signal.aborted)return A(S.signal.reason),w;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Jl,V=new d({next(L){if(N===Jl){N=L,R++;return}try{let pt=u(N,L,R);R++,N=pt}catch(pt){A(pt),C.abort(pt);return}},error(L){A(L)},complete(){N!==Jl?T(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,S),w}}return o(y.prototype,"subscribe"),[y,m]})();function pp(){return typeof globalThis.Observable=="function"}function up(){Object.defineProperties(globalThis,{Observable:{value:hp,configurable:!0,writable:!0},Subscriber:{value:kf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(wi()&&!Fe(document))return;let e=this;return new hp(i=>{if(!e||i.signal.aborted)return;let r=n=>{i.next(n)};e.addEventListener(o,r,{capture:t.capture||!1,passive:t.passive,once:!1,signal:i.signal})})}}function Kl(o,t,e){let i=o.filter(r=>!r.hasAttribute("disabled"));for(let r of i){let n=r.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return r}return null}function mp(o,t,e,i){if(!i)return null;let r=o.filter(s=>!s.hasAttribute("disabled")),n=i.getBoundingClientRect();for(let s of r){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function fp(o,t,e,i){let r=o.filter(c=>!c.hasAttribute("disabled"));if(r.length===0)return null;let n,s;if(i){let c=i.getBoundingClientRect();n=c.left+c.width/2,s=c.top+c.height/2}else n=t,s=e;let a=null,l=1/0;for(let c of r){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function gp(o,t,e,i){let r=o.filter(l=>!l.hasAttribute("disabled"));if(r.length===0)return null;let n;if(i){let l=i.getBoundingClientRect();n=[{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 n=[{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 r){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 y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function Cf(o,t,e){let i=o.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}function Sf(o,t,e,i,r){let n=r&&r.length>0?o.filter(g=>r.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let l;if(i){let g=i.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 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}],T=0,A=0;for(let C of l)for(let S of w){let R=Math.sqrt(Math.pow(C.x-S.x,2)+Math.pow(C.y-S.y,2));T+=R,A++}return T/A},d=null,h=1/0;for(let g of n){let b=c(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=c(g);b<m&&(m=b,f=g)}if(d&&i){let g=i.getBoundingClientRect(),b=d.getBoundingClientRect(),w=g.left+g.width/2,T=g.top+g.height/2;if(w>=b.left&&w<=b.right&&T>=b.top&&T<=b.bottom)return d}if(f&&Cf(f,t,e))return f;let x=i?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function bp(o){switch(o){case"pointerWithin":return Kl;case"rectangleIntersection":return mp;case"closestCenter":return fp;case"closestCorners":return gp;case"closestCornersWithInventoryPriority":return Sf;default:return Kl}}function Zi(o,t,e,i,r="pointerWithin",n){return bp(r)(o,t,e,i,n)}function Be(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let i of e)if(i instanceof HTMLElement&&i.tagName!=="SLOT"){if(i.matches(t)||i.hasAttribute("qti-draggable"))return i;let r=i.closest(t)||i.closest('[qti-draggable="true"]');if(r)return r}return null}function gr(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Zl=o=>o?.internals;function Vt(o,t,e){let i=Zl(o)?.states;i&&(e?i.add(t):i.delete(t))}function is(o,t){return Zl(o)?.states?.has(t)??!1}function br(o){Vt(o,"dragging",!1),Vt(o,"placeholder",!1),Vt(o,"return-anchor",!1)}function xi(o){return is(o,"dragging")||is(o,"placeholder")}function ve(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let i=Zl(o)?.states;if(i){e?i.add(t):i.delete(t);return}let r=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));r.has("drop")&&(e?r.add(t):r.delete(t),o.setAttribute("part",[...r].join(" ")))}function tn(o,t){ve(o,"filled",t)}function en(o,t){let e=[];return o.forEach(i=>{let r=[];i.tagName.toLowerCase()==="slot"?r=i.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):r=Array.from(i.querySelectorAll(`[identifier="${t}"]`)),e.push(...r)}),e}function vp(o,t){let e=o.find(r=>r.getAttribute("identifier")===t);if(!e)return 1;let i=e.getAttribute("match-max");return i?parseInt(i,10)||0:1}var tc={origin:{x:0,y:0},scale:{x:1,y:1}},ns=100,Ef=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Af=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Tf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},ec=(o,t)=>{let e=o.ownerDocument??document,i=t??e.body,r=Ef(e);return r&&!Tf(r,i)?Af(r):i},ic=(o,t=1)=>{let i=(o.ownerDocument??document).createElement("div");i.style.cssText=`position:fixed;left:0;top:0;width:${ns}px;height:${ns}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(i);let r=i.getBoundingClientRect();return i.remove(),{origin:{x:r.left,y:r.top},scale:{x:(r.width/ns||1)*t,y:(r.height/ns||1)*t}}},yp=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});pp()||up();var wp=new WeakSet;function If(o){!o||wp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),wp.add(o))}var xp=o=>!!o.internals?.states,rs=(o,t,e,i='slot[part="drags"]',r="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=r,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=tc,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#i=a=>{let l=a;if(l.context!==Oi)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.#i,{capture:!0}),If(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#i,{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;#i;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(i,this),u=a(i,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),T=g?b:new Set,A=g?w:new Set,C=new Set([...b,...w].filter(xp));for(let S of this.#t)C.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of C){let R=T.has(S),N=!R&&A.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=C,this.trackedDraggables.forEach(S=>{let R=xi(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Be(m,t),x=this.disabled||this.readonly,u=gr(y)||xi(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Be(m,t);if(!y){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(y,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(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let y=Be(m,t),x=this.disabled||this.readonly,u=gr(y)||xi(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Be(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Be(m,t),x=this.disabled||this.readonly,u=gr(y)||xi(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Be(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,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 y=this.trackedDraggables.filter(u=>!xi(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=Be(m,t),g=this.disabled||this.readonly,b=gr(u)||xi(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:y.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 y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||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: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 b=a.getAttribute("identifier");if(b){let w=en(this.trackedDragContainers,b);w.forEach(T=>Vt(T,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Vt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,T=this.dragState.pointerId;w&&T!==void 0&&w.setPointerCapture&&w.setPointerCapture(T)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let 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),l==="pointer")try{let w=this.dragState.dragSource,T=this.dragState.pointerId;w&&T!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(T)}catch{}};this.dragState.touchCleanup=b}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(l==="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())}}),y=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];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Zi(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=>ve(m,"hover",!1)),c&&ve(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 y=l.getBoundingClientRect();h=Zi(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Vt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{Vt(y,"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){br(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))}c.style.removeProperty("box-shadow");let h=ec(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=ic(h,this.cloneZoom),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.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}=yp(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=ec(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=ic(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{ve(a,"enabled",!0),ve(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ve(a,"enabled",!1),ve(a,"active",!1),ve(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Vt(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=tc,this.cloneZoom=1,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)xp(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return n};var qp={duration:250,easing:"ease",fill:"both"};function nc(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function kp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Ue(o){let t=new Map;return o.forEach(e=>{t.set(e,nc(e))}),t}function Cp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function os(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 rc(o){return os(o)>0}function ss(o,t,e={}){let i=os(o);if(i<=0)return null;let r=nc(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:l}=Cp(t,r);if(n===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...qp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*i,easing:d,fill:h})}function He(o,t={}){let e=new Map;return o.forEach((i,r)=>{if(!(r instanceof HTMLElement))return;let n=ss(r,i,t);n&&e.set(r,n)}),e}var vr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},jt=(o,t,e,i='slot[part="drags"]',r="closestCornersWithInventoryPriority")=>{let n=Xl(o,t,e,i),s=rs(n,t,e,i,r);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,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}#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&&tn(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()),tn(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}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,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(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(is(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=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(()=>{ss(c,kp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){br(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=en(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 T=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),T&&this.restoreOriginalInInventory(T,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Ue(u):null;if(!x){let T=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(T){let A=T.getAttribute("identifier"),C=T.getBoundingClientRect();this.removeChipFromDroppable(d,T);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,T),tn(R,!0),this.animateReturn(T,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=c.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",b.localName==="qti-gap-text"?"drag drag-text":"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)),tn(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&He(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let T=b.getBoundingClientRect(),A=h.left-T.left,C=h.top-T.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&tn(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=en(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 y=this.enableFlipAnimations&&m.length>0?Ue(m):null;h.forEach(x=>{br(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&He(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=en(this.trackedDragContainers,c),h=vp(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{Vt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),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="",y=!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}.`,y=!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}.`,y=!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"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,x,{suppressInline:!0}),y}reportValidity(){return super.reportValidity()}}return vr([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),vr([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),vr([H({context:Ve})],a.prototype,"_dragDrop",void 0),vr([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),vr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Yt({emptyAs:[]})})],a.prototype,"response",null),a};var as=class{getInsertPosition(t,e,i,r,n){let s=t.indexOf(i);if(s===-1)return null;let a=i.getBoundingClientRect(),l=(n-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Sp=new as;var _f={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function yr(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function ls(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function cs(o,t,e={}){let i={..._f,...e},r=document.createElement("div");return r.setAttribute("data-drop-placeholder","true"),r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.margin=window.getComputedStyle(o).margin,r.style.boxSizing="border-box",r.style.border=`${i.borderStyle} ${i.borderColor}`,r.style.borderRadius=getComputedStyle(o).borderRadius,r.style.background=i.background,r.style.transition=`transform ${i.transitionDuration*os(o)}ms ease`,r.style.pointerEvents="none",r}function oc(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ft=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#i=yr(),this.#n={hoveredSlot:null,originalPositions:new Map},this.#r=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#i;#n;#r;#o;set allowReorder(r){this.#o=r}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(r){return oc(r,this.trackedDroppables)}#s(r){return r.querySelector(t)}#a(r){let n=this.#c(r);return n===0||n>1}#c(r){let n=parseInt(r.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(r){return r.querySelectorAll(t).length}#l(r){let n=this.#c(r);return n===0?!1:this.#p(r)>=n}#f(){this.#n={hoveredSlot:null,originalPositions:new Map}}#d(r){if(!this.#t||r===this.#t){this.#u();return}if(this.#n.hoveredSlot===r)return;this.#u();let n=this.#s(r);if(!n){this.#i.placeholder&&r.appendChild(this.#i.placeholder),this.#n.hoveredSlot=r;return}if(this.#a(r)){if(this.#l(r)){this.#i.placeholder&&this.#t&&this.#t.appendChild(this.#i.placeholder),this.#n.hoveredSlot=null;return}this.#i.placeholder&&r.appendChild(this.#i.placeholder),this.#n.hoveredSlot=r;return}if(this.isDeclarativeTarget(r)){this.#i.placeholder?.parentElement&&this.#i.placeholder.remove(),this.#n.hoveredSlot=r;return}let a=Ue([n]);this.#n.originalPositions.set(n,r),this.#i.placeholder&&this.#i.placeholder.parentElement&&this.#i.placeholder.remove(),this.#t.appendChild(n),this.#i.placeholder&&r.appendChild(this.#i.placeholder),this.#n.hoveredSlot=r,He(a,this.sortableAnimationConfig)}#u(){if(this.#n.originalPositions.size===0&&this.#n.hoveredSlot===null)return;let r=Array.from(this.#n.originalPositions.keys()),n=r.length>0?Ue(r):null;for(let[s,a]of this.#n.originalPositions)a.appendChild(s);this.#i.placeholder&&this.#t&&this.#t.appendChild(this.#i.placeholder),n&&He(n,this.sortableAnimationConfig),this.#n.originalPositions.clear(),this.#n.hoveredSlot=null}initiateDrag(r,n,s,a,...l){this.#t=null,this.#i=yr(),this.#f();let c=this.findContainingDroppable(r);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#i.sortContainer=c;let h=r.getBoundingClientRect();this.#i.placeholder=cs(r,h,this.sortablePlaceholderConfig);let f=r.getAttribute("slot");f&&this.#i.placeholder.setAttribute("slot",f),this.#i.placeholder.style.visibility="hidden",c.appendChild(this.#i.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#r.add(m)}})}let[d]=l;super.initiateDrag(r,n,s,a,d)}cleanupSortableState(r=!0){if(r)for(let[n,s]of this.#n.originalPositions)s.appendChild(n);this.#i.placeholder&&this.#i.placeholder.remove(),ls(this.#i),this.#r.clear(),this.#t=null,this.#f()}onSortableDragMove(r,n){if(!this.isDraggingFromSlot)return;let s=Zi(this.trackedDroppables,r,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#u()}handleDragMove(r,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,r,n),this.onSortableDragMove(r,n)}allowDrop(r,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(r,n)}handleDrop(r,n){super.handleDrop(r,n),this.cleanupSortableState(!1)}handleInvalidDrop(r){this.cleanupSortableState(),super.handleInvalidDrop(r)}}return e};var Ep=[O,W,Gt,q`
|
|
8310
8399
|
:host {
|
|
8311
8400
|
display: block; /* necessary to calculate scaling position */
|
|
8312
8401
|
}
|
|
@@ -8359,9 +8448,9 @@ div.full-correct-response-inline {
|
|
|
8359
8448
|
:host([answer-key]) ::slotted(qti-simple-associable-choice) {
|
|
8360
8449
|
display: none;
|
|
8361
8450
|
}
|
|
8362
|
-
`];var
|
|
8363
|
-
${G(
|
|
8364
|
-
</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
|
|
8451
|
+
`];var Nf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},$f=jt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),qi=class extends Ft($f,'[qti-draggable="true"]'){static{this.styles=Ep}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 i=e;this._childrenMap.includes(i)||(this._childrenMap=[...this._childrenMap,i])}#t(t,e){let i=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
|
|
8452
|
+
${G(i,r=>r.getAttribute("identifier"),r=>r)}
|
|
8453
|
+
</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 i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),n=i&&this.chipsIn(i)[0]?.getAttribute("identifier"),s=r&&this.chipsIn(r)[0]?.getAttribute("identifier");n&&s&&t.push(`${n} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,i)=>{let r=e.split(" ");return r.length!==2?[]:[`${r[0]} droplist${i}_left`,`${r[1]} droplist${i}_right`]})??[]}render(){return v` <slot name="prompt"></slot>
|
|
8365
8454
|
<slot part="drags" name="qti-simple-associable-choice"></slot>
|
|
8366
8455
|
<div part="drops">
|
|
8367
8456
|
${this._childrenMap.length>0&&Array.from({length:this.#e},(t,e)=>v`<div part="drop-row">
|
|
@@ -8370,7 +8459,7 @@ div.full-correct-response-inline {
|
|
|
8370
8459
|
</div>`)}
|
|
8371
8460
|
|
|
8372
8461
|
<div role="alert" part="message" id="validation-message"></div>
|
|
8373
|
-
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};
|
|
8462
|
+
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Nf([_()],qi.prototype,"_childrenMap",void 0);var ds=[{tag:"qti-associate-interaction",ctor:qi}];var We=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Qe=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(r,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(r,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(r,n){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(r){this.maxChoices>1&&(typeof r=="string"||r===null)?this.response=r?r.toString().split(","):[]:this.response=r||""}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 r=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{r.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&n>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let r=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==r&&(this._interactionContext={...this._interactionContext,choiceRole:r})}_choiceElementSelectedHandler(r){this._toggleChoiceChecked(r.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==r.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(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(r,n){r.internals?.states&&(n?(r.internals.states.add("checked"),r.internals.ariaChecked="true"):(r.internals.states.delete("checked"),r.internals.ariaChecked="false"))}_getChoiceChecked(r){return r.internals.states.has("checked")}_toggleChoiceChecked(r){let n=this._getChoiceChecked(r);this._setChoiceChecked(r,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let r=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=r.includes(n.identifier);this._setChoiceChecked(n,s)})}}return We([Ri("#validation-message")],e.prototype,"_validationMessageElement",void 0),We([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),We([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),We([z("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),We([z("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),We([z("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),We([p({attribute:"response",reflect:!1,converter:Yt({emptyAs:""})})],e.prototype,"response",void 0),We([z("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Lf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ap=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#i=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#n=null;set class(r){this.#t=this.#r(r),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(r,n,s){super.attributeChangedCallback(r,n,s),r==="class"&&n!==s&&(this.class=s??"")}updated(r){super.updated(r),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#n=new MutationObserver(r=>{r.some(n=>n.type==="childList"||n.type==="attributes"&&n.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}#r(r){return r?r.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let r=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),n=this.#s(r),s=this.#a(),a=this.#c();n.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(r){return r.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(r=>this.#e.includes(r)).pop()??null}#c(){return this.#t.filter(r=>this.#i.includes(r)).pop()??null}#p(r,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${r}`;break;case"qti-labels-lower-alpha":l=this.#l(r,"lower");break;case"qti-labels-upper-alpha":l=this.#l(r,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(r,n){let s=r,a="",l=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Lf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Tp=[O,W,q`
|
|
8374
8463
|
:host {
|
|
8375
8464
|
display: block;
|
|
8376
8465
|
}
|
|
@@ -8439,16 +8528,16 @@ div.full-correct-response-inline {
|
|
|
8439
8528
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
8440
8529
|
grid-row: auto;
|
|
8441
8530
|
}
|
|
8442
|
-
`];var
|
|
8531
|
+
`];var zf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ki=class extends Ap(Qe(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Tp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
|
|
8443
8532
|
<slot part="prompt" name="prompt"></slot>
|
|
8444
8533
|
<slot part="slot" @slotchange=${this.#t}></slot>
|
|
8445
8534
|
<div part="message" role="alert" id="validation-message"></div>
|
|
8446
|
-
`}};
|
|
8535
|
+
`}};zf([p({type:String})],ki.prototype,"orientation",void 0);var hs=[{tag:"qti-choice-interaction",ctor:ki}];var Ip=[O,q`
|
|
8447
8536
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
8448
8537
|
:host {
|
|
8449
8538
|
display: block;
|
|
8450
8539
|
}
|
|
8451
|
-
`];var
|
|
8540
|
+
`];var wr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},sc=`
|
|
8452
8541
|
const postToParentWindows = (type, data) => {
|
|
8453
8542
|
window.top.postMessage(data ? { type, data } : { type }, '*');
|
|
8454
8543
|
let w = window.parent;
|
|
@@ -8515,7 +8604,7 @@ window.CES = {
|
|
|
8515
8604
|
},
|
|
8516
8605
|
};
|
|
8517
8606
|
CES.load();
|
|
8518
|
-
`,
|
|
8607
|
+
`,Vf=`
|
|
8519
8608
|
(function() {
|
|
8520
8609
|
var blobUrlReceived = null;
|
|
8521
8610
|
|
|
@@ -8559,7 +8648,7 @@ CES.load();
|
|
|
8559
8648
|
requestBlobUrl();
|
|
8560
8649
|
}
|
|
8561
8650
|
})();
|
|
8562
|
-
`,
|
|
8651
|
+
`,ye=class extends D{#t;#e;#i;static{this.styles=Ip}constructor(){super(),this.#t="",this.#e=null,this.#i=null,this._errorMessage=null,this.#n=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#n;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let i=this.querySelector("object[data]");if(i){t=i.getAttribute("data");let r=i.getAttribute("width"),n=i.getAttribute("height");r&&this.setAttribute("width",r),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:so((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(i=>i.json()).then(i=>{this.manifest=i,this.setupCES()}).catch(i=>{this._errorMessage=i})}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 i=this.manifest.style[0],r=this.#a(),n=await this.#l(i,r),s=n.url;if(n.baseUrl&&!this.#i&&(this.#i=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,r,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#i&&(this.#i=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+sc+"</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",y=await this.#l(m,r,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#i&&(this.#i=y.baseUrl),y.text){let x=y.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+sc+"</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>"+sc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let y=new Blob([f],{type:"text/html"});this.#n=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${Vf}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
|
|
8563
8652
|
<!DOCTYPE html>
|
|
8564
8653
|
<html>
|
|
8565
8654
|
<head>
|
|
@@ -8568,7 +8657,7 @@ CES.load();
|
|
|
8568
8657
|
</head>
|
|
8569
8658
|
<body></body>
|
|
8570
8659
|
</html>
|
|
8571
|
-
`;t.srcdoc=c}#r(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),
|
|
8660
|
+
`;t.srcdoc=c}#r(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),i=[...t,...e];for(let r of i){let n=r.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let a=r.contentDocument||r.contentWindow.document;a&&this.#o(a,i)}catch(a){console.error("Error accessing nested iframe:",a)}}return i.forEach((r,n)=>{i.indexOf(r)!==n&&i.splice(n,1)}),i}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(r=>{e.push(r);let n=r.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let a=r.contentDocument||r.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",n)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let i=this.#r();for(let r of i)r.contentWindow&&r.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:i}=t.data;switch(e){case"setResponse":(i===null||!(Array.isArray(i)&&i.length===1&&i[0]===""))&&(this.#t=i,this.saveResponse(i));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 r=this.#a(),n=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#i||r[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",n);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 v`<iframe
|
|
8572
8661
|
width=${this.getAttribute("width")}
|
|
8573
8662
|
height=${this.getAttribute("height")}
|
|
8574
8663
|
frameborder="0"
|
|
@@ -8579,9 +8668,9 @@ CES.load();
|
|
|
8579
8668
|
${this._errorMessage&&v`<div style="color:red">
|
|
8580
8669
|
<h1>Error</h1>
|
|
8581
8670
|
${this._errorMessage}
|
|
8582
|
-
</div>`}`}#a(){let e=[this.#
|
|
8671
|
+
</div>`}`}#a(){let e=[this.#i,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(r=>new URL(r,window.location.href).toString()),i=this.#p();return i&&e.push(i),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,i={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let r of e){let n=new URL(r,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(i.returnText){let l=await a.text();return{url:s,baseUrl:n,text:l}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};wr([p({type:String,attribute:"data"})],ye.prototype,"data",void 0);wr([p({type:String,attribute:"data-base-item"})],ye.prototype,"baseItemUrl",void 0);wr([p({type:String,attribute:"data-base-ref"})],ye.prototype,"baseRefUrl",void 0);wr([p({type:String,attribute:"id"})],ye.prototype,"id",void 0);wr([_()],ye.prototype,"_errorMessage",void 0);var ps=[{tag:"qti-custom-interaction",ctor:ye}];var _p=[O];var xr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},we=class extends k{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=_p}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",i=t.variables?.find(r=>r.identifier==="completionStatus")?.value;return e&&i==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
|
|
8583
8672
|
${this.title}
|
|
8584
|
-
</button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};
|
|
8673
|
+
</button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};xr([p({type:String,attribute:"response-identifier"})],we.prototype,"responseIdentifier",void 0);xr([p({reflect:!0,type:Boolean})],we.prototype,"disabled",void 0);xr([I({context:j,subscribe:!0}),_()],we.prototype,"_itemContext",void 0);xr([p({type:String,attribute:"count-attempt"})],we.prototype,"countAttempt",void 0);xr([p({type:String})],we.prototype,"title",void 0);var us=[{tag:"qti-end-attempt-interaction",ctor:we}];var Rp=[O,q`
|
|
8585
8674
|
/* PK: display host as block, else design will be collapsed */
|
|
8586
8675
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
8587
8676
|
:host {
|
|
@@ -8594,7 +8683,7 @@ CES.load();
|
|
|
8594
8683
|
height: 100%;
|
|
8595
8684
|
border: 0;
|
|
8596
8685
|
}
|
|
8597
|
-
`];var gt=function(o,t,e,
|
|
8686
|
+
`];var gt=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Op=5,jf=50,Pp="qti-height-lines-",Mp=!1,X=class extends D{constructor(){super(...arguments),this._rows=Op,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Mp||(Mp=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Rp}_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/jf):Op}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Pp))continue;let e=parseInt(t.slice(Pp.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="",i=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let r=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,n=new RegExp(r);i=t.checkValidity()&&n.test(t.value),i||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else i=t.checkValidity();return i&&!this.response&&this.minStrings>=1&&(i=!1),!i&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(i,e,t,{suppressInline:!0}),i}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
|
|
8598
8687
|
part="textarea"
|
|
8599
8688
|
name="${this.responseIdentifier}"
|
|
8600
8689
|
spellcheck="false"
|
|
@@ -8609,7 +8698,7 @@ CES.load();
|
|
|
8609
8698
|
?disabled="${this.disabled}"
|
|
8610
8699
|
?readonly="${this.readonly}"
|
|
8611
8700
|
.value=${this.response}
|
|
8612
|
-
></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${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))}};gt([_()],X.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],X.prototype,"format",void 0);gt([z("format")],X.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],X.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);gt([z(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);gt([z("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var
|
|
8701
|
+
></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${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))}};gt([_()],X.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],X.prototype,"format",void 0);gt([z("format")],X.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],X.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);gt([z(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);gt([z("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var ms=[{tag:"qti-extended-text-interaction",ctor:X}];var Dp=[O,W,q`
|
|
8613
8702
|
:host {
|
|
8614
8703
|
display: flex;
|
|
8615
8704
|
align-items: flex-start;
|
|
@@ -8653,10 +8742,10 @@ CES.load();
|
|
|
8653
8742
|
:host([answer-key]) [part~='drags'] {
|
|
8654
8743
|
display: none;
|
|
8655
8744
|
}
|
|
8656
|
-
`];var
|
|
8745
|
+
`];var nn=class extends Ft(jt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=Dp}render(){return v`<slot name="prompt"> </slot>
|
|
8657
8746
|
<slot part="drags" name="drags"></slot>
|
|
8658
8747
|
<slot part="drops"></slot>
|
|
8659
|
-
<div role="alert" part="message" id="validation-message"></div>`}};var
|
|
8748
|
+
<div role="alert" part="message" id="validation-message"></div>`}};var fs=[{tag:"qti-gap-match-interaction",ctor:nn}];function zp(o){return o.querySelector('img, object[type^="image"]')}function Np(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let i=parseFloat(e);return Number.isFinite(i)&&i>0?i:null}var Vp=new WeakMap,$p=new WeakMap;function Ff(o){let t=$p.get(o);return t||(t=new Promise(e=>{let i=o.data;if(!i){e(null);return}let r=new Image;r.onload=()=>{let n={width:r.naturalWidth,height:r.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}Vp.set(o,n),e(n)},r.onerror=()=>e(null),r.src=i}),$p.set(o,t)),t}function Bf(o){if(o.localName==="object")return Vp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function gs(o){let t=Np(o,"width"),e=Np(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let i=Bf(o);return i?{width:t??i.width,height:e??i.height}:null}function Uf(o){let t=gs(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Ff(o).then(()=>gs(o));let e=o;return e.complete?Promise.resolve(null):new Promise(i=>{let r=()=>{e.removeEventListener("load",r),e.removeEventListener("error",r),i(gs(o))};e.addEventListener("load",r),e.addEventListener("error",r)})}function te(o,t,e,i){let r=gs(e);if(r){Lp(o,t,r,i);return}Uf(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Lp(o,t,n,i)})}function Lp(o,t,{width:e,height:i},r){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,l=n/e*100,c=s/i*100,d=a/e*100,h=a/i*100;r.style.left=l-d+"%",r.style.top=c-h+"%",r.style.width=2*d+"%",r.style.height=2*h+"%",r.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,l]=t,c=n/e*100,d=s/i*100,h=a/e*100,f=l/i*100;r.style.left=c+"%",r.style.top=d+"%",r.style.width=h-c+"%",r.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,l]=t,c=n/e*100,d=s/i*100,h=a/e*100,f=l/i*100;r.style.left=c-h+"%",r.style.top=d-f+"%",r.style.width=2*h+"%",r.style.height=2*f+"%",r.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),l=Math.min(...n.map(b=>b.y)),c=Math.max(...n.map(b=>b.y)),d=s/e*100,h=l/i*100,f=a/e*100,m=c/i*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=f-d+"%",r.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-l)/(c-l)*100})),x=y.map(b=>`${b.x}% ${b.y}%`).join(",");r.style.clipPath=`polygon(${x})`;let u=y.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>`)}")`;r.style.setProperty("--qti-shape-outline",g(4)),r.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":r.style.left="0%",r.style.top="0%",r.style.width="100%",r.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var jp=[O,W,q`
|
|
8660
8749
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
8661
8750
|
the theme, together with a 'display: block' this component now owns. */
|
|
8662
8751
|
:host {
|
|
@@ -8686,14 +8775,14 @@ CES.load();
|
|
|
8686
8775
|
top: 0px;
|
|
8687
8776
|
left: 0px;
|
|
8688
8777
|
}
|
|
8689
|
-
`];var
|
|
8778
|
+
`];var qr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Bt=class extends D{static{this.styles=jp}#t;#e;#i;constructor(){super(),this.#t=[],this.#e=null,this.#i=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#r().length>0}set response(t){this._response=this.#n(t)}get response(){return this._response}#n(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#r(){return this.#n(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
|
|
8690
8779
|
<line-container>
|
|
8691
8780
|
<svg
|
|
8692
8781
|
width=${Q(this.grImage[0]?.width)}
|
|
8693
8782
|
height=${Q(this.grImage[0]?.height)}
|
|
8694
8783
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
8695
8784
|
>
|
|
8696
|
-
${G(this.#r(),t=>t,(t,e)
|
|
8785
|
+
${G(this.#r(),t=>t,(t,e)=>Ln`
|
|
8697
8786
|
<line
|
|
8698
8787
|
part="line"
|
|
8699
8788
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -8702,11 +8791,11 @@ CES.load();
|
|
|
8702
8791
|
y2=${parseInt(this.querySelector(`[identifier=${t.split(" ")[1]}]`).style.top)}
|
|
8703
8792
|
stroke="red"
|
|
8704
8793
|
stroke-width="3"
|
|
8705
|
-
@click=${
|
|
8794
|
+
@click=${i=>{i.stopPropagation(),this._response=this._response.filter((r,n)=>n!==e),this.saveResponse(this.response)}}
|
|
8706
8795
|
/>
|
|
8707
8796
|
`)}
|
|
8708
8797
|
${this.renderSupplementalLines()}
|
|
8709
|
-
${this.#e
|
|
8798
|
+
${this.#e&&Ln`<line
|
|
8710
8799
|
part="point"
|
|
8711
8800
|
x1=${this.startCoord.x}
|
|
8712
8801
|
y1=${this.startCoord.y}
|
|
@@ -8718,7 +8807,7 @@ CES.load();
|
|
|
8718
8807
|
</svg>
|
|
8719
8808
|
<slot></slot>
|
|
8720
8809
|
</line-container>
|
|
8721
|
-
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),
|
|
8810
|
+
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),i=t.target,r=i.getAttribute("coords"),n=i.getAttribute("shape"),s=r.split(",").map(a=>parseInt(a));te(n,s,e,i)}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 i=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-i.left,y:t.clientY-i.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.#i||(this.#i=e.target,this._response=this.#r(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#i.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#i=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)}};qr([_()],Bt.prototype,"startCoord",void 0);qr([_()],Bt.prototype,"mouseCoord",void 0);qr([pd({selector:"img"})],Bt.prototype,"grImage",void 0);qr([_()],Bt.prototype,"_response",void 0);qr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Yt({emptyAs:[]})})],Bt.prototype,"response",null);var bs=[{tag:"qti-graphic-associate-interaction",ctor:Bt}];var Fp=[O,W,q`
|
|
8722
8811
|
:host {
|
|
8723
8812
|
display: flex;
|
|
8724
8813
|
align-items: flex-start;
|
|
@@ -8803,10 +8892,10 @@ CES.load();
|
|
|
8803
8892
|
user-select: none;
|
|
8804
8893
|
pointer-events: none;
|
|
8805
8894
|
}
|
|
8806
|
-
`];var
|
|
8895
|
+
`];var Hf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Wf=jt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Ci=class extends Ft(Wf,'[qti-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#r(t.target)}}static{this.styles=Fp}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
|
|
8807
8896
|
<slot part="image" style=${t}></slot>
|
|
8808
8897
|
<slot part="drags" name="drags" class="hover-border" style=${t}></slot>
|
|
8809
|
-
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#
|
|
8898
|
+
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#i(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#n(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},i=e("width"),r=e("height");i&&r&&(t.style.aspectRatio=`${i} / ${r}`)}#r(t){let e=this.#i(),i=t.getAttribute("coords"),r=t.getAttribute("shape");!e||!i||!r||(this.#n(e),this.#o(e),te(r,i.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),i=t.getBoundingClientRect().width,r=e>0&&i>0?Math.min(1,i/e):1,n=Math.round(r*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};Hf([_()],Ci.prototype,"_graphicScale",void 0);var vs=[{tag:"qti-graphic-gap-match-interaction",ctor:Ci}];var Bp=[O,W,q`
|
|
8810
8899
|
/* The order pins are anchored outside their hotspot's box. */
|
|
8811
8900
|
:host {
|
|
8812
8901
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -8844,11 +8933,11 @@ CES.load();
|
|
|
8844
8933
|
pointer-events: none;
|
|
8845
8934
|
user-select: none;
|
|
8846
8935
|
}
|
|
8847
|
-
`];var
|
|
8936
|
+
`];var Up=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ge=class o extends Qe(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#r=t=>{this.#n(t.target),this.refreshLocatorPins()}}static{this.styles=Bp}static#t="cito-graphic-order-marker";render(){return v`
|
|
8848
8937
|
<slot name="prompt"></slot>
|
|
8849
8938
|
<slot></slot>
|
|
8850
8939
|
<div role="alert" part="message" id="validation-message"></div>
|
|
8851
|
-
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(
|
|
8940
|
+
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let i=[...this.#e()],r=i.indexOf(e);if(r>=0)i.splice(r,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(i.length>=n)return;i.push(e)}this.response=i,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#i(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 n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),i=Array.from(this.querySelectorAll(`.${o.#t}`));i.length===e.length&&e.every((n,s)=>{let a=i[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#i(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(i.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#i(n);n.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(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#n(t){let e=zp(this),i=t.getAttribute("coords"),r=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=i.split(",").map(s=>parseInt(s));te(r,n,e,t)}#r;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r),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.#r)}};Up([p({type:Number,attribute:"max-choices"})],Ge.prototype,"maxChoices",void 0);Up([z("response")],Ge.prototype,"handleOrderedResponseChange",null);var ys=[{tag:"qti-graphic-order-interaction",ctor:Ge}];var Hp=[O,W,q`
|
|
8852
8941
|
:host {
|
|
8853
8942
|
display: block;
|
|
8854
8943
|
}
|
|
@@ -8897,17 +8986,17 @@ CES.load();
|
|
|
8897
8986
|
max-width: 100%;
|
|
8898
8987
|
height: auto;
|
|
8899
8988
|
}
|
|
8900
|
-
`];var
|
|
8989
|
+
`];var rn=class extends Qe(D,"qti-hotspot-choice"){static{this.styles=Hp}render(){return v`
|
|
8901
8990
|
<slot name="prompt"></slot>
|
|
8902
8991
|
<slot></slot>
|
|
8903
8992
|
<div part="message" role="alert" id="validation-message"></div>
|
|
8904
|
-
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let
|
|
8993
|
+
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let i=()=>{t.removeEventListener("load",i),e(t)};t.addEventListener("load",i)})),this.#t}async#i(t){let e=this.querySelector("img");if(!e)return;let i=t.getAttribute("coords"),r=t.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a)),s=await this.#e(e);te(r,n,s,t)}#n=t=>{this.#i(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};var ws=[{tag:"qti-hotspot-interaction",ctor:rn}];var Wp=[O,W,q`
|
|
8905
8994
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
8906
8995
|
:host {
|
|
8907
8996
|
display: block;
|
|
8908
8997
|
}
|
|
8909
|
-
`];var
|
|
8910
|
-
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=
|
|
8998
|
+
`];var on=class extends Qe(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
|
|
8999
|
+
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Wp}};var xs=[{tag:"qti-hottext-interaction",ctor:on}];var ac=(o,t="[part='menu']",e="[part='trigger']",i="--qti-inline-choice-width")=>{class r extends o{#t=null;#e=null;#i=null;#n=0;#r=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(l=>l instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let l=a.matches(":popover-open"),c=a.style.visibility,d=a.style.display;l||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{l||(a.hidePopover?.(),a.style.visibility=c,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#c(a),this.#s();let l=this.#o()+this.menuAutoSizeExtraWidth();l<=0||l===this.#r||(this.#r=l,s.style.setProperty(i,`${l}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let c of this.menuAutoSizeRows()){let d=c.style.width;c.style.width="max-content",s=Math.max(s,c.getBoundingClientRect().width),c.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let l=getComputedStyle(a);return s+parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#i||(this.#i=new MutationObserver(()=>this.#a()),this.#i.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#n||(this.#n=requestAnimationFrame(()=>{this.#n=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#i?.disconnect(),this.#i=null,this.#n&&cancelAnimationFrame(this.#n),this.#n=0,super.disconnectedCallback()}}return r};var Qf=q`
|
|
8911
9000
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
8912
9001
|
Inline-block so the element flows with surrounding text.
|
|
8913
9002
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -9125,7 +9214,7 @@ CES.load();
|
|
|
9125
9214
|
z-index: var(--qti-overlay-z-index);
|
|
9126
9215
|
white-space: nowrap;
|
|
9127
9216
|
}
|
|
9128
|
-
`,
|
|
9217
|
+
`,Gf=Qf,Qp=Gf;var ee=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Xf=0,nt=class extends ac(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Xf++}`,this._handleDataPromptChange=()=>{this.#i()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#r(!0))},this.#a=t=>{let i=t.newState==="open";this._dropdownOpen!==i&&(this._dropdownOpen=i),i?this._internals.states.add("open"):this._internals.states.delete("open")},this.#c=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#r(!1),this.#p();return}let e=this.#m(),i=this.renderRoot.activeElement,r=this.#l(),n=i||(r instanceof HTMLElement&&this.#f(r)?r:null),s=e.findIndex(a=>a===n);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(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#n(a)}}},this.#h=()=>{this.#i()},this.#g=t=>{if(this.disabled||this.readonly)return;let i=t.currentTarget.getAttribute("identifier")??"";this.#n(i)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[Qp]}renderTrigger(){let t=this.#e();return v`
|
|
9129
9218
|
<button
|
|
9130
9219
|
part="trigger"
|
|
9131
9220
|
type="button"
|
|
@@ -9145,7 +9234,7 @@ CES.load();
|
|
|
9145
9234
|
aria-hidden="true"
|
|
9146
9235
|
></span>
|
|
9147
9236
|
</button>
|
|
9148
|
-
`}renderMenu(){let t=this.options[0],e=this.#t(),
|
|
9237
|
+
`}renderMenu(){let t=this.options[0],e=this.#t(),i=t?.selected??!0,r=e&&i,n=e&&!i,s=["option","option-prompt",t?.selected?"option-selected":"",n?"option-clear":""].filter(Boolean).join(" ");return v`
|
|
9149
9238
|
<div
|
|
9150
9239
|
id="${this._menuId}"
|
|
9151
9240
|
part="menu"
|
|
@@ -9159,17 +9248,17 @@ CES.load();
|
|
|
9159
9248
|
type="button"
|
|
9160
9249
|
role="option"
|
|
9161
9250
|
?hidden=${r}
|
|
9162
|
-
aria-label=${Q(
|
|
9251
|
+
aria-label=${Q(n?this.dataClearLabel||"Clear":void 0)}
|
|
9163
9252
|
aria-selected="${t?.selected?"true":"false"}"
|
|
9164
|
-
@click=${()=>this.#
|
|
9253
|
+
@click=${()=>this.#n("")}
|
|
9165
9254
|
>
|
|
9166
9255
|
<span part="option-content"
|
|
9167
|
-
>${
|
|
9256
|
+
>${n?v`<span part="clear-icon" aria-hidden="true"></span>`:t?.content}</span
|
|
9168
9257
|
>
|
|
9169
9258
|
</button>
|
|
9170
9259
|
<slot @slotchange=${this.#h}></slot>
|
|
9171
9260
|
</div>
|
|
9172
|
-
`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#
|
|
9261
|
+
`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#i(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#v(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#i()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#b(),this.#m()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#b()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#i(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",i=this._pendingResponse,r=i!==void 0?i??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:r===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===r}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#b(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="dropdown-icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),i=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+i}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,i=this.required||this.minChoices>=1,r=e||!i,n=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(r,r?"":n,this,{suppressInline:!0}),r}reportValidity(){return super.reportValidity()}reset(){this.#r(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#b()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(i=>({...i,selected:i.value===e})),this.#b()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#n(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#b(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#r(!1)}#r(t){let e=this.#d();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#c;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#f(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#d(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#i()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#h;#g;#v(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#g),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#b(){await this.updateComplete;let t=this.options.find(i=>i.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let i of e){let n=(i.getAttribute("identifier")??"")===t;i.removeEventListener("click",this.#g),i.addEventListener("click",this.#g),i.disabled=this.disabled,i.readonly=this.readonly,i.internals.role="option",i.internals.ariaSelected=n?"true":"false",i.internals.ariaChecked=n?"true":"false",i.internals.ariaDisabled=this.disabled?"true":"false",i.internals.ariaReadOnly=this.readonly?"true":"false",n?i.internals.states.add("checked"):i.internals.states.delete("checked"),i.tabIndex=-1}}#m(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};ee([_()],nt.prototype,"options",void 0);ee([_()],nt.prototype,"_dropdownOpen",void 0);ee([I({context:yt,subscribe:!0}),p({attribute:!1})],nt.prototype,"configContext",void 0);ee([p({type:String,attribute:"data-prompt"})],nt.prototype,"dataPrompt",void 0);ee([p({type:String,attribute:"data-clear-label"})],nt.prototype,"dataClearLabel",void 0);ee([z("dataPrompt",{waitUntilFirstUpdate:!0})],nt.prototype,"_handleDataPromptChange",void 0);ee([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],nt.prototype,"required",void 0);ee([p({type:Number,attribute:"min-choices"})],nt.prototype,"minChoices",void 0);ee([z(["required","minChoices"],{waitUntilFirstUpdate:!0})],nt.prototype,"_handleRequiredChange",void 0);ee([p({attribute:"response",reflect:!1,noAccessor:!0})],nt.prototype,"response",null);var qs=[{tag:"qti-inline-choice-interaction",ctor:nt}];var Gp=[O,W,q`
|
|
9173
9262
|
/*
|
|
9174
9263
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
9175
9264
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -9275,7 +9364,7 @@ CES.load();
|
|
|
9275
9364
|
:host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
|
|
9276
9365
|
display: none;
|
|
9277
9366
|
}
|
|
9278
|
-
`];var
|
|
9367
|
+
`];var Xp=[O,q`
|
|
9279
9368
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
9280
9369
|
display: contents;
|
|
9281
9370
|
}
|
|
@@ -9335,6 +9424,20 @@ CES.load();
|
|
|
9335
9424
|
display: contents;
|
|
9336
9425
|
}
|
|
9337
9426
|
|
|
9427
|
+
/*
|
|
9428
|
+
* qti-header-hidden (vocabulary §1.2.8.2): "Do not display the top row of the table where the
|
|
9429
|
+
* column headers are displayed." The whole row goes, the top-left cell with it.
|
|
9430
|
+
*/
|
|
9431
|
+
:host(.qti-match-tabular.qti-header-hidden) [part='grid'] {
|
|
9432
|
+
grid-template-rows: repeat(var(--qti-match-rows, 1), auto);
|
|
9433
|
+
}
|
|
9434
|
+
:host(.qti-match-tabular.qti-header-hidden) :is([part='corner'], [part='cols-wrap']) {
|
|
9435
|
+
display: none;
|
|
9436
|
+
}
|
|
9437
|
+
:host(.qti-match-tabular.qti-header-hidden) :is([part='rows-wrap'], [part='checkbox-grid']) {
|
|
9438
|
+
grid-row: 1 / -1;
|
|
9439
|
+
}
|
|
9440
|
+
|
|
9338
9441
|
/*
|
|
9339
9442
|
* The radio/checkbox box centres its own mark. qti-simple-choice.styles.ts does the same for
|
|
9340
9443
|
* the non-tabular control; here the cells are plain spans in this shadow root, so the rule
|
|
@@ -9350,7 +9453,7 @@ CES.load();
|
|
|
9350
9453
|
justify-content: center;
|
|
9351
9454
|
flex-shrink: 0;
|
|
9352
9455
|
}
|
|
9353
|
-
`];var
|
|
9456
|
+
`];var ks=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ie=class extends Ft(jt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,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,i=e.value,r=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(i)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(r)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[Gp,Xp]}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"),i=e[0],r=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(i?.setAttribute("slot","match-rows"),r?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(i?.removeAttribute("slot"),r?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}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 v`
|
|
9354
9457
|
<slot name="prompt"></slot>
|
|
9355
9458
|
<slot ?hidden=${t}></slot>
|
|
9356
9459
|
|
|
@@ -9360,17 +9463,17 @@ CES.load();
|
|
|
9360
9463
|
role="grid"
|
|
9361
9464
|
style="--qti-match-rows: ${this.sourceChoices.length}; --qti-match-cols: ${this.targetChoices.length};"
|
|
9362
9465
|
>
|
|
9363
|
-
<div part="corner"
|
|
9466
|
+
<div part="corner">${this.dataFirstColumnHeader??P}</div>
|
|
9364
9467
|
<div part="cols-wrap" role="row"><slot name="match-cols" part="c-header"></slot></div>
|
|
9365
9468
|
<div part="rows-wrap"><slot name="match-rows" part="r-header"></slot></div>
|
|
9366
9469
|
<div part="checkbox-grid">
|
|
9367
|
-
${this.sourceChoices.map((e,
|
|
9470
|
+
${this.sourceChoices.map((e,i)=>v`
|
|
9368
9471
|
<div role="row" style="display: contents;">
|
|
9369
|
-
${this.targetChoices.map((r,
|
|
9472
|
+
${this.targetChoices.map((r,n)=>{let s=e.getAttribute("identifier"),a=r.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(l,d),m=d?"checked":"",y=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&c>=e.matchMax&&!d;return v`
|
|
9370
9473
|
<label
|
|
9371
9474
|
part="input-cell"
|
|
9372
9475
|
role="gridcell"
|
|
9373
|
-
style="grid-row: ${
|
|
9476
|
+
style="grid-row: ${i+1}; grid-column: ${n+1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
|
|
9374
9477
|
>
|
|
9375
9478
|
<input
|
|
9376
9479
|
type=${h}
|
|
@@ -9393,13 +9496,13 @@ CES.load();
|
|
|
9393
9496
|
`:P}
|
|
9394
9497
|
|
|
9395
9498
|
<div role="alert" part="message" id="validation-message"></div>
|
|
9396
|
-
`}};
|
|
9499
|
+
`}};ks([p({type:String})],ie.prototype,"class",void 0);ks([p({type:String,attribute:"data-first-column-header"})],ie.prototype,"dataFirstColumnHeader",void 0);ks([_()],ie.prototype,"_response",void 0);ks([p({type:String,attribute:"response-identifier"})],ie.prototype,"responseIdentifier",void 0);var Cs=[{tag:"qti-match-interaction",ctor:ie}];var Yp=[O,q`
|
|
9397
9500
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
9398
9501
|
:host {
|
|
9399
9502
|
display: block;
|
|
9400
9503
|
}
|
|
9401
|
-
`];var
|
|
9402
|
-
<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
|
|
9504
|
+
`];var Ss=class extends D{static{this.styles=Yp}#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 v` <slot name="prompt"></slot>
|
|
9505
|
+
<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 Es=[{tag:"qti-media-interaction",ctor:Ss}];var Jp=[O,W,Gt,q`
|
|
9403
9506
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
9404
9507
|
:host {
|
|
9405
9508
|
display: block;
|
|
@@ -9609,16 +9712,16 @@ CES.load();
|
|
|
9609
9712
|
:host([answer-key]) [part~='drags'] {
|
|
9610
9713
|
display: none;
|
|
9611
9714
|
}
|
|
9612
|
-
`];var
|
|
9715
|
+
`];var Kp=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Yf=jt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Xe=class extends Ft(Yf,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Jp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
|
|
9613
9716
|
<div part="container">
|
|
9614
9717
|
<slot part="drags"> </slot>
|
|
9615
9718
|
<div part="drops">
|
|
9616
|
-
${[...Array(this.nrChoices)].map((e,
|
|
9617
|
-
${G(
|
|
9719
|
+
${[...Array(this.nrChoices)].map((e,i)=>{let r=`droplist${i}`,n=this._dragDrop?.nodesByTarget?.[r]??[];return v`<div role="region" part="drop" data-declarative-drops identifier=${r}>
|
|
9720
|
+
${G(n,s=>s.getAttribute("identifier"),s=>s)}
|
|
9618
9721
|
</div>`})}
|
|
9619
9722
|
</div>
|
|
9620
9723
|
<div id="validation-message" part="message" role="alert" style="display:none;"></div>
|
|
9621
|
-
</div>`}getValue(t){return t?.map((e,
|
|
9724
|
+
</div>`}getValue(t){return t?.map((e,i)=>`${e} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(i=>i.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Kp([_()],Xe.prototype,"nrChoices",void 0);Kp([p({type:String})],Xe.prototype,"orientation",void 0);var As=[{tag:"qti-order-interaction",ctor:Xe}];var Zp=`@layer qti-base {
|
|
9622
9725
|
/* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
|
|
9623
9726
|
/* ============================
|
|
9624
9727
|
QTI 3 shared css
|
|
@@ -11174,7 +11277,7 @@ CES.load();
|
|
|
11174
11277
|
}
|
|
11175
11278
|
}
|
|
11176
11279
|
}
|
|
11177
|
-
`;var
|
|
11280
|
+
`;var tu=[O,q`
|
|
11178
11281
|
:host {
|
|
11179
11282
|
display: block;
|
|
11180
11283
|
width: 100%;
|
|
@@ -11184,18 +11287,18 @@ CES.load();
|
|
|
11184
11287
|
::slotted(qti-interaction-markup) {
|
|
11185
11288
|
display: none;
|
|
11186
11289
|
}
|
|
11187
|
-
`];var
|
|
11290
|
+
`];var Jf=new Set(["point","pair","directedPair"]),sn=(o,t)=>{if(o==null)return o;switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let i=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(r=>typeof r=="number"?r:parseFloat(String(r)));return i.length===2&&i.every(Number.isFinite)?i:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},Kf=(o,t,e)=>{if(e)return Array.isArray(t)&&!Jf.has(e)?{name:o,list:{[e]:t.map(i=>sn(i,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:sn(t,e)}};if(Array.isArray(t)){let i=t.filter(r=>r!=null);if(i.length&&i.every(r=>typeof r=="boolean"))return{name:o,list:{boolean:i}};if(i.length&&i.every(r=>typeof r=="number")){let r=i,n=r.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:r}}}return{name:o,list:{string:t.map(r=>r==null?"":String(r))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},Ts=(o,t={})=>{if(!Ot(o))return{record:[]};let e=[];for(let[i,r]of Object.entries(o))e.push(Kf(i,r,t[i]));return{record:e}},Zf=(o,t={})=>{if(!Ot(o))return{...t};let e={};for(let[i,r]of Object.entries(o))e[i]=t[i]??ao(Array.isArray(r)?r[0]:r);return e},nu=(o,t={})=>Ts(o,Zf(o,t)),eu=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},iu=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},ru=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let i=iu(e.list);t[e.name]=Array.isArray(i)?i.map(eu).filter(r=>r!==null):[]}else t[e.name]=eu(iu(e.base));return t};var ou=`/** vim: et:ts=4:sw=4:sts=4
|
|
11188
11291
|
* @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
|
|
11189
11292
|
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
11190
11293
|
*/var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
|
|
11191
|
-
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var St=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Yf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Jf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Kf=["solution","review"];function Zf(o){return o==null?!1:Array.isArray(o)?o.length>0:Rt(o)?Object.keys(o).length>0:o!==""}var Y=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#r=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#m(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let n=e?.params?.value,r=n&&typeof n=="object"?this.#f(n):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,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(r===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=r;this.response=c,this.validate(),this.saveResponse(c,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#q=null}#t;static{this.styles=[Jp,q`
|
|
11294
|
+
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var Et=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},tg=o=>o.replace(/<\/(script)/gi,"<\\/$1"),eg=o=>o.replace(/<\/(style)/gi,"<\\/$1"),ig=["solution","review"];function ng(o){return o==null?!1:Array.isArray(o)?o.length>0:Ot(o)?Object.keys(o).length>0:o!==""}var Y=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#n=null,this.#r=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#m(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let i=e?.params?.value,r=i&&typeof i=="object"?this.#f(i):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(r===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=r;this.response=c,this.validate(),this.saveResponse(c,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#q=null}#t;static{this.styles=[tu,q`
|
|
11192
11295
|
:host {
|
|
11193
11296
|
display: block;
|
|
11194
11297
|
width: 100%;
|
|
11195
11298
|
min-height: 50px;
|
|
11196
11299
|
}
|
|
11197
|
-
`]}#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},
|
|
11198
|
-
`);this.sendMessageToIframe("setStylesheets",r)}let
|
|
11300
|
+
`]}#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},i=t.correctResponse;return ng(i)&&(e.correctResponse={value:i}),e}#i(){let t=this.responseDeclaration;if(!t?.correctResponse||ig.includes(this.status))return t;let{correctResponse:e,...i}=t;return i}#n;#r;#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||{}}#c(){if(this.#r===null&&this.requireShimJson)try{this.#r=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#r={}}return this.#r||{}}#p(){return this.#a()}#l(){return this.#c()}#f(t){if(t&&Array.isArray(t.record)){let e=ru(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let i=t[e];if(i){for(let r in i)if(i.hasOwnProperty(r)){let n=i[r];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,i){if(e==="record"||i==="record")return Ts(t);if(e!=="single"){let r=this.normalizeListValue(t).map(n=>sn(n,i));return{list:{[i]:r}}}return{base:{[i]:sn(t,i)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let n=r.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=Hn(n.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=sn(c,a[l]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},i={...t,...e};if(!Object.keys(i).length)return null;let r={candidateIdentifier:i.candidateIdentifier??"",testIdentifier:i.testIdentifier??"",environmentIdentifier:i.environmentIdentifier??"",...i};return Ts(r)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(i=>{let r=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!r)return;let n=this.context?.variables?.find(l=>l.identifier===r);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[r]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(i=>{let r=i.getAttribute("identifier")||"";if(!r)return;if(r==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[r]=l);return}let n=this.context?.variables?.find(l=>l.identifier===r);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[r]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#d(t){let e={...t};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let r=i.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[r]=t[i]}return e}#u(t){let e={...t},i=(r,n,s)=>{let a=r;for(let l=0;l<n.length;l+=1){let c=n[l];if(l===n.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[r,n]of Object.entries(t)){if(!r.includes("__"))continue;let s=r.split("__").filter(Boolean);s.length<2||i(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,i,r){if(e==="record")return nu(t,r);if(e!=="single"){let n={list:{}};return n.list[i]=t,n}else{let n={base:{}};return n.base[i]=t,n}}#h(){return this.response===null||this.response===void 0?!1:Ot(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#g(t,e){let i=this.dataset.invalidresponsemessage||"Invalid response.",r=t?"":e&&e.trim().length>0?e:i;this._internals.setValidity(t?{}:{customError:!0},r)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#h();return this.#g(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:Ot(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#f(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(i=>i.identifier===this.responseIdentifier);if(e){let i=e.cardinality||"single",r=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,i,r,s);t[this.responseIdentifier]=a}return t}#v(t){return t&&t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#b(t){let e={};for(let[i,r]of Object.entries(t))typeof r=="string"?e[i]=this.#v(r):e[i]=r;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:t,params:e});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#m(){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.#x(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#y(){let t=this.#d(this.#u(this.#b({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],i=typeof e=="string"&&e.length>0?e:null,r={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:so(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#w(),boundTo:i?null:this.boundTo,responseDeclaration:this.#i(),status:this.status,state:i};this.sendMessageToIframe("initialize",r)}#w(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let i=e.querySelectorAll("qti-interaction-module");for(let r of i)t.push({id:r.getAttribute("id"),primaryPath:r.getAttribute("primary-path"),fallbackPath:r.getAttribute("fallback-path")})}return t}#x(){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 r=e.map(n=>n.outerHTML).join(`
|
|
11301
|
+
`);this.sendMessageToIframe("setStylesheets",r)}let i=this.querySelector("properties");i&&this.sendMessageToIframe("setProperties",i.innerHTML)}#C(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),i=JSON.stringify(this.#l()),r=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=r?r.endsWith("/")?r:`${r}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,l=this.dataset.componentsCssUrl,c=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${tg(ou)}</script>`,d=`
|
|
11199
11302
|
font-family: ${t.getPropertyValue("font-family")};
|
|
11200
11303
|
font-size: ${t.getPropertyValue("font-size")};
|
|
11201
11304
|
line-height: ${t.getPropertyValue("line-height")};
|
|
@@ -11206,9 +11309,9 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11206
11309
|
<head>
|
|
11207
11310
|
<meta charset="utf-8" />
|
|
11208
11311
|
<title>QTI PCI Container</title>
|
|
11209
|
-
<base href="${
|
|
11312
|
+
<base href="${n}" />
|
|
11210
11313
|
${a?`<script type="module">import '${a}';</script>`:""}
|
|
11211
|
-
<style>${
|
|
11314
|
+
<style>${eg(Zp)}</style>
|
|
11212
11315
|
<style>
|
|
11213
11316
|
body, html {
|
|
11214
11317
|
margin: 0;
|
|
@@ -11280,7 +11383,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11280
11383
|
// Define standard paths and shims
|
|
11281
11384
|
window.requirePaths = ${e};
|
|
11282
11385
|
|
|
11283
|
-
window.requireShim = ${
|
|
11386
|
+
window.requireShim = ${i};
|
|
11284
11387
|
|
|
11285
11388
|
// Single initial RequireJS configuration with error handling
|
|
11286
11389
|
window.requirejs.config({
|
|
@@ -12094,7 +12197,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12094
12197
|
<h1>Error</h1>
|
|
12095
12198
|
${this._errorMessage}
|
|
12096
12199
|
</div>`:""}
|
|
12097
|
-
`}};
|
|
12200
|
+
`}};Et([p({type:String,attribute:"module"})],Y.prototype,"module",void 0);Et([p({type:String,attribute:"custom-interaction-type-identifier"})],Y.prototype,"customInteractionTypeIdentifier",void 0);Et([p({type:String,attribute:"data-require-paths"})],Y.prototype,"requirePathsJson",void 0);Et([p({type:String,attribute:"data-require-shim"})],Y.prototype,"requireShimJson",void 0);Et([p({type:String,attribute:"data-require-js-url"})],Y.prototype,"requireJsUrl",void 0);Et([p({type:String,attribute:"data-base-url"})],Y.prototype,"baseUrl",void 0);Et([p({type:Boolean,attribute:"data-use-default-paths"})],Y.prototype,"useDefaultPaths",void 0);Et([p({type:String,attribute:"data-status"})],Y.prototype,"status",void 0);Et([_()],Y.prototype,"_errorMessage",void 0);Et([I({context:j,subscribe:!0}),_()],Y.prototype,"context",void 0);Et([I({context:wt,subscribe:!0}),_()],Y.prototype,"qtiContext",void 0);Et([p({attribute:"response",reflect:!1,converter:Yt({emptyAs:null})})],Y.prototype,"response",void 0);var Is=class extends Y{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,i)=>{let r=()=>{window.clearTimeout(n),e()},n=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",r),i(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",r,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,i=r=>{let{data:n}=r;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",i),t(n.content))};window.addEventListener("message",i),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",i),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(i=>{let r=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===r&&(window.removeEventListener("message",n),i())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),i()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let i=`click-selector-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let i=`click-text-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(i=>{let r=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===r&&(window.removeEventListener("message",n),i(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),i(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let i=`get-bounding-rect-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.rect??null))};window.addEventListener("message",r),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(i=>{let r=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===r&&(window.removeEventListener("message",n),i(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),i(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let i=`mousedown-selector-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
|
|
12098
12201
|
// Test helper functions for QtiPortableCustomInteractionTest
|
|
12099
12202
|
// Base iframe implementation already provides PCIManager.getContent
|
|
12100
12203
|
|
|
@@ -12287,7 +12390,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12287
12390
|
}
|
|
12288
12391
|
},
|
|
12289
12392
|
true
|
|
12290
|
-
);`,
|
|
12393
|
+
);`,i=t.lastIndexOf("</script>");return t.substring(0,i)+e+t.substring(i)}};var _s=[{tag:"qti-portable-custom-interaction",ctor:Y},{tag:"qti-portable-custom-interaction-test",ctor:Is}];var su=[O,q`
|
|
12291
12394
|
:host {
|
|
12292
12395
|
display: block;
|
|
12293
12396
|
}
|
|
@@ -12298,12 +12401,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12298
12401
|
left: 50%;
|
|
12299
12402
|
transform: translateX(-50%);
|
|
12300
12403
|
}
|
|
12301
|
-
`];var
|
|
12404
|
+
`];var Rs=class extends k{static{this.styles=su}render(){return v`<slot></slot>`}};var au=[O,q`
|
|
12302
12405
|
:host {
|
|
12303
12406
|
display: inline-block;
|
|
12304
12407
|
position: relative;
|
|
12305
12408
|
}
|
|
12306
|
-
`];var
|
|
12409
|
+
`];var Os=class extends k{static{this.styles=au}render(){return v`<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,i=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+i+"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 Ps=[{tag:"qti-position-object-interaction",ctor:Rs},{tag:"qti-position-object-stage",ctor:Os}];var lu="important",rg=" !"+lu,Ms=Mt(class extends Oe{constructor(o){if(super(o),o.type!==Gi.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 i=o[e];return i==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}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 i of this.ft)t[i]==null&&(this.ft.delete(i),i.includes("-")?e.removeProperty(i):e[i]=null);for(let i in t){let r=t[i];if(r!=null){this.ft.add(i);let n=typeof r=="string"&&r.endsWith(rg);i.includes("-")||n?e.setProperty(i,n?r.slice(0,-11):r,n?lu:""):e[i]=r}}return rt}});var cu=[O,q`
|
|
12307
12410
|
:host {
|
|
12308
12411
|
display: block;
|
|
12309
12412
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -12364,20 +12467,20 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12364
12467
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
12365
12468
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
12366
12469
|
}
|
|
12367
|
-
`];var
|
|
12470
|
+
`];var an=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},bt=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.#i=1,this.#n=1,this.#r=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),i=(t.clientX-e.left)*this.#i,r=(t.clientY-e.top)*this.#n,n=`${i.toFixed()} ${r.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=cu}#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;#i;#n;#r;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(i=>i).map(i=>{let[r,n]=i.split(" ").map(Number);return{x:r,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let i of t){let r=i.dataset.coord,n=i.dataset.shape;!r||!n||te(n,r.split(",").map(s=>+s),e,i)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
|
|
12368
12471
|
<point-container>
|
|
12369
|
-
${G(e.filter(
|
|
12472
|
+
${G(e.filter(i=>i),i=>i,(i,r)=>{let[n,s]=i.split(" ").map(Number),a=n/(this.#r||1)*100,l=s/(this.#o||1)*100;return v`
|
|
12370
12473
|
<button
|
|
12371
|
-
part=${this.pointPart(
|
|
12372
|
-
style=${
|
|
12373
|
-
aria-label="Remove point at ${
|
|
12474
|
+
part=${this.pointPart(i,r)}
|
|
12475
|
+
style=${Ms({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
|
|
12476
|
+
aria-label="Remove point at ${i}"
|
|
12374
12477
|
?disabled=${this.disabled}
|
|
12375
12478
|
@click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==r),this.saveResponse(this.response)}}
|
|
12376
12479
|
></button>
|
|
12377
12480
|
`})}
|
|
12378
12481
|
${this.renderSupplementalLayer()}
|
|
12379
12482
|
<slot></slot>
|
|
12380
|
-
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,
|
|
12483
|
+
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,i=t<this.minChoices,r=!0,n="";return e?(r=!1,n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):i&&(r=!1,n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(r,n,this.#e??this,{suppressInline:!0}),r}reportValidity(){return super.reportValidity()}#c(){this.#r=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#i=t.width===0?1:this.#r/t.width,this.#n=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.requestUpdate(),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)}};an([p({type:Number,attribute:"max-choices"})],bt.prototype,"maxChoices",void 0);an([p({type:Number,attribute:"min-choices"})],bt.prototype,"minChoices",void 0);an([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=fl(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>gl(o)}})],bt.prototype,"response",void 0);an([p({attribute:"area-mappings"})],bt.prototype,"areaMappings",void 0);an([_()],bt.prototype,"_areaEntries",void 0);an([z("areaMappings")],bt.prototype,"_handleAreaMappingsChange",void 0);var Ds=[{tag:"qti-select-point-interaction",ctor:bt}];var du=[O,q`
|
|
12381
12484
|
:host {
|
|
12382
12485
|
display: block;
|
|
12383
12486
|
--show-bounds: true;
|
|
@@ -12445,7 +12548,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12445
12548
|
text-align: center;
|
|
12446
12549
|
color: #6b7280; /* text-gray-500 */
|
|
12447
12550
|
}
|
|
12448
|
-
`];var
|
|
12551
|
+
`];var kr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},At=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=du}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let i=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#i(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
|
|
12449
12552
|
<slot name="prompt"></slot>
|
|
12450
12553
|
<div id="slider" part="slider">
|
|
12451
12554
|
<div id="bounds" part="bounds">
|
|
@@ -12455,7 +12558,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12455
12558
|
|
|
12456
12559
|
<div id="ticks" part="ticks"></div>
|
|
12457
12560
|
|
|
12458
|
-
<div id="rail" part="rail" @mousedown=${this.#
|
|
12561
|
+
<div id="rail" part="rail" @mousedown=${this.#n} @touchstart=${this.#r}>
|
|
12459
12562
|
<div id="knob" part="knob">
|
|
12460
12563
|
${this.#t===null?P:v`<div id="value" part="value">${this.#t}</div>`}
|
|
12461
12564
|
</div>
|
|
@@ -12463,7 +12566,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12463
12566
|
${this.renderRailSupplement()}
|
|
12464
12567
|
</div>
|
|
12465
12568
|
</div>
|
|
12466
|
-
`}#
|
|
12569
|
+
`}#n(t){this.#o(t.pageX);let e=r=>this.#s(r.pageX),i=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",i)}#r(t){this.#o(t.touches[0].pageX);let e=r=>this.#s(r.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",i)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),i=t-e.left,r=Math.min(1,Math.max(0,i/e.width)),n=this.min+Math.round(r*(this.max-this.min)/this.step)*this.step;this.#i(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};kr([Ri("#rail")],At.prototype,"_rail",void 0);kr([p({type:Number,attribute:"lower-bound"})],At.prototype,"min",void 0);kr([p({type:Number,attribute:"upper-bound"})],At.prototype,"max",void 0);kr([p({type:Number,attribute:"step"})],At.prototype,"step",void 0);kr([p({attribute:"response",reflect:!1,noAccessor:!0})],At.prototype,"response",null);var Ns=[{tag:"qti-slider-interaction",ctor:At}];var hu=()=>new cc,cc=class{},lc=new WeakMap,gN=Mt(class extends Me{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=lc.get(t);e===void 0&&(e=new WeakMap,lc.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"?lc.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 pu=[O,q`
|
|
12467
12570
|
:host {
|
|
12468
12571
|
display: inline-flex;
|
|
12469
12572
|
align-items: center;
|
|
@@ -12552,7 +12655,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12552
12655
|
:host(.qti-input-width-72) {
|
|
12553
12656
|
--qti-input-width: 72;
|
|
12554
12657
|
}
|
|
12555
|
-
`];var
|
|
12658
|
+
`];var Si=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ht=class extends D{constructor(){super(...arguments),this.inputRef=hu(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=pu}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 v`<div part="answer" aria-hidden="true"></div>`}renderInput(){return v`<input
|
|
12556
12659
|
part="input"
|
|
12557
12660
|
name="${this.responseIdentifier}"
|
|
12558
12661
|
spellcheck="false"
|
|
@@ -12568,7 +12671,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12568
12671
|
maxlength=${1e3}
|
|
12569
12672
|
?disabled="${this.disabled}"
|
|
12570
12673
|
?readonly="${this.readonly}"
|
|
12571
|
-
/>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${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=""}};
|
|
12674
|
+
/>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${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=""}};Si([p({type:Number,attribute:"expected-length"})],ht.prototype,"expectedLength",void 0);Si([p({type:String,attribute:"pattern-mask"})],ht.prototype,"patternMask",void 0);Si([p({type:String,attribute:"placeholder-text"})],ht.prototype,"placeholderText",void 0);Si([p({type:String,attribute:"data-patternmask-message"})],ht.prototype,"dataPatternmaskMessage",void 0);Si([p({type:String,attribute:"response",reflect:!1})],ht.prototype,"response",void 0);Si([Ri("input")],ht.prototype,"_input",void 0);Si([z("response",{waitUntilFirstUpdate:!0})],ht.prototype,"_handleValueChange",void 0);var $s=[{tag:"qti-text-entry-interaction",ctor:ht}];var uu=[O,q`
|
|
12572
12675
|
:host {
|
|
12573
12676
|
display: block;
|
|
12574
12677
|
margin: 1em 0;
|
|
@@ -12577,18 +12680,18 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12577
12680
|
display: block;
|
|
12578
12681
|
margin-top: 0.5em;
|
|
12579
12682
|
}
|
|
12580
|
-
`];var
|
|
12683
|
+
`];var Ls=class extends D{static{this.styles=uu}#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 v`
|
|
12581
12684
|
<div>
|
|
12582
12685
|
<slot name="prompt"></slot>
|
|
12583
12686
|
<input
|
|
12584
12687
|
type="file"
|
|
12585
12688
|
part="input"
|
|
12586
|
-
@change="${this.#
|
|
12689
|
+
@change="${this.#i}"
|
|
12587
12690
|
?disabled="${this.disabled}"
|
|
12588
12691
|
?readonly="${this.readonly}"
|
|
12589
12692
|
/>
|
|
12590
12693
|
</div>
|
|
12591
|
-
`}async#n(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(t)})}};var $s=[{tag:"qti-upload-interaction",ctor:Ns}];var hu=[...cs,...ds,...hs,...ps,...us,...ms,...gs,...bs,...vs,...ys,...ws,...xs,...qs,...Cs,...Ss,...Ts,...Rs,...Ps,...Ms,...Ds,...$s,...sp];for(let{tag:o,ctor:t}of hu)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of $s)customElements.get(o)||customElements.define(o,t);var D2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Gd().load(`${o}`).then(a=>a.assessmentTest()),n=await Un().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),r=await Un().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:n,testURI:s,testURL:i,items:r,testIdentifier:e.identifier}},N2=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Ls=class extends eg(Gt){calculate(){return this.calculateChildren(Array.from(this.children))}};function eg(o){return class extends o{calculateChildren(e){return e.map(r=>{let i=r;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(r=>typeof r=="boolean"&&r)}}}var pu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ai=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let n of t){if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(n.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(n.value===null||n.value===void 0)return null;n.value==="true"&&e++}return e>=this.min&&e<=this.max}};pu([p({type:Number})],ai.prototype,"min",void 0);pu([p({type:Number})],ai.prototype,"max",void 0);var ng=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},kr=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};ng([p({type:String,attribute:"base-type"})],kr.prototype,"baseType",void 0);var zs=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Vs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let n=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,n));let r=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(r,i,n):this.#n(r,i,n)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,n){return K.compareSingleValues(t,e,n)||t===e}#n(t,e,n){let r=[...t];return e.every(i=>{let s=r.findIndex(a=>this.#e(a,i,n));return s===-1?!1:(r.splice(s,1),!0)})}#i(t,e,n){for(let r=0;r+e.length<=t.length;r++)if(e.every((i,s)=>this.#e(t[r+s],i,n)))return!0;return!1}};var js=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(n=>n.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var cc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},En=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,n;if(t.length===2)e=t[0],n=t[1];else if(t.length===1)n=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let 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===n);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let r=this.context.variables.find(i=>i.identifier===n);return r?r.defaultValue||null:(console.warn(`qti-default: variable "${n}" not found in item context`),null)}};cc([p({type:String})],En.prototype,"identifier",void 0);cc([I({context:j,subscribe:!0}),_()],En.prototype,"context",void 0);cc([_(),I({context:ot,subscribe:!0})],En.prototype,"_testContext",void 0);var Fs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return e.cardinality!=="single"||!Array.isArray(n.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):n.value.filter(i=>!e.value.includes(i))}return null}};var Bs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var Us=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(n=>this.#e(n));return e.some(n=>n===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Hs=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(n=>this.#e(n));return e.some(n=>n===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var ig=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Cr=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let r=parseFloat(e.value),i=parseFloat(n.value);if(!isNaN(r)&&!isNaN(i))return this.roundingMode==="significantFigures"?r.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(r*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: ${r}, ${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}};ig([p({type:String,attribute:"rounding-mode"})],Cr.prototype,"roundingMode",void 0);var uu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},li=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return!e||!n?null:e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||n.value===null||e.value===void 0||n.value===void 0?null:this.toleranceMode==="exact"?K.compareSingleValues(e.value,n.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(n.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let n=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(n.length===0||n.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[r,i=r]=n,[s,a]=this.toleranceMode==="absolute"?[e-r,e+i]:[e*(1-r/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};uu([p({type:String,attribute:"tolerance-mode"})],li.prototype,"toleranceMode",void 0);uu([p({type:String})],li.prototype,"tolerance",void 0);var J=class extends k{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ws=class extends J{process(){throw new Dn}};var Qs=class extends J{process(){throw new Nn}};var Gs=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],n=e?.cardinality==="record"||e?.baseType==="record";if(n&&(e.value===null||e.value===void 0))return null;if(!e||!n||!Rt(e.value))return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r==null?null:(this.#t=e.fieldBaseTypes?.[t]??so(Array.isArray(r)?r[0]:r),r)}};var Xs=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let n of t){if(n.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(n.value===null||n.value===void 0)return null;if(n.cardinality==="single"){if(Array.isArray(n.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let r=parseInt(n.value,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}else if(n.cardinality==="multiple"||n.cardinality==="ordered"){if(!Array.isArray(n.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let r of n.value){if(r==null)return null;let i=parseInt(r,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 n=1;n<t.length&&(e=this.#e(e,Math.abs(t[n])),e!==1);n++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let n=e;e=t%e,t=n}return t}};var At=o=>o==null||o==="";var Ys=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(At(e?.value)||At(n?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float"))return+e.value>+n.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Js=class extends Gt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return At(e?.value)||At(n?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float")?+e.value>=+n.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var rg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Sr=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let n=this.#t(this.n);if(n===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(n)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let n=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>n.length?null:n[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(n=>n.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};rg([p({type:String})],Sr.prototype,"n",void 0);var mu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},ci=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let n=this.#t(e.value.toString()),r=this.#e(this.coords);if(!n||r.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#n(n,r);case"rect":return this.#i(n,r);case"ellipse":return this.#r(n,r);case"poly":case"polygon":return this.#o(n,r);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 n=Number.parseFloat(e[0]),r=Number.parseFloat(e[1]);return Number.isNaN(n)||Number.isNaN(r)?(console.error("qti-inside requires numeric point coordinates"),null):{x:n,y:r}}#e(t){let e=t.split(",").map(n=>n.trim()).filter(Boolean).map(n=>Number.parseFloat(n));return e.some(n=>Number.isNaN(n))?(console.error("qti-inside requires numeric coords"),[]):e}#n(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[n,r,i]=e;return(t.x-n)**2+(t.y-r)**2<=i**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[n,r,i,s]=e,a=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,s),d=Math.max(r,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#r(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[n,r,i,s]=e;return i===0||s===0?!1:(t.x-n)**2/i**2+(t.y-r)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let n=!1;for(let r=0,i=e.length-2;r<e.length;r+=2){let s=e[r],a=e[r+1],l=e[i],c=e[i+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(n=!n),i=r}return n}};mu([p({type:String})],ci.prototype,"shape",void 0);mu([p({type:String})],ci.prototype,"coords",void 0);var Ks=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let n of t){if(n.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-integer-divide requires single cardinality"),[];if(n.value===null||n.value===void 0)return[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-integer-divide requires integer values"),[];e.push(r)}return e}};var Zs=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let n of t){if(n.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(n.cardinality!=="single"||Array.isArray(n.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(n.value===null||n.value===void 0)return[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-integer-modulus requires integer values"),[];e.push(r)}return e}};var ta=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let n=Number.parseInt(e.value,10);return Number.isNaN(n)?(console.error("qti-integer-to-float requires an integer value"),null):n}};var ea=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var na=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,n)=>this.#n(e,n))}#t(t){let e=[];for(let n of t){if(n.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(n.value===null||n.value===void 0)return[];if(n.cardinality==="single"){if(Array.isArray(n.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let r=Number.parseInt(n.value,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r);continue}if(n.cardinality!=="multiple"&&n.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(n.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let r of n.value){let i=Number.parseInt(r,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let n=Math.abs(t),r=Math.abs(e);for(;r!==0;){let i=n%r;n=r,r=i}return n}#n(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var fu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},di=class extends J{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 n=parseFloat(this.childExpression.calculate()),r;return e.matchTable?.size?r=e.matchTable.get(n):e.interpolationTable&&(r=this.#t(n,e.interpolationTable)),r==null?(console.warn(`lookupOutcomeValue: no table entry matches ${n} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:_t(r)}})),r)}#t(t,e){if(!Number.isNaN(t))return e.find(n=>n.includeBoundary?t>=n.sourceValue:t>n.sourceValue)?.targetValue}};fu([p({type:String})],di.prototype,"identifier",void 0);fu([I({context:j,subscribe:!0}),_()],di.prototype,"context",void 0);var ia=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(At(e?.value)||At(n?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float"))return+e.value<+n.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var ra=class extends Gt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return At(e?.value)||At(n?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(n.baseType==="integer"||n.baseType==="float")?+e.value<=+n.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var og=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Er=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let n=Array.isArray(t.value)?t.value:[t.value];if(!n||n.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,i=new Set;for(let s of n)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(K.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){r+=a.mappedValue??0,i.add(a.coords);break}}return i.size<n.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};og([p({type:String})],Er.prototype,"identifier",void 0);var sg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ar=class extends E{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,n=Array.isArray(t.value)?t.value:[t.value],r=0;for(let i of n){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?K.compareSingleValues(l.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):K.compareSingleValues(l.mapKey,i,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?r+=e.defaultValue:r+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(r=Math.max(e.lowerBound,r)),e?.upperBound!==null&&e?.upperBound!==void 0&&(r=Math.min(e.upperBound,r)),r}};sg([p({type:String})],Ar.prototype,"identifier",void 0);var oa=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];return o.match(e,n)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):K.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let n=0;n<t.value.length;n++)if(!K.compareSingleValues(e.value[n],t.value[n],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let n=0;for(let r of e.value){let i=null,s=[...t.value];for(let a of s)if(K.compareSingleValues(r,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;n++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var ag=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Tr=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};ag([p({type:String})],Tr.prototype,"name",void 0);var lg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Ir=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let n of t){if(n.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(n.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(n.value===null||n.value===void 0)return null;if(n.baseType!=="integer"&&n.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let r=parseFloat(n.value);if(isNaN(r))return console.error("qti-math-operator non-numerical value"),null;e.push(r)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let n=e[0],r=e[1];return n===0&&r<=0||n<0&&!Number.isInteger(r)?null:Math.pow(n,r)}case"log_base":{if(e.length!==2)return null;let n=e[0],r=e[1];return n<=0||r<=0||r===1?null:Math.log(n)/Math.log(r)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(n){return console.error(`qti-math-operator: error performing operation "${t}":`,n),null}}};lg([p({type:String})],Ir.prototype,"name",void 0);var sa=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var aa=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,n]=t;if(e.baseType===n.baseType||e.baseType==="integer"&&n.baseType==="float"||e.baseType==="float"&&n.baseType==="integer"||console.warn("Which must both have the same base-type"),n.cardinality==="multiple"||n.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||n.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||n.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||n.value===null)return null;let r=e.value;return n.value.includes(r)}};var la=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};var ca=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var da=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var ha=class extends E{getResult(){return null}};var pa=class extends Gt{getResult(){return Array.from(this.children).map(e=>{let n=e;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=n.calculate(),i=!1;if(typeof r=="string")if(r==="true")i=!0;else if(r==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(i=r);return i}).some(e=>typeof e=="boolean"&&e)}};var ua=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var ma=class extends k{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},hi=class extends ma{shouldProcess(){return!0}getSubRules(){return[...this.children]}},pi=class extends ma{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},ui=class extends J{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var fa=class extends ui{};var mi=class extends pi{};var ga=class extends mi{};var ba=class extends hi{};var cg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},_r=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let n=this.#t();return n?n.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};cg([p({type:String})],_r.prototype,"pattern",void 0);var va=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,n]=t;if(e.cardinality!=="single"||n.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(n.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||n.value===null||n.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||n.baseType!=="integer"&&n.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let r=parseFloat(e.value),i=parseFloat(n.value);if(isNaN(r)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(r===0&&i<=0||r<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(r,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))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var dg=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function hg(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function Rr(o,t){return hg(t===void 0?o.toExponential():o.toExponential(t))}function gu(o){let[t,e]=o.split(/e/i),n=t.includes(".")?t.replace(/\.?0+$/,""):t,r=e===void 0?"":`e${e}`;return`${n}${r}`}function bu(o,t){let e=t===0?1:t,n=o===0?0:Math.floor(Math.log10(o));return n<-4||n>=e?gu(Rr(o,e-1)):gu(o.toFixed(Math.max(0,e-1-n)))}function pg(o,t,e,n){if(o==="s"||o==="c"){let c=o==="c"?n.slice(0,1):n;return e===void 0?c:c.slice(0,e)}let r=Number(n);if(n.trim()===""||!Number.isFinite(r))return n;let i=Math.abs(r),s,a=r<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=Rr(i,e??6);break;case"E":s=Rr(i,e??6).toUpperCase();break;case"g":s=bu(i,e??6);break;case"G":s=bu(i,e??6).toUpperCase();break;default:return n}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function ug(o,t,e){if(o.length>=e)return o;let n=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(n)}`;if(t.includes("0")){let[,r,i]=/^([-+ ]?)(.*)$/.exec(o);return`${r}${"0".repeat(n)}${i}`}return`${" ".repeat(n)}${o}`}function vu(o,t){return o.replace(dg,(e,n,r,i,s,a)=>n?"%":ug(pg(a,r??"",s===void 0?void 0:Number(s),t),r??"",i===void 0?0:Number(i)))}var we=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},vt=class extends k{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(n=>n.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let n=e[this.index-1];return n==null?null:this.#e(n,t.baseType)}return e.map(n=>this.#e(n,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let n=e;if(this.field!==void 0){let i=n[this.field];return i==null?null:this.#e(i,t.baseType)}let r=Object.entries(n).filter(([,i])=>i!=null);return r.length===0?null:r.map(([i,s])=>`${i}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let n=Array.isArray(t)?t.join(" "):String(t);if(this.format)return vu(this.format,n);if(e==="integer"&&this.base!==10){let r=Number.parseInt(n,10);if(Number.isFinite(r))return r.toString(this.base)}if(this.powerForm){let r=Number(n);if(n.trim()!==""&&Number.isFinite(r))return Rr(r)}return n}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};we([p({type:String})],vt.prototype,"identifier",void 0);we([p({type:String})],vt.prototype,"format",void 0);we([p({type:Number})],vt.prototype,"base",void 0);we([p({type:Number})],vt.prototype,"index",void 0);we([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);we([p({type:String})],vt.prototype,"field",void 0);we([p({type:String})],vt.prototype,"delimiter",void 0);we([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);we([I({context:j,subscribe:!0}),_()],vt.prototype,"context",void 0);var ya=class extends E{getResult(){return this.getVariables().reduce((n,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return n*parseFloat(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return n},1)}};var dc=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},An=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let n=Math.floor(Math.random()*t.length);return t[n]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};dc([p({type:Number})],An.prototype,"min",void 0);dc([p({type:Number})],An.prototype,"max",void 0);dc([p({type:Number})],An.prototype,"step",void 0);var wa=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let n=Math.floor(Math.random()*e.length);return e[n]}return e}return console.error("unexpected number of children in match"),null}};var mg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},hc=1e3,Or=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let n=[];for(let r=0;r<t;r++){let i=e.calculate(),s=this.#n(i);s&&n.push(s)}return n}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,n=this.context?.variables?.find(s=>s.identifier===e);if(!n)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let r=Array.isArray(n.value)?n.value[0]:n.value,i=parseInt(r?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>hc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${hc} limit, truncating`),hc):t}#n(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};mg([p({type:String,attribute:"number-repeats"})],Or.prototype,"numberRepeats",void 0);var xa=class extends ui{};var fi=class extends pi{};var qa=class extends fi{};var ka=class extends hi{};var Ca=class extends J{process(){for(let t of[...this.children])t.process()}};var yu=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},gi=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let n=parseFloat(e.value);return isNaN(n)?null:isFinite(n)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(n,this.figures):this.#e(n,this.figures):n===1/0?1/0:n===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let n=Math.pow(10,e);return Math.round(t*n)/n}#e(t,e){if(t===0)return 0;let n=Math.floor(Math.log10(Math.abs(t))),r=Math.pow(10,e-n-1);return Math.round(t*r)/r}};yu([p({type:String,attribute:"rounding-mode"})],gi.prototype,"roundingMode",void 0);yu([p({type:Number})],gi.prototype,"figures",void 0);var Sa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let n=parseFloat(e.value);return isNaN(n)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(n)?Math.floor(n+.5):n===1/0?1/0:n===-1/0?-1/0:null}};var Ea=class extends J{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 r=new pc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>_t(this.#e(e))):_t(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()??""}},pc=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 Aa=class extends J{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 r=new uc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(r)}}))}#t(t){return Array.isArray(t)?t.map(_t):t!==null?_t(t):null}},uc=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 Ta=class extends J{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 r=new mc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>_t(this.#e(e))):_t(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()??""}},mc=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 fg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Pr=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#n(t,t.length);case"popsd":return Math.sqrt(this.#n(t,t.length));case"samplevariance":return t.length<2?null:this.#n(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#n(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,n)=>e+n,0)/t.length}#e(t){let e=[...t].sort((r,i)=>r-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}#n(t,e){let n=this.#t(t);return t.reduce((r,i)=>r+Math.pow(i-n,2),0)/e}#i(t){let e=[];for(let n of t){if(!n)continue;let r=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(n.value)){n.value.forEach(i=>r(i));continue}r(n.value)}return e}};fg([p({type:String})],Pr.prototype,"name",void 0);var gg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Mr=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],n=t[1];if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("unexpected cardinality in qti string-match"),!1;let r=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?n.value:n.value.toLowerCase();return K.compareSingleValues(r,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};gg([p({type:String,attribute:"case-sensitive"})],Mr.prototype,"caseSensitive",void 0);var bg=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},Dr=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,n]=t;if(e.cardinality!=="single"||n.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(n.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||n.value===null||e.value===void 0||n.value===void 0)return null;let r=e.value.toString(),i=n.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(r.toLowerCase()):i.includes(r)}};bg([p({type:String,attribute:"case-sensitive"})],Dr.prototype,"caseSensitive",void 0);var Ia=class extends vg(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function vg(o){return class extends o{calculateChildren(e){let n=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return n.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):n[0]-n[1]}}}var _a=class extends E{getResult(){return new fc(Array.from(this.children)).calculate()}},fc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(n=>n.calculate!==void 0).some(n=>n.calculate()===null)?null:this.expressions.map(n=>{let r=n.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((n,r)=>n+r,0)}};var Ra=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let n=Number.parseFloat(e.value);return Number.isNaN(n)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(n)}};var Oa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var wu=[{tag:"qti-and",ctor:Ls},{tag:"qti-any-n",ctor:ai},{tag:"qti-base-value",ctor:kr},{tag:"qti-container-size",ctor:zs},{tag:"qti-contains",ctor:Vs},{tag:"qti-correct",ctor:js},{tag:"qti-default",ctor:En},{tag:"qti-delete",ctor:Fs},{tag:"qti-divide",ctor:Bs},{tag:"qti-duration-gte",ctor:Us},{tag:"qti-duration-lt",ctor:Hs},{tag:"qti-equal",ctor:li},{tag:"qti-equal-rounded",ctor:Cr},{tag:"qti-exit-response",ctor:Ws},{tag:"qti-exit-test",ctor:Qs},{tag:"qti-field-value",ctor:Gs},{tag:"qti-gcd",ctor:Xs},{tag:"qti-gt",ctor:Ys},{tag:"qti-gte",ctor:Js},{tag:"qti-index",ctor:Sr},{tag:"qti-inside",ctor:ci},{tag:"qti-integer-divide",ctor:Ks},{tag:"qti-integer-modulus",ctor:Zs},{tag:"qti-integer-to-float",ctor:ta},{tag:"qti-is-null",ctor:ea},{tag:"qti-lcm",ctor:na},{tag:"qti-lookup-outcome-value",ctor:di},{tag:"qti-lt",ctor:ia},{tag:"qti-lte",ctor:ra},{tag:"qti-map-response",ctor:Ar},{tag:"qti-map-response-point",ctor:Er},{tag:"qti-match",ctor:oa},{tag:"qti-math-constant",ctor:Tr},{tag:"qti-math-operator",ctor:Ir},{tag:"qti-max",ctor:sa},{tag:"qti-member",ctor:aa},{tag:"qti-min",ctor:la},{tag:"qti-multiple",ctor:ca},{tag:"qti-not",ctor:da},{tag:"qti-null",ctor:ha},{tag:"qti-or",ctor:pa},{tag:"qti-ordered",ctor:ua},{tag:"qti-outcome-condition",ctor:fa},{tag:"qti-outcome-else",ctor:ba},{tag:"qti-outcome-else-if",ctor:ga},{tag:"qti-outcome-if",ctor:mi},{tag:"qti-pattern-match",ctor:_r},{tag:"qti-power",ctor:va},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ya},{tag:"qti-random",ctor:wa},{tag:"qti-random-integer",ctor:An},{tag:"qti-repeat",ctor:Or},{tag:"qti-response-condition",ctor:xa},{tag:"qti-response-else",ctor:ka},{tag:"qti-response-else-if",ctor:qa},{tag:"qti-response-if",ctor:fi},{tag:"qti-response-processing-fragment",ctor:Ca},{tag:"qti-round",ctor:Sa},{tag:"qti-round-to",ctor:gi},{tag:"qti-rule",ctor:J},{tag:"qti-set-correct-response",ctor:Ea},{tag:"qti-set-outcome-value",ctor:Aa},{tag:"qti-set-template-value",ctor:Ta},{tag:"qti-stats-operator",ctor:Pr},{tag:"qti-string-match",ctor:Mr},{tag:"qti-substring",ctor:Dr},{tag:"qti-subtract",ctor:Ia},{tag:"qti-sum",ctor:_a},{tag:"qti-truncate",ctor:Ra},{tag:"qti-variable",ctor:Oa}];for(let{tag:o,ctor:t}of wu)customElements.get(o)||customElements.define(o,t);var xe=function(o,t,e,n){var r=arguments.length,i=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,n);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(r<3?s(i):r>3?s(t,e,i):s(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i},tt;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(tt||(tt={}));var gc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(n,r)=>{this.toggleInternalCorrectResponse(r)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(n,r)=>{this.toggleFullCorrectResponse(r)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(n,r)=>{this.toggleCandidateCorrection(r)},this._correctResponse=null}set correctResponseAttr(n){this._correctResponse=n}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(n){this._isFullCorrectResponse=n,n&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let n=this.responseVariable;return n?.correctResponse?n.correctResponse:this._correctResponse}set correctResponse(n){let r=this._correctResponse;this._correctResponse=n,n==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(n)?n.join(","):n),this.requestUpdate("_correctResponse",r)}get correctness(){let n=this.correctResponse;if(!n)return null;let r=this.response;if(r==null||r===""||Array.isArray(r)&&r.length===0)return null;let i=Array.isArray(n)?n:[n],a=(Array.isArray(r)?r:[r]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>i.includes(d)).length,c=a.filter(d=>!i.includes(d)).length;return l===i.length&&c===0&&a.length===i.length?tt.Correct:l>0&&(l<i.length||c>0)?tt.PartiallyCorrect:tt.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(n){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(n):this.toggleInternalCorrectResponse(n)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(n){let r=this.nextSibling,i=r instanceof HTMLDivElement&&r?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(n&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==tt.Correct))){if(!i)return;this.parentElement?.removeChild(r);return}if(i)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(n){this._internals.states.delete("show-correct-response"),n&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(n){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return xe([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),xe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),xe([z("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),xe([z("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),xe([z("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),xe([_()],t.prototype,"_isFullCorrectResponse",void 0),xe([_()],t.prototype,"_correctResponse",void 0),t};var lt=q`
|
|
12694
|
+
`}async#i(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,i)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>i(r.error),r.readAsDataURL(t)})}};var zs=[{tag:"qti-upload-interaction",ctor:Ls}];var mu=[...ds,...hs,...ps,...us,...ms,...fs,...bs,...vs,...ys,...ws,...xs,...qs,...Cs,...Es,...As,..._s,...Ps,...Ds,...Ns,...$s,...zs,...cp];for(let{tag:o,ctor:t}of mu)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of As)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of _s)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of $s)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of zs)customElements.get(o)||customElements.define(o,t);var W2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Jd().load(`${o}`).then(a=>a.assessmentTest()),i=await Ui().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),r=await Ui().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:i,testURI:s,testURL:n,items:r,testIdentifier:e.identifier}},Q2=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Vs=class extends og(Xt){calculate(){return this.calculateChildren(Array.from(this.children))}};function og(o){return class extends o{calculateChildren(e){return e.map(r=>{let n=r;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.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(r=>typeof r=="boolean"&&r)}}}var fu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ln=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let i of t){if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(i.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(i.value===null||i.value===void 0)return null;i.value==="true"&&e++}return e>=this.min&&e<=this.max}};fu([p({type:Number})],ln.prototype,"min",void 0);fu([p({type:Number})],ln.prototype,"max",void 0);var sg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Cr=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};sg([p({type:String,attribute:"base-type"})],Cr.prototype,"baseType",void 0);var js=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Fs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let i=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,i));let r=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#n(r,n,i):this.#i(r,n,i)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,i){return K.compareSingleValues(t,e,i)||t===e}#i(t,e,i){let r=[...t];return e.every(n=>{let s=r.findIndex(a=>this.#e(a,n,i));return s===-1?!1:(r.splice(s,1),!0)})}#n(t,e,i){for(let r=0;r+e.length<=t.length;r++)if(e.every((n,s)=>this.#e(t[r+s],n,i)))return!0;return!1}};var Bs=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(i=>i.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var dc=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ei=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,i;if(t.length===2)e=t[0],i=t[1];else if(t.length===1)i=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)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===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let r=this.context.variables.find(n=>n.identifier===i);return r?r.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};dc([p({type:String})],Ei.prototype,"identifier",void 0);dc([I({context:j,subscribe:!0}),_()],Ei.prototype,"context",void 0);dc([_(),I({context:ot,subscribe:!0})],Ei.prototype,"_testContext",void 0);var Us=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return e.cardinality!=="single"||!Array.isArray(i.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):i.value.filter(n=>!e.value.includes(n))}return null}};var Hs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};var Ws=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(i=>this.#e(i));return e.some(i=>i===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 Qs=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(i=>this.#e(i));return e.some(i=>i===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 ag=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Sr=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let r=parseFloat(e.value),n=parseFloat(i.value);if(!isNaN(r)&&!isNaN(n))return this.roundingMode==="significantFigures"?r.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(r*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${r}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};ag([p({type:String,attribute:"rounding-mode"})],Sr.prototype,"roundingMode",void 0);var gu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},cn=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return!e||!i?null:e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||i.value===null||e.value===void 0||i.value===void 0?null:this.toleranceMode==="exact"?K.compareSingleValues(e.value,i.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(i.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 i=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(i.length===0||i.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[r,n=r]=i,[s,a]=this.toleranceMode==="absolute"?[e-r,e+n]:[e*(1-r/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};gu([p({type:String,attribute:"tolerance-mode"})],cn.prototype,"toleranceMode",void 0);gu([p({type:String})],cn.prototype,"tolerance",void 0);var J=class extends k{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Gs=class extends J{process(){throw new Di}};var Xs=class extends J{process(){throw new Ni}};var Ys=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],i=e?.cardinality==="record"||e?.baseType==="record";if(i&&(e.value===null||e.value===void 0))return null;if(!e||!i||!Ot(e.value))return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r==null?null:(this.#t=e.fieldBaseTypes?.[t]??ao(Array.isArray(r)?r[0]:r),r)}};var Js=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(i.value===null||i.value===void 0)return null;if(i.cardinality==="single"){if(Array.isArray(i.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let r=parseInt(i.value,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}else if(i.cardinality==="multiple"||i.cardinality==="ordered"){if(!Array.isArray(i.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let r of i.value){if(r==null)return null;let n=parseInt(r,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}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 i=1;i<t.length&&(e=this.#e(e,Math.abs(t[i])),e!==1);i++);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 i=e;e=t%e,t=i}return t}};var Tt=o=>o==null||o==="";var Ks=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(Tt(e?.value)||Tt(i?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float"))return+e.value>+i.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Zs=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return Tt(e?.value)||Tt(i?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float")?+e.value>=+i.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var lg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Er=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let i=this.#t(this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(i)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let i=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>i.length?null:i[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(i=>i.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};lg([p({type:String})],Er.prototype,"n",void 0);var bu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},dn=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let i=this.#t(e.value.toString()),r=this.#e(this.coords);if(!i||r.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#i(i,r);case"rect":return this.#n(i,r);case"ellipse":return this.#r(i,r);case"poly":case"polygon":return this.#o(i,r);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.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 i=Number.parseFloat(e[0]),r=Number.parseFloat(e[1]);return Number.isNaN(i)||Number.isNaN(r)?(console.error("qti-inside requires numeric point coordinates"),null):{x:i,y:r}}#e(t){let e=t.split(",").map(i=>i.trim()).filter(Boolean).map(i=>Number.parseFloat(i));return e.some(i=>Number.isNaN(i))?(console.error("qti-inside requires numeric coords"),[]):e}#i(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[i,r,n]=e;return(t.x-i)**2+(t.y-r)**2<=n**2}#n(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[i,r,n,s]=e,a=Math.min(i,n),l=Math.max(i,n),c=Math.min(r,s),d=Math.max(r,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#r(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[i,r,n,s]=e;return n===0||s===0?!1:(t.x-i)**2/n**2+(t.y-r)**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 i=!1;for(let r=0,n=e.length-2;r<e.length;r+=2){let s=e[r],a=e[r+1],l=e[n],c=e[n+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(i=!i),n=r}return i}};bu([p({type:String})],dn.prototype,"shape",void 0);bu([p({type:String})],dn.prototype,"coords",void 0);var ta=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-integer-divide requires single cardinality"),[];if(i.value===null||i.value===void 0)return[];let r=Number.parseInt(i.value,10);if(Number.isNaN(r))return console.error("qti-integer-divide requires integer values"),[];e.push(r)}return e}};var ea=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(i.value===null||i.value===void 0)return[];let r=Number.parseInt(i.value,10);if(Number.isNaN(r))return console.error("qti-integer-modulus requires integer values"),[];e.push(r)}return e}};var ia=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let i=Number.parseInt(e.value,10);return Number.isNaN(i)?(console.error("qti-integer-to-float requires an integer value"),null):i}};var na=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var ra=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,i)=>this.#i(e,i))}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(i.value===null||i.value===void 0)return[];if(i.cardinality==="single"){if(Array.isArray(i.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let r=Number.parseInt(i.value,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r);continue}if(i.cardinality!=="multiple"&&i.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(i.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let r of i.value){let n=Number.parseInt(r,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let i=Math.abs(t),r=Math.abs(e);for(;r!==0;){let n=i%r;i=r,r=n}return i}#i(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var vu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},hn=class extends J{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let i=parseFloat(this.childExpression.calculate()),r;return e.matchTable?.size?r=e.matchTable.get(i):e.interpolationTable&&(r=this.#t(i,e.interpolationTable)),r==null?(console.warn(`lookupOutcomeValue: no table entry matches ${i} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Rt(r)}})),r)}#t(t,e){if(!Number.isNaN(t))return e.find(i=>i.includeBoundary?t>=i.sourceValue:t>i.sourceValue)?.targetValue}};vu([p({type:String})],hn.prototype,"identifier",void 0);vu([I({context:j,subscribe:!0}),_()],hn.prototype,"context",void 0);var oa=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(Tt(e?.value)||Tt(i?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float"))return+e.value<+i.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var sa=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return Tt(e?.value)||Tt(i?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float")?+e.value<=+i.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var cg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ar=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let i=Array.isArray(t.value)?t.value:[t.value];if(!i||i.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,n=new Set;for(let s of i)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(K.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){r+=a.mappedValue??0,n.add(a.coords);break}}return n.size<i.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};cg([p({type:String})],Ar.prototype,"identifier",void 0);var dg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Tr=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,i=Array.isArray(t.value)?t.value:[t.value],r=0;for(let n of i){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?K.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):K.compareSingleValues(l.mapKey,n,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?r+=e.defaultValue:r+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(r=Math.max(e.lowerBound,r)),e?.upperBound!==null&&e?.upperBound!==void 0&&(r=Math.min(e.upperBound,r)),r}};dg([p({type:String})],Tr.prototype,"identifier",void 0);var aa=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return o.match(e,i)}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):K.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 i=0;i<t.value.length;i++)if(!K.compareSingleValues(e.value[i],t.value[i],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 i=0;for(let r of e.value){let n=null,s=[...t.value];for(let a of s)if(K.compareSingleValues(r,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;i++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var hg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ir=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};hg([p({type:String})],Ir.prototype,"name",void 0);var pg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},_r=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let i of t){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let r=parseFloat(i.value);if(isNaN(r))return console.error("qti-math-operator non-numerical value"),null;e.push(r)}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 i=e[0],r=e[1];return i===0&&r<=0||i<0&&!Number.isInteger(r)?null:Math.pow(i,r)}case"log_base":{if(e.length!==2)return null;let i=e[0],r=e[1];return i<=0||r<=0||r===1?null:Math.log(i)/Math.log(r)}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(i){return console.error(`qti-math-operator: error performing operation "${t}":`,i),null}}};pg([p({type:String})],_r.prototype,"name",void 0);var la=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};var ca=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,i]=t;if(e.baseType===i.baseType||e.baseType==="integer"&&i.baseType==="float"||e.baseType==="float"&&i.baseType==="integer"||console.warn("Which must both have the same base-type"),i.cardinality==="multiple"||i.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||i.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||i.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||i.value===null)return null;let r=e.value;return i.value.includes(r)}};var da=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};var ha=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var pa=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var ua=class extends E{getResult(){return null}};var ma=class extends Xt{getResult(){return Array.from(this.children).map(e=>{let i=e;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=i.calculate(),n=!1;if(typeof r=="string")if(r==="true")n=!0;else if(r==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(n=r);return n}).some(e=>typeof e=="boolean"&&e)}};var fa=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var ga=class extends k{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},pn=class extends ga{shouldProcess(){return!0}getSubRules(){return[...this.children]}},un=class extends ga{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},mn=class extends J{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ba=class extends mn{};var fn=class extends un{};var va=class extends fn{};var ya=class extends pn{};var ug=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Rr=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let i=this.#t();return i?i.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}}}};ug([p({type:String})],Rr.prototype,"pattern",void 0);var wa=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,i]=t;if(e.cardinality!=="single"||i.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(i.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||i.value===null||i.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let r=parseFloat(e.value),n=parseFloat(i.value);if(isNaN(r)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(r===0&&n<=0||r<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(r,n)}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 mg=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function fg(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function Or(o,t){return fg(t===void 0?o.toExponential():o.toExponential(t))}function yu(o){let[t,e]=o.split(/e/i),i=t.includes(".")?t.replace(/\.?0+$/,""):t,r=e===void 0?"":`e${e}`;return`${i}${r}`}function wu(o,t){let e=t===0?1:t,i=o===0?0:Math.floor(Math.log10(o));return i<-4||i>=e?yu(Or(o,e-1)):yu(o.toFixed(Math.max(0,e-1-i)))}function gg(o,t,e,i){if(o==="s"||o==="c"){let c=o==="c"?i.slice(0,1):i;return e===void 0?c:c.slice(0,e)}let r=Number(i);if(i.trim()===""||!Number.isFinite(r))return i;let n=Math.abs(r),s,a=r<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=Or(n,e??6);break;case"E":s=Or(n,e??6).toUpperCase();break;case"g":s=wu(n,e??6);break;case"G":s=wu(n,e??6).toUpperCase();break;default:return i}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function bg(o,t,e){if(o.length>=e)return o;let i=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(i)}`;if(t.includes("0")){let[,r,n]=/^([-+ ]?)(.*)$/.exec(o);return`${r}${"0".repeat(i)}${n}`}return`${" ".repeat(i)}${o}`}function xu(o,t){return o.replace(mg,(e,i,r,n,s,a)=>i?"%":bg(gg(a,r??"",s===void 0?void 0:Number(s),t),r??"",n===void 0?0:Number(n)))}var xe=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends k{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(i=>i.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${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 i=e[this.index-1];return i==null?null:this.#e(i,t.baseType)}return e.map(i=>this.#e(i,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let i=e;if(this.field!==void 0){let n=i[this.field];return n==null?null:this.#e(n,t.baseType)}let r=Object.entries(i).filter(([,n])=>n!=null);return r.length===0?null:r.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let i=Array.isArray(t)?t.join(" "):String(t);if(this.format)return xu(this.format,i);if(e==="integer"&&this.base!==10){let r=Number.parseInt(i,10);if(Number.isFinite(r))return r.toString(this.base)}if(this.powerForm){let r=Number(i);if(i.trim()!==""&&Number.isFinite(r))return Or(r)}return i}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};xe([p({type:String})],vt.prototype,"identifier",void 0);xe([p({type:String})],vt.prototype,"format",void 0);xe([p({type:Number})],vt.prototype,"base",void 0);xe([p({type:Number})],vt.prototype,"index",void 0);xe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);xe([p({type:String})],vt.prototype,"field",void 0);xe([p({type:String})],vt.prototype,"delimiter",void 0);xe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);xe([I({context:j,subscribe:!0}),_()],vt.prototype,"context",void 0);var xa=class extends E{getResult(){return this.getVariables().reduce((i,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return i*parseFloat(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return i},1)}};var hc=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ai=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),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 i=Math.floor(Math.random()*t.length);return t[i]}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 i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};hc([p({type:Number})],Ai.prototype,"min",void 0);hc([p({type:Number})],Ai.prototype,"max",void 0);hc([p({type:Number})],Ai.prototype,"step",void 0);var qa=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let i=Math.floor(Math.random()*e.length);return e[i]}return e}return console.error("unexpected number of children in match"),null}};var vg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},pc=1e3,Pr=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let i=[];for(let r=0;r<t;r++){let n=e.calculate(),s=this.#i(n);s&&i.push(s)}return i}#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,i=this.context?.variables?.find(s=>s.identifier===e);if(!i)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let r=Array.isArray(i.value)?i.value[0]:i.value,n=parseInt(r?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>pc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${pc} limit, truncating`),pc):t}#i(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"}}};vg([p({type:String,attribute:"number-repeats"})],Pr.prototype,"numberRepeats",void 0);var ka=class extends mn{};var gn=class extends un{};var Ca=class extends gn{};var Sa=class extends pn{};var Ea=class extends J{process(){for(let t of[...this.children])t.process()}};var qu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},bn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(e.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(i,this.figures):this.#e(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let i=Math.pow(10,e);return Math.round(t*i)/i}#e(t,e){if(t===0)return 0;let i=Math.floor(Math.log10(Math.abs(t))),r=Math.pow(10,e-i-1);return Math.round(t*r)/r}};qu([p({type:String,attribute:"rounding-mode"})],bn.prototype,"roundingMode",void 0);qu([p({type:Number})],bn.prototype,"figures",void 0);var Aa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let i=parseFloat(e.value);return isNaN(i)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(i)?Math.floor(i+.5):i===1/0?1/0:i===-1/0?-1/0:null}};var Ta=class extends J{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 r=new uc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Rt(this.#e(e))):Rt(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("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 Ia=class extends J{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 r=new mc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(r)}}))}#t(t){return Array.isArray(t)?t.map(Rt):t!==null?Rt(t):null}},mc=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 _a=class extends J{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 r=new fc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Rt(this.#e(e))):Rt(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()??""}},fc=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 yg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Mr=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#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.#i(t,t.length);case"popsd":return Math.sqrt(this.#i(t,t.length));case"samplevariance":return t.length<2?null:this.#i(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#i(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,i)=>e+i,0)/t.length}#e(t){let e=[...t].sort((r,n)=>r-n),i=Math.floor(e.length/2);return e.length%2===0?(e[i-1]+e[i])/2:e[i]}#i(t,e){let i=this.#t(t);return t.reduce((r,n)=>r+Math.pow(n-i,2),0)/e}#n(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};yg([p({type:String})],Mr.prototype,"name",void 0);var wg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Dr=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let r=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return K.compareSingleValues(r,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};wg([p({type:String,attribute:"case-sensitive"})],Dr.prototype,"caseSensitive",void 0);var xg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Nr=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,i]=t;if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||i.value===null||e.value===void 0||i.value===void 0)return null;let r=e.value.toString(),n=i.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(r.toLowerCase()):n.includes(r)}};xg([p({type:String,attribute:"case-sensitive"})],Nr.prototype,"caseSensitive",void 0);var Ra=class extends qg(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function qg(o){return class extends o{calculateChildren(e){let i=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=r.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return i.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):i[0]-i[1]}}}var Oa=class extends E{getResult(){return new gc(Array.from(this.children)).calculate()}},gc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(i=>i.calculate!==void 0).some(i=>i.calculate()===null)?null:this.expressions.map(i=>{let r=i.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((i,r)=>i+r,0)}};var Pa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let i=Number.parseFloat(e.value);return Number.isNaN(i)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(i)}};var Ma=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var ku=[{tag:"qti-and",ctor:Vs},{tag:"qti-any-n",ctor:ln},{tag:"qti-base-value",ctor:Cr},{tag:"qti-container-size",ctor:js},{tag:"qti-contains",ctor:Fs},{tag:"qti-correct",ctor:Bs},{tag:"qti-default",ctor:Ei},{tag:"qti-delete",ctor:Us},{tag:"qti-divide",ctor:Hs},{tag:"qti-duration-gte",ctor:Ws},{tag:"qti-duration-lt",ctor:Qs},{tag:"qti-equal",ctor:cn},{tag:"qti-equal-rounded",ctor:Sr},{tag:"qti-exit-response",ctor:Gs},{tag:"qti-exit-test",ctor:Xs},{tag:"qti-field-value",ctor:Ys},{tag:"qti-gcd",ctor:Js},{tag:"qti-gt",ctor:Ks},{tag:"qti-gte",ctor:Zs},{tag:"qti-index",ctor:Er},{tag:"qti-inside",ctor:dn},{tag:"qti-integer-divide",ctor:ta},{tag:"qti-integer-modulus",ctor:ea},{tag:"qti-integer-to-float",ctor:ia},{tag:"qti-is-null",ctor:na},{tag:"qti-lcm",ctor:ra},{tag:"qti-lookup-outcome-value",ctor:hn},{tag:"qti-lt",ctor:oa},{tag:"qti-lte",ctor:sa},{tag:"qti-map-response",ctor:Tr},{tag:"qti-map-response-point",ctor:Ar},{tag:"qti-match",ctor:aa},{tag:"qti-math-constant",ctor:Ir},{tag:"qti-math-operator",ctor:_r},{tag:"qti-max",ctor:la},{tag:"qti-member",ctor:ca},{tag:"qti-min",ctor:da},{tag:"qti-multiple",ctor:ha},{tag:"qti-not",ctor:pa},{tag:"qti-null",ctor:ua},{tag:"qti-or",ctor:ma},{tag:"qti-ordered",ctor:fa},{tag:"qti-outcome-condition",ctor:ba},{tag:"qti-outcome-else",ctor:ya},{tag:"qti-outcome-else-if",ctor:va},{tag:"qti-outcome-if",ctor:fn},{tag:"qti-pattern-match",ctor:Rr},{tag:"qti-power",ctor:wa},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:xa},{tag:"qti-random",ctor:qa},{tag:"qti-random-integer",ctor:Ai},{tag:"qti-repeat",ctor:Pr},{tag:"qti-response-condition",ctor:ka},{tag:"qti-response-else",ctor:Sa},{tag:"qti-response-else-if",ctor:Ca},{tag:"qti-response-if",ctor:gn},{tag:"qti-response-processing-fragment",ctor:Ea},{tag:"qti-round",ctor:Aa},{tag:"qti-round-to",ctor:bn},{tag:"qti-rule",ctor:J},{tag:"qti-set-correct-response",ctor:Ta},{tag:"qti-set-outcome-value",ctor:Ia},{tag:"qti-set-template-value",ctor:_a},{tag:"qti-stats-operator",ctor:Mr},{tag:"qti-string-match",ctor:Dr},{tag:"qti-substring",ctor:Nr},{tag:"qti-subtract",ctor:Ra},{tag:"qti-sum",ctor:Oa},{tag:"qti-truncate",ctor:Pa},{tag:"qti-variable",ctor:Ma}];for(let{tag:o,ctor:t}of ku)customElements.get(o)||customElements.define(o,t);var qe=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},tt;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(tt||(tt={}));var bc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(i,r)=>{this.toggleInternalCorrectResponse(r)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(i,r)=>{this.toggleFullCorrectResponse(r)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(i,r)=>{this.toggleCandidateCorrection(r)},this._correctResponse=null}set correctResponseAttr(i){this._correctResponse=i}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(i){this._isFullCorrectResponse=i,i&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let i=this.responseVariable;return i?.correctResponse?i.correctResponse:this._correctResponse}set correctResponse(i){let r=this._correctResponse;this._correctResponse=i,i==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(i)?i.join(","):i),this.requestUpdate("_correctResponse",r)}get correctness(){let i=this.correctResponse;if(!i)return null;let r=this.response;if(r==null||r===""||Array.isArray(r)&&r.length===0)return null;let n=Array.isArray(i)?i:[i],a=(Array.isArray(r)?r:[r]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>n.includes(d)).length,c=a.filter(d=>!n.includes(d)).length;return l===n.length&&c===0&&a.length===n.length?tt.Correct:l>0&&(l<n.length||c>0)?tt.PartiallyCorrect:tt.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(i){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(i):this.toggleInternalCorrectResponse(i)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(i){let r=this.nextSibling,n=r instanceof HTMLDivElement&&r?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(i&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==tt.Correct))){if(!n)return;this.parentElement?.removeChild(r);return}if(n)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(i){this._internals.states.delete("show-correct-response"),i&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(i){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return qe([p({attribute:"correct-response",reflect:!0,converter:Yt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),qe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),qe([z("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),qe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),qe([z("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),qe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),qe([z("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),qe([_()],t.prototype,"_isFullCorrectResponse",void 0),qe([_()],t.prototype,"_correctResponse",void 0),t};var lt=q`
|
|
12592
12695
|
/* Nothing at all until the item judges this element. */
|
|
12593
12696
|
[part~='correction'] {
|
|
12594
12697
|
display: none;
|
|
@@ -12621,21 +12724,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12621
12724
|
|
|
12622
12725
|
pointer-events: none;
|
|
12623
12726
|
}
|
|
12624
|
-
`;var
|
|
12727
|
+
`;var kg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Z=o=>{class t extends bc(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(i){this.showCandidateCorrection!==i&&(this.showCandidateCorrection=i),super.toggleCandidateCorrection(i);let r=this._internals;r.states.delete("candidate-correct"),r.states.delete("candidate-partially-correct"),r.states.delete("candidate-incorrect");let n=null;i&&(this.correctness===tt.Correct&&(r.states.add("candidate-correct"),n="correct"),this.correctness===tt.PartiallyCorrect&&(r.states.add("candidate-partially-correct"),n="partially-correct"),this.correctness===tt.Incorrect&&(r.states.add("candidate-incorrect"),n="incorrect")),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return kg([_()],t.prototype,"_candidateCorrection",void 0),t};var Ti=o=>{class t extends Z(o){toggleInternalCorrectResponse(i){super.toggleInternalCorrectResponse(i);let r=this.correctResponse,n=r?Array.isArray(r)?r:[r]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),i&&n.length>0&&s.internals.states.add(n.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(i){super.toggleCandidateCorrection(i);for(let s of this._choiceElements)s.candidateCorrection=null;if(!i||!this.correctResponse)return;let r=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=r.includes(s.identifier)?"correct":"incorrect")}}return t};var It=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(i){if(this.#t===i)return;let r=this.#t;this.#t=i;let n=this.internals.states;n.delete("candidate-correct"),n.delete("candidate-incorrect"),n.delete("candidate-partially-correct"),i&&n.add(`candidate-${i}`),this.requestUpdate("candidateCorrection",r)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var vc=class extends It(je){static{this.styles=[je.styles,lt]}render(){return v`<div part="control"></div>
|
|
12625
12728
|
<slot part="label"></slot>
|
|
12626
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
12729
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Cg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Da=class extends It(vi){constructor(){super(...arguments),this.orderCorrect=null}};Cg([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Da.prototype,"orderCorrect",void 0);var yc=class extends It(yi){static{this.styles=[yi.styles,lt]}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
12627
12730
|
<slot part="label"></slot>
|
|
12628
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
12731
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var wc=class extends It(Lt){static{this.styles=[Lt.styles,lt]}render(){return v`
|
|
12629
12732
|
<div part="control"></div>
|
|
12630
12733
|
<slot part="label"></slot>
|
|
12631
12734
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
12632
12735
|
<div part="drop">
|
|
12633
12736
|
${G(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
12634
12737
|
</div>
|
|
12635
|
-
`}};var
|
|
12738
|
+
`}};var xc=class extends It(zt){static{this.styles=[zt.styles,lt]}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
12636
12739
|
${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
12637
12740
|
<slot part="label"></slot>
|
|
12638
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
12741
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Cu=class extends mt{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 i=this.getRootNode();for(;;){if(i.querySelectorAll(t).forEach(r=>r.shown=e),!(i instanceof ShadowRoot))return;i=i.host.getRootNode()}}};var Su=class extends be{#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)};#i=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.#i)}updateControlState(t,e){this.querySelectorAll(t).forEach(i=>i.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.#i),super.disconnectedCallback()}};var Eu=class extends ft{#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,i){if(!t||!e?.showSolution)return;let r=t;r.showCandidateCorrection?.(!0),r.showCorrectResponse?.(i)}},Au=class extends Ne{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},Tu=class extends hi{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var qc=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},$r=class extends k{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 v`
|
|
12639
12742
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
12640
12743
|
<select
|
|
12641
12744
|
part="select"
|
|
@@ -12646,12 +12749,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12646
12749
|
${this._options[t]}
|
|
12647
12750
|
</option>`)}
|
|
12648
12751
|
</select>
|
|
12649
|
-
`}};
|
|
12752
|
+
`}};qc([I({context:yt,subscribe:!0})],$r.prototype,"itemContext",void 0);qc([p({type:String})],$r.prototype,"label",void 0);qc([_()],$r.prototype,"_options",void 0);var vn=q`
|
|
12650
12753
|
display: inline-flex;
|
|
12651
12754
|
cursor: pointer;
|
|
12652
12755
|
border-radius: 0.25rem;
|
|
12653
12756
|
user-select: none;
|
|
12654
|
-
`,
|
|
12757
|
+
`,Iu=q`
|
|
12655
12758
|
display: flex;
|
|
12656
12759
|
flex: 1 1 auto;
|
|
12657
12760
|
align-items: center;
|
|
@@ -12659,50 +12762,50 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12659
12762
|
padding: 0.5rem 1rem;
|
|
12660
12763
|
border-radius: 0.25rem;
|
|
12661
12764
|
user-select: none;
|
|
12662
|
-
`,
|
|
12765
|
+
`,yn=q`
|
|
12663
12766
|
background-color: lightgray;
|
|
12664
|
-
${
|
|
12665
|
-
`,
|
|
12767
|
+
${Iu};
|
|
12768
|
+
`,wn=q`
|
|
12666
12769
|
cursor: not-allowed;
|
|
12667
12770
|
opacity: 0.8;
|
|
12668
|
-
`,
|
|
12669
|
-
${
|
|
12771
|
+
`,gU=q`
|
|
12772
|
+
${Iu};
|
|
12670
12773
|
border: 1px solid gray;
|
|
12671
|
-
`;var
|
|
12774
|
+
`;var xn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ye=class extends k{static{this.styles=q`
|
|
12672
12775
|
:host {
|
|
12673
|
-
${
|
|
12776
|
+
${vn};
|
|
12674
12777
|
}
|
|
12675
12778
|
div {
|
|
12676
|
-
${
|
|
12779
|
+
${yn};
|
|
12677
12780
|
}
|
|
12678
12781
|
:host([disabled]) {
|
|
12679
|
-
${
|
|
12782
|
+
${wn};
|
|
12680
12783
|
}
|
|
12681
|
-
`}#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(
|
|
12784
|
+
`}#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(i=>i.correctResponse),e=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#i(){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 v` <div @click="${this.#i}">${this.#n()}</div> `}};xn([I({context:Ee,subscribe:!0})],Ye.prototype,"computedContext",void 0);xn([p({type:Boolean,reflect:!0})],Ye.prototype,"shown",void 0);xn([p({type:Boolean,reflect:!0})],Ye.prototype,"disabled",void 0);xn([p({type:String})],Ye.prototype,"showCandidateCorrectionText",void 0);xn([p({type:String})],Ye.prototype,"hideCandidateCorrectionText",void 0);xn([p({type:String})],Ye.prototype,"noCorrectResponseText",void 0);var qn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Je=class extends k{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`
|
|
12682
12785
|
:host {
|
|
12683
|
-
${
|
|
12786
|
+
${vn};
|
|
12684
12787
|
}
|
|
12685
12788
|
div {
|
|
12686
|
-
${
|
|
12789
|
+
${yn};
|
|
12687
12790
|
}
|
|
12688
12791
|
:host([disabled]) {
|
|
12689
|
-
${
|
|
12792
|
+
${wn};
|
|
12690
12793
|
}
|
|
12691
|
-
`}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(
|
|
12794
|
+
`}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(i=>i.correctResponse),e=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#i(){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 v` <div @click="${this.#i}">${this.#n()}</div> `}};qn([I({context:Ee,subscribe:!0})],Je.prototype,"computedContext",void 0);qn([p({type:Boolean,reflect:!0})],Je.prototype,"shown",void 0);qn([p({type:Boolean,reflect:!0})],Je.prototype,"disabled",void 0);qn([p({type:String})],Je.prototype,"showCorrectText",void 0);qn([p({type:String})],Je.prototype,"hideCorrectText",void 0);qn([p({type:String})],Je.prototype,"noCorrectResponseText",void 0);var kn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ke=class extends k{static{this.styles=q`
|
|
12692
12795
|
:host {
|
|
12693
|
-
${
|
|
12796
|
+
${vn};
|
|
12694
12797
|
}
|
|
12695
12798
|
div {
|
|
12696
|
-
${
|
|
12799
|
+
${yn};
|
|
12697
12800
|
}
|
|
12698
12801
|
:host(:focus-visible) {
|
|
12699
12802
|
outline: 2px solid currentColor;
|
|
12700
12803
|
outline-offset: 2px;
|
|
12701
12804
|
}
|
|
12702
12805
|
:host([disabled]) {
|
|
12703
|
-
${
|
|
12806
|
+
${wn};
|
|
12704
12807
|
}
|
|
12705
|
-
`}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#
|
|
12808
|
+
`}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#i()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#i())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(r=>r.items)).find(i=>i.active);if(this.#e!==e&&(this.shown=!1,this.#e=e),e){let i=!!e?.variables?.some(n=>n.correctResponse),r=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!r}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#i(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#n(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`${this.#n()}`}};kn([I({context:F,subscribe:!0})],Ke.prototype,"computedContext",void 0);kn([p({type:Boolean,reflect:!0})],Ke.prototype,"shown",void 0);kn([p({type:Boolean,reflect:!0})],Ke.prototype,"disabled",void 0);kn([p({type:String})],Ke.prototype,"showCorrectText",void 0);kn([p({type:String})],Ke.prototype,"hideCorrectText",void 0);kn([p({type:String})],Ke.prototype,"noCorrectResponseText",void 0);var ne=o=>{class t extends Z(o){toggleInternalCorrectResponse(i){this.showFullCorrectResponse||this.toggleFullCorrectResponse(i)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var Cc=class extends ne(qi){};var Sc=class extends Ti(ki){};var Sg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Na=class extends It(X){static{this.styles=[X.styles,lt,q`
|
|
12706
12809
|
/*
|
|
12707
12810
|
* Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
|
|
12708
12811
|
* is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
|
|
@@ -12766,7 +12869,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12766
12869
|
}
|
|
12767
12870
|
`]}render(){return v`${this.renderPrompt()}${this.renderTextarea()}
|
|
12768
12871
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
12769
|
-
${this.renderValidationMessage()}`}};
|
|
12872
|
+
${this.renderValidationMessage()}`}};Sg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Na.prototype,"candidateCorrection",void 0);var $a=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[i,r]=e.split(" ");return{source:i,target:r}}):[];var Ec=class extends ne(nn){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=$a(this.correctResponse);for(let i of this.querySelectorAll("qti-gap")){let r=i.getAttribute("identifier"),n=i.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===r)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var Ac=class extends Z(Bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",i)}renderSupplementalLines(){return G(this.#t,t=>t,t=>Ln`
|
|
12770
12873
|
<line
|
|
12771
12874
|
part="correct-line"
|
|
12772
12875
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -12777,7 +12880,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12777
12880
|
stroke-width="3"
|
|
12778
12881
|
stroke-dasharray="5,5"
|
|
12779
12882
|
/>
|
|
12780
|
-
`)}};var
|
|
12883
|
+
`)}};var Tc=class extends ne(Ci){};var Ic=class extends Z(Ge){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,i=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements){let n=i.indexOf(r.identifier);r.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,i=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements)r.candidateCorrection=null,t&&r.order!=null&&(r.candidateCorrection=i[r.order-1]===r.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var _c=class extends Ti(rn){};var Rc=class extends Ti(on){};var Oc=class extends Z(nt){static get styles(){return[nt.styles,lt,q`
|
|
12781
12884
|
/*
|
|
12782
12885
|
* Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
|
|
12783
12886
|
* badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
|
|
@@ -12796,20 +12899,20 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12796
12899
|
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return v`
|
|
12797
12900
|
${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
|
|
12798
12901
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
12799
|
-
`}};var
|
|
12902
|
+
`}};var Pc=class extends ne(ie){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=$a(this.correctResponse);this.#t=t?new Set(e.map(i=>`${i.source} ${i.target}`)):new Set;for(let i of this.targetChoices){let r=i.getAttribute("identifier"),n=i.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${r}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function Eg(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 n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let i=0;for(let n=1;n<o.length;n++)t[n]>t[i]&&(i=n);let r=new Set;for(let n=i;n!==-1;n=e[n])r.add(n);return r}function _u(o,t){let e=new Map(t.map((a,l)=>[a,l])),i=o.filter(a=>e.has(a)),r=i.map(a=>e.get(a)),n=Eg(r),s=new Set;return n.forEach(a=>s.add(i[a])),s}var Mc=class extends ne(Xe){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let i=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of i)c.candidateCorrection=null;if(!t)return;let r=this.correctResponse,s=(r?Array.isArray(r)?r:[r]:[]).map((c,d)=>{let[h,f]=c.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=i.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=_u(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var Dc=class extends Z(Y){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,i=e?.correctResponse??this.correctResponse;this.correctResponse=t?i:e?.cardinality==="single"?"":[];let r=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${r}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=r,n.className="pci-correct-response-container",Object.assign(n.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"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var Nc=class extends Z(bt){#t=[];#e=[];static{this.styles=[bt.styles,q`
|
|
12800
12903
|
[part~='correct'] {
|
|
12801
12904
|
--qti-select-point-marker-color: var(--qti-correct);
|
|
12802
12905
|
}
|
|
12803
12906
|
[part~='incorrect'] {
|
|
12804
12907
|
--qti-select-point-marker-color: var(--qti-incorrect);
|
|
12805
12908
|
}
|
|
12806
|
-
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let
|
|
12807
|
-
style=${
|
|
12909
|
+
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let i=this._effectiveAreaEntries,r=this.responseVariable?.baseType,n=this.correctResponse;for(let s of this.responsePoints){let a=i.some(l=>K.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,r));!i.length&&n&&(a=(Array.isArray(n)?n:[n]).some(c=>{let[d,h]=c.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let r=this.#t;this.#t=[],this.requestUpdate("correctAreas",r);return}let e=this._effectiveAreaEntries;if(!e.length){let r=this.correctResponse,n=r?Array.isArray(r)?r:[r]:[];if(n.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=n.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let i=this.#t;this.#t=e.map(r=>({shape:r.shape,coords:r.coords})),this.requestUpdate("correctAreas",i)}pointPart(t,e){let i=this.#e[e];return i===void 0?"point":`point ${i?"correct":"incorrect"}`}renderSupplementalLayer(){return G(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>v`<div
|
|
12910
|
+
style=${Ms({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
|
|
12808
12911
|
data-correction-area
|
|
12809
12912
|
data-coord=${t.coords}
|
|
12810
12913
|
data-shape=${t.shape}
|
|
12811
12914
|
alt=${`correct-response-${e+1}`}
|
|
12812
|
-
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var
|
|
12915
|
+
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var $c=class extends Z(At){#t=null;static{this.styles=[At.styles,q`
|
|
12813
12916
|
[part='knob-correct'] {
|
|
12814
12917
|
background-color: var(--qti-correct-light);
|
|
12815
12918
|
border: 2px solid var(--qti-correct);
|
|
@@ -12822,9 +12925,9 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12822
12925
|
border-radius: 9999px;
|
|
12823
12926
|
left: var(--value-percentage-correct);
|
|
12824
12927
|
}
|
|
12825
|
-
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,
|
|
12928
|
+
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=Array.isArray(e)?e[0]:e,r=t&&i?parseFloat(i):NaN,n=this.#t;if(this.#t=Number.isFinite(r)?r: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",n)}renderRailSupplement(){return this.#t===null?P:v`<div id="knob-correct" part="knob-correct">
|
|
12826
12929
|
<div id="value" part="value">${this.#t}</div>
|
|
12827
|
-
</div>`}};var
|
|
12930
|
+
</div>`}};var Lc=class extends Z(ht){static{this.styles=[ht.styles,lt,q`
|
|
12828
12931
|
/*
|
|
12829
12932
|
* The trailing inset only — size and leading gap come from the shared sheet.
|
|
12830
12933
|
*
|
|
@@ -12853,11 +12956,11 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
12853
12956
|
background-color: var(--qti-bg);
|
|
12854
12957
|
white-space: nowrap;
|
|
12855
12958
|
}
|
|
12856
|
-
`]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return tt.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((
|
|
12959
|
+
`]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return tt.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((i,r)=>Math.max(r.mappedValue,i),0);for(let i of t.mapping.mapEntries){let r=i.mapKey,n=t.value;if(i.caseSensitive||(r=r.toLowerCase(),n=n.toLowerCase()),r===n)return i.mappedValue===e?tt.Correct:i.mappedValue<=(t.mapping.defaultValue||0)?tt.Incorrect:tt.PartiallyCorrect}}return t.correctResponse===t.value?tt.Correct:tt.Incorrect}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}render(){return v`
|
|
12857
12960
|
${this.renderAnswer()} ${this.renderInput()}
|
|
12858
12961
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
12859
12962
|
${this.renderValidationMessage()}
|
|
12860
|
-
`}};export{Z as CandidateCorrectionMixin,
|
|
12963
|
+
`}};export{Z as CandidateCorrectionMixin,Ti as ChoiceCorrectionMixin,bc as CorrectResponseMixin,tt as Correctness,cl as CustomStateSetShim,dl as INITIAL_SESSION_CONTEXT,hl as INITIAL_TEST_CONTEXT,D as Interaction,ml as IsNullOrUndefined,$t as ItemContainer,$r as ItemCorrectResponseMode,ur as ItemPrintVariables,Ye as ItemShowCandidateCorrection,Je as ItemShowCorrectResponse,Lh as ItemViewMixin,Pd as PUBLIC_ITEM_EVENTS,Oo as QTI_TEST_STATE_VERSION,Vs as QtiAnd,ln as QtiAnyN,mt as QtiAssessmentItem,Cu as QtiAssessmentItemCorrection,qt as QtiAssessmentItemRef,kt as QtiAssessmentSection,uo as QtiAssessmentStimulus,Hi as QtiAssessmentStimulusRef,Il as QtiAssessmentStimulusRefConnectedEvent,oi as QtiAssessmentTest,Ki as QtiAssociableHotspot,qi as QtiAssociateInteraction,Cc as QtiAssociateInteractionCorrection,Cr as QtiBaseValue,de as QtiBranchRule,ki as QtiChoiceInteraction,Sc as QtiChoiceInteractionCorrection,vo as QtiCompanionMaterialsInfo,Xt as QtiConditionExpression,js as QtiContainerSize,Fs as QtiContains,Xn as QtiContentBody,Wi as QtiContextDeclaration,Bs as QtiCorrect,ye as QtiCustomInteraction,Yn as QtiCustomOperator,Ei as QtiDefault,Us as QtiDelete,Hs as QtiDivide,Ws as QtiDurationGte,Qs as QtiDurationLt,we as QtiEndAttemptInteraction,cn as QtiEqual,Sr as QtiEqualRounded,Gs as QtiExitResponse,Di as QtiExitResponseSignal,Xs as QtiExitTest,Ni as QtiExitTestSignal,E as QtiExpression,X as QtiExtendedTextInteraction,Na as QtiExtendedTextInteractionCorrection,ut as QtiFeedback,yo as QtiFeedbackBlock,wo as QtiFeedbackInline,Ys as QtiFieldValue,gi as QtiGap,mr as QtiGapImg,nn as QtiGapMatchInteraction,Ec as QtiGapMatchInteractionCorrection,je as QtiGapText,vc as QtiGapTextCorrection,Js as QtiGcd,Bt as QtiGraphicAssociateInteraction,Ac as QtiGraphicAssociateInteractionCorrection,Ci as QtiGraphicGapMatchInteraction,Tc as QtiGraphicGapMatchInteractionCorrection,Ge as QtiGraphicOrderInteraction,Ic as QtiGraphicOrderInteractionCorrection,Ks as QtiGt,Zs as QtiGte,vi as QtiHotspotChoice,Da as QtiHotspotChoiceCorrection,rn as QtiHotspotInteraction,_c as QtiHotspotInteractionCorrection,yi as QtiHottext,yc as QtiHottextCorrection,on as QtiHottextInteraction,Rc as QtiHottextInteractionCorrection,Er as QtiIndex,fr as QtiInlineChoice,nt as QtiInlineChoiceInteraction,Oc as QtiInlineChoiceInteractionCorrection,dn as QtiInside,ta as QtiIntegerDivide,ea as QtiIntegerModulus,ia as QtiIntegerToFloat,na as QtiIsNull,be as QtiItem,xo as QtiItemBody,Su as QtiItemCorrection,Pt as QtiItemSessionControl,ra as QtiLcm,hn as QtiLookupOutcomeValue,oa as QtiLt,sa as QtiLte,Tr as QtiMapResponse,Ar as QtiMapResponsePoint,aa as QtiMatch,ie as QtiMatchInteraction,Pc as QtiMatchInteractionCorrection,Ir as QtiMathConstant,_r as QtiMathOperator,la as QtiMax,Ss as QtiMediaInteraction,ca as QtiMember,da as QtiMin,Qi as QtiModalFeedback,ha as QtiMultiple,pa as QtiNot,ua as QtiNull,Wn as QtiNumberPresented,co as QtiNumberSelected,ma as QtiOr,Xe as QtiOrderInteraction,Mc as QtiOrderInteractionCorrection,fa as QtiOrdered,ba as QtiOutcomeCondition,pe as QtiOutcomeDeclaration,ya as QtiOutcomeElse,va as QtiOutcomeElseIf,fn as QtiOutcomeIf,po as QtiOutcomeProcessing,Cl as QtiOutcomeProcessingProcessor,Rr as QtiPatternMatch,Y as QtiPortableCustomInteraction,Dc as QtiPortableCustomInteractionCorrection,Rs as QtiPositionObjectInteraction,Os as QtiPositionObjectStage,wa as QtiPower,ho as QtiPreCondition,vt as QtiPrintedVariable,xa as QtiProduct,Ko as QtiPrompt,qa as QtiRandom,Ai as QtiRandomInteger,Pr as QtiRepeat,ka as QtiResponseCondition,Re as QtiResponseDeclaration,Sa as QtiResponseElse,Ca as QtiResponseElseIf,gn as QtiResponseIf,ko as QtiResponseProcessing,Ea as QtiResponseProcessingFragment,Aa as QtiRound,bn as QtiRoundTo,ue as QtiRubricBlock,Id as QtiRuleElement,bt as QtiSelectPointInteraction,Nc as QtiSelectPointInteractionCorrection,Ta as QtiSetCorrectResponse,uc as QtiSetCorrectResponseRule,Ia as QtiSetOutcomeValue,mc as QtiSetOutcomeValueRule,_a as QtiSetTemplateValue,fc as QtiSetTemplateValueRule,Lt as QtiSimpleAssociableChoice,wc as QtiSimpleAssociableChoiceCorrection,zt as QtiSimpleChoice,xc as QtiSimpleChoiceCorrection,At as QtiSliderInteraction,$c as QtiSliderInteractionCorrection,Mr as QtiStatsOperator,Dr as QtiStringMatch,Eo as QtiStylesheet,Nr as QtiSubstring,Ra as QtiSubtract,Oa as QtiSum,gc as QtiSumExpression,Ao as QtiTemplateConstraint,me as QtiTemplateDeclaration,To as QtiTemplateProcessing,Ne as QtiTest,Au as QtiTestCorrection,er as QtiTestFeedback,De as QtiTestPart,ir as QtiTestVariables,Rl as QtiTestVariablesExpression,ht as QtiTextEntryInteraction,Lc as QtiTextEntryInteractionCorrection,Pa as QtiTruncate,Ls as QtiUploadInteraction,Ma as QtiVariable,Mi as QtiVariableDeclaration,K as ScoringHelper,Le as TestBookmark,hi as TestCheckItem,Tu as TestCheckItemCorrection,Ct as TestContainer,ge as TestEndAttempt,or as TestItemLink,mi as TestItemToSpeech,ft as TestNavigation,Eu as TestNavigationCorrection,ci as TestNext,di as TestPrev,ar as TestPrintContext,cr as TestPrintState,lr as TestPrintVariables,pi as TestScoringButtons,Yi as TestScoringFeedback,sr as TestSectionLink,Ke as TestShowCorrectResponse,ui as TestStamp,jo as TestSubmit,Yo as TestTtsNext,Wo as TestTtsPause,Jo as TestTtsPick,pr as TestTtsPlay,Xo as TestTtsPrev,Qo as TestTtsResume,Go as TestTtsStop,Kt as TestView,hr as TestViewToggle,ny as asSeed,Ul as bookmarkedItems,O as boxSizing,um as classifyCustomStateSupport,F as computedContext,Ee as computedItemContext,yt as configContext,Rt as convertNumberToUniversalFormat,lt as correctionPart,Oy as decimalSeparator,yl as dispatchDeclared,xt as dispatchPublic,Gt as dropRegion,_d as getCustomOperator,Q2 as getItemByUri,W2 as getManifestInfo,ao as inferRecordFieldBaseType,tg as inlineScriptText,eg as inlineStyleText,Sd as installCustomStateSetFallback,Oi as interactionContext,Ot as isRecordValue,fm as isSeed,j as itemContext,Ed as itemContextVariables,jy as iterResponseValues,wl as listenDeclared,Md as listenPublic,Fy as parsePair,Uy as parsePoint,fl as parseResponseAttribute,Nh as pluginElements,Rh as pluginState,og as qtiAndMixin,wt as qtiContext,mu as qtiInteractionElements,qg as qtiSubtractMixin,Jt as qtiTransformItem,Jd as qtiTransformManifest,Ui as qtiTransformTest,Hn as readRecordFieldValues,Yy as registerCustomOperator,so as removeDoubleSlashes,Yt as responseAttributeConverter,By as serializePair,Hy as serializePoint,gl as serializeResponseAttribute,Ae as sessionContext,ot as testContext,Dh as ttsElements,Jy as unregisterCustomOperator,W as validationMessage};
|
|
12861
12964
|
/*! Bundled license information:
|
|
12862
12965
|
|
|
12863
12966
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|