@intellectif/lk-react 23.0.1 → 23.1.1

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 (369) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +13 -9
  3. package/dist/ActivityErrorBoundary-B379hvtL.cjs +39 -0
  4. package/dist/ActivityErrorBoundary-B379hvtL.cjs.map +1 -0
  5. package/dist/ActivityErrorBoundary-Dw6SbWv3.js +34 -0
  6. package/dist/ActivityErrorBoundary-Dw6SbWv3.js.map +1 -0
  7. package/dist/ActivityMedia-CQQTRNl7.cjs +641 -0
  8. package/dist/ActivityMedia-CQQTRNl7.cjs.map +1 -0
  9. package/dist/ActivityMedia-vDiP-Psa.js +636 -0
  10. package/dist/ActivityMedia-vDiP-Psa.js.map +1 -0
  11. package/dist/ActivityPreview-1hhTkYuj.js +240 -0
  12. package/dist/ActivityPreview-1hhTkYuj.js.map +1 -0
  13. package/dist/ActivityPreview-BKr34exz.cjs +245 -0
  14. package/dist/ActivityPreview-BKr34exz.cjs.map +1 -0
  15. package/dist/ActivitySequence-CkX87pfB.js +839 -0
  16. package/dist/ActivitySequence-CkX87pfB.js.map +1 -0
  17. package/dist/ActivitySequence-CmoSyDnp.cjs +844 -0
  18. package/dist/ActivitySequence-CmoSyDnp.cjs.map +1 -0
  19. package/dist/Dictation-BlxRp-3k.js +926 -0
  20. package/dist/Dictation-BlxRp-3k.js.map +1 -0
  21. package/dist/Dictation-jECzL88E.cjs +931 -0
  22. package/dist/Dictation-jECzL88E.cjs.map +1 -0
  23. package/dist/FeedbackRegion-BNNMtTY-.cjs +108 -0
  24. package/dist/FeedbackRegion-BNNMtTY-.cjs.map +1 -0
  25. package/dist/FeedbackRegion-CyPSp8bA.js +85 -0
  26. package/dist/FeedbackRegion-CyPSp8bA.js.map +1 -0
  27. package/dist/FillInTheBlanks-B6xzqYXx.js +474 -0
  28. package/dist/FillInTheBlanks-B6xzqYXx.js.map +1 -0
  29. package/dist/FillInTheBlanks-BpKhdHg2.cjs +479 -0
  30. package/dist/FillInTheBlanks-BpKhdHg2.cjs.map +1 -0
  31. package/dist/GapSelect-DUSiaEQH.js +441 -0
  32. package/dist/GapSelect-DUSiaEQH.js.map +1 -0
  33. package/dist/GapSelect-payTq_Zn.cjs +446 -0
  34. package/dist/GapSelect-payTq_Zn.cjs.map +1 -0
  35. package/dist/InteractiveVideo-BguGv-HA.cjs +2955 -0
  36. package/dist/InteractiveVideo-BguGv-HA.cjs.map +1 -0
  37. package/dist/InteractiveVideo-Cg2jbU3j.js +2944 -0
  38. package/dist/InteractiveVideo-Cg2jbU3j.js.map +1 -0
  39. package/dist/LkAiProvider-DAPpA3PQ.d.cts +84 -0
  40. package/dist/LkAiProvider-DAPpA3PQ.d.cts.map +1 -0
  41. package/dist/LkAiProvider-QdEcIhoo.d.ts +84 -0
  42. package/dist/LkAiProvider-QdEcIhoo.d.ts.map +1 -0
  43. package/dist/LkIntlProvider-D_FdYXjQ.js +375 -0
  44. package/dist/LkIntlProvider-D_FdYXjQ.js.map +1 -0
  45. package/dist/LkIntlProvider-oi57lYB0.cjs +410 -0
  46. package/dist/LkIntlProvider-oi57lYB0.cjs.map +1 -0
  47. package/dist/MultipleChoice-COn5MtKY.cjs +433 -0
  48. package/dist/MultipleChoice-COn5MtKY.cjs.map +1 -0
  49. package/dist/MultipleChoice-Dra0_KYD.js +428 -0
  50. package/dist/MultipleChoice-Dra0_KYD.js.map +1 -0
  51. package/dist/PronunciationFeedback-DlMPGjkR.cjs +831 -0
  52. package/dist/PronunciationFeedback-DlMPGjkR.cjs.map +1 -0
  53. package/dist/PronunciationFeedback-Dxd6XPkO.js +772 -0
  54. package/dist/PronunciationFeedback-Dxd6XPkO.js.map +1 -0
  55. package/dist/ReadAloud-C8RhaUqV.js +1092 -0
  56. package/dist/ReadAloud-C8RhaUqV.js.map +1 -0
  57. package/dist/ReadAloud-akDehitT.cjs +1103 -0
  58. package/dist/ReadAloud-akDehitT.cjs.map +1 -0
  59. package/dist/StimulusPanel-BgzByfkb.js +74 -0
  60. package/dist/StimulusPanel-BgzByfkb.js.map +1 -0
  61. package/dist/StimulusPanel-b66gaN3i.cjs +79 -0
  62. package/dist/StimulusPanel-b66gaN3i.cjs.map +1 -0
  63. package/dist/ThemeProvider-BRN1tj4n.cjs +187 -0
  64. package/dist/ThemeProvider-BRN1tj4n.cjs.map +1 -0
  65. package/dist/ThemeProvider-C7K9iMLX.js +158 -0
  66. package/dist/ThemeProvider-C7K9iMLX.js.map +1 -0
  67. package/dist/ThemeProvider-CocC8ODJ.d.ts +62 -0
  68. package/dist/ThemeProvider-CocC8ODJ.d.ts.map +1 -0
  69. package/dist/ThemeProvider-DS4KOL86.d.cts +62 -0
  70. package/dist/ThemeProvider-DS4KOL86.d.cts.map +1 -0
  71. package/dist/WrittenResponse-Bj3eFmGl.cjs +491 -0
  72. package/dist/WrittenResponse-Bj3eFmGl.cjs.map +1 -0
  73. package/dist/WrittenResponse-Cl8G6nO_.js +486 -0
  74. package/dist/WrittenResponse-Cl8G6nO_.js.map +1 -0
  75. package/dist/ai/LkAiProvider.cjs +34 -14
  76. package/dist/ai/LkAiProvider.cjs.map +1 -1
  77. package/dist/ai/LkAiProvider.d.cts +2 -73
  78. package/dist/ai/LkAiProvider.d.ts +2 -73
  79. package/dist/ai/LkAiProvider.js +33 -2
  80. package/dist/ai/LkAiProvider.js.map +1 -1
  81. package/dist/ai/useAiHelp.cjs +7 -23
  82. package/dist/ai/useAiHelp.d.cts +198 -121
  83. package/dist/ai/useAiHelp.d.cts.map +1 -0
  84. package/dist/ai/useAiHelp.d.ts +198 -121
  85. package/dist/ai/useAiHelp.d.ts.map +1 -0
  86. package/dist/ai/useAiHelp.js +3 -6
  87. package/dist/components/ActivityPreview.cjs +3 -31
  88. package/dist/components/ActivityPreview.d.cts +2 -81
  89. package/dist/components/ActivityPreview.d.ts +2 -81
  90. package/dist/components/ActivityPreview.js +2 -22
  91. package/dist/components/ActivitySequence.cjs +3 -32
  92. package/dist/components/ActivitySequence.d.cts +2 -432
  93. package/dist/components/ActivitySequence.d.ts +2 -432
  94. package/dist/components/ActivitySequence.js +2 -23
  95. package/dist/components/Dictation.cjs +4 -23
  96. package/dist/components/Dictation.d.cts +2 -19
  97. package/dist/components/Dictation.d.ts +2 -19
  98. package/dist/components/Dictation.js +3 -14
  99. package/dist/components/FillInTheBlanks.cjs +4 -22
  100. package/dist/components/FillInTheBlanks.d.cts +2 -30
  101. package/dist/components/FillInTheBlanks.d.ts +2 -30
  102. package/dist/components/FillInTheBlanks.js +3 -13
  103. package/dist/components/GapSelect.cjs +4 -22
  104. package/dist/components/GapSelect.d.cts +2 -27
  105. package/dist/components/GapSelect.d.ts +2 -27
  106. package/dist/components/GapSelect.js +3 -13
  107. package/dist/components/InteractiveVideo.cjs +5 -34
  108. package/dist/components/InteractiveVideo.d.cts +3 -291
  109. package/dist/components/InteractiveVideo.d.ts +3 -291
  110. package/dist/components/InteractiveVideo.js +3 -21
  111. package/dist/components/MultipleChoice.cjs +4 -22
  112. package/dist/components/MultipleChoice.d.cts +2 -26
  113. package/dist/components/MultipleChoice.d.ts +2 -26
  114. package/dist/components/MultipleChoice.js +3 -13
  115. package/dist/components/PronunciationFeedback.cjs +4 -16
  116. package/dist/components/PronunciationFeedback.d.cts +2 -69
  117. package/dist/components/PronunciationFeedback.d.ts +2 -69
  118. package/dist/components/PronunciationFeedback.js +3 -7
  119. package/dist/components/ReadAloud.cjs +4 -22
  120. package/dist/components/ReadAloud.d.cts +7 -11
  121. package/dist/components/ReadAloud.d.cts.map +1 -0
  122. package/dist/components/ReadAloud.d.ts +7 -11
  123. package/dist/components/ReadAloud.d.ts.map +1 -0
  124. package/dist/components/ReadAloud.js +3 -13
  125. package/dist/components/StimulusPanel.cjs +3 -14
  126. package/dist/components/StimulusPanel.d.cts +2 -51
  127. package/dist/components/StimulusPanel.d.ts +2 -51
  128. package/dist/components/StimulusPanel.js +2 -5
  129. package/dist/components/WrittenResponse.cjs +4 -21
  130. package/dist/components/WrittenResponse.d.cts +3 -18
  131. package/dist/components/WrittenResponse.d.ts +3 -18
  132. package/dist/components/WrittenResponse.js +3 -12
  133. package/dist/direction-Dq0_HtA5.js +183 -0
  134. package/dist/direction-Dq0_HtA5.js.map +1 -0
  135. package/dist/direction-K1pj0HCA.cjs +200 -0
  136. package/dist/direction-K1pj0HCA.cjs.map +1 -0
  137. package/dist/hooks/useActivityState.cjs +28 -10
  138. package/dist/hooks/useActivityState.cjs.map +1 -1
  139. package/dist/hooks/useActivityState.d.cts +25 -24
  140. package/dist/hooks/useActivityState.d.cts.map +1 -0
  141. package/dist/hooks/useActivityState.d.ts +25 -24
  142. package/dist/hooks/useActivityState.d.ts.map +1 -0
  143. package/dist/hooks/useActivityState.js +28 -2
  144. package/dist/hooks/useActivityState.js.map +1 -1
  145. package/dist/hooks/useSpeechRecorder.cjs +5 -16
  146. package/dist/hooks/useSpeechRecorder.d.cts +2 -127
  147. package/dist/hooks/useSpeechRecorder.d.ts +2 -127
  148. package/dist/hooks/useSpeechRecorder.js +3 -3
  149. package/dist/hooks/useXAPI.cjs +126 -10
  150. package/dist/hooks/useXAPI.cjs.map +1 -1
  151. package/dist/hooks/useXAPI.d.cts +14 -14
  152. package/dist/hooks/useXAPI.d.cts.map +1 -0
  153. package/dist/hooks/useXAPI.d.ts +14 -14
  154. package/dist/hooks/useXAPI.d.ts.map +1 -0
  155. package/dist/hooks/useXAPI.js +126 -2
  156. package/dist/hooks/useXAPI.js.map +1 -1
  157. package/dist/i18n/LkIntlProvider.cjs +9 -32
  158. package/dist/i18n/LkIntlProvider.d.cts +34 -38
  159. package/dist/i18n/LkIntlProvider.d.cts.map +1 -0
  160. package/dist/i18n/LkIntlProvider.d.ts +34 -38
  161. package/dist/i18n/LkIntlProvider.d.ts.map +1 -0
  162. package/dist/i18n/LkIntlProvider.js +3 -3
  163. package/dist/index-2iDJohip.d.cts +90 -0
  164. package/dist/index-2iDJohip.d.cts.map +1 -0
  165. package/dist/index-BAqT5tXN.d.ts +90 -0
  166. package/dist/index-BAqT5tXN.d.ts.map +1 -0
  167. package/dist/index-BRbEfXgE.d.ts +78 -0
  168. package/dist/index-BRbEfXgE.d.ts.map +1 -0
  169. package/dist/index-BW7aA5eN.d.cts +25 -0
  170. package/dist/index-BW7aA5eN.d.cts.map +1 -0
  171. package/dist/index-BeiVd-qe.d.ts +124 -0
  172. package/dist/index-BeiVd-qe.d.ts.map +1 -0
  173. package/dist/index-C1KGpD1k.d.ts +49 -0
  174. package/dist/index-C1KGpD1k.d.ts.map +1 -0
  175. package/dist/index-C7cCHEze.d.cts +24 -0
  176. package/dist/index-C7cCHEze.d.cts.map +1 -0
  177. package/dist/index-CKTpYTCC.d.cts +49 -0
  178. package/dist/index-CKTpYTCC.d.cts.map +1 -0
  179. package/dist/index-CN3_TwDL.d.ts +28 -0
  180. package/dist/index-CN3_TwDL.d.ts.map +1 -0
  181. package/dist/index-CNoAqj5I.d.ts +16 -0
  182. package/dist/index-CNoAqj5I.d.ts.map +1 -0
  183. package/dist/index-CTlht6OV.d.cts +432 -0
  184. package/dist/index-CTlht6OV.d.cts.map +1 -0
  185. package/dist/index-CmgSzapt.d.cts +124 -0
  186. package/dist/index-CmgSzapt.d.cts.map +1 -0
  187. package/dist/index-D4WYDN_p.d.cts +28 -0
  188. package/dist/index-D4WYDN_p.d.cts.map +1 -0
  189. package/dist/index-DAJ6KK49.d.ts +25 -0
  190. package/dist/index-DAJ6KK49.d.ts.map +1 -0
  191. package/dist/index-DIiacP_z.d.cts +78 -0
  192. package/dist/index-DIiacP_z.d.cts.map +1 -0
  193. package/dist/index-DR0SOJig.d.ts +291 -0
  194. package/dist/index-DR0SOJig.d.ts.map +1 -0
  195. package/dist/index-DRMauOVH.d.ts +432 -0
  196. package/dist/index-DRMauOVH.d.ts.map +1 -0
  197. package/dist/index-bmmRfGad.d.cts +16 -0
  198. package/dist/index-bmmRfGad.d.cts.map +1 -0
  199. package/dist/index-n9PKZm7W.d.cts +291 -0
  200. package/dist/index-n9PKZm7W.d.cts.map +1 -0
  201. package/dist/index-zu9H7owf.d.ts +24 -0
  202. package/dist/index-zu9H7owf.d.ts.map +1 -0
  203. package/dist/index.cjs +118 -161
  204. package/dist/index.cjs.map +1 -1
  205. package/dist/index.d.cts +20 -24
  206. package/dist/index.d.ts +20 -24
  207. package/dist/index.js +84 -31
  208. package/dist/index.js.map +1 -1
  209. package/dist/theme/ThemeProvider.cjs +8 -28
  210. package/dist/theme/ThemeProvider.d.cts +2 -59
  211. package/dist/theme/ThemeProvider.d.ts +2 -59
  212. package/dist/theme/ThemeProvider.js +3 -3
  213. package/dist/theme/skin.css +46 -1
  214. package/dist/tries-CbbtZkdG.cjs +363 -0
  215. package/dist/{chunk-W6UMY7PF.cjs.map → tries-CbbtZkdG.cjs.map} +1 -1
  216. package/dist/tries-DTHSrLCm.js +310 -0
  217. package/dist/tries-DTHSrLCm.js.map +1 -0
  218. package/dist/types-BOQd93x3.d.cts +994 -0
  219. package/dist/types-BOQd93x3.d.cts.map +1 -0
  220. package/dist/types-HIrgF_mS.d.ts +994 -0
  221. package/dist/types-HIrgF_mS.d.ts.map +1 -0
  222. package/dist/useAiHelp-B-ccDL5Q.js +906 -0
  223. package/dist/useAiHelp-B-ccDL5Q.js.map +1 -0
  224. package/dist/useAiHelp-h9yOLFqt.cjs +995 -0
  225. package/dist/useAiHelp-h9yOLFqt.cjs.map +1 -0
  226. package/dist/useSpeechRecorder--O_f-xvt.cjs +720 -0
  227. package/dist/useSpeechRecorder--O_f-xvt.cjs.map +1 -0
  228. package/dist/useSpeechRecorder-DtAYvl02.d.cts +154 -0
  229. package/dist/useSpeechRecorder-DtAYvl02.d.cts.map +1 -0
  230. package/dist/useSpeechRecorder-DtAYvl02.d.ts +154 -0
  231. package/dist/useSpeechRecorder-DtAYvl02.d.ts.map +1 -0
  232. package/dist/useSpeechRecorder-zIi9Dlw8.js +709 -0
  233. package/dist/useSpeechRecorder-zIi9Dlw8.js.map +1 -0
  234. package/package.json +10 -11
  235. package/dist/WrittenResponse-CgRrjM4S.d.ts +0 -115
  236. package/dist/WrittenResponse-D2K1VW_V.d.cts +0 -115
  237. package/dist/ai/useAiHelp.cjs.map +0 -1
  238. package/dist/ai/useAiHelp.js.map +0 -1
  239. package/dist/chunk-2OP5YHRR.js +0 -543
  240. package/dist/chunk-2OP5YHRR.js.map +0 -1
  241. package/dist/chunk-2TW6WLBC.js +0 -80
  242. package/dist/chunk-2TW6WLBC.js.map +0 -1
  243. package/dist/chunk-4MXECBZT.js +0 -888
  244. package/dist/chunk-4MXECBZT.js.map +0 -1
  245. package/dist/chunk-54DX6SLS.cjs +0 -42
  246. package/dist/chunk-54DX6SLS.cjs.map +0 -1
  247. package/dist/chunk-6GQLCCGN.js +0 -858
  248. package/dist/chunk-6GQLCCGN.js.map +0 -1
  249. package/dist/chunk-6N43WDVG.js +0 -29
  250. package/dist/chunk-6N43WDVG.js.map +0 -1
  251. package/dist/chunk-6RIM5EQP.cjs +0 -393
  252. package/dist/chunk-6RIM5EQP.cjs.map +0 -1
  253. package/dist/chunk-7F2YQWMW.cjs +0 -553
  254. package/dist/chunk-7F2YQWMW.cjs.map +0 -1
  255. package/dist/chunk-B4JRBV56.cjs +0 -63
  256. package/dist/chunk-B4JRBV56.cjs.map +0 -1
  257. package/dist/chunk-B7JU52YQ.cjs +0 -437
  258. package/dist/chunk-B7JU52YQ.cjs.map +0 -1
  259. package/dist/chunk-C4PSJ3ZC.js +0 -329
  260. package/dist/chunk-C4PSJ3ZC.js.map +0 -1
  261. package/dist/chunk-CXIP7ERK.js +0 -389
  262. package/dist/chunk-CXIP7ERK.js.map +0 -1
  263. package/dist/chunk-DPNCCWOV.js +0 -395
  264. package/dist/chunk-DPNCCWOV.js.map +0 -1
  265. package/dist/chunk-DXFCYNST.js +0 -35
  266. package/dist/chunk-DXFCYNST.js.map +0 -1
  267. package/dist/chunk-DZ7VLLDQ.cjs +0 -891
  268. package/dist/chunk-DZ7VLLDQ.cjs.map +0 -1
  269. package/dist/chunk-E4UF4XZM.js +0 -29
  270. package/dist/chunk-E4UF4XZM.js.map +0 -1
  271. package/dist/chunk-ERV666AR.js +0 -435
  272. package/dist/chunk-ERV666AR.js.map +0 -1
  273. package/dist/chunk-FISEZBLF.cjs +0 -31
  274. package/dist/chunk-FISEZBLF.cjs.map +0 -1
  275. package/dist/chunk-HYOUMTPW.js +0 -597
  276. package/dist/chunk-HYOUMTPW.js.map +0 -1
  277. package/dist/chunk-HZIT24BK.js +0 -61
  278. package/dist/chunk-HZIT24BK.js.map +0 -1
  279. package/dist/chunk-IYGF7PZY.cjs +0 -2938
  280. package/dist/chunk-IYGF7PZY.cjs.map +0 -1
  281. package/dist/chunk-J2QIHZ3H.cjs +0 -27
  282. package/dist/chunk-J2QIHZ3H.cjs.map +0 -1
  283. package/dist/chunk-JMEZYYCE.js +0 -2935
  284. package/dist/chunk-JMEZYYCE.js.map +0 -1
  285. package/dist/chunk-K63VPFOV.cjs +0 -134
  286. package/dist/chunk-K63VPFOV.cjs.map +0 -1
  287. package/dist/chunk-KI6DJ5ZF.js +0 -495
  288. package/dist/chunk-KI6DJ5ZF.js.map +0 -1
  289. package/dist/chunk-MCO52PV5.js +0 -520
  290. package/dist/chunk-MCO52PV5.js.map +0 -1
  291. package/dist/chunk-MXZHL4U5.cjs +0 -860
  292. package/dist/chunk-MXZHL4U5.cjs.map +0 -1
  293. package/dist/chunk-NFGUJ52G.cjs +0 -336
  294. package/dist/chunk-NFGUJ52G.cjs.map +0 -1
  295. package/dist/chunk-O7MINPKZ.js +0 -431
  296. package/dist/chunk-O7MINPKZ.js.map +0 -1
  297. package/dist/chunk-OD65OZIW.cjs +0 -159
  298. package/dist/chunk-OD65OZIW.cjs.map +0 -1
  299. package/dist/chunk-OJGTJOWI.cjs +0 -20
  300. package/dist/chunk-OJGTJOWI.cjs.map +0 -1
  301. package/dist/chunk-PGAPZ6UE.cjs +0 -497
  302. package/dist/chunk-PGAPZ6UE.cjs.map +0 -1
  303. package/dist/chunk-PNNUPUH4.cjs +0 -82
  304. package/dist/chunk-PNNUPUH4.cjs.map +0 -1
  305. package/dist/chunk-QAZO3ANW.cjs +0 -433
  306. package/dist/chunk-QAZO3ANW.cjs.map +0 -1
  307. package/dist/chunk-RX3A6KIY.js +0 -17
  308. package/dist/chunk-RX3A6KIY.js.map +0 -1
  309. package/dist/chunk-SHDSOOBF.cjs +0 -826
  310. package/dist/chunk-SHDSOOBF.cjs.map +0 -1
  311. package/dist/chunk-SPSKDNEE.js +0 -824
  312. package/dist/chunk-SPSKDNEE.js.map +0 -1
  313. package/dist/chunk-TGTP5DKF.js +0 -234
  314. package/dist/chunk-TGTP5DKF.js.map +0 -1
  315. package/dist/chunk-U4KTOH7C.js +0 -22
  316. package/dist/chunk-U4KTOH7C.js.map +0 -1
  317. package/dist/chunk-U5VFJVQ2.js +0 -241
  318. package/dist/chunk-U5VFJVQ2.js.map +0 -1
  319. package/dist/chunk-UDCQTOVU.cjs +0 -523
  320. package/dist/chunk-UDCQTOVU.cjs.map +0 -1
  321. package/dist/chunk-UHKZXOXD.js +0 -128
  322. package/dist/chunk-UHKZXOXD.js.map +0 -1
  323. package/dist/chunk-UKUHVCZX.cjs +0 -599
  324. package/dist/chunk-UKUHVCZX.cjs.map +0 -1
  325. package/dist/chunk-VPU6UY4O.cjs +0 -55
  326. package/dist/chunk-VPU6UY4O.cjs.map +0 -1
  327. package/dist/chunk-W6UMY7PF.cjs +0 -251
  328. package/dist/chunk-WZ2TBXVB.cjs +0 -236
  329. package/dist/chunk-WZ2TBXVB.cjs.map +0 -1
  330. package/dist/chunk-XOR4MPEN.cjs +0 -31
  331. package/dist/chunk-XOR4MPEN.cjs.map +0 -1
  332. package/dist/chunk-XS6OYYVR.cjs +0 -397
  333. package/dist/chunk-XS6OYYVR.cjs.map +0 -1
  334. package/dist/chunk-XYJBRKBZ.js +0 -51
  335. package/dist/chunk-XYJBRKBZ.js.map +0 -1
  336. package/dist/chunk-YORQQXGO.js +0 -155
  337. package/dist/chunk-YORQQXGO.js.map +0 -1
  338. package/dist/components/ActivityPreview.cjs.map +0 -1
  339. package/dist/components/ActivityPreview.js.map +0 -1
  340. package/dist/components/ActivitySequence.cjs.map +0 -1
  341. package/dist/components/ActivitySequence.js.map +0 -1
  342. package/dist/components/Dictation.cjs.map +0 -1
  343. package/dist/components/Dictation.js.map +0 -1
  344. package/dist/components/FillInTheBlanks.cjs.map +0 -1
  345. package/dist/components/FillInTheBlanks.js.map +0 -1
  346. package/dist/components/GapSelect.cjs.map +0 -1
  347. package/dist/components/GapSelect.js.map +0 -1
  348. package/dist/components/InteractiveVideo.cjs.map +0 -1
  349. package/dist/components/InteractiveVideo.js.map +0 -1
  350. package/dist/components/MultipleChoice.cjs.map +0 -1
  351. package/dist/components/MultipleChoice.js.map +0 -1
  352. package/dist/components/PronunciationFeedback.cjs.map +0 -1
  353. package/dist/components/PronunciationFeedback.js.map +0 -1
  354. package/dist/components/ReadAloud.cjs.map +0 -1
  355. package/dist/components/ReadAloud.js.map +0 -1
  356. package/dist/components/StimulusPanel.cjs.map +0 -1
  357. package/dist/components/StimulusPanel.js.map +0 -1
  358. package/dist/components/WrittenResponse.cjs.map +0 -1
  359. package/dist/components/WrittenResponse.js.map +0 -1
  360. package/dist/hooks/useSpeechRecorder.cjs.map +0 -1
  361. package/dist/hooks/useSpeechRecorder.js.map +0 -1
  362. package/dist/i18n/LkIntlProvider.cjs.map +0 -1
  363. package/dist/i18n/LkIntlProvider.js.map +0 -1
  364. package/dist/machine-CuwKqWXC.d.cts +0 -26
  365. package/dist/machine-CuwKqWXC.d.ts +0 -26
  366. package/dist/theme/ThemeProvider.cjs.map +0 -1
  367. package/dist/theme/ThemeProvider.js.map +0 -1
  368. package/dist/types-CO0XLEN6.d.cts +0 -973
  369. package/dist/types-CrtIcRcK.d.ts +0 -973
