@citolab/qti-components 6.0.34 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{chunk-GGEPFBR7.cjs → chunk-6YQCE7H6.cjs} +1 -1
  2. package/dist/chunk-AWSFYZS5.js +17 -0
  3. package/dist/chunk-CCQXZDO6.cjs +17 -0
  4. package/dist/chunk-DKGW23YB.js +1 -0
  5. package/dist/chunk-MTPOYN4D.js +0 -0
  6. package/dist/{chunk-UGSY24LD.cjs → chunk-OI3PY5MR.cjs} +2 -6
  7. package/dist/chunk-TEMU6PXC.cjs +1 -0
  8. package/dist/{chunk-X6JTBTZK.js → chunk-TSUFNGZN.js} +2 -6
  9. package/dist/context/index.cjs +1 -1
  10. package/dist/context/index.d.cts +3 -3
  11. package/dist/context/index.d.ts +3 -3
  12. package/dist/context/index.js +1 -1
  13. package/dist/custom-elements.json +2238 -1210
  14. package/dist/index.cjs +189 -108
  15. package/dist/index.d.cts +194 -63
  16. package/dist/index.d.ts +194 -63
  17. package/dist/index.js +189 -108
  18. package/dist/qti-components/index.cjs +51 -51
  19. package/dist/qti-components/index.d.cts +32 -11
  20. package/dist/qti-components/index.d.ts +32 -11
  21. package/dist/qti-components/index.js +77 -77
  22. package/dist/qti-item/index.cjs +1 -1
  23. package/dist/qti-item/index.d.cts +10 -8
  24. package/dist/qti-item/index.d.ts +10 -8
  25. package/dist/qti-item/index.js +1 -1
  26. package/dist/qti-item-react/index.cjs +1 -1
  27. package/dist/qti-item-react/index.d.cts +2 -1
  28. package/dist/qti-item-react/index.d.ts +2 -1
  29. package/dist/qti-item-react/index.js +1 -1
  30. package/dist/{qti-simple-choice-e2bc67b1.d.ts → qti-simple-choice-5902cb37.d.ts} +45 -48
  31. package/dist/qti-test/index.cjs +79 -0
  32. package/dist/qti-test/index.d.cts +120 -0
  33. package/dist/qti-test/index.d.ts +120 -0
  34. package/dist/qti-test/index.js +79 -0
  35. package/dist/qti-transform/index.cjs +1 -1
  36. package/dist/qti-transform/index.d.cts +1 -0
  37. package/dist/qti-transform/index.d.ts +1 -0
  38. package/dist/qti-transform/index.js +1 -1
  39. package/package.json +36 -30
  40. package/dist/chunk-5GG2XAUT.js +0 -1
  41. package/dist/chunk-G7BJTOY4.cjs +0 -17
  42. package/dist/chunk-UE4QJK43.js +0 -17
@@ -1,26 +1,26 @@
1
- import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5GG2XAUT.js";import{a as A,b as W,c as s}from"../chunk-343LZK3D.js";var xt={};var Et={};var qt={};var Ct={};var _t={};var kt={};var At={};var Tt={};var wt={};var Rt={ON_OUTCOME_CHANGED:"qti-outcome-changed",ON_INTERACTION_CHANGED:"on-interaction-changed",ON_REGISTER_VARIABLE:"on-register-variable",ON_REGISTER_FEEDBACK:"on-register-feedback",ON_REGISTER_INTERACTION:"on-register-interaction",ON_REGISTER_CHOICE:"on-register-choice",ON_REGISTER_HOTSPOT:"on-register-hotspot",ON_LOOSE_CHOICE:"on-loose-choice",ON_INTERACTION_RESPONSE:"on-interaction-response",ON_DROPDOWN_SELECTED:"on-dropdown-selected",ON_CHOICE_ELEMENT_SELECTED:"choice-element-selected"};var H=class{constructor(){this.value=null}},D=class{constructor(){this.value=null;this.candidateResponse=null;this.correctResponse=null}};import{customElement as er,property as oe}from"lit/decorators.js";import{html as tr,LitElement as rr}from"lit";var T=class extends rr{constructor(){super();this.variables=[];this.feedbackElements=[];this.interactionElements=[];this._numAttempts=0;this._handleDisabledChange=(e,t)=>{this.interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this.interactionElements.forEach(r=>r.readonly=t);this.addEventListener("qti-register-variable",this._registerVariable),this.addEventListener("qti-register-feedback",this.registerFeedbackElement),this.addEventListener("qti-register-interaction",this.registerInteractionElement),this.addEventListener("qti-outcome-changed",this.outcomeChanged),this.addEventListener("qti-interaction-response",this.interactionResponse)}render(){return tr`<slot></slot>`}firstUpdated(e){super.firstUpdated(e),this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0,detail:this}))}disconnectedCallback(){this.removeEventListener("qti-register-variable",this._registerVariable),this.removeEventListener("qti-register-feedback",this.registerFeedbackElement),this.removeEventListener("qti-register-interaction",this.registerInteractionElement),this.removeEventListener("qti-outcome-changed",this.outcomeChanged),this.removeEventListener("qti-interaction-response",this.interactionResponse)}_registerVariable(e){this.variables.push(e.detail.variable)}showCorrectResponse(){let e=this.variables.filter(t=>"correctResponse"in t&&t.correctResponse);this.responses=e.map(t=>({responseIdentifier:t.identifier,response:t.correctResponse}))}processResponse(){let e=this.querySelector("qti-response-processing");return e?e.process?(e.process(),this._numAttempts++,this.dispatchEvent(new CustomEvent("qti-response-processing")),!0):(console.info("Client side response webcomponents not available"),!1):(console.info("Client side response processing template not available"),!1)}set responses(e){if(e)for(let t of e){let r=this.interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier),o=this.getResponse(t.responseIdentifier);o&&(o.value=t.response),r&&(r.response=t.response)}}resetInteractions(){this.interactionElements.forEach(e=>e.reset())}validateResponses(){let e=!0;return this.interactionElements.forEach(t=>{t.validate()||(e=!1)}),e}getVariable(e){switch(e){case"numAttempts":return{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:this._numAttempts.toString()};default:{let t=this.variables.find(r=>r.identifier===e);return t||(console.warn(`Variable with identifier ${e} was not found`),null)}break}}getResponse(e){let t=this.variables.find(o=>o.identifier===e);return t instanceof D?t:null}getOutcome(e){let t=this.variables.find(r=>r.identifier===e);return t instanceof H?t:null}registerFeedbackElement(e){e.stopPropagation(),this.feedbackElements.push(e.detail)}registerInteractionElement(e){e.stopPropagation(),this.interactionElements.push(e.target)}interactionResponse(e){let t=e.detail,r=this.getResponse(t.responseIdentifier);r&&(r.value=t.response),e.stopImmediatePropagation();let o=this.getAttribute("identifier");o||console.warn("qti-assessment-item has no identifier specified"),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:o,responseIdentifier:t.responseIdentifier,response:t.response}}))}outcomeChanged(e){this.showFeedback(e)}showFeedback(e){this.feedbackElements.forEach(t=>{t.checkShowFeedback(e.detail.outcomeIdentifier)})}setOutcomeValue(e,t){let r;switch(e){case"completionStatus":r={identifier:"completionStatus",cardinality:"single",baseType:"string",value:t};break;default:{if(r=this.getOutcome(e),!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}r.cardinality==="single"?r.value=t:r.value.push(t)}break}this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:r.value}}))}};s([oe({type:Boolean})],T.prototype,"disabled",2),s([oe({type:Boolean})],T.prototype,"readonly",2),s([oe({type:String})],T.prototype,"title",2),s([oe({type:String})],T.prototype,"identifier",2),s([h("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"_handleDisabledChange",2),s([h("readonly",{waitUntilFirstUpdate:!0})],T.prototype,"_handleReadonlyChange",2),T=s([er("qti-assessment-item")],T);import{LitElement as ir}from"lit";var $e=class extends ir{constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.closest("qti-assessment-item"),t=this.getAttribute("href");if(t!==null){let r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.media="screen",r.href=t,e.appendChild(r),this.styleLink=r}if(this.textContent!==null){let r=document.createElement("style");r.media="screen",r.textContent=this.textContent,e.appendChild(r),this.styleLink=r}}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(t){console.log("could not remove stylesheet")}}};customElements.define("qti-stylesheet",$e);import{customElement as or}from"lit/decorators.js";import{html as nr,LitElement as ar}from"lit";import{css as sr}from"lit";var Lt=sr`
1
+ import{a as Et,b as f}from"../chunk-QROD4MVT.js";import{a as xt}from"../chunk-DKGW23YB.js";import{a as g,b as C,c as s}from"../chunk-343LZK3D.js";var Ct={};var qt={};var _t={};var kt={};var Rt={};var At={};var wt={};var St={};var Tt={};var Lt={ON_OUTCOME_CHANGED:"qti-outcome-changed",ON_INTERACTION_CHANGED:"on-interaction-changed",ON_REGISTER_VARIABLE:"on-register-variable",ON_REGISTER_FEEDBACK:"on-register-feedback",ON_REGISTER_INTERACTION:"on-register-interaction",ON_REGISTER_CHOICE:"on-register-choice",ON_REGISTER_HOTSPOT:"on-register-hotspot",ON_LOOSE_CHOICE:"on-loose-choice",ON_INTERACTION_RESPONSE:"on-interaction-response",ON_DROPDOWN_SELECTED:"on-dropdown-selected",ON_CHOICE_ELEMENT_SELECTED:"choice-element-selected"};import{customElement as sr,property as N}from"lit/decorators.js";import{html as or,LitElement as nr}from"lit";import{createContext as ir}from"@lit-labs/context";var ae=ir("item");import{provide as ar}from"@lit-labs/context";var q=class extends nr{constructor(){super();this.identifier=void 0;this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(r=>r.readonly=t);this._context={identifier:this.getAttribute("identifier"),variables:[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}]};this._initialContext=C(g({},this.context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",({detail:e})=>{this._context=C(g({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let t=e.detail;this._feedbackElements.push(t),t.checkShowFeedback(t.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:t,countAttempt:r}=e.detail;this.updateResponseVariable(t,"true"),this.processResponse(r)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:t,value:r}=e.detail;this.updateOutcomeVariable(t,r)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get context(){return g({},this._context)}set variables(e){this._context=C(g({},this.context),{variables:e}),this.context.variables.forEach(t=>{if(t.type==="response"){let r=this._interactionElements.find(o=>o.responseIdentifier===t.identifier);r&&(r.response=t.value)}t.type==="outcome"&&this._feedbackElements.forEach(r=>r.checkShowFeedback(t.identifier))})}firstUpdated(e){super.firstUpdated(e),this._emit("qti-item-connected",this)}disconnectedCallback(){super.disconnectedCallback(),this._emit("qti-item-disconnected")}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);o&&(o.response=t.response)}}render(){return or`<slot></slot>`}showCorrectResponse(){let e=this.context.variables.filter(t=>"correctResponse"in t&&t.correctResponse);this.responses=e.map(t=>({responseIdentifier:t.identifier,response:t.correctResponse}))}processResponse(e=!0){var r;let t=this.querySelector("qti-response-processing");return t?t.process?(t.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((r=this._context.variables.find(o=>o.identifier==="numAttempts"))==null?void 0:r.value)+1).toString()),this._emit("qti-response-processing"),!0):(console.info("Client side response webcomponents not available"),!1):(console.info("Client side response processing template not available"),!1)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:t,response:r}=e.detail;this.updateResponseVariable(t,r)}updateResponseVariable(e,t){this._context=C(g({},this._context),{variables:this._context.variables.map(r=>r.identifier!==e?r:C(g({},r),{value:t}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:t})}updateOutcomeVariable(e,t){var o;let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=C(g({},this._context),{variables:this._context.variables.map(n=>n.identifier!==e?n:C(g({},n),{value:r.cardinality==="single"?t:[...n.value,t]}))}),this._feedbackElements.forEach(n=>n.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,identifier:e,value:(o=this._context.variables.find(n=>n.identifier===e))==null?void 0:o.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,t=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}};s([N({type:String})],q.prototype,"title",2),s([N({type:String})],q.prototype,"identifier",2),s([N({type:String})],q.prototype,"adaptive",2),s([N({type:String})],q.prototype,"timeDependent",2),s([N({type:Boolean})],q.prototype,"disabled",2),s([f("disabled",{waitUntilFirstUpdate:!0})],q.prototype,"_handleDisabledChange",2),s([N({type:Boolean})],q.prototype,"readonly",2),s([f("readonly",{waitUntilFirstUpdate:!0})],q.prototype,"_handleReadonlyChange",2),s([ar({context:ae}),N({attribute:!1})],q.prototype,"_context",2),q=s([sr("qti-assessment-item")],q);import{LitElement as lr}from"lit";var Oe=class extends lr{constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.closest("qti-assessment-item"),t=this.getAttribute("href");if(t!==null){let r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.media="screen",r.href=t,e.appendChild(r),this.styleLink=r}if(this.textContent!==null){let r=document.createElement("style");r.media="screen",r.textContent=this.textContent,e.appendChild(r),this.styleLink=r}}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(t){console.log("could not remove stylesheet")}}};customElements.define("qti-stylesheet",Oe);import{customElement as pr}from"lit/decorators.js";import{html as dr,LitElement as ur}from"lit";import{css as cr}from"lit";var Vt=cr`
2
2
  :host {
3
3
  display: block;
4
4
  }
