@intellectif/lk-react 23.1.0 → 23.1.2

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