@@ -1,826 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var chunkB4JRBV56_cjs = require('./chunk-B4JRBV56.cjs');
5
- var chunkXS6OYYVR_cjs = require('./chunk-XS6OYYVR.cjs');
6
- var chunkQAZO3ANW_cjs = require('./chunk-QAZO3ANW.cjs');
7
- var chunkPGAPZ6UE_cjs = require('./chunk-PGAPZ6UE.cjs');
8
- var chunkB7JU52YQ_cjs = require('./chunk-B7JU52YQ.cjs');
9
- var chunkMXZHL4U5_cjs = require('./chunk-MXZHL4U5.cjs');
10
- var chunkDZ7VLLDQ_cjs = require('./chunk-DZ7VLLDQ.cjs');
11
- var chunkJ2QIHZ3H_cjs = require('./chunk-J2QIHZ3H.cjs');
12
- var chunk54DX6SLS_cjs = require('./chunk-54DX6SLS.cjs');
13
- var chunkNFGUJ52G_cjs = require('./chunk-NFGUJ52G.cjs');
14
- var lkCore = require('@intellectif/lk-core');
15
- var react = require('react');
16
- var jsxRuntime = require('react/jsx-runtime');
17
-
18
- function slotKeyOf(setKey, slot) {
19
- return `${setKey}::slot-${slot.slotId}-${slot.activity.id}`;
20
- }
21
- function entryKeyOf(slot) {
22
- return slot.slotId.split(".")[0] ?? slot.slotId;
23
- }
24
- var captureScopeCount = 0;
25
- function SequencePane({
26
- className,
27
- hidden,
28
- channel,
29
- children
30
- }) {
31
- const ref = react.useRef(null);
32
- const captureGroup = channel?.captureGroup;
33
- react.useEffect(() => {
34
- if (!hidden) {
35
- return;
36
- }
37
- if (captureGroup !== void 0) {
38
- chunkDZ7VLLDQ_cjs.stopCaptureGroup(captureGroup);
39
- }
40
- const node = ref.current;
41
- if (node === null) {
42
- return;
43
- }
44
- for (const media of node.querySelectorAll("audio, video")) {
45
- const element = media;
46
- if (!element.paused) {
47
- element.pause();
48
- }
49
- }
50
- }, [hidden, captureGroup]);
51
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, hidden, ref, children: channel === void 0 ? children : /* @__PURE__ */ jsxRuntime.jsx(chunkJ2QIHZ3H_cjs.SequenceSlotContext.Provider, { value: channel, children }) });
52
- }
53
- function shufflesItsOwnOptions(entry) {
54
- const item = entry;
55
- return item?.shuffle === true || item?.shuffleChoices === true;
56
- }
57
- function ActivitySequence({
58
- activities,
59
- renderers,
60
- onActivityComplete,
61
- onComplete,
62
- onFinished,
63
- onSubmit,
64
- onInteraction,
65
- renderMode = "practice",
66
- shuffle,
67
- shuffleSeed,
68
- defaultIndex,
69
- onIndexChange,
70
- responses,
71
- submittedSlotIds,
72
- outcomes,
73
- sanitizeHtml,
74
- theme,
75
- locale,
76
- disabled,
77
- mediaBudget,
78
- recordingBinding,
79
- assessments,
80
- workletUrl,
81
- strings,
82
- ai,
83
- delivery,
84
- scoring
85
- }) {
86
- const sessionIdRef = react.useRef(null);
87
- const s = chunkNFGUJ52G_cjs.useLkStrings(strings);
88
- const mediaPlays = mediaBudget?.plays;
89
- const [captureScope] = react.useState(() => {
90
- captureScopeCount += 1;
91
- return `lk-seq-capture-${captureScopeCount}`;
92
- });
93
- const shuffleEntries = shuffle === "entries";
94
- const needsSeed = shuffleEntries || activities.some(
95
- (entry) => lkCore.isItemGroup(entry) ? entry.shuffle === "within-group" || entry.items.some(shufflesItsOwnOptions) : shufflesItsOwnOptions(entry)
96
- );
97
- if (needsSeed && shuffleSeed === void 0 && renderMode !== "practice") {
98
- throw new Error(
99
- `ActivitySequence: renderMode "${renderMode}" requires a \`shuffleSeed\` when anything in the sequence shuffles: shuffle="entries", a group with shuffle: "within-group", or an activity's own \`data.shuffle\` (multiple choice) or \`data.shuffleChoices\` (gap select), including an activity inside a group. Pass the attempt id, so the server can rebuild every order the learner saw from that one seed.`
100
- );
101
- }
102
- const seed = needsSeed ? (
103
- // biome-ignore lint/suspicious/noAssignInExpressions: sanctioned lazy ref initialization
104
- shuffleSeed ?? (sessionIdRef.current ??= chunk54DX6SLS_cjs.randomSessionId())
105
- ) : void 0;
106
- const slots = react.useMemo(
107
- () => lkCore.flattenSequence(activities, { shuffleEntries, ...seed !== void 0 ? { seed } : {} }),
108
- [activities, shuffleEntries, seed]
109
- );
110
- const [index, setIndex] = react.useState(() => {
111
- const requested = Math.trunc(defaultIndex ?? 0);
112
- if (!Number.isFinite(requested)) {
113
- return 0;
114
- }
115
- return Math.min(Math.max(0, requested), Math.max(0, slots.length - 1));
116
- });
117
- const outcomesRef = react.useRef(null);
118
- const outcomeSlotsRef = react.useRef(null);
119
- const takesRef = react.useRef(/* @__PURE__ */ new Map());
120
- const setGenerationRef = react.useRef(0);
121
- const indexRef = react.useRef(index);
122
- const reportedRef = react.useRef(false);
123
- const channelsRef = react.useRef(/* @__PURE__ */ new Map());
124
- const callsRef = react.useRef(/* @__PURE__ */ new Map());
125
- const hostPendingRef = react.useRef(/* @__PURE__ */ new Set());
126
- const [portals, setPortals] = react.useState(() => /* @__PURE__ */ new Map());
127
- const portalRefsRef = react.useRef(/* @__PURE__ */ new Map());
128
- const modeRef = react.useRef(renderMode);
129
- modeRef.current = renderMode;
130
- const deliveryRef = react.useRef(lkCore.resolveDeliveryPolicy(delivery));
131
- deliveryRef.current = lkCore.resolveDeliveryPolicy(delivery);
132
- const scoringKey = JSON.stringify(scoring ?? null);
133
- const scoringInForce = react.useMemo(
134
- () => scoring === void 0 || scoring === null ? void 0 : lkCore.resolveItemScoringPolicy(scoring),
135
- [scoringKey]
136
- );
137
- const scoringRef = react.useRef(scoringInForce);
138
- scoringRef.current = scoringInForce;
139
- const [, setReported] = react.useState(false);
140
- const triesRef = react.useRef(/* @__PURE__ */ new Map());
141
- const triedRef = react.useRef(/* @__PURE__ */ new Map());
142
- const latestRef = react.useRef(null);
143
- const aliveRef = react.useRef(true);
144
- react.useEffect(() => {
145
- aliveRef.current = true;
146
- return () => {
147
- aliveRef.current = false;
148
- };
149
- }, []);
150
- if (outcomesRef.current === null) {
151
- const submittedAtMount = new Set(submittedSlotIds ?? []);
152
- outcomesRef.current = slots.map(
153
- (slot) => submittedAtMount.has(slot.slotId) ? {
154
- kind: "restored",
155
- index: slot.index,
156
- slotId: slot.slotId,
157
- activityId: slot.activity.id,
158
- ...responses !== void 0 && Object.hasOwn(responses, slot.slotId) ? { response: responses[slot.slotId] } : {}
159
- } : null
160
- );
161
- outcomeSlotsRef.current = slots;
162
- }
163
- const regionRef = react.useRef(null);
164
- const mountedRef = react.useRef(false);
165
- const setKey = JSON.stringify(slots.map((slot) => [slot.slotId, slot.activity.id]));
166
- const [prevSetKey, setPrevSetKey] = react.useState(setKey);
167
- const seedKey = `${setKey}::${mediaBudget?.resumeKey ?? ""}`;
168
- const mountSetKeyRef = react.useRef(setKey);
169
- const mountSeedKeyRef = react.useRef(seedKey);
170
- const seedsApply = mountSetKeyRef.current === setKey;
171
- const mediaSeedsApply = mountSeedKeyRef.current === seedKey || seedsApply;
172
- if (mountSeedKeyRef.current !== seedKey) {
173
- mountSeedKeyRef.current = seedKey;
174
- }
175
- const submitted = react.useMemo(() => new Set(submittedSlotIds ?? []), [submittedSlotIds]);
176
- if (prevSetKey !== setKey) {
177
- setPrevSetKey(setKey);
178
- setIndex(0);
179
- indexRef.current = 0;
180
- outcomesRef.current = slots.map(() => null);
181
- outcomeSlotsRef.current = slots;
182
- takesRef.current = /* @__PURE__ */ new Map();
183
- setGenerationRef.current += 1;
184
- channelsRef.current = /* @__PURE__ */ new Map();
185
- callsRef.current = /* @__PURE__ */ new Map();
186
- hostPendingRef.current = /* @__PURE__ */ new Set();
187
- portalRefsRef.current = /* @__PURE__ */ new Map();
188
- reportedRef.current = false;
189
- triesRef.current = /* @__PURE__ */ new Map();
190
- triedRef.current = /* @__PURE__ */ new Map();
191
- setReported(false);
192
- }
193
- const setGeneration = setGenerationRef.current;
194
- react.useEffect(() => {
195
- if (mountedRef.current) {
196
- regionRef.current?.focus();
197
- } else {
198
- mountedRef.current = true;
199
- }
200
- }, [index]);
201
- const reportedIndexRef = react.useRef(null);
202
- react.useEffect(() => {
203
- if (reportedIndexRef.current === index) {
204
- return;
205
- }
206
- const first = reportedIndexRef.current === null;
207
- reportedIndexRef.current = index;
208
- if (first && index === Math.trunc(defaultIndex ?? 0)) {
209
- return;
210
- }
211
- onIndexChange?.(index);
212
- }, [index, defaultIndex, onIndexChange]);
213
- react.useEffect(() => {
214
- if (indexRef.current === index) {
215
- return;
216
- }
217
- indexRef.current = index;
218
- latestRef.current?.reportIfFinished();
219
- }, [index]);
220
- const stimulusMounts = react.useMemo(() => {
221
- const mounts = /* @__PURE__ */ new Map();
222
- for (const slot of slots) {
223
- if (slot.group === void 0) {
224
- continue;
225
- }
226
- const entryKey = entryKeyOf(slot);
227
- const existing = mounts.get(entryKey);
228
- if (existing === void 0) {
229
- mounts.set(entryKey, { entryKey, group: slot.group, first: slot.index, last: slot.index });
230
- } else {
231
- existing.last = slot.index;
232
- }
233
- }
234
- return [...mounts.values()];
235
- }, [slots]);
236
- const total = slots.length;
237
- const current = slots[index];
238
- const go = (next) => {
239
- setIndex(next);
240
- };
241
- const reportIfFinished = () => {
242
- const held = outcomesRef.current;
243
- const presented = outcomeSlotsRef.current;
244
- if (held === null || presented === null || reportedRef.current) {
245
- return;
246
- }
247
- if (hostPendingRef.current.size > 0) {
248
- return;
249
- }
250
- for (const [at, state] of triesRef.current) {
251
- if (state === "retrying" || at === indexRef.current) {
252
- return;
253
- }
254
- }
255
- const items = [];
256
- for (const [at, outcome] of held.entries()) {
257
- const take = takesRef.current.get(at);
258
- if (take?.state === "in-flight" || take?.state === "retryable" && at === indexRef.current) {
259
- return;
260
- }
261
- const slot = presented[at];
262
- if (outcome !== null) {
263
- items.push(outcome);
264
- } else if (take?.state === "retryable" && renderMode === "practice" && slot !== void 0) {
265
- items.push({
266
- kind: "unsubmitted",
267
- index: at,
268
- slotId: slot.slotId,
269
- activityId: slot.activity.id
270
- });
271
- } else {
272
- return;
273
- }
274
- }
275
- reportedRef.current = true;
276
- setReported(true);
277
- onFinished?.(items);
278
- const scored = [];
279
- for (const item of items) {
280
- if (item.kind !== "scored") {
281
- return;
282
- }
283
- scored.push(item.result);
284
- }
285
- onComplete?.(scored);
286
- };
287
- const record = (outcome, generation, take, tried) => {
288
- const held = outcomesRef.current;
289
- if (held === null || generation !== setGenerationRef.current) {
290
- return;
291
- }
292
- const at = outcome.index;
293
- const holding = held[at];
294
- let accepted = outcome;
295
- if (tried !== void 0) {
296
- const latest = triedRef.current.get(at);
297
- if (holding?.kind === "restored") {
298
- return;
299
- }
300
- if (holding != null && (reportedRef.current || latest === void 0 || tried <= latest)) {
301
- return;
302
- }
303
- triedRef.current.set(at, tried);
304
- } else if (take === void 0) {
305
- if (holding != null) {
306
- return;
307
- }
308
- } else {
309
- if (holding?.kind === "restored") {
310
- return;
311
- }
312
- const latest = takesRef.current.get(at);
313
- if (outcome.kind === "responded") {
314
- if (latest !== void 0 && (take < latest.take || take === latest.take && latest.response !== void 0)) {
315
- return;
316
- }
317
- takesRef.current.set(at, {
318
- take,
319
- // A take this pager hears of first through its answer — a consumer's
320
- // renderer has no channel — has nothing on its way.
321
- state: latest?.take === take ? latest.state : "settled",
322
- response: outcome.response
323
- });
324
- } else if (outcome.kind === "scored") {
325
- if (latest?.take !== take || latest.response === void 0 || holding?.kind === "scored") {
326
- return;
327
- }
328
- accepted = { ...outcome, response: latest.response };
329
- } else {
330
- return;
331
- }
332
- }
333
- const next = held.slice();
334
- next[at] = accepted;
335
- outcomesRef.current = next;
336
- if (accepted.kind === "scored") {
337
- onActivityComplete?.(accepted.result, accepted.index, accepted.slotId);
338
- }
339
- reportIfFinished();
340
- };
341
- const submitSlot = (generation, at, response) => {
342
- if (generation !== setGenerationRef.current) {
343
- return;
344
- }
345
- onSubmit?.(response, { slotId: at.slotId, index: at.index, activityId: at.activityId });
346
- if (at.type === "written-response") {
347
- return;
348
- }
349
- if (renderMode !== "practice") {
350
- record(
351
- {
352
- kind: "responded",
353
- index: at.index,
354
- slotId: at.slotId,
355
- activityId: at.activityId,
356
- response
357
- },
358
- generation
359
- );
360
- return;
361
- }
362
- if (at.type === "read-aloud") {
363
- record(
364
- {
365
- kind: "responded",
366
- index: at.index,
367
- slotId: at.slotId,
368
- activityId: at.activityId,
369
- response
370
- },
371
- generation,
372
- chunkJ2QIHZ3H_cjs.takeOf(response) ?? chunkJ2QIHZ3H_cjs.mintTake()
373
- );
374
- }
375
- };
376
- const completeSlot = (generation, at, result) => {
377
- const takesAnswers = renderMode === "practice" && at.type === "read-aloud";
378
- const outcome = {
379
- kind: "scored",
380
- index: at.index,
381
- slotId: at.slotId,
382
- activityId: at.activityId,
383
- result
384
- };
385
- const tried = takesAnswers ? void 0 : chunkJ2QIHZ3H_cjs.takeOf(result);
386
- if (tried !== void 0 && renderMode === "practice") {
387
- record(outcome, generation, void 0, tried);
388
- return;
389
- }
390
- record(
391
- outcome,
392
- generation,
393
- // The take the grade is for: stamped by `<ReadAloud>`, and for a
394
- // consumer's renderer, which cannot stamp one, the slot's latest.
395
- takesAnswers ? chunkJ2QIHZ3H_cjs.takeOf(result) ?? takesRef.current.get(at.index)?.take : void 0
396
- );
397
- };
398
- const clearSlot = (generation, at) => {
399
- const held = outcomesRef.current;
400
- if (!aliveRef.current || held === null || generation !== setGenerationRef.current) {
401
- return;
402
- }
403
- takesRef.current.delete(at.index);
404
- if (held[at.index] == null) {
405
- return;
406
- }
407
- const next = held.slice();
408
- next[at.index] = null;
409
- outcomesRef.current = next;
410
- };
411
- const hostPending = (generation, at, pending) => {
412
- if (!aliveRef.current || generation !== setGenerationRef.current) {
413
- return;
414
- }
415
- const waiting = hostPendingRef.current;
416
- if (pending) {
417
- waiting.add(at.index);
418
- return;
419
- }
420
- if (!waiting.delete(at.index)) {
421
- return;
422
- }
423
- reportIfFinished();
424
- };
425
- const emitFor = (generation, at, type, payload) => {
426
- if (!aliveRef.current || generation !== setGenerationRef.current) {
427
- return;
428
- }
429
- onInteraction?.({
430
- type,
431
- activityId: at.activityId,
432
- timestamp: Date.now(),
433
- payload: payload ?? {}
434
- });
435
- };
436
- const updateTake = (generation, at, take, state) => {
437
- if (!aliveRef.current || generation !== setGenerationRef.current) {
438
- return;
439
- }
440
- const latest = takesRef.current.get(at);
441
- if (latest !== void 0 && take < latest.take) {
442
- return;
443
- }
444
- takesRef.current.set(at, latest?.take === take ? { ...latest, state } : { take, state });
445
- reportIfFinished();
446
- };
447
- const updateTries = (generation, at, state) => {
448
- if (!aliveRef.current || generation !== setGenerationRef.current) {
449
- return;
450
- }
451
- const was = triesRef.current.get(at);
452
- if (state === "none") {
453
- triesRef.current.delete(at);
454
- } else {
455
- triesRef.current.set(at, state);
456
- }
457
- if (was !== void 0 && was !== state) {
458
- reportIfFinished();
459
- }
460
- };
461
- latestRef.current = {
462
- updateTake,
463
- updateTries,
464
- reportIfFinished,
465
- submitSlot,
466
- completeSlot,
467
- clearSlot,
468
- hostPending,
469
- emit: emitFor
470
- };
471
- const callsFor = (slot) => {
472
- const key = `${slot.index}::${slot.slotId}`;
473
- let calls = callsRef.current.get(key);
474
- if (calls === void 0) {
475
- const generation = setGeneration;
476
- const at = {
477
- slotId: slot.slotId,
478
- index: slot.index,
479
- activityId: slot.activity.id,
480
- type: slot.activity.type
481
- };
482
- calls = {
483
- slot: { slotId: at.slotId, index: at.index, activityId: at.activityId },
484
- onSubmit: (response) => latestRef.current?.submitSlot(generation, at, response),
485
- onComplete: (result) => latestRef.current?.completeSlot(generation, at, result),
486
- clear: () => latestRef.current?.clearSlot(generation, at),
487
- setPending: (pending) => latestRef.current?.hostPending(generation, at, pending === true),
488
- emit: (type, payload) => latestRef.current?.emit(generation, at, type, payload)
489
- };
490
- callsRef.current.set(key, calls);
491
- }
492
- return calls;
493
- };
494
- const portalRefFor = (key) => {
495
- let callback = portalRefsRef.current.get(key);
496
- if (callback === void 0) {
497
- callback = (node) => {
498
- setPortals((held) => {
499
- if (node === null) {
500
- if (!held.has(key)) {
501
- return held;
502
- }
503
- const next2 = new Map(held);
504
- next2.delete(key);
505
- return next2;
506
- }
507
- if (held.get(key) === node) {
508
- return held;
509
- }
510
- const next = new Map(held);
511
- next.set(key, node);
512
- return next;
513
- });
514
- };
515
- portalRefsRef.current.set(key, callback);
516
- }
517
- return callback;
518
- };
519
- const channelFor = (slot) => {
520
- const key = `${slot.index}::${slot.slotId}`;
521
- let channel = channelsRef.current.get(key);
522
- if (channel === void 0) {
523
- const generation = setGeneration;
524
- const at = slot.index;
525
- channel = {
526
- captureGroup: `${captureScope}::${slot.slotId}`,
527
- // A getter, so the channel keeps the one identity a recorder joined
528
- // while still answering for the mode in force now.
529
- get renderMode() {
530
- return modeRef.current;
531
- },
532
- get delivery() {
533
- return deliveryRef.current;
534
- },
535
- get scoring() {
536
- return scoringRef.current;
537
- },
538
- get triesClosed() {
539
- return reportedRef.current;
540
- },
541
- triesState: (state) => {
542
- latestRef.current?.updateTries(generation, at, state);
543
- },
544
- takeState: (take, state) => {
545
- latestRef.current?.updateTake(generation, at, take, state);
546
- }
547
- };
548
- channelsRef.current.set(key, channel);
549
- }
550
- return channel;
551
- };
552
- if (!current) {
553
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lk-seq" });
554
- }
555
- const budgetedMedia = slots.flatMap((slot) => {
556
- const found = [];
557
- const own = slot.activity.media;
558
- if (own !== void 0 && lkCore.resolvePlaybackPolicy(own).maxPlays !== null) {
559
- found.push({ key: lkCore.slotMediaKey(slot.slotId), url: own.url });
560
- }
561
- const stimulus = slot.group?.stimulus.media;
562
- if (stimulus !== void 0 && lkCore.resolvePlaybackPolicy(stimulus).maxPlays !== null) {
563
- found.push({ key: lkCore.stimulusMediaKey(slot.slotId), url: stimulus.url });
564
- }
565
- return found;
566
- });
567
- const budgetEnforced = mediaBudget?.enforced ?? renderMode !== "review";
568
- if (budgetedMedia.length > 0 && renderMode === "exam" && budgetEnforced) {
569
- if (mediaBudget?.onPlayConsumed === void 0) {
570
- throw new Error(
571
- `ActivitySequence: renderMode "exam" with media that declares \`maxPlays\` requires \`mediaBudget.onPlayConsumed\`. The SDK persists nothing, so without it the count lives only in this mount: a refresh silently restores the full budget, and a paper that grants unlimited plays while showing "2 plays remaining" is indistinguishable \u2014 to the learner and to an appeal \u2014 from one that works. Budgeted media: ${[...new Set(budgetedMedia.map((m) => m.key))].join(", ")}.`
572
- );
573
- }
574
- const resuming = responses !== void 0 && Object.keys(responses).length > 0 || submittedSlotIds !== void 0 && submittedSlotIds.length > 0;
575
- if (resuming && mediaBudget.plays === void 0) {
576
- throw new Error(
577
- "ActivitySequence: this is a resumed attempt (`responses`/`submittedSlotIds` were supplied) but `mediaBudget.plays` is absent. A resume that omits the ledger hands the learner a fresh budget at exactly the moment it matters. Pass `restoreMediaPlayLedger(plan, stored).entries`, or `{}` to state explicitly that nothing was spent."
578
- );
579
- }
580
- }
581
- const keysByUrl = /* @__PURE__ */ new Map();
582
- for (const { key, url } of budgetedMedia) {
583
- const keys = keysByUrl.get(url) ?? /* @__PURE__ */ new Set();
584
- keys.add(key);
585
- keysByUrl.set(url, keys);
586
- }
587
- for (const [url, keys] of keysByUrl) {
588
- if (keys.size > 1) {
589
- throw new Error(
590
- `ActivitySequence: media ${JSON.stringify(url)} is budgeted under ${keys.size} separate keys (${[...keys].join(", ")}), so one recording grants ${keys.size} \xD7 maxPlays. Put the questions that share a recording in an item group \u2014 a group's stimulus is one recording with one budget.`
591
- );
592
- }
593
- }
594
- const bindingFor = (key, slot) => {
595
- if (mediaBudget === void 0) {
596
- return void 0;
597
- }
598
- const entry = mediaSeedsApply && mediaPlays !== void 0 && Object.hasOwn(mediaPlays, key) ? mediaPlays[key] : void 0;
599
- return {
600
- key,
601
- slotId: slot.slotId,
602
- index: slot.index,
603
- activityId: slot.activity.id,
604
- ...entry !== void 0 ? { entry } : {},
605
- ...mediaBudget.enforced !== void 0 ? { enforced: mediaBudget.enforced } : {},
606
- ...mediaBudget.onPlayConsumed !== void 0 ? { onPlayConsumed: mediaBudget.onPlayConsumed } : {},
607
- ...mediaBudget.onPlayRefunded !== void 0 ? { onPlayRefunded: mediaBudget.onPlayRefunded } : {},
608
- ...mediaBudget.onPosition !== void 0 ? { onPosition: mediaBudget.onPosition } : {},
609
- ...mediaBudget.strings !== void 0 ? { strings: mediaBudget.strings } : {}
610
- };
611
- };
612
- const recordingBindingFor = (slot) => {
613
- if (recordingBinding === void 0) {
614
- return void 0;
615
- }
616
- const at = {
617
- slotId: slot.slotId,
618
- index: slot.index,
619
- activityId: slot.activity.id
620
- };
621
- const { assess, playbackUrl } = recordingBinding;
622
- return {
623
- upload: (take) => recordingBinding.upload(take, at),
624
- ...assess !== void 0 ? { assess: (ref) => assess.call(recordingBinding, ref, at) } : {},
625
- ...playbackUrl !== void 0 ? { playbackUrl: (ref) => playbackUrl.call(recordingBinding, ref, at) } : {}
626
- };
627
- };
628
- const forwarded = {
629
- ...onInteraction ? { onInteraction } : {},
630
- renderMode,
631
- ...sanitizeHtml ? { sanitizeHtml } : {},
632
- ...strings !== void 0 ? { strings } : {},
633
- // Handed to no question in `exam`, where none gives AI help: a
634
- // `renderers` override is not given ports it must then know to ignore.
635
- ...ai !== void 0 && renderMode !== "exam" ? { ai } : {},
636
- // As given: each question combines it with the paper's through its
637
- // channel, so what it is handed and what holds cannot disagree.
638
- ...delivery !== void 0 && delivery !== null ? { delivery } : {},
639
- // As given, for a `renderers` override to score by. The SDK's own questions
640
- // read the paper's from their channel, which wins over it.
641
- ...scoring !== void 0 && scoring !== null ? { scoring } : {},
642
- ...theme ? { theme } : {},
643
- ...locale ? { locale } : {},
644
- ...disabled ? { disabled } : {}
645
- };
646
- const renderSlot = (slot) => {
647
- const activity = slot.activity;
648
- const { slotId, index: slotIndex } = slot;
649
- const activityId = activity.id;
650
- const restored = seedsApply && responses !== void 0 && Object.hasOwn(responses, slotId) ? responses[slotId] : void 0;
651
- const slotOutcome = outcomes !== void 0 && Object.hasOwn(outcomes, slotId) ? outcomes[slotId] : void 0;
652
- const slotBinding = bindingFor(lkCore.slotMediaKey(slotId), slot);
653
- const calls = callsFor(slot);
654
- const childProps = {
655
- // `defaultValue`, not `value`: the learner must be able to keep editing
656
- // a restored answer. A controlled `value` would freeze it unless the
657
- // consumer also threaded state back, which is not what resume means.
658
- ...restored !== void 0 ? { defaultValue: restored } : {},
659
- ...seedsApply && submitted.has(slotId) ? { defaultSubmitted: true } : {},
660
- ...slotOutcome !== void 0 ? { outcome: slotOutcome } : {},
661
- // One identity per slot for the life of the set — see `callsFor`. Their
662
- // bodies are `submitSlot` and `completeSlot`, the same ones a host's own
663
- // renderer calls, so a question the host draws is recorded exactly as one
664
- // the SDK draws.
665
- onComplete: calls.onComplete,
666
- onSubmit: calls.onSubmit,
667
- ...forwarded,
668
- ...slotBinding !== void 0 ? { mediaBudget: slotBinding } : {}
669
- };
670
- const CustomRenderer = renderers?.[activity.type];
671
- if (CustomRenderer) {
672
- const portalKey = slotKeyOf(setKey, slot);
673
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
674
- /* @__PURE__ */ jsxRuntime.jsx(
675
- CustomRenderer,
676
- {
677
- data: activity,
678
- ...childProps,
679
- question: {
680
- slot: calls.slot,
681
- active: slotIndex === index,
682
- portalContainer: portals.get(portalKey) ?? null,
683
- clear: calls.clear,
684
- setPending: calls.setPending,
685
- emit: calls.emit
686
- }
687
- }
688
- ),
689
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lk-seq-portal", ref: portalRefFor(portalKey) })
690
- ] });
691
- }
692
- if (activity.type === "multiple-choice") {
693
- return /* @__PURE__ */ jsxRuntime.jsx(
694
- chunkQAZO3ANW_cjs.MultipleChoice,
695
- {
696
- data: activity,
697
- ...shuffleSeed !== void 0 ? { shuffleSeed } : {},
698
- ...childProps
699
- }
700
- );
701
- }
702
- if (activity.type === "fill-in-the-blanks") {
703
- return /* @__PURE__ */ jsxRuntime.jsx(chunkPGAPZ6UE_cjs.FillInTheBlanks, { data: activity, ...childProps });
704
- }
705
- if (activity.type === "gap-select") {
706
- return /* @__PURE__ */ jsxRuntime.jsx(
707
- chunkB7JU52YQ_cjs.GapSelect,
708
- {
709
- data: activity,
710
- ...shuffleSeed !== void 0 ? { shuffleSeed } : {},
711
- ...childProps
712
- }
713
- );
714
- }
715
- if (activity.type === "dictation") {
716
- return /* @__PURE__ */ jsxRuntime.jsx(chunkMXZHL4U5_cjs.Dictation, { data: activity, ...childProps });
717
- }
718
- if (activity.type === "read-aloud") {
719
- const slotRecordingBinding = recordingBindingFor(slot);
720
- const slotAssessment = assessments !== void 0 && Object.hasOwn(assessments, slotId) ? assessments[slotId] : void 0;
721
- return /* @__PURE__ */ jsxRuntime.jsx(
722
- chunkDZ7VLLDQ_cjs.ReadAloud,
723
- {
724
- data: activity,
725
- ...childProps,
726
- ...slotRecordingBinding !== void 0 ? { recordingBinding: slotRecordingBinding } : {},
727
- ...slotAssessment !== void 0 ? { assessment: slotAssessment } : {},
728
- ...workletUrl !== void 0 ? { workletUrl } : {}
729
- }
730
- );
731
- }
732
- if (activity.type === "written-response") {
733
- const { onComplete: _neverGrades, ...writtenResponseProps } = childProps;
734
- return /* @__PURE__ */ jsxRuntime.jsx(
735
- chunkXS6OYYVR_cjs.WrittenResponse,
736
- {
737
- data: activity,
738
- ...writtenResponseProps,
739
- onSubmitted: (submission) => record(
740
- { kind: "submitted", index: slotIndex, slotId, activityId, submission },
741
- setGeneration
742
- )
743
- }
744
- );
745
- }
746
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lk-seq-unsupported", role: "note", children: s.unsupportedActivity });
747
- };
748
- const currentEntryKey = entryKeyOf(current);
749
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-seq", lang: locale, children: [
750
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lk-seq-progress", "aria-live": "polite", role: "status", children: s.questionProgress(index + 1, total) }),
751
- stimulusMounts.map(({ entryKey, group, first, last }) => {
752
- const firstSlot = slots[first];
753
- const stimulusBinding = firstSlot === void 0 ? void 0 : bindingFor(lkCore.stimulusMediaKey(firstSlot.slotId), firstSlot);
754
- return /* @__PURE__ */ jsxRuntime.jsx(
755
- SequencePane,
756
- {
757
- className: "lk-seq-stimulus",
758
- hidden: entryKey !== currentEntryKey,
759
- children: /* @__PURE__ */ jsxRuntime.jsx(
760
- chunkB4JRBV56_cjs.StimulusPanel,
761
- {
762
- stimulus: group.stimulus,
763
- range: { first: first + 1, last: last + 1 },
764
- renderMode,
765
- ...sanitizeHtml ? { sanitizeHtml } : {},
766
- ...locale ? { locale } : {},
767
- ...onInteraction ? { onInteraction } : {},
768
- ...disabled ? { disabled } : {},
769
- ...strings !== void 0 ? { strings } : {},
770
- ...stimulusBinding !== void 0 ? { mediaBudget: stimulusBinding } : {}
771
- }
772
- )
773
- },
774
- `${setKey}::group-${entryKey}`
775
- );
776
- }),
777
- /* @__PURE__ */ jsxRuntime.jsx(
778
- "section",
779
- {
780
- className: "lk-seq-question",
781
- ref: regionRef,
782
- tabIndex: -1,
783
- "aria-label": s.questionProgress(index + 1, total),
784
- children: slots.map((slot) => {
785
- const slotKey = slotKeyOf(setKey, slot);
786
- return /* @__PURE__ */ jsxRuntime.jsx(
787
- SequencePane,
788
- {
789
- className: "lk-seq-slot",
790
- hidden: slot.index !== index,
791
- channel: channelFor(slot),
792
- children: renderSlot(slot)
793
- },
794
- slotKey
795
- );
796
- })
797
- }
798
- ),
799
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-seq-nav", children: [
800
- /* @__PURE__ */ jsxRuntime.jsx(
801
- "button",
802
- {
803
- type: "button",
804
- className: "lk-seq-prev",
805
- onClick: () => go(index - 1),
806
- disabled: index === 0,
807
- children: s.previous
808
- }
809
- ),
810
- /* @__PURE__ */ jsxRuntime.jsx(
811
- "button",
812
- {
813
- type: "button",
814
- className: "lk-seq-next",
815
- onClick: () => go(index + 1),
816
- disabled: index === total - 1,
817
- children: s.next
818
- }
819
- )
820
- ] })
821
- ] });
822
- }
823
-
824
- exports.ActivitySequence = ActivitySequence;
825
- //# sourceMappingURL=chunk-SHDSOOBF.cjs.map
826
- //# sourceMappingURL=chunk-SHDSOOBF.cjs.map