@citolab/qti-components 7.3.14 → 7.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/chunks/chunk-3GQR5P44.js +1465 -0
- package/cdn/chunks/chunk-3HBEGP7L.js +5 -0
- package/cdn/chunks/chunk-3YQMAZEO.js +29 -0
- package/cdn/chunks/chunk-4FHDGI2F.js +1 -0
- package/cdn/chunks/chunk-52ODZ2SG.js +1 -0
- package/cdn/chunks/chunk-75B2MTXK.js +5 -0
- package/cdn/chunks/chunk-CFTU3ORQ.js +8 -0
- package/cdn/chunks/chunk-D4MRLLZV.js +5 -0
- package/cdn/chunks/chunk-DCZUBT3N.js +8 -0
- package/cdn/chunks/chunk-DD7CA4II.js +3626 -0
- package/cdn/chunks/chunk-DM5ADAYX.js +5 -0
- package/cdn/chunks/chunk-DXSWZAQC.js +48 -0
- package/cdn/chunks/chunk-EQQ2Q5AI.js +37 -0
- package/cdn/chunks/chunk-FFAS2XX4.js +1 -0
- package/cdn/chunks/chunk-FSY4P2FB.js +5 -0
- package/cdn/chunks/chunk-GKQ7ZVSW.js +1 -0
- package/cdn/chunks/chunk-GT4M2OYS.js +6 -0
- package/cdn/chunks/chunk-I2FZKUEI.js +5 -0
- package/cdn/chunks/chunk-IJC7QQWZ.js +5 -0
- package/cdn/chunks/chunk-IKD3CWLJ.js +8 -0
- package/cdn/chunks/chunk-IRKXPLX4.js +8 -0
- package/cdn/chunks/chunk-ITRDMRY2.js +21 -0
- package/cdn/chunks/chunk-J3VBFXQ4.js +5 -0
- package/cdn/chunks/chunk-JEOUBKC3.js +48 -0
- package/cdn/chunks/chunk-JG2NZCZP.js +1 -0
- package/cdn/chunks/chunk-JHNDA6EI.js +10 -0
- package/cdn/chunks/chunk-JSQ33LHM.js +1465 -0
- package/cdn/chunks/chunk-JYWR4OFP.js +1 -0
- package/cdn/chunks/chunk-LY6AS3BU.js +8 -0
- package/cdn/chunks/chunk-MBXBNIVQ.js +1 -0
- package/cdn/chunks/chunk-NGP67REL.js +25 -0
- package/cdn/chunks/chunk-NR427UBQ.js +1465 -0
- package/cdn/chunks/chunk-NYIJRPFS.js +17 -0
- package/cdn/chunks/chunk-O42LSPRK.js +1476 -0
- package/cdn/chunks/chunk-OYRCVI2F.js +8 -0
- package/cdn/chunks/chunk-P3DHKBA3.js +18 -0
- package/cdn/chunks/chunk-PCYFDB62.js +1453 -0
- package/cdn/chunks/chunk-PRKJK3CO.js +8 -0
- package/cdn/chunks/chunk-Q3SNDE3I.js +1453 -0
- package/cdn/chunks/chunk-RPCHFSVN.js +5 -0
- package/cdn/chunks/chunk-RRZDPY4W.js +2 -0
- package/cdn/chunks/chunk-SP3SJHRT.js +1 -0
- package/cdn/chunks/chunk-TYGXINAY.js +8 -0
- package/cdn/chunks/chunk-U7UACCDW.js +1 -0
- package/cdn/chunks/chunk-VTKINN7M.js +1476 -0
- package/cdn/chunks/chunk-YAR3YZEP.js +17 -0
- package/cdn/chunks/chunk-ZZN6JPJW.js +1 -0
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-6JAP4TX6.js +8141 -0
- package/dist/chunks/chunk-6JAP4TX6.js.map +1 -0
- package/dist/chunks/chunk-D6RXMCYA.js +913 -0
- package/dist/chunks/chunk-D6RXMCYA.js.map +1 -0
- package/dist/chunks/chunk-GNXM5DVD.js +913 -0
- package/dist/chunks/chunk-GNXM5DVD.js.map +1 -0
- package/dist/chunks/chunk-HFAZT3RR.js +8142 -0
- package/dist/chunks/chunk-HFAZT3RR.js.map +1 -0
- package/dist/chunks/chunk-IQDKAADN.js +8003 -0
- package/dist/chunks/chunk-IQDKAADN.js.map +1 -0
- package/dist/chunks/chunk-JKJL266U.js +7994 -0
- package/dist/chunks/chunk-JKJL266U.js.map +1 -0
- package/dist/chunks/chunk-JW7LJSTW.js +7980 -0
- package/dist/chunks/chunk-JW7LJSTW.js.map +1 -0
- package/dist/chunks/chunk-TL4E7QIO.js +913 -0
- package/dist/chunks/chunk-TL4E7QIO.js.map +1 -0
- package/dist/chunks/chunk-U5D23TXK.js +913 -0
- package/dist/chunks/chunk-U5D23TXK.js.map +1 -0
- package/dist/chunks/chunk-VDUUQVX6.js +913 -0
- package/dist/chunks/chunk-VDUUQVX6.js.map +1 -0
- package/dist/index.html +0 -0
- package/dist/index.js +4 -4
- package/dist/qti-components/index.js +3 -3
- package/dist/qti-response-declaration-DxATRdhf.d.ts +1356 -0
- package/dist/qti-test/core/index.js +4 -4
- package/dist/qti-test-feedback-CeAIRGhn.d.ts +91 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as L}from"./chunk-ITRDMRY2.js";import{a as R,b as A}from"./chunk-CZDMOYYF.js";import{a as w,b as x}from"./chunk-QQR6POPY.js";import{g as S}from"./chunk-PCYFDB62.js";import{a as V}from"./chunk-ULI6NOVG.js";import{a as I,b as C}from"./chunk-3YQMAZEO.js";import{a as E,b as o}from"./chunk-NGP67REL.js";import{a as N,d,i as p}from"./chunk-EQQ2Q5AI.js";import{a as i}from"./chunk-JR322KXH.js";var M=(e=>(e.ITEM_NOT_FOUND="item-not-found",e.SECTION_NOT_FOUND="section-not-found",e.LOAD_ERROR="load-error",e.NETWORK_ERROR="network-error",e.TIMEOUT_ERROR="timeout-error",e))(M||{}),D=m=>{class c extends m{constructor(...t){super(...t);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this._activeRequests=[];this._navigationInProgress=!1;this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:e})=>{if(!e?.id)return;let s=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=s;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:e.type,id:e.id}),this._cancelActiveRequests(),this._targetNavigation={type:e.type,id:e.id},e.type==="item"?await this._navigateToItem(e.id):e.type==="section"&&await this._navigateToSection(e.id),this._lastNavigationRequestId!==s){console.log("Navigation was superseded by a newer request");return}}catch(u){if(this._lastNavigationRequestId===s){let a=this._normalizeError(u,e.type,e.id);this._lastError=a,this._dispatchErrorEvent(a),console.error(`Navigation error (${a.type}):`,a.message,a.details)}}finally{this._lastNavigationRequestId===s&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:e.type,id:e.id}))}}),this.addEventListener("qti-assessment-test-connected",e=>{this._testElement=e.detail,this._initializeNavigation()})}_initializeNavigation(){let t;this.navigate==="section"&&(t=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(t=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),t&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:t},bubbles:!0,composed:!0}))}navigateTo(t,e){e||(t==="section"&&(e=this._testElement?.querySelector("qti-assessment-section")?.identifier),t==="item"&&(e=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}async _navigateToItem(t){let e=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`);if(!e)throw{type:"item-not-found",message:`Item with identifier "${t}" not found.`,itemId:t};let s=e.closest("qti-test-part")?.identifier,u=e.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:u,navItemRefId:t,navItemLoading:!0};try{await this._loadItems([t])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(t){let e=this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`);if(!e)throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};let s=e.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:t,navItemRefId:null,navItemLoading:!0};try{let u=this._getSectionItemIds(t);await this._loadItems(u)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(t,e,s){return t&&t.type&&Object.values(M).includes(t.type)?t:t instanceof DOMException&&t.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:t}:t.name==="TimeoutError"||t.message&&t.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:t}:t instanceof TypeError&&t.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:t}:{type:"load-error",message:`Failed to load ${e}: ${s}`,details:t,itemId:e==="item"?s:void 0,sectionId:e==="section"?s:void 0}}_dispatchErrorEvent(t){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:t,bubbles:!0,composed:!0}))}_dispatchStatusEvent(t){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:t,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(t=>{t&&t.readyState!==4&&t.abort()}),this._activeRequests=[])}async _loadItems(t){if(!this._testElement||t.length===0)return;let e=t.map(a=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${a}"]`)),s=e.reduce((a,v,l)=>(v||a.push(t[l]),a),[]);if(s.length>0)throw{type:"item-not-found",message:`One or more items not found: ${s.join(", ")}`,details:{missingItems:s}};this._clearLoadedItems();let u=e.map(async a=>{if(!a)return null;let v=new Promise((l,b)=>{setTimeout(()=>{b({name:"TimeoutError",message:`Request for item ${a.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:l,request:b}=V(this.cacheTransform).load(a.href);b instanceof XMLHttpRequest&&this._activeRequests.push(b);let B=await Promise.race([l,v]);return{itemRef:a,doc:B.htmlDoc(),request:b}}catch(l){if(l instanceof DOMException&&l.name==="AbortError"||l&&l.name==="TimeoutError")return console.log(`Request for item ${a.identifier} was ${l.name==="TimeoutError"?"timed out":"aborted"}`),null;throw l.itemId=a.identifier,l}});try{let v=(await Promise.all(u)).filter(l=>l!==null);if(v.forEach(({itemRef:l,doc:b})=>{l&&b&&(l.xmlDoc=b)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:v.map(({itemRef:l})=>({identifier:l?.identifier,element:l})),bubbles:!0,composed:!0}))}),v.length===0&&t.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:t}};return v}catch(a){throw console.error("Error loading items:",a),a}}_getSectionItemIds(t){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`))throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${t}"] > qti-assessment-item-ref`)).map(s=>s.identifier)}_clearLoadedItems(){let t=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(t||[]).forEach(e=>{e.xmlDoc=null})}retryNavigation(){if(this._lastError){let t=this._lastError.itemId?"item":"section",e=this._lastError.itemId||this._lastError.sectionId;e&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return i([o({type:String})],c.prototype,"navigate",2),i([o({type:Boolean,attribute:"cache-transform"})],c.prototype,"cacheTransform",2),i([o({type:Number})],c.prototype,"requestTimeout",2),i([o({type:Boolean})],c.prototype,"showLoadingIndicators",2),c};var P=m=>{class c extends m{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",t=>{this.sessionContext={...this.sessionContext,view:t.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",t=>{this._updateElementView(),this._setCorrectResponseVisibility(t.detail)})}willUpdate(n){super.willUpdate(n),n.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;e&&e.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(n){n.showCorrectResponse(this.sessionContext.view==="scorer")}}return c};var q=class extends p{constructor(){super();this.testContext=w;this.sessionContext=R;this._updateItemInTestContext=r=>{let n=r._context,t=n.identifier,e=n.variables,s=this.testContext.items.find(u=>u?.identifier===t);if(!s){console.warn(`Item IDs between assessment.xml and item.xml should match: ${t} is not found!`);return}s.variables?.length===1?this._updateItemVariablesInTestContext(t,e):r.variables=[...s.variables||[]]};this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=w,this.sessionContext=R,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(t=>({href:t.href,identifier:t.identifier,category:t.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,t=n.closest("qti-assessment-item-ref")?.identifier;t&&(n.assessmentItemRefId=t),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables)})}updateItemVariables(r,n){let t=this.testContext.items.find(s=>s.identifier===r);t&&(t.variables=t.variables.map(s=>{let u=n.find(a=>a.identifier===s.identifier);return u?{...s,...u}:s}));let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);e&&e.assessmentItem&&e.assessmentItem&&(e.assessmentItem.variables=n)}_updateItemVariablesInTestContext(r,n){this.testContext={...this.testContext,items:this.testContext.items.map(t=>t.identifier!==r?t:{...t,variables:n.map(e=>{let s=t.variables.find(u=>u.identifier===e.identifier);return s?{...s,...e}:e})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};i([o({attribute:!1,type:Object}),I({context:x})],q.prototype,"testContext",2),i([o({attribute:!1,type:Object}),I({context:A})],q.prototype,"sessionContext",2);var $=m=>{class c extends m{constructor(...n){super(...n),this.addEventListener("qti-register-variable",t=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],t.detail.variable]},t.stopPropagation()}),this.addEventListener("qti-set-outcome-value",t=>{let{outcomeIdentifier:e,value:s}=t.detail;this.updateOutcomeVariable(e,s),t.stopPropagation()})}outcomeProcessing(){let n=this.querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}updateOutcomeVariable(n,t){let e=this.getOutcome(n);if(!e){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:e.cardinality==="single"?t:[...s.value,t]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(t=>t.identifier===n)||null}}return c};var T=class extends D(P($(q))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return d`<slot></slot>`}};T=i([E("qti-test")],T);var k={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},f=class extends p{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let r=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");r&&(this.myTemplate=L(r)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};i([o({type:String})],f.prototype,"category",2),i([o({type:String})],f.prototype,"identifier",2),i([o({type:Boolean,converter:k})],f.prototype,"required",2),i([o({type:Boolean,converter:k})],f.prototype,"fixed",2),i([o({type:String})],f.prototype,"href",2),i([o({type:Object,attribute:!1})],f.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",f);var O={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},h=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};i([o({type:String})],h.prototype,"identifier",2),i([o({type:String})],h.prototype,"required",2),i([o({type:Boolean,converter:O})],h.prototype,"fixed",2),i([o({type:Boolean,converter:O})],h.prototype,"visible",2),i([o({type:Boolean,converter:O,attribute:"keep-together"})],h.prototype,"keepTogether",2),i([C({context:x,subscribe:!0})],h.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",h);var y=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],y.prototype,"identifier",2),i([o({type:String})],y.prototype,"title",1),i([C({context:x,subscribe:!0})],y.prototype,"_testContext",2),y=i([E("qti-assessment-test")],y);var g=class extends p{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],g.prototype,"identifier",2),i([o({type:String})],g.prototype,"class",2),i([o({type:String,attribute:"navigation-mode"})],g.prototype,"navigationMode",2),i([o({type:String,attribute:"submission-mode"})],g.prototype,"submissionMode",2),g=i([E("qti-test-part")],g);customElements.get("qti-test-part")||customElements.define("qti-test-part",g);var _=class extends S{render(){return d``}};_.styles=N`
|
|
2
|
+
:host {
|
|
3
|
+
color: gray;
|
|
4
|
+
}
|
|
5
|
+
`,_=i([E("qti-test-feedback")],_);export{T as a,f as b,h as c,y as d,g as e,_ as f};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import{a as b}from"./chunk-P6SSTAJ2.js";import{b as c}from"./chunk-3YQMAZEO.js";import{a as m}from"./chunk-NGP67REL.js";import{a as d,d as a,i as l}from"./chunk-EQQ2Q5AI.js";import{a as i}from"./chunk-JR322KXH.js";var o=class extends l{render(){let s=this.computedContext?.testParts.flatMap(t=>t.sections.flatMap(p=>p.items)).find(t=>t.active);if(!s||!s.variables)return a``;let u=s.variables.filter(t=>t.type==="response"),f=s.variables.filter(t=>t.type==="outcome"),n=(t,p)=>a`
|
|
2
|
+
<h3>${p}</h3>
|
|
3
|
+
<table>
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th>Identifier</th>
|
|
7
|
+
<th>Value</th>
|
|
8
|
+
<th>Cardinality</th>
|
|
9
|
+
<th>Base Type</th>
|
|
10
|
+
<th>Correct Response / Mappings</th>
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
13
|
+
<tbody>
|
|
14
|
+
${t.map(e=>{let h=e.correctResponse?Array.isArray(e.correctResponse)?e.correctResponse.join(", "):e.correctResponse:"",x=e.mapping?.mapEntries?.map(r=>`${r.mapKey}=${r.mappedValue}pt`).join(", ")||"",y=e.areaMapping?.areaMapEntries?.map(r=>`${r.shape}(${r.coords})=${r.mappedValue}pt`).join(", ")||"";return a`
|
|
15
|
+
<tr>
|
|
16
|
+
<td>${e.identifier}</td>
|
|
17
|
+
<td>${Array.isArray(e.value)?e.value.join(", "):e.value}</td>
|
|
18
|
+
<td>${e.cardinality}</td>
|
|
19
|
+
<td>${e.baseType}</td>
|
|
20
|
+
<td>${h||x||y}</td>
|
|
21
|
+
</tr>
|
|
22
|
+
`})}
|
|
23
|
+
</tbody>
|
|
24
|
+
</table>
|
|
25
|
+
`;return a`
|
|
26
|
+
${n(u,"Response Variables")} ${n(f,"Outcome Variables")}
|
|
27
|
+
`}};o.styles=d`
|
|
28
|
+
table {
|
|
29
|
+
width: 100%;
|
|
30
|
+
border-collapse: collapse;
|
|
31
|
+
margin: 20px 0;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
text-align: left;
|
|
34
|
+
}
|
|
35
|
+
th,
|
|
36
|
+
td {
|
|
37
|
+
border: 1px solid #ddd;
|
|
38
|
+
padding: 8px;
|
|
39
|
+
}
|
|
40
|
+
th {
|
|
41
|
+
background-color: #f4f4f4;
|
|
42
|
+
font-weight: bold;
|
|
43
|
+
}
|
|
44
|
+
h3 {
|
|
45
|
+
margin-top: 20px;
|
|
46
|
+
font-size: 16px;
|
|
47
|
+
}
|
|
48
|
+
`,i([c({context:b,subscribe:!0})],o.prototype,"computedContext",2),o=i([m("test-print-item-variables")],o);export{o as a};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var I=globalThis,Z=I.ShadowRoot&&(I.ShadyCSS===void 0||I.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ht=Symbol(),bt=new WeakMap,B=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==ht)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=bt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&bt.set(e,t))}return t}toString(){return this.cssText}},St=r=>new B(typeof r=="string"?r:r+"",void 0,ht),Ft=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((s,i,n)=>s+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[n+1],r[0]);return new B(e,r,ht)},wt=(r,t)=>{if(Z)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),i=I.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},lt=Z||I.CSSStyleSheet===void 0?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return St(e)})(r):r;var Pt=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var v=function(r,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?r!==t||!i:!t.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(r,e):i?i.value=e:t.set(r,e),e},m=function(r,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!s:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(r):s?s.value:t.get(r)},N,J,X,D,ct,k,Y,w,W,S,Q,Tt,Ct=r=>typeof r=="boolean"?r:r?.capture??!1;var qt=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,s){if(e==null)return;let i=Ct(s)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let a=typeof s=="object"&&s?s:{};a.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,s)),n.set(e,a??{})}removeEventListener(t,e,s){if(e==null)return;let i=Ct(s)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=[this],s=this.__eventTargetParent;if(t.composed)for(;s;)e.push(s),s=s.__eventTargetParent;else for(;s&&s!==this.__host;)e.push(s),s=s.__eventTargetParent;let i=!1,n=!1,a=0,d=null,o=null,c=null,p=t.stopPropagation,l=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return d??o},...h},srcElement:{get(){return t.target},...h},currentTarget:{get(){return c},...h},eventPhase:{get(){return a},...h},composedPath:{value:()=>e,...h},stopPropagation:{value:()=>{i=!0,p.call(t)},...h},stopImmediatePropagation:{value:()=>{n=!0,l.call(t)},...h}});let g=(u,$,U)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),$.once&&U.delete(u)},f=()=>(c=null,a=0,!t.defaultPrevented),b=e.slice().reverse();d=!this.__host||!t.composed?this:null;let yt=u=>{for(o=this;o.__host&&u.includes(o.__host);)o=o.__host};for(let u of b){!d&&(!o||o===u.__host)&&yt(b.slice(b.indexOf(u))),c=u,a=u===t.target?2:1;let $=u.__captureEventListeners.get(t.type);if($){for(let[U,ot]of $)if(g(U,ot,$),n)return f()}if(i)return f()}let at=t.bubbles?e:[this];o=null;for(let u of at){!d&&(!o||u===o.__host)&&yt(at.slice(0,at.indexOf(u)+1)),c=u,a=u===t.target?2:3;let $=u.__eventListeners.get(t.type);if($){for(let[U,ot]of $)if(g(U,ot,$),n)return f()}if(i)return f()}return f()}},dt=qt;var h={__proto__:null};h.enumerable=!0;Object.freeze(h);var ut=(S=class{constructor(t,e={}){if(N.set(this,!1),J.set(this,!1),X.set(this,!1),D.set(this,!1),ct.set(this,Date.now()),k.set(this,!1),Y.set(this,void 0),w.set(this,void 0),W.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:s,cancelable:i,composed:n}=e;v(this,N,!!i,"f"),v(this,J,!!s,"f"),v(this,X,!!n,"f"),v(this,Y,`${t}`,"f"),v(this,w,null,"f"),v(this,W,!1,"f")}initEvent(t,e,s){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){v(this,D,!0,"f")}get target(){return m(this,w,"f")}get currentTarget(){return m(this,w,"f")}get srcElement(){return m(this,w,"f")}get type(){return m(this,Y,"f")}get cancelable(){return m(this,N,"f")}get defaultPrevented(){return m(this,N,"f")&&m(this,D,"f")}get timeStamp(){return m(this,ct,"f")}composedPath(){return m(this,W,"f")?[m(this,w,"f")]:[]}get returnValue(){return!m(this,N,"f")||!m(this,D,"f")}get bubbles(){return m(this,J,"f")}get composed(){return m(this,X,"f")}get eventPhase(){return m(this,W,"f")?S.AT_TARGET:S.NONE}get cancelBubble(){return m(this,k,"f")}set cancelBubble(t){t&&v(this,k,!0,"f")}stopPropagation(){v(this,k,!0,"f")}get isTrusted(){return!1}},N=new WeakMap,J=new WeakMap,X=new WeakMap,D=new WeakMap,ct=new WeakMap,k=new WeakMap,Y=new WeakMap,w=new WeakMap,W=new WeakMap,S.NONE=0,S.CAPTURING_PHASE=1,S.AT_TARGET=2,S.BUBBLING_PHASE=3,S);Object.defineProperties(ut.prototype,{initEvent:h,stopImmediatePropagation:h,preventDefault:h,target:h,currentTarget:h,srcElement:h,type:h,cancelable:h,defaultPrevented:h,timeStamp:h,composedPath:h,returnValue:h,bubbles:h,composed:h,eventPhase:h,cancelBubble:h,stopPropagation:h,isTrusted:h});var Rt=(Tt=class extends ut{constructor(t,e={}){super(t,e),Q.set(this,void 0),v(this,Q,e?.detail??null,"f")}initCustomEvent(t,e,s,i){throw new Error("Method not implemented.")}get detail(){return m(this,Q,"f")}},Q=new WeakMap,Tt);Object.defineProperties(Rt.prototype,{detail:h});var pt=ut,_t=Rt;globalThis.Event??(globalThis.Event=pt);globalThis.CustomEvent??(globalThis.CustomEvent=_t);var xt=new WeakMap,V=r=>{let t=xt.get(r);return t===void 0&&xt.set(r,t=new Map),t},Kt=class extends dt{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(V(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){V(this).set(t,String(e))}removeAttribute(t){V(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return V(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Pt(this);return this.__internals=t,t}getAttribute(t){return V(this).get(t)??null}};var Zt=class extends Kt{},mt=Zt;globalThis.litServerRoot??(globalThis.litServerRoot=Object.defineProperty(new mt,"localName",{get(){return"lit-server-root"}}));var Jt=class{constructor(){this.__definitions=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]})}get(t){return this.__definitions.get(t)?.ctor}},Xt=Jt;var Mt=new Xt;var{is:Yt,defineProperty:Qt,getOwnPropertyDescriptor:te,getOwnPropertyNames:ee,getOwnPropertySymbols:se,getPrototypeOf:ie}=Object,E=globalThis;E.customElements??(E.customElements=Mt);var Nt=E.trustedTypes,re=Nt?Nt.emptyScript:"",ne=E.reactiveElementPolyfillSupport,j=(r,t)=>r,ft={toAttribute(r,t){switch(t){case Boolean:r=r?re:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},Ht=(r,t)=>!Yt(r,t),Lt={attribute:!0,type:String,converter:ft,reflect:!1,useDefault:!1,hasChanged:Ht};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),E.litPropertyMetadata??(E.litPropertyMetadata=new WeakMap);var A=class extends(globalThis.HTMLElement??mt){static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Lt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Qt(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){let{get:i,set:n}=te(this.prototype,t)??{get(){return this[e]},set(a){this[e]=a}};return{get:i,set(a){let d=i?.call(this);n?.call(this,a),this.requestUpdate(t,d,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Lt}static _$Ei(){if(this.hasOwnProperty(j("elementProperties")))return;let t=ie(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(j("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(j("properties"))){let e=this.properties,s=[...ee(e),...se(e)];for(let i of s)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(lt(i))}else t!==void 0&&e.push(lt(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return wt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:ft).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=s.getPropertyOptions(i),a=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:ft;this._$Em=i,this[i]=a.fromAttribute(e,n.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){let i=this.constructor,n=this[t];if(s??(s=i.getPropertyOptions(t)),!((s.hasChanged??Ht)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:n},a){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,a??e??this[t]),n!==!0||a!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,n]of s){let{wrapped:a}=n,d=this[i];a!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,n,d)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[j("elementProperties")]=new Map,A[j("finalized")]=new Map,ne?.({ReactiveElement:A}),(E.reactiveElementVersions??(E.reactiveElementVersions=[])).push("2.1.0");var L=globalThis,tt=L.trustedTypes,Ot=tt?tt.createPolicy("lit-html",{createHTML:r=>r}):void 0,Et="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,vt="?"+y,ae=`<${vt}>`,C=L.document===void 0?{createTreeWalker:()=>({})}:document,z=()=>C.createComment(""),F=r=>r===null||typeof r!="object"&&typeof r!="function",$t=Array.isArray,Wt=r=>$t(r)||typeof r?.[Symbol.iterator]=="function",gt=`[
|
|
3
|
+
\f\r]`,G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ut=/-->/g,It=/>/g,P=RegExp(`>|${gt}(?:([^\\s"'>=/]+)(${gt}*=${gt}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Bt=/'/g,Dt=/"/g,Vt=/^(?:script|style|textarea|title)$/i,At=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Me=At(1),Ne=At(2),Le=At(3),R=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),kt=new WeakMap,T=C.createTreeWalker(C,129);function jt(r,t){if(!$t(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ot!==void 0?Ot.createHTML(t):t}var Gt=(r,t)=>{let e=r.length-1,s=[],i,n=t===2?"<svg>":t===3?"<math>":"",a=G;for(let d=0;d<e;d++){let o=r[d],c,p,l=-1,g=0;for(;g<o.length&&(a.lastIndex=g,p=a.exec(o),p!==null);)g=a.lastIndex,a===G?p[1]==="!--"?a=Ut:p[1]!==void 0?a=It:p[2]!==void 0?(Vt.test(p[2])&&(i=RegExp("</"+p[2],"g")),a=P):p[3]!==void 0&&(a=P):a===P?p[0]===">"?(a=i??G,l=-1):p[1]===void 0?l=-2:(l=a.lastIndex-p[2].length,c=p[1],a=p[3]===void 0?P:p[3]==='"'?Dt:Bt):a===Dt||a===Bt?a=P:a===Ut||a===It?a=G:(a=P,i=void 0);let f=a===P&&r[d+1].startsWith("/>")?" ":"";n+=a===G?o+ae:l>=0?(s.push(c),o.slice(0,l)+Et+o.slice(l)+y+f):o+y+(l===-2?d:f)}return[jt(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},q=class r{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,a=0,d=t.length-1,o=this.parts,[c,p]=Gt(t,e);if(this.el=r.createElement(c,s),T.currentNode=this.el.content,e===2||e===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=T.nextNode())!==null&&o.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let l of i.getAttributeNames())if(l.endsWith(Et)){let g=p[a++],f=i.getAttribute(l).split(y),b=/([.?@])?(.*)/.exec(g);o.push({type:1,index:n,name:b[2],strings:f,ctor:b[1]==="."?st:b[1]==="?"?it:b[1]==="@"?rt:M}),i.removeAttribute(l)}else l.startsWith(y)&&(o.push({type:6,index:n}),i.removeAttribute(l));if(Vt.test(i.tagName)){let l=i.textContent.split(y),g=l.length-1;if(g>0){i.textContent=tt?tt.emptyScript:"";for(let f=0;f<g;f++)i.append(l[f],z()),T.nextNode(),o.push({type:2,index:++n});i.append(l[g],z())}}}else if(i.nodeType===8)if(i.data===vt)o.push({type:2,index:n});else{let l=-1;for(;(l=i.data.indexOf(y,l+1))!==-1;)o.push({type:7,index:n}),l+=y.length-1}n++}}static createElement(t,e){let s=C.createElement("template");return s.innerHTML=t,s}};function x(r,t,e=r,s){if(t===R)return t;let i=s!==void 0?e._$Co?.[s]:e._$Cl,n=F(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(r),i._$AT(r,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=x(r,i._$AS(r,t.values),i,s)),t}var et=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??C).importNode(e,!0);T.currentNode=i;let n=T.nextNode(),a=0,d=0,o=s[0];for(;o!==void 0;){if(a===o.index){let c;o.type===2?c=new H(n,n.nextSibling,this,t):o.type===1?c=new o.ctor(n,o.name,o.strings,this,t):o.type===6&&(c=new nt(n,this,t)),this._$AV.push(c),o=s[++d]}a!==o?.index&&(n=T.nextNode(),a++)}return T.currentNode=C,i}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},H=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=x(this,t,e),F(t)?t===_||t==null||t===""?(this._$AH!==_&&this._$AR(),this._$AH=_):t!==this._$AH&&t!==R&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Wt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==_&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=q.createElement(jt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new et(i,this),a=n.u(this.options);n.p(e),this.T(a),this._$AH=n}}_$AC(t){let e=kt.get(t.strings);return e===void 0&&kt.set(t.strings,e=new q(t)),e}k(t){$t(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,i=0;for(let n of t)i===e.length?e.push(s=new r(this.O(z()),this.O(z()),this,this.options)):s=e[i],s._$AI(n),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,n){this.type=1,this._$AH=_,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=_}_$AI(t,e=this,s,i){let n=this.strings,a=!1;if(n===void 0)t=x(this,t,e,0),a=!F(t)||t!==this._$AH&&t!==R,a&&(this._$AH=t);else{let d=t,o,c;for(t=n[0],o=0;o<n.length-1;o++)c=x(this,d[s+o],e,o),c===R&&(c=this._$AH[o]),a||(a=!F(c)||c!==this._$AH[o]),c===_?t=_:t!==_&&(t+=(c??"")+n[o+1]),this._$AH[o]=c}a&&!i&&this.j(t)}j(t){t===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},st=class extends M{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===_?void 0:t}},it=class extends M{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==_)}},rt=class extends M{constructor(t,e,s,i,n){super(t,e,s,i,n),this.type=5}_$AI(t,e=this){if((t=x(this,t,e,0)??_)===R)return;let s=this._$AH,i=t===_&&s!==_||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==_&&(s===_||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},nt=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){x(this,t)}},He={M:Et,P:y,A:vt,C:1,L:Gt,R:et,D:Wt,V:x,I:H,H:M,N:it,U:rt,B:st,F:nt},oe=L.litHtmlPolyfillSupport;oe?.(q,H),(L.litHtmlVersions??(L.litHtmlVersions=[])).push("3.3.0");var zt=(r,t,e)=>{let s=e?.renderBefore??t,i=s._$litPart$;if(i===void 0){let n=e?.renderBefore??null;s._$litPart$=i=new H(t.insertBefore(z(),n),n,void 0,e??{})}return i._$AI(r),i};var K=globalThis,O=class extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=zt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return R}};O._$litElement$=!0,O.finalized=!0,K.litElementHydrateSupport?.({LitElement:O});var he=K.litElementPolyfillSupport;he?.({LitElement:O});(K.litElementVersions??(K.litElementVersions=[])).push("4.2.0");export{Ft as a,ft as b,Ht as c,Me as d,Ne as e,R as f,_ as g,He as h,O as i};
|
|
5
|
+
/*! Bundled license information:
|
|
6
|
+
|
|
7
|
+
@lit/reactive-element/node/css-tag.js:
|
|
8
|
+
@lit-labs/ssr-dom-shim/index.js:
|
|
9
|
+
(**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2019 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
16
|
+
@lit-labs/ssr-dom-shim/lib/events.js:
|
|
17
|
+
(**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2023 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*)
|
|
22
|
+
|
|
23
|
+
lit-html/node/lit-html.js:
|
|
24
|
+
lit-element/lit-element.js:
|
|
25
|
+
(**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2017 Google LLC
|
|
28
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
+
*)
|
|
30
|
+
|
|
31
|
+
lit-html/node/is-server.js:
|
|
32
|
+
(**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2022 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
36
|
+
*)
|
|
37
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as g}from"./chunk-CZDMOYYF.js";import{b as _}from"./chunk-QQR6POPY.js";import{a as R}from"./chunk-P6SSTAJ2.js";import{a as A}from"./chunk-7ME56ODO.js";import{a as E,b as I}from"./chunk-3YQMAZEO.js";import{a as y,b,c as p}from"./chunk-NGP67REL.js";import{d as q,i as S}from"./chunk-EQQ2Q5AI.js";import{a as m}from"./chunk-JR322KXH.js";var a=class extends S{constructor(){super();this.identifier=void 0;this.initContext=[];this.configContext={};this.autoScoreItems=!1;this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-interaction-changed",this._handleInteractionChanged.bind(this)),this.addEventListener("test-end-attempt",this._handleTestEndAttempt.bind(this)),this.addEventListener("test-show-correct-response",this._handleTestShowCorrectResponse.bind(this)),this.addEventListener("test-update-outcome-variable",this._handleTestUpdateOutcomeVariable.bind(this))}_handleTestEndAttempt(o){let t=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,s=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,s)}_handleTestShowCorrectResponse(o){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCorrectResponse(o.detail)}_handleTestUpdateOutcomeVariable(o){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${o.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(o.detail.outcomeVariableId,o.detail.value)}_handleInteractionChanged(o){if(this.autoScoreItems){let e=o.composedPath()[0].closest("qti-assessment-item"),t=e.variables.find(s=>s.identifier==="SCORE");if(t&&t.externalScored===null&&e.adaptive==="false"){let s=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,s)}}}render(){return q`<slot></slot>`}_handleTestConnected(o){this._testElement=o.detail;let e=Array.from(this._testElement?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this._testElement.identifier,title:this._testElement.title,view:this._sessionContext?.view,testParts:e.map(t=>{let s=[...t.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:t.identifier,navigationMode:t.navigationMode,submissionMode:t.submissionMode,sections:s.map(i=>{let c=[...i.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:i.identifier,title:i.title,items:c.map(n=>({...this.initContext?.find(d=>d.identifier===n.identifier),active:!1,identifier:n.identifier,categories:n.category?n.category?.split(" "):[],href:n.href,variables:[]}))}})}})}}_handleItemConnected(o){let e=o.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(t=>({...t,sections:t.sections.map(s=>({...s,items:s.items.map(i=>{if(i.identifier!==e.parentElement.getAttribute("identifier"))return i;let n=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),d=e.querySelectorAll("qti-response-declaration"),u=Array.from(d).some(l=>l.querySelector("qti-correct-response")),f=Array.from(d).some(l=>{let x=l.querySelector("qti-mapping"),v=l.querySelector("qti-area-mapping");return x?.querySelector("qti-map-entry")||v?.querySelector("qti-area-map-entry")}),h=u||f,C=!!e.querySelector("qti-response-processing");return{...i,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:n,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:C}})}))}))}}willUpdate(o){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(t=>({...t,active:this._sessionContext?.navPartId===t.identifier||!1,sections:t.sections.map(s=>({...s,active:this._sessionContext?.navSectionId===s.identifier||!1,completed:s.items.every(i=>this._testContext.items.find(c=>c.identifier===i.identifier)?.variables.find(c=>c.identifier==="completionStatus").value==="completed"),items:s.items.map(i=>{let c=this._testContext?.items.find(r=>r.identifier===i.identifier),n={...i,...c,...this.initContext?.find(r=>r.identifier===i.identifier)},d=n.variables?.find(r=>r.identifier=="SCORE")?.value,u=parseInt(d?.toString()),f=n.variables?.find(r=>r.identifier==="completionStatus")?.value,h=n.variables?.find(r=>r.identifier==="RESPONSE")?.value||"",C=n.variables?.find(r=>r.identifier==="numAttempts")?.value||0,l=this._sessionContext?.navItemRefId===n.identifier||!1,x=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,v=i.variables?.find(r=>r.identifier=="MAXSCORE")?.value,M=parseInt(v?.toString());return{...n,completionStatus:f,numAttempts:C,score:u,response:h,index:x,active:l,maxScore:M}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};m([b({type:String})],a.prototype,"identifier",2),m([p()],a.prototype,"initContext",2),m([p(),E({context:A})],a.prototype,"configContext",2),m([p(),I({context:_,subscribe:!0})],a.prototype,"_testContext",2),m([p(),I({context:g,subscribe:!0})],a.prototype,"_sessionContext",2),m([p(),E({context:R})],a.prototype,"computedContext",2),m([b({type:Boolean,attribute:"auto-score-items"})],a.prototype,"autoScoreItems",2),a=m([y("test-navigation")],a);export{a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as L}from"./chunk-AV6ISYP4.js";import{a as R,b as A}from"./chunk-CZDMOYYF.js";import{a as w,b as x}from"./chunk-QQR6POPY.js";import{g as S}from"./chunk-JSQ33LHM.js";import{a as V}from"./chunk-ULI6NOVG.js";import{a as I,b as C}from"./chunk-7WJYJA45.js";import{a as E,b as o}from"./chunk-42P7F3FC.js";import{a as N,d,i as p}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-JR322KXH.js";var M=(e=>(e.ITEM_NOT_FOUND="item-not-found",e.SECTION_NOT_FOUND="section-not-found",e.LOAD_ERROR="load-error",e.NETWORK_ERROR="network-error",e.TIMEOUT_ERROR="timeout-error",e))(M||{}),D=m=>{class c extends m{constructor(...t){super(...t);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this._activeRequests=[];this._navigationInProgress=!1;this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:e})=>{if(!e?.id)return;let s=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=s;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:e.type,id:e.id}),this._cancelActiveRequests(),this._targetNavigation={type:e.type,id:e.id},e.type==="item"?await this._navigateToItem(e.id):e.type==="section"&&await this._navigateToSection(e.id),this._lastNavigationRequestId!==s){console.log("Navigation was superseded by a newer request");return}}catch(u){if(this._lastNavigationRequestId===s){let a=this._normalizeError(u,e.type,e.id);this._lastError=a,this._dispatchErrorEvent(a),console.error(`Navigation error (${a.type}):`,a.message,a.details)}}finally{this._lastNavigationRequestId===s&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:e.type,id:e.id}))}}),this.addEventListener("qti-assessment-test-connected",e=>{this._testElement=e.detail,this._initializeNavigation()})}_initializeNavigation(){let t;this.navigate==="section"&&(t=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(t=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),t&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:t},bubbles:!0,composed:!0}))}navigateTo(t,e){e||(t==="section"&&(e=this._testElement?.querySelector("qti-assessment-section")?.identifier),t==="item"&&(e=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}async _navigateToItem(t){let e=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`);if(!e)throw{type:"item-not-found",message:`Item with identifier "${t}" not found.`,itemId:t};let s=e.closest("qti-test-part")?.identifier,u=e.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:u,navItemRefId:t,navItemLoading:!0};try{await this._loadItems([t])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(t){let e=this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`);if(!e)throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};let s=e.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:t,navItemRefId:null,navItemLoading:!0};try{let u=this._getSectionItemIds(t);await this._loadItems(u)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(t,e,s){return t&&t.type&&Object.values(M).includes(t.type)?t:t instanceof DOMException&&t.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:t}:t.name==="TimeoutError"||t.message&&t.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:t}:t instanceof TypeError&&t.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:t}:{type:"load-error",message:`Failed to load ${e}: ${s}`,details:t,itemId:e==="item"?s:void 0,sectionId:e==="section"?s:void 0}}_dispatchErrorEvent(t){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:t,bubbles:!0,composed:!0}))}_dispatchStatusEvent(t){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:t,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(t=>{t&&t.readyState!==4&&t.abort()}),this._activeRequests=[])}async _loadItems(t){if(!this._testElement||t.length===0)return;let e=t.map(a=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${a}"]`)),s=e.reduce((a,v,l)=>(v||a.push(t[l]),a),[]);if(s.length>0)throw{type:"item-not-found",message:`One or more items not found: ${s.join(", ")}`,details:{missingItems:s}};this._clearLoadedItems();let u=e.map(async a=>{if(!a)return null;let v=new Promise((l,b)=>{setTimeout(()=>{b({name:"TimeoutError",message:`Request for item ${a.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:l,request:b}=V(this.cacheTransform).load(a.href);b instanceof XMLHttpRequest&&this._activeRequests.push(b);let B=await Promise.race([l,v]);return{itemRef:a,doc:B.htmlDoc(),request:b}}catch(l){if(l instanceof DOMException&&l.name==="AbortError"||l&&l.name==="TimeoutError")return console.log(`Request for item ${a.identifier} was ${l.name==="TimeoutError"?"timed out":"aborted"}`),null;throw l.itemId=a.identifier,l}});try{let v=(await Promise.all(u)).filter(l=>l!==null);if(v.forEach(({itemRef:l,doc:b})=>{l&&b&&(l.xmlDoc=b)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:v.map(({itemRef:l})=>({identifier:l?.identifier,element:l})),bubbles:!0,composed:!0}))}),v.length===0&&t.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:t}};return v}catch(a){throw console.error("Error loading items:",a),a}}_getSectionItemIds(t){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`))throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${t}"] > qti-assessment-item-ref`)).map(s=>s.identifier)}_clearLoadedItems(){let t=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(t||[]).forEach(e=>{e.xmlDoc=null})}retryNavigation(){if(this._lastError){let t=this._lastError.itemId?"item":"section",e=this._lastError.itemId||this._lastError.sectionId;e&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return i([o({type:String})],c.prototype,"navigate",2),i([o({type:Boolean,attribute:"cache-transform"})],c.prototype,"cacheTransform",2),i([o({type:Number})],c.prototype,"requestTimeout",2),i([o({type:Boolean})],c.prototype,"showLoadingIndicators",2),c};var P=m=>{class c extends m{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",t=>{this.sessionContext={...this.sessionContext,view:t.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",t=>{this._updateElementView(),this._setCorrectResponseVisibility(t.detail)})}willUpdate(n){super.willUpdate(n),n.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;e&&e.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(n){n.showCorrectResponse(this.sessionContext.view==="scorer")}}return c};var q=class extends p{constructor(){super();this.testContext=w;this.sessionContext=R;this._updateItemInTestContext=r=>{let n=r._context,t=n.identifier,e=n.variables,s=this.testContext.items.find(u=>u?.identifier===t);if(!s){console.warn(`Item IDs between assessment.xml and item.xml should match: ${t} is not found!`);return}s.variables?.length===1?this._updateItemVariablesInTestContext(t,e):r.variables=[...s.variables||[]]};this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=w,this.sessionContext=R,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(t=>({href:t.href,identifier:t.identifier,category:t.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,t=n.closest("qti-assessment-item-ref")?.identifier;t&&(n.assessmentItemRefId=t),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables)})}updateItemVariables(r,n){let t=this.testContext.items.find(s=>s.identifier===r);t&&(t.variables=t.variables.map(s=>{let u=n.find(a=>a.identifier===s.identifier);return u?{...s,...u}:s}));let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);e&&e.assessmentItem&&e.assessmentItem&&(e.assessmentItem.variables=n)}_updateItemVariablesInTestContext(r,n){this.testContext={...this.testContext,items:this.testContext.items.map(t=>t.identifier!==r?t:{...t,variables:n.map(e=>{let s=t.variables.find(u=>u.identifier===e.identifier);return s?{...s,...e}:e})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};i([o({attribute:!1,type:Object}),I({context:x})],q.prototype,"testContext",2),i([o({attribute:!1,type:Object}),I({context:A})],q.prototype,"sessionContext",2);var $=m=>{class c extends m{constructor(...n){super(...n),this.addEventListener("qti-register-variable",t=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],t.detail.variable]},t.stopPropagation()}),this.addEventListener("qti-set-outcome-value",t=>{let{outcomeIdentifier:e,value:s}=t.detail;this.updateOutcomeVariable(e,s),t.stopPropagation()})}outcomeProcessing(){let n=this.querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}updateOutcomeVariable(n,t){let e=this.getOutcome(n);if(!e){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:e.cardinality==="single"?t:[...s.value,t]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(t=>t.identifier===n)||null}}return c};var T=class extends D(P($(q))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return d`<slot></slot>`}};T=i([E("qti-test")],T);var k={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},f=class extends p{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let r=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");r&&(this.myTemplate=L(r)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};i([o({type:String})],f.prototype,"category",2),i([o({type:String})],f.prototype,"identifier",2),i([o({type:Boolean,converter:k})],f.prototype,"required",2),i([o({type:Boolean,converter:k})],f.prototype,"fixed",2),i([o({type:String})],f.prototype,"href",2),i([o({type:Object,attribute:!1})],f.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",f);var O={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},h=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};i([o({type:String})],h.prototype,"identifier",2),i([o({type:String})],h.prototype,"required",2),i([o({type:Boolean,converter:O})],h.prototype,"fixed",2),i([o({type:Boolean,converter:O})],h.prototype,"visible",2),i([o({type:Boolean,converter:O,attribute:"keep-together"})],h.prototype,"keepTogether",2),i([C({context:x,subscribe:!0})],h.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",h);var y=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],y.prototype,"identifier",2),i([o({type:String})],y.prototype,"title",1),i([C({context:x,subscribe:!0})],y.prototype,"_testContext",2),y=i([E("qti-assessment-test")],y);var g=class extends p{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],g.prototype,"identifier",2),i([o({type:String})],g.prototype,"class",2),i([o({type:String,attribute:"navigation-mode"})],g.prototype,"navigationMode",2),i([o({type:String,attribute:"submission-mode"})],g.prototype,"submissionMode",2),g=i([E("qti-test-part")],g);customElements.get("qti-test-part")||customElements.define("qti-test-part",g);var _=class extends S{render(){return d``}};_.styles=N`
|
|
2
|
+
:host {
|
|
3
|
+
color: gray;
|
|
4
|
+
}
|
|
5
|
+
`,_=i([E("qti-test-feedback")],_);export{T as a,f as b,h as c,y as d,g as e,_ as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-ITRDMRY2.js";import{a as l}from"./chunk-P6SSTAJ2.js";import{b as n}from"./chunk-3YQMAZEO.js";import{a as p}from"./chunk-NGP67REL.js";import{d as m,i as a}from"./chunk-EQQ2Q5AI.js";import{a as r}from"./chunk-JR322KXH.js";var t=class extends a{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=s(e)}render(){if(!this.computedContext)return m``;let e=this.computedContext.testParts.flatMap(o=>o.sections);return m` ${e.map(o=>this.myTemplate({item:o}))} `}};r([n({context:l,subscribe:!0})],t.prototype,"computedContext",2),t=r([p("test-section-buttons-stamp")],t);export{t as a};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as c}from"./chunk-QQCGUVEV.js";import{b as n}from"./chunk-3YQMAZEO.js";import{c as l}from"./chunk-NGP67REL.js";import{a as o,d as u,i as p}from"./chunk-EQQ2Q5AI.js";import{a}from"./chunk-JR322KXH.js";var s=class extends p{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.context.variables.find(i=>i.identifier===r)||null}case"qti-multiple":{let t=e.getResult();return t.length>0?{identifier:"",baseType:t[0].baseType,value:t.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",t=this.context.variables.find(i=>i.identifier===r)||null;return{baseType:t.baseType,value:t.correctResponse,cardinality:t.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return u`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
2
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};s.styles=o`
|
|
3
|
+
slot {
|
|
4
|
+
display: none;
|
|
5
|
+
}
|
|
6
|
+
`,a([l()],s.prototype,"result",2),a([n({context:c,subscribe:!0}),l()],s.prototype,"context",2);export{s as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as L}from"./chunk-AV6ISYP4.js";import{a as R,b as A}from"./chunk-CZDMOYYF.js";import{a as w,b as x}from"./chunk-QQR6POPY.js";import{g as S}from"./chunk-3GQR5P44.js";import{a as V}from"./chunk-ULI6NOVG.js";import{a as I,b as C}from"./chunk-7WJYJA45.js";import{a as E,b as o}from"./chunk-42P7F3FC.js";import{a as N,d,i as p}from"./chunk-65CZNGQC.js";import{a as i}from"./chunk-JR322KXH.js";var M=(e=>(e.ITEM_NOT_FOUND="item-not-found",e.SECTION_NOT_FOUND="section-not-found",e.LOAD_ERROR="load-error",e.NETWORK_ERROR="network-error",e.TIMEOUT_ERROR="timeout-error",e))(M||{}),D=m=>{class c extends m{constructor(...t){super(...t);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this._activeRequests=[];this._navigationInProgress=!1;this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:e})=>{if(!e?.id)return;let s=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=s;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:e.type,id:e.id}),this._cancelActiveRequests(),this._targetNavigation={type:e.type,id:e.id},e.type==="item"?await this._navigateToItem(e.id):e.type==="section"&&await this._navigateToSection(e.id),this._lastNavigationRequestId!==s){console.log("Navigation was superseded by a newer request");return}}catch(u){if(this._lastNavigationRequestId===s){let a=this._normalizeError(u,e.type,e.id);this._lastError=a,this._dispatchErrorEvent(a),console.error(`Navigation error (${a.type}):`,a.message,a.details)}}finally{this._lastNavigationRequestId===s&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:e.type,id:e.id}))}}),this.addEventListener("qti-assessment-test-connected",e=>{this._testElement=e.detail,this._initializeNavigation()})}_initializeNavigation(){let t;this.navigate==="section"&&(t=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(t=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),t&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:t},bubbles:!0,composed:!0}))}navigateTo(t,e){e||(t==="section"&&(e=this._testElement?.querySelector("qti-assessment-section")?.identifier),t==="item"&&(e=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}async _navigateToItem(t){let e=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`);if(!e)throw{type:"item-not-found",message:`Item with identifier "${t}" not found.`,itemId:t};let s=e.closest("qti-test-part")?.identifier,u=e.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:u,navItemRefId:t,navItemLoading:!0};try{await this._loadItems([t])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(t){let e=this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`);if(!e)throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};let s=e.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:t,navItemRefId:null,navItemLoading:!0};try{let u=this._getSectionItemIds(t);await this._loadItems(u)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(t,e,s){return t&&t.type&&Object.values(M).includes(t.type)?t:t instanceof DOMException&&t.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:t}:t.name==="TimeoutError"||t.message&&t.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:t}:t instanceof TypeError&&t.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:t}:{type:"load-error",message:`Failed to load ${e}: ${s}`,details:t,itemId:e==="item"?s:void 0,sectionId:e==="section"?s:void 0}}_dispatchErrorEvent(t){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:t,bubbles:!0,composed:!0}))}_dispatchStatusEvent(t){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:t,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(t=>{t&&t.readyState!==4&&t.abort()}),this._activeRequests=[])}async _loadItems(t){if(!this._testElement||t.length===0)return;let e=t.map(a=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${a}"]`)),s=e.reduce((a,v,l)=>(v||a.push(t[l]),a),[]);if(s.length>0)throw{type:"item-not-found",message:`One or more items not found: ${s.join(", ")}`,details:{missingItems:s}};this._clearLoadedItems();let u=e.map(async a=>{if(!a)return null;let v=new Promise((l,b)=>{setTimeout(()=>{b({name:"TimeoutError",message:`Request for item ${a.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:l,request:b}=V(this.cacheTransform).load(a.href);b instanceof XMLHttpRequest&&this._activeRequests.push(b);let B=await Promise.race([l,v]);return{itemRef:a,doc:B.htmlDoc(),request:b}}catch(l){if(l instanceof DOMException&&l.name==="AbortError"||l&&l.name==="TimeoutError")return console.log(`Request for item ${a.identifier} was ${l.name==="TimeoutError"?"timed out":"aborted"}`),null;throw l.itemId=a.identifier,l}});try{let v=(await Promise.all(u)).filter(l=>l!==null);if(v.forEach(({itemRef:l,doc:b})=>{l&&b&&(l.xmlDoc=b)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:v.map(({itemRef:l})=>({identifier:l?.identifier,element:l})),bubbles:!0,composed:!0}))}),v.length===0&&t.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:t}};return v}catch(a){throw console.error("Error loading items:",a),a}}_getSectionItemIds(t){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`))throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${t}"] > qti-assessment-item-ref`)).map(s=>s.identifier)}_clearLoadedItems(){let t=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(t||[]).forEach(e=>{e.xmlDoc=null})}retryNavigation(){if(this._lastError){let t=this._lastError.itemId?"item":"section",e=this._lastError.itemId||this._lastError.sectionId;e&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return i([o({type:String})],c.prototype,"navigate",2),i([o({type:Boolean,attribute:"cache-transform"})],c.prototype,"cacheTransform",2),i([o({type:Number})],c.prototype,"requestTimeout",2),i([o({type:Boolean})],c.prototype,"showLoadingIndicators",2),c};var P=m=>{class c extends m{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",t=>{this.sessionContext={...this.sessionContext,view:t.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",t=>{this._updateElementView(),this._setCorrectResponseVisibility(t.detail)})}willUpdate(n){super.willUpdate(n),n.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;e&&e.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(n){n.showCorrectResponse(this.sessionContext.view==="scorer")}}return c};var q=class extends p{constructor(){super();this.testContext=w;this.sessionContext=R;this._updateItemInTestContext=r=>{let n=r._context,t=n.identifier,e=n.variables,s=this.testContext.items.find(u=>u?.identifier===t);if(!s){console.warn(`Item IDs between assessment.xml and item.xml should match: ${t} is not found!`);return}s.variables?.length===1?this._updateItemVariablesInTestContext(t,e):r.variables=[...s.variables||[]]};this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=w,this.sessionContext=R,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(t=>({href:t.href,identifier:t.identifier,category:t.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,t=n.closest("qti-assessment-item-ref")?.identifier;t&&(n.assessmentItemRefId=t),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables)})}updateItemVariables(r,n){let t=this.testContext.items.find(s=>s.identifier===r);t&&(t.variables=t.variables.map(s=>{let u=n.find(a=>a.identifier===s.identifier);return u?{...s,...u}:s}));let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);e&&e.assessmentItem&&e.assessmentItem&&(e.assessmentItem.variables=n)}_updateItemVariablesInTestContext(r,n){this.testContext={...this.testContext,items:this.testContext.items.map(t=>t.identifier!==r?t:{...t,variables:n.map(e=>{let s=t.variables.find(u=>u.identifier===e.identifier);return s?{...s,...e}:e})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};i([o({attribute:!1,type:Object}),I({context:x})],q.prototype,"testContext",2),i([o({attribute:!1,type:Object}),I({context:A})],q.prototype,"sessionContext",2);var $=m=>{class c extends m{constructor(...n){super(...n),this.addEventListener("qti-register-variable",t=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],t.detail.variable]},t.stopPropagation()}),this.addEventListener("qti-set-outcome-value",t=>{let{outcomeIdentifier:e,value:s}=t.detail;this.updateOutcomeVariable(e,s),t.stopPropagation()})}outcomeProcessing(){let n=this.querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}updateOutcomeVariable(n,t){let e=this.getOutcome(n);if(!e){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:e.cardinality==="single"?t:[...s.value,t]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(t=>t.identifier===n)||null}}return c};var T=class extends D(P($(q))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return d`<slot></slot>`}};T=i([E("qti-test")],T);var k={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},f=class extends p{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let r=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");r&&(this.myTemplate=L(r)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};i([o({type:String})],f.prototype,"category",2),i([o({type:String})],f.prototype,"identifier",2),i([o({type:Boolean,converter:k})],f.prototype,"required",2),i([o({type:Boolean,converter:k})],f.prototype,"fixed",2),i([o({type:String})],f.prototype,"href",2),i([o({type:Object,attribute:!1})],f.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",f);var O={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},h=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};i([o({type:String})],h.prototype,"identifier",2),i([o({type:String})],h.prototype,"required",2),i([o({type:Boolean,converter:O})],h.prototype,"fixed",2),i([o({type:Boolean,converter:O})],h.prototype,"visible",2),i([o({type:Boolean,converter:O,attribute:"keep-together"})],h.prototype,"keepTogether",2),i([C({context:x,subscribe:!0})],h.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",h);var y=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],y.prototype,"identifier",2),i([o({type:String})],y.prototype,"title",1),i([C({context:x,subscribe:!0})],y.prototype,"_testContext",2),y=i([E("qti-assessment-test")],y);var g=class extends p{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],g.prototype,"identifier",2),i([o({type:String})],g.prototype,"class",2),i([o({type:String,attribute:"navigation-mode"})],g.prototype,"navigationMode",2),i([o({type:String,attribute:"submission-mode"})],g.prototype,"submissionMode",2),g=i([E("qti-test-part")],g);customElements.get("qti-test-part")||customElements.define("qti-test-part",g);var _=class extends S{render(){return d``}};_.styles=N`
|
|
2
|
+
:host {
|
|
3
|
+
color: gray;
|
|
4
|
+
}
|
|
5
|
+
`,_=i([E("qti-test-feedback")],_);export{T as a,f as b,h as c,y as d,g as e,_ as f};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as L}from"./chunk-ITRDMRY2.js";import{a as R,b as A}from"./chunk-CZDMOYYF.js";import{a as w,b as x}from"./chunk-QQR6POPY.js";import{g as S}from"./chunk-VTKINN7M.js";import{a as V}from"./chunk-ULI6NOVG.js";import{a as I,b as C}from"./chunk-3YQMAZEO.js";import{a as E,b as o}from"./chunk-NGP67REL.js";import{a as N,d,i as p}from"./chunk-EQQ2Q5AI.js";import{a as i}from"./chunk-JR322KXH.js";var M=(e=>(e.ITEM_NOT_FOUND="item-not-found",e.SECTION_NOT_FOUND="section-not-found",e.LOAD_ERROR="load-error",e.NETWORK_ERROR="network-error",e.TIMEOUT_ERROR="timeout-error",e))(M||{}),D=m=>{class c extends m{constructor(...t){super(...t);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this._activeRequests=[];this._navigationInProgress=!1;this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:e})=>{if(!e?.id)return;let s=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=s;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:e.type,id:e.id}),this._cancelActiveRequests(),this._targetNavigation={type:e.type,id:e.id},e.type==="item"?await this._navigateToItem(e.id):e.type==="section"&&await this._navigateToSection(e.id),this._lastNavigationRequestId!==s){console.log("Navigation was superseded by a newer request");return}}catch(u){if(this._lastNavigationRequestId===s){let a=this._normalizeError(u,e.type,e.id);this._lastError=a,this._dispatchErrorEvent(a),console.error(`Navigation error (${a.type}):`,a.message,a.details)}}finally{this._lastNavigationRequestId===s&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:e.type,id:e.id}))}}),this.addEventListener("qti-assessment-test-connected",e=>{this._testElement=e.detail,this._initializeNavigation()})}_initializeNavigation(){let t;this.navigate==="section"&&(t=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(t=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),t&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:t},bubbles:!0,composed:!0}))}navigateTo(t,e){e||(t==="section"&&(e=this._testElement?.querySelector("qti-assessment-section")?.identifier),t==="item"&&(e=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}async _navigateToItem(t){let e=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`);if(!e)throw{type:"item-not-found",message:`Item with identifier "${t}" not found.`,itemId:t};let s=e.closest("qti-test-part")?.identifier,u=e.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:u,navItemRefId:t,navItemLoading:!0};try{await this._loadItems([t])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(t){let e=this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`);if(!e)throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};let s=e.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:s,navSectionId:t,navItemRefId:null,navItemLoading:!0};try{let u=this._getSectionItemIds(t);await this._loadItems(u)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(t,e,s){return t&&t.type&&Object.values(M).includes(t.type)?t:t instanceof DOMException&&t.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:t}:t.name==="TimeoutError"||t.message&&t.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:t}:t instanceof TypeError&&t.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:t}:{type:"load-error",message:`Failed to load ${e}: ${s}`,details:t,itemId:e==="item"?s:void 0,sectionId:e==="section"?s:void 0}}_dispatchErrorEvent(t){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:t,bubbles:!0,composed:!0}))}_dispatchStatusEvent(t){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:t,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(t=>{t&&t.readyState!==4&&t.abort()}),this._activeRequests=[])}async _loadItems(t){if(!this._testElement||t.length===0)return;let e=t.map(a=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${a}"]`)),s=e.reduce((a,v,l)=>(v||a.push(t[l]),a),[]);if(s.length>0)throw{type:"item-not-found",message:`One or more items not found: ${s.join(", ")}`,details:{missingItems:s}};this._clearLoadedItems();let u=e.map(async a=>{if(!a)return null;let v=new Promise((l,b)=>{setTimeout(()=>{b({name:"TimeoutError",message:`Request for item ${a.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:l,request:b}=V(this.cacheTransform).load(a.href);b instanceof XMLHttpRequest&&this._activeRequests.push(b);let B=await Promise.race([l,v]);return{itemRef:a,doc:B.htmlDoc(),request:b}}catch(l){if(l instanceof DOMException&&l.name==="AbortError"||l&&l.name==="TimeoutError")return console.log(`Request for item ${a.identifier} was ${l.name==="TimeoutError"?"timed out":"aborted"}`),null;throw l.itemId=a.identifier,l}});try{let v=(await Promise.all(u)).filter(l=>l!==null);if(v.forEach(({itemRef:l,doc:b})=>{l&&b&&(l.xmlDoc=b)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:v.map(({itemRef:l})=>({identifier:l?.identifier,element:l})),bubbles:!0,composed:!0}))}),v.length===0&&t.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:t}};return v}catch(a){throw console.error("Error loading items:",a),a}}_getSectionItemIds(t){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${t}"]`))throw{type:"section-not-found",message:`Section with identifier "${t}" not found.`,sectionId:t};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${t}"] > qti-assessment-item-ref`)).map(s=>s.identifier)}_clearLoadedItems(){let t=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(t||[]).forEach(e=>{e.xmlDoc=null})}retryNavigation(){if(this._lastError){let t=this._lastError.itemId?"item":"section",e=this._lastError.itemId||this._lastError.sectionId;e&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:t,id:e},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return i([o({type:String})],c.prototype,"navigate",2),i([o({type:Boolean,attribute:"cache-transform"})],c.prototype,"cacheTransform",2),i([o({type:Number})],c.prototype,"requestTimeout",2),i([o({type:Boolean})],c.prototype,"showLoadingIndicators",2),c};var P=m=>{class c extends m{constructor(...n){super(...n),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",t=>{this.sessionContext={...this.sessionContext,view:t.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",t=>{this._updateElementView(),this._setCorrectResponseVisibility(t.detail)})}willUpdate(n){super.willUpdate(n),n.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;e&&e.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(n){n.showCorrectResponse(this.sessionContext.view==="scorer")}}return c};var q=class extends p{constructor(){super();this.testContext=w;this.sessionContext=R;this._updateItemInTestContext=r=>{let n=r._context,t=n.identifier,e=n.variables,s=this.testContext.items.find(u=>u?.identifier===t);if(!s){console.warn(`Item IDs between assessment.xml and item.xml should match: ${t} is not found!`);return}s.variables?.length===1?this._updateItemVariablesInTestContext(t,e):r.variables=[...s.variables||[]]};this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=w,this.sessionContext=R,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(t=>({href:t.href,identifier:t.identifier,category:t.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,t=n.closest("qti-assessment-item-ref")?.identifier;t&&(n.assessmentItemRefId=t),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables)})}updateItemVariables(r,n){let t=this.testContext.items.find(s=>s.identifier===r);t&&(t.variables=t.variables.map(s=>{let u=n.find(a=>a.identifier===s.identifier);return u?{...s,...u}:s}));let e=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);e&&e.assessmentItem&&e.assessmentItem&&(e.assessmentItem.variables=n)}_updateItemVariablesInTestContext(r,n){this.testContext={...this.testContext,items:this.testContext.items.map(t=>t.identifier!==r?t:{...t,variables:n.map(e=>{let s=t.variables.find(u=>u.identifier===e.identifier);return s?{...s,...e}:e})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};i([o({attribute:!1,type:Object}),I({context:x})],q.prototype,"testContext",2),i([o({attribute:!1,type:Object}),I({context:A})],q.prototype,"sessionContext",2);var $=m=>{class c extends m{constructor(...n){super(...n),this.addEventListener("qti-register-variable",t=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],t.detail.variable]},t.stopPropagation()}),this.addEventListener("qti-set-outcome-value",t=>{let{outcomeIdentifier:e,value:s}=t.detail;this.updateOutcomeVariable(e,s),t.stopPropagation()})}outcomeProcessing(){let n=this.querySelector("qti-outcome-processing");return n?(n?.process(),!0):!1}updateOutcomeVariable(n,t){let e=this.getOutcome(n);if(!e){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==n?s:{...s,value:e.cardinality==="single"?t:[...s.value,t]})}}getOutcome(n){return this.getVariable(n)}getVariable(n){return this.testContext.testOutcomeVariables?.find(t=>t.identifier===n)||null}}return c};var T=class extends D(P($(q))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return d`<slot></slot>`}};T=i([E("qti-test")],T);var k={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},f=class extends p{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let r=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");r&&(this.myTemplate=L(r)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};i([o({type:String})],f.prototype,"category",2),i([o({type:String})],f.prototype,"identifier",2),i([o({type:Boolean,converter:k})],f.prototype,"required",2),i([o({type:Boolean,converter:k})],f.prototype,"fixed",2),i([o({type:String})],f.prototype,"href",2),i([o({type:Object,attribute:!1})],f.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",f);var O={fromAttribute(m){return m==="true"},toAttribute(m){return m?"true":"false"}},h=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};i([o({type:String})],h.prototype,"identifier",2),i([o({type:String})],h.prototype,"required",2),i([o({type:Boolean,converter:O})],h.prototype,"fixed",2),i([o({type:Boolean,converter:O})],h.prototype,"visible",2),i([o({type:Boolean,converter:O,attribute:"keep-together"})],h.prototype,"keepTogether",2),i([C({context:x,subscribe:!0})],h.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",h);var y=class extends p{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],y.prototype,"identifier",2),i([o({type:String})],y.prototype,"title",1),i([C({context:x,subscribe:!0})],y.prototype,"_testContext",2),y=i([E("qti-assessment-test")],y);var g=class extends p{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(r){this._title=r,this.removeAttribute("title"),this.setAttribute("data-title",r)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return d` <slot></slot>`}};i([o({type:String})],g.prototype,"identifier",2),i([o({type:String})],g.prototype,"class",2),i([o({type:String,attribute:"navigation-mode"})],g.prototype,"navigationMode",2),i([o({type:String,attribute:"submission-mode"})],g.prototype,"submissionMode",2),g=i([E("qti-test-part")],g);customElements.get("qti-test-part")||customElements.define("qti-test-part",g);var _=class extends S{render(){return d``}};_.styles=N`
|
|
2
|
+
:host {
|
|
3
|
+
color: gray;
|
|
4
|
+
}
|
|
5
|
+
`,_=i([E("qti-test-feedback")],_);export{T as a,f as b,h as c,y as d,g as e,_ as f};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as u,c as h}from"./chunk-YAR3YZEP.js";import{a as p}from"./chunk-XUJ7TXHW.js";import{a as c}from"./chunk-P6SSTAJ2.js";import{b as n}from"./chunk-3YQMAZEO.js";import{a,b as l}from"./chunk-NGP67REL.js";import{a as m,d as r,i as d}from"./chunk-EQQ2Q5AI.js";import{a as s}from"./chunk-JR322KXH.js";var t=class extends d{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,o){o&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let o=this.computedContext?.testParts.find(i=>i.active);o&&(this.sectionItems=o.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return r`<slot></slot>`}};t.styles=m`
|
|
2
|
+
:host {
|
|
3
|
+
${u};
|
|
4
|
+
}
|
|
5
|
+
:host([disabled]) {
|
|
6
|
+
${h};
|
|
7
|
+
}
|
|
8
|
+
`,s([l({type:Boolean,reflect:!0,attribute:"disabled"})],t.prototype,"_internalDisabled",2),s([n({context:c,subscribe:!0})],t.prototype,"computedContext",2),s([p("computedContext")],t.prototype,"_handleTestElementChange",1),t=s([a("test-prev")],t);export{t as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as m,c as n}from"./chunk-YAR3YZEP.js";import{a as l,b as o}from"./chunk-NGP67REL.js";import{a as s,d as i,i as r}from"./chunk-EQQ2Q5AI.js";import{a as e}from"./chunk-JR322KXH.js";var t=class extends r{constructor(){super();this.itemId=null;this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(a){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:a}}))}render(){return i` <slot></slot> `}};t.styles=s`
|
|
2
|
+
:host {
|
|
3
|
+
${m};
|
|
4
|
+
}
|
|
5
|
+
:host([disabled]) {
|
|
6
|
+
${n};
|
|
7
|
+
}
|
|
8
|
+
`,e([o({type:String,attribute:"item-id"})],t.prototype,"itemId",2),t=e([l("test-item-link")],t);export{t as a};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{f as pt,g as ft,h as w}from"./chunk-EQQ2Q5AI.js";import{b as i,c as A,d as N,e as s,f as ct}from"./chunk-JR322KXH.js";var Y=["this"],dt=["+","-","!"],Et=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],K={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},z=13;var Ht=["==","!=","<=",">=","||","&&","??","|>"],Bt=["===","!=="],h;(function(e){e[e.STRING=1]="STRING",e[e.IDENTIFIER=2]="IDENTIFIER",e[e.DOT=3]="DOT",e[e.COMMA=4]="COMMA",e[e.COLON=5]="COLON",e[e.INTEGER=6]="INTEGER",e[e.DECIMAL=7]="DECIMAL",e[e.OPERATOR=8]="OPERATOR",e[e.GROUPER=9]="GROUPER",e[e.KEYWORD=10]="KEYWORD",e[e.ARROW=11]="ARROW"})(h||(h={}));var C=(e,t,r=0)=>({kind:e,value:t,precedence:r}),Yt=e=>e===9||e===10||e===13||e===32,mt=e=>e===95||e===36||(e&=-33,65<=e&&e<=90),zt=e=>mt(e)||U(e),Vt=e=>Y.indexOf(e)!==-1,jt=e=>e===34||e===39,U=e=>48<=e&&e<=57,Xt=e=>e===43||e===45||e===42||e===47||e===33||e===38||e===37||e===60||e===61||e===62||e===63||e===94||e===124,qt=e=>e===40||e===41||e===91||e===93||e===123||e===125,Qt=e=>e.replace(/\\(.)/g,(t,r)=>{switch(r){case"n":return`
|
|
2
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return r}}),G,k,L,E,u,I,M,tt,Rt,Ot,vt,et,gt,xt,yt,It,Tt,V=class{constructor(t){A(this,u);A(this,G);A(this,k,-1);A(this,L,0);A(this,E);N(this,G,t),s(this,u,I).call(this)}nextToken(){for(;Yt(i(this,E));)s(this,u,I).call(this,!0);if(jt(i(this,E)))return s(this,u,Rt).call(this);if(mt(i(this,E)))return s(this,u,Ot).call(this);if(U(i(this,E)))return s(this,u,vt).call(this);if(i(this,E)===46)return s(this,u,et).call(this);if(i(this,E)===44)return s(this,u,gt).call(this);if(i(this,E)===58)return s(this,u,xt).call(this);if(Xt(i(this,E)))return s(this,u,It).call(this);if(qt(i(this,E)))return s(this,u,Tt).call(this);if(s(this,u,I).call(this),i(this,E)!==void 0)throw new Error(`Expected end of input, got ${i(this,E)}`)}};G=new WeakMap,k=new WeakMap,L=new WeakMap,E=new WeakMap,u=new WeakSet,I=function(t){ct(this,k)._++,i(this,k)<i(this,G).length?(N(this,E,i(this,G).charCodeAt(i(this,k))),t===!0&&N(this,L,i(this,k))):N(this,E,void 0)},M=function(t=0){let r=i(this,G).substring(i(this,L),i(this,k)+t);return t===0&&s(this,u,tt).call(this),r},tt=function(){N(this,L,i(this,k))},Rt=function(){let t="unterminated string",r=i(this,E);for(s(this,u,I).call(this,!0);i(this,E)!==r;){if(i(this,E)===void 0)throw new Error(t);if(i(this,E)===92&&(s(this,u,I).call(this),i(this,E)===void 0))throw new Error(t);s(this,u,I).call(this)}let n=C(h.STRING,Qt(s(this,u,M).call(this)));return s(this,u,I).call(this),n},Ot=function(){do s(this,u,I).call(this);while(zt(i(this,E)));let t=s(this,u,M).call(this),r=Vt(t)?h.KEYWORD:h.IDENTIFIER;return C(r,t)},vt=function(){do s(this,u,I).call(this);while(U(i(this,E)));return i(this,E)===46?s(this,u,et).call(this):C(h.INTEGER,s(this,u,M).call(this))},et=function(){return s(this,u,I).call(this),U(i(this,E))?s(this,u,yt).call(this):(s(this,u,tt).call(this),C(h.DOT,".",z))},gt=function(){return s(this,u,I).call(this,!0),C(h.COMMA,",")},xt=function(){return s(this,u,I).call(this,!0),C(h.COLON,":")},yt=function(){do s(this,u,I).call(this);while(U(i(this,E)));return C(h.DECIMAL,s(this,u,M).call(this))},It=function(){s(this,u,I).call(this);let t=s(this,u,M).call(this,2);if(Bt.indexOf(t)!==-1)s(this,u,I).call(this),s(this,u,I).call(this);else{if(t=s(this,u,M).call(this,1),t==="=>")return s(this,u,I).call(this),C(h.ARROW,t);Ht.indexOf(t)!==-1&&s(this,u,I).call(this)}return t=s(this,u,M).call(this),C(h.OPERATOR,t,K[t])},Tt=function(){let t=String.fromCharCode(i(this,E)),r=C(h.GROUPER,t,K[t]);return s(this,u,I).call(this,!0),r};var nt=(e,t)=>new W(e,t).parse(),S,F,R,_,T,a,m,D,j,wt,At,X,Nt,rt,_t,Pt,bt,Ct,q,kt,Dt,St,st,it,W=class{constructor(t,r){A(this,a);A(this,S);A(this,F);A(this,R);A(this,_);A(this,T);N(this,F,new V(t)),N(this,R,r)}parse(){return s(this,a,m).call(this),s(this,a,D).call(this)}_matches(t,r){return!(t&&i(this,S)!==t||r&&i(this,T)!==r)}};S=new WeakMap,F=new WeakMap,R=new WeakMap,_=new WeakMap,T=new WeakMap,a=new WeakSet,m=function(t,r){if(!this._matches(t,r))throw new Error(`Expected kind ${t} (${r}), was ${i(this,_)?.kind} (${i(this,_)?.value})`);let n=i(this,F).nextToken();N(this,_,n),N(this,S,n?.kind),N(this,T,n?.value)},D=function(){if(!i(this,_))return i(this,R).empty();let t=s(this,a,X).call(this);return t===void 0?void 0:s(this,a,j).call(this,t,0)},j=function(t,r){if(t===void 0)throw new Error("Expected left to be defined.");for(;i(this,_);)if(this._matches(h.GROUPER,"(")){let n=s(this,a,q).call(this);t=i(this,R).invoke(t,void 0,n)}else if(this._matches(h.GROUPER,"[")){let n=s(this,a,kt).call(this);t=i(this,R).index(t,n)}else if(this._matches(h.DOT)){s(this,a,m).call(this);let n=s(this,a,X).call(this);t=s(this,a,wt).call(this,t,n)}else{if(this._matches(h.KEYWORD))break;if(this._matches(h.OPERATOR)&&i(this,_).precedence>=r)t=i(this,T)==="?"?s(this,a,Nt).call(this,t):s(this,a,At).call(this,t,i(this,_));else break}return t},wt=function(t,r){if(r===void 0)throw new Error("expected identifier");if(r.type==="ID")return i(this,R).getter(t,r.value);if(r.type==="Invoke"&&r.receiver.type==="ID"){let n=r.receiver;return i(this,R).invoke(t,n.value,r.arguments)}else throw new Error(`expected identifier: ${r}`)},At=function(t,r){if(Et.indexOf(r.value)===-1)throw new Error(`unknown operator: ${r.value}`);s(this,a,m).call(this);let n=s(this,a,X).call(this);for(;(i(this,S)===h.OPERATOR||i(this,S)===h.DOT||i(this,S)===h.GROUPER)&&i(this,_).precedence>r.precedence;)n=s(this,a,j).call(this,n,i(this,_).precedence);return i(this,R).binary(t,r.value,n)},X=function(){if(this._matches(h.OPERATOR)){let t=i(this,T);if(s(this,a,m).call(this),t==="+"||t==="-"){if(this._matches(h.INTEGER))return s(this,a,st).call(this,t);if(this._matches(h.DECIMAL))return s(this,a,it).call(this,t)}if(dt.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let r=s(this,a,j).call(this,s(this,a,rt).call(this),z);return i(this,R).unary(t,r)}return s(this,a,rt).call(this)},Nt=function(t){s(this,a,m).call(this,h.OPERATOR,"?");let r=s(this,a,D).call(this);s(this,a,m).call(this,h.COLON);let n=s(this,a,D).call(this);return i(this,R).ternary(t,r,n)},rt=function(){switch(i(this,S)){case h.KEYWORD:let t=i(this,T);if(t==="this")return s(this,a,m).call(this),i(this,R).id(t);throw Y.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case h.IDENTIFIER:return s(this,a,bt).call(this);case h.STRING:return s(this,a,St).call(this);case h.INTEGER:return s(this,a,st).call(this);case h.DECIMAL:return s(this,a,it).call(this);case h.GROUPER:return i(this,T)==="("?s(this,a,Dt).call(this):i(this,T)==="{"?s(this,a,Pt).call(this):i(this,T)==="["?s(this,a,_t).call(this):void 0;case h.COLON:throw new Error('unexpected token ":"');default:return}},_t=function(){let t=[];do{if(s(this,a,m).call(this),this._matches(h.GROUPER,"]"))break;t.push(s(this,a,D).call(this))}while(this._matches(h.COMMA));return s(this,a,m).call(this,h.GROUPER,"]"),i(this,R).list(t)},Pt=function(){let t={};do{if(s(this,a,m).call(this),this._matches(h.GROUPER,"}"))break;let r=i(this,T);(this._matches(h.STRING)||this._matches(h.IDENTIFIER))&&s(this,a,m).call(this),s(this,a,m).call(this,h.COLON),t[r]=s(this,a,D).call(this)}while(this._matches(h.COMMA));return s(this,a,m).call(this,h.GROUPER,"}"),i(this,R).map(t)},bt=function(){let t=i(this,T);if(t==="true")return s(this,a,m).call(this),i(this,R).literal(!0);if(t==="false")return s(this,a,m).call(this),i(this,R).literal(!1);if(t==="null")return s(this,a,m).call(this),i(this,R).literal(null);if(t==="undefined")return s(this,a,m).call(this),i(this,R).literal(void 0);let r=s(this,a,Ct).call(this),n=s(this,a,q).call(this);return n?i(this,R).invoke(r,void 0,n):r},Ct=function(){if(!this._matches(h.IDENTIFIER))throw new Error(`expected identifier: ${i(this,T)}`);let t=i(this,T);return s(this,a,m).call(this),i(this,R).id(t)},q=function(){if(!this._matches(h.GROUPER,"("))return;let t=[];do{if(s(this,a,m).call(this),this._matches(h.GROUPER,")"))break;let r=s(this,a,D).call(this);t.push(r)}while(this._matches(h.COMMA));return s(this,a,m).call(this,h.GROUPER,")"),t},kt=function(){s(this,a,m).call(this);let t=s(this,a,D).call(this);return s(this,a,m).call(this,h.GROUPER,"]"),t},Dt=function(){let t=s(this,a,q).call(this);if(this._matches(h.ARROW)){s(this,a,m).call(this);let r=s(this,a,D).call(this),n=t?.map(o=>o.value)??[];return i(this,R).arrowFunction(n,r)}else return i(this,R).paren(t[0])},St=function(){let t=i(this,R).literal(i(this,T));return s(this,a,m).call(this),t},st=function(t=""){let r=i(this,R).literal(parseInt(`${t}${i(this,T)}`,10));return s(this,a,m).call(this),r},it=function(t=""){let r=i(this,R).literal(parseFloat(`${t}${i(this,T)}`));return s(this,a,m).call(this),r};var{hasOwn:Mt,fromEntries:Jt}=Object,Zt={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),"|>":(e,t)=>t(e)},Kt={"+":e=>e,"-":e=>-e,"!":e=>!e},Q=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(r){return this.value},getIds(r){return r}}}id(t){return{type:"ID",value:t,evaluate(r){return this.value==="this"?r:r?.[this.value]},getIds(r){return r.push(this.value),r}}}unary(t,r){let n=Kt[t];return{type:"Unary",operator:t,child:r,evaluate(o){return n(this.child.evaluate(o))},getIds(o){return this.child.getIds(o)}}}binary(t,r,n){let o=Zt[r];return{type:"Binary",operator:r,left:t,right:n,evaluate(c){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let l=this.right.evaluate(c),d,p;return this.left.type==="Getter"?(d=this.left.receiver.evaluate(c),p=this.left.name):this.left.type==="Index"?(d=this.left.receiver.evaluate(c),p=this.left.argument.evaluate(c)):this.left.type==="ID"&&(d=c,p=this.left.value),d===void 0?void 0:d[p]=l}return o(this.left.evaluate(c),this.right.evaluate(c))},getIds(c){return this.left.getIds(c),this.right.getIds(c),c}}}getter(t,r){return{type:"Getter",receiver:t,name:r,evaluate(n){return this.receiver.evaluate(n)?.[this.name]},getIds(n){return this.receiver.getIds(n),n}}}invoke(t,r,n){if(r!=null&&typeof r!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:r,arguments:n,evaluate(o){let c=this.receiver.evaluate(o),l=this.method?c:o?.this??o,d=this.method?c?.[r]:c,O=(this.arguments??[]).map(f=>f?.evaluate(o));return d?.apply?.(l,O)},getIds(o){return this.receiver.getIds(o),this.arguments?.forEach(c=>c?.getIds(o)),o}}}paren(t){return t}index(t,r){return{type:"Index",receiver:t,argument:r,evaluate(n){return this.receiver.evaluate(n)?.[this.argument.evaluate(n)]},getIds(n){return this.receiver.getIds(n),n}}}ternary(t,r,n){return{type:"Ternary",condition:t,trueExpr:r,falseExpr:n,evaluate(o){return this.condition.evaluate(o)?this.trueExpr.evaluate(o):this.falseExpr.evaluate(o)},getIds(o){return this.condition.getIds(o),this.trueExpr.getIds(o),this.falseExpr.getIds(o),o}}}map(t){return{type:"Map",entries:t,evaluate(r){let n={};if(t&&this.entries)for(let o in t){let c=this.entries[o];c&&(n[o]=c.evaluate(r))}return n},getIds(r){if(t&&this.entries)for(let n in t){let o=this.entries[n];o&&o.getIds(r)}return r}}}list(t){return{type:"List",items:t,evaluate(r){return this.items?.map(n=>n?.evaluate(r))},getIds(r){return this.items?.forEach(n=>n?.getIds(r)),r}}}arrowFunction(t,r){return{type:"ArrowFunction",params:t,body:r,evaluate(n){let o=this.params,c=this.body;return function(...l){let d=Jt(o.map((O,f)=>[O,l[f]])),p=new Proxy(n??{},{set(O,f,x){return Mt(d,f)&&(d[f]=x),O[f]=x},get(O,f){return Mt(d,f)?d[f]:O[f]}});return c.evaluate(p)}},getIds(n){return this.body.getIds(n).filter(o=>!this.params.includes(o))}}}};var at=null,Gt={boundAttributeSuffix:w.M,marker:w.P,markerMatch:w.A,HTML_RESULT:w.C,getTemplateHtml:w.L,overrideDirectiveResolve:(e,t)=>class extends e{_$AS(r,n){return t(this,n)}},patchDirectiveResolve:(e,t)=>{if(e.prototype._$AS!==t){at??(at=e.prototype._$AS.name);for(let r=e.prototype;r!==Object.prototype;r=Object.getPrototypeOf(r))if(r.hasOwnProperty(at))return void(r[at]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(e,t){e._$litDirective$=t},getAttributePartCommittedValue:(e,t,r)=>{let n=pt;return e.j=o=>n=o,e._$AI(t,e,r),n},connectedDisconnectable:e=>({...e,_$AU:!0}),resolveDirective:w.V,AttributePart:w.H,PropertyPart:w.B,BooleanAttributePart:w.N,EventPart:w.U,ElementPart:w.F,TemplateInstance:w.R,isIterable:w.D,ChildPart:w.I};var{AttributePart:te,PropertyPart:ee,BooleanAttributePart:re,EventPart:se}=Gt,ut=new Q,ot=new Map,Lt=e=>e.replace(/-(-|\w)/g,(t,r)=>r.toUpperCase()),J=(e,t)=>{let r=ot.get(e);if(r===void 0){if(ot.has(e))return;if(e=e.trim(),e.startsWith("{{")&&e.endsWith("}}")){let n=e.substring(2,e.length-2).trim();r=new W(n,ut).parse(),ot.set(e,r)}}return r?.evaluate(t)},ie=(e,t,r,n)=>{let o=e.getAttribute("if");if(o!==null&&J(o,t))return Z(e,t,r,n)},$t=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Ut=e=>/(?:\\{{)|(?:\\}})/g.test(e),H=e=>e.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),ne=(e,t,r,n)=>{let o=e.getAttribute("repeat");if(o!==null){let c=J(o,t);if(!c[Symbol.iterator])return ft;let l=B(e),d=-1,p=[];for(let O of c){d++;let f=Object.create(t);f.item=O,f.index=d,f.this=t.this??t;let x=[];for(let y of l.parts){let g=y.update(f,r,n);y.type===1?x.push(...g):x.push(g)}let v={_$litType$:l,values:x};p.push(v)}return p}},Ft={if:ie,repeat:ne},_e=(e,t=Ft,r={},n)=>{let c=B(e).renderers;if(n){let d=B(n).renderers,p=c.super;p!==void 0?r={...c,...r,super:(O,f,x)=>(x={...d,...x,super:(v,y,g)=>Z(n,v,y,g)},p(O,f,x))}:(r={...d,...c,...r},e=n)}else r={...c,...r};return l=>Z(e,l,t,r)};var Z=(e,t,r=Ft,n={})=>{let o=B(e),c=[];for(let d of o.parts){let p=d.update(t,r,n);d.type===1?c.push(...p):c.push(p)}return{_$litType$:o,values:c}},Wt=new Map,B=e=>{let t=Wt.get(e);return t===void 0&&Wt.set(e,t=ae(e)),t},ae=e=>{let t={h:void 0,el:e.cloneNode(!0),parts:[],renderers:{}},r=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),n=r.currentNode,o=-1,c=[];for(;(n=r.nextNode())!==null;)if(n.nodeType===Node.COMMENT_NODE)o++;else if(n.nodeType===Node.ELEMENT_NODE){o++;let l=n;if(l.tagName==="TEMPLATE"){let p=l.getAttribute("type"),O=l.getAttribute("name"),f=l.getAttribute("call");if(f!==null||p!==null||O!==null){l.parentNode.insertBefore(document.createComment(""),l),c.push(l);let x;if(f!==null){let v=f.trim(),y=v.startsWith("{{")&&v.endsWith("}}");x=(g,b,P)=>{let $=l.getAttribute("data"),ht=$===null?void 0:J($,g);return(y?J(v,g):P[f])?.(ht,b,P)}}else p!==null?x=(v,y,g)=>{let b=y[p];return b?.(l,v,y,g)}:(O==="super"?t.renderers.super=(v,y,g)=>{let b=g.super,P=B(l);return g={...g,...P.renderers},b(v,y,g)}:t.renderers[O]=(v,y,g)=>Z(l,v,y,g),x=(v,y,g)=>{let b=g[O];return b?.(v,y,g)});t.parts.push({type:2,index:o,update:x});continue}}let d=l.getAttributeNames();for(let p of d){let O=l.getAttribute(p),f=O.split($t);if(f.length===1){Ut(O)&&l.setAttribute(p,H(O));continue}l.removeAttribute(p);let x=p,v=te,y=p[0];y==="."?(x=Lt(p.substring(1)),v=ee):y==="?"?(x=p.substring(1),v=re):y==="@"&&(x=Lt(p.substring(1)),v=se);let g=[H(f[0])],b=[];for(let P=1;P<f.length;P+=2){let $=f[P];b.push(nt($,ut)),g.push(H(f[P+1]))}t.parts.push({type:1,index:o,name:x,strings:g,ctor:v,update:(P,$,ht)=>b.map(lt=>lt.evaluate(P))})}}else if(n.nodeType===Node.TEXT_NODE){let l=n,d=l.textContent,p=d.split($t);p.length>1?l.textContent=H(p[0]):Ut(d)&&(l.textContent=H(d));for(let O=1;O<p.length;O+=2){let f=p[O],x=nt(f,ut);t.parts.push({type:2,index:++o,update:(y,g)=>x.evaluate(y)});let v=new Text(p[O+1].replace("\\{{","{{"));l.parentNode.insertBefore(v,l.nextSibling),l.parentNode.insertBefore(document.createComment(""),l.nextSibling),l=v,r.currentNode=v}}for(let l of c)l.remove();return t};export{_e as a};
|
|
3
|
+
/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
@heximal/expressions/lib/constants.js:
|
|
6
|
+
@heximal/expressions/lib/tokenizer.js:
|
|
7
|
+
@heximal/expressions/lib/parser.js:
|
|
8
|
+
@heximal/expressions/lib/ast_factory.js:
|
|
9
|
+
@heximal/expressions/lib/eval.js:
|
|
10
|
+
(*
|
|
11
|
+
* @license
|
|
12
|
+
* Portions Copyright (c) 2013, the Dart project authors.
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
lit-html/node/private-ssr-support.js:
|
|
16
|
+
(**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2019 Google LLC
|
|
19
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
+
*)
|
|
21
|
+
*/
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as c,b as h}from"./chunk-DD7CA4II.js";import{a as i}from"./chunk-XUJ7TXHW.js";import{c as l}from"./chunk-ULI6NOVG.js";import{a as n,b as p,c as a}from"./chunk-NGP67REL.js";import{d as s,i as o}from"./chunk-EQQ2Q5AI.js";import{a as r}from"./chunk-JR322KXH.js";var e=class extends o{constructor(){super(...arguments);this.testURL=null;this.testDoc=null;this.testXML=null;this.templateContent=null}async handleTestURLChange(){if(this.testURL)try{let t=await l().load(this.testURL);this.testDoc=t.htmlDoc()}catch(t){console.error("Error loading or parsing XML:",t)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=l().parse(this.testXML).htmlDoc()}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}initializeTemplateContent(){let t=this.querySelector("template");this.templateContent=t?t.content:s``}applyStyles(){let t=new CSSStyleSheet;t.replaceSync(h),this.shadowRoot.adoptedStyleSheets=[t]}render(){return s`
|
|
2
|
+
${this.templateContent}
|
|
3
|
+
<slot></slot>
|
|
4
|
+
${c(this.testDoc,s`<span>Loading...</span>`)}
|
|
5
|
+
`}};r([p({type:String,attribute:"test-url"})],e.prototype,"testURL",2),r([a()],e.prototype,"testDoc",2),r([a()],e.prototype,"testXML",2),r([i("testURL",{waitUntilFirstUpdate:!0})],e.prototype,"handleTestURLChange",1),r([i("testXML",{waitUntilFirstUpdate:!0})],e.prototype,"handleTestXMLChange",1),e=r([n("test-container")],e);export{e as a};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import{a as m}from"./chunk-TCHROQU3.js";import{b as i}from"./chunk-3YQMAZEO.js";import{a as l}from"./chunk-NGP67REL.js";import{a as d,d as a,i as c}from"./chunk-EQQ2Q5AI.js";import{a as p}from"./chunk-JR322KXH.js";var r=class extends c{render(){let s=this.computedContext;if(!s||!s.variables)return a``;let b=s.variables.filter(o=>o.type==="response"),u=s.variables.filter(o=>o.type==="outcome"),n=(o,h)=>a`
|
|
2
|
+
<h3>${h}</h3>
|
|
3
|
+
<table>
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th>Identifier</th>
|
|
7
|
+
<th>Value</th>
|
|
8
|
+
<th>Cardinality</th>
|
|
9
|
+
<th>Base Type</th>
|
|
10
|
+
<th>Correct Response / Mappings</th>
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
13
|
+
<tbody>
|
|
14
|
+
${o.map(e=>{let f=e.correctResponse?Array.isArray(e.correctResponse)?e.correctResponse.join(", "):e.correctResponse:"",x=e.mapping?.mapEntries?.map(t=>`${t.mapKey}=${t.mappedValue}pt`).join(", ")||"",y=e.areaMapping?.areaMapEntries?.map(t=>`${t.shape}(${t.coords})=${t.mappedValue}pt`).join(", ")||"";return a`
|
|
15
|
+
<tr>
|
|
16
|
+
<td>${e.identifier}</td>
|
|
17
|
+
<td>${Array.isArray(e.value)?e.value.join(", "):e.value}</td>
|
|
18
|
+
<td>${e.cardinality}</td>
|
|
19
|
+
<td>${e.baseType}</td>
|
|
20
|
+
<td>${f||x||y}</td>
|
|
21
|
+
</tr>
|
|
22
|
+
`})}
|
|
23
|
+
</tbody>
|
|
24
|
+
</table>
|
|
25
|
+
`;return a`
|
|
26
|
+
${n(b,"Response Variables")} ${n(u,"Outcome Variables")}
|
|
27
|
+
`}};r.styles=d`
|
|
28
|
+
table {
|
|
29
|
+
width: 100%;
|
|
30
|
+
border-collapse: collapse;
|
|
31
|
+
margin: 20px 0;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
text-align: left;
|
|
34
|
+
}
|
|
35
|
+
th,
|
|
36
|
+
td {
|
|
37
|
+
border: 1px solid #ddd;
|
|
38
|
+
padding: 8px;
|
|
39
|
+
}
|
|
40
|
+
th {
|
|
41
|
+
background-color: #f4f4f4;
|
|
42
|
+
font-weight: bold;
|
|
43
|
+
}
|
|
44
|
+
h3 {
|
|
45
|
+
margin-top: 20px;
|
|
46
|
+
font-size: 16px;
|
|
47
|
+
}
|
|
48
|
+
`,p([i({context:m,subscribe:!0})],r.prototype,"computedContext",2),r=p([l("print-item-variables")],r);export{r as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-ITRDMRY2.js";import{a as l}from"./chunk-P6SSTAJ2.js";import{b as n}from"./chunk-3YQMAZEO.js";import{a as p}from"./chunk-NGP67REL.js";import{d as r,i as a}from"./chunk-EQQ2Q5AI.js";import{a as o}from"./chunk-JR322KXH.js";var t=class extends a{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=i(e)}render(){if(!this.computedContext)return r``;let e=this.computedContext.testParts.flatMap(m=>m.sections.flatMap(s=>s.items));return r` ${e.map(m=>this.myTemplate({item:m,view:this.computedContext.view}))} `}};o([n({context:l,subscribe:!0})],t.prototype,"computedContext",2),t=o([p("test-paging-buttons-stamp")],t);export{t as a};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{b as m}from"./chunk-CZDMOYYF.js";import{a as c}from"./chunk-XUJ7TXHW.js";import{b as r}from"./chunk-3YQMAZEO.js";import{a,b as n,c as l}from"./chunk-NGP67REL.js";import{d as s,i as p}from"./chunk-EQQ2Q5AI.js";import{a as i}from"./chunk-JR322KXH.js";var t=class extends p{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=t.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(o=>o.trim());this._viewOptions=e.filter(o=>t.DEFAULT_VIEW_OPTIONS.includes(o))}else this._viewOptions=t.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return s`
|
|
2
|
+
<label part="label" for="viewSelect">${this.label}</label>
|
|
3
|
+
<select
|
|
4
|
+
part="select"
|
|
5
|
+
id="viewSelect"
|
|
6
|
+
@change=${e=>{let o=e.target;this._switchView(o.value)}}
|
|
7
|
+
>
|
|
8
|
+
${this._viewOptions.map(e=>s`<option value="${e}" ?selected=${e===this.sessionContext.view}>${e}</option>`)}
|
|
9
|
+
</select>
|
|
10
|
+
`}};t.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"],i([r({context:m,subscribe:!0})],t.prototype,"sessionContext",2),i([n({type:String})],t.prototype,"label",2),i([n({type:String,attribute:"view-options"})],t.prototype,"viewOptions",2),i([c("viewOptions",{waitUntilFirstUpdate:!0})],t.prototype,"_handleViewOptionsChange",2),i([l()],t.prototype,"_viewOptions",2),t=i([a("test-view")],t);export{t as a};
|