@citolab/qti-components 7.3.0 → 7.3.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 (393) hide show
  1. package/cdn/chunks/chunk-2F7QLIQX.js +2 -0
  2. package/cdn/chunks/chunk-2TNA4LAA.js +5 -0
  3. package/cdn/chunks/chunk-3KGTXIVH.js +8 -0
  4. package/cdn/chunks/chunk-3XOKPK45.js +2 -0
  5. package/cdn/chunks/chunk-42P7F3FC.js +73 -0
  6. package/cdn/chunks/chunk-4DVWMPIY.js +1 -0
  7. package/cdn/chunks/chunk-4HPXSOYI.js +8 -0
  8. package/cdn/chunks/chunk-4NRLYCX4.js +1 -0
  9. package/cdn/chunks/chunk-57WZEH27.js +8 -0
  10. package/cdn/chunks/chunk-5EXLLJZQ.js +1 -0
  11. package/cdn/chunks/chunk-5F23N5NY.js +1 -0
  12. package/cdn/chunks/chunk-5PA3GEIX.js +2 -0
  13. package/cdn/chunks/chunk-5TWGFLOQ.js +8 -0
  14. package/cdn/chunks/chunk-65CZNGQC.js +55 -0
  15. package/cdn/chunks/chunk-65EW446C.js +6 -0
  16. package/cdn/chunks/chunk-6BGG2JJR.js +24 -0
  17. package/cdn/chunks/chunk-6IUESNBB.js +8 -0
  18. package/cdn/chunks/chunk-6K2ZYRFF.js +8 -0
  19. package/cdn/chunks/chunk-774W6MHT.js +8 -0
  20. package/cdn/chunks/chunk-7Q4OOYXA.js +1 -0
  21. package/cdn/chunks/chunk-7VGFTHNK.js +1492 -0
  22. package/cdn/chunks/chunk-7WJYJA45.js +59 -0
  23. package/cdn/chunks/chunk-AA47N7CH.js +1 -0
  24. package/cdn/chunks/chunk-AEDTBA25.js +1 -0
  25. package/cdn/chunks/chunk-AZLSV74C.js +8 -0
  26. package/cdn/chunks/chunk-BB7HFL7K.js +1 -0
  27. package/cdn/chunks/chunk-BMOQZEO2.js +1 -0
  28. package/cdn/chunks/chunk-C26NWYVO.js +2 -0
  29. package/cdn/chunks/chunk-CIIKVJF7.js +2 -0
  30. package/cdn/chunks/chunk-CMGZUMGV.js +2 -0
  31. package/cdn/chunks/chunk-D4A6UBNV.js +41 -0
  32. package/cdn/chunks/chunk-DCSFLPLR.js +8 -0
  33. package/cdn/chunks/chunk-DDA3QNFL.js +1 -0
  34. package/cdn/chunks/chunk-DEWOG57H.js +1 -0
  35. package/cdn/chunks/chunk-DHC7PAPQ.js +8 -0
  36. package/cdn/chunks/chunk-DNY4M5BB.js +8 -0
  37. package/cdn/chunks/chunk-DPR3I67K.js +1 -0
  38. package/cdn/chunks/chunk-DQTXWGN5.js +48 -0
  39. package/cdn/chunks/chunk-DTLI3JJ6.js +8 -0
  40. package/cdn/chunks/chunk-DZTNCG5K.js +2 -0
  41. package/cdn/chunks/chunk-E46WIJKQ.js +5 -0
  42. package/cdn/chunks/chunk-ER2TCZX3.js +8 -0
  43. package/cdn/chunks/chunk-EVDUKDZH.js +1 -0
  44. package/cdn/chunks/chunk-EWRXIRZJ.js +8 -0
  45. package/cdn/chunks/chunk-EZJSKOLP.js +5 -0
  46. package/cdn/chunks/chunk-F6VI7SEZ.js +5 -0
  47. package/cdn/chunks/chunk-FGR3JZXL.js +48 -0
  48. package/cdn/chunks/chunk-FREEF447.js +2 -0
  49. package/cdn/chunks/chunk-G66B3SKF.js +2 -0
  50. package/cdn/chunks/chunk-GFVOBN7D.js +8 -0
  51. package/cdn/chunks/chunk-GOXH3AYH.js +5 -0
  52. package/cdn/chunks/chunk-GVKNKCU6.js +1492 -0
  53. package/cdn/chunks/chunk-H3WTP2FL.js +2 -0
  54. package/cdn/chunks/chunk-HE62L5UT.js +1 -0
  55. package/cdn/chunks/chunk-HH6AFB54.js +1492 -0
  56. package/cdn/chunks/chunk-IEHCQ5EK.js +2 -0
  57. package/cdn/chunks/chunk-IEOQ2ZTN.js +3461 -0
  58. package/cdn/chunks/chunk-IPAFN4CK.js +1 -0
  59. package/cdn/chunks/chunk-JHBAY3L2.js +8 -0
  60. package/cdn/chunks/chunk-JKUNDLQR.js +1 -0
  61. package/cdn/chunks/chunk-KLXWDMHE.js +1 -0
  62. package/cdn/chunks/chunk-KP5NLKZ5.js +1 -0
  63. package/cdn/chunks/chunk-KXXIBL5Z.js +8 -0
  64. package/cdn/chunks/chunk-LBB5CUEL.js +8 -0
  65. package/cdn/chunks/chunk-LHAF7DPW.js +2 -0
  66. package/cdn/chunks/chunk-LUNOUEBJ.js +8 -0
  67. package/cdn/chunks/chunk-M3RRG6KY.js +1 -0
  68. package/cdn/chunks/chunk-M4LLTEOD.js +8 -0
  69. package/cdn/chunks/chunk-MH2Z24XO.js +1 -0
  70. package/cdn/chunks/chunk-N3YBYEEI.js +2 -0
  71. package/cdn/chunks/chunk-N5BGKNYJ.js +5 -0
  72. package/cdn/chunks/chunk-NPVEQKUL.js +2 -0
  73. package/cdn/chunks/chunk-ODMQDF6O.js +1 -0
  74. package/cdn/chunks/chunk-OW2KBDBG.js +8 -0
  75. package/cdn/chunks/chunk-PQJD55CB.js +8 -0
  76. package/cdn/chunks/chunk-PUI3LIFH.js +0 -0
  77. package/cdn/chunks/chunk-QHO7IBHQ.js +2 -0
  78. package/cdn/chunks/chunk-QTTXN3LY.js +2 -0
  79. package/cdn/chunks/chunk-RQHP2XKF.js +8 -0
  80. package/cdn/chunks/chunk-RUQA3BBO.js +8 -0
  81. package/cdn/chunks/chunk-RZGOUINM.js +1 -0
  82. package/cdn/chunks/chunk-SAXGGMLU.js +8 -0
  83. package/cdn/chunks/chunk-SDSLRCON.js +1 -0
  84. package/cdn/chunks/chunk-SDWXKOZK.js +8 -0
  85. package/cdn/chunks/chunk-T4K75PFT.js +1 -0
  86. package/cdn/chunks/chunk-TC54XTRL.js +17 -0
  87. package/cdn/chunks/chunk-TDS4LYUD.js +8 -0
  88. package/cdn/chunks/chunk-U5Y5T4ZS.js +17 -0
  89. package/cdn/chunks/chunk-U7DWV6B3.js +5 -0
  90. package/cdn/chunks/chunk-UB5MEEVK.js +8 -0
  91. package/cdn/chunks/chunk-UN2WT4WS.js +2 -0
  92. package/cdn/chunks/chunk-UU5PAEUU.js +1 -0
  93. package/cdn/chunks/chunk-UX37G5GZ.js +8 -0
  94. package/cdn/chunks/chunk-UZYJ2YET.js +1 -0
  95. package/cdn/chunks/chunk-VGNWADCN.js +1 -0
  96. package/cdn/chunks/chunk-VXQNVDBK.js +1 -0
  97. package/cdn/chunks/chunk-W6GUPXZV.js +1492 -0
  98. package/cdn/chunks/chunk-WC5YAZM2.js +5 -0
  99. package/cdn/chunks/chunk-WLTLNYTT.js +8 -0
  100. package/cdn/chunks/chunk-WNRGD6XK.js +1 -0
  101. package/cdn/chunks/chunk-X6XQ42NC.js +1 -0
  102. package/cdn/chunks/chunk-X6XRXEW2.js +2 -0
  103. package/cdn/chunks/chunk-XB37N5IN.js +1 -0
  104. package/cdn/chunks/chunk-XCXGSLM4.js +2 -0
  105. package/cdn/chunks/chunk-XFUCW4CT.js +5 -0
  106. package/cdn/chunks/chunk-XQIN4PIX.js +10 -0
  107. package/cdn/chunks/chunk-XY3YXM26.js +8 -0
  108. package/cdn/chunks/chunk-YGJSWINU.js +1 -0
  109. package/cdn/chunks/chunk-YXM5LVFL.js +1 -0
  110. package/cdn/chunks/chunk-YXZ773BI.js +1 -0
  111. package/cdn/chunks/chunk-YZCE7WOL.js +1 -0
  112. package/cdn/chunks/chunk-ZJK77QYF.js +8 -0
  113. package/cdn/chunks/chunk-ZSLIH67U.js +1 -0
  114. package/cdn/exports/computed-item.context.js +1 -1
  115. package/cdn/exports/computed.context.js +1 -1
  116. package/cdn/exports/config.context.js +1 -1
  117. package/cdn/exports/interaction.js +1 -1
  118. package/cdn/exports/qti-assessment-item.context.js +1 -1
  119. package/cdn/exports/qti-condition-expression.js +1 -1
  120. package/cdn/exports/qti-expression.js +1 -1
  121. package/cdn/exports/session.context.js +1 -1
  122. package/cdn/exports/test.context.js +1 -1
  123. package/cdn/index.global.js +1 -1
  124. package/cdn/index.js +1 -1
  125. package/cdn/qti-components/index.js +1 -1
  126. package/cdn/qti-item/components/item-container.js +1 -1
  127. package/cdn/qti-item/components/item-show-correct-response.js +1 -1
  128. package/cdn/qti-item/components/print-item-variables.js +1 -1
  129. package/cdn/qti-item/components/styles.js +1 -1
  130. package/cdn/qti-item/core/index.js +1 -1
  131. package/cdn/qti-test/components/index.js +1 -1
  132. package/cdn/qti-test/components/styles.js +1 -1
  133. package/cdn/qti-test/components/test-check-item.js +1 -0
  134. package/cdn/qti-test/components/test-container.js +1 -1
  135. package/cdn/qti-test/components/test-end-attempt.js +1 -1
  136. package/cdn/qti-test/components/test-item-link.js +1 -1
  137. package/cdn/qti-test/components/test-navigation.js +1 -1
  138. package/cdn/qti-test/components/test-next.js +1 -1
  139. package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
  140. package/cdn/qti-test/components/test-prev.js +1 -1
  141. package/cdn/qti-test/components/test-print-context.js +1 -1
  142. package/cdn/qti-test/components/test-print-item-variables.js +1 -1
  143. package/cdn/qti-test/components/test-scoring-buttons.js +1 -1
  144. package/cdn/qti-test/components/test-scoring-feedback.js +1 -1
  145. package/cdn/qti-test/components/test-section-buttons-stamp.js +1 -1
  146. package/cdn/qti-test/components/test-section-link.js +1 -1
  147. package/cdn/qti-test/components/test-show-correct-response.js +1 -1
  148. package/cdn/qti-test/components/test-stamp.js +1 -1
  149. package/cdn/qti-test/components/test-view-toggle.js +1 -1
  150. package/cdn/qti-test/components/test-view.js +1 -1
  151. package/cdn/qti-test/core/index.js +1 -1
  152. package/dist/chunks/chunk-24ZEUR6V.js +91 -0
  153. package/dist/chunks/chunk-24ZEUR6V.js.map +1 -0
  154. package/dist/chunks/chunk-25SPL2N7.js +296 -0
  155. package/dist/chunks/chunk-25SPL2N7.js.map +1 -0
  156. package/dist/chunks/chunk-2L6I23IQ.js +308 -0
  157. package/dist/chunks/chunk-2L6I23IQ.js.map +1 -0
  158. package/dist/chunks/chunk-3FIHHFFC.js +307 -0
  159. package/dist/chunks/chunk-3FIHHFFC.js.map +1 -0
  160. package/dist/chunks/chunk-3IAZELYI.js +90 -0
  161. package/dist/chunks/chunk-3IAZELYI.js.map +1 -0
  162. package/dist/chunks/chunk-3YJPKRFS.js +91 -0
  163. package/dist/chunks/chunk-3YJPKRFS.js.map +1 -0
  164. package/dist/chunks/chunk-5AZFPSD4.js +87 -0
  165. package/dist/chunks/chunk-5AZFPSD4.js.map +1 -0
  166. package/dist/chunks/chunk-5OZP32ZZ.js +90 -0
  167. package/dist/chunks/chunk-5OZP32ZZ.js.map +1 -0
  168. package/dist/chunks/chunk-5QGG5BMS.js +45 -0
  169. package/dist/chunks/chunk-5QGG5BMS.js.map +1 -0
  170. package/dist/chunks/chunk-5SU6S5L4.js +94 -0
  171. package/dist/chunks/chunk-5SU6S5L4.js.map +1 -0
  172. package/dist/chunks/chunk-5WHKITF6.js +90 -0
  173. package/dist/chunks/chunk-5WHKITF6.js.map +1 -0
  174. package/dist/chunks/chunk-64JRMFTB.js +93 -0
  175. package/dist/chunks/chunk-64JRMFTB.js.map +1 -0
  176. package/dist/chunks/chunk-6BNGNEZW.js +308 -0
  177. package/dist/chunks/chunk-6BNGNEZW.js.map +1 -0
  178. package/dist/chunks/chunk-6DMR7L77.js +44 -0
  179. package/dist/chunks/chunk-6DMR7L77.js.map +1 -0
  180. package/dist/chunks/chunk-6N4WVDBR.js +95 -0
  181. package/dist/chunks/chunk-6N4WVDBR.js.map +1 -0
  182. package/dist/chunks/chunk-6SGCKTJ6.js +88 -0
  183. package/dist/chunks/chunk-6SGCKTJ6.js.map +1 -0
  184. package/dist/chunks/chunk-6U3U2UIA.js +887 -0
  185. package/dist/chunks/chunk-6U3U2UIA.js.map +1 -0
  186. package/dist/chunks/chunk-745MFIEL.js +238 -0
  187. package/dist/chunks/chunk-745MFIEL.js.map +1 -0
  188. package/dist/chunks/chunk-7NNYV6VG.js +95 -0
  189. package/dist/chunks/chunk-7NNYV6VG.js.map +1 -0
  190. package/dist/chunks/chunk-7OMJMXHK.js +50 -0
  191. package/dist/chunks/chunk-7OMJMXHK.js.map +1 -0
  192. package/dist/chunks/chunk-7YI2I5U2.js +238 -0
  193. package/dist/chunks/chunk-7YI2I5U2.js.map +1 -0
  194. package/dist/chunks/chunk-AOXSRF6N.js +7309 -0
  195. package/dist/chunks/chunk-AOXSRF6N.js.map +1 -0
  196. package/dist/chunks/chunk-B7BLTXGS.js +88 -0
  197. package/dist/chunks/chunk-B7BLTXGS.js.map +1 -0
  198. package/dist/chunks/chunk-BI3RICFC.js +300 -0
  199. package/dist/chunks/chunk-BI3RICFC.js.map +1 -0
  200. package/dist/chunks/chunk-BTZQDUT6.js +44 -0
  201. package/dist/chunks/chunk-BTZQDUT6.js.map +1 -0
  202. package/dist/chunks/chunk-CTPQMLOA.js +88 -0
  203. package/dist/chunks/chunk-CTPQMLOA.js.map +1 -0
  204. package/dist/chunks/chunk-DGPPAIBY.js +307 -0
  205. package/dist/chunks/chunk-DGPPAIBY.js.map +1 -0
  206. package/dist/chunks/chunk-DJ7XZ2UR.js +91 -0
  207. package/dist/chunks/chunk-DJ7XZ2UR.js.map +1 -0
  208. package/dist/chunks/chunk-DLCEFRYR.js +887 -0
  209. package/dist/chunks/chunk-DLCEFRYR.js.map +1 -0
  210. package/dist/chunks/chunk-DLVJXJLB.js +90 -0
  211. package/dist/chunks/chunk-DLVJXJLB.js.map +1 -0
  212. package/dist/chunks/chunk-EVOMGJVT.js +95 -0
  213. package/dist/chunks/chunk-EVOMGJVT.js.map +1 -0
  214. package/dist/chunks/chunk-EYWDGFIX.js +89 -0
  215. package/dist/chunks/chunk-EYWDGFIX.js.map +1 -0
  216. package/dist/chunks/chunk-F5OPIJ4X.js +90 -0
  217. package/dist/chunks/chunk-F5OPIJ4X.js.map +1 -0
  218. package/dist/chunks/chunk-FEXZ676E.js +304 -0
  219. package/dist/chunks/chunk-FEXZ676E.js.map +1 -0
  220. package/dist/chunks/chunk-FH34FO6K.js +238 -0
  221. package/dist/chunks/chunk-FH34FO6K.js.map +1 -0
  222. package/dist/chunks/chunk-FIAJJAPH.js +85 -0
  223. package/dist/chunks/chunk-FIAJJAPH.js.map +1 -0
  224. package/dist/chunks/chunk-FQVFSQFE.js +238 -0
  225. package/dist/chunks/chunk-FQVFSQFE.js.map +1 -0
  226. package/dist/chunks/chunk-G3M2356A.js +889 -0
  227. package/dist/chunks/chunk-G3M2356A.js.map +1 -0
  228. package/dist/chunks/chunk-GA2EWU3T.js +102 -0
  229. package/dist/chunks/chunk-GA2EWU3T.js.map +1 -0
  230. package/dist/chunks/chunk-GEEYD5SH.js +7310 -0
  231. package/dist/chunks/chunk-GEEYD5SH.js.map +1 -0
  232. package/dist/chunks/chunk-GIHLVK5S.js +103 -0
  233. package/dist/chunks/chunk-GIHLVK5S.js.map +1 -0
  234. package/dist/chunks/chunk-GV4LNJKM.js +248 -0
  235. package/dist/chunks/chunk-GV4LNJKM.js.map +1 -0
  236. package/dist/chunks/chunk-H2HBYOZZ.js +90 -0
  237. package/dist/chunks/chunk-H2HBYOZZ.js.map +1 -0
  238. package/dist/chunks/chunk-H6RDLSTK.js +87 -0
  239. package/dist/chunks/chunk-H6RDLSTK.js.map +1 -0
  240. package/dist/chunks/chunk-HIFFHC2Z.js +887 -0
  241. package/dist/chunks/chunk-HIFFHC2Z.js.map +1 -0
  242. package/dist/chunks/chunk-HUQGTGCK.js +91 -0
  243. package/dist/chunks/chunk-HUQGTGCK.js.map +1 -0
  244. package/dist/chunks/chunk-IAZM2LUL.js +87 -0
  245. package/dist/chunks/chunk-IAZM2LUL.js.map +1 -0
  246. package/dist/chunks/chunk-IDRQNT6W.js +86 -0
  247. package/dist/chunks/chunk-IDRQNT6W.js.map +1 -0
  248. package/dist/chunks/chunk-IRKYNGZN.js +90 -0
  249. package/dist/chunks/chunk-IRKYNGZN.js.map +1 -0
  250. package/dist/chunks/chunk-IWQR5TSB.js +43 -0
  251. package/dist/chunks/chunk-IWQR5TSB.js.map +1 -0
  252. package/dist/chunks/chunk-J4RNYEIE.js +85 -0
  253. package/dist/chunks/chunk-J4RNYEIE.js.map +1 -0
  254. package/dist/chunks/chunk-K5F4CT37.js +82 -0
  255. package/dist/chunks/chunk-K5F4CT37.js.map +1 -0
  256. package/dist/chunks/chunk-L7HOSFNE.js +307 -0
  257. package/dist/chunks/chunk-L7HOSFNE.js.map +1 -0
  258. package/dist/chunks/chunk-LBL5YIK7.js +94 -0
  259. package/dist/chunks/chunk-LBL5YIK7.js.map +1 -0
  260. package/dist/chunks/chunk-MGC6UY5C.js +85 -0
  261. package/dist/chunks/chunk-MGC6UY5C.js.map +1 -0
  262. package/dist/chunks/chunk-MK5KU4FM.js +7303 -0
  263. package/dist/chunks/chunk-MK5KU4FM.js.map +1 -0
  264. package/dist/chunks/chunk-MKPVFZUH.js +88 -0
  265. package/dist/chunks/chunk-MKPVFZUH.js.map +1 -0
  266. package/dist/chunks/chunk-MTWSJYVA.js +86 -0
  267. package/dist/chunks/chunk-MTWSJYVA.js.map +1 -0
  268. package/dist/chunks/chunk-NJTIAZBT.js +236 -0
  269. package/dist/chunks/chunk-NJTIAZBT.js.map +1 -0
  270. package/dist/chunks/chunk-O2AQND3R.js +889 -0
  271. package/dist/chunks/chunk-O2AQND3R.js.map +1 -0
  272. package/dist/chunks/chunk-O2SG4LAF.js +294 -0
  273. package/dist/chunks/chunk-O2SG4LAF.js.map +1 -0
  274. package/dist/chunks/chunk-POGGEBHU.js +294 -0
  275. package/dist/chunks/chunk-POGGEBHU.js.map +1 -0
  276. package/dist/chunks/chunk-PRO3U224.js +91 -0
  277. package/dist/chunks/chunk-PRO3U224.js.map +1 -0
  278. package/dist/chunks/chunk-PWLZEXO4.js +89 -0
  279. package/dist/chunks/chunk-PWLZEXO4.js.map +1 -0
  280. package/dist/chunks/chunk-Q7Q24WJK.js +227 -0
  281. package/dist/chunks/chunk-Q7Q24WJK.js.map +1 -0
  282. package/dist/chunks/chunk-QBRVWBMH.js +230 -0
  283. package/dist/chunks/chunk-QBRVWBMH.js.map +1 -0
  284. package/dist/chunks/chunk-R5EYCFY4.js +91 -0
  285. package/dist/chunks/chunk-R5EYCFY4.js.map +1 -0
  286. package/dist/chunks/chunk-RHXLL5D3.js +264 -0
  287. package/dist/chunks/chunk-RHXLL5D3.js.map +1 -0
  288. package/dist/chunks/chunk-SGNRQWTB.js +887 -0
  289. package/dist/chunks/chunk-SGNRQWTB.js.map +1 -0
  290. package/dist/chunks/chunk-SOKWNLL4.js +89 -0
  291. package/dist/chunks/chunk-SOKWNLL4.js.map +1 -0
  292. package/dist/chunks/chunk-TWYN56XO.js +92 -0
  293. package/dist/chunks/chunk-TWYN56XO.js.map +1 -0
  294. package/dist/chunks/chunk-U2662SPQ.js +887 -0
  295. package/dist/chunks/chunk-U2662SPQ.js.map +1 -0
  296. package/dist/chunks/chunk-UNYT7ZNM.js +85 -0
  297. package/dist/chunks/chunk-UNYT7ZNM.js.map +1 -0
  298. package/dist/chunks/chunk-UUZFQW3D.js +889 -0
  299. package/dist/chunks/chunk-UUZFQW3D.js.map +1 -0
  300. package/dist/chunks/chunk-VIBFS7K3.js +229 -0
  301. package/dist/chunks/chunk-VIBFS7K3.js.map +1 -0
  302. package/dist/chunks/chunk-VVPQCJL6.js +264 -0
  303. package/dist/chunks/chunk-VVPQCJL6.js.map +1 -0
  304. package/dist/chunks/chunk-VY73H2OD.js +238 -0
  305. package/dist/chunks/chunk-VY73H2OD.js.map +1 -0
  306. package/dist/chunks/chunk-W7DAMVVM.js +90 -0
  307. package/dist/chunks/chunk-W7DAMVVM.js.map +1 -0
  308. package/dist/chunks/chunk-WTV3RW6F.js +91 -0
  309. package/dist/chunks/chunk-WTV3RW6F.js.map +1 -0
  310. package/dist/chunks/chunk-XB2AUIYM.js +232 -0
  311. package/dist/chunks/chunk-XB2AUIYM.js.map +1 -0
  312. package/dist/chunks/chunk-XBJQTK4U.js +91 -0
  313. package/dist/chunks/chunk-XBJQTK4U.js.map +1 -0
  314. package/dist/chunks/chunk-XH6AMJFY.js +238 -0
  315. package/dist/chunks/chunk-XH6AMJFY.js.map +1 -0
  316. package/dist/chunks/chunk-XNQ4ARRB.js +90 -0
  317. package/dist/chunks/chunk-XNQ4ARRB.js.map +1 -0
  318. package/dist/chunks/chunk-Y5S4XHSH.js +133 -0
  319. package/dist/chunks/chunk-Y5S4XHSH.js.map +1 -0
  320. package/dist/chunks/chunk-YC72WJT5.js +88 -0
  321. package/dist/chunks/chunk-YC72WJT5.js.map +1 -0
  322. package/dist/chunks/chunk-YMQNOCS2.js +246 -0
  323. package/dist/chunks/chunk-YMQNOCS2.js.map +1 -0
  324. package/dist/chunks/chunk-Z6EJ36PR.js +307 -0
  325. package/dist/chunks/chunk-Z6EJ36PR.js.map +1 -0
  326. package/dist/chunks/chunk-ZEEFMPDJ.js +238 -0
  327. package/dist/chunks/chunk-ZEEFMPDJ.js.map +1 -0
  328. package/dist/chunks/chunk-ZGSNDSK3.js +1 -0
  329. package/dist/chunks/chunk-ZGSNDSK3.js.map +1 -0
  330. package/dist/chunks/chunk-ZLULX3V3.js +264 -0
  331. package/dist/chunks/chunk-ZLULX3V3.js.map +1 -0
  332. package/dist/chunks/chunk-ZO6ZTWFN.js +99 -0
  333. package/dist/chunks/chunk-ZO6ZTWFN.js.map +1 -0
  334. package/dist/chunks/chunk-ZSAPTO2I.js +85 -0
  335. package/dist/chunks/chunk-ZSAPTO2I.js.map +1 -0
  336. package/dist/chunks/chunk-ZW6ND3PL.js +307 -0
  337. package/dist/chunks/chunk-ZW6ND3PL.js.map +1 -0
  338. package/dist/exports/computed-item.context.d.ts +1 -1
  339. package/dist/exports/computed.context.d.ts +2 -2
  340. package/dist/exports/interaction.d.ts +1 -1
  341. package/dist/exports/item.context.d.ts +1 -1
  342. package/dist/exports/qti-assessment-item.context.d.ts +1 -1
  343. package/dist/exports/qti-condition-expression.d.ts +1 -1
  344. package/dist/exports/qti-expression.d.ts +1 -1
  345. package/dist/exports/session.context.d.ts +2 -2
  346. package/dist/exports/test.context.d.ts +1 -1
  347. package/dist/exports/variables.d.ts +1 -1
  348. package/dist/index.d.ts +3 -2
  349. package/dist/index.js +19 -16
  350. package/dist/qti-components/index.d.ts +2 -2
  351. package/dist/qti-components/index.js +1 -1
  352. package/dist/qti-components-jsx.d.ts +63 -18
  353. package/dist/qti-item/components/item-show-correct-response.d.ts +1 -1
  354. package/dist/qti-item/components/print-item-variables.d.ts +1 -1
  355. package/dist/qti-item/core/index.d.ts +1 -1
  356. package/dist/qti-loader/index.d.ts +1 -1
  357. package/dist/qti-response-declaration-0TYT5oEz.d.ts +1171 -0
  358. package/dist/qti-response-declaration-B0WM2iOU.d.ts +1113 -0
  359. package/dist/qti-response-declaration-tkYP2TfV.d.ts +1112 -0
  360. package/dist/qti-response-declaration-y-C5AMTr.d.ts +1115 -0
  361. package/dist/qti-test/components/index.d.ts +3 -2
  362. package/dist/qti-test/components/index.js +17 -14
  363. package/dist/qti-test/components/test-check-item.d.ts +16 -0
  364. package/dist/qti-test/components/test-check-item.js +9 -0
  365. package/dist/qti-test/components/test-check-item.js.map +1 -0
  366. package/dist/qti-test/components/test-navigation.d.ts +2 -2
  367. package/dist/qti-test/components/test-navigation.js +1 -1
  368. package/dist/qti-test/components/test-next.d.ts +2 -3
  369. package/dist/qti-test/components/test-next.js +1 -4
  370. package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +3 -0
  371. package/dist/qti-test/components/test-paging-buttons-stamp.js +1 -1
  372. package/dist/qti-test/components/test-prev.d.ts +2 -2
  373. package/dist/qti-test/components/test-prev.js +1 -2
  374. package/dist/qti-test/components/test-print-context.d.ts +2 -2
  375. package/dist/qti-test/components/test-print-item-variables.d.ts +2 -2
  376. package/dist/qti-test/components/test-scoring-buttons.d.ts +2 -2
  377. package/dist/qti-test/components/test-scoring-buttons.js +1 -1
  378. package/dist/qti-test/components/test-scoring-feedback.d.ts +2 -2
  379. package/dist/qti-test/components/test-section-buttons-stamp.d.ts +3 -0
  380. package/dist/qti-test/components/test-section-buttons-stamp.js +1 -1
  381. package/dist/qti-test/components/test-show-correct-response.d.ts +5 -2
  382. package/dist/qti-test/components/test-show-correct-response.js +1 -1
  383. package/dist/qti-test/components/test-stamp.d.ts +8 -2
  384. package/dist/qti-test/components/test-stamp.js +1 -1
  385. package/dist/qti-test/core/index.d.ts +4 -3
  386. package/dist/qti-test/core/index.js +2 -2
  387. package/dist/qti-test-feedback-Bth3dOO1.d.ts +85 -0
  388. package/dist/qti-test-feedback-C6Z0bJMR.d.ts +85 -0
  389. package/dist/qti-test-feedback-CcyKpmkY.d.ts +85 -0
  390. package/dist/qti-test-feedback-D8AwiYTL.d.ts +85 -0
  391. package/dist/vscode.html-custom-data.json +30 -13
  392. package/package.json +6 -5
  393. package/readme.md +4 -0
