@citolab/qti-components 7.2.0 → 7.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/cdn/chunks/chunk-2CXOEWW3.js +5 -0
  2. package/cdn/chunks/chunk-2EE5IVNF.js +1 -0
  3. package/cdn/chunks/chunk-2S62LLS5.js +2 -0
  4. package/cdn/chunks/chunk-33KVDPBT.js +5 -0
  5. package/cdn/chunks/chunk-42AQQPRG.js +5 -0
  6. package/cdn/chunks/chunk-4TNE5ZQS.js +5 -0
  7. package/cdn/chunks/chunk-57ZBXU3V.js +5 -0
  8. package/cdn/chunks/chunk-5RGC3O3Z.js +3 -0
  9. package/cdn/chunks/chunk-5SM3KVCK.js +5 -0
  10. package/cdn/chunks/chunk-5WJBI6M7.js +1033 -0
  11. package/cdn/chunks/chunk-66BMMESW.js +2 -0
  12. package/cdn/chunks/chunk-6D53FU3U.js +2 -0
  13. package/cdn/chunks/chunk-72GJGEI2.js +2 -0
  14. package/cdn/chunks/chunk-73GTDWYG.js +2 -0
  15. package/cdn/chunks/chunk-7G2JKRYL.js +3 -0
  16. package/cdn/chunks/chunk-7HDBTHS7.js +2 -0
  17. package/cdn/chunks/chunk-7U6V7TMQ.js +1 -0
  18. package/cdn/chunks/chunk-A5GQJBQ4.js +5 -0
  19. package/cdn/chunks/chunk-BH7YS4N7.js +5 -0
  20. package/cdn/chunks/chunk-DAKW2UJX.js +3 -0
  21. package/cdn/chunks/chunk-DPW6VAG2.js +3441 -0
  22. package/cdn/chunks/chunk-DQCUGHMI.js +2 -0
  23. package/cdn/chunks/chunk-DTD5NE7V.js +2 -0
  24. package/cdn/chunks/chunk-EJE3C3VD.js +5 -0
  25. package/cdn/chunks/chunk-FGT2KVW2.js +1 -0
  26. package/cdn/chunks/chunk-FXG6JQNB.js +3 -0
  27. package/cdn/chunks/chunk-G3O7FTGW.js +2 -0
  28. package/cdn/chunks/chunk-GSDSRYPT.js +5 -0
  29. package/cdn/chunks/chunk-GW7MTJY4.js +2 -0
  30. package/cdn/chunks/chunk-HNZFDARC.js +2 -0
  31. package/cdn/chunks/chunk-I37HIF37.js +2 -0
  32. package/cdn/chunks/chunk-IFSRAUBH.js +1 -0
  33. package/cdn/chunks/chunk-IHVEZOAV.js +5 -0
  34. package/cdn/chunks/chunk-IJ47QETV.js +2 -0
  35. package/cdn/chunks/chunk-JVY3MIVH.js +5 -0
  36. package/cdn/chunks/chunk-JXGYDOJM.js +3 -0
  37. package/cdn/chunks/chunk-JXU7B3Q3.js +5 -0
  38. package/cdn/chunks/chunk-K3HDRUZ2.js +2 -0
  39. package/cdn/chunks/chunk-KGNJ44AT.js +2 -0
  40. package/cdn/chunks/chunk-KM6BQLUW.js +2 -0
  41. package/cdn/chunks/chunk-KMPDXXNC.js +5 -0
  42. package/cdn/chunks/chunk-KPFC2HQR.js +3 -0
  43. package/cdn/chunks/chunk-KZQ2VXMQ.js +2 -0
  44. package/cdn/chunks/chunk-LEC3TBJ3.js +2 -0
  45. package/cdn/chunks/chunk-ME2BEQTK.js +3463 -0
  46. package/cdn/chunks/chunk-MM3TTGOD.js +5 -0
  47. package/cdn/chunks/chunk-NBXY7TMD.js +2 -0
  48. package/cdn/chunks/chunk-NCNOPEEF.js +2 -0
  49. package/cdn/chunks/chunk-O7JELRBY.js +2 -0
  50. package/cdn/chunks/chunk-OCQAZUB6.js +2 -0
  51. package/cdn/chunks/chunk-OK2KV5ZV.js +1033 -0
  52. package/cdn/chunks/chunk-PX7O5JO2.js +1033 -0
  53. package/cdn/chunks/chunk-QBBWQ5J6.js +5 -0
  54. package/cdn/chunks/chunk-QBLSG366.js +1033 -0
  55. package/cdn/chunks/chunk-QPP7ZB2K.js +5 -0
  56. package/cdn/chunks/chunk-RSOX5VS5.js +3 -0
  57. package/cdn/chunks/chunk-SHXTMXYU.js +1 -0
  58. package/cdn/chunks/chunk-SNRRONMC.js +2 -0
  59. package/cdn/chunks/chunk-SNS5XDXU.js +1033 -0
  60. package/cdn/chunks/chunk-SUDAVHNM.js +1 -0
  61. package/cdn/chunks/chunk-UUKFU4BI.js +2 -0
  62. package/cdn/chunks/chunk-V65TZQVT.js +2 -0
  63. package/cdn/chunks/chunk-VIW7IGYG.js +2 -0
  64. package/cdn/chunks/chunk-W7LBE76A.js +5 -0
  65. package/cdn/chunks/chunk-WANQ7VHH.js +2 -0
  66. package/cdn/chunks/chunk-WI3S4WLU.js +2 -0
  67. package/cdn/chunks/chunk-WQK3JD6Q.js +5 -0
  68. package/cdn/chunks/chunk-WRAMSS3Q.js +3465 -0
  69. package/cdn/chunks/chunk-XAGT5BEK.js +1033 -0
  70. package/cdn/chunks/chunk-XLY6GBBJ.js +2 -0
  71. package/cdn/chunks/chunk-XNII2G63.js +3468 -0
  72. package/cdn/chunks/chunk-YSCJG7CX.js +3461 -0
  73. package/cdn/chunks/chunk-ZOMLA6TY.js +1033 -0
  74. package/cdn/index.global.js +1 -1
  75. package/cdn/index.js +1 -1
  76. package/cdn/qti-components/index.js +1 -1
  77. package/cdn/qti-item/components/item-container.js +1 -1
  78. package/cdn/qti-item/core/index.js +1 -1
  79. package/cdn/qti-test/components/index.js +1 -1
  80. package/cdn/qti-test/components/test-container.js +1 -1
  81. package/cdn/qti-test/components/test-navigation.js +1 -1
  82. package/cdn/qti-test/components/test-print-context.js +1 -1
  83. package/cdn/qti-test/components/test-stamp.js +1 -1
  84. package/cdn/qti-test/core/index.js +1 -1
  85. package/dist/chunks/chunk-25AXOL6N.js +73 -0
  86. package/dist/chunks/chunk-25AXOL6N.js.map +1 -0
  87. package/dist/chunks/chunk-34ZMZ5GH.js +76 -0
  88. package/dist/chunks/chunk-34ZMZ5GH.js.map +1 -0
  89. package/dist/chunks/chunk-3UPSFFDF.js +45 -0
  90. package/dist/chunks/chunk-3UPSFFDF.js.map +1 -0
  91. package/dist/chunks/chunk-4IPSXNHA.js +870 -0
  92. package/dist/chunks/chunk-4IPSXNHA.js.map +1 -0
  93. package/dist/chunks/chunk-4NZYGJLT.js +94 -0
  94. package/dist/chunks/chunk-4NZYGJLT.js.map +1 -0
  95. package/dist/chunks/chunk-4UIDYSZL.js +78 -0
  96. package/dist/chunks/chunk-4UIDYSZL.js.map +1 -0
  97. package/dist/chunks/chunk-4V7ZPUTP.js +78 -0
  98. package/dist/chunks/chunk-4V7ZPUTP.js.map +1 -0
  99. package/dist/chunks/chunk-5IQUODBV.js +94 -0
  100. package/dist/chunks/chunk-5IQUODBV.js.map +1 -0
  101. package/dist/chunks/chunk-6B7USFAR.js +82 -0
  102. package/dist/chunks/chunk-6B7USFAR.js.map +1 -0
  103. package/dist/chunks/chunk-6IC436D3.js +95 -0
  104. package/dist/chunks/chunk-6IC436D3.js.map +1 -0
  105. package/dist/chunks/chunk-6MXANZQB.js +80 -0
  106. package/dist/chunks/chunk-6MXANZQB.js.map +1 -0
  107. package/dist/chunks/chunk-6UZG2X74.js +870 -0
  108. package/dist/chunks/chunk-6UZG2X74.js.map +1 -0
  109. package/dist/chunks/chunk-6XLSPSL3.js +94 -0
  110. package/dist/chunks/chunk-6XLSPSL3.js.map +1 -0
  111. package/dist/chunks/chunk-AXVMZW54.js +73 -0
  112. package/dist/chunks/chunk-AXVMZW54.js.map +1 -0
  113. package/dist/chunks/chunk-B5Y4EZF6.js +80 -0
  114. package/dist/chunks/chunk-B5Y4EZF6.js.map +1 -0
  115. package/dist/chunks/chunk-B7NLQTW7.js +69 -0
  116. package/dist/chunks/chunk-B7NLQTW7.js.map +1 -0
  117. package/dist/chunks/chunk-BAEQ4MHU.js +69 -0
  118. package/dist/chunks/chunk-BAEQ4MHU.js.map +1 -0
  119. package/dist/chunks/chunk-C2KEHCRU.js +80 -0
  120. package/dist/chunks/chunk-C2KEHCRU.js.map +1 -0
  121. package/dist/chunks/chunk-CL6HNHNL.js +72 -0
  122. package/dist/chunks/chunk-CL6HNHNL.js.map +1 -0
  123. package/dist/chunks/chunk-DH2EP5PV.js +81 -0
  124. package/dist/chunks/chunk-DH2EP5PV.js.map +1 -0
  125. package/dist/chunks/chunk-DIETZXSR.js +78 -0
  126. package/dist/chunks/chunk-DIETZXSR.js.map +1 -0
  127. package/dist/chunks/chunk-DOP7DN3W.js +78 -0
  128. package/dist/chunks/chunk-DOP7DN3W.js.map +1 -0
  129. package/dist/chunks/chunk-DTZHLZH2.js +8 -0
  130. package/dist/chunks/chunk-DTZHLZH2.js.map +1 -0
  131. package/dist/chunks/chunk-E7YBWRAI.js +870 -0
  132. package/dist/chunks/chunk-E7YBWRAI.js.map +1 -0
  133. package/dist/chunks/chunk-EBKJVMIY.js +79 -0
  134. package/dist/chunks/chunk-EBKJVMIY.js.map +1 -0
  135. package/dist/chunks/chunk-ECXRMWLT.js +94 -0
  136. package/dist/chunks/chunk-ECXRMWLT.js.map +1 -0
  137. package/dist/chunks/chunk-ERWBN3ZB.js +6899 -0
  138. package/dist/chunks/chunk-ERWBN3ZB.js.map +1 -0
  139. package/dist/chunks/chunk-FDIYM6TD.js +68 -0
  140. package/dist/chunks/chunk-FDIYM6TD.js.map +1 -0
  141. package/dist/chunks/chunk-FROMX3AY.js +78 -0
  142. package/dist/chunks/chunk-FROMX3AY.js.map +1 -0
  143. package/dist/chunks/chunk-FVD3INZH.js +69 -0
  144. package/dist/chunks/chunk-FVD3INZH.js.map +1 -0
  145. package/dist/chunks/chunk-GJVATV62.js +43 -0
  146. package/dist/chunks/chunk-GJVATV62.js.map +1 -0
  147. package/dist/chunks/chunk-GWSHKTCL.js +33 -0
  148. package/dist/chunks/chunk-GWSHKTCL.js.map +1 -0
  149. package/dist/chunks/chunk-H2Z5FH4R.js +76 -0
  150. package/dist/chunks/chunk-H2Z5FH4R.js.map +1 -0
  151. package/dist/chunks/chunk-HAP6ALTQ.js +78 -0
  152. package/dist/chunks/chunk-HAP6ALTQ.js.map +1 -0
  153. package/dist/chunks/chunk-HL7H4ZGY.js +82 -0
  154. package/dist/chunks/chunk-HL7H4ZGY.js.map +1 -0
  155. package/dist/chunks/chunk-HQ7IWQPH.js +80 -0
  156. package/dist/chunks/chunk-HQ7IWQPH.js.map +1 -0
  157. package/dist/chunks/chunk-IA235UXD.js +79 -0
  158. package/dist/chunks/chunk-IA235UXD.js.map +1 -0
  159. package/dist/chunks/chunk-IIDUZWYL.js +78 -0
  160. package/dist/chunks/chunk-IIDUZWYL.js.map +1 -0
  161. package/dist/chunks/chunk-IKVCQGA6.js +79 -0
  162. package/dist/chunks/chunk-IKVCQGA6.js.map +1 -0
  163. package/dist/chunks/chunk-IT6EGJUH.js +68 -0
  164. package/dist/chunks/chunk-IT6EGJUH.js.map +1 -0
  165. package/dist/chunks/chunk-IWSVL7HX.js +94 -0
  166. package/dist/chunks/chunk-IWSVL7HX.js.map +1 -0
  167. package/dist/chunks/chunk-JVAVUINW.js +870 -0
  168. package/dist/chunks/chunk-JVAVUINW.js.map +1 -0
  169. package/dist/chunks/chunk-K5SSEHCG.js +92 -0
  170. package/dist/chunks/chunk-K5SSEHCG.js.map +1 -0
  171. package/dist/chunks/chunk-KYGAKC4X.js +82 -0
  172. package/dist/chunks/chunk-KYGAKC4X.js.map +1 -0
  173. package/dist/chunks/chunk-LD4XIWJQ.js +6908 -0
  174. package/dist/chunks/chunk-LD4XIWJQ.js.map +1 -0
  175. package/dist/chunks/chunk-LHF73NOA.js +6899 -0
  176. package/dist/chunks/chunk-LHF73NOA.js.map +1 -0
  177. package/dist/chunks/chunk-LT563K5H.js +78 -0
  178. package/dist/chunks/chunk-LT563K5H.js.map +1 -0
  179. package/dist/chunks/chunk-LVWZUV4A.js +86 -0
  180. package/dist/chunks/chunk-LVWZUV4A.js.map +1 -0
  181. package/dist/chunks/chunk-MCMAHBGE.js +3455 -0
  182. package/dist/chunks/chunk-MCMAHBGE.js.map +1 -0
  183. package/dist/chunks/chunk-NFPHKFFE.js +78 -0
  184. package/dist/chunks/chunk-NFPHKFFE.js.map +1 -0
  185. package/dist/chunks/chunk-NLW7S5TN.js +94 -0
  186. package/dist/chunks/chunk-NLW7S5TN.js.map +1 -0
  187. package/dist/chunks/chunk-O2YP7VIE.js +245 -0
  188. package/dist/chunks/chunk-O2YP7VIE.js.map +1 -0
  189. package/dist/chunks/chunk-OAKKH2XA.js +99 -0
  190. package/dist/chunks/chunk-OAKKH2XA.js.map +1 -0
  191. package/dist/chunks/chunk-OBIKEFCI.js +56 -0
  192. package/dist/chunks/chunk-OBIKEFCI.js.map +1 -0
  193. package/dist/chunks/chunk-OEJMOV45.js +78 -0
  194. package/dist/chunks/chunk-OEJMOV45.js.map +1 -0
  195. package/dist/chunks/chunk-OFYYP7AK.js +94 -0
  196. package/dist/chunks/chunk-OFYYP7AK.js.map +1 -0
  197. package/dist/chunks/chunk-PJMWNLXZ.js +80 -0
  198. package/dist/chunks/chunk-PJMWNLXZ.js.map +1 -0
  199. package/dist/chunks/chunk-Q5QUG5DL.js +870 -0
  200. package/dist/chunks/chunk-Q5QUG5DL.js.map +1 -0
  201. package/dist/chunks/chunk-QGVSNUAF.js +79 -0
  202. package/dist/chunks/chunk-QGVSNUAF.js.map +1 -0
  203. package/dist/chunks/chunk-QIN2S2F7.js +94 -0
  204. package/dist/chunks/chunk-QIN2S2F7.js.map +1 -0
  205. package/dist/chunks/chunk-QKYFFNPR.js +3453 -0
  206. package/dist/chunks/chunk-QKYFFNPR.js.map +1 -0
  207. package/dist/chunks/chunk-QMIYPOBM.js +3458 -0
  208. package/dist/chunks/chunk-QMIYPOBM.js.map +1 -0
  209. package/dist/chunks/chunk-QMYMPOQQ.js +69 -0
  210. package/dist/chunks/chunk-QMYMPOQQ.js.map +1 -0
  211. package/dist/chunks/chunk-QYH6VORA.js +6895 -0
  212. package/dist/chunks/chunk-QYH6VORA.js.map +1 -0
  213. package/dist/chunks/chunk-RGQDJQVE.js +3451 -0
  214. package/dist/chunks/chunk-RGQDJQVE.js.map +1 -0
  215. package/dist/chunks/chunk-S4YY5LQ6.js +870 -0
  216. package/dist/chunks/chunk-S4YY5LQ6.js.map +1 -0
  217. package/dist/chunks/chunk-SKXNZMFN.js +870 -0
  218. package/dist/chunks/chunk-SKXNZMFN.js.map +1 -0
  219. package/dist/chunks/chunk-SWROECSL.js +82 -0
  220. package/dist/chunks/chunk-SWROECSL.js.map +1 -0
  221. package/dist/chunks/chunk-TGF5F45T.js +94 -0
  222. package/dist/chunks/chunk-TGF5F45T.js.map +1 -0
  223. package/dist/chunks/chunk-TUVS6HU4.js +85 -0
  224. package/dist/chunks/chunk-TUVS6HU4.js.map +1 -0
  225. package/dist/chunks/chunk-UHU4AWX2.js +28 -0
  226. package/dist/chunks/chunk-UHU4AWX2.js.map +1 -0
  227. package/dist/chunks/chunk-V53ESOPP.js +79 -0
  228. package/dist/chunks/chunk-V53ESOPP.js.map +1 -0
  229. package/dist/chunks/chunk-VGGCSCVL.js +94 -0
  230. package/dist/chunks/chunk-VGGCSCVL.js.map +1 -0
  231. package/dist/chunks/chunk-WLVDQ3UA.js +6898 -0
  232. package/dist/chunks/chunk-WLVDQ3UA.js.map +1 -0
  233. package/dist/chunks/chunk-WTN76Y5P.js +74 -0
  234. package/dist/chunks/chunk-WTN76Y5P.js.map +1 -0
  235. package/dist/chunks/chunk-WVMOFVRE.js +74 -0
  236. package/dist/chunks/chunk-WVMOFVRE.js.map +1 -0
  237. package/dist/chunks/chunk-WXQLAXP4.js +73 -0
  238. package/dist/chunks/chunk-WXQLAXP4.js.map +1 -0
  239. package/dist/chunks/chunk-X2ZV2OFN.js +82 -0
  240. package/dist/chunks/chunk-X2ZV2OFN.js.map +1 -0
  241. package/dist/chunks/chunk-XAJNR7FS.js +74 -0
  242. package/dist/chunks/chunk-XAJNR7FS.js.map +1 -0
  243. package/dist/chunks/chunk-Y7BBA7SG.js +6895 -0
  244. package/dist/chunks/chunk-Y7BBA7SG.js.map +1 -0
  245. package/dist/chunks/chunk-YBDDKT65.js +69 -0
  246. package/dist/chunks/chunk-YBDDKT65.js.map +1 -0
  247. package/dist/chunks/chunk-YKKQ6AI7.js +69 -0
  248. package/dist/chunks/chunk-YKKQ6AI7.js.map +1 -0
  249. package/dist/chunks/chunk-YLHGELZY.js +79 -0
  250. package/dist/chunks/chunk-YLHGELZY.js.map +1 -0
  251. package/dist/chunks/chunk-YQC26WHY.js +79 -0
  252. package/dist/chunks/chunk-YQC26WHY.js.map +1 -0
  253. package/dist/chunks/chunk-ZBUXIAEV.js +3431 -0
  254. package/dist/chunks/chunk-ZBUXIAEV.js.map +1 -0
  255. package/dist/chunks/chunk-ZU6ANMBF.js +28 -0
  256. package/dist/chunks/chunk-ZU6ANMBF.js.map +1 -0
  257. package/dist/exports/computed.context.d.ts +4 -0
  258. package/dist/exports/computed.context.js +1 -1
  259. package/dist/exports/session.context.d.ts +1 -1
  260. package/dist/index.d.ts +1 -1
  261. package/dist/index.js +17 -17
  262. package/dist/item.css +6 -0
  263. package/dist/qti-components/index.js +1 -1
  264. package/dist/qti-components-jsx.d.ts +10 -7
  265. package/dist/qti-item/components/item-container.js +2 -2
  266. package/dist/qti-item/core/index.js +2 -2
  267. package/dist/qti-response-declaration-CNh-wf6q.d.ts +1146 -0
  268. package/dist/qti-test/components/index.d.ts +1 -1
  269. package/dist/qti-test/components/index.js +14 -14
  270. package/dist/qti-test/components/test-container.js +2 -2
  271. package/dist/qti-test/components/test-navigation.d.ts +1 -1
  272. package/dist/qti-test/components/test-navigation.js +2 -2
  273. package/dist/qti-test/components/test-next.js +2 -2
  274. package/dist/qti-test/components/test-paging-buttons-stamp.js +2 -2
  275. package/dist/qti-test/components/test-prev.js +2 -2
  276. package/dist/qti-test/components/test-print-context.js +2 -2
  277. package/dist/qti-test/components/test-print-item-variables.js +2 -2
  278. package/dist/qti-test/components/test-scoring-buttons.js +2 -2
  279. package/dist/qti-test/components/test-scoring-feedback.js +2 -2
  280. package/dist/qti-test/components/test-section-buttons-stamp.js +2 -2
  281. package/dist/qti-test/components/test-show-correct-response.js +2 -2
  282. package/dist/qti-test/components/test-stamp.d.ts +8 -1
  283. package/dist/qti-test/components/test-stamp.js +2 -2
  284. package/dist/qti-test/core/index.d.ts +2 -2
  285. package/dist/qti-test/core/index.js +2 -2
  286. package/dist/qti-test-feedback-C4bd_5i4.d.ts +98 -0
  287. package/dist/qti-test-feedback-DaBphqnZ.d.ts +98 -0
  288. package/dist/vscode.html-custom-data.json +13 -7
  289. package/package.json +3 -1
