@citolab/qti-components 6.9.1-beta.12 → 6.9.1-beta.13
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/dist/{chunk-62FWJYVB.js → chunk-FGJTTWL5.js} +2 -2
- package/dist/custom-elements.json +8 -0
- package/dist/index.js +73 -60
- package/dist/item.css +17 -4
- package/dist/qti-components/index.js +1 -1
- package/dist/qti-item/index.d.ts +2 -0
- package/dist/qti-item/index.js +20 -7
- package/dist/qti-loader/index.js +1 -1
- package/dist/qti-transformers/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnPropertyDescriptor,Ji=Object.getOwnPropertyDescriptors;var Fr=Object.getOwnPropertySymbols;var Gi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable;var Xr=s=>{throw TypeError(s)};var Br=(s,t,e)=>t in s?jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,C=(s,t)=>{for(var e in t||(t={}))Gi.call(t,e)&&Br(s,e,t[e]);if(Fr)for(var e of Fr(t))Qi.call(t,e)&&Br(s,e,t[e]);return s},_=(s,t)=>Ki(s,Ji(t));var l=(s,t,e,r)=>{for(var i=r>1?void 0:r?Zi(t,e):t,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(t,e,i):n(i))||i);return r&&i&&jr(t,e,i),i};var Yr=(s,t,e)=>t.has(s)||Xr("Cannot "+e);var R=(s,t,e)=>(Yr(s,t,"read from private field"),e?e.call(s):t.get(s)),qt=(s,t,e)=>t.has(s)?Xr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),Wr=(s,t,e,r)=>(Yr(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e);var ie=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var Ee=class{constructor(t,e,r,i){var o;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=(o=n.subscribe)!=null?o:!1}else this.context=e,this.callback=r,this.subscribe=i!=null?i:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ie(this.context,this.t,this.subscribe))}};var wt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var er=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},Ce=class extends wt{constructor(t,e,r){var i,o;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{let a=n.composedPath()[0];n.context===this.context&&a!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,a,n.subscribe))},this.onProviderRequest=n=>{let a=n.composedPath()[0];if(n.context!==this.context||a===this.host)return;let c=new Set;for(let[p,{consumerHost:f}]of this.subscriptions)c.has(p)||(c.add(p),f.dispatchEvent(new ie(this.context,p,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(i=this.host).addController)==null||o.call(i,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new er(this.context))}};function tr({context:s}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new Ce(this,{context:s}))}),{get(){return t.get.call(this)},set(i){var o;return(o=r.get(this))==null||o.setValue(i),t.set.call(this,i)},init(i){var o;return(o=r.get(this))==null||o.setValue(i),i}};{t.constructor.addInitializer(n=>{r.set(n,new Ce(n,{context:s}))});let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let n=new WeakMap;o={get(){return n.get(this)},set(a){r.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;o=_(C({},i),{set(a){r.get(this).setValue(a),n==null||n.call(this,a)}})}return void Object.defineProperty(t,e,o)}}}function J({context:s,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ee(this,{context:s,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new Ee(i,{context:s,callback:o=>{i[r]=o},subscribe:t})})}}var Kr=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Zr=new WeakMap,Oe=s=>{let t=Zr.get(s);return t===void 0&&Zr.set(s,t=new Map),t},ts=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Oe(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){Oe(this).set(t,String(e))}removeAttribute(t){Oe(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Oe(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Kr(this);return this.__internals=t,t}getAttribute(t){let e=Oe(this).get(t);return e!=null?e:null}};var rs=class extends ts{},Jr=rs;var is=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},ss=is;var Gr=new ss;var Ue=globalThis,Et=Ue.ShadowRoot&&(Ue.ShadyCSS===void 0||Ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rr=Symbol(),Qr=new WeakMap,ze=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==rr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Et&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Qr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Qr.set(e,t))}return t}toString(){return this.cssText}},ei=s=>new ze(typeof s=="string"?s:s+"",void 0,rr),b=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1],s[0]);return new ze(e,s,rr)},ir=(s,t)=>{if(Et)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Ue.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},Ct=Et||Ue.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ei(e)})(s):s;var{is:os,defineProperty:ns,getOwnPropertyDescriptor:as,getOwnPropertyNames:ls,getOwnPropertySymbols:cs,getPrototypeOf:ds}=Object,I=globalThis,ii;(ii=I.customElements)!=null||(I.customElements=Gr);var ti=I.trustedTypes,ps=ti?ti.emptyScript:"",sr=I.reactiveElementPolyfillSupport,Fe=(s,t)=>s,Be={toAttribute(s,t){switch(t){case Boolean:s=s?ps:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch(r){e=null}}return e}},kt=(s,t)=>!os(s,t),ri={attribute:!0,type:String,converter:Be,reflect:!1,hasChanged:kt},si,oi;(si=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(oi=I.litPropertyMetadata)!=null||(I.litPropertyMetadata=new WeakMap);var ni,G=class extends((ni=globalThis.HTMLElement)!=null?ni:Jr){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ri){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&ns(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){var n;let{get:i,set:o}=(n=as(this.prototype,t))!=null?n:{get(){return this[e]},set(a){this[e]=a}};return{get(){return i==null?void 0:i.call(this)},set(a){let c=i==null?void 0:i.call(this);o.call(this,a),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:ri}static _$Ei(){if(this.hasOwnProperty(Fe("elementProperties")))return;let t=ds(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Fe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fe("properties"))){let e=this.properties,r=[...ls(e),...cs(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(Ct(i))}else t!==void 0&&e.push(Ct(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return ir(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var i;return(i=r.hostConnected)==null?void 0:i.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var o;let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(((o=r.converter)==null?void 0:o.toAttribute)!==void 0?r.converter:Be).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){var o;let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:Be;this._$Em=i,this[i]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,r){var i;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((i=r.hasChanged)!=null?i:kt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){var i;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((i=this._$Ej)!=null?i:this._$Ej=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,a]of this._$Ep)this[n]=a;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[n,a]of o)a.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(o=>{var n;return(n=o.hostUpdate)==null?void 0:n.call(o)}),this.update(e)):this._$EU()}catch(o){throw t=!1,this._$EU(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}},ai;G.elementStyles=[],G.shadowRootOptions={mode:"open"},G[Fe("elementProperties")]=new Map,G[Fe("finalized")]=new Map,sr==null||sr({ReactiveElement:G}),((ai=I.reactiveElementVersions)!=null?ai:I.reactiveElementVersions=[]).push("2.0.4");var ke=globalThis,Tt=ke.trustedTypes,li=Tt?Tt.createPolicy("lit-html",{createHTML:s=>s}):void 0,ar="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,lr="?"+Q,hs=`<${lr}>`,be=ke.document===void 0?{createTreeWalker:()=>({})}:document,Xe=()=>be.createComment(""),Ye=s=>s===null||typeof s!="object"&&typeof s!="function",cr=Array.isArray,gi=s=>cr(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",or=`[
|
|
2
|
-
\f\r]`,je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),pi=/'/g,hi=/"/g,fi=/^(?:script|style|textarea|title)$/i,dr=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),h=dr(1),pr=dr(2),_o=dr(3),L=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),mi=new WeakMap,fe=be.createTreeWalker(be,129);function bi(s,t){if(!cr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return li!==void 0?li.createHTML(t):t}var vi=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=je;for(let a=0;a<e;a++){let c=s[a],p,f,g=-1,y=0;for(;y<c.length&&(n.lastIndex=y,f=n.exec(c),f!==null);)y=n.lastIndex,n===je?f[1]==="!--"?n=ci:f[1]!==void 0?n=di:f[2]!==void 0?(fi.test(f[2])&&(i=RegExp("</"+f[2],"g")),n=ge):f[3]!==void 0&&(n=ge):n===ge?f[0]===">"?(n=i!=null?i:je,g=-1):f[1]===void 0?g=-2:(g=n.lastIndex-f[2].length,p=f[1],n=f[3]===void 0?ge:f[3]==='"'?hi:pi):n===hi||n===pi?n=ge:n===ci||n===di?n=je:(n=ge,i=void 0);let v=n===ge&&s[a+1].startsWith("/>")?" ":"";o+=n===je?c+hs:g>=0?(r.push(p),c.slice(0,g)+ar+c.slice(g)+Q+v):c+Q+(g===-2?a:v)}return[bi(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},We=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[p,f]=vi(t,e);if(this.el=s.createElement(p,r),fe.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=fe.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let g of i.getAttributeNames())if(g.endsWith(ar)){let y=f[n++],v=i.getAttribute(g).split(Q),w=/([.?@])?(.*)/.exec(y);c.push({type:1,index:o,name:w[2],strings:v,ctor:w[1]==="."?_t:w[1]==="?"?St:w[1]==="@"?Rt:ye}),i.removeAttribute(g)}else g.startsWith(Q)&&(c.push({type:6,index:o}),i.removeAttribute(g));if(fi.test(i.tagName)){let g=i.textContent.split(Q),y=g.length-1;if(y>0){i.textContent=Tt?Tt.emptyScript:"";for(let v=0;v<y;v++)i.append(g[v],Xe()),fe.nextNode(),c.push({type:2,index:++o});i.append(g[y],Xe())}}}else if(i.nodeType===8)if(i.data===lr)c.push({type:2,index:o});else{let g=-1;for(;(g=i.data.indexOf(Q,g+1))!==-1;)c.push({type:7,index:o}),g+=Q.length-1}o++}}static createElement(t,e){let r=be.createElement("template");return r.innerHTML=t,r}};function ve(s,t,e=s,r){var n,a,c;if(t===L)return t;let i=r!==void 0?(n=e.o)==null?void 0:n[r]:e.l,o=Ye(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?((c=e.o)!=null?c:e.o=[])[r]=i:e.l=i),i!==void 0&&(t=ve(s,i._$AS(s,t.values),i,r)),t}var At=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var p;let{el:{content:e},parts:r}=this._$AD,i=((p=t==null?void 0:t.creationScope)!=null?p:be).importNode(e,!0);fe.currentNode=i;let o=fe.nextNode(),n=0,a=0,c=r[0];for(;c!==void 0;){if(n===c.index){let f;c.type===2?f=new Te(o,o.nextSibling,this,t):c.type===1?f=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(f=new Mt(o,this,t)),this._$AV.push(f),c=r[++a]}n!==(c==null?void 0:c.index)&&(o=fe.nextNode(),n++)}return fe.currentNode=be,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Te=class s{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this.v}constructor(t,e,r,i){var o;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this.v=(o=i==null?void 0:i.isConnected)!=null?o:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ve(this,t,e),Ye(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):gi(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==E&&Ye(this._$AH)?this._$AA.nextSibling.data=t:this.T(be.createTextNode(t)),this._$AH=t}$(t){var o;let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=We.createElement(bi(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{let n=new At(i,this),a=n.u(this.options);n.p(e),this.T(a),this._$AH=n}}_$AC(t){let e=mi.get(t.strings);return e===void 0&&mi.set(t.strings,e=new We(t)),e}k(t){cr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(Xe()),this.O(Xe()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}},ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=ve(this,t,e,0),n=!Ye(t)||t!==this._$AH&&t!==L,n&&(this._$AH=t);else{let a=t,c,p;for(t=o[0],c=0;c<o.length-1;c++)p=ve(this,a[r+c],e,c),p===L&&(p=this._$AH[c]),n||(n=!Ye(p)||p!==this._$AH[c]),p===E?t=E:t!==E&&(t+=(p!=null?p:"")+o[c+1]),this._$AH[c]=p}n&&!i&&this.j(t)}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},_t=class extends ye{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===E?void 0:t}},St=class extends ye{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},Rt=class extends ye{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){var n;if((t=(n=ve(this,t,e,0))!=null?n:E)===L)return;let r=this._$AH,i=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==E&&(r===E||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},Mt=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ve(this,t)}},yi={M:ar,P:Q,A:lr,C:1,L:vi,R:At,D:gi,V:ve,I:Te,H:ye,N:St,U:Rt,B:_t,F:Mt},nr=ke.litHtmlPolyfillSupport,ui;nr==null||nr(We,Te),((ui=ke.litHtmlVersions)!=null?ui:ke.litHtmlVersions=[]).push("3.2.0");var xi=(s,t,e)=>{var o,n;let r=(o=e==null?void 0:e.renderBefore)!=null?o:t,i=r._$litPart$;if(i===void 0){let a=(n=e==null?void 0:e.renderBefore)!=null?n:null;r._$litPart$=i=new Te(t.insertBefore(Xe(),a),a,void 0,e!=null?e:{})}return i._$AI(s),i};var u=class extends G{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=xi(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return L}},qi;u._$litElement$=!0,u.finalized=!0,(qi=globalThis.litElementHydrateSupport)==null||qi.call(globalThis,{LitElement:u});var hr=globalThis.litElementPolyfillSupport;hr==null||hr({LitElement:u});var wi;((wi=globalThis.litElementVersions)!=null?wi:globalThis.litElementVersions=[]).push("4.1.0");var m=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};var ms={attribute:!0,type:String,converter:Be,reflect:!1,hasChanged:kt},us=(s=ms,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,s),r==="accessor"){let{name:n}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,s)},init(a){return a!==void 0&&this.P(n,void 0,s),a}}}if(r==="setter"){let{name:n}=e;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,s)}}throw Error("Unsupported decorator location: "+r)};function d(s){return(t,e)=>typeof e=="object"?us(s,t,e):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?_(C({},r),{wrapped:!0}):r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,t,e)}function q(s){return d(_(C({},s),{state:!0,attribute:!1}))}var se=(s,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(s,t,e),e);function Ke(s,t){return(e,r,i)=>{let o=n=>{var a,c;return(c=(a=n.renderRoot)==null?void 0:a.querySelector(s))!=null?c:null};if(t){let{get:n,set:a}=typeof r=="object"?e:i!=null?i:(()=>{let c=Symbol();return{get(){return this[c]},set(p){this[c]=p}}})();return se(e,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return se(e,r,{get(){return o(this)}})}}function Ei(s){return(t,e)=>{let{slot:r,selector:i}=s!=null?s:{},o="slot"+(r?`[name=${r}]`:":not([name])");return se(t,e,{get(){var c,p;let n=(c=this.renderRoot)==null?void 0:c.querySelector(o),a=(p=n==null?void 0:n.assignedElements(s))!=null?p:[];return i===void 0?a:a.filter(f=>f.matches(i))}})}}function S(s,t){let e=C({waitUntilFirstUpdate:!1},t);return(r,i)=>{let{update:o}=r,n=Array.isArray(s)?s:[s];r.update=function(a){n.forEach(c=>{let p=c;if(a.has(p)){let f=a.get(p),g=this[p];f!==g&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](f,g)}}),o.call(this,a)}}}var Ci=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],O="item";var $=class extends u{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(i=>i.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(i=>i.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:Ci};this._initialContext=_(C({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=_(C({},this._context),{variables:[...this._context.variables,e.detail.variable]}),this._initialContext=this._context,e.stopPropagation()}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:i}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(i)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:i}=e.detail;this.updateOutcomeVariable(r,i),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>C({identifier:e.identifier,value:e.value,type:e.type},e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=_(C({},this._context),{variables:this._context.variables.map(r=>{let i=e.find(o=>o.identifier===r.identifier);return i?C(C({},r),i):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let i=this._interactionElements.find(o=>o.responseIdentifier===r.identifier);i&&(i.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(r.identifier))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===r.responseIdentifier);o&&(o.response=r.response)}}render(){return h`<slot></slot>`}showCorrectResponse(e){let i=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of i){let n=this._interactionElements.find(a=>a.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=e?o.response:"")}}processResponse(e=!0){var i;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((i=this._context.variables.find(o=>o.identifier==="numAttempts"))==null?void 0:i.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:i}=e.detail;this.updateResponseVariable(r,i)}updateResponseVariable(e,r){this._context=_(C({},this._context),{variables:this._context.variables.map(i=>i.identifier!==e?i:_(C({},i),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:Array.isArray(r)?[...r]:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var o;let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=_(C({},this._context),{variables:this._context.variables.map(n=>n.identifier!==e?n:_(C({},n),{value:i.cardinality==="single"?r:[...n.value,r]}))}),this._feedbackElements.forEach(n=>n.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(o=this._context.variables.find(n=>n.identifier===e))==null?void 0:o.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],$.prototype,"title",2),l([d({type:String})],$.prototype,"identifier",2),l([d({type:String})],$.prototype,"adaptive",2),l([d({type:String})],$.prototype,"timeDependent",2),l([d({type:Boolean})],$.prototype,"disabled",2),l([S("disabled",{waitUntilFirstUpdate:!0})],$.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],$.prototype,"readonly",2),l([S("readonly",{waitUntilFirstUpdate:!0})],$.prototype,"_handleReadonlyChange",2),l([tr({context:O})],$.prototype,"_context",2),$=l([m("qti-assessment-item")],$);var gs=String.raw,Ze=()=>{let s,t={async load(e,r=!1){return new Promise((i,o)=>{gr(e,r).then(n=>(s=n,i(t)))})},parse(e){return s=fr(e),t},path:e=>(vs(s,e),t),fn(e){return e(s),t},pciHooks(e){let r=["hook","module"],i=e.substring(0,e.lastIndexOf("/"));for(let o of r)s.querySelectorAll("["+o+"]").forEach(a=>{let c=a.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",i+"/"+encodeURIComponent(c+(c.endsWith(".js")?"":".js"))))});return t},customInteraction(e,r){let i=s.querySelector("qti-custom-interaction"),o=i.querySelector("object");return i.setAttribute("data-base-ref",e),i.setAttribute("data-base-item",e+r),i.setAttribute("data",o.getAttribute("data")),i.setAttribute("width",o.getAttribute("width")),i.setAttribute("height",o.getAttribute("height")),i.removeChild(o),t},convertCDATAtoComment(){return ys(s),t},stripStyleSheets(){return xs(s),t},html(){return new XMLSerializer().serializeToString(Lt(s))},xml(){return new XMLSerializer().serializeToString(s)},htmldoc(){return Lt(s)},xmldoc(){return s}};return t},ur=()=>{let s,t={async load(e){return new Promise((r,i)=>{gr(e).then(o=>(s=o,r(t)))})},parse(e){s=fr(e)},assessmentTest(){let e=s.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t},$t=()=>{let s,t={async load(e){return new Promise((r,i)=>{gr(e).then(o=>(s=o,r(t)))})},parse(e){return s=fr(e),t},fn(e){return e(s),t},items(){return bs(s)},html(){return new XMLSerializer().serializeToString(Lt(s))},xml(){return new XMLSerializer().serializeToString(s)},htmldoc(){return Lt(s)},xmldoc(){return s}};return t},fs=gs`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
1
|
+
var Br=Object.defineProperty,Yi=Object.defineProperties,Wi=Object.getOwnPropertyDescriptor,Ki=Object.getOwnPropertyDescriptors;var zr=Object.getOwnPropertySymbols;var Zi=Object.prototype.hasOwnProperty,Ji=Object.prototype.propertyIsEnumerable;var jr=s=>{throw TypeError(s)};var Fr=(s,t,e)=>t in s?Br(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,C=(s,t)=>{for(var e in t||(t={}))Zi.call(t,e)&&Fr(s,e,t[e]);if(zr)for(var e of zr(t))Ji.call(t,e)&&Fr(s,e,t[e]);return s},_=(s,t)=>Yi(s,Ki(t));var l=(s,t,e,r)=>{for(var i=r>1?void 0:r?Wi(t,e):t,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(t,e,i):n(i))||i);return r&&i&&Br(t,e,i),i};var Xr=(s,t,e)=>t.has(s)||jr("Cannot "+e);var V=(s,t,e)=>(Xr(s,t,"read from private field"),e?e.call(s):t.get(s)),Jt=(s,t,e)=>t.has(s)?jr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),Gt=(s,t,e,r)=>(Xr(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e);var ie=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var Ee=class{constructor(t,e,r,i){var o;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=(o=n.subscribe)!=null?o:!1}else this.context=e,this.callback=r,this.subscribe=i!=null?i:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ie(this.context,this.t,this.subscribe))}};var yt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Qt=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},Ce=class extends yt{constructor(t,e,r){var i,o;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{let a=n.composedPath()[0];n.context===this.context&&a!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,a,n.subscribe))},this.onProviderRequest=n=>{let a=n.composedPath()[0];if(n.context!==this.context||a===this.host)return;let c=new Set;for(let[p,{consumerHost:f}]of this.subscriptions)c.has(p)||(c.add(p),f.dispatchEvent(new ie(this.context,p,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(i=this.host).addController)==null||o.call(i,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Qt(this.context))}};function er({context:s}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new Ce(this,{context:s}))}),{get(){return t.get.call(this)},set(i){var o;return(o=r.get(this))==null||o.setValue(i),t.set.call(this,i)},init(i){var o;return(o=r.get(this))==null||o.setValue(i),i}};{t.constructor.addInitializer(n=>{r.set(n,new Ce(n,{context:s}))});let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let n=new WeakMap;o={get(){return n.get(this)},set(a){r.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;o=_(C({},i),{set(a){r.get(this).setValue(a),n==null||n.call(this,a)}})}return void Object.defineProperty(t,e,o)}}}function J({context:s,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ee(this,{context:s,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new Ee(i,{context:s,callback:o=>{i[r]=o},subscribe:t})})}}var Yr=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Wr=new WeakMap,Oe=s=>{let t=Wr.get(s);return t===void 0&&Wr.set(s,t=new Map),t},Qi=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Oe(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){Oe(this).set(t,String(e))}removeAttribute(t){Oe(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Oe(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Yr(this);return this.__internals=t,t}getAttribute(t){let e=Oe(this).get(t);return e!=null?e:null}};var es=class extends Qi{},Kr=es;var ts=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},rs=ts;var Zr=new rs;var Ue=globalThis,xt=Ue.ShadowRoot&&(Ue.ShadyCSS===void 0||Ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,tr=Symbol(),Jr=new WeakMap,ze=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==tr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(xt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Jr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Jr.set(e,t))}return t}toString(){return this.cssText}},Gr=s=>new ze(typeof s=="string"?s:s+"",void 0,tr),b=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1],s[0]);return new ze(e,s,tr)},rr=(s,t)=>{if(xt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Ue.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},qt=xt||Ue.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Gr(e)})(s):s;var{is,defineProperty:ss,getOwnPropertyDescriptor:os,getOwnPropertyNames:ns,getOwnPropertySymbols:as,getPrototypeOf:ls}=Object,N=globalThis,ti;(ti=N.customElements)!=null||(N.customElements=Zr);var Qr=N.trustedTypes,cs=Qr?Qr.emptyScript:"",ir=N.reactiveElementPolyfillSupport,Fe=(s,t)=>s,Be={toAttribute(s,t){switch(t){case Boolean:s=s?cs:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch(r){e=null}}return e}},wt=(s,t)=>!is(s,t),ei={attribute:!0,type:String,converter:Be,reflect:!1,hasChanged:wt},ri,ii;(ri=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(ii=N.litPropertyMetadata)!=null||(N.litPropertyMetadata=new WeakMap);var si,G=class extends((si=globalThis.HTMLElement)!=null?si:Kr){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ei){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&ss(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){var n;let{get:i,set:o}=(n=os(this.prototype,t))!=null?n:{get(){return this[e]},set(a){this[e]=a}};return{get(){return i==null?void 0:i.call(this)},set(a){let c=i==null?void 0:i.call(this);o.call(this,a),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:ei}static _$Ei(){if(this.hasOwnProperty(Fe("elementProperties")))return;let t=ls(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Fe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fe("properties"))){let e=this.properties,r=[...ns(e),...as(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(qt(i))}else t!==void 0&&e.push(qt(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return rr(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var i;return(i=r.hostConnected)==null?void 0:i.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){var o;let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(((o=r.converter)==null?void 0:o.toAttribute)!==void 0?r.converter:Be).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){var o;let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:Be;this._$Em=i,this[i]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,r){var i;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((i=r.hasChanged)!=null?i:wt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){var i;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((i=this._$Ej)!=null?i:this._$Ej=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,a]of this._$Ep)this[n]=a;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[n,a]of o)a.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(o=>{var n;return(n=o.hostUpdate)==null?void 0:n.call(o)}),this.update(e)):this._$EU()}catch(o){throw t=!1,this._$EU(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}},oi;G.elementStyles=[],G.shadowRootOptions={mode:"open"},G[Fe("elementProperties")]=new Map,G[Fe("finalized")]=new Map,ir==null||ir({ReactiveElement:G}),((oi=N.reactiveElementVersions)!=null?oi:N.reactiveElementVersions=[]).push("2.0.4");var ke=globalThis,Et=ke.trustedTypes,ni=Et?Et.createPolicy("lit-html",{createHTML:s=>s}):void 0,nr="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,ar="?"+Q,ds=`<${ar}>`,be=ke.document===void 0?{createTreeWalker:()=>({})}:document,Xe=()=>be.createComment(""),Ye=s=>s===null||typeof s!="object"&&typeof s!="function",lr=Array.isArray,mi=s=>lr(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",sr=`[
|
|
2
|
+
\f\r]`,je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ai=/-->/g,li=/>/g,ge=RegExp(`>|${sr}(?:([^\\s"'>=/]+)(${sr}*=${sr}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ci=/'/g,di=/"/g,ui=/^(?:script|style|textarea|title)$/i,cr=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),h=cr(1),dr=cr(2),To=cr(3),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),pi=new WeakMap,fe=be.createTreeWalker(be,129);function gi(s,t){if(!lr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ni!==void 0?ni.createHTML(t):t}var fi=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=je;for(let a=0;a<e;a++){let c=s[a],p,f,g=-1,y=0;for(;y<c.length&&(n.lastIndex=y,f=n.exec(c),f!==null);)y=n.lastIndex,n===je?f[1]==="!--"?n=ai:f[1]!==void 0?n=li:f[2]!==void 0?(ui.test(f[2])&&(i=RegExp("</"+f[2],"g")),n=ge):f[3]!==void 0&&(n=ge):n===ge?f[0]===">"?(n=i!=null?i:je,g=-1):f[1]===void 0?g=-2:(g=n.lastIndex-f[2].length,p=f[1],n=f[3]===void 0?ge:f[3]==='"'?di:ci):n===di||n===ci?n=ge:n===ai||n===li?n=je:(n=ge,i=void 0);let v=n===ge&&s[a+1].startsWith("/>")?" ":"";o+=n===je?c+ds:g>=0?(r.push(p),c.slice(0,g)+nr+c.slice(g)+Q+v):c+Q+(g===-2?a:v)}return[gi(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},We=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[p,f]=fi(t,e);if(this.el=s.createElement(p,r),fe.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=fe.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let g of i.getAttributeNames())if(g.endsWith(nr)){let y=f[n++],v=i.getAttribute(g).split(Q),w=/([.?@])?(.*)/.exec(y);c.push({type:1,index:o,name:w[2],strings:v,ctor:w[1]==="."?kt:w[1]==="?"?Tt:w[1]==="@"?At:ye}),i.removeAttribute(g)}else g.startsWith(Q)&&(c.push({type:6,index:o}),i.removeAttribute(g));if(ui.test(i.tagName)){let g=i.textContent.split(Q),y=g.length-1;if(y>0){i.textContent=Et?Et.emptyScript:"";for(let v=0;v<y;v++)i.append(g[v],Xe()),fe.nextNode(),c.push({type:2,index:++o});i.append(g[y],Xe())}}}else if(i.nodeType===8)if(i.data===ar)c.push({type:2,index:o});else{let g=-1;for(;(g=i.data.indexOf(Q,g+1))!==-1;)c.push({type:7,index:o}),g+=Q.length-1}o++}}static createElement(t,e){let r=be.createElement("template");return r.innerHTML=t,r}};function ve(s,t,e=s,r){var n,a,c;if(t===M)return t;let i=r!==void 0?(n=e.o)==null?void 0:n[r]:e.l,o=Ye(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?((c=e.o)!=null?c:e.o=[])[r]=i:e.l=i),i!==void 0&&(t=ve(s,i._$AS(s,t.values),i,r)),t}var Ct=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var p;let{el:{content:e},parts:r}=this._$AD,i=((p=t==null?void 0:t.creationScope)!=null?p:be).importNode(e,!0);fe.currentNode=i;let o=fe.nextNode(),n=0,a=0,c=r[0];for(;c!==void 0;){if(n===c.index){let f;c.type===2?f=new Te(o,o.nextSibling,this,t):c.type===1?f=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(f=new _t(o,this,t)),this._$AV.push(f),c=r[++a]}n!==(c==null?void 0:c.index)&&(o=fe.nextNode(),n++)}return fe.currentNode=be,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Te=class s{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this.v}constructor(t,e,r,i){var o;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this.v=(o=i==null?void 0:i.isConnected)!=null?o:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ve(this,t,e),Ye(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):mi(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==E&&Ye(this._$AH)?this._$AA.nextSibling.data=t:this.T(be.createTextNode(t)),this._$AH=t}$(t){var o;let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=We.createElement(gi(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{let n=new Ct(i,this),a=n.u(this.options);n.p(e),this.T(a),this._$AH=n}}_$AC(t){let e=pi.get(t.strings);return e===void 0&&pi.set(t.strings,e=new We(t)),e}k(t){lr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(Xe()),this.O(Xe()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}},ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=ve(this,t,e,0),n=!Ye(t)||t!==this._$AH&&t!==M,n&&(this._$AH=t);else{let a=t,c,p;for(t=o[0],c=0;c<o.length-1;c++)p=ve(this,a[r+c],e,c),p===M&&(p=this._$AH[c]),n||(n=!Ye(p)||p!==this._$AH[c]),p===E?t=E:t!==E&&(t+=(p!=null?p:"")+o[c+1]),this._$AH[c]=p}n&&!i&&this.j(t)}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},kt=class extends ye{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===E?void 0:t}},Tt=class extends ye{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},At=class extends ye{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){var n;if((t=(n=ve(this,t,e,0))!=null?n:E)===M)return;let r=this._$AH,i=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==E&&(r===E||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},_t=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ve(this,t)}},bi={M:nr,P:Q,A:ar,C:1,L:fi,R:Ct,D:mi,V:ve,I:Te,H:ye,N:Tt,U:At,B:kt,F:_t},or=ke.litHtmlPolyfillSupport,hi;or==null||or(We,Te),((hi=ke.litHtmlVersions)!=null?hi:ke.litHtmlVersions=[]).push("3.2.0");var vi=(s,t,e)=>{var o,n;let r=(o=e==null?void 0:e.renderBefore)!=null?o:t,i=r._$litPart$;if(i===void 0){let a=(n=e==null?void 0:e.renderBefore)!=null?n:null;r._$litPart$=i=new Te(t.insertBefore(Xe(),a),a,void 0,e!=null?e:{})}return i._$AI(s),i};var u=class extends G{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=vi(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return M}},yi;u._$litElement$=!0,u.finalized=!0,(yi=globalThis.litElementHydrateSupport)==null||yi.call(globalThis,{LitElement:u});var pr=globalThis.litElementPolyfillSupport;pr==null||pr({LitElement:u});var xi;((xi=globalThis.litElementVersions)!=null?xi:globalThis.litElementVersions=[]).push("4.1.0");var m=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};var ps={attribute:!0,type:String,converter:Be,reflect:!1,hasChanged:wt},hs=(s=ps,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,s),r==="accessor"){let{name:n}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,s)},init(a){return a!==void 0&&this.P(n,void 0,s),a}}}if(r==="setter"){let{name:n}=e;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,s)}}throw Error("Unsupported decorator location: "+r)};function d(s){return(t,e)=>typeof e=="object"?hs(s,t,e):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?_(C({},r),{wrapped:!0}):r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,t,e)}function q(s){return d(_(C({},s),{state:!0,attribute:!1}))}var se=(s,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(s,t,e),e);function Ke(s,t){return(e,r,i)=>{let o=n=>{var a,c;return(c=(a=n.renderRoot)==null?void 0:a.querySelector(s))!=null?c:null};if(t){let{get:n,set:a}=typeof r=="object"?e:i!=null?i:(()=>{let c=Symbol();return{get(){return this[c]},set(p){this[c]=p}}})();return se(e,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return se(e,r,{get(){return o(this)}})}}function qi(s){return(t,e)=>{let{slot:r,selector:i}=s!=null?s:{},o="slot"+(r?`[name=${r}]`:":not([name])");return se(t,e,{get(){var c,p;let n=(c=this.renderRoot)==null?void 0:c.querySelector(o),a=(p=n==null?void 0:n.assignedElements(s))!=null?p:[];return i===void 0?a:a.filter(f=>f.matches(i))}})}}function S(s,t){let e=C({waitUntilFirstUpdate:!1},t);return(r,i)=>{let{update:o}=r,n=Array.isArray(s)?s:[s];r.update=function(a){n.forEach(c=>{let p=c;if(a.has(p)){let f=a.get(p),g=this[p];f!==g&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](f,g)}}),o.call(this,a)}}}var wi=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var L=class extends u{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(i=>i.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(i=>i.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:wi};this._initialContext=_(C({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=_(C({},this._context),{variables:[...this._context.variables,e.detail.variable]}),this._initialContext=this._context,e.stopPropagation()}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:i}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(i)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:i}=e.detail;this.updateOutcomeVariable(r,i),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>C({identifier:e.identifier,value:e.value,type:e.type},e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=_(C({},this._context),{variables:this._context.variables.map(r=>{let i=e.find(o=>o.identifier===r.identifier);return i?C(C({},r),i):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let i=this._interactionElements.find(o=>o.responseIdentifier===r.identifier);i&&(i.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(r.identifier))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===r.responseIdentifier);o&&(o.response=r.response)}}render(){return h`<slot></slot>`}showCorrectResponse(e){let i=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of i){let n=this._interactionElements.find(a=>a.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=e?o.response:"")}}processResponse(e=!0){var i;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((i=this._context.variables.find(o=>o.identifier==="numAttempts"))==null?void 0:i.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:i}=e.detail;this.updateResponseVariable(r,i)}updateResponseVariable(e,r){this._context=_(C({},this._context),{variables:this._context.variables.map(i=>i.identifier!==e?i:_(C({},i),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:Array.isArray(r)?[...r]:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var o;let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=_(C({},this._context),{variables:this._context.variables.map(n=>n.identifier!==e?n:_(C({},n),{value:i.cardinality==="single"?r:[...n.value,r]}))}),this._feedbackElements.forEach(n=>n.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(o=this._context.variables.find(n=>n.identifier===e))==null?void 0:o.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],L.prototype,"title",2),l([d({type:String})],L.prototype,"identifier",2),l([d({type:String})],L.prototype,"adaptive",2),l([d({type:String})],L.prototype,"timeDependent",2),l([d({type:Boolean})],L.prototype,"disabled",2),l([S("disabled",{waitUntilFirstUpdate:!0})],L.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],L.prototype,"readonly",2),l([S("readonly",{waitUntilFirstUpdate:!0})],L.prototype,"_handleReadonlyChange",2),l([er({context:I})],L.prototype,"_context",2),L=l([m("qti-assessment-item")],L);var ms=String.raw,Ze=()=>{let s,t={async load(e,r=!1){return new Promise((i,o)=>{ur(e,r).then(n=>(s=n,i(t)))})},parse(e){return s=gr(e),t},path:e=>(fs(s,e),t),fn(e){return e(s),t},pciHooks(e){let r=["hook","module"],i=e.substring(0,e.lastIndexOf("/"));for(let o of r)s.querySelectorAll("["+o+"]").forEach(a=>{let c=a.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",i+"/"+encodeURIComponent(c+(c.endsWith(".js")?"":".js"))))});return t},customInteraction(e,r){let i=s.querySelector("qti-custom-interaction"),o=i.querySelector("object");return i.setAttribute("data-base-ref",e),i.setAttribute("data-base-item",e+r),i.setAttribute("data",o.getAttribute("data")),i.setAttribute("width",o.getAttribute("width")),i.setAttribute("height",o.getAttribute("height")),i.removeChild(o),t},convertCDATAtoComment(){return bs(s),t},stripStyleSheets(){return vs(s),t},html(){return new XMLSerializer().serializeToString(St(s))},xml(){return new XMLSerializer().serializeToString(s)},htmldoc(){return St(s)},xmldoc(){return s}};return t},mr=()=>{let s,t={async load(e){return new Promise((r,i)=>{ur(e).then(o=>(s=o,r(t)))})},parse(e){s=gr(e)},assessmentTest(){let e=s.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t},Rt=()=>{let s,t={async load(e){return new Promise((r,i)=>{ur(e).then(o=>(s=o,r(t)))})},parse(e){return s=gr(e),t},fn(e){return e(s),t},items(){return gs(s)},html(){return new XMLSerializer().serializeToString(St(s))},xml(){return new XMLSerializer().serializeToString(s)},htmldoc(){return St(s)},xmldoc(){return s}};return t},us=ms`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
4
4
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
5
5
|
<xsl:template match="@*|node()">
|
|
6
6
|
<xsl:copy>
|
|
@@ -22,23 +22,23 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
22
22
|
<xsl:apply-templates/>
|
|
23
23
|
</xsl:element>
|
|
24
24
|
</xsl:template>
|
|
25
|
-
</xsl:stylesheet>`;function
|
|
25
|
+
</xsl:stylesheet>`;function gs(s){let t=[];return s.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var hr=null;function ur(s,t=!0){return t&&hr!==null&&hr.abort(),new Promise((e,r)=>{let i=new XMLHttpRequest;hr=i,i.open("GET",s,!0),i.responseType="document",i.onload=()=>{i.status>=200&&i.status<300?e(i.responseXML):r(i.statusText)},i.onerror=()=>{r(i.statusText)},i.send()})}function gr(s){return new DOMParser().parseFromString(s,"text/xml")}function St(s){let t=new XSLTProcessor,e=new DOMParser().parseFromString(us,"text/xml");return t.importStylesheet(e),t.transformToFragment(s,document)}function fs(s,t){t.endsWith("/")||(t+="/"),s.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{var o;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href"),e.getAttribute("primary-path")&&(r="primary-path");let i=(o=e.getAttribute(r))==null?void 0:o.trim();if(!i.startsWith("data:")&&!i.startsWith("http")){let n=t+encodeURIComponent(i);e.setAttribute(r,n)}})}function bs(s){s.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function vs(s){s.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Ae=class extends u{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0});if(this.dispatchEvent(e)){let o=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);o?await this.loadAndAppendStimulus(o):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async loadAndAppendStimulus(e){var o;let r=this.href.substring(0,this.href.lastIndexOf("/")),i=await Ze().load(this.href).then(n=>n.path(r).htmldoc());if(i){let n=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.append(...n),((o=i.querySelector("qti-assessment-stimulus"))==null?void 0:o.title).includes("(lijst)")&&e.classList.add("qti-stimulus-list")}}};l([d({type:String})],Ae.prototype,"identifier",2),l([d({type:String})],Ae.prototype,"href",2),Ae=l([m("qti-assessment-stimulus-ref")],Ae);var Ei={toAttribute:s=>s?"true":"false",fromAttribute:s=>s==="true"};function O(s,t){class e extends s{constructor(...o){super(...o);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}handleDisabledChange(o,n){this.tabIndex=n?-1:0,n&&this.blur()}setInternalState(o,n){n&&!this._internals.states.has(o)?this._internals.states.add(o):!n&&this._internals.states.has(o)&&this._internals.states.delete(o)}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(o){o.altKey||o.code==="Space"&&(o.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return h`<slot></slot>`}}return l([d({type:String})],e.prototype,"identifier",2),l([d({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),l([d({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Ei})],e.prototype,"disabled",2),l([d({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Ei})],e.prototype,"readonly",2),l([S("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var Ci=b`
|
|
26
26
|
:host {
|
|
27
27
|
display: block;
|
|
28
28
|
}
|
|
29
|
-
`;var _e=class extends u{render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};_e.styles=
|
|
29
|
+
`;var _e=class extends u{render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};_e.styles=Ci,_e=l([m("qti-item-body")],_e);var Mt=class extends u{render(){return h`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};Mt=l([m("qti-prompt")],Mt);var Lt=class extends u{firstUpdated(t){super.firstUpdated(t);let e=this,r=this.getAttribute("href");if(r!==null){let i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.media="screen",i.href=r,e.appendChild(i),this.styleLink=i}if(this.textContent!==null){let i=document.createElement("style");i.media="screen",i.textContent=this.textContent,e.appendChild(i),this.styleLink=i}}disconnectedCallback(){if(this.styleLink)try{this.styleLink.remove()}catch(t){console.log("could not remove stylesheet")}}};Lt=l([m("qti-stylesheet")],Lt);var oe=class extends u{render(){return h`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML);return r.length>1||t.cardinality==="multiple"||t.cardinality==="ordered"?r:r[0]}};oe=l([m("qti-variabledeclaration")],oe);var U=class extends oe{constructor(){super(...arguments);this.externalScored=null}render(){var r,i;let e=(i=(r=this.itemContext)==null?void 0:r.variables.find(o=>o.identifier===this.identifier))==null?void 0:i.value;return h`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let r=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(i.getAttribute("source-value")),n=parseInt(i.getAttribute("target-value"));(isNaN(o)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),r.set(o,n)}return r}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};U.styles=[b`
|
|
30
30
|
:host {
|
|
31
31
|
display: none;
|
|
32
32
|
}
|
|
33
|
-
`],l([d({type:String,attribute:"base-type"})],
|
|
33
|
+
`],l([d({type:String,attribute:"base-type"})],U.prototype,"baseType",2),l([d({type:String,attribute:"external-scored"})],U.prototype,"externalScored",2),l([d({type:String})],U.prototype,"identifier",2),l([d({type:String})],U.prototype,"cardinality",2),l([J({context:I,subscribe:!0}),q()],U.prototype,"itemContext",2),U=l([m("qti-outcome-declaration")],U);var ee=class extends oe{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(i=>i.identifier===this.identifier))==null?void 0:r.value;return h`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};t.value=this.defaultValues(t),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}get correctResponse(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent),r[i].remove()}}return t}get mapping(){return this.querySelector("qti-mapping")}};ee.styles=[b`
|
|
34
34
|
:host {
|
|
35
35
|
display: none;
|
|
36
36
|
}
|
|
37
|
-
`],l([d({type:String,attribute:"base-type"})],ee.prototype,"baseType",2),l([d({type:String})],ee.prototype,"identifier",2),l([d({type:String})],ee.prototype,"cardinality",2),l([J({context:
|
|
37
|
+
`],l([d({type:String,attribute:"base-type"})],ee.prototype,"baseType",2),l([d({type:String})],ee.prototype,"identifier",2),l([d({type:String})],ee.prototype,"cardinality",2),l([J({context:I,subscribe:!0}),q()],ee.prototype,"itemContext",2),ee=l([m("qti-response-declaration")],ee);var $t=class extends u{};$t=l([m("qti-companion-materials-info")],$t);var Dt=class extends u{render(){return h`<slot></slot>`}};Dt=l([m("qti-content-body")],Dt);var z=class extends u{handleclassNamesChange(t,e){this.classNames.split(" ").forEach(i=>{switch(i){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};z.styles=b`
|
|
38
38
|
:host {
|
|
39
39
|
display: block;
|
|
40
40
|
}
|
|
41
|
-
`,l([d({type:String})],
|
|
41
|
+
`,l([d({type:String})],z.prototype,"id",2),l([d({type:String})],z.prototype,"use",2),l([d({type:String})],z.prototype,"view",2),l([d({type:String,attribute:"class"})],z.prototype,"classNames",2),l([S("classNames",{waitUntilFirstUpdate:!0})],z.prototype,"handleclassNamesChange",1),z=l([m("qti-rubric-block")],z);var ys=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Je=s=>{if(typeof s=="string")return s;let t=ys();return t==="."?s.toLocaleString():s.toString().replace(".","").replace(t,".")};function fr(s){return s==null}function Ge(s){return s.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var $=class extends u{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this.closest("qti-assessment-item").getOutcome(t);if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!fr(this.identifier)&&!fr(e==null?void 0:e.value)&&this.identifier===e.value||!1,this.showFeedback(r)}showFeedback(t){this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}};l([d({type:String,attribute:"show-hide"})],$.prototype,"showHide",2),l([d({type:String,attribute:"outcome-identifier"})],$.prototype,"outcomeIdentifier",2),l([d({type:String})],$.prototype,"identifier",2),l([d({type:String,attribute:!1})],$.prototype,"showStatus",2);var Qe=class extends ${render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(t){this.checkShowFeedback(this.outcomeIdentifier)}};Qe.styles=b`
|
|
42
42
|
:host {
|
|
43
43
|
display: block;
|
|
44
44
|
}
|
|
@@ -48,21 +48,21 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
48
48
|
.off {
|
|
49
49
|
display: none;
|
|
50
50
|
}
|
|
51
|
-
`,Qe=l([m("qti-feedback-block")],Qe);var et=class extends
|
|
51
|
+
`,Qe=l([m("qti-feedback-block")],Qe);var et=class extends ${constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${this.showStatus}"></slot> `}};et.styles=b`
|
|
52
52
|
.on {
|
|
53
53
|
display: inline-block;
|
|
54
54
|
}
|
|
55
55
|
.off {
|
|
56
56
|
display: none;
|
|
57
57
|
}
|
|
58
|
-
`,et=l([m("qti-feedback-inline")],et);var tt=class extends
|
|
58
|
+
`,et=l([m("qti-feedback-inline")],et);var tt=class extends ${constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${this.showStatus}"></slot> `}};tt.styles=b`
|
|
59
59
|
.on {
|
|
60
60
|
display: inline-block;
|
|
61
61
|
}
|
|
62
62
|
.off {
|
|
63
63
|
display: none;
|
|
64
64
|
}
|
|
65
|
-
`,tt=l([m("qti-modal-feedback")],tt);var
|
|
65
|
+
`,tt=l([m("qti-modal-feedback")],tt);var F=s=>s!=null?s:E;var T=class extends u{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}set correctResponse(e){console.warn("correctResponse is not implemented")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};l([d({attribute:"response-identifier"})],T.prototype,"responseIdentifier",2),l([d({reflect:!0,type:Boolean})],T.prototype,"disabled",2),l([d({reflect:!0,type:Boolean})],T.prototype,"readonly",2);var{I:xs}=bi;var Ti=s=>s.strings===void 0,ki=()=>document.createComment(""),Se=(s,t,e)=>{var o;let r=s._$AA.parentNode,i=t===void 0?s._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(ki(),i),a=r.insertBefore(ki(),i);e=new xs(n,a,s,s.options)}else{let n=e._$AB.nextSibling,a=e._$AM,c=a!==s;if(c){let p;(o=e._$AQ)==null||o.call(e,s),e._$AM=s,e._$AP!==void 0&&(p=s._$AU)!==a._$AU&&e._$AP(p)}if(n!==i||c){let p=e._$AA;for(;p!==n;){let f=p.nextSibling;r.insertBefore(p,i),p=f}}}return e},ne=(s,t,e=s)=>(s._$AI(t,e),s),qs={},Ai=(s,t=qs)=>s._$AH=t,_i=s=>s._$AH,Ht=s=>{var r;(r=s._$AP)==null||r.call(s,!1,!0);let t=s._$AA,e=s._$AB.nextSibling;for(;t!==e;){let i=t.nextSibling;t.remove(),t=i}};var ae={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},te=s=>(...t)=>({_$litDirective$:s,values:t}),B=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this.t=t,this._$AM=e,this.i=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var rt=(s,t)=>{var r;let e=s._$AN;if(e===void 0)return!1;for(let i of e)(r=i._$AO)==null||r.call(i,t,!1),rt(i,t);return!0},Pt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while((e==null?void 0:e.size)===0)},Si=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),Cs(t)}};function ws(s){this._$AN!==void 0?(Pt(this),this._$AM=s,Si(this)):this._$AM=s}function Es(s,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)rt(r[o],!1),Pt(r[o]);else r!=null&&(rt(r,!1),Pt(r));else rt(this,s)}var Cs=s=>{var t,e;s.type==ae.CHILD&&((t=s._$AP)!=null||(s._$AP=Es),(e=s._$AQ)!=null||(s._$AQ=ws))},Nt=class extends B{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Si(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,i;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),e&&(rt(this,t),Pt(this))}setValue(t){if(Ti(this.t))this.t._$AI(t,this);else{let e=[...this.t._$AH];e[this.i]=t,this.t._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Vt=()=>new vr,vr=class{},br=new WeakMap,Ri=te(class extends Nt{render(s){return E}update(s,[t]){var r;let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=(r=s.options)==null?void 0:r.host,this.rt(this.ct=s.element)),E}rt(s){var t;if(this.isConnected||(s=void 0),typeof this.Y=="function"){let e=(t=this.ht)!=null?t:globalThis,r=br.get(e);r===void 0&&(r=new WeakMap,br.set(e,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,t,e;return typeof this.Y=="function"?(t=br.get((s=this.ht)!=null?s:globalThis))==null?void 0:t.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var j=class extends T{constructor(){super(...arguments);this.textareaRef=Vt();this._value=""}handleclassNamesChange(e,r){this.classNames.split(" ").forEach(o=>{if(o.startsWith("qti-height-lines")){let n=o.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(n))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
|
|
66
66
|
/* PK: display host as block, else design will be collapsed */
|
|
67
67
|
:host {
|
|
68
68
|
display: block;
|
|
@@ -76,20 +76,20 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
76
76
|
`]}render(){return h`<slot name="prompt"></slot
|
|
77
77
|
><textarea
|
|
78
78
|
part="textarea"
|
|
79
|
-
${
|
|
79
|
+
${Ri(this.textareaRef)}
|
|
80
80
|
spellcheck="false"
|
|
81
81
|
autocomplete="off"
|
|
82
82
|
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
83
83
|
@keyup="${this.textChanged}"
|
|
84
84
|
@change="${this.textChanged}"
|
|
85
85
|
@blur="${e=>{let r=e.target;r.checkValidity()?r.setCustomValidity(""):(r.setCustomValidity(this.dataset.patternmaskMessage||"Invalid input"),r.reportValidity())}}"
|
|
86
|
-
placeholder="${
|
|
87
|
-
maxlength="${
|
|
88
|
-
pattern="${
|
|
86
|
+
placeholder="${F(this.placeholderText?this.placeholderText:void 0)}"
|
|
87
|
+
maxlength="${F(this.expectedLength?this.expectedLength:void 0)}"
|
|
88
|
+
pattern="${F(this.patternMask?this.patternMask:void 0)}"
|
|
89
89
|
?disabled="${this.disabled}"
|
|
90
90
|
?readonly="${this.readonly}"
|
|
91
91
|
.value=${this._value}
|
|
92
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([d({type:Number,attribute:"expected-length"})],
|
|
92
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([d({type:Number,attribute:"expected-length"})],j.prototype,"expectedLength",2),l([d({type:String,attribute:"pattern-mask"})],j.prototype,"patternMask",2),l([d({type:String,attribute:"placeholder-text"})],j.prototype,"placeholderText",2),l([q()],j.prototype,"_value",2),l([d({type:String,attribute:"class"})],j.prototype,"classNames",2),l([S("classNames",{waitUntilFirstUpdate:!0})],j.prototype,"handleclassNamesChange",1),j=l([m("qti-extended-text-interaction")],j);function Mi(s,t){let e,r=C({},t);return(i,o)=>{let{connectedCallback:n,disconnectedCallback:a}=i;i.connectedCallback=function(){var f;n.call(this);let c=g=>{let y=Array.from(this.querySelectorAll(s));for(let v of g){let w=Array.from(v.addedNodes).map(A=>A),k=Array.from(v.addedNodes).map(A=>A);v.type==="childList"&&w.find(A=>y.includes(A))&&this[o](w,k)}};e=new MutationObserver(c),e.observe(this,{childList:!0,subtree:!0});let p=(f=this.querySelectorAll(s))!=null?f:[];this[o](Array.from(p),[])},i.disconnectedCallback=function(){a.call(this),e.disconnect()}}}var D=class extends T{constructor(){super(...arguments);this._value="";this._correctValue="";this._size=5;this.inputRef=Vt()}handleclassNamesChange(e,r){r.split(" ").forEach(o=>{if(o.startsWith("qti-input-width")){let n=o.replace("qti-input-width-","");this._size=parseInt(n)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
|
|
93
93
|
[part='correct'] {
|
|
94
94
|
position: absolute;
|
|
95
95
|
width: 100%;
|
|
@@ -104,15 +104,15 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
104
104
|
@keyup="${this.textChanged}"
|
|
105
105
|
@change="${this.textChanged}"
|
|
106
106
|
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
107
|
-
placeholder="${
|
|
107
|
+
placeholder="${F(this.placeholderText?this.placeholderText:void 0)}"
|
|
108
108
|
.value="${this._value}"
|
|
109
109
|
size="${this._size}"
|
|
110
|
-
pattern="${
|
|
110
|
+
pattern="${F(this.patternMask?this.patternMask:void 0)}"
|
|
111
111
|
?disabled="${this.disabled}"
|
|
112
112
|
?readonly="${this.readonly}"
|
|
113
113
|
/>
|
|
114
114
|
<div part="correct">${this._correctValue}</div>
|
|
115
|
-
`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([d({type:Number,attribute:"expected-length"})],
|
|
115
|
+
`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([d({type:Number,attribute:"expected-length"})],D.prototype,"expectedLength",2),l([d({type:String,attribute:"pattern-mask"})],D.prototype,"patternMask",2),l([d({type:String,attribute:"placeholder-text"})],D.prototype,"placeholderText",2),l([q()],D.prototype,"_value",2),l([q()],D.prototype,"_correctValue",2),l([q()],D.prototype,"_size",2),l([d({type:String,attribute:"class"})],D.prototype,"classNames",2),l([S("classNames")],D.prototype,"handleclassNamesChange",1),D=l([m("qti-text-entry-interaction")],D);var le=(s,t)=>{class e extends s{constructor(...o){super(...o);this._choiceElements=[];this.responseIdentifier="";this.minChoices=0;this.maxChoices=1;this.disabled=!1;this._handleDisabledChange=(o,n)=>{this._choiceElements.forEach(a=>a.disabled=n)};this.readonly=!1;this._handleReadonlyChange=(o,n)=>{this._choiceElements.forEach(a=>a.readonly=n)}}_handleMaxChoicesChange(o,n){this._determineInputType()}validate(){let o=this._choiceElements.filter(n=>this._getChoiceChecked(n)).length;return this.maxChoices!==0&&o>this.maxChoices?!1:o>=this.minChoices}set response(o){let n=Array.isArray(o)?o:[o];this._choiceElements.forEach(a=>{this._setChoiceChecked(a,n.includes(a.identifier))})}set correctResponse(o){let n=Array.isArray(o)?o:[o];if(n.length===0){this._choiceElements.forEach(a=>{a.removeAttribute("data-correct-response")});return}this._choiceElements.forEach(a=>{a.setAttribute("data-correct-response",n.includes(a.identifier)?"true":"false")})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${t}`,this._registerChoiceElement),this.addEventListener(`unregister-${t}`,this._unregisterChoiceElement),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${t}`,this._registerChoiceElement),this.removeEventListener(`unregister-${t}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler)}_registerChoiceElement(o){o.stopPropagation();let n=o.target;n.disabled=this.disabled,this._choiceElements.push(n),this._setInputType(n)}_unregisterChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(o=>{this._setInputType(o)})}_setInputType(o){o.setAttribute("role",this.maxChoices===1?"radio":"checkbox")}_choiceElementSelectedHandler(o){this._toggleChoiceChecked(o.target),this.maxChoices===1&&this._choiceElements.forEach(n=>{n.identifier!==o.detail.identifier&&this._setChoiceChecked(n,!1)}),this._handleChoiceSelection()}_setChoiceChecked(o,n){o.setAttribute("aria-checked",n.toString())}_getChoiceChecked(o){return o.getAttribute("aria-checked")==="true"}_toggleChoiceChecked(o){let n=this._getChoiceChecked(o);this._setChoiceChecked(o,!n)}_handleChoiceSelection(){let o=this._choiceElements.filter(c=>this._getChoiceChecked(c)),n=o.map(c=>c.identifier);if(this.maxChoices>1&&this.maxChoices!==0){let c=o.length>=this.maxChoices;this._choiceElements.forEach(p=>{this._getChoiceChecked(p)||(p.disabled=c)})}let a=this.maxChoices===1?n[0]||void 0:n;this._saveResponse(a)}_saveResponse(o){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:o}}))}}return l([d({attribute:"response-identifier"})],e.prototype,"responseIdentifier",2),l([d({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),l([d({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),l([S("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),l([d({reflect:!0,type:Boolean})],e.prototype,"disabled",2),l([S("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),l([d({reflect:!0,type:Boolean})],e.prototype,"readonly",2),l([S("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),e};var It=class extends le(u,"qti-hottext"){constructor(){super(...arguments);this.render=()=>h`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};It=l([m("qti-hottext-interaction")],It);var it=class extends B{constructor(t){if(super(t),this.it=E,t.type!==ae.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===E||t==null)return this._t=void 0,this.it=t;if(t===M)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};it.directiveName="unsafeHTML",it.resultType=1;var ce=te(it);var de=class extends T{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
|
|
116
116
|
:host {
|
|
117
117
|
display: inline-block;
|
|
118
118
|
}
|
|
@@ -142,7 +142,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
142
142
|
</select>
|
|
143
143
|
|
|
144
144
|
${ce(this.correctOption)}
|
|
145
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(r=>r.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,r)=>_(C({},e),{selected:r===0}))}set response(e){this.options=this.options.map(r=>(e===r.value&&(r.selected=!0),r))}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(r=>e===r.value).textContent}</span>`}choiceSelected(e){let r=e.target.value;this.options=this.options.map(i=>_(C({},i),{selected:i.value===r})),this.saveResponse(r)}};de.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],l([q()],de.prototype,"options",2),l([q()],de.prototype,"correctOption",2),l([d({attribute:"data-prompt",type:String})],de.prototype,"dataPrompt",2),de=l([m("qti-inline-choice-interaction")],de);var
|
|
145
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(r=>r.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,r)=>_(C({},e),{selected:r===0}))}set response(e){this.options=this.options.map(r=>(e===r.value&&(r.selected=!0),r))}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(r=>e===r.value).textContent}</span>`}choiceSelected(e){let r=e.target.value;this.options=this.options.map(i=>_(C({},i),{selected:i.value===r})),this.saveResponse(r)}};de.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],l([q()],de.prototype,"options",2),l([q()],de.prototype,"correctOption",2),l([d({attribute:"data-prompt",type:String})],de.prototype,"dataPrompt",2),de=l([m("qti-inline-choice-interaction")],de);var Ot=(s,t)=>{class e extends s{constructor(){super(...arguments);this._shuffle=!1}set shuffle(o){let n=this._shuffle;this._shuffle=o,o?this._shuffleChoices():this._resetShuffleChoices(),this.requestUpdate("shuffle",n)}get shuffle(){return this._shuffle}connectedCallback(){super.connectedCallback(),this.shuffle?this._shuffleChoices():this._resetShuffleChoices()}_shuffleChoices(){let o=Array.from(this.querySelectorAll(t)),n=[],a=[];o.forEach((y,v)=>{y.hasAttribute("fixed")?n.push({element:y,index:v}):a.push(y)}),a.length<=1&&console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");let c=!1,p=10,f=0;for(;!c&&f<p;){f++;for(let y=a.length-1;y>0;y--){let v=Math.floor(Math.random()*(y+1));[a[y],a[v]]=[a[v],a[y]]}if(c=a.some((y,v)=>o.indexOf(y)!==v),c)break}c||console.warn("Failed to shuffle the choices after multiple attempts.");let g=1;o.forEach((y,v)=>{y.hasAttribute("fixed")?y.style.setProperty("order",String(g++)):a.shift().style.setProperty("order",String(g++))})}_resetShuffleChoices(){Array.from(this.querySelectorAll("qti-simple-choice")).forEach((n,a)=>{n.style.setProperty("order","initial")})}}return l([d({type:String,reflect:!0,converter:ks})],e.prototype,"shuffle",1),e},ks={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}};var Li=(s,t)=>{class e extends s{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(o){o&&(this._classes=o.split(" "),this._addLabels())}get class(){var o;return((o=this._classes)==null?void 0:o.join(" "))||""}updated(o){super.updated(o),o.has("shuffle")&&this._addLabels()}_addLabels(){let o=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),n=a=>!isNaN(+a);if(o){let c=Array.from(this.querySelectorAll("qti-simple-choice")).map(p=>p).map((p,f)=>({el:p,order:n(p.style.order)?+p.style.order:f+1})).sort((p,f)=>p.order-f.order).map(p=>p.el);for(let p=0;p<c.length;p++)c[p].marker=this._getLabel(p+1)}}_getLabel(o){let n=this._classes.filter(p=>this._allLabels.includes(p)).pop(),a=this._classes.filter(p=>this._allLabelSuffixes.includes(p)).pop();!n&&a&&(n="qti-labels-upper-alpha");let c="";switch(n){case"qti-labels-decimal":c=`${o}`;break;case"qti-labels-lower-alpha":c=`${String.fromCharCode(97+o-1)}`;break;case"qti-labels-upper-alpha":c=`${String.fromCharCode(65+o-1)}`;break}return a==="qti-labels-suffix-period"?c+=".":a==="qti-labels-suffix-parenthesis"&&(c+=")"),c}}return l([d({type:String,reflect:!0})],e.prototype,"class",1),e};var $i=b`
|
|
146
146
|
[part='slot'] {
|
|
147
147
|
/* display: flex; */
|
|
148
148
|
/* flex-direction: column; */
|
|
@@ -182,11 +182,11 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
182
182
|
flex-direction: row;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
`;var Re=class extends
|
|
185
|
+
`;var Re=class extends Li(Ot(le(u,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){render(){return h` <slot name="prompt"></slot><slot part="slot"></slot>`}};Re.styles=$i,l([d({type:String})],Re.prototype,"orientation",2),Re=l([m("qti-choice-interaction")],Re);var st=class extends u{render(){return h`<slot></slot>`}process(){let t=new yr,e=[...this.children];t.process(e)}};st.styles=[b`
|
|
186
186
|
:host {
|
|
187
187
|
display: none;
|
|
188
188
|
}
|
|
189
|
-
`],st=l([m("qti-outcome-processing")],st);var
|
|
189
|
+
`],st=l([m("qti-outcome-processing")],st);var yr=class{process(t){for(let e of t)e.process()}};var Di=`<qti-response-processing>
|
|
190
190
|
<qti-response-condition>
|
|
191
191
|
<qti-response-if>
|
|
192
192
|
<qti-match>
|
|
@@ -203,7 +203,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
203
203
|
</qti-set-outcome-value>
|
|
204
204
|
</qti-response-else>
|
|
205
205
|
</qti-response-condition>
|
|
206
|
-
</qti-response-processing>`,
|
|
206
|
+
</qti-response-processing>`,Hi=`<qti-response-processing>
|
|
207
207
|
<qti-response-condition>
|
|
208
208
|
<qti-response-if>
|
|
209
209
|
<qti-is-null>
|
|
@@ -219,7 +219,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
219
219
|
</qti-set-outcome-value>
|
|
220
220
|
</qti-response-else>
|
|
221
221
|
</qti-response-condition>
|
|
222
|
-
</qti-response-processing>`,
|
|
222
|
+
</qti-response-processing>`,Pi=`<qti-response-processing>
|
|
223
223
|
<qti-response-condition>
|
|
224
224
|
<qti-response-if>
|
|
225
225
|
<qti-is-null>
|
|
@@ -235,19 +235,19 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
235
235
|
</qti-set-outcome-value>
|
|
236
236
|
</qti-response-else>
|
|
237
237
|
</qti-response-condition>
|
|
238
|
-
</qti-response-processing>`;var xe=class extends u{render(){return h`<slot></slot>`}process(){let t=[...this.children];for(let e of t)e.process()}firstUpdated(t){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),r=e[e.length-1].replace(".xml","");switch(this.innerHTML="",r){case"map_response":{this.appendChild(this.fragmentFromString(
|
|
238
|
+
</qti-response-processing>`;var xe=class extends u{render(){return h`<slot></slot>`}process(){let t=[...this.children];for(let e of t)e.process()}firstUpdated(t){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),r=e[e.length-1].replace(".xml","");switch(this.innerHTML="",r){case"map_response":{this.appendChild(this.fragmentFromString(Hi).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Pi).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(Di).firstElementChild.firstElementChild);break}}}fragmentFromString(t){return document.createRange().createContextualFragment(t)}};xe.styles=[b`
|
|
239
239
|
:host {
|
|
240
240
|
display: none;
|
|
241
241
|
}
|
|
242
|
-
`],xe=l([m("qti-response-processing")],xe);var
|
|
242
|
+
`],xe=l([m("qti-response-processing")],xe);var X=class extends u{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};X=l([m("qti-rule")],X);var Ut=class extends X{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.closest("qti-assessment-item").getVariable(t),r;return e.interpolationTable&&(r=e.interpolationTable.get(parseInt(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Je(r)}})),r)}};l([d({type:String})],Ut.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",Ut);var xr=class extends X{render(){return h`<slot></slot>`}process(){let t=[...this.children];for(let e=0;e<t.length;e++){let r=t[e];if(r.calculate()){r.process();return}}}};customElements.define("qti-response-condition",xr);var qr=class extends X{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,i=new wr(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(i)?i.map(o=>Je(o)):Je(i)}}))}},wr=class{constructor(t){this.expression=t}process(){let t=this.expression?this.expression.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}return t}};customElements.define("qti-set-outcome-value",qr);var ot=class extends u{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}};customElements.define("qti-response-else",ot);var nt=class extends ot{calculate(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}};customElements.define("qti-response-if",nt);var Er=class extends nt{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",Er);var x=class extends u{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(r)}case"qti-multiple":{let i=e.getResult();return i.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(o=>o.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.assessmentItem.getResponse(r);return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch(r){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return h`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
243
243
|
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};x.styles=b`
|
|
244
244
|
slot {
|
|
245
245
|
display: none;
|
|
246
246
|
}
|
|
247
|
-
`,l([q()],x.prototype,"result",2);var P=class extends x{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var jt=class extends _s(P){calculate(){return this.calculateChildren(Array.from(this.children))}};function _s(s){return class extends s{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate();if(typeof n=="string")if(n==="true")n=!0;else if(n==="false")n=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return n}).every(i=>typeof i=="boolean"&&i)}}}customElements.define("qti-and",jt);var Xt=class extends x{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};l([d({type:String,attribute:"base-type"})],Xt.prototype,"baseType",2);customElements.define("qti-base-value",Xt);var kr=class extends P{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",kr);var Tr=class extends x{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(t);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Tr);var Yt=class extends x{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(r.value),n=parseFloat(i.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([d({type:String})],Yt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Yt);var N=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Wt=class extends x{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):N.compareSingleValues(r.value,i.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([d({type:String})],Wt.prototype,"toleranceMode",2);customElements.define("qti-equal",Wt);var Ar=class extends x{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Ar);var _r=class extends P{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",_r);var Sr=class extends x{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",Sr);var Rr=class extends x{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",Rr);var Mr=class extends P{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",Mr);var Kt=class extends x{getResult(){let t=this.assessmentItem.getResponse(this.identifier);if(!t)return console.warn(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let n=e.mapEntries.find(a=>N.compareSingleValues(a.mapKey,o,t.baseType));n==null||n.mappedValue==null?i+=e.defaultValue:i+=n.mappedValue}return e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([d({type:String})],Kt.prototype,"identifier",2);customElements.define("qti-map-response",Kt);var Me=class extends u{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};l([d({attribute:"default-value",type:Number})],Me.prototype,"defaultValue",2),l([d({attribute:"lower-bound",type:Number})],Me.prototype,"lowerBound",2),l([d({attribute:"upper-bound",type:Number})],Me.prototype,"upperBound",2);customElements.define("qti-mapping",Me);var Lr=class s extends x{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return s.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;switch(e.cardinality){case"single":return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):N.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let i=0;i<t.value.length;i++)if(!N.compareSingleValues(e.value[i],t.value[i],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let i=0;for(let o of e.value){let n=null,a=[...t.value];for(let c of a)if(N.compareSingleValues(o,c,e.baseType)){n=c;break}if(n!==null)a.splice(a.indexOf(n),1);else return!1;i++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",Lr);var $r=class extends x{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType!==r.baseType&&console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};customElements.define("qti-member",$r);var Dr=class extends x{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};customElements.define("qti-multiple",Dr);var Hr=class extends x{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Hr);var Pr=class extends P{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate();if(typeof i=="string")if(i==="true")i=!0;else if(i==="false")i=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return i}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Pr);var Nr=class extends x{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};customElements.define("qti-ordered",Nr);var at=class extends u{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(i=>i.identifier===this.identifier))==null?void 0:r.value;return h`${JSON.stringify(t,null,2)}`}calculate(){let t=this.closest("qti-assessment-item"),e=this.identifier;return t.getVariable(e).value}};l([d({type:String})],at.prototype,"identifier",2),l([J({context:O,subscribe:!0}),q()],at.prototype,"itemContext",2);customElements.define("qti-printed-variable",at);var Vr=class extends x{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseInt(i.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};customElements.define("qti-product",Vr);var Zt=class extends x{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return N.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([d({type:String,attribute:"case-sensitive"})],Zt.prototype,"caseSensitive",2);customElements.define("qti-string-match",Zt);var Ir=class extends x{constructor(){super(),this._expression=new Or(Array.from(this.children))}getResult(){return this._expression.calculate()}},Or=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",Ir);var Ur=class extends x{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",Ur);var pe=class extends T{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)r&&(n.paths[a]=this.getResolvablePath(n.paths[a],r));return n}}catch(i){}return null};this.getResolvablePathString=(e,r)=>(e=e.replace(/\.js$/,""),e!=null&&e.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`));this.getResolvablePath=(e,r)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,r)):this.getResolvablePathString(e,r)}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];if(i){for(let o in i)if(i.hasOwnProperty(o)){let n=i[o];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),i=JSON.stringify(e);if(i!==this.rawResponse){this.rawResponse=i;let o=this.convertQtiVariableJSON(r);this.response=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set response(e){}getTAOConfig(e){let r=e.querySelectorAll("properties"),i={},o=a=>{let c={},p=a.getAttribute("key");if(p){let f=Array.from(a.children),g=f.map(v=>v.getAttribute("key"));g.length>0&&!g.find(v=>!Number.isInteger(+v))?c[p]=f.map(v=>n(v)):c[p]=a.textContent}return c},n=a=>{if(a){let c={};for(let p of a.children)c=C(C({},c),o(p));return c}};for(let a of r)return a.getAttribute("key")||(i=C(C({},i),n(a))),i;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",i=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=r=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);r=="IMS"?e.getInstance(i,o,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,i.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let r=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let o=i.querySelectorAll("qti-interaction-module");for(let n of o){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),p=n.getAttribute("fallback-path");if(a&&c){let f=p?this.combineRequireResolvePaths(this.getResolvablePath(c,r),this.getResolvablePath(p,r)):this.getResolvablePath(c,r),g=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(g,f)}}}return e}combineRequireResolvePaths(e,r){let i=Array.isArray(e)?e:[e],o=Array.isArray(r)?r:[r];return i.concat(o)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return h`<slot></slot>${this._errorMessage&&h`<div style="color:red">
|
|
247
|
+
`,l([q()],x.prototype,"result",2);var H=class extends x{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var zt=class extends Ts(H){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ts(s){return class extends s{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate();if(typeof n=="string")if(n==="true")n=!0;else if(n==="false")n=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return n}).every(i=>typeof i=="boolean"&&i)}}}customElements.define("qti-and",zt);var Ft=class extends x{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};l([d({type:String,attribute:"base-type"})],Ft.prototype,"baseType",2);customElements.define("qti-base-value",Ft);var Cr=class extends H{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Cr);var kr=class extends x{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(t);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",kr);var Bt=class extends x{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(r.value),n=parseFloat(i.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([d({type:String})],Bt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Bt);var P=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var jt=class extends x{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):P.compareSingleValues(r.value,i.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([d({type:String})],jt.prototype,"toleranceMode",2);customElements.define("qti-equal",jt);var Tr=class extends x{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Tr);var Ar=class extends H{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Ar);var _r=class extends x{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",_r);var Sr=class extends x{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",Sr);var Rr=class extends H{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",Rr);var Xt=class extends x{getResult(){let t=this.assessmentItem.getResponse(this.identifier);if(!t)return console.warn(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let n=e.mapEntries.find(a=>P.compareSingleValues(a.mapKey,o,t.baseType));n==null||n.mappedValue==null?i+=e.defaultValue:i+=n.mappedValue}return e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([d({type:String})],Xt.prototype,"identifier",2);customElements.define("qti-map-response",Xt);var Me=class extends u{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};l([d({attribute:"default-value",type:Number})],Me.prototype,"defaultValue",2),l([d({attribute:"lower-bound",type:Number})],Me.prototype,"lowerBound",2),l([d({attribute:"upper-bound",type:Number})],Me.prototype,"upperBound",2);customElements.define("qti-mapping",Me);var Mr=class s extends x{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return s.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;switch(e.cardinality){case"single":return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):P.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let i=0;i<t.value.length;i++)if(!P.compareSingleValues(e.value[i],t.value[i],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let i=0;for(let o of e.value){let n=null,a=[...t.value];for(let c of a)if(P.compareSingleValues(o,c,e.baseType)){n=c;break}if(n!==null)a.splice(a.indexOf(n),1);else return!1;i++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",Mr);var Lr=class extends x{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType!==r.baseType&&console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};customElements.define("qti-member",Lr);var $r=class extends x{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};customElements.define("qti-multiple",$r);var Dr=class extends x{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Dr);var Hr=class extends H{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate();if(typeof i=="string")if(i==="true")i=!0;else if(i==="false")i=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return i}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Hr);var Pr=class extends x{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};customElements.define("qti-ordered",Pr);var at=class extends u{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(i=>i.identifier===this.identifier))==null?void 0:r.value;return h`${JSON.stringify(t,null,2)}`}calculate(){let t=this.closest("qti-assessment-item"),e=this.identifier;return t.getVariable(e).value}};l([d({type:String})],at.prototype,"identifier",2),l([J({context:I,subscribe:!0}),q()],at.prototype,"itemContext",2);customElements.define("qti-printed-variable",at);var Nr=class extends x{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseInt(i.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};customElements.define("qti-product",Nr);var Yt=class extends x{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return P.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([d({type:String,attribute:"case-sensitive"})],Yt.prototype,"caseSensitive",2);customElements.define("qti-string-match",Yt);var Vr=class extends x{constructor(){super(),this._expression=new Ir(Array.from(this.children))}getResult(){return this._expression.calculate()}},Ir=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",Vr);var Or=class extends x{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",Or);var pe=class extends T{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)r&&(n.paths[a]=this.getResolvablePath(n.paths[a],r));return n}}catch(i){}return null};this.getResolvablePathString=(e,r)=>(e=e.replace(/\.js$/,""),e!=null&&e.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`));this.getResolvablePath=(e,r)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,r)):this.getResolvablePathString(e,r)}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];if(i){for(let o in i)if(i.hasOwnProperty(o)){let n=i[o];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),i=JSON.stringify(e);if(i!==this.rawResponse){this.rawResponse=i;let o=this.convertQtiVariableJSON(r);this.response=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set response(e){}getTAOConfig(e){let r=e.querySelectorAll("properties"),i={},o=a=>{let c={},p=a.getAttribute("key");if(p){let f=Array.from(a.children),g=f.map(v=>v.getAttribute("key"));g.length>0&&!g.find(v=>!Number.isInteger(+v))?c[p]=f.map(v=>n(v)):c[p]=a.textContent}return c},n=a=>{if(a){let c={};for(let p of a.children)c=C(C({},c),o(p));return c}};for(let a of r)return a.getAttribute("key")||(i=C(C({},i),n(a))),i;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",i=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=r=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);r=="IMS"?e.getInstance(i,o,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,i.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let r=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let o=i.querySelectorAll("qti-interaction-module");for(let n of o){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),p=n.getAttribute("fallback-path");if(a&&c){let f=p?this.combineRequireResolvePaths(this.getResolvablePath(c,r),this.getResolvablePath(p,r)):this.getResolvablePath(c,r),g=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(g,f)}}}return e}combineRequireResolvePaths(e,r){let i=Array.isArray(e)?e:[e],o=Array.isArray(r)?r:[r];return i.concat(o)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return h`<slot></slot>${this._errorMessage&&h`<div style="color:red">
|
|
248
248
|
<h1>Error</h1>
|
|
249
249
|
${this._errorMessage}
|
|
250
|
-
</div>`}`}};l([d({type:String,attribute:"response-identifier"})],pe.prototype,"responseIdentifier",2),l([d({type:String,attribute:"module"})],pe.prototype,"module",2),l([d({type:String,attribute:"custom-interaction-type-identifier"})],pe.prototype,"customInteractionTypeIdentifier",2),l([q()],pe.prototype,"_errorMessage",2),pe=l([m("qti-portable-custom-interaction")],pe);var Jt=class s{constructor(){this.touchStartTime=0;this.touchStartPoint=null;this.lastClickTime=0;this.isDraggable=!1;this.dragSource=null;this.dragClone=null;this.touchEndTriggered=!1;this.isDragging=!1;this.initialTransform="";this.hasDispatchedDragStart=!1;this.rootNode=null;this.focusedElement=null;this.focusableDropZones=[];this.currentDropZoneIndex=-1;this.dataTransfer={data:{},setData(t,e){this.data[t]=e},getData(t){return this.data[t]},effectAllowed:"move"};this.cloneOffset={x:0,y:0};this.lastTarget=null;this.currentDropTarget=null;this.allowClick=!0;this.copyStylesForDragClone=!0;this.dragOnClickEnabled=!1;this.useDragClone=!1;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;if(s.instance)return s.instance;s.instance=this,document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("keyup",this.handleKeyUp.bind(this))}addDraggableElements(t){t.forEach(e=>{e.setAttribute("tabindex","0"),e.addEventListener("focus",()=>this.focusedElement=e),e.addEventListener("blur",()=>this.focusedElement=null),e.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),e.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1})})}handleTouchStart(t){this.touchStartTime=Date.now();let{x:e,y:r}=this.getEventCoordinates(t);if(this.touchStartPoint={x:e,y:r},this.dragSource=t.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode(),this.dragOnClickEnabled&&(this.isDragging=!0,this.createDragClone(t,{clientX:e,clientY:r})),!this.useDragClone){let i=window.getComputedStyle(this.dragSource);this.initialTransform=i.transform==="none"?"":i.transform,this.initialTransition=i.transition||"",this.dragSource.style.transition="none";let o=this.dragSource.getBoundingClientRect();this.cloneOffset.x=e-o.left,this.cloneOffset.y=r-o.top,this.dragSource.style.zIndex="9999",this.dragSource.focus()}t.preventDefault()}handleTouchMove(t){if(this.isDraggable&&this.dragSource){let{x:e,y:r}=this.getEventCoordinates(t),i={clientX:e,clientY:r};this.calculateDragDistance(i)>=this.MIN_DRAG_DISTANCE&&(this.dragSource.style.pointerEvents="none",this.isDragging=!0),this.createDragClone(t,i),t.preventDefault()}}createDragClone(t,e){if(!this.isDragging)return;if(this.useDragClone){if(!this.dragClone){if(this.dragSource.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone=this.dragSource.cloneNode(!0),this.copyStylesForDragClone){let i=window.getComputedStyle(this.dragSource);for(let o of i)this.dragClone.style[o]=i.getPropertyValue(o)}this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),this.calculateClonePosition(e),this.setDragCloneStyles(e),this.dispatchCustomEvent(this.dragSource,"dragstart")}this.updateDragClonePosition(e)}else if(this.touchStartPoint){let i=e.clientX-this.touchStartPoint.x,o=e.clientY-this.touchStartPoint.y;this.dragSource.style.transform=`${this.initialTransform} translate(${i}px, ${o}px)`,this.hasDispatchedDragStart||(this.dispatchCustomEvent(this.dragSource,"dragstart"),this.hasDispatchedDragStart=!0)}let r=this.findDropTarget(t);r!==this.lastTarget&&(this.dispatchCustomEvent(r,"dragenter"),this.dispatchCustomEvent(this.lastTarget,"dragleave"),this.lastTarget=r),this.currentDropTarget=r,this.currentDropTarget&&this.dispatchCustomEvent(r,"dragover")}handleTouchEnd(t){var r;this.touchEndTriggered=!0,this.isDraggable=!1;let e=!1;if(this.currentDropTarget)this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),e=!0;else if(this.isDragging){let i=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});i.dataTransfer={dropEffect:"none"},(r=this.dragSource)==null||r.dispatchEvent(i)}this.resetDragState(e)}handleTouchCancel(t){this.resetDragState()}findDropTarget(t){let{x:e,y:r}=this.getEventCoordinates(t);return this.getDropTargetAtPoint(document,e,r)}getDropTargetAtPoint(t,e,r,i=0){if(i>2)return null;let n=t.elementFromPoint(e,r);if(!n)return null;if(n.hasAttribute("dropzone"))return n;let a=n.parentElement;for(;a;){if(a.hasAttribute("dropzone"))return a;a=a.parentElement}if(n.shadowRoot&&i<2){let c=this.getDropTargetAtPoint(n.shadowRoot,e,r,i+1);if(c)return c}return null}handleKeyDown(t){this.focusedElement&&(t.key===" "&&!this.isDragging?(t.preventDefault(),this.isDraggable=!0,this.dragSource=this.focusedElement,this.isDragging=!0,this.collectDropZones(),this.dispatchCustomEvent(this.dragSource,"dragstart")):t.key==="Tab"&&this.isDragging&&(t.preventDefault(),this.moveToNextDropZone()))}handleKeyUp(t){t.key===" "&&this.isDragging&&this.currentDropTarget&&(t.preventDefault(),this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),this.resetDragState(!0))}collectDropZones(){this.focusableDropZones=Array.from(document.querySelectorAll("[dropzone]")),this.currentDropZoneIndex=-1}moveToNextDropZone(){if(this.focusableDropZones.length===0)return;this.currentDropZoneIndex=(this.currentDropZoneIndex+1)%this.focusableDropZones.length;let t=this.focusableDropZones[this.currentDropZoneIndex];t.focus(),this.currentDropTarget=t,this.dispatchCustomEvent(t,"dragenter")}getEventCoordinates(t,e=!1){let r=t.touches?t.touches[0]:t;return{x:e?r.pageX:r.clientX,y:e?r.pageY:r.clientY}}calculateClonePosition(t){let e=this.dragSource.getBoundingClientRect();this.cloneOffset.x=t.clientX-e.left,this.cloneOffset.y=t.clientY-e.top}setDragCloneStyles(t){this.dragClone.style.position="fixed",this.dragClone.style.top=`${t.clientY-this.cloneOffset.y}px`,this.dragClone.style.left=`${t.clientX-this.cloneOffset.x}px`,this.dragClone.style.pointerEvents="none",this.dragClone.style.zIndex="999999"}updateDragClonePosition(t){requestAnimationFrame(()=>{if(this.touchEndTriggered||!this.dragClone)return;let e=t.clientX-this.cloneOffset.x,r=t.clientY-this.cloneOffset.y,{newLeft:i,newTop:o}=this.applyBoundaries(e,r,this.dragClone);this.dragClone.style.left=`${i}px`,this.dragClone.style.top=`${o}px`})}applyTransformBoundaries(t,e){let r;this.rootNode instanceof ShadowRoot?r=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?r=document.documentElement.getBoundingClientRect():r=new DOMRect(0,0,window.innerWidth,window.innerHeight);let i=this.dragSource.getBoundingClientRect(),o=i.width,n=i.height,a=i.left+t,c=i.top+e,p=Math.max(r.left,Math.min(a,r.right-o)),f=Math.max(r.top,Math.min(c,r.bottom-n)),g=p-i.left,y=f-i.top;return{boundedDeltaX:g,boundedDeltaY:y}}applyBoundaries(t,e,r){let i;this.rootNode instanceof ShadowRoot?i=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?i=document.documentElement.getBoundingClientRect():i=new DOMRect(0,0,window.innerWidth,window.innerHeight);let o=r.getBoundingClientRect(),n=o.width,a=o.height,c=Math.max(i.left,Math.min(t,i.right-n)),p=Math.max(i.top,Math.min(e,i.bottom-a));return{newLeft:c,newTop:p}}calculateDragDistance(t){let e=Math.abs(t.clientX-this.touchStartPoint.x),r=Math.abs(t.clientY-this.touchStartPoint.y);return e+r}dispatchCustomEvent(t,e,r=!0){if(!t)return;let i=new CustomEvent(e,{bubbles:r,cancelable:!0});i.dataTransfer=this.dataTransfer,t.dispatchEvent(i)}resetDragState(t=!1){var e;this.isDragging&&(this.useDragClone?(this.dragSource.style.opacity="1.0",(e=this.dragClone)==null||e.parentElement.removeChild(this.dragClone)):(t||(this.dragSource.style.transform="translate(0, 0)"),this.dragSource.style.zIndex="",this.dragSource.style.pointerEvents="",this.dragSource.style.transition=this.initialTransition,this.initialTransition="")),this.isDragging=!1,this.dragSource=null,this.dragClone=null,this.isDraggable=!1,this.touchStartTime=0,this.touchStartPoint=null,this.touchEndTriggered=!1,this.dataTransfer={data:{},setData(r,i){this.data[r]=i},getData(r){return this.data[r]},effectAllowed:"move"},this.cloneOffset={x:0,y:0},this.lastTarget=null,this.currentDropTarget=null,this.allowClick=!0,this.initialTransform="",this.hasDispatchedDragStart=!1,this.rootNode=null}};var Ii=(s,t,e)=>{class r extends s{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.isMatchTabular())return;super.firstUpdated(n);let a=this.getDroppableElements();this.initializeEventHandlers(),a.forEach(c=>{this.prepareDroppable(c),this.observeDroppableAttributes(c)})}isMatchTabular(){return this.classList.contains("qti-match-tabular")}getDroppableElements(){return Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e))}initializeEventHandlers(){this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this)}prepareDroppable(n){n.setAttribute("dropzone","move"),n.addEventListener("dragleave",this.dragleaveHandler),this.attachEventListeners(n)}observeDroppableAttributes(n){this.observer=new MutationObserver(a=>{a.forEach(({attributeName:c})=>{c==="disabled"&&this.toggleDroppableHandlers(n)})}),this.observer.observe(n,{attributes:!0})}toggleDroppableHandlers(n){n.hasAttribute("disabled")?this.removeEventListeners(n):this.attachEventListeners(n)}attachEventListeners(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeEventListeners(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.isMatchTabular()||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),this.activateDroppable(n.currentTarget),n.dataTransfer.dropEffect="move",!1}activateDroppable(n){n.setAttribute("active","")}async dropHandler(n){n.preventDefault();let a=n.currentTarget,c=this.findDraggable(n.dataTransfer.getData("text"));return!c||!this.isValidDrop(a,c)?(c.style.transform="translate(0, 0)",!1):(await this.moveDraggableToDroppable(c,a),this.deactivateDroppable(a),!1)}findDraggable(n){return this.querySelector(`[identifier=${n}]`)||this.shadowRoot.querySelector(`[identifier=${n}]`)}isValidDrop(n,a){return a.parentElement.getAttribute("identifier")!==n.getAttribute("identifier")}async moveDraggableToDroppable(n,a){let c=()=>{n.style.transform="translate(0, 0)",a.appendChild(n),this.checkMaxAssociations()};if(!document.startViewTransition){c();return}await document.startViewTransition(c).finished}deactivateDroppable(n){n.removeAttribute("active")}dragleaveHandler(n){return n.preventDefault(),this.deactivateDroppable(n.currentTarget),n.dataTransfer.dropEffect="none",!1}}return l([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var Oi=(s,t,e)=>{class r extends s{}return r};var W=(s,t,e,r)=>{class i extends Oi(Ii(s,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.droppables=[];this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1;this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),c.setAttribute("dragging",""),this.activateDroppables()};this.handleDragEnd=a=>{a.preventDefault(),this.deactivateDroppables();let c=a.currentTarget;c.removeAttribute("dragging"),this.wasDropped(a)||this.configuration.dragCanBePlacedBack&&this.restoreInitialDraggablePosition(c),this.wasMoved(a)&&this.saveResponse()}}handleDraggablesChange(a,c){if(this.isMatchTabular())return;let p=this.filterExistingDraggables(a);p.length>0&&this.addNewDraggables(p)}firstUpdated(a){super.firstUpdated(a),this.initializeDroppables()}connectedCallback(){super.connectedCallback(),this.initializeDragDropApi()}initializeDragDropApi(){this.dragDropApi=new Jt,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}isMatchTabular(){return this.classList.contains("qti-match-tabular")}filterExistingDraggables(a){return a.filter(c=>!this.draggables.has(c))}addNewDraggables(a){this.dragDropApi.addDraggableElements(a),a.forEach(c=>this.storeDraggable(c))}storeDraggable(a){let c=Array.from(a.parentNode.children).indexOf(a);this.draggables.set(a,{parent:a.parentElement,index:c}),a.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")}`,a.setAttribute("qti-draggable","true"),a.addEventListener("dragstart",this.handleDragStart),a.addEventListener("dragend",this.handleDragEnd)}initializeDroppables(){this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}activateDroppables(){this.droppables.forEach(a=>a.setAttribute("enabled",""))}deactivateDroppables(){this.droppables.forEach(a=>a.removeAttribute("enabled"))}wasDropped(a){return a.dataTransfer.dropEffect!=="none"}wasMoved(a){return a.dataTransfer.dropEffect==="move"}async restoreInitialDraggablePosition(a){let{parent:c,index:p}=this.draggables.get(a),f=Math.min(p,c.children.length),g=(v,w,k)=>{let A=Math.min(k,w.children.length);w.insertBefore(v,w.children[A]),v.style.transform="translate(0, 0)",this.checkMaxAssociations(),this.saveResponse()};if(!document.startViewTransition){g(a,c,p);return}let y=document.startViewTransition(()=>{a.style.transform="",g(a,c,p)})}checkMaxAssociations(){this.droppables.forEach((a,c)=>{let p=+(a.getAttribute("match-max")||1);a.querySelectorAll('[qti-draggable="true"]').length>=p?this.disableDroppable(a):this.enableDroppable(a)})}disableDroppable(a){a.setAttribute("disabled",""),a.removeAttribute("dropzone")}enableDroppable(a){a.removeAttribute("disabled"),a.setAttribute("dropzone","move")}set response(a){this.isMatchTabular()||(this.resetDroppables(),a==null||a.forEach(c=>this.placeResponse(c)))}placeResponse(a){let[c,...p]=a.split(" ").reverse(),f=this.findDroppableById(c);p.forEach(g=>this.placeDraggableInDroppable(g,f))}findDroppableById(a){return this.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let p=this.querySelector(`[identifier=${a}]`);if(!c||!p){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let f=()=>{p.style.transform="translate(0, 0)",c.appendChild(p),this.checkMaxAssociations()};document.startViewTransition?await document.startViewTransition(f).finished:f()}validate(){let a=this.getValidAssociations();return this.minAssociations<=0||this.minAssociations<=a}getValidAssociations(){return this.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(a=>{let c=a.querySelectorAll('[qti-draggable="true"]'),p=Array.from(c).map(g=>g.getAttribute("identifier")),f=a.getAttribute("identifier");return[...p,f].join(" ")})}reset(a=!0){this.resetDroppables(),a&&this.saveResponse()}async resetDroppables(){let a=(p,f,g)=>{p.style.transform="translate(0, 0)";let y=Math.min(g,f.children.length);f.insertBefore(p,f.children[y])};if(!document.startViewTransition){this.draggables.forEach(({parent:p,index:f},g)=>{a(g,p,f)});return}await document.startViewTransition(()=>{this.draggables.forEach(({parent:p,index:f},g)=>{a(g,p,f)})}).finished}}return l([d({type:String,attribute:"response-identifier"})],i.prototype,"responseIdentifier",2),l([d({attribute:!1,type:Object})],i.prototype,"configuration",2),l([d({type:Boolean,reflect:!0})],i.prototype,"disabled",2),l([d({type:Boolean,reflect:!0})],i.prototype,"readonly",2),l([d({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([d({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([$i(t)],i.prototype,"handleDraggablesChange",1),i};var Ui=b`
|
|
250
|
+
</div>`}`}};l([d({type:String,attribute:"response-identifier"})],pe.prototype,"responseIdentifier",2),l([d({type:String,attribute:"module"})],pe.prototype,"module",2),l([d({type:String,attribute:"custom-interaction-type-identifier"})],pe.prototype,"customInteractionTypeIdentifier",2),l([q()],pe.prototype,"_errorMessage",2),pe=l([m("qti-portable-custom-interaction")],pe);var Wt=class s{constructor(){this.touchStartTime=0;this.touchStartPoint=null;this.lastClickTime=0;this.isDraggable=!1;this.dragSource=null;this.dragClone=null;this.touchEndTriggered=!1;this.isDragging=!1;this.initialTransform="";this.hasDispatchedDragStart=!1;this.rootNode=null;this.focusedElement=null;this.focusableDropZones=[];this.currentDropZoneIndex=-1;this.dataTransfer={data:{},setData(t,e){this.data[t]=e},getData(t){return this.data[t]},effectAllowed:"move"};this.cloneOffset={x:0,y:0};this.lastTarget=null;this.currentDropTarget=null;this.allowClick=!0;this.copyStylesForDragClone=!0;this.dragOnClickEnabled=!1;this.useDragClone=!1;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;if(s.instance)return s.instance;s.instance=this,document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("keyup",this.handleKeyUp.bind(this))}addDraggableElements(t){t.forEach(e=>{e.setAttribute("tabindex","0"),e.addEventListener("focus",()=>this.focusedElement=e),e.addEventListener("blur",()=>this.focusedElement=null),e.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),e.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1})})}handleTouchStart(t){this.touchStartTime=Date.now();let{x:e,y:r}=this.getEventCoordinates(t);if(this.touchStartPoint={x:e,y:r},this.dragSource=t.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode(),this.dragOnClickEnabled&&(this.isDragging=!0,this.createDragClone(t,{clientX:e,clientY:r})),!this.useDragClone){let i=window.getComputedStyle(this.dragSource);this.initialTransform=i.transform==="none"?"":i.transform,this.initialTransition=i.transition||"",this.dragSource.style.transition="none";let o=this.dragSource.getBoundingClientRect();this.cloneOffset.x=e-o.left,this.cloneOffset.y=r-o.top,this.dragSource.style.zIndex="9999",this.dragSource.focus()}t.preventDefault()}handleTouchMove(t){if(this.isDraggable&&this.dragSource){let{x:e,y:r}=this.getEventCoordinates(t),i={clientX:e,clientY:r};this.calculateDragDistance(i)>=this.MIN_DRAG_DISTANCE&&(this.dragSource.style.pointerEvents="none",this.isDragging=!0),this.createDragClone(t,i),t.preventDefault()}}createDragClone(t,e){if(!this.isDragging)return;if(this.useDragClone){if(!this.dragClone){if(this.dragSource.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone=this.dragSource.cloneNode(!0),this.copyStylesForDragClone){let i=window.getComputedStyle(this.dragSource);for(let o of i)this.dragClone.style[o]=i.getPropertyValue(o)}this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),this.calculateClonePosition(e),this.setDragCloneStyles(e),this.dispatchCustomEvent(this.dragSource,"dragstart")}this.updateDragClonePosition(e)}else if(this.touchStartPoint){let i=e.clientX-this.touchStartPoint.x,o=e.clientY-this.touchStartPoint.y;this.dragSource.style.transform=`${this.initialTransform} translate(${i}px, ${o}px)`,this.hasDispatchedDragStart||(this.dispatchCustomEvent(this.dragSource,"dragstart"),this.hasDispatchedDragStart=!0)}let r=this.findDropTarget(t);r!==this.lastTarget&&(this.dispatchCustomEvent(r,"dragenter"),this.dispatchCustomEvent(this.lastTarget,"dragleave"),this.lastTarget=r),this.currentDropTarget=r,this.currentDropTarget&&this.dispatchCustomEvent(r,"dragover")}handleTouchEnd(t){var r;this.touchEndTriggered=!0,this.isDraggable=!1;let e=!1;if(this.currentDropTarget)this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),e=!0;else if(this.isDragging){let i=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});i.dataTransfer={dropEffect:"none"},(r=this.dragSource)==null||r.dispatchEvent(i)}this.resetDragState(e)}handleTouchCancel(t){this.resetDragState()}findDropTarget(t){let{x:e,y:r}=this.getEventCoordinates(t);return this.getDropTargetAtPoint(document,e,r)}getDropTargetAtPoint(t,e,r,i=0){if(i>2)return null;let n=t.elementFromPoint(e,r);if(!n)return null;if(n.hasAttribute("dropzone"))return n;let a=n.parentElement;for(;a;){if(a.hasAttribute("dropzone"))return a;a=a.parentElement}if(n.shadowRoot&&i<2){let c=this.getDropTargetAtPoint(n.shadowRoot,e,r,i+1);if(c)return c}return null}handleKeyDown(t){this.focusedElement&&(t.key===" "&&!this.isDragging?(t.preventDefault(),this.isDraggable=!0,this.dragSource=this.focusedElement,this.isDragging=!0,this.collectDropZones(),this.dispatchCustomEvent(this.dragSource,"dragstart")):t.key==="Tab"&&this.isDragging&&(t.preventDefault(),this.moveToNextDropZone()))}handleKeyUp(t){t.key===" "&&this.isDragging&&this.currentDropTarget&&(t.preventDefault(),this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),this.resetDragState(!0))}collectDropZones(){this.focusableDropZones=Array.from(document.querySelectorAll("[dropzone]")),this.currentDropZoneIndex=-1}moveToNextDropZone(){if(this.focusableDropZones.length===0)return;this.currentDropZoneIndex=(this.currentDropZoneIndex+1)%this.focusableDropZones.length;let t=this.focusableDropZones[this.currentDropZoneIndex];t.focus(),this.currentDropTarget=t,this.dispatchCustomEvent(t,"dragenter")}getEventCoordinates(t,e=!1){let r=t.touches?t.touches[0]:t;return{x:e?r.pageX:r.clientX,y:e?r.pageY:r.clientY}}calculateClonePosition(t){let e=this.dragSource.getBoundingClientRect();this.cloneOffset.x=t.clientX-e.left,this.cloneOffset.y=t.clientY-e.top}setDragCloneStyles(t){this.dragClone.style.position="fixed",this.dragClone.style.top=`${t.clientY-this.cloneOffset.y}px`,this.dragClone.style.left=`${t.clientX-this.cloneOffset.x}px`,this.dragClone.style.pointerEvents="none",this.dragClone.style.zIndex="999999"}updateDragClonePosition(t){requestAnimationFrame(()=>{if(this.touchEndTriggered||!this.dragClone)return;let e=t.clientX-this.cloneOffset.x,r=t.clientY-this.cloneOffset.y,{newLeft:i,newTop:o}=this.applyBoundaries(e,r,this.dragClone);this.dragClone.style.left=`${i}px`,this.dragClone.style.top=`${o}px`})}applyTransformBoundaries(t,e){let r;this.rootNode instanceof ShadowRoot?r=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?r=document.documentElement.getBoundingClientRect():r=new DOMRect(0,0,window.innerWidth,window.innerHeight);let i=this.dragSource.getBoundingClientRect(),o=i.width,n=i.height,a=i.left+t,c=i.top+e,p=Math.max(r.left,Math.min(a,r.right-o)),f=Math.max(r.top,Math.min(c,r.bottom-n)),g=p-i.left,y=f-i.top;return{boundedDeltaX:g,boundedDeltaY:y}}applyBoundaries(t,e,r){let i;this.rootNode instanceof ShadowRoot?i=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?i=document.documentElement.getBoundingClientRect():i=new DOMRect(0,0,window.innerWidth,window.innerHeight);let o=r.getBoundingClientRect(),n=o.width,a=o.height,c=Math.max(i.left,Math.min(t,i.right-n)),p=Math.max(i.top,Math.min(e,i.bottom-a));return{newLeft:c,newTop:p}}calculateDragDistance(t){let e=Math.abs(t.clientX-this.touchStartPoint.x),r=Math.abs(t.clientY-this.touchStartPoint.y);return e+r}dispatchCustomEvent(t,e,r=!0){if(!t)return;let i=new CustomEvent(e,{bubbles:r,cancelable:!0});i.dataTransfer=this.dataTransfer,t.dispatchEvent(i)}resetDragState(t=!1){var e;this.isDragging&&(this.useDragClone?(this.dragSource.style.opacity="1.0",(e=this.dragClone)==null||e.parentElement.removeChild(this.dragClone)):(t||(this.dragSource.style.transform="translate(0, 0)"),this.dragSource.style.zIndex="",this.dragSource.style.pointerEvents="",this.dragSource.style.transition=this.initialTransition,this.initialTransition="")),this.isDragging=!1,this.dragSource=null,this.dragClone=null,this.isDraggable=!1,this.touchStartTime=0,this.touchStartPoint=null,this.touchEndTriggered=!1,this.dataTransfer={data:{},setData(r,i){this.data[r]=i},getData(r){return this.data[r]},effectAllowed:"move"},this.cloneOffset={x:0,y:0},this.lastTarget=null,this.currentDropTarget=null,this.allowClick=!0,this.initialTransform="",this.hasDispatchedDragStart=!1,this.rootNode=null}};var Ni=(s,t,e)=>{class r extends s{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.isMatchTabular())return;super.firstUpdated(n);let a=this.getDroppableElements();this.initializeEventHandlers(),a.forEach(c=>{this.prepareDroppable(c),this.observeDroppableAttributes(c)})}isMatchTabular(){return this.classList.contains("qti-match-tabular")}getDroppableElements(){return Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e))}initializeEventHandlers(){this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this)}prepareDroppable(n){n.setAttribute("dropzone","move"),n.addEventListener("dragleave",this.dragleaveHandler),this.attachEventListeners(n)}observeDroppableAttributes(n){this.observer=new MutationObserver(a=>{a.forEach(({attributeName:c})=>{c==="disabled"&&this.toggleDroppableHandlers(n)})}),this.observer.observe(n,{attributes:!0})}toggleDroppableHandlers(n){n.hasAttribute("disabled")?this.removeEventListeners(n):this.attachEventListeners(n)}attachEventListeners(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeEventListeners(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.isMatchTabular()||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),this.activateDroppable(n.currentTarget),n.dataTransfer.dropEffect="move",!1}activateDroppable(n){n.setAttribute("active","")}async dropHandler(n){n.preventDefault();let a=n.currentTarget,c=this.findDraggable(n.dataTransfer.getData("text"));return!c||!this.isValidDrop(a,c)?(c.style.transform="translate(0, 0)",!1):(await this.moveDraggableToDroppable(c,a),this.deactivateDroppable(a),!1)}findDraggable(n){return this.querySelector(`[identifier=${n}]`)||this.shadowRoot.querySelector(`[identifier=${n}]`)}isValidDrop(n,a){return a.parentElement.getAttribute("identifier")!==n.getAttribute("identifier")}async moveDraggableToDroppable(n,a){let c=()=>{n.style.transform="translate(0, 0)",a.appendChild(n),this.checkMaxAssociations()};if(!document.startViewTransition){c();return}await document.startViewTransition(c).finished}deactivateDroppable(n){n.removeAttribute("active")}dragleaveHandler(n){return n.preventDefault(),this.deactivateDroppable(n.currentTarget),n.dataTransfer.dropEffect="none",!1}}return l([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var Vi=(s,t,e)=>{class r extends s{}return r};var Y=(s,t,e,r)=>{class i extends Vi(Ni(s,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.droppables=[];this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1;this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),c.setAttribute("dragging",""),this.activateDroppables()};this.handleDragEnd=a=>{a.preventDefault(),this.deactivateDroppables();let c=a.currentTarget;c.removeAttribute("dragging"),this.wasDropped(a)||this.configuration.dragCanBePlacedBack&&this.restoreInitialDraggablePosition(c),this.wasMoved(a)&&this.saveResponse()}}handleDraggablesChange(a,c){if(this.isMatchTabular())return;let p=this.filterExistingDraggables(a);p.length>0&&this.addNewDraggables(p)}firstUpdated(a){super.firstUpdated(a),this.initializeDroppables()}connectedCallback(){super.connectedCallback(),this.initializeDragDropApi()}initializeDragDropApi(){this.dragDropApi=new Wt,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}isMatchTabular(){return this.classList.contains("qti-match-tabular")}filterExistingDraggables(a){return a.filter(c=>!this.draggables.has(c))}addNewDraggables(a){this.dragDropApi.addDraggableElements(a),a.forEach(c=>this.storeDraggable(c))}storeDraggable(a){let c=Array.from(a.parentNode.children).indexOf(a);this.draggables.set(a,{parent:a.parentElement,index:c}),a.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")}`,a.setAttribute("qti-draggable","true"),a.addEventListener("dragstart",this.handleDragStart),a.addEventListener("dragend",this.handleDragEnd)}initializeDroppables(){this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}activateDroppables(){this.droppables.forEach(a=>a.setAttribute("enabled",""))}deactivateDroppables(){this.droppables.forEach(a=>a.removeAttribute("enabled"))}wasDropped(a){return a.dataTransfer.dropEffect!=="none"}wasMoved(a){return a.dataTransfer.dropEffect==="move"}async restoreInitialDraggablePosition(a){let{parent:c,index:p}=this.draggables.get(a),f=Math.min(p,c.children.length),g=(v,w,k)=>{let A=Math.min(k,w.children.length);w.insertBefore(v,w.children[A]),v.style.transform="translate(0, 0)",this.checkMaxAssociations(),this.saveResponse()};if(!document.startViewTransition){g(a,c,p);return}let y=document.startViewTransition(()=>{a.style.transform="",g(a,c,p)})}checkMaxAssociations(){this.droppables.forEach((a,c)=>{let p=+(a.getAttribute("match-max")||1);a.querySelectorAll('[qti-draggable="true"]').length>=p?this.disableDroppable(a):this.enableDroppable(a)})}disableDroppable(a){a.setAttribute("disabled",""),a.removeAttribute("dropzone")}enableDroppable(a){a.removeAttribute("disabled"),a.setAttribute("dropzone","move")}set response(a){this.isMatchTabular()||(this.resetDroppables(),a==null||a.forEach(c=>this.placeResponse(c)))}placeResponse(a){let[c,...p]=a.split(" ").reverse(),f=this.findDroppableById(c);p.forEach(g=>this.placeDraggableInDroppable(g,f))}findDroppableById(a){return this.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let p=this.querySelector(`[identifier=${a}]`);if(!c||!p){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let f=()=>{p.style.transform="translate(0, 0)",c.appendChild(p),this.checkMaxAssociations()};document.startViewTransition?await document.startViewTransition(f).finished:f()}validate(){let a=this.getValidAssociations();return this.minAssociations<=0||this.minAssociations<=a}getValidAssociations(){return this.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(a=>{let c=a.querySelectorAll('[qti-draggable="true"]'),p=Array.from(c).map(g=>g.getAttribute("identifier")),f=a.getAttribute("identifier");return[...p,f].join(" ")})}reset(a=!0){this.resetDroppables(),a&&this.saveResponse()}async resetDroppables(){let a=(p,f,g)=>{p.style.transform="translate(0, 0)";let y=Math.min(g,f.children.length);f.insertBefore(p,f.children[y])};if(!document.startViewTransition){this.draggables.forEach(({parent:p,index:f},g)=>{a(g,p,f)});return}await document.startViewTransition(()=>{this.draggables.forEach(({parent:p,index:f},g)=>{a(g,p,f)})}).finished}}return l([d({type:String,attribute:"response-identifier"})],i.prototype,"responseIdentifier",2),l([d({attribute:!1,type:Object})],i.prototype,"configuration",2),l([d({type:Boolean,reflect:!0})],i.prototype,"disabled",2),l([d({type:Boolean,reflect:!0})],i.prototype,"readonly",2),l([d({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([d({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([Mi(t)],i.prototype,"handleDraggablesChange",1),i};var Ii=b`
|
|
251
251
|
:host {
|
|
252
252
|
display: block; /* necessary to calculate scaling position */
|
|
253
253
|
}
|
|
@@ -267,14 +267,14 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
267
267
|
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
268
268
|
);
|
|
269
269
|
}
|
|
270
|
-
`;var Le=class extends
|
|
270
|
+
`;var Le=class extends Y(u,"qti-simple-associable-choice",!0,".dl"){constructor(){super();this._childrenMap=[];this.addEventListener("register-qti-simple-associable-choice",e=>{let r=e.target;this._childrenMap.push(r)})}render(){return h` <slot name="prompt"></slot>
|
|
271
271
|
<slot name="qti-simple-associable-choice"></slot>
|
|
272
272
|
<div part="drop-container">
|
|
273
273
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,r)=>h`<div part="associables-container">
|
|
274
274
|
<div name="left${r}" part="drop-list" class="dl" identifier="droplist${r}_left"></div>
|
|
275
275
|
<div name="right${r}" part="drop-list" class="dl" identifier="droplist${r}_right"></div>
|
|
276
276
|
</div>`)}
|
|
277
|
-
</div>`}};Le.styles=
|
|
277
|
+
</div>`}};Le.styles=Ii,l([q()],Le.prototype,"_childrenMap",2),Le=l([m("qti-associate-interaction")],Le);var W=class extends T{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:Ge(this.baseItemUrl+"/"+this.data);fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}setupCES(){let e=this.shadowRoot.querySelector("#pciContainer"),r=e.contentWindow||e,i=e.contentDocument;window.addEventListener("message",this.handlePostMessage),i.open(),i.write(`
|
|
278
278
|
<html>
|
|
279
279
|
<head>
|
|
280
280
|
<link href='${Ge(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
|
|
@@ -293,7 +293,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
293
293
|
${this._errorMessage&&h`<div style="color:red">
|
|
294
294
|
<h1>Error</h1>
|
|
295
295
|
${this._errorMessage}
|
|
296
|
-
</div>`}`}};l([d({type:String,attribute:"response-identifier"})],
|
|
296
|
+
</div>`}`}};l([d({type:String,attribute:"response-identifier"})],W.prototype,"responseIdentifier",2),l([d({type:String,attribute:"data"})],W.prototype,"data",2),l([d({type:String,attribute:"data-base-item"})],W.prototype,"baseItemUrl",2),l([d({type:String,attribute:"data-base-ref"})],W.prototype,"baseRefUrl",2),l([d({type:String,attribute:"id"})],W.prototype,"id",2),l([q()],W.prototype,"_errorMessage",2),W=l([m("qti-custom-interaction")],W);var $e=class extends T{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}set response(e){}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};l([d({type:String,attribute:"count-attempt"})],$e.prototype,"countAttempt",2),l([d({type:String})],$e.prototype,"title",2),$e=l([m("qti-end-attempt-interaction")],$e);var lt=class extends Y(u,"qti-gap-text",!1,"qti-gap"){render(){return h`<slot name="prompt"> </slot><slot part="drags" name="qti-gap-text"></slot> <slot part="drops"></slot>`}set correctResponse(t){let e=[],r=Array.isArray(t)?t:[t];r&&(e=r.map(o=>{let n=o.split(" ");return{text:n[0],gap:n[1]}})),this.querySelectorAll("qti-gap").forEach((o,n)=>{var f,g,y,v;let a=o.getAttribute("identifier"),c=(f=e.find(w=>w.gap===a))==null?void 0:f.text,p=(g=this.querySelector(`qti-gap-text[identifier="${c}"]`))==null?void 0:g.textContent.trim();if(c&&p){if(!((y=o.nextElementSibling)!=null&&y.classList.contains("correct-option"))){let w=document.createElement("span");w.classList.add("correct-option"),w.textContent=p,o.insertAdjacentElement("afterend",w)}}else(v=o.nextElementSibling)!=null&&v.classList.contains("correct-option")&&o.nextElementSibling.remove()})}};lt.styles=[b`
|
|
297
297
|
:host {
|
|
298
298
|
display: flex;
|
|
299
299
|
align-items: flex-start;
|
|
@@ -320,14 +320,14 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
320
320
|
flex: 1;
|
|
321
321
|
gap: 0.5rem;
|
|
322
322
|
}
|
|
323
|
-
`],lt=l([m("qti-gap-match-interaction")],lt);var
|
|
323
|
+
`],lt=l([m("qti-gap-match-interaction")],lt);var Oi=(s,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(s[i],i);return r},Kt=te(class extends B{constructor(s){if(super(s),s.type!==ae.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],o=[],n=0;for(let a of s)i[n]=r?r(a,n):n,o[n]=e(a,n),n++;return{values:o,keys:i}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,r]){var k;let i=_i(s),{values:o,keys:n}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=n,o;let a=(k=this.ut)!=null?k:this.ut=[],c=[],p,f,g=0,y=i.length-1,v=0,w=o.length-1;for(;g<=y&&v<=w;)if(i[g]===null)g++;else if(i[y]===null)y--;else if(a[g]===n[v])c[v]=ne(i[g],o[v]),g++,v++;else if(a[y]===n[w])c[w]=ne(i[y],o[w]),y--,w--;else if(a[g]===n[w])c[w]=ne(i[g],o[w]),Se(s,c[w+1],i[g]),g++,w--;else if(a[y]===n[v])c[v]=ne(i[y],o[v]),Se(s,i[g],i[y]),y--,v++;else if(p===void 0&&(p=Oi(n,v,w),f=Oi(a,g,y)),p.has(a[g]))if(p.has(a[y])){let A=f.get(n[v]),we=A!==void 0?i[A]:null;if(we===null){let vt=Se(s,i[g]);ne(vt,o[v]),c[v]=vt}else c[v]=ne(we,o[v]),Se(s,i[g],we),i[A]=null;v++}else Ht(i[y]),y--;else Ht(i[g]),g++;for(;v<=w;){let A=Se(s,c[w+1]);ne(A,o[v]),c[v++]=A}for(;g<=y;){let A=i[g++];A!==null&&Ht(A)}return this.ut=n,Ai(s,c),M}});function De(s,t,e,r){switch(s){case"circle":{let[i,o,n]=t,a=i/e.width*100,c=o/e.height*100,p=n/e.width*100;r.style.left=a-p+"%",r.style.top=c-p+"%",r.style.width=r.style.height=4*p+"px",r.style.borderRadius="9999px"}break;case"rect":{let[i,o,n,a]=t,c=i/e.width*100,p=o/e.height*100,f=n/e.width*100,g=a/e.height*100;r.style.left=c+"%",r.style.top=p+"%",r.style.width=f-c+"%",r.style.height=g-p+"%"}break;case"poly":{let i=t.reduce((k,A,we,vt)=>{if(we%2===1){let Xi=k.pop();k[k.length]={x:Xi,y:vt[we]}}else k.push(A);return k},[]),o=Math.min(...i.map(k=>k.x)),n=Math.max(...i.map(k=>k.x)),a=Math.min(...i.map(k=>k.y)),c=Math.max(...i.map(k=>k.y)),p=o/e.width*100,f=a/e.height*100,g=n/e.width*100,y=c/e.height*100;r.style.left=o/e.width*100+"%",r.style.top=a/e.height*100+"%",r.style.width=g-p+"%",r.style.height=y-f+"%";let w=i.map(k=>({x:(k.x-o)/(n-o)*100,y:(k.y-a)/(c-a)*100})).map(k=>Math.round(k.x)+"% "+Math.round(k.y)+"%").join(",");r.style.clipPath=`polygon(${w})`}break;default:break}}var K=class extends T{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,r,i,o;return h`<slot name="prompt"></slot>
|
|
324
324
|
<line-container>
|
|
325
325
|
<svg
|
|
326
|
-
width=${
|
|
327
|
-
height=${
|
|
326
|
+
width=${F((e=this.grImage[0])==null?void 0:e.width)}
|
|
327
|
+
height=${F((r=this.grImage[0])==null?void 0:r.height)}
|
|
328
328
|
viewbox="0 0 ${(i=this.grImage[0])==null?void 0:i.width} ${(o=this.grImage[0])==null?void 0:o.height}"
|
|
329
329
|
>
|
|
330
|
-
${
|
|
330
|
+
${Kt(this._lines,n=>n,(n,a)=>dr`
|
|
331
331
|
<line
|
|
332
332
|
part="line"
|
|
333
333
|
x1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.left)}
|
|
@@ -339,7 +339,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
339
339
|
@click=${c=>{c.stopPropagation(),this._lines=this._lines.filter((p,f)=>f!==a),this.saveResponse(this._lines)}}
|
|
340
340
|
/>
|
|
341
341
|
`)}
|
|
342
|
-
${this.startPoint&&
|
|
342
|
+
${this.startPoint&&dr`<line
|
|
343
343
|
part="point"
|
|
344
344
|
x1=${this.startCoord.x}
|
|
345
345
|
y1=${this.startCoord.y}
|
|
@@ -350,7 +350,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
350
350
|
/>`}
|
|
351
351
|
</svg>
|
|
352
352
|
<slot></slot>
|
|
353
|
-
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),i=e.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));De(n,a,r,i)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",i=>{this.startPoint?this.endPoint||(this.endPoint=i.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=i.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};
|
|
353
|
+
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),i=e.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));De(n,a,r,i)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",i=>{this.startPoint?this.endPoint||(this.endPoint=i.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=i.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};K.styles=[b`
|
|
354
354
|
slot:not([name='prompt']) {
|
|
355
355
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
356
356
|
display: block;
|
|
@@ -373,7 +373,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
373
373
|
top: 0px;
|
|
374
374
|
left: 0px;
|
|
375
375
|
}
|
|
376
|
-
`],l([q()],
|
|
376
|
+
`],l([q()],K.prototype,"_lines",2),l([q()],K.prototype,"startCoord",2),l([q()],K.prototype,"mouseCoord",2),l([Ke("svg")],K.prototype,"svgContainer",2),l([qi({selector:"img"})],K.prototype,"grImage",2),K=l([m("qti-graphic-associate-interaction")],K);var ct=class extends Y(u,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return h` <slot name="prompt"></slot>
|
|
377
377
|
<slot></slot>
|
|
378
378
|
<slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));switch(o){case"circle":{let[a,c,p]=n;r.style.left=a-p+"px",r.style.top=c-p+"px",r.style.width=r.style.height=2*p+"px"}break;case"rect":{let[a,c,p,f]=n;r.style.left=a+"px",r.style.top=c+"px",r.style.width=p-a+"px",r.style.height=f-c+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};ct.styles=b`
|
|
379
379
|
:host {
|
|
@@ -417,7 +417,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
417
417
|
user-select: none;
|
|
418
418
|
/* width:100%; */
|
|
419
419
|
}
|
|
420
|
-
`],pt=l([m("qti-hotspot-interaction")],pt);var he=class extends
|
|
420
|
+
`],pt=l([m("qti-hotspot-interaction")],pt);var he=class extends O(u,"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`
|
|
421
421
|
<slot part="slot"></slot>
|
|
422
422
|
<slot part="dropslot" name="qti-simple-associable-choice"></slot>
|
|
423
423
|
`}};he.styles=b`
|
|
@@ -432,7 +432,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
432
432
|
slot[name='qti-simple-associable-choice'] {
|
|
433
433
|
width: 100%;
|
|
434
434
|
}
|
|
435
|
-
`,l([d({type:Number,attribute:"match-min"})],he.prototype,"matchMin",2),l([d({type:Number,attribute:"match-max"})],he.prototype,"matchMax",2),l([d({type:Boolean,attribute:"fixed"})],he.prototype,"fixed",2),he=l([m("qti-simple-associable-choice")],he);var
|
|
435
|
+
`,l([d({type:Number,attribute:"match-min"})],he.prototype,"matchMin",2),l([d({type:Number,attribute:"match-max"})],he.prototype,"matchMax",2),l([d({type:Boolean,attribute:"fixed"})],he.prototype,"fixed",2),he=l([m("qti-simple-associable-choice")],he);var Ui=b`
|
|
436
436
|
slot {
|
|
437
437
|
/* slot where the */
|
|
438
438
|
display: flex;
|
|
@@ -459,7 +459,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
459
459
|
/* Make sure the drag and drop container slots have the same width */
|
|
460
460
|
flex: 1;
|
|
461
461
|
}
|
|
462
|
-
`;var me=class extends
|
|
462
|
+
`;var me=class extends Y(u,"qti-simple-match-set:first-of-type qti-simple-associable-choice",!1,"qti-simple-match-set:last-of-type qti-simple-associable-choice"){constructor(){super(...arguments);this.lastCheckedRadio=null;this._response=[];this.correctOptions=[];this.responseIdentifier="";this.handleRadioClick=e=>{let r=e.target;this.lastCheckedRadio===r?(r.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=r};this.handleRadioChange=e=>{let r=e.target,i=r.value,o=r.name,n=r.type;r.checked?(this.response?this.response.indexOf(i)===-1&&(n==="radio"&&(this.response=this.response.filter(a=>a.indexOf(o)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=r):(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.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e)}render(){return this.classList.contains("qti-match-tabular")?h`
|
|
463
463
|
<slot name="prompt"></slot>
|
|
464
464
|
<table>
|
|
465
465
|
<tr>
|
|
@@ -482,8 +482,8 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
482
482
|
</td>`})}
|
|
483
483
|
</tr>`)}
|
|
484
484
|
</table>
|
|
485
|
-
`:h`<slot name="prompt"></slot> <slot></slot>`}};me.styles=
|
|
486
|
-
<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.toString())})}};ht.styles=[b``],ht=l([m("qti-media-interaction")],ht);var re=class extends
|
|
485
|
+
`:h`<slot name="prompt"></slot> <slot></slot>`}};me.styles=Ui,l([q()],me.prototype,"_response",2),l([q()],me.prototype,"correctOptions",2),l([d({type:String,attribute:"response-identifier"})],me.prototype,"responseIdentifier",2),me=l([m("qti-match-interaction")],me);var ht=class extends T{constructor(){super();this.value=0}reset(){}validate(){return!0}set response(e){}static get properties(){return _(C({},T.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return h` <slot name="prompt"></slot>
|
|
486
|
+
<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.toString())})}};ht.styles=[b``],ht=l([m("qti-media-interaction")],ht);var re=class extends Ot(Y(u,"qti-simple-choice",!0,"drop-list"),"qti-simple-choice"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
|
|
487
487
|
<div part="container">
|
|
488
488
|
<slot part="drags"> </slot>
|
|
489
489
|
<div part="drops">
|
|
@@ -537,7 +537,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
537
537
|
:host(.qti-choices-right) [part='container'] {
|
|
538
538
|
flex-direction: row-reverse;
|
|
539
539
|
}
|
|
540
|
-
`],l([q()],re.prototype,"nrChoices",2),l([q()],re.prototype,"correctResponses",2),l([q()],re.prototype,"showCorrectResponses",2),l([d({type:String})],re.prototype,"orientation",2),re=l([m("qti-order-interaction")],re);var
|
|
540
|
+
`],l([q()],re.prototype,"nrChoices",2),l([q()],re.prototype,"correctResponses",2),l([q()],re.prototype,"showCorrectResponses",2),l([d({type:String})],re.prototype,"orientation",2),re=l([m("qti-order-interaction")],re);var Zt=class extends u{render(){return h`<slot></slot>`}};Zt.styles=[b`
|
|
541
541
|
:host {
|
|
542
542
|
display: block;
|
|
543
543
|
}
|
|
@@ -548,17 +548,17 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
548
548
|
left: 50%;
|
|
549
549
|
transform: translateX(-50%);
|
|
550
550
|
}
|
|
551
|
-
`];customElements.define("qti-position-object-interaction",
|
|
551
|
+
`];customElements.define("qti-position-object-interaction",Zt);var mt=class extends u{render(){return h`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,r=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(t){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};mt.styles=[b`
|
|
552
552
|
:host {
|
|
553
553
|
display: inline-block;
|
|
554
554
|
position: relative;
|
|
555
555
|
}
|
|
556
|
-
`],mt=l([m("qti-position-object-stage")],mt);var
|
|
556
|
+
`],mt=l([m("qti-position-object-stage")],mt);var zi="important",As=" !"+zi,Fi=te(class extends B{constructor(s){var t;if(super(s),s.type!==ae.ATTRIBUTE||s.name!=="style"||((t=s.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((t,e)=>{let r=s[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(s,[t]){let{style:e}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(As);r.includes("-")||o?e.setProperty(r,o?i.slice(0,-11):i,o?zi:""):e[r]=i}}return M}});var ue=class extends T{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=e=>{if(this._points.length<this.maxChoices){let r=e.offsetX,i=e.offsetY;this._points=[...this._points,`${r} ${i}`],this.saveResponse(this._points)}}}render(){return h` <slot name="prompt"></slot>
|
|
557
557
|
<point-container>
|
|
558
|
-
${
|
|
558
|
+
${Kt(this._points,e=>e,(e,r)=>h`
|
|
559
559
|
<button
|
|
560
560
|
part="point"
|
|
561
|
-
style=${
|
|
561
|
+
style=${Fi({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
562
562
|
aria-label="Remove point at ${e}"
|
|
563
563
|
@click=${i=>{i.stopPropagation(),this._points=this._points.filter((o,n)=>n!==r),this.saveResponse(this._points)}}
|
|
564
564
|
></button>
|
|
@@ -572,7 +572,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
572
572
|
display: block;
|
|
573
573
|
position: relative;
|
|
574
574
|
}
|
|
575
|
-
`],l([d({type:Number,attribute:"max-choices"})],ue.prototype,"maxChoices",2),l([d({type:Number,attribute:"min-choices"})],ue.prototype,"minChoices",2),l([q()],ue.prototype,"_points",2),ue=l([m("qti-select-point-interaction")],ue);var
|
|
575
|
+
`],l([d({type:Number,attribute:"max-choices"})],ue.prototype,"maxChoices",2),l([d({type:Number,attribute:"min-choices"})],ue.prototype,"minChoices",2),l([q()],ue.prototype,"_points",2),ue=l([m("qti-select-point-interaction")],ue);var R=class extends T{constructor(){super();this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=(e,r)=>{};this._handleReadonlyChange=(e,r)=>{};this.csLive=getComputedStyle(this)}set min(e){this._min=e,this.value=e,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}set response(e){if(Array.isArray(e)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let r=parseInt(e);if(Number.isNaN(r)){console.error("QtiSliderInteraction: response is not a number");return}this.value=r}render(){this.value<this.min&&(this.value=this.min),this.value>this.max&&(this.value=this.max);let e=(this.value-this.min)/(this.max-this.min)*100;return this.style.setProperty("--value-percentage",`${e}%`),this.setAttribute("aria-valuenow",this.value.toString()),h`<slot name="prompt"></slot>
|
|
576
576
|
<div id="slider" part="slider">
|
|
577
577
|
${this.csLive.getPropertyValue("--show-bounds")=="true"?h`<div id="bounds" part="bounds">
|
|
578
578
|
<div>${this._min}</div>
|
|
@@ -584,7 +584,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
584
584
|
${this.csLive.getPropertyValue("--show-value")=="true"?h`<div id="value" part="value">${this.value}</div>`:E}
|
|
585
585
|
</div>
|
|
586
586
|
</div>
|
|
587
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:c}=this.getPositionFromEvent(a),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),a.stopPropagation()},i=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",i),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",i);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let r=n=>{let a=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),n.preventDefault(),n.stopPropagation()},i=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,i=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=i}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let i=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=i.touches[0]||i.changedTouches[0];r={x:o.pageX,y:o.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};
|
|
587
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:c}=this.getPositionFromEvent(a),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),a.stopPropagation()},i=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",i),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",i);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let r=n=>{let a=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),n.preventDefault(),n.stopPropagation()},i=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,i=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=i}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let i=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=i.touches[0]||i.changedTouches[0];r={x:o.pageX,y:o.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};R.styles=[b``],l([Ke("#knob")],R.prototype,"_knob",2),l([Ke("#rail")],R.prototype,"_rail",2),l([d({type:Number})],R.prototype,"value",2),l([d({type:Boolean,attribute:"step-label"})],R.prototype,"stepLabel",2),l([d({type:Boolean})],R.prototype,"reverse",2),l([d({type:Number,attribute:"lower-bound"})],R.prototype,"min",1),l([d({type:Number,attribute:"upper-bound"})],R.prototype,"max",1),l([d({type:Number,attribute:"step"})],R.prototype,"step",1),l([S("disabled",{waitUntilFirstUpdate:!0})],R.prototype,"_handleDisabledChange",2),l([S("readonly",{waitUntilFirstUpdate:!0})],R.prototype,"_handleReadonlyChange",2),R=l([m("qti-slider-interaction")],R);var ut=class extends u{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,i,o;let e=Array.from((i=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?i:[]).find(n=>n.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(o=e.textContent)!=null?o:"")}catch(n){console.error("custom-operator contains invalid javascript code",n)}}calculate(){let t={variable:r=>{var i,o,n;return(n=(o=(i=this._context)==null?void 0:i.variables.find(a=>a.identifier===r))==null?void 0:o.value)!=null?n:""},correct:r=>{var i,o,n;return(n=(o=(i=this._context)==null?void 0:i.variables.find(a=>a.identifier===r))==null?void 0:o.correctResponse)!=null?n:""}},e={getVariable:r=>{var i;return(i=this._context)==null?void 0:i.variables.find(o=>o.identifier===r)},updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.operatorFunction(this._context,t,e)}};l([J({context:I,subscribe:!0}),q()],ut.prototype,"_context",2),ut=l([m("qti-custom-operator")],ut);var gt=class extends u{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return h` <slot name="qti-gap-img"></slot> `}};gt.styles=b`
|
|
588
588
|
:host {
|
|
589
589
|
display: flex;
|
|
590
590
|
user-select: none;
|
|
@@ -600,18 +600,18 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
600
600
|
display: flex;
|
|
601
601
|
user-select: none;
|
|
602
602
|
}
|
|
603
|
-
`,l([d({type:Number,reflect:!0})],Pe.prototype,"tabindex",2),Pe=l([m("qti-gap-img")],Pe);var Ne=class extends
|
|
603
|
+
`,l([d({type:Number,reflect:!0})],Pe.prototype,"tabindex",2),Pe=l([m("qti-gap-img")],Pe);var Ne=class extends O(u,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return h`<slot></slot>`}};Ne.styles=b`
|
|
604
604
|
:host {
|
|
605
605
|
display: inline-flex;
|
|
606
606
|
user-select: none;
|
|
607
607
|
}
|
|
608
|
-
`,l([d({type:Number,reflect:!0})],Ne.prototype,"tabindex",2),Ne=l([m("qti-gap-text")],Ne);var Ve=class extends
|
|
608
|
+
`,l([d({type:Number,reflect:!0})],Ne.prototype,"tabindex",2),Ne=l([m("qti-gap-text")],Ne);var Ve=class extends O(u,"qti-hotspot-choice"){};Ve.styles=b`
|
|
609
609
|
:host {
|
|
610
610
|
display: flex;
|
|
611
611
|
user-select: none;
|
|
612
612
|
position: absolute;
|
|
613
613
|
}
|
|
614
|
-
`,l([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],Ve.prototype,"order",2),Ve=l([m("qti-hotspot-choice")],Ve);var ft=class extends
|
|
614
|
+
`,l([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],Ve.prototype,"order",2),Ve=l([m("qti-hotspot-choice")],Ve);var ft=class extends O(u,"qti-hottext"){render(){return h`<div part="ch"><div part="cha"></div></div>
|
|
615
615
|
<slot></slot> `}};ft.styles=b`
|
|
616
616
|
:host {
|
|
617
617
|
display: flex;
|
|
@@ -622,7 +622,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
622
622
|
display: block;
|
|
623
623
|
cursor: pointer;
|
|
624
624
|
}
|
|
625
|
-
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,cancelable:!1,composed:!0}))}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([d({type:String})],bt.prototype,"identifier",2),bt=l([m("qti-inline-choice")],bt);var Ie=class extends
|
|
625
|
+
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,cancelable:!1,composed:!0}))}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([d({type:String})],bt.prototype,"identifier",2),bt=l([m("qti-inline-choice")],bt);var Ie=class extends O(u,"qti-simple-choice"){render(){return h`<div part="ch">
|
|
626
626
|
<div part="cha"></div>
|
|
627
627
|
</div>
|
|
628
628
|
${this.marker?h`<div id="label">${this.marker}</div>`:E}
|
|
@@ -642,7 +642,7 @@ var jr=Object.defineProperty,Ki=Object.defineProperties,Zi=Object.getOwnProperty
|
|
|
642
642
|
align-items: center;
|
|
643
643
|
justify-content: center;
|
|
644
644
|
}
|
|
645
|
-
`,l([d({type:String,attribute:!1})],Ie.prototype,"marker",2),Ie=l([m("qti-simple-choice")],Ie);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");var
|
|
645
|
+
`,l([d({type:String,attribute:!1})],Ie.prototype,"marker",2),Ie=l([m("qti-simple-choice")],Ie);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");var Bi=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
646
646
|
|
|
647
647
|
/*
|
|
648
648
|
Base variables on PNP
|
|
@@ -672,7 +672,7 @@ https://www.imsglobal.org/spec/qti/v3p0/impl#h.e0onr51nghyl
|
|
|
672
672
|
--qti-bg-primary: var(--qti-primary);
|
|
673
673
|
|
|
674
674
|
/* Text colors */
|
|
675
|
-
--qti-text-gray-500: #
|
|
675
|
+
--qti-text-gray-500: #45484f;
|
|
676
676
|
--qti-text-white: white;
|
|
677
677
|
|
|
678
678
|
/* Border properties */
|
|
@@ -955,8 +955,7 @@ https://www.imsglobal.org/spec/qti/v3p0/impl#h.e0onr51nghyl
|
|
|
955
955
|
background-color: var(--qti-bg-gray-100);
|
|
956
956
|
color: var(--qti-text-gray-500);
|
|
957
957
|
border-color: var(--qti-border-color-gray);
|
|
958
|
-
|
|
959
|
-
/* outline: 2px solid var(--qti-bg-gray-100); */
|
|
958
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
960
959
|
|
|
961
960
|
/* outline-color: var(--qti-text-gray-50); */
|
|
962
961
|
}
|
|
@@ -2603,6 +2602,7 @@ qti-response-declaration {
|
|
|
2603
2602
|
background-color: var(--qti-bg-gray-100);
|
|
2604
2603
|
color: var(--qti-text-gray-500);
|
|
2605
2604
|
border-color: var(--qti-border-color-gray);
|
|
2605
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
2606
2606
|
}
|
|
2607
2607
|
|
|
2608
2608
|
border-radius: var(--qti-border-radius-md);
|
|
@@ -2644,6 +2644,7 @@ qti-response-declaration {
|
|
|
2644
2644
|
background-color: var(--qti-bg-gray-100);
|
|
2645
2645
|
color: var(--qti-text-gray-500);
|
|
2646
2646
|
border-color: var(--qti-border-color-gray);
|
|
2647
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
2647
2648
|
}
|
|
2648
2649
|
|
|
2649
2650
|
&::part(cha) {
|
|
@@ -2855,6 +2856,7 @@ qti-response-declaration {
|
|
|
2855
2856
|
background-color: var(--qti-bg-gray-100);
|
|
2856
2857
|
color: var(--qti-text-gray-500);
|
|
2857
2858
|
border-color: var(--qti-border-color-gray);
|
|
2859
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
2858
2860
|
}
|
|
2859
2861
|
|
|
2860
2862
|
width: 100%;
|
|
@@ -2896,6 +2898,7 @@ qti-response-declaration {
|
|
|
2896
2898
|
background-color: var(--qti-bg-gray-100);
|
|
2897
2899
|
color: var(--qti-text-gray-500);
|
|
2898
2900
|
border-color: var(--qti-border-color-gray);
|
|
2901
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
2899
2902
|
}
|
|
2900
2903
|
|
|
2901
2904
|
width: 100%;
|
|
@@ -2960,6 +2963,7 @@ qti-response-declaration {
|
|
|
2960
2963
|
background-color: var(--qti-bg-gray-100);
|
|
2961
2964
|
color: var(--qti-text-gray-500);
|
|
2962
2965
|
border-color: var(--qti-border-color-gray);
|
|
2966
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
2963
2967
|
}
|
|
2964
2968
|
}
|
|
2965
2969
|
}
|
|
@@ -3066,6 +3070,7 @@ qti-response-declaration {
|
|
|
3066
3070
|
background-color: var(--qti-bg-gray-100);
|
|
3067
3071
|
color: var(--qti-text-gray-500);
|
|
3068
3072
|
border-color: var(--qti-border-color-gray);
|
|
3073
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
3069
3074
|
}
|
|
3070
3075
|
|
|
3071
3076
|
border-radius: var(--qti-border-radius-md);
|
|
@@ -3114,6 +3119,7 @@ qti-response-declaration {
|
|
|
3114
3119
|
background-color: var(--qti-bg-gray-100);
|
|
3115
3120
|
color: var(--qti-text-gray-500);
|
|
3116
3121
|
border-color: var(--qti-border-color-gray);
|
|
3122
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
3117
3123
|
}
|
|
3118
3124
|
}
|
|
3119
3125
|
}
|
|
@@ -3243,7 +3249,11 @@ qti-response-declaration {
|
|
|
3243
3249
|
|
|
3244
3250
|
&[disabled] {
|
|
3245
3251
|
&::part(dropslot) {
|
|
3246
|
-
|
|
3252
|
+
cursor: not-allowed;
|
|
3253
|
+
background-color: var(--qti-bg-gray-100);
|
|
3254
|
+
color: var(--qti-text-gray-500);
|
|
3255
|
+
border-color: var(--qti-border-color-gray);
|
|
3256
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
3247
3257
|
}
|
|
3248
3258
|
}
|
|
3249
3259
|
|
|
@@ -3540,6 +3550,7 @@ qti-response-declaration {
|
|
|
3540
3550
|
background-color: var(--qti-bg-gray-100);
|
|
3541
3551
|
color: var(--qti-text-gray-500);
|
|
3542
3552
|
border-color: var(--qti-border-color-gray);
|
|
3553
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
3543
3554
|
}
|
|
3544
3555
|
|
|
3545
3556
|
&[aria-ordervalue] {
|
|
@@ -3603,6 +3614,7 @@ qti-response-declaration {
|
|
|
3603
3614
|
background-color: var(--qti-bg-gray-100);
|
|
3604
3615
|
color: var(--qti-text-gray-500);
|
|
3605
3616
|
border-color: var(--qti-border-color-gray);
|
|
3617
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
3606
3618
|
}
|
|
3607
3619
|
|
|
3608
3620
|
width: 100%;
|
|
@@ -3644,6 +3656,7 @@ qti-response-declaration {
|
|
|
3644
3656
|
background-color: var(--qti-bg-gray-100);
|
|
3645
3657
|
color: var(--qti-text-gray-500);
|
|
3646
3658
|
border-color: var(--qti-border-color-gray);
|
|
3659
|
+
outline: 4px solid var(--qti-bg-gray-100);
|
|
3647
3660
|
}
|
|
3648
3661
|
|
|
3649
3662
|
width: 100%;
|
|
@@ -3792,7 +3805,7 @@ qti-response-declaration {
|
|
|
3792
3805
|
/* @import './styles/qti-variants/qti-input-width'; */
|
|
3793
3806
|
|
|
3794
3807
|
/* @import './styles/qti-variants/qti-interactions'; */
|
|
3795
|
-
`;var
|
|
3808
|
+
`;var Z,qe,Ur=class extends HTMLElement{constructor(){super(...arguments);Jt(this,Z,null);Jt(this,qe,null)}set xmlDoc(e){if(!V(this,Z)){Gt(this,Z,this.attachShadow({mode:"open"}));let r=new CSSStyleSheet;r.replaceSync(Bi),V(this,Z).adoptedStyleSheets=[r],V(this,Z).innerHTML="",V(this,Z).addEventListener("qti-assessment-item-connected",({target:i})=>Gt(this,qe,i))}V(this,Z).innerHTML="",V(this,Z).appendChild(e.cloneNode(!0))}processResponse(){var e;(e=V(this,qe))!=null&&e.processResponse()||console.warn("No qti-assessment-item found")}get variables(){var e;return((e=V(this,qe))==null?void 0:e.variables)||console.warn("No qti-assessment-item found")}set variables(e){V(this,qe).variables=e}attributeChangedCallback(e,r,i){switch(e){case"view":break;default:r!==i&&(this[e]=i);break}}};Z=new WeakMap,qe=new WeakMap;customElements.define("qti-item",Ur);var ji=s=>s.endsWith("/")?s:`${s}/`,jf=async(s,t,e=!0)=>{let r=ji(s),i=await mr().load(`${r}imsmanifest.xml`).then(c=>c.assessmentTest()),o=await Rt().load(`${r}${i.href}`).then(c=>c.items()),n=`${r}${i.href.substring(0,i.href.lastIndexOf("/"))}/${o[t].href}`,a=await Ze().load(n,e).then(c=>c.path(n.substring(0,n.lastIndexOf("/"))).stripStyleSheets());return{itemHTMLDoc:a.htmldoc(),itemHTML:a.html(),items:o}},Xf=async s=>{let t=ji(s),e=await mr().load(`${t}imsmanifest.xml`).then(c=>c.assessmentTest()),r=await Rt().load(`${t}${e.href}`).then(c=>c.htmldoc()),i=await Rt().load(`${t}${e.href}`).then(c=>c.items()),n=`${t.substring(0,t.lastIndexOf("/"))}/${e.href.substring(0,e.href.lastIndexOf("/"))}`,a=`${n}/${i[0].href.substring(0,i[0].href.lastIndexOf("/"))}`;return{assessmentXML:r,itemLocation:a,assessmentLocation:n,items:i,testIdentifier:e.identifier}},Yf=async(s,t=!0)=>Ze().load(s,t).then(e=>e.path(s.substring(0,s.lastIndexOf("/"))).stripStyleSheets().html());export{O as ActiveElementMixin,T as Interaction,at as QtPrintedVariable,zt as QtiAnd,L as QtiAssessmentItem,Ae as QtiAssessmentStimulusRef,gt as QtiAssociableHotspot,Le as QtiAssociateInteraction,Ft as QtiBaseValue,Re as QtiChoiceInteraction,$t as QtiCompanionMaterialsInfo,H as QtiConditionExpression,Cr as QtiContains,Dt as QtiContentBody,kr as QtiCorrect,W as QtiCustomInteraction,ut as QtiCustomOperator,$e as QtiEndAttemptInteraction,jt as QtiEqual,Bt as QtiEqualRounded,x as QtiExpression,j as QtiExtendedTextInteraction,Qe as QtiFeedbackBlock,et as QtiFeedbackInline,He as QtiGap,Pe as QtiGapImg,lt as QtiGapMatchInteraction,Ne as QtiGapText,K as QtiGraphicAssociateInteraction,ct as QtiGraphicGapMatchInteraction,dt as QtiGraphicOrderInteraction,Tr as QtiGt,Ar as QtiGte,Ve as QtiHotspotChoice,pt as QtiHotspotInteraction,ft as QtiHottext,It as QtiHottextInteraction,bt as QtiInlineChoice,de as QtiInlineChoiceInteraction,_r as QtiIsNull,Ur as QtiItem,Ut as QtiLookupOutcomeValue,Sr as QtiLt,Rr as QtiLte,Xt as QtiMapResponse,Me as QtiMapping,Mr as QtiMatch,me as QtiMatchInteraction,ht as QtiMediaInteraction,Lr as QtiMember,tt as QtiModalFeedback,$r as QtiMultiple,Dr as QtiNot,Hr as QtiOr,re as QtiOrderInteraction,Pr as QtiOrdered,U as QtiOutcomeDeclaration,st as QtiOutcomeProcessing,yr as QtiOutcomeProcessingProcessor,pe as QtiPortableCustomInteraction,mt as QtiPositionObjectStage,Nr as QtiProduct,Mt as QtiPrompt,xr as QtiResponseCondition,ee as QtiResponseDeclaration,ot as QtiResponseElse,Er as QtiResponseElseIf,nt as QtiResponseIf,xe as QtiResponseProcessing,z as QtiRubricBlock,X as QtiRule,Zt as QtiSPositionObjectInteraction,ue as QtiSelectPointInteraction,qr as QtiSetOutcomeValue,wr as QtiSetOutcomeValueRule,he as QtiSimpleAssociableChoice,Ie as QtiSimpleChoice,R as QtiSliderInteraction,Yt as QtiStringMatch,Lt as QtiStylesheet,Vr as QtiSum,Ir as QtiSumExpression,D as QtiTextEntryInteraction,Or as QtiVariable,Xf as getAssessmentData,jf as getItemByIndex,Yf as getItemByUri,I as itemContext,wi as itemContextVariables,Ts as qtiAndMixin,Ze as qtiTransformItem,mr as qtiTransformManifest,Rt as qtiTransformTest};
|
|
3796
3809
|
/*! Bundled license information:
|
|
3797
3810
|
|
|
3798
3811
|
@lit/context/lib/context-request-event.js:
|