@citolab/qti-components 3.0.55 → 3.0.57
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/index.js +2 -2
- package/index.umd.js +6 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -173,7 +173,7 @@ import{LitElement as e,html as t,css as s}from"lit";import{customElement as i,pr
|
|
|
173
173
|
</select>`}validate(){const e=this.options.find((e=>e.selected));return!!e&&""!==e.value}reset(){this.options=this.options.map(((e,t)=>Object.assign(Object.assign({},e),{selected:0===t})))}set response(e){this.options=this.options.map((t=>(e===t.value&&(t.selected=!0),t)))}choiceSelected(e){const t=e.target.value;this.options=this.options.map((e=>Object.assign(Object.assign({},e),{selected:e.value===t}))),this.saveResponse({base:{string:t}})}}z.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"],customElements.define("qti-inline-choice-interaction",z);class X extends V{constructor(){super(...arguments),this._shuffle=!1,this.render=()=>t`
|
|
174
174
|
<slot name="prompt"></slot>
|
|
175
175
|
<slot></slot>`}}X.layoutClass=["","qti-choices-stacking-2","qti-choices-stacking-3","qti-choices-stacking-4","qti-orientation-vertical","qti-orientation-horizontal"],X.presentationClass=["","qti-input-control-hidden"],q([n({attribute:"orientation"}),x("design:type",String)],X.prototype,"_orientation",void 0),q([n({attribute:"shuffle",type:Boolean}),x("design:type",Boolean)],X.prototype,"_shuffle",void 0),customElements.define("qti-choice-interaction",X);let K=class extends w{};K=q([i("qti-simple-choice")],K);class W extends e{render(){return t`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){const e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0.0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response identifier="RESPONSE"> </qti-map-response>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"map_response_point":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"match_correct":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-match>\n <qti-variable identifier="RESPONSE"></qti-variable>\n <qti-correct identifier="RESPONSE"></qti-correct>\n </qti-match>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">1</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'))}}const e=[...this.children];for(let t=0;t<e.length;t++){e[t].process()}}fragmentFromString(e){return document.createRange().createContextualFragment(e)}}customElements.define("qti-response-processing",W);class Q extends e{render(){return t``}process(){throw new Error("Not implemented")}}customElements.define("qti-rule",Q);class J extends Q{render(){return t`<slot></slot>`}process(){const e=[...this.children];for(let t=0;t<e.length;t++){const s=e[t];if(s.calculate())return void s.process()}}}customElements.define("qti-response-condition",J);class Z extends e{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return t`
|
|
176
|
-
<slot></slot>`}calculate(){return this.debugCalculateResult=!0,!0}getSubRules(){return[...this.children]}process(){const e=this.getSubRules();for(let t=0;t<e.length;t++){e[t].process()}}}customElements.define("qti-response-else",Z);class ee extends Z{render(){return t`${super.render()}`}calculate(){const e=this.firstElementChild.calculate();return this.debugCalculateResult=e,e}getSubRules(){const e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}}customElements.define("qti-response-if",ee);class te extends ee{render(){return t`${super.render()}`}}customElements.define("qti-response-else-if",te);class se extends E{render(){return t``}calculate(){throw new Error("Not implemented")}}customElements.define("qti-expression",se);class ie extends se{calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Response ${e} can not be found`),null;const s=t.mapping,i=t.value;let n=0;if(Array.isArray(i)){for(let e=0;e<i.length;e++)n+=ne(s,i[e],t.baseType);return n}return n+=ne(s,i,t.baseType),n}}function ne(e,t,s){let i=0;for(const n of e.entries()){const{entryTyped:e,valueTyped:r}=re(s,n,t);e===r&&(i+=n[1])}return i}function re(e,t,s){let i,n;switch(e){case m.string:case m.identifier:case m.directedPair:i=""+t[0],n=""+s;break;case m.float:i=parseFloat(t[0].replace(",",".")),n=parseFloat(s.replace(",","."));break;default:console.warn("no base-type identifier")}return{entryTyped:i,valueTyped:n}}customElements.define("qti-map-response",ie);class oe extends Q{process(){const e=this.getAttribute("identifier"),t=this.firstElementChild,s=t?t.calculate():null;this.closest("qti-assessment-item").setOutcomeValue(e,s)}}customElements.define("qti-set-outcome-value",oe);class ae extends se{render(){return t``}calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Can not find qti-response-identifier: ${e}`),null;return t.correctResponse}}customElements.define("qti-correct",ae);class le extends se{render(){return t``}calculate(){const e=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariableValue(e)}}customElements.define("qti-variable",le);class ce extends se{calculate(){const e=this.firstElementChild.calculate(),t=this.lastElementChild.calculate();let s=!0;return s=e instanceof Array?e.length===t.length&&e.filter(((e,s)=>e===t[s])).length===e.length:e==t,s}}customElements.define("qti-match",ce);class de extends se{calculate(){return de.calculate(this.textContent,this.getAttribute("base-type"))}static calculate(e,t){let s;if(t===m.directedPair){const t=e.split(" ");s={destination:t[1],source:t[0]}}else s=e;return s}}customElements.define("qti-base-value",de);class he extends se{calculate(){const e=this.firstElementChild,t=this.lastElementChild;return he.calculate(e,t)}static calculate(e,t){const s=e.calculate(),i=t.calculate(),n=s.map((e=>e.source+" "+e.destination)),r=i.map((e=>e.source+" "+e.destination));return n.filter((e=>r.includes(e))).length>0}}customElements.define("qti-contains",he);class pe extends se{calculate(){return 2===this.children.length?pe.calculate(this.children[0],this.children[1]):(this.err("unexpected number of children in qte"),null)}static calculate(e,t){return+e.calculate()>=+t.calculate()}}customElements.define("qti-gte",pe);class ue extends se{calculate(){return Array.from(this.children).map((e=>e.calculate()))}}customElements.define("qti-multiple",ue);class me extends se{render(){return t``}calculate(){return me.calculate(Array.from(this.children))}static calculate(e){return e.every((e=>e.calculate()))}}customElements.define("qti-and",me);class ge extends se{render(){return t``}calculate(){return ge.calculate(Array.from(this.children))}static calculate(e){return!!e.find((e=>e.calculate()))}}customElements.define("qti-or",ge);class be extends se{calculate(){return 1===this.children.length?be.calculate(this.children[0]):(this.err("unexpected number of children in qte"),null)}static calculate(e){const t=e.calculate();return null==t||null==t||""===t}}customElements.define("qti-is-null",be);class ye extends E{constructor(){super(...arguments),this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){const t=e.querySelectorAll("properties");let s={};const i=e=>{const t={},s=e.getAttribute("key");if(s){const i=Array.from(e.children),r=i.map((e=>e.getAttribute("key"))),o=r.length>0&&!r.find((e=>!Number.isInteger(+e)));t[s]=o?i.map((e=>n(e))):e.textContent}return t},n=e=>{if(e){let t={};for(const s of e.children)t=Object.assign(Object.assign({},t),i(s));return t}};for(const e of t){return e.getAttribute("key")||(s=Object.assign(Object.assign({},s),n(e))),s}this.err("Can not find qti-custom-interaction config")}register(e){const t="QTI-CUSTOM-INTERACTION"===this.parentElement.tagName?"TAO":"IMS",s="IMS"==t?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),"TAO"==t&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");const i="IMS"==t?{properties:this.dataset}:this.getTAOConfig(this);if("IMS"==t?e.getInstance(s,i,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,i),"TAO"==t){Array.from(this.querySelectorAll("link")).map((e=>e.getAttribute("href"))).forEach((e=>{const t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.media="screen",t.href=e,s.appendChild(t)}))}}connectedCallback(){super.connectedCallback();const e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim);requirejs.config(e)(["require"],(e=>{define("qtiCustomInteractionContext",(()=>({register:e=>{this.register(e)},notifyReady:()=>{}}))),e([this.module],(()=>{}),(e=>{this._errorMessage=e}))}),(e=>{this._errorMessage=e}))}render(){return t`<slot></slot>${this._errorMessage&&t`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}}customElements.define("qti-portable-custom-interaction",ye);const fe=(e,t)=>class extends e{connectedCallback(){if(super.connectedCallback(),this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{e.addEventListener("dragstart",(t=>{t.dataTransfer.setData("text",t.currentTarget.getAttribute("identifier")),e.setAttribute("dragging","")})),e.addEventListener("dragend",(t=>{t.preventDefault(),e.removeAttribute("over"),e.removeAttribute("dragging")})),e.setAttribute("qti-draggable","true")}))}},ve=(e,t,s)=>class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0}}}firstUpdated(e){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(e);const i=Array.from(t?this.shadowRoot.querySelectorAll(s):this.querySelectorAll(s));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),i.forEach((e=>{e.setAttribute("dropzone","move"),e.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(e)}));for(const e of i)this.observer=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){switch(t.attributeName){case"disabled":e.hasAttribute("disabled")?this.removeHandler(e):this.attachHandler(e);break}}}))})),this.observer.observe(e,{attributes:!0})}attachHandler(e){e.addEventListener("dragover",this.dragoverHandler),e.addEventListener("drop",this.dropHandler)}removeHandler(e){e.removeEventListener("dragover",this.dragoverHandler),e.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var e;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),null===(e=this.observer)||void 0===e||e.disconnect())}dragoverHandler(e){e.preventDefault();return e.currentTarget.setAttribute("active",""),e.dataTransfer.dropEffect="move",!1}dropHandler(e){e.preventDefault();const t=e.currentTarget,s=this.querySelector(`[identifier=${e.dataTransfer.getData("text")}`),i=s||this.shadowRoot.querySelector(`[identifier=${e.dataTransfer.getData("text")}`);return t?i.parentElement.getAttribute("identifier")!==t.getAttribute("identifier")&&t.appendChild(i):console.error(`cannot find droppable, target: ${e.target?JSON.stringify(e.target):"null"}`),t.removeAttribute("active"),!1}dragleaveHandler(e){e.preventDefault();return e.currentTarget.removeAttribute("active"),!1}};class Ee{constructor(e){return this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._canDrag=!1,this._dragSrc=null,this._dragCopy=null,this._touchEndCalled=!1,this._dragRunning=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0,this._DBLCLICKDELAY=500,this._CONTEXTMENUDELAY=1e3,this._DRAGDELTA=5,this._COPYOPACITY=.7,e.forEach((e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})),document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this}_touchStart(e){this._touchBegin=Date.now();const{x:t,y:s}=this.getPositionFromEvent(e);this._touchDown={x:t,y:s},this._dragSrc=e.target,this._canDrag=!0,e.preventDefault()}_touchMove(e){if(this._canDrag&&this._dragSrc){const{x:s,y:i}=this.getPositionFromEvent(e),n={clientX:s,clientY:i};if(null===this._dragCopy){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);const e=window.getComputedStyle(this._dragSrc);this._dragCopy.style="";for(const t of e)this._dragCopy.style[t]=e.getPropertyValue(t);this._calculateDragCopyPosition(n),this._dragCopy.style.top=n.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=n.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="absolute",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._getDelta(n)>=this._DRAGDELTA&&(this._dragRunning=!0),this._dragRunning){const s=this;requestAnimationFrame((function(){s._touchEndCalled||null===s._dragCopy||(s._dragCopy.style.top=n.clientY-s._copyOffset.y+"px",s._dragCopy.style.left=n.clientX-s._copyOffset.x+"px")}));var t=this._findDroppable(e);t!=this._lastTarget&&(this._dispatchEvent(t,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=t),this._currentDropContainer=t,this._currentDropContainer&&this._dispatchEvent(t,"dragover"),e.preventDefault()}}}_touchEnd(e){var t;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else{const e=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});e.dataTransfer={dropEffect:"none"},null===(t=this._dragSrc)||void 0===t||t.dispatchEvent(e)}this._reset()}_touchCancel(e){this._reset()}_findDroppable(e){let t;const s=e.composedPath().find((e=>{if(1===e.nodeType&&"SLOT"!==e.nodeName&&e.hasAttribute("dropzone"))return e}));if(s){const i=s.getRootNode(),n=this._getPoint(e);t=i.elementFromPoint(n.x,n.y)}return t}_getPoint(e,t){return e&&e.touches&&(e=e.touches[0]),{x:t?e.pageX:e.clientX,y:t?e.pageY:e.clientY}}_calculateDragCopyPosition(e){const t=this._dragSrc.getBoundingClientRect();this._copyOffset.x=e.clientX-t.left,this._copyOffset.y=e.clientY-t.top}_getDelta(e){return Math.abs(e.clientX-this._touchDown.x)+Math.abs(e.clientY-this._touchDown.y)}_dispatchEvent(e,t,s=!0){if(!e)return!1;const i=new CustomEvent(t,{bubbles:s,cancelable:!0});return i.dataTransfer=this._dataTransfer,e.dispatchEvent(i),i.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}getPositionFromEvent(e){let t;if("touchstart"==e.type||"touchmove"==e.type||"touchend"==e.type||"touchcancel"==e.type){const s=void 0===e.originalEvent?e:e.originalEvent,i=s.touches[0]||s.changedTouches[0];t={x:i.pageX,y:i.pageY}}else"mousedown"!=e.type&&"mouseup"!=e.type&&"mousemove"!=e.type&&"mouseover"!=e.type&&"mouseout"!=e.type&&"mouseenter"!=e.type&&"mouseleave"!=e.type||(t={x:e.clientX,y:e.clientY});return t}}const _e=(e,t,s,i)=>{class r extends(((e,t,s)=>class extends e{})(ve(fe(e,t),s,i))){constructor(){if(super(),this.draggables=new Map,this.responseIdentifier="",this.disabled=!1,this.readonly=!1,this.minAssociations=1,this.maxAssociations=1,this.classList.contains("qti-match-tabular"))return;const e=Array.from(this.querySelectorAll(t));new Ee(e),e.forEach((e=>{this.draggables.set(e,{parent:e.parentElement,index:Array.from(e.parentNode.children).indexOf(e)}),e.addEventListener("dragend",(e=>{if("none"===e.dataTransfer.dropEffect){const t=e.currentTarget,s=this.draggables.get(t),i=s.index<s.parent.children.length?s.index:s.parent.children.length-1,n=s.parent,r=s.parent.children[i];n.insertBefore(t,r)}"move"===e.dataTransfer.dropEffect&&console.log(e.dataTransfer),this.saveResponse()}))}))}updated(e){this.classList.contains("qti-match-tabular")||e.forEach(((e,t)=>{switch(t){case"disabled":this.draggables.forEach(((e,t)=>{this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.disabled?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}));break;case"readonly":this.draggables.forEach(((e,t)=>{this.readonly?t.setAttribute("readonly",""):t.removeAttribute("readonly"),this.readonly?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}))}}))}reset(e=!0){this.draggables.forEach(((e,t)=>{const s=e.index<e.parent.children.length?e.index:e.parent.children.length;e.parent.insertBefore(t,e.parent.children[s])})),e&&this.saveResponse()}set response(e){this.classList.contains("qti-match-tabular")||(this.reset(!1),null!==e&&Array.isArray(e)&&e.forEach((e=>{const[t,s]=e.split(" ");if(s){const e=this.querySelector(`[identifier=${s}]`),i=this.querySelector(`[identifier=${t}]`);e?i?e.appendChild(i):console.error(`cannot find draggable with identifier: ${t}`):console.error(`cannot find droppable with identifier: ${s}`)}})))}validate(){const e=(s?Array.from(this.shadowRoot.querySelectorAll(i)):Array.from(this.querySelectorAll(i))).filter((e=>e.childElementCount>0)).length;return this.minAssociations<=0||this.minAssociations<=e}saveResponse(){const e={list:{pair:(s?Array.from(this.shadowRoot.querySelectorAll(i)):Array.from(this.querySelectorAll(i))).map((e=>Array.from(e.children).map((e=>e.getAttribute("identifier")+" "))+e.getAttribute("identifier")))}};this.dispatchEvent(new CustomEvent(b.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:e}}))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(b.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}}return q([n({type:String,attribute:"response-identifier"}),x("design:type",String)],r.prototype,"responseIdentifier",void 0),q([n({type:Boolean,reflect:!0}),x("design:type",Object)],r.prototype,"disabled",void 0),q([n({type:Boolean,reflect:!0}),x("design:type",Object)],r.prototype,"readonly",void 0),q([n({type:Number,reflect:!0,attribute:"min-associations"}),x("design:type",Object)],r.prototype,"minAssociations",void 0),q([n({type:Number,reflect:!0,attribute:"max-associations"}),x("design:type",Object)],r.prototype,"maxAssociations",void 0),r};class Ce extends(_e(E,"qti-simple-associable-choice",!0,"drop-list")){render(){return t` <slot name="prompt"></slot>
|
|
176
|
+
<slot></slot>`}calculate(){return this.debugCalculateResult=!0,!0}getSubRules(){return[...this.children]}process(){const e=this.getSubRules();for(let t=0;t<e.length;t++){e[t].process()}}}customElements.define("qti-response-else",Z);class ee extends Z{render(){return t`${super.render()}`}calculate(){const e=this.firstElementChild.calculate();return this.debugCalculateResult=e,e}getSubRules(){const e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}}customElements.define("qti-response-if",ee);class te extends ee{render(){return t`${super.render()}`}}customElements.define("qti-response-else-if",te);class se extends E{render(){return t``}calculate(){throw new Error("Not implemented")}}customElements.define("qti-expression",se);class ie extends se{calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Response ${e} can not be found`),null;const s=t.mapping,i=t.value;let n=0;if(Array.isArray(i)){for(let e=0;e<i.length;e++)n+=ne(s,i[e],t.baseType);return n}return n+=ne(s,i,t.baseType),n}}function ne(e,t,s){let i=0;for(const n of e.entries()){const{entryTyped:e,valueTyped:r}=re(s,n,t);e===r&&(i+=n[1])}return i}function re(e,t,s){let i,n;switch(e){case m.string:case m.identifier:case m.directedPair:i=""+t[0],n=""+s;break;case m.float:i=parseFloat(t[0].replace(",",".")),n=parseFloat(s.replace(",","."));break;default:console.warn("no base-type identifier")}return{entryTyped:i,valueTyped:n}}customElements.define("qti-map-response",ie);class oe extends Q{process(){const e=this.getAttribute("identifier"),t=this.firstElementChild,s=t?t.calculate():null;this.closest("qti-assessment-item").setOutcomeValue(e,s)}}customElements.define("qti-set-outcome-value",oe);class ae extends se{render(){return t``}calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Can not find qti-response-identifier: ${e}`),null;return t.correctResponse}}customElements.define("qti-correct",ae);class le extends se{render(){return t``}calculate(){const e=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariableValue(e)}}customElements.define("qti-variable",le);class ce extends se{calculate(){const e=this.firstElementChild.calculate(),t=this.lastElementChild.calculate();let s=!0;return s=e instanceof Array?e.length===t.length&&e.filter(((e,s)=>e===t[s])).length===e.length:e==t,s}}customElements.define("qti-match",ce);class de extends se{calculate(){return de.calculate(this.textContent,this.getAttribute("base-type"))}static calculate(e,t){let s;if(t===m.directedPair){const t=e.split(" ");s={destination:t[1],source:t[0]}}else s=e;return s}}customElements.define("qti-base-value",de);class he extends se{calculate(){const e=this.firstElementChild,t=this.lastElementChild;return he.calculate(e,t)}static calculate(e,t){const s=e.calculate(),i=t.calculate(),n=s.map((e=>e.source+" "+e.destination)),r=i.map((e=>e.source+" "+e.destination));return n.filter((e=>r.includes(e))).length>0}}customElements.define("qti-contains",he);class pe extends se{calculate(){return 2===this.children.length?pe.calculate(this.children[0],this.children[1]):(this.err("unexpected number of children in qte"),null)}static calculate(e,t){return+e.calculate()>=+t.calculate()}}customElements.define("qti-gte",pe);class ue extends se{calculate(){return Array.from(this.children).map((e=>e.calculate()))}}customElements.define("qti-multiple",ue);class me extends se{render(){return t``}calculate(){return me.calculate(Array.from(this.children))}static calculate(e){return e.every((e=>e.calculate()))}}customElements.define("qti-and",me);class ge extends se{render(){return t``}calculate(){return ge.calculate(Array.from(this.children))}static calculate(e){return!!e.find((e=>e.calculate()))}}customElements.define("qti-or",ge);class be extends se{calculate(){return 1===this.children.length?be.calculate(this.children[0]):(this.err("unexpected number of children in qte"),null)}static calculate(e){const t=e.calculate();return null==t||null==t||""===t}}customElements.define("qti-is-null",be);class ye extends E{constructor(){super(...arguments),this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){const t=e.querySelectorAll("properties");let s={};const i=e=>{const t={},s=e.getAttribute("key");if(s){const i=Array.from(e.children),r=i.map((e=>e.getAttribute("key"))),o=r.length>0&&!r.find((e=>!Number.isInteger(+e)));t[s]=o?i.map((e=>n(e))):e.textContent}return t},n=e=>{if(e){let t={};for(const s of e.children)t=Object.assign(Object.assign({},t),i(s));return t}};for(const e of t){return e.getAttribute("key")||(s=Object.assign(Object.assign({},s),n(e))),s}this.err("Can not find qti-custom-interaction config")}register(e){const t="QTI-CUSTOM-INTERACTION"===this.parentElement.tagName?"TAO":"IMS",s="IMS"==t?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),"TAO"==t&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");const i="IMS"==t?{properties:this.dataset}:this.getTAOConfig(this);if("IMS"==t?e.getInstance(s,i,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,i),"TAO"==t){Array.from(this.querySelectorAll("link")).map((e=>e.getAttribute("href"))).forEach((e=>{const t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.media="screen",t.href=e,s.appendChild(t)}))}}connectedCallback(){super.connectedCallback();const e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim);requirejs.config(e)(["require"],(e=>{define("qtiCustomInteractionContext",(()=>({register:e=>{this.register(e)},notifyReady:()=>{}}))),e([this.module],(()=>{}),(e=>{this._errorMessage=e}))}),(e=>{this._errorMessage=e}))}render(){return t`<slot></slot>${this._errorMessage&&t`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}}customElements.define("qti-portable-custom-interaction",ye);const fe=(e,t)=>class extends e{connectedCallback(){if(super.connectedCallback(),this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{e.addEventListener("dragstart",(t=>{t.dataTransfer.setData("text",t.currentTarget.getAttribute("identifier")),e.setAttribute("dragging","")})),e.addEventListener("dragend",(t=>{t.preventDefault(),e.removeAttribute("over"),e.removeAttribute("dragging")})),e.setAttribute("qti-draggable","true")}))}},ve=(e,t,s)=>class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0}}}firstUpdated(e){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(e);const i=Array.from(t?this.shadowRoot.querySelectorAll(s):this.querySelectorAll(s));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),i.forEach((e=>{e.setAttribute("dropzone","move"),e.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(e)}));for(const e of i)this.observer=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){switch(t.attributeName){case"disabled":e.hasAttribute("disabled")?this.removeHandler(e):this.attachHandler(e);break}}}))})),this.observer.observe(e,{attributes:!0})}attachHandler(e){e.addEventListener("dragover",this.dragoverHandler),e.addEventListener("drop",this.dropHandler)}removeHandler(e){e.removeEventListener("dragover",this.dragoverHandler),e.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var e;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),null===(e=this.observer)||void 0===e||e.disconnect())}dragoverHandler(e){e.preventDefault();return e.currentTarget.setAttribute("active",""),e.dataTransfer.dropEffect="move",!1}dropHandler(e){e.preventDefault();const t=e.currentTarget,s=this.querySelector(`[identifier=${e.dataTransfer.getData("text")}`),i=s||this.shadowRoot.querySelector(`[identifier=${e.dataTransfer.getData("text")}`);return t?i.parentElement.getAttribute("identifier")!==t.getAttribute("identifier")&&t.appendChild(i):console.error(`cannot find droppable, target: ${e.target?JSON.stringify(e.target):"null"}`),t.removeAttribute("active"),!1}dragleaveHandler(e){e.preventDefault();return e.currentTarget.removeAttribute("active"),!1}};class Ee{constructor(e){return this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._canDrag=!1,this._dragSrc=null,this._dragCopy=null,this._touchEndCalled=!1,this._dragRunning=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0,this._DBLCLICKDELAY=500,this._CONTEXTMENUDELAY=1e3,this._DRAGDELTA=5,this._COPYOPACITY=.7,e.forEach((e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})),document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this}_touchStart(e){this._touchBegin=Date.now();const{x:t,y:s}=this.getPositionFromEvent(e);this._touchDown={x:t,y:s},this._dragSrc=e.target,this._canDrag=!0,e.preventDefault()}_touchMove(e){if(this._canDrag&&this._dragSrc){const{x:s,y:i}=this.getPositionFromEvent(e),n={clientX:s,clientY:i};if(null===this._dragCopy){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);const e=window.getComputedStyle(this._dragSrc);this._dragCopy.style="";for(const t of e)this._dragCopy.style[t]=e.getPropertyValue(t);this._calculateDragCopyPosition(n),this._dragCopy.style.top=n.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=n.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="absolute",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._getDelta(n)>=this._DRAGDELTA&&(this._dragRunning=!0),this._dragRunning){const s=this;requestAnimationFrame((function(){s._touchEndCalled||null===s._dragCopy||(s._dragCopy.style.top=n.clientY-s._copyOffset.y+"px",s._dragCopy.style.left=n.clientX-s._copyOffset.x+"px")}));var t=this._findDroppable(e);t!=this._lastTarget&&(this._dispatchEvent(t,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=t),this._currentDropContainer=t,this._currentDropContainer&&this._dispatchEvent(t,"dragover"),e.preventDefault()}}}_touchEnd(e){var t;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else{const e=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});e.dataTransfer={dropEffect:"none"},null===(t=this._dragSrc)||void 0===t||t.dispatchEvent(e)}this._reset()}_touchCancel(e){this._reset()}_findDroppable(e){let t;const s=e.composedPath().find((e=>{if(1===e.nodeType&&"SLOT"!==e.nodeName&&e.hasAttribute("dropzone"))return e}));if(s){const i=s.getRootNode(),n=this._getPoint(e);t=i.elementFromPoint(n.x,n.y)}return t}_getPoint(e,t){return e&&e.touches&&(e=e.touches[0]),{x:t?e.pageX:e.clientX,y:t?e.pageY:e.clientY}}_calculateDragCopyPosition(e){const t=this._dragSrc.getBoundingClientRect();this._copyOffset.x=e.clientX-t.left,this._copyOffset.y=e.clientY-t.top}_getDelta(e){return Math.abs(e.clientX-this._touchDown.x)+Math.abs(e.clientY-this._touchDown.y)}_dispatchEvent(e,t,s=!0){if(!e)return!1;const i=new CustomEvent(t,{bubbles:s,cancelable:!0});return i.dataTransfer=this._dataTransfer,e.dispatchEvent(i),i.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}getPositionFromEvent(e){let t;if("touchstart"==e.type||"touchmove"==e.type||"touchend"==e.type||"touchcancel"==e.type){const s=void 0===e.originalEvent?e:e.originalEvent,i=s.touches[0]||s.changedTouches[0];t={x:i.pageX,y:i.pageY}}else"mousedown"!=e.type&&"mouseup"!=e.type&&"mousemove"!=e.type&&"mouseover"!=e.type&&"mouseout"!=e.type&&"mouseenter"!=e.type&&"mouseleave"!=e.type||(t={x:e.clientX,y:e.clientY});return t}}const _e=(e,t,s,i)=>{class r extends(((e,t,s)=>class extends e{})(ve(fe(e,t),s,i))){constructor(){if(super(),this.draggables=new Map,this.responseIdentifier="",this.disabled=!1,this.readonly=!1,this.minAssociations=1,this.maxAssociations=1,this.classList.contains("qti-match-tabular"))return;this.droppables=s?Array.from(this.shadowRoot.querySelectorAll(i)):Array.from(this.querySelectorAll(i));const e=Array.from(this.querySelectorAll(t));new Ee(e),e.forEach((e=>{this.draggables.set(e,{parent:e.parentElement,index:Array.from(e.parentNode.children).indexOf(e)}),e.addEventListener("dragend",(e=>{if("none"===e.dataTransfer.dropEffect){const t=e.currentTarget,s=this.draggables.get(t),i=s.index<s.parent.children.length?s.index:s.parent.children.length-1,n=s.parent,r=s.parent.children[i];n.insertBefore(t,r)}e.dataTransfer.dropEffect,this.saveResponse()}))}))}updated(e){this.classList.contains("qti-match-tabular")||e.forEach(((e,t)=>{switch(t){case"disabled":this.draggables.forEach(((e,t)=>{this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.disabled?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}));break;case"readonly":this.draggables.forEach(((e,t)=>{this.readonly?t.setAttribute("readonly",""):t.removeAttribute("readonly"),this.readonly?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}))}}))}reset(e=!0){this.draggables.forEach(((e,t)=>{const s=e.index<e.parent.children.length?e.index:e.parent.children.length;e.parent.insertBefore(t,e.parent.children[s])})),e&&this.saveResponse()}set response(e){this.classList.contains("qti-match-tabular")||(this.reset(!1),null!==e&&Array.isArray(e)&&e.forEach((e=>{const[t,s]=e.split(" ");if(s){const e=this.querySelector(`[identifier=${s}]`),i=this.querySelector(`[identifier=${t}]`);e?i?e.appendChild(i):console.error(`cannot find draggable with identifier: ${t}`):console.error(`cannot find droppable with identifier: ${s}`)}})))}validate(){const e=(s?Array.from(this.shadowRoot.querySelectorAll(i)):Array.from(this.querySelectorAll(i))).filter((e=>e.childElementCount>0)).length;return this.minAssociations<=0||this.minAssociations<=e}saveResponse(){const e={list:{pair:this.droppables.map((e=>{var t;let s="";return(null===(t=e.children)||void 0===t?void 0:t.length)>0&&(s+=Array.from(e.children).map((e=>e.getAttribute("identifier"))).join(" ")+" "),s+=e.getAttribute("identifier"),s}))}};this.dispatchEvent(new CustomEvent(b.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:e}}))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(b.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}}return q([n({type:String,attribute:"response-identifier"}),x("design:type",String)],r.prototype,"responseIdentifier",void 0),q([n({type:Boolean,reflect:!0}),x("design:type",Object)],r.prototype,"disabled",void 0),q([n({type:Boolean,reflect:!0}),x("design:type",Object)],r.prototype,"readonly",void 0),q([n({type:Number,reflect:!0,attribute:"min-associations"}),x("design:type",Object)],r.prototype,"minAssociations",void 0),q([n({type:Number,reflect:!0,attribute:"max-associations"}),x("design:type",Object)],r.prototype,"maxAssociations",void 0),r};class Ce extends(_e(E,"qti-simple-associable-choice",!0,"drop-list")){render(){return t` <slot name="prompt"></slot>
|
|
177
177
|
<slot name="qti-simple-associable-choice"></slot>
|
|
178
178
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map(((e,s)=>t`<div part="associables-container">
|
|
179
179
|
<drop-list part="drop-list" identifier="droplist${s}_left"></drop-list>
|
|
@@ -328,7 +328,7 @@ import{LitElement as e,html as t,css as s}from"lit";import{customElement as i,pr
|
|
|
328
328
|
<div class="notification"></div>`}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}}He.styles=[Te],customElements.define("qti-select-point-interaction",He);class $e extends P{constructor(){super(...arguments),this.stepLabel=!1,this.reverse=!1,this._handleDisabledChange=(e,t)=>{},this._handleReadonlyChange=(e,t)=>{}}set min(e){this._min=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){this.value=e}render(){this.value<this.min&&(this.value=this.min),this.value>this.max&&(this.value=this.max);const e=(this.value-this.min)/(this.max-this.min)*100;return t`<slot name="prompt"></slot>
|
|
329
329
|
<div id="rail" @mousedown=${this._onMouseDown} part="rail">
|
|
330
330
|
<div id="knob" part="knob" style="left:${e}%"></div>
|
|
331
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onMouseDown(e){const t=
|
|
331
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onMouseDown(e){const t=e=>{const t=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(t),e.preventDefault(),e.stopPropagation()},s=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",s),this.saveResponse({base:{float:this.value}})};document.addEventListener("mousemove",t),document.addEventListener("mouseup",s);const i=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(i),e.preventDefault(),e.stopPropagation()}calculateValue(e){const t=this.min+(this.max-this.min)*e/this.offsetWidth,s=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=s}}$e.styles=[s``],q([o("#knob"),x("design:type",HTMLElement)],$e.prototype,"_knob",void 0),q([o("#rail"),x("design:type",HTMLElement)],$e.prototype,"_rail",void 0),q([n({attribute:!1}),x("design:type",Number)],$e.prototype,"value",void 0),q([n({type:Boolean,attribute:"step-label"}),x("design:type",Object)],$e.prototype,"stepLabel",void 0),q([n({type:Boolean}),x("design:type",Object)],$e.prototype,"reverse",void 0),q([n({type:Number,attribute:"lower-bound"}),x("design:type",Number),x("design:paramtypes",[Number])],$e.prototype,"min",null),q([n({type:Number,attribute:"upper-bound"}),x("design:type",Number),x("design:paramtypes",[Number])],$e.prototype,"max",null),q([n({type:Number,attribute:"step"}),x("design:type",Number),x("design:paramtypes",[Number])],$e.prototype,"step",null),q([R("disabled",{waitUntilFirstUpdate:!0}),x("design:type",Object)],$e.prototype,"_handleDisabledChange",void 0),q([R("readonly",{waitUntilFirstUpdate:!0}),x("design:type",Object)],$e.prototype,"_handleReadonlyChange",void 0),customElements.define("qti-slider-interaction",$e);class je extends e{constructor(){super(...arguments),this.render=()=>t`${this.value}`}levenshtein(e,t){let s;if(0===e.length)return t.length;if(0===t.length)return e.length;e.length>t.length&&(s=e,e=t,t=s);const i=e.length,n=t.length,r=Array(i);let o,a,l;for(o=0;o<=i;o++)r[o]=o;for(o=1;o<=n;o++){for(l=o,a=1;a<=i;a++)s=r[a-1],r[a-1]=l,l=Math.min(s+(t[o-1]!==e[a-1]),l+1,r[a]+1);r[a-1]=l}return l}calculate(){const e=this.firstElementChild,t=this.lastElementChild,s=e.calculate(),i=t.calculate();return this.value=100-this.levenshtein(s.toString().trim(),i.toString().trim())/i.toString().length*100,this.value}}je.properties={value:{}},customElements.define("qti-custom-operator-levenshtein",je);class Pe extends e{render(){return t``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/[^0-9$.,]/g,""):""}}customElements.define("qti-custom-operator-numeric",Pe);class Fe extends e{constructor(){super(...arguments),this.render=()=>t`${this.value}`}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return this.value=t?this.parseNumber(t,undefined):"",this.value}parseNumber(e,t=navigator.languages){const s=Intl.NumberFormat(t).format(1.1),i=new RegExp(`[^-+0-9${s.charAt(1)}]`,"g"),n=e.replace(i,"").replace(s.charAt(1),".");return parseFloat(n)}}Fe.properties={value:{}},customElements.define("qti-custom-operator-parse-numeric-nl",Fe);class Ue extends e{render(){return t``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/ /g,""):""}}customElements.define("qti-custom-operator-remove-spaces",Ue);class Be extends e{render(){return t``}calculate(){return this.firstElementChild.calculate().toString().trim()}}customElements.define("qti-custom-operator-trim",Be);const Ge=(e,t)=>class extends e{_dispatch(){this.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:!0,detail:+this.getAttribute("index")}))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._dispatch)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._dispatch)}};customElements.define("qti-test-next",class extends(Ge(e,"on-next-item")){constructor(){super(...arguments),this.render=()=>t`<slot></slot>`}}),customElements.define("qti-test-item",class extends(Ge(e,"on-request-item")){constructor(){super(...arguments),this.render=()=>t`<slot></slot>`}}),customElements.define("qti-test-prev",class extends(Ge(e,"on-prev-item")){constructor(){super(...arguments),this.render=()=>t`<slot></slot>`}}),customElements.define("qti-test-check",class extends(Ge(e,"on-check-item")){constructor(){super(...arguments),this.render=()=>t`<slot></slot>`}}),customElements.define("qti-test-score",class extends(Ge(e,"on-score-item")){constructor(){super(...arguments),this.render=()=>t`<slot></slot>`}}),customElements.define("qti-test-show-correct",class extends(Ge(e,"on-show-correct")){constructor(){super(...arguments),this.render=()=>t`<slot></slot>`}});const Ve={ON_ITEM_WAS_FINISHED:"onItemWasFinished",ON_NO_RESPONSE_ON_SUBMIT:"onNoResponseOnSubmit",ON_REQUEST_ITEM:"onRequestItem",ON_TEST_FINISHED:"onTestFinished",ON_ITEM_READY:"onItemReady"};var Ye,ze;!function(e){e.linear="linear",e.nonlinear="nonlinear"}(Ye||(Ye={})),function(e){e.individual="individual",e.simultaneous="simultaneous"}(ze||(ze={}));let Xe=class extends e{constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this._navigationMode=Ye.nonlinear,this._submissionMode=ze.simultaneous,this.items=[],this.itemIndex=0,this.provider=new d(this,L,{log:e=>{console.log(`[my-app] ${e}`)},view:"candidate"})}handleNavigationModeChange(e,t){this.prevButton.style.visibility=t===Ye.linear?"hidden":"visible"}handleItemIndexChange(e,t){this.emit(Ve.ON_REQUEST_ITEM,{detail:t})}set qtiContext(e){this.provider.value.view=e.view,this.provider.updateObservers()}set itemXML(e){this._itemRef&&this._itemRef.remove(),this.insertAdjacentHTML("afterbegin",e)}set manualOutcomeValue(e){this._itemRef.setOutcomeValue("SCORE",e)}set itemResponse(e){this._itemRef&&(this._itemRef.responses=e,this._navigationMode===Ye.linear&&(this._itemRef.style.filter="blur(5px)",this._itemRef.setAttribute("disabled",""),this.dispatchEvent(new CustomEvent(Ve.ON_ITEM_WAS_FINISHED))))}_onCheckItem(){return!!this._itemRef.validateResponses()&&(this._itemRef.processResponse(),!0)}_onScoreItem(){this._onCheckItem()&&this._itemRef.processResponse()}_onPrevItem(){this.itemIndex>0&&this.emit(Ve.ON_REQUEST_ITEM,{detail:this.itemIndex-1})}_onNextItem(){this._navigationMode!==Ye.linear||this._itemRef.validateResponses()?this.itemIndex<this.items.length-1?this.emit(Ve.ON_REQUEST_ITEM,{detail:this.itemIndex+1}):this.dispatchEvent(new CustomEvent(Ve.ON_TEST_FINISHED)):this.dispatchEvent(new CustomEvent(Ve.ON_NO_RESPONSE_ON_SUBMIT))}_onShowCorrect(){this._itemRef.showCorrectResponse()}_onRequestItem({detail:e}){this.emit(Ve.ON_REQUEST_ITEM,{detail:e})}_handleSlotchange(e){const t=this.querySelector("qti-assessment-item");t&&(this._itemRef=t,this.disabled&&this._itemRef.setAttribute("disabled",""),this.readonly&&this._itemRef.setAttribute("readonly",""),this.emit(Ve.ON_ITEM_READY,{detail:t}))}render(){return t`
|
|
332
332
|
<slot
|
|
333
333
|
@slotchange=${this._handleSlotchange}
|
|
334
334
|
@on-prev-item=${this._onPrevItem}
|
package/index.umd.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;var u;const m=window,g=m.trustedTypes,b=g?g.emptyScript:"",v=m.reactiveElementPolyfillSupport,
|
|
11
|
+
*/;var u;const m=window,g=m.trustedTypes,b=g?g.emptyScript:"",v=m.reactiveElementPolyfillSupport,y={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},f=(e,t)=>t!==e&&(t==t||e==e),_={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:f};class E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const s=this._$Ep(i,t);void 0!==s&&(this._$Ev.set(s,i),e.push(s))})),e}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(s){const n=this[e];this[t]=s,this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||_}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(p(e))}else void 0!==e&&t.push(p(e));return t}static _$Ep(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{a?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const i=document.createElement("style"),s=o.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=t.cssText,e.appendChild(i)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=_){var s;const n=this.constructor._$Ep(e,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:y).toAttribute(t,i.type);this._$El=e,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$El=null}}_$AK(e,t){var i;const s=this.constructor,n=s._$Ev.get(e);if(void 0!==n&&this._$El!==n){const e=s.getPropertyOptions(n),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(i=e.converter)||void 0===i?void 0:i.fromAttribute)?e.converter:y;this._$El=n,this[n]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,i){let s=!0;void 0!==e&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||f)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(i)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
@@ -57,13 +57,13 @@ function be(e,t){return(({finisher:e,descriptor:t})=>(i,s)=>{var n;if(void 0===s
|
|
|
57
57
|
:host {
|
|
58
58
|
display: block;
|
|
59
59
|
}
|
|
60
|
-
`,e.QtiItemBody=de([pe("qti-item-body")],e.QtiItemBody);class
|
|
60
|
+
`,e.QtiItemBody=de([pe("qti-item-body")],e.QtiItemBody);class ye extends re{render(){return D` <slot></slot> `}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}}customElements.define("qti-prompt",ye);
|
|
61
61
|
/**
|
|
62
62
|
* @license
|
|
63
63
|
* Copyright 2020 Google LLC
|
|
64
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
65
65
|
*/
|
|
66
|
-
const
|
|
66
|
+
const fe=Symbol.for(""),_e=e=>{if((null==e?void 0:e.r)===fe)return null==e?void 0:e._$litStatic$},Ee=new Map,Ce=(e=>(t,...i)=>{const s=i.length;let n,r;const o=[],a=[];let l,c=0,d=!1;for(;c<s;){for(l=t[c];c<s&&void 0!==(r=i[c],n=_e(r));)l+=n+t[++c],d=!0;a.push(r),o.push(l),c++}if(c===s&&o.push(t[s]),d){const e=o.join("$$lit$$");void 0===(t=Ee.get(e))&&(o.raw=o,Ee.set(e,t=o)),i=a}return e(t,...i)})(D);function Ae(e,t){const i=Object.assign({waitUntilFirstUpdate:!1},t);return(t,s)=>{const{update:n}=t;if(e in t){const r=e;t.update=function(e){if(e.has(r)){const t=e.get(r),n=this[r];t!==n&&(i.waitUntilFirstUpdate&&!this.hasUpdated||this[s](t,n))}n.call(this,e)}}}}const xe=32;e.QtiChoice=class extends ae{constructor(){super(...arguments),this.tabindex=0,this.disabled=!1,this.readonly=!1,this.checked=!1}handleDisabledChange(e,t){t?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.emit(s.ON_REGISTER_CHOICE)}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.emit(s.ON_LOOSE_CHOICE)}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){e.altKey||e.keyCode===xe&&(e.preventDefault(),this._toggleChecked())}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.emit(s.ON_CHOICE_ELEMENT_SELECTED,{detail:{identifier:this.identifier,checked:this.checked}}))}render(){return Ce` <slot></slot> `}},de([me({reflect:!0}),he("design:type",String)],e.QtiChoice.prototype,"identifier",void 0),de([me({type:Number,reflect:!0}),he("design:type",Object)],e.QtiChoice.prototype,"tabindex",void 0),de([me({type:Boolean,reflect:!0}),he("design:type",Object)],e.QtiChoice.prototype,"disabled",void 0),de([me({type:Boolean,reflect:!0}),he("design:type",Object)],e.QtiChoice.prototype,"readonly",void 0),de([me({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>`${e}`}}),he("design:type",Object)],e.QtiChoice.prototype,"checked",void 0),de([Ae("disabled",{waitUntilFirstUpdate:!0}),he("design:type",Function),he("design:paramtypes",[Object,Boolean]),he("design:returntype",void 0)],e.QtiChoice.prototype,"handleDisabledChange",null),e.QtiChoice=de([pe("qti-choice")],e.QtiChoice);class Se extends re{render(){return D``}}customElements.define("qti-variabledeclaration",Se);class qe extends Se{connectedCallback(){super.connectedCallback();const t=new n({baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||e.Cardinality.single,mapping:this.mapping});this.dispatchEvent(new CustomEvent(s.ON_REGISTER_VARIABLE,{bubbles:!0,composed:!0,detail:t}))}get correctResponse(){let e;const t=this.querySelector("qti-correct-response");if(t){const i=t.querySelectorAll("qti-value");if(1===i.length)e=i[0].textContent,i[0].remove();else{e=[];for(let t=0;t<i.length;t++)e.push(i[t].textContent),i[t].remove()}}return e}get mapping(){const e=this.querySelector("qti-mapping");if(e){const t=new Map,i=e.querySelectorAll("qti-map-entry");for(let e=0;e<i.length;e++){const s=i[e],n=s.getAttribute("map-key"),r=s.getAttribute("mapped-value");t.set(n,r?parseFloat(r):null)}return t}return null}}de([me({type:String,attribute:"base-type"}),he("design:type",String)],qe.prototype,"baseType",void 0),de([me({type:String,attribute:"identifier"}),he("design:type",String)],qe.prototype,"identifier",void 0),de([me({type:String,attribute:"cardinality"}),he("design:type",String)],qe.prototype,"cardinality",void 0),customElements.define("qti-response-declaration",qe);class Oe extends Se{static get observedAttributes(){return["identifier","cardinality","base-type"]}connectedCallback(){super.connectedCallback();const e=this.getAttribute("identifier"),t=new r;t.identifier=e,this.dispatchEvent(new CustomEvent(s.ON_REGISTER_VARIABLE,{bubbles:!0,composed:!0,detail:t}))}}customElements.define("qti-outcome-declaration",Oe),e.QtiCompanionMaterialsInfo=class extends ae{},e.QtiCompanionMaterialsInfo=de([pe("qti-companion-materials-info")],e.QtiCompanionMaterialsInfo);
|
|
67
67
|
/**
|
|
68
68
|
* @license
|
|
69
69
|
* Copyright 2021 Google LLC
|
|
@@ -286,7 +286,7 @@ const Ue=2;
|
|
|
286
286
|
</select>`}validate(){const e=this.options.find((e=>e.selected));return!!e&&""!==e.value}reset(){this.options=this.options.map(((e,t)=>Object.assign(Object.assign({},e),{selected:0===t})))}set response(e){this.options=this.options.map((t=>(e===t.value&&(t.selected=!0),t)))}choiceSelected(e){const t=e.target.value;this.options=this.options.map((e=>Object.assign(Object.assign({},e),{selected:e.value===t}))),this.saveResponse({base:{string:t}})}}it.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"],customElements.define("qti-inline-choice-interaction",it);class st extends et{constructor(){super(...arguments),this._shuffle=!1,this.render=()=>D`
|
|
287
287
|
<slot name="prompt"></slot>
|
|
288
288
|
<slot></slot>`}}st.layoutClass=["","qti-choices-stacking-2","qti-choices-stacking-3","qti-choices-stacking-4","qti-orientation-vertical","qti-orientation-horizontal"],st.presentationClass=["","qti-input-control-hidden"],de([me({attribute:"orientation"}),he("design:type",String)],st.prototype,"_orientation",void 0),de([me({attribute:"shuffle",type:Boolean}),he("design:type",Boolean)],st.prototype,"_shuffle",void 0),customElements.define("qti-choice-interaction",st),e.QtiSimpleChoice=class extends e.QtiChoice{},e.QtiSimpleChoice=de([pe("qti-simple-choice")],e.QtiSimpleChoice);class nt extends re{render(){return D`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){const e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0.0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response identifier="RESPONSE"> </qti-map-response>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"map_response_point":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"match_correct":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-match>\n <qti-variable identifier="RESPONSE"></qti-variable>\n <qti-correct identifier="RESPONSE"></qti-correct>\n </qti-match>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">1</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'))}}const e=[...this.children];for(let t=0;t<e.length;t++){e[t].process()}}fragmentFromString(e){return document.createRange().createContextualFragment(e)}}customElements.define("qti-response-processing",nt);class rt extends re{render(){return D``}process(){throw new Error("Not implemented")}}customElements.define("qti-rule",rt);class ot extends rt{render(){return D`<slot></slot>`}process(){const e=[...this.children];for(let t=0;t<e.length;t++){const i=e[t];if(i.calculate())return void i.process()}}}customElements.define("qti-response-condition",ot);class at extends re{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return D`
|
|
289
|
-
<slot></slot>`}calculate(){return this.debugCalculateResult=!0,!0}getSubRules(){return[...this.children]}process(){const e=this.getSubRules();for(let t=0;t<e.length;t++){e[t].process()}}}customElements.define("qti-response-else",at);class lt extends at{render(){return D`${super.render()}`}calculate(){const e=this.firstElementChild.calculate();return this.debugCalculateResult=e,e}getSubRules(){const e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}}customElements.define("qti-response-if",lt);class ct extends lt{render(){return D`${super.render()}`}}customElements.define("qti-response-else-if",ct);class dt extends ae{render(){return D``}calculate(){throw new Error("Not implemented")}}customElements.define("qti-expression",dt);class ht extends dt{calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Response ${e} can not be found`),null;const i=t.mapping,s=t.value;let n=0;if(Array.isArray(s)){for(let e=0;e<s.length;e++)n+=pt(i,s[e],t.baseType);return n}return n+=pt(i,s,t.baseType),n}}function pt(e,t,i){let s=0;for(const n of e.entries()){const{entryTyped:e,valueTyped:r}=ut(i,n,t);e===r&&(s+=n[1])}return s}function ut(t,i,s){let n,r;switch(t){case e.BaseType.string:case e.BaseType.identifier:case e.BaseType.directedPair:n=""+i[0],r=""+s;break;case e.BaseType.float:n=parseFloat(i[0].replace(",",".")),r=parseFloat(s.replace(",","."));break;default:console.warn("no base-type identifier")}return{entryTyped:n,valueTyped:r}}customElements.define("qti-map-response",ht);class mt extends rt{process(){const e=this.getAttribute("identifier"),t=this.firstElementChild,i=t?t.calculate():null;this.closest("qti-assessment-item").setOutcomeValue(e,i)}}customElements.define("qti-set-outcome-value",mt);class gt extends dt{render(){return D``}calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Can not find qti-response-identifier: ${e}`),null;return t.correctResponse}}customElements.define("qti-correct",gt);class bt extends dt{render(){return D``}calculate(){const e=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariableValue(e)}}customElements.define("qti-variable",bt);class vt extends dt{calculate(){const e=this.firstElementChild.calculate(),t=this.lastElementChild.calculate();let i=!0;return i=e instanceof Array?e.length===t.length&&e.filter(((e,i)=>e===t[i])).length===e.length:e==t,i}}customElements.define("qti-match",vt);class ft extends dt{calculate(){return ft.calculate(this.textContent,this.getAttribute("base-type"))}static calculate(t,i){let s;if(i===e.BaseType.directedPair){const e=t.split(" ");s={destination:e[1],source:e[0]}}else s=t;return s}}customElements.define("qti-base-value",ft);class yt extends dt{calculate(){const e=this.firstElementChild,t=this.lastElementChild;return yt.calculate(e,t)}static calculate(e,t){const i=e.calculate(),s=t.calculate(),n=i.map((e=>e.source+" "+e.destination)),r=s.map((e=>e.source+" "+e.destination)),o=n.filter((e=>r.includes(e)));return o.length>0}}customElements.define("qti-contains",yt);class _t extends dt{calculate(){return 2===this.children.length?_t.calculate(this.children[0],this.children[1]):(this.err("unexpected number of children in qte"),null)}static calculate(e,t){return+e.calculate()>=+t.calculate()}}customElements.define("qti-gte",_t);class Et extends dt{calculate(){return Array.from(this.children).map((e=>e.calculate()))}}customElements.define("qti-multiple",Et);class Ct extends dt{render(){return D``}calculate(){return Ct.calculate(Array.from(this.children))}static calculate(e){return e.every((e=>e.calculate()))}}customElements.define("qti-and",Ct);class At extends dt{render(){return D``}calculate(){return At.calculate(Array.from(this.children))}static calculate(e){return!!e.find((e=>e.calculate()))}}customElements.define("qti-or",At);class xt extends dt{calculate(){return 1===this.children.length?xt.calculate(this.children[0]):(this.err("unexpected number of children in qte"),null)}static calculate(e){const t=e.calculate();return null==t||null==t||""===t}}customElements.define("qti-is-null",xt);class St extends ae{constructor(){super(...arguments),this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){const t=e.querySelectorAll("properties");let i={};const s=e=>{const t={},i=e.getAttribute("key");if(i){const s=Array.from(e.children),r=s.map((e=>e.getAttribute("key"))),o=r.length>0&&!r.find((e=>!Number.isInteger(+e)));t[i]=o?s.map((e=>n(e))):e.textContent}return t},n=e=>{if(e){let t={};for(const i of e.children)t=Object.assign(Object.assign({},t),s(i));return t}};for(const e of t){return e.getAttribute("key")||(i=Object.assign(Object.assign({},i),n(e))),i}this.err("Can not find qti-custom-interaction config")}register(e){const t="QTI-CUSTOM-INTERACTION"===this.parentElement.tagName?"TAO":"IMS",i="IMS"==t?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),"TAO"==t&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");const s="IMS"==t?{properties:this.dataset}:this.getTAOConfig(this);if("IMS"==t?e.getInstance(i,s,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,s),"TAO"==t){Array.from(this.querySelectorAll("link")).map((e=>e.getAttribute("href"))).forEach((e=>{const t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.media="screen",t.href=e,i.appendChild(t)}))}}connectedCallback(){super.connectedCallback();const e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim);requirejs.config(e)(["require"],(e=>{define("qtiCustomInteractionContext",(()=>({register:e=>{this.register(e)},notifyReady:()=>{}}))),e([this.module],(()=>{}),(e=>{this._errorMessage=e}))}),(e=>{this._errorMessage=e}))}render(){return D`<slot></slot>${this._errorMessage&&D`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}}customElements.define("qti-portable-custom-interaction",St);const qt=(e,t)=>class extends e{connectedCallback(){if(super.connectedCallback(),this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{e.addEventListener("dragstart",(t=>{t.dataTransfer.setData("text",t.currentTarget.getAttribute("identifier")),e.setAttribute("dragging","")})),e.addEventListener("dragend",(t=>{t.preventDefault(),e.removeAttribute("over"),e.removeAttribute("dragging")})),e.setAttribute("qti-draggable","true")}))}},Ot=(e,t,i)=>class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0}}}firstUpdated(e){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(e);const s=Array.from(t?this.shadowRoot.querySelectorAll(i):this.querySelectorAll(i));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),s.forEach((e=>{e.setAttribute("dropzone","move"),e.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(e)}));for(const e of s)this.observer=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){switch(t.attributeName){case"disabled":e.hasAttribute("disabled")?this.removeHandler(e):this.attachHandler(e);break}}}))})),this.observer.observe(e,{attributes:!0})}attachHandler(e){e.addEventListener("dragover",this.dragoverHandler),e.addEventListener("drop",this.dropHandler)}removeHandler(e){e.removeEventListener("dragover",this.dragoverHandler),e.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var e;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),null===(e=this.observer)||void 0===e||e.disconnect())}dragoverHandler(e){e.preventDefault();return e.currentTarget.setAttribute("active",""),e.dataTransfer.dropEffect="move",!1}dropHandler(e){e.preventDefault();const t=e.currentTarget,i=this.querySelector(`[identifier=${e.dataTransfer.getData("text")}`),s=i||this.shadowRoot.querySelector(`[identifier=${e.dataTransfer.getData("text")}`);return t?s.parentElement.getAttribute("identifier")!==t.getAttribute("identifier")&&t.appendChild(s):console.error(`cannot find droppable, target: ${e.target?JSON.stringify(e.target):"null"}`),t.removeAttribute("active"),!1}dragleaveHandler(e){e.preventDefault();return e.currentTarget.removeAttribute("active"),!1}};class $t{constructor(e){return this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._canDrag=!1,this._dragSrc=null,this._dragCopy=null,this._touchEndCalled=!1,this._dragRunning=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0,this._DBLCLICKDELAY=500,this._CONTEXTMENUDELAY=1e3,this._DRAGDELTA=5,this._COPYOPACITY=.7,e.forEach((e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})),document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this}_touchStart(e){this._touchBegin=Date.now();const{x:t,y:i}=this.getPositionFromEvent(e);this._touchDown={x:t,y:i},this._dragSrc=e.target,this._canDrag=!0,e.preventDefault()}_touchMove(e){if(this._canDrag&&this._dragSrc){const{x:i,y:s}=this.getPositionFromEvent(e),n={clientX:i,clientY:s};if(null===this._dragCopy){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);const e=window.getComputedStyle(this._dragSrc);this._dragCopy.style="";for(const t of e)this._dragCopy.style[t]=e.getPropertyValue(t);this._calculateDragCopyPosition(n),this._dragCopy.style.top=n.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=n.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="absolute",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._getDelta(n)>=this._DRAGDELTA&&(this._dragRunning=!0),this._dragRunning){const i=this;requestAnimationFrame((function(){i._touchEndCalled||null===i._dragCopy||(i._dragCopy.style.top=n.clientY-i._copyOffset.y+"px",i._dragCopy.style.left=n.clientX-i._copyOffset.x+"px")}));var t=this._findDroppable(e);t!=this._lastTarget&&(this._dispatchEvent(t,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=t),this._currentDropContainer=t,this._currentDropContainer&&this._dispatchEvent(t,"dragover"),e.preventDefault()}}}_touchEnd(e){var t;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else{const e=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});e.dataTransfer={dropEffect:"none"},null===(t=this._dragSrc)||void 0===t||t.dispatchEvent(e)}this._reset()}_touchCancel(e){this._reset()}_findDroppable(e){let t;const i=e.composedPath().find((e=>{if(1===e.nodeType&&"SLOT"!==e.nodeName&&e.hasAttribute("dropzone"))return e}));if(i){const s=i.getRootNode(),n=this._getPoint(e);t=s.elementFromPoint(n.x,n.y)}return t}_getPoint(e,t){return e&&e.touches&&(e=e.touches[0]),{x:t?e.pageX:e.clientX,y:t?e.pageY:e.clientY}}_calculateDragCopyPosition(e){const t=this._dragSrc.getBoundingClientRect();this._copyOffset.x=e.clientX-t.left,this._copyOffset.y=e.clientY-t.top}_getDelta(e){return Math.abs(e.clientX-this._touchDown.x)+Math.abs(e.clientY-this._touchDown.y)}_dispatchEvent(e,t,i=!0){if(!e)return!1;const s=new CustomEvent(t,{bubbles:i,cancelable:!0});return s.dataTransfer=this._dataTransfer,e.dispatchEvent(s),s.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}getPositionFromEvent(e){let t;if("touchstart"==e.type||"touchmove"==e.type||"touchend"==e.type||"touchcancel"==e.type){const i=void 0===e.originalEvent?e:e.originalEvent,s=i.touches[0]||i.changedTouches[0];t={x:s.pageX,y:s.pageY}}else"mousedown"!=e.type&&"mouseup"!=e.type&&"mousemove"!=e.type&&"mouseover"!=e.type&&"mouseout"!=e.type&&"mouseenter"!=e.type&&"mouseleave"!=e.type||(t={x:e.clientX,y:e.clientY});return t}}const Rt=(e,t,i,n)=>{class r extends(((e,t,i)=>class extends e{})(Ot(qt(e,t),i,n))){constructor(){if(super(),this.draggables=new Map,this.responseIdentifier="",this.disabled=!1,this.readonly=!1,this.minAssociations=1,this.maxAssociations=1,this.classList.contains("qti-match-tabular"))return;const e=Array.from(this.querySelectorAll(t));new $t(e),e.forEach((e=>{this.draggables.set(e,{parent:e.parentElement,index:Array.from(e.parentNode.children).indexOf(e)}),e.addEventListener("dragend",(e=>{if("none"===e.dataTransfer.dropEffect){const t=e.currentTarget,i=this.draggables.get(t),s=i.index<i.parent.children.length?i.index:i.parent.children.length-1,n=i.parent,r=i.parent.children[s];n.insertBefore(t,r)}"move"===e.dataTransfer.dropEffect&&console.log(e.dataTransfer),this.saveResponse()}))}))}updated(e){this.classList.contains("qti-match-tabular")||e.forEach(((e,t)=>{switch(t){case"disabled":this.draggables.forEach(((e,t)=>{this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.disabled?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}));break;case"readonly":this.draggables.forEach(((e,t)=>{this.readonly?t.setAttribute("readonly",""):t.removeAttribute("readonly"),this.readonly?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}))}}))}reset(e=!0){this.draggables.forEach(((e,t)=>{const i=e.index<e.parent.children.length?e.index:e.parent.children.length;e.parent.insertBefore(t,e.parent.children[i])})),e&&this.saveResponse()}set response(e){this.classList.contains("qti-match-tabular")||(this.reset(!1),null!==e&&Array.isArray(e)&&e.forEach((e=>{const[t,i]=e.split(" ");if(i){const e=this.querySelector(`[identifier=${i}]`),s=this.querySelector(`[identifier=${t}]`);e?s?e.appendChild(s):console.error(`cannot find draggable with identifier: ${t}`):console.error(`cannot find droppable with identifier: ${i}`)}})))}validate(){const e=(i?Array.from(this.shadowRoot.querySelectorAll(n)):Array.from(this.querySelectorAll(n))).filter((e=>e.childElementCount>0)).length;return this.minAssociations<=0||this.minAssociations<=e}saveResponse(){const e={list:{pair:(i?Array.from(this.shadowRoot.querySelectorAll(n)):Array.from(this.querySelectorAll(n))).map((e=>Array.from(e.children).map((e=>e.getAttribute("identifier")+" "))+e.getAttribute("identifier")))}};this.dispatchEvent(new CustomEvent(s.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:e}}))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(s.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}}return de([me({type:String,attribute:"response-identifier"}),he("design:type",String)],r.prototype,"responseIdentifier",void 0),de([me({type:Boolean,reflect:!0}),he("design:type",Object)],r.prototype,"disabled",void 0),de([me({type:Boolean,reflect:!0}),he("design:type",Object)],r.prototype,"readonly",void 0),de([me({type:Number,reflect:!0,attribute:"min-associations"}),he("design:type",Object)],r.prototype,"minAssociations",void 0),de([me({type:Number,reflect:!0,attribute:"max-associations"}),he("design:type",Object)],r.prototype,"maxAssociations",void 0),r};class kt extends(Rt(ae,"qti-simple-associable-choice",!0,"drop-list")){render(){return D` <slot name="prompt"></slot>
|
|
289
|
+
<slot></slot>`}calculate(){return this.debugCalculateResult=!0,!0}getSubRules(){return[...this.children]}process(){const e=this.getSubRules();for(let t=0;t<e.length;t++){e[t].process()}}}customElements.define("qti-response-else",at);class lt extends at{render(){return D`${super.render()}`}calculate(){const e=this.firstElementChild.calculate();return this.debugCalculateResult=e,e}getSubRules(){const e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}}customElements.define("qti-response-if",lt);class ct extends lt{render(){return D`${super.render()}`}}customElements.define("qti-response-else-if",ct);class dt extends ae{render(){return D``}calculate(){throw new Error("Not implemented")}}customElements.define("qti-expression",dt);class ht extends dt{calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Response ${e} can not be found`),null;const i=t.mapping,s=t.value;let n=0;if(Array.isArray(s)){for(let e=0;e<s.length;e++)n+=pt(i,s[e],t.baseType);return n}return n+=pt(i,s,t.baseType),n}}function pt(e,t,i){let s=0;for(const n of e.entries()){const{entryTyped:e,valueTyped:r}=ut(i,n,t);e===r&&(s+=n[1])}return s}function ut(t,i,s){let n,r;switch(t){case e.BaseType.string:case e.BaseType.identifier:case e.BaseType.directedPair:n=""+i[0],r=""+s;break;case e.BaseType.float:n=parseFloat(i[0].replace(",",".")),r=parseFloat(s.replace(",","."));break;default:console.warn("no base-type identifier")}return{entryTyped:n,valueTyped:r}}customElements.define("qti-map-response",ht);class mt extends rt{process(){const e=this.getAttribute("identifier"),t=this.firstElementChild,i=t?t.calculate():null;this.closest("qti-assessment-item").setOutcomeValue(e,i)}}customElements.define("qti-set-outcome-value",mt);class gt extends dt{render(){return D``}calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Can not find qti-response-identifier: ${e}`),null;return t.correctResponse}}customElements.define("qti-correct",gt);class bt extends dt{render(){return D``}calculate(){const e=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariableValue(e)}}customElements.define("qti-variable",bt);class vt extends dt{calculate(){const e=this.firstElementChild.calculate(),t=this.lastElementChild.calculate();let i=!0;return i=e instanceof Array?e.length===t.length&&e.filter(((e,i)=>e===t[i])).length===e.length:e==t,i}}customElements.define("qti-match",vt);class yt extends dt{calculate(){return yt.calculate(this.textContent,this.getAttribute("base-type"))}static calculate(t,i){let s;if(i===e.BaseType.directedPair){const e=t.split(" ");s={destination:e[1],source:e[0]}}else s=t;return s}}customElements.define("qti-base-value",yt);class ft extends dt{calculate(){const e=this.firstElementChild,t=this.lastElementChild;return ft.calculate(e,t)}static calculate(e,t){const i=e.calculate(),s=t.calculate(),n=i.map((e=>e.source+" "+e.destination)),r=s.map((e=>e.source+" "+e.destination)),o=n.filter((e=>r.includes(e)));return o.length>0}}customElements.define("qti-contains",ft);class _t extends dt{calculate(){return 2===this.children.length?_t.calculate(this.children[0],this.children[1]):(this.err("unexpected number of children in qte"),null)}static calculate(e,t){return+e.calculate()>=+t.calculate()}}customElements.define("qti-gte",_t);class Et extends dt{calculate(){return Array.from(this.children).map((e=>e.calculate()))}}customElements.define("qti-multiple",Et);class Ct extends dt{render(){return D``}calculate(){return Ct.calculate(Array.from(this.children))}static calculate(e){return e.every((e=>e.calculate()))}}customElements.define("qti-and",Ct);class At extends dt{render(){return D``}calculate(){return At.calculate(Array.from(this.children))}static calculate(e){return!!e.find((e=>e.calculate()))}}customElements.define("qti-or",At);class xt extends dt{calculate(){return 1===this.children.length?xt.calculate(this.children[0]):(this.err("unexpected number of children in qte"),null)}static calculate(e){const t=e.calculate();return null==t||null==t||""===t}}customElements.define("qti-is-null",xt);class St extends ae{constructor(){super(...arguments),this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){const t=e.querySelectorAll("properties");let i={};const s=e=>{const t={},i=e.getAttribute("key");if(i){const s=Array.from(e.children),r=s.map((e=>e.getAttribute("key"))),o=r.length>0&&!r.find((e=>!Number.isInteger(+e)));t[i]=o?s.map((e=>n(e))):e.textContent}return t},n=e=>{if(e){let t={};for(const i of e.children)t=Object.assign(Object.assign({},t),s(i));return t}};for(const e of t){return e.getAttribute("key")||(i=Object.assign(Object.assign({},i),n(e))),i}this.err("Can not find qti-custom-interaction config")}register(e){const t="QTI-CUSTOM-INTERACTION"===this.parentElement.tagName?"TAO":"IMS",i="IMS"==t?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),"TAO"==t&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");const s="IMS"==t?{properties:this.dataset}:this.getTAOConfig(this);if("IMS"==t?e.getInstance(i,s,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,s),"TAO"==t){Array.from(this.querySelectorAll("link")).map((e=>e.getAttribute("href"))).forEach((e=>{const t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.media="screen",t.href=e,i.appendChild(t)}))}}connectedCallback(){super.connectedCallback();const e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim);requirejs.config(e)(["require"],(e=>{define("qtiCustomInteractionContext",(()=>({register:e=>{this.register(e)},notifyReady:()=>{}}))),e([this.module],(()=>{}),(e=>{this._errorMessage=e}))}),(e=>{this._errorMessage=e}))}render(){return D`<slot></slot>${this._errorMessage&&D`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}}customElements.define("qti-portable-custom-interaction",St);const qt=(e,t)=>class extends e{connectedCallback(){if(super.connectedCallback(),this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{e.addEventListener("dragstart",(t=>{t.dataTransfer.setData("text",t.currentTarget.getAttribute("identifier")),e.setAttribute("dragging","")})),e.addEventListener("dragend",(t=>{t.preventDefault(),e.removeAttribute("over"),e.removeAttribute("dragging")})),e.setAttribute("qti-draggable","true")}))}},Ot=(e,t,i)=>class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0}}}firstUpdated(e){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(e);const s=Array.from(t?this.shadowRoot.querySelectorAll(i):this.querySelectorAll(i));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),s.forEach((e=>{e.setAttribute("dropzone","move"),e.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(e)}));for(const e of s)this.observer=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){switch(t.attributeName){case"disabled":e.hasAttribute("disabled")?this.removeHandler(e):this.attachHandler(e);break}}}))})),this.observer.observe(e,{attributes:!0})}attachHandler(e){e.addEventListener("dragover",this.dragoverHandler),e.addEventListener("drop",this.dropHandler)}removeHandler(e){e.removeEventListener("dragover",this.dragoverHandler),e.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var e;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),null===(e=this.observer)||void 0===e||e.disconnect())}dragoverHandler(e){e.preventDefault();return e.currentTarget.setAttribute("active",""),e.dataTransfer.dropEffect="move",!1}dropHandler(e){e.preventDefault();const t=e.currentTarget,i=this.querySelector(`[identifier=${e.dataTransfer.getData("text")}`),s=i||this.shadowRoot.querySelector(`[identifier=${e.dataTransfer.getData("text")}`);return t?s.parentElement.getAttribute("identifier")!==t.getAttribute("identifier")&&t.appendChild(s):console.error(`cannot find droppable, target: ${e.target?JSON.stringify(e.target):"null"}`),t.removeAttribute("active"),!1}dragleaveHandler(e){e.preventDefault();return e.currentTarget.removeAttribute("active"),!1}};class $t{constructor(e){return this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._canDrag=!1,this._dragSrc=null,this._dragCopy=null,this._touchEndCalled=!1,this._dragRunning=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0,this._DBLCLICKDELAY=500,this._CONTEXTMENUDELAY=1e3,this._DRAGDELTA=5,this._COPYOPACITY=.7,e.forEach((e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})),document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this}_touchStart(e){this._touchBegin=Date.now();const{x:t,y:i}=this.getPositionFromEvent(e);this._touchDown={x:t,y:i},this._dragSrc=e.target,this._canDrag=!0,e.preventDefault()}_touchMove(e){if(this._canDrag&&this._dragSrc){const{x:i,y:s}=this.getPositionFromEvent(e),n={clientX:i,clientY:s};if(null===this._dragCopy){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);const e=window.getComputedStyle(this._dragSrc);this._dragCopy.style="";for(const t of e)this._dragCopy.style[t]=e.getPropertyValue(t);this._calculateDragCopyPosition(n),this._dragCopy.style.top=n.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=n.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="absolute",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._getDelta(n)>=this._DRAGDELTA&&(this._dragRunning=!0),this._dragRunning){const i=this;requestAnimationFrame((function(){i._touchEndCalled||null===i._dragCopy||(i._dragCopy.style.top=n.clientY-i._copyOffset.y+"px",i._dragCopy.style.left=n.clientX-i._copyOffset.x+"px")}));var t=this._findDroppable(e);t!=this._lastTarget&&(this._dispatchEvent(t,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=t),this._currentDropContainer=t,this._currentDropContainer&&this._dispatchEvent(t,"dragover"),e.preventDefault()}}}_touchEnd(e){var t;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else{const e=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});e.dataTransfer={dropEffect:"none"},null===(t=this._dragSrc)||void 0===t||t.dispatchEvent(e)}this._reset()}_touchCancel(e){this._reset()}_findDroppable(e){let t;const i=e.composedPath().find((e=>{if(1===e.nodeType&&"SLOT"!==e.nodeName&&e.hasAttribute("dropzone"))return e}));if(i){const s=i.getRootNode(),n=this._getPoint(e);t=s.elementFromPoint(n.x,n.y)}return t}_getPoint(e,t){return e&&e.touches&&(e=e.touches[0]),{x:t?e.pageX:e.clientX,y:t?e.pageY:e.clientY}}_calculateDragCopyPosition(e){const t=this._dragSrc.getBoundingClientRect();this._copyOffset.x=e.clientX-t.left,this._copyOffset.y=e.clientY-t.top}_getDelta(e){return Math.abs(e.clientX-this._touchDown.x)+Math.abs(e.clientY-this._touchDown.y)}_dispatchEvent(e,t,i=!0){if(!e)return!1;const s=new CustomEvent(t,{bubbles:i,cancelable:!0});return s.dataTransfer=this._dataTransfer,e.dispatchEvent(s),s.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(e,t){this.data[e]=t},getData:function(e){return this.data[e]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}getPositionFromEvent(e){let t;if("touchstart"==e.type||"touchmove"==e.type||"touchend"==e.type||"touchcancel"==e.type){const i=void 0===e.originalEvent?e:e.originalEvent,s=i.touches[0]||i.changedTouches[0];t={x:s.pageX,y:s.pageY}}else"mousedown"!=e.type&&"mouseup"!=e.type&&"mousemove"!=e.type&&"mouseover"!=e.type&&"mouseout"!=e.type&&"mouseenter"!=e.type&&"mouseleave"!=e.type||(t={x:e.clientX,y:e.clientY});return t}}const Rt=(e,t,i,n)=>{class r extends(((e,t,i)=>class extends e{})(Ot(qt(e,t),i,n))){constructor(){if(super(),this.draggables=new Map,this.responseIdentifier="",this.disabled=!1,this.readonly=!1,this.minAssociations=1,this.maxAssociations=1,this.classList.contains("qti-match-tabular"))return;this.droppables=i?Array.from(this.shadowRoot.querySelectorAll(n)):Array.from(this.querySelectorAll(n));const e=Array.from(this.querySelectorAll(t));new $t(e),e.forEach((e=>{this.draggables.set(e,{parent:e.parentElement,index:Array.from(e.parentNode.children).indexOf(e)}),e.addEventListener("dragend",(e=>{if("none"===e.dataTransfer.dropEffect){const t=e.currentTarget,i=this.draggables.get(t),s=i.index<i.parent.children.length?i.index:i.parent.children.length-1,n=i.parent,r=i.parent.children[s];n.insertBefore(t,r)}e.dataTransfer.dropEffect,this.saveResponse()}))}))}updated(e){this.classList.contains("qti-match-tabular")||e.forEach(((e,t)=>{switch(t){case"disabled":this.draggables.forEach(((e,t)=>{this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.disabled?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}));break;case"readonly":this.draggables.forEach(((e,t)=>{this.readonly?t.setAttribute("readonly",""):t.removeAttribute("readonly"),this.readonly?t.removeAttribute("qti-draggable"):t.setAttribute("qti-draggable","true")}))}}))}reset(e=!0){this.draggables.forEach(((e,t)=>{const i=e.index<e.parent.children.length?e.index:e.parent.children.length;e.parent.insertBefore(t,e.parent.children[i])})),e&&this.saveResponse()}set response(e){this.classList.contains("qti-match-tabular")||(this.reset(!1),null!==e&&Array.isArray(e)&&e.forEach((e=>{const[t,i]=e.split(" ");if(i){const e=this.querySelector(`[identifier=${i}]`),s=this.querySelector(`[identifier=${t}]`);e?s?e.appendChild(s):console.error(`cannot find draggable with identifier: ${t}`):console.error(`cannot find droppable with identifier: ${i}`)}})))}validate(){const e=(i?Array.from(this.shadowRoot.querySelectorAll(n)):Array.from(this.querySelectorAll(n))).filter((e=>e.childElementCount>0)).length;return this.minAssociations<=0||this.minAssociations<=e}saveResponse(){const e=this.droppables.map((e=>{var t;let i="";return(null===(t=e.children)||void 0===t?void 0:t.length)>0&&(i+=Array.from(e.children).map((e=>e.getAttribute("identifier"))).join(" ")+" "),i+=e.getAttribute("identifier"),i})),t={list:{pair:e}};this.dispatchEvent(new CustomEvent(s.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:t}}))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(s.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}}return de([me({type:String,attribute:"response-identifier"}),he("design:type",String)],r.prototype,"responseIdentifier",void 0),de([me({type:Boolean,reflect:!0}),he("design:type",Object)],r.prototype,"disabled",void 0),de([me({type:Boolean,reflect:!0}),he("design:type",Object)],r.prototype,"readonly",void 0),de([me({type:Number,reflect:!0,attribute:"min-associations"}),he("design:type",Object)],r.prototype,"minAssociations",void 0),de([me({type:Number,reflect:!0,attribute:"max-associations"}),he("design:type",Object)],r.prototype,"maxAssociations",void 0),r};class kt extends(Rt(ae,"qti-simple-associable-choice",!0,"drop-list")){render(){return D` <slot name="prompt"></slot>
|
|
290
290
|
<slot name="qti-simple-associable-choice"></slot>
|
|
291
291
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map(((e,t)=>D`<div part="associables-container">
|
|
292
292
|
<drop-list part="drop-list" identifier="droplist${t}_left"></drop-list>
|
|
@@ -441,7 +441,7 @@ const Ue=2;
|
|
|
441
441
|
<div class="notification"></div>`}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}}Gt.styles=[Ut],customElements.define("qti-select-point-interaction",Gt);class Vt extends Pe{constructor(){super(...arguments),this.stepLabel=!1,this.reverse=!1,this._handleDisabledChange=(e,t)=>{},this._handleReadonlyChange=(e,t)=>{}}set min(e){this._min=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){this.value=e}render(){this.value<this.min&&(this.value=this.min),this.value>this.max&&(this.value=this.max);const e=(this.value-this.min)/(this.max-this.min)*100;return D`<slot name="prompt"></slot>
|
|
442
442
|
<div id="rail" @mousedown=${this._onMouseDown} part="rail">
|
|
443
443
|
<div id="knob" part="knob" style="left:${e}%"></div>
|
|
444
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onMouseDown(e){const t=
|
|
444
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onMouseDown(e){const t=e=>{const t=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(t),e.preventDefault(),e.stopPropagation()},i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this.saveResponse({base:{float:this.value}})};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i);const s=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(s),e.preventDefault(),e.stopPropagation()}calculateValue(e){const t=this.min+(this.max-this.min)*e/this.offsetWidth,i=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=i}}Vt.styles=[h``],de([be("#knob"),he("design:type",HTMLElement)],Vt.prototype,"_knob",void 0),de([be("#rail"),he("design:type",HTMLElement)],Vt.prototype,"_rail",void 0),de([me({attribute:!1}),he("design:type",Number)],Vt.prototype,"value",void 0),de([me({type:Boolean,attribute:"step-label"}),he("design:type",Object)],Vt.prototype,"stepLabel",void 0),de([me({type:Boolean}),he("design:type",Object)],Vt.prototype,"reverse",void 0),de([me({type:Number,attribute:"lower-bound"}),he("design:type",Number),he("design:paramtypes",[Number])],Vt.prototype,"min",null),de([me({type:Number,attribute:"upper-bound"}),he("design:type",Number),he("design:paramtypes",[Number])],Vt.prototype,"max",null),de([me({type:Number,attribute:"step"}),he("design:type",Number),he("design:paramtypes",[Number])],Vt.prototype,"step",null),de([Ae("disabled",{waitUntilFirstUpdate:!0}),he("design:type",Object)],Vt.prototype,"_handleDisabledChange",void 0),de([Ae("readonly",{waitUntilFirstUpdate:!0}),he("design:type",Object)],Vt.prototype,"_handleReadonlyChange",void 0),customElements.define("qti-slider-interaction",Vt);class zt extends re{constructor(){super(...arguments),this.render=()=>D`${this.value}`}levenshtein(e,t){let i;if(0===e.length)return t.length;if(0===t.length)return e.length;e.length>t.length&&(i=e,e=t,t=i);const s=e.length,n=t.length,r=Array(s);let o,a,l;for(o=0;o<=s;o++)r[o]=o;for(o=1;o<=n;o++){for(l=o,a=1;a<=s;a++)i=r[a-1],r[a-1]=l,l=Math.min(i+(t[o-1]!==e[a-1]),l+1,r[a]+1);r[a-1]=l}return l}calculate(){const e=this.firstElementChild,t=this.lastElementChild,i=e.calculate(),s=t.calculate();return this.value=100-this.levenshtein(i.toString().trim(),s.toString().trim())/s.toString().length*100,this.value}}zt.properties={value:{}},customElements.define("qti-custom-operator-levenshtein",zt);class Yt extends re{render(){return D``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/[^0-9$.,]/g,""):""}}customElements.define("qti-custom-operator-numeric",Yt);class Wt extends re{constructor(){super(...arguments),this.render=()=>D`${this.value}`}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return this.value=t?this.parseNumber(t,undefined):"",this.value}parseNumber(e,t=navigator.languages){const i=Intl.NumberFormat(t).format(1.1),s=new RegExp(`[^-+0-9${i.charAt(1)}]`,"g"),n=e.replace(s,"").replace(i.charAt(1),".");return parseFloat(n)}}Wt.properties={value:{}},customElements.define("qti-custom-operator-parse-numeric-nl",Wt);class Kt extends re{render(){return D``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/ /g,""):""}}customElements.define("qti-custom-operator-remove-spaces",Kt);class Xt extends re{render(){return D``}calculate(){return this.firstElementChild.calculate().toString().trim()}}customElements.define("qti-custom-operator-trim",Xt);const Jt=(e,t)=>class extends e{_dispatch(){this.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:!0,detail:+this.getAttribute("index")}))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._dispatch)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._dispatch)}};customElements.define("qti-test-next",class extends(Jt(re,"on-next-item")){constructor(){super(...arguments),this.render=()=>D`<slot></slot>`}}),customElements.define("qti-test-item",class extends(Jt(re,"on-request-item")){constructor(){super(...arguments),this.render=()=>D`<slot></slot>`}}),customElements.define("qti-test-prev",class extends(Jt(re,"on-prev-item")){constructor(){super(...arguments),this.render=()=>D`<slot></slot>`}}),customElements.define("qti-test-check",class extends(Jt(re,"on-check-item")){constructor(){super(...arguments),this.render=()=>D`<slot></slot>`}}),customElements.define("qti-test-score",class extends(Jt(re,"on-score-item")){constructor(){super(...arguments),this.render=()=>D`<slot></slot>`}}),customElements.define("qti-test-show-correct",class extends(Jt(re,"on-show-correct")){constructor(){super(...arguments),this.render=()=>D`<slot></slot>`}});const Zt={ON_ITEM_WAS_FINISHED:"onItemWasFinished",ON_NO_RESPONSE_ON_SUBMIT:"onNoResponseOnSubmit",ON_REQUEST_ITEM:"onRequestItem",ON_TEST_FINISHED:"onTestFinished",ON_ITEM_READY:"onItemReady"};var ei,ti;e.NavigationMode=void 0,(ei=e.NavigationMode||(e.NavigationMode={})).linear="linear",ei.nonlinear="nonlinear",e.SubmissionMode=void 0,(ti=e.SubmissionMode||(e.SubmissionMode={})).individual="individual",ti.simultaneous="simultaneous",e.QtiTest=class extends re{constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this._navigationMode=e.NavigationMode.nonlinear,this._submissionMode=e.SubmissionMode.simultaneous,this.items=[],this.itemIndex=0,this.provider=new Te(this,Ne,{log:e=>{console.log(`[my-app] ${e}`)},view:"candidate"})}handleNavigationModeChange(t,i){this.prevButton.style.visibility=i===e.NavigationMode.linear?"hidden":"visible"}handleItemIndexChange(e,t){this.emit(Zt.ON_REQUEST_ITEM,{detail:t})}set qtiContext(e){this.provider.value.view=e.view,this.provider.updateObservers()}set itemXML(e){this._itemRef&&this._itemRef.remove(),this.insertAdjacentHTML("afterbegin",e)}set manualOutcomeValue(e){this._itemRef.setOutcomeValue("SCORE",e)}set itemResponse(t){this._itemRef&&(this._itemRef.responses=t,this._navigationMode===e.NavigationMode.linear&&(this._itemRef.style.filter="blur(5px)",this._itemRef.setAttribute("disabled",""),this.dispatchEvent(new CustomEvent(Zt.ON_ITEM_WAS_FINISHED))))}_onCheckItem(){return!!this._itemRef.validateResponses()&&(this._itemRef.processResponse(),!0)}_onScoreItem(){this._onCheckItem()&&this._itemRef.processResponse()}_onPrevItem(){this.itemIndex>0&&this.emit(Zt.ON_REQUEST_ITEM,{detail:this.itemIndex-1})}_onNextItem(){this._navigationMode!==e.NavigationMode.linear||this._itemRef.validateResponses()?this.itemIndex<this.items.length-1?this.emit(Zt.ON_REQUEST_ITEM,{detail:this.itemIndex+1}):this.dispatchEvent(new CustomEvent(Zt.ON_TEST_FINISHED)):this.dispatchEvent(new CustomEvent(Zt.ON_NO_RESPONSE_ON_SUBMIT))}_onShowCorrect(){this._itemRef.showCorrectResponse()}_onRequestItem({detail:e}){this.emit(Zt.ON_REQUEST_ITEM,{detail:e})}_handleSlotchange(e){const t=this.querySelector("qti-assessment-item");t&&(this._itemRef=t,this.disabled&&this._itemRef.setAttribute("disabled",""),this.readonly&&this._itemRef.setAttribute("readonly",""),this.emit(Zt.ON_ITEM_READY,{detail:t}))}render(){return D`
|
|
445
445
|
<slot
|
|
446
446
|
@slotchange=${this._handleSlotchange}
|
|
447
447
|
@on-prev-item=${this._onPrevItem}
|
|
@@ -486,4 +486,4 @@ const Ue=2;
|
|
|
486
486
|
:host {
|
|
487
487
|
display: none;
|
|
488
488
|
}
|
|
489
|
-
`,de([me({type:Boolean}),he("design:type",Object)],e.QtiManualScoring.prototype,"disabled",void 0),de([me({type:Boolean}),he("design:type",Object)],e.QtiManualScoring.prototype,"readonly",void 0),de([me({type:Number}),he("design:type",String)],e.QtiManualScoring.prototype,"value",void 0),de([me({type:Number}),he("design:type",Number)],e.QtiManualScoring.prototype,"min",void 0),de([me({type:Number}),he("design:type",Number)],e.QtiManualScoring.prototype,"max",void 0),e.QtiManualScoring=de([pe("qti-manual-scoring")],e.QtiManualScoring),e.Choices=et,e.Events=s,e.OutcomeVariable=r,e.QtiAnd=Ct,e.QtiAssessmentItem=le,e.QtiAssociateInteraction=kt,e.QtiBaseValue=
|
|
489
|
+
`,de([me({type:Boolean}),he("design:type",Object)],e.QtiManualScoring.prototype,"disabled",void 0),de([me({type:Boolean}),he("design:type",Object)],e.QtiManualScoring.prototype,"readonly",void 0),de([me({type:Number}),he("design:type",String)],e.QtiManualScoring.prototype,"value",void 0),de([me({type:Number}),he("design:type",Number)],e.QtiManualScoring.prototype,"min",void 0),de([me({type:Number}),he("design:type",Number)],e.QtiManualScoring.prototype,"max",void 0),e.QtiManualScoring=de([pe("qti-manual-scoring")],e.QtiManualScoring),e.Choices=et,e.Events=s,e.OutcomeVariable=r,e.QtiAnd=Ct,e.QtiAssessmentItem=le,e.QtiAssociateInteraction=kt,e.QtiBaseValue=yt,e.QtiChoiceInteraction=st,e.QtiContains=ft,e.QtiCorrect=gt,e.QtiCustomOperatorLevenshtein=zt,e.QtiCustomOperatorNumericOnly=Yt,e.QtiCustomOperatorParseNumberLocalNl=Wt,e.QtiCustomOperatorRemoveAllSpaces=Kt,e.QtiCustomOperatorTrim=Xt,e.QtiExpression=dt,e.QtiExtendedTextInteraction=Ze,e.QtiFeedbackInline=Me,e.QtiGap=It,e.QtiGapMatchInteraction=Tt,e.QtiGapText=Nt,e.QtiGraphicAssociateInteraction=Lt,e.QtiGraphicGapMatchInteraction=Ht,e.QtiGraphicOrderInteraction=Pt,e.QtiGte=_t,e.QtiHotspotChoice=Dt,e.QtiHotspotInteraction=Qt,e.QtiHottextInteraction=tt,e.QtiInlineChoiceInteraction=it,e.QtiIsNull=xt,e.QtiItem=si,e.QtiMapResponse=ht,e.QtiMatch=vt,e.QtiMatchInteraction=jt,e.QtiMediaInteraction=Bt,e.QtiModalFeedback=Le,e.QtiMultiple=Et,e.QtiOr=At,e.QtiOrderInteraction=Ft,e.QtiOutcomeDeclaration=Oe,e.QtiPortableCustomInteraction=St,e.QtiPrompt=ye,e.QtiResponseCondition=ot,e.QtiResponseDeclaration=qe,e.QtiResponseElse=at,e.QtiResponseElseIf=ct,e.QtiResponseIf=lt,e.QtiResponseProcessing=nt,e.QtiSelectPointInteraction=Gt,e.QtiSetOutcomeValue=mt,e.QtiSliderInteraction=Vt,e.QtiStylesheet=ce,e.QtiTextEntryInteraction=De,e.QtiVariable=bt,e.ResponseVariable=n,e.Status={EMPTY:"empty",USER:"user",FEEDBACK:"feedback",EXPECTED:"expected"},e.TestEvents=Zt,e.qtiSimpleAssociableChoice=wt,Object.defineProperty(e,"__esModule",{value:!0})}));
|