@@ -0,0 +1,245 @@
1
+ import {
2
+ sessionContext
3
+ } from "./chunk-UZ4QB5IO.js";
4
+ import {
5
+ testContext
6
+ } from "./chunk-CJADUWEC.js";
7
+ import {
8
+ computedContext
9
+ } from "./chunk-DTZHLZH2.js";
10
+ import {
11
+ __decorateClass
12
+ } from "./chunk-H2JE6IVU.js";
13
+
14
+ // src/lib/qti-test/components/test-navigation.ts
15
+ import { consume, provide } from "@lit/context";
16
+ import { html, LitElement } from "lit";
17
+ import { customElement, property, state } from "lit/decorators.js";
18
+ var TestNavigation = class extends LitElement {
19
+ constructor() {
20
+ super();
21
+ this.identifier = void 0;
22
+ this.initContext = [];
23
+ this.configContext = {};
24
+ this.autoScoreItems = false;
25
+ this.addEventListener("qti-assessment-test-connected", this._handleTestConnected.bind(this));
26
+ this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
27
+ this.addEventListener("qti-interaction-changed", this._handleInteractionChanged.bind(this));
28
+ this.addEventListener("test-end-attempt", this._handleTestEndAttempt.bind(this));
29
+ this.addEventListener("test-show-correct-response", this._handleTestShowCorrectResponse.bind(this));
30
+ this.addEventListener("test-update-outcome-variable", this._handleTestUpdateOutcomeVariable.bind(this));
31
+ }
32
+ /**
33
+ * Handles the 'test-end-attempt' event.
34
+ * @private
35
+ * @listens TestNavigation#test-end-attempt
36
+ * @param {CustomEvent} event - The custom event object.
37
+ */
38
+ _handleTestEndAttempt(_event) {
39
+ const qtiItemEl = this._testElement.querySelector(
40
+ `qti-assessment-item-ref[identifier="${this._sessionContext.navItemId}"]`
41
+ );
42
+ const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
43
+ const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
44
+ qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
45
+ }
46
+ /**
47
+ * Handles the 'test-end-attempt' event.
48
+ * @private
49
+ * @listens TestNavigation#test-show-correct-response
50
+ * @param {CustomEvent} event - The custom event object.
51
+ */
52
+ _handleTestShowCorrectResponse(event) {
53
+ const qtiItemEl = this._testElement.querySelector(
54
+ `qti-assessment-item-ref[identifier="${this._sessionContext.navItemId}"]`
55
+ );
56
+ const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
57
+ qtiAssessmentItemEl.showCorrectResponse(event.detail);
58
+ }
59
+ _handleTestUpdateOutcomeVariable(event) {
60
+ const qtiItemEl = this._testElement.querySelector(
61
+ `qti-assessment-item-ref[identifier="${event.detail.assessmentItemRefId}"]`
62
+ );
63
+ const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
64
+ qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);
65
+ }
66
+ _handleInteractionChanged(_event) {
67
+ if (this.autoScoreItems) {
68
+ const assessmentItem = _event.composedPath()[0].closest("qti-assessment-item");
69
+ const scoreOutcomeIdentifier = assessmentItem.variables.find((v) => v.identifier === "SCORE");
70
+ if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
71
+ assessmentItem.processResponse();
72
+ }
73
+ }
74
+ }
75
+ render() {
76
+ return html`<slot></slot>`;
77
+ }
78
+ /* PK: on test connected we can build the computed context */
79
+ _handleTestConnected(event) {
80
+ this.initContext = null;
81
+ this._testElement = event.detail;
82
+ const testPartElements = Array.from(this._testElement?.querySelectorAll(`qti-test-part`) || []);
83
+ this.computedContext = {
84
+ identifier: this._testElement.identifier,
85
+ title: this._testElement.title,
86
+ testParts: testPartElements.map((testPart) => {
87
+ const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
88
+ return {
89
+ active: false,
90
+ identifier: testPart.identifier,
91
+ navigationMode: testPart.navigationMode,
92
+ submissionMode: testPart.submissionMode,
93
+ sections: sectionElements.map((section) => {
94
+ const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
95
+ return {
96
+ active: false,
97
+ identifier: section.identifier,
98
+ title: section.title,
99
+ items: itemElements.map((item) => {
100
+ return {
101
+ active: false,
102
+ identifier: item.identifier,
103
+ href: item.href,
104
+ variables: []
105
+ };
106
+ })
107
+ };
108
+ })
109
+ };
110
+ })
111
+ };
112
+ }
113
+ /* PK: on item connected we can add item only properties in the xml */
114
+ _handleItemConnected(event) {
115
+ const itemElement = event.detail;
116
+ this.computedContext = {
117
+ ...this.computedContext,
118
+ testParts: this.computedContext.testParts.map((testPart) => {
119
+ return {
120
+ ...testPart,
121
+ sections: testPart.sections.map((section) => {
122
+ return {
123
+ ...section,
124
+ items: section.items.map((item) => {
125
+ if (item.identifier !== itemElement.parentElement.getAttribute("identifier")) {
126
+ return item;
127
+ }
128
+ return {
129
+ ...item,
130
+ assessmentItemIdentifier: itemElement.getAttribute("identifier"),
131
+ label: itemElement.getAttribute("label"),
132
+ title: itemElement.title,
133
+ adaptive: itemElement.adaptive == "true" || false,
134
+ timeDependent: itemElement.timeDependent == "true" || false,
135
+ variables: itemElement._context.variables
136
+ };
137
+ })
138
+ };
139
+ })
140
+ };
141
+ })
142
+ };
143
+ }
144
+ /* PK: on every change of the candidate we will recomputed the computedContext */
145
+ willUpdate(_changedProperties) {
146
+ if (!this.computedContext) return;
147
+ let itemIndex = 1;
148
+ this.computedContext = {
149
+ ...this.computedContext,
150
+ testParts: this.computedContext.testParts.map((testPart) => {
151
+ return {
152
+ ...testPart,
153
+ active: this._sessionContext?.navPartId === testPart.identifier || false,
154
+ sections: testPart.sections.map((section) => {
155
+ return {
156
+ ...section,
157
+ active: this._sessionContext?.navSectionId === section.identifier || false,
158
+ completed: section.items.every(
159
+ (item) => this._testContext.items.find((i) => i.identifier === item.identifier)?.variables.find((v) => v.identifier === "completionStatus").value === "completed"
160
+ ),
161
+ items: section.items.map((item) => {
162
+ const itemContext = this._testContext?.items.find((i) => i.identifier === item.identifier);
163
+ let computedItem;
164
+ if (this.initContext) {
165
+ const initContext = this.initContext.find((i) => i.identifier === item.identifier);
166
+ computedItem = { ...item, ...itemContext, ...initContext };
167
+ } else {
168
+ computedItem = { ...item, ...itemContext };
169
+ }
170
+ const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
171
+ const score = parseInt(rawscore?.toString());
172
+ const completionStatus = computedItem.variables?.find((v) => v.identifier === "completionStatus")?.value;
173
+ const categories = computedItem.category ? computedItem.category?.split(" ") : [];
174
+ const type = categories.includes(this.configContext?.infoItemCategory) ? "info" : "regular";
175
+ const active = this._sessionContext?.navItemId === computedItem.identifier || false;
176
+ const correct = (
177
+ // this._testContext.view === 'scorer' &&
178
+ type == "regular" && score !== void 0 && !isNaN(score) && score > 0 || false
179
+ );
180
+ const incorrect = (
181
+ // this._testContext.view === 'scorer' &&
182
+ type == "regular" && score !== void 0 && !isNaN(score) && score <= 0 || false
183
+ );
184
+ const completed = (
185
+ // this._testContext.view === 'candidate' &&
186
+ completionStatus === "completed"
187
+ );
188
+ const response = computedItem.variables?.find((v) => v.identifier === "RESPONSE")?.value || "";
189
+ const index = categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
190
+ const view = this._sessionContext.view;
191
+ return {
192
+ ...computedItem,
193
+ // rawscore, // not necessary for outside world
194
+ // score, // not necessary for outside world
195
+ // completionStatus, // not necessary for outside world
196
+ // categories, // not necessary for outside world
197
+ type,
198
+ active,
199
+ correct,
200
+ incorrect,
201
+ completed,
202
+ index,
203
+ response,
204
+ view
205
+ };
206
+ })
207
+ };
208
+ })
209
+ };
210
+ })
211
+ };
212
+ }
213
+ };
214
+ __decorateClass([
215
+ property({ type: String })
216
+ ], TestNavigation.prototype, "identifier", 2);
217
+ __decorateClass([
218
+ state()
219
+ ], TestNavigation.prototype, "initContext", 2);
220
+ __decorateClass([
221
+ state(),
222
+ consume({ context: testContext, subscribe: true })
223
+ ], TestNavigation.prototype, "_testContext", 2);
224
+ __decorateClass([
225
+ state(),
226
+ consume({ context: sessionContext, subscribe: true })
227
+ ], TestNavigation.prototype, "_sessionContext", 2);
228
+ __decorateClass([
229
+ state()
230
+ ], TestNavigation.prototype, "configContext", 2);
231
+ __decorateClass([
232
+ state(),
233
+ provide({ context: computedContext })
234
+ ], TestNavigation.prototype, "computedContext", 2);
235
+ __decorateClass([
236
+ property({ type: Boolean, attribute: "auto-score-items" })
237
+ ], TestNavigation.prototype, "autoScoreItems", 2);
238
+ TestNavigation = __decorateClass([
239
+ customElement("test-navigation")
240
+ ], TestNavigation);
241
+
242
+ export {
243
+ TestNavigation
244
+ };
245
+ //# sourceMappingURL=chunk-O2YP7VIE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-navigation.ts"],"sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { testContext } from '../../exports/test.context';\nimport { sessionContext } from '../../exports/session.context';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\nimport type { QtiAssessmentItem } from '../../qti-components';\nimport type { OutcomeVariable } from '../../exports/variables';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiTestPart } from '../core';\nimport type { ConfigContext } from '../../exports/config.context';\nimport type { SessionContext } from '../../exports/session.context';\nimport type { TestContext } from '../../exports/test.context';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n 'test-show-correct-response': CustomEvent<{ value: boolean }>;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n@customElement('test-navigation')\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n protected configContext: ConfigContext = {};\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n private _testElement: QtiAssessmentTest;\n\n constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this._handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this._handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this._handleInteractionChanged.bind(this));\n\n this.addEventListener('test-end-attempt', this._handleTestEndAttempt.bind(this));\n this.addEventListener('test-show-correct-response', this._handleTestShowCorrectResponse.bind(this));\n this.addEventListener('test-update-outcome-variable', this._handleTestUpdateOutcomeVariable.bind(this));\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n private _handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-show-correct-response\n * @param {CustomEvent} event - The custom event object.\n */\n private _handleTestShowCorrectResponse(event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.showCorrectResponse(event.detail);\n }\n\n private _handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${event.detail.assessmentItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n private _handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest('qti-assessment-item');\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n assessmentItem.processResponse();\n }\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n private _handleTestConnected(event: CustomEvent) {\n this.initContext = null;\n this._testElement = event.detail as QtiAssessmentTest;\n const testPartElements = Array.from(this._testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this._testElement.identifier,\n title: this._testElement.title,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n items: itemElements.map(item => {\n return {\n active: false,\n identifier: item.identifier,\n href: item.href,\n variables: []\n } as ComputedItemContext;\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on item connected we can add item only properties in the xml */\n private _handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item => {\n if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: (itemElement as any)._context.variables\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n let computedItem;\n\n if (this.initContext) {\n const initContext = this.initContext.find(i => i.identifier === item.identifier);\n computedItem = { ...item, ...itemContext, ...initContext };\n } else {\n computedItem = { ...item, ...itemContext };\n }\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseInt(rawscore?.toString());\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')?.value;\n const categories = computedItem.category ? computedItem.category?.split(' ') : [];\n\n const type = categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular'; // rounded-full\n const active = this._sessionContext?.navItemId === computedItem.identifier || false; // !border-sky-600\n\n const correct =\n // this._testContext.view === 'scorer' &&\n (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false; // bg-green-100 border-green-400\n const incorrect =\n // this._testContext.view === 'scorer' &&\n (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false; // bg-red-100 border-red-400\n const completed =\n // this._testContext.view === 'candidate' &&\n completionStatus === 'completed';\n // || item.category === this.host._configContext?.infoItemCategory || false\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n\n const index = categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n\n const view = this._sessionContext.view;\n\n return {\n ...computedItem,\n // rawscore, // not necessary for outside world\n // score, // not necessary for outside world\n // completionStatus, // not necessary for outside world\n // categories, // not necessary for outside world\n type,\n active,\n correct,\n incorrect,\n completed,\n index,\n response,\n view\n };\n })\n };\n })\n };\n })\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,SAAS,eAAe;AACjC,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe,UAAU,aAAa;AA0BxC,IAAM,iBAAN,cAA6B,WAAW;AAAA,EAyB7C,cAAc;AACZ,UAAM;AAzBoB,sBAAa;AAGzC,SAAO,cAA4D,CAAC;AAWpE,SAAU,gBAA+B,CAAC;AAMkB,0BAAiB;AAM3E,SAAK,iBAAiB,iCAAiC,KAAK,qBAAqB,KAAK,IAAI,CAAC;AAC3F,SAAK,iBAAiB,iCAAiC,KAAK,qBAAqB,KAAK,IAAI,CAAC;AAE3F,SAAK,iBAAiB,2BAA2B,KAAK,0BAA0B,KAAK,IAAI,CAAC;AAE1F,SAAK,iBAAiB,oBAAoB,KAAK,sBAAsB,KAAK,IAAI,CAAC;AAC/E,SAAK,iBAAiB,8BAA8B,KAAK,+BAA+B,KAAK,IAAI,CAAC;AAClG,SAAK,iBAAiB,gCAAgC,KAAK,iCAAiC,KAAK,IAAI,CAAC;AAAA,EACxG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,sBAAsB,QAAqB;AACjD,UAAM,YAAY,KAAK,aAAa;AAAA,MAClC,uCAAuC,KAAK,gBAAgB,SAAS;AAAA,IACvE;AACA,UAAM,sBAAsB,UAAU;AACtC,UAAM,6BAA6B,KAAK,e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mBAAmB,CAAC;AAAA,GArB/C,eAqBiD;AArBjD,iBAAN;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB;","names":[]}
@@ -0,0 +1,99 @@
1
+ import {
2
+ propInternalState
3
+ } from "./chunk-K6EUKFNW.js";
4
+ import {
5
+ btn,
6
+ dis
7
+ } from "./chunk-5ZHHNEDA.js";
8
+ import {
9
+ watch
10
+ } from "./chunk-ELDMXTUQ.js";
11
+ import {
12
+ computedContext
13
+ } from "./chunk-DTZHLZH2.js";
14
+ import {
15
+ __decorateClass
16
+ } from "./chunk-H2JE6IVU.js";
17
+
18
+ // src/lib/qti-test/components/test-next.ts
19
+ import { css, html, LitElement } from "lit";
20
+ import { customElement } from "lit/decorators.js";
21
+ import { consume } from "@lit/context";
22
+ var TestNext = class extends LitElement {
23
+ constructor() {
24
+ super();
25
+ this.disabled = true;
26
+ this._internals = this.attachInternals();
27
+ this._internals.role = "button";
28
+ this._internals.ariaLabel = "Next item";
29
+ this.addEventListener("click", (e) => {
30
+ e.preventDefault();
31
+ if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
32
+ });
33
+ }
34
+ _handleTestElementChange(_oldValue, newValue) {
35
+ if (newValue) {
36
+ this.disabled = false;
37
+ }
38
+ }
39
+ connectedCallback() {
40
+ super.connectedCallback();
41
+ this.checkDisabled();
42
+ }
43
+ willUpdate(_changedProperties) {
44
+ if (!this.computedContext) return;
45
+ const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
46
+ if (!testPart) return;
47
+ this.sectionItems = testPart.sections.flatMap((section) => section.items);
48
+ this.itemIndex = this.sectionItems.findIndex((item) => item.active);
49
+ this.checkDisabled();
50
+ }
51
+ checkDisabled() {
52
+ this.disabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
53
+ }
54
+ _requestItem(identifier) {
55
+ this.dispatchEvent(
56
+ new CustomEvent("qti-request-navigation", {
57
+ composed: true,
58
+ bubbles: true,
59
+ detail: {
60
+ type: "item",
61
+ id: identifier
62
+ }
63
+ })
64
+ );
65
+ }
66
+ render() {
67
+ return html`<slot></slot>`;
68
+ }
69
+ };
70
+ TestNext.styles = css`
71
+ :host {
72
+ ${btn};
73
+ }
74
+ :host([disabled]) {
75
+ ${dis};
76
+ }
77
+ `;
78
+ __decorateClass([
79
+ propInternalState({
80
+ type: Boolean,
81
+ reflect: true,
82
+ aria: "ariaDisabled"
83
+ // Maps to `aria-disabled` attribute
84
+ })
85
+ ], TestNext.prototype, "disabled", 2);
86
+ __decorateClass([
87
+ consume({ context: computedContext, subscribe: true })
88
+ ], TestNext.prototype, "computedContext", 2);
89
+ __decorateClass([
90
+ watch("computedContext")
91
+ ], TestNext.prototype, "_handleTestElementChange", 1);
92
+ TestNext = __decorateClass([
93
+ customElement("test-next")
94
+ ], TestNext);
95
+
96
+ export {
97
+ TestNext
98
+ };
99
+ //# sourceMappingURL=chunk-OAKKH2XA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-next.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { propInternalState, watch } from '../../decorators';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n/**\n * Represents a custom element for navigating to the next test item.\n *\n * @remarks\n * This element provides functionality for navigating to the next test item.\n *\n * @example\n * ```html\n * <test-next></test-next>\n * ```\n */\n@customElement('test-next')\nexport class TestNext extends LitElement {\n @propInternalState({\n type: Boolean,\n reflect: true,\n aria: 'ariaDisabled' // Maps to `aria-disabled` attribute\n })\n public disabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n protected computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.disabled = false;\n }\n }\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n private _internals: ElementInternals;\n\n constructor() {\n super();\n\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);\n });\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.checkDisabled();\n }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n this.disabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-next': TestNext;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAoBjB,IAAM,WAAN,cAAuB,WAAW;AAAA,EA+BvC,cAAc;AACZ,UAAM;AA1BR,SAAO,WAAW;AA4BhB,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,SAAU,MAAK,aAAa,KAAK,aAAa,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,IACxF,CAAC;AAAA,EACH;AAAA,EA3BA,yB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
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-scoring-feedback.ts
9
+ import { consume } from "@lit/context";
10
+ import { html, LitElement } from "lit";
11
+ import { customElement, property } from "lit/decorators.js";
12
+ var TestScoringFeedback = class extends LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.view = null;
16
+ }
17
+ render() {
18
+ const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
19
+ if (!activeItem || !activeItem.variables) return html``;
20
+ if (activeItem["category"] === "dep-informational") return html`<div>${this.dataset.informational}</div>`;
21
+ const completionStatus = activeItem?.variables.find((v) => v.identifier === "completionStatus")?.value;
22
+ const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
23
+ const score = parseInt(scoreOutcome?.value);
24
+ const externalScored = activeItem["externalScored"];
25
+ const feedbackText = () => {
26
+ if (completionStatus !== "completed") {
27
+ return this.dataset.textNoResponse;
28
+ }
29
+ if (!externalScored && score !== void 0 && !Number.isNaN(score)) {
30
+ return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;
31
+ }
32
+ if (externalScored === "externalMachine") {
33
+ return Number.isNaN(score) || score === void 0 ? "We konden je antwoord geen score geven, omdat we te weinig antwoorden konden vinden die op jouw antwoord leken. Kijk je antwoord zelf na." : `We hebben je antwoord ${score === 0 ? "geen punten" : score == 1 ? "\xE9\xE9n punt" : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;
34
+ }
35
+ if (externalScored === "human") {
36
+ return Number.isNaN(score) ? "" : "Deze score heb je zelf toegekend.";
37
+ }
38
+ return this.dataset.scoreUnknown;
39
+ };
40
+ return html`<div>${feedbackText()}</div>`;
41
+ }
42
+ };
43
+ __decorateClass([
44
+ consume({ context: computedContext, subscribe: true })
45
+ ], TestScoringFeedback.prototype, "computedContext", 2);
46
+ __decorateClass([
47
+ property({ type: String, attribute: "view" })
48
+ ], TestScoringFeedback.prototype, "view", 2);
49
+ TestScoringFeedback = __decorateClass([
50
+ customElement("test-scoring-feedback")
51
+ ], TestScoringFeedback);
52
+
53
+ export {
54
+ TestScoringFeedback
55
+ };
56
+ //# sourceMappingURL=chunk-OBIKEFCI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-scoring-feedback.ts"],"sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { OutcomeVariable } from '../../exports/variables';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { ViewMode } from 'storybook/internal/types';\n\n@customElement('test-scoring-feedback')\nexport class TestScoringFeedback extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n protected computedContext?: ComputedContext;\n\n @property({ type: String, attribute: 'view' })\n public view: ViewMode = null;\n\n render() {\n const activeItem = this.computedContext?.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n if (!activeItem || !activeItem.variables) return html``;\n\n if (activeItem['category'] === 'dep-informational') return html`<div>${this.dataset.informational}</div>`;\n\n const completionStatus = activeItem?.variables.find(v => v.identifier === 'completionStatus')?.value;\n const scoreOutcome = activeItem?.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n\n const score = parseInt(scoreOutcome?.value as string);\n const externalScored = activeItem['externalScored'];\n\n const feedbackText = () => {\n if (completionStatus !== 'completed') {\n return this.dataset.textNoResponse;\n }\n\n if (!externalScored && score !== undefined && !Number.isNaN(score)) {\n return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;\n }\n\n if (externalScored === 'externalMachine') {\n return Number.isNaN(score) || score === undefined\n ? 'We konden je antwoord geen score geven, omdat we te weinig antwoorden konden vinden die op jouw antwoord leken. Kijk je antwoord zelf na.'\n : `We hebben je antwoord ${score === 0 ? 'geen punten' : score == 1 ? 'één punt' : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;\n }\n\n if (externalScored === 'human') {\n return Number.isNaN(score) ? '' : 'Deze score heb je zelf toegekend.';\n }\n\n return this.dataset.scoreUnknown;\n };\n\n return html`<div>${feedbackText()}</div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-scoring-feedback': TestScoringFeedback;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe,gBAAgB;AASjC,IAAM,sBAAN,cAAkC,WAAW;AAAA,EAA7C;AAAA;AAKL,SAAO,OAAiB;AAAA;AAAA,EAExB,SAAS;AACP,UAAM,aAAa,KAAK,iBAAiB,UACtC,QAAQ,cAAY,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,CAAC,EACvE,KAAK,UAAQ,KAAK,MAAM;AAE3B,QAAI,CAAC,cAAc,CAAC,WAAW,UAAW,QAAO;AAEjD,QAAI,WAAW,UAAU,MAAM,oBAAqB,QAAO,YAAY,KAAK,QAAQ,aAAa;AAEjG,UAAM,mBAAmB,YAAY,UAAU,KAAK,OAAK,EAAE,eAAe,kBAAkB,GAAG;AAC/F,UAAM,eAAe,YAAY,UAAU,KAAK,QAAM,GAAG,cAAc,OAAO;AAE9E,UAAM,QAAQ,SAAS,cAAc,KAAe;AACpD,UAAM,iBAAiB,WAAW,gBAAgB;AAElD,UAAM,eAAe,MAAM;AACzB,UAAI,qBAAqB,aAAa;AACpC,eAAO,KAAK,QAAQ;AAAA,MACtB;AAEA,UAAI,CAAC,kBAAkB,UAAU,UAAa,CAAC,OAAO,MAAM,KAAK,GAAG;AAClE,eAAO,QAAQ,IAAI,KAAK,QAAQ,cAAc,KAAK,QAAQ;AAAA,MAC7D;AAEA,UAAI,mBAAmB,mBAAmB;AACxC,eAAO,OAAO,MAAM,KAAK,KAAK,UAAU,SACpC,8IACA,yBAAyB,UAAU,IAAI,gBAAgB,SAAS,IAAI,mBAAa,GAAG,KAAK,SAAS;AAAA,MACxG;AAEA,UAAI,mBAAmB,SAAS;AAC9B,eAAO,OAAO,MAAM,KAAK,IAAI,KAAK;AAAA,MACpC;AAEA,aAAO,KAAK,QAAQ;AAAA,IACtB;AAEA,WAAO,YAAY,aAAa,CAAC;AAAA,EACnC;AACF;AA5CY;AAAA,EADT,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,oBAED;AAGH;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,OAAO,CAAC;AAAA,GAJlC,oBAKJ;AALI,sBAAN;AAAA,EADN,cAAc,uBAAuB;AAAA,GACzB;","names":[]}
@@ -0,0 +1,78 @@
1
+ import {
2
+ computedContext
3
+ } from "./chunk-DTZHLZH2.js";
4
+ import {
5
+ __decorateClass
6
+ } from "./chunk-H2JE6IVU.js";
7
+
8
+ // src/lib/qti-test/components/test-stamp.ts
9
+ import { html, LitElement, nothing } from "lit";
10
+ import { customElement, property, state } from "lit/decorators.js";
11
+ import { prepareTemplate } from "stampino";
12
+ import { consume } from "@lit/context";
13
+ var TestStamp = class extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.debug = false;
17
+ this.stampContext = null;
18
+ }
19
+ createRenderRoot() {
20
+ return this;
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ const templateElement = this.querySelector("template");
25
+ if (!templateElement) {
26
+ this.myTemplate = null;
27
+ return;
28
+ }
29
+ this.myTemplate = prepareTemplate(templateElement);
30
+ }
31
+ willUpdate(_changedProperties) {
32
+ if (!this.computedContext) {
33
+ this.stampContext = null;
34
+ return;
35
+ }
36
+ const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
37
+ const augmentedTestPart = {
38
+ ...activeTestPart,
39
+ items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables, ...rest }) => rest)),
40
+ sections: activeTestPart.sections.map((section) => ({
41
+ ...section,
42
+ items: section.items.map(({ variables, ...rest }) => rest)
43
+ }))
44
+ };
45
+ const activeSection = augmentedTestPart.sections.find((section) => section.active);
46
+ const augmentedSection = { ...activeSection, items: activeSection.items };
47
+ const augmentedItem = augmentedSection.items.find((item) => item.active);
48
+ const { testParts, ...activeTest } = this.computedContext;
49
+ this.stampContext = {
50
+ test: activeTest,
51
+ testpart: augmentedTestPart,
52
+ section: augmentedSection,
53
+ item: augmentedItem
54
+ };
55
+ }
56
+ render() {
57
+ return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}
58
+ ${this.stampContext && this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;
59
+ }
60
+ };
61
+ __decorateClass([
62
+ property({ type: Boolean, reflect: true })
63
+ ], TestStamp.prototype, "debug", 2);
64
+ __decorateClass([
65
+ state(),
66
+ consume({ context: computedContext, subscribe: true })
67
+ ], TestStamp.prototype, "computedContext", 2);
68
+ __decorateClass([
69
+ state()
70
+ ], TestStamp.prototype, "stampContext", 2);
71
+ TestStamp = __decorateClass([
72
+ customElement("test-stamp")
73
+ ], TestStamp);
74
+
75
+ export {
76
+ TestStamp
77
+ };
78
+ //# sourceMappingURL=chunk-OEJMOV45.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-stamp.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { prepareTemplate } from 'stampino';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { TemplateFunction } from 'stampino';\n\n@customElement('test-stamp')\nexport class TestStamp extends LitElement {\n @property({ type: Boolean, reflect: true })\n public debug = false;\n\n @state()\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n @state()\n private stampContext: {\n test?: unknown;\n testpart?: unknown;\n section?: unknown;\n item?: unknown;\n } | null = null;\n\n myTemplate: TemplateFunction;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n const templateElement = this.querySelector<HTMLTemplateElement>('template');\n if (!templateElement) {\n this.myTemplate = null;\n return;\n }\n this.myTemplate = prepareTemplate(templateElement);\n }\n\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) {\n this.stampContext = null;\n return;\n }\n\n const activeTestPart = this.computedContext.testParts.find(testPart => testPart.active);\n const augmentedTestPart = {\n ...activeTestPart,\n items: activeTestPart.sections.flatMap(section => section.items.map(({ variables, ...rest }) => rest)),\n sections: activeTestPart.sections.map(section => ({\n ...section,\n items: section.items.map(({ variables, ...rest }) => rest)\n }))\n };\n\n const activeSection = augmentedTestPart.sections.find(section => section.active);\n const augmentedSection = { ...activeSection, items: activeSection.items };\n\n const augmentedItem = augmentedSection.items.find(item => item.active);\n\n // if (!activeTestPart || !activeItem) {\n // this.stampContext = null;\n // return;\n // }\n\n const { testParts, ...activeTest } = this.computedContext;\n\n this.stampContext = {\n test: activeTest,\n testpart: augmentedTestPart,\n section: augmentedSection,\n item: augmentedItem\n };\n }\n\n render() {\n return html` ${this.debug ? html`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing}\n ${this.stampContext && this.myTemplate ? this.myTemplate(this.stampContext) : nothing}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-stamp': TestStamp;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,YAAY,eAAe;AAC1C,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,uBAAuB;AAChC,SAAS,eAAe;AASjB,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAEL,SAAO,QAAQ;AAOf,SAAQ,eAKG;AAAA;AAAA,EAID,mBAAmD;AAC3D,WAAO;AAAA,EACT;A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E,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAD/B,UAEJ;AAIC;AAAA,EAFP,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAL3C,UAMH;AAGA;AAAA,EADP,MAAM;AAAA,GARI,UASH;AATG,YAAN;AAAA,EADN,cAAc,YAAY;AAAA,GACd;","names":[]}
@@ -0,0 +1,94 @@
1
+ import {
2
+ item_default
3
+ } from "./chunk-ZBUXIAEV.js";
4
+ import {
5
+ watch
6
+ } from "./chunk-ELDMXTUQ.js";
7
+ import {
8
+ qtiTransformTest
9
+ } from "./chunk-VEWD22O5.js";
10
+ import {
11
+ __decorateClass
12
+ } from "./chunk-H2JE6IVU.js";
13
+
14
+ // src/lib/qti-test/components/test-container.ts
15
+ import { LitElement, html } from "lit";
16
+ import { customElement, property, state } from "lit/decorators.js";
17
+ import { until } from "lit/directives/until.js";
18
+ var TestContainer = class extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.testURL = null;
22
+ this.testDoc = null;
23
+ this.testXML = null;
24
+ /** Template content if provided */
25
+ this.templateContent = null;
26
+ }
27
+ async handleTestURLChange() {
28
+ if (!this.testURL) return;
29
+ try {
30
+ const api = await qtiTransformTest().load(this.testURL);
31
+ this.testDoc = api.htmlDoc();
32
+ } catch (error) {
33
+ console.error("Error loading or parsing XML:", error);
34
+ }
35
+ }
36
+ handleTestXMLChange() {
37
+ if (!this.testXML) return;
38
+ try {
39
+ this.testDoc = qtiTransformTest().parse(this.testXML).htmlDoc();
40
+ } catch (error) {
41
+ console.error("Error parsing XML:", error);
42
+ }
43
+ }
44
+ async connectedCallback() {
45
+ super.connectedCallback();
46
+ this.initializeTemplateContent();
47
+ this.applyStyles();
48
+ if (this.testURL) {
49
+ this.handleTestURLChange();
50
+ }
51
+ if (this.testXML) {
52
+ this.handleTestXMLChange();
53
+ }
54
+ }
55
+ initializeTemplateContent() {
56
+ const template = this.querySelector("template");
57
+ this.templateContent = template ? template.content : html``;
58
+ }
59
+ applyStyles() {
60
+ const sheet = new CSSStyleSheet();
61
+ sheet.replaceSync(item_default);
62
+ this.shadowRoot.adoptedStyleSheets = [sheet];
63
+ }
64
+ render() {
65
+ return html`
66
+ ${this.templateContent}
67
+ <slot></slot>
68
+ ${until(this.testDoc, html`<span>Loading...</span>`)}
69
+ `;
70
+ }
71
+ };
72
+ __decorateClass([
73
+ property({ type: String, attribute: "test-url" })
74
+ ], TestContainer.prototype, "testURL", 2);
75
+ __decorateClass([
76
+ state()
77
+ ], TestContainer.prototype, "testDoc", 2);
78
+ __decorateClass([
79
+ state()
80
+ ], TestContainer.prototype, "testXML", 2);
81
+ __decorateClass([
82
+ watch("testURL", { waitUntilFirstUpdate: true })
83
+ ], TestContainer.prototype, "handleTestURLChange", 1);
84
+ __decorateClass([
85
+ watch("testXML", { waitUntilFirstUpdate: true })
86
+ ], TestContainer.prototype, "handleTestXMLChange", 1);
87
+ TestContainer = __decorateClass([
88
+ customElement("test-container")
89
+ ], TestContainer);
90
+
91
+ export {
92
+ TestContainer
93
+ };
94
+ //# sourceMappingURL=chunk-OFYYP7AK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-test/components/test-container.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\n\nimport { watch } from '../../decorators/watch';\nimport itemCss from '../../../item.css?inline';\nimport { qtiTransformTest } from '../../qti-transformers';\n\n/**\n * `<test-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-test` will be placed inside the shadow DOM of this element.\n * The element loads the test from the provided URL and renders it inside the shadow DOM.\n *\n * ```html\n * <qti-test>\n * <test-navigation>\n * <test-container class=\"m-4 bg-white\" test-url=\"./path/to/assessmenttest.xml\"></test-container>\n * </test-navigation>\n * </qti-test>\n * ```\n */\n@customElement('test-container')\nexport class TestContainer extends LitElement {\n /** URL of the item to load */\n @property({ type: String, attribute: 'test-url' })\n testURL: string = null;\n\n /** A parsed HTML document */\n @state()\n testDoc: DocumentFragment = null;\n\n /** The raw XML string */\n @state()\n testXML: string = null;\n\n /** Template content if provided */\n private templateContent = null;\n\n @watch('testURL', { waitUntilFirstUpdate: true })\n protected async handleTestURLChange() {\n if (!this.testURL) return;\n try {\n const api = await qtiTransformTest().load(this.testURL);\n this.testDoc = api.htmlDoc();\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n @watch('testXML', { waitUntilFirstUpdate: true })\n protected handleTestXMLChange() {\n if (!this.testXML) return;\n try {\n this.testDoc = qtiTransformTest().parse(this.testXML).htmlDoc();\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.initializeTemplateContent();\n this.applyStyles();\n if (this.testURL) {\n this.handleTestURLChange();\n }\n if (this.testXML) {\n this.handleTestXMLChange();\n }\n }\n\n private initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.templateContent = template ? template.content : html``;\n }\n\n private applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n render() {\n return html`\n ${this.templateContent}\n <slot></slot>\n ${until(this.testDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-container': TestContainer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,YAAY,YAAY;AACjC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,aAAa;AAoBf,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC;AAAA;AAGL,mBAAkB;AAIlB,mBAA4B;AAI5B,mBAAkB;AAGlB;AAAA,SAAQ,kBAAkB;AAAA;AAAA,EAG1B,MAAgB,sBAAsB;AACpC,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;AACF,YAAM,MAAM,MAAM,iBAAi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