@citolab/qti-components 7.5.1 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +101 -101
- package/custom-elements.json +327 -150
- package/dist/chunks/{chunk-K47QFOQX.js → chunk-2WTHXWS3.js} +38 -1
- package/dist/chunks/chunk-2WTHXWS3.js.map +1 -0
- package/dist/chunks/{chunk-UVKOJQ52.js → chunk-FQWMCONA.js} +4 -4
- package/dist/chunks/{chunk-7RW7LCEJ.js → chunk-G7ZPPP7O.js} +6 -37
- package/dist/chunks/chunk-G7ZPPP7O.js.map +1 -0
- package/dist/chunks/{chunk-4BDOB6KY.js → chunk-GG4NR5OR.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/qti-components/index.js +2 -2
- package/dist/qti-item/index.js +1 -1
- package/dist/qti-test/index.js +2 -2
- package/package.json +12 -21
- package/dist/chunks/chunk-7RW7LCEJ.js.map +0 -1
- package/dist/chunks/chunk-K47QFOQX.js.map +0 -1
- package/dist/custom-elements.json +0 -29837
- /package/dist/chunks/{chunk-UVKOJQ52.js.map → chunk-FQWMCONA.js.map} +0 -0
- /package/dist/chunks/{chunk-4BDOB6KY.js.map → chunk-GG4NR5OR.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var tn=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var l=(o,r,e,t)=>{for(var i=t>1?void 0:t?rn(r,e):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(t?n(r,e,i):n(i))||i);return t&&i&&tn(r,e,i),i};var Se=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var st=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,n)),this.unsubscribe=n},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Se(this.context,this.host,this.t,this.subscribe))}};var Tr=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var bi=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},ot=class extends Tr{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Se(this.context,a,n,!0)));i.stopPropagation()},this.host=r,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new bi(this.context,this.host))}};function X({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new ot(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer(n=>{t.set(n,new ot(n,{context:o}))});let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let n=new WeakMap;s={get(){return n.get(this)},set(a){t.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;s={...i,set(a){t.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function _({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer(function(){new st(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})}):e.constructor.addInitializer(i=>{new st(i,{context:o,callback:s=>{i[t]=s},subscribe:r})})}}var As=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var ie=function(o,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!i:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,e):i?i.value=e:r.set(o,e),e},D=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},nt,kr,Rr,Mt,vi,It,Sr,je,Lt,Me,Mr,Ts,ks=o=>typeof o=="boolean"?o:o?.capture??!1;var yi=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=ks(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);if(s===void 0)s=new Map,i.set(r,s);else if(s.has(e))return;let n=typeof t=="object"&&t?t:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),s.set(e,n??{})}removeEventListener(r,e,t){if(e==null)return;let i=ks(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);s!==void 0&&(s.delete(e),s.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,s=!1,n=0,a=null,c=null,d=null,p=r.stopPropagation,m=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??c},...I},srcElement:{get(){return r.target},...I},currentTarget:{get(){return d},...I},eventPhase:{get(){return n},...I},composedPath:{value:()=>e,...I},stopPropagation:{value:()=>{i=!0,p.call(r)},...I},stopImmediatePropagation:{value:()=>{s=!0,m.call(r)},...I}});let f=(q,A,L)=>{typeof q=="function"?q(r):typeof q?.handleEvent=="function"&&q.handleEvent(r),A.once&&L.delete(q)},b=()=>(d=null,n=0,!r.defaultPrevented),y=e.slice().reverse();a=!this.__host||!r.composed?this:null;let w=q=>{for(c=this;c.__host&&q.includes(c.__host);)c=c.__host};for(let q of y){!a&&(!c||c===q.__host)&&w(y.slice(y.indexOf(q))),d=q,n=q===r.target?2:1;let A=q.__captureEventListeners.get(r.type);if(A){for(let[L,V]of A)if(f(L,V,A),s)return b()}if(i)return b()}let R=r.bubbles?e:[this];c=null;for(let q of R){!a&&(!c||q===c.__host)&&w(R.slice(0,R.indexOf(q)+1)),d=q,n=q===r.target?2:3;let A=q.__eventListeners.get(r.type);if(A){for(let[L,V]of A)if(f(L,V,A),s)return b()}if(i)return b()}return b()}},xi=yi;var I={__proto__:null};I.enumerable=!0;Object.freeze(I);var qi=(Me=class{constructor(r,e={}){if(nt.set(this,!1),kr.set(this,!1),Rr.set(this,!1),Mt.set(this,!1),vi.set(this,Date.now()),It.set(this,!1),Sr.set(this,void 0),je.set(this,void 0),Lt.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:s}=e;ie(this,nt,!!i,"f"),ie(this,kr,!!t,"f"),ie(this,Rr,!!s,"f"),ie(this,Sr,`${r}`,"f"),ie(this,je,null,"f"),ie(this,Lt,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){ie(this,Mt,!0,"f")}get target(){return D(this,je,"f")}get currentTarget(){return D(this,je,"f")}get srcElement(){return D(this,je,"f")}get type(){return D(this,Sr,"f")}get cancelable(){return D(this,nt,"f")}get defaultPrevented(){return D(this,nt,"f")&&D(this,Mt,"f")}get timeStamp(){return D(this,vi,"f")}composedPath(){return D(this,Lt,"f")?[D(this,je,"f")]:[]}get returnValue(){return!D(this,nt,"f")||!D(this,Mt,"f")}get bubbles(){return D(this,kr,"f")}get composed(){return D(this,Rr,"f")}get eventPhase(){return D(this,Lt,"f")?Me.AT_TARGET:Me.NONE}get cancelBubble(){return D(this,It,"f")}set cancelBubble(r){r&&ie(this,It,!0,"f")}stopPropagation(){ie(this,It,!0,"f")}get isTrusted(){return!1}},nt=new WeakMap,kr=new WeakMap,Rr=new WeakMap,Mt=new WeakMap,vi=new WeakMap,It=new WeakMap,Sr=new WeakMap,je=new WeakMap,Lt=new WeakMap,Me.NONE=0,Me.CAPTURING_PHASE=1,Me.AT_TARGET=2,Me.BUBBLING_PHASE=3,Me);Object.defineProperties(qi.prototype,{initEvent:I,stopImmediatePropagation:I,preventDefault:I,target:I,currentTarget:I,srcElement:I,type:I,cancelable:I,defaultPrevented:I,timeStamp:I,composedPath:I,returnValue:I,bubbles:I,composed:I,eventPhase:I,cancelBubble:I,stopPropagation:I,isTrusted:I});var Rs=(Ts=class extends qi{constructor(r,e={}){super(r,e),Mr.set(this,void 0),ie(this,Mr,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return D(this,Mr,"f")}},Mr=new WeakMap,Ts);Object.defineProperties(Rs.prototype,{detail:I});var Ei=qi,Ci=Rs;globalThis.Event??=Ei;globalThis.CustomEvent??=Ci;var Ss=new WeakMap,$t=o=>{let r=Ss.get(o);return r===void 0&&Ss.set(o,r=new Map),r},sn=class extends xi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($t(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){$t(this).set(r,String(e))}removeAttribute(r){$t(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return $t(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let r=new As(this);return this.__internals=r,r}getAttribute(r){return $t(this).get(r)??null}};var on=class extends sn{},_i=on;globalThis.litServerRoot??=Object.defineProperty(new _i,"localName",{get(){return"lit-server-root"}});function nn(){let o,r;return{promise:new Promise((t,i)=>{o=t,r=i}),resolve:o,reject:r}}var wi=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
-
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=nn(),this.__pendingWhenDefineds.set(r,t)),t.promise}},an=
|
|
3
|
-
\f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Hs=/'/g,zs=/"/g,js=/^(?:script|style|textarea|title)$/i,Ii=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Ii(1),zr=Ii(2),Ua=Ii(3),P=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Fs=new WeakMap,We=Xe.createTreeWalker(Xe,129);function Bs(o,r){if(!Mi(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vs!==void 0?Vs.createHTML(r):r}var Ws=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=Ht;for(let a=0;a<e;a++){let c=o[a],d,p,m=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===Ht?p[1]==="!--"?n=Ns:p[1]!==void 0?n=Ds:p[2]!==void 0?(js.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=Be):p[3]!==void 0&&(n=Be):n===Be?p[0]===">"?(n=i??Ht,m=-1):p[1]===void 0?m=-2:(m=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?Be:p[3]==='"'?zs:Hs):n===zs||n===Hs?n=Be:n===Ns||n===Ds?n=Ht:(n=Be,i=void 0);let b=n===Be&&o[a+1].startsWith("/>")?" ":"";s+=n===Ht?c+gn:m>=0?(t.push(d),c.slice(0,m)+Ri+c.slice(m)+be+b):c+be+(m===-2?a:b)}return[Bs(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ut=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,c=this.parts,[d,p]=Ws(r,e);if(this.el=o.createElement(d,t),We.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=We.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Ri)){let f=p[n++],b=i.getAttribute(m).split(be),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:y[2],strings:b,ctor:y[1]==="."?Pr:y[1]==="?"?Vr:y[1]==="@"?Nr:Ye}),i.removeAttribute(m)}else m.startsWith(be)&&(c.push({type:6,index:s}),i.removeAttribute(m));if(js.test(i.tagName)){let m=i.textContent.split(be),f=m.length-1;if(f>0){i.textContent=$r?$r.emptyScript:"";for(let b=0;b<f;b++)i.append(m[b],zt()),We.nextNode(),c.push({type:2,index:++s});i.append(m[f],zt())}}}else if(i.nodeType===8)if(i.data===Si)c.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(be,m+1))!==-1;)c.push({type:7,index:s}),m+=be.length-1}s++}}static createElement(r,e){let t=Xe.createElement("template");return t.innerHTML=r,t}};function Ge(o,r,e=o,t){if(r===P)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=Ft(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ge(o,i._$AS(o,r.values),i,t)),r}var Or=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Xe).importNode(e,!0);We.currentNode=i;let s=We.nextNode(),n=0,a=0,c=t[0];for(;c!==void 0;){if(n===c.index){let d;c.type===2?d=new at(s,s.nextSibling,this,r):c.type===1?d=new c.ctor(s,c.name,c.strings,this,r):c.type===6&&(d=new Dr(s,this,r)),this._$AV.push(d),c=t[++a]}n!==c?.index&&(s=We.nextNode(),n++)}return We.currentNode=Xe,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},at=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ge(this,r,e),Ft(r)?r===S||r==null||r===""?(this._$AH!==S&&this._$AR(),this._$AH=S):r!==this._$AH&&r!==P&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):Us(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==S&&Ft(this._$AH)?this._$AA.nextSibling.data=r:this.T(Xe.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ut.createElement(Bs(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Or(i,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(r){let e=Fs.get(r.strings);return e===void 0&&Fs.set(r.strings,e=new Ut(r)),e}k(r){Mi(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new o(this.O(zt()),this.O(zt()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=S,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=S}_$AI(r,e=this,t,i){let s=this.strings,n=!1;if(s===void 0)r=Ge(this,r,e,0),n=!Ft(r)||r!==this._$AH&&r!==P,n&&(this._$AH=r);else{let a=r,c,d;for(r=s[0],c=0;c<s.length-1;c++)d=Ge(this,a[t+c],e,c),d===P&&(d=this._$AH[c]),n||=!Ft(d)||d!==this._$AH[c],d===S?r=S:r!==S&&(r+=(d??"")+s[c+1]),this._$AH[c]=d}n&&!i&&this.j(r)}j(r){r===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Pr=class extends Ye{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===S?void 0:r}},Vr=class extends Ye{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==S)}},Nr=class extends Ye{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=Ge(this,r,e,0)??S)===P)return;let t=this._$AH,i=r===S&&t!==S||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==S&&(t===S||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},Dr=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ge(this,r)}},H={M:Ri,P:be,A:Si,C:1,L:Ws,R:Or,D:Us,V:Ge,I:at,H:Ye,N:Vr,U:Nr,B:Pr,F:Dr},bn=Hr.litHtmlPolyfillSupport;bn?.(Ut,at),(Hr.litHtmlVersions??=[]).push("3.3.1");var Li=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new at(r.insertBefore(zt(),s),s,void 0,e??{})}return i._$AI(o),i};var $i=globalThis,v=class extends ge{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Li(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}};v._$litElement$=!0,v.finalized=!0,$i.litElementHydrateSupport?.({LitElement:v});var vn=$i.litElementPolyfillSupport;vn?.({LitElement:v});($i.litElementVersions??=[]).push("4.2.1");var g=o=>(r,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,r)}):customElements.define(o,r)};var yn={attribute:!0,type:String,converter:Nt,reflect:!1,hasChanged:Lr},xn=(o=yn,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(e.name,o),t==="accessor"){let{name:n}=e;return{set(a){let c=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,c,o)},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let c=this[n];r.call(this,a),this.requestUpdate(n,c,o)}}throw Error("Unsupported decorator location: "+t)};function u(o){return(r,e)=>typeof e=="object"?xn(o,r,e):((t,i,s)=>{let n=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),n?Object.getOwnPropertyDescriptor(i,s):void 0})(o,r,e)}function E(o){return u({...o,state:!0,attribute:!1})}var Ie=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function lt(o,r){return(e,t,i)=>{let s=n=>n.renderRoot?.querySelector(o)??null;if(r){let{get:n,set:a}=typeof t=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(d){this[c]=d}}})();return Ie(e,t,{get(){let c=n.call(this);return c===void 0&&(c=s(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return Ie(e,t,{get(){return s(this)}})}}function Xs(o){return(r,e)=>{let{slot:t,selector:i}=o??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Ie(r,e,{get(){let n=this.renderRoot?.querySelector(s),a=n?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}function Fr(o,r){let e;return(t,i)=>{let{connectedCallback:s,disconnectedCallback:n}=t;t.connectedCallback=function(){s.call(this);let a=d=>{let p=Array.from(this.querySelectorAll(o)).concat(Array.from(this.shadowRoot?.querySelectorAll(o)||[]));for(let m of d){let f=Array.from(m.addedNodes).map(y=>y),b=Array.from(m.addedNodes).map(y=>y);m.type==="childList"&&f.find(y=>p.includes(y))&&this[i](f,b)}};e=new MutationObserver(a),e.observe(this,{childList:!0,subtree:!0});let c=Array.from(this.querySelectorAll(o)).concat(Array.from(this.shadowRoot?.querySelectorAll(o)||[]));this[i](Array.from(c),[])},t.disconnectedCallback=function(){n.call(this),e.disconnect()}}}function M(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(c=>{let d=c;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,m)}}),s.call(this,a)}}}var $=Symbol("item");var Gs=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var G=class extends v{constructor(){super(...arguments);this._templateProcessing=null;this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={variables:Gs};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}get title(){return this._itemTitle}set title(e){this._itemTitle=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this._processTemplates(),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this}))})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._interactionElements)t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of this._interactionElements)t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}_processTemplates(){this._templateProcessing=this.querySelector("qti-template-processing"),this._templateProcessing&&this._templateProcessing.process()}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing");return!i||!i.process?!1:(i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=this._interactionElements.every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};l([u({type:String})],G.prototype,"identifier",2),l([u({type:String})],G.prototype,"adaptive",2),l([u({type:String})],G.prototype,"timeDependent",2),l([u({type:String})],G.prototype,"title",1),l([u({type:Boolean})],G.prototype,"disabled",2),l([M("disabled",{waitUntilFirstUpdate:!0})],G.prototype,"_handleDisabledChange",2),l([u({type:Boolean})],G.prototype,"readonly",2),l([M("readonly",{waitUntilFirstUpdate:!0})],G.prototype,"_handleReadonlyChange",2),l([X({context:$})],G.prototype,"_context",2),G=l([g("qti-assessment-item")],G);var qn=String.raw,En=qn`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
1
|
+
var tn=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var l=(o,r,e,t)=>{for(var i=t>1?void 0:t?rn(r,e):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(t?n(r,e,i):n(i))||i);return t&&i&&tn(r,e,i),i};var Se=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var st=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,n)),this.unsubscribe=n},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Se(this.context,this.host,this.t,this.subscribe))}};var kr=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var vi=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},ot=class extends kr{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Se(this.context,a,n,!0)));i.stopPropagation()},this.host=r,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new vi(this.context,this.host))}};function X({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new ot(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer(n=>{t.set(n,new ot(n,{context:o}))});let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let n=new WeakMap;s={get(){return n.get(this)},set(a){t.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;s={...i,set(a){t.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function _({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer(function(){new st(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})}):e.constructor.addInitializer(i=>{new st(i,{context:o,callback:s=>{i[t]=s},subscribe:r})})}}var As=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var ie=function(o,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!i:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,e):i?i.value=e:r.set(o,e),e},D=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},nt,Sr,Mr,Mt,yi,It,Ir,Be,Lt,Me,Lr,Rs,ks=o=>typeof o=="boolean"?o:o?.capture??!1;var xi=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=ks(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);if(s===void 0)s=new Map,i.set(r,s);else if(s.has(e))return;let n=typeof t=="object"&&t?t:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),s.set(e,n??{})}removeEventListener(r,e,t){if(e==null)return;let i=ks(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);s!==void 0&&(s.delete(e),s.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,s=!1,n=0,a=null,c=null,d=null,p=r.stopPropagation,m=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??c},...I},srcElement:{get(){return r.target},...I},currentTarget:{get(){return d},...I},eventPhase:{get(){return n},...I},composedPath:{value:()=>e,...I},stopPropagation:{value:()=>{i=!0,p.call(r)},...I},stopImmediatePropagation:{value:()=>{s=!0,m.call(r)},...I}});let f=(q,T,L)=>{typeof q=="function"?q(r):typeof q?.handleEvent=="function"&&q.handleEvent(r),T.once&&L.delete(q)},b=()=>(d=null,n=0,!r.defaultPrevented),y=e.slice().reverse();a=!this.__host||!r.composed?this:null;let w=q=>{for(c=this;c.__host&&q.includes(c.__host);)c=c.__host};for(let q of y){!a&&(!c||c===q.__host)&&w(y.slice(y.indexOf(q))),d=q,n=q===r.target?2:1;let T=q.__captureEventListeners.get(r.type);if(T){for(let[L,N]of T)if(f(L,N,T),s)return b()}if(i)return b()}let k=r.bubbles?e:[this];c=null;for(let q of k){!a&&(!c||q===c.__host)&&w(k.slice(0,k.indexOf(q)+1)),d=q,n=q===r.target?2:3;let T=q.__eventListeners.get(r.type);if(T){for(let[L,N]of T)if(f(L,N,T),s)return b()}if(i)return b()}return b()}},qi=xi;var I={__proto__:null};I.enumerable=!0;Object.freeze(I);var Ei=(Me=class{constructor(r,e={}){if(nt.set(this,!1),Sr.set(this,!1),Mr.set(this,!1),Mt.set(this,!1),yi.set(this,Date.now()),It.set(this,!1),Ir.set(this,void 0),Be.set(this,void 0),Lt.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:s}=e;ie(this,nt,!!i,"f"),ie(this,Sr,!!t,"f"),ie(this,Mr,!!s,"f"),ie(this,Ir,`${r}`,"f"),ie(this,Be,null,"f"),ie(this,Lt,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){ie(this,Mt,!0,"f")}get target(){return D(this,Be,"f")}get currentTarget(){return D(this,Be,"f")}get srcElement(){return D(this,Be,"f")}get type(){return D(this,Ir,"f")}get cancelable(){return D(this,nt,"f")}get defaultPrevented(){return D(this,nt,"f")&&D(this,Mt,"f")}get timeStamp(){return D(this,yi,"f")}composedPath(){return D(this,Lt,"f")?[D(this,Be,"f")]:[]}get returnValue(){return!D(this,nt,"f")||!D(this,Mt,"f")}get bubbles(){return D(this,Sr,"f")}get composed(){return D(this,Mr,"f")}get eventPhase(){return D(this,Lt,"f")?Me.AT_TARGET:Me.NONE}get cancelBubble(){return D(this,It,"f")}set cancelBubble(r){r&&ie(this,It,!0,"f")}stopPropagation(){ie(this,It,!0,"f")}get isTrusted(){return!1}},nt=new WeakMap,Sr=new WeakMap,Mr=new WeakMap,Mt=new WeakMap,yi=new WeakMap,It=new WeakMap,Ir=new WeakMap,Be=new WeakMap,Lt=new WeakMap,Me.NONE=0,Me.CAPTURING_PHASE=1,Me.AT_TARGET=2,Me.BUBBLING_PHASE=3,Me);Object.defineProperties(Ei.prototype,{initEvent:I,stopImmediatePropagation:I,preventDefault:I,target:I,currentTarget:I,srcElement:I,type:I,cancelable:I,defaultPrevented:I,timeStamp:I,composedPath:I,returnValue:I,bubbles:I,composed:I,eventPhase:I,cancelBubble:I,stopPropagation:I,isTrusted:I});var Ss=(Rs=class extends Ei{constructor(r,e={}){super(r,e),Lr.set(this,void 0),ie(this,Lr,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return D(this,Lr,"f")}},Lr=new WeakMap,Rs);Object.defineProperties(Ss.prototype,{detail:I});var Ci=Ei,wi=Ss;globalThis.Event??=Ci;globalThis.CustomEvent??=wi;var Ms=new WeakMap,$t=o=>{let r=Ms.get(o);return r===void 0&&Ms.set(o,r=new Map),r},sn=class extends qi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($t(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){$t(this).set(r,String(e))}removeAttribute(r){$t(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return $t(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let r=new As(this);return this.__internals=r,r}getAttribute(r){return $t(this).get(r)??null}};var on=class extends sn{},Ti=on;globalThis.litServerRoot??=Object.defineProperty(new Ti,"localName",{get(){return"lit-server-root"}});function nn(){let o,r;return{promise:new Promise((t,i)=>{o=t,r=i}),resolve:o,reject:r}}var _i=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=nn(),this.__pendingWhenDefineds.set(r,t)),t.promise}},an=_i;var Is=new an;var Ot=globalThis,$r=Ot.ShadowRoot&&(Ot.ShadyCSS===void 0||Ot.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ai=Symbol(),Ls=new WeakMap,Pt=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ai)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if($r&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ls.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ls.set(e,r))}return r}toString(){return this.cssText}},$s=o=>new Pt(typeof o=="string"?o:o+"",void 0,Ai),x=(o,...r)=>{let e=o.length===1?o[0]:r.reduce((t,i,s)=>t+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new Pt(e,o,Ai)},Os=(o,r)=>{if($r)o.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=Ot.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Ri=$r||Ot.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return $s(e)})(o):o;var{is:ln,defineProperty:cn,getOwnPropertyDescriptor:dn,getOwnPropertyNames:pn,getOwnPropertySymbols:un,getPrototypeOf:mn}=Object,Dt=globalThis;Dt.customElements??=Is;var Ps=Dt.trustedTypes,hn=Ps?Ps.emptyScript:"",fn=Dt.reactiveElementPolyfillSupport,Nt=(o,r)=>o,Vt={toAttribute(o,r){switch(r){case Boolean:o=o?hn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,r){let e=o;switch(r){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}},Or=(o,r)=>!ln(o,r),Ns={attribute:!0,type:String,converter:Vt,reflect:!1,useDefault:!1,hasChanged:Or};Symbol.metadata??=Symbol("metadata"),Dt.litPropertyMetadata??=new WeakMap;var ge=class extends(globalThis.HTMLElement??Ti){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Ns){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&cn(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:s}=dn(this.prototype,r)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let a=i?.call(this);s?.call(this,n),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Ns}static _$Ei(){if(this.hasOwnProperty(Nt("elementProperties")))return;let r=mn(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Nt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nt("properties"))){let e=this.properties,t=[...pn(e),...un(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ri(i))}else r!==void 0&&e.push(Ri(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Os(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:Vt).toAttribute(e,t.type);this._$Em=r,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Vt;this._$Em=i;let a=n.fromAttribute(e,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t){if(r!==void 0){let i=this.constructor,s=this[r];if(t??=i.getPropertyOptions(r),!((t.hasChanged??Or)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(r)&&!this.hasAttribute(i._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:s},n){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,n??e??this[r]),s!==!0||n!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:n}=s,a=this[i];n!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(r){}firstUpdated(r){}};ge.elementStyles=[],ge.shadowRootOptions={mode:"open"},ge[Nt("elementProperties")]=new Map,ge[Nt("finalized")]=new Map,fn?.({ReactiveElement:ge}),(Dt.reactiveElementVersions??=[]).push("2.1.1");var Fr=globalThis,Pr=Fr.trustedTypes,Vs=Pr?Pr.createPolicy("lit-html",{createHTML:o=>o}):void 0,Si="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,Mi="?"+be,gn=`<${Mi}>`,Xe=Fr.document===void 0?{createTreeWalker:()=>({})}:document,zt=()=>Xe.createComment(""),Ft=o=>o===null||typeof o!="object"&&typeof o!="function",Ii=Array.isArray,Bs=o=>Ii(o)||typeof o?.[Symbol.iterator]=="function",ki=`[
|
|
3
|
+
\f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ds=/-->/g,Hs=/>/g,je=RegExp(`>|${ki}(?:([^\\s"'>=/]+)(${ki}*=${ki}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),zs=/'/g,Fs=/"/g,js=/^(?:script|style|textarea|title)$/i,Li=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Li(1),Ur=Li(2),Ua=Li(3),P=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Us=new WeakMap,We=Xe.createTreeWalker(Xe,129);function Ws(o,r){if(!Ii(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vs!==void 0?Vs.createHTML(r):r}var Xs=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=Ht;for(let a=0;a<e;a++){let c=o[a],d,p,m=-1,f=0;for(;f<c.length&&(n.lastIndex=f,p=n.exec(c),p!==null);)f=n.lastIndex,n===Ht?p[1]==="!--"?n=Ds:p[1]!==void 0?n=Hs:p[2]!==void 0?(js.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=je):p[3]!==void 0&&(n=je):n===je?p[0]===">"?(n=i??Ht,m=-1):p[1]===void 0?m=-2:(m=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?je:p[3]==='"'?Fs:zs):n===Fs||n===zs?n=je:n===Ds||n===Hs?n=Ht:(n=je,i=void 0);let b=n===je&&o[a+1].startsWith("/>")?" ":"";s+=n===Ht?c+gn:m>=0?(t.push(d),c.slice(0,m)+Si+c.slice(m)+be+b):c+be+(m===-2?a:b)}return[Ws(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ut=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,c=this.parts,[d,p]=Xs(r,e);if(this.el=o.createElement(d,t),We.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=We.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Si)){let f=p[n++],b=i.getAttribute(m).split(be),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:y[2],strings:b,ctor:y[1]==="."?Vr:y[1]==="?"?Dr:y[1]==="@"?Hr:Ye}),i.removeAttribute(m)}else m.startsWith(be)&&(c.push({type:6,index:s}),i.removeAttribute(m));if(js.test(i.tagName)){let m=i.textContent.split(be),f=m.length-1;if(f>0){i.textContent=Pr?Pr.emptyScript:"";for(let b=0;b<f;b++)i.append(m[b],zt()),We.nextNode(),c.push({type:2,index:++s});i.append(m[f],zt())}}}else if(i.nodeType===8)if(i.data===Mi)c.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(be,m+1))!==-1;)c.push({type:7,index:s}),m+=be.length-1}s++}}static createElement(r,e){let t=Xe.createElement("template");return t.innerHTML=r,t}};function Ge(o,r,e=o,t){if(r===P)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=Ft(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ge(o,i._$AS(o,r.values),i,t)),r}var Nr=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Xe).importNode(e,!0);We.currentNode=i;let s=We.nextNode(),n=0,a=0,c=t[0];for(;c!==void 0;){if(n===c.index){let d;c.type===2?d=new at(s,s.nextSibling,this,r):c.type===1?d=new c.ctor(s,c.name,c.strings,this,r):c.type===6&&(d=new zr(s,this,r)),this._$AV.push(d),c=t[++a]}n!==c?.index&&(s=We.nextNode(),n++)}return We.currentNode=Xe,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},at=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ge(this,r,e),Ft(r)?r===S||r==null||r===""?(this._$AH!==S&&this._$AR(),this._$AH=S):r!==this._$AH&&r!==P&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):Bs(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==S&&Ft(this._$AH)?this._$AA.nextSibling.data=r:this.T(Xe.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ut.createElement(Ws(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Nr(i,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(r){let e=Us.get(r.strings);return e===void 0&&Us.set(r.strings,e=new Ut(r)),e}k(r){Ii(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new o(this.O(zt()),this.O(zt()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=S,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=S}_$AI(r,e=this,t,i){let s=this.strings,n=!1;if(s===void 0)r=Ge(this,r,e,0),n=!Ft(r)||r!==this._$AH&&r!==P,n&&(this._$AH=r);else{let a=r,c,d;for(r=s[0],c=0;c<s.length-1;c++)d=Ge(this,a[t+c],e,c),d===P&&(d=this._$AH[c]),n||=!Ft(d)||d!==this._$AH[c],d===S?r=S:r!==S&&(r+=(d??"")+s[c+1]),this._$AH[c]=d}n&&!i&&this.j(r)}j(r){r===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Vr=class extends Ye{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===S?void 0:r}},Dr=class extends Ye{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==S)}},Hr=class extends Ye{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=Ge(this,r,e,0)??S)===P)return;let t=this._$AH,i=r===S&&t!==S||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==S&&(t===S||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},zr=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ge(this,r)}},H={M:Si,P:be,A:Mi,C:1,L:Xs,R:Nr,D:Bs,V:Ge,I:at,H:Ye,N:Dr,U:Hr,B:Vr,F:zr},bn=Fr.litHtmlPolyfillSupport;bn?.(Ut,at),(Fr.litHtmlVersions??=[]).push("3.3.1");var $i=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new at(r.insertBefore(zt(),s),s,void 0,e??{})}return i._$AI(o),i};var Oi=globalThis,v=class extends ge{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=$i(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}};v._$litElement$=!0,v.finalized=!0,Oi.litElementHydrateSupport?.({LitElement:v});var vn=Oi.litElementPolyfillSupport;vn?.({LitElement:v});(Oi.litElementVersions??=[]).push("4.2.1");var g=o=>(r,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(o,r)}):customElements.define(o,r)};var yn={attribute:!0,type:String,converter:Vt,reflect:!1,hasChanged:Or},xn=(o=yn,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(e.name,o),t==="accessor"){let{name:n}=e;return{set(a){let c=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,c,o)},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let c=this[n];r.call(this,a),this.requestUpdate(n,c,o)}}throw Error("Unsupported decorator location: "+t)};function u(o){return(r,e)=>typeof e=="object"?xn(o,r,e):((t,i,s)=>{let n=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),n?Object.getOwnPropertyDescriptor(i,s):void 0})(o,r,e)}function E(o){return u({...o,state:!0,attribute:!1})}var Ie=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function lt(o,r){return(e,t,i)=>{let s=n=>n.renderRoot?.querySelector(o)??null;if(r){let{get:n,set:a}=typeof t=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(d){this[c]=d}}})();return Ie(e,t,{get(){let c=n.call(this);return c===void 0&&(c=s(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return Ie(e,t,{get(){return s(this)}})}}function Gs(o){return(r,e)=>{let{slot:t,selector:i}=o??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Ie(r,e,{get(){let n=this.renderRoot?.querySelector(s),a=n?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}function Br(o,r){let e;return(t,i)=>{let{connectedCallback:s,disconnectedCallback:n}=t;t.connectedCallback=function(){s.call(this);let a=d=>{let p=Array.from(this.querySelectorAll(o)).concat(Array.from(this.shadowRoot?.querySelectorAll(o)||[]));for(let m of d){let f=Array.from(m.addedNodes).map(y=>y),b=Array.from(m.addedNodes).map(y=>y);m.type==="childList"&&f.find(y=>p.includes(y))&&this[i](f,b)}};e=new MutationObserver(a),e.observe(this,{childList:!0,subtree:!0});let c=Array.from(this.querySelectorAll(o)).concat(Array.from(this.shadowRoot?.querySelectorAll(o)||[]));this[i](Array.from(c),[])},t.disconnectedCallback=function(){n.call(this),e.disconnect()}}}function M(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(c=>{let d=c;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,m)}}),s.call(this,a)}}}var $=Symbol("item");var Ys=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var G=class extends v{constructor(){super(...arguments);this._templateProcessing=null;this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={variables:Ys};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}get title(){return this._itemTitle}set title(e){this._itemTitle=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this._processTemplates(),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this}))})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._interactionElements)t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of this._interactionElements)t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}_processTemplates(){this._templateProcessing=this.querySelector("qti-template-processing"),this._templateProcessing&&this._templateProcessing.process()}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing");return!i||!i.process?!1:(i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=this._interactionElements.every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};l([u({type:String})],G.prototype,"identifier",2),l([u({type:String})],G.prototype,"adaptive",2),l([u({type:String})],G.prototype,"timeDependent",2),l([u({type:String})],G.prototype,"title",1),l([u({type:Boolean})],G.prototype,"disabled",2),l([M("disabled",{waitUntilFirstUpdate:!0})],G.prototype,"_handleDisabledChange",2),l([u({type:Boolean})],G.prototype,"readonly",2),l([M("readonly",{waitUntilFirstUpdate:!0})],G.prototype,"_handleReadonlyChange",2),l([X({context:$})],G.prototype,"_context",2),G=l([g("qti-assessment-item")],G);var qn=String.raw,En=qn`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
5
5
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
6
6
|
<xsl:template match="@*|node()">
|
|
7
7
|
<xsl:copy>
|
|
@@ -23,7 +23,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
23
23
|
<xsl:apply-templates/>
|
|
24
24
|
</xsl:element>
|
|
25
25
|
</xsl:template>
|
|
26
|
-
</xsl:stylesheet>`;function Ys(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=Ks(t,i);t.replaceWith(s)})}function Js(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=Ks(e,n);e.replaceWith(a)}})})}function Ks(o,r){let e=document.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Zs(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function Ur(o){let r=new XMLHttpRequest;return{promise:new Promise((t,i)=>{r.open("GET",o,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?t(r.responseXML):i(r.statusText)},r.onerror=()=>{i(r.statusText)},r.send()}),xhr:r}}function jr(o){return new DOMParser().parseFromString(o,"text/xml")}function ct(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(En,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function dt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function Qs(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function eo(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function to(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:}}var Je=(o=!1)=>{let r,e="",t={load(i){e=i;let s=encodeURI(i);if(o&&sessionStorage.getItem(s))return{promise:Promise.resolve(t.parse(sessionStorage.getItem(s))),request:null};let{promise:n,xhr:a}=Ur(i);return{promise:new Promise(d=>{n.then(p=>(r=p,t.shuffleInteractions(),o&&sessionStorage.setItem(s,new XMLSerializer().serializeToString(r)),d(t)))}),request:a}},parse(i){return r=jr(i),t},path:i=>(dt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],c=r.querySelectorAll(n),d=await s(i,"/modules/module_resolution.js"),p=await s(i,"/modules/fallback_module_resolution.js");if(c.length>0)for(let m of Array.from(c)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let w=await s(i,`/${y}`),R=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of R){let A=q.getAttribute("id");if(A&&w.paths&&w.paths[A]){let L=w.paths[A],V=Array.isArray(L)?L[0]:L;if(q.setAttribute("primary-path",V),p&&p.paths&&p.paths[A]){let N=p.paths[A];Array.isArray(N)?q.setAttribute("fallback-path",N[0]):q.setAttribute("fallback-path",N)}}}if(w.paths){for(let q in w.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let L=r.createElement("qti-interaction-module");L.setAttribute("id",q);let V=Array.isArray(w.paths[q])?w.paths[q][0]:w.paths[q];if(L.setAttribute("primary-path",V),p&&p.paths&&p.paths[q]){let N=p.paths[q];Array.isArray(N)?L.setAttribute("fallback-path",N[0]):L.setAttribute("fallback-path",N)}b.appendChild(L)}}w.urlArgs&&b.setAttribute("url-args",w.urlArgs)}catch(w){console.warn(`Failed to load primary configuration: ${y}`,w)}}else if(d){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in d.paths){let w=d.paths[y],R="";p&&p.paths&&p.paths[y]&&(R=p.paths[y]);let q=Array.isArray(w)?w:[w],A=Array.isArray(R)?R:[R],L=q.map((V,N)=>{let en=A.length>N?A[N]:"";return{primaryPath:V,fallbackPath:en}});for(let V of A)L.some(N=>N.fallbackPath===V)||L.push({primaryPath:q.length>0?q[0]:V,fallbackPath:V});for(let V of L){let N=r.createElement("qti-interaction-module");V.fallbackPath&&N.setAttribute("fallback-path",V.fallbackPath),N.setAttribute("id",y),N.setAttribute("primary-path",V.primaryPath),b&&b.appendChild(N)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=to(n.tagName.toLowerCase()),c=Array.isArray(a)?a:[a];for(let d of c){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,A)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:A})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,w=0;for(;!y&&w<20;){w++;for(let q=f.length-1;q>0;q--){let A=Math.floor(Math.random()*(q+1));[f[q],f[A]]=[f[A],f[q]]}y=!f.every((q,A)=>q===b[A])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let R=0;for(let q of f)q.parentElement.insertBefore(q,m[R]?.element),R++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Ys(r,i,s),t),extendElementsWithClass:(i="extend")=>(Js(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return Qs(r),t},stripStyleSheets(){return eo(r),t},html(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(ct(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),ct(r)},xmlDoc(){return r}};return t};var Oi=()=>{let o,r={async load(e){return new Promise((t,i)=>{Ur(e).promise.then(s=>(o=s,r.path(e.substring(0,e.lastIndexOf("/"))),t(r)))})},parse(e){return o=jr(e),r},path:e=>(dt(o,e),r),fn(e){return e(o),r},items(){return Zs(o)},html(){return new XMLSerializer().serializeToString(ct(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return ct(o)},xmlDoc(){return o}};return r};var pt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let s=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);s?await this.updateStimulusRef(s):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await Je().load(this.href).promise.then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};l([u({type:String})],pt.prototype,"identifier",2),l([u({type:String})],pt.prototype,"href",2),pt=l([g("qti-assessment-stimulus-ref")],pt);var Br=class extends v{};Br=l([g("qti-companion-materials-info")],Br);var jt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};l([_({context:$,subscribe:!0}),E()],jt.prototype,"_context",2),jt=l([g("qti-custom-operator")],jt);var Cn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Bt=o=>{if(typeof o=="string")return o;let r=Cn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Pi(o){return o==null}function Ke(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Y=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Pi(this.identifier)&&!Pi(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};l([u({type:String,attribute:"show-hide"})],Y.prototype,"showHide",2),l([u({type:String,attribute:"outcome-identifier"})],Y.prototype,"outcomeIdentifier",2),l([u({type:String})],Y.prototype,"identifier",2),l([u({type:String,attribute:!1})],Y.prototype,"showStatus",2),l([_({context:$,subscribe:!0}),E()],Y.prototype,"_context",2);var Wt=class extends Y{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Wt.styles=x`
|
|
26
|
+
</xsl:stylesheet>`;function Js(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=Zs(t,i);t.replaceWith(s)})}function Ks(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=Zs(e,n);e.replaceWith(a)}})})}function Zs(o,r){let e=document.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Qs(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function Bt(o){let r=new XMLHttpRequest;return{promise:new Promise((t,i)=>{r.open("GET",o,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?t(r.responseXML):i(r.statusText)},r.onerror=()=>{i(r.statusText)},r.send()}),xhr:r}}function jt(o){return new DOMParser().parseFromString(o,"text/xml")}function ct(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(En,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function dt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function eo(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function to(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function ro(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:}}var Je=(o=!1)=>{let r,e="",t={load(i){e=i;let s=encodeURI(i);if(o&&sessionStorage.getItem(s))return{promise:Promise.resolve(t.parse(sessionStorage.getItem(s))),request:null};let{promise:n,xhr:a}=Bt(i);return{promise:new Promise(d=>{n.then(p=>(r=p,t.shuffleInteractions(),o&&sessionStorage.setItem(s,new XMLSerializer().serializeToString(r)),d(t)))}),request:a}},parse(i){return r=jt(i),t},path:i=>(dt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],c=r.querySelectorAll(n),d=await s(i,"/modules/module_resolution.js"),p=await s(i,"/modules/fallback_module_resolution.js");if(c.length>0)for(let m of Array.from(c)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let w=await s(i,`/${y}`),k=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of k){let T=q.getAttribute("id");if(T&&w.paths&&w.paths[T]){let L=w.paths[T],N=Array.isArray(L)?L[0]:L;if(q.setAttribute("primary-path",N),p&&p.paths&&p.paths[T]){let V=p.paths[T];Array.isArray(V)?q.setAttribute("fallback-path",V[0]):q.setAttribute("fallback-path",V)}}}if(w.paths){for(let q in w.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let L=r.createElement("qti-interaction-module");L.setAttribute("id",q);let N=Array.isArray(w.paths[q])?w.paths[q][0]:w.paths[q];if(L.setAttribute("primary-path",N),p&&p.paths&&p.paths[q]){let V=p.paths[q];Array.isArray(V)?L.setAttribute("fallback-path",V[0]):L.setAttribute("fallback-path",V)}b.appendChild(L)}}w.urlArgs&&b.setAttribute("url-args",w.urlArgs)}catch(w){console.warn(`Failed to load primary configuration: ${y}`,w)}}else if(d){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in d.paths){let w=d.paths[y],k="";p&&p.paths&&p.paths[y]&&(k=p.paths[y]);let q=Array.isArray(w)?w:[w],T=Array.isArray(k)?k:[k],L=q.map((N,V)=>{let en=T.length>V?T[V]:"";return{primaryPath:N,fallbackPath:en}});for(let N of T)L.some(V=>V.fallbackPath===N)||L.push({primaryPath:q.length>0?q[0]:N,fallbackPath:N});for(let N of L){let V=r.createElement("qti-interaction-module");N.fallbackPath&&V.setAttribute("fallback-path",N.fallbackPath),V.setAttribute("id",y),V.setAttribute("primary-path",N.primaryPath),b&&b.appendChild(V)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=ro(n.tagName.toLowerCase()),c=Array.isArray(a)?a:[a];for(let d of c){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,w=0;for(;!y&&w<20;){w++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let k=0;for(let q of f)q.parentElement.insertBefore(q,m[k]?.element),k++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Js(r,i,s),t),extendElementsWithClass:(i="extend")=>(Ks(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return eo(r),t},stripStyleSheets(){return to(r),t},html(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(ct(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),ct(r)},xmlDoc(){return r}};return t};var Pi=()=>{let o,r={async load(e){return new Promise((t,i)=>{Bt(e).promise.then(s=>(o=s,r.path(e.substring(0,e.lastIndexOf("/"))),t(r)))})},parse(e){return o=jt(e),r},path:e=>(dt(o,e),r),fn(e){return e(o),r},items(){return Qs(o)},html(){return new XMLSerializer().serializeToString(ct(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return ct(o)},xmlDoc(){return o}};return r};var pt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let s=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);s?await this.updateStimulusRef(s):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await Je().load(this.href).promise.then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};l([u({type:String})],pt.prototype,"identifier",2),l([u({type:String})],pt.prototype,"href",2),pt=l([g("qti-assessment-stimulus-ref")],pt);var jr=class extends v{};jr=l([g("qti-companion-materials-info")],jr);var Wt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};l([_({context:$,subscribe:!0}),E()],Wt.prototype,"_context",2),Wt=l([g("qti-custom-operator")],Wt);var Cn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Xt=o=>{if(typeof o=="string")return o;let r=Cn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Ni(o){return o==null}function Ke(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Y=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ni(this.identifier)&&!Ni(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};l([u({type:String,attribute:"show-hide"})],Y.prototype,"showHide",2),l([u({type:String,attribute:"outcome-identifier"})],Y.prototype,"outcomeIdentifier",2),l([u({type:String})],Y.prototype,"identifier",2),l([u({type:String,attribute:!1})],Y.prototype,"showStatus",2),l([_({context:$,subscribe:!0}),E()],Y.prototype,"_context",2);var Gt=class extends Y{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Gt.styles=x`
|
|
27
27
|
:host {
|
|
28
28
|
display: block;
|
|
29
29
|
}
|
|
@@ -33,14 +33,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
33
33
|
.off {
|
|
34
34
|
display: none;
|
|
35
35
|
}
|
|
36
|
-
`,
|
|
36
|
+
`,Gt=l([g("qti-feedback-block")],Gt);var se=o=>o??S;var Yt=class extends Y{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${se(this.showStatus)}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Yt.styles=x`
|
|
37
37
|
.on {
|
|
38
38
|
display: inline-block;
|
|
39
39
|
}
|
|
40
40
|
.off {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
`,
|
|
43
|
+
`,Yt=l([g("qti-feedback-inline")],Yt);var Ze=class extends Y{render(){return h`
|
|
44
44
|
<dialog class="qti-dialog" part="feedback" ?open="${this.showStatus==="on"}">
|
|
45
45
|
<slot></slot>
|
|
46
46
|
<div style="margin-top: var(--qti-gap-size); text-align: center;">
|
|
@@ -86,13 +86,13 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
86
86
|
.button:focus {
|
|
87
87
|
outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
|
|
88
88
|
}
|
|
89
|
-
`,Ze=l([g("qti-modal-feedback")],Ze);var
|
|
89
|
+
`,Ze=l([g("qti-modal-feedback")],Ze);var Jt=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return h` <slot name="drags"></slot> `}};Jt.styles=x`
|
|
90
90
|
:host {
|
|
91
91
|
display: flex;
|
|
92
92
|
user-select: none;
|
|
93
93
|
position: absolute;
|
|
94
94
|
}
|
|
95
|
-
`,Gt=l([g("qti-associable-hotspot")],Gt);var ro=(o,r,e)=>{class t extends o{}return t};var oe=(o,r,e,t)=>{class i extends ro(o,e,r){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.dataTransfer={data:{},setData(a,c){this.data[a]=c},getData(a){return this.data[a]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=0;this.draggablesModified=(a,c)=>{if(this.isMatchTabular())return;for(let p of c)this.draggables.includes(p)&&(this.draggables=this.draggables.filter(m=>m!==p),p.removeAttribute("tabindex"),p.removeEventListener("touchstart",this.handleTouchStart.bind(this)),p.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let p of a)this.draggables.includes(p)||(this.draggables.push(p),p.setAttribute("tabindex","0"),p.hasTouchStartListener||(p.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),p.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),p.hasTouchStartListener=!0));let d=0;this.draggables.forEach(p=>{p.style.viewTransitionName=`drag-${d}-${this.getAttribute("identifier")||crypto.randomUUID()}`,p.setAttribute("qti-draggable","true"),d++})};this.droppablesModified=(a,c)=>{if(!this.isMatchTabular()){for(let d of c)this.droppables.includes(d)&&(this.droppables=this.droppables.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.droppables.includes(d)||(this.droppables.push(d),this.allDropzones.push(d));for(let d of this.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box")}}}handleDraggableContainerChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.dragContainersModified(a||[],c||[])}dragContainersModified(a,c){for(let d of c)this.dragContainers.includes(d)&&(this.dragContainers=this.dragContainers.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.dragContainers.includes(d)||(this.dragContainers.push(d),this.allDropzones.push(d))}handleDraggablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.draggablesModified(a||[],c||[])}handleDroppablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.droppablesModified(a||[],c||[])}firstUpdated(a){if(super.firstUpdated(a),this.isMatchTabular())return;this.hasAttribute("disabled")||(document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}));let d=Array.from(this.querySelectorAll(r)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(r)||[])),p=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),m=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(m,[]),this.droppablesModified(p,[]),this.draggablesModified(d,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(b=>this.resizeObserver?.observe(b))}async moveDraggableToDroppable(a,c){if(this.isMatchTabular())return;(()=>{a.style.transform="translate(0, 0)",c.tagName==="SLOT"?a.setAttribute("slot",c.getAttribute("name")):c.appendChild(a),this.checkAllMaxAssociations(),this.saveResponse()})()}activateDroppable(a){this.dragContainers.includes(a)?(this._internals.states.add("--dragzone-active"),a.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),a.setAttribute("active",""))}deactivateDroppable(a,c=!0){c&&this._internals.states.add("--dragzone-active"),a.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}async updateMinDimensionsForDropZones(){if(await this.updateComplete,this.isMatchTabular())return;let a=this.querySelectorAll(r),c=Array.from(this.querySelectorAll(e)).map(b=>b),d=0,p=0;a.forEach(b=>{let y=b.getBoundingClientRect();d=Math.max(d,y.height),p=Math.max(p,y.width)});let m=this.querySelector(t)||this.shadowRoot?.querySelector(t),f=c[0]?.parentElement;f&&(f.style.gridTemplateColumns=`repeat(auto-fit, minmax(calc(${p}px + 2 * var(--qti-dropzone-padding)), 1fr))`),m&&(m.style.minHeight=`${d}px`,m.style.minWidth=`${p}px`);for(let b of c){b.style.minHeight=`${d}px`,b.style.minWidth=`${p}px`;let y=b.shadowRoot?.querySelector('slot[part="dropslot"]');y&&(y.style.minHeight=`${d}px`,y.style.minWidth=`${p}px`)}}activateDroppables(a){if(this.isMatchTabular())return;this.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.droppables.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragContainers.forEach(c=>{c.removeAttribute("enabled"),c.removeAttribute("active")}),this.droppables.forEach(c=>{c.removeAttribute("enabled"),c.removeAttribute("active")})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("touchmove",this.handleTouchMove),document.removeEventListener("mousemove",this.handleTouchMove),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("mouseup",this.handleTouchEnd),document.removeEventListener("touchcancel",this.handleTouchCancel)}handleTouchMove(a){if(!this.isMatchTabular()&&this.isDraggable&&this.dragClone){let{x:c,y:d}=this.getEventCoordinates(a),p={clientX:c,clientY:d};this.calculateDragDistance(p)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0,this.updateDragClonePosition(p));let m=this.findClosestDropzone();this.currentDropTarget=m,m!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),m&&(this.activateDroppable(m),this.dispatchCustomEvent(m,"dragenter")),this.lastTarget=m),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover"),a.preventDefault()}}handleTouchEnd(a){this.isMatchTabular()||(this.isDragging&&this.resetDragState(),this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(c=>{c.removeAttribute("dragging")}),a.preventDefault())}handleTouchCancel(a){this.resetDragState()}validate(){if(this.isMatchTabular())return;if(!this.shadowRoot)return!1;let a=this.getValidAssociations(),c=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(c=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(c=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let p=this.lastElementChild;return this._internals.setValidity(c?{}:{customError:!0},d,p),c}reportValidity(){let a=this.shadowRoot.querySelector("#validation-message");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.setProperty("display","block","important"))),this._internals.validity.valid}checkMaxAssociations(a){let c=this.getMatchMaxValue(a),d=a.querySelectorAll('[qti-draggable="true"]').length;return!(c===0)&&d>=c}dropDraggableInDroppable(a,c){let d=a.cloneNode(!0);d.removeAttribute("style"),this.moveDraggableToDroppable(d,c),this.draggablesModified([d],[]);let p=this.getMatchMaxValue(a),m=this.draggables.filter(f=>f.getAttribute("identifier")===a.getAttribute("identifier"));p!==0&&m.length>=p?(a.style.opacity="0.0",a.style.pointerEvents="none"):a.style.opacity="1.0"}resetDragState(){if(this.dragClone){let a=this.currentDropTarget!==null,c=!a||this.dragContainers.includes(this.currentDropTarget);a&&this.currentDropTarget&&!c&&this.dropDraggableInDroppable(this.dragSource,this.currentDropTarget),c&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto",this.saveResponse()),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.deactivateDroppables()}checkAllMaxAssociations(){let a=this.getValidAssociations(),c=this.maxAssociations!==0&&a>=this.maxAssociations;this.droppables.forEach(d=>{c?this.disableDroppable(d):this.checkMaxAssociations(d)?this.disableDroppable(d):this.enableDroppable(d)})}getMatchMaxValue(a){let c=a.getAttribute("match-max");return c?parseInt(c,10):1}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get response(){let a;return typeof this.getResponse=="function"?a=this.getResponse():a=this.collectResponseData(),a.join(",")}set response(a){if(!this.isMatchTabular())if(typeof this.getValue=="function"&&(a=this.getValue(a)),Array.isArray(a)){this.reset(!1),a?.forEach(d=>this.placeResponse(d));let c=new FormData;a.forEach(d=>{c.append(this.responseIdentifier,d)}),this._internals.setFormValue(c)}else this._internals.setFormValue(a||"")}placeResponse(a){let[c,...d]=a.split(" ").reverse(),p=Array.from(this.draggables),m=Array.from(this.droppables);d.forEach(f=>{if(f==="")return;let b=p.find(w=>w.getAttribute("identifier")===f),y=m.find(w=>w.getAttribute("identifier")===c);this.dropDraggableInDroppable(b,y)})}getValidAssociations(){let a=0;for(let c of this.droppables)a=a+this.getDraggablesFromDroppable(c).length;return a}saveResponse(){let a;typeof this.getResponse=="function"?a=this.getResponse():a=this.collectResponseData(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(c=>{let p=this.getDraggablesFromDroppable(c).map(f=>f.getAttribute("identifier")),m=c.getAttribute("identifier");return p.map(f=>`${f} ${m}`)}).flat()}getDraggablesFromDroppable(a){return this.draggables.map(p=>p.getAttribute("identifier")).filter((p,m,f)=>f.indexOf(p)===m).flatMap(p=>Array.from(a.querySelectorAll(`[identifier='${p}']`))).filter(p=>!!p).map(p=>p)}reset(a=!0){this.droppables.forEach(c=>{this.getDraggablesFromDroppable(c).forEach(p=>{p.remove(),this.draggablesModified([],[p])})}),this.dragContainers.forEach(c=>{Array.from(c.querySelectorAll('[qti-draggable="true"]')).forEach(p=>{p.style.opacity="1.0"})}),this.dragClone=null,this.dragSource=null,this.isDragging=!1,this.isDraggable=!1,this.currentDropTarget=null,this.lastTarget=null,a&&this.saveResponse()}updateDragClonePosition(a){if(!this.isDragging||!this.dragClone)return;let c=a.clientX-this.cloneOffset.x,d=a.clientY-this.cloneOffset.y,{newLeft:p,newTop:m}=this.applyInteractionBoundaries(c,d,this.dragClone);this.dragClone.style.left=`${p}px`,this.dragClone.style.top=`${m}px`}applyInteractionBoundaries(a,c,d){let p=this.getBoundingClientRect(),m=d.getBoundingClientRect(),f=m.width,b=m.height,y=Math.max(p.left,Math.min(a,p.right-f)),w=Math.max(p.top,Math.min(c,p.bottom-b));return{newLeft:y,newTop:w}}getEventCoordinates(a,c=!1){let d=a.touches?a.touches[0]:a;return{x:c?d.pageX:d.clientX,y:c?d.pageY:d.clientY}}calculateDragDistance(a){let c=Math.abs(a.clientX-this.touchStartPoint.x),d=Math.abs(a.clientY-this.touchStartPoint.y);return c+d}findClosestDropzone(){let a=this.allDropzones.filter(m=>!m.hasAttribute("disabled"));if(!this.dragClone||a.length===0)return null;let c=this.dragClone.getBoundingClientRect(),d=null,p=0;for(let m of a){let f=m.getBoundingClientRect(),b=this.calculateOverlapArea(c,f);b>p&&(p=b,d=m)}if(!d){let m=200;for(let f of a){let b=f.getBoundingClientRect(),y=Math.sqrt(Math.pow(c.left-b.left,2)+Math.pow(c.top-b.top,2));y<m&&(m=y,d=f)}}return d}calculateOverlapArea(a,c){let d=Math.max(0,Math.min(a.right,c.right)-Math.max(a.left,c.left)),p=Math.max(0,Math.min(a.bottom,c.bottom)-Math.max(a.top,c.top));return d*p}dispatchCustomEvent(a,c,d=!0){if(!a)return;let p=new CustomEvent(c,{bubbles:d,cancelable:!0});p.dataTransfer=this.dataTransfer,a.dispatchEvent(p)}appendClone(){document.body.appendChild(this.dragClone)}handleTouchStart(a){if(this.isMatchTabular()||a instanceof MouseEvent&&a.button!==0||this.isDragging)return;let{x:c,y:d}=this.getEventCoordinates(a);this.touchStartPoint={x:c,y:d},this.dragSource=a.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let p=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),m=this.droppables.some(q=>Array.from(q.children).some(A=>A===this.dragSource)),f=this.dragSource.getBoundingClientRect();m&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=p),this.cloneOffset.x=c-f.left,this.cloneOffset.y=d-f.top,this.dragClone=p.cloneNode(!0);let b=window.getComputedStyle(p);for(let q=0;q<b.length;q++){let A=b[q];this.dragClone.style.setProperty(A,b.getPropertyValue(A))}let y=p.getBoundingClientRect();this.dragClone.style.width=`${y.width}px`,this.dragClone.style.height=`${y.height}px`,f&&this.setDragCloneStyles(f),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone();let w=this.getMatchMaxValue(this.dragSource),R=this.draggables.filter(q=>q.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));w!==0&&R.length>=w?(p.style.opacity="0.0",p.style.pointerEvents="none"):p.style.opacity="1.0",a.preventDefault(),this.dragClone.setAttribute("dragging","")}findDraggableInDraggableContainer(a){let c=this.dragContainers.flat();for(let d of c){if(d.getAttribute("identifier")===a)return d;let p;d instanceof HTMLSlotElement?p=Array.from(d?.assignedElements()||[]):p=Array.from(d.querySelectorAll(r));let m=p.find(f=>f.getAttribute("identifier")===a);if(m)return m}}setDragCloneStyles(a){this.dragClone.style.position="fixed",this.dragClone.style.top=`${a.top}px`,this.dragClone.style.left=`${a.left}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return l([u({attribute:!1,type:Object})],i.prototype,"configuration",2),l([u({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([u({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([Fr(t)],i.prototype,"handleDraggableContainerChange",1),l([Fr(r)],i.prototype,"handleDraggablesChange",1),l([Fr(e)],i.prototype,"handleDroppablesChange",1),i};var io=x`
|
|
95
|
+
`,Jt=l([g("qti-associable-hotspot")],Jt);var io=(o,r,e)=>{class t extends o{}return t};var oe=(o,r,e,t)=>{class i extends io(o,e,r){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.dataTransfer={data:{},setData(a,c){this.data[a]=c},getData(a){return this.data[a]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=0;this.draggablesModified=(a,c)=>{if(this.isMatchTabular())return;for(let p of c)this.draggables.includes(p)&&(this.draggables=this.draggables.filter(m=>m!==p),p.removeAttribute("tabindex"),p.removeEventListener("touchstart",this.handleTouchStart.bind(this)),p.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let p of a)this.draggables.includes(p)||(this.draggables.push(p),p.setAttribute("tabindex","0"),p.hasTouchStartListener||(p.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),p.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),p.hasTouchStartListener=!0));let d=0;this.draggables.forEach(p=>{p.style.viewTransitionName=`drag-${d}-${this.getAttribute("identifier")||crypto.randomUUID()}`,p.setAttribute("qti-draggable","true"),d++})};this.droppablesModified=(a,c)=>{if(!this.isMatchTabular()){for(let d of c)this.droppables.includes(d)&&(this.droppables=this.droppables.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.droppables.includes(d)||(this.droppables.push(d),this.allDropzones.push(d));for(let d of this.droppables)this.dataset.choicesContainerWidth&&(d.style.width=`${this.dataset.choicesContainerWidth}px`,d.style.boxSizing="border-box")}}}handleDraggableContainerChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.dragContainersModified(a||[],c||[])}dragContainersModified(a,c){for(let d of c)this.dragContainers.includes(d)&&(this.dragContainers=this.dragContainers.filter(p=>p!==d),this.allDropzones=this.allDropzones.filter(p=>p!==d));for(let d of a)this.dragContainers.includes(d)||(this.dragContainers.push(d),this.allDropzones.push(d))}handleDraggablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.draggablesModified(a||[],c||[])}handleDroppablesChange(a,c){this.isMatchTabular()||(a.length>0||c.length>0)&&this.droppablesModified(a||[],c||[])}firstUpdated(a){if(super.firstUpdated(a),this.isMatchTabular())return;this.hasAttribute("disabled")||(document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}));let d=Array.from(this.querySelectorAll(r)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(r)||[])),p=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),m=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(m,[]),this.droppablesModified(p,[]),this.draggablesModified(d,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(b=>this.resizeObserver?.observe(b))}async moveDraggableToDroppable(a,c){if(this.isMatchTabular())return;(()=>{a.style.transform="translate(0, 0)",c.tagName==="SLOT"?a.setAttribute("slot",c.getAttribute("name")):c.appendChild(a),this.checkAllMaxAssociations(),this.saveResponse()})()}activateDroppable(a){this.dragContainers.includes(a)?(this._internals.states.add("--dragzone-active"),a.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),a.setAttribute("active",""))}deactivateDroppable(a,c=!0){c&&this._internals.states.add("--dragzone-active"),a.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}async updateMinDimensionsForDropZones(){if(await this.updateComplete,this.isMatchTabular())return;let a=this.querySelectorAll(r),c=Array.from(this.querySelectorAll(e)).map(b=>b),d=0,p=0;a.forEach(b=>{let y=b.getBoundingClientRect();d=Math.max(d,y.height),p=Math.max(p,y.width)});let m=this.querySelector(t)||this.shadowRoot?.querySelector(t),f=c[0]?.parentElement;f&&(f.style.gridTemplateColumns=`repeat(auto-fit, minmax(calc(${p}px + 2 * var(--qti-dropzone-padding)), 1fr))`),m&&(m.style.minHeight=`${d}px`,m.style.minWidth=`${p}px`);for(let b of c){b.style.minHeight=`${d}px`,b.style.minWidth=`${p}px`;let y=b.shadowRoot?.querySelector('slot[part="dropslot"]');y&&(y.style.minHeight=`${d}px`,y.style.minWidth=`${p}px`)}}activateDroppables(a){if(this.isMatchTabular())return;this.dragContainers.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")}),this.droppables.forEach(d=>{d.setAttribute("enabled",""),d.hasAttribute("disabled")&&(d.contains(a)||d.shadowRoot&&d.shadowRoot.contains(a))&&d.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragContainers.forEach(c=>{c.removeAttribute("enabled"),c.removeAttribute("active")}),this.droppables.forEach(c=>{c.removeAttribute("enabled"),c.removeAttribute("active")})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("touchmove",this.handleTouchMove),document.removeEventListener("mousemove",this.handleTouchMove),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("mouseup",this.handleTouchEnd),document.removeEventListener("touchcancel",this.handleTouchCancel)}handleTouchMove(a){if(!this.isMatchTabular()&&this.isDraggable&&this.dragClone){let{x:c,y:d}=this.getEventCoordinates(a),p={clientX:c,clientY:d};this.calculateDragDistance(p)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0,this.updateDragClonePosition(p));let m=this.findClosestDropzone();this.currentDropTarget=m,m!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),m&&(this.activateDroppable(m),this.dispatchCustomEvent(m,"dragenter")),this.lastTarget=m),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover"),a.preventDefault()}}handleTouchEnd(a){this.isMatchTabular()||(this.isDragging&&this.resetDragState(),this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(c=>{c.removeAttribute("dragging")}),a.preventDefault())}handleTouchCancel(a){this.resetDragState()}validate(){if(this.isMatchTabular())return;if(!this.shadowRoot)return!1;let a=this.getValidAssociations(),c=!0,d="";this.maxAssociations>0&&a>this.maxAssociations?(c=!1,d=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&a<this.minAssociations&&(c=!1,d=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let p=this.lastElementChild;return this._internals.setValidity(c?{}:{customError:!0},d,p),c}reportValidity(){let a=this.shadowRoot.querySelector("#validation-message");return a&&(this._internals.validity.valid?(a.textContent="",a.style.display="none"):(a.textContent=this._internals.validationMessage,a.style.setProperty("display","block","important"))),this._internals.validity.valid}checkMaxAssociations(a){let c=this.getMatchMaxValue(a),d=a.querySelectorAll('[qti-draggable="true"]').length;return!(c===0)&&d>=c}dropDraggableInDroppable(a,c){let d=a.cloneNode(!0);d.removeAttribute("style"),this.moveDraggableToDroppable(d,c),this.draggablesModified([d],[]);let p=this.getMatchMaxValue(a),m=this.draggables.filter(f=>f.getAttribute("identifier")===a.getAttribute("identifier"));p!==0&&m.length>=p?(a.style.opacity="0.0",a.style.pointerEvents="none"):a.style.opacity="1.0"}resetDragState(){if(this.dragClone){let a=this.currentDropTarget!==null,c=!a||this.dragContainers.includes(this.currentDropTarget);a&&this.currentDropTarget&&!c&&this.dropDraggableInDroppable(this.dragSource,this.currentDropTarget),c&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto",this.saveResponse()),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.deactivateDroppables()}checkAllMaxAssociations(){let a=this.getValidAssociations(),c=this.maxAssociations!==0&&a>=this.maxAssociations;this.droppables.forEach(d=>{c?this.disableDroppable(d):this.checkMaxAssociations(d)?this.disableDroppable(d):this.enableDroppable(d)})}getMatchMaxValue(a){let c=a.getAttribute("match-max");return c?parseInt(c,10):1}disableDroppable(a){a.setAttribute("disabled","")}enableDroppable(a){a.removeAttribute("disabled")}get response(){let a;return typeof this.getResponse=="function"?a=this.getResponse():a=this.collectResponseData(),a.join(",")}set response(a){if(!this.isMatchTabular())if(typeof this.getValue=="function"&&(a=this.getValue(a)),Array.isArray(a)){this.reset(!1),a?.forEach(d=>this.placeResponse(d));let c=new FormData;a.forEach(d=>{c.append(this.responseIdentifier,d)}),this._internals.setFormValue(c)}else this._internals.setFormValue(a||"")}placeResponse(a){let[c,...d]=a.split(" ").reverse(),p=Array.from(this.draggables),m=Array.from(this.droppables);d.forEach(f=>{if(f==="")return;let b=p.find(w=>w.getAttribute("identifier")===f),y=m.find(w=>w.getAttribute("identifier")===c);this.dropDraggableInDroppable(b,y)})}getValidAssociations(){let a=0;for(let c of this.droppables)a=a+this.getDraggablesFromDroppable(c).length;return a}saveResponse(){let a;typeof this.getResponse=="function"?a=this.getResponse():a=this.collectResponseData(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(c=>{let p=this.getDraggablesFromDroppable(c).map(f=>f.getAttribute("identifier")),m=c.getAttribute("identifier");return p.map(f=>`${f} ${m}`)}).flat()}getDraggablesFromDroppable(a){return this.draggables.map(p=>p.getAttribute("identifier")).filter((p,m,f)=>f.indexOf(p)===m).flatMap(p=>Array.from(a.querySelectorAll(`[identifier='${p}']`))).filter(p=>!!p).map(p=>p)}reset(a=!0){this.droppables.forEach(c=>{this.getDraggablesFromDroppable(c).forEach(p=>{p.remove(),this.draggablesModified([],[p])})}),this.dragContainers.forEach(c=>{Array.from(c.querySelectorAll('[qti-draggable="true"]')).forEach(p=>{p.style.opacity="1.0"})}),this.dragClone=null,this.dragSource=null,this.isDragging=!1,this.isDraggable=!1,this.currentDropTarget=null,this.lastTarget=null,a&&this.saveResponse()}updateDragClonePosition(a){if(!this.isDragging||!this.dragClone)return;let c=a.clientX-this.cloneOffset.x,d=a.clientY-this.cloneOffset.y,{newLeft:p,newTop:m}=this.applyInteractionBoundaries(c,d,this.dragClone);this.dragClone.style.left=`${p}px`,this.dragClone.style.top=`${m}px`}applyInteractionBoundaries(a,c,d){let p=this.getBoundingClientRect(),m=d.getBoundingClientRect(),f=m.width,b=m.height,y=Math.max(p.left,Math.min(a,p.right-f)),w=Math.max(p.top,Math.min(c,p.bottom-b));return{newLeft:y,newTop:w}}getEventCoordinates(a,c=!1){let d=a.touches?a.touches[0]:a;return{x:c?d.pageX:d.clientX,y:c?d.pageY:d.clientY}}calculateDragDistance(a){let c=Math.abs(a.clientX-this.touchStartPoint.x),d=Math.abs(a.clientY-this.touchStartPoint.y);return c+d}findClosestDropzone(){let a=this.allDropzones.filter(m=>!m.hasAttribute("disabled"));if(!this.dragClone||a.length===0)return null;let c=this.dragClone.getBoundingClientRect(),d=null,p=0;for(let m of a){let f=m.getBoundingClientRect(),b=this.calculateOverlapArea(c,f);b>p&&(p=b,d=m)}if(!d){let m=200;for(let f of a){let b=f.getBoundingClientRect(),y=Math.sqrt(Math.pow(c.left-b.left,2)+Math.pow(c.top-b.top,2));y<m&&(m=y,d=f)}}return d}calculateOverlapArea(a,c){let d=Math.max(0,Math.min(a.right,c.right)-Math.max(a.left,c.left)),p=Math.max(0,Math.min(a.bottom,c.bottom)-Math.max(a.top,c.top));return d*p}dispatchCustomEvent(a,c,d=!0){if(!a)return;let p=new CustomEvent(c,{bubbles:d,cancelable:!0});p.dataTransfer=this.dataTransfer,a.dispatchEvent(p)}appendClone(){document.body.appendChild(this.dragClone)}handleTouchStart(a){if(this.isMatchTabular()||a instanceof MouseEvent&&a.button!==0||this.isDragging)return;let{x:c,y:d}=this.getEventCoordinates(a);this.touchStartPoint={x:c,y:d},this.dragSource=a.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let p=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),m=this.droppables.some(q=>Array.from(q.children).some(T=>T===this.dragSource)),f=this.dragSource.getBoundingClientRect();m&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=p),this.cloneOffset.x=c-f.left,this.cloneOffset.y=d-f.top,this.dragClone=p.cloneNode(!0);let b=window.getComputedStyle(p);for(let q=0;q<b.length;q++){let T=b[q];this.dragClone.style.setProperty(T,b.getPropertyValue(T))}let y=p.getBoundingClientRect();this.dragClone.style.width=`${y.width}px`,this.dragClone.style.height=`${y.height}px`,f&&this.setDragCloneStyles(f),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone();let w=this.getMatchMaxValue(this.dragSource),k=this.draggables.filter(q=>q.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));w!==0&&k.length>=w?(p.style.opacity="0.0",p.style.pointerEvents="none"):p.style.opacity="1.0",a.preventDefault(),this.dragClone.setAttribute("dragging","")}findDraggableInDraggableContainer(a){let c=this.dragContainers.flat();for(let d of c){if(d.getAttribute("identifier")===a)return d;let p;d instanceof HTMLSlotElement?p=Array.from(d?.assignedElements()||[]):p=Array.from(d.querySelectorAll(r));let m=p.find(f=>f.getAttribute("identifier")===a);if(m)return m}}setDragCloneStyles(a){this.dragClone.style.position="fixed",this.dragClone.style.top=`${a.top}px`,this.dragClone.style.left=`${a.left}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return l([u({attribute:!1,type:Object})],i.prototype,"configuration",2),l([u({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([u({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([Br(t)],i.prototype,"handleDraggableContainerChange",1),l([Br(r)],i.prototype,"handleDraggablesChange",1),l([Br(e)],i.prototype,"handleDroppablesChange",1),i};var so=x`
|
|
96
96
|
:host {
|
|
97
97
|
display: block; /* necessary to calculate scaling position */
|
|
98
98
|
}
|
|
@@ -117,7 +117,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
117
117
|
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
|
-
`;var ne=Symbol("configContext");var
|
|
120
|
+
`;var ne=Symbol("configContext");var R=class extends v{constructor(){super();this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){return this._correctResponse}set correctResponse(e){this._correctResponse=e}get correctness(){let e=this.responseVariable;return!e||e.correctResponse===null?null:e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!1}get responseVariable(){let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),s=this.responseVariable;if(!s)return;if(!e||this.correctness==="correct"){if(!i)return;this.parentElement?.removeChild(t)}if(i||this.correctness==="correct")return;let n=this.cloneNode(!0),a=document.createElement("div");a.classList.add("full-correct-response"),this.isInline?a.classList.add("full-correct-response-inline"):a.classList.add("full-correct-response-block"),a.role="full-correct-response",a.appendChild(n),n.isFullCorrectResponse=!0,this.parentElement?.insertBefore(a,this.nextSibling),await n.updateComplete,n.response=Array.isArray(s.correctResponse)?[...s.correctResponse]:s.correctResponse}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t?.cardinality==="single"?"":[]}toggleCandidateCorrection(e){this.responseVariable&&(this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect")))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};l([_({context:$,subscribe:!0})],R.prototype,"_context",2),l([_({context:ne,subscribe:!0})],R.prototype,"configContext",2),l([u({type:String,attribute:"response-identifier"})],R.prototype,"responseIdentifier",2),l([u({reflect:!0,type:Boolean})],R.prototype,"disabled",2),l([u({reflect:!0,type:Boolean})],R.prototype,"readonly",2),l([E()],R.prototype,"_isFullCorrectResponse",2),l([E()],R.prototype,"_correctResponse",2);var ut=class extends oe(R,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let t=e.target;this._childrenMap.push(t)}render(){return h` <slot name="prompt"></slot>
|
|
121
121
|
<slot name="qti-simple-associable-choice"></slot>
|
|
122
122
|
<div part="drop-container">
|
|
123
123
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>h`<div part="associables-container">
|
|
@@ -126,7 +126,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
126
126
|
</div>`)}
|
|
127
127
|
|
|
128
128
|
<div role="alert" part="message" id="validation-message"></div>
|
|
129
|
-
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ut.styles=
|
|
129
|
+
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ut.styles=so,l([E()],ut.prototype,"_childrenMap",2),ut=l([g("qti-associate-interaction")],ut);var Le=(o,r)=>{class e extends o{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(s,n)=>{this._choiceElements.forEach(a=>a.disabled=n)};this._handleReadonlyChange=(s,n)=>{this._choiceElements.forEach(a=>a.readonly=n)};this.response="";this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}_handleMaxChoicesChange(s,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(s){this.maxChoices>1&&(typeof s=="string"||s===null)?this.response=s?s.toString().split(","):[]:this.response=s||""}toggleInternalCorrectResponse(s){let n=this.responseVariable;if(n?.correctResponse){let a=Array.isArray(n.correctResponse)?n.correctResponse:[n.correctResponse];this._choiceElements.forEach(c=>{c.internals.states.delete("correct-response"),c.internals.states.delete("incorrect-response"),s&&a.length>0&&(a.includes(c.identifier)?c.internals.states.add("correct-response"):c.internals.states.add("incorrect-response"))})}}toggleCandidateCorrection(s){let n=this.responseVariable;if(!n?.correctResponse)return;let a=Array.isArray(n.correctResponse)?n.correctResponse:[n.correctResponse],c=Array.isArray(n.value)?n.value:[n.value];this._choiceElements.forEach(d=>{d.internals.states.delete("candidate-correct"),d.internals.states.delete("candidate-incorrect"),s&&c.includes(d.identifier)&&(a.includes(d.identifier)?d.internals.states.add("candidate-correct"):d.internals.states.add("candidate-incorrect"))})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${r}`,this._registerChoiceElement),this.addEventListener(`unregister-${r}`,this._unregisterChoiceElement),this.addEventListener(`activate-${r}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${r}`,this._registerChoiceElement),this.removeEventListener(`unregister-${r}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${r}`,this._choiceElementSelectedHandler)}validate(){let s=this._choiceElements.filter(d=>this._getChoiceChecked(d)),n=s.length,a=!0,c="";return this.maxChoices!==0&&n>this.maxChoices?(a=!1,c=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(a=!1,c=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`),s.length>0&&this._internals.setValidity(a?{}:{customError:!0},c,s[n-1]||this._choiceElements[0]||this),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.setProperty("display","block","important"))),this._internals.validity.valid}_registerChoiceElement(s){s.stopPropagation();let n=s.target;n.disabled=this.disabled,this._choiceElements.push(n),this._setInputType(n)}_unregisterChoiceElement(s){s.stopPropagation();let n=s.target;this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(s=>{this._setInputType(s)})}_setInputType(s){this._internals.role=this.maxChoices===1?"radiogroup":null;let n=this.maxChoices===1?"radio":"checkbox";s.internals.role=n,s.internals.states.delete(n==="radio"?"checkbox":"radio"),s.internals.states.add(n)}_choiceElementSelectedHandler(s){this._toggleChoiceChecked(s.target),this.maxChoices===1?this._choiceElements.forEach(n=>{n.identifier!==s.detail.identifier&&this._setChoiceChecked(n,!1)}):this._configContext?.disableAfterIfMaxChoicesReached&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(s,n){s.internals?.states&&(n?(s.internals.states.add("--checked"),s.internals.ariaChecked="true"):(s.internals.states.delete("--checked"),s.internals.ariaChecked="false"))}_getChoiceChecked(s){return s.internals.states.has("--checked")}_toggleChoiceChecked(s){let n=this._getChoiceChecked(s);this._setChoiceChecked(s,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.saveResponse(this.response)}_updateChoiceSelection(){let s=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let a=s.includes(n.identifier);this._setChoiceChecked(n,a)})}}return l([lt("#validation-message")],e.prototype,"_validationMessageElement",2),l([u({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),l([u({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),l([M("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),l([M("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),l([M("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),l([E()],e.prototype,"response",2),l([M("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",2),l([E(),_({context:ne,subscribe:!0})],e.prototype,"_configContext",2),e};var oo=(o,r)=>{class e extends o{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(s){s&&(this._classes=s.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(s){super.updated(s),this._addLabels()}_addLabels(){let s=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),n=a=>!isNaN(+a);if(s){let c=Array.from(this.querySelectorAll("qti-simple-choice")).map(d=>d).map((d,p)=>({el:d,order:n(d.style.order)?+d.style.order:p+1})).sort((d,p)=>d.order-p.order).map(d=>d.el);for(let d=0;d<c.length;d++)c[d].marker=this._getLabel(d+1)}}_getLabel(s){let n=this._classes.filter(d=>this._allLabels.includes(d)).pop(),a=this._classes.filter(d=>this._allLabelSuffixes.includes(d)).pop();!n&&a&&(n="qti-labels-upper-alpha");let c="";switch(n){case"qti-labels-decimal":c=`${s}`;break;case"qti-labels-lower-alpha":c=`${String.fromCharCode(97+s-1)}`;break;case"qti-labels-upper-alpha":c=`${String.fromCharCode(65+s-1)}`;break}return a==="qti-labels-suffix-period"?c+=".":a==="qti-labels-suffix-parenthesis"&&(c+=")"),c}}return l([u({type:String,reflect:!0})],e.prototype,"class",1),e};var no=x`
|
|
130
130
|
:host {
|
|
131
131
|
display: block;
|
|
132
132
|
}
|
|
@@ -196,11 +196,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
196
196
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
197
197
|
grid-row: auto;
|
|
198
198
|
}
|
|
199
|
-
`;var mt=class extends
|
|
199
|
+
`;var mt=class extends oo(Le(R,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments);this.orientation="vertical"}_handleSlotChange(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return h`
|
|
200
200
|
<slot part="prompt" name="prompt"></slot>
|
|
201
201
|
<slot part="slot" @slotchange=${this._handleSlotChange}></slot>
|
|
202
202
|
<div part="message" role="alert" id="validation-message"></div>
|
|
203
|
-
`}};mt.styles=
|
|
203
|
+
`}};mt.styles=no,l([u({type:String})],mt.prototype,"orientation",2),mt=l([g("qti-choice-interaction")],mt);var ve=class extends R{constructor(){super();this.rawResponse="";this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")||this.data.startsWith("blob")?this.data:Ke(this.baseItemUrl+"/"+this.data);fetch(e).then(t=>t.json()).then(t=>{this.manifest=t,this.setupCES()}).catch(t=>{this._errorMessage=t})}setupCES(){let t=this.shadowRoot.querySelector("#pciContainer").contentDocument;if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let i=this.manifest.style[0],s=i.startsWith("http")||i.startsWith("blob")?i:Ke(`${this.baseRefUrl}/${i}`),n=this.manifest.script[0],a=n.startsWith("http")||n.startsWith("blob")?n:Ke(`${this.baseRefUrl}/${n}`);window.addEventListener("message",this.handlePostMessage),t.open(),t.write(`
|
|
204
204
|
<html>
|
|
205
205
|
<head>
|
|
206
206
|
<link href='${s}' rel="stylesheet" />
|
|
@@ -219,7 +219,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
219
219
|
${this._errorMessage&&h`<div style="color:red">
|
|
220
220
|
<h1>Error</h1>
|
|
221
221
|
${this._errorMessage}
|
|
222
|
-
</div>`}`}};l([u({type:String,attribute:"data"})],ve.prototype,"data",2),l([u({type:String,attribute:"data-base-item"})],ve.prototype,"baseItemUrl",2),l([u({type:String,attribute:"data-base-ref"})],ve.prototype,"baseRefUrl",2),l([u({type:String,attribute:"id"})],ve.prototype,"id",2),l([E()],ve.prototype,"_errorMessage",2),ve=l([g("qti-custom-interaction")],ve);var $e=class extends v{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};l([u({type:String,attribute:"response-identifier"})],$e.prototype,"responseIdentifier",2),l([u({reflect:!0,type:Boolean})],$e.prototype,"disabled",2),l([u({type:String,attribute:"count-attempt"})],$e.prototype,"countAttempt",2),l([u({type:String})],$e.prototype,"title",2),$e=l([g("qti-end-attempt-interaction")],$e);var
|
|
222
|
+
</div>`}`}};l([u({type:String,attribute:"data"})],ve.prototype,"data",2),l([u({type:String,attribute:"data-base-item"})],ve.prototype,"baseItemUrl",2),l([u({type:String,attribute:"data-base-ref"})],ve.prototype,"baseRefUrl",2),l([u({type:String,attribute:"id"})],ve.prototype,"id",2),l([E()],ve.prototype,"_errorMessage",2),ve=l([g("qti-custom-interaction")],ve);var $e=class extends v{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};l([u({type:String,attribute:"response-identifier"})],$e.prototype,"responseIdentifier",2),l([u({reflect:!0,type:Boolean})],$e.prototype,"disabled",2),l([u({type:String,attribute:"count-attempt"})],$e.prototype,"countAttempt",2),l([u({type:String})],$e.prototype,"title",2),$e=l([g("qti-end-attempt-interaction")],$e);var ao=x`
|
|
223
223
|
/* PK: display host as block, else design will be collapsed */
|
|
224
224
|
:host {
|
|
225
225
|
display: block;
|
|
@@ -230,7 +230,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
230
230
|
height: 100%;
|
|
231
231
|
border: 0;
|
|
232
232
|
}
|
|
233
|
-
`;var U=class extends
|
|
233
|
+
`;var U=class extends R{constructor(){super(...arguments);this._rows=5;this.response=null;this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}handleclassNamesChange(e,t){let i=t.split(" "),s=!1;if(i.forEach(n=>{if(n.startsWith("qti-height-lines-")){let a=n.replace("qti-height-lines-","");this._rows=parseInt(a),s=!0}}),!s&&this.expectedLength){let n=Math.ceil(this.expectedLength/50);this._rows=n}}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(t);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return!!this.response&&e.checkValidity()}toggleCorrectResponse(){}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return h`<slot name="prompt"></slot
|
|
234
234
|
><textarea
|
|
235
235
|
part="textarea"
|
|
236
236
|
name="${this.responseIdentifier}"
|
|
@@ -246,12 +246,12 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
246
246
|
?disabled="${this.disabled}"
|
|
247
247
|
?readonly="${this.readonly}"
|
|
248
248
|
.value=${this.response}
|
|
249
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};U.styles=
|
|
249
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};U.styles=ao,l([E()],U.prototype,"_rows",2),l([u({type:Number,attribute:"expected-length"})],U.prototype,"expectedLength",2),l([u({type:String,attribute:"pattern-mask"})],U.prototype,"patternMask",2),l([u({type:String,attribute:"placeholder-text"})],U.prototype,"placeholderText",2),l([u({type:String,attribute:"data-patternmask-message"})],U.prototype,"dataPatternmaskMessage",2),l([u({type:String,attribute:"class"})],U.prototype,"classNames",2),l([M("classNames")],U.prototype,"handleclassNamesChange",1),l([E()],U.prototype,"response",2),l([M("response",{waitUntilFirstUpdate:!0})],U.prototype,"_handleResponseChange",2),U=l([g("qti-extended-text-interaction")],U);var ht=class extends v{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};ht.styles=x`
|
|
250
250
|
:host {
|
|
251
251
|
display: flex;
|
|
252
252
|
user-select: none;
|
|
253
253
|
}
|
|
254
|
-
`,l([u({type:Number,reflect:!0})],ht.prototype,"tabindex",2),ht=l([g("qti-gap-img")],ht);var
|
|
254
|
+
`,l([u({type:Number,reflect:!0})],ht.prototype,"tabindex",2),ht=l([g("qti-gap-img")],ht);var lo=x`
|
|
255
255
|
:host {
|
|
256
256
|
display: flex;
|
|
257
257
|
align-items: flex-start;
|
|
@@ -285,10 +285,10 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
285
285
|
border-radius: 0.3rem;
|
|
286
286
|
gap: 0.5rem;
|
|
287
287
|
}
|
|
288
|
-
`;var
|
|
288
|
+
`;var Kt=class extends oe(R,"qti-gap-text","qti-gap","slot[part='drags']"){render(){return h`<slot name="prompt"> </slot>
|
|
289
289
|
<slot part="drags" name="drags"></slot>
|
|
290
290
|
<slot part="drops"></slot>
|
|
291
|
-
<div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(n=>{let a=n.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(n=>{let a=n.getAttribute("identifier"),c=t.find(p=>p.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${c}"]`)?.textContent.trim();if(c&&d){if(!n.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",n.insertAdjacentElement("afterend",p)}}else n.nextElementSibling?.classList.contains("correct-option")&&n.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}};
|
|
291
|
+
<div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(n=>{let a=n.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(n=>{let a=n.getAttribute("identifier"),c=t.find(p=>p.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${c}"]`)?.textContent.trim();if(c&&d){if(!n.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",n.insertAdjacentElement("afterend",p)}}else n.nextElementSibling?.classList.contains("correct-option")&&n.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}};Kt.styles=lo,Kt=l([g("qti-gap-match-interaction")],Kt);var co={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function ae(o,r){class e extends o{constructor(...s){super(...s);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(s,n){this.tabIndex=n?-1:0,n&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${r}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${r}`,{bubbles:!0,composed:!0}))}_onKeyUp(s){s.altKey||s.code==="Space"&&(s.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${r}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return h`<slot></slot>`}}return l([u({type:String})],e.prototype,"identifier",2),l([u({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),l([u({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:co})],e.prototype,"disabled",2),l([u({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:co})],e.prototype,"readonly",2),l([M("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var ft=class extends ae(v,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return h`<slot></slot>`}};ft.styles=x`
|
|
292
292
|
:host {
|
|
293
293
|
display: inline-flex;
|
|
294
294
|
user-select: none;
|
|
@@ -298,7 +298,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
298
298
|
display: flex;
|
|
299
299
|
user-select: none;
|
|
300
300
|
}
|
|
301
|
-
`,l([u({type:Number,reflect:!0})],gt.prototype,"tabindex",2),gt=l([g("qti-gap")],gt);var Oe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ee=o=>(...r)=>({_$litDirective$:o,values:r}),le=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:wn}=H,
|
|
301
|
+
`,l([u({type:Number,reflect:!0})],gt.prototype,"tabindex",2),gt=l([g("qti-gap")],gt);var Oe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ee=o=>(...r)=>({_$litDirective$:o,values:r}),le=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:wn}=H,uo=o=>o===null||typeof o!="object"&&typeof o!="function";var mo=o=>o.strings===void 0,po=()=>document.createComment(""),bt=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(po(),i),n=t.insertBefore(po(),i);e=new wn(s,n,o,o.options)}else{let s=e._$AB.nextSibling,n=e._$AM,a=n!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==n._$AU&&e._$AP(c)}if(s!==i||a){let c=e._$AA;for(;c!==s;){let d=c.nextSibling;t.insertBefore(c,i),c=d}}}return e},Pe=(o,r,e=o)=>(o._$AI(r,e),o),_n={},ho=(o,r=_n)=>o._$AH=r,fo=o=>o._$AH,Wr=o=>{o._$AR(),o._$AA.remove()};var go=(o,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(o[i],i);return t},vt=ee(class extends le{constructor(o){if(super(o),o.type!==Oe.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],s=[],n=0;for(let a of o)i[n]=t?t(a,n):n,s[n]=e(a,n),n++;return{values:s,keys:i}}render(o,r,e){return this.dt(o,r,e).values}update(o,[r,e,t]){let i=fo(o),{values:s,keys:n}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=n,s;let a=this.ut??=[],c=[],d,p,m=0,f=i.length-1,b=0,y=s.length-1;for(;m<=f&&b<=y;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[b])c[b]=Pe(i[m],s[b]),m++,b++;else if(a[f]===n[y])c[y]=Pe(i[f],s[y]),f--,y--;else if(a[m]===n[y])c[y]=Pe(i[m],s[y]),bt(o,c[y+1],i[m]),m++,y--;else if(a[f]===n[b])c[b]=Pe(i[f],s[b]),bt(o,i[m],i[f]),f--,b++;else if(d===void 0&&(d=go(n,b,y),p=go(a,m,f)),d.has(a[m]))if(d.has(a[f])){let w=p.get(n[b]),k=w!==void 0?i[w]:null;if(k===null){let q=bt(o,i[m]);Pe(q,s[b]),c[b]=q}else c[b]=Pe(k,s[b]),bt(o,i[m],k),i[w]=null;b++}else Wr(i[f]),f--;else Wr(i[m]),m++;for(;b<=y;){let w=bt(o,c[y+1]);Pe(w,s[b]),c[b++]=w}for(;m<=f;){let w=i[m++];w!==null&&Wr(w)}return this.ut=n,ho(o,c),P}});function Ne(o,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,s=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(o){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[n,a,c]=r,d=n/i*100,p=a/s*100,m=c/i*100,f=c/s*100;t.style.left=d-m+"%",t.style.top=p-f+"%",t.style.width=2*m+"%",t.style.height=2*f+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[n,a,c,d]=r,p=n/i*100,m=a/s*100,f=c/i*100,b=d/s*100;t.style.left=p+"%",t.style.top=m+"%",t.style.width=f-p+"%",t.style.height=b-m+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[n,a,c,d]=r,p=n/i*100,m=a/s*100,f=c/i*100,b=d/s*100;t.style.left=p-f+"%",t.style.top=m-b+"%",t.style.width=2*f+"%",t.style.height=2*b+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let n=[];for(let q=0;q<r.length;q+=2)n.push({x:r[q],y:r[q+1]});let a=Math.min(...n.map(q=>q.x)),c=Math.max(...n.map(q=>q.x)),d=Math.min(...n.map(q=>q.y)),p=Math.max(...n.map(q=>q.y)),m=a/i*100,f=d/s*100,b=c/i*100,y=p/s*100;t.style.left=m+"%",t.style.top=f+"%",t.style.width=b-m+"%",t.style.height=y-f+"%";let k=n.map(q=>({x:(q.x-a)/(c-a)*100,y:(q.y-d)/(p-d)*100})).map(q=>`${q.x}% ${q.y}%`).join(",");t.style.clipPath=`polygon(${k})`}break;default:console.error(`Unsupported shape: ${o}`);break}}var bo=x`
|
|
302
302
|
slot:not([name='prompt']) {
|
|
303
303
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
304
304
|
display: block;
|
|
@@ -322,14 +322,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
322
322
|
top: 0px;
|
|
323
323
|
left: 0px;
|
|
324
324
|
}
|
|
325
|
-
`;var ce=class extends
|
|
325
|
+
`;var ce=class extends R{constructor(){super();this.startPoint=null;this.endPoint=null;this._correctLines=[];this._response=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._response=[],this._correctLines=[]}validate(){return this.response.length>0}set response(e){this._response=e}get response(){return this._response}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctLines=[];return}if(!t.correctResponse){console.error("No correct response found for this interaction.");return}let i=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];this._correctLines=i}render(){return h`<slot name="prompt"></slot>
|
|
326
326
|
<line-container>
|
|
327
327
|
<svg
|
|
328
328
|
width=${se(this.grImage[0]?.width)}
|
|
329
329
|
height=${se(this.grImage[0]?.height)}
|
|
330
330
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
331
331
|
>
|
|
332
|
-
${vt(this.response||[],e=>e,(e,t)=>
|
|
332
|
+
${vt(this.response||[],e=>e,(e,t)=>Ur`
|
|
333
333
|
<line
|
|
334
334
|
part="line"
|
|
335
335
|
x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
|
|
@@ -341,7 +341,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
341
341
|
@click=${i=>{i.stopPropagation(),this._response=this._response.filter((s,n)=>n!==t),this.saveResponse(this.response)}}
|
|
342
342
|
/>
|
|
343
343
|
`)}
|
|
344
|
-
${vt(this._correctLines||[],e=>e,(e,t)=>
|
|
344
|
+
${vt(this._correctLines||[],e=>e,(e,t)=>Ur`
|
|
345
345
|
<line
|
|
346
346
|
part="correct-line"
|
|
347
347
|
x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
|
|
@@ -353,7 +353,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
353
353
|
stroke-dasharray="5,5"
|
|
354
354
|
/>
|
|
355
355
|
`)}
|
|
356
|
-
${this.startPoint&&
|
|
356
|
+
${this.startPoint&&Ur`<line
|
|
357
357
|
part="point"
|
|
358
358
|
x1=${this.startCoord.x}
|
|
359
359
|
y1=${this.startCoord.y}
|
|
@@ -365,7 +365,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
365
365
|
</svg>
|
|
366
366
|
<slot></slot>
|
|
367
367
|
</line-container>
|
|
368
|
-
<div role="alert" part="message" id="validation-message"></div>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),n=i.getAttribute("shape"),a=s.split(",").map(c=>parseInt(c));
|
|
368
|
+
<div role="alert" part="message" id="validation-message"></div>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),n=i.getAttribute("shape"),a=s.split(",").map(c=>parseInt(c));Ne(n,a,t,i)}firstUpdated(){this.hotspots=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let i=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-i.left,y:e.clientY-i.top}}),this.hotspots.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.startPoint?this.endPoint||(this.endPoint=t.target,this._response=[...this.response,`${this.startPoint.getAttribute("identifier")} ${this.endPoint.getAttribute("identifier")}`],this.saveResponse(this.response),this.startPoint=null,this.endPoint=null):(this.startPoint=t.target,this.startCoord={x:parseInt(this.startPoint.getAttribute("coords").split(",")[0]),y:parseInt(this.startPoint.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};ce.styles=bo,l([E()],ce.prototype,"_correctLines",2),l([E()],ce.prototype,"startCoord",2),l([E()],ce.prototype,"mouseCoord",2),l([Gs({selector:"img"})],ce.prototype,"grImage",2),l([E()],ce.prototype,"_response",2),ce=l([g("qti-graphic-associate-interaction")],ce);var vo=x`
|
|
369
369
|
:host {
|
|
370
370
|
display: flex;
|
|
371
371
|
align-items: flex-start;
|
|
@@ -419,10 +419,10 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
419
419
|
user-select: none;
|
|
420
420
|
pointer-events: none;
|
|
421
421
|
}
|
|
422
|
-
`;var
|
|
422
|
+
`;var Zt=class extends oe(R,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){render(){return h` <slot name="prompt"></slot>
|
|
423
423
|
<slot part="image"></slot>
|
|
424
424
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
425
|
-
<div role="alert" part="message" id="validation-message"></div>`}positionHotspotOnRegister(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),s=t.split(",").map(n=>parseInt(n));switch(i){case"circle":{let[n,a,c]=s;e.style.left=n-c+"px",e.style.top=a-c+"px",e.style.width=e.style.height=2*c+"px"}break;case"rect":{let[n,a,c,d]=s;e.style.left=n+"px",e.style.top=a+"px",e.style.width=c-n+"px",e.style.height=d-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};
|
|
425
|
+
<div role="alert" part="message" id="validation-message"></div>`}positionHotspotOnRegister(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),s=t.split(",").map(n=>parseInt(n));switch(i){case"circle":{let[n,a,c]=s;e.style.left=n-c+"px",e.style.top=a-c+"px",e.style.width=e.style.height=2*c+"px"}break;case"rect":{let[n,a,c,d]=s;e.style.left=n+"px",e.style.top=a+"px",e.style.width=c-n+"px",e.style.height=d-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Zt.styles=vo,Zt=l([g("qti-graphic-gap-match-interaction")],Zt);var yo=x`
|
|
426
426
|
slot:not([name='prompt']) {
|
|
427
427
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
428
428
|
display: block;
|
|
@@ -433,17 +433,17 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
433
433
|
pointer-events: none;
|
|
434
434
|
user-select: none;
|
|
435
435
|
}
|
|
436
|
-
`;var
|
|
436
|
+
`;var Qt=class extends Le(R,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return h`
|
|
437
437
|
<slot name="prompt"></slot>
|
|
438
438
|
<slot></slot>
|
|
439
439
|
<div role="alert" part="message" id="validation-message"></div>
|
|
440
|
-
`}setHotspotOrder(e){let{identifier:t}=e.detail,i=this._choiceElements.find(n=>n.getAttribute("identifier")===t);if(!i)return;let s=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){let n=this._choiceElements.filter(a=>a.order!=null).length;if(n>=s){this.choiceOrdering=!1;return}i.order=n+1}else{let n=i.order;i.order=null,this._choiceElements.forEach(a=>{a.order!=null&&a.order>n&&a.order--})}this.choiceOrdering=!1}}toggleCorrectResponse(e){let t=this.responseVariable,i=this._choiceElements;for(let s of i)if(e&&t?.correctResponse?.length>0&&Array.isArray(t.correctResponse)){let n=t.correctResponse.findIndex(a=>a===s.identifier);n>=0?s.orderCorrect=n+1:s.orderCorrect=null}else s.orderCorrect=null}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),n=i.getAttribute("shape"),a=s.split(",").map(c=>parseInt(c));
|
|
440
|
+
`}setHotspotOrder(e){let{identifier:t}=e.detail,i=this._choiceElements.find(n=>n.getAttribute("identifier")===t);if(!i)return;let s=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){let n=this._choiceElements.filter(a=>a.order!=null).length;if(n>=s){this.choiceOrdering=!1;return}i.order=n+1}else{let n=i.order;i.order=null,this._choiceElements.forEach(a=>{a.order!=null&&a.order>n&&a.order--})}this.choiceOrdering=!1}}toggleCorrectResponse(e){let t=this.responseVariable,i=this._choiceElements;for(let s of i)if(e&&t?.correctResponse?.length>0&&Array.isArray(t.correctResponse)){let n=t.correctResponse.findIndex(a=>a===s.identifier);n>=0?s.orderCorrect=n+1:s.orderCorrect=null}else s.orderCorrect=null}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,s=i.getAttribute("coords"),n=i.getAttribute("shape"),a=s.split(",").map(c=>parseInt(c));Ne(n,a,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};Qt.styles=yo,Qt=l([g("qti-graphic-order-interaction")],Qt);var Qe=class extends ae(v,"qti-hotspot-choice"){};Qe.styles=x`
|
|
441
441
|
:host {
|
|
442
442
|
display: flex;
|
|
443
443
|
user-select: none;
|
|
444
444
|
position: absolute;
|
|
445
445
|
}
|
|
446
|
-
`,l([u({attribute:"aria-ordervalue",type:Number,reflect:!0})],Qe.prototype,"order",2),l([u({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Qe.prototype,"orderCorrect",2),Qe=l([g("qti-hotspot-choice")],Qe);var
|
|
446
|
+
`,l([u({attribute:"aria-ordervalue",type:Number,reflect:!0})],Qe.prototype,"order",2),l([u({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Qe.prototype,"orderCorrect",2),Qe=l([g("qti-hotspot-choice")],Qe);var xo=x`
|
|
447
447
|
slot:not([name='prompt']) {
|
|
448
448
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
449
449
|
display: block;
|
|
@@ -455,17 +455,17 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
455
455
|
user-select: none;
|
|
456
456
|
/* width:100%; */
|
|
457
457
|
}
|
|
458
|
-
`;var
|
|
458
|
+
`;var er=class extends Le(R,"qti-hotspot-choice"){render(){return h`
|
|
459
459
|
<slot name="prompt"></slot>
|
|
460
460
|
<slot></slot>
|
|
461
|
-
`}positionHotspotOnRegister(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),s=t.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));
|
|
462
|
-
<div part="message" role="alert" id="validation-message"></div>`}get classObject(){let e={"qti-input-control-hidden":!0};return this.class&&this.class.split(" ").forEach(t=>{t.trim()&&(e[t.trim()]=!0)}),e}connectedCallback(){super.connectedCallback(),this.updateHostClasses()}updated(e){super.updated(e),this.updateHostClasses()}updateHostClasses(){let e=Object.keys(this.classObject).join(" ");this.className=e}};l([u({type:String,reflect:!0})],
|
|
463
|
-
<slot></slot> `}};
|
|
461
|
+
`}positionHotspotOnRegister(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),s=t.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));Ne(s,n,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};er.styles=xo,er=l([g("qti-hotspot-interaction")],er);var tr=class extends Le(R,"qti-hottext"){constructor(){super(...arguments);this.class="";this.render=()=>h`<slot></slot>
|
|
462
|
+
<div part="message" role="alert" id="validation-message"></div>`}get classObject(){let e={"qti-input-control-hidden":!0};return this.class&&this.class.split(" ").forEach(t=>{t.trim()&&(e[t.trim()]=!0)}),e}connectedCallback(){super.connectedCallback(),this.updateHostClasses()}updated(e){super.updated(e),this.updateHostClasses()}updateHostClasses(){let e=Object.keys(this.classObject).join(" ");this.className=e}};l([u({type:String,reflect:!0})],tr.prototype,"class",2),tr=l([g("qti-hottext-interaction")],tr);var rr=class extends ae(v,"qti-hottext"){render(){return h`<div part="ch"><div part="cha"></div></div>
|
|
463
|
+
<slot></slot> `}};rr.styles=x`
|
|
464
464
|
:host {
|
|
465
465
|
display: flex;
|
|
466
466
|
user-select: none;
|
|
467
467
|
}
|
|
468
|
-
`,
|
|
468
|
+
`,rr=l([g("qti-hottext")],rr);var ir=class extends le{constructor(r){if(super(r),this.it=S,r.type!==Oe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===S||r==null)return this._t=void 0,this.it=r;if(r===P)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ir.directiveName="unsafeHTML",ir.resultType=1;var yt=ee(ir);var ye=class extends R{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt=""}get isInline(){return!0}static get styles(){return[x`
|
|
469
469
|
:host {
|
|
470
470
|
display: inline-block;
|
|
471
471
|
}
|
|
@@ -495,15 +495,15 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
495
495
|
</select>
|
|
496
496
|
|
|
497
497
|
${yt(this.correctOption)}
|
|
498
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("on-dropdown-selected",this.choiceSelected)}willUpdate(e){(e.has("configContext")||e.has("dataPrompt"))&&this._updateOptions()}_updateOptions(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select";this.options=[{textContent:t,value:"",selected:!1},...e.map(i=>({textContent:i.innerHTML,value:i.getAttribute("identifier"),selected:!1}))]}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set response(e){this.options=this.options.map(t=>(e&&e===t.value&&(t.selected=!0),t))}get response(){return this.options.find(e=>e.selected)?.value||null}toggleInternalCorrectResponse(e){if(this.correctResponse=e&&this.responseVariable?.correctResponse?.toString(),!this.correctResponse){this.correctOption="";return}this.correctOption=`<span part="correct-option" style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block">${this.options.find(t=>this.correctResponse===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(i=>({...i,selected:i.value===t})),this.saveResponse(t)}};ye.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],l([E()],ye.prototype,"options",2),l([E()],ye.prototype,"correctOption",2),l([u({attribute:"data-prompt",type:String})],ye.prototype,"dataPrompt",2),l([_({context:ne,subscribe:!0}),u({attribute:!1})],ye.prototype,"configContext",2),ye=l([g("qti-inline-choice-interaction")],ye);var
|
|
498
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("on-dropdown-selected",this.choiceSelected)}willUpdate(e){(e.has("configContext")||e.has("dataPrompt"))&&this._updateOptions()}_updateOptions(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select";this.options=[{textContent:t,value:"",selected:!1},...e.map(i=>({textContent:i.innerHTML,value:i.getAttribute("identifier"),selected:!1}))]}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set response(e){this.options=this.options.map(t=>(e&&e===t.value&&(t.selected=!0),t))}get response(){return this.options.find(e=>e.selected)?.value||null}toggleInternalCorrectResponse(e){if(this.correctResponse=e&&this.responseVariable?.correctResponse?.toString(),!this.correctResponse){this.correctOption="";return}this.correctOption=`<span part="correct-option" style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block">${this.options.find(t=>this.correctResponse===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(i=>({...i,selected:i.value===t})),this.saveResponse(t)}};ye.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],l([E()],ye.prototype,"options",2),l([E()],ye.prototype,"correctOption",2),l([u({attribute:"data-prompt",type:String})],ye.prototype,"dataPrompt",2),l([_({context:ne,subscribe:!0}),u({attribute:!1})],ye.prototype,"configContext",2),ye=l([g("qti-inline-choice-interaction")],ye);var sr=class extends v{static get styles(){return[x`
|
|
499
499
|
:host {
|
|
500
500
|
display: block;
|
|
501
501
|
cursor: pointer;
|
|
502
502
|
}
|
|
503
|
-
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return h` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};l([u({type:String})],
|
|
503
|
+
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return h` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};l([u({type:String})],sr.prototype,"identifier",2),sr=l([g("qti-inline-choice")],sr);var Ve=class extends ae(v,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return h`
|
|
504
504
|
<slot part="slot"></slot>
|
|
505
505
|
<slot part="dropslot" name="qti-simple-associable-choice"></slot>
|
|
506
|
-
`}};
|
|
506
|
+
`}};Ve.styles=x`
|
|
507
507
|
:host {
|
|
508
508
|
display: flex;
|
|
509
509
|
user-select: none;
|
|
@@ -515,7 +515,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
515
515
|
slot[name='qti-simple-associable-choice'] {
|
|
516
516
|
width: auto;
|
|
517
517
|
}
|
|
518
|
-
`,l([u({type:Number,attribute:"match-min"})],
|
|
518
|
+
`,l([u({type:Number,attribute:"match-min"})],Ve.prototype,"matchMin",2),l([u({type:Number,attribute:"match-max"})],Ve.prototype,"matchMax",2),l([u({type:String,attribute:"fixed",converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],Ve.prototype,"fixed",2),Ve=l([g("qti-simple-associable-choice")],Ve);var qo=x`
|
|
519
519
|
slot:not([hidden]) {
|
|
520
520
|
/* slot where the */
|
|
521
521
|
display: flex;
|
|
@@ -541,7 +541,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
541
541
|
/* Make sure the drag and drop container slots have the same width */
|
|
542
542
|
flex: 1;
|
|
543
543
|
}
|
|
544
|
-
`;var xe=class extends oe(
|
|
544
|
+
`;var xe=class extends oe(R,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=null;this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,s=t.name,n=t.type;t.checked?(this.response?this.response.indexOf(i)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(a=>a.indexOf(s)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=t):(this.response=(this.response||[]).filter(a=>a!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getMatches(e){if(!e.correctResponse)return[];let t=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse],i=[];return t&&t.forEach(s=>{let n=s.split(" ");i.push({source:n[0],target:n[1]})}),i}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!t?.correctResponse){this.querySelectorAll(".correct-option").forEach(s=>s.remove());return}let i=this.getMatches(t);this.class.split(" ").includes("qti-match-tabular")?e?this.correctOptions=i||[]:this.correctOptions=null:e?(this.querySelectorAll(".correct-option").forEach(s=>s.remove()),this.targetChoices.forEach(s=>{let n=s.getAttribute("identifier"),a=i.find(c=>c.target===n);if(a?.source){let d=this.querySelector(`qti-simple-associable-choice[identifier="${a.source}"]`)?.textContent?.trim();if(d&&!s.previousElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",s.insertAdjacentElement("beforebegin",p)}}})):this.correctOptions=null}toggleCandidateCorrection(e){let t=this.responseVariable;if(!t?.correctResponse)return;let i=this.getMatches(t);this.targetChoices.forEach(s=>{let n=s.getAttribute("identifier"),a=i.filter(d=>d.target===n);s.querySelectorAll("qti-simple-associable-choice").forEach(d=>{if(d.internals.states.delete("candidate-correct"),d.internals.states.delete("candidate-incorrect"),!e)return;a.find(m=>m.source===d.identifier)?.source!==void 0?d.internals.states.add("candidate-correct"):d.internals.states.add("candidate-incorrect")})})}render(){let e=this.class.split(" ").includes("qti-match-tabular"),t=this.correctOptions!==null;return h`
|
|
545
545
|
<slot name="prompt"></slot>
|
|
546
546
|
<slot ?hidden=${e}></slot>
|
|
547
547
|
|
|
@@ -584,8 +584,8 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
584
584
|
`:S}
|
|
585
585
|
|
|
586
586
|
<div role="alert" part="message" id="validation-message"></div>
|
|
587
|
-
`}};xe.styles=
|
|
588
|
-
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};
|
|
587
|
+
`}};xe.styles=qo,l([u({type:String})],xe.prototype,"class",2),l([E()],xe.prototype,"_response",2),l([u({type:String,attribute:"response-identifier"})],xe.prototype,"responseIdentifier",2),l([E()],xe.prototype,"correctOptions",2),xe=l([g("qti-match-interaction")],xe);var or=class extends R{constructor(){super();this._value=null}reset(){}validate(){return!0}get response(){return this._value?this._value.toString():null}set response(e){if(e)if(!isNaN(parseInt(e?.toString())))this._value=parseInt(e.toString());else throw new Error(`Value must be a number ${e}`)}static get properties(){return{...R.properties,step:{type:Number,attribute:"step",default:10}}}render(){return h` <slot name="prompt"></slot>
|
|
588
|
+
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};or.styles=[x``],or=l([g("qti-media-interaction")],or);var Eo=x`
|
|
589
589
|
[part='drags'] {
|
|
590
590
|
display: flex;
|
|
591
591
|
align-items: flex-start;
|
|
@@ -634,17 +634,17 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
634
634
|
:host(.qti-choices-right) [part='container'] {
|
|
635
635
|
flex-direction: row-reverse;
|
|
636
636
|
}
|
|
637
|
-
`;var qe=class extends oe(
|
|
637
|
+
`;var qe=class extends oe(R,"qti-simple-choice","drop-list","slot[part='drags']"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
|
|
638
638
|
<div part="container">
|
|
639
639
|
<slot part="drags"> </slot>
|
|
640
640
|
<div part="drops">
|
|
641
641
|
${[...Array(this.nrChoices)].map((t,i)=>h`<drop-list role="region" part="drop-list" identifier="droplist${i}"></drop-list>`)}
|
|
642
642
|
</div>
|
|
643
|
-
</div>`}toggleCorrectResponse(e){let t=this.responseVariable;if(this.shadowRoot.querySelectorAll(".correct-option").forEach(i=>i.remove()),e&&t?.correctResponse){let s=(Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse]).map(c=>c.split(" ")[0]),n=new Set;this.querySelectorAll("qti-simple-choice").forEach((c,d)=>{let p=c.getAttribute("identifier");if(!p||!s.includes(p)||n.has(p))return;n.add(p);let m=c.textContent?.trim();if(!m)return;let f=this.shadowRoot.querySelector(`drop-list[identifier="droplist${d}"]`);if(!f)return;let b=document.createElement("span");b.classList.add("correct-option"),b.textContent=m,b.style.border="1px solid var(--qti-correct)",b.style.borderRadius="4px",b.style.padding="2px 4px",b.style.display="inline-block",b.style.marginTop="4px",f.insertAdjacentElement("afterend",b)})}}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let s=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(s).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};qe.styles=
|
|
643
|
+
</div>`}toggleCorrectResponse(e){let t=this.responseVariable;if(this.shadowRoot.querySelectorAll(".correct-option").forEach(i=>i.remove()),e&&t?.correctResponse){let s=(Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse]).map(c=>c.split(" ")[0]),n=new Set;this.querySelectorAll("qti-simple-choice").forEach((c,d)=>{let p=c.getAttribute("identifier");if(!p||!s.includes(p)||n.has(p))return;n.add(p);let m=c.textContent?.trim();if(!m)return;let f=this.shadowRoot.querySelector(`drop-list[identifier="droplist${d}"]`);if(!f)return;let b=document.createElement("span");b.classList.add("correct-option"),b.textContent=m,b.style.border="1px solid var(--qti-correct)",b.style.borderRadius="4px",b.style.padding="2px 4px",b.style.display="inline-block",b.style.marginTop="4px",f.insertAdjacentElement("afterend",b)})}}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let s=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(s).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};qe.styles=Eo,l([E()],qe.prototype,"nrChoices",2),l([E()],qe.prototype,"correctResponses",2),l([E()],qe.prototype,"showCorrectResponses",2),l([u({type:String})],qe.prototype,"orientation",2),qe=l([g("qti-order-interaction")],qe);var Co=x`
|
|
644
644
|
::slotted(qti-interaction-markup) {
|
|
645
645
|
display: none;
|
|
646
646
|
}
|
|
647
|
-
`;var z=class extends k{constructor(){super(...arguments);this._iframeLoaded=!1;this._pendingMessages=[];this._responseCheckInterval=null;this.requirePathsJson="";this.requireShimJson="";this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";this.baseUrl="";this.useIframe=!1;this.useDefaultShims=!1;this.useDefaultPaths=!1;this._errorMessage=null;this.response=[];this._parsedRequirePaths=null;this._parsedRequireShim=null;this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe"))switch(t.method){case"iframeReady":this.initializeInteraction(),this.processPendingMessages(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"interactionChanged":{let i=this.convertQtiVariableJSON(t.params.value);this.response=i,this.validate(),this.saveResponse(this.response);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}};this._onInteractionChanged=e=>{e.stopPropagation();let t=this.convertQtiVariableJSON(e.detail.value);this.response=t,this.saveResponse(t)};this.loadConfig=async(e,t)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)t&&(n.paths[a]=this.getResolvablePath(n.paths[a],t));return n}}catch{}return null};this.getResolvablePathString=(e,t)=>(e=e.replace(/\.js$/,""),e?.toLocaleLowerCase().startsWith("http")||!t?e:this.removeDoubleSlashes(`${t}/${e}`));this.getResolvablePath=(e,t)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,t)):this.getResolvablePathString(e,t);this._previousState=null}getRequirePaths(){if(this._parsedRequirePaths===null&&this.requirePathsJson)try{let e=JSON.parse(this.requirePathsJson);Array.isArray(e)?(this._parsedRequirePaths={},e.forEach(t=>{t.name&&t.value&&(this._parsedRequirePaths[t.name]=t.value)})):this._parsedRequirePaths=e}catch(e){console.error("Error parsing require paths JSON:",e),this._errorMessage=`Error parsing require paths JSON: ${e.message}`,this._parsedRequirePaths={}}return this._parsedRequirePaths||{}}getRequireShim(){if(this._parsedRequireShim===null&&this.requireShimJson)try{this._parsedRequireShim=JSON.parse(this.requireShimJson)}catch(e){console.error("Error parsing require shim JSON:",e),this._errorMessage=`Error parsing require shim JSON: ${e.message}`,this._parsedRequireShim={}}return this._parsedRequireShim||{}}getDefaultRequirePaths(){return{"taoQtiItem/portableLib/OAT/util/event":"/assets/pci-scripts/portableLib/OAT/util/event","taoQtiItem/portableLib/OAT/util/html":"/assets/pci-scripts/portableLib/OAT/util/html","taoQtiItem/portableLib/OAT/util/EventMgr":"/assets/pci-scripts/portableLib/OAT/util/EventMgr","taoQtiItem/portableLib/OAT/util/math":"/assets/pci-scripts/portableLib/OAT/util/math","taoQtiItem/portableLib/OAT/util/xml":"/assets/pci-scripts/portableLib/OAT/util/xml","taoQtiItem/portableLib/OAT/util/tooltip":"/assets/pci-scripts/portableLib/OAT/util/tooltip","taoQtiItem/portableLib/jquery_2_1_1":"/assets/pci-scripts/portableLib/jquery_2_1_1","taoQtiItem/pci-scripts/portableLib/jquery.qtip":"/assets/portableLib/jquery.qtip","taoQtiItem/pci-scripts/portableLib/lodash":"/assets/pci-scripts/portableLib/lodash","taoQtiItem/pci-scripts/portableLib/raphael":"/assets/pci-scripts/portableLib/raphael","IMSGlobal/jquery_2_1_1":"/assets/pci-scripts/IMSGlobal/jquery_2_1_1","OAT/util/event":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/event","OAT/util/html":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/html","OAT/util/EventMgr":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/EventMgr","OAT/util/math":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/math","OAT/util/xml":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/xml","OAT/util/tooltip":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/tooltip","OAT/lodash":"/assets/pci-scripts/legacyPortableSharedLib/lodash",mathJax:"/assets/pci-scripts/mathjax/mathJax",css:"/assets/pci-scripts/css/css"}}getDefaultRequireShim(){return{mathJax:{exports:"MathJax",init:function(){let e=window;if(e.MathJax)return e.MathJax.Hub.Config({showMathMenu:!1,showMathMenuMSIE:!1,menuSettings:{inTabOrder:!1}}),e.MathJax.Hub.Startup.MenuZoom=function(){},e.MathJax.Hub.Startup.onload(),e.MathJax}}}}getFinalRequirePaths(){let e=this.getDefaultRequirePaths(),t=this.getRequirePaths();return this.useDefaultPaths?{...e,...t}:t}getFinalRequireShim(){let e=this.getRequireShim(),t=this.getDefaultRequireShim();return this.useDefaultShims?{...t,...e}:e}convertQtiVariableJSON(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let s in i)if(i.hasOwnProperty(s)){let n=i[s];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}addHyphenatedKeys(e){let t={...e};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let s=i.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);t[s]=e[i]}return t}responseVariablesToQtiVariableJSON(e,t,i){if(t!=="single"){let s={list:{}};return s.list[i]=e,s}else{let s={base:{}};return s.base[i]=e,s}}validate(){return!0}set value(e){e===null?this._value=[]:this._value=Array.isArray(e)?e:e.split(",")}get value(){if(this.useIframe)return this._value?.toString()||null;{let e=this.pci?.getResponse();if(e){let t=this.convertQtiVariableJSON(e);return Array.isArray(t)?t.join(","):t}}return Array.isArray(this._value)?this._value.join(","):this._value?.toString()||null}set boundTo(e){if(!e||!e[this.responseIdentifier])return;let t=this.convertQtiVariableJSON(e[this.responseIdentifier]);this._value=t,this.saveResponse(t)}get boundTo(){let e={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(c=>c.identifier===this.responseIdentifier)?.cardinality||"single",s=this.context?.variables?.find(c=>c.identifier===this.responseIdentifier)?.baseType||"string",n=this.context?.variables?.find(c=>c.identifier===this.responseIdentifier)?.value||null,a=this.responseVariablesToQtiVariableJSON(n,i,s);e[this.responseIdentifier]=a}return e}unescapeHtml(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}unescapeDataAttributes(e){let t={};for(let[i,s]of Object.entries(e))typeof s=="string"?t[i]=this.unescapeHtml(s):t[i]=s;return t}register(e){this.pci=e,this.dom=this.querySelector("qti-interaction-markup"),this.dom||(this.dom=document.createElement("div"),this.appendChild(this.dom)),this.dom.classList.add("qti-customInteraction"),this.dom.style.width="100%",this.dom.style.minHeight="50px",this.dom.style.display="block",this.dom.addEventListener("qti-interaction-changed",this._onInteractionChanged),this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let t={properties:this.addHyphenatedKeys(this.unescapeDataAttributes({...this.dataset})),contextVariables:{},templateVariables:{},onready:i=>{this.pci=i;try{let s=new ResizeObserver(n=>{for(let a of n)a.contentRect&&a.contentRect.height>0&&(this.style.height=`${a.contentRect.height+20}px`)});s.observe(this.dom),this._resizeObserver=s}catch{console.warn("ResizeObserver not supported, falling back to static sizing")}},ondone:(i,s,n,a)=>{this.response=this.convertQtiVariableJSON(s),this.saveResponse(this.response)},responseIdentifier:this.responseIdentifier,boundTo:this.boundTo};if(e.getInstance)e.getInstance(this.dom,t,void 0);else{let s=(n=>{let a={},d=(p=>{let m={};Object.entries(p.dataset).forEach(([b,y])=>{b.includes("__")||(m[b]=y)});let f={};return Object.entries(p.dataset).forEach(([b,y])=>{let w=b.split("__");if(w.length>1){let[R,q,A]=w;f[R]=f[R]||{},f[R][q]=f[R][q]||{},f[R][q][A]=y}}),Object.entries(f).forEach(([b,y])=>{m[b]=Object.values(y)}),m})(n);for(let p in d)if(Object.prototype.hasOwnProperty.call(d,p)){let m=d[p];p==="config"?a[p]=JSON.parse(m):a[p]=m}return a})(this);e.initialize(this.customInteractionTypeIdentifier,this.dom.firstElementChild||this.dom,Object.keys(s).length?s:null)}}disconnectedCallback(){if(super.disconnectedCallback(),this.useIframe)window.removeEventListener("message",this.handleIframeMessage);else{this.stopResponseCheck(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.removeEventListener("qti-interaction-changed",this._onInteractionChanged)}}sendMessageToIframe(e,t){if(!this._iframeLoaded){this._pendingMessages.push({method:e,params:t});return}this.iframe.contentWindow.postMessage({source:"qti-portable-custom-interaction",method:e,params:t},"*")}processPendingMessages(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}createIframe(){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.addMarkupToIframe(),this.sendIframeInitData()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent(),i=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${i}`,this.appendChild(this.iframe)}sendIframeInitData(){let e={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:Ke(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,dataAttributes:{...this.dataset},interactionModules:this.getInteractionModules(),boundTo:this.boundTo};this.sendMessageToIframe("initialize",e)}getInteractionModules(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let i=t.querySelectorAll("qti-interaction-module");for(let s of i)e.push({id:s.getAttribute("id"),primaryPath:s.getAttribute("primary-path"),fallbackPath:s.getAttribute("fallback-path")})}return e}addMarkupToIframe(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=this.querySelector("properties");t&&this.sendMessageToIframe("setProperties",t.innerHTML)}initializeInteraction(){}connectedCallback(){if(super.connectedCallback(),this.useIframe)window.addEventListener("message",this.handleIframeMessage),this.createIframe();else{define("qtiCustomInteractionContext",()=>({register:t=>{this.register(t)},notifyReady:()=>{}}));let e=this.buildRequireConfig();if(e){let t=requirejs.config(e);requirejs.onError=function(i){throw console.error("RequireJS error:",i),i.requireType==="timeout"&&console.error("Modules that timed out:",i.requireModules),i},t(["require"],i=>{try{i([this.module],()=>{},s=>{console.error("Error loading module:",s)})}catch(s){console.error("Error in require call:",s)}})}}}stopResponseCheck(){this._responseCheckInterval!==null&&(window.clearInterval(this._responseCheckInterval),this._responseCheckInterval=null)}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:{...this.getFinalRequirePaths(),...window.requirePaths||{}},shim:{...this.getFinalRequireShim(),...window.requireShim||{}}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let t=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let s=i.querySelectorAll("qti-interaction-module");for(let n of s){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),d=n.getAttribute("fallback-path");if(a&&c){let p=d?this.combineRequireResolvePaths(this.getResolvablePath(c,t),this.getResolvablePath(d,t)):this.getResolvablePath(c,t),m=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(m,p)}}}return e}combineRequireResolvePaths(e,t){let i=Array.isArray(e)?e:[e],s=Array.isArray(t)?t:[t];return i.concat(s).filter((n,a,c)=>c.indexOf(n)===a)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}generateIframeContent(){let e=window.getComputedStyle(document.body),t=JSON.stringify(this.getFinalRequirePaths()),i=JSON.stringify(this.getFinalRequireShim()),s=`
|
|
647
|
+
`;var z=class extends R{constructor(){super(...arguments);this._iframeLoaded=!1;this._pendingMessages=[];this._responseCheckInterval=null;this.requirePathsJson="";this.requireShimJson="";this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js";this.baseUrl="";this.useIframe=!1;this.useDefaultShims=!1;this.useDefaultPaths=!1;this._errorMessage=null;this.response=[];this._parsedRequirePaths=null;this._parsedRequireShim=null;this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe"))switch(t.method){case"iframeReady":this.initializeInteraction(),this.processPendingMessages(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"interactionChanged":{let i=this.convertQtiVariableJSON(t.params.value);this.response=i,this.validate(),this.saveResponse(this.response);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}};this._onInteractionChanged=e=>{e.stopPropagation();let t=this.convertQtiVariableJSON(e.detail.value);this.response=t,this.saveResponse(t)};this.loadConfig=async(e,t)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)t&&(n.paths[a]=this.getResolvablePath(n.paths[a],t));return n}}catch{}return null};this.getResolvablePathString=(e,t)=>(e=e.replace(/\.js$/,""),e?.toLocaleLowerCase().startsWith("http")||!t?e:this.removeDoubleSlashes(`${t}/${e}`));this.getResolvablePath=(e,t)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,t)):this.getResolvablePathString(e,t);this._previousState=null}getRequirePaths(){if(this._parsedRequirePaths===null&&this.requirePathsJson)try{let e=JSON.parse(this.requirePathsJson);Array.isArray(e)?(this._parsedRequirePaths={},e.forEach(t=>{t.name&&t.value&&(this._parsedRequirePaths[t.name]=t.value)})):this._parsedRequirePaths=e}catch(e){console.error("Error parsing require paths JSON:",e),this._errorMessage=`Error parsing require paths JSON: ${e.message}`,this._parsedRequirePaths={}}return this._parsedRequirePaths||{}}getRequireShim(){if(this._parsedRequireShim===null&&this.requireShimJson)try{this._parsedRequireShim=JSON.parse(this.requireShimJson)}catch(e){console.error("Error parsing require shim JSON:",e),this._errorMessage=`Error parsing require shim JSON: ${e.message}`,this._parsedRequireShim={}}return this._parsedRequireShim||{}}getDefaultRequirePaths(){return{"taoQtiItem/portableLib/OAT/util/event":"/assets/pci-scripts/portableLib/OAT/util/event","taoQtiItem/portableLib/OAT/util/html":"/assets/pci-scripts/portableLib/OAT/util/html","taoQtiItem/portableLib/OAT/util/EventMgr":"/assets/pci-scripts/portableLib/OAT/util/EventMgr","taoQtiItem/portableLib/OAT/util/math":"/assets/pci-scripts/portableLib/OAT/util/math","taoQtiItem/portableLib/OAT/util/xml":"/assets/pci-scripts/portableLib/OAT/util/xml","taoQtiItem/portableLib/OAT/util/tooltip":"/assets/pci-scripts/portableLib/OAT/util/tooltip","taoQtiItem/portableLib/jquery_2_1_1":"/assets/pci-scripts/portableLib/jquery_2_1_1","taoQtiItem/pci-scripts/portableLib/jquery.qtip":"/assets/portableLib/jquery.qtip","taoQtiItem/pci-scripts/portableLib/lodash":"/assets/pci-scripts/portableLib/lodash","taoQtiItem/pci-scripts/portableLib/raphael":"/assets/pci-scripts/portableLib/raphael","IMSGlobal/jquery_2_1_1":"/assets/pci-scripts/IMSGlobal/jquery_2_1_1","OAT/util/event":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/event","OAT/util/html":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/html","OAT/util/EventMgr":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/EventMgr","OAT/util/math":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/math","OAT/util/xml":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/xml","OAT/util/tooltip":"/assets/pci-scripts/legacyPortableSharedLib/OAT/util/tooltip","OAT/lodash":"/assets/pci-scripts/legacyPortableSharedLib/lodash",mathJax:"/assets/pci-scripts/mathjax/mathJax",css:"/assets/pci-scripts/css/css"}}getDefaultRequireShim(){return{mathJax:{exports:"MathJax",init:function(){let e=window;if(e.MathJax)return e.MathJax.Hub.Config({showMathMenu:!1,showMathMenuMSIE:!1,menuSettings:{inTabOrder:!1}}),e.MathJax.Hub.Startup.MenuZoom=function(){},e.MathJax.Hub.Startup.onload(),e.MathJax}}}}getFinalRequirePaths(){let e=this.getDefaultRequirePaths(),t=this.getRequirePaths();return this.useDefaultPaths?{...e,...t}:t}getFinalRequireShim(){let e=this.getRequireShim(),t=this.getDefaultRequireShim();return this.useDefaultShims?{...t,...e}:e}convertQtiVariableJSON(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let s in i)if(i.hasOwnProperty(s)){let n=i[s];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}addHyphenatedKeys(e){let t={...e};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let s=i.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);t[s]=e[i]}return t}responseVariablesToQtiVariableJSON(e,t,i){if(t!=="single"){let s={list:{}};return s.list[i]=e,s}else{let s={base:{}};return s.base[i]=e,s}}validate(){return!0}set value(e){e===null?this._value=[]:this._value=Array.isArray(e)?e:e.split(",")}get value(){if(this.useIframe)return this._value?.toString()||null;{let e=this.pci?.getResponse();if(e){let t=this.convertQtiVariableJSON(e);return Array.isArray(t)?t.join(","):t}}return Array.isArray(this._value)?this._value.join(","):this._value?.toString()||null}set boundTo(e){if(!e||!e[this.responseIdentifier])return;let t=this.convertQtiVariableJSON(e[this.responseIdentifier]);this._value=t,this.saveResponse(t)}get boundTo(){let e={};if(this.context?.variables?.find(i=>i.identifier===this.responseIdentifier)){let i=this.context?.variables?.find(c=>c.identifier===this.responseIdentifier)?.cardinality||"single",s=this.context?.variables?.find(c=>c.identifier===this.responseIdentifier)?.baseType||"string",n=this.context?.variables?.find(c=>c.identifier===this.responseIdentifier)?.value||null,a=this.responseVariablesToQtiVariableJSON(n,i,s);e[this.responseIdentifier]=a}return e}unescapeHtml(e){return e&&e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}unescapeDataAttributes(e){let t={};for(let[i,s]of Object.entries(e))typeof s=="string"?t[i]=this.unescapeHtml(s):t[i]=s;return t}register(e){this.pci=e,this.dom=this.querySelector("qti-interaction-markup"),this.dom||(this.dom=document.createElement("div"),this.appendChild(this.dom)),this.dom.classList.add("qti-customInteraction"),this.dom.style.width="100%",this.dom.style.minHeight="50px",this.dom.style.display="block",this.dom.addEventListener("qti-interaction-changed",this._onInteractionChanged),this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let t={properties:this.addHyphenatedKeys(this.unescapeDataAttributes({...this.dataset})),contextVariables:{},templateVariables:{},onready:i=>{this.pci=i;try{let s=new ResizeObserver(n=>{for(let a of n)a.contentRect&&a.contentRect.height>0&&(this.style.height=`${a.contentRect.height+20}px`)});s.observe(this.dom),this._resizeObserver=s}catch{console.warn("ResizeObserver not supported, falling back to static sizing")}},ondone:(i,s,n,a)=>{this.response=this.convertQtiVariableJSON(s),this.saveResponse(this.response)},responseIdentifier:this.responseIdentifier,boundTo:this.boundTo};if(e.getInstance)e.getInstance(this.dom,t,void 0);else{let s=(n=>{let a={},d=(p=>{let m={};Object.entries(p.dataset).forEach(([b,y])=>{b.includes("__")||(m[b]=y)});let f={};return Object.entries(p.dataset).forEach(([b,y])=>{let w=b.split("__");if(w.length>1){let[k,q,T]=w;f[k]=f[k]||{},f[k][q]=f[k][q]||{},f[k][q][T]=y}}),Object.entries(f).forEach(([b,y])=>{m[b]=Object.values(y)}),m})(n);for(let p in d)if(Object.prototype.hasOwnProperty.call(d,p)){let m=d[p];p==="config"?a[p]=JSON.parse(m):a[p]=m}return a})(this);e.initialize(this.customInteractionTypeIdentifier,this.dom.firstElementChild||this.dom,Object.keys(s).length?s:null)}}disconnectedCallback(){if(super.disconnectedCallback(),this.useIframe)window.removeEventListener("message",this.handleIframeMessage);else{this.stopResponseCheck(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.removeEventListener("qti-interaction-changed",this._onInteractionChanged)}}sendMessageToIframe(e,t){if(!this._iframeLoaded){this._pendingMessages.push({method:e,params:t});return}this.iframe.contentWindow.postMessage({source:"qti-portable-custom-interaction",method:e,params:t},"*")}processPendingMessages(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}createIframe(){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.addMarkupToIframe(),this.sendIframeInitData()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent(),i=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${i}`,this.appendChild(this.iframe)}sendIframeInitData(){let e={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:Ke(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,dataAttributes:{...this.dataset},interactionModules:this.getInteractionModules(),boundTo:this.boundTo};this.sendMessageToIframe("initialize",e)}getInteractionModules(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let i=t.querySelectorAll("qti-interaction-module");for(let s of i)e.push({id:s.getAttribute("id"),primaryPath:s.getAttribute("primary-path"),fallbackPath:s.getAttribute("fallback-path")})}return e}addMarkupToIframe(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=this.querySelector("properties");t&&this.sendMessageToIframe("setProperties",t.innerHTML)}initializeInteraction(){}connectedCallback(){if(super.connectedCallback(),this.useIframe)window.addEventListener("message",this.handleIframeMessage),this.createIframe();else{define("qtiCustomInteractionContext",()=>({register:t=>{this.register(t)},notifyReady:()=>{}}));let e=this.buildRequireConfig();if(e){let t=requirejs.config(e);requirejs.onError=function(i){throw console.error("RequireJS error:",i),i.requireType==="timeout"&&console.error("Modules that timed out:",i.requireModules),i},t(["require"],i=>{try{i([this.module],()=>{},s=>{console.error("Error loading module:",s)})}catch(s){console.error("Error in require call:",s)}})}}}stopResponseCheck(){this._responseCheckInterval!==null&&(window.clearInterval(this._responseCheckInterval),this._responseCheckInterval=null)}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:{...this.getFinalRequirePaths(),...window.requirePaths||{}},shim:{...this.getFinalRequireShim(),...window.requireShim||{}}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let t=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let s=i.querySelectorAll("qti-interaction-module");for(let n of s){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),d=n.getAttribute("fallback-path");if(a&&c){let p=d?this.combineRequireResolvePaths(this.getResolvablePath(c,t),this.getResolvablePath(d,t)):this.getResolvablePath(c,t),m=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(m,p)}}}return e}combineRequireResolvePaths(e,t){let i=Array.isArray(e)?e:[e],s=Array.isArray(t)?t:[t];return i.concat(s).filter((n,a,c)=>c.indexOf(n)===a)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}generateIframeContent(){let e=window.getComputedStyle(document.body),t=JSON.stringify(this.getFinalRequirePaths()),i=JSON.stringify(this.getFinalRequireShim()),s=`
|
|
648
648
|
font-family: ${e.getPropertyValue("font-family")};
|
|
649
649
|
font-size: ${e.getPropertyValue("font-size")};
|
|
650
650
|
line-height: ${e.getPropertyValue("line-height")};
|
|
@@ -1071,7 +1071,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1071
1071
|
<h1>Error</h1>
|
|
1072
1072
|
${this._errorMessage}
|
|
1073
1073
|
</div>`:""}
|
|
1074
|
-
`}};z.styles=[
|
|
1074
|
+
`}};z.styles=[Co,x`
|
|
1075
1075
|
:host {
|
|
1076
1076
|
display: block;
|
|
1077
1077
|
width: 100%;
|
|
@@ -1093,24 +1093,24 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1093
1093
|
left: 50%;
|
|
1094
1094
|
transform: translateX(-50%);
|
|
1095
1095
|
}
|
|
1096
|
-
`]}};customElements.define("qti-position-object-interaction",Vi);var
|
|
1096
|
+
`]}};customElements.define("qti-position-object-interaction",Vi);var nr=class extends v{render(){return h`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(r){r.preventDefault();let e=r.clientX-this.startX,t=r.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=r.clientX,this.startY=r.clientY}firstUpdated(r){super.firstUpdated(r),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};nr.styles=[x`
|
|
1097
1097
|
:host {
|
|
1098
1098
|
display: inline-block;
|
|
1099
1099
|
position: relative;
|
|
1100
1100
|
}
|
|
1101
|
-
`],
|
|
1101
|
+
`],nr=l([g("qti-position-object-stage")],nr);var wo="important",Tn=" !"+wo,Di=ee(class extends le{constructor(o){if(super(o),o.type!==Oe.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((r,e)=>{let t=o[e];return t==null?r:r+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[r]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)r[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in r){let i=r[t];if(i!=null){this.ft.add(t);let s=typeof i=="string"&&i.endsWith(Tn);t.includes("-")||s?e.setProperty(t,s?i.slice(0,-11):i,s?wo:""):e[t]=i}}return P}});var F=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[n,...a]=e.split(","),c=a.map(Number);switch(n.toLowerCase()){case"circle":case"default":{let[d,p,m]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-d)**2+(s-p)**2)<=m}case"rect":{let[d,p,m,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=d&&i<=m&&s>=p&&s<=f}case"ellipse":{let[d,p,m,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let b=(i-d)**2/m**2,y=(s-p)**2/f**2;return b+y<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let d=[];for(let p=0;p<c.length;p+=2)d.push({x:c[p],y:c[p+1]});return this.isPointInPolygon({x:i,y:s},d)}default:return console.warn(`Unsupported shape type: ${n}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let n=e[i].x,a=e[i].y,c=e[s].x,d=e[s].y;a>r.y!=d>r.y&&r.x<(c-n)*(r.y-a)/(d-a)+n&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var de=class extends R{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=null;this._correctAreas=[];this._responseCorrection=[];this._imgElement=null;this._scaleX=1;this._scaleY=1;this._imageWidthOriginal=0;this._imageHeightOriginal=0;this._onImageClick=e=>{if(this.disabled)return;if(!this._imgElement){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.calculateScale();let t=this._imgElement.getBoundingClientRect(),i=(e.clientX-t.left)*this._scaleX,s=(e.clientY-t.top)*this._scaleY,n=`${i.toFixed()} ${s.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._onResize=()=>{this.calculateScale()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize)}get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(s=>F.isPointInArea(`${t.x} ${t.y}`,`${s.shape},${s.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,s=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let n=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];if(n.length===0||n.find(a=>a.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),s=n.map(a=>({shape:"circle",coords:a.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else s=i.areaMapEntries;this._correctAreas=s.map(n=>({coords:n.coords,shape:n.shape}))}updated(e){super.updated(e);let t=this._imgElement;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.calculateScale(),this.shadowRoot.querySelectorAll("div").forEach(i=>{let s=i.dataset.coord,n=i.dataset.shape;s&&n&&Ne(n,s.split(",").map(a=>+a),t,i)}))}render(){return h` <slot name="prompt"></slot>
|
|
1102
1102
|
<point-container>
|
|
1103
1103
|
${vt((this.response||[]).filter(e=>e),e=>e,(e,t)=>{let[i,s]=e.split(" ").map(Number),n=i/(this._imageWidthOriginal||1)*100,a=s/(this._imageHeightOriginal||1)*100,c=16,d=c/(this._imageWidthOriginal||1)*100,p=c/(this._imageHeightOriginal||1)*100,m="";return this._responseCorrection[t]===!0?m=" correct":this._responseCorrection[t]===!1&&(m=" incorrect"),h`
|
|
1104
1104
|
<button
|
|
1105
1105
|
part="point${m}"
|
|
1106
|
-
style=${
|
|
1106
|
+
style=${Di({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",transform:"translate(-50%, -50%)",left:`${n}%`,top:`${a}%`,width:`min(${d}%, 1rem)`,height:`min(${p}%, 1rem)`,minWidth:`min(${d}%, 1rem)`,minHeight:`min(${p}%, 1rem)`,borderRadius:"50%",background:"red"})}
|
|
1107
1107
|
aria-label="Remove point at ${e}"
|
|
1108
1108
|
?disabled=${this.disabled}
|
|
1109
1109
|
@click=${f=>{f.stopPropagation(),this.response=(this.response||[]).filter((b,y)=>y!==t),this.saveResponse(this.response)}}
|
|
1110
1110
|
></button>
|
|
1111
1111
|
`})}
|
|
1112
1112
|
${vt(this._correctAreas?.filter(e=>e)||[],e=>e,(e,t)=>h`<div
|
|
1113
|
-
style=${
|
|
1113
|
+
style=${Di({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
|
|
1114
1114
|
data-coord="${e.coords}"
|
|
1115
1115
|
alt=${`correct-response-${t+1}`}
|
|
1116
1116
|
data-shape="${e.shape}"
|
|
@@ -1152,7 +1152,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1152
1152
|
align-items: center;
|
|
1153
1153
|
justify-content: center;
|
|
1154
1154
|
}
|
|
1155
|
-
`,l([u({type:String,attribute:"template-identifier"})],Ee.prototype,"templateIdentifier",2),l([u({type:String,attribute:"show-hide"})],Ee.prototype,"showHide",2),l([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],Ee.prototype,"fixed",2),l([u({type:String,attribute:!1})],Ee.prototype,"marker",2),Ee=l([g("qti-simple-choice")],Ee);var
|
|
1155
|
+
`,l([u({type:String,attribute:"template-identifier"})],Ee.prototype,"templateIdentifier",2),l([u({type:String,attribute:"show-hide"})],Ee.prototype,"showHide",2),l([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],Ee.prototype,"fixed",2),l([u({type:String,attribute:!1})],Ee.prototype,"marker",2),Ee=l([g("qti-simple-choice")],Ee);var _o=x`
|
|
1156
1156
|
:host {
|
|
1157
1157
|
display: block;
|
|
1158
1158
|
--show-bounds: true;
|
|
@@ -1232,7 +1232,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1232
1232
|
text-align: center;
|
|
1233
1233
|
color: #6b7280; /* text-gray-500 */
|
|
1234
1234
|
}
|
|
1235
|
-
`;var Ce=class extends
|
|
1235
|
+
`;var Ce=class extends R{constructor(){super(...arguments);this._value=0;this._correctResponseNumber=null;this.min=0;this.max=100;this.step=1}validate(){return!0}connectedCallback(){super.connectedCallback(),this._updateValue(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this._value.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this._updateValue(t)}toggleCorrectResponse(e){let t=this.responseVariable;if(t?.correctResponse){if(e){this._correctResponse=t.correctResponse.toString();let i=parseFloat(t.correctResponse.toString());if(isNaN(i))this._correctResponseNumber=null;else{this._correctResponseNumber=i;let s=(this._correctResponseNumber-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}}else this._correctResponseNumber=null;this.requestUpdate()}}_updateValue(e){let t=this._value;if(this._value=Math.min(this.max,Math.max(this.min,e)),this._value===t)return;let i=(this._value-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return h`
|
|
1236
1236
|
<slot name="prompt"></slot>
|
|
1237
1237
|
<div id="slider" part="slider">
|
|
1238
1238
|
<div id="bounds" part="bounds">
|
|
@@ -1254,7 +1254,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1254
1254
|
`:null}
|
|
1255
1255
|
</div>
|
|
1256
1256
|
</div>
|
|
1257
|
-
`}_onMouseDown(e){this._startDrag(e.pageX);let t=s=>this._onDrag(s.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=s=>this._onDrag(s.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,s=Math.min(1,Math.max(0,i/t.width)),n=this.min+Math.round(s*(this.max-this.min)/this.step)*this.step;this._updateValue(n)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Ce.styles=
|
|
1257
|
+
`}_onMouseDown(e){this._startDrag(e.pageX);let t=s=>this._onDrag(s.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=s=>this._onDrag(s.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,s=Math.min(1,Math.max(0,i/t.width)),n=this.min+Math.round(s*(this.max-this.min)/this.step)*this.step;this._updateValue(n)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Ce.styles=_o,l([lt("#rail")],Ce.prototype,"_rail",2),l([u({type:Number,attribute:"lower-bound"})],Ce.prototype,"min",2),l([u({type:Number,attribute:"upper-bound"})],Ce.prototype,"max",2),l([u({type:Number,attribute:"step"})],Ce.prototype,"step",2),Ce=l([g("qti-slider-interaction")],Ce);var ar=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),ar(t,r);return!0},Xr=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},To=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),kn(r)}};function An(o){this._$AN!==void 0?(Xr(this),this._$AM=o,To(this)):this._$AM=o}function Rn(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)ar(t[s],!1),Xr(t[s]);else t!=null&&(ar(t,!1),Xr(t));else ar(this,o)}var kn=o=>{o.type==Oe.CHILD&&(o._$AP??=Rn,o._$AQ??=An)},xt=class extends le{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),To(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(ar(this,r),Xr(this))}setValue(r){if(mo(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ao=()=>new zi,zi=class{},Hi=new WeakMap,Bh=ee(class extends xt{render(o){return S}update(o,[r]){let e=r!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=r,this.ht=o.options?.host,this.rt(this.ct=o.element)),S}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let r=this.ht??globalThis,e=Hi.get(r);e===void 0&&(e=new WeakMap,Hi.set(r,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"?Hi.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 Ro=x`
|
|
1258
1258
|
:host {
|
|
1259
1259
|
display: inline-block;
|
|
1260
1260
|
}
|
|
@@ -1362,7 +1362,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1362
1362
|
bottom: 0;
|
|
1363
1363
|
}
|
|
1364
1364
|
}
|
|
1365
|
-
`;var J=class extends
|
|
1365
|
+
`;var J=class extends R{constructor(){super(...arguments);this.inputRef=Ao();this.response=null;this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}get value(){return this.response||null}set value(e){this.response=e||null}get correctness(){let e=this.responseVariable;if(!e||e.value===null)return null;if(e.mapping){let t=e.mapping.mapEntries.reduce((i,s)=>Math.max(s.mappedValue,i),0);for(let i of e.mapping.mapEntries){let s=i.mapKey,n=e.value;if(i.caseSensitive||(s=s.toLowerCase(),n=n.toLowerCase()),s===n)return i.mappedValue===t?"correct":i.mappedValue<=(e.mapping.defaultValue||0)?"incorrect":"partially-correct"}}return e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!0}validate(){if(!this._input)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),this._input.setCustomValidity(""),this._input.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),this._input.setCustomValidity(this.dataPatternmaskMessage));else{let e=this._input.checkValidity();this._internals.setValidity(e?{}:{customError:!1})}return this.response!==""&&this._input.checkValidity()}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(e&&t?.correctResponse){let i=t.correctResponse.toString();this._correctResponse=i}else this._correctResponse=null}render(){return h`
|
|
1366
1366
|
<input
|
|
1367
1367
|
part="input"
|
|
1368
1368
|
name="${this.responseIdentifier}"
|
|
@@ -1381,12 +1381,12 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1381
1381
|
?readonly="${this.readonly}"
|
|
1382
1382
|
/>
|
|
1383
1383
|
${this._correctResponse?h`<div part="correct">${this._correctResponse}</div>`:S}
|
|
1384
|
-
`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};J.styles=
|
|
1384
|
+
`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};J.styles=Ro,l([u({type:Number,attribute:"expected-length"})],J.prototype,"expectedLength",2),l([u({type:String,attribute:"pattern-mask"})],J.prototype,"patternMask",2),l([u({type:String,attribute:"placeholder-text"})],J.prototype,"placeholderText",2),l([u({type:String,attribute:"data-patternmask-message"})],J.prototype,"dataPatternmaskMessage",2),l([E()],J.prototype,"response",2),l([lt("input")],J.prototype,"_input",2),l([M("response",{waitUntilFirstUpdate:!0})],J.prototype,"_handleValueChange",2),J=l([g("qti-text-entry-interaction")],J);var lr=class extends R{constructor(){super(...arguments);this._file=null;this._base64=null}reset(){this._file=null,this._base64=null,this.saveResponse(null)}validate(){return this._base64!==null}get response(){return this._base64}set response(e){if(typeof e=="string")this._base64=e,this.saveResponse(e);else if(e===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...R.properties}}render(){return h`
|
|
1385
1385
|
<div>
|
|
1386
1386
|
<slot name="prompt"></slot>
|
|
1387
1387
|
<input type="file" @change="${this._onFileChange}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
1388
1388
|
</div>
|
|
1389
|
-
`}async _onFileChange(e){let t=e.target;t.files&&t.files.length>0&&(this._file=t.files[0],this._base64=await this._convertToBase64(this._file),this.saveResponse(this._base64),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this._base64}})))}_convertToBase64(e){return new Promise((t,i)=>{let s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>i(s.error),s.readAsDataURL(e)})}};
|
|
1389
|
+
`}async _onFileChange(e){let t=e.target;t.files&&t.files.length>0&&(this._file=t.files[0],this._base64=await this._convertToBase64(this._file),this.saveResponse(this._base64),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this._base64}})))}_convertToBase64(e){return new Promise((t,i)=>{let s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>i(s.error),s.readAsDataURL(e)})}};lr.styles=[x`
|
|
1390
1390
|
:host {
|
|
1391
1391
|
display: block;
|
|
1392
1392
|
margin: 1em 0;
|
|
@@ -1395,15 +1395,15 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1395
1395
|
display: block;
|
|
1396
1396
|
margin-top: 0.5em;
|
|
1397
1397
|
}
|
|
1398
|
-
`],
|
|
1398
|
+
`],lr=l([g("qti-upload-interaction")],lr);var ko=x`
|
|
1399
1399
|
:host {
|
|
1400
1400
|
display: block;
|
|
1401
1401
|
}
|
|
1402
|
-
`;var
|
|
1402
|
+
`;var cr=class extends v{render(){return h`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};cr.styles=ko,cr=l([g("qti-item-body")],cr);var dr=class extends v{render(){return h`<slot></slot>`}process(){let r=new Fi,e=[...this.children];r.process(e)}};dr.styles=[x`
|
|
1403
1403
|
:host {
|
|
1404
1404
|
display: none;
|
|
1405
1405
|
}
|
|
1406
|
-
`],
|
|
1406
|
+
`],dr=l([g("qti-outcome-processing")],dr);var Fi=class{process(r){for(let e of r)e.process()}};var Gr=class extends v{render(){return h`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};Gr=l([g("qti-prompt")],Gr);var So=`<qti-response-processing>
|
|
1407
1407
|
<qti-response-condition>
|
|
1408
1408
|
<qti-response-if>
|
|
1409
1409
|
<qti-match>
|
|
@@ -1420,7 +1420,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1420
1420
|
</qti-set-outcome-value>
|
|
1421
1421
|
</qti-response-else>
|
|
1422
1422
|
</qti-response-condition>
|
|
1423
|
-
</qti-response-processing>`,
|
|
1423
|
+
</qti-response-processing>`,Mo=`<qti-response-processing>
|
|
1424
1424
|
<qti-response-condition>
|
|
1425
1425
|
<qti-response-if>
|
|
1426
1426
|
<qti-is-null>
|
|
@@ -1436,7 +1436,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1436
1436
|
</qti-set-outcome-value>
|
|
1437
1437
|
</qti-response-else>
|
|
1438
1438
|
</qti-response-condition>
|
|
1439
|
-
</qti-response-processing>`,
|
|
1439
|
+
</qti-response-processing>`,Io=`<qti-response-processing>
|
|
1440
1440
|
<qti-response-condition>
|
|
1441
1441
|
<qti-response-if>
|
|
1442
1442
|
<qti-is-null>
|
|
@@ -1452,20 +1452,20 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1452
1452
|
</qti-set-outcome-value>
|
|
1453
1453
|
</qti-response-else>
|
|
1454
1454
|
</qti-response-condition>
|
|
1455
|
-
</qti-response-processing>`;var
|
|
1455
|
+
</qti-response-processing>`;var pr=class extends v{render(){return h`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let t of e)t.process()}firstUpdated(r){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString(Mo).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Io).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(So).firstElementChild.firstElementChild);break}}}fragmentFromString(r){return document.createRange().createContextualFragment(r)}};pr.styles=[x`
|
|
1456
1456
|
:host {
|
|
1457
1457
|
display: none;
|
|
1458
1458
|
}
|
|
1459
|
-
`],
|
|
1459
|
+
`],pr=l([g("qti-response-processing")],pr);var pe=class extends v{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};pe=l([g("qti-rule")],pe);var ur=class extends pe{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Xt(t)}})),t)}};l([u({type:String})],ur.prototype,"identifier",2),l([_({context:$,subscribe:!0}),E()],ur.prototype,"context",2);customElements.define("qti-lookup-outcome-value",ur);var Ui=class extends pe{render(){return h`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Ui);var Bi=class extends pe{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new ji(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.formatValue(i)}}))}formatValue(r){return Array.isArray(r)?r.map(Xt):r!==null?Xt(r):null}},ji=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",Bi);var mr=class extends v{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",mr);var hr=class extends mr{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",hr);var Wi=class extends hr{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",Wi);var Yr=Symbol("qtiContext");var C=class extends v{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(s=>s.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.value),cardinality:"ordered",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context.variables.find(s=>s.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}static{this.styles=x`
|
|
1460
1460
|
slot {
|
|
1461
1461
|
display: none;
|
|
1462
1462
|
}
|
|
1463
1463
|
`}render(){return h`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
1464
|
-
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};l([E()],C.prototype,"result",2),l([_({context:$,subscribe:!0}),E()],C.prototype,"context",2),l([_({context:Yr,subscribe:!0}),E()],C.prototype,"qtiContext",2);var K=class extends C{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Jr=class extends Sn(K){calculate(){return this.calculateChildren(Array.from(this.children))}};Jr=l([g("qti-and")],Jr);function Sn(o){return class extends o{calculateChildren(e){return e.map(i=>{let s=i;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=s.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}var Kr=class extends C{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};l([u({type:String,attribute:"base-type"})],Kr.prototype,"baseType",2);customElements.define("qti-base-value",Kr);var Wi=class extends C{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};customElements.define("qti-container-size",Wi);var Xi=class extends K{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,s=t.value;return i.filter(c=>s.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Xi);var Gi=class extends C{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Gi);var Yi={items:[],testOutcomeVariables:[]},ue=Symbol("testContext");var qt=class extends C{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let n=this._testContext.items.find(c=>c.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(n)}`),!this._testContext||!n)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(c=>c.identifier===t)?.variables.find(c=>c.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let s=this.context.variables.find(n=>n.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};l([u({type:String})],qt.prototype,"identifier",2),l([_({context:$,subscribe:!0}),E()],qt.prototype,"context",2),l([E(),_({context:ue,subscribe:!0})],qt.prototype,"_testContext",2);customElements.define("qti-default",qt);var Zr=class extends C{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),n=parseFloat(i.value);if(!isNaN(s)&&!isNaN(n))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(s*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${s}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([u({type:String})],Zr.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Zr);var Ji=class extends C{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",Ji);var mr=class extends C{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this._roundToDecimalPlaces(i,this.figures):this._roundToSignificantFigures(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}_roundToDecimalPlaces(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}_roundToSignificantFigures(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),s=Math.pow(10,t-i-1);return Math.round(e*s)/s}};l([u({type:String,attribute:"rounding-mode"})],mr.prototype,"roundingMode",2),l([u({type:Number})],mr.prototype,"figures",2);customElements.define("qti-round-to",mr);var Qr=class extends C{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):F.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([u({type:String})],Qr.prototype,"toleranceMode",2);customElements.define("qti-equal",Qr);var Ki=class extends C{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let s=parseInt(i,10);if(isNaN(s))return console.error("qti-gcd non-numerical value"),null;e.push(s)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this._calculateGcd(e)}_calculateGcd(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this._gcdTwoNumbers(e,Math.abs(r[t])),e!==1);t++);return e}_gcdTwoNumbers(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",Ki);var Zi=class extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Zi);var Qi=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Qi);var es=class extends C{getResult(){return null}};customElements.define("qti-null",es);var ts=class extends C{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ts);var rs=class extends C{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",rs);var is=class extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",is);var ss=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",ss);var ei=class extends C{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let s of t){let n=e.mapEntries.filter(c=>r.baseType==="string"&&!c.caseSensitive?F.compareSingleValues(c.mapKey.toLowerCase(),s.toLowerCase(),r.baseType):F.compareSingleValues(c.mapKey,s,r.baseType)),a=n.reduce((c,d)=>c.mappedValue>d.mappedValue?c:d,n.length>0?n[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};l([u({type:String})],ei.prototype,"identifier",2);customElements.define("qti-map-response",ei);var ti=class extends C{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,s=new Set;for(let n of t)for(let a of e.areaMapEntries){if(s.has(a.coords))continue;F.isPointInArea(n,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,s.add(a.coords))}return s.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([u({type:String})],ti.prototype,"identifier",2);customElements.define("qti-map-response-point",ti);var ri=class extends C{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let s=parseFloat(i.value);if(isNaN(s))return console.error("qti-math-operator non-numerical value"),null;t.push(s)}return this._performOperation(this.name,t)}_performOperation(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],s=t[1];return i===0&&s<=0||i<0&&!Number.isInteger(s)?null:Math.pow(i,s)}case"log_base":{if(t.length!==2)return null;let i=t[0],s=t[1];return i<=0||s<=0||s===1?null:Math.log(i)/Math.log(s)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};l([u({type:String})],ri.prototype,"name",2);customElements.define("qti-math-operator",ri);var os=class o extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return o.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):F.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!F.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let s=null,n=[...r.value];for(let a of n)if(F.compareSingleValues(i,a,e.baseType)){s=a;break}if(s!==null)n.splice(n.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",os);var ns=class extends C{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",ns);var as=class extends C{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",as);var ls=class extends C{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",ls);var cs=class extends K{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),s=!1;if(typeof i=="string")if(i==="true")s=!0;else if(i==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(s=i);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",cs);var ds=class extends C{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",ds);var ps=class extends C{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),s=parseFloat(t.value);if(isNaN(i)||isNaN(s))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&s<=0||i<0&&!Number.isInteger(s))return null;let n;try{n=Math.pow(i,s)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(n))return null;if(n===1/0||n===-1/0)return n;if(!isFinite(n)||Math.abs(n)>Number.MAX_VALUE||n!==0&&Math.abs(n)<Number.MIN_VALUE)return null;if(isFinite(n)&&n!==0){let a=Math.floor(Math.log10(Math.abs(n))),c=Math.max(0,14-a),d=Math.pow(10,c);n=Math.round(n*d)/d}return n}};customElements.define("qti-power",ps);var hr=class extends v{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?S:h`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};l([u({type:String})],hr.prototype,"identifier",2),l([_({context:$,subscribe:!0}),E()],hr.prototype,"context",2);customElements.define("qti-printed-variable",hr);var us=class extends C{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",us);var Io=class extends Mn(C){getResult(){return this.calculateChildren(Array.from(this.children))}};function Mn(o){return class extends o{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}var ii=class extends C{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return F.compareSingleValues(s,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([u({type:String,attribute:"case-sensitive"})],ii.prototype,"caseSensitive",2);customElements.define("qti-string-match",ii);var ms=class extends C{constructor(){super(),this._expression=new hs(Array.from(this.children))}getResult(){return this._expression.calculate()}},hs=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",ms);var fs=class extends C{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",fs);var Et=class extends C{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let s=this.min+this.step*t;if(s>this.max)break;Number.isInteger(s)&&e.push(s),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};l([u({type:Number})],Et.prototype,"min",2),l([u({type:Number})],Et.prototype,"max",2),l([u({type:Number})],Et.prototype,"step",2);customElements.define("qti-random-integer",Et);var gs=class extends C{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",gs);var bs=class extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}}};customElements.define("qti-delete",bs);var fr=class extends C{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 r=this.getVariables()[0];if(!r)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let t=this.lookupVariableValue(this.n);if(t===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(t)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(r.cardinality==="ordered"){let t=Array.isArray(r.value)?r.value:[r.value];return r.value===null||e>t.length?null:t[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}lookupVariableValue(r){let e=this.context.variables.find(t=>t.identifier===r)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};l([u({type:String})],fr.prototype,"n",2),fr=l([g("qti-index")],fr);var si=class extends v{render(){return h`<slot></slot>`}};si=l([g("qti-content-body")],si);var me=class extends v{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{let t=new CustomEvent("qti-rubric:discretionary-placement",{detail:{className:e,element:this},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(t))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return h`<slot></slot>`}};me.styles=x`
|
|
1464
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};l([E()],C.prototype,"result",2),l([_({context:$,subscribe:!0}),E()],C.prototype,"context",2),l([_({context:Yr,subscribe:!0}),E()],C.prototype,"qtiContext",2);var K=class extends C{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Jr=class extends Sn(K){calculate(){return this.calculateChildren(Array.from(this.children))}};Jr=l([g("qti-and")],Jr);function Sn(o){return class extends o{calculateChildren(e){return e.map(i=>{let s=i;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=s.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}var Kr=class extends C{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};l([u({type:String,attribute:"base-type"})],Kr.prototype,"baseType",2);customElements.define("qti-base-value",Kr);var Xi=class extends C{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};customElements.define("qti-container-size",Xi);var Gi=class extends K{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,s=t.value;return i.filter(c=>s.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Gi);var Yi=class extends C{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Yi);var Ji={items:[],testOutcomeVariables:[]},ue=Symbol("testContext");var qt=class extends C{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let n=this._testContext.items.find(c=>c.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(n)}`),!this._testContext||!n)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(c=>c.identifier===t)?.variables.find(c=>c.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let s=this.context.variables.find(n=>n.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};l([u({type:String})],qt.prototype,"identifier",2),l([_({context:$,subscribe:!0}),E()],qt.prototype,"context",2),l([E(),_({context:ue,subscribe:!0})],qt.prototype,"_testContext",2);customElements.define("qti-default",qt);var Zr=class extends C{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),n=parseFloat(i.value);if(!isNaN(s)&&!isNaN(n))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(s*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${s}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([u({type:String})],Zr.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Zr);var Ki=class extends C{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",Ki);var fr=class extends C{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this._roundToDecimalPlaces(i,this.figures):this._roundToSignificantFigures(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}_roundToDecimalPlaces(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}_roundToSignificantFigures(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),s=Math.pow(10,t-i-1);return Math.round(e*s)/s}};l([u({type:String,attribute:"rounding-mode"})],fr.prototype,"roundingMode",2),l([u({type:Number})],fr.prototype,"figures",2);customElements.define("qti-round-to",fr);var Qr=class extends C{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):F.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([u({type:String})],Qr.prototype,"toleranceMode",2);customElements.define("qti-equal",Qr);var Zi=class extends C{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let s=parseInt(i,10);if(isNaN(s))return console.error("qti-gcd non-numerical value"),null;e.push(s)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this._calculateGcd(e)}_calculateGcd(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this._gcdTwoNumbers(e,Math.abs(r[t])),e!==1);t++);return e}_gcdTwoNumbers(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",Zi);var Qi=class extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Qi);var es=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",es);var ts=class extends C{getResult(){return null}};customElements.define("qti-null",ts);var rs=class extends C{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",rs);var is=class extends C{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",is);var ss=class extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",ss);var os=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",os);var ei=class extends C{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let s of t){let n=e.mapEntries.filter(c=>r.baseType==="string"&&!c.caseSensitive?F.compareSingleValues(c.mapKey.toLowerCase(),s.toLowerCase(),r.baseType):F.compareSingleValues(c.mapKey,s,r.baseType)),a=n.reduce((c,d)=>c.mappedValue>d.mappedValue?c:d,n.length>0?n[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};l([u({type:String})],ei.prototype,"identifier",2);customElements.define("qti-map-response",ei);var ti=class extends C{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,s=new Set;for(let n of t)for(let a of e.areaMapEntries){if(s.has(a.coords))continue;F.isPointInArea(n,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,s.add(a.coords))}return s.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([u({type:String})],ti.prototype,"identifier",2);customElements.define("qti-map-response-point",ti);var ri=class extends C{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let s=parseFloat(i.value);if(isNaN(s))return console.error("qti-math-operator non-numerical value"),null;t.push(s)}return this._performOperation(this.name,t)}_performOperation(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],s=t[1];return i===0&&s<=0||i<0&&!Number.isInteger(s)?null:Math.pow(i,s)}case"log_base":{if(t.length!==2)return null;let i=t[0],s=t[1];return i<=0||s<=0||s===1?null:Math.log(i)/Math.log(s)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};l([u({type:String})],ri.prototype,"name",2);customElements.define("qti-math-operator",ri);var ns=class o extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return o.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):F.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!F.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let s=null,n=[...r.value];for(let a of n)if(F.compareSingleValues(i,a,e.baseType)){s=a;break}if(s!==null)n.splice(n.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",ns);var as=class extends C{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",as);var ls=class extends C{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",ls);var cs=class extends C{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",cs);var ds=class extends K{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),s=!1;if(typeof i=="string")if(i==="true")s=!0;else if(i==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(s=i);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ds);var ps=class extends C{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",ps);var us=class extends C{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),s=parseFloat(t.value);if(isNaN(i)||isNaN(s))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&s<=0||i<0&&!Number.isInteger(s))return null;let n;try{n=Math.pow(i,s)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(n))return null;if(n===1/0||n===-1/0)return n;if(!isFinite(n)||Math.abs(n)>Number.MAX_VALUE||n!==0&&Math.abs(n)<Number.MIN_VALUE)return null;if(isFinite(n)&&n!==0){let a=Math.floor(Math.log10(Math.abs(n))),c=Math.max(0,14-a),d=Math.pow(10,c);n=Math.round(n*d)/d}return n}};customElements.define("qti-power",us);var gr=class extends v{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?S:h`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};l([u({type:String})],gr.prototype,"identifier",2),l([_({context:$,subscribe:!0}),E()],gr.prototype,"context",2);customElements.define("qti-printed-variable",gr);var ms=class extends C{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",ms);var ii=class extends Mn(C){getResult(){return this.calculateChildren(Array.from(this.children))}};function Mn(o){return class extends o{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",ii);var si=class extends C{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return F.compareSingleValues(s,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([u({type:String,attribute:"case-sensitive"})],si.prototype,"caseSensitive",2);customElements.define("qti-string-match",si);var hs=class extends C{constructor(){super(),this._expression=new fs(Array.from(this.children))}getResult(){return this._expression.calculate()}},fs=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",hs);var gs=class extends C{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",gs);var Et=class extends C{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let s=this.min+this.step*t;if(s>this.max)break;Number.isInteger(s)&&e.push(s),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};l([u({type:Number})],Et.prototype,"min",2),l([u({type:Number})],Et.prototype,"max",2),l([u({type:Number})],Et.prototype,"step",2);customElements.define("qti-random-integer",Et);var bs=class extends C{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",bs);var vs=class extends C{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}}};customElements.define("qti-delete",vs);var br=class extends C{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 r=this.getVariables()[0];if(!r)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let t=this.lookupVariableValue(this.n);if(t===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(t)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(r.cardinality==="ordered"){let t=Array.isArray(r.value)?r.value:[r.value];return r.value===null||e>t.length?null:t[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}lookupVariableValue(r){let e=this.context.variables.find(t=>t.identifier===r)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};l([u({type:String})],br.prototype,"n",2),br=l([g("qti-index")],br);var oi=class extends v{render(){return h`<slot></slot>`}};oi=l([g("qti-content-body")],oi);var me=class extends v{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{let t=new CustomEvent("qti-rubric:discretionary-placement",{detail:{className:e,element:this},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(t))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return h`<slot></slot>`}};me.styles=x`
|
|
1465
1465
|
:host {
|
|
1466
1466
|
display: block;
|
|
1467
1467
|
}
|
|
1468
|
-
`,l([u({type:String})],me.prototype,"id",2),l([u({type:String})],me.prototype,"use",2),l([u({type:String})],me.prototype,"view",2),l([u({type:String,attribute:"class"})],me.prototype,"classNames",2),l([M("classNames",{waitUntilFirstUpdate:!0})],me.prototype,"handleclassNamesChange",1),me=l([g("qti-rubric-block")],me);var
|
|
1468
|
+
`,l([u({type:String})],me.prototype,"id",2),l([u({type:String})],me.prototype,"use",2),l([u({type:String})],me.prototype,"view",2),l([u({type:String,attribute:"class"})],me.prototype,"classNames",2),l([M("classNames",{waitUntilFirstUpdate:!0})],me.prototype,"handleclassNamesChange",1),me=l([g("qti-rubric-block")],me);var ni=class extends v{constructor(){super(...arguments);this.styleElement=null}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(i=>i.text()).then(i=>{let s=this.minifyCss(i);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${s}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};ni=l([g("qti-stylesheet")],ni);var De=class extends v{render(){return h`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};De=l([g("qti-variabledeclaration")],De);var he=class extends De{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return h`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let s=parseFloat(i.getAttribute("source-value")),n=parseFloat(i.getAttribute("target-value"));(isNaN(s)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(s,n)}return t}return null}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:e,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=e,(t.value===null||t.value==null)&&(t.baseType==="integer"||t.baseType==="float")&&(t.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};he.styles=[x`
|
|
1469
1469
|
:host {
|
|
1470
1470
|
display: none;
|
|
1471
1471
|
}
|
|
@@ -1473,40 +1473,40 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1473
1473
|
:host {
|
|
1474
1474
|
display: none;
|
|
1475
1475
|
}
|
|
1476
|
-
`],l([u({type:String,attribute:"base-type"})],we.prototype,"baseType",2),l([u({type:String})],we.prototype,"identifier",2),l([u({type:String})],we.prototype,"cardinality",2),l([_({context:$,subscribe:!0}),E()],we.prototype,"itemContext",2),we=l([g("qti-response-declaration")],we);var Lo=(s=>(s.ITEM_NOT_FOUND="item-not-found",s.SECTION_NOT_FOUND="section-not-found",s.LOAD_ERROR="load-error",s.NETWORK_ERROR="network-error",s.TIMEOUT_ERROR="timeout-error",s))(Lo||{}),$o=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this.postLoadTransformCallback=null;this._navigationInProgress=!1;this._activeRequests=[];this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:s})=>{if(!s?.id)return;let n=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=n;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:s.type,id:s.id}),this._cancelActiveRequests(),this._targetNavigation={type:s.type,id:s.id},s.type==="item"?await this._navigateToItem(s.id):s.type==="section"&&await this._navigateToSection(s.id),this._lastNavigationRequestId!==n){console.log("Navigation was superseded by a newer request");return}}catch(a){if(this._lastNavigationRequestId===n){let c=this._normalizeError(a,s.type,s.id);this._lastError=c,this._dispatchErrorEvent(c),console.error(`Navigation error (${c.type}):`,c.message,c.details)}}finally{this._lastNavigationRequestId===n&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:s.type,id:s.id}))}}),this.addEventListener("qti-assessment-test-connected",s=>{this._testElement=s.detail,this._initializeNavigation()})}_initializeNavigation(){let i;this.navigate==="section"&&(i=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(i=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:i},bubbles:!0,composed:!0}))}navigateTo(i,s){s||(i==="section"&&(s=this._testElement?.querySelector("qti-assessment-section")?.identifier),i==="item"&&(s=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}async _navigateToItem(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw{type:"item-not-found",message:`Item with identifier "${i}" not found.`,itemId:i};let n=s.closest("qti-test-part")?.identifier,a=s.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:i,navItemLoading:!0};try{await this._loadItems([i])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(i){let s=this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`);if(!s)throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};let n=s.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:i,navItemRefId:null,navItemLoading:!0};try{let a=this._getSectionItemIds(i);await this._loadItems(a)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(i,s,n){return i&&i.type&&Object.values(Lo).includes(i.type)?i:i instanceof DOMException&&i.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:i}:i.name==="TimeoutError"||i.message&&i.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:i}:i instanceof TypeError&&i.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:i}:{type:"load-error",message:`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchErrorEvent(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchStatusEvent(i){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:i,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(i=>{i&&i.readyState!==4&&i.abort()}),this._activeRequests=[])}async _loadItems(i){if(!this._testElement||i.length===0)return;let s=i.map(c=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${c}"]`)),n=s.reduce((c,d,p)=>(d||c.push(i[p]),c),[]);if(n.length>0)throw{type:"item-not-found",message:`One or more items not found: ${n.join(", ")}`,details:{missingItems:n}};this._clearLoadedItems();let a=s.map(async c=>{if(!c)return null;let d=new Promise((p,m)=>{setTimeout(()=>{m({name:"TimeoutError",message:`Request for item ${c.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:p,request:m}=Je(this.cacheTransform).load(c.href);m instanceof XMLHttpRequest&&this._activeRequests.push(m);let f=await Promise.race([p,d]),b=f;return console.log(`Loaded item 123: ${c.identifier}`),this.postLoadTransformCallback&&(b=await this.postLoadTransformCallback(f,c)),{itemRef:c,doc:b.htmlDoc(),request:m}}catch(p){if(p instanceof DOMException&&p.name==="AbortError"||p&&p.name==="TimeoutError")return console.log(`Request for item ${c.identifier} was ${p.name==="TimeoutError"?"timed out":"aborted"}`),null;throw p.itemId=c.identifier,p}});try{let d=(await Promise.all(a)).filter(p=>p!==null);if(d.forEach(({itemRef:p,doc:m})=>{p&&m&&(p.xmlDoc=m)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:d.map(({itemRef:p})=>({identifier:p?.identifier,element:p})),bubbles:!0,composed:!0}))}),d.length===0&&i.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:i}};return d}catch(c){throw console.error("Error loading items:",c),c}}_getSectionItemIds(i){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`))throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(n=>n.identifier)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}retryNavigation(){if(this._lastError){let i=this._lastError.itemId?"item":"section",s=this._lastError.itemId||this._lastError.sectionId;s&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return l([u({type:String})],r.prototype,"navigate",2),l([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),l([u({type:Number})],r.prototype,"requestTimeout",2),l([u({type:Boolean})],r.prototype,"showLoadingIndicators",2),l([u({type:Function})],r.prototype,"postLoadTransformCallback",2),r};var Oo=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var vs={view:"candidate"},He=Symbol("testContext");var Ct=class extends v{constructor(){super();this.testContext=Yi;this.sessionContext=vs;this._updateItemInTestContext=e=>{let t=e._context,i=t.identifier,s=t.variables,n=this.testContext.items.find(a=>a?.identifier===i);if(!n){console.warn(`Item IDs between assessment.xml and item.xml should match: ${i} is not found!`);return}n.variables?.length===1?this._updateItemVariablesInTestContext(i,s):e.variables=[...n.variables||[]]};this.addEventListener("qti-assessment-test-connected",e=>{if(this.testContext=Yi,this.sessionContext=vs,this.testContext&&this.testContext.items.length>0)return;this._testElement=e.detail;let t=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:t}}),this.addEventListener("qti-assessment-item-connected",e=>{let t=e.detail,i=t.closest("qti-assessment-item-ref")?.identifier;i&&(t.assessmentItemRefId=i),this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-item-context-updated",e=>{this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail.itemContext.variables)})}updateItemVariables(e,t){let i=this.testContext.items.find(n=>n.identifier===e);i&&(i.variables=i.variables.map(n=>{let a=t.find(c=>c.identifier===n.identifier);return a?{...n,...a}:n}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e}"]`);s&&s.assessmentItem&&s.assessmentItem&&(s.assessmentItem.variables=t)}_updateItemVariablesInTestContext(e,t){this.testContext={...this.testContext,items:this.testContext.items.map(i=>i.identifier!==e?i:{...i,variables:t.map(s=>{let n=i.variables.find(a=>a.identifier===s.identifier);return n?{...n,...s}:s})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};l([u({attribute:!1,type:Object}),X({context:ue})],Ct.prototype,"testContext",2),l([u({attribute:!1,type:Object}),X({context:He})],Ct.prototype,"sessionContext",2);var Po=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var ni=class extends $o(Oo(Po(Ct))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};ni=l([g("qti-test")],ni);var ai=["this"],Vo=["+","-","!"],No=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ys={"!":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},li=13;var In=["==","!=","<=",">=","||","&&","??","|>"],Ln=["===","!=="],T;(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"})(T||(T={}));var fe=(o,r,e=0)=>({kind:o,value:r,precedence:e}),$n=o=>o===9||o===10||o===13||o===32,Do=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),On=o=>Do(o)||gr(o),Pn=o=>ai.indexOf(o)!==-1,Vn=o=>o===34||o===39,gr=o=>48<=o&&o<=57,Nn=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,Dn=o=>o===40||o===41||o===91||o===93||o===123||o===125,Hn=o=>o.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
|
|
1477
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ci=class{#s;#n=-1;#i=0;#t;constructor(r){this.#s=r,this.#e()}nextToken(){for(;$n(this.#t);)this.#e(!0);if(Vn(this.#t))return this.#l();if(Do(this.#t))return this.#d();if(gr(this.#t))return this.#p();if(this.#t===46)return this.#a();if(this.#t===44)return this.#u();if(this.#t===58)return this.#c();if(Nn(this.#t))return this.#h();if(Dn(this.#t))return this.#f();if(this.#e(),this.#t!==void 0)throw new Error(`Expected end of input, got ${this.#t}`)}#e(r){this.#n++,this.#n<this.#s.length?(this.#t=this.#s.charCodeAt(this.#n),r===!0&&(this.#i=this.#n)):this.#t=void 0}#r(r=0){let e=this.#s.substring(this.#i,this.#n+r);return r===0&&this.#o(),e}#o(){this.#i=this.#n}#l(){let r="unterminated string",e=this.#t;for(this.#e(!0);this.#t!==e;){if(this.#t===void 0)throw new Error(r);if(this.#t===92&&(this.#e(),this.#t===void 0))throw new Error(r);this.#e()}let t=fe(T.STRING,Hn(this.#r()));return this.#e(),t}#d(){do this.#e();while(On(this.#t));let r=this.#r(),e=Pn(r)?T.KEYWORD:T.IDENTIFIER;return fe(e,r)}#p(){do this.#e();while(gr(this.#t));return this.#t===46?this.#a():fe(T.INTEGER,this.#r())}#a(){return this.#e(),gr(this.#t)?this.#m():(this.#o(),fe(T.DOT,".",li))}#u(){return this.#e(!0),fe(T.COMMA,",")}#c(){return this.#e(!0),fe(T.COLON,":")}#m(){do this.#e();while(gr(this.#t));return fe(T.DECIMAL,this.#r())}#h(){this.#e();let r=this.#r(2);if(Ln.indexOf(r)!==-1)this.#e(),this.#e();else{if(r=this.#r(1),r==="=>")return this.#e(),fe(T.ARROW,r);In.indexOf(r)!==-1&&this.#e()}return r=this.#r(),fe(T.OPERATOR,r,ys[r])}#f(){let r=String.fromCharCode(this.#t),e=fe(T.GROUPER,r,ys[r]);return this.#e(!0),e}};var xs=(o,r)=>new br(o,r).parse(),br=class{#s;#n;#i;#t;#e;constructor(r,e){this.#n=new ci(r),this.#i=e}parse(){return this.#r(),this.#o()}#r(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#t?.kind} (${this.#t?.value})`);let t=this.#n.nextToken();this.#t=t,this.#s=t?.kind,this.#e=t?.value}_matches(r,e){return!(r&&this.#s!==r||e&&this.#e!==e)}#o(){if(!this.#t)return this.#i.empty();let r=this.#a();return r===void 0?void 0:this.#l(r,0)}#l(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#t;)if(this._matches(T.GROUPER,"(")){let t=this.#g();r=this.#i.invoke(r,void 0,t)}else if(this._matches(T.GROUPER,"[")){let t=this.#x();r=this.#i.index(r,t)}else if(this._matches(T.DOT)){this.#r();let t=this.#a();r=this.#d(r,t)}else{if(this._matches(T.KEYWORD))break;if(this._matches(T.OPERATOR)&&this.#t.precedence>=e)r=this.#e==="?"?this.#u(r):this.#p(r,this.#t);else break}return r}#d(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#i.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(r,e){if(No.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#r();let t=this.#a();for(;(this.#s===T.OPERATOR||this.#s===T.DOT||this.#s===T.GROUPER)&&this.#t.precedence>e.precedence;)t=this.#l(t,this.#t.precedence);return this.#i.binary(r,e.value,t)}#a(){if(this._matches(T.OPERATOR)){let r=this.#e;if(this.#r(),r==="+"||r==="-"){if(this._matches(T.INTEGER))return this.#b(r);if(this._matches(T.DECIMAL))return this.#v(r)}if(Vo.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#l(this.#c(),li);return this.#i.unary(r,e)}return this.#c()}#u(r){this.#r(T.OPERATOR,"?");let e=this.#o();this.#r(T.COLON);let t=this.#o();return this.#i.ternary(r,e,t)}#c(){switch(this.#s){case T.KEYWORD:let r=this.#e;if(r==="this")return this.#r(),this.#i.id(r);throw ai.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case T.IDENTIFIER:return this.#f();case T.STRING:return this.#E();case T.INTEGER:return this.#b();case T.DECIMAL:return this.#v();case T.GROUPER:return this.#e==="("?this.#q():this.#e==="{"?this.#h():this.#e==="["?this.#m():void 0;case T.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let r=[];do{if(this.#r(),this._matches(T.GROUPER,"]"))break;r.push(this.#o())}while(this._matches(T.COMMA));return this.#r(T.GROUPER,"]"),this.#i.list(r)}#h(){let r={};do{if(this.#r(),this._matches(T.GROUPER,"}"))break;let e=this.#e;(this._matches(T.STRING)||this._matches(T.IDENTIFIER))&&this.#r(),this.#r(T.COLON),r[e]=this.#o()}while(this._matches(T.COMMA));return this.#r(T.GROUPER,"}"),this.#i.map(r)}#f(){let r=this.#e;if(r==="true")return this.#r(),this.#i.literal(!0);if(r==="false")return this.#r(),this.#i.literal(!1);if(r==="null")return this.#r(),this.#i.literal(null);if(r==="undefined")return this.#r(),this.#i.literal(void 0);let e=this.#y(),t=this.#g();return t?this.#i.invoke(e,void 0,t):e}#y(){if(!this._matches(T.IDENTIFIER))throw new Error(`expected identifier: ${this.#e}`);let r=this.#e;return this.#r(),this.#i.id(r)}#g(){if(!this._matches(T.GROUPER,"("))return;let r=[];do{if(this.#r(),this._matches(T.GROUPER,")"))break;let e=this.#o();r.push(e)}while(this._matches(T.COMMA));return this.#r(T.GROUPER,")"),r}#x(){this.#r();let r=this.#o();return this.#r(T.GROUPER,"]"),r}#q(){let r=this.#g();if(this._matches(T.ARROW)){this.#r();let e=this.#o(),t=r?.map(i=>i.value)??[];return this.#i.arrowFunction(t,e)}else return this.#i.paren(r[0])}#E(){let r=this.#i.literal(this.#e);return this.#r(),r}#b(r=""){let e=this.#i.literal(parseInt(`${r}${this.#e}`,10));return this.#r(),e}#v(r=""){let e=this.#i.literal(parseFloat(`${r}${this.#e}`));return this.#r(),e}};var{hasOwn:Ho,fromEntries:zn}=Object,Fn={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},Un={"+":o=>o,"-":o=>-o,"!":o=>!o},di=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=Un[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Fn[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(s),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),c=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,c=this.left.value),a===void 0?void 0:a[c]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,d=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=zn(i.map((d,p)=>[d,n[p]])),c=new Proxy(t??{},{set(d,p,m){return Ho(a,p)&&(a[p]=m),d[p]=m},get(d,p){return Ho(a,p)?a[p]:d[p]}});return s.evaluate(c)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var qs=null,zo={boundAttributeSuffix:H.M,marker:H.P,markerMatch:H.A,HTML_RESULT:H.C,getTemplateHtml:H.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){qs??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(qs))return void(e[qs]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=P;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:H.V,AttributePart:H.H,PropertyPart:H.B,BooleanAttributePart:H.N,EventPart:H.U,ElementPart:H.F,TemplateInstance:H.R,isIterable:H.D,ChildPart:H.I};var{AttributePart:jn,PropertyPart:Bn,BooleanAttributePart:Wn,EventPart:Xn}=zo,Cs=new di,Es=new Map,Fo=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),pi=(o,r)=>{let e=Es.get(o);if(e===void 0){if(Es.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new br(t,Cs).parse(),Es.set(o,e)}}return e?.evaluate(r)},Gn=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&pi(i,r))return ui(o,r,e,t)},Uo=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,jo=o=>/(?:\\{{)|(?:\\}})/g.test(o),vr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Yn=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=pi(i,r);if(!s[Symbol.iterator])return S;let n=yr(o),a=-1,c=[];for(let d of s){a++;let p=Object.create(r);p.item=d,p.index=a,p.this=r.this??r;let m=[];for(let b of n.parts){let y=b.update(p,e,t);b.type===1?m.push(...y):m.push(y)}let f={_$litType$:n,values:m};c.push(f)}return c}},Wo={if:Gn,repeat:Yn},Z=(o,r=Wo,e={},t)=>{let s=yr(o).renderers;if(t){let a=yr(t).renderers,c=s.super;c!==void 0?e={...s,...e,super:(d,p,m)=>(m={...a,...m,super:(f,b,y)=>ui(t,f,b,y)},c(d,p,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>ui(o,n,r,e)};var ui=(o,r,e=Wo,t={})=>{let i=yr(o),s=[];for(let a of i.parts){let c=a.update(r,e,t);a.type===1?s.push(...c):s.push(c)}return{_$litType$:i,values:s}},Bo=new Map,yr=o=>{let r=Bo.get(o);return r===void 0&&Bo.set(o,r=Jn(o)),r},Jn=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let c=n.getAttribute("type"),d=n.getAttribute("name"),p=n.getAttribute("call");if(p!==null||c!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(p!==null){let f=p.trim(),b=f.startsWith("{{")&&f.endsWith("}}");m=(y,w,R)=>{let q=n.getAttribute("data"),A=q===null?void 0:pi(q,y);return(b?pi(f,y):R[p])?.(A,w,R)}}else c!==null?m=(f,b,y)=>{let w=b[c];return w?.(n,f,b,y)}:(d==="super"?r.renderers.super=(f,b,y)=>{let w=y.super,R=yr(n);return y={...y,...R.renderers},w(f,b,y)}:r.renderers[d]=(f,b,y)=>ui(n,f,b,y),m=(f,b,y)=>{let w=y[d];return w?.(f,b,y)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let c of a){let d=n.getAttribute(c),p=d.split(Uo);if(p.length===1){jo(d)&&n.setAttribute(c,vr(d));continue}n.removeAttribute(c);let m=c,f=jn,b=c[0];b==="."?(m=Fo(c.substring(1)),f=Bn):b==="?"?(m=c.substring(1),f=Wn):b==="@"&&(m=Fo(c.substring(1)),f=Xn);let y=[vr(p[0])],w=[];for(let R=1;R<p.length;R+=2){let q=p[R];w.push(xs(q,Cs)),y.push(vr(p[R+1]))}r.parts.push({type:1,index:i,name:m,strings:y,ctor:f,update:(R,q,A)=>w.map(L=>L.evaluate(R))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,c=a.split(Uo);c.length>1?n.textContent=vr(c[0]):jo(a)&&(n.textContent=vr(a));for(let d=1;d<c.length;d+=2){let p=c[d],m=xs(p,Cs);r.parts.push({type:2,index:++i,update:(b,y)=>m.evaluate(b)});let f=new Text(c[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of s)n.remove();return r};var Xo={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},_e=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let e=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");e&&(this.myTemplate=Z(e)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};l([u({type:String})],_e.prototype,"category",2),l([u({type:String})],_e.prototype,"identifier",2),l([u({type:Boolean,converter:Xo})],_e.prototype,"required",2),l([u({type:Boolean,converter:Xo})],_e.prototype,"fixed",2),l([u({type:String})],_e.prototype,"href",2),l([u({type:Object,attribute:!1})],_e.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",_e);var ws={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ae=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){this._title=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};l([u({type:String})],Ae.prototype,"identifier",2),l([u({type:String})],Ae.prototype,"required",2),l([u({type:Boolean,converter:ws})],Ae.prototype,"fixed",2),l([u({type:Boolean,converter:ws})],Ae.prototype,"visible",2),l([u({type:Boolean,converter:ws,attribute:"keep-together"})],Ae.prototype,"keepTogether",2),l([_({context:ue,subscribe:!0})],Ae.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",Ae);var et=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([u({type:String})],et.prototype,"identifier",2),l([u({type:String})],et.prototype,"title",1),l([_({context:ue,subscribe:!0})],et.prototype,"_testContext",2),et=l([g("qti-assessment-test")],et);var Te=class extends v{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([u({type:String})],Te.prototype,"identifier",2),l([u({type:String})],Te.prototype,"class",2),l([u({type:String,attribute:"navigation-mode"})],Te.prototype,"navigationMode",2),l([u({type:String,attribute:"submission-mode"})],Te.prototype,"submissionMode",2),Te=l([g("qti-test-part")],Te);customElements.get("qti-test-part")||customElements.define("qti-test-part",Te);var xr=class extends Ze{render(){return h``}};xr.styles=x`
|
|
1476
|
+
`],l([u({type:String,attribute:"base-type"})],we.prototype,"baseType",2),l([u({type:String})],we.prototype,"identifier",2),l([u({type:String})],we.prototype,"cardinality",2),l([_({context:$,subscribe:!0}),E()],we.prototype,"itemContext",2),we=l([g("qti-response-declaration")],we);var Lo=(s=>(s.ITEM_NOT_FOUND="item-not-found",s.SECTION_NOT_FOUND="section-not-found",s.LOAD_ERROR="load-error",s.NETWORK_ERROR="network-error",s.TIMEOUT_ERROR="timeout-error",s))(Lo||{}),$o=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this.postLoadTransformCallback=null;this._navigationInProgress=!1;this._activeRequests=[];this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:s})=>{if(!s?.id)return;let n=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=n;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:s.type,id:s.id}),this._cancelActiveRequests(),this._targetNavigation={type:s.type,id:s.id},s.type==="item"?await this._navigateToItem(s.id):s.type==="section"&&await this._navigateToSection(s.id),this._lastNavigationRequestId!==n){console.log("Navigation was superseded by a newer request");return}}catch(a){if(this._lastNavigationRequestId===n){let c=this._normalizeError(a,s.type,s.id);this._lastError=c,this._dispatchErrorEvent(c),console.error(`Navigation error (${c.type}):`,c.message,c.details)}}finally{this._lastNavigationRequestId===n&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:s.type,id:s.id}))}}),this.addEventListener("qti-assessment-test-connected",s=>{this._testElement=s.detail,this._initializeNavigation()})}_initializeNavigation(){let i;this.navigate==="section"&&(i=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(i=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:i},bubbles:!0,composed:!0}))}navigateTo(i,s){s||(i==="section"&&(s=this._testElement?.querySelector("qti-assessment-section")?.identifier),i==="item"&&(s=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}async _navigateToItem(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw{type:"item-not-found",message:`Item with identifier "${i}" not found.`,itemId:i};let n=s.closest("qti-test-part")?.identifier,a=s.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:i,navItemLoading:!0};try{await this._loadItems([i])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(i){let s=this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`);if(!s)throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};let n=s.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:i,navItemRefId:null,navItemLoading:!0};try{let a=this._getSectionItemIds(i);await this._loadItems(a)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(i,s,n){return i&&i.type&&Object.values(Lo).includes(i.type)?i:i instanceof DOMException&&i.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:i}:i.name==="TimeoutError"||i.message&&i.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:i}:i instanceof TypeError&&i.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:i}:{type:"load-error",message:`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchErrorEvent(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchStatusEvent(i){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:i,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(i=>{i&&i.readyState!==4&&i.abort()}),this._activeRequests=[])}async _loadItems(i){if(!this._testElement||i.length===0)return;let s=i.map(c=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${c}"]`)),n=s.reduce((c,d,p)=>(d||c.push(i[p]),c),[]);if(n.length>0)throw{type:"item-not-found",message:`One or more items not found: ${n.join(", ")}`,details:{missingItems:n}};this._clearLoadedItems();let a=s.map(async c=>{if(!c)return null;let d=new Promise((p,m)=>{setTimeout(()=>{m({name:"TimeoutError",message:`Request for item ${c.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:p,request:m}=Je(this.cacheTransform).load(c.href);m instanceof XMLHttpRequest&&this._activeRequests.push(m);let f=await Promise.race([p,d]),b=f;return console.log(`Loaded item 123: ${c.identifier}`),this.postLoadTransformCallback&&(b=await this.postLoadTransformCallback(f,c)),{itemRef:c,doc:b.htmlDoc(),request:m}}catch(p){if(p instanceof DOMException&&p.name==="AbortError"||p&&p.name==="TimeoutError")return console.log(`Request for item ${c.identifier} was ${p.name==="TimeoutError"?"timed out":"aborted"}`),null;throw p.itemId=c.identifier,p}});try{let d=(await Promise.all(a)).filter(p=>p!==null);if(d.forEach(({itemRef:p,doc:m})=>{p&&m&&(p.xmlDoc=m)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:d.map(({itemRef:p})=>({identifier:p?.identifier,element:p})),bubbles:!0,composed:!0}))}),d.length===0&&i.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:i}};return d}catch(c){throw console.error("Error loading items:",c),c}}_getSectionItemIds(i){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`))throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(n=>n.identifier)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}retryNavigation(){if(this._lastError){let i=this._lastError.itemId?"item":"section",s=this._lastError.itemId||this._lastError.sectionId;s&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return l([u({type:String})],r.prototype,"navigate",2),l([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),l([u({type:Number})],r.prototype,"requestTimeout",2),l([u({type:Boolean})],r.prototype,"showLoadingIndicators",2),l([u({type:Function})],r.prototype,"postLoadTransformCallback",2),r};var Oo=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var ys={view:"candidate"},He=Symbol("testContext");var Ct=class extends v{constructor(){super();this.testContext=Ji;this.sessionContext=ys;this._updateItemInTestContext=e=>{let t=e._context,i=t.identifier,s=t.variables,n=this.testContext.items.find(a=>a?.identifier===i);if(!n){console.warn(`Item IDs between assessment.xml and item.xml should match: ${i} is not found!`);return}n.variables?.length===1?this._updateItemVariablesInTestContext(i,s):e.variables=[...n.variables||[]]};this.addEventListener("qti-assessment-test-connected",e=>{if(this.testContext=Ji,this.sessionContext=ys,this.testContext&&this.testContext.items.length>0)return;this._testElement=e.detail;let t=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:t}}),this.addEventListener("qti-assessment-item-connected",e=>{let t=e.detail,i=t.closest("qti-assessment-item-ref")?.identifier;i&&(t.assessmentItemRefId=i),this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-item-context-updated",e=>{this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail.itemContext.variables)})}updateItemVariables(e,t){let i=this.testContext.items.find(n=>n.identifier===e);i&&(i.variables=i.variables.map(n=>{let a=t.find(c=>c.identifier===n.identifier);return a?{...n,...a}:n}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e}"]`);s&&s.assessmentItem&&s.assessmentItem&&(s.assessmentItem.variables=t)}_updateItemVariablesInTestContext(e,t){this.testContext={...this.testContext,items:this.testContext.items.map(i=>i.identifier!==e?i:{...i,variables:t.map(s=>{let n=i.variables.find(a=>a.identifier===s.identifier);return n?{...n,...s}:s})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};l([u({attribute:!1,type:Object}),X({context:ue})],Ct.prototype,"testContext",2),l([u({attribute:!1,type:Object}),X({context:He})],Ct.prototype,"sessionContext",2);var Po=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var ai=class extends $o(Oo(Po(Ct))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};ai=l([g("qti-test")],ai);var li=["this"],No=["+","-","!"],Vo=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],xs={"!":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},ci=13;var In=["==","!=","<=",">=","||","&&","??","|>"],Ln=["===","!=="],A;(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"})(A||(A={}));var fe=(o,r,e=0)=>({kind:o,value:r,precedence:e}),$n=o=>o===9||o===10||o===13||o===32,Do=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),On=o=>Do(o)||vr(o),Pn=o=>li.indexOf(o)!==-1,Nn=o=>o===34||o===39,vr=o=>48<=o&&o<=57,Vn=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,Dn=o=>o===40||o===41||o===91||o===93||o===123||o===125,Hn=o=>o.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
|
|
1477
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),di=class{#s;#n=-1;#i=0;#t;constructor(r){this.#s=r,this.#e()}nextToken(){for(;$n(this.#t);)this.#e(!0);if(Nn(this.#t))return this.#l();if(Do(this.#t))return this.#d();if(vr(this.#t))return this.#p();if(this.#t===46)return this.#a();if(this.#t===44)return this.#u();if(this.#t===58)return this.#c();if(Vn(this.#t))return this.#h();if(Dn(this.#t))return this.#f();if(this.#e(),this.#t!==void 0)throw new Error(`Expected end of input, got ${this.#t}`)}#e(r){this.#n++,this.#n<this.#s.length?(this.#t=this.#s.charCodeAt(this.#n),r===!0&&(this.#i=this.#n)):this.#t=void 0}#r(r=0){let e=this.#s.substring(this.#i,this.#n+r);return r===0&&this.#o(),e}#o(){this.#i=this.#n}#l(){let r="unterminated string",e=this.#t;for(this.#e(!0);this.#t!==e;){if(this.#t===void 0)throw new Error(r);if(this.#t===92&&(this.#e(),this.#t===void 0))throw new Error(r);this.#e()}let t=fe(A.STRING,Hn(this.#r()));return this.#e(),t}#d(){do this.#e();while(On(this.#t));let r=this.#r(),e=Pn(r)?A.KEYWORD:A.IDENTIFIER;return fe(e,r)}#p(){do this.#e();while(vr(this.#t));return this.#t===46?this.#a():fe(A.INTEGER,this.#r())}#a(){return this.#e(),vr(this.#t)?this.#m():(this.#o(),fe(A.DOT,".",ci))}#u(){return this.#e(!0),fe(A.COMMA,",")}#c(){return this.#e(!0),fe(A.COLON,":")}#m(){do this.#e();while(vr(this.#t));return fe(A.DECIMAL,this.#r())}#h(){this.#e();let r=this.#r(2);if(Ln.indexOf(r)!==-1)this.#e(),this.#e();else{if(r=this.#r(1),r==="=>")return this.#e(),fe(A.ARROW,r);In.indexOf(r)!==-1&&this.#e()}return r=this.#r(),fe(A.OPERATOR,r,xs[r])}#f(){let r=String.fromCharCode(this.#t),e=fe(A.GROUPER,r,xs[r]);return this.#e(!0),e}};var qs=(o,r)=>new yr(o,r).parse(),yr=class{#s;#n;#i;#t;#e;constructor(r,e){this.#n=new di(r),this.#i=e}parse(){return this.#r(),this.#o()}#r(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#t?.kind} (${this.#t?.value})`);let t=this.#n.nextToken();this.#t=t,this.#s=t?.kind,this.#e=t?.value}_matches(r,e){return!(r&&this.#s!==r||e&&this.#e!==e)}#o(){if(!this.#t)return this.#i.empty();let r=this.#a();return r===void 0?void 0:this.#l(r,0)}#l(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#t;)if(this._matches(A.GROUPER,"(")){let t=this.#g();r=this.#i.invoke(r,void 0,t)}else if(this._matches(A.GROUPER,"[")){let t=this.#x();r=this.#i.index(r,t)}else if(this._matches(A.DOT)){this.#r();let t=this.#a();r=this.#d(r,t)}else{if(this._matches(A.KEYWORD))break;if(this._matches(A.OPERATOR)&&this.#t.precedence>=e)r=this.#e==="?"?this.#u(r):this.#p(r,this.#t);else break}return r}#d(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#i.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(r,e){if(Vo.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#r();let t=this.#a();for(;(this.#s===A.OPERATOR||this.#s===A.DOT||this.#s===A.GROUPER)&&this.#t.precedence>e.precedence;)t=this.#l(t,this.#t.precedence);return this.#i.binary(r,e.value,t)}#a(){if(this._matches(A.OPERATOR)){let r=this.#e;if(this.#r(),r==="+"||r==="-"){if(this._matches(A.INTEGER))return this.#b(r);if(this._matches(A.DECIMAL))return this.#v(r)}if(No.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#l(this.#c(),ci);return this.#i.unary(r,e)}return this.#c()}#u(r){this.#r(A.OPERATOR,"?");let e=this.#o();this.#r(A.COLON);let t=this.#o();return this.#i.ternary(r,e,t)}#c(){switch(this.#s){case A.KEYWORD:let r=this.#e;if(r==="this")return this.#r(),this.#i.id(r);throw li.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case A.IDENTIFIER:return this.#f();case A.STRING:return this.#E();case A.INTEGER:return this.#b();case A.DECIMAL:return this.#v();case A.GROUPER:return this.#e==="("?this.#q():this.#e==="{"?this.#h():this.#e==="["?this.#m():void 0;case A.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let r=[];do{if(this.#r(),this._matches(A.GROUPER,"]"))break;r.push(this.#o())}while(this._matches(A.COMMA));return this.#r(A.GROUPER,"]"),this.#i.list(r)}#h(){let r={};do{if(this.#r(),this._matches(A.GROUPER,"}"))break;let e=this.#e;(this._matches(A.STRING)||this._matches(A.IDENTIFIER))&&this.#r(),this.#r(A.COLON),r[e]=this.#o()}while(this._matches(A.COMMA));return this.#r(A.GROUPER,"}"),this.#i.map(r)}#f(){let r=this.#e;if(r==="true")return this.#r(),this.#i.literal(!0);if(r==="false")return this.#r(),this.#i.literal(!1);if(r==="null")return this.#r(),this.#i.literal(null);if(r==="undefined")return this.#r(),this.#i.literal(void 0);let e=this.#y(),t=this.#g();return t?this.#i.invoke(e,void 0,t):e}#y(){if(!this._matches(A.IDENTIFIER))throw new Error(`expected identifier: ${this.#e}`);let r=this.#e;return this.#r(),this.#i.id(r)}#g(){if(!this._matches(A.GROUPER,"("))return;let r=[];do{if(this.#r(),this._matches(A.GROUPER,")"))break;let e=this.#o();r.push(e)}while(this._matches(A.COMMA));return this.#r(A.GROUPER,")"),r}#x(){this.#r();let r=this.#o();return this.#r(A.GROUPER,"]"),r}#q(){let r=this.#g();if(this._matches(A.ARROW)){this.#r();let e=this.#o(),t=r?.map(i=>i.value)??[];return this.#i.arrowFunction(t,e)}else return this.#i.paren(r[0])}#E(){let r=this.#i.literal(this.#e);return this.#r(),r}#b(r=""){let e=this.#i.literal(parseInt(`${r}${this.#e}`,10));return this.#r(),e}#v(r=""){let e=this.#i.literal(parseFloat(`${r}${this.#e}`));return this.#r(),e}};var{hasOwn:Ho,fromEntries:zn}=Object,Fn={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},Un={"+":o=>o,"-":o=>-o,"!":o=>!o},pi=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=Un[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Fn[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(s),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),c=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,c=this.left.value),a===void 0?void 0:a[c]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,d=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=zn(i.map((d,p)=>[d,n[p]])),c=new Proxy(t??{},{set(d,p,m){return Ho(a,p)&&(a[p]=m),d[p]=m},get(d,p){return Ho(a,p)?a[p]:d[p]}});return s.evaluate(c)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var Es=null,zo={boundAttributeSuffix:H.M,marker:H.P,markerMatch:H.A,HTML_RESULT:H.C,getTemplateHtml:H.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){Es??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Es))return void(e[Es]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=P;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:H.V,AttributePart:H.H,PropertyPart:H.B,BooleanAttributePart:H.N,EventPart:H.U,ElementPart:H.F,TemplateInstance:H.R,isIterable:H.D,ChildPart:H.I};var{AttributePart:Bn,PropertyPart:jn,BooleanAttributePart:Wn,EventPart:Xn}=zo,ws=new pi,Cs=new Map,Fo=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ui=(o,r)=>{let e=Cs.get(o);if(e===void 0){if(Cs.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new yr(t,ws).parse(),Cs.set(o,e)}}return e?.evaluate(r)},Gn=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&ui(i,r))return mi(o,r,e,t)},Uo=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Bo=o=>/(?:\\{{)|(?:\\}})/g.test(o),xr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Yn=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=ui(i,r);if(!s[Symbol.iterator])return S;let n=qr(o),a=-1,c=[];for(let d of s){a++;let p=Object.create(r);p.item=d,p.index=a,p.this=r.this??r;let m=[];for(let b of n.parts){let y=b.update(p,e,t);b.type===1?m.push(...y):m.push(y)}let f={_$litType$:n,values:m};c.push(f)}return c}},Wo={if:Gn,repeat:Yn},Z=(o,r=Wo,e={},t)=>{let s=qr(o).renderers;if(t){let a=qr(t).renderers,c=s.super;c!==void 0?e={...s,...e,super:(d,p,m)=>(m={...a,...m,super:(f,b,y)=>mi(t,f,b,y)},c(d,p,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>mi(o,n,r,e)};var mi=(o,r,e=Wo,t={})=>{let i=qr(o),s=[];for(let a of i.parts){let c=a.update(r,e,t);a.type===1?s.push(...c):s.push(c)}return{_$litType$:i,values:s}},jo=new Map,qr=o=>{let r=jo.get(o);return r===void 0&&jo.set(o,r=Jn(o)),r},Jn=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let c=n.getAttribute("type"),d=n.getAttribute("name"),p=n.getAttribute("call");if(p!==null||c!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(p!==null){let f=p.trim(),b=f.startsWith("{{")&&f.endsWith("}}");m=(y,w,k)=>{let q=n.getAttribute("data"),T=q===null?void 0:ui(q,y);return(b?ui(f,y):k[p])?.(T,w,k)}}else c!==null?m=(f,b,y)=>{let w=b[c];return w?.(n,f,b,y)}:(d==="super"?r.renderers.super=(f,b,y)=>{let w=y.super,k=qr(n);return y={...y,...k.renderers},w(f,b,y)}:r.renderers[d]=(f,b,y)=>mi(n,f,b,y),m=(f,b,y)=>{let w=y[d];return w?.(f,b,y)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let c of a){let d=n.getAttribute(c),p=d.split(Uo);if(p.length===1){Bo(d)&&n.setAttribute(c,xr(d));continue}n.removeAttribute(c);let m=c,f=Bn,b=c[0];b==="."?(m=Fo(c.substring(1)),f=jn):b==="?"?(m=c.substring(1),f=Wn):b==="@"&&(m=Fo(c.substring(1)),f=Xn);let y=[xr(p[0])],w=[];for(let k=1;k<p.length;k+=2){let q=p[k];w.push(qs(q,ws)),y.push(xr(p[k+1]))}r.parts.push({type:1,index:i,name:m,strings:y,ctor:f,update:(k,q,T)=>w.map(L=>L.evaluate(k))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,c=a.split(Uo);c.length>1?n.textContent=xr(c[0]):Bo(a)&&(n.textContent=xr(a));for(let d=1;d<c.length;d+=2){let p=c[d],m=qs(p,ws);r.parts.push({type:2,index:++i,update:(b,y)=>m.evaluate(b)});let f=new Text(c[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of s)n.remove();return r};var Xo={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},_e=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let e=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");e&&(this.myTemplate=Z(e)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};l([u({type:String})],_e.prototype,"category",2),l([u({type:String})],_e.prototype,"identifier",2),l([u({type:Boolean,converter:Xo})],_e.prototype,"required",2),l([u({type:Boolean,converter:Xo})],_e.prototype,"fixed",2),l([u({type:String})],_e.prototype,"href",2),l([u({type:Object,attribute:!1})],_e.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",_e);var _s={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Te=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){this._title=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};l([u({type:String})],Te.prototype,"identifier",2),l([u({type:String})],Te.prototype,"required",2),l([u({type:Boolean,converter:_s})],Te.prototype,"fixed",2),l([u({type:Boolean,converter:_s})],Te.prototype,"visible",2),l([u({type:Boolean,converter:_s,attribute:"keep-together"})],Te.prototype,"keepTogether",2),l([_({context:ue,subscribe:!0})],Te.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",Te);var et=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([u({type:String})],et.prototype,"identifier",2),l([u({type:String})],et.prototype,"title",1),l([_({context:ue,subscribe:!0})],et.prototype,"_testContext",2),et=l([g("qti-assessment-test")],et);var Ae=class extends v{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};l([u({type:String})],Ae.prototype,"identifier",2),l([u({type:String})],Ae.prototype,"class",2),l([u({type:String,attribute:"navigation-mode"})],Ae.prototype,"navigationMode",2),l([u({type:String,attribute:"submission-mode"})],Ae.prototype,"submissionMode",2),Ae=l([g("qti-test-part")],Ae);customElements.get("qti-test-part")||customElements.define("qti-test-part",Ae);var Er=class extends Ze{render(){return h``}};Er.styles=x`
|
|
1478
1478
|
:host {
|
|
1479
1479
|
color: gray;
|
|
1480
1480
|
}
|
|
1481
|
-
`,
|
|
1481
|
+
`,Er=l([g("qti-test-feedback")],Er);var O=Symbol("computedContext");var Q=class extends v{constructor(){super();this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-interaction-changed",this._handleInteractionChanged.bind(this)),this.addEventListener("test-end-attempt",this._handleTestEndAttempt.bind(this)),this.addEventListener("test-show-correct-response",this._handleTestShowCorrectResponse.bind(this)),this.addEventListener("test-show-candidate-correction",this._handleTestShowCandidateCorrection.bind(this)),this.addEventListener("test-update-outcome-variable",this._handleTestUpdateOutcomeVariable.bind(this))}_handleTestEndAttempt(e){let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,s=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,s)}_handleTestShowCorrectResponse(e){let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem;i&&i.showCorrectResponse(e.detail)}_handleTestShowCandidateCorrection(e){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCandidateCorrection(e.detail)}_handleTestUpdateOutcomeVariable(e){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)}_handleInteractionChanged(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),i=t.variables.find(s=>s.identifier==="SCORE");if(i&&i.externalScored===null&&t.adaptive==="false"){let s=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,s)}}}render(){return h`<slot></slot>`}_handleTestConnected(e){if(this._testElement=e.detail,!this.qtiContext.QTI_CONTEXT?.testIdentifier){let s=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...s,testIdentifier:this._testElement.identifier,environmentIdentifier:s.environmentIdentifier||"default"}}}this._testElement.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(s=>{let n=this._extractDefaultValues(s);Object.keys(n).length>0&&(this.qtiContext={QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(this._testElement?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this._testElement.identifier,title:this._testElement.title,view:this._sessionContext?.view,testParts:i.map(s=>{let n=[...s.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:s.identifier,navigationMode:s.navigationMode,submissionMode:s.submissionMode,sections:n.map(a=>{let c=[...a.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:a.identifier,title:a.title,items:c.map(d=>({...this.initContext?.find(p=>p.identifier===d.identifier),active:!1,identifier:d.identifier,categories:d.category?d.category?.split(" "):[],href:d.href,variables:[]}))}})}})}}_extractDefaultValues(e){let t={},i=e.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let a=n.getAttribute("field-identifier"),c=n.getAttribute("base-type")||"string",d=n.textContent?.trim()||"";if(a){let p=d;switch(c){case"integer":p=parseInt(d,10);break;case"float":case"duration":p=parseFloat(d);break;case"boolean":p=d.toLowerCase()==="true";break;case"string":default:p=d;break}t[a]=p}}),t}_handleItemConnected(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(s=>({...s,items:s.items.map(n=>{if(n.identifier!==t.parentElement.getAttribute("identifier"))return n;let c=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),d=t.querySelectorAll("qti-response-declaration"),p=Array.from(d).some(y=>y.querySelector("qti-correct-response")),m=Array.from(d).some(y=>{let w=y.querySelector("qti-mapping"),k=y.querySelector("qti-area-mapping");return w?.querySelector("qti-map-entry")||k?.querySelector("qti-area-map-entry")}),f=p||m,b=!!t.querySelector("qti-response-processing");return{...n,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:c,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:f,hasResponseProcessing:b}})}))}))}}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(s=>({...s,active:this._sessionContext?.navSectionId===s.identifier||!1,completed:s.items.every(n=>this._testContext.items.find(a=>a.identifier===n.identifier)?.variables.find(a=>a.identifier==="completionStatus").value==="completed"),items:s.items.map(n=>{let a=this._testContext?.items.find(T=>T.identifier===n.identifier),c={...n,...a,...this.initContext?.find(T=>T.identifier===n.identifier)},d=c.variables?.find(T=>T.identifier=="SCORE")?.value,p=d==null?null:parseFloat(d?.toString()),m=c.variables?.find(T=>T.identifier==="completionStatus")?.value,f=c.variables?.find(T=>T.identifier==="RESPONSE")?.value||"",b=c.variables?.find(T=>T.identifier==="numAttempts")?.value||0,y=this._sessionContext?.navItemRefId===c.identifier||!1,w=n.categories.includes(this.configContext?.infoItemCategory)?null:t++,k=n.variables?.find(T=>T.identifier=="MAXSCORE")?.value,q=k==null?null:parseFloat(k?.toString());return{...c,completionStatus:m,numAttempts:b,score:p,response:f,index:w,active:y,maxScore:q}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};l([u({type:String})],Q.prototype,"identifier",2),l([E()],Q.prototype,"initContext",2),l([E(),X({context:Yr})],Q.prototype,"qtiContext",2),l([E(),X({context:ne})],Q.prototype,"configContext",2),l([E(),_({context:ue,subscribe:!0})],Q.prototype,"_testContext",2),l([E(),_({context:He,subscribe:!0})],Q.prototype,"_sessionContext",2),l([E(),X({context:O})],Q.prototype,"computedContext",2),l([u({type:Boolean,attribute:"auto-score-items"})],Q.prototype,"autoScoreItems",2),Q=l([g("test-navigation")],Q);var Go=x`
|
|
1482
1482
|
display: inline-flex;
|
|
1483
1483
|
align-items: center;
|
|
1484
1484
|
cursor: pointer;
|
|
1485
1485
|
padding: 0.5rem 1rem;
|
|
1486
1486
|
border-radius: 0.25rem;
|
|
1487
1487
|
user-select: none;
|
|
1488
|
-
`,
|
|
1488
|
+
`,B=x`
|
|
1489
1489
|
background-color: lightgray;
|
|
1490
1490
|
${Go};
|
|
1491
|
-
`,
|
|
1491
|
+
`,j=x`
|
|
1492
1492
|
cursor: not-allowed;
|
|
1493
1493
|
opacity: 0.8;
|
|
1494
|
-
|
|
1494
|
+
`,$E=x`
|
|
1495
1495
|
${Go};
|
|
1496
1496
|
border: 1px solid gray;
|
|
1497
1497
|
`;var ze=class extends v{constructor(){super();this._internalDisabled=!0;this._internals=this.attachInternals(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};ze.styles=x`
|
|
1498
1498
|
:host {
|
|
1499
|
-
${
|
|
1499
|
+
${B};
|
|
1500
1500
|
}
|
|
1501
1501
|
:host([disabled]) {
|
|
1502
|
-
${
|
|
1502
|
+
${j};
|
|
1503
1503
|
}
|
|
1504
1504
|
`,l([u({type:Boolean,reflect:!0,attribute:"disabled"})],ze.prototype,"_internalDisabled",2),l([_({context:O,subscribe:!0})],ze.prototype,"computedContext",2),l([M("computedContext")],ze.prototype,"_handleTestElementChange",1),ze=l([g("test-next")],ze);var Fe=class extends v{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};Fe.styles=x`
|
|
1505
1505
|
:host {
|
|
1506
|
-
${
|
|
1506
|
+
${B};
|
|
1507
1507
|
}
|
|
1508
1508
|
:host([disabled]) {
|
|
1509
|
-
${
|
|
1509
|
+
${j};
|
|
1510
1510
|
}
|
|
1511
1511
|
`,l([u({type:Boolean,reflect:!0,attribute:"disabled"})],Fe.prototype,"_internalDisabled",2),l([_({context:O,subscribe:!0})],Fe.prototype,"computedContext",2),l([M("computedContext")],Fe.prototype,"_handleTestElementChange",1),Fe=l([g("test-prev")],Fe);var W=class extends v{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=W.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>W.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=W.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return h`
|
|
1512
1512
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
@@ -1519,26 +1519,26 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1519
1519
|
</select>
|
|
1520
1520
|
`}};W.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],l([_({context:He,subscribe:!0})],W.prototype,"sessionContext",2),l([u({type:String})],W.prototype,"label",2),l([u({type:String,attribute:"view-options"})],W.prototype,"viewOptions",2),l([M("viewOptions",{waitUntilFirstUpdate:!0})],W.prototype,"_handleViewOptionsChange",2),l([E()],W.prototype,"_viewOptions",2),W=l([g("test-view")],W);var wt=class extends v{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h` <slot></slot> `}};wt.styles=x`
|
|
1521
1521
|
:host {
|
|
1522
|
-
${
|
|
1522
|
+
${B};
|
|
1523
1523
|
}
|
|
1524
1524
|
:host([disabled]) {
|
|
1525
|
-
${
|
|
1525
|
+
${j};
|
|
1526
1526
|
}
|
|
1527
|
-
`,l([u({type:String,attribute:"item-id"})],wt.prototype,"itemId",2),wt=l([g("test-item-link")],wt);var
|
|
1527
|
+
`,l([u({type:String,attribute:"item-id"})],wt.prototype,"itemId",2),wt=l([g("test-item-link")],wt);var Cr=class extends v{constructor(){super(),this.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})))}render(){return h` <slot></slot> `}};Cr.styles=x`
|
|
1528
1528
|
:host {
|
|
1529
|
-
${
|
|
1529
|
+
${B};
|
|
1530
1530
|
}
|
|
1531
1531
|
:host([disabled]) {
|
|
1532
|
-
${
|
|
1532
|
+
${j};
|
|
1533
1533
|
}
|
|
1534
|
-
`,
|
|
1534
|
+
`,Cr=l([g("test-end-attempt")],Cr);var te=class extends v{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"}willUpdate(e){let t=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(s=>s.items)).find(i=>i.active);if(this._previousActiveItem!==t&&(this.shown=!1,this._previousActiveItem=t),t){let i=!!t?.variables?.some(n=>n.correctResponse),s=!!t?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!s}else this.disabled=!0}_toggleState(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}_getDisplayedText(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return h` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `}};te.styles=x`
|
|
1535
1535
|
:host {
|
|
1536
|
-
${
|
|
1536
|
+
${B};
|
|
1537
1537
|
}
|
|
1538
1538
|
:host([disabled]) {
|
|
1539
|
-
${
|
|
1539
|
+
${j};
|
|
1540
1540
|
}
|
|
1541
|
-
`,l([_({context:O,subscribe:!0})],te.prototype,"computedContext",2),l([u({type:Boolean,reflect:!0})],te.prototype,"shown",2),l([u({type:Boolean,reflect:!0})],te.prototype,"disabled",2),l([u({type:String})],te.prototype,"showCorrectText",2),l([u({type:String})],te.prototype,"hideCorrectText",2),l([u({type:String})],te.prototype,"noCorrectResponseText",2),te=l([g("test-show-correct-response")],te);var
|
|
1541
|
+
`,l([_({context:O,subscribe:!0})],te.prototype,"computedContext",2),l([u({type:Boolean,reflect:!0})],te.prototype,"shown",2),l([u({type:Boolean,reflect:!0})],te.prototype,"disabled",2),l([u({type:String})],te.prototype,"showCorrectText",2),l([u({type:String})],te.prototype,"hideCorrectText",2),l([u({type:String})],te.prototype,"noCorrectResponseText",2),te=l([g("test-show-correct-response")],te);var wr=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=Z(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(t=>t.items));return h` ${r.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};l([_({context:O,subscribe:!0})],wr.prototype,"computedContext",2),wr=l([g("test-paging-buttons-stamp")],wr);var hi=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},fi=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(r=>this.Z=r)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Yo=o=>!uo(o)&&typeof o.then=="function",Jo=1073741823,Ts=class extends xt{constructor(){super(...arguments),this._$Cwt=Jo,this._$Cbt=[],this._$CK=new hi(this),this._$CX=new fi}render(...r){return r.find(e=>!Yo(e))??P}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!Yo(c))return this._$Cwt=a,c;a<i&&c===t[a]||(this._$Cwt=Jo,i=0,Promise.resolve(c).then(async d=>{for(;n.get();)await n.get();let p=s.deref();if(p!==void 0){let m=p._$Cbt.indexOf(c);m>-1&&m<p._$Cwt&&(p._$Cwt=m,p.setValue(d))}}))}return P}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},gi=ee(Ts);var bi=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
1542
1542
|
|
|
1543
1543
|
:root,
|
|
1544
1544
|
:host {
|
|
@@ -5252,11 +5252,11 @@ div.full-correct-response-inline {
|
|
|
5252
5252
|
margin-right: var(--qti-padding-horizontal);
|
|
5253
5253
|
padding: 0.2rem;
|
|
5254
5254
|
}
|
|
5255
|
-
`;var
|
|
5255
|
+
`;var Re=class extends v{constructor(){super(...arguments);this.testURL=null;this.testDoc=null;this.testXML=null;this.templateContent=null}async handleTestURLChange(){if(this.testURL)try{let e=await Pi().load(this.testURL);this.testDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=Pi().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:h``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(bi),this.shadowRoot.adoptedStyleSheets=[e]}render(){return h`
|
|
5256
5256
|
${this.templateContent}
|
|
5257
5257
|
<slot></slot>
|
|
5258
|
-
${
|
|
5259
|
-
`}};l([u({type:String,attribute:"test-url"})],
|
|
5258
|
+
${gi(this.testDoc,h`<span>Loading...</span>`)}
|
|
5259
|
+
`}};l([u({type:String,attribute:"test-url"})],Re.prototype,"testURL",2),l([E()],Re.prototype,"testDoc",2),l([E()],Re.prototype,"testXML",2),l([M("testURL",{waitUntilFirstUpdate:!0})],Re.prototype,"handleTestURLChange",1),l([M("testXML",{waitUntilFirstUpdate:!0})],Re.prototype,"handleTestXMLChange",1),Re=l([g("test-container")],Re);var _t=class extends v{render(){let r=this.computedContext?.testParts.flatMap(s=>s.sections.flatMap(n=>n.items)).find(s=>s.active);if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,n)=>h`
|
|
5260
5260
|
<h3>${n}</h3>
|
|
5261
5261
|
<table>
|
|
5262
5262
|
<thead>
|
|
@@ -5303,26 +5303,26 @@ div.full-correct-response-inline {
|
|
|
5303
5303
|
margin-top: 20px;
|
|
5304
5304
|
font-size: 16px;
|
|
5305
5305
|
}
|
|
5306
|
-
`,l([_({context:O,subscribe:!0})],_t.prototype,"computedContext",2),_t=l([g("test-print-item-variables")],_t);var
|
|
5306
|
+
`,l([_({context:O,subscribe:!0})],_t.prototype,"computedContext",2),_t=l([g("test-print-item-variables")],_t);var _r=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=Z(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections);return h` ${r.map(e=>this.myTemplate({item:e}))} `}};l([_({context:O,subscribe:!0})],_r.prototype,"computedContext",2),_r=l([g("test-section-buttons-stamp")],_r);var Tt=class extends v{constructor(){super();this.sectionId=null;this.addEventListener("click",()=>this._requestItem(this.sectionId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))}render(){return h` <slot></slot> `}};Tt.styles=x`
|
|
5307
5307
|
:host {
|
|
5308
|
-
${
|
|
5308
|
+
${B};
|
|
5309
5309
|
}
|
|
5310
5310
|
:host([disabled]) {
|
|
5311
|
-
${
|
|
5311
|
+
${j};
|
|
5312
5312
|
}
|
|
5313
|
-
`,l([u({type:String,attribute:"section-id"})],
|
|
5314
|
-
${this.myTemplate?this.myTemplate(this.stampContext):S}`}};l([u({type:Boolean,reflect:!0})],rt.prototype,"debug",2),l([E(),_({context:O,subscribe:!0})],rt.prototype,"computedContext",2),l([E()],rt.prototype,"stampContext",2),rt=l([g("test-stamp")],rt);var it=class extends v{constructor(){super();this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&this._changeOutcomeScore(i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}_changeOutcomeScore(e){let s=(this.computedContext?.testParts.find(n=>n.active)).sections.flatMap(n=>n.items).find(n=>n.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:s,outcomeVariableId:"SCORE",value:e},bubbles:!0}))}render(){let e=this.computedContext?.testParts.flatMap(c=>c.sections.flatMap(d=>d.items)).find(c=>c.active);if(!e||!e.variables)return h``;let t=e.variables.find(c=>c.identifier=="MAXSCORE")?.value,i=e.variables.find(c=>c.identifier=="SCORE"),s=i?.value,n=i?.externalScored!=="human";if(!t||!i)return S;let a=[...Array(Number(t)+1).keys()];return h`${this.myTemplate?this.myTemplate({scores:a,score:s,disabled:n}):S}`}};l([u({type:String,attribute:"view"})],it.prototype,"view",2),l([u({type:Boolean})],it.prototype,"disabled",2),l([_({context:O,subscribe:!0})],it.prototype,"computedContext",2),it=l([g("test-scoring-buttons")],it);var
|
|
5313
|
+
`,l([u({type:String,attribute:"section-id"})],Tt.prototype,"sectionId",2),Tt=l([g("test-section-link")],Tt);var Tr=class extends v{render(){return h` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};l([E(),_({context:O,subscribe:!0})],Tr.prototype,"computedContext",2),Tr=l([g("test-print-context")],Tr);var rt=class extends v{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(f=>f.active),i=t?.sections.find(f=>f.active),s=i?.items.find(f=>f.active),{variables:n,...a}=s||{};if(!t||!i||!s)return;let c={...t,items:t.sections.flatMap(f=>f.items.map(({variables:b,...y})=>y)),sections:t.sections.map(f=>({...f,items:f.items.map(({variables:b,...y})=>y)}))},d={...i,items:i.items.map(({variables:f,...b})=>b)},{testParts:p,...m}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:a,activeSection:d,activeTestpart:c,test:m}}render(){return h` ${this.debug?h`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:S}
|
|
5314
|
+
${this.myTemplate?this.myTemplate(this.stampContext):S}`}};l([u({type:Boolean,reflect:!0})],rt.prototype,"debug",2),l([E(),_({context:O,subscribe:!0})],rt.prototype,"computedContext",2),l([E()],rt.prototype,"stampContext",2),rt=l([g("test-stamp")],rt);var it=class extends v{constructor(){super();this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&this._changeOutcomeScore(i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}_changeOutcomeScore(e){let s=(this.computedContext?.testParts.find(n=>n.active)).sections.flatMap(n=>n.items).find(n=>n.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:s,outcomeVariableId:"SCORE",value:e},bubbles:!0}))}render(){let e=this.computedContext?.testParts.flatMap(c=>c.sections.flatMap(d=>d.items)).find(c=>c.active);if(!e||!e.variables)return h``;let t=e.variables.find(c=>c.identifier=="MAXSCORE")?.value,i=e.variables.find(c=>c.identifier=="SCORE"),s=i?.value,n=i?.externalScored!=="human";if(!t||!i)return S;let a=[...Array(Number(t)+1).keys()];return h`${this.myTemplate?this.myTemplate({scores:a,score:s,disabled:n}):S}`}};l([u({type:String,attribute:"view"})],it.prototype,"view",2),l([u({type:Boolean})],it.prototype,"disabled",2),l([_({context:O,subscribe:!0})],it.prototype,"computedContext",2),it=l([g("test-scoring-buttons")],it);var Ar=class extends v{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");if(!r){this.myTemplate=null;return}this.myTemplate=Z(r)}_switchView(r){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:r}))}firstUpdated(r){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return h`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):S}`}};l([_({context:He,subscribe:!0})],Ar.prototype,"sessionContext",2),Ar=l([g("test-view-toggle")],Ar);var At=class extends v{constructor(){super(...arguments);this.view=null}render(){let e=this.computedContext?.testParts.flatMap(c=>c.sections.flatMap(d=>d.items)).find(c=>c.active);if(!e||!e.variables)return h``;if(e.category==="dep-informational")return h`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(c=>c.identifier==="completionStatus")?.value,i=e?.variables.find(c=>c.identifier=="SCORE"),s=parseFloat(i?.value),n=e.externalScored;return h`<div>${t!=="completed"?this.dataset.textNoResponse:!n&&s!==void 0&&!Number.isNaN(s)?s>0?this.dataset.textCorrect:this.dataset.textIncorrect:n==="externalMachine"?Number.isNaN(s)||s===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${s===0?"geen punten":s==1?"\xE9\xE9n punt":`${s} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:n==="human"?Number.isNaN(s)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};l([_({context:O,subscribe:!0})],At.prototype,"computedContext",2),l([u({type:String,attribute:"view"})],At.prototype,"view",2),At=l([g("test-scoring-feedback")],At);var Rr=class extends v{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})),this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return h` <slot></slot> `}};Rr.styles=x`
|
|
5315
5315
|
:host {
|
|
5316
|
-
${
|
|
5316
|
+
${B};
|
|
5317
5317
|
}
|
|
5318
5318
|
:host([disabled]) {
|
|
5319
|
-
${
|
|
5319
|
+
${j};
|
|
5320
5320
|
}
|
|
5321
|
-
`,
|
|
5321
|
+
`,Rr=l([g("test-check-item")],Rr);var ke=class extends v{constructor(){super(...arguments);this.itemURL=null;this.itemDoc=null;this.itemXML=null;this.templateContent=null}async handleItemURLChange(){if(this.itemURL)try{let{promise:e}=await Je().load(this.itemURL);this.itemDoc=(await e).htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Je().parse(this.itemXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:h``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(bi),this.shadowRoot.adoptedStyleSheets=[e]}render(){return h`
|
|
5322
5322
|
${this.templateContent}
|
|
5323
5323
|
<slot></slot>
|
|
5324
|
-
${
|
|
5325
|
-
`}};l([u({type:String,attribute:"item-url"})],
|
|
5324
|
+
${gi(this.itemDoc,h`<span>Loading...</span>`)}
|
|
5325
|
+
`}};l([u({type:String,attribute:"item-url"})],ke.prototype,"itemURL",2),l([E()],ke.prototype,"itemDoc",2),l([E()],ke.prototype,"itemXML",2),l([M("itemURL",{waitUntilFirstUpdate:!0})],ke.prototype,"handleItemURLChange",1),l([M("itemXML",{waitUntilFirstUpdate:!0})],ke.prototype,"handleItemXMLChange",1),ke=l([g("item-container")],ke);var Rt=Symbol("computedItemContext");var kt=class extends v{render(){let r=this.computedContext;if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,n)=>h`
|
|
5326
5326
|
<h3>${n}</h3>
|
|
5327
5327
|
<table>
|
|
5328
5328
|
<thead>
|
|
@@ -5348,7 +5348,7 @@ div.full-correct-response-inline {
|
|
|
5348
5348
|
</table>
|
|
5349
5349
|
`;return h`
|
|
5350
5350
|
${i(e,"Response Variables")} ${i(t,"Outcome Variables")}
|
|
5351
|
-
`}};
|
|
5351
|
+
`}};kt.styles=x`
|
|
5352
5352
|
table {
|
|
5353
5353
|
width: 100%;
|
|
5354
5354
|
border-collapse: collapse;
|
|
@@ -5369,7 +5369,7 @@ div.full-correct-response-inline {
|
|
|
5369
5369
|
margin-top: 20px;
|
|
5370
5370
|
font-size: 16px;
|
|
5371
5371
|
}
|
|
5372
|
-
`,l([_({context:
|
|
5372
|
+
`,l([_({context:Rt,subscribe:!0})],kt.prototype,"computedContext",2),kt=l([g("print-item-variables")],kt);var Ko=x`
|
|
5373
5373
|
display: inline-flex;
|
|
5374
5374
|
align-items: center;
|
|
5375
5375
|
cursor: pointer;
|
|
@@ -5382,7 +5382,7 @@ div.full-correct-response-inline {
|
|
|
5382
5382
|
`,Qo=x`
|
|
5383
5383
|
cursor: not-allowed;
|
|
5384
5384
|
opacity: 0.8;
|
|
5385
|
-
|
|
5385
|
+
`,T0=x`
|
|
5386
5386
|
${Ko};
|
|
5387
5387
|
border: 1px solid gray;
|
|
5388
5388
|
`;var re=class extends v{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._hasCorrectResponse=!1;this._previousActiveItem=""}updated(){if(!this._hasCorrectResponse||this._previousActiveItem!==this.computedContext?.identifier){this._previousActiveItem=this.computedContext?.identifier;let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this._hasCorrectResponse=e||t}this.disabled=!this._hasCorrectResponse}_toggleState(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}_getDisplayedText(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return h` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `}};re.styles=x`
|
|
@@ -5392,7 +5392,7 @@ div.full-correct-response-inline {
|
|
|
5392
5392
|
:host([disabled]) {
|
|
5393
5393
|
${Qo};
|
|
5394
5394
|
}
|
|
5395
|
-
`,l([_({context:
|
|
5395
|
+
`,l([_({context:Rt,subscribe:!0})],re.prototype,"computedContext",2),l([u({type:Boolean,reflect:!0})],re.prototype,"shown",2),l([u({type:Boolean,reflect:!0})],re.prototype,"disabled",2),l([u({type:String})],re.prototype,"showCorrectText",2),l([u({type:String})],re.prototype,"hideCorrectText",2),l([u({type:String})],re.prototype,"noCorrectResponseText",2),re=l([g("item-show-correct-response")],re);var St=class extends v{constructor(){super();this.configContext={};this._onItemContextChanged=this._handleItemContextChanged.bind(this);this._onAssessmentItemConnected=this._handleAssessmentItemConnected.bind(this);this._onHandleShowCorrectResponse=this._handleShowCorrectResponse.bind(this);this._onHandleShowCandidateCorrection=this._handleShowCandidateCorrection.bind(this);this._onHandleSwitchCorrectResponseMode=this._handleSwitchCorrectResponseMode.bind(this);this.addEventListener("qti-item-context-updated",this._onItemContextChanged),this.addEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected),this.addEventListener("item-show-correct-response",this._onHandleShowCorrectResponse),this.addEventListener("item-show-candidate-correction",this._onHandleShowCandidateCorrection),this.addEventListener("item-switch-correct-response-mode",this._onHandleSwitchCorrectResponseMode)}_handleItemContextChanged(e){this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}_handleAssessmentItemConnected(e){let t=e.detail._context.variables;this._qtiAssessmentItem=e.detail,this.computedContext=this.computedContext?.identifier===this._qtiAssessmentItem.identifier?{...this.computedContext,title:this._qtiAssessmentItem.title}:{identifier:this._qtiAssessmentItem.identifier,title:this._qtiAssessmentItem.title,adaptive:this._qtiAssessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier,t||[])}_handleShowCorrectResponse(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCorrectResponse(e.detail)}_handleShowCandidateCorrection(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCandidateCorrection(e.detail)}_handleSwitchCorrectResponseMode(e){this._handleShowCorrectResponse(new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}}_updateItemVariablesInTestContext(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),n=t?.find(p=>p.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,c=s!==void 0&&!isNaN(s)&&s<=0,d=n==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:c,completed:d,variables:t}}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this._onItemContextChanged),this.removeEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected)}};l([E(),X({context:Rt})],St.prototype,"computedContext",2),l([E(),X({context:ne})],St.prototype,"configContext",2),St=l([g("qti-item")],St);export{Ji as INITIAL_TEST_CONTEXT,ke as ItemContainer,re as ItemShowCorrectResponse,kt as PrintItemVariables,Jr as QtiAnd,G as QtiAssessmentItem,_e as QtiAssessmentItemRef,Te as QtiAssessmentSection,pt as QtiAssessmentStimulusRef,et as QtiAssessmentTest,Jt as QtiAssociableHotspot,ut as QtiAssociateInteraction,Kr as QtiBaseValue,mt as QtiChoiceInteraction,jr as QtiCompanionMaterialsInfo,Xi as QtiContainerSize,Gi as QtiContains,oi as QtiContentBody,Yi as QtiCorrect,ve as QtiCustomInteraction,Wt as QtiCustomOperator,qt as QtiDefault,vs as QtiDelete,$e as QtiEndAttemptInteraction,Qr as QtiEqual,Zr as QtiEqualRounded,U as QtiExtendedTextInteraction,Gt as QtiFeedbackBlock,Yt as QtiFeedbackInline,is as QtiFieldValue,gt as QtiGap,ht as QtiGapImg,Kt as QtiGapMatchInteraction,ft as QtiGapText,Zi as QtiGcd,ce as QtiGraphicAssociateInteraction,Zt as QtiGraphicGapMatchInteraction,Qt as QtiGraphicOrderInteraction,Qi as QtiGt,es as QtiGte,Qe as QtiHotspotChoice,er as QtiHotspotInteraction,rr as QtiHottext,tr as QtiHottextInteraction,br as QtiIndex,sr as QtiInlineChoice,ye as QtiInlineChoiceInteraction,rs as QtiIsNull,St as QtiItem,cr as QtiItemBody,ur as QtiLookupOutcomeValue,ss as QtiLt,os as QtiLte,ei as QtiMapResponse,ti as QtiMapResponsePoint,ns as QtiMatch,xe as QtiMatchInteraction,ri as QtiMathOperator,or as QtiMediaInteraction,as as QtiMember,Ze as QtiModalFeedback,ls as QtiMultiple,cs as QtiNot,ts as QtiNull,ds as QtiOr,qe as QtiOrderInteraction,ps as QtiOrdered,he as QtiOutcomeDeclaration,dr as QtiOutcomeProcessing,Fi as QtiOutcomeProcessingProcessor,z as QtiPortableCustomInteraction,Vi as QtiPositionObjectInteraction,nr as QtiPositionObjectStage,us as QtiPower,gr as QtiPrintedVariable,ms as QtiProduct,Gr as QtiPrompt,bs as QtiRandom,Et as QtiRandomInteger,Ui as QtiResponseCondition,we as QtiResponseDeclaration,mr as QtiResponseElse,Wi as QtiResponseElseIf,hr as QtiResponseIf,pr as QtiResponseProcessing,Ki as QtiRound,fr as QtiRoundTo,me as QtiRubricBlock,pe as QtiRule,de as QtiSelectPointInteraction,Bi as QtiSetOutcomeValue,ji as QtiSetOutcomeValueRule,Ve as QtiSimpleAssociableChoice,Ee as QtiSimpleChoice,Ce as QtiSliderInteraction,si as QtiStringMatch,ni as QtiStylesheet,ii as QtiSubtract,hs as QtiSum,fs as QtiSumExpression,ai as QtiTest,Er as QtiTestFeedback,Ae as QtiTestPart,J as QtiTextEntryInteraction,lr as QtiUploadInteraction,gs as QtiVariable,Rr as TestCheckItem,Re as TestContainer,Cr as TestEndAttempt,wt as TestItemLink,Q as TestNavigation,ze as TestNext,wr as TestPagingButtonsStamp,Fe as TestPrev,Tr as TestPrintContext,_t as TestPrintVariables,it as TestScoringButtons,At as TestScoringFeedback,_r as TestSectionButtonsStamp,Tt as TestSectionLink,te as TestShowCorrectResponse,rt as TestStamp,W as TestView,Ar as TestViewToggle,Sn as qtiAndMixin,Mn as qtiSubtractMixin,ue as testContext};
|
|
5396
5396
|
/*! Bundled license information:
|
|
5397
5397
|
|
|
5398
5398
|
@lit/context/lib/context-request-event.js:
|