@@ -0,0 +1,1492 @@
1
+ import{a as Ye}from"./chunk-EHK76KRT.js";import{a as de,b as Z,c as ue,e as he,f as Q,g as zt,h as Ft,i as We,j as Ut}from"./chunk-6BGG2JJR.js";import{a as R}from"./chunk-XUJ7TXHW.js";import{a as $}from"./chunk-4NRLYCX4.js";import{a as C}from"./chunk-65EW446C.js";import{a as T}from"./chunk-QQCGUVEV.js";import{a as Pt}from"./chunk-ULI6NOVG.js";import{a as Ht,b as S}from"./chunk-7WJYJA45.js";import{a as E}from"./chunk-KP5NLKZ5.js";import{a as m,b as u,c as x,d as pe,e as Nt}from"./chunk-42P7F3FC.js";import{a as g,d as h,e as Xe,f as ce,g as _,i as y}from"./chunk-65CZNGQC.js";import{a as Ot}from"./chunk-KWPDTFYH.js";import{a as n}from"./chunk-IAP2CEE7.js";var L=class extends y{constructor(){super(...arguments);this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(r=>r.readonly=t);this._context={variables:Ot};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:r}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(r)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:r}=e.detail;this.updateOutcomeVariable(t,r),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:r}=e.detail;this.updateResponseVariable(t,r),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let r=e.find(s=>s.identifier===t.identifier);return r?{...t,...r}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let r=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);r&&(r.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(r=>r.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(a=>a.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this}))})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._context.variables.filter(r=>r.type==="response")){let r=this._interactionElements.find(s=>s.getAttribute("response-identifier")===t.identifier);r&&r.toggleCorrectResponse(t,e)}}processResponse(e=!0,t=!0){this.validate(t);let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==e?r:{...r,value:t})},this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:r.cardinality==="single"?t:[...s.value,t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){return this._interactionElements.every(t=>t.validate())?!0:this._interactionElements.some(t=>t.validate())?!1:(e&&this.reportValidity(),null)}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};n([u({type:String})],L.prototype,"title",2),n([u({type:String})],L.prototype,"identifier",2),n([u({type:String})],L.prototype,"adaptive",2),n([u({type:String})],L.prototype,"timeDependent",2),n([u({type:Boolean})],L.prototype,"disabled",2),n([R("disabled",{waitUntilFirstUpdate:!0})],L.prototype,"_handleDisabledChange",2),n([u({type:Boolean})],L.prototype,"readonly",2),n([R("readonly",{waitUntilFirstUpdate:!0})],L.prototype,"_handleReadonlyChange",2),n([Ht({context:T})],L.prototype,"_context",2),L=n([m("qti-assessment-item")],L);var me=class extends y{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let s=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);s?await this.updateStimulusRef(s):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await Pt().load(this.href).promise.then(r=>r.htmlDoc());if(t){let r=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...r)}}};n([u({type:String})],me.prototype,"identifier",2),n([u({type:String})],me.prototype,"href",2),me=n([m("qti-assessment-stimulus-ref")],me);var Je=class extends y{};Je=n([m("qti-companion-materials-info")],Je);var Ce=class extends y{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let i=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",i?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let i={variable:t=>this._context?.variables.find(r=>r.identifier===t)?.value??"",correct:t=>this._context?.variables.find(r=>r.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(r=>r.identifier===t),updateOutcomeVariable:(t,r)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:r}}))},updateResponseVariable:(t,r)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:r}}))}};return this.operatorFunction(this._context,i,e)}};n([S({context:T,subscribe:!0}),x()],Ce.prototype,"_context",2),Ce=n([m("qti-custom-operator")],Ce);var hr=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),qe=p=>{if(typeof p=="string")return p;let i=hr();return i==="."?p.toLocaleString():p.toString().replace(".","").replace(i,".")};function ct(p){return p==null}function ae(p){return p.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var V=class extends y{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(i){let e=this._context.variables.find(r=>r.identifier===i)||null;if(this.outcomeIdentifier!==i||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!ct(this.identifier)&&!ct(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(i){this.showStatus=i&&this.showHide==="show"||!i&&this.showHide==="hide"?"on":"off"}};n([u({type:String,attribute:"show-hide"})],V.prototype,"showHide",2),n([u({type:String,attribute:"outcome-identifier"})],V.prototype,"outcomeIdentifier",2),n([u({type:String})],V.prototype,"identifier",2),n([u({type:String,attribute:!1})],V.prototype,"showStatus",2),n([S({context:T,subscribe:!0}),x()],V.prototype,"_context",2);var we=class extends V{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};we.styles=g`
2
+ :host {
3
+ display: block;
4
+ }
5
+ .on {
6
+ display: block;
7
+ }
8
+ .off {
9
+ display: none;
10
+ }
11
+ `,we=n([m("qti-feedback-block")],we);var H=p=>p??_;var Me=class extends V{constructor(){super(...arguments);this.render=()=>h` <slot part="feedback" class="${H(this.showStatus)}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Me.styles=g`
12
+ .on {
13
+ display: inline-block;
14
+ }
15
+ .off {
16
+ display: none;
17
+ }
18
+ `,Me=n([m("qti-feedback-inline")],Me);var Te=class extends V{render(){return h`
19
+ <dialog class="qti-dialog" part="feedback" ?open="${this.showStatus==="on"}">
20
+ <slot></slot>
21
+ <div style="margin-top: var(--qti-gap-size); text-align: center;">
22
+ <button class="button close-button" @click="${this.closeFeedback}">Close</button>
23
+ </div>
24
+ </dialog>
25
+ `}openFeedback(){let i=this.shadowRoot?.querySelector("dialog");i&&!i.open&&i.showModal()}closeFeedback(){let i=this.shadowRoot?.querySelector("dialog");i&&i.open&&(i.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(i){i.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};Te.styles=g`
26
+ .qti-dialog {
27
+ background: var(--qti-bg);
28
+ border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
29
+ border-radius: var(--qti-border-radius);
30
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
31
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
32
+ position: fixed;
33
+ top: 50%;
34
+ left: 50%;
35
+ transform: translate(-50%, -50%);
36
+ z-index: 1000;
37
+ width: auto;
38
+ max-width: 90%;
39
+ }
40
+
41
+ .button {
42
+ border-radius: var(--qti-border-radius);
43
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
44
+ background-color: var(--qti-bg-active);
45
+ border: var(--qti-border-active);
46
+ cursor: pointer;
47
+ position: relative;
48
+ display: inline-block;
49
+ }
50
+
51
+ .button:hover {
52
+ background-color: var(--qti-hover-bg);
53
+ }
54
+
55
+ .button:disabled {
56
+ background-color: var(--qti-disabled-bg);
57
+ color: var(--qti-disabled-color);
58
+ cursor: not-allowed;
59
+ }
60
+
61
+ .button:focus {
62
+ outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
63
+ }
64
+ `,Te=n([m("qti-modal-feedback")],Te);var Re=class extends y{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return h` <slot name="drags"></slot> `}};Re.styles=g`
65
+ :host {
66
+ display: flex;
67
+ user-select: none;
68
+ position: absolute;
69
+ }
70
+ `,Re=n([m("qti-associable-hotspot")],Re);var Bt=(p,i,e)=>{class t extends p{}return t};var N=(p,i,e,t)=>{class r extends Bt(p,e,i){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.dataTransfer={data:{},setData(o,l){this.data[o]=l},getData(o){return this.data[o]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=0;this.draggablesModified=(o,l)=>{for(let d of l)this.draggables.includes(d)&&(this.draggables=this.draggables.filter(f=>f!==d),d.removeAttribute("tabindex"),d.removeEventListener("touchstart",this.handleTouchStart.bind(this)),d.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let d of o)this.draggables.includes(d)||(this.draggables.push(d),d.setAttribute("tabindex","0"),d.hasTouchStartListener||(d.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),d.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),d.hasTouchStartListener=!0));let c=0;this.draggables.forEach(d=>{d.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")||crypto.randomUUID()}`,d.setAttribute("qti-draggable","true"),c++})};this.droppablesModified=(o,l)=>{for(let c of l)this.droppables.includes(c)&&(this.droppables=this.droppables.filter(d=>d!==c),this.allDropzones=this.allDropzones.filter(d=>d!==c));for(let c of o)this.droppables.includes(c)||(this.droppables.push(c),this.allDropzones.push(c));for(let c of this.droppables)this.dataset.choicesContainerWidth&&(c.style.width=`${this.dataset.choicesContainerWidth}px`,c.style.boxSizing="border-box")}}handleDraggableContainerChange(o,l){this.isMatchTabular()||(o.length>0||l.length>0)&&this.dragContainersModified(o||[],l||[])}dragContainersModified(o,l){for(let c of l)this.dragContainers.includes(c)&&(this.dragContainers=this.dragContainers.filter(d=>d!==c),this.allDropzones=this.allDropzones.filter(d=>d!==c));for(let c of o)this.dragContainers.includes(c)||(this.dragContainers.push(c),this.allDropzones.push(c))}handleDraggablesChange(o,l){this.isMatchTabular()||(o.length>0||l.length>0)&&this.draggablesModified(o||[],l||[])}handleDroppablesChange(o,l){this.isMatchTabular()||(o.length>0||l.length>0)&&this.droppablesModified(o||[],l||[])}firstUpdated(o){super.firstUpdated(o),this.hasAttribute("disabled")||(document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}));let c=Array.from(this.querySelectorAll(i)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(i)||[])),d=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),f=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(f,[]),this.droppablesModified(d,[]),this.draggablesModified(c,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(v=>this.resizeObserver?.observe(v))}async moveDraggableToDroppable(o,l){(()=>{o.style.transform="translate(0, 0)",l.tagName==="SLOT"?o.setAttribute("slot",l.getAttribute("name")):l.appendChild(o),this.checkAllMaxAssociations(),this.saveResponse()})()}activateDroppable(o){this.dragContainers.includes(o)?(this._internals.states.add("--dragzone-active"),o.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),o.setAttribute("active",""))}deactivateDroppable(o,l=!0){l&&this._internals.states.add("--dragzone-active"),o.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}updateMinDimensionsForDropZones(){let o=this.querySelectorAll(i),l=Array.from(this.querySelectorAll(e)).map(b=>b),c=0,d=0;o.forEach(b=>{let v=b.getBoundingClientRect();c=Math.max(c,v.height),d=Math.max(d,v.width)});let f=this.querySelector(t)||this.shadowRoot?.querySelector(t);f&&(f.style.minHeight=`${c}px`,f.style.minWidth=`${d}px`);for(let b of l)b.style.minHeight=`${c}px`,b.style.minWidth=`${d}px`}activateDroppables(o){this.dragContainers.forEach(c=>{c.setAttribute("enabled",""),c.hasAttribute("disabled")&&(c.contains(o)||c.shadowRoot&&c.shadowRoot.contains(o))&&c.removeAttribute("disabled")}),this.droppables.forEach(c=>{c.setAttribute("enabled",""),c.hasAttribute("disabled")&&(c.contains(o)||c.shadowRoot&&c.shadowRoot.contains(o))&&c.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragContainers.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")}),this.droppables.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("touchmove",this.handleTouchMove),document.removeEventListener("mousemove",this.handleTouchMove),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("mouseup",this.handleTouchEnd),document.removeEventListener("touchcancel",this.handleTouchCancel)}handleTouchMove(o){if(this.isDraggable&&this.dragClone){let{x:l,y:c}=this.getEventCoordinates(o),d={clientX:l,clientY:c};this.calculateDragDistance(d)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0,this.updateDragClonePosition(d));let f=this.findClosestDropzone();this.currentDropTarget=f,f!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),f&&(this.activateDroppable(f),this.dispatchCustomEvent(f,"dragenter")),this.lastTarget=f),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover"),o.preventDefault()}}handleTouchEnd(o){this.isDragging&&this.resetDragState(),this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(l=>{l.removeAttribute("dragging")}),o.preventDefault()}handleTouchCancel(o){this.resetDragState()}validate(){if(!this.shadowRoot)return!1;let o=this.getValidAssociations(),l=!0,c="";this.maxAssociations>0&&o>this.maxAssociations?(l=!1,c=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&o<this.minAssociations&&(l=!1,c=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let d=this.lastElementChild;return this._internals.setValidity(l?{}:{customError:!0},c,d),l}reportValidity(){let o=this.shadowRoot.querySelector("#validationMessage");return o&&(this._internals.validity.valid?(o.textContent="",o.style.display="none"):(o.textContent=this._internals.validationMessage,o.style.display="block")),this._internals.validity.valid}checkMaxAssociations(o){let l=this.getMatchMaxValue(o),c=o.querySelectorAll('[qti-draggable="true"]').length;return!(l===0)&&c>=l}dropDraggableInDroppable(o,l){let c=o.cloneNode(!0);c.removeAttribute("style"),this.moveDraggableToDroppable(c,l),this.draggablesModified([c],[]);let d=this.getMatchMaxValue(o),f=this.draggables.filter(b=>b.getAttribute("identifier")===o.getAttribute("identifier"));d!==0&&f.length>=d?(o.style.opacity="0.0",o.style.pointerEvents="none"):o.style.opacity="1.0"}resetDragState(){if(this.dragClone){let o=this.currentDropTarget!==null,l=!o||this.dragContainers.includes(this.currentDropTarget);o&&this.currentDropTarget&&!l&&this.dropDraggableInDroppable(this.dragSource,this.currentDropTarget),l&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto",this.saveResponse()),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.deactivateDroppables()}checkAllMaxAssociations(){let o=this.getValidAssociations(),l=this.maxAssociations!==0&&o>=this.maxAssociations;this.droppables.forEach(c=>{l?this.disableDroppable(c):this.checkMaxAssociations(c)?this.disableDroppable(c):this.enableDroppable(c)})}getMatchMaxValue(o){let l=o.getAttribute("match-max");return l?parseInt(l,10):1}disableDroppable(o){o.setAttribute("disabled","")}enableDroppable(o){o.removeAttribute("disabled")}get response(){let o;return typeof this.getResponse=="function"?o=this.getResponse():o=this.collectResponseData(),o.join(",")}set response(o){if(!this.isMatchTabular())if(typeof this.getValue=="function"&&(o=this.getValue(o)),Array.isArray(o)){this.reset(!1),o?.forEach(c=>this.placeResponse(c));let l=new FormData;o.forEach(c=>{l.append(this.responseIdentifier,c)}),this._internals.setFormValue(l)}else this._internals.setFormValue(o||"")}placeResponse(o){let[l,...c]=o.split(" ").reverse(),d=Array.from(this.draggables),f=Array.from(this.droppables);c.forEach(b=>{if(b==="")return;let v=d.find(M=>M.getAttribute("identifier")===b),w=f.find(M=>M.getAttribute("identifier")===l);this.dropDraggableInDroppable(v,w)})}getValidAssociations(){let o=0;for(let l of this.droppables)o=o+this.getDraggablesFromDroppable(l).length;return o}saveResponse(){let o;typeof this.getResponse=="function"?o=this.getResponse():o=this.collectResponseData(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:o}}))}collectResponseData(){return this.droppables.map(l=>{let d=this.getDraggablesFromDroppable(l).map(b=>b.getAttribute("identifier")),f=l.getAttribute("identifier");return d.map(b=>`${b} ${f}`)}).flat()}getDraggablesFromDroppable(o){return this.draggables.map(d=>d.getAttribute("identifier")).filter((d,f,b)=>b.indexOf(d)===f).flatMap(d=>Array.from(o.querySelectorAll(`[identifier='${d}']`))).filter(d=>!!d).map(d=>d)}reset(o=!0){this.droppables.forEach(l=>{this.getDraggablesFromDroppable(l).forEach(d=>{d.remove(),this.draggablesModified([],[d])})}),this.dragContainers.forEach(l=>{Array.from(l.querySelectorAll('[qti-draggable="true"]')).forEach(d=>{d.style.opacity="1.0"})}),this.dragClone=null,this.dragSource=null,this.isDragging=!1,this.isDraggable=!1,this.currentDropTarget=null,this.lastTarget=null,o&&this.saveResponse()}updateDragClonePosition(o){if(!this.isDragging||!this.dragClone)return;let l=o.clientX-this.cloneOffset.x,c=o.clientY-this.cloneOffset.y,{newLeft:d,newTop:f}=this.applyInteractionBoundaries(l,c,this.dragClone);this.dragClone.style.left=`${d}px`,this.dragClone.style.top=`${f}px`}applyInteractionBoundaries(o,l,c){let d=this.getBoundingClientRect(),f=c.getBoundingClientRect(),b=f.width,v=f.height,w=Math.max(d.left,Math.min(o,d.right-b)),M=Math.max(d.top,Math.min(l,d.bottom-v));return{newLeft:w,newTop:M}}getEventCoordinates(o,l=!1){let c=o.touches?o.touches[0]:o;return{x:l?c.pageX:c.clientX,y:l?c.pageY:c.clientY}}calculateDragDistance(o){let l=Math.abs(o.clientX-this.touchStartPoint.x),c=Math.abs(o.clientY-this.touchStartPoint.y);return l+c}findClosestDropzone(){let o=this.allDropzones.filter(f=>!f.hasAttribute("disabled"));if(!this.dragClone||o.length===0)return null;let l=this.dragClone.getBoundingClientRect(),c=null,d=0;for(let f of o){let b=f.getBoundingClientRect(),v=this.calculateOverlapArea(l,b);v>d&&(d=v,c=f)}if(!c){let f=200;for(let b of o){let v=b.getBoundingClientRect(),w=Math.sqrt(Math.pow(l.left-v.left,2)+Math.pow(l.top-v.top,2));w<f&&(f=w,c=b)}}return c}calculateOverlapArea(o,l){let c=Math.max(0,Math.min(o.right,l.right)-Math.max(o.left,l.left)),d=Math.max(0,Math.min(o.bottom,l.bottom)-Math.max(o.top,l.top));return c*d}dispatchCustomEvent(o,l,c=!0){if(!o)return;let d=new CustomEvent(l,{bubbles:c,cancelable:!0});d.dataTransfer=this.dataTransfer,o.dispatchEvent(d)}appendClone(){document.body.appendChild(this.dragClone)}handleTouchStart(o){if(this.isDragging)return;let{x:l,y:c}=this.getEventCoordinates(o);this.touchStartPoint={x:l,y:c},this.dragSource=o.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let d=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),f=this.droppables.some(q=>Array.from(q.children).some(je=>je===this.dragSource)),b=this.dragSource.getBoundingClientRect();f&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=d),this.cloneOffset.x=l-b.left,this.cloneOffset.y=c-b.top,this.dragClone=d.cloneNode(!0);let v=window.getComputedStyle(d);for(let q=0;q<v.length;q++){let je=v[q];this.dragClone.style.setProperty(je,v.getPropertyValue(je))}let w=d.getBoundingClientRect();this.dragClone.style.width=`${w.width}px`,this.dragClone.style.height=`${w.height}px`,b&&this.setDragCloneStyles(b),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone();let M=this.getMatchMaxValue(this.dragSource),ne=this.draggables.filter(q=>q.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));M!==0&&ne.length>=M?(d.style.opacity="0.0",d.style.pointerEvents="none"):d.style.opacity="1.0",o.preventDefault(),this.dragClone.setAttribute("dragging","")}findDraggableInDraggableContainer(o){let l=this.dragContainers.flat();for(let c of l){if(c.getAttribute("identifier")===o)return c;let d;c instanceof HTMLSlotElement?d=Array.from(c?.assignedElements()||[]):d=Array.from(c.querySelectorAll(i));let f=d.find(b=>b.getAttribute("identifier")===o);if(f)return f}}setDragCloneStyles(o){this.dragClone.style.position="fixed",this.dragClone.style.top=`${o.top}px`,this.dragClone.style.left=`${o.left}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return n([u({attribute:!1,type:Object})],r.prototype,"configuration",2),n([u({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),n([u({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),n([Ye(t)],r.prototype,"handleDraggableContainerChange",1),n([Ye(i)],r.prototype,"handleDraggablesChange",1),n([Ye(e)],r.prototype,"handleDroppablesChange",1),r};var jt=g`
71
+ :host {
72
+ display: block; /* necessary to calculate scaling position */
73
+ }
74
+ slot[name='qti-simple-associable-choice'] {
75
+ display: flex;
76
+ align-items: flex-start;
77
+ flex: 1;
78
+ border: 2px solid transparent;
79
+ padding: 0.3rem;
80
+ border-radius: 0.3rem;
81
+ gap: 0.5rem;
82
+ }
83
+
84
+ :host::part(associables-container) {
85
+ display: flex;
86
+ padding: 0.5rem;
87
+ justify-content: space-between;
88
+ background: linear-gradient(
89
+ 180deg,
90
+ rgb(0 0 0 / 0%) calc(50% - 1px),
91
+ var(--qti-border-color-gray) calc(50%),
92
+ rgb(0 0 0 / 0%) calc(50% + 1px)
93
+ );
94
+ }
95
+ `;var fe=class extends N(E,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let t=e.target;this._childrenMap.push(t)}render(){return h` <slot name="prompt"></slot>
96
+ <slot name="qti-simple-associable-choice"></slot>
97
+ <div part="drop-container">
98
+ ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>h`<div part="associables-container">
99
+ <div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
100
+ <div name="right${t}" part="drop-list" class="dl" identifier="droplist${t}_right"></div>
101
+ </div>`)}
102
+
103
+ <div role="alert" id="validationMessage"></div>
104
+ </div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};fe.styles=jt,n([x()],fe.prototype,"_childrenMap",2),fe=n([m("qti-associate-interaction")],fe);var ee=(p,i)=>{class e extends p{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(s,a)=>{this._choiceElements.forEach(o=>o.disabled=a)};this._handleReadonlyChange=(s,a)=>{this._choiceElements.forEach(o=>o.readonly=a)};this.response="";this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}_handleMaxChoicesChange(s,a){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(s){this.maxChoices>1&&(typeof s=="string"||s===null)?this.response=s?s.toString().split(","):[]:this.response=s||""}toggleCorrectResponse(s,a){if(s.correctResponse){let o=Array.isArray(s.correctResponse)?s.correctResponse:[s.correctResponse];this._choiceElements.forEach(l=>{l.internals.states.delete("correct-response"),l.internals.states.delete("incorrect-response"),a&&o.length>0&&(o.includes(l.identifier)?l.internals.states.add("correct-response"):l.internals.states.add("incorrect-response"))})}}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${i}`,this._registerChoiceElement),this.addEventListener(`unregister-${i}`,this._unregisterChoiceElement),this.addEventListener(`activate-${i}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${i}`,this._registerChoiceElement),this.removeEventListener(`unregister-${i}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${i}`,this._choiceElementSelectedHandler)}validate(){let s=this._choiceElements.filter(c=>this._getChoiceChecked(c)),a=s.length,o=!0,l="";return this.maxChoices!==0&&a>this.maxChoices?(o=!1,l=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):a<this.minChoices&&(o=!1,l=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`),s.length>0&&this._internals.setValidity(o?{}:{customError:!0},l,s[a-1]||this._choiceElements[0]||this),o}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.display="block")),this._internals.validity.valid}_registerChoiceElement(s){s.stopPropagation();let a=s.target;a.disabled=this.disabled,this._choiceElements.push(a),this._setInputType(a)}_unregisterChoiceElement(s){s.stopPropagation();let a=s.target;this._choiceElements=this._choiceElements.filter(o=>o!==a)}_determineInputType(){this._choiceElements.forEach(s=>{this._setInputType(s)})}_setInputType(s){this._internals.role=this.maxChoices===1?"radiogroup":null;let a=this.maxChoices===1?"radio":"checkbox";s.internals.role=a,s.internals.states.delete(a==="radio"?"checkbox":"radio"),s.internals.states.add(a)}_choiceElementSelectedHandler(s){this._toggleChoiceChecked(s.target),this.maxChoices===1&&this._choiceElements.forEach(a=>{a.identifier!==s.detail.identifier&&this._setChoiceChecked(a,!1)}),this._handleChoiceSelection()}_setChoiceChecked(s,a){s.internals?.states&&(a?(s.internals.states.add("--checked"),s.internals.ariaChecked="true"):(s.internals.states.delete("--checked"),s.internals.ariaChecked="false"))}_getChoiceChecked(s){return s.internals.states.has("--checked")}_toggleChoiceChecked(s){let a=this._getChoiceChecked(s);this._setChoiceChecked(s,!a)}_handleChoiceSelection(){let a=this._choiceElements.filter(o=>this._getChoiceChecked(o)).map(o=>o.identifier);this.response=this.maxChoices===1?a[0]||"":a,this.validate(),this.saveResponse(this.response)}_updateChoiceSelection(){let s=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(a=>{let o=s.includes(a.identifier);this._setChoiceChecked(a,o)})}}return n([pe("#validationMessage")],e.prototype,"_validationMessageElement",2),n([u({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),n([u({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),n([R("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),n([R("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),n([R("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),n([x()],e.prototype,"response",2),n([R("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",2),e};var Xt=(p,i)=>{class e extends p{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(s){s&&(this._classes=s.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(s){super.updated(s),this._addLabels()}_addLabels(){let s=this._classes.some(o=>this._allLabels.includes(o)||this._allLabelSuffixes.includes(o)),a=o=>!isNaN(+o);if(s){let l=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c).map((c,d)=>({el:c,order:a(c.style.order)?+c.style.order:d+1})).sort((c,d)=>c.order-d.order).map(c=>c.el);for(let c=0;c<l.length;c++)l[c].marker=this._getLabel(c+1)}}_getLabel(s){let a=this._classes.filter(c=>this._allLabels.includes(c)).pop(),o=this._classes.filter(c=>this._allLabelSuffixes.includes(c)).pop();!a&&o&&(a="qti-labels-upper-alpha");let l="";switch(a){case"qti-labels-decimal":l=`${s}`;break;case"qti-labels-lower-alpha":l=`${String.fromCharCode(97+s-1)}`;break;case"qti-labels-upper-alpha":l=`${String.fromCharCode(65+s-1)}`;break}return o==="qti-labels-suffix-period"?l+=".":o==="qti-labels-suffix-parenthesis"&&(l+=")"),l}}return n([u({type:String,reflect:!0})],e.prototype,"class",1),e};var Yt=g`
105
+ :host {
106
+ display: block;
107
+ }
108
+
109
+ [part='slot'] {
110
+ display: grid;
111
+ gap: 10px;
112
+ }
113
+
114
+ /* Define the number of columns dynamically */
115
+ :host([class*='qti-choices-stacking-']) [part='slot'] {
116
+ grid-template-columns: repeat(var(--stacking-count, 1), 1fr);
117
+ }
118
+
119
+ /* Apply dynamic stacking count based on class */
120
+ :host(.qti-choices-stacking-1) {
121
+ --stacking-count: 1;
122
+ }
123
+ :host(.qti-choices-stacking-2) {
124
+ --stacking-count: 2;
125
+ }
126
+ :host(.qti-choices-stacking-3) {
127
+ --stacking-count: 3;
128
+ }
129
+ :host(.qti-choices-stacking-4) {
130
+ --stacking-count: 4;
131
+ }
132
+ :host(.qti-choices-stacking-5) {
133
+ --stacking-count: 5;
134
+ }
135
+ :host(.qti-choices-stacking-6) {
136
+ --stacking-count: 6;
137
+ }
138
+
139
+ /* Default slot item layout */
140
+ ::slotted(qti-simple-choice) {
141
+ display: flex;
142
+ align-items: center;
143
+ white-space: nowrap;
144
+ }
145
+
146
+ /* Orientation styles */
147
+ :host(.qti-orientation-horizontal) [part='slot'] {
148
+ grid-auto-flow: dense column;
149
+ grid-auto-columns: 1fr;
150
+ }
151
+
152
+ :host(.qti-orientation-vertical) [part='slot'] {
153
+ grid-auto-flow: row;
154
+ }
155
+
156
+ /* Vertical and horizontal stacking logic */
157
+ :host(.qti-orientation-vertical[class*='qti-choices-stacking-']) [part='slot'] {
158
+ grid-auto-flow: dense column;
159
+ grid-auto-columns: 1fr;
160
+ grid-template-columns: repeat(var(--stacking-count), 1fr);
161
+ grid-template-rows: repeat(calc(var(--item-count) / var(--stacking-count)), 1fr);
162
+ }
163
+
164
+ :host(.qti-orientation-horizontal[class*='qti-choices-stacking-']) [part='slot'] {
165
+ grid-auto-flow: row;
166
+ grid-template-columns: repeat(var(--stacking-count), 1fr);
167
+ grid-template-rows: unset;
168
+ }
169
+
170
+ /* Ensure even distribution in vertical mode */
171
+ :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
172
+ grid-row: auto;
173
+ }
174
+ `;var ge=class extends Xt(ee(E,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments);this.orientation="vertical"}_handleSlotChange(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return h`
175
+ <slot part="prompt" name="prompt"></slot><slot part="slot" @slotchange=${this._handleSlotChange}></slot>
176
+ <div part="message" role="alert" id="validationMessage"></div>
177
+ `}};ge.styles=Yt,n([u({type:String})],ge.prototype,"orientation",2),ge=n([m("qti-choice-interaction")],ge);var B=class extends E{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:ae(this.baseItemUrl+"/"+this.data);fetch(e).then(t=>t.json()).then(t=>{this.manifest=t,this.setupCES()}).catch(t=>{this._errorMessage=t})}setupCES(){let e=this.shadowRoot.querySelector("#pciContainer"),t=e.contentDocument;window.addEventListener("message",this.handlePostMessage),t.open(),t.write(`
178
+ <html>
179
+ <head>
180
+ <link href='${ae(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
181
+ <script src='${ae(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
182
+ </head>
183
+ <body></body>
184
+ </html>
185
+ `),t.close()}getIFrames(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),r=[...e,...t];for(let s of r){let a=s.src;if(new URL(a,window.location.href).origin===window.location.origin)try{let l=s.contentDocument||s.contentWindow.document;l&&this.getInnerIFrames(l,r)}catch(l){console.error("Error accessing nested iframe:",l)}}return r.forEach((s,a)=>{r.indexOf(s)!==a&&r.splice(a,1)}),r}getInnerIFrames(e,t=[]){return e.querySelectorAll("iframe").forEach(s=>{t.push(s);let a=s.src;if(new URL(a,window.location.href).origin===window.location.origin)try{let l=s.contentDocument||s.contentWindow.document;this.getInnerIFrames(l,t)}catch(l){console.error("Error accessing nested iframe:",l)}else console.warn("Skipped cross-origin iframe:",a)}),t}postToWindowAndIframes(e,t){window.postMessage({type:e,data:t},"*");let r=this.getIFrames();for(let s of r)s.contentWindow&&s.contentWindow.postMessage({type:e,data:t},"*")}handlePostMessage(e){let{type:t,data:r}=e.data;switch(t){case"setResponse":this.rawResponse=r,this.saveResponse(r);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let s=this.manifest.media.map(a=>a.startsWith("http")?a:ae(this.baseRefUrl+"/"+a));this.postToWindowAndIframes("mediaData",s);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}get response(){return this.rawResponse}set response(e){if(typeof e=="string")this.rawResponse=e,this.saveResponse(e);else throw new Error("Value must be a string")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return h`<iframe
186
+ width=${this.getAttribute("width")}
187
+ height=${this.getAttribute("height")}
188
+ frameborder="0"
189
+ title="pciContainer"
190
+ id="pciContainer"
191
+ >
192
+ </iframe>
193
+ ${this._errorMessage&&h`<div style="color:red">
194
+ <h1>Error</h1>
195
+ ${this._errorMessage}
196
+ </div>`}`}};n([u({type:String,attribute:"data"})],B.prototype,"data",2),n([u({type:String,attribute:"data-base-item"})],B.prototype,"baseItemUrl",2),n([u({type:String,attribute:"data-base-ref"})],B.prototype,"baseRefUrl",2),n([u({type:String,attribute:"id"})],B.prototype,"id",2),n([x()],B.prototype,"_errorMessage",2),B=n([m("qti-custom-interaction")],B);var te=class extends y{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};n([u({type:String,attribute:"response-identifier"})],te.prototype,"responseIdentifier",2),n([u({reflect:!0,type:Boolean})],te.prototype,"disabled",2),n([u({type:String,attribute:"count-attempt"})],te.prototype,"countAttempt",2),n([u({type:String})],te.prototype,"title",2),te=n([m("qti-end-attempt-interaction")],te);var Wt=g`
197
+ /* PK: display host as block, else design will be collapsed */
198
+ :host {
199
+ display: block;
200
+ }
201
+ textarea {
202
+ box-sizing: border-box;
203
+ width: 100%;
204
+ height: 100%;
205
+ border: 0;
206
+ }
207
+ `;var A=class extends E{constructor(){super(...arguments);this._rows=5;this.response=null;this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}handleclassNamesChange(e,t){let r=t.split(" "),s=!1;if(r.forEach(a=>{if(a.startsWith("qti-height-lines-")){let o=a.replace("qti-height-lines-","");this._rows=parseInt(o),s=!0}}),!s&&this.expectedLength){let a=Math.ceil(this.expectedLength/50);this._rows=a}}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,r=new RegExp(t);e.checkValidity()&&r.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return!!this.response&&e.checkValidity()}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return h`<slot name="prompt"></slot
208
+ ><textarea
209
+ part="textarea"
210
+ name="${this.responseIdentifier}"
211
+ spellcheck="false"
212
+ autocomplete="off"
213
+ maxlength="${5e3}"
214
+ @keydown="${e=>e.stopImmediatePropagation()}"
215
+ @keyup="${this.textChanged}"
216
+ @change="${this.textChanged}"
217
+ @blur="${e=>{this.reportValidity()}}"
218
+ placeholder="${H(this.placeholderText?this.placeholderText:void 0)}"
219
+ rows="${this._rows}"
220
+ ?disabled="${this.disabled}"
221
+ ?readonly="${this.readonly}"
222
+ .value=${this.response}
223
+ ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};A.styles=Wt,n([x()],A.prototype,"_rows",2),n([u({type:Number,attribute:"expected-length"})],A.prototype,"expectedLength",2),n([u({type:String,attribute:"pattern-mask"})],A.prototype,"patternMask",2),n([u({type:String,attribute:"placeholder-text"})],A.prototype,"placeholderText",2),n([u({type:String,attribute:"data-patternmask-message"})],A.prototype,"dataPatternmaskMessage",2),n([u({type:String,attribute:"class"})],A.prototype,"classNames",2),n([R("classNames")],A.prototype,"handleclassNamesChange",1),n([x()],A.prototype,"response",2),n([R("response",{waitUntilFirstUpdate:!0})],A.prototype,"_handleResponseChange",2),A=n([m("qti-extended-text-interaction")],A);var be=class extends y{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};be.styles=g`
224
+ :host {
225
+ display: flex;
226
+ user-select: none;
227
+ }
228
+ `,n([u({type:Number,reflect:!0})],be.prototype,"tabindex",2),be=n([m("qti-gap-img")],be);var Jt=g`
229
+ :host {
230
+ display: flex;
231
+ align-items: flex-start;
232
+ flex-direction: column;
233
+ flex-wrap: wrap;
234
+ gap: 0.5rem;
235
+ }
236
+
237
+ :host(.qti-choices-top) {
238
+ flex-direction: column;
239
+ }
240
+ :host(.qti-choices-bottom) {
241
+ flex-direction: column-reverse;
242
+ }
243
+ :host(.qti-choices-left) {
244
+ flex-direction: row;
245
+ }
246
+ :host(.qti-choices-right) {
247
+ flex-direction: row-reverse;
248
+ }
249
+ /* [part='drops'] , */
250
+ [name='prompt'] {
251
+ width: 100%;
252
+ }
253
+ [name='drags'] {
254
+ display: flex;
255
+ align-items: flex-start;
256
+ flex: 1;
257
+ border: 2px solid transparent;
258
+ padding: 0.3rem;
259
+ border-radius: 0.3rem;
260
+ gap: 0.5rem;
261
+ }
262
+ `;var Se=class extends N(E,"qti-gap-text","qti-gap","slot[part='drags']"){render(){return h`<slot name="prompt"> </slot>
263
+ <slot part="drags" name="drags"></slot>
264
+ <slot part="drops"></slot>
265
+ <div role="alert" id="validationMessage"></div>`}toggleCorrectResponse(i,e){if(e&&i.correctResponse){let t=[],r=Array.isArray(i.correctResponse)?i.correctResponse:[i.correctResponse];r&&(t=r.map(a=>{let o=a.split(" ");return{text:o[0],gap:o[1]}})),this.querySelectorAll("qti-gap").forEach(a=>{let o=a.getAttribute("identifier"),l=t.find(d=>d.gap===o)?.text,c=this.querySelector(`qti-gap-text[identifier="${l}"]`)?.textContent.trim();if(l&&c){if(!a.nextElementSibling?.classList.contains("correct-option")){let d=document.createElement("span");d.classList.add("correct-option"),d.textContent=c,d.style.border="1px solid var(--qti-correct)",d.style.borderRadius="4px",d.style.padding="2px 4px",d.style.display="inline-block",a.insertAdjacentElement("afterend",d)}}else a.nextElementSibling?.classList.contains("correct-option")&&a.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(r=>{r.remove()})}};Se.styles=Jt,Se=n([m("qti-gap-match-interaction")],Se);var Gt={toAttribute:p=>p?"true":"false",fromAttribute:p=>p==="true"};function O(p,i){class e extends p{constructor(...s){super(...s);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(s,a){this.tabIndex=a?-1:0,a&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${i}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${i}`,{bubbles:!0,composed:!0}))}_onKeyUp(s){s.altKey||s.code==="Space"&&(s.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${i}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return h`<slot></slot>`}}return n([u({type:String})],e.prototype,"identifier",2),n([u({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),n([u({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Gt})],e.prototype,"disabled",2),n([u({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Gt})],e.prototype,"readonly",2),n([R("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var ve=class extends O(y,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return h`<slot></slot>`}};ve.styles=g`
266
+ :host {
267
+ display: inline-flex;
268
+ user-select: none;
269
+ }
270
+ `,n([u({type:Number,reflect:!0})],ve.prototype,"tabindex",2),ve=n([m("qti-gap-text")],ve);var ye=class extends y{constructor(){super(...arguments);this.tabindex=0}render(){return h` <slot name="drags"></slot>`}};ye.styles=g`
271
+ :host {
272
+ display: flex;
273
+ user-select: none;
274
+ }
275
+ `,n([u({type:Number,reflect:!0})],ye.prototype,"tabindex",2),ye=n([m("qti-gap")],ye);var Kt=(p,i,e)=>{let t=new Map;for(let r=i;r<=e;r++)t.set(p[r],r);return t},xe=Z(class extends ue{constructor(p){if(super(p),p.type!==de.CHILD)throw Error("repeat() can only be used in text expressions")}dt(p,i,e){let t;e===void 0?e=i:i!==void 0&&(t=i);let r=[],s=[],a=0;for(let o of p)r[a]=t?t(o,a):a,s[a]=e(o,a),a++;return{values:s,keys:r}}render(p,i,e){return this.dt(p,i,e).values}update(p,[i,e,t]){let r=Ft(p),{values:s,keys:a}=this.dt(i,e,t);if(!Array.isArray(r))return this.ut=a,s;let o=this.ut??(this.ut=[]),l=[],c,d,f=0,b=r.length-1,v=0,w=s.length-1;for(;f<=b&&v<=w;)if(r[f]===null)f++;else if(r[b]===null)b--;else if(o[f]===a[v])l[v]=Q(r[f],s[v]),f++,v++;else if(o[b]===a[w])l[w]=Q(r[b],s[w]),b--,w--;else if(o[f]===a[w])l[w]=Q(r[f],s[w]),he(p,l[w+1],r[f]),f++,w--;else if(o[b]===a[v])l[v]=Q(r[b],s[v]),he(p,r[f],r[b]),b--,v++;else if(c===void 0&&(c=Kt(a,v,w),d=Kt(o,f,b)),c.has(o[f]))if(c.has(o[b])){let M=d.get(a[v]),ne=M!==void 0?r[M]:null;if(ne===null){let q=he(p,r[f]);Q(q,s[v]),l[v]=q}else l[v]=Q(ne,s[v]),he(p,r[f],ne),r[M]=null;v++}else We(r[b]),b--;else We(r[f]),f++;for(;v<=w;){let M=he(p,l[w+1]);Q(M,s[v]),l[v++]=M}for(;f<=b;){let M=r[f++];M!==null&&We(M)}return this.ut=a,zt(p,l),ce}});function re(p,i,e,t){let r=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,s=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(p){case"circle":{if(i.length!==3){console.error("Invalid cirlce coordinates:",i);return}let[a,o,l]=i,c=a/r*100,d=o/s*100,f=l/r*100;t.style.left=c-f+"%",t.style.top=d-f+"%";let b=l/r*100,v=l/s*100;t.style.width=2*b+"%",t.style.height=2*v+"%",t.style.borderRadius="50%"}break;case"rect":{if(i.length!==4){console.error("Invalid rectangle coordinates:",i);return}let[a,o,l,c]=i,d=a/r*100,f=o/s*100,b=l/r*100,v=c/s*100;t.style.left=d+"%",t.style.top=f+"%",t.style.width=b-d+"%",t.style.height=v-f+"%"}break;case"ellipse":{if(i.length!==4){console.error("Invalid ellipse coordinates:",i);return}let[a,o,l,c]=i,d=a/r*100,f=o/s*100,b=l/r*100,v=c/s*100;t.style.left=d-b+"%",t.style.top=f-v+"%",t.style.width=2*b+"%",t.style.height=2*v+"%",t.style.borderRadius="50%"}break;case"poly":{if(i.length<6||i.length%2!==0){console.error("Invalid polygon coordinates:",i);return}let a=[];for(let q=0;q<i.length;q+=2)a.push({x:i[q],y:i[q+1]});let o=Math.min(...a.map(q=>q.x)),l=Math.max(...a.map(q=>q.x)),c=Math.min(...a.map(q=>q.y)),d=Math.max(...a.map(q=>q.y)),f=o/r*100,b=c/s*100,v=l/r*100,w=d/s*100;t.style.left=f+"%",t.style.top=b+"%",t.style.width=v-f+"%",t.style.height=w-b+"%";let ne=a.map(q=>({x:(q.x-o)/(l-o)*100,y:(q.y-c)/(d-c)*100})).map(q=>`${q.x}% ${q.y}%`).join(",");t.style.clipPath=`polygon(${ne})`}break;default:console.error(`Unsupported shape: ${p}`);break}}var Zt=g`
276
+ slot:not([name='prompt']) {
277
+ // position: relative; /* qti-hotspot-choice relative to the slot */
278
+ display: block;
279
+ width: fit-content; /* hotspots not stretching further if image is at max size */
280
+ }
281
+ ::slotted(img) {
282
+ /* image not selectable anymore */
283
+ pointer-events: none;
284
+ user-select: none;
285
+ }
286
+ ::slotted(qti-associable-hotspot) {
287
+ transform: translate(-50%, -50%);
288
+ }
289
+ line-container {
290
+ display: block;
291
+ position: relative;
292
+ width: fit-content;
293
+ }
294
+ svg {
295
+ position: absolute;
296
+ top: 0px;
297
+ left: 0px;
298
+ }
299
+ `;var P=class extends E{constructor(){super();this.startPoint=null;this.endPoint=null;this._correctLines=[];this._response=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._response=[],this._correctLines=[]}validate(){return this.response.length>0}set response(e){this._response=e}get response(){return this._response}toggleCorrectResponse(e,t){if(!t){this._correctLines=[];return}if(!e.correctResponse){console.error("No correct response found for this interaction.");return}let r=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];this._correctLines=r}render(){return h`<slot name="prompt"></slot>
300
+ <line-container>
301
+ <svg
302
+ width=${H(this.grImage[0]?.width)}
303
+ height=${H(this.grImage[0]?.height)}
304
+ viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
305
+ >
306
+ ${xe(this.response,e=>e,(e,t)=>Xe`
307
+ <line
308
+ part="line"
309
+ x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
310
+ y1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.top)}
311
+ x2=${parseInt(this.querySelector(`[identifier=${e.split(" ")[1]}]`).style.left)}
312
+ y2=${parseInt(this.querySelector(`[identifier=${e.split(" ")[1]}]`).style.top)}
313
+ stroke="red"
314
+ stroke-width="3"
315
+ @click=${r=>{r.stopPropagation(),this._response=this._response.filter((s,a)=>a!==t),this.saveResponse(this.response)}}
316
+ />
317
+ `)}
318
+ ${xe(this._correctLines,e=>e,(e,t)=>Xe`
319
+ <line
320
+ part="correct-line"
321
+ x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
322
+ y1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.top)}
323
+ x2=${parseInt(this.querySelector(`[identifier=${e.split(" ")[1]}]`).style.left)}
324
+ y2=${parseInt(this.querySelector(`[identifier=${e.split(" ")[1]}]`).style.top)}
325
+ stroke="var(--qti-correct)"
326
+ stroke-width="3"
327
+ stroke-dasharray="5,5"
328
+ />
329
+ `)}
330
+ ${this.startPoint&&Xe`<line
331
+ part="point"
332
+ x1=${this.startCoord.x}
333
+ y1=${this.startCoord.y}
334
+ x2=${this.mouseCoord.x}
335
+ y2=${this.mouseCoord.y}
336
+ stroke="var(--qti-border-active)"
337
+ stroke-width="3"
338
+ />`}
339
+ </svg>
340
+ <slot></slot>
341
+ </line-container>
342
+ <div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,s=r.getAttribute("coords"),a=r.getAttribute("shape"),o=s.split(",").map(l=>parseInt(l));re(a,o,t,r)}firstUpdated(){this.hotspots=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let r=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-r.left,y:e.clientY-r.top}}),this.hotspots.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.startPoint?this.endPoint||(this.endPoint=t.target,this._response=[...this.response,`${this.startPoint.getAttribute("identifier")} ${this.endPoint.getAttribute("identifier")}`],this.saveResponse(this.response),this.startPoint=null,this.endPoint=null):(this.startPoint=t.target,this.startCoord={x:parseInt(this.startPoint.getAttribute("coords").split(",")[0]),y:parseInt(this.startPoint.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};P.styles=Zt,n([x()],P.prototype,"_correctLines",2),n([x()],P.prototype,"startCoord",2),n([x()],P.prototype,"mouseCoord",2),n([Nt({selector:"img"})],P.prototype,"grImage",2),n([x()],P.prototype,"_response",2),P=n([m("qti-graphic-associate-interaction")],P);var Qt=g`
343
+ :host {
344
+ display: flex;
345
+ align-items: flex-start;
346
+ flex-direction: column;
347
+ flex-wrap: wrap;
348
+ gap: 0.5rem;
349
+ }
350
+
351
+ :host(.qti-choices-top) {
352
+ flex-direction: column-reverse;
353
+ }
354
+ :host(.qti-choices-bottom) {
355
+ flex-direction: column;
356
+ }
357
+ :host(.qti-choices-left) {
358
+ flex-direction: row-reverse;
359
+ & [name='drags'] {
360
+ width: 25%;
361
+ }
362
+ & [part='image'] {
363
+ width: 75%;
364
+ }
365
+ }
366
+ :host(.qti-choices-right) {
367
+ flex-direction: row;
368
+ & [name='drags'] {
369
+ width: 25%;
370
+ }
371
+ & [part='image'] {
372
+ width: 75%;
373
+ }
374
+ }
375
+ [part='image'] {
376
+ display: block;
377
+ position: relative;
378
+ }
379
+ /* [part='drops'] , */
380
+
381
+ [name='drags'] {
382
+ display: flex;
383
+ align-items: flex-start;
384
+ flex-wrap: wrap;
385
+ flex: 1;
386
+ border: 2px solid transparent;
387
+ padding: 0.3rem;
388
+ border-radius: 0.3rem;
389
+ gap: 0.5rem;
390
+ }
391
+ ::slotted(img) {
392
+ display: inline-block;
393
+ user-select: none;
394
+ pointer-events: none;
395
+ }
396
+ `;var _e=class extends N(E,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){render(){return h` <slot name="prompt"></slot>
397
+ <slot part="image"></slot>
398
+ <slot part="drags" name="drags" class="hover-border"></slot>
399
+ <div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(i){let e=i.target,t=e.getAttribute("coords"),r=e.getAttribute("shape"),s=t.split(",").map(a=>parseInt(a));switch(r){case"circle":{let[a,o,l]=s;e.style.left=a-l+"px",e.style.top=o-l+"px",e.style.width=e.style.height=2*l+"px"}break;case"rect":{let[a,o,l,c]=s;e.style.left=a+"px",e.style.top=o+"px",e.style.width=l-a+"px",e.style.height=c-o+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};_e.styles=Qt,_e=n([m("qti-graphic-gap-match-interaction")],_e);var er=g`
400
+ slot:not([name='prompt']) {
401
+ position: relative; /* qti-hotspot-choice relative to the slot */
402
+ display: block;
403
+ width: fit-content; /* hotspots not stretching further if image is at max size */
404
+ }
405
+ ::slotted(img) {
406
+ /* image not selectable anymore */
407
+ pointer-events: none;
408
+ user-select: none;
409
+ }
410
+ `;var ke=class extends ee(E,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return h`
411
+ <slot name="prompt"></slot>
412
+ <slot></slot>
413
+ <div role="alert" id="validationMessage"></div>
414
+ `}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(a=>a.getAttribute("identifier")===t);if(!r)return;let s=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){let a=this._choiceElements.filter(o=>o.order!=null).length;if(a>=s){this.choiceOrdering=!1;return}r.order=a+1}else{let a=r.order;r.order=null,this._choiceElements.forEach(o=>{o.order!=null&&o.order>a&&o.order--})}this.choiceOrdering=!1}}toggleCorrectResponse(e,t){let r=this._choiceElements;for(let s of r)if(t&&e.correctResponse?.length>0&&Array.isArray(e.correctResponse)){let a=e.correctResponse.findIndex(o=>o===s.identifier);a>=0?s.orderCorrect=a+1:s.orderCorrect=null}else s.orderCorrect=null}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,s=r.getAttribute("coords"),a=r.getAttribute("shape"),o=s.split(",").map(l=>parseInt(l));re(a,o,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};ke.styles=er,ke=n([m("qti-graphic-order-interaction")],ke);var le=class extends O(y,"qti-hotspot-choice"){};le.styles=g`
415
+ :host {
416
+ display: flex;
417
+ user-select: none;
418
+ position: absolute;
419
+ }
420
+ `,n([u({attribute:"aria-ordervalue",type:Number,reflect:!0})],le.prototype,"order",2),n([u({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],le.prototype,"orderCorrect",2),le=n([m("qti-hotspot-choice")],le);var tr=g`
421
+ slot:not([name='prompt']) {
422
+ position: relative; /* qti-hotspot-choice relative to the slot */
423
+ display: block;
424
+ width: fit-content; /* hotspots not stretching further if image is at max size */
425
+ }
426
+ ::slotted(img) {
427
+ /* image not selectable anymore */
428
+ pointer-events: none;
429
+ user-select: none;
430
+ /* width:100%; */
431
+ }
432
+ `;var Ae=class extends ee(E,"qti-hotspot-choice"){render(){return h`
433
+ <slot name="prompt"></slot>
434
+ <slot></slot>
435
+ `}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),s=t.getAttribute("shape"),a=r.split(",").map(o=>parseInt(o));re(s,a,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};Ae.styles=tr,Ae=n([m("qti-hotspot-interaction")],Ae);var Ge=class extends ee(E,"qti-hottext"){constructor(){super(...arguments);this.render=()=>h`<slot></slot>`}};Ge=n([m("qti-hottext-interaction")],Ge);var Le=class extends O(y,"qti-hottext"){render(){return h`<div part="ch"><div part="cha"></div></div>
436
+ <slot></slot> `}};Le.styles=g`
437
+ :host {
438
+ display: flex;
439
+ user-select: none;
440
+ }
441
+ `,Le=n([m("qti-hottext")],Le);var Ve=class extends ue{constructor(i){if(super(i),this.it=_,i.type!==de.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===_||i==null)return this._t=void 0,this.it=i;if(i===ce)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this._t;this.it=i;let e=[i];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ve.directiveName="unsafeHTML",Ve.resultType=1;var Ee=Z(Ve);var ie=class extends E{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[g`
442
+ :host {
443
+ display: inline-block;
444
+ }
445
+ slot {
446
+ display: flex;
447
+ flex-direction: column;
448
+ }
449
+ [role='menu'] {
450
+ position: absolute;
451
+ z-index: 1000;
452
+ }
453
+ .anchor {
454
+ /* anchor-name: --infobox; */
455
+ width: fit-content;
456
+ }
457
+
458
+ .positionedElement {
459
+ position: absolute;
460
+ /* position-anchor: --infobox; */
461
+ /* top: anchor(bottom); */
462
+ }
463
+ `]}render(){return h`
464
+ <select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
465
+ ${this.options.map(e=>h`
466
+ <option value="${e.value}" ?selected="${e.selected}">${Ee(e.textContent)}</option>
467
+ `)}
468
+ </select>
469
+
470
+ ${Ee(this.correctOption)}
471
+ `}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set response(e){this.options=this.options.map(t=>(e&&e===t.value&&(t.selected=!0),t))}get response(){return this.options.find(e=>e.selected)?.value||null}toggleCorrectResponse(e,t){if(this.correctResponse=t&&e.correctResponse?.toString(),!this.correctResponse){this.correctOption="";return}this.correctOption=`<span part="correct-option" style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block">${this.options.find(r=>this.correctResponse===r.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>({...r,selected:r.value===t})),this.saveResponse(t)}};ie.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],n([x()],ie.prototype,"options",2),n([x()],ie.prototype,"correctOption",2),n([u({attribute:"data-prompt",type:String})],ie.prototype,"dataPrompt",2),ie=n([m("qti-inline-choice-interaction")],ie);var De=class extends y{static get styles(){return[g`
472
+ :host {
473
+ display: block;
474
+ cursor: pointer;
475
+ }
476
+ `]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return h` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};n([u({type:String})],De.prototype,"identifier",2),De=n([m("qti-inline-choice")],De);var se=class extends O(y,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return h`
477
+ <slot part="slot"></slot>
478
+ <slot part="dropslot" name="qti-simple-associable-choice"></slot>
479
+ `}};se.styles=g`
480
+ :host {
481
+ display: flex;
482
+ user-select: none;
483
+ }
484
+ slot {
485
+ width: 100%;
486
+ display: block;
487
+ }
488
+ slot[name='qti-simple-associable-choice'] {
489
+ /* width: 100%; */
490
+ }
491
+ `,n([u({type:Number,attribute:"match-min"})],se.prototype,"matchMin",2),n([u({type:Number,attribute:"match-max"})],se.prototype,"matchMax",2),n([u({type:String,attribute:"fixed",converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],se.prototype,"fixed",2),se=n([m("qti-simple-associable-choice")],se);var rr=g`
492
+ slot:not([hidden]) {
493
+ /* slot where the */
494
+ display: flex;
495
+ flex-direction: column;
496
+ gap: 0.5rem;
497
+ align-items: flex-start; /* prevents the drag and drop container slots having the same height */
498
+ }
499
+ :host(.qti-choices-top) slot {
500
+ flex-direction: column;
501
+ }
502
+ :host(.qti-choices-bottom) slot {
503
+ flex-direction: column-reverse;
504
+ }
505
+ :host(.qti-choices-left) slot {
506
+ flex-direction: row;
507
+ }
508
+ :host(.qti-choices-right) slot {
509
+ flex-direction: row-reverse;
510
+ }
511
+ slot[name='prompt'] {
512
+ display: block;
513
+ }
514
+ ::slotted(qti-simple-match-set) {
515
+ /* Make sure the drag and drop container slots have the same width */
516
+ flex: 1;
517
+ }
518
+ `;var j=class extends N(E,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=[];this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,r=t.value,s=t.name,a=t.type;t.checked?(this.response?this.response.indexOf(r)===-1&&(a==="radio"&&(this.response=this.response.filter(o=>o.indexOf(s)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=t):(this.response=this.response.filter(o=>o!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}async connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.rows.length:super.validate()}toggleCorrectResponse(e,t){if(t&&e.correctResponse){let s=(Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse]).map(a=>{let[o,l]=a.split(" ");return{text:o,gap:l}});this.querySelectorAll(".correct-option").forEach(a=>a.remove()),this.cols.forEach(a=>{let o=a.getAttribute("identifier"),l=s.find(c=>c.gap===o);if(l?.text){let d=this.querySelector(`qti-simple-associable-choice[identifier="${l.text}"]`)?.textContent?.trim();if(d&&!a.previousElementSibling?.classList.contains("correct-option")){let f=document.createElement("span");f.classList.add("correct-option"),f.textContent=d,f.style.border="1px solid var(--qti-correct)",f.style.borderRadius="4px",f.style.padding="2px 4px",f.style.display="inline-block",a.insertAdjacentElement("beforebegin",f)}}})}else this.querySelectorAll(".correct-option").forEach(r=>r.remove())}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e,this.class.split(" ").includes("qti-match-tabular")||(this.response=e))}render(){let e=this.class.split(" ").includes("qti-match-tabular");return h`
519
+ <slot name="prompt"></slot>
520
+ <slot ?hidden=${e}></slot>
521
+
522
+ ${e?h`
523
+ <table>
524
+ <tr>
525
+ <td></td>
526
+ ${this.cols.map(t=>h`<th part="r-header">${Ee(t.innerHTML)}</th>`)}
527
+ </tr>
528
+
529
+ ${this.rows.map(t=>h`<tr>
530
+ <td part="c-header">${Ee(t.innerHTML)}</td>
531
+ ${this.cols.map(r=>{let s=t.getAttribute("identifier"),a=r.getAttribute("identifier"),o=`${s} ${a}`,l=this.response.filter(b=>b.split(" ")[0]===s).length||0,c=this.response.includes(o),d=`rb ${c?"rb-checked":""} ${this.correctOptions.includes(o)?"rb-correct":""}`,f=this.correctOptions.length>0?!0:t.matchMax===1?!1:t.matchMax!==0&&l>=t.matchMax&&!c;return h`<td>
532
+ <input
533
+ type=${t.matchMax===1?"radio":"checkbox"}
534
+ part=${d}
535
+ name=${s}
536
+ value=${o}
537
+ .disabled=${f}
538
+ @change=${b=>this.handleRadioChange(b)}
539
+ @click=${b=>t.matchMax===1?this.handleRadioClick(b):null}
540
+ />
541
+ </td>`})}
542
+ </tr>`)}
543
+ </table>
544
+ `:_}
545
+
546
+ <div role="alert" id="validationMessage"></div>
547
+ `}};j.styles=rr,n([u({type:String})],j.prototype,"class",2),n([x()],j.prototype,"_response",2),n([u({type:String,attribute:"response-identifier"})],j.prototype,"responseIdentifier",2),n([x()],j.prototype,"correctOptions",2),j=n([m("qti-match-interaction")],j);var Ie=class extends E{constructor(){super();this._value=null}reset(){}validate(){return!0}get response(){return this._value?this._value.toString():null}set response(e){if(e)if(!isNaN(parseInt(e?.toString())))this._value=parseInt(e.toString());else throw new Error(`Value must be a number ${e}`)}static get properties(){return{...E.properties,step:{type:Number,attribute:"step",default:10}}}render(){return h` <slot name="prompt"></slot>
548
+ <slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};Ie.styles=[g``],Ie=n([m("qti-media-interaction")],Ie);var ir=g`
549
+ [part='drags'] {
550
+ display: flex;
551
+ align-items: flex-start;
552
+ flex: 1;
553
+ flex-wrap: wrap;
554
+ }
555
+
556
+ [part='drops'] {
557
+ flex: 1;
558
+ display: grid;
559
+ grid-auto-flow: column;
560
+ grid-auto-columns: 1fr;
561
+ }
562
+
563
+ :host([orientation='horizontal']) [part='drags'] {
564
+ flex-direction: row;
565
+ }
566
+ :host([orientation='horizontal']) [part='drops'] {
567
+ grid-auto-flow: column;
568
+ }
569
+ :host([orientation='vertical']) [part='drags'] {
570
+ flex-direction: column;
571
+ }
572
+ :host([orientation='vertical']) [part='drops'] {
573
+ grid-auto-flow: row;
574
+ }
575
+
576
+ [part='drop-list'] {
577
+ display: block;
578
+ flex: 1;
579
+ }
580
+
581
+ [part='container'] {
582
+ display: flex;
583
+ gap: 0.5rem;
584
+ }
585
+ :host(.qti-choices-top) [part='container'] {
586
+ flex-direction: column;
587
+ }
588
+ :host(.qti-choices-bottom) [part='container'] {
589
+ flex-direction: column-reverse;
590
+ }
591
+ :host(.qti-choices-left) [part='container'] {
592
+ flex-direction: row;
593
+ }
594
+ :host(.qti-choices-right) [part='container'] {
595
+ flex-direction: row-reverse;
596
+ }
597
+ `;var X=class extends N(E,"qti-simple-choice","drop-list","slot[part='drags']"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
598
+ <div part="container">
599
+ <slot part="drags"> </slot>
600
+ <div part="drops">
601
+ ${[...Array(this.nrChoices)].map((t,r)=>h`<drop-list role="region" part="drop-list" identifier="droplist${r}"></drop-list>`)}
602
+ </div>
603
+ </div>`}toggleCorrectResponse(e,t){if(this.shadowRoot.querySelectorAll(".correct-option").forEach(r=>r.remove()),t&&e.correctResponse){let s=(Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse]).map(l=>l.split(" ")[0]),a=new Set;this.querySelectorAll("qti-simple-choice").forEach((l,c)=>{let d=l.getAttribute("identifier");if(!d||!s.includes(d)||a.has(d))return;a.add(d);let f=l.textContent?.trim();if(!f)return;let b=this.shadowRoot.querySelector(`drop-list[identifier="droplist${c}"]`);if(!b)return;let v=document.createElement("span");v.classList.add("correct-option"),v.textContent=f,v.style.border="1px solid var(--qti-correct)",v.style.borderRadius="4px",v.style.padding="2px 4px",v.style.display="inline-block",v.style.marginTop="4px",b.insertAdjacentElement("afterend",v)})}}getValue(e){return e?.map((t,r)=>`${t} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(r=>{let s=r.querySelectorAll('[qti-draggable="true"]');return[...Array.from(s).map(o=>o.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};X.styles=ir,n([x()],X.prototype,"nrChoices",2),n([x()],X.prototype,"correctResponses",2),n([x()],X.prototype,"showCorrectResponses",2),n([u({type:String})],X.prototype,"orientation",2),X=n([m("qti-order-interaction")],X);var sr=g`
604
+ ::slotted(qti-interaction-markup) {
605
+ display: none;
606
+ }
607
+ `;var I=class extends E{constructor(){super(...arguments);this._iframeLoaded=!1;this._pendingMessages=[];this._errorMessage=null;this.response=[];this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe"))switch(t.method){case"iframeReady":this.initializeInteraction(),this.processPendingMessages(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"interactionChanged":{let r=this.convertQtiVariableJSON(t.params.value);console.log("Interaction changed:",r),this.response=r,this.validate(),this.saveResponse(this.response);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}}}convertQtiVariableJSON(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s)){let a=r[s];if(Array.isArray(a))return a.map(String);if(a!=null)return String(a)}}}return null}responseVariablesToQtiVariableJSON(e,t,r){if(t!=="single"){let s={list:{}};return s.list[r]=e,s}else{let s={base:{}};return s.base[r]=e,s}}validate(){return!0}set value(e){this._value=e;let t=this.context?.variables?.find(s=>s.identifier===this.responseIdentifier)?.cardinality||"single",r=this.context?.variables?.find(s=>s.identifier===this.responseIdentifier)?.baseType||"string";this.sendMessageToIframe("setValue",this.responseVariablesToQtiVariableJSON(this._value,t,r))}get value(){return this._value?.toString()||null}sendMessageToIframe(e,t){if(!this._iframeLoaded){this._pendingMessages.push({method:e,params:t});return}this.iframe.contentWindow.postMessage({source:"qti-portable-custom-interaction",method:e,params:t},"*")}processPendingMessages(){this._pendingMessages.length&&(this._pendingMessages.forEach(e=>{this.sendMessageToIframe(e.method,e.params)}),this._pendingMessages=[])}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}createIframe(){this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.addMarkupToIframe(),this.sendIframeInitData()};let e=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=e;let t=this.generateIframeContent(),r=encodeURIComponent(t);this.iframe.src=`data:text/html;charset=utf-8,${r}`,this.appendChild(this.iframe)}sendIframeInitData(){let e=this.responseVariablesToQtiVariableJSON(this._value,this.context?.variables?.find(s=>s.identifier===this.responseIdentifier)?.cardinality||"single",this.context?.variables?.find(s=>s.identifier===this.responseIdentifier)?.baseType||"string"),t={};t[this.responseIdentifier]=e;let r={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:ae(`${window.location.origin}${this.baseUrl}`),responseIdentifier:this.responseIdentifier,dataAttributes:{...this.dataset},interactionModules:this.getInteractionModules(),boundTo:t};this.sendMessageToIframe("initialize",r)}getInteractionModules(){let e=[],t=this.querySelector("qti-interaction-modules");if(t){let r=t.querySelectorAll("qti-interaction-module");for(let s of r)e.push({id:s.getAttribute("id"),primaryPath:s.getAttribute("primary-path"),fallbackPath:s.getAttribute("fallback-path")})}return e}addMarkupToIframe(){let e=this.querySelector("qti-interaction-markup");e&&this.sendMessageToIframe("setMarkup",e.innerHTML);let t=this.querySelector("properties");t&&this.sendMessageToIframe("setProperties",t.innerHTML)}initializeInteraction(){if(this._value){let e=this.context?.variables?.find(s=>s.identifier===this.responseIdentifier)?.cardinality||"single",t=this.context?.variables?.find(s=>s.identifier===this.responseIdentifier)?.baseType||"string",r=this.responseVariablesToQtiVariableJSON(this._value,e,t);this.sendMessageToIframe("setValue",r)}}generateIframeContent(){let e=window.getComputedStyle(document.body),t=`
608
+ font-family: ${e.getPropertyValue("font-family")};
609
+ font-size: ${e.getPropertyValue("font-size")};
610
+ line-height: ${e.getPropertyValue("line-height")};
611
+ font-weight: ${e.getPropertyValue("font-weight")};
612
+ color: ${e.getPropertyValue("color")};
613
+ `;return`<!DOCTYPE html>
614
+ <html lang="en">
615
+ <head>
616
+ <meta charset="utf-8" />
617
+ <title>QTI PCI Container</title>
618
+ <base href="${window.location.origin}" />
619
+ <style>
620
+ body, html {
621
+ margin: 0;
622
+ padding: 0;
623
+ width: 100%;
624
+ height: auto;
625
+ overflow: hidden;
626
+ /* Add the extracted font styles here */
627
+ ${t}
628
+ }
629
+ .qti-customInteraction {
630
+ width: 100%;
631
+ height: 100%;
632
+ }
633
+ #pci-container {
634
+ width: 100%;
635
+ height: 100%;
636
+ }
637
+ </style>
638
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
639
+ <script>
640
+ // Define standard paths and shims
641
+ window.requirePaths = {
642
+ 'taoQtiItem/portableLib/OAT/util/event': '/assets/pci-scripts/portableLib/OAT/util/event',
643
+ 'taoQtiItem/portableLib/OAT/util/html': '/assets/pci-scripts/portableLib/OAT/util/html',
644
+ 'taoQtiItem/portableLib/OAT/util/EventMgr': '/assets/pci-scripts/portableLib/OAT/util/EventMgr',
645
+ 'taoQtiItem/portableLib/OAT/util/math': '/assets/pci-scripts/portableLib/OAT/util/math',
646
+ 'taoQtiItem/portableLib/OAT/util/xml': '/assets/pci-scripts/portableLib/OAT/util/xml',
647
+ 'taoQtiItem/portableLib/OAT/util/tooltip': '/assets/pci-scripts/portableLib/OAT/util/tooltip',
648
+ 'taoQtiItem/portableLib/jquery_2_1_1': '/assets/pci-scripts/portableLib/jquery_2_1_1',
649
+ 'taoQtiItem/pci-scripts/portableLib/jquery.qtip': '/assets/portableLib/jquery.qtip',
650
+ 'taoQtiItem/pci-scripts/portableLib/lodash': '/assets/pci-scripts/portableLib/lodash',
651
+ 'taoQtiItem/pci-scripts/portableLib/raphael': '/assets/pci-scripts/portableLib/raphael',
652
+ 'IMSGlobal/jquery_2_1_1': '/assets/pci-scripts/IMSGlobal/jquery_2_1_1',
653
+ 'OAT/util/event': '/assets/pci-scripts/legacyPortableSharedLib/OAT/util/event',
654
+ 'OAT/util/html': '/assets/pci-scripts/legacyPortableSharedLib/OAT/util/html',
655
+ 'OAT/util/EventMgr': '/assets/pci-scripts/legacyPortableSharedLib/OAT/util/EventMgr',
656
+ 'OAT/util/math': '/assets/pci-scripts/legacyPortableSharedLib/OAT/util/math',
657
+ 'OAT/util/xml': '/assets/pci-scripts/legacyPortableSharedLib/OAT/util/xml',
658
+ 'OAT/util/tooltip': '/assets/pci-scripts/legacyPortableSharedLib/OAT/util/tooltip',
659
+ 'OAT/lodash': '/assets/pci-scripts/legacyPortableSharedLib/lodash',
660
+ 'mathJax': '/assets/pci-scripts/mathjax/mathJax',
661
+ 'css': '/assets/pci-scripts/css/css'
662
+ };
663
+
664
+ window.requireShim = {
665
+ mathJax: {
666
+ exports: 'MathJax',
667
+ init: function () {
668
+ if (window.MathJax) {
669
+ window.MathJax.Hub.Config({
670
+ showMathMenu: false,
671
+ showMathMenuMSIE: false,
672
+ menuSettings: { inTabOrder: false },
673
+ });
674
+ window.MathJax.Hub.Startup.MenuZoom = function () { /* nothing */ };
675
+ window.MathJax.Hub.Startup.onload();
676
+ return window.MathJax;
677
+ }
678
+ },
679
+ },
680
+ };
681
+
682
+ // Single initial RequireJS configuration with error handling
683
+ window.requirejs.config({
684
+ catchError: true,
685
+ waitSeconds: 30,
686
+ paths: window.requirePaths,
687
+ shim: window.requireShim,
688
+ onNodeCreated: function(node, config, moduleName, url) {
689
+ console.log('RequireJS creating node for module:', moduleName, 'URL:', url);
690
+
691
+ // Add error handler to script node
692
+ node.addEventListener('error', function(evt) {
693
+ console.error('Script load error for module:', moduleName, 'URL:', url, 'Event:', evt);
694
+ });
695
+ },
696
+ onError: function(err) {
697
+ console.error('RequireJS error:', {
698
+ type: err.requireType,
699
+ modules: err.requireModules,
700
+ error: err
701
+ });
702
+
703
+ if (err.requireType === 'scripterror') {
704
+ console.error('Script error usually indicates a network or CORS issue with:', err.requireModules);
705
+ }
706
+
707
+ // Notify parent window about the error
708
+ window.parent.postMessage({
709
+ source: 'qti-pci-iframe',
710
+ method: 'error',
711
+ params: {
712
+ message: 'RequireJS ' + err.requireType + ' error for modules: ' + err.requireModules,
713
+ details: {
714
+ type: err.requireType,
715
+ modules: err.requireModules,
716
+ error: err.toString()
717
+ }
718
+ }
719
+ }, '*');
720
+ }
721
+ });
722
+
723
+ // PCI Manager for iframe implementation
724
+ window.PCIManager = {
725
+ pciInstance: null,
726
+ container: null,
727
+ customInteractionTypeIdentifier: null,
728
+
729
+ initialize: function(config) {
730
+ this.customInteractionTypeIdentifier = config.customInteractionTypeIdentifier;
731
+ this.container = document.getElementById('pci-container');
732
+ this.container.classList.add('qti-customInteraction');
733
+
734
+ function getResolvablePath(path, basePath) {
735
+ if (Array.isArray(path)) {
736
+ return path.map(p => getResolvablePathString(p, basePath));
737
+ } else {
738
+ return getResolvablePathString(path, basePath);
739
+ }
740
+ }
741
+
742
+ function removeDoubleSlashes(str) {
743
+ return str
744
+ .replace(/([^:\\/])\\/\\/+/g, '$1/')
745
+ .replace(/\\/\\//g, '/')
746
+ .replace('http:/', 'http://')
747
+ .replace('https:/', 'https://');
748
+ }
749
+
750
+ function getResolvablePathString(path, basePath) {
751
+ path = path.replace(/\\.js$/, '');
752
+ return path?.toLocaleLowerCase().startsWith('http') || !basePath
753
+ ? path
754
+ : removeDoubleSlashes(\`\${basePath}/\${path}\`);
755
+ }
756
+
757
+ function combineRequireResolvePaths(path1, path2, baseUrl) {
758
+ path1 = getResolvablePath(path1, baseUrl);
759
+ const path1Array = Array.isArray(path1) ? path1 : [path1];
760
+ if (!path2) {
761
+ return path1Array;
762
+ }
763
+ path2 = getResolvablePath(path2, baseUrl);
764
+ const path2Array = Array.isArray(path2) ? path2 : [path2];
765
+ return path1Array.concat(path2Array).filter((value, index, self) => self.indexOf(value) === index);
766
+ }
767
+
768
+ // Update paths with modules from the config
769
+ if (config.interactionModules && config.interactionModules.length > 0) {
770
+ config.interactionModules.forEach(module => {
771
+ if (module.id && module.primaryPath) {
772
+ const currentPath = window.requirePaths[module.id] || [];
773
+ const currentPaths = Array.isArray(currentPath) ? currentPath : [currentPath];
774
+ const newPath = combineRequireResolvePaths(
775
+ module.primaryPath, module.fallbackPath, config.baseUrl
776
+ );
777
+ window.requirePaths[module.id] = currentPaths.concat(newPath).filter((value, index, self) => self.indexOf(value) === index);
778
+ }
779
+ });
780
+ }
781
+
782
+ // The ONLY other requirejs.config call - with the context for this specific PCI
783
+ window.requirejs.config({
784
+ context: this.customInteractionTypeIdentifier,
785
+ paths: window.requirePaths,
786
+ shim: window.requireShim
787
+ });
788
+
789
+ // Define qtiCustomInteractionContext for the PCI
790
+ define('qtiCustomInteractionContext', () => {
791
+ return {
792
+ register: pciInstance => {
793
+ this.pciInstance = pciInstance;
794
+ // Configure PCI instance
795
+ const pciConfig = {
796
+ properties: this.addHyphenatedKeys({ ...config.dataAttributes }),
797
+ onready: pciInstance => {
798
+ this.pciInstance = pciInstance;
799
+ this.notifyReady();
800
+ },
801
+ ondone: (pciInstance, response, state, status) => {
802
+ this.notifyInteractionChanged(response);
803
+ },
804
+ responseIdentifier: config.responseIdentifier,
805
+ boundTo: config.boundTo,
806
+ };
807
+
808
+ if (pciInstance.getInstance) {
809
+ pciInstance.getInstance(this.container, pciConfig, undefined);
810
+ } else {
811
+ // TAO custom interaction initialization
812
+ const restoreTAOConfig = (dataset) => {
813
+ const config = {};
814
+ const parseDataAttributes = () => {
815
+ const result = {};
816
+
817
+ // Separate direct attributes from nested ones
818
+ Object.entries(dataset || []).forEach(([key, value]) => {
819
+ if (!key.includes('__')) {
820
+ // Direct attributes (like version)
821
+ result[key] = value;
822
+ }
823
+ });
824
+
825
+ // Parse nested attributes
826
+ const nestedData = {};
827
+
828
+ Object.entries(dataset || []).forEach(([key, value]) => {
829
+ const parts = key.split('__');
830
+ if (parts.length > 1) {
831
+ const [group, index, prop] = parts;
832
+ nestedData[group] = nestedData[group] || {};
833
+ nestedData[group][index] = nestedData[group][index] || {};
834
+ nestedData[group][index][prop] = value;
835
+ }
836
+ });
837
+
838
+ // Convert nested groups to arrays
839
+ Object.entries(nestedData).forEach(([key, group]) => {
840
+ result[key] = Object.values(group);
841
+ });
842
+ return result;
843
+ };
844
+ const data = parseDataAttributes();
845
+ for (const key in data) {
846
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
847
+ const value = data[key];
848
+ if (key === 'config') {
849
+ config[key] = JSON.parse(value);
850
+ } else {
851
+ config[key] = value;
852
+ }
853
+ }
854
+ }
855
+ return config;
856
+ };
857
+ const taoConfig = restoreTAOConfig(config.dataAttributes);
858
+
859
+ this.pciInstance.initialize(
860
+ this.customInteractionTypeIdentifier,
861
+ this.container.firstElementChild || this.container,
862
+ Object.keys(taoConfig).length ? taoConfig : null
863
+ );
864
+ }
865
+ },
866
+ notifyReady: () => {
867
+ // Notify parent that the PCI is ready
868
+ window.parent.postMessage({
869
+ source: 'qti-pci-iframe',
870
+ method: 'pciReady'
871
+ }, '*');
872
+ }
873
+ };
874
+ });
875
+
876
+ // Load the PCI module
877
+ this.loadModule(config.module);
878
+ },
879
+
880
+ setupRequireJsConfig: function(config) {
881
+ // This function is no longer needed as we handle config in initialize
882
+ },
883
+
884
+ loadModule: function(modulePath) {
885
+ try {
886
+ // Get the context-specific require
887
+ const contextRequire = window.requirejs.config({
888
+ context: this.customInteractionTypeIdentifier
889
+ });
890
+
891
+ contextRequire(['require'], require => {
892
+ // Now load the actual module
893
+ require([modulePath], () => {
894
+ }, err => {
895
+ console.error('Error loading module after tap loaded:', modulePath, err);
896
+ this.notifyError('Module load error: ' + err.toString());
897
+ });
898
+ });
899
+ } catch (error) {
900
+ console.error('Exception in loadModule:', error);
901
+ this.notifyError('Error in require call: ' + error.toString());
902
+ }
903
+ },
904
+
905
+ notifyReady: function() {
906
+ window.parent.postMessage({
907
+ source: 'qti-pci-iframe',
908
+ method: 'iframeReady'
909
+ }, '*');
910
+ },
911
+
912
+ notifyInteractionChanged: function(response) {
913
+ window.parent.postMessage({
914
+ source: 'qti-pci-iframe',
915
+ method: 'interactionChanged',
916
+ params: { value: response }
917
+ }, '*');
918
+ },
919
+
920
+ notifyError: function(message) {
921
+ console.error('PCI Error:', message);
922
+ window.parent.postMessage({
923
+ source: 'qti-pci-iframe',
924
+ method: 'error',
925
+ params: { message: message }
926
+ }, '*');
927
+ },
928
+
929
+ setMarkup: function(markupHtml) {
930
+ this.container = document.getElementById('pci-container');
931
+ this.container.innerHTML = markupHtml;
932
+ },
933
+
934
+ setValue: function(value) {
935
+ if (this.pciInstance && this.pciInstance.setResponse) {
936
+ this.pciInstance.setResponse(value);
937
+ }
938
+ },
939
+
940
+ addHyphenatedKeys: function(properties) {
941
+ const updatedProperties = { ...properties };
942
+ for (const key in properties) {
943
+ if (Object.prototype.hasOwnProperty.call(properties, key)) {
944
+ const hyphenatedKey = key.replace(/[A-Z]/g, char => \`-\${char.toLowerCase()}\`);
945
+ updatedProperties[hyphenatedKey] = properties[key];
946
+ }
947
+ }
948
+ return updatedProperties;
949
+ },
950
+ };
951
+
952
+ // Set up message listener for communication with parent
953
+ window.addEventListener('message', function(event) {
954
+ const { data } = event;
955
+
956
+ // Ensure the message is from our parent
957
+ if (!data || data.source !== 'qti-portable-custom-interaction') {
958
+ return;
959
+ }
960
+
961
+ switch(data.method) {
962
+ case 'initialize':
963
+ PCIManager.initialize(data.params);
964
+ break;
965
+
966
+ case 'setValue':
967
+ PCIManager.setValue(data.params);
968
+ break;
969
+
970
+ case 'setMarkup':
971
+ PCIManager.setMarkup(data.params);
972
+ break;
973
+
974
+ case 'setBoundTo':
975
+ // Handle setting boundTo
976
+ break;
977
+
978
+ case 'setProperties':
979
+ // Handle setting properties
980
+ break;
981
+ }
982
+ });
983
+
984
+ // Notify parent that iframe has loaded
985
+ window.addEventListener('load', function() {
986
+ window.parent.postMessage({
987
+ source: 'qti-pci-iframe',
988
+ method: 'iframeLoaded'
989
+ }, '*');
990
+ });
991
+ let resizeTimeout;
992
+ let previousHeight = 0;
993
+ const notifyResize = () => {
994
+ const container = document.getElementById('pci-container');
995
+ const newHeight = container.scrollHeight + 100;
996
+ if (newHeight !== previousHeight) {
997
+ previousHeight = newHeight;
998
+ clearTimeout(resizeTimeout);
999
+ resizeTimeout = setTimeout(() => {
1000
+ window.parent.postMessage({
1001
+ source: 'qti-pci-iframe',
1002
+ method: 'resize',
1003
+ height: newHeight,
1004
+ width: container.scrollWidth
1005
+ }, '*');
1006
+ }, 100); // Adjust debounce time as needed
1007
+ }
1008
+ };
1009
+
1010
+ function setupResizeObserver() {
1011
+ const container = document.getElementById('pci-container');
1012
+ if (!container || !(container instanceof Element)) {
1013
+ console.warn('ResizeObserver: document.container is not an Element');
1014
+ return;
1015
+ }
1016
+
1017
+ const resizeObserver = new ResizeObserver(() => {
1018
+ notifyResize();
1019
+ });
1020
+
1021
+ resizeObserver.observe(container);
1022
+ }
1023
+
1024
+ // Run setup once DOM is ready
1025
+ if (document.readyState === 'loading') {
1026
+ document.addEventListener('DOMContentLoaded', () => {
1027
+ notifyResize(); // initial resize
1028
+ setupResizeObserver();
1029
+ });
1030
+ } else {
1031
+ notifyResize();
1032
+ setupResizeObserver();
1033
+ }
1034
+
1035
+ window.addEventListener('load', () => {
1036
+ notifyResize();
1037
+ });
1038
+ let lastResponseStr = '';
1039
+ setInterval(() => {
1040
+ if (PCIManager.pciInstance && PCIManager.pciInstance.getResponse) {
1041
+ const response = PCIManager.pciInstance.getResponse();
1042
+ const responseStr = JSON.stringify(response);
1043
+
1044
+ if (responseStr !== lastResponseStr) {
1045
+ lastResponseStr = responseStr;
1046
+ window.parent.postMessage({
1047
+ source: 'qti-pci-iframe',
1048
+ method: 'interactionChanged',
1049
+ params: { value: response }
1050
+ }, '*');
1051
+ }
1052
+ }
1053
+ }, 500); // Check every 500ms
1054
+ </script>
1055
+ </head>
1056
+ <body>
1057
+ <div id="pci-container"></div>
1058
+ </body>
1059
+ </html>`}render(){return h`
1060
+ <slot></slot>
1061
+ ${this._errorMessage?h`<div style="color:red">
1062
+ <h1>Error</h1>
1063
+ ${this._errorMessage}
1064
+ </div>`:""}
1065
+ `}};I.styles=sr,n([u({type:String,attribute:"module"})],I.prototype,"module",2),n([u({type:String,attribute:"custom-interaction-type-identifier"})],I.prototype,"customInteractionTypeIdentifier",2),n([u({type:String,attribute:"data-base-url"})],I.prototype,"baseUrl",2),n([x()],I.prototype,"_errorMessage",2),n([S({context:T,subscribe:!0}),x()],I.prototype,"context",2),n([x()],I.prototype,"response",2),I=n([m("qti-portable-custom-interaction")],I);var Ke=class extends y{render(){return h`<slot></slot>`}};Ke.styles=[g`
1066
+ :host {
1067
+ display: block;
1068
+ }
1069
+ ::slotted(img) {
1070
+ position: absolute;
1071
+ cursor: move;
1072
+ user-select: none;
1073
+ left: 50%;
1074
+ transform: translateX(-50%);
1075
+ }
1076
+ `];customElements.define("qti-position-object-interaction",Ke);var $e=class extends y{render(){return h`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(i){i.preventDefault();let e=i.clientX-this.startX,t=i.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=i.clientX,this.startY=i.clientY}firstUpdated(i){super.firstUpdated(i),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};$e.styles=[g`
1077
+ :host {
1078
+ display: inline-block;
1079
+ position: relative;
1080
+ }
1081
+ `],$e=n([m("qti-position-object-stage")],$e);var or="important",mr=" !"+or,pt=Z(class extends ue{constructor(p){if(super(p),p.type!==de.ATTRIBUTE||p.name!=="style"||p.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(p){return Object.keys(p).reduce((i,e)=>{let t=p[e];return t==null?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(p,[i]){let{style:e}=p.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let t of this.ft)i[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in i){let r=i[t];if(r!=null){this.ft.add(t);let s=typeof r=="string"&&r.endsWith(mr);t.includes("-")||s?e.setProperty(t,s?r.slice(0,-11):r,s?or:""):e[t]=r}}return ce}});var Y=class extends E{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=[];this._correctAreas=[];this._imgElement=null;this._scaleX=1;this._scaleY=1;this._imageWidthOrginal=0;this._imageHeightOrginal=0;this._onImageClick=e=>{if(!this._imgElement){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.calculateScale();let t=this._imgElement.getBoundingClientRect(),r=(e.clientX-t.left)*this._scaleX,s=(e.clientY-t.top)*this._scaleY,a=`${r.toFixed()} ${s.toFixed()}`;this.maxChoices===1?this.response=[a]:(this.maxChoices===0||this.response.length<this.maxChoices)&&(this.response=[...this.response,a]),this.saveResponse(this.response)};this._onResize=()=>{this.calculateScale()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize)}toggleCorrectResponse(e,t){if(!t){this._correctAreas=[];return}let r=e.areaMapping,s=[];if(!r||r.areaMapEntries.length===0)if(e.correctResponse){let a=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];if(a.length===0||a.find(o=>o.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),s=a.map(o=>({shape:"circle",coords:o.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else s=r.areaMapEntries;this._correctAreas=s.map(a=>({coords:a.coords,shape:a.shape}))}updated(e){super.updated(e);let t=this._imgElement;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.calculateScale(),this.shadowRoot.querySelectorAll("div").forEach(r=>{let s=r.dataset.coord,a=r.dataset.shape;s&&a&&re(a,s.split(",").map(o=>+o),t,r)}))}render(){return h` <slot name="prompt"></slot>
1082
+ <point-container>
1083
+ ${xe(this.response.filter(e=>e),e=>e,(e,t)=>{let[r,s]=e.split(" ").map(Number),a=r/(this._imageWidthOrginal||1)*100,o=s/(this._imageHeightOrginal||1)*100,l=16,c=l/(this._imageWidthOrginal||1)*100,d=l/(this._imageHeightOrginal||1)*100;return h`
1084
+ <button
1085
+ part="point"
1086
+ style=${pt({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",transform:"translate(-50%, -50%)",left:`${a}%`,top:`${o}%`,width:`min(${c}%, 1rem)`,height:`min(${d}%, 1rem)`,minWidth:`min(${c}%, 1rem)`,minHeight:`min(${d}%, 1rem)`,borderRadius:"50%",background:"red"})}
1087
+ aria-label="Remove point at ${e}"
1088
+ @click=${f=>{f.stopPropagation(),this.response=this.response.filter((b,v)=>v!==t),this.saveResponse(this.response)}}
1089
+ ></button>
1090
+ `})}
1091
+ ${xe(this._correctAreas?.filter(e=>e),e=>e,(e,t)=>h`<div
1092
+ style=${pt({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
1093
+ data-coord="${e.coords}"
1094
+ alt=${`correct-response-${t+1}`}
1095
+ data-shape="${e.shape}"
1096
+ ></div>`)}
1097
+ <slot></slot>
1098
+ </point-container>`}reset(){this.response=null}validate(){return this.response.length>=this.minChoices&&this.response.length<=this.maxChoices}calculateScale(){this._imageWidthOrginal=this._imgElement.getAttribute("width")?parseFloat(this._imgElement.getAttribute("width")):this._imgElement.naturalWidth,this._imageHeightOrginal=this._imgElement.getAttribute("height")?parseFloat(this._imgElement.getAttribute("height")):this._imgElement.naturalHeight;let e=this._imgElement.getBoundingClientRect();this._scaleX=e.width===0?1:this._imageWidthOrginal/e.width,this._scaleY=e.height===0?1:this._imageHeightOrginal/e.height}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?(this.calculateScale(),this._imgElement.addEventListener("click",this._onImageClick)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};Y.styles=[g`
1099
+ :host {
1100
+ display: block;
1101
+ }
1102
+ point-container {
1103
+ display: block;
1104
+ position: relative;
1105
+ width: fit-content;
1106
+ }
1107
+
1108
+ ::slotted(img) {
1109
+ max-width: 100%;
1110
+ height: auto;
1111
+ display: block;
1112
+ }
1113
+ `],n([u({type:Number,attribute:"max-choices"})],Y.prototype,"maxChoices",2),n([u({type:Number,attribute:"min-choices"})],Y.prototype,"minChoices",2),n([x()],Y.prototype,"response",2),n([x()],Y.prototype,"_correctAreas",2),Y=n([m("qti-select-point-interaction")],Y);var W=class extends O(y,"qti-simple-choice"){constructor(){super(...arguments);this.templateIdentifier=null;this.showHide="show";this.fixed=!1}get checked(){return this.internals.states.has("--checked")}render(){return h`<div part="ch">
1114
+ <div part="cha"></div>
1115
+ </div>
1116
+ ${this.marker?h`<div id="label">${this.marker}</div>`:_}
1117
+ <slot part="slot"></slot>`}};W.styles=g`
1118
+ :host {
1119
+ display: flex;
1120
+ align-items: center;
1121
+ user-select: none;
1122
+ }
1123
+ slot {
1124
+ width: 100%;
1125
+ display: flex;
1126
+ align-items: center;
1127
+ }
1128
+ [part='ch'] {
1129
+ display: flex;
1130
+ flex-shrink: 0;
1131
+ align-items: center;
1132
+ justify-content: center;
1133
+ }
1134
+ `,n([u({type:String,attribute:"template-identifier"})],W.prototype,"templateIdentifier",2),n([u({type:String,attribute:"show-hide"})],W.prototype,"showHide",2),n([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],W.prototype,"fixed",2),n([u({type:String,attribute:!1})],W.prototype,"marker",2),W=n([m("qti-simple-choice")],W);var nr=g`
1135
+ :host {
1136
+ display: block;
1137
+ --show-bounds: true;
1138
+ --show-ticks: true;
1139
+ --show-value: true;
1140
+ }
1141
+
1142
+ [part='slider'] {
1143
+ margin-left: 2rem; /* mx-8 */
1144
+ margin-right: 2rem;
1145
+ padding-bottom: 1rem; /* pb-4 */
1146
+ padding-top: 1.25rem; /* pt-5 */
1147
+ }
1148
+
1149
+ [part='bounds'] {
1150
+ display: flex;
1151
+ width: 100%;
1152
+ justify-content: space-between;
1153
+ margin-bottom: 0.5rem; /* mb-2 */
1154
+ }
1155
+
1156
+ [part='ticks'] {
1157
+ margin-left: 0.125rem; /* mx-0.5 */
1158
+ margin-right: 0.125rem;
1159
+ margin-bottom: 0.25rem; /* mb-1 */
1160
+ height: 0.5rem; /* h-2 */
1161
+ background: linear-gradient(to right, var(--qti-border-color) var(--qti-border-thickness), transparent 1px) repeat-x
1162
+ 0 center / calc(calc(100% - var(--qti-border-thickness)) / ((var(--max) - var(--min)) / var(--step))) 100%;
1163
+ }
1164
+
1165
+ [part='rail'] {
1166
+ display: flex;
1167
+ align-items: center;
1168
+ box-sizing: border-box;
1169
+ height: 0.375rem; /* h-1.5 */
1170
+ width: 100%;
1171
+ cursor: pointer;
1172
+ border-radius: 9999px; /* rounded-full */
1173
+ border: 1px solid #d1d5db; /* border-gray-300 */
1174
+ background-color: #e5e7eb; /* bg-gray-200 */
1175
+ }
1176
+
1177
+ [part='knob'] {
1178
+ background-color: var(--qti-bg-active);
1179
+ border: 2px solid var(--qti-border-active);
1180
+ position: relative;
1181
+ height: 1rem; /* h-4 */
1182
+ width: 1rem; /* w-4 */
1183
+ transform-origin: center;
1184
+ transform: translateX(-50%);
1185
+ cursor: pointer;
1186
+ border-radius: 9999px; /* rounded-full */
1187
+ left: var(--value-percentage);
1188
+ }
1189
+ [part='knob-correct'] {
1190
+ background-color: var(--qti-correct-light);
1191
+ border: 2px solid var(--qti-correct);
1192
+ position: relative;
1193
+ height: 1rem; /* h-4 */
1194
+ width: 1rem; /* w-4 */
1195
+ transform-origin: center;
1196
+ transform: translateX(-50%);
1197
+ cursor: pointer;
1198
+ border-radius: 9999px; /* rounded-full */
1199
+ left: var(--value-percentage-correct);
1200
+ }
1201
+
1202
+ [part='value'] {
1203
+ position: absolute;
1204
+ bottom: 2rem; /* bottom-8 */
1205
+ left: 0.5rem; /* left-2 */
1206
+ transform: translateX(-50%);
1207
+ cursor: pointer;
1208
+ border-radius: 0.25rem; /* rounded */
1209
+ background-color: #f3f4f6; /* bg-gray-100 */
1210
+ padding: 0.25rem 0.5rem; /* px-2 py-1 */
1211
+ text-align: center;
1212
+ color: #6b7280; /* text-gray-500 */
1213
+ }
1214
+ `;var J=class extends E{constructor(){super(...arguments);this._value=0;this._correctResponseNumber=null;this.min=0;this.max=100;this.step=1}validate(){return!0}connectedCallback(){super.connectedCallback(),this._updateValue(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this._value.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this._updateValue(t)}toggleCorrectResponse(e,t){if(t){this._correctResponse=e.correctResponse.toString();let r=parseFloat(e.correctResponse.toString());if(isNaN(r))this._correctResponseNumber=null;else{this._correctResponseNumber=r;let s=(this._correctResponseNumber-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}}else this._correctResponseNumber=null;this.requestUpdate()}_updateValue(e){let t=this._value;if(this._value=Math.min(this.max,Math.max(this.min,e)),this._value===t)return;let r=(this._value-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return h`
1215
+ <slot name="prompt"></slot>
1216
+ <div id="slider" part="slider">
1217
+ <div id="bounds" part="bounds">
1218
+ <div>${this.min}</div>
1219
+ <div>${this.max}</div>
1220
+ </div>
1221
+
1222
+ <div id="ticks" part="ticks"></div>
1223
+
1224
+ <div id="rail" part="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchStart}>
1225
+ <div id="knob" part="knob">
1226
+ <div id="value" part="value">${this.response}</div>
1227
+ </div>
1228
+
1229
+ ${this._correctResponseNumber!==null?h`
1230
+ <div id="knob-correct" part="knob-correct">
1231
+ <div id="value" part="value">${this._correctResponseNumber}</div>
1232
+ </div>
1233
+ `:null}
1234
+ </div>
1235
+ </div>
1236
+ `}_onMouseDown(e){this._startDrag(e.pageX);let t=s=>this._onDrag(s.pageX),r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=s=>this._onDrag(s.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",r)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),r=e-t.left,s=Math.min(1,Math.max(0,r/t.width)),a=this.min+Math.round(s*(this.max-this.min)/this.step)*this.step;this._updateValue(a)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};J.styles=nr,n([pe("#rail")],J.prototype,"_rail",2),n([u({type:Number,attribute:"lower-bound"})],J.prototype,"min",2),n([u({type:Number,attribute:"upper-bound"})],J.prototype,"max",2),n([u({type:Number,attribute:"step"})],J.prototype,"step",2),J=n([m("qti-slider-interaction")],J);var ar=()=>new ut,ut=class{},dt=new WeakMap,Ba=Z(class extends Ut{render(p){return _}update(p,[i]){let e=i!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=i,this.ht=p.options?.host,this.rt(this.ct=p.element)),_}rt(p){if(this.isConnected||(p=void 0),typeof this.G=="function"){let i=this.ht??globalThis,e=dt.get(i);e===void 0&&(e=new WeakMap,dt.set(i,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,p),p!==void 0&&this.G.call(this.ht,p)}else this.G.value=p}get lt(){return typeof this.G=="function"?dt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var lr=g`
1237
+ :host {
1238
+ display: inline-block;
1239
+ }
1240
+
1241
+ :host(.qti-input-width-1) [part='input'] {
1242
+ width: 1.1rem;
1243
+ min-width: 1.1rem;
1244
+ }
1245
+
1246
+ :host(.qti-input-width-2) [part='input'] {
1247
+ width: 2.3rem;
1248
+ min-width: 2.3rem;
1249
+ }
1250
+
1251
+ :host(.qti-input-width-3) [part='input'] {
1252
+ width: 3.3rem;
1253
+ min-width: 3.3rem;
1254
+ }
1255
+
1256
+ :host(.qti-input-width-4) [part='input'] {
1257
+ width: 4.2rem;
1258
+ min-width: 4.2rem;
1259
+ }
1260
+
1261
+ :host(.qti-input-width-6) [part='input'] {
1262
+ width: 6.6rem;
1263
+ min-width: 6.6rem;
1264
+ }
1265
+
1266
+ :host(.qti-input-width-10) [part='input'] {
1267
+ width: 8rem;
1268
+ min-width: 8rem;
1269
+ }
1270
+
1271
+ :host(.qti-input-width-15) [part='input'] {
1272
+ width: 12rem;
1273
+ min-width: 12rem;
1274
+ }
1275
+
1276
+ :host(.qti-input-width-20) [part='input'] {
1277
+ width: 17rem;
1278
+ min-width: 17rem;
1279
+ }
1280
+
1281
+ :host(.qti-input-width-25) [part='input'] {
1282
+ width: 20rem;
1283
+ min-width: 20rem;
1284
+ }
1285
+
1286
+ :host(.qti-input-width-30) [part='input'] {
1287
+ width: 24rem;
1288
+ min-width: 24rem;
1289
+ }
1290
+
1291
+ :host(.qti-input-width-35) [part='input'] {
1292
+ width: 28rem;
1293
+ min-width: 28rem;
1294
+ }
1295
+
1296
+ :host(.qti-input-width-40) [part='input'] {
1297
+ width: 32rem;
1298
+ min-width: 32rem;
1299
+ }
1300
+
1301
+ :host(.qti-input-width-45) [part='input'] {
1302
+ width: 36rem;
1303
+ min-width: 36rem;
1304
+ }
1305
+
1306
+ :host(.qti-input-width-50) [part='input'] {
1307
+ width: 40rem;
1308
+ min-width: 40rem;
1309
+ }
1310
+
1311
+ :host(.qti-input-width-72) [part='input'] {
1312
+ width: 57rem;
1313
+ min-width: 57rem;
1314
+ }
1315
+
1316
+ :host {
1317
+ position: relative;
1318
+ }
1319
+ input {
1320
+ anchor-name: --text-entry-input;
1321
+ z-index: 100;
1322
+ position: relative;
1323
+ }
1324
+
1325
+ [part='correct'] {
1326
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
1327
+ background-color: var(--qti-bg);
1328
+ z-index: 0;
1329
+ position: absolute;
1330
+ left: 0;
1331
+ right: 0;
1332
+ position-anchor: --text-entry-input;
1333
+ bottom: anchor(top);
1334
+ left: anchor(left);
1335
+ /* opacity: 1; */
1336
+ transition: all 1s;
1337
+
1338
+ @starting-style {
1339
+ display: grid;
1340
+ /* opacity: 0; */
1341
+ bottom: 0;
1342
+ }
1343
+ }
1344
+ `;var D=class extends E{constructor(){super(...arguments);this.inputRef=ar();this.response=null;this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}get value(){return this.response||null}set value(e){this.response=e||null}validate(){if(!this._input)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),this._input.setCustomValidity(""),this._input.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),this._input.setCustomValidity(this.dataPatternmaskMessage));else{let e=this._input.checkValidity();this._internals.setValidity(e?{}:{customError:!1})}return this.response!==""&&this._input.checkValidity()}toggleCorrectResponse(e,t){if(t&&e.correctResponse){let r=e.correctResponse.toString();this._correctResponse=r}else this._correctResponse=null}render(){return h`
1345
+ <input
1346
+ part="input"
1347
+ name="${this.responseIdentifier}"
1348
+ spellcheck="false"
1349
+ autocomplete="off"
1350
+ @blur="${e=>{this.reportValidity()}}"
1351
+ @keydown="${e=>e.stopImmediatePropagation()}"
1352
+ @keyup="${this.textChanged}"
1353
+ @change="${this.textChanged}"
1354
+ type="${this.patternMask=="[0-9]*"?"number":"text"}"
1355
+ placeholder="${H(this.placeholderText?this.placeholderText:void 0)}"
1356
+ .value="${this.response}"
1357
+ pattern="${H(this.patternMask?this.patternMask:void 0)}"
1358
+ maxlength=${1e3}
1359
+ ?disabled="${this.disabled}"
1360
+ ?readonly="${this.readonly}"
1361
+ />
1362
+ ${this._correctResponse?h`<div part="correct">${this._correctResponse}</div>`:_}
1363
+ `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this.response=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};D.styles=lr,n([u({type:Number,attribute:"expected-length"})],D.prototype,"expectedLength",2),n([u({type:String,attribute:"pattern-mask"})],D.prototype,"patternMask",2),n([u({type:String,attribute:"placeholder-text"})],D.prototype,"placeholderText",2),n([u({type:String,attribute:"data-patternmask-message"})],D.prototype,"dataPatternmaskMessage",2),n([x()],D.prototype,"response",2),n([pe("input")],D.prototype,"_input",2),n([R("response",{waitUntilFirstUpdate:!0})],D.prototype,"_handleValueChange",2),D=n([m("qti-text-entry-interaction")],D);var He=class extends E{constructor(){super(...arguments);this._file=null;this._base64=null}reset(){this._file=null,this._base64=null,this.saveResponse(null)}validate(){return this._base64!==null}get response(){return this._base64}set response(e){if(typeof e=="string")this._base64=e,this.saveResponse(e);else if(e===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...E.properties}}render(){return h`
1364
+ <div>
1365
+ <slot name="prompt"></slot>
1366
+ <input type="file" @change="${this._onFileChange}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
1367
+ </div>
1368
+ `}async _onFileChange(e){let t=e.target;t.files&&t.files.length>0&&(this._file=t.files[0],this._base64=await this._convertToBase64(this._file),this.saveResponse(this._base64),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this._base64}})))}_convertToBase64(e){return new Promise((t,r)=>{let s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}};He.styles=[g`
1369
+ :host {
1370
+ display: block;
1371
+ margin: 1em 0;
1372
+ }
1373
+ input[type='file'] {
1374
+ display: block;
1375
+ margin-top: 0.5em;
1376
+ }
1377
+ `],He=n([m("qti-upload-interaction")],He);var cr=g`
1378
+ :host {
1379
+ display: block;
1380
+ }
1381
+ `;var Ne=class extends y{render(){return h`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};Ne.styles=cr,Ne=n([m("qti-item-body")],Ne);var Oe=class extends y{render(){return h`<slot></slot>`}process(){let i=new ht,e=[...this.children];i.process(e)}};Oe.styles=[g`
1382
+ :host {
1383
+ display: none;
1384
+ }
1385
+ `],Oe=n([m("qti-outcome-processing")],Oe);var ht=class{process(i){for(let e of i)e.process()}};var Ze=class extends y{render(){return h`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};Ze=n([m("qti-prompt")],Ze);var pr=`<qti-response-processing>
1386
+ <qti-response-condition>
1387
+ <qti-response-if>
1388
+ <qti-match>
1389
+ <qti-variable identifier="RESPONSE"></qti-variable>
1390
+ <qti-correct identifier="RESPONSE"></qti-correct>
1391
+ </qti-match>
1392
+ <qti-set-outcome-value identifier="SCORE">
1393
+ <qti-base-value base-type="float">1</qti-base-value>
1394
+ </qti-set-outcome-value>
1395
+ </qti-response-if>
1396
+ <qti-response-else>
1397
+ <qti-set-outcome-value identifier="SCORE">
1398
+ <qti-base-value base-type="float">0</qti-base-value>
1399
+ </qti-set-outcome-value>
1400
+ </qti-response-else>
1401
+ </qti-response-condition>
1402
+ </qti-response-processing>`,dr=`<qti-response-processing>
1403
+ <qti-response-condition>
1404
+ <qti-response-if>
1405
+ <qti-is-null>
1406
+ <qti-variable identifier="RESPONSE"></qti-variable>
1407
+ </qti-is-null>
1408
+ <qti-set-outcome-value identifier="SCORE">
1409
+ <qti-base-value base-type="float">0.0</qti-base-value>
1410
+ </qti-set-outcome-value>
1411
+ </qti-response-if>
1412
+ <qti-response-else>
1413
+ <qti-set-outcome-value identifier="SCORE">
1414
+ <qti-map-response identifier="RESPONSE"> </qti-map-response>
1415
+ </qti-set-outcome-value>
1416
+ </qti-response-else>
1417
+ </qti-response-condition>
1418
+ </qti-response-processing>`,ur=`<qti-response-processing>
1419
+ <qti-response-condition>
1420
+ <qti-response-if>
1421
+ <qti-is-null>
1422
+ <qti-variable identifier="RESPONSE"></qti-variable>
1423
+ </qti-is-null>
1424
+ <qti-set-outcome-value identifier="SCORE">
1425
+ <qti-base-value base-type="float">0</qti-base-value>
1426
+ </qti-set-outcome-value>
1427
+ </qti-response-if>
1428
+ <qti-response-else>
1429
+ <qti-set-outcome-value identifier="SCORE">
1430
+ <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
1431
+ </qti-set-outcome-value>
1432
+ </qti-response-else>
1433
+ </qti-response-condition>
1434
+ </qti-response-processing>`;var Pe=class extends y{render(){return h`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let t of e)t.process()}firstUpdated(i){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString(dr).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(ur).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(pr).firstElementChild.firstElementChild);break}}}fragmentFromString(i){return document.createRange().createContextualFragment(i)}};Pe.styles=[g`
1435
+ :host {
1436
+ display: none;
1437
+ }
1438
+ `],Pe=n([m("qti-response-processing")],Pe);var z=class extends y{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};z=n([m("qti-rule")],z);var ze=class extends z{get childExpression(){return this.firstElementChild}process(){let i=this.getAttribute("identifier"),e=this.context.variables.find(r=>r.identifier===i)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseInt(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:qe(t)}})),t)}};n([u({type:String})],ze.prototype,"identifier",2),n([S({context:T,subscribe:!0}),x()],ze.prototype,"context",2);customElements.define("qti-lookup-outcome-value",ze);var mt=class extends z{render(){return h`<slot></slot>`}process(){let i=[...this.children];for(let e=0;e<i.length;e++){let t=i[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",mt);var ft=class extends z{process(){let i=this.getAttribute("identifier");if(!i){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let r=new gt(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:this.formatValue(r)}}))}formatValue(i){return Array.isArray(i)?i.map(qe):i!==null?qe(i):null}},gt=class{constructor(i){this.expression=i}process(){let i=this.expression.calculate()??null;return i===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(i)?i.map(e=>e.value?e.value:e):i}};customElements.define("qti-set-outcome-value",ft);var Fe=class extends y{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let i=this.getSubRules();for(let e=0;e<i.length;e++)i[e].process()}};customElements.define("qti-response-else",Fe);var Ue=class extends Fe{calculate(){return this.firstElementChild.calculate()}getSubRules(){let i=[];for(let e=1;e<this.children.length;e++)i.push(this.children[e]);return i}};customElements.define("qti-response-if",Ue);var bt=class extends Ue{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",bt);var Qe=class extends fr($){calculate(){return this.calculateChildren(Array.from(this.children))}};Qe=n([m("qti-and")],Qe);function fr(p){return class extends p{calculateChildren(e){return e.map(r=>{let s=r;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let a=s.calculate(),o=!1;if(typeof a=="string")if(a==="true")o=!0;else if(a==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof a=="boolean"&&(o=a);return o}).every(r=>typeof r=="boolean"&&r)}}}var et=class extends C{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};n([u({type:String,attribute:"base-type"})],et.prototype,"baseType",2);customElements.define("qti-base-value",et);var vt=class extends ${getResult(){let i=this.getVariables();if(this.children.length===2){let e=i[0],t=i[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let r=e.value,s=t.value;return r.filter(l=>s.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let r=e.value;return t.value.includes(r)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",vt);var yt=class extends C{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let i=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===i)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",yt);var tt=class extends C{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),a=parseFloat(r.value);if(!isNaN(s)&&!isNaN(a))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===a.toPrecision(this.figures):Math.round(s*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(a*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${s}, ${a}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};n([u({type:String})],tt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",tt);var k=class{static isPointInArea(i,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[r,s]=i.split(" ").map(Number),[a,...o]=e.split(","),l=o.map(Number);switch(a.toLowerCase()){case"circle":case"default":{let[c,d,f]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((r-c)**2+(s-d)**2)<=f}case"rect":{let[c,d,f,b]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):r>=c&&r<=f&&s>=d&&s<=b}case"ellipse":{let[c,d,f,b]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let v=(r-c)**2/f**2,w=(s-d)**2/b**2;return v+w<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:r,y:s},c)}default:return console.warn(`Unsupported shape type: ${a}`),!1}}static isPointInPolygon(i,e){let t=!1;for(let r=0,s=e.length-1;r<e.length;s=r++){let a=e[r].x,o=e[r].y,l=e[s].x,c=e[s].y;o>i.y!=c>i.y&&i.x<(l-a)*(i.y-o)/(c-o)+a&&(t=!t)}return t}static compareSingleValues(i,e,t){switch(t){case"identifier":case"string":return i===e;case"integer":{let r=parseInt(i,10),s=parseInt(e,10);if(!isNaN(r)&&!isNaN(s))return r===s;console.error(`Cannot convert ${i} and/or ${e} to int.`);break}case"float":{let r=parseFloat(i),s=parseFloat(e);if(!isNaN(r)&&!isNaN(s))return r===s;console.error(`couldn't convert ${i} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=i.split(" ").sort(),s=e.split(" ").sort();if(r.length===2&&s.length===2)return t==="pair"&&(r.sort(),s.sort()),r.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${i} 2: ${e}`);break}}return!1}};var rt=class extends C{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):k.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};n([u({type:String})],rt.prototype,"toleranceMode",2);customElements.define("qti-equal",rt);var xt=class extends C{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",xt);var Et=class extends ${getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Et);var Ct=class extends C{getResult(){if(this.children.length===1){let i=this.getVariables();if(!i)return!0;let e=i[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",Ct);var qt=class extends C{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",qt);var wt=class extends ${getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",wt);var it=class extends C{getResult(){let i=this.context.variables.find(s=>s.identifier===this.identifier);if(!i||!i.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=i.mapping,t=Array.isArray(i.value)?i.value:[i.value],r=0;for(let s of t){let a=e.mapEntries.filter(l=>i.baseType==="string"&&!l.caseSensitive?k.compareSingleValues(l.mapKey.toLowerCase(),s.toLowerCase(),i.baseType):k.compareSingleValues(l.mapKey,s,i.baseType)),o=a.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,a.length>0?a[0]:{mapKey:null,mappedValue:null});o===null||o.mappedValue==null?r+=e.defaultValue:r+=o.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(r=Math.max(e.lowerBound,r)),e?.upperBound!==null&&e?.upperBound!==void 0&&(r=Math.min(e.upperBound,r)),r}};n([u({type:String})],it.prototype,"identifier",2);customElements.define("qti-map-response",it);var G=class extends y{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 t=e.getAttribute("identifier")||"";return this.context.variables.find(s=>s.identifier===t)||null}case"qti-multiple":{let r=e.getResult();return r.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(s=>s.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.context.variables.find(s=>s.identifier===t)||null;return{baseType:r.baseType,value:r.correctResponse,cardinality:r.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 h`<pre>${JSON.stringify(this.result,null,2)}</pre>
1439
+ <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};G.styles=g`
1440
+ slot {
1441
+ display: none;
1442
+ }
1443
+ `,n([x()],G.prototype,"result",2),n([S({context:T,subscribe:!0}),x()],G.prototype,"context",2);var st=class extends G{getResult(){let i=this.context.variables.find(a=>a.identifier===this.identifier);if(!i)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=i.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(i.value)?i.value:[i.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,s=new Set;for(let a of t)for(let o of e.areaMapEntries){if(s.has(o.coords))continue;k.isPointInArea(a,`${o.shape},${o.coords}`,i.baseType)&&(r+=o.mappedValue??0,s.add(o.coords))}return s.size<t.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};n([u({type:String})],st.prototype,"identifier",2);customElements.define("qti-map-response-point",st);var Mt=class p extends C{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return p.match(e,t)}return console.error("unexpected number of children in match"),null}static match(i,e){switch(e.cardinality){case"single":return i.value===null?!1:Array.isArray(i.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):k.compareSingleValues(i.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(i.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(i.value.length!==e.value.length)return!1;for(let t=0;t<i.value.length;t++)if(!k.compareSingleValues(e.value[t],i.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(i.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(i.value.length!==e.value.length)return!1;let t=0;for(let r of e.value){let s=null,a=[...i.value];for(let o of a)if(k.compareSingleValues(r,o,e.baseType)){s=o;break}if(s!==null)a.splice(a.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",Mt);var Tt=class extends C{getResult(){let i=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let r=e.value;return t.value.includes(r)}};customElements.define("qti-member",Tt);var Rt=class extends C{getResult(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return i}};customElements.define("qti-multiple",Rt);var St=class extends C{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",St);var _t=class extends ${getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate(),s=!1;if(typeof r=="string")if(r==="true")s=!0;else if(r==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(s=r);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",_t);var kt=class extends C{getResult(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return i}};customElements.define("qti-ordered",kt);var Be=class extends y{render(){let i=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return i===null?_:h`${JSON.stringify(i,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};n([u({type:String})],Be.prototype,"identifier",2),n([S({context:T,subscribe:!0}),x()],Be.prototype,"context",2);customElements.define("qti-printed-variable",Be);var At=class extends C{getResult(){return this.getVariables().reduce((t,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return t*parseInt(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return t},1)}};customElements.define("qti-product",At);var ot=class extends gr(C){getResult(){return this.calculateChildren(Array.from(this.children))}};function gr(p){return class extends p{calculateChildren(e){let t=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",ot);var nt=class extends C{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),a=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return k.compareSingleValues(s,a,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};n([u({type:String,attribute:"case-sensitive"})],nt.prototype,"caseSensitive",2);customElements.define("qti-string-match",nt);var Lt=class extends C{constructor(){super(),this._expression=new Vt(Array.from(this.children))}getResult(){return this._expression.calculate()}},Vt=class{constructor(i){this.expressions=i}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let t=e.calculate();return Number.isNaN(t)?(console.error("unexpected value in qti-sum, expected number"),null):Number(t)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",Lt);var Dt=class extends C{getResult(){let i=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===i).value}};customElements.define("qti-variable",Dt);var It=class extends C{getResult(){let i=this.getVariables();if(i.length===1){let e=i[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",It);var $t=class extends G{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):i[0].baseType!==i[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}}};customElements.define("qti-delete",$t);var at=class extends y{render(){return h`<slot></slot>`}};at=n([m("qti-content-body")],at);var F=class extends y{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return h`<slot></slot>`}};F.styles=g`
1444
+ :host {
1445
+ display: block;
1446
+ }
1447
+ `,n([u({type:String})],F.prototype,"id",2),n([u({type:String})],F.prototype,"use",2),n([u({type:String})],F.prototype,"view",2),n([u({type:String,attribute:"class"})],F.prototype,"classNames",2),n([R("classNames",{waitUntilFirstUpdate:!0})],F.prototype,"handleclassNamesChange",1),F=n([m("qti-rubric-block")],F);var lt=class extends y{constructor(){super(...arguments);this.styleElement=null}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(r=>r.text()).then(r=>{let s=this.minifyCss(r);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${s}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};lt=n([m("qti-stylesheet")],lt);var oe=class extends y{render(){return h`<slot></slot>`}defaultValues(i){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(r=>r.innerHTML.trim());return t.length>1||i.cardinality==="multiple"||i.cardinality==="ordered"?t:t[0]}};oe=n([m("qti-variabledeclaration")],oe);var U=class extends oe{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return h`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let s=parseInt(r.getAttribute("source-value")),a=parseInt(r.getAttribute("target-value"));(isNaN(s)||isNaN(a))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(s,a)}return t}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};e.value=this.defaultValues(e),(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};U.styles=[g`
1448
+ :host {
1449
+ display: none;
1450
+ }
1451
+ `],n([u({type:String,attribute:"base-type"})],U.prototype,"baseType",2),n([u({type:String,attribute:"external-scored"})],U.prototype,"externalScored",2),n([u({type:String})],U.prototype,"identifier",2),n([u({type:String})],U.prototype,"cardinality",2),n([S({context:T,subscribe:!0}),x()],U.prototype,"itemContext",2),U=n([m("qti-outcome-declaration")],U);var K=class extends oe{render(){let i=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return h`${JSON.stringify(i,null,2)}`}connectedCallback(){super.connectedCallback();let i={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,areaMapping:this.areaMapping,value:null,type:"response",candidateResponse:null};i.value=this.defaultValues(i),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}get correctResponse(){let i,e=this.querySelector("qti-correct-response");if(e){let t=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&t.length>0)i=t[0].textContent.trim(),t[0].remove();else if(this.cardinality!=="single"){i=[];for(let r=0;r<t.length;r++)i.push(t[r].textContent.trim()),t[r].remove()}}return i}get mapping(){let i=this.querySelector("qti-mapping"),e=parseInt(i?.getAttribute("lower-bound")),t=parseInt(i?.getAttribute("upper-bound"));return{defaultValue:Number(i?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(t)?null:t,mapEntries:Array.from(i?.querySelectorAll("qti-map-entry")||[]).map(s=>({mapKey:s.getAttribute("map-key")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,caseSensitive:s.hasAttribute("case-sensitive")?s.getAttribute("case-sensitive")!=="false":!0}))}}get areaMapping(){let i=this.querySelector("qti-area-mapping"),e=Number(i?.getAttribute("default-value"))||0,t=parseInt(i?.getAttribute("lower-bound")),r=parseInt(i?.getAttribute("upper-bound")),s=Array.from(i?.querySelectorAll("qti-area-map-entry")||[]).map(a=>({shape:a.getAttribute("shape")||"default",coords:a.getAttribute("coords")||"",mappedValue:Number(a.getAttribute("mapped-value"))||0,defaultValue:Number(a.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(t)?null:t,upperBound:isNaN(r)?null:r,areaMapEntries:s}}};K.styles=[g`
1452
+ :host {
1453
+ display: none;
1454
+ }
1455
+ `],n([u({type:String,attribute:"base-type"})],K.prototype,"baseType",2),n([u({type:String})],K.prototype,"identifier",2),n([u({type:String})],K.prototype,"cardinality",2),n([S({context:T,subscribe:!0}),x()],K.prototype,"itemContext",2),K=n([m("qti-response-declaration")],K);export{L as a,me as b,Je as c,Ce as d,we as e,Me as f,Te as g,Re as h,fe as i,ge as j,B as k,te as l,A as m,be as n,Se as o,ve as p,ye as q,P as r,_e as s,ke as t,le as u,Ae as v,Ge as w,Le as x,ie as y,De as z,se as A,j as B,Ie as C,X as D,I as E,Ke as F,$e as G,Y as H,W as I,J,D as K,He as L,Ne as M,Oe as N,ht as O,Ze as P,Pe as Q,z as R,ze as S,mt as T,ft as U,gt as V,Fe as W,Ue as X,bt as Y,Qe as Z,fr as _,et as $,vt as aa,yt as ba,tt as ca,rt as da,xt as ea,Et as fa,Ct as ga,qt as ha,wt as ia,it as ja,st as ka,Mt as la,Tt as ma,Rt as na,St as oa,_t as pa,kt as qa,Be as ra,At as sa,ot as ta,gr as ua,nt as va,Lt as wa,Vt as xa,Dt as ya,It as za,$t as Aa,at as Ba,F as Ca,lt as Da,U as Ea,K as Fa};
1456
+ /*! Bundled license information:
1457
+
1458
+ lit-html/node/directives/if-defined.js:
1459
+ (**
1460
+ * @license
1461
+ * Copyright 2018 Google LLC
1462
+ * SPDX-License-Identifier: BSD-3-Clause
1463
+ *)
1464
+
1465
+ lit-html/node/directives/repeat.js:
1466
+ (**
1467
+ * @license
1468
+ * Copyright 2017 Google LLC
1469
+ * SPDX-License-Identifier: BSD-3-Clause
1470
+ *)
1471
+
1472
+ lit-html/node/directives/unsafe-html.js:
1473
+ (**
1474
+ * @license
1475
+ * Copyright 2017 Google LLC
1476
+ * SPDX-License-Identifier: BSD-3-Clause
1477
+ *)
1478
+
1479
+ lit-html/node/directives/style-map.js:
1480
+ (**
1481
+ * @license
1482
+ * Copyright 2018 Google LLC
1483
+ * SPDX-License-Identifier: BSD-3-Clause
1484
+ *)
1485
+
1486
+ lit-html/node/directives/ref.js:
1487
+ (**
1488
+ * @license
1489
+ * Copyright 2020 Google LLC
1490
+ * SPDX-License-Identifier: BSD-3-Clause
1491
+ *)
1492
+ */