5
- `;var $=class extends ar{render(){return nr`<slot name="qti-rubric-block"></slot><slot></slot>`}};$.styles=Lt,$=s([or("qti-item-body")],$);import{html as lr,LitElement as cr}from"lit";var Oe=class extends cr{render(){return lr`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",Oe);import{html as pr}from"lit/static-html.js";import{property as G}from"lit/decorators.js";import{LitElement as dr}from"lit";var ur={SPACE:32},y=class extends dr{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.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case ur.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),pr` <slot></slot> `}};s([G({type:String})],y.prototype,"identifier",2),s([G({type:Number,reflect:!0})],y.prototype,"tabindex",2),s([G({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:a=>a}})],y.prototype,"disabled",2),s([G({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:a=>a}})],y.prototype,"readonly",2),s([G({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:a=>a}})],y.prototype,"checked",2),s([h("disabled",{waitUntilFirstUpdate:!0})],y.prototype,"handleDisabledChange",1);import{html as mr,LitElement as hr}from"lit";var V=class extends hr{render(){return mr``}defaultValues(i){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(r=>r.innerHTML);return t.length>1||i.cardinality==="multiple"||i.cardinality==="ordered"?t:t[0]}};customElements.define("qti-variabledeclaration",V);import{property as Pe}from"lit/decorators.js";var O=class extends V{connectedCallback(){super.connectedCallback();let e=new D;e.baseType=this.baseType,e.identifier=this.identifier,e.correctResponse=this.correctResponse,e.cardinality=this.cardinality||"single",e.mapping=this.mapping,e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){e=[];for(let o=0;o<r.length;o++)e.push(r[o].textContent),r[o].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};s([Pe({type:String,attribute:"base-type"})],O.prototype,"baseType",2),s([Pe({type:String})],O.prototype,"identifier",2),s([Pe({type:String})],O.prototype,"cardinality",2);customElements.define("qti-response-declaration",O);import{property as Ie}from"lit/decorators.js";var P=class extends V{get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(r.getAttribute("source-value")),n=parseInt(r.getAttribute("target-value"));(isNaN(o)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(o,n)}}return null}connectedCallback(){super.connectedCallback();let e=new H;e.identifier=this.identifier,e.cardinality=this.cardinality,e.baseType=this.baseType,e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};s([Ie({type:String,attribute:"base-type"})],P.prototype,"baseType",2),s([Ie({type:String})],P.prototype,"identifier",2),s([Ie({type:String})],P.prototype,"cardinality",2);customElements.define("qti-outcome-declaration",P);import{LitElement as fr}from"lit";import{customElement as br}from"lit/decorators.js";var ne=class extends fr{};ne=s([br("qti-companion-materials-info")],ne);import{LitElement as gr,css as vr,html as yr}from"lit";import{customElement as xr,property as ae}from"lit/decorators.js";import{ContextConsumer as Er}from"@lit-labs/context";var w=class extends gr{constructor(){super(...arguments);this.logger=new Er(this,vt,e=>this.style.display=this.view===e.view?"block":"none",!0)}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{switch(o){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return yr`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};w.styles=vr`
5
+ `;var $=class extends ur{render(){return dr`<slot name="qti-rubric-block"></slot><slot></slot>`}};$.styles=Vt,$=s([pr("qti-item-body")],$);import{html as mr,LitElement as hr}from"lit";var Pe=class extends hr{render(){return mr`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",Pe);import{html as fr}from"lit/static-html.js";import{property as G}from"lit/decorators.js";import{LitElement as br}from"lit";var gr={SPACE:32},x=class extends br{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.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case gr.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),fr` <slot></slot> `}};s([G({type:String})],x.prototype,"identifier",2),s([G({type:Number,reflect:!0})],x.prototype,"tabindex",2),s([G({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:a=>a}})],x.prototype,"disabled",2),s([G({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:a=>a}})],x.prototype,"readonly",2),s([G({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:a=>a}})],x.prototype,"checked",2),s([f("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"handleDisabledChange",1);import{html as vr,LitElement as yr}from"lit";var H=class extends yr{render(){return vr``}defaultValues(i){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(r=>r.innerHTML);return t.length>1||i.cardinality==="multiple"||i.cardinality==="ordered"?t:t[0]}};customElements.define("qti-variabledeclaration",H);import{property as Ie}from"lit/decorators.js";var O=class extends H{connectedCallback(){super.connectedCallback();let e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){e=[];for(let o=0;o<r.length;o++)e.push(r[o].textContent),r[o].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};s([Ie({type:String,attribute:"base-type"})],O.prototype,"baseType",2),s([Ie({type:String})],O.prototype,"identifier",2),s([Ie({type:String})],O.prototype,"cardinality",2);customElements.define("qti-response-declaration",O);import{property as Ue}from"lit/decorators.js";var P=class extends H{get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(r.getAttribute("source-value")),n=parseInt(r.getAttribute("target-value"));(isNaN(o)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(o,n)}}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};s([Ue({type:String,attribute:"base-type"})],P.prototype,"baseType",2),s([Ue({type:String})],P.prototype,"identifier",2),s([Ue({type:String})],P.prototype,"cardinality",2);customElements.define("qti-outcome-declaration",P);import{LitElement as xr}from"lit";import{customElement as Er}from"lit/decorators.js";var le=class extends xr{};le=s([Er("qti-companion-materials-info")],le);import{LitElement as Cr,css as qr,html as _r}from"lit";import{customElement as kr,property as ce}from"lit/decorators.js";import{ContextConsumer as Rr}from"@lit-labs/context";var S=class extends Cr{constructor(){super(...arguments);this.logger=new Rr(this,xt,e=>this.style.display=this.view===e.view?"block":"none",!0)}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{switch(o){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return _r`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};S.styles=qr`
6
6
  :host {
7
7
  display: block;
8
8
  }
9
- `,s([ae({type:String})],w.prototype,"id",2),s([ae({type:String})],w.prototype,"use",2),s([ae({type:String})],w.prototype,"view",2),s([ae({type:String,attribute:"class"})],w.prototype,"classNames",2),s([h("classNames",{waitUntilFirstUpdate:!0})],w.prototype,"handleclassNamesChange",1),w=s([xr("qti-rubric-block")],w);import{LitElement as qr,html as Cr}from"lit";import{customElement as _r}from"lit/decorators.js";var le=class extends qr{render(){return Cr`<slot></slot>`}};le=s([_r("qti-content-body")],le);import{css as Ar,html as Tr}from"lit";import{LitElement as kr}from"lit";import{property as ce}from"lit/decorators.js";var E=class extends kr{constructor(){super();this.showHide="show",this.showFeedback(this.showHide==="hide")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this.closest("qti-assessment-item").getOutcome(e);if(this.outcomeIdentifier!==e||!t)return;let r=!1;Array.isArray(t.value)?r=t.baseType=="float"||t.baseType=="integer"?t.value.includes(this.identifier):t.value.includes(this.identifier):r=t.baseType=="float"||t.baseType=="integer"?this.identifier===t.value:this.identifier===t.value,this.showFeedback(r)}showFeedback(e){this.showStatus=e?"on":"off"}};s([ce({type:String,attribute:"show-hide"})],E.prototype,"showHide",2),s([ce({type:String,attribute:"outcome-identifier"})],E.prototype,"outcomeIdentifier",2),s([ce({type:String})],E.prototype,"identifier",2),s([ce({type:String,attribute:!1})],E.prototype,"showStatus",2);var pe=class extends E{constructor(){super(...arguments);this.render=()=>Tr` <slot part="feedback" class="${this.showStatus}"></slot> `}};pe.styles=Ar`
9
+ `,s([ce({type:String})],S.prototype,"id",2),s([ce({type:String})],S.prototype,"use",2),s([ce({type:String})],S.prototype,"view",2),s([ce({type:String,attribute:"class"})],S.prototype,"classNames",2),s([f("classNames",{waitUntilFirstUpdate:!0})],S.prototype,"handleclassNamesChange",1),S=s([kr("qti-rubric-block")],S);import{LitElement as Ar,html as wr}from"lit";import{customElement as Sr}from"lit/decorators.js";var pe=class extends Ar{render(){return wr`<slot></slot>`}};pe=s([Sr("qti-content-body")],pe);import{css as Vr,html as Mr}from"lit";import{LitElement as Lr}from"lit";import{property as de}from"lit/decorators.js";var Tr=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Fe=a=>{if(typeof a=="string")return a;let i=Tr();return i==="."?a.toLocaleString():a.toString().replace(".","").replace(i,".")};function Xe(a){return a==null}var _=class extends Lr{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this.closest("qti-assessment-item").getOutcome(e);if(this.outcomeIdentifier!==e||!t)return;let r=!1;Array.isArray(t.value)?r=t.value.includes(this.identifier):r=!Xe(this.identifier)&&!Xe(t==null?void 0:t.value)&&this.identifier===t.value||!1,this.showFeedback(r)}showFeedback(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};s([de({type:String,attribute:"show-hide"})],_.prototype,"showHide",2),s([de({type:String,attribute:"outcome-identifier"})],_.prototype,"outcomeIdentifier",2),s([de({type:String})],_.prototype,"identifier",2),s([de({type:String,attribute:!1})],_.prototype,"showStatus",2);var ue=class extends _{constructor(){super(...arguments);this.render=()=>Mr` <slot part="feedback" class="${this.showStatus}"></slot> `}};ue.styles=Vr`
10
10
  .on {
11
11
  display: inline-block;
12
12
  }
13
13
  .off {
14
14
  display: none;
15
15
  }
16
- `;customElements.define("qti-feedback-inline",pe);import{css as wr,html as Rr}from"lit";var de=class extends E{constructor(){super(...arguments);this.render=()=>Rr` <slot part="feedback" class="${this.showStatus}"></slot> `}};de.styles=wr`
16
+ `;customElements.define("qti-feedback-inline",ue);import{css as Nr,html as Hr}from"lit";var me=class extends _{constructor(){super(...arguments);this.render=()=>Hr` <slot part="feedback" class="${this.showStatus}"></slot> `}};me.styles=Nr`
17
17
  .on {
18
18
  display: inline-block;
19
19
  }
20
20
  .off {
21
21
  display: none;
22
22
  }
23
- `;customElements.define("qti-modal-feedback",de);import{css as Lr,html as Sr}from"lit";var ue=class extends E{render(){return Sr` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(i){this.checkShowFeedback(this.outcomeIdentifier)}};ue.styles=Lr`
23
+ `;customElements.define("qti-modal-feedback",me);import{css as Dr,html as $r}from"lit";var he=class extends _{render(){return $r` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(i){this.checkShowFeedback(this.outcomeIdentifier)}};he.styles=Dr`
24
24
  :host {
25
25
  display: block;
26
26
  }
@@ -30,11 +30,11 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
30
30
  .off {
31
31
  display: none;
32
32
  }
33
- `;customElements.define("qti-feedback-block",ue);import{css as Vr,html as Nr}from"lit";import{ifDefined as St}from"lit/directives/if-defined.js";import{property as Fe}from"lit/decorators.js";import{LitElement as Mr}from"lit";var f=class extends Mr{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:e}}))}};s([Fe({attribute:"response-identifier"})],f.prototype,"responseIdentifier",2),s([Fe({reflect:!0,type:Boolean})],f.prototype,"disabled",2),s([Fe({reflect:!0,type:Boolean})],f.prototype,"readonly",2);import{customElement as Hr,property as me,state as Mt}from"lit/decorators.js";import{createRef as Dr}from"lit/directives/ref.js";var k=class extends f{constructor(){super(...arguments);this._value="";this._size=5;this.inputRef=Dr()}handleclassNamesChange(e,t){t.split(" ").forEach(o=>{if(o.startsWith("qti-input-width")){let n=o.replace("qti-input-width-","");this._size=parseInt(n)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[Vr`
33
+ `;customElements.define("qti-feedback-block",he);import{css as Pr,html as Ir}from"lit";import{ifDefined as Mt}from"lit/directives/if-defined.js";import{property as Ye}from"lit/decorators.js";import{LitElement as Or}from"lit";var m=class extends Or{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:e}}))}};s([Ye({attribute:"response-identifier"})],m.prototype,"responseIdentifier",2),s([Ye({reflect:!0,type:Boolean})],m.prototype,"disabled",2),s([Ye({reflect:!0,type:Boolean})],m.prototype,"readonly",2);import{customElement as Ur,property as fe,state as Nt}from"lit/decorators.js";import{createRef as Fr}from"lit/directives/ref.js";var w=class extends m{constructor(){super(...arguments);this._value="";this._size=5;this.inputRef=Fr()}handleclassNamesChange(e,t){t.split(" ").forEach(o=>{if(o.startsWith("qti-input-width")){let n=o.replace("qti-input-width-","");this._size=parseInt(n)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[Pr`
34
34
  :host {
35
35
  display: inline-flex;
36
36
  }
37
- `]}render(){return Nr`
37
+ `]}render(){return Ir`
38
38
  <input
39
39
  part="input"
40
40
  spellcheck="false"
@@ -43,14 +43,14 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
43
43
  @keyup="${this.textChanged}"
44
44
  @change="${this.textChanged}"
45
45
  type="${this.patternMask=="[0-9]*"?"number":"text"}"
46
- placeholder="${St(this.placeholderText?this.placeholderText:void 0)}"
46
+ placeholder="${Mt(this.placeholderText?this.placeholderText:void 0)}"
47
47
  .value="${this._value}"
48
48
  size="${this._size}"
49
- pattern="${St(this.patternMask?this.patternMask:void 0)}"
49
+ pattern="${Mt(this.patternMask?this.patternMask:void 0)}"
50
50
  ?disabled="${this.disabled}"
51
51
  ?readonly="${this.readonly}"
52
52
  />
53
- `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this._value=t.value,this.saveResponse(t.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};s([me({type:Number,attribute:"expected-length"})],k.prototype,"expectedLength",2),s([me({type:String,attribute:"pattern-mask"})],k.prototype,"patternMask",2),s([me({type:String,attribute:"placeholder-text"})],k.prototype,"placeholderText",2),s([Mt()],k.prototype,"_value",2),s([Mt()],k.prototype,"_size",2),s([me({type:String,attribute:"class"})],k.prototype,"classNames",2),s([h("classNames")],k.prototype,"handleclassNamesChange",1),k=s([Hr("qti-text-entry-interaction")],k);import{css as $r,html as Or}from"lit";import{ifDefined as Ue}from"lit/directives/if-defined.js";import{ref as Pr,createRef as Ir}from"lit/directives/ref.js";import{customElement as Fr,property as he,state as Ur}from"lit/decorators.js";var R=class extends f{constructor(){super(...arguments);this.textareaRef=Ir();this._value=""}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{if(o.startsWith("qti-height-lines")){let n=o.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(n))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[$r`
53
+ `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this._value=t.value,this.saveResponse(t.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};s([fe({type:Number,attribute:"expected-length"})],w.prototype,"expectedLength",2),s([fe({type:String,attribute:"pattern-mask"})],w.prototype,"patternMask",2),s([fe({type:String,attribute:"placeholder-text"})],w.prototype,"placeholderText",2),s([Nt()],w.prototype,"_value",2),s([Nt()],w.prototype,"_size",2),s([fe({type:String,attribute:"class"})],w.prototype,"classNames",2),s([f("classNames")],w.prototype,"handleclassNamesChange",1),w=s([Ur("qti-text-entry-interaction")],w);import{css as Xr,html as Yr}from"lit";import{ifDefined as Be}from"lit/directives/if-defined.js";import{ref as Br,createRef as jr}from"lit/directives/ref.js";import{customElement as zr,property as be,state as Kr}from"lit/decorators.js";var T=class extends m{constructor(){super(...arguments);this.textareaRef=jr();this._value=""}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{if(o.startsWith("qti-height-lines")){let n=o.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(n))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[Xr`
54
54
  /* PK: display host as block, else design will be collapsed */
55
55
  :host {
56
56
  display: block;
@@ -61,38 +61,38 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
61
61
  height: 100%;
62
62
  border: 0;
63
63
  }
64
- `]}render(){return Or`<textarea
64
+ `]}render(){return Yr`<textarea
65
65
  part="textarea"
66
- ${Pr(this.textareaRef)}
66
+ ${Br(this.textareaRef)}
67
67
  spellcheck="false"
68
68
  autocomplete="off"
69
69
  @keydown="${e=>e.stopImmediatePropagation()}"
70
70
  @keyup="${this.textChanged}"
71
71
  @change="${this.textChanged}"
72
- placeholder="${Ue(this.placeholderText?this.placeholderText:void 0)}"
73
- maxlength="${Ue(this.expectedLength?this.expectedLength:void 0)}"
74
- pattern="${Ue(this.patternMask?this.patternMask:void 0)}"
72
+ placeholder="${Be(this.placeholderText?this.placeholderText:void 0)}"
73
+ maxlength="${Be(this.expectedLength?this.expectedLength:void 0)}"
74
+ pattern="${Be(this.patternMask?this.patternMask:void 0)}"
75
75
  ?disabled="${this.disabled}"
76
76
  ?readonly="${this.readonly}"
77
77
  .value=${this._value}
78
- ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this._value=t.value,this.saveResponse(t.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};s([he({type:Number,attribute:"expected-length"})],R.prototype,"expectedLength",2),s([he({type:String,attribute:"pattern-mask"})],R.prototype,"patternMask",2),s([he({type:String,attribute:"placeholder-text"})],R.prototype,"placeholderText",2),s([Ur()],R.prototype,"_value",2),s([he({type:String,attribute:"class"})],R.prototype,"classNames",2),s([h("classNames",{waitUntilFirstUpdate:!0})],R.prototype,"handleclassNamesChange",1),R=s([Fr("qti-extended-text-interaction")],R);import{html as Xr}from"lit";import{property as Vt}from"lit/decorators.js";var v=class extends f{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,t)=>this._choiceElements.forEach(r=>r.disabled=t);this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach(r=>r.readonly=t);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}reset(){this._choiceElements.forEach(e=>{e.reset()})}validate(){return this._choiceElements.reduce((t,r)=>t+(r.checked?1:0),0)>=this.minChoices}set response(e){this._choiceElements.forEach(r=>{r.checked=!1}),(Array.isArray(e)?e:[e]).forEach(r=>{let o=this.querySelector(`[identifier='${r}']`);o&&(o.checked=!0)})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._setInputType(t)}_looseChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._choiceElements=this._choiceElements.filter(r=>r!==t)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(t=>t.identifier!==e.detail.identifier).forEach(t=>{t.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(r=>r.checked).map(r=>r.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(r=>r.disabled=!r.checked):this._choiceElements.forEach(r=>r.disabled=!1));let t;this.maxChoices===1?t=e.length>0?e[0]:void 0:t=e,this.saveResponse(t)}};s([Vt({type:Number,attribute:"min-choices"})],v.prototype,"minChoices",2),s([Vt({type:Number,attribute:"max-choices"})],v.prototype,"maxChoices",2),s([h("disabled",{waitUntilFirstUpdate:!0})],v.prototype,"_handleDisabledChange",2),s([h("readonly",{waitUntilFirstUpdate:!0})],v.prototype,"_handleReadonlyChange",2),s([h("maxChoices",{waitUntilFirstUpdate:!0})],v.prototype,"_handleMaxChoicesChange",2);var Xe=class extends v{constructor(){super(...arguments);this.render=()=>Xr`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};customElements.define("qti-hottext-interaction",Xe);import{css as Yr,html as Nt}from"lit";import{property as Br,state as zr}from"lit/decorators.js";var I=class extends f{constructor(){super(...arguments);this.options=[];this.dataPrompt="select"}static get styles(){return[Yr`
78
+ ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this._value=t.value,this.saveResponse(t.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};s([be({type:Number,attribute:"expected-length"})],T.prototype,"expectedLength",2),s([be({type:String,attribute:"pattern-mask"})],T.prototype,"patternMask",2),s([be({type:String,attribute:"placeholder-text"})],T.prototype,"placeholderText",2),s([Kr()],T.prototype,"_value",2),s([be({type:String,attribute:"class"})],T.prototype,"classNames",2),s([f("classNames",{waitUntilFirstUpdate:!0})],T.prototype,"handleclassNamesChange",1),T=s([zr("qti-extended-text-interaction")],T);import{html as Wr}from"lit";import{property as Ht}from"lit/decorators.js";var y=class extends m{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,t)=>this._choiceElements.forEach(r=>r.disabled=t);this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach(r=>r.readonly=t);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}validate(){return this._choiceElements.reduce((t,r)=>t+(r.checked?1:0),0)>=this.minChoices}set response(e){let t=Array.isArray(e)?e:[e];this._choiceElements.forEach(r=>{r.checked=!!t.find(o=>o===r.identifier)})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._setInputType(t)}_looseChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._choiceElements=this._choiceElements.filter(r=>r!==t)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(t=>t.identifier!==e.detail.identifier).forEach(t=>{t.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(r=>r.checked).map(r=>r.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(r=>r.disabled=!r.checked):this._choiceElements.forEach(r=>r.disabled=!1));let t;this.maxChoices===1?t=e.length>0?e[0]:void 0:t=e,this.saveResponse(t)}};s([Ht({type:Number,attribute:"min-choices"})],y.prototype,"minChoices",2),s([Ht({type:Number,attribute:"max-choices"})],y.prototype,"maxChoices",2),s([f("disabled",{waitUntilFirstUpdate:!0})],y.prototype,"_handleDisabledChange",2),s([f("readonly",{waitUntilFirstUpdate:!0})],y.prototype,"_handleReadonlyChange",2),s([f("maxChoices",{waitUntilFirstUpdate:!0})],y.prototype,"_handleMaxChoicesChange",2);var je=class extends y{constructor(){super(...arguments);this.render=()=>Wr`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};customElements.define("qti-hottext-interaction",je);import{css as Gr,html as Dt}from"lit";import{property as Jr,state as Zr}from"lit/decorators.js";var I=class extends m{constructor(){super(...arguments);this.options=[];this.dataPrompt="select"}static get styles(){return[Gr`
79
79
  :host {
80
80
  display: inline-block;
81
81
  }
82
- `]}render(){return Nt` <select
82
+ `]}render(){return Dt` <select
83
83
  part="select"
84
84
  @change="${this.choiceSelected}"
85
85
  ?disabled="${this.disabled}"
86
86
  ?readonly="${this.readonly}"
87
87
  >
88
- ${this.options.map(e=>Nt` <option value="${e.value}" ?selected="${e.selected}">${e.textContent}</option> `)}
89
- </select>`}firstUpdated(e){super.firstUpdated(e),this.addEventListener(Rt.ON_DROPDOWN_SELECTED,this.choiceSelected);let t=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...t.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>W(A({},e),{selected:t===0}))}set response(e){this.options=this.options.map(t=>(e===t.value&&(t.selected=!0),t))}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>W(A({},r),{selected:r.value===t})),this.saveResponse(t)}};I.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"],s([zr()],I.prototype,"options",2),s([Br({attribute:"data-prompt",type:String})],I.prototype,"dataPrompt",2);customElements.define("qti-inline-choice-interaction",I);import{customElement as Kr,property as Wr}from"lit/decorators.js";import{html as Gr}from"lit";import{css as jr}from"lit";var Ht=jr`
88
+ ${this.options.map(e=>Dt` <option value="${e.value}" ?selected="${e.selected}">${e.textContent}</option> `)}
89
+ </select>`}firstUpdated(e){super.firstUpdated(e),this.addEventListener(Lt.ON_DROPDOWN_SELECTED,this.choiceSelected);let t=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...t.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>C(g({},e),{selected:t===0}))}set response(e){this.options=this.options.map(t=>(e===t.value&&(t.selected=!0),t))}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>C(g({},r),{selected:r.value===t})),this.saveResponse(t)}};I.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"],s([Zr()],I.prototype,"options",2),s([Jr({attribute:"data-prompt",type:String})],I.prototype,"dataPrompt",2);customElements.define("qti-inline-choice-interaction",I);import{customElement as ei,property as ti}from"lit/decorators.js";import{html as ri}from"lit";import{css as Qr}from"lit";var $t=Qr`
90
90
  :host {
91
91
  display: flex;
92
92
  flex-direction: column;
93
93
  // align-items: flex-start;
94
94
  }
95
- `;var F=class extends v{render(){return Gr` <slot name="prompt"></slot><slot part="slot"></slot>`}};F.styles=Ht,s([Wr({type:String})],F.prototype,"orientation",2),F=s([Kr("qti-choice-interaction")],F);import{customElement as Jr}from"lit/decorators.js";import{html as Zr,LitElement as Qr}from"lit";var Dt=`<qti-response-processing>
95
+ `;var U=class extends y{render(){return ri` <slot name="prompt"></slot><slot part="slot"></slot>`}};U.styles=$t,s([ti({type:String})],U.prototype,"orientation",2),U=s([ei("qti-choice-interaction")],U);import{customElement as ii}from"lit/decorators.js";import{html as si,LitElement as oi}from"lit";var Ot=`<qti-response-processing>
96
96
  <qti-response-condition>
97
97
  <qti-response-if>
98
98
  <qti-match>
@@ -109,7 +109,7 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
109
109
  </qti-set-outcome-value>
110
110
  </qti-response-else>
111
111
  </qti-response-condition>
112
- </qti-response-processing>`,$t=`<qti-response-processing>
112
+ </qti-response-processing>`,Pt=`<qti-response-processing>
113
113
  <qti-response-condition>
114
114
  <qti-response-if>
115
115
  <qti-is-null>
@@ -125,7 +125,7 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
125
125
  </qti-set-outcome-value>
126
126
  </qti-response-else>
127
127
  </qti-response-condition>
128
- </qti-response-processing>`,Ot=`<qti-response-processing>
128
+ </qti-response-processing>`,It=`<qti-response-processing>
129
129
  <qti-response-condition>
130
130
  <qti-response-if>
131
131
  <qti-is-null>
@@ -141,8 +141,8 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
141
141
  </qti-set-outcome-value>
142
142
  </qti-response-else>
143
143
  </qti-response-condition>
144
- </qti-response-processing>`;var U=class extends Qr{render(){return Zr`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString($t));break}case"map_response_point":{this.appendChild(this.fragmentFromString(Ot));break}case"match_correct":this.appendChild(this.fragmentFromString(Dt));break}}let i=[...this.children];for(let e of i)e.process()}fragmentFromString(i){return document.createRange().createContextualFragment(i)}};U=s([Jr("qti-response-processing")],U);import{customElement as ei}from"lit/decorators.js";import{html as ti,LitElement as ri}from"lit";var S=class extends ri{render(){return ti`<slot></slot>`}process(){throw new Error("Not implemented")}};S=s([ei("qti-rule")],S);import{html as ii}from"lit";var Ye=class extends S{render(){return ii`<slot></slot>`}process(){let i=[...this.children];for(let e=0;e<i.length;e++){let t=i[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Ye);var Be=class extends S{process(){let i=this.getAttribute("identifier"),e=this.firstElementChild,t=e?e.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}this.closest("qti-assessment-item").setOutcomeValue(i,t)}};customElements.define("qti-set-outcome-value",Be);import{html as ni}from"lit";import{html as si,LitElement as oi}from"lit";var J=class extends oi{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return si` <slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let i=this.getSubRules();for(let e=0;e<i.length;e++)i[e].process()}};customElements.define("qti-response-else",J);var Z=class extends J{render(){return ni`${super.render()}`}calculate(){return this.firstElementChild.calculate()}getSubRules(){let i=[];for(let e=1;e<this.children.length;e++)i.push(this.children[e]);return i}};customElements.define("qti-response-if",Z);import{html as ai}from"lit";var ze=class extends Z{render(){return ai`${super.render()}`}};customElements.define("qti-response-else-if",ze);import{LitElement as li,css as ci,html as Q,nothing as je}from"lit";import{state as Pt}from"lit/decorators.js";var u=class extends li{constructor(){super(...arguments);this._error=[];this._debug=!1;this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(t)}case"qti-multiple":{let r=e.calculate();return r.length>0?{baseType:r[0].baseType,value:r.map(o=>o.value),cardinality:"multiple"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.assessmentItem.getResponse(t);return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.calculate().toString(),cardinality:"single"}}catch(t){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}set error(e){let t=this._error;this._error.push(e),this.requestUpdate("error",t)}render(){return Q`${this._debug?Q`${this._error.map(e=>Q`<div role="alert">${e}</div>`)}`:je}
145
- ${this._debug?Q`${JSON.stringify(this._result)}`:je} ${this._debug?Q`<slot></slot>`:je}`}calculate(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};u.styles=ci`
144
+ </qti-response-processing>`;var F=class extends oi{render(){return si`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString(Pt));break}case"map_response_point":{this.appendChild(this.fragmentFromString(It));break}case"match_correct":this.appendChild(this.fragmentFromString(Ot));break}}let i=[...this.children];for(let e of i)e.process()}fragmentFromString(i){return document.createRange().createContextualFragment(i)}};F=s([ii("qti-response-processing")],F);import{customElement as ni}from"lit/decorators.js";import{html as ai,LitElement as li}from"lit";var V=class extends li{render(){return ai`<slot></slot>`}process(){throw new Error("Not implemented")}};V=s([ni("qti-rule")],V);import{html as ci}from"lit";var ze=class extends V{render(){return ci`<slot></slot>`}process(){let i=[...this.children];for(let e=0;e<i.length;e++){let t=i[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",ze);var Ke=class extends V{process(){let i=this.getAttribute("identifier"),e=this.firstElementChild,t=e?e.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:Array.isArray(t)?t.map(r=>Fe(r)):Fe(t)}}))}};customElements.define("qti-set-outcome-value",Ke);import{html as ui}from"lit";import{html as pi,LitElement as di}from"lit";var J=class extends di{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return pi` <slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let i=this.getSubRules();for(let e=0;e<i.length;e++)i[e].process()}};customElements.define("qti-response-else",J);var Z=class extends J{render(){return ui`${super.render()}`}calculate(){return this.firstElementChild.calculate()}getSubRules(){let i=[];for(let e=1;e<this.children.length;e++)i.push(this.children[e]);return i}};customElements.define("qti-response-if",Z);import{html as mi}from"lit";var We=class extends Z{render(){return mi`${super.render()}`}};customElements.define("qti-response-else-if",We);import{LitElement as hi,css as fi,html as Q,nothing as Ge}from"lit";import{state as Ut}from"lit/decorators.js";var u=class extends hi{constructor(){super(...arguments);this._error=[];this._debug=!1;this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(t)}case"qti-multiple":{let r=e.calculate();return r.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(o=>o.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.assessmentItem.getResponse(t);return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.calculate().toString(),cardinality:"single"}}catch(t){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}set error(e){let t=this._error;this._error.push(e),this.requestUpdate("error",t)}render(){return Q`${this._debug?Q`${this._error.map(e=>Q`<div role="alert">${e}</div>`)}`:Ge}
145
+ ${this._debug?Q`${JSON.stringify(this._result)}`:Ge} ${this._debug?Q`<slot></slot>`:Ge}`}calculate(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};u.styles=fi`
146
146
  :host {
147
147
  display: inline;
148
148
  }
@@ -155,15 +155,15 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
155
155
  border-radius: 5px;
156
156
  margin-bottom: 3px;
157
157
  }
158
- `,s([Pt()],u.prototype,"_result",2),s([Pt()],u.prototype,"error",1);var q=class extends u{calculate(){throw new Error("Not implemented")}};var Ke=class extends q{calculate(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();if(typeof r=="string")if(r==="true")r=!0;else if(r==="false")r=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return r}).every(e=>typeof e=="boolean"&&e)}};customElements.define("qti-and",Ke);import{property as pi}from"lit/decorators.js";var fe=class extends u{constructor(){super(...arguments);this.baseType="string"}calculate(){return this.textContent}};s([pi({type:String,attribute:"base-type"})],fe.prototype,"baseType",2);customElements.define("qti-base-value",fe);var We=class extends q{calculate(){let i=this.getVariables();if(this.children.length===2){let e=i[0],t=i[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let r=e.value,o=t.value;return r.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let r=e.value;return t.value.includes(r)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",We);var Ge=class extends u{get interpretation(){return this.getAttribute("interpretation")||""}calculate(){let i=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(i);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Ge);import{property as di}from"lit/decorators.js";var C=class{static compareSingleValues(i,e,t){switch(t){case"identifier":case"string":return i===e;case"integer":{let r=parseInt(i,10),o=parseInt(e,10);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`Cannot convert ${i} and/or ${e} to int.`);break}case"float":{let r=parseFloat(i),o=parseFloat(e);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`couldn't convert ${i} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=i.split(" ").sort(),o=e.split(" ").sort();if(r.length===2&&o.length===2)return t==="pair"&&(r.sort(),o.sort()),r.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${i} 2: ${e}`);break}}return!1}};var be=class extends u{constructor(){super(...arguments);this.toleranceMode="exact"}calculate(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):C.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};s([di({type:String})],be.prototype,"toleranceMode",2);customElements.define("qti-equal",be);import{property as ui}from"lit/decorators.js";var ge=class extends u{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}calculate(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(t.value),n=parseFloat(r.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};s([ui({type:String})],ge.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",ge);var Je=class extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Je);var Ze=class extends q{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Ze);var Qe=class extends u{calculate(){if(this.children.length===1){let i=this.getVariables();if(!i)return!0;let e=i[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",Qe);var et=class extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",et);var tt=class extends q{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",tt);import{property as rt}from"lit/decorators.js";import{LitElement as mi}from"lit";var X=class extends mi{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};s([rt({attribute:"default-value",type:Number})],X.prototype,"defaultValue",2),s([rt({attribute:"lower-bound",type:Number})],X.prototype,"lowerBound",2),s([rt({attribute:"upper-bound",type:Number})],X.prototype,"upperBound",2);customElements.define("qti-mapping",X);import{property as hi}from"lit/decorators.js";var ve=class extends u{calculate(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],o=0;for(let n of r){let l=t.mapEntries.find(c=>C.compareSingleValues(c.mapKey,n,e.baseType));l==null||l.mappedValue==null?o+=t.defaultValue:o+=l.mappedValue}return t.lowerBound!=null&&(o=Math.max(t.lowerBound,o)),t.upperBound!=null&&(o=Math.min(t.upperBound,o)),o}};s([hi({type:String})],ve.prototype,"identifier",2);customElements.define("qti-map-response",ve);var it=class a extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return this._result=a.match(e,t),this._result}return console.error("unexpected number of children in match"),null}static match(i,e){if(e.cardinality==="single")return Array.isArray(i.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):C.compareSingleValues(i.value.toString(),e.value.toString(),e.baseType);{if(!Array.isArray(i.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(i.value.length!==e.value.length)return!1;let t=0;for(let r of e.value){if(e.cardinality==="ordered"){let o=i[t];if(!C.compareSingleValues(r,o,e.baseType))return!1}else{let o=null;for(let n of i.value)if(C.compareSingleValues(r,n,e.baseType)){o=n;break}if(o!==null)i.value.splice(i.value.indexOf(o),1);else return!1}t++}return!0}}};customElements.define("qti-match",it);var st=class extends u{calculate(){let i=this.getVariables();this.children.length!==2&&(this.error="The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType!==t.baseType&&(this.error="Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||(this.error="and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&(this.error="The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&(this.error="It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let r=e.value;return t.value.includes(r)}};customElements.define("qti-member",st);var ot=class extends u{calculate(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return i}};customElements.define("qti-multiple",ot);import{html as fi}from"lit";var nt=class extends u{render(){return fi`${super.render()}`}calculate(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",nt);import{html as bi}from"lit";var at=class extends q{render(){return bi``}calculate(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();if(typeof r=="string")if(r==="true")r=!0;else if(r==="false")r=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",at);var lt=class extends u{calculate(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return i}};customElements.define("qti-ordered",lt);import{LitElement as gi,html as It}from"lit";import{property as vi,state as yi}from"lit/decorators.js";var ee=class extends gi{constructor(){super();this.value="";this.closest("qti-assessment-item").addEventListener("qti-response-processing",()=>{this.value=this.calculate()})}render(){return It`${Array.isArray(this.value)?this.value.map(e=>It`${e}`):this.value}`}calculate(){let e=this.closest("qti-assessment-item"),t=this.identifier;return e.getVariable(t).value}};s([vi({type:String})],ee.prototype,"identifier",2),s([yi()],ee.prototype,"value",2);customElements.define("qti-printed-variable",ee);var ct=class extends u{calculate(){return this.getVariables().reduce((t,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return t*parseInt(r.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return t},1)}};customElements.define("qti-product",ct);var pt=class extends u{calculate(){let i=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(i).value}};customElements.define("qti-variable",pt);import{property as xi}from"lit/decorators.js";var ye=class extends u{constructor(){super(...arguments);this.caseSensitive="true"}calculate(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return C.compareSingleValues(o,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};s([xi({type:String,attribute:"case-sensitive"})],ye.prototype,"caseSensitive",2);customElements.define("qti-string-match",ye);var dt=class extends u{calculate(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",dt);import{LitElement as Ei,html as Ft}from"lit";var ut=class extends Ei{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){let t=e.querySelectorAll("properties"),r={},o=l=>{let c={},p=l.getAttribute("key");if(p){let d=Array.from(l.children),m=d.map(g=>g.getAttribute("key"));m.length>0&&!m.find(g=>!Number.isInteger(+g))?c[p]=d.map(g=>n(g)):c[p]=l.textContent}return c},n=l=>{if(l){let c={};for(let p of l.children)c=A(A({},c),o(p));return c}};for(let l of t)return l.getAttribute("key")||(r=A(A({},r),n(l))),r;console.log("Can not find qti-custom-interaction config")}register(e){let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",r=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");r.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=t=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);t=="IMS"?e.getInstance(r,o,void 0):e.initialize(this.customInteractionTypeIdentifier,r.firstElementChild,o),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,r.appendChild(c)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}requirejs.config(e)(["require"],r=>{define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}})),r([this.module],()=>{},o=>{this._errorMessage=o})},r=>{this._errorMessage=r})}render(){return Ft`<slot></slot>${this._errorMessage&&Ft`<div style="color:red">
158
+ `,s([Ut()],u.prototype,"_result",2),s([Ut()],u.prototype,"error",1);var k=class extends u{calculate(){throw new Error("Not implemented")}};var Je=class extends k{calculate(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();if(typeof r=="string")if(r==="true")r=!0;else if(r==="false")r=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return r}).every(e=>typeof e=="boolean"&&e)}};customElements.define("qti-and",Je);import{property as bi}from"lit/decorators.js";var ge=class extends u{constructor(){super(...arguments);this.baseType="string"}calculate(){return this.textContent}};s([bi({type:String,attribute:"base-type"})],ge.prototype,"baseType",2);customElements.define("qti-base-value",ge);var Ze=class extends k{calculate(){let i=this.getVariables();if(this.children.length===2){let e=i[0],t=i[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let r=e.value,o=t.value;return r.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let r=e.value;return t.value.includes(r)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",Ze);var Qe=class extends u{get interpretation(){return this.getAttribute("interpretation")||""}calculate(){let i=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(i);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Qe);import{property as gi}from"lit/decorators.js";var R=class{static compareSingleValues(i,e,t){switch(t){case"identifier":case"string":return i===e;case"integer":{let r=parseInt(i,10),o=parseInt(e,10);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`Cannot convert ${i} and/or ${e} to int.`);break}case"float":{let r=parseFloat(i),o=parseFloat(e);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`couldn't convert ${i} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=i.split(" ").sort(),o=e.split(" ").sort();if(r.length===2&&o.length===2)return t==="pair"&&(r.sort(),o.sort()),r.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${i} 2: ${e}`);break}}return!1}};var ve=class extends u{constructor(){super(...arguments);this.toleranceMode="exact"}calculate(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):R.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};s([gi({type:String})],ve.prototype,"toleranceMode",2);customElements.define("qti-equal",ve);import{property as vi}from"lit/decorators.js";var ye=class extends u{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}calculate(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(t.value),n=parseFloat(r.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};s([vi({type:String})],ye.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",ye);var et=class extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",et);var tt=class extends k{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",tt);var rt=class extends u{calculate(){if(this.children.length===1){let i=this.getVariables();if(!i)return!0;let e=i[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",rt);var it=class extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",it);var st=class extends k{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",st);import{property as ot}from"lit/decorators.js";import{LitElement as yi}from"lit";var X=class extends yi{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};s([ot({attribute:"default-value",type:Number})],X.prototype,"defaultValue",2),s([ot({attribute:"lower-bound",type:Number})],X.prototype,"lowerBound",2),s([ot({attribute:"upper-bound",type:Number})],X.prototype,"upperBound",2);customElements.define("qti-mapping",X);import{property as xi}from"lit/decorators.js";var xe=class extends u{calculate(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],o=0;for(let n of r){let l=t.mapEntries.find(c=>R.compareSingleValues(c.mapKey,n,e.baseType));l==null||l.mappedValue==null?o+=t.defaultValue:o+=l.mappedValue}return t.lowerBound!=null&&(o=Math.max(t.lowerBound,o)),t.upperBound!=null&&(o=Math.min(t.upperBound,o)),o}};s([xi({type:String})],xe.prototype,"identifier",2);customElements.define("qti-map-response",xe);var ee=class a extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return this._result=a.match(e,t),this._result}return console.error("unexpected number of children in match"),null}static match(i,e){if(e.cardinality==="single")return i.value===null?!1:Array.isArray(i.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):R.compareSingleValues(i.value.toString(),e.value.toString(),e.baseType);{if(!Array.isArray(i.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(i.value.length!==e.value.length)return!1;let t=0;for(let r of e.value){if(e.cardinality==="ordered"){let o=i[t];if(!R.compareSingleValues(r,o,e.baseType))return!1}else{let o=null;for(let n of i.value)if(R.compareSingleValues(r,n,e.baseType)){o=n;break}if(o!==null)i.value.splice(i.value.indexOf(o),1);else return!1}t++}return!0}}};customElements.define("qti-match",ee);var nt=class extends u{calculate(){let i=this.getVariables();this.children.length!==2&&(this.error="The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType!==t.baseType&&(this.error="Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||(this.error="and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&(this.error="The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&(this.error="It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let r=e.value;return t.value.includes(r)}};customElements.define("qti-member",nt);var at=class extends u{calculate(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return i}};customElements.define("qti-multiple",at);import{html as Ei}from"lit";var lt=class extends u{render(){return Ei`${super.render()}`}calculate(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",lt);import{html as Ci}from"lit";var ct=class extends k{render(){return Ci``}calculate(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();if(typeof r=="string")if(r==="true")r=!0;else if(r==="false")r=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ct);var pt=class extends u{calculate(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return i}};customElements.define("qti-ordered",pt);import{LitElement as qi,html as Ft}from"lit";import{property as _i,state as ki}from"lit/decorators.js";var te=class extends qi{constructor(){super();this.value="";this.closest("qti-assessment-item").addEventListener("qti-response-processing",()=>{this.value=this.calculate()})}render(){return Ft`${Array.isArray(this.value)?this.value.map(e=>Ft`${e}`):this.value}`}calculate(){let e=this.closest("qti-assessment-item"),t=this.identifier;return e.getVariable(t).value}};s([_i({type:String})],te.prototype,"identifier",2),s([ki()],te.prototype,"value",2);customElements.define("qti-printed-variable",te);var dt=class extends u{calculate(){return this.getVariables().reduce((t,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return t*parseInt(r.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return t},1)}};customElements.define("qti-product",dt);var ut=class extends u{calculate(){let i=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(i).value}};customElements.define("qti-variable",ut);import{property as Ri}from"lit/decorators.js";var Ee=class extends u{constructor(){super(...arguments);this.caseSensitive="true"}calculate(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return R.compareSingleValues(o,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};s([Ri({type:String,attribute:"case-sensitive"})],Ee.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ee);var mt=class extends u{calculate(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",mt);import{LitElement as Ai,html as Xt}from"lit";var ht=class extends Ai{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){let t=e.querySelectorAll("properties"),r={},o=l=>{let c={},p=l.getAttribute("key");if(p){let d=Array.from(l.children),h=d.map(v=>v.getAttribute("key"));h.length>0&&!h.find(v=>!Number.isInteger(+v))?c[p]=d.map(v=>n(v)):c[p]=l.textContent}return c},n=l=>{if(l){let c={};for(let p of l.children)c=g(g({},c),o(p));return c}};for(let l of t)return l.getAttribute("key")||(r=g(g({},r),n(l))),r;console.log("Can not find qti-custom-interaction config")}register(e){let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",r=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");r.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=t=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);t=="IMS"?e.getInstance(r,o,void 0):e.initialize(this.customInteractionTypeIdentifier,r.firstElementChild,o),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,r.appendChild(c)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}requirejs.config(e)(["require"],r=>{define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}})),r([this.module],()=>{},o=>{this._errorMessage=o})},r=>{this._errorMessage=r})}render(){return Xt`<slot></slot>${this._errorMessage&&Xt`<div style="color:red">
159
159
  <h1>Error</h1>
160
160
  ${this._errorMessage}
161
- </div>`}`}};customElements.define("qti-portable-custom-interaction",ut);import{LitElement as Ci,css as _i,html as Yt}from"lit";var xe=class a{constructor(){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(i,e){this.data[i]=e},getData:function(i){return this.data[i]},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;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(i,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let t=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let r of t)this._dragCopy.style[r]=t.getPropertyValue(r);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let t=this;requestAnimationFrame(function(){t._touchEndCalled||t._dragCopy===null||(t._dragCopy.style.top=e.clientY-t._copyOffset.y+"px",t._dragCopy.style.left=e.clientX-t._copyOffset.x+"px")});let r=this._findDroppable(i);r!=this._lastTarget&&(this._dispatchEvent(r,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=r),this._currentDropContainer=r,this._currentDropContainer&&this._dispatchEvent(r,"dragover")}};return a._instance?a._instance:(a._instance=this,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)}addDraggables(i){i.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(i){this._touchBegin=Date.now();let{x:e,y:t}=this._getPoint(i);if(this._touchDown={x:e,y:t},this._dragSrc=i.currentTarget,this._canDrag=!0,this.dragOnClick){let r={clientX:e,clientY:t};this._dragRunning=!0,this._createDragCopy(i,r)}i.preventDefault()}_touchMove(i){if(this._canDrag&&this._dragSrc){let{x:e,y:t}=this._getPoint(i),r={clientX:e,clientY:t};this._getDelta(r)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(i,r),i.preventDefault()}}_touchEnd(i){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let t=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});t.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(t)}this._reset()}_touchCancel(i){this._reset()}_findDroppable(i){let e=this._getPoint(i);return this.elementFromPoint(e.x,e.y)}elementFromPoint(i,e){let t=document.elementFromPoint(i,e);if(t){for(;t.shadowRoot;){let r=t.shadowRoot.elementFromPoint(i,e);if(r===null||r===t)break;t=r}return t}return null}_getPoint(i,e){return i&&i.touches&&(i=i.touches[0]),{x:e?i.pageX:i.clientX,y:e?i.pageY:i.clientY}}_calculateDragCopyPosition(i){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=i.clientX-e.left,this._copyOffset.y=i.clientY-e.top}_getDelta(i){let e=Math.abs(i.clientX-this._touchDown.x),t=Math.abs(i.clientY-this._touchDown.y);return e+t}_dispatchEvent(i,e,t=!0){if(!i)return!1;let r=new CustomEvent(e,{bubbles:t,cancelable:!0});return r.dataTransfer=this._dataTransfer,i.dispatchEvent(r),r.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(i,e){this.data[i]=e},getData:function(i){return this.data[i]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};import{property as qi}from"lit/decorators.js";var Ut=(a,i,e)=>{class t extends a{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(n);let l=Array.from(i?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(p=>{p.forEach(d=>{if(d.type==="attributes")switch(d.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeHandler(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),n.currentTarget.setAttribute("active",""),n.dataTransfer.dropEffect="move",!1}dropHandler(n){n.preventDefault();let l=n.currentTarget,c=this.querySelector(`[identifier=${n.dataTransfer.getData("text")}`),p=c||this.shadowRoot.querySelector(`[identifier=${n.dataTransfer.getData("text")}`);return l?p.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(p):console.error(`cannot find droppable, target: ${n.target?JSON.stringify(n.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(n){return n.preventDefault(),n.currentTarget.removeAttribute("active"),n.dataTransfer.dropEffect="none",!1}}return s([qi({type:Boolean,reflect:!0})],t.prototype,"disabled",2),t};var Xt=(a,i,e)=>{class t extends a{}return t};import{property as Y}from"lit/decorators.js";var L=(a,i,e,t)=>{class r extends Xt(Ut(a,e,t),t,i){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(d=>!this.draggables||!this.draggables.get(d)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(d=>{this.draggables.set(d,{parent:d.parentElement,index:Array.from(d.parentNode.children).indexOf(d)}),d.setAttribute("qti-draggable","true"),d.addEventListener("dragstart",m=>{m.dataTransfer.setData("text",m.currentTarget.getAttribute("identifier")),d.setAttribute("dragging","")}),d.addEventListener("dragend",m=>{if(m.preventDefault(),d.removeAttribute("over"),d.removeAttribute("dragging"),(m.dataTransfer.dropEffect==="none"||m.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let _=m.currentTarget,g=this.draggables.get(_),He=g.index<g.parent.children.length?g.index:g.parent.children.length-1,b=g.parent,De=g.parent.children[He];b.insertBefore(_,De),this.saveResponse(),this.checkMaxMatchAssociations()}m.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("disabled",""):d.removeAttribute("disabled"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("readonly",""):d.removeAttribute("readonly"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(t):this.querySelectorAll(t))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new xe,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,p)=>{let d=c.parent.children,m=c.index<d.length?c.index:d.length;c.parent.insertBefore(p,d[m])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let p=+(l.getAttribute("match-max")||1)<=(l.children.length||0);p?l.setAttribute("disabled",""):l.removeAttribute("disabled"),p?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[p,...d]=c.split(" ").reverse();if(p){let m=this.droppables.find(_=>_.getAttribute("identifier")===p);d.forEach(_=>{let g=this.querySelector(`[identifier=${_}]`);m?g?(m.appendChild(g),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${_}`):console.error(`cannot find droppable with identifier: ${p}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(t)):Array.from(this.querySelectorAll(t))).filter(p=>p.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let l=this.droppables.map(c=>{var d;let p="";return((d=c.children)==null?void 0:d.length)>0&&(p+=Array.from(c.children).map(m=>m.getAttribute("identifier")).join(" ")+" "),p+=c.getAttribute("identifier"),p});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return s([yt(i)],r.prototype,"reInitDragAndDrop",1),s([Y({type:String,attribute:"response-identifier"})],r.prototype,"responseIdentifier",2),s([Y({attribute:!1,type:Object})],r.prototype,"configuration",2),s([h("configuration")],r.prototype,"handleDragOptionsChanged",1),s([Y({type:Boolean,reflect:!0})],r.prototype,"disabled",2),s([h("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),s([Y({type:Boolean,reflect:!0})],r.prototype,"readonly",2),s([h("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),s([Y({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),s([Y({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),r};import{state as ki}from"lit/decorators.js";var te=class extends L(Ci,"qti-simple-associable-choice",!0,".dl"){render(){return Yt` <slot name="prompt"></slot>
161
+ </div>`}`}};customElements.define("qti-portable-custom-interaction",ht);import{LitElement as Si,css as Ti,html as jt}from"lit";var Ce=class a{constructor(){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(i,e){this.data[i]=e},getData:function(i){return this.data[i]},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;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(i,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let t=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let r of t)this._dragCopy.style[r]=t.getPropertyValue(r);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let t=this;requestAnimationFrame(function(){t._touchEndCalled||t._dragCopy===null||(t._dragCopy.style.top=e.clientY-t._copyOffset.y+"px",t._dragCopy.style.left=e.clientX-t._copyOffset.x+"px")});let r=this._findDroppable(i);r!=this._lastTarget&&(this._dispatchEvent(r,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=r),this._currentDropContainer=r,this._currentDropContainer&&this._dispatchEvent(r,"dragover")}};return a._instance?a._instance:(a._instance=this,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)}addDraggables(i){i.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(i){this._touchBegin=Date.now();let{x:e,y:t}=this._getPoint(i);if(this._touchDown={x:e,y:t},this._dragSrc=i.currentTarget,this._canDrag=!0,this.dragOnClick){let r={clientX:e,clientY:t};this._dragRunning=!0,this._createDragCopy(i,r)}i.preventDefault()}_touchMove(i){if(this._canDrag&&this._dragSrc){let{x:e,y:t}=this._getPoint(i),r={clientX:e,clientY:t};this._getDelta(r)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(i,r),i.preventDefault()}}_touchEnd(i){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let t=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});t.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(t)}this._reset()}_touchCancel(i){this._reset()}_findDroppable(i){let e=this._getPoint(i);return this.elementFromPoint(e.x,e.y)}elementFromPoint(i,e){let t=document.elementFromPoint(i,e);if(t){for(;t.shadowRoot;){let r=t.shadowRoot.elementFromPoint(i,e);if(r===null||r===t)break;t=r}return t}return null}_getPoint(i,e){return i&&i.touches&&(i=i.touches[0]),{x:e?i.pageX:i.clientX,y:e?i.pageY:i.clientY}}_calculateDragCopyPosition(i){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=i.clientX-e.left,this._copyOffset.y=i.clientY-e.top}_getDelta(i){let e=Math.abs(i.clientX-this._touchDown.x),t=Math.abs(i.clientY-this._touchDown.y);return e+t}_dispatchEvent(i,e,t=!0){if(!i)return!1;let r=new CustomEvent(e,{bubbles:t,cancelable:!0});return r.dataTransfer=this._dataTransfer,i.dispatchEvent(r),r.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(i,e){this.data[i]=e},getData:function(i){return this.data[i]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};import{property as wi}from"lit/decorators.js";var Yt=(a,i,e)=>{class t extends a{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(n);let l=Array.from(i?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(p=>{p.forEach(d=>{if(d.type==="attributes")switch(d.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeHandler(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),n.currentTarget.setAttribute("active",""),n.dataTransfer.dropEffect="move",!1}dropHandler(n){n.preventDefault();let l=n.currentTarget,c=this.querySelector(`[identifier=${n.dataTransfer.getData("text")}`),p=c||this.shadowRoot.querySelector(`[identifier=${n.dataTransfer.getData("text")}`);return l?p.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(p):console.error(`cannot find droppable, target: ${n.target?JSON.stringify(n.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(n){return n.preventDefault(),n.currentTarget.removeAttribute("active"),n.dataTransfer.dropEffect="none",!1}}return s([wi({type:Boolean,reflect:!0})],t.prototype,"disabled",2),t};var Bt=(a,i,e)=>{class t extends a{}return t};import{property as Y}from"lit/decorators.js";var L=(a,i,e,t)=>{class r extends Bt(Yt(a,e,t),t,i){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(d=>!this.draggables||!this.draggables.get(d)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(d=>{this.draggables.set(d,{parent:d.parentElement,index:Array.from(d.parentNode.children).indexOf(d)}),d.setAttribute("qti-draggable","true"),d.addEventListener("dragstart",h=>{h.dataTransfer.setData("text",h.currentTarget.getAttribute("identifier")),d.setAttribute("dragging","")}),d.addEventListener("dragend",h=>{if(h.preventDefault(),d.removeAttribute("over"),d.removeAttribute("dragging"),(h.dataTransfer.dropEffect==="none"||h.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let A=h.currentTarget,v=this.draggables.get(A),De=v.index<v.parent.children.length?v.index:v.parent.children.length-1,b=v.parent,$e=v.parent.children[De];b.insertBefore(A,$e),this.saveResponse(),this.checkMaxMatchAssociations()}h.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("disabled",""):d.removeAttribute("disabled"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("readonly",""):d.removeAttribute("readonly"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(t):this.querySelectorAll(t))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ce,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,p)=>{let d=c.parent.children,h=c.index<d.length?c.index:d.length;c.parent.insertBefore(p,d[h])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let p=+(l.getAttribute("match-max")||1)<=(l.children.length||0);p?l.setAttribute("disabled",""):l.removeAttribute("disabled"),p?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[p,...d]=c.split(" ").reverse();if(p){let h=this.droppables.find(A=>A.getAttribute("identifier")===p);d.forEach(A=>{let v=this.querySelector(`[identifier=${A}]`);h?v?(h.appendChild(v),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${A}`):console.error(`cannot find droppable with identifier: ${p}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(t)):Array.from(this.querySelectorAll(t))).filter(p=>p.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let l=this.droppables.map(c=>{var d;let p="";return((d=c.children)==null?void 0:d.length)>0&&(p+=Array.from(c.children).map(h=>h.getAttribute("identifier")).join(" ")+" "),p+=c.getAttribute("identifier"),p});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return s([Et(i)],r.prototype,"reInitDragAndDrop",1),s([Y({type:String,attribute:"response-identifier"})],r.prototype,"responseIdentifier",2),s([Y({attribute:!1,type:Object})],r.prototype,"configuration",2),s([f("configuration")],r.prototype,"handleDragOptionsChanged",1),s([Y({type:Boolean,reflect:!0})],r.prototype,"disabled",2),s([f("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),s([Y({type:Boolean,reflect:!0})],r.prototype,"readonly",2),s([f("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),s([Y({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),s([Y({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),r};import{state as Li}from"lit/decorators.js";var re=class extends L(Si,"qti-simple-associable-choice",!0,".dl"){render(){return jt` <slot name="prompt"></slot>
162
162
  <slot name="qti-simple-associable-choice"></slot>
163
- ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>Yt`<div part="associables-container">
163
+ ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>jt`<div part="associables-container">
164
164
  <div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
165
165
  <div name="right${t}" part="drop-list" class="dl" identifier="droplist${t}_right"></div>
166
- </div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};te.styles=_i`
166
+ </div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};re.styles=Ti`
167
167
  :host {
168
168
  display: block; /* necessary to calculate scaling position */
169
169
  }
@@ -172,8 +172,8 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
172
172
  flex-wrap: wrap;
173
173
  gap: 0.5rem;
174
174
  }
175
- `,s([ki()],te.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",te);import{css as Ai,html as Ti,LitElement as wi}from"lit";var Ee=class extends L(wi,"qti-gap-text",!1,"qti-gap"){render(){return Ti` <slot part="drags" name="qti-gap-text"></slot>
176
- <slot part="drops"></slot>`}};Ee.styles=[Ai`
175
+ `,s([Li()],re.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",re);import{css as Vi,html as Mi,LitElement as Ni}from"lit";var qe=class extends L(Ni,"qti-gap-text",!1,"qti-gap"){render(){return Mi` <slot part="drags" name="qti-gap-text"></slot>
176
+ <slot part="drops"></slot>`}};qe.styles=[Vi`
177
177
  :host {
178
178
  display: flex;
179
179
  align-items: flex-start;
@@ -196,14 +196,14 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
196
196
  align-items: flex-start;
197
197
  flex: 1;
198
198
  }
199
- `];customElements.define("qti-gap-match-interaction",Ee);import{css as Ri,svg as Bt,html as Li}from"lit";function B(a,i,e,t){switch(a){case"circle":{let[r,o,n]=i,l=r/e.width*100,c=o/e.height*100,p=n/e.width*100;t.style.left=l-p+"%",t.style.top=c-p+"%",t.style.width=t.style.height=4*p+"px",t.style.borderRadius="9999px"}break;case"rect":{let[r,o,n,l]=i,c=r/e.width*100,p=o/e.height*100,d=n/e.width*100,m=l/e.height*100;t.style.left=c+"%",t.style.top=p+"%",t.style.width=d-c+"%",t.style.height=m-p+"%"}break;case"poly":{let r=i.reduce((b,De,gt,Zt)=>{if(gt%2===1){let Qt=b.pop();b[b.length]={x:Qt,y:Zt[gt]}}else b.push(De);return b},[]),o=Math.min(...r.map(b=>b.x)),n=Math.max(...r.map(b=>b.x)),l=Math.min(...r.map(b=>b.y)),c=Math.max(...r.map(b=>b.y)),p=o/e.width*100,d=l/e.height*100,m=n/e.width*100,_=c/e.height*100;t.style.left=o/e.width*100+"%",t.style.top=l/e.height*100+"%",t.style.width=m-p+"%",t.style.height=_-d+"%";let He=r.map(b=>({x:(b.x-o)/(n-o)*100,y:(b.y-l)/(c-l)*100})).map(b=>Math.round(b.x)+"% "+Math.round(b.y)+"%").join(",");t.style.clipPath=`polygon(${He})`}break;default:break}}import{query as Si,queryAssignedElements as Mi,state as mt}from"lit/decorators.js";import{repeat as Vi}from"lit/directives/repeat.js";import{ifDefined as zt}from"lit/directives/if-defined.js";var M=class extends f{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,t,r,o;return Li`<slot name="prompt"></slot>
199
+ `];customElements.define("qti-gap-match-interaction",qe);import{css as Hi,svg as zt,html as Di}from"lit";function B(a,i,e,t){switch(a){case"circle":{let[r,o,n]=i,l=r/e.width*100,c=o/e.height*100,p=n/e.width*100;t.style.left=l-p+"%",t.style.top=c-p+"%",t.style.width=t.style.height=4*p+"px",t.style.borderRadius="9999px"}break;case"rect":{let[r,o,n,l]=i,c=r/e.width*100,p=o/e.height*100,d=n/e.width*100,h=l/e.height*100;t.style.left=c+"%",t.style.top=p+"%",t.style.width=d-c+"%",t.style.height=h-p+"%"}break;case"poly":{let r=i.reduce((b,$e,yt,tr)=>{if(yt%2===1){let rr=b.pop();b[b.length]={x:rr,y:tr[yt]}}else b.push($e);return b},[]),o=Math.min(...r.map(b=>b.x)),n=Math.max(...r.map(b=>b.x)),l=Math.min(...r.map(b=>b.y)),c=Math.max(...r.map(b=>b.y)),p=o/e.width*100,d=l/e.height*100,h=n/e.width*100,A=c/e.height*100;t.style.left=o/e.width*100+"%",t.style.top=l/e.height*100+"%",t.style.width=h-p+"%",t.style.height=A-d+"%";let De=r.map(b=>({x:(b.x-o)/(n-o)*100,y:(b.y-l)/(c-l)*100})).map(b=>Math.round(b.x)+"% "+Math.round(b.y)+"%").join(",");t.style.clipPath=`polygon(${De})`}break;default:break}}import{query as $i,queryAssignedElements as Oi,state as ft}from"lit/decorators.js";import{repeat as Pi}from"lit/directives/repeat.js";import{ifDefined as Kt}from"lit/directives/if-defined.js";var M=class extends m{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,t,r,o;return Di`<slot name="prompt"></slot>
200
200
  <line-container>
201
201
  <svg
202
- width=${zt((e=this.grImage[0])==null?void 0:e.width)}
203
- height=${zt((t=this.grImage[0])==null?void 0:t.height)}
202
+ width=${Kt((e=this.grImage[0])==null?void 0:e.width)}
203
+ height=${Kt((t=this.grImage[0])==null?void 0:t.height)}
204
204
  viewbox="0 0 ${(r=this.grImage[0])==null?void 0:r.width} ${(o=this.grImage[0])==null?void 0:o.height}"
205
205
  >
206
- ${Vi(this._lines,n=>n,(n,l)=>Bt`
206
+ ${Pi(this._lines,n=>n,(n,l)=>zt`
207
207
  <line
208
208
  part="line"
209
209
  x1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.left)}
@@ -215,7 +215,7 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
215
215
  @click=${c=>{c.stopPropagation(),this._lines=this._lines.filter((p,d)=>d!==l),this.saveResponse(this._lines)}}
216
216
  />
217
217
  `)}
218
- ${this.startPoint&&Bt`<line
218
+ ${this.startPoint&&zt`<line
219
219
  part="point"
220
220
  x1=${this.startCoord.x}
221
221
  y1=${this.startCoord.y}
@@ -226,7 +226,7 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
226
226
  />`}
227
227
  </svg>
228
228
  <slot></slot>
229
- </line-container>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));B(n,l,t,r)}firstUpdated(e){super.firstUpdated(e),this.hotspots=document.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",t=>{this.mouseCoord={x:t.clientX-this.grImage[0].getBoundingClientRect().left,y:t.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",r=>{this.startPoint?this.endPoint||(this.endPoint=r.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=r.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};M.styles=[Ri`
229
+ </line-container>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));B(n,l,t,r)}firstUpdated(e){super.firstUpdated(e),this.hotspots=document.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",t=>{this.mouseCoord={x:t.clientX-this.grImage[0].getBoundingClientRect().left,y:t.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",r=>{this.startPoint?this.endPoint||(this.endPoint=r.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=r.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};M.styles=[Hi`
230
230
  slot:not([name='prompt']) {
231
231
  // position: relative; /* qti-hotspot-choice relative to the slot */
232
232
  display: block;
@@ -249,8 +249,8 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
249
249
  top: 0px;
250
250
  left: 0px;
251
251
  }
252
- `],s([mt()],M.prototype,"_lines",2),s([mt()],M.prototype,"startCoord",2),s([mt()],M.prototype,"mouseCoord",2),s([Si("svg")],M.prototype,"svgContainer",2),s([Mi({selector:"img"})],M.prototype,"grImage",2);customElements.define("qti-graphic-associate-interaction",M);import{css as Ni,html as Hi,LitElement as Di}from"lit";var qe=class extends L(Di,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return Hi` <slot></slot>
253
- <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));switch(o){case"circle":{let[l,c,p]=n;t.style.left=l-p+"px",t.style.top=c-p+"px",t.style.width=t.style.height=2*p+"px"}break;case"rect":{let[l,c,p,d]=n;t.style.left=l+"px",t.style.top=c+"px",t.style.width=p-l+"px",t.style.height=d-c+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};qe.styles=Ni`
252
+ `],s([ft()],M.prototype,"_lines",2),s([ft()],M.prototype,"startCoord",2),s([ft()],M.prototype,"mouseCoord",2),s([$i("svg")],M.prototype,"svgContainer",2),s([Oi({selector:"img"})],M.prototype,"grImage",2);customElements.define("qti-graphic-associate-interaction",M);import{css as Ii,html as Ui,LitElement as Fi}from"lit";var _e=class extends L(Fi,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return Ui` <slot></slot>
253
+ <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));switch(o){case"circle":{let[l,c,p]=n;t.style.left=l-p+"px",t.style.top=c-p+"px",t.style.width=t.style.height=2*p+"px"}break;case"rect":{let[l,c,p,d]=n;t.style.left=l+"px",t.style.top=c+"px",t.style.width=p-l+"px",t.style.height=d-c+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};_e.styles=Ii`
254
254
  :host {
255
255
  display: inline-block;
256
256
  position: relative;
@@ -259,12 +259,12 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
259
259
  display: flex;
260
260
  gap: 1rem;
261
261
  }
262
- `;customElements.define("qti-graphic-gap-match-interaction",qe);import{css as $i,html as Oi}from"lit";var Ce=class extends v{render(){return Oi`
262
+ `;customElements.define("qti-graphic-gap-match-interaction",_e);import{css as Xi,html as Yi}from"lit";var ke=class extends y{render(){return Yi`
263
263
  <slot name="prompt"></slot>
264
264
  <!-- slot for the prompt -->
265
265
  <slot></slot>
266
266
  <!-- slot for the image and hotspots -->
267
- `}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(n=>n.getAttribute("identifier")===t),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}r.order=this._choiceElements.filter(n=>!!n.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(n=>(n.order>n.order&&n.order--,n)),r.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));B(n,l,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Ce.styles=[$i`
267
+ `}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(n=>n.getAttribute("identifier")===t),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}r.order=this._choiceElements.filter(n=>!!n.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(n=>(n.order>n.order&&n.order--,n)),r.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));B(n,l,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};ke.styles=[Xi`
268
268
  slot:not([name='prompt']) {
269
269
  position: relative; /* qti-hotspot-choice relative to the slot */
270
270
  display: block;
@@ -275,12 +275,12 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
275
275
  pointer-events: none;
276
276
  user-select: none;
277
277
  }
278
- `];customElements.define("qti-graphic-order-interaction",Ce);import{css as Pi,html as Ii}from"lit";var _e=class extends v{render(){return Ii`
278
+ `];customElements.define("qti-graphic-order-interaction",ke);import{css as Bi,html as ji}from"lit";var Re=class extends y{render(){return ji`
279
279
  <slot name="prompt"></slot>
280
280
  <!-- slot for the prompt -->
281
281
  <slot></slot>
282
282
  <!-- slot for the image and hotspots -->
283
- `}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));B(o,n,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};_e.styles=[Pi`
283
+ `}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));B(o,n,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Re.styles=[Bi`
284
284
  slot:not([name='prompt']) {
285
285
  position: relative; /* qti-hotspot-choice relative to the slot */
286
286
  display: block;
@@ -292,36 +292,36 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
292
292
  user-select: none;
293
293
  /* width:100%; */
294
294
  }
295
- `];customElements.define("qti-hotspot-interaction",_e);import{html as re,LitElement as Xi}from"lit";import{html as Fi,LitElement as Ui}from"lit";var ht=class extends Ui{connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return Fi`
295
+ `];customElements.define("qti-hotspot-interaction",Re);import{html as ie,LitElement as Wi}from"lit";import{html as zi,LitElement as Ki}from"lit";var bt=class extends Ki{connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return zi`
296
296
  <slot></slot>
297
297
  <slot name="qti-simple-associable-choice"></slot>
298
- `}};customElements.define("qti-simple-associable-choice",ht);import{property as Yi,state as Bi}from"lit/decorators.js";import{unsafeHTML as jt}from"lit/directives/unsafe-html.js";var z=class extends L(Xi,"qti-simple-match-set:first-of-type qti-simple-associable-choice",!1,"qti-simple-match-set:last-of-type qti-simple-associable-choice"){constructor(){super(...arguments);this.response=[];this.responseIdentifier=""}connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}render(){return this.classList.contains("qti-match-tabular")?re`
298
+ `}};customElements.define("qti-simple-associable-choice",bt);import{property as Gi,state as Ji}from"lit/decorators.js";import{unsafeHTML as Wt}from"lit/directives/unsafe-html.js";var j=class extends L(Wi,"qti-simple-match-set:first-of-type qti-simple-associable-choice",!1,"qti-simple-match-set:last-of-type qti-simple-associable-choice"){constructor(){super(...arguments);this.response=[];this.responseIdentifier=""}connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}render(){return this.classList.contains("qti-match-tabular")?ie`
299
299
  <slot name="prompt"></slot>
300
300
  <table>
301
301
  <tr>
302
302
  <td></td>
303
- ${this.cols.map((e,t)=>re`<th part="r-header">${jt(e.innerHTML)}</th>`)}
303
+ ${this.cols.map((e,t)=>ie`<th part="r-header">${Wt(e.innerHTML)}</th>`)}
304
304
  </tr>
305
- ${this.rows.map((e,t)=>re`<tr>
306
- <td part="c-header">${jt(e.innerHTML)}</td>
307
- ${this.cols.map((r,o)=>{let n=`${e.getAttribute("identifier")} ${r.getAttribute("identifier")}`;return re`<td>
308
- <input
309
- type="checkbox"
310
- value=${r.getAttribute("identifier")}
311
- .checked=${this.response.includes(n)}
312
- @change=${l=>{l.target.checked?this.response.push(n):this.response=this.response.filter(p=>p!==n),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:this.response}}))}}
313
- />
314
- </td>`})}
315
- </tr>`)}
305
+ ${this.rows.map((e,t)=>ie`<tr>
306
+ <td part="c-header">${Wt(e.innerHTML)}</td>
307
+ ${this.cols.map((r,o)=>{let n=`${e.getAttribute("identifier")} ${r.getAttribute("identifier")}`;return ie`<td>
308
+ <input
309
+ type="checkbox"
310
+ value=${r.getAttribute("identifier")}
311
+ .checked=${this.response.includes(n)}
312
+ @change=${l=>{l.target.checked?this.response.push(n):this.response=this.response.filter(p=>p!==n),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:this.response}}))}}
313
+ />
314
+ </td>`})}
315
+ </tr>`)}
316
316
  </table>
317
- `:re`<slot name="prompt"></slot> <slot></slot>`}};z.styles=[],s([Bi()],z.prototype,"response",2),s([Yi({type:String,attribute:"response-identifier"})],z.prototype,"responseIdentifier",2);customElements.define("qti-match-interaction",z);import{css as zi,html as ji}from"lit";var ke=class extends f{constructor(){super()}reset(){}validate(){return!0}set response(e){}static get properties(){return W(A({},f.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return ji` <slot name="prompt"></slot>
318
- <slot></slot>`}connectedCallback(){super.connectedCallback()}};ke.styles=[zi``];customElements.define("qti-media-interaction",ke);import{css as Ki,html as Kt,LitElement as Wi}from"lit";import{property as Gi}from"lit/decorators.js";var j=class extends L(Wi,"qti-simple-choice",!0,"drop-list"){render(){return Kt` <slot name="prompt"> </slot>
317
+ `:ie`<slot name="prompt"></slot> <slot></slot>`}};j.styles=[],s([Ji()],j.prototype,"response",2),s([Gi({type:String,attribute:"response-identifier"})],j.prototype,"responseIdentifier",2);customElements.define("qti-match-interaction",j);import{css as Zi,html as Qi}from"lit";var Ae=class extends m{constructor(){super();this.value=0}reset(){}validate(){return!0}set response(e){}static get properties(){return C(g({},m.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return Qi` <slot name="prompt"></slot>
318
+ <slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.value++,this.saveResponse(this.value.toString())})}};Ae.styles=[Zi``];customElements.define("qti-media-interaction",Ae);import{css as es,html as Gt,LitElement as ts}from"lit";import{property as rs}from"lit/decorators.js";var z=class extends L(ts,"qti-simple-choice",!0,"drop-list"){render(){return Gt` <slot name="prompt"> </slot>
319
319
  <div part="container">
320
320
  <slot part="drags"> </slot>
321
321
  <div part="drops">
322
- ${Array.from(this.querySelectorAll("qti-simple-choice")).map((e,t)=>Kt`<drop-list part="drop-list" identifier="droplist${t}"></drop-list>`)}
322
+ ${Array.from(this.querySelectorAll("qti-simple-choice")).map((e,t)=>Gt`<drop-list part="drop-list" identifier="droplist${t}"></drop-list>`)}
323
323
  </div>
324
- </div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};j.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],j.styles=[Ki`
324
+ </div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};z.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],z.styles=[es`
325
325
  [part='drags'] {
326
326
  display: flex;
327
327
  align-items: flex-start;
@@ -369,7 +369,7 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
369
369
  :host(.qti-choices-right) [part='container'] {
370
370
  flex-direction: row-reverse;
371
371
  }
372
- `],s([Gi({type:String})],j.prototype,"orientation",2);customElements.define("qti-order-interaction",j);import{LitElement as Ji,css as Zi,html as Qi}from"lit";var Ae=class extends Ji{render(){return Qi`<slot></slot>`}};Ae.styles=[Zi`
372
+ `],s([rs({type:String})],z.prototype,"orientation",2);customElements.define("qti-order-interaction",z);import{LitElement as is,css as ss,html as os}from"lit";var we=class extends is{render(){return os`<slot></slot>`}};we.styles=[ss`
373
373
  :host {
374
374
  display: block;
375
375
  }
@@ -380,22 +380,22 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
380
380
  left: 50%;
381
381
  transform: translateX(-50%);
382
382
  }
383
- `];customElements.define("qti-position-object-interaction",Ae);import{LitElement as es,css as ts,html as rs}from"lit";var Te=class extends es{constructor(){super();this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}render(){return rs`<slot></slot>`}dragElementHandler(e){e.preventDefault();let t=e.clientX-this.startX,r=e.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+t+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=e.clientX,this.startY=e.clientY}connectedCallback(){super.connectedCallback(),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(e){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};Te.styles=[ts`
383
+ `];customElements.define("qti-position-object-interaction",we);import{LitElement as ns,css as as,html as ls}from"lit";var Se=class extends ns{constructor(){super();this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}render(){return ls`<slot></slot>`}dragElementHandler(e){e.preventDefault();let t=e.clientX-this.startX,r=e.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+t+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=e.clientX,this.startY=e.clientY}connectedCallback(){super.connectedCallback(),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(e){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};Se.styles=[as`
384
384
  :host {
385
385
  display: inline-block;
386
386
  position: relative;
387
387
  }
388
- `];customElements.define("qti-position-object-stage",Te);import{css as is,html as Wt}from"lit";import{property as Gt,state as ss}from"lit/decorators.js";import{repeat as os}from"lit/directives/repeat.js";import{styleMap as ns}from"lit/directives/style-map.js";var N=class extends f{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return Wt` <slot name="prompt"></slot>
388
+ `];customElements.define("qti-position-object-stage",Se);import{css as cs,html as Jt}from"lit";import{property as Zt,state as ps}from"lit/decorators.js";import{repeat as ds}from"lit/directives/repeat.js";import{styleMap as us}from"lit/directives/style-map.js";var D=class extends m{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return Jt` <slot name="prompt"></slot>
389
389
  <point-container>
390
- ${os(this._points,e=>e,(e,t)=>Wt`
390
+ ${ds(this._points,e=>e,(e,t)=>Jt`
391
391
  <button
392
392
  part="point"
393
- style=${ns({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
393
+ style=${us({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
394
394
  @click=${r=>{r.stopPropagation(),this._points=this._points.filter((o,n)=>n!==t),this.saveResponse(this._points)}}
395
395
  ></button>
396
396
  `)}
397
397
  <slot></slot>
398
- </point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",t=>{let r=t.offsetX,o=t.offsetY;this._points=[...this._points,r+" "+o],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};N.styles=[is`
398
+ </point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",t=>{let r=t.offsetX,o=t.offsetY;this._points=[...this._points,r+" "+o],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};D.styles=[cs`
399
399
  host() {
400
400
  display: block;
401
401
  }
@@ -403,29 +403,29 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
403
403
  display: block;
404
404
  position: relative;
405
405
  }
406
- `],s([Gt({type:Number,attribute:"max-choices"})],N.prototype,"maxChoices",2),s([Gt({type:Number,attribute:"min-choices"})],N.prototype,"minChoices",2),s([ss()],N.prototype,"_points",2);customElements.define("qti-select-point-interaction",N);import{css as as,html as we,nothing as ft}from"lit";import{property as K,query as Jt}from"lit/decorators.js";var x=class extends f{constructor(){super();this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=(e,t)=>{};this._handleReadonlyChange=(e,t)=>{};this.csLive=getComputedStyle(this)}set min(e){this._min=e,this.value=e,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}set response(e){if(Array.isArray(e)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let t=parseInt(e);if(Number.isNaN(t)){console.error("QtiSliderInteraction: response is not a number");return}this.value=t}render(){this.value<this.min&&(this.value=this.min),this.value>this.max&&(this.value=this.max);let e=(this.value-this.min)/(this.max-this.min)*100;return this.style.setProperty("--value-percentage",`${e}%`),this.setAttribute("aria-valuenow",this.value.toString()),we`<slot name="prompt"></slot>
406
+ `],s([Zt({type:Number,attribute:"max-choices"})],D.prototype,"maxChoices",2),s([Zt({type:Number,attribute:"min-choices"})],D.prototype,"minChoices",2),s([ps()],D.prototype,"_points",2);customElements.define("qti-select-point-interaction",D);import{css as ms,html as Te,nothing as gt}from"lit";import{property as K,query as Qt}from"lit/decorators.js";var E=class extends m{constructor(){super();this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=(e,t)=>{};this._handleReadonlyChange=(e,t)=>{};this.csLive=getComputedStyle(this)}set min(e){this._min=e,this.value=e,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}set response(e){if(Array.isArray(e)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let t=parseInt(e);if(Number.isNaN(t)){console.error("QtiSliderInteraction: response is not a number");return}this.value=t}render(){this.value<this.min&&(this.value=this.min),this.value>this.max&&(this.value=this.max);let e=(this.value-this.min)/(this.max-this.min)*100;return this.style.setProperty("--value-percentage",`${e}%`),this.setAttribute("aria-valuenow",this.value.toString()),Te`<slot name="prompt"></slot>
407
407
  <div id="slider" part="slider">
408
- ${this.csLive.getPropertyValue("--show-bounds")=="true"?we`<div id="bounds" part="bounds">
408
+ ${this.csLive.getPropertyValue("--show-bounds")=="true"?Te`<div id="bounds" part="bounds">
409
409
  <div>${this._min}</div>
410
410
  <div>${this._max}</div>
411
- </div>`:ft}
412
- ${this.csLive.getPropertyValue("--show-ticks")=="true"?we`<div id="ticks" part="ticks"></div>`:ft}
411
+ </div>`:gt}
412
+ ${this.csLive.getPropertyValue("--show-ticks")=="true"?Te`<div id="ticks" part="ticks"></div>`:gt}
413
413
  <div id="rail" part="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchMove}>
414
414
  <div id="knob" part="knob">
415
- ${this.csLive.getPropertyValue("--show-value")=="true"?we`<div id="value" part="value">${this.value}</div>`:ft}
415
+ ${this.csLive.getPropertyValue("--show-value")=="true"?Te`<div id="value" part="value">${this.value}</div>`:gt}
416
416
  </div>
417
417
  </div>
418
- </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let t=l=>{let{x:c}=this.getPositionFromEvent(l),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),l.stopPropagation()},r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",t),document.addEventListener("touchend",r);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let t=n=>{let l=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),n.preventDefault(),n.stopPropagation()},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let t=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,r=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=r}getPositionFromEvent(e){let t;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let r=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=r.touches[0]||r.changedTouches[0];t={x:o.pageX,y:o.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(t={x:e.clientX,y:e.clientY});return t}};x.styles=[as``],s([Jt("#knob")],x.prototype,"_knob",2),s([Jt("#rail")],x.prototype,"_rail",2),s([K({type:Number})],x.prototype,"value",2),s([K({type:Boolean,attribute:"step-label"})],x.prototype,"stepLabel",2),s([K({type:Boolean})],x.prototype,"reverse",2),s([K({type:Number,attribute:"lower-bound"})],x.prototype,"min",1),s([K({type:Number,attribute:"upper-bound"})],x.prototype,"max",1),s([K({type:Number,attribute:"step"})],x.prototype,"step",1),s([h("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"_handleDisabledChange",2),s([h("readonly",{waitUntilFirstUpdate:!0})],x.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",x);import{LitElement as ls,html as cs}from"lit";import{property as ps}from"lit/decorators.js";var Re=class extends ls{render(){return cs`<button @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.closest("qti-assessment-item").processResponse()}};s([ps({type:String})],Re.prototype,"title",2);customElements.define("qti-end-attempt-interaction",Re);import{LitElement as ds,css as us,html as ms}from"lit";var Le=class extends ds{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return ms` <slot name="qti-gap-img"></slot> `}};Le.styles=us`
418
+ </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let t=l=>{let{x:c}=this.getPositionFromEvent(l),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),l.stopPropagation()},r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",t),document.addEventListener("touchend",r);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let t=n=>{let l=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),n.preventDefault(),n.stopPropagation()},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let t=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,r=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=r}getPositionFromEvent(e){let t;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let r=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=r.touches[0]||r.changedTouches[0];t={x:o.pageX,y:o.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(t={x:e.clientX,y:e.clientY});return t}};E.styles=[ms``],s([Qt("#knob")],E.prototype,"_knob",2),s([Qt("#rail")],E.prototype,"_rail",2),s([K({type:Number})],E.prototype,"value",2),s([K({type:Boolean,attribute:"step-label"})],E.prototype,"stepLabel",2),s([K({type:Boolean})],E.prototype,"reverse",2),s([K({type:Number,attribute:"lower-bound"})],E.prototype,"min",1),s([K({type:Number,attribute:"upper-bound"})],E.prototype,"max",1),s([K({type:Number,attribute:"step"})],E.prototype,"step",1),s([f("disabled",{waitUntilFirstUpdate:!0})],E.prototype,"_handleDisabledChange",2),s([f("readonly",{waitUntilFirstUpdate:!0})],E.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",E);import{html as hs}from"lit";import{customElement as fs,property as er}from"lit/decorators.js";var W=class extends m{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}set response(e){}render(){return hs`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};s([er({type:String,attribute:"count-attempt"})],W.prototype,"countAttempt",2),s([er({type:String})],W.prototype,"title",2),W=s([fs("qti-end-attempt-interaction")],W);import{LitElement as bs,css as gs,html as vs}from"lit";var Le=class extends bs{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return vs` <slot name="qti-gap-img"></slot> `}};Le.styles=gs`
419
419
  :host {
420
420
  position: absolute;
421
421
  }
422
- `;customElements.define("qti-associable-hotspot",Le);import{LitElement as hs}from"lit";import{property as fs}from"lit/decorators.js";var Se=class extends hs{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};s([fs({type:Number,reflect:!0})],Se.prototype,"tabindex",2);customElements.define("qti-gap-img",Se);import{html as bs,LitElement as gs}from"lit";import{property as vs}from"lit/decorators.js";var Me=class extends gs{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return bs`<slot></slot>`}};s([vs({type:Number,reflect:!0})],Me.prototype,"tabindex",2);customElements.define("qti-gap-text",Me);import{html as ys,LitElement as xs}from"lit";import{property as Es}from"lit/decorators.js";var Ve=class extends xs{constructor(){super(...arguments);this.tabindex=0}render(){return ys` <slot name="qti-gap-text"></slot>`}};s([Es({type:Number,reflect:!0})],Ve.prototype,"tabindex",2);customElements.define("qti-gap",Ve);import{css as qs}from"lit";import{property as Cs}from"lit/decorators.js";var ie=class extends y{};ie.styles=qs`
422
+ `;customElements.define("qti-associable-hotspot",Le);import{LitElement as ys}from"lit";import{property as xs}from"lit/decorators.js";var Ve=class extends ys{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};s([xs({type:Number,reflect:!0})],Ve.prototype,"tabindex",2);customElements.define("qti-gap-img",Ve);import{html as Es,LitElement as Cs}from"lit";import{property as qs}from"lit/decorators.js";var Me=class extends Cs{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return Es`<slot></slot>`}};s([qs({type:Number,reflect:!0})],Me.prototype,"tabindex",2);customElements.define("qti-gap-text",Me);import{html as _s,LitElement as ks}from"lit";import{property as Rs}from"lit/decorators.js";var Ne=class extends ks{constructor(){super(...arguments);this.tabindex=0}render(){return _s` <slot name="qti-gap-text"></slot>`}};s([Rs({type:Number,reflect:!0})],Ne.prototype,"tabindex",2);customElements.define("qti-gap",Ne);import{css as As}from"lit";import{property as ws}from"lit/decorators.js";var se=class extends x{};se.styles=As`
423
423
  :host {
424
424
  position: absolute;
425
425
  }
426
- `,s([Cs({attribute:"aria-ordervalue",type:Number,reflect:!0})],ie.prototype,"order",2);customElements.define("qti-hotspot-choice",ie);import{customElement as _s}from"lit/decorators.js";import{html as ks}from"lit";var Ne=class extends y{render(){return ks`<div part="ch"><div part="cha"></div></div>
427
- <slot></slot> `}};Ne=s([_s("qti-hottext")],Ne);import{LitElement as As}from"lit";var bt=class extends As{};customElements.define("qti-inline-choice",bt);import{customElement as Ts}from"lit/decorators.js";import{css as ws,html as Rs}from"lit";var se=class extends y{render(){return Rs`<div part="ch"><div part="cha"></div></div>
428
- <slot part="slot"></slot> `}};se.styles=ws`
426
+ `,s([ws({attribute:"aria-ordervalue",type:Number,reflect:!0})],se.prototype,"order",2);customElements.define("qti-hotspot-choice",se);import{customElement as Ss}from"lit/decorators.js";import{html as Ts}from"lit";var He=class extends x{render(){return Ts`<div part="ch"><div part="cha"></div></div>
427
+ <slot></slot> `}};He=s([Ss("qti-hottext")],He);import{LitElement as Ls}from"lit";var vt=class extends Ls{};customElements.define("qti-inline-choice",vt);import{customElement as Vs}from"lit/decorators.js";import{css as Ms,html as Ns}from"lit";var oe=class extends x{render(){return Ns`<div part="ch"><div part="cha"></div></div>
428
+ <slot part="slot"></slot> `}};oe.styles=Ms`
429
429
  :host {
430
430
  display: flex;
431
431
  }
@@ -433,4 +433,4 @@ import{a as yt,b as h}from"../chunk-QROD4MVT.js";import{a as vt}from"../chunk-5G
433
433
  width: 100%;
434
434
  display: block;
435
435
  }
436
- `,se=s([Ts("qti-simple-choice")],se);export{Rt as Events,f as Interaction,H as OutcomeVariable,ee as QtPrintedVariable,Ke as QtiAnd,T as QtiAssessmentItem,Le as QtiAssociableHotspot,te as QtiAssociateInteraction,fe as QtiBaseValue,y as QtiChoice,wt as QtiChoiceElementSelected,F as QtiChoiceInteraction,ne as QtiCompanionMaterialsInfo,q as QtiConditionExpression,We as QtiContains,Ge as QtiCorrect,Re as QtiEndAttemptInteraction,be as QtiEqual,ge as QtiEqualRounded,u as QtiExpression,R as QtiExtendedTextInteraction,ue as QtiFeedbackBlock,pe as QtiFeedbackInline,Ve as QtiGap,Se as QtiGapImg,Ee as QtiGapMatchInteraction,Me as QtiGapText,M as QtiGraphicAssociateInteraction,qe as QtiGraphicGapMatchInteraction,Ce as QtiGraphicOrderInteraction,Je as QtiGt,Ze as QtiGte,ie as QtiHotspotChoice,_e as QtiHotspotInteraction,Ne as QtiHottext,Xe as QtiHottextInteraction,bt as QtiInlineChoice,I as QtiInlineChoiceInteraction,Et as QtiInteractionChanged,Tt as QtiInteractionResponse,Qe as QtiIsNull,At as QtiLooseChoice,et as QtiLt,tt as QtiLte,ve as QtiMapResponse,X as QtiMapping,it as QtiMatch,z as QtiMatchInteraction,ke as QtiMediaInteraction,st as QtiMember,de as QtiModalFeedback,ot as QtiMultiple,nt as QtiNot,at as QtiOr,j as QtiOrderInteraction,lt as QtiOrdered,xt as QtiOutcomeChanged,P as QtiOutcomeDeclaration,ut as QtiPortableCustomInteraction,Te as QtiPositionObjectStage,ct as QtiProduct,Oe as QtiPrompt,_t as QtiRegisterChoice,kt as QtiRegisterHotspot,Ct as QtiRegisterInteraction,qt as QtiRegisterVariable,Ye as QtiResponseCondition,O as QtiResponseDeclaration,J as QtiResponseElse,ze as QtiResponseElseIf,Z as QtiResponseIf,U as QtiResponseProcessing,S as QtiRule,Ae as QtiSPositionObjectInteraction,N as QtiSelectPointInteraction,Be as QtiSetOutcomeValue,ht as QtiSimpleAssociableChoice,se as QtiSimpleChoice,x as QtiSliderInteraction,ye as QtiStringMatch,$e as QtiStylesheet,dt as QtiSum,k as QtiTextEntryInteraction,pt as QtiVariable,D as ResponseVariable,le as qtiContentBody,w as qtiRubricBlock};
436
+ `,oe=s([Vs("qti-simple-choice")],oe);import{consume as Hs}from"@lit-labs/context";import{html as Ds,LitElement as $s}from"lit";import{customElement as Os,property as Ps}from"lit/decorators.js";var ne=class extends $s{render(){return Ds`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(e){var r,o,n;let t=Array.from((o=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?o:[]).find(l=>l.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(n=t.textContent)!=null?n:"")}catch(l){console.error("custom-operator contains invalid javascript code",l)}}calculate(){let e={match:ee.match,variable:r=>{var o,n,l;return(l=(n=(o=this.context)==null?void 0:o.variables.find(c=>c.identifier===r))==null?void 0:n.value)!=null?l:""},correct:r=>{var o,n,l;return(l=(n=(o=this.context)==null?void 0:o.variables.find(c=>c.identifier===r))==null?void 0:n.correctResponse)!=null?l:""}},t={getVariable:r=>{var o;return(o=this.context)==null?void 0:o.variables.find(n=>n.identifier===r)},updateOutcomeVariable:(r,o)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:o}}))}};return this.operatorFunction(this.context,e,t)}};s([Hs({context:ae,subscribe:!0}),Ps({attribute:!1})],ne.prototype,"context",2),ne=s([Os("qti-custom-operator")],ne);export{Lt as Events,m as Interaction,te as QtPrintedVariable,Je as QtiAnd,q as QtiAssessmentItem,Le as QtiAssociableHotspot,re as QtiAssociateInteraction,ge as QtiBaseValue,x as QtiChoice,Tt as QtiChoiceElementSelected,U as QtiChoiceInteraction,le as QtiCompanionMaterialsInfo,k as QtiConditionExpression,Ze as QtiContains,Qe as QtiCorrect,ne as QtiCustomOperator,W as QtiEndAttemptInteraction,ve as QtiEqual,ye as QtiEqualRounded,u as QtiExpression,T as QtiExtendedTextInteraction,he as QtiFeedbackBlock,ue as QtiFeedbackInline,Ne as QtiGap,Ve as QtiGapImg,qe as QtiGapMatchInteraction,Me as QtiGapText,M as QtiGraphicAssociateInteraction,_e as QtiGraphicGapMatchInteraction,ke as QtiGraphicOrderInteraction,et as QtiGt,tt as QtiGte,se as QtiHotspotChoice,Re as QtiHotspotInteraction,He as QtiHottext,je as QtiHottextInteraction,vt as QtiInlineChoice,I as QtiInlineChoiceInteraction,qt as QtiInteractionChanged,St as QtiInteractionResponse,rt as QtiIsNull,wt as QtiLooseChoice,it as QtiLt,st as QtiLte,xe as QtiMapResponse,X as QtiMapping,ee as QtiMatch,j as QtiMatchInteraction,Ae as QtiMediaInteraction,nt as QtiMember,me as QtiModalFeedback,at as QtiMultiple,lt as QtiNot,ct as QtiOr,z as QtiOrderInteraction,pt as QtiOrdered,Ct as QtiOutcomeChanged,P as QtiOutcomeDeclaration,ht as QtiPortableCustomInteraction,Se as QtiPositionObjectStage,dt as QtiProduct,Pe as QtiPrompt,Rt as QtiRegisterChoice,At as QtiRegisterHotspot,kt as QtiRegisterInteraction,_t as QtiRegisterVariable,ze as QtiResponseCondition,O as QtiResponseDeclaration,J as QtiResponseElse,We as QtiResponseElseIf,Z as QtiResponseIf,F as QtiResponseProcessing,V as QtiRule,we as QtiSPositionObjectInteraction,D as QtiSelectPointInteraction,Ke as QtiSetOutcomeValue,bt as QtiSimpleAssociableChoice,oe as QtiSimpleChoice,E as QtiSliderInteraction,Ee as QtiStringMatch,Oe as QtiStylesheet,mt as QtiSum,w as QtiTextEntryInteraction,ut as QtiVariable,ae as itemContext,pe as qtiContentBody,S as qtiRubricBlock};