@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,860 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var chunkW6UMY7PF_cjs = require('./chunk-W6UMY7PF.cjs');
5
- var chunkOJGTJOWI_cjs = require('./chunk-OJGTJOWI.cjs');
6
- var chunkOD65OZIW_cjs = require('./chunk-OD65OZIW.cjs');
7
- var chunkVPU6UY4O_cjs = require('./chunk-VPU6UY4O.cjs');
8
- var chunkJ2QIHZ3H_cjs = require('./chunk-J2QIHZ3H.cjs');
9
- var chunkFISEZBLF_cjs = require('./chunk-FISEZBLF.cjs');
10
- var chunk54DX6SLS_cjs = require('./chunk-54DX6SLS.cjs');
11
- var chunkUKUHVCZX_cjs = require('./chunk-UKUHVCZX.cjs');
12
- var chunkXOR4MPEN_cjs = require('./chunk-XOR4MPEN.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
- var TEXT_CHANGED_DEBOUNCE_MS = 500;
19
- var VISUALLY_HIDDEN = {
20
- position: "absolute",
21
- width: 1,
22
- height: 1,
23
- margin: -1,
24
- padding: 0,
25
- overflow: "hidden",
26
- clip: "rect(0 0 0 0)",
27
- clipPath: "inset(50%)",
28
- whiteSpace: "nowrap",
29
- border: 0
30
- };
31
- var recordingsGroupCount = 0;
32
- var UNSPELLED_RE = new RegExp(
33
- `^[\\p{P}\\p{Cc}\\p{Cf}\\p{Default_Ignorable_Code_Point}${String.fromCodePoint(180, 96, 65344, 700, 1600, 2042)}]*$`,
34
- "u"
35
- );
36
- var HINT_SPACE_RE = new RegExp(
37
- `(?:(?!${String.fromCodePoint(65279)})\\s|${String.fromCodePoint(133)})+`,
38
- "u"
39
- );
40
- var VISIBLE_TEXT_RE = /[^\p{White_Space}\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/u;
41
- var BULLET = "\u2022";
42
- var LEFT_TO_RIGHT_MARK = String.fromCodePoint(8206);
43
- var RIGHT_TO_LEFT_MARK = String.fromCodePoint(8207);
44
- var EXTENDING_RE = new RegExp(
45
- `^[\\p{M}${String.fromCodePoint(8204, 8205, 3635, 3763)}${String.fromCodePoint(127995)}-${String.fromCodePoint(127999)}${String.fromCodePoint(917536)}-${String.fromCodePoint(917631)}${String.fromCodePoint(4448)}-${String.fromCodePoint(4607)}${String.fromCodePoint(55216)}-${String.fromCodePoint(55295)}]$`,
46
- "u"
47
- );
48
- var STACKING_VIRAMAS = new Set(
49
- [
50
- 2381,
51
- 2509,
52
- 2765,
53
- 2893,
54
- 3149,
55
- 3277,
56
- 3405,
57
- 4153,
58
- 6098,
59
- 6752,
60
- 6980,
61
- 43456,
62
- 69702,
63
- 69939
64
- ].map((point) => String.fromCodePoint(point))
65
- );
66
- var SUBJOINED_AFTER = new Map([
67
- ...[2608, 2607, 2613].map(
68
- (point) => [
69
- String.fromCodePoint(point),
70
- (before) => before.at(-1) === String.fromCodePoint(2637)
71
- ]
72
- ),
73
- [
74
- String.fromCodePoint(2999),
75
- (before) => before.at(-1) === String.fromCodePoint(3021) && before.at(-2) === String.fromCodePoint(2965)
76
- ],
77
- [
78
- String.fromCodePoint(2992),
79
- (before) => before.at(-1) === String.fromCodePoint(3021) && before.at(-2) === String.fromCodePoint(3e3)
80
- ]
81
- ]);
82
- var JOINABLE_VIRAMAS = /* @__PURE__ */ new Set([...STACKING_VIRAMAS, String.fromCodePoint(3530)]);
83
- var ZERO_WIDTH_JOINER = String.fromCodePoint(8205);
84
- var PREPENDED = /* @__PURE__ */ new Set([String.fromCodePoint(3406), String.fromCodePoint(6158)]);
85
- var ARABIC_LAM = String.fromCodePoint(1604);
86
- var LIGATING_ALEFS = new Set(
87
- [1570, 1571, 1573, 1575, 1649, 1650, 1651, 1653].map(
88
- (point) => String.fromCodePoint(point)
89
- )
90
- );
91
- var REGIONAL_INDICATOR_RE = /^[\u{1f1e6}-\u{1f1ff}]$/u;
92
- var LETTER_RE = /^\p{L}$/u;
93
- var LETTER_WITH_REQUIRED_LIGATURES_RE = /(?![\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}])\p{L}/u;
94
- var DIGIT_RE = /^\p{Nd}$/u;
95
- var NUMBER_SIGN_RE = new RegExp(
96
- `^[\\p{Sc}${String.fromCodePoint(176, 177, 8240, 8241, 8494, 8723)}]$`,
97
- "u"
98
- );
99
- var ARABIC_LETTER_BLOCKS = [
100
- [1536, 1983],
101
- [2144, 2303],
102
- [64336, 65023],
103
- [65136, 65279]
104
- ];
105
- function textOf(response) {
106
- return response !== void 0 && response.type === "dictation" ? response.text : "";
107
- }
108
- function hintsOf(response) {
109
- if (response === void 0 || response.type !== "dictation") {
110
- return 0;
111
- }
112
- const revealed = response.hintsRevealed;
113
- return typeof revealed === "number" && Number.isInteger(revealed) && revealed > 0 ? revealed : 0;
114
- }
115
- function responseOf(text, hintsRevealed) {
116
- return { type: "dictation", text, ...hintsRevealed > 0 ? { hintsRevealed } : {} };
117
- }
118
- function slowMediaFor(data, label) {
119
- const slow = data.slowMedia;
120
- if (slow === void 0) {
121
- return void 0;
122
- }
123
- const policy = data.media?.playback ?? {};
124
- const { maxPlays: _budget, ...inherited } = policy;
125
- const hasPolicy = Object.values(inherited).some((value) => value !== void 0);
126
- return {
127
- type: "audio",
128
- url: slow.url,
129
- alt: slow.alt ?? label,
130
- ...hasPolicy ? { playback: inherited } : {}
131
- };
132
- }
133
- function hintWordsOf(transcript) {
134
- const words = [];
135
- let leading = "";
136
- for (const token of transcript.split(HINT_SPACE_RE)) {
137
- if (token === "") {
138
- continue;
139
- }
140
- const last = words.length - 1;
141
- if (!UNSPELLED_RE.test(token.normalize("NFC"))) {
142
- words.push(leading === "" ? token : `${leading} ${token}`);
143
- leading = "";
144
- } else if (last >= 0) {
145
- words[last] = `${words[last]} ${token}`;
146
- } else {
147
- leading = leading === "" ? token : `${leading} ${token}`;
148
- }
149
- }
150
- return words;
151
- }
152
- function wordsFromDetails(details) {
153
- if (details.length === 0 || !details.every((detail) => /^w\d+$/.test(detail.itemId))) {
154
- return null;
155
- }
156
- return details.map((detail) => {
157
- const attempt = Array.isArray(detail.learnerResponse) ? detail.learnerResponse.join(" ") : detail.learnerResponse;
158
- const reference = Array.isArray(detail.correctResponse) ? detail.correctResponse.join(" ") : detail.correctResponse;
159
- const correct = chunk54DX6SLS_cjs.detailIsRight(detail);
160
- const missing = detail.outcome === "incorrect-omission" || !correct && attempt === "";
161
- return {
162
- itemId: detail.itemId,
163
- reference,
164
- attempt,
165
- similarity: detail.score ?? (correct ? 1 : 0),
166
- status: correct ? "correct" : missing ? "missing" : "incorrect"
167
- };
168
- });
169
- }
170
- function extendsCluster(before, shown) {
171
- const previous = before.at(-1);
172
- if (EXTENDING_RE.test(shown)) {
173
- return true;
174
- }
175
- if (LETTER_RE.test(shown)) {
176
- if (STACKING_VIRAMAS.has(previous) || PREPENDED.has(previous) || SUBJOINED_AFTER.get(shown)?.(before) === true) {
177
- return true;
178
- }
179
- if (previous === ZERO_WIDTH_JOINER && JOINABLE_VIRAMAS.has(before.at(-2))) {
180
- return true;
181
- }
182
- }
183
- if (previous === ARABIC_LAM && LIGATING_ALEFS.has(shown)) {
184
- return true;
185
- }
186
- return REGIONAL_INDICATOR_RE.test(shown) && before.length % 2 === 1 && before.every((character) => REGIONAL_INDICATOR_RE.test(character));
187
- }
188
- function characterOf(op) {
189
- return op.reference === "" ? op.attempt : op.reference;
190
- }
191
- function isArabicLetter(character) {
192
- const point = character?.codePointAt(0);
193
- return point !== void 0 && LETTER_RE.test(character) && ARABIC_LETTER_BLOCKS.some(([first, last]) => point >= first && point <= last);
194
- }
195
- function bulletDirections(ops, contentDir) {
196
- const own = ops.map((op) => chunkOD65OZIW_cjs.characterDirectionOf(characterOf(op)));
197
- const before = [];
198
- const arabicBefore = [];
199
- let lastDirection;
200
- let lastLetterArabic = false;
201
- ops.forEach((op, index) => {
202
- before[index] = lastDirection;
203
- arabicBefore[index] = lastLetterArabic;
204
- lastDirection = own[index] ?? lastDirection;
205
- if (LETTER_RE.test(characterOf(op))) {
206
- lastLetterArabic = isArabicLetter(characterOf(op));
207
- }
208
- });
209
- const after = [];
210
- let nextDirection;
211
- for (let index = ops.length - 1; index >= 0; index -= 1) {
212
- after[index] = nextDirection;
213
- nextDirection = own[index] ?? nextDirection;
214
- }
215
- const directions = /* @__PURE__ */ new Map();
216
- ops.forEach((op, index) => {
217
- if (op.op !== "missing") {
218
- return;
219
- }
220
- const neighbourIsDigit = [ops[index - 1], ops[index + 1]].some(
221
- (neighbour) => neighbour !== void 0 && DIGIT_RE.test(characterOf(neighbour))
222
- );
223
- directions.set(
224
- index,
225
- own[index] ?? (NUMBER_SIGN_RE.test(characterOf(op)) && neighbourIsDigit && !arabicBefore[index] ? "ltr" : before[index] !== void 0 && before[index] === after[index] ? before[index] : contentDir ?? before[index] ?? after[index])
226
- );
227
- });
228
- return directions;
229
- }
230
- function clusterOpOf(ops) {
231
- if (ops[0].op === "missing") {
232
- return "missing";
233
- }
234
- const wrong = new Set(ops.map((op) => op.op).filter((kind) => kind !== "equal"));
235
- if (wrong.size === 0) {
236
- return "equal";
237
- }
238
- return wrong.size === 1 ? [...wrong][0] : "substitute";
239
- }
240
- function clustersOf(ops, contentDir) {
241
- const bullets = bulletDirections(ops, contentDir);
242
- const groups = [];
243
- ops.forEach((op, index) => {
244
- const shown = op.op === "missing" ? BULLET : op.attempt;
245
- const current = groups.at(-1);
246
- if (current !== void 0 && op.op !== "missing" && (current.ops[0].op === "missing" ? EXTENDING_RE.test(shown) : extendsCluster(current.shown, shown))) {
247
- current.ops.push(op);
248
- current.shown.push(shown);
249
- return;
250
- }
251
- const direction = bullets.get(index);
252
- groups.push({
253
- ops: [op],
254
- shown: [shown],
255
- ...direction !== void 0 ? { bullet: direction } : {}
256
- });
257
- });
258
- const clusters = [];
259
- for (const group of groups) {
260
- const mark = group.bullet === void 0 ? "" : group.bullet === "rtl" ? RIGHT_TO_LEFT_MARK : LEFT_TO_RIGHT_MARK;
261
- const cluster = { op: clusterOpOf(group.ops), text: `${mark}${group.shown.join("")}${mark}` };
262
- const previous = clusters.at(-1);
263
- if (previous !== void 0 && previous.op === "equal" && cluster.op === "equal") {
264
- previous.text += cluster.text;
265
- } else {
266
- clusters.push(cluster);
267
- }
268
- }
269
- return clusters;
270
- }
271
- function CharOps({
272
- ops,
273
- contentDir
274
- }) {
275
- return clustersOf(ops, contentDir).map((cluster, index) => /* @__PURE__ */ jsxRuntime.jsx(
276
- "span",
277
- {
278
- className: "lk-dc-op",
279
- "data-op": cluster.op,
280
- ...LETTER_WITH_REQUIRED_LIGATURES_RE.test(cluster.text) ? {} : { "data-ligatures": "decorative" },
281
- "aria-hidden": "true",
282
- children: cluster.text
283
- },
284
- index
285
- ));
286
- }
287
- function AnnouncementText({ announcement }) {
288
- if (announcement === null) {
289
- return null;
290
- }
291
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
292
- announcement.text,
293
- announcement.feedback ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
294
- " ",
295
- /* @__PURE__ */ jsxRuntime.jsx("span", { dir: "auto", children: announcement.feedback })
296
- ] }) : null
297
- ] });
298
- }
299
- function Dictation({
300
- data,
301
- onComplete,
302
- onSubmit,
303
- onChange,
304
- onInteraction,
305
- value,
306
- defaultValue,
307
- defaultSubmitted,
308
- renderMode = "practice",
309
- outcome,
310
- mediaBudget,
311
- mediaStrings,
312
- strings,
313
- theme,
314
- locale,
315
- disabled,
316
- ai: aiProp,
317
- delivery,
318
- scoring
319
- }) {
320
- const isExam = renderMode === "exam";
321
- const isReview = renderMode === "review";
322
- const s = chunkNFGUJ52G_cjs.useLkStrings(strings);
323
- const ai = chunkOJGTJOWI_cjs.useLearnerAi(aiProp);
324
- const policy = chunkVPU6UY4O_cjs.useDeliveryPolicy(delivery);
325
- const scoringPolicy = chunkW6UMY7PF_cjs.useItemScoringPolicy(scoring);
326
- const hasKey = typeof data.transcript === "string";
327
- const devError = react.useMemo(() => {
328
- if (!chunk54DX6SLS_cjs.isDevelopment()) {
329
- return null;
330
- }
331
- if (data.redacted === true) {
332
- if (hasKey) {
333
- const shape = data;
334
- return shape.type === "dictation" && typeof shape.id === "string" && typeof shape.title === "string" ? null : new Error(
335
- "Dictation received a revealed projection (redacted: true with a transcript) that is not a dictation: `type`, `id` and `title` are required."
336
- );
337
- }
338
- try {
339
- lkCore.assertRedacted(data);
340
- return null;
341
- } catch (error) {
342
- return error instanceof Error ? error : new Error(String(error));
343
- }
344
- }
345
- const result2 = lkCore.validateActivity("dictation", data);
346
- return result2.success ? null : new lkCore.ActivitySchemaError("dictation", result2.errors);
347
- }, [data, hasKey]);
348
- const { state, start, complete, getTimeSpent, reset } = chunkXOR4MPEN_cjs.useActivityState(
349
- defaultSubmitted === true ? "completed" : "idle"
350
- );
351
- const tries = chunkW6UMY7PF_cjs.useTries({
352
- policy: scoringPolicy,
353
- graded: renderMode === "practice" && policy.feedback,
354
- submitted: state === "completed",
355
- disabled: disabled === true
356
- });
357
- const resetTries = tries.reset;
358
- const isControlled = value !== void 0;
359
- const [internalText, setInternalText] = react.useState(() => textOf(defaultValue));
360
- const [internalRevealed, setInternalRevealed] = react.useState(() => hintsOf(defaultValue));
361
- const [result, setResult] = react.useState(null);
362
- const [summary, setSummary] = react.useState(null);
363
- const [solutionShown, setSolutionShown] = react.useState(false);
364
- const formRef = react.useRef(null);
365
- const feedbackRef = react.useRef(null);
366
- const focusAfterRef = react.useRef(null);
367
- const text = isControlled ? textOf(value) : internalText;
368
- const revealed = isControlled ? hintsOf(value) : internalRevealed;
369
- const defaultValueRef = react.useRef(defaultValue);
370
- react.useEffect(() => {
371
- defaultValueRef.current = defaultValue;
372
- }, [defaultValue]);
373
- const defaultSubmittedRef = react.useRef(defaultSubmitted);
374
- react.useEffect(() => {
375
- defaultSubmittedRef.current = defaultSubmitted;
376
- }, [defaultSubmitted]);
377
- const lastDataRef = react.useRef(data);
378
- react.useEffect(() => {
379
- if (lastDataRef.current === data) {
380
- return;
381
- }
382
- lastDataRef.current = data;
383
- setInternalText(textOf(defaultValueRef.current));
384
- setInternalRevealed(hintsOf(defaultValueRef.current));
385
- setResult(null);
386
- setSummary(null);
387
- setSolutionShown(false);
388
- resetTries();
389
- reset(defaultSubmittedRef.current === true ? "completed" : "idle");
390
- }, [data, reset, resetTries]);
391
- const textChangedRef = react.useRef(
392
- null
393
- );
394
- react.useEffect(
395
- () => () => {
396
- if (textChangedRef.current !== null) {
397
- clearTimeout(textChangedRef.current.timer);
398
- }
399
- },
400
- []
401
- );
402
- const revealButtonRef = react.useRef(null);
403
- const ids = react.useId();
404
- const hintId = `${ids}-hint`;
405
- const titleId = `${ids}-title`;
406
- const solutionId = `${ids}-solution`;
407
- const [recordingsGroup] = react.useState(() => {
408
- recordingsGroupCount += 1;
409
- return `lk-dc-recordings-${recordingsGroupCount}`;
410
- });
411
- const slowMedia = react.useMemo(
412
- () => slowMediaFor(data, s.dictationSlowRecording),
413
- [data, s.dictationSlowRecording]
414
- );
415
- react.useEffect(() => {
416
- const target = focusAfterRef.current;
417
- if (target === null) {
418
- return;
419
- }
420
- focusAfterRef.current = null;
421
- if (target === "answer") {
422
- formRef.current?.querySelector("textarea")?.focus();
423
- } else {
424
- feedbackRef.current?.focus();
425
- }
426
- });
427
- if (devError) {
428
- throw devError;
429
- }
430
- if (data.redacted === true && renderMode === "practice") {
431
- throw new Error(
432
- `Dictation "${data.id}" received redacted activity data in renderMode "practice", which grades locally and has no answer key to grade against. Render redacted data with renderMode="exam" (server grades) or "review" (pass \`outcome\`).`
433
- );
434
- }
435
- const submitted = state === "completed";
436
- const inactive = disabled === true || submitted || isReview;
437
- const revealing = isReview ? outcome?.status === "scored" : !isExam && submitted;
438
- const marking = revealing && policy.feedback;
439
- const solutionsShown = policy.solutions && !tries.open;
440
- const transcript = isExam || !hasKey ? void 0 : data.transcript;
441
- const hintWords = react.useMemo(
442
- () => transcript === void 0 ? [] : hintWordsOf(transcript),
443
- [transcript]
444
- );
445
- const hintsOffered = policy.hints && data.hints?.mode === "progressive-words" && !isExam && !isReview && transcript !== void 0;
446
- const hintsEnabled = hintsOffered && !submitted;
447
- const hintTotal = hintWords.length;
448
- const hintsShown = Math.min(revealed, hintTotal);
449
- const reportedHints = hintsOffered ? hintsShown : 0;
450
- const fireInteraction = (type, payload) => {
451
- onInteraction?.({ type, activityId: data.id, timestamp: Date.now(), payload });
452
- };
453
- const flushTextChanged = () => {
454
- const pending = textChangedRef.current;
455
- if (pending === null) {
456
- return;
457
- }
458
- clearTimeout(pending.timer);
459
- textChangedRef.current = null;
460
- fireInteraction("text-changed", { length: pending.length });
461
- };
462
- const handleTextChange = (next) => {
463
- if (inactive) {
464
- return;
465
- }
466
- if (state === "idle") {
467
- start();
468
- }
469
- if (!isControlled) {
470
- setInternalText(next);
471
- }
472
- onChange?.(responseOf(next, reportedHints));
473
- if (onInteraction === void 0) {
474
- return;
475
- }
476
- if (textChangedRef.current !== null) {
477
- clearTimeout(textChangedRef.current.timer);
478
- }
479
- textChangedRef.current = {
480
- length: next.length,
481
- timer: setTimeout(() => {
482
- const pending = textChangedRef.current;
483
- textChangedRef.current = null;
484
- if (pending !== null) {
485
- fireInteraction("text-changed", { length: pending.length });
486
- }
487
- }, TEXT_CHANGED_DEBOUNCE_MS)
488
- };
489
- };
490
- const setRevealed = (next) => {
491
- if (!isControlled) {
492
- setInternalRevealed(next);
493
- }
494
- onChange?.(responseOf(text, next));
495
- };
496
- const revealNextHint = () => {
497
- if (inactive || hintsShown >= hintTotal) {
498
- return;
499
- }
500
- if (state === "idle") {
501
- start();
502
- }
503
- const next = hintsShown + 1;
504
- setRevealed(next);
505
- fireInteraction("hint-requested", { revealed: next, total: hintTotal });
506
- };
507
- const resetHints = () => {
508
- if (inactive || hintsShown === 0 || scoringPolicy.hintPenalty > 0) {
509
- return;
510
- }
511
- revealButtonRef.current?.focus();
512
- setRevealed(0);
513
- };
514
- const handleSubmit = (event) => {
515
- event.preventDefault();
516
- if (inactive) {
517
- return;
518
- }
519
- const response = responseOf(text, reportedHints);
520
- onSubmit?.(response);
521
- flushTextChanged();
522
- if (isExam) {
523
- complete();
524
- setSummary({ text: s.answerSubmitted, feedback: null });
525
- fireInteraction("submitted", { length: text.length, hintsRevealed: reportedHints });
526
- return;
527
- }
528
- const answer = lkCore.score("dictation", data, response);
529
- complete();
530
- const timeSpent = getTimeSpent();
531
- const counted = tries.record({
532
- score: answer.score,
533
- maxScore: answer.maxScore,
534
- hintsRevealed: reportedHints
535
- });
536
- const mine = counted.tries[counted.tries.length - 1];
537
- const costed = mine === void 0 ? answer.score : mine.scored;
538
- const scoringResult = costed === answer.score ? answer : { ...answer, score: costed, passed: lkCore.computePassThreshold(data, costed) };
539
- const passed2 = counted.score === scoringResult.score ? scoringResult.passed : lkCore.computePassThreshold(data, counted.score);
540
- const xapiStatement = lkCore.xAPIBuilder.buildAnsweredStatement({
541
- actor: chunk54DX6SLS_cjs.ANONYMOUS_ACTOR,
542
- object: {
543
- id: chunk54DX6SLS_cjs.objectIdFor(data.id),
544
- name: { [data.locale ?? "en-US"]: data.title },
545
- ...lkCore.xapiDefinitionFor(data)
546
- },
547
- scoringResult,
548
- timeSpentMs: timeSpent,
549
- response: response.text
550
- });
551
- setResult(answer);
552
- onComplete?.(
553
- chunkJ2QIHZ3H_cjs.stampTake(
554
- { score: counted.score, maxScore: counted.maxScore, passed: passed2, timeSpent, xapiStatement },
555
- chunkJ2QIHZ3H_cjs.mintTake()
556
- )
557
- );
558
- const correctWords = answer.details.filter(chunk54DX6SLS_cjs.detailIsRight).length;
559
- setSolutionShown(false);
560
- setSummary({
561
- text: `${s.answerSubmitted} ${s.scoreAnnouncement(
562
- Math.round(counted.score * 100),
563
- passed2
564
- )} ${s.dictationWordsSummary(correctWords, answer.details.length)}`,
565
- feedback: answer.feedback
566
- });
567
- fireInteraction("submitted", {
568
- length: text.length,
569
- hintsRevealed: reportedHints,
570
- score: scoringResult.score
571
- });
572
- };
573
- const retry = () => {
574
- reset("idle");
575
- setSummary(null);
576
- focusAfterRef.current = "answer";
577
- };
578
- const closeTries = () => {
579
- tries.close();
580
- focusAfterRef.current = "feedback";
581
- };
582
- const given = isControlled ? value : defaultValue;
583
- const hasResponse = given !== void 0 && given.type === "dictation";
584
- const contentLang = typeof data.locale === "string" ? data.locale.replaceAll("_", "-") : void 0;
585
- const localeDir = chunkOD65OZIW_cjs.localeDirectionOf(data.locale);
586
- const alignment = react.useMemo(
587
- () => marking && transcript !== void 0 && (!isReview || hasResponse) ? lkCore.alignDictation(data, text) : null,
588
- [marking, transcript, isReview, hasResponse, data, text]
589
- );
590
- const sentenceDiff = react.useMemo(
591
- () => alignment !== null && alignment.attempt !== "" && solutionsShown ? lkCore.diffDictationChars(alignment.reference, alignment.attempt) : null,
592
- [alignment, solutionsShown]
593
- );
594
- const detailWords = react.useMemo(
595
- () => isReview && alignment === null && outcome?.status === "scored" ? wordsFromDetails(outcome.details) : null,
596
- [isReview, alignment, outcome]
597
- );
598
- const words = alignment?.words ?? detailWords;
599
- const marksShown = marking && words !== null;
600
- const contentDir = localeDir ?? chunkOD65OZIW_cjs.textDirectionOf(transcript ?? words?.map((word) => word.reference).join(" ") ?? "");
601
- const nothingTyped = alignment !== null ? alignment.attempt === "" : words?.every((word) => word.attempt === "") ?? false;
602
- const passed = isReview ? outcome?.status === "scored" || outcome?.status === "graded" ? outcome.passed : void 0 : result?.passed;
603
- const reviewSummary = react.useMemo(() => {
604
- if (!isReview || outcome === void 0) {
605
- return null;
606
- }
607
- if (outcome.status === "scored") {
608
- return {
609
- text: s.scoreAnnouncement(Math.round(outcome.score * 100), outcome.passed),
610
- feedback: outcome.feedback
611
- };
612
- }
613
- if (outcome.status === "deferred") {
614
- return { text: s.notGradedYet, feedback: null };
615
- }
616
- if (outcome.status === "graded") {
617
- const percent = outcome.maxScore > 0 ? Math.round(outcome.score / outcome.maxScore * 100) : Math.round(outcome.score * 100);
618
- return {
619
- text: s.scoreAnnouncement(percent, outcome.passed),
620
- feedback: outcome.feedback ?? null
621
- };
622
- }
623
- return { text: s.noGradeAvailable, feedback: null };
624
- }, [isReview, outcome, s]);
625
- const sentenceFor = (word) => {
626
- switch (word.status) {
627
- case "correct":
628
- return s.dictationWordCorrect(word.attempt);
629
- case "incorrect":
630
- return solutionsShown ? s.dictationWordWrong(word.attempt, word.reference) : s.dictationWordWrongUnnamed(word.attempt);
631
- case "missing":
632
- return solutionsShown ? s.dictationWordMissing(word.reference) : s.dictationWordMissingUnnamed;
633
- default:
634
- return s.dictationWordExtra(word.attempt);
635
- }
636
- };
637
- const acceptedTranscripts = transcript === void 0 || !Array.isArray(data.acceptedTranscripts) ? void 0 : data.acceptedTranscripts.filter((entry) => typeof entry === "string");
638
- const extra = !isReview && policy.feedback && submitted && tries.counted !== null ? chunkW6UMY7PF_cjs.triesSummary(s, scoringPolicy, tries.counted, tries.open) : "";
639
- return /* @__PURE__ */ jsxRuntime.jsxs(
640
- "form",
641
- {
642
- ref: formRef,
643
- className: "lk-dc",
644
- "aria-labelledby": VISIBLE_TEXT_RE.test(data.title) ? titleId : void 0,
645
- lang: locale,
646
- "data-render-mode": renderMode,
647
- style: theme,
648
- onSubmit: handleSubmit,
649
- children: [
650
- /* @__PURE__ */ jsxRuntime.jsx("p", { id: titleId, className: "lk-dc-title", dir: localeDir ?? "auto", lang: contentLang, children: data.title }),
651
- data.media !== void 0 || slowMedia !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-dc-recordings", children: [
652
- data.media !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "lk-dc-recording", children: [
653
- /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "lk-dc-recording-label", children: s.dictationRecording }),
654
- /* @__PURE__ */ jsxRuntime.jsx(
655
- chunkUKUHVCZX_cjs.ActivityMedia,
656
- {
657
- media: data.media,
658
- renderMode,
659
- playbackGroup: recordingsGroup,
660
- ...mediaBudget !== void 0 ? { mediaBudget } : {},
661
- ...mediaStrings !== void 0 ? { mediaStrings } : {},
662
- ...strings !== void 0 ? { strings } : {},
663
- ...onInteraction !== void 0 ? { onInteraction } : {},
664
- ...locale !== void 0 ? { locale } : {},
665
- ...disabled !== void 0 ? { disabled } : {}
666
- }
667
- )
668
- ] }) : null,
669
- slowMedia !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "lk-dc-recording", "data-slow": "true", children: [
670
- /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "lk-dc-recording-label", children: s.dictationSlowRecording }),
671
- /* @__PURE__ */ jsxRuntime.jsx(
672
- chunkUKUHVCZX_cjs.ActivityMedia,
673
- {
674
- media: slowMedia,
675
- renderMode,
676
- playbackGroup: recordingsGroup,
677
- ...mediaStrings !== void 0 ? { mediaStrings } : {},
678
- ...strings !== void 0 ? { strings } : {},
679
- ...locale !== void 0 ? { locale } : {},
680
- ...disabled !== void 0 ? { disabled } : {}
681
- }
682
- )
683
- ] }) : null
684
- ] }) : null,
685
- hintsEnabled ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-dc-hints", children: [
686
- /* @__PURE__ */ jsxRuntime.jsx(
687
- "button",
688
- {
689
- ref: revealButtonRef,
690
- type: "button",
691
- className: "lk-dc-hint-btn",
692
- disabled: inactive,
693
- "aria-disabled": hintsShown >= hintTotal || void 0,
694
- onClick: revealNextHint,
695
- children: s.dictationRevealNextWord(hintsShown, hintTotal)
696
- }
697
- ),
698
- /* @__PURE__ */ jsxRuntime.jsx(chunkW6UMY7PF_cjs.HintCost, { policy: scoringPolicy, strings: s }),
699
- hintsShown > 0 && scoringPolicy.hintPenalty <= 0 ? /* @__PURE__ */ jsxRuntime.jsx(
700
- "button",
701
- {
702
- type: "button",
703
- className: "lk-dc-hint-reset",
704
- disabled: inactive,
705
- onClick: resetHints,
706
- children: s.dictationResetHints
707
- }
708
- ) : null,
709
- /* @__PURE__ */ jsxRuntime.jsx("p", { id: hintId, className: "lk-dc-hint", role: "status", dir: contentDir, lang: contentLang, children: hintsShown > 0 ? `${hintWords.slice(0, hintsShown).join(" ")}${hintsShown < hintTotal ? " \u2026" : ""}` : "" })
710
- ] }) : null,
711
- /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { disabled: inactive, children: [
712
- /* @__PURE__ */ jsxRuntime.jsx(
713
- "textarea",
714
- {
715
- className: "lk-dc-input",
716
- "aria-label": s.dictationInputLabel,
717
- "aria-describedby": hintsEnabled && hintsShown > 0 ? hintId : void 0,
718
- dir: "auto",
719
- rows: 3,
720
- maxLength: lkCore.DICTATION_MAX_TEXT_LENGTH,
721
- autoComplete: "off",
722
- autoCapitalize: "none",
723
- autoCorrect: "off",
724
- spellCheck: false,
725
- value: text,
726
- disabled: inactive,
727
- "aria-disabled": inactive || void 0,
728
- "data-correct": marking && passed !== void 0 && (!isReview || hasResponse) ? String(passed) : void 0,
729
- onChange: (event) => handleTextChange(event.target.value)
730
- }
731
- ),
732
- isReview ? null : (
733
- // Enabled on empty text: an omission is a recorded answer.
734
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", disabled: inactive, children: isExam ? s.submitAnswers : s.checkAnswers })
735
- )
736
- ] }),
737
- marksShown ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-dc-result", children: [
738
- nothingTyped ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-dc-nothing", role: "note", children: s.dictationNothingTyped }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
739
- /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "lk-dc-words", "aria-label": s.dictationMarksLabel, dir: contentDir, children: words?.map((word, index) => {
740
- const sentence = sentenceFor(word);
741
- return /* @__PURE__ */ jsxRuntime.jsxs(
742
- "li",
743
- {
744
- className: "lk-dc-word",
745
- "data-state": word.status,
746
- title: sentence,
747
- children: [
748
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: VISUALLY_HIDDEN, children: sentence }),
749
- /* @__PURE__ */ jsxRuntime.jsx(
750
- "span",
751
- {
752
- className: "lk-dc-word-text",
753
- "aria-hidden": "true",
754
- dir: contentDir ?? "auto",
755
- lang: contentLang,
756
- ...word.status === "incorrect" && alignment !== null && solutionsShown ? { "data-marks": "characters" } : {},
757
- children: word.status === "incorrect" && alignment !== null && solutionsShown ? /* @__PURE__ */ jsxRuntime.jsx(
758
- CharOps,
759
- {
760
- ops: lkCore.diffDictationChars(word.reference, word.attempt),
761
- contentDir
762
- }
763
- ) : word.status === "missing" ? (
764
- // Where the answer may not show, a gap the size of
765
- // nothing in particular: the word is missing, not named.
766
- solutionsShown ? word.reference : "\u2026"
767
- ) : word.attempt
768
- }
769
- )
770
- ]
771
- },
772
- index
773
- );
774
- }) }),
775
- sentenceDiff !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-dc-diff", "aria-hidden": "true", dir: contentDir, lang: contentLang, children: /* @__PURE__ */ jsxRuntime.jsx(CharOps, { ops: sentenceDiff, contentDir }) }) : null,
776
- /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "lk-dc-legend", children: [
777
- /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": "correct", children: s.dictationLegendCorrect }),
778
- /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": "incorrect", children: s.dictationLegendWrong }),
779
- /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": "missing", children: s.dictationLegendMissing }),
780
- alignment !== null ? /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": "extra", children: s.dictationLegendExtra }) : null
781
- ] }),
782
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-dc-diff-note", children: s.dictationDiffNote })
783
- ] }),
784
- transcript !== void 0 && solutionsShown ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
785
- /* @__PURE__ */ jsxRuntime.jsx(
786
- "button",
787
- {
788
- type: "button",
789
- className: "lk-dc-solution-toggle",
790
- "aria-expanded": solutionShown,
791
- "aria-controls": solutionId,
792
- onClick: () => setSolutionShown((shown) => !shown),
793
- children: solutionShown ? s.hideSolution : s.showSolution
794
- }
795
- ),
796
- solutionShown ? /* @__PURE__ */ jsxRuntime.jsxs(
797
- "blockquote",
798
- {
799
- id: solutionId,
800
- className: "lk-dc-solution",
801
- "aria-label": s.dictationSolutionLabel,
802
- dir: contentDir,
803
- children: [
804
- /* @__PURE__ */ jsxRuntime.jsx("p", { lang: contentLang, children: transcript }),
805
- acceptedTranscripts !== void 0 && acceptedTranscripts.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "lk-dc-solution-alternatives", lang: contentLang, children: acceptedTranscripts.map((alternative) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: alternative }, alternative)) }) : null
806
- ]
807
- }
808
- ) : null
809
- ] }) : null
810
- ] }) : null,
811
- /* @__PURE__ */ jsxRuntime.jsx(
812
- chunkVPU6UY4O_cjs.FeedbackRegion,
813
- {
814
- id: `${data.id}-feedback`,
815
- ...scoringPolicy.retries > 0 ? { ref: feedbackRef } : {},
816
- children: /* @__PURE__ */ jsxRuntime.jsx(
817
- AnnouncementText,
818
- {
819
- announcement: isReview ? policy.feedback || !chunkVPU6UY4O_cjs.outcomeShowsMarks(outcome) ? reviewSummary : null : policy.feedback || summary === null ? summary === null || extra === "" ? summary : { ...summary, text: `${summary.text} ${extra}` } : { text: s.answerSubmitted, feedback: null }
820
- }
821
- )
822
- }
823
- ),
824
- /* @__PURE__ */ jsxRuntime.jsx(
825
- chunkW6UMY7PF_cjs.TryActions,
826
- {
827
- tries,
828
- solutions: policy.solutions && transcript !== void 0,
829
- strings: s,
830
- onRetry: retry,
831
- onClose: closeTries
832
- }
833
- ),
834
- /* @__PURE__ */ jsxRuntime.jsx(
835
- chunkW6UMY7PF_cjs.AiExplanation,
836
- {
837
- ai,
838
- data,
839
- renderMode,
840
- submitted,
841
- response: responseOf(text, reportedHints),
842
- outcome,
843
- locale,
844
- onInteraction,
845
- strings: s,
846
- delivery: tries.open ? { ...policy, solutions: false } : policy
847
- }
848
- )
849
- ]
850
- }
851
- );
852
- }
853
- function Dictation2(props) {
854
- const strings = chunkNFGUJ52G_cjs.useLkStrings(props.strings);
855
- return /* @__PURE__ */ jsxRuntime.jsx(chunkFISEZBLF_cjs.ActivityErrorBoundary, { activityTitle: props.data?.title, strings, children: /* @__PURE__ */ jsxRuntime.jsx(Dictation, { ...props }) });
856
- }
857
-
858
- exports.Dictation = Dictation2;
859
- //# sourceMappingURL=chunk-MXZHL4U5.cjs.map
860
- //# sourceMappingURL=chunk-MXZHL4U5.cjs.map