@citolab/qti-components 3.0.41 → 3.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,21 +1,21 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,s=require("lit"),i=require("lit/decorators.js"),n=require("lit/static-html.js"),r=require("lit/directives/if-defined.js"),o=require("lit/directives/ref.js");exports.BaseType=void 0,(e=exports.BaseType||(exports.BaseType={})).boolean="boolean",e.directedPair="directedPair",e.float="float",e.integer="integer",e.string="string",e.identifier="identifier",e.pair="pair",exports.Cardinality=void 0,(t=exports.Cardinality||(exports.Cardinality={})).multiple="multiple",t.ordered="ordered",t.single="single";const a={ON_OUTCOME_CHANGED:"on-outcome-changed",ON_INTERACTION_CHANGED:"on-interaction-changed",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"};class l{constructor({mapping:e,correctResponse:t,cardinality:s,baseType:i,identifier:n}){this._basetype=exports.BaseType.string,this._mapping=e,this._correctResponse=t,this._cardinality=s,this._basetype=i,this._identifier=n}static getCandidateResponse(e){return e[Object.keys(e)[0]][Object.keys(e[Object.keys(e)[0]])[0]]}get mapping(){return this._mapping}get correctResponse(){return this._correctResponse}get cardinality(){return this._cardinality}get baseType(){return this._basetype}get identifier(){return this._identifier}get value(){return this._candidateResponse}set value(e){this._candidateResponse=e}set qtiVariable(e){this._qtiVariable=e,this._candidateResponse=l.getCandidateResponse(e)}get qtiVariable(){return this._qtiVariable}}class c{}class d extends s.LitElement{emit(e,t){const s=new CustomEvent(e,Object.assign({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(s),s}err(e){throw e}}class p extends d{constructor(){super(),this.variables=[],this.feedbackElements=[],this.interactionElements=[],this.identifier="",this.addEventListener(a.ON_REGISTER_FEEDBACK,this.registerFeedbackElement),this.addEventListener(a.ON_REGISTER_INTERACTION,this.registerInteractionElement),this.addEventListener(a.ON_OUTCOME_CHANGED,this.outcomeChanged),this.addEventListener(a.ON_INTERACTION_RESPONSE,this.interactionResponse)}static get properties(){return{title:{type:String},identifier:{type:String},disabled:{type:Boolean},readonly:{type:Boolean}}}render(){return s.html`<slot></slot>`}updated(e){e.forEach(((e,t)=>{switch(t){case"disabled":this.interactionElements.forEach((e=>e.disabled=this.disabled));break;case"readonly":this.interactionElements.forEach((e=>e.readonly=this.readonly))}}))}disconnectedCallback(){this.removeEventListener(a.ON_REGISTER_FEEDBACK,this.registerFeedbackElement),this.removeEventListener(a.ON_REGISTER_INTERACTION,this.registerInteractionElement),this.removeEventListener(a.ON_OUTCOME_CHANGED,this.outcomeChanged),this.removeEventListener(a.ON_INTERACTION_RESPONSE,this.interactionResponse)}processResponse(){if(this.validateResponses()){const e=this.querySelector("qti-response-processing");return e?e.process?(e.process(),!0):(console.info("Client side response webcomponents not available"),!1):(console.info("Client side response processing template not available"),!1)}return console.info("Item is not valid, call validateResponses first"),!1}set responses(e){if(e){e.interactions.forEach((e=>{const t=this.interactionElements.find((t=>t.getAttribute("response-identifier")===e.responseIdentifier)),s=this.getResponse(e.responseIdentifier);s&&(s.qtiVariable=e.responses);const i=l.getCandidateResponse(e.responses);t.response=i}))}}resetInteractions(){this.interactionElements.forEach((e=>e.reset()))}validateResponses(){let e=!0;return this.interactionElements.forEach((t=>{t.validate()||(e=!1)})),e}getVariableValue(e){return this.variables.find((t=>t.identifier===e)).value}getResponse(e){const t=this.variables.find((t=>t.identifier===e));if(t instanceof l)return t;this.err(`qti-response-variable ${e} not found, make sure you registered it`)}getOutcome(e){const t=this.variables.find((t=>t.identifier===e));return t instanceof c?t:(this.err(`qti-outcome-variable ${e} not found, make sure you registered it`),null)}registerFeedbackElement(e){e.stopPropagation(),this.feedbackElements.push(e.detail)}registerInteractionElement(e){e.stopPropagation(),this.interactionElements.push(e.target)}interactionResponse(e){const t=this.getResponse(e.detail.responseIdentifier);t&&(t.qtiVariable=e.detail.responses),e.stopImmediatePropagation(),this.dispatchEvent(new CustomEvent(a.ON_INTERACTION_CHANGED,{bubbles:!0,composed:!0,detail:{item:this.getAttribute("identifier"),interaction:{responseIdentifier:e.detail.responseIdentifier,responses:e.detail.responses}}}))}outcomeChanged(e){this.feedbackElements.forEach((t=>{t.checkShowFeedback(e.detail.outcomeIdentifier,e.detail.value)}))}setOutcomeValue(e,t){const s=this.getOutcome(e);s?(s.value=t,this.dispatchEvent(new CustomEvent(a.ON_OUTCOME_CHANGED,{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:t}}))):this.err(`Can not set qti-outcome-identifier: ${e}, it is not available`)}}customElements.define("qti-assessment-item",p);class h extends s.LitElement{constructor(){super()}connectedCallback(){super.connectedCallback();const e=this.closest("qti-assessment-item"),t=this.getAttribute("href"),s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.media="screen",s.href=t,e.appendChild(s),this.styleLink=s}disconnectedCallback(){const e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(e){console.log("could not remove stylesheet")}}}customElements.define("qti-stylesheet",h);class u extends s.LitElement{render(){return s.html` <style>
2
- :host {
3
- display: block;
4
- }
5
- </style>
6
- <!--
7
- <header>
8
- <slot name="qti-rubric-block" />
9
- </header>
10
- -->
11
- <slot></slot>`}}customElements.define("qti-item-body",u);class m extends s.LitElement{render(){return s.html` <slot></slot> `}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}}function f(e,t,s,i){var n,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,s,o):n(t,s))||o);return r>3&&o&&Object.defineProperty(t,s,o),o}function g(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function b(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))}function x(e,t){const s=Object.assign({waitUntilFirstUpdate:!1},t);return(t,i)=>{const{update:n}=t;if(e in t){const r=e;t.update=function(e){if(e.has(r)){const t=e.get(r),n=this[r];t!==n&&(s.waitUntilFirstUpdate&&!this.hasUpdated||this[i](t,n))}n.call(this,e)}}}}customElements.define("qti-prompt",m);const y=32;exports.QtiChoice=class extends d{constructor(){super(...arguments),this.tabindex=0,this.disabled=!1,this.readonly=!1,this.checked=!1}handleDisabledChange(e,t){t?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.emit(a.ON_REGISTER_CHOICE)}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.emit(a.ON_LOOSE_CHOICE)}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){e.altKey||e.keyCode===y&&(e.preventDefault(),this._toggleChecked())}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.emit(a.ON_CHOICE_ELEMENT_SELECTED,{detail:{identifier:this.identifier,checked:this.checked}}))}render(){return n.html` <slot></slot> `}},f([i.property({reflect:!0}),g("design:type",String)],exports.QtiChoice.prototype,"identifier",void 0),f([i.property({type:Number,reflect:!0}),g("design:type",Object)],exports.QtiChoice.prototype,"tabindex",void 0),f([i.property({type:Boolean,reflect:!0}),g("design:type",Object)],exports.QtiChoice.prototype,"disabled",void 0),f([i.property({type:Boolean,reflect:!0}),g("design:type",Object)],exports.QtiChoice.prototype,"readonly",void 0),f([i.property({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>`${e}`}}),g("design:type",Object)],exports.QtiChoice.prototype,"checked",void 0),f([x("disabled",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Boolean]),g("design:returntype",void 0)],exports.QtiChoice.prototype,"handleDisabledChange",null),exports.QtiChoice=f([i.customElement("qti-choice")],exports.QtiChoice);class E extends s.LitElement{render(){return s.html``}}customElements.define("qti-variabledeclaration",E);class v extends E{static get properties(){return{baseType:{type:String,attribute:"base-type"},identifier:{type:String,attribute:"identifier"},cardinality:{type:String,attribute:"cardinality"}}}connectedCallback(){super.connectedCallback();const e=new l({baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||exports.Cardinality.single,mapping:this.mapping});this.closest("qti-assessment-item").variables.push(e)}get correctResponse(){let e;const t=this.querySelector("qti-correct-response");if(t){const s=t.querySelectorAll("qti-value");if(1===s.length)e=s[0].textContent,s[0].remove();else{e=[];for(let t=0;t<s.length;t++)e.push(s[t].textContent),s[t].remove()}}return e}get mapping(){const e=this.querySelector("qti-mapping");if(e){const t=new Map,s=e.querySelectorAll("qti-map-entry");for(let e=0;e<s.length;e++){const i=s[e],n=i.getAttribute("map-key"),r=i.getAttribute("mapped-value");t.set(n,r?parseFloat(r):null)}return t}return null}}customElements.define("qti-response-declaration",v);class C extends E{static get observedAttributes(){return["identifier","cardinality","base-type"]}connectedCallback(){super.connectedCallback();const e=this.getAttribute("identifier"),t=new c;t.identifier=e;this.closest("qti-assessment-item").variables.push(t)}}customElements.define("qti-outcome-declaration",C),exports.qtiCompanionMaterialsInfo=class extends d{},exports.qtiCompanionMaterialsInfo=f([i.customElement("qti-companion-materials-info")],exports.qtiCompanionMaterialsInfo),exports.qtiRubricBlock=class extends d{},exports.qtiRubricBlock=f([i.customElement("qti-rubric-block")],exports.qtiRubricBlock),exports.qtiContentBody=class extends d{},exports.qtiContentBody=f([i.customElement("qti-content-body")],exports.qtiContentBody);class q extends s.LitElement{constructor(){super(),this.showHide="show",this.showFeedback("hide"===this.showHide)}static get properties(){return{showStatus:{type:String,attribute:!0,reflect:!0},showHide:{type:String,attribute:"show-hide"},outcomeIdentifier:{type:String,attribute:"outcome-identifier"},identifier:{type:String}}}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(a.ON_REGISTER_FEEDBACK,{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e,t){this.outcomeIdentifier===e&&(t instanceof Array?this.showFeedback(-1!==t.indexOf(this.identifier)):this.showFeedback(this.identifier===t))}showFeedback(e){this.showStatus=e?"on":"off"}}class _ extends q{constructor(){super(...arguments),this.render=()=>s.html` <slot class="${this.showStatus}"></slot> `}}_.styles=s.css`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,s=require("lit"),i=require("lit/decorators.js"),n=require("lit/static-html.js"),r=require("@lit-labs/context"),o=require("lit/directives/if-defined.js"),a=require("lit/directives/ref.js");exports.BaseType=void 0,(e=exports.BaseType||(exports.BaseType={})).boolean="boolean",e.directedPair="directedPair",e.float="float",e.integer="integer",e.string="string",e.identifier="identifier",e.pair="pair",exports.Cardinality=void 0,(t=exports.Cardinality||(exports.Cardinality={})).multiple="multiple",t.ordered="ordered",t.single="single";const l={ON_OUTCOME_CHANGED:"on-outcome-changed",ON_INTERACTION_CHANGED:"on-interaction-changed",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"};class c{constructor({mapping:e,correctResponse:t,cardinality:s,baseType:i,identifier:n}){this._basetype=exports.BaseType.string,this._mapping=e,this._correctResponse=t,this._cardinality=s,this._basetype=i,this._identifier=n}static getCandidateResponse(e){return e[Object.keys(e)[0]][Object.keys(e[Object.keys(e)[0]])[0]]}get mapping(){return this._mapping}get correctResponse(){return this._correctResponse}get cardinality(){return this._cardinality}get baseType(){return this._basetype}get identifier(){return this._identifier}get value(){return this._candidateResponse}set value(e){this._candidateResponse=e}set qtiVariable(e){this._qtiVariable=e,this._candidateResponse=c.getCandidateResponse(e)}get qtiVariable(){return this._qtiVariable}}class d{}class p extends s.LitElement{emit(e,t){const s=new CustomEvent(e,Object.assign({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(s),s}err(e){throw e}}class h extends p{constructor(){super(),this.variables=[],this.feedbackElements=[],this.interactionElements=[],this.identifier="",this.addEventListener(l.ON_REGISTER_FEEDBACK,this.registerFeedbackElement),this.addEventListener(l.ON_REGISTER_INTERACTION,this.registerInteractionElement),this.addEventListener(l.ON_OUTCOME_CHANGED,this.outcomeChanged),this.addEventListener(l.ON_INTERACTION_RESPONSE,this.interactionResponse)}static get properties(){return{title:{type:String},identifier:{type:String},disabled:{type:Boolean},readonly:{type:Boolean}}}render(){return s.html`<slot></slot>`}updated(e){e.forEach(((e,t)=>{switch(t){case"disabled":this.interactionElements.forEach((e=>e.disabled=this.disabled));break;case"readonly":this.interactionElements.forEach((e=>e.readonly=this.readonly))}}))}disconnectedCallback(){this.removeEventListener(l.ON_REGISTER_FEEDBACK,this.registerFeedbackElement),this.removeEventListener(l.ON_REGISTER_INTERACTION,this.registerInteractionElement),this.removeEventListener(l.ON_OUTCOME_CHANGED,this.outcomeChanged),this.removeEventListener(l.ON_INTERACTION_RESPONSE,this.interactionResponse)}processResponse(){if(this.validateResponses()){const e=this.querySelector("qti-response-processing");return e?e.process?(e.process(),!0):(console.info("Client side response webcomponents not available"),!1):(console.info("Client side response processing template not available"),!1)}return console.info("Item is not valid, call validateResponses first"),!1}set responses(e){if(e){e.interactions.forEach((e=>{const t=this.interactionElements.find((t=>t.getAttribute("response-identifier")===e.responseIdentifier)),s=this.getResponse(e.responseIdentifier);s&&(s.qtiVariable=e.responses);const i=c.getCandidateResponse(e.responses);t.response=i}))}}resetInteractions(){this.interactionElements.forEach((e=>e.reset()))}validateResponses(){let e=!0;return this.interactionElements.forEach((t=>{t.validate()||(e=!1)})),e}getVariableValue(e){return this.variables.find((t=>t.identifier===e)).value}getResponse(e){const t=this.variables.find((t=>t.identifier===e));if(t instanceof c)return t;this.err(`qti-response-variable ${e} not found, make sure you registered it`)}getOutcome(e){const t=this.variables.find((t=>t.identifier===e));return t instanceof d?t:(this.err(`qti-outcome-variable ${e} not found, make sure you registered it`),null)}registerFeedbackElement(e){e.stopPropagation(),this.feedbackElements.push(e.detail)}registerInteractionElement(e){e.stopPropagation(),this.interactionElements.push(e.target)}interactionResponse(e){const t=this.getResponse(e.detail.responseIdentifier);t&&(t.qtiVariable=e.detail.responses),e.stopImmediatePropagation(),this.dispatchEvent(new CustomEvent(l.ON_INTERACTION_CHANGED,{bubbles:!0,composed:!0,detail:{item:this.getAttribute("identifier"),interaction:{responseIdentifier:e.detail.responseIdentifier,responses:e.detail.responses}}}))}outcomeChanged(e){this.feedbackElements.forEach((t=>{t.checkShowFeedback(e.detail.outcomeIdentifier,e.detail.value)}))}setOutcomeValue(e,t){const s=this.getOutcome(e);s?(s.value=t,this.dispatchEvent(new CustomEvent(l.ON_OUTCOME_CHANGED,{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:t}}))):this.err(`Can not set qti-outcome-identifier: ${e}, it is not available`)}}customElements.define("qti-assessment-item",h);class u extends s.LitElement{constructor(){super()}connectedCallback(){super.connectedCallback();const e=this.closest("qti-assessment-item"),t=this.getAttribute("href"),s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.media="screen",s.href=t,e.appendChild(s),this.styleLink=s}disconnectedCallback(){const e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(e){console.log("could not remove stylesheet")}}}function m(e,t,s,i){var n,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r<3?n(o):r>3?n(t,s,o):n(t,s))||o);return r>3&&o&&Object.defineProperty(t,s,o),o}function g(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function b(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))}customElements.define("qti-stylesheet",u),exports.QtiItemBody=class extends s.LitElement{render(){return s.html`
2
+ <slot name="qti-rubric-block"></slot>
3
+ <slot></slot>`}},exports.QtiItemBody.styles=s.css`
4
+ :host {
5
+ display: block;
6
+ }
7
+ `,exports.QtiItemBody=m([i.customElement("qti-item-body")],exports.QtiItemBody);class f extends s.LitElement{render(){return s.html` <slot></slot> `}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}}function y(e,t){const s=Object.assign({waitUntilFirstUpdate:!1},t);return(t,i)=>{const{update:n}=t;if(e in t){const r=e;t.update=function(e){if(e.has(r)){const t=e.get(r),n=this[r];t!==n&&(s.waitUntilFirstUpdate&&!this.hasUpdated||this[i](t,n))}n.call(this,e)}}}}customElements.define("qti-prompt",f);const x=32;exports.QtiChoice=class extends p{constructor(){super(...arguments),this.tabindex=0,this.disabled=!1,this.readonly=!1,this.checked=!1}handleDisabledChange(e,t){t?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.emit(l.ON_REGISTER_CHOICE)}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.emit(l.ON_LOOSE_CHOICE)}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){e.altKey||e.keyCode===x&&(e.preventDefault(),this._toggleChecked())}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.emit(l.ON_CHOICE_ELEMENT_SELECTED,{detail:{identifier:this.identifier,checked:this.checked}}))}render(){return n.html` <slot></slot> `}},m([i.property({reflect:!0}),g("design:type",String)],exports.QtiChoice.prototype,"identifier",void 0),m([i.property({type:Number,reflect:!0}),g("design:type",Object)],exports.QtiChoice.prototype,"tabindex",void 0),m([i.property({type:Boolean,reflect:!0}),g("design:type",Object)],exports.QtiChoice.prototype,"disabled",void 0),m([i.property({type:Boolean,reflect:!0}),g("design:type",Object)],exports.QtiChoice.prototype,"readonly",void 0),m([i.property({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>`${e}`}}),g("design:type",Object)],exports.QtiChoice.prototype,"checked",void 0),m([y("disabled",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Boolean]),g("design:returntype",void 0)],exports.QtiChoice.prototype,"handleDisabledChange",null),exports.QtiChoice=m([i.customElement("qti-choice")],exports.QtiChoice);class v extends s.LitElement{render(){return s.html``}}customElements.define("qti-variabledeclaration",v);class E extends v{static get properties(){return{baseType:{type:String,attribute:"base-type"},identifier:{type:String,attribute:"identifier"},cardinality:{type:String,attribute:"cardinality"}}}connectedCallback(){super.connectedCallback();const e=new c({baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||exports.Cardinality.single,mapping:this.mapping});this.closest("qti-assessment-item").variables.push(e)}get correctResponse(){let e;const t=this.querySelector("qti-correct-response");if(t){const s=t.querySelectorAll("qti-value");if(1===s.length)e=s[0].textContent,s[0].remove();else{e=[];for(let t=0;t<s.length;t++)e.push(s[t].textContent),s[t].remove()}}return e}get mapping(){const e=this.querySelector("qti-mapping");if(e){const t=new Map,s=e.querySelectorAll("qti-map-entry");for(let e=0;e<s.length;e++){const i=s[e],n=i.getAttribute("map-key"),r=i.getAttribute("mapped-value");t.set(n,r?parseFloat(r):null)}return t}return null}}customElements.define("qti-response-declaration",E);class C extends v{static get observedAttributes(){return["identifier","cardinality","base-type"]}connectedCallback(){super.connectedCallback();const e=this.getAttribute("identifier"),t=new d;t.identifier=e;this.closest("qti-assessment-item").variables.push(t)}}customElements.define("qti-outcome-declaration",C),exports.QtiCompanionMaterialsInfo=class extends p{},exports.QtiCompanionMaterialsInfo=m([i.customElement("qti-companion-materials-info")],exports.QtiCompanionMaterialsInfo);const q=r.createContext("logger");exports.qtiRubricBlock=class extends p{constructor(){super(...arguments),this.logger=new r.ContextConsumer(this,q,void 0,!0)}handleclassNamesChange(e,t){this.classNames.split(" ").forEach((e=>{switch(e){case"qti-rubric-discretionary-placement":default:this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","")}}))}render(){return s.html`<slot></slot>`}connectedCallback(){var e;super.connectedCallback(),this.view===(null===(e=this.logger.value)||void 0===e?void 0:e.view)?this.style.visibility="visible":this.style.visibility="hidden"}},exports.qtiRubricBlock.styles=s.css`
8
+ :host {
9
+ display: block;
10
+ }
11
+ `,m([i.property({type:String}),g("design:type",Object)],exports.qtiRubricBlock.prototype,"id",void 0),m([i.property({type:String}),g("design:type",String)],exports.qtiRubricBlock.prototype,"use",void 0),m([i.property({type:String}),g("design:type",String)],exports.qtiRubricBlock.prototype,"view",void 0),m([i.property({type:String,attribute:"class"}),g("design:type",Object)],exports.qtiRubricBlock.prototype,"classNames",void 0),m([y("classNames",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Boolean]),g("design:returntype",void 0)],exports.qtiRubricBlock.prototype,"handleclassNamesChange",null),exports.qtiRubricBlock=m([i.customElement("qti-rubric-block")],exports.qtiRubricBlock),exports.qtiContentBody=class extends p{render(){return s.html`<slot></slot>`}},exports.qtiContentBody=m([i.customElement("qti-content-body")],exports.qtiContentBody);class _ extends s.LitElement{constructor(){super(),this.showHide="show",this.showFeedback("hide"===this.showHide)}static get properties(){return{showStatus:{type:String,attribute:!0,reflect:!0},showHide:{type:String,attribute:"show-hide"},outcomeIdentifier:{type:String,attribute:"outcome-identifier"},identifier:{type:String}}}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(l.ON_REGISTER_FEEDBACK,{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e,t){this.outcomeIdentifier===e&&(t instanceof Array?this.showFeedback(-1!==t.indexOf(this.identifier)):this.showFeedback(this.identifier===t))}showFeedback(e){this.showStatus=e?"on":"off"}}class S extends _{constructor(){super(...arguments),this.render=()=>s.html` <slot class="${this.showStatus}"></slot> `}}S.styles=s.css`
12
12
  .on {
13
13
  display: inline-block;
14
14
  }
15
15
  .off {
16
16
  display: none;
17
17
  }
18
- `,customElements.define("qti-feedback-inline",_);class S extends q{render(){return s.html`
18
+ `,customElements.define("qti-feedback-inline",S);class O extends _{render(){return s.html`
19
19
  <style>
20
20
  .on {
21
21
  display: inline-block;
@@ -27,7 +27,7 @@
27
27
  <div class="feedback ${this.showStatus}">
28
28
  <slot></slot>
29
29
  </div>
30
- `}}customElements.define("qti-modal-feedback",S);class O extends d{constructor(){super(...arguments),this.responseIdentifier="",this.disabled=!1,this.readonly=!1}connectedCallback(){super.connectedCallback(),this.emit(a.ON_REGISTER_INTERACTION)}saveResponse(e){this.emit(a.ON_INTERACTION_RESPONSE,{detail:{responseIdentifier:this.responseIdentifier,responses:e}})}}f([i.property({attribute:"response-identifier"}),g("design:type",Object)],O.prototype,"responseIdentifier",void 0),f([i.property({reflect:!0,type:Boolean}),g("design:type",Object)],O.prototype,"disabled",void 0),f([i.property({reflect:!0,type:Boolean}),g("design:type",Object)],O.prototype,"readonly",void 0);const R=s.css`
30
+ `}}customElements.define("qti-modal-feedback",O);class k extends p{constructor(){super(...arguments),this.responseIdentifier="",this.disabled=!1,this.readonly=!1}connectedCallback(){super.connectedCallback(),this.emit(l.ON_REGISTER_INTERACTION)}saveResponse(e){this.emit(l.ON_INTERACTION_RESPONSE,{detail:{responseIdentifier:this.responseIdentifier,responses:e}})}}m([i.property({attribute:"response-identifier"}),g("design:type",Object)],k.prototype,"responseIdentifier",void 0),m([i.property({reflect:!0,type:Boolean}),g("design:type",Object)],k.prototype,"disabled",void 0),m([i.property({reflect:!0,type:Boolean}),g("design:type",Object)],k.prototype,"readonly",void 0);const R=s.css`
31
31
  /***
32
32
  The new CSS reset - version 1.4.9 (last updated 11.2.2022)
33
33
  GitHub page: https://github.com/elad2412/the-new-css-reset
@@ -107,7 +107,7 @@
107
107
  :where([draggable='true']) {
108
108
  -webkit-user-drag: element;
109
109
  }
110
- `;class k extends O{constructor(){super(),this.value=""}static get properties(){return Object.assign(Object.assign({},O.properties),{expectedLength:{type:Number,attribute:"expected-length"},patternMask:{type:String,attribute:"pattern-mask"},placeholderText:{type:String,attribute:"placeholder-text"},value:{type:String}})}set response(e){this.value=void 0!==e?e:""}validate(){return""!==this.value}static get styles(){return[R,s.css`
110
+ `;class w extends k{constructor(){super(),this.value=""}static get properties(){return Object.assign(Object.assign({},k.properties),{expectedLength:{type:Number,attribute:"expected-length"},patternMask:{type:String,attribute:"pattern-mask"},placeholderText:{type:String,attribute:"placeholder-text"},value:{type:String}})}set response(e){this.value=void 0!==e?e:""}validate(){return""!==this.value}static get styles(){return[R,s.css`
111
111
  /* PK: display host as block, else design will be collapsed */
112
112
  :host {
113
113
  display: inline-block;
@@ -123,13 +123,13 @@
123
123
  @keyup="${this.textChanged}"
124
124
  @change="${this.textChanged}"
125
125
  type="text"
126
- placeholder="${r.ifDefined(this.placeholderText?this.placeholderText:void 0)}"
126
+ placeholder="${o.ifDefined(this.placeholderText?this.placeholderText:void 0)}"
127
127
  .value="${this.value}"
128
- size="${r.ifDefined(this.expectedLength?this.expectedLength:void 0)}"
129
- pattern="${r.ifDefined(this.patternMask?this.patternMask:void 0)}"
128
+ size="${o.ifDefined(this.expectedLength?this.expectedLength:void 0)}"
129
+ pattern="${o.ifDefined(this.patternMask?this.patternMask:void 0)}"
130
130
  ?disabled="${this.disabled}"
131
131
  ?readonly="${this.readonly}"
132
- />`}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.setEmptyAttribute(t.value),this.value=t.value,this.saveResponse({base:{string:t.value}})}reset(){this.value=""}setEmptyAttribute(e){this.setAttribute("empty",""===e?"true":"false")}}k.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],customElements.define("qti-text-entry-interaction",k);class T extends O{constructor(){super(...arguments),this.value="",this.textareaRef=o.createRef()}static get properties(){return Object.assign(Object.assign({},O.properties),{expectedLength:{type:Number,attribute:"expected-length"},patternMask:{type:String,attribute:"pattern-mask"},placeholderText:{type:String,attribute:"placeholder-text"},value:{type:String},classNames:{type:String,attribute:"class"}})}updated(e){e.has("classNames")&&this.changeRowsOnClassChange()}changeRowsOnClassChange(){this.classNames.split(" ").forEach((e=>{if(e.startsWith("qti-height-lines")){const t=e.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(t))}}))}set response(e){this.value=void 0!==e?e:""}validate(){return""!==this.value}static get styles(){return[R,s.css`
132
+ />`}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.setEmptyAttribute(t.value),this.value=t.value,this.saveResponse({base:{string:t.value}})}reset(){this.value=""}setEmptyAttribute(e){this.setAttribute("empty",""===e?"true":"false")}}w.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],customElements.define("qti-text-entry-interaction",w);class I extends k{constructor(){super(...arguments),this.textareaRef=a.createRef(),this.value=""}handleclassNamesChange(e,t){this.classNames.split(" ").forEach((e=>{if(e.startsWith("qti-height-lines")){const t=e.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(t))}}))}set response(e){this.value=void 0!==e?e:""}validate(){return""!==this.value}static get styles(){return[R,s.css`
133
133
  /* PK: display host as block, else design will be collapsed */
134
134
  :host {
135
135
  display: block;
@@ -140,20 +140,19 @@
140
140
  height: 100%;
141
141
  }
142
142
  `]}render(){return s.html`<textarea
143
- ${o.ref(this.textareaRef)}
143
+ ${a.ref(this.textareaRef)}
144
144
  spellcheck="false"
145
145
  autocomplete="off"
146
146
  @keydown="${e=>e.stopImmediatePropagation()}"
147
147
  @keyup="${this.textChanged}"
148
148
  @change="${this.textChanged}"
149
- placeholder="${r.ifDefined(this.placeholderText?this.placeholderText:void 0)}"
150
- maxlength="${r.ifDefined(this.expectedLength?this.expectedLength:void 0)}"
151
- pattern="${r.ifDefined(this.patternMask?this.patternMask:void 0)}"
149
+ placeholder="${o.ifDefined(this.placeholderText?this.placeholderText:void 0)}"
150
+ maxlength="${o.ifDefined(this.expectedLength?this.expectedLength:void 0)}"
151
+ pattern="${o.ifDefined(this.patternMask?this.patternMask:void 0)}"
152
152
  ?disabled="${this.disabled}"
153
153
  ?readonly="${this.readonly}"
154
154
  .value=${this.value}
155
- ></textarea
156
- >`}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.setEmptyAttribute(t.value),this.value=t.value,this.saveResponse({base:{string:t.value}})}reset(){this.value=""}setEmptyAttribute(e){this.setAttribute("empty",""===e?"true":"false")}}T.rowHeightClass=["","qti-height-lines-3","qti-height-lines-6","qti-height-lines-15"],customElements.define("qti-extended-text-interaction",T),exports.QtiHottext=class extends exports.QtiChoice{},exports.QtiHottext=f([i.customElement("qti-hottext")],exports.QtiHottext);class w extends O{constructor(){super(),this._choiceElements=[],this._minChoices=0,this._maxChoices=1,this._handleDisabledChange=(e,t)=>this._choiceElements.forEach((e=>e.disabled=t)),this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach((e=>e.readonly=t)),this._handleMaxChoicesChange=()=>this._determineInputType(),this.addEventListener(a.ON_REGISTER_CHOICE,this._registerChoiceElement),this.addEventListener(a.ON_LOOSE_CHOICE,this._looseChoiceElement)}reset(){this._choiceElements.forEach((e=>{e.reset()}))}validate(){return this._choiceElements.reduce(((e,t)=>e+(!0===t.checked?1:0)),0)>=this._minChoices}set response(e){this._choiceElements.forEach((e=>{e.checked=!1}));(Array.isArray(e)?e:[e]).forEach((e=>{const t=this.querySelector("[identifier='"+e+"']");t&&(t.checked=!0)}))}connectedCallback(){super.connectedCallback(),this.addEventListener(a.ON_CHOICE_ELEMENT_SELECTED,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(a.ON_CHOICE_ELEMENT_SELECTED,this._choiceElementSelectedHandler),this.removeEventListener(a.ON_REGISTER_CHOICE,this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();const t=e.target;this._choiceElements.push(t),this._setInputType(t)}_looseChoiceElement(e){e.stopPropagation();const t=e.target;this._choiceElements.push(t),this._choiceElements=this._choiceElements.filter((e=>e!==t))}_determineInputType(){this._choiceElements.forEach((e=>{this._setInputType(e)}))}_setInputType(e){1===this._maxChoices?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){1===this._maxChoices&&this._choiceElements.filter((t=>t.identifier!==e.detail.identifier)).forEach((e=>{e.checked=!1})),this._choiceElementSelected()}_choiceElementSelected(){const e=this._choiceElements.filter((e=>1==e.checked)).map((e=>e.identifier));let t;this._maxChoices>1&&(this._maxChoices===e.length?this._choiceElements.forEach((e=>e.disabled=!(1==e.checked))):this._choiceElements.forEach((e=>e.disabled=!1))),t=1===this._maxChoices?{base:{identifier:e.length>0?e[0]:""}}:{list:{identifier:e}},this.saveResponse(t)}}f([i.property({type:Number,attribute:"min-choices"}),g("design:type",Number)],w.prototype,"_minChoices",void 0),f([i.property({type:Number,attribute:"max-choices"}),g("design:type",Number)],w.prototype,"_maxChoices",void 0),f([x("disabled",{waitUntilFirstUpdate:!0}),g("design:type",Object)],w.prototype,"_handleDisabledChange",void 0),f([x("readonly",{waitUntilFirstUpdate:!0}),g("design:type",Object)],w.prototype,"_handleReadonlyChange",void 0),f([x("_maxChoices",{waitUntilFirstUpdate:!0}),g("design:type",Object)],w.prototype,"_handleMaxChoicesChange",void 0);class I extends w{constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}}customElements.define("qti-hottext-interaction",I);class A extends O{constructor(){super(),this.options=[],this.addEventListener(a.ON_DROPDOWN_SELECTED,this.choiceSelected);const e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:"select",value:"",selected:!1},...e.map((e=>({textContent:e.innerHTML,value:e.getAttribute("identifier"),selected:!1})))]}static get properties(){return Object.assign(Object.assign({},O.properties),{options:{type:Array,value:[],attribute:!1}})}connectedCallback(){super.connectedCallback()}static get styles(){return[R,s.css`
155
+ ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.setEmptyAttribute(t.value),this.value=t.value,this.saveResponse({base:{string:t.value}})}reset(){this.value=""}setEmptyAttribute(e){this.setAttribute("empty",""===e?"true":"false")}}I.rowHeightClass=["","qti-height-lines-3","qti-height-lines-6","qti-height-lines-15"],m([i.property({type:Number,attribute:"expected-length"}),g("design:type",Object)],I.prototype,"expectedLength",void 0),m([i.property({type:String,attribute:"pattern-mask"}),g("design:type",Object)],I.prototype,"patternMask",void 0),m([i.property({type:String,attribute:"placeholder-text"}),g("design:type",Object)],I.prototype,"placeholderText",void 0),m([i.property({type:String}),g("design:type",Object)],I.prototype,"value",void 0),m([i.property({type:String,attribute:"class"}),g("design:type",Object)],I.prototype,"classNames",void 0),m([y("classNames",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Boolean]),g("design:returntype",void 0)],I.prototype,"handleclassNamesChange",null),customElements.define("qti-extended-text-interaction",I),exports.QtiHottext=class extends exports.QtiChoice{},exports.QtiHottext=m([i.customElement("qti-hottext")],exports.QtiHottext);class T extends k{constructor(){super(),this._choiceElements=[],this._minChoices=0,this._maxChoices=1,this._handleDisabledChange=(e,t)=>this._choiceElements.forEach((e=>e.disabled=t)),this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach((e=>e.readonly=t)),this._handleMaxChoicesChange=()=>this._determineInputType(),this.addEventListener(l.ON_REGISTER_CHOICE,this._registerChoiceElement),this.addEventListener(l.ON_LOOSE_CHOICE,this._looseChoiceElement)}reset(){this._choiceElements.forEach((e=>{e.reset()}))}validate(){return this._choiceElements.reduce(((e,t)=>e+(!0===t.checked?1:0)),0)>=this._minChoices}set response(e){this._choiceElements.forEach((e=>{e.checked=!1}));(Array.isArray(e)?e:[e]).forEach((e=>{const t=this.querySelector("[identifier='"+e+"']");t&&(t.checked=!0)}))}connectedCallback(){super.connectedCallback(),this.addEventListener(l.ON_CHOICE_ELEMENT_SELECTED,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(l.ON_CHOICE_ELEMENT_SELECTED,this._choiceElementSelectedHandler),this.removeEventListener(l.ON_REGISTER_CHOICE,this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();const t=e.target;this._choiceElements.push(t),this._setInputType(t)}_looseChoiceElement(e){e.stopPropagation();const t=e.target;this._choiceElements.push(t),this._choiceElements=this._choiceElements.filter((e=>e!==t))}_determineInputType(){this._choiceElements.forEach((e=>{this._setInputType(e)}))}_setInputType(e){1===this._maxChoices?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){1===this._maxChoices&&this._choiceElements.filter((t=>t.identifier!==e.detail.identifier)).forEach((e=>{e.checked=!1})),this._choiceElementSelected()}_choiceElementSelected(){const e=this._choiceElements.filter((e=>1==e.checked)).map((e=>e.identifier));let t;this._maxChoices>1&&(this._maxChoices===e.length?this._choiceElements.forEach((e=>e.disabled=!(1==e.checked))):this._choiceElements.forEach((e=>e.disabled=!1))),t=1===this._maxChoices?{base:{identifier:e.length>0?e[0]:""}}:{list:{identifier:e}},this.saveResponse(t)}}m([i.property({type:Number,attribute:"min-choices"}),g("design:type",Number)],T.prototype,"_minChoices",void 0),m([i.property({type:Number,attribute:"max-choices"}),g("design:type",Number)],T.prototype,"_maxChoices",void 0),m([y("disabled",{waitUntilFirstUpdate:!0}),g("design:type",Object)],T.prototype,"_handleDisabledChange",void 0),m([y("readonly",{waitUntilFirstUpdate:!0}),g("design:type",Object)],T.prototype,"_handleReadonlyChange",void 0),m([y("_maxChoices",{waitUntilFirstUpdate:!0}),g("design:type",Object)],T.prototype,"_handleMaxChoicesChange",void 0);class A extends T{constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}}customElements.define("qti-hottext-interaction",A);class N extends k{constructor(){super(),this.options=[],this.addEventListener(l.ON_DROPDOWN_SELECTED,this.choiceSelected);const e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:"select",value:"",selected:!1},...e.map((e=>({textContent:e.innerHTML,value:e.getAttribute("identifier"),selected:!1})))]}static get properties(){return Object.assign(Object.assign({},k.properties),{options:{type:Array,value:[],attribute:!1}})}connectedCallback(){super.connectedCallback()}static get styles(){return[R,s.css`
157
156
  :host {
158
157
  display: inline-block;
159
158
  }
@@ -171,10 +170,10 @@
171
170
  ${this.options.map((e=>s.html`
172
171
  <option value="${e.value}" ?selected="${e.selected}">${e.textContent}</option>
173
172
  `))}
174
- </select>`}validate(){const e=this.options.find((e=>e.selected));return!!e&&""!==e.value}reset(){this.options=this.options.map(((e,t)=>Object.assign(Object.assign({},e),{selected:0===t})))}set response(e){this.options=this.options.map((t=>(e===t.value&&(t.selected=!0),t)))}choiceSelected(e){const t=e.target.value;this.options=this.options.map((e=>Object.assign(Object.assign({},e),{selected:e.value===t}))),this.saveResponse({base:{string:t}})}}A.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],customElements.define("qti-inline-choice-interaction",A);class N extends w{constructor(){super(...arguments),this._shuffle=!1,this.render=()=>s.html`
173
+ </select>`}validate(){const e=this.options.find((e=>e.selected));return!!e&&""!==e.value}reset(){this.options=this.options.map(((e,t)=>Object.assign(Object.assign({},e),{selected:0===t})))}set response(e){this.options=this.options.map((t=>(e===t.value&&(t.selected=!0),t)))}choiceSelected(e){const t=e.target.value;this.options=this.options.map((e=>Object.assign(Object.assign({},e),{selected:e.value===t}))),this.saveResponse({base:{string:t}})}}N.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],customElements.define("qti-inline-choice-interaction",N);class L extends T{constructor(){super(...arguments),this._shuffle=!1,this.render=()=>s.html`
175
174
  <slot name="prompt"></slot>
176
- <slot></slot>`}}N.layoutClass=["","qti-choices-stacking-2","qti-choices-stacking-3","qti-choices-stacking-4","qti-orientation-vertical","qti-orientation-horizontal"],N.presentationClass=["","qti-input-control-hidden"],f([i.property({attribute:"orientation"}),g("design:type",String)],N.prototype,"_orientation",void 0),f([i.property({attribute:"shuffle",type:Boolean}),g("design:type",Boolean)],N.prototype,"_shuffle",void 0),customElements.define("qti-choice-interaction",N),exports.QtiSimpleChoice=class extends exports.QtiChoice{},exports.QtiSimpleChoice=f([i.customElement("qti-simple-choice")],exports.QtiSimpleChoice);class L extends s.LitElement{render(){return s.html`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){const e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0.0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response identifier="RESPONSE"> </qti-map-response>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"map_response_point":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"match_correct":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-match>\n <qti-variable identifier="RESPONSE"></qti-variable>\n <qti-correct identifier="RESPONSE"></qti-correct>\n </qti-match>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">1</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'))}}const e=[...this.children];for(let t=0;t<e.length;t++){e[t].process()}}fragmentFromString(e){return document.createRange().createContextualFragment(e)}}customElements.define("qti-response-processing",L);class M extends s.LitElement{render(){return s.html``}process(){throw new Error("Not implemented")}}customElements.define("qti-rule",M);class $ extends M{render(){return s.html`<slot></slot>`}process(){const e=[...this.children];for(let t=0;t<e.length;t++){const s=e[t];if(s.calculate())return void s.process()}}}customElements.define("qti-response-condition",$);class H extends s.LitElement{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return s.html`
177
- <slot></slot>`}calculate(){return this.debugCalculateResult=!0,!0}getSubRules(){return[...this.children]}process(){const e=this.getSubRules();for(let t=0;t<e.length;t++){e[t].process()}}}customElements.define("qti-response-else",H);class Q extends H{render(){return s.html`${super.render()}`}calculate(){const e=this.firstElementChild.calculate();return this.debugCalculateResult=e,e}getSubRules(){const e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}}customElements.define("qti-response-if",Q);class D extends Q{render(){return s.html`${super.render()}`}}customElements.define("qti-response-else-if",D);class P extends d{render(){return s.html``}calculate(){throw new Error("Not implemented")}}customElements.define("qti-expression",P);class j extends P{calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Response ${e} can not be found`),null;const s=t.mapping,i=t.value;let n=0;if(Array.isArray(i)){for(let e=0;e<i.length;e++)n+=B(s,i[e],t.baseType);return n}return n+=B(s,i,t.baseType),n}}function B(e,t,s){let i=0;for(const n of e.entries()){const{entryTyped:e,valueTyped:r}=F(s,n,t);e===r&&(i+=n[1])}return i}function F(e,t,s){let i,n;switch(e){case exports.BaseType.string:case exports.BaseType.identifier:case exports.BaseType.directedPair:i=""+t[0],n=""+s;break;case exports.BaseType.float:i=parseFloat(t[0].replace(",",".")),n=parseFloat(s.replace(",","."));break;default:console.warn("no base-type identifier")}return{entryTyped:i,valueTyped:n}}customElements.define("qti-map-response",j);class U extends M{process(){const e=this.getAttribute("identifier"),t=this.firstElementChild,s=t?t.calculate():null;this.closest("qti-assessment-item").setOutcomeValue(e,s)}}customElements.define("qti-set-outcome-value",U);class G extends P{render(){return s.html``}calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Can not find qti-response-identifier: ${e}`),null;return t.correctResponse}}customElements.define("qti-correct",G);class z extends P{render(){return s.html``}calculate(){const e=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariableValue(e)}}customElements.define("qti-variable",z);class W extends P{calculate(){const e=this.firstElementChild.calculate(),t=this.lastElementChild.calculate();let s=!0;return s=e instanceof Array?e.length===t.length&&e.filter(((e,s)=>e===t[s])).length===e.length:e==t,s}}customElements.define("qti-match",W);class V extends P{calculate(){return V.calculate(this.textContent,this.getAttribute("base-type"))}static calculate(e,t){let s;if(t===exports.BaseType.directedPair){const t=e.split(" ");s={destination:t[1],source:t[0]}}else s=e;return s}}customElements.define("qti-base-value",V);class K extends P{calculate(){const e=this.firstElementChild,t=this.lastElementChild;return K.calculate(e,t)}static calculate(e,t){const s=e.calculate(),i=t.calculate(),n=s.map((e=>e.source+" "+e.destination)),r=i.map((e=>e.source+" "+e.destination));return n.filter((e=>r.includes(e))).length>0}}customElements.define("qti-contains",K);class X extends P{calculate(){return 2===this.children.length?X.calculate(this.children[0],this.children[1]):(this.err("unexpected number of children in qte"),null)}static calculate(e,t){return+e.calculate()>=+t.calculate()}}customElements.define("qti-gte",X);class Y extends P{calculate(){return Array.from(this.children).map((e=>e.calculate()))}}customElements.define("qti-multiple",Y);class J extends P{render(){return s.html``}calculate(){return J.calculate(Array.from(this.children))}static calculate(e){return e.every((e=>e.calculate()))}}customElements.define("qti-and",J);class Z extends P{render(){return s.html``}calculate(){return Z.calculate(Array.from(this.children))}static calculate(e){return!!e.find((e=>e.calculate()))}}customElements.define("qti-or",Z);class ee extends P{calculate(){return 1===this.children.length?ee.calculate(this.children[0]):(this.err("unexpected number of children in qte"),null)}static calculate(e){const t=e.calculate();return null==t||null==t||""===t}}customElements.define("qti-is-null",ee);class te extends d{constructor(){super(...arguments),this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){const t=e.querySelectorAll("properties");let s={};const i=e=>{const t={},s=e.getAttribute("key");if(s){const i=Array.from(e.children),r=i.map((e=>e.getAttribute("key"))),o=r.length>0&&!r.find((e=>!Number.isInteger(+e)));t[s]=o?i.map((e=>n(e))):e.textContent}return t},n=e=>{if(e){let t={};for(const s of e.children)t=Object.assign(Object.assign({},t),i(s));return t}};for(const e of t){return e.getAttribute("key")||(s=Object.assign(Object.assign({},s),n(e))),s}this.err("Can not find qti-custom-interaction config")}register(e){const t="QTI-CUSTOM-INTERACTION"===this.parentElement.tagName?"TAO":"IMS",s="IMS"==t?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),"TAO"==t&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");const i="IMS"==t?{properties:this.dataset}:this.getTAOConfig(this);if("IMS"==t?e.getInstance(s,i,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,i),"TAO"==t){Array.from(this.querySelectorAll("link")).map((e=>e.getAttribute("href"))).forEach((e=>{const t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.media="screen",t.href=e,s.appendChild(t)}))}}connectedCallback(){super.connectedCallback();const e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim);requirejs.config(e)(["require"],(e=>{define("qtiCustomInteractionContext",(()=>({register:e=>{this.register(e)},notifyReady:()=>{}}))),e([this.module],(()=>{}),(e=>{console.log("WAH",e),this._errorMessage=e}))}),(e=>{console.log("BAH",e),this._errorMessage=e}))}render(){return s.html`<slot></slot>${this._errorMessage&&s.html`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}}customElements.define("qti-portable-custom-interaction",te);const se=(e,t)=>class extends e{connectedCallback(){if(super.connectedCallback(),this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{e.addEventListener("dragstart",(t=>{t.dataTransfer.setData("text",t.currentTarget.getAttribute("identifier")),e.setAttribute("dragging","")})),e.addEventListener("dragend",(t=>{t.preventDefault(),e.removeAttribute("over"),e.removeAttribute("dragging")})),e.setAttribute("draggable","true")}))}},ie=(e,t)=>class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0}}}firstUpdated(e){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(e);const s=Array.from(this.querySelectorAll(t));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),s.forEach((e=>{e.setAttribute("dropzone","move"),e.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(e)}));for(const e of s)this.observer=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){switch(t.attributeName){case"disabled":e.hasAttribute("disabled")?this.removeHandler(e):this.attachHandler(e);break}}}))})),this.observer.observe(e,{attributes:!0})}attachHandler(e){e.addEventListener("dragover",this.dragoverHandler),e.addEventListener("drop",this.dropHandler)}removeHandler(e){e.removeEventListener("dragover",this.dragoverHandler),e.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var e;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),null===(e=this.observer)||void 0===e||e.disconnect())}dragoverHandler(e){e.preventDefault();return e.currentTarget.setAttribute("active",""),e.dataTransfer.dropEffect="move",!1}dropHandler(e){e.preventDefault();const t=e.currentTarget,s=this.querySelector(`[identifier=${e.dataTransfer.getData("text")}`);return t?s.parentElement.getAttribute("identifier")!==t.getAttribute("identifier")&&t.appendChild(s):console.error(`cannot find droppable, target: ${e.target?JSON.stringify(e.target):"null"}`),t.removeAttribute("active"),!1}dragleaveHandler(e){e.preventDefault();return e.currentTarget.removeAttribute("active"),!1}},ne=(e,t,s)=>class extends e{constructor(){super(...arguments),this.state=new Map,this.animateMe=()=>{this.state.forEach(((e,t)=>{const{left:s,top:i,width:n,height:r}=t.getBoundingClientRect();null==this.state.get(t)&&this.state.set(t,{left:s,top:i,width:n,height:r});const o=this.state.get(t),a=o.left-s,l=o.top-i,c=o.width/n,d=o.height/r;this.state.set(t,{left:s,top:i,width:n,height:r});const{duration:p,easing:h}={duration:350,easing:"cubic-bezier(0.26, 0.86, 0.44, 0.985)"};t.animate([{transformOrigin:"top left",transform:`\n translate(${a}px, ${l}px)\n scale(${c}, ${d})\n `},{transformOrigin:"top left",transform:"none"}],{duration:p,easing:h})}))}}firstUpdated(e){const i=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return b(this,void 0,void 0,(function*(){if(this.classList.contains("qti-match-tabular"))return;yield this.updateComplete;Array.from(this.querySelectorAll(s)).forEach((e=>{const{left:t,top:s,width:i,height:n}=e.getBoundingClientRect();this.state.set(e,{left:t,top:s,width:i,height:n})})),this.observer=new MutationObserver(this.animateMe);Array.from(this.querySelectorAll(t)).forEach((e=>{this.observer.observe(e,{childList:!0})})),this.observer.observe(this,{childList:!0}),i.firstUpdated.call(this,e)}))}disconnectedCallback(){this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),this.observer.disconnect())}},re=(e,t,i)=>{class n extends(ne(ie(se(e,t),i),i,t)){constructor(){if(super(),this.draggables=new Map,this.disabled=!1,this.readonly=!1,this.minAssociations=1,this.maxAssociations=1,this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{this.draggables.set(e,{parent:e.parentElement,index:Array.from(e.parentNode.children).indexOf(e)}),e.addEventListener("dragend",(e=>{if("none"===e.dataTransfer.dropEffect){const t=e.currentTarget,s=this.draggables.get(t),i=s.index<s.parent.children.length?s.index:s.parent.children.length-1,n=s.parent,r=s.parent.children[i];n.insertBefore(t,r)}e.dataTransfer.dropEffect,this.saveResponse(),this.checkMaxMatchAssociations()}))}))}static get properties(){return{responseIdentifier:{type:String,value:"",attribute:"response-identifier"},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},minAssociations:{type:Number,reflect:!0,attribute:"min-associations"},maxAssociations:{type:Number,reflect:!0,attribute:"max-associations"}}}render(){return s.html` <slot></slot> `}checkMaxMatchAssociations(){const e=Array.from(this.querySelectorAll(i));if(e.filter((e=>e.childElementCount>0)).length>=this.maxAssociations)e.forEach((e=>this.setDisableStateDroppable(e,!0)));else for(const t of e){const e=+(t.getAttribute("match-max")||1)<=(t.children.length||0);this.setDisableStateDroppable(t,e)}}setDisableStateDroppable(e,t){t?(e.setAttribute("disabled",""),e.removeAttribute("dropzone")):(e.removeAttribute("disabled"),e.setAttribute("dropzone","move"))}updated(e){this.classList.contains("qti-match-tabular")||e.forEach(((e,t)=>{switch(t){case"disabled":this.draggables.forEach(((e,t)=>{this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.disabled?t.removeAttribute("draggable"):t.setAttribute("draggable","true")}));break;case"readonly":this.draggables.forEach(((e,t)=>{this.readonly?t.setAttribute("readonly",""):t.removeAttribute("readonly"),this.readonly?t.removeAttribute("draggable"):t.setAttribute("draggable","true")}))}}))}reset(e=!0){this.draggables.forEach(((e,t)=>{const s=e.index<e.parent.children.length?e.index:e.parent.children.length;e.parent.insertBefore(t,e.parent.children[s])})),e&&this.saveResponse()}set response(e){this.classList.contains("qti-match-tabular")||(this.reset(!1),null!==e&&Array.isArray(e)&&e.forEach((e=>{const[t,s]=e.split(" ");if(s){const e=this.querySelector(`[identifier=${s}]`),i=this.querySelector(`[identifier=${t}]`);e?i?(e.appendChild(i),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${t}`):console.error(`cannot find droppable with identifier: ${s}`)}})))}validate(){const e=Array.from(this.querySelectorAll(i)).filter((e=>e.childElementCount>0)).length;return this.minAssociations<=0||this.minAssociations<=e}saveResponse(){const e={list:{pair:Array.from(this.querySelectorAll(i)).map((e=>Array.from(e.children).map((e=>e.getAttribute("identifier")+" "))+e.getAttribute("identifier")))}};this.dispatchEvent(new CustomEvent(a.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:e}}))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(a.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}}return n},oe=s.css`
175
+ <slot></slot>`}}L.layoutClass=["","qti-choices-stacking-2","qti-choices-stacking-3","qti-choices-stacking-4","qti-orientation-vertical","qti-orientation-horizontal"],L.presentationClass=["","qti-input-control-hidden"],m([i.property({attribute:"orientation"}),g("design:type",String)],L.prototype,"_orientation",void 0),m([i.property({attribute:"shuffle",type:Boolean}),g("design:type",Boolean)],L.prototype,"_shuffle",void 0),customElements.define("qti-choice-interaction",L),exports.QtiSimpleChoice=class extends exports.QtiChoice{},exports.QtiSimpleChoice=m([i.customElement("qti-simple-choice")],exports.QtiSimpleChoice);class M extends s.LitElement{render(){return s.html`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){const e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0.0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response identifier="RESPONSE"> </qti-map-response>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"map_response_point":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-is-null>\n <qti-variable identifier="RESPONSE"></qti-variable>\n </qti-is-null>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'));break;case"match_correct":this.appendChild(this.fragmentFromString('<qti-response-processing>\n <qti-response-condition>\n <qti-response-if>\n <qti-match>\n <qti-variable identifier="RESPONSE"></qti-variable>\n <qti-correct identifier="RESPONSE"></qti-correct>\n </qti-match>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">1</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-if>\n <qti-response-else>\n <qti-set-outcome-value identifier="SCORE">\n <qti-base-value base-type="float">0</qti-base-value>\n </qti-set-outcome-value>\n </qti-response-else>\n </qti-response-condition>\n</qti-response-processing>'))}}const e=[...this.children];for(let t=0;t<e.length;t++){e[t].process()}}fragmentFromString(e){return document.createRange().createContextualFragment(e)}}customElements.define("qti-response-processing",M);class $ extends s.LitElement{render(){return s.html``}process(){throw new Error("Not implemented")}}customElements.define("qti-rule",$);class Q extends ${render(){return s.html`<slot></slot>`}process(){const e=[...this.children];for(let t=0;t<e.length;t++){const s=e[t];if(s.calculate())return void s.process()}}}customElements.define("qti-response-condition",Q);class H extends s.LitElement{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return s.html`
176
+ <slot></slot>`}calculate(){return this.debugCalculateResult=!0,!0}getSubRules(){return[...this.children]}process(){const e=this.getSubRules();for(let t=0;t<e.length;t++){e[t].process()}}}customElements.define("qti-response-else",H);class j extends H{render(){return s.html`${super.render()}`}calculate(){const e=this.firstElementChild.calculate();return this.debugCalculateResult=e,e}getSubRules(){const e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}}customElements.define("qti-response-if",j);class D extends j{render(){return s.html`${super.render()}`}}customElements.define("qti-response-else-if",D);class P extends p{render(){return s.html``}calculate(){throw new Error("Not implemented")}}customElements.define("qti-expression",P);class B extends P{calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Response ${e} can not be found`),null;const s=t.mapping,i=t.value;let n=0;if(Array.isArray(i)){for(let e=0;e<i.length;e++)n+=F(s,i[e],t.baseType);return n}return n+=F(s,i,t.baseType),n}}function F(e,t,s){let i=0;for(const n of e.entries()){const{entryTyped:e,valueTyped:r}=U(s,n,t);e===r&&(i+=n[1])}return i}function U(e,t,s){let i,n;switch(e){case exports.BaseType.string:case exports.BaseType.identifier:case exports.BaseType.directedPair:i=""+t[0],n=""+s;break;case exports.BaseType.float:i=parseFloat(t[0].replace(",",".")),n=parseFloat(s.replace(",","."));break;default:console.warn("no base-type identifier")}return{entryTyped:i,valueTyped:n}}customElements.define("qti-map-response",B);class G extends ${process(){const e=this.getAttribute("identifier"),t=this.firstElementChild,s=t?t.calculate():null;this.closest("qti-assessment-item").setOutcomeValue(e,s)}}customElements.define("qti-set-outcome-value",G);class z extends P{render(){return s.html``}calculate(){const e=this.getAttribute("identifier"),t=this.closest("qti-assessment-item").getResponse(e);if(!t)return this.err(`Can not find qti-response-identifier: ${e}`),null;return t.correctResponse}}customElements.define("qti-correct",z);class W extends P{render(){return s.html``}calculate(){const e=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariableValue(e)}}customElements.define("qti-variable",W);class V extends P{calculate(){const e=this.firstElementChild.calculate(),t=this.lastElementChild.calculate();let s=!0;return s=e instanceof Array?e.length===t.length&&e.filter(((e,s)=>e===t[s])).length===e.length:e==t,s}}customElements.define("qti-match",V);class K extends P{calculate(){return K.calculate(this.textContent,this.getAttribute("base-type"))}static calculate(e,t){let s;if(t===exports.BaseType.directedPair){const t=e.split(" ");s={destination:t[1],source:t[0]}}else s=e;return s}}customElements.define("qti-base-value",K);class X extends P{calculate(){const e=this.firstElementChild,t=this.lastElementChild;return X.calculate(e,t)}static calculate(e,t){const s=e.calculate(),i=t.calculate(),n=s.map((e=>e.source+" "+e.destination)),r=i.map((e=>e.source+" "+e.destination));return n.filter((e=>r.includes(e))).length>0}}customElements.define("qti-contains",X);class Y extends P{calculate(){return 2===this.children.length?Y.calculate(this.children[0],this.children[1]):(this.err("unexpected number of children in qte"),null)}static calculate(e,t){return+e.calculate()>=+t.calculate()}}customElements.define("qti-gte",Y);class J extends P{calculate(){return Array.from(this.children).map((e=>e.calculate()))}}customElements.define("qti-multiple",J);class Z extends P{render(){return s.html``}calculate(){return Z.calculate(Array.from(this.children))}static calculate(e){return e.every((e=>e.calculate()))}}customElements.define("qti-and",Z);class ee extends P{render(){return s.html``}calculate(){return ee.calculate(Array.from(this.children))}static calculate(e){return!!e.find((e=>e.calculate()))}}customElements.define("qti-or",ee);class te extends P{calculate(){return 1===this.children.length?te.calculate(this.children[0]):(this.err("unexpected number of children in qte"),null)}static calculate(e){const t=e.calculate();return null==t||null==t||""===t}}customElements.define("qti-is-null",te);class se extends p{constructor(){super(...arguments),this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){const t=e.querySelectorAll("properties");let s={};const i=e=>{const t={},s=e.getAttribute("key");if(s){const i=Array.from(e.children),r=i.map((e=>e.getAttribute("key"))),o=r.length>0&&!r.find((e=>!Number.isInteger(+e)));t[s]=o?i.map((e=>n(e))):e.textContent}return t},n=e=>{if(e){let t={};for(const s of e.children)t=Object.assign(Object.assign({},t),i(s));return t}};for(const e of t){return e.getAttribute("key")||(s=Object.assign(Object.assign({},s),n(e))),s}this.err("Can not find qti-custom-interaction config")}register(e){const t="QTI-CUSTOM-INTERACTION"===this.parentElement.tagName?"TAO":"IMS",s="IMS"==t?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),"TAO"==t&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");const i="IMS"==t?{properties:this.dataset}:this.getTAOConfig(this);if("IMS"==t?e.getInstance(s,i,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,i),"TAO"==t){Array.from(this.querySelectorAll("link")).map((e=>e.getAttribute("href"))).forEach((e=>{const t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.media="screen",t.href=e,s.appendChild(t)}))}}connectedCallback(){super.connectedCallback();const e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim);requirejs.config(e)(["require"],(e=>{define("qtiCustomInteractionContext",(()=>({register:e=>{this.register(e)},notifyReady:()=>{}}))),e([this.module],(()=>{}),(e=>{console.log("WAH",e),this._errorMessage=e}))}),(e=>{console.log("BAH",e),this._errorMessage=e}))}render(){return s.html`<slot></slot>${this._errorMessage&&s.html`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}}customElements.define("qti-portable-custom-interaction",se);const ie=(e,t)=>class extends e{connectedCallback(){if(super.connectedCallback(),this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{e.addEventListener("dragstart",(t=>{t.dataTransfer.setData("text",t.currentTarget.getAttribute("identifier")),e.setAttribute("dragging","")})),e.addEventListener("dragend",(t=>{t.preventDefault(),e.removeAttribute("over"),e.removeAttribute("dragging")})),e.setAttribute("draggable","true")}))}},ne=(e,t)=>class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0}}}firstUpdated(e){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(e);const s=Array.from(this.querySelectorAll(t));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),s.forEach((e=>{e.setAttribute("dropzone","move"),e.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(e)}));for(const e of s)this.observer=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){switch(t.attributeName){case"disabled":e.hasAttribute("disabled")?this.removeHandler(e):this.attachHandler(e);break}}}))})),this.observer.observe(e,{attributes:!0})}attachHandler(e){e.addEventListener("dragover",this.dragoverHandler),e.addEventListener("drop",this.dropHandler)}removeHandler(e){e.removeEventListener("dragover",this.dragoverHandler),e.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var e;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),null===(e=this.observer)||void 0===e||e.disconnect())}dragoverHandler(e){e.preventDefault();return e.currentTarget.setAttribute("active",""),e.dataTransfer.dropEffect="move",!1}dropHandler(e){e.preventDefault();const t=e.currentTarget,s=this.querySelector(`[identifier=${e.dataTransfer.getData("text")}`);return t?s.parentElement.getAttribute("identifier")!==t.getAttribute("identifier")&&t.appendChild(s):console.error(`cannot find droppable, target: ${e.target?JSON.stringify(e.target):"null"}`),t.removeAttribute("active"),!1}dragleaveHandler(e){e.preventDefault();return e.currentTarget.removeAttribute("active"),!1}},re=(e,t,s)=>class extends e{constructor(){super(...arguments),this.state=new Map,this.animateMe=()=>{this.state.forEach(((e,t)=>{const{left:s,top:i,width:n,height:r}=t.getBoundingClientRect();null==this.state.get(t)&&this.state.set(t,{left:s,top:i,width:n,height:r});const o=this.state.get(t),a=o.left-s,l=o.top-i,c=o.width/n,d=o.height/r;this.state.set(t,{left:s,top:i,width:n,height:r});const{duration:p,easing:h}={duration:350,easing:"cubic-bezier(0.26, 0.86, 0.44, 0.985)"};t.animate([{transformOrigin:"top left",transform:`\n translate(${a}px, ${l}px)\n scale(${c}, ${d})\n `},{transformOrigin:"top left",transform:"none"}],{duration:p,easing:h})}))}}firstUpdated(e){const i=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return b(this,void 0,void 0,(function*(){if(this.classList.contains("qti-match-tabular"))return;yield this.updateComplete;Array.from(this.querySelectorAll(s)).forEach((e=>{const{left:t,top:s,width:i,height:n}=e.getBoundingClientRect();this.state.set(e,{left:t,top:s,width:i,height:n})})),this.observer=new MutationObserver(this.animateMe);Array.from(this.querySelectorAll(t)).forEach((e=>{this.observer.observe(e,{childList:!0})})),this.observer.observe(this,{childList:!0}),i.firstUpdated.call(this,e)}))}disconnectedCallback(){this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),this.observer.disconnect())}},oe=(e,t,i)=>{class n extends(re(ne(ie(e,t),i),i,t)){constructor(){if(super(),this.draggables=new Map,this.disabled=!1,this.readonly=!1,this.minAssociations=1,this.maxAssociations=1,this.classList.contains("qti-match-tabular"))return;Array.from(this.querySelectorAll(t)).forEach((e=>{this.draggables.set(e,{parent:e.parentElement,index:Array.from(e.parentNode.children).indexOf(e)}),e.addEventListener("dragend",(e=>{if("none"===e.dataTransfer.dropEffect){const t=e.currentTarget,s=this.draggables.get(t),i=s.index<s.parent.children.length?s.index:s.parent.children.length-1,n=s.parent,r=s.parent.children[i];n.insertBefore(t,r)}e.dataTransfer.dropEffect,this.saveResponse(),this.checkMaxMatchAssociations()}))}))}static get properties(){return{responseIdentifier:{type:String,value:"",attribute:"response-identifier"},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},minAssociations:{type:Number,reflect:!0,attribute:"min-associations"},maxAssociations:{type:Number,reflect:!0,attribute:"max-associations"}}}render(){return s.html` <slot></slot> `}checkMaxMatchAssociations(){const e=Array.from(this.querySelectorAll(i));if(e.filter((e=>e.childElementCount>0)).length>=this.maxAssociations)e.forEach((e=>this.setDisableStateDroppable(e,!0)));else for(const t of e){const e=+(t.getAttribute("match-max")||1)<=(t.children.length||0);this.setDisableStateDroppable(t,e)}}setDisableStateDroppable(e,t){t?(e.setAttribute("disabled",""),e.removeAttribute("dropzone")):(e.removeAttribute("disabled"),e.setAttribute("dropzone","move"))}updated(e){this.classList.contains("qti-match-tabular")||e.forEach(((e,t)=>{switch(t){case"disabled":this.draggables.forEach(((e,t)=>{this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.disabled?t.removeAttribute("draggable"):t.setAttribute("draggable","true")}));break;case"readonly":this.draggables.forEach(((e,t)=>{this.readonly?t.setAttribute("readonly",""):t.removeAttribute("readonly"),this.readonly?t.removeAttribute("draggable"):t.setAttribute("draggable","true")}))}}))}reset(e=!0){this.draggables.forEach(((e,t)=>{const s=e.index<e.parent.children.length?e.index:e.parent.children.length;e.parent.insertBefore(t,e.parent.children[s])})),e&&this.saveResponse()}set response(e){this.classList.contains("qti-match-tabular")||(this.reset(!1),null!==e&&Array.isArray(e)&&e.forEach((e=>{const[t,s]=e.split(" ");if(s){const e=this.querySelector(`[identifier=${s}]`),i=this.querySelector(`[identifier=${t}]`);e?i?(e.appendChild(i),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${t}`):console.error(`cannot find droppable with identifier: ${s}`)}})))}validate(){const e=Array.from(this.querySelectorAll(i)).filter((e=>e.childElementCount>0)).length;return this.minAssociations<=0||this.minAssociations<=e}saveResponse(){const e={list:{pair:Array.from(this.querySelectorAll(i)).map((e=>Array.from(e.children).map((e=>e.getAttribute("identifier")+" "))+e.getAttribute("identifier")))}};this.dispatchEvent(new CustomEvent(l.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:e}}))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(l.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}}return n},ae=s.css`
178
177
  .notification {
179
178
  position: absolute;
180
179
  z-index: 100000;
@@ -196,21 +195,21 @@
196
195
  border-radius: 99999px;
197
196
  content: 'preview not interactive';
198
197
  }
199
- `;class ae extends(re(d,"qti-simple-associable-choice","drop-list")){render(){return s.html`
198
+ `;class le extends(oe(p,"qti-simple-associable-choice","drop-list")){render(){return s.html`
200
199
  <slot name="prompt"></slot>
201
200
  <slot></slot>`}firstUpdated(e){s.render(s.html`
202
201
  ${this.childrenMap.length>0&&Array.from(Array(Math.ceil(this.childrenMap.length/2)).keys()).map(((e,t)=>s.html`<div class="associables-container">
203
202
  <drop-list class="associables-gap" identifier="droplist${t}_left"></drop-list>
204
203
  <drop-list class="associables-gap" identifier="droplist${t}_right"></drop-list>
205
204
  </div>`))}
206
- `,this),super.firstUpdated(e)}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}}ae.styles=[oe],customElements.define("qti-associate-interaction",ae);class le extends s.LitElement{render(){return s.html`
205
+ `,this),super.firstUpdated(e)}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}}le.styles=[ae],customElements.define("qti-associate-interaction",le);class ce extends s.LitElement{render(){return s.html`
207
206
  <slot></slot>
208
- `}}customElements.define("qti-simple-associable-choice",le);class ce extends(re(s.LitElement,"qti-gap-text","qti-gap")){render(){return s.html`<slot></slot>`}}ce.styles=[oe],customElements.define("qti-gap-match-interaction",ce);class de extends HTMLElement{}customElements.define("qti-gap-text",de);class pe extends HTMLElement{}function he(e,t,s,i){switch(e){case"circle":{const[e,n,r]=t,o=e/s.width*100,a=n/s.height*100,l=r/s.width*100;i.style.left=o-l+"%",i.style.top=a-l+"%",i.style.width=i.style.height=4*l+"px",i.style.clipPath="circle(50% at 50% 50%)"}break;case"rect":{const[e,n,r,o]=t,a=e/s.width*100,l=n/s.height*100,c=r/s.width*100,d=o/s.height*100;i.style.left=a+"%",i.style.top=l+"%",i.style.width=c-a+"%",i.style.height=d-l+"%"}break;case"poly":{const e=t.reduce(((e,t,s,i)=>{if(s%2==1){const t=e.pop();e[e.length]={x:t,y:i[s]}}else e.push(t);return e}),[]),n=Math.min(...e.map((e=>e.x))),r=Math.max(...e.map((e=>e.x))),o=Math.min(...e.map((e=>e.y))),a=Math.max(...e.map((e=>e.y))),l=n/s.width*100,c=o/s.height*100,d=r/s.width*100,p=a/s.height*100;i.style.left=n/s.width*100+"%",i.style.top=o/s.height*100+"%",i.style.width=d-l+"%",i.style.height=p-c+"%";const h=e.map((e=>({x:(e.x-n)/(r-n)*100,y:(e.y-o)/(a-o)*100}))).map((e=>Math.round(e.x)+"% "+Math.round(e.y)+"%")).join(",");i.style.clipPath=`polygon(${h})`}}}customElements.define("qti-gap",pe);class ue extends w{render(){return s.html`
207
+ `}}customElements.define("qti-simple-associable-choice",ce);class de extends(oe(s.LitElement,"qti-gap-text","qti-gap")){render(){return s.html`<slot></slot>`}}de.styles=[ae],customElements.define("qti-gap-match-interaction",de);class pe extends HTMLElement{}customElements.define("qti-gap-text",pe);class he extends HTMLElement{}function ue(e,t,s,i){switch(e){case"circle":{const[e,n,r]=t,o=e/s.width*100,a=n/s.height*100,l=r/s.width*100;i.style.left=o-l+"%",i.style.top=a-l+"%",i.style.width=i.style.height=4*l+"px",i.style.clipPath="circle(50% at 50% 50%)"}break;case"rect":{const[e,n,r,o]=t,a=e/s.width*100,l=n/s.height*100,c=r/s.width*100,d=o/s.height*100;i.style.left=a+"%",i.style.top=l+"%",i.style.width=c-a+"%",i.style.height=d-l+"%"}break;case"poly":{const e=t.reduce(((e,t,s,i)=>{if(s%2==1){const t=e.pop();e[e.length]={x:t,y:i[s]}}else e.push(t);return e}),[]),n=Math.min(...e.map((e=>e.x))),r=Math.max(...e.map((e=>e.x))),o=Math.min(...e.map((e=>e.y))),a=Math.max(...e.map((e=>e.y))),l=n/s.width*100,c=o/s.height*100,d=r/s.width*100,p=a/s.height*100;i.style.left=n/s.width*100+"%",i.style.top=o/s.height*100+"%",i.style.width=d-l+"%",i.style.height=p-c+"%";const h=e.map((e=>({x:(e.x-n)/(r-n)*100,y:(e.y-o)/(a-o)*100}))).map((e=>Math.round(e.x)+"% "+Math.round(e.y)+"%")).join(",");i.style.clipPath=`polygon(${h})`}}}customElements.define("qti-gap",he);class me extends T{render(){return s.html`
209
208
  <slot name="prompt"></slot>
210
209
  <!-- slot for the prompt -->
211
210
  <slot></slot>
212
211
  <!-- slot for the image and hotspots -->
213
- `}positionHotspotOnRegister(e){const t=this.querySelector("img"),s=e.target,i=s.getAttribute("coords");he(s.getAttribute("shape"),i.split(",").map((e=>parseInt(e))),t,s)}connectedCallback(){super.connectedCallback(),this.addEventListener(a.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(a.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}}ue.styles=[s.css`
212
+ `}positionHotspotOnRegister(e){const t=this.querySelector("img"),s=e.target,i=s.getAttribute("coords");ue(s.getAttribute("shape"),i.split(",").map((e=>parseInt(e))),t,s)}connectedCallback(){super.connectedCallback(),this.addEventListener(l.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(l.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}}me.styles=[s.css`
214
213
  slot:not([name='prompt']) {
215
214
  position: relative; /* qti-hotspot-choice relative to the slot */
216
215
  display: block;
@@ -221,18 +220,18 @@
221
220
  pointer-events: none;
222
221
  user-select: none;
223
222
  }
224
- `],customElements.define("qti-graphic-associate-interaction",ue);class me extends(re(d,"qti-gap-img","qti-associable-hotspot")){render(){return s.html` <slot></slot>
225
- <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(e){const t=e.target,s=t.getAttribute("coords"),i=t.getAttribute("shape"),n=s.split(",").map((e=>parseInt(e)));switch(i){case"circle":{const[e,s,i]=n;t.style.left=e-i+"px",t.style.top=s-i+"px",t.style.width=t.style.height=2*i+"px"}break;case"rect":{const[e,s,i,r]=n;t.style.left=e+"px",t.style.top=s+"px",t.style.width=i-e+"px",t.style.height=r-s+"px"}}}connectedCallback(){super.connectedCallback(),this.addEventListener(a.ON_REGISTER_HOTSPOT,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(a.ON_REGISTER_HOTSPOT,this.positionHotspotOnRegister)}}me.styles=s.css`
223
+ `],customElements.define("qti-graphic-associate-interaction",me);class ge extends(oe(p,"qti-gap-img","qti-associable-hotspot")){render(){return s.html` <slot></slot>
224
+ <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(e){const t=e.target,s=t.getAttribute("coords"),i=t.getAttribute("shape"),n=s.split(",").map((e=>parseInt(e)));switch(i){case"circle":{const[e,s,i]=n;t.style.left=e-i+"px",t.style.top=s-i+"px",t.style.width=t.style.height=2*i+"px"}break;case"rect":{const[e,s,i,r]=n;t.style.left=e+"px",t.style.top=s+"px",t.style.width=i-e+"px",t.style.height=r-s+"px"}}}connectedCallback(){super.connectedCallback(),this.addEventListener(l.ON_REGISTER_HOTSPOT,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(l.ON_REGISTER_HOTSPOT,this.positionHotspotOnRegister)}}ge.styles=s.css`
226
225
  slot[name="qti-gap-img"] {
227
226
  display: flex;
228
227
  gap: 1rem;
229
228
  }
230
- `,customElements.define("qti-graphic-gap-match-interaction",me);class fe extends w{render(){return s.html`
229
+ `,customElements.define("qti-graphic-gap-match-interaction",ge);class be extends T{render(){return s.html`
231
230
  <slot name="prompt"></slot>
232
231
  <!-- slot for the prompt -->
233
232
  <slot></slot>
234
233
  <!-- slot for the image and hotspots -->
235
- `}setHotspotOrder(e){const{identifier:t}=e.detail,s=this._choiceElements.find((e=>e.getAttribute("identifier")===t)),i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,null==s.order)return this._choiceElements.filter((e=>e.order>0)).length>=i||(s.order=this._choiceElements.filter((e=>!!e.order)).length+1),void(this.choiceOrdering=!1);this._choiceElements.forEach((e=>(e.order>e.order&&e.order--,e))),s.order=null,this.choiceOrdering=!1}}positionHotspotOnRegister(e){const t=this.querySelector("img"),s=e.target,i=s.getAttribute("coords");he(s.getAttribute("shape"),i.split(",").map((e=>parseInt(e))),t,s)}connectedCallback(){super.connectedCallback(),this.addEventListener(a.ON_CHOICE_ELEMENT_SELECTED,this.setHotspotOrder),this.addEventListener(a.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(a.ON_CHOICE_ELEMENT_SELECTED,this.setHotspotOrder),this.removeEventListener(a.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}}fe.styles=[s.css`
234
+ `}setHotspotOrder(e){const{identifier:t}=e.detail,s=this._choiceElements.find((e=>e.getAttribute("identifier")===t)),i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,null==s.order)return this._choiceElements.filter((e=>e.order>0)).length>=i||(s.order=this._choiceElements.filter((e=>!!e.order)).length+1),void(this.choiceOrdering=!1);this._choiceElements.forEach((e=>(e.order>e.order&&e.order--,e))),s.order=null,this.choiceOrdering=!1}}positionHotspotOnRegister(e){const t=this.querySelector("img"),s=e.target,i=s.getAttribute("coords");ue(s.getAttribute("shape"),i.split(",").map((e=>parseInt(e))),t,s)}connectedCallback(){super.connectedCallback(),this.addEventListener(l.ON_CHOICE_ELEMENT_SELECTED,this.setHotspotOrder),this.addEventListener(l.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(l.ON_CHOICE_ELEMENT_SELECTED,this.setHotspotOrder),this.removeEventListener(l.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}}be.styles=[s.css`
236
235
  slot:not([name='prompt']) {
237
236
  position: relative; /* qti-hotspot-choice relative to the slot */
238
237
  display: block;
@@ -243,12 +242,12 @@
243
242
  pointer-events: none;
244
243
  user-select: none;
245
244
  }
246
- `],customElements.define("qti-graphic-order-interaction",fe);class ge extends w{render(){return s.html`
245
+ `],customElements.define("qti-graphic-order-interaction",be);class fe extends T{render(){return s.html`
247
246
  <slot name="prompt"></slot>
248
247
  <!-- slot for the prompt -->
249
248
  <slot></slot>
250
249
  <!-- slot for the image and hotspots -->
251
- `}positionHotspotOnRegister(e){const t=this.querySelector("img"),s=e.target,i=s.getAttribute("coords");he(s.getAttribute("shape"),i.split(",").map((e=>parseInt(e))),t,s)}connectedCallback(){super.connectedCallback(),this.addEventListener(a.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(a.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}}ge.styles=[s.css`
250
+ `}positionHotspotOnRegister(e){const t=this.querySelector("img"),s=e.target,i=s.getAttribute("coords");ue(s.getAttribute("shape"),i.split(",").map((e=>parseInt(e))),t,s)}connectedCallback(){super.connectedCallback(),this.addEventListener(l.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(l.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}}fe.styles=[s.css`
252
251
  slot:not([name='prompt']) {
253
252
  position: relative; /* qti-hotspot-choice relative to the slot */
254
253
  display: block;
@@ -259,21 +258,21 @@
259
258
  pointer-events: none;
260
259
  user-select: none;
261
260
  }
262
- `],customElements.define("qti-hotspot-interaction",ge);class be extends exports.QtiChoice{}be.styles=s.css`
261
+ `],customElements.define("qti-hotspot-interaction",fe);class ye extends exports.QtiChoice{}ye.styles=s.css`
263
262
  :host {
264
263
  position: absolute;
265
264
  }
266
- `,f([i.property({attribute:"aria-ordervalue",type:Number,reflect:!0}),g("design:type",Number)],be.prototype,"order",void 0),customElements.define("qti-hotspot-choice",be);class xe extends(re(s.LitElement,":first-of-type > qti-simple-associable-choice",":last-of-type > qti-simple-associable-choice")){render(){return s.html`
265
+ `,m([i.property({attribute:"aria-ordervalue",type:Number,reflect:!0}),g("design:type",Number)],ye.prototype,"order",void 0),customElements.define("qti-hotspot-choice",ye);class xe extends(oe(s.LitElement,":first-of-type > qti-simple-associable-choice",":last-of-type > qti-simple-associable-choice")){render(){return s.html`
267
266
  <slot name="prompt"></slot>
268
- <slot></slot>`}}xe.styles=[oe],customElements.define("qti-match-interaction",xe);class ye extends O{constructor(){super()}reset(){}validate(){return!0}set response(e){}static get properties(){return Object.assign(Object.assign({},O.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return s.html`
267
+ <slot></slot>`}}xe.styles=[ae],customElements.define("qti-match-interaction",xe);class ve extends k{constructor(){super()}reset(){}validate(){return!0}set response(e){}static get properties(){return Object.assign(Object.assign({},k.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return s.html`
269
268
  <slot name="prompt"></slot>
270
- <slot></slot>`}connectedCallback(){super.connectedCallback()}}ye.styles=[oe,s.css``],customElements.define("qti-media-interaction",ye);class Ee extends(re(d,"qti-simple-choice","drop-list")){static get properties(){return{_classNames:{type:String,attribute:"class"},_orientation:{type:String,attribute:"orientation"}}}render(){return s.html` <slot name="prompt"> </slot>
269
+ <slot></slot>`}connectedCallback(){super.connectedCallback()}}ve.styles=[ae,s.css``],customElements.define("qti-media-interaction",ve);class Ee extends(oe(p,"qti-simple-choice","drop-list")){static get properties(){return{_classNames:{type:String,attribute:"class"},_orientation:{type:String,attribute:"orientation"}}}render(){return s.html` <slot name="prompt"> </slot>
271
270
  <div class=${`container ${this._classNames}`}>
272
271
  <slot class=${"vertical"===this._orientation?"ver":"hor"}> </slot>
273
272
  <div class=${"vertical"===this._orientation?"ver":"hor"}>
274
273
  ${this.childrenMap.map(((e,t)=>s.html`<drop-list identifier="droplist${t}"></drop-list>`))}
275
274
  </div>
276
- </div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}}Ee.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],Ee.styles=[oe,s.css`
275
+ </div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}}Ee.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],Ee.styles=[ae,s.css`
277
276
  .hor {
278
277
  display: grid;
279
278
  gap: var(--qti-gap, 2px);
@@ -312,10 +311,10 @@
312
311
  content: 'drop here';
313
312
  color: var(--qti-placeholder-text);
314
313
  }
315
- `],customElements.define("qti-order-interaction",Ee);class ve extends w{constructor(){super()}render(){return s.html`<slot></slot>
316
- <div class="notification"></div>`}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}}ve.styles=[oe],customElements.define("qti-select-point-interaction",ve);const Ce=37,qe=38,_e=39,Se=40,Oe=33,Re=34,ke=35,Te=36;class we extends O{constructor(){super(),this.addEventListener("keydown",this._onKeyDown.bind(this))}reset(){}validate(){return!0}set response(e){}set min(e){this._min=e,this.style.setProperty("--qti-slider-interaction-lower-bounds",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--qti-slider-interaction-upper-bounds",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--qti-slider-interaction-step",`${this._step}`)}get step(){return this._step}render(){return s.html`
314
+ `],customElements.define("qti-order-interaction",Ee);class Ce extends T{constructor(){super()}render(){return s.html`<slot></slot>
315
+ <div class="notification"></div>`}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}}Ce.styles=[ae],customElements.define("qti-select-point-interaction",Ce);const qe=37,_e=38,Se=39,Oe=40,ke=33,Re=34,we=35,Ie=36;class Te extends k{constructor(){super(),this.addEventListener("keydown",this._onKeyDown.bind(this))}reset(){}validate(){return!0}set response(e){}set min(e){this._min=e,this.style.setProperty("--qti-slider-interaction-lower-bounds",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--qti-slider-interaction-upper-bounds",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--qti-slider-interaction-step",`${this._step}`)}get step(){return this._step}render(){return s.html`
317
316
  <slot name="prompt"></slot>
318
- <slot></slot>`}firstUpdated(){this.addEventListener("mousedown",this._onMouseDown.bind(this)),this.style.setProperty("--qti-slider-interaction-step",this.step?this.step.toString():"10");const e=this.getAttribute("value");this._moveSliderTo(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get RAIL_WIDTH(){return this.offsetWidth}_onKeyDown(e){let t=!1;const s=this.value;switch(e.keyCode){case Ce:case Se:this._moveSliderTo(s-this.step),t=!0;break;case _e:case qe:this._moveSliderTo(s+this.step),t=!0;break;case Re:this._moveSliderTo(s-this.step),t=!0;break;case Oe:this._moveSliderTo(s+this.step),t=!0;break;case Te:this._moveSliderTo(this.min),t=!0;break;case ke:this._moveSliderTo(this.max),t=!0}t&&(e.preventDefault(),e.stopPropagation())}_onMouseDown(e){const t=e.target,s=this.min,i=this.max,n=e=>{const n=e.pageX-t.offsetLeft,r=s+(i-s)*n/this.RAIL_WIDTH;this._moveSliderTo(r),e.preventDefault(),e.stopPropagation()},r=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r),this.saveResponse({base:{float:this.value}})};document.addEventListener("mousemove",n),document.addEventListener("mouseup",r),e.preventDefault(),e.stopPropagation(),e.target.focus();const o=e.pageX-t.offsetLeft,a=s+(i-s)*o/this.RAIL_WIDTH;this._moveSliderTo(a)}_moveSliderTo(e){const t=this.min,s=this.max;let i=Number(e);i<t&&(i=t),i>s&&(i=s);const n=(i-t)/(s-t)*100;this.style.setProperty("--qti-slider-interaction-aria-valuenow",`${n}%`)}}we.styles=[oe,s.css``],f([i.property({type:Number,attribute:"lower-bound"}),g("design:type",Number),g("design:paramtypes",[Number])],we.prototype,"min",null),f([i.property({type:Number,attribute:"upper-bound"}),g("design:type",Number),g("design:paramtypes",[Number])],we.prototype,"max",null),f([i.property({type:Number,attribute:"step"}),g("design:type",Number),g("design:paramtypes",[Number])],we.prototype,"step",null),customElements.define("qti-slider-interaction",we);class Ie extends s.LitElement{constructor(){super(...arguments),this.render=()=>s.html`${this.value}`}levenshtein(e,t){let s;if(0===e.length)return t.length;if(0===t.length)return e.length;e.length>t.length&&(s=e,e=t,t=s);const i=e.length,n=t.length,r=Array(i);let o,a,l;for(o=0;o<=i;o++)r[o]=o;for(o=1;o<=n;o++){for(l=o,a=1;a<=i;a++)s=r[a-1],r[a-1]=l,l=Math.min(s+(t[o-1]!==e[a-1]),l+1,r[a]+1);r[a-1]=l}return l}calculate(){const e=this.firstElementChild,t=this.lastElementChild,s=e.calculate(),i=t.calculate();return this.value=100-this.levenshtein(s.toString().trim(),i.toString().trim())/i.toString().length*100,this.value}}Ie.properties={value:{}},customElements.define("qti-custom-operator-levenshtein",Ie);class Ae extends s.LitElement{render(){return s.html``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/[^0-9$.,]/g,""):""}}customElements.define("qti-custom-operator-numeric",Ae);class Ne extends s.LitElement{constructor(){super(...arguments),this.render=()=>s.html`${this.value}`}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return this.value=t?this.parseNumber(t,undefined):"",this.value}parseNumber(e,t=navigator.languages){const s=Intl.NumberFormat(t).format(1.1),i=new RegExp(`[^-+0-9${s.charAt(1)}]`,"g"),n=e.replace(i,"").replace(s.charAt(1),".");return parseFloat(n)}}Ne.properties={value:{}},customElements.define("qti-custom-operator-parse-numeric-nl",Ne);class Le extends s.LitElement{render(){return s.html``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/ /g,""):""}}customElements.define("qti-custom-operator-remove-spaces",Le);class Me extends s.LitElement{render(){return s.html``}calculate(){return this.firstElementChild.calculate().toString().trim()}}customElements.define("qti-custom-operator-trim",Me);const $e={ON_ITEM_WAS_FINISHED:"onItemWasFinished",ON_NO_RESPONSE_ON_SUBMIT:"onNoResponseOnSubmit",ON_REQUEST_ITEM:"onRequestItem",ON_TEST_FINISHED:"onTestFinished"};var He,Qe;exports.NavigationMode=void 0,(He=exports.NavigationMode||(exports.NavigationMode={})).linear="linear",He.nonlinear="nonlinear",exports.SubmissionMode=void 0,(Qe=exports.SubmissionMode||(exports.SubmissionMode={})).individual="individual",Qe.simultaneous="simultaneous",exports.QtiTest=class extends s.LitElement{constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this._navigationMode=exports.NavigationMode.nonlinear,this._submissionMode=exports.SubmissionMode.simultaneous,this.items=[],this.itemIndex=0}handleNavigationModeChange(e,t){this.prevButton.style.visibility=t===exports.NavigationMode.linear?"hidden":"visible"}set itemXML(e){this._itemRef&&this._itemRef.remove(),this.insertAdjacentHTML("afterbegin",e)}set itemResponse(e){this._itemRef&&(this._itemRef.responses=e,this._navigationMode===exports.NavigationMode.linear&&(this._itemRef.style.filter="blur(5px)",this._itemRef.setAttribute("disabled",""),this.dispatchEvent(new CustomEvent($e.ON_ITEM_WAS_FINISHED))))}_onCheckItem(){return!!this._itemRef.validateResponses()&&(this._itemRef.processResponse(),!0)}_onScoreItem(){this._onCheckItem()&&this._itemRef.processResponse()}_onPrevItem(){this.itemIndex>0&&this._dispatchRequestItem(this.itemIndex-1)}_onNextItem(){this._navigationMode!==exports.NavigationMode.linear||this._itemRef.validateResponses()?this.itemIndex<this.items.length-1?this._dispatchRequestItem(this.itemIndex+1):this.dispatchEvent(new CustomEvent($e.ON_TEST_FINISHED)):this.dispatchEvent(new CustomEvent($e.ON_NO_RESPONSE_ON_SUBMIT))}_dispatchRequestItem(e){this.dispatchEvent(new CustomEvent($e.ON_REQUEST_ITEM,{bubbles:!0,composed:!0,detail:e}))}_onRequestItem(e){this._dispatchRequestItem(e.detail)}_handleSlotchange(e){const t=this.querySelector("qti-assessment-item");t&&(this._itemRef=t,this.disabled&&this._itemRef.setAttribute("disabled",""),this.readonly&&this._itemRef.setAttribute("readonly",""))}render(){return s.html`
317
+ <slot></slot>`}firstUpdated(){this.addEventListener("mousedown",this._onMouseDown.bind(this)),this.style.setProperty("--qti-slider-interaction-step",this.step?this.step.toString():"10");const e=this.getAttribute("value");this._moveSliderTo(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get RAIL_WIDTH(){return this.offsetWidth}_onKeyDown(e){let t=!1;const s=this.value;switch(e.keyCode){case qe:case Oe:this._moveSliderTo(s-this.step),t=!0;break;case Se:case _e:this._moveSliderTo(s+this.step),t=!0;break;case Re:this._moveSliderTo(s-this.step),t=!0;break;case ke:this._moveSliderTo(s+this.step),t=!0;break;case Ie:this._moveSliderTo(this.min),t=!0;break;case we:this._moveSliderTo(this.max),t=!0}t&&(e.preventDefault(),e.stopPropagation())}_onMouseDown(e){const t=e.target,s=this.min,i=this.max,n=e=>{const n=e.pageX-t.offsetLeft,r=s+(i-s)*n/this.RAIL_WIDTH;this._moveSliderTo(r),e.preventDefault(),e.stopPropagation()},r=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r),this.saveResponse({base:{float:this.value}})};document.addEventListener("mousemove",n),document.addEventListener("mouseup",r),e.preventDefault(),e.stopPropagation(),e.target.focus();const o=e.pageX-t.offsetLeft,a=s+(i-s)*o/this.RAIL_WIDTH;this._moveSliderTo(a)}_moveSliderTo(e){const t=this.min,s=this.max;let i=Number(e);i<t&&(i=t),i>s&&(i=s);const n=(i-t)/(s-t)*100;this.style.setProperty("--qti-slider-interaction-aria-valuenow",`${n}%`)}}Te.styles=[ae,s.css``],m([i.property({type:Number,attribute:"lower-bound"}),g("design:type",Number),g("design:paramtypes",[Number])],Te.prototype,"min",null),m([i.property({type:Number,attribute:"upper-bound"}),g("design:type",Number),g("design:paramtypes",[Number])],Te.prototype,"max",null),m([i.property({type:Number,attribute:"step"}),g("design:type",Number),g("design:paramtypes",[Number])],Te.prototype,"step",null),customElements.define("qti-slider-interaction",Te);class Ae extends s.LitElement{constructor(){super(...arguments),this.render=()=>s.html`${this.value}`}levenshtein(e,t){let s;if(0===e.length)return t.length;if(0===t.length)return e.length;e.length>t.length&&(s=e,e=t,t=s);const i=e.length,n=t.length,r=Array(i);let o,a,l;for(o=0;o<=i;o++)r[o]=o;for(o=1;o<=n;o++){for(l=o,a=1;a<=i;a++)s=r[a-1],r[a-1]=l,l=Math.min(s+(t[o-1]!==e[a-1]),l+1,r[a]+1);r[a-1]=l}return l}calculate(){const e=this.firstElementChild,t=this.lastElementChild,s=e.calculate(),i=t.calculate();return this.value=100-this.levenshtein(s.toString().trim(),i.toString().trim())/i.toString().length*100,this.value}}Ae.properties={value:{}},customElements.define("qti-custom-operator-levenshtein",Ae);class Ne extends s.LitElement{render(){return s.html``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/[^0-9$.,]/g,""):""}}customElements.define("qti-custom-operator-numeric",Ne);class Le extends s.LitElement{constructor(){super(...arguments),this.render=()=>s.html`${this.value}`}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return this.value=t?this.parseNumber(t,undefined):"",this.value}parseNumber(e,t=navigator.languages){const s=Intl.NumberFormat(t).format(1.1),i=new RegExp(`[^-+0-9${s.charAt(1)}]`,"g"),n=e.replace(i,"").replace(s.charAt(1),".");return parseFloat(n)}}Le.properties={value:{}},customElements.define("qti-custom-operator-parse-numeric-nl",Le);class Me extends s.LitElement{render(){return s.html``}calculate(){var e;const t=null===(e=this.firstElementChild.calculate())||void 0===e?void 0:e.toString();return t?t.replace(/ /g,""):""}}customElements.define("qti-custom-operator-remove-spaces",Me);class $e extends s.LitElement{render(){return s.html``}calculate(){return this.firstElementChild.calculate().toString().trim()}}customElements.define("qti-custom-operator-trim",$e);const Qe=(e,t)=>class extends e{_dispatch(){this.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:!0,detail:+this.getAttribute("index")}))}connectedCallback(){this.addEventListener("click",this._dispatch)}disconnectedCallback(){this.removeEventListener("click",this._dispatch)}};customElements.define("qti-test-next",class extends(Qe(s.LitElement,"on-next-item")){constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}}),customElements.define("qti-test-item",class extends(Qe(s.LitElement,"on-request-item")){constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}}),customElements.define("qti-test-prev",class extends(Qe(s.LitElement,"on-prev-item")){constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}}),customElements.define("qti-test-check",class extends(Qe(s.LitElement,"on-check-item")){constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}}),customElements.define("qti-test-score",class extends(Qe(s.LitElement,"on-score-item")){constructor(){super(...arguments),this.render=()=>s.html`<slot></slot>`}});const He={ON_ITEM_WAS_FINISHED:"onItemWasFinished",ON_NO_RESPONSE_ON_SUBMIT:"onNoResponseOnSubmit",ON_REQUEST_ITEM:"onRequestItem",ON_TEST_FINISHED:"onTestFinished"};var je,De;exports.NavigationMode=void 0,(je=exports.NavigationMode||(exports.NavigationMode={})).linear="linear",je.nonlinear="nonlinear",exports.SubmissionMode=void 0,(De=exports.SubmissionMode||(exports.SubmissionMode={})).individual="individual",De.simultaneous="simultaneous",exports.QtiTest=class extends s.LitElement{constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this._navigationMode=exports.NavigationMode.nonlinear,this._submissionMode=exports.SubmissionMode.simultaneous,this.items=[],this.itemIndex=0}handleNavigationModeChange(e,t){this.prevButton.style.visibility=t===exports.NavigationMode.linear?"hidden":"visible"}handleItemIndexChange(e,t){this._dispatchRequestItem(t)}set qtiContext(e){this.provider=new r.ContextProvider(this,q,{log:e=>{console.log(`[my-app] ${e}`)},view:e.view})}set itemXML(e){this._itemRef&&this._itemRef.remove(),this.insertAdjacentHTML("afterbegin",e)}set itemResponse(e){this._itemRef&&(this._itemRef.responses=e,this._navigationMode===exports.NavigationMode.linear&&(this._itemRef.style.filter="blur(5px)",this._itemRef.setAttribute("disabled",""),this.dispatchEvent(new CustomEvent(He.ON_ITEM_WAS_FINISHED))))}_onCheckItem(){return!!this._itemRef.validateResponses()&&(this._itemRef.processResponse(),!0)}_onScoreItem(){this._onCheckItem()&&this._itemRef.processResponse()}_onPrevItem(){this.itemIndex>0&&this._dispatchRequestItem(this.itemIndex-1)}_onNextItem(){this._navigationMode!==exports.NavigationMode.linear||this._itemRef.validateResponses()?this.itemIndex<this.items.length-1?this._dispatchRequestItem(this.itemIndex+1):this.dispatchEvent(new CustomEvent(He.ON_TEST_FINISHED)):this.dispatchEvent(new CustomEvent(He.ON_NO_RESPONSE_ON_SUBMIT))}_dispatchRequestItem(e){this.dispatchEvent(new CustomEvent(He.ON_REQUEST_ITEM,{bubbles:!0,composed:!0,detail:e}))}_onRequestItem(e){this._dispatchRequestItem(e.detail)}_handleSlotchange(e){const t=this.querySelector("qti-assessment-item");t&&(this._itemRef=t,this.disabled&&this._itemRef.setAttribute("disabled",""),this.readonly&&this._itemRef.setAttribute("readonly",""))}render(){return s.html`
319
318
  <slot
320
319
  @slotchange=${this._handleSlotchange}
321
320
  @on-prev-item=${this._onPrevItem}
@@ -325,10 +324,12 @@
325
324
  @on-request-item=${this._onRequestItem}
326
325
  >
327
326
  </slot>
328
- `}},f([i.query("qti-test-prev"),g("design:type",HTMLElement)],exports.QtiTest.prototype,"prevButton",void 0),f([i.query("qti-test-next"),g("design:type",HTMLElement)],exports.QtiTest.prototype,"nextButton",void 0),f([i.property({type:Boolean}),g("design:type",Object)],exports.QtiTest.prototype,"disabled",void 0),f([i.property({type:Boolean}),g("design:type",Object)],exports.QtiTest.prototype,"readonly",void 0),f([i.property({type:String,attribute:"navigation-mode"}),g("design:type",Object)],exports.QtiTest.prototype,"_navigationMode",void 0),f([x("_navigationMode",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,String]),g("design:returntype",void 0)],exports.QtiTest.prototype,"handleNavigationModeChange",null),f([i.property({type:String,attribute:"submission-mode"}),g("design:type",Object)],exports.QtiTest.prototype,"_submissionMode",void 0),f([i.property(),g("design:type",Array)],exports.QtiTest.prototype,"items",void 0),f([i.property({type:Number,attribute:"item-index",reflect:!0}),g("design:type",Object)],exports.QtiTest.prototype,"itemIndex",void 0),f([i.state(),g("design:type",p)],exports.QtiTest.prototype,"_itemRef",void 0),exports.QtiTest=f([i.customElement("qti-test")],exports.QtiTest);const De=(e,t)=>class extends e{constructor(){super(...arguments),this.scale=1,this.ro=new ResizeObserver((e=>{for(const t of e)this.fitToParent(t.contentRect.width)}))}connectedCallback(){super.connectedCallback(),this.ro.observe(this),this.fitToParent()}static get properties(){return{scales:{type:Boolean,reflect:!0}}}updated(e){e.forEach(((e,t)=>{if("scales"===t)this.scales&&this.fitToParent()}))}fitToParent(e=this.clientWidth){const s=this.querySelector(t);if(s){const t=e/s.clientWidth;this.scale=t,this.marginY=-s.clientHeight*(1-t)+"px",requestAnimationFrame((()=>{s.style.transform=`scale(${this.scale})`,s.style.margin=`0 0 ${this.marginY} 0`}))}}};class Pe extends(De(s.LitElement,"qti-assessment-item")){constructor(){super(...arguments),this.processResponse=()=>{var e;return null===(e=this._item)||void 0===e?void 0:e.processResponse()},this.validateResponses=()=>!!this._item&&this._item.validateResponses(),this.resetInteractions=()=>{var e;return null===(e=this._item)||void 0===e?void 0:e.resetInteractions()},this.render=()=>s.html`<slot @slotchange=${this.handleSlotchange}></slot>`}static get properties(){return{disabled:{type:Boolean},readonly:{type:Boolean},responses:{type:Object}}}updated(e){e.forEach(((e,t)=>{var s,i;switch(t){case"disabled":null===(s=this._item)||void 0===s||s.setAttribute("disabled","");break;case"readonly":null===(i=this._item)||void 0===i||i.setAttribute("readonly","");break;case"responses":this._item&&(this._item.responses=this.responses)}}))}handleSlotchange(e){const t=e.target.assignedNodes({flatten:!0});this._item=null,t.forEach((e=>{"QTI-ASSESSMENT-ITEM"==e.nodeName&&(this._item=e,this.disabled&&this._item.setAttribute("disabled",""),this.readonly&&this._item.setAttribute("readonly",""),this.responses&&(this._item.responses=this.responses))}))}}Pe.styles=s.css`
327
+ `}},m([i.query("qti-test-prev"),g("design:type",HTMLElement)],exports.QtiTest.prototype,"prevButton",void 0),m([i.query("qti-test-next"),g("design:type",HTMLElement)],exports.QtiTest.prototype,"nextButton",void 0),m([i.property({type:Boolean}),g("design:type",Object)],exports.QtiTest.prototype,"disabled",void 0),m([i.property({type:Boolean}),g("design:type",Object)],exports.QtiTest.prototype,"readonly",void 0),m([i.property({type:String,attribute:"navigation-mode"}),g("design:type",Object)],exports.QtiTest.prototype,"_navigationMode",void 0),m([y("_navigationMode",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,String]),g("design:returntype",void 0)],exports.QtiTest.prototype,"handleNavigationModeChange",null),m([i.property({type:String,attribute:"submission-mode"}),g("design:type",Object)],exports.QtiTest.prototype,"_submissionMode",void 0),m([i.property(),g("design:type",Array)],exports.QtiTest.prototype,"items",void 0),m([i.property({type:Number,attribute:"item-index",reflect:!0}),g("design:type",Object)],exports.QtiTest.prototype,"itemIndex",void 0),m([y("itemIndex",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Number]),g("design:returntype",void 0)],exports.QtiTest.prototype,"handleItemIndexChange",null),m([i.state(),g("design:type",h)],exports.QtiTest.prototype,"_itemRef",void 0),exports.QtiTest=m([i.customElement("qti-test")],exports.QtiTest);const Pe=(e,t)=>class extends e{constructor(){super(...arguments),this.scale=1,this.ro=new ResizeObserver((e=>{for(const t of e)this.fitToParent(t.contentRect.width)}))}connectedCallback(){super.connectedCallback(),this.ro.observe(this),this.fitToParent()}static get properties(){return{scales:{type:Boolean,reflect:!0}}}updated(e){e.forEach(((e,t)=>{if("scales"===t)this.scales&&this.fitToParent()}))}fitToParent(e=this.clientWidth){const s=this.querySelector(t);if(s){const t=e/s.clientWidth;this.scale=t,this.marginY=-s.clientHeight*(1-t)+"px",requestAnimationFrame((()=>{s.style.transform=`scale(${this.scale})`,s.style.margin=`0 0 ${this.marginY} 0`}))}}};class Be extends(Pe(s.LitElement,"qti-assessment-item")){constructor(){super(...arguments),this.disabled=!1,this.readonly=!1,this.processResponse=()=>{var e;return null===(e=this._item)||void 0===e?void 0:e.processResponse()},this.validateResponses=()=>!!this._item&&this._item.validateResponses(),this.resetInteractions=()=>{var e;return null===(e=this._item)||void 0===e?void 0:e.resetInteractions()},this.render=()=>s.html`<slot @slotchange=${this.handleSlotchange}></slot>`}handleDisabledChange(e,t){var s,i;t&&(null===(s=this._item)||void 0===s||s.setAttribute("disabled","")),!t&&(null===(i=this._item)||void 0===i||i.removeAttribute("disabled"))}handleReadonlyChange(e,t){var s,i;t&&(null===(s=this._item)||void 0===s||s.setAttribute("readonly","")),!t&&(null===(i=this._item)||void 0===i||i.removeAttribute("readonly"))}handleResponsesChange(e,t){this._item&&(this._item.responses=t)}handleSlotchange(e){const t=e.target.assignedNodes({flatten:!0});this._item=null,t.forEach((e=>{"QTI-ASSESSMENT-ITEM"==e.nodeName&&(this._item=e,this.disabled&&this._item.setAttribute("disabled",""),this.readonly&&this._item.setAttribute("readonly",""),this.responses&&(this._item.responses=this.responses))}))}}Be.styles=s.css`
329
328
  :host {
330
329
  display: block; /* necessary to calculate scaling position */
331
330
  width: 100%;
331
+ height: 100%;
332
+ overflow: hidden;
332
333
  }
333
334
  ::slotted(qti-assessment-item) {
334
335
  display: block; /* necessary to calculate scaling position */
@@ -336,7 +337,18 @@
336
337
  }
337
338
  :host([scales]) ::slotted(qti-assessment-item) {
338
339
  aspect-ratio: 4 / 3;
339
- width: 640px !important;
340
+ width: 1024px !important;
340
341
  transform-origin: 0 0;
341
342
  }
342
- `,customElements.define("qti-item",Pe);const je=e=>{const t=e.split("/>");let s="";for(let e=0;e<t.length-1;e++){const i=t[e].split("<");s+=t[e]+"></"+i[i.length-1].split(" ")[0]+">"}return s+t[t.length-1]};exports.AssessmentTestEvents=$e,exports.Choices=w,exports.Events=a,exports.OutcomeVariable=c,exports.QtiAnd=J,exports.QtiAssessmentItem=p,exports.QtiAssociateInteraction=ae,exports.QtiBaseValue=V,exports.QtiChoiceInteraction=N,exports.QtiContains=K,exports.QtiCorrect=G,exports.QtiCustomOperatorLevenshtein=Ie,exports.QtiCustomOperatorNumericOnly=Ae,exports.QtiCustomOperatorParseNumberLocalNl=Ne,exports.QtiCustomOperatorRemoveAllSpaces=Le,exports.QtiCustomOperatorTrim=Me,exports.QtiExpression=P,exports.QtiExtendedTextInteraction=T,exports.QtiFeedbackInline=_,exports.QtiGap=pe,exports.QtiGapMatchInteraction=ce,exports.QtiGapText=de,exports.QtiGraphicAssociateInteraction=ue,exports.QtiGraphicGapMatchInteraction=me,exports.QtiGraphicOrderInteraction=fe,exports.QtiGte=X,exports.QtiHotspotChoice=be,exports.QtiHotspotInteraction=ge,exports.QtiHottextInteraction=I,exports.QtiInlineChoiceInteraction=A,exports.QtiIsNull=ee,exports.QtiItem=Pe,exports.QtiItemBody=u,exports.QtiMapResponse=j,exports.QtiMatch=W,exports.QtiMatchInteraction=xe,exports.QtiMediaInteraction=ye,exports.QtiModalFeedback=S,exports.QtiMultiple=Y,exports.QtiOr=Z,exports.QtiOrderInteraction=Ee,exports.QtiOutcomeDeclaration=C,exports.QtiPortableCustomInteraction=te,exports.QtiPrompt=m,exports.QtiResponseCondition=$,exports.QtiResponseDeclaration=v,exports.QtiResponseElse=H,exports.QtiResponseElseIf=D,exports.QtiResponseIf=Q,exports.QtiResponseProcessing=L,exports.QtiSelectPointInteraction=ve,exports.QtiSetOutcomeValue=U,exports.QtiSliderInteraction=we,exports.QtiStylesheet=h,exports.QtiTextEntryInteraction=k,exports.QtiVariable=z,exports.ResponseVariable=l,exports.Status={EMPTY:"empty",USER:"user",FEEDBACK:"feedback",EXPECTED:"expected"},exports.fixSelfClosingTags=je,exports.qtiSimpleAssociableChoice=le,exports.qtiTransform=e=>{let t=e;const s=e=>{const s=(new DOMParser).parseFromString(t,"text/xml"),i=new XSLTProcessor,n=(new DOMParser).parseFromString(e,"text/xml");i.importStylesheet(n);const r=i.transformToFragment(s,document);t=(new XMLSerializer).serializeToString(r)},i={mathml:()=>(s(""),i),pciHooks(e){const s=["hook","module"],n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const t of s){r.querySelectorAll("["+t+"]").forEach((s=>{const i=s.getAttribute(t);i.startsWith("data:")||i.startsWith("http")||(s.setAttribute("base-url",e),s.setAttribute("module",n+"/"+i+(i.endsWith(".js")?"":".js")))}))}return t=(new XMLSerializer).serializeToString(r),i},assetsLocation(e,s=["src","href","data"]){const n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const e of s){r.querySelectorAll("["+e+"]").forEach((t=>{const s=t.getAttribute(e);s.startsWith("data:")||s.startsWith("http")||t.setAttribute(e,n+"/"+encodeURIComponent(s))}))}return t=(new XMLSerializer).serializeToString(r),i},customTypes:()=>(s('<?xml version="1.0" encoding="utf-8"?>\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:qti="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:m="http://www.w3.org/1998/Math/MathML">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\t \n <xsl:param name="separator" select="\' \'" />\n <xsl:param name="prefix" select="\'type:\'" />\n <xsl:variable name="prefixElements"></xsl:variable>\n <xsl:variable name="suffixElements"></xsl:variable>\n \x3c!-- passthrough --\x3e\n <xsl:template match="*">\n <xsl:copy>\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:copy>\n </xsl:template>\n <xsl:template match="@* | text()">\n <xsl:copy-of select="." />\n </xsl:template>\n \n <xsl:template match="*">\n <xsl:variable name="elementName">\n <xsl:call-template name="getTypedElementName">\n <xsl:with-param name="input" select="." />\n </xsl:call-template>\n </xsl:variable>\n <xsl:element name="{$elementName}">\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:element>\n </xsl:template>\n \n \x3c!-- custom names --\x3e\n <xsl:template name="getType">\n <xsl:param name="input" />\n <xsl:param name="separator" select="$separator" />\n <xsl:param name="prefix" select="$prefix" />\n <xsl:variable name="output">\n <xsl:choose>\n <xsl:when test="contains($input, $separator)">\n <xsl:value-of select="substring-before($input, $separator)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="$input" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n <xsl:choose>\n <xsl:when test="starts-with($output, $prefix) and $output != $prefix">\n <xsl:value-of select="substring-after($output, $prefix)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:variable name="after" select="substring-after($input, $separator)" />\n <xsl:if test="$after">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$after" />\n <xsl:with-param name="separator" select="$separator" />\n <xsl:with-param name="prefix" select="$prefix" />\n </xsl:call-template>\n </xsl:if>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n \n <xsl:template name="getTypedElementName">\n <xsl:param name="input" />\n <xsl:variable name="prefixElements" select="document(\'\')//xsl:variable[@name = \'prefixElements\']/element" />\n <xsl:variable name="suffixElements" select="document(\'\')//xsl:variable[@name = \'suffixElements\']/element" />\n <xsl:variable name="originalName" select="name($input)" />\n <xsl:variable name="type">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$input/@class" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="$originalName" />\n \x3c!-- Add prefix elements --\x3e\n <xsl:if test="$prefixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n \x3c!-- Add suffix to typed elements --\x3e\n <xsl:if test="string-length($type)">\n <xsl:text>-</xsl:text>\n <xsl:value-of select="$type" />\n </xsl:if>\n \x3c!-- Add suffix to elements --\x3e\n <xsl:if test="$suffixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n </xsl:template>\n </xsl:stylesheet>'),i),suffix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,e+"-"+s)})),i),prefix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,s+"-"+e)})),i),fn:e=>(t=e(t),i),elementNameAttributes:e=>(e.forEach((e=>{t=t.replaceAll(e,e+` data-element="${e}" `)})),i),print:()=>(console.log(t),i),xml:()=>(t=je(t),t)};return i};
343
+ `,m([i.property({type:Boolean,reflect:!0}),g("design:type",Object)],Be.prototype,"disabled",void 0),m([y("disabled",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Boolean]),g("design:returntype",void 0)],Be.prototype,"handleDisabledChange",null),m([i.property({type:Boolean,reflect:!0}),g("design:type",Object)],Be.prototype,"readonly",void 0),m([y("readonly",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Boolean]),g("design:returntype",void 0)],Be.prototype,"handleReadonlyChange",null),m([i.property({type:Object,reflect:!0}),g("design:type",Object)],Be.prototype,"responses",void 0),m([y("responses",{waitUntilFirstUpdate:!0}),g("design:type",Function),g("design:paramtypes",[Object,Object]),g("design:returntype",void 0)],Be.prototype,"handleResponsesChange",null),m([i.state(),g("design:type",h)],Be.prototype,"_item",void 0),customElements.define("qti-item",Be);const Fe=e=>{const t=e.split("/>");let s="";for(let e=0;e<t.length-1;e++){const i=t[e].split("<");s+=t[e]+"></"+i[i.length-1].split(" ")[0]+">"}return s+t[t.length-1]};exports.QtiManualScoring=class extends p{textChanged(e){if(this.disabled||this.readonly)return;const t=e.target;this.value=t.value;this.parentElement.querySelector("qti-assessment-item").setOutcomeValue("SCORE",this.value)}render(){return s.html`<input
344
+ type="number"
345
+ spellcheck="false"
346
+ autocomplete="off"
347
+ @keyup="${this.textChanged}"
348
+ @change="${this.textChanged}"
349
+ placeholder="score"
350
+ .value="${this.value}"
351
+ size="10"
352
+ ?disabled="${!1}"
353
+ ?readonly="${!1}"
354
+ />`}},m([i.property({type:Number,attribute:!1}),g("design:type",String)],exports.QtiManualScoring.prototype,"value",void 0),exports.QtiManualScoring=m([i.customElement("qti-manual-scoring")],exports.QtiManualScoring),exports.AssessmentTestEvents=He,exports.Choices=T,exports.Events=l,exports.OutcomeVariable=d,exports.QtiAnd=Z,exports.QtiAssessmentItem=h,exports.QtiAssociateInteraction=le,exports.QtiBaseValue=K,exports.QtiChoiceInteraction=L,exports.QtiContains=X,exports.QtiCorrect=z,exports.QtiCustomOperatorLevenshtein=Ae,exports.QtiCustomOperatorNumericOnly=Ne,exports.QtiCustomOperatorParseNumberLocalNl=Le,exports.QtiCustomOperatorRemoveAllSpaces=Me,exports.QtiCustomOperatorTrim=$e,exports.QtiExpression=P,exports.QtiExtendedTextInteraction=I,exports.QtiFeedbackInline=S,exports.QtiGap=he,exports.QtiGapMatchInteraction=de,exports.QtiGapText=pe,exports.QtiGraphicAssociateInteraction=me,exports.QtiGraphicGapMatchInteraction=ge,exports.QtiGraphicOrderInteraction=be,exports.QtiGte=Y,exports.QtiHotspotChoice=ye,exports.QtiHotspotInteraction=fe,exports.QtiHottextInteraction=A,exports.QtiInlineChoiceInteraction=N,exports.QtiIsNull=te,exports.QtiItem=Be,exports.QtiMapResponse=B,exports.QtiMatch=V,exports.QtiMatchInteraction=xe,exports.QtiMediaInteraction=ve,exports.QtiModalFeedback=O,exports.QtiMultiple=J,exports.QtiOr=ee,exports.QtiOrderInteraction=Ee,exports.QtiOutcomeDeclaration=C,exports.QtiPortableCustomInteraction=se,exports.QtiPrompt=f,exports.QtiResponseCondition=Q,exports.QtiResponseDeclaration=E,exports.QtiResponseElse=H,exports.QtiResponseElseIf=D,exports.QtiResponseIf=j,exports.QtiResponseProcessing=M,exports.QtiSelectPointInteraction=Ce,exports.QtiSetOutcomeValue=G,exports.QtiSliderInteraction=Te,exports.QtiStylesheet=u,exports.QtiTextEntryInteraction=w,exports.QtiVariable=W,exports.ResponseVariable=c,exports.Status={EMPTY:"empty",USER:"user",FEEDBACK:"feedback",EXPECTED:"expected"},exports.fixSelfClosingTags=Fe,exports.qtiSimpleAssociableChoice=ce,exports.qtiTransform=e=>{let t=e;const s=e=>{const s=(new DOMParser).parseFromString(t,"text/xml"),i=new XSLTProcessor,n=(new DOMParser).parseFromString(e,"text/xml");i.importStylesheet(n);const r=i.transformToFragment(s,document);t=(new XMLSerializer).serializeToString(r)},i={mathml:()=>(s(""),i),removeNamesSpaces:()=>(s('\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\n <xsl:template match="*">\n \x3c!-- remove element prefix --\x3e\n <xsl:element name="{local-name()}">\n \x3c!-- process attributes --\x3e\n <xsl:for-each select="@*">\n \x3c!-- remove attribute prefix --\x3e\n <xsl:attribute name="{local-name()}">\n <xsl:value-of select="."/>\n </xsl:attribute>\n </xsl:for-each>\n <xsl:apply-templates/>\n </xsl:element>\n </xsl:template>\n</xsl:stylesheet>'),i),pciHooks(e){const s=["hook","module"],n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const t of s){r.querySelectorAll("["+t+"]").forEach((s=>{const i=s.getAttribute(t);i.startsWith("data:")||i.startsWith("http")||(s.setAttribute("base-url",e),s.setAttribute("module",n+"/"+encodeURIComponent(i+(i.endsWith(".js")?"":".js"))))}))}return t=(new XMLSerializer).serializeToString(r),i},assetsLocation(e,s=["src","href","data"]){const n=e.substring(0,e.lastIndexOf("/")),r=(new DOMParser).parseFromString(t,"text/xml");for(const e of s){r.querySelectorAll("["+e+"]").forEach((t=>{const s=t.getAttribute(e);s.startsWith("data:")||s.startsWith("http")||t.setAttribute(e,n+"/"+encodeURIComponent(s))}))}return t=(new XMLSerializer).serializeToString(r),i},customTypes:()=>(s('<?xml version="1.0" encoding="utf-8"?>\n <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:qti="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:m="http://www.w3.org/1998/Math/MathML">\n <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>\t \n <xsl:param name="separator" select="\' \'" />\n <xsl:param name="prefix" select="\'type:\'" />\n <xsl:variable name="prefixElements"></xsl:variable>\n <xsl:variable name="suffixElements"></xsl:variable>\n \x3c!-- passthrough --\x3e\n <xsl:template match="*">\n <xsl:copy>\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:copy>\n </xsl:template>\n <xsl:template match="@* | text()">\n <xsl:copy-of select="." />\n </xsl:template>\n \n <xsl:template match="*">\n <xsl:variable name="elementName">\n <xsl:call-template name="getTypedElementName">\n <xsl:with-param name="input" select="." />\n </xsl:call-template>\n </xsl:variable>\n <xsl:element name="{$elementName}">\n <xsl:apply-templates select="* | @* | text()" />\n </xsl:element>\n </xsl:template>\n \n \x3c!-- custom names --\x3e\n <xsl:template name="getType">\n <xsl:param name="input" />\n <xsl:param name="separator" select="$separator" />\n <xsl:param name="prefix" select="$prefix" />\n <xsl:variable name="output">\n <xsl:choose>\n <xsl:when test="contains($input, $separator)">\n <xsl:value-of select="substring-before($input, $separator)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="$input" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n <xsl:choose>\n <xsl:when test="starts-with($output, $prefix) and $output != $prefix">\n <xsl:value-of select="substring-after($output, $prefix)" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:variable name="after" select="substring-after($input, $separator)" />\n <xsl:if test="$after">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$after" />\n <xsl:with-param name="separator" select="$separator" />\n <xsl:with-param name="prefix" select="$prefix" />\n </xsl:call-template>\n </xsl:if>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n \n <xsl:template name="getTypedElementName">\n <xsl:param name="input" />\n <xsl:variable name="prefixElements" select="document(\'\')//xsl:variable[@name = \'prefixElements\']/element" />\n <xsl:variable name="suffixElements" select="document(\'\')//xsl:variable[@name = \'suffixElements\']/element" />\n <xsl:variable name="originalName" select="name($input)" />\n <xsl:variable name="type">\n <xsl:call-template name="getType">\n <xsl:with-param name="input" select="$input/@class" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="$originalName" />\n \x3c!-- Add prefix elements --\x3e\n <xsl:if test="$prefixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n \x3c!-- Add suffix to typed elements --\x3e\n <xsl:if test="string-length($type)">\n <xsl:text>-</xsl:text>\n <xsl:value-of select="$type" />\n </xsl:if>\n \x3c!-- Add suffix to elements --\x3e\n <xsl:if test="$suffixElements[text() = $originalName]">\n <xsl:text>-</xsl:text>\n </xsl:if>\n </xsl:template>\n </xsl:stylesheet>'),i),suffix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,e+"-"+s)})),i),prefix:(e,s)=>(e.forEach((e=>{t=t.replaceAll(e,s+"-"+e)})),i),fn:e=>(t=e(t),i),elementNameAttributes:e=>(e.forEach((e=>{t=t.replaceAll(e,e+` data-element="${e}" `)})),i),print:()=>(console.log(t),i),xml:()=>(t=Fe(t),t)};return i};