@intellectif/lk-react 23.0.1 → 23.1.0

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 (178) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +4 -4
  3. package/dist/{WrittenResponse-CgRrjM4S.d.ts → WrittenResponse-B7A5gHMj.d.ts} +1 -1
  4. package/dist/{WrittenResponse-D2K1VW_V.d.cts → WrittenResponse-BpL9p2Hn.d.cts} +1 -1
  5. package/dist/ai/LkAiProvider.cjs +3 -3
  6. package/dist/ai/LkAiProvider.d.cts +12 -2
  7. package/dist/ai/LkAiProvider.d.ts +12 -2
  8. package/dist/ai/LkAiProvider.js +1 -1
  9. package/dist/ai/useAiHelp.cjs +9 -7
  10. package/dist/ai/useAiHelp.d.cts +82 -3
  11. package/dist/ai/useAiHelp.d.ts +82 -3
  12. package/dist/ai/useAiHelp.js +2 -4
  13. package/dist/{chunk-VPU6UY4O.cjs → chunk-2PNSVBLQ.cjs} +5 -6
  14. package/dist/chunk-2PNSVBLQ.cjs.map +1 -0
  15. package/dist/{chunk-HZIT24BK.js → chunk-4ZZWZSWI.js} +4 -4
  16. package/dist/{chunk-HZIT24BK.js.map → chunk-4ZZWZSWI.js.map} +1 -1
  17. package/dist/{chunk-B7JU52YQ.cjs → chunk-7ALBSPYR.cjs} +34 -35
  18. package/dist/chunk-7ALBSPYR.cjs.map +1 -0
  19. package/dist/{chunk-TGTP5DKF.js → chunk-7NFY3M3W.js} +10 -10
  20. package/dist/{chunk-TGTP5DKF.js.map → chunk-7NFY3M3W.js.map} +1 -1
  21. package/dist/{chunk-E4UF4XZM.js → chunk-7SB2MJA4.js} +4 -4
  22. package/dist/{chunk-E4UF4XZM.js.map → chunk-7SB2MJA4.js.map} +1 -1
  23. package/dist/{chunk-ERV666AR.js → chunk-ABJJ3LII.js} +9 -10
  24. package/dist/chunk-ABJJ3LII.js.map +1 -0
  25. package/dist/{chunk-NFGUJ52G.cjs → chunk-BIGGXHAW.cjs} +8 -2
  26. package/dist/chunk-BIGGXHAW.cjs.map +1 -0
  27. package/dist/{chunk-O7MINPKZ.js → chunk-C7QZE5BI.js} +9 -10
  28. package/dist/chunk-C7QZE5BI.js.map +1 -0
  29. package/dist/{chunk-IYGF7PZY.cjs → chunk-CWTUWNV3.cjs} +25 -26
  30. package/dist/chunk-CWTUWNV3.cjs.map +1 -0
  31. package/dist/{chunk-4MXECBZT.js → chunk-DC4CQCK5.js} +40 -13
  32. package/dist/chunk-DC4CQCK5.js.map +1 -0
  33. package/dist/{chunk-PGAPZ6UE.cjs → chunk-DS6HN3YR.cjs} +34 -35
  34. package/dist/chunk-DS6HN3YR.cjs.map +1 -0
  35. package/dist/{chunk-U5VFJVQ2.js → chunk-FDQR4GAZ.js} +3 -4
  36. package/dist/chunk-FDQR4GAZ.js.map +1 -0
  37. package/dist/{chunk-DPNCCWOV.js → chunk-FKGMSOJF.js} +8 -9
  38. package/dist/chunk-FKGMSOJF.js.map +1 -0
  39. package/dist/{chunk-SPSKDNEE.js → chunk-G6PXJ2SA.js} +11 -12
  40. package/dist/chunk-G6PXJ2SA.js.map +1 -0
  41. package/dist/{chunk-C4PSJ3ZC.js → chunk-HNLRVRQR.js} +8 -2
  42. package/dist/chunk-HNLRVRQR.js.map +1 -0
  43. package/dist/{chunk-FISEZBLF.cjs → chunk-J3C72RPK.cjs} +7 -7
  44. package/dist/{chunk-FISEZBLF.cjs.map → chunk-J3C72RPK.cjs.map} +1 -1
  45. package/dist/{chunk-SHDSOOBF.cjs → chunk-KFLIDTDU.cjs} +25 -26
  46. package/dist/chunk-KFLIDTDU.cjs.map +1 -0
  47. package/dist/{chunk-W6UMY7PF.cjs → chunk-KHKH5LCT.cjs} +7 -8
  48. package/dist/chunk-KHKH5LCT.cjs.map +1 -0
  49. package/dist/{chunk-7F2YQWMW.cjs → chunk-LBEKRN6Y.cjs} +122 -11
  50. package/dist/chunk-LBEKRN6Y.cjs.map +1 -0
  51. package/dist/{chunk-6RIM5EQP.cjs → chunk-LPUWXIPR.cjs} +197 -12
  52. package/dist/chunk-LPUWXIPR.cjs.map +1 -0
  53. package/dist/{chunk-XS6OYYVR.cjs → chunk-MKXEM2C5.cjs} +19 -20
  54. package/dist/chunk-MKXEM2C5.cjs.map +1 -0
  55. package/dist/{chunk-CXIP7ERK.js → chunk-MXNC5UNO.js} +182 -8
  56. package/dist/chunk-MXNC5UNO.js.map +1 -0
  57. package/dist/{chunk-MXZHL4U5.cjs → chunk-NAK55BYU.cjs} +31 -32
  58. package/dist/chunk-NAK55BYU.cjs.map +1 -0
  59. package/dist/{chunk-UKUHVCZX.cjs → chunk-NDBMKGQ5.cjs} +5 -5
  60. package/dist/{chunk-UKUHVCZX.cjs.map → chunk-NDBMKGQ5.cjs.map} +1 -1
  61. package/dist/{chunk-XYJBRKBZ.js → chunk-ORT3KLGI.js} +3 -4
  62. package/dist/chunk-ORT3KLGI.js.map +1 -0
  63. package/dist/{chunk-JMEZYYCE.js → chunk-PWHECW6N.js} +11 -12
  64. package/dist/chunk-PWHECW6N.js.map +1 -0
  65. package/dist/{chunk-6GQLCCGN.js → chunk-RBS5A2DF.js} +9 -10
  66. package/dist/chunk-RBS5A2DF.js.map +1 -0
  67. package/dist/{chunk-B4JRBV56.cjs → chunk-RPWUDXG5.cjs} +6 -6
  68. package/dist/{chunk-B4JRBV56.cjs.map → chunk-RPWUDXG5.cjs.map} +1 -1
  69. package/dist/{chunk-KI6DJ5ZF.js → chunk-TCDJY3H6.js} +9 -10
  70. package/dist/chunk-TCDJY3H6.js.map +1 -0
  71. package/dist/{chunk-DZ7VLLDQ.cjs → chunk-TP5UMRAU.cjs} +66 -39
  72. package/dist/chunk-TP5UMRAU.cjs.map +1 -0
  73. package/dist/{chunk-HYOUMTPW.js → chunk-TS7J6DTY.js} +3 -3
  74. package/dist/{chunk-HYOUMTPW.js.map → chunk-TS7J6DTY.js.map} +1 -1
  75. package/dist/{chunk-OJGTJOWI.cjs → chunk-TUVENMXB.cjs} +2 -2
  76. package/dist/chunk-TUVENMXB.cjs.map +1 -0
  77. package/dist/{chunk-WZ2TBXVB.cjs → chunk-V6BA44DS.cjs} +18 -18
  78. package/dist/{chunk-WZ2TBXVB.cjs.map → chunk-V6BA44DS.cjs.map} +1 -1
  79. package/dist/{chunk-2OP5YHRR.js → chunk-XO5R73Y4.js} +120 -10
  80. package/dist/chunk-XO5R73Y4.js.map +1 -0
  81. package/dist/{chunk-QAZO3ANW.cjs → chunk-YY4PFR3Z.cjs} +34 -35
  82. package/dist/chunk-YY4PFR3Z.cjs.map +1 -0
  83. package/dist/{chunk-RX3A6KIY.js → chunk-ZPI6Q42R.js} +2 -2
  84. package/dist/chunk-ZPI6Q42R.js.map +1 -0
  85. package/dist/components/ActivityPreview.cjs +16 -18
  86. package/dist/components/ActivityPreview.d.cts +2 -2
  87. package/dist/components/ActivityPreview.d.ts +2 -2
  88. package/dist/components/ActivityPreview.js +15 -17
  89. package/dist/components/ActivitySequence.cjs +17 -19
  90. package/dist/components/ActivitySequence.d.cts +2 -2
  91. package/dist/components/ActivitySequence.d.ts +2 -2
  92. package/dist/components/ActivitySequence.js +16 -18
  93. package/dist/components/Dictation.cjs +9 -11
  94. package/dist/components/Dictation.d.cts +1 -1
  95. package/dist/components/Dictation.d.ts +1 -1
  96. package/dist/components/Dictation.js +8 -10
  97. package/dist/components/FillInTheBlanks.cjs +9 -11
  98. package/dist/components/FillInTheBlanks.d.cts +1 -1
  99. package/dist/components/FillInTheBlanks.d.ts +1 -1
  100. package/dist/components/FillInTheBlanks.js +8 -10
  101. package/dist/components/GapSelect.cjs +9 -11
  102. package/dist/components/GapSelect.d.cts +1 -1
  103. package/dist/components/GapSelect.d.ts +1 -1
  104. package/dist/components/GapSelect.js +8 -10
  105. package/dist/components/InteractiveVideo.cjs +16 -18
  106. package/dist/components/InteractiveVideo.d.cts +2 -2
  107. package/dist/components/InteractiveVideo.d.ts +2 -2
  108. package/dist/components/InteractiveVideo.js +14 -16
  109. package/dist/components/MultipleChoice.cjs +9 -11
  110. package/dist/components/MultipleChoice.d.cts +1 -1
  111. package/dist/components/MultipleChoice.d.ts +1 -1
  112. package/dist/components/MultipleChoice.js +8 -10
  113. package/dist/components/PronunciationFeedback.cjs +6 -5
  114. package/dist/components/PronunciationFeedback.d.cts +28 -7
  115. package/dist/components/PronunciationFeedback.d.ts +28 -7
  116. package/dist/components/PronunciationFeedback.js +5 -4
  117. package/dist/components/ReadAloud.cjs +9 -9
  118. package/dist/components/ReadAloud.d.cts +2 -2
  119. package/dist/components/ReadAloud.d.ts +2 -2
  120. package/dist/components/ReadAloud.js +8 -8
  121. package/dist/components/StimulusPanel.cjs +4 -4
  122. package/dist/components/StimulusPanel.d.cts +1 -1
  123. package/dist/components/StimulusPanel.d.ts +1 -1
  124. package/dist/components/StimulusPanel.js +3 -3
  125. package/dist/components/WrittenResponse.cjs +8 -10
  126. package/dist/components/WrittenResponse.d.cts +3 -3
  127. package/dist/components/WrittenResponse.d.ts +3 -3
  128. package/dist/components/WrittenResponse.js +7 -9
  129. package/dist/i18n/LkIntlProvider.cjs +7 -7
  130. package/dist/i18n/LkIntlProvider.d.cts +2 -2
  131. package/dist/i18n/LkIntlProvider.d.ts +2 -2
  132. package/dist/i18n/LkIntlProvider.js +1 -1
  133. package/dist/index.cjs +58 -56
  134. package/dist/index.cjs.map +1 -1
  135. package/dist/index.d.cts +3 -3
  136. package/dist/index.d.ts +3 -3
  137. package/dist/index.js +18 -20
  138. package/dist/index.js.map +1 -1
  139. package/dist/theme/skin.css +46 -1
  140. package/dist/{types-CrtIcRcK.d.ts → types-C4IsUQsK.d.ts} +16 -0
  141. package/dist/{types-CO0XLEN6.d.cts → types-CJgZWtl4.d.cts} +16 -0
  142. package/package.json +3 -3
  143. package/dist/chunk-2OP5YHRR.js.map +0 -1
  144. package/dist/chunk-4MXECBZT.js.map +0 -1
  145. package/dist/chunk-54DX6SLS.cjs +0 -42
  146. package/dist/chunk-54DX6SLS.cjs.map +0 -1
  147. package/dist/chunk-6GQLCCGN.js.map +0 -1
  148. package/dist/chunk-6RIM5EQP.cjs.map +0 -1
  149. package/dist/chunk-7F2YQWMW.cjs.map +0 -1
  150. package/dist/chunk-B7JU52YQ.cjs.map +0 -1
  151. package/dist/chunk-C4PSJ3ZC.js.map +0 -1
  152. package/dist/chunk-CXIP7ERK.js.map +0 -1
  153. package/dist/chunk-DPNCCWOV.js.map +0 -1
  154. package/dist/chunk-DXFCYNST.js +0 -35
  155. package/dist/chunk-DXFCYNST.js.map +0 -1
  156. package/dist/chunk-DZ7VLLDQ.cjs.map +0 -1
  157. package/dist/chunk-ERV666AR.js.map +0 -1
  158. package/dist/chunk-IYGF7PZY.cjs.map +0 -1
  159. package/dist/chunk-J2QIHZ3H.cjs +0 -27
  160. package/dist/chunk-J2QIHZ3H.cjs.map +0 -1
  161. package/dist/chunk-JMEZYYCE.js.map +0 -1
  162. package/dist/chunk-KI6DJ5ZF.js.map +0 -1
  163. package/dist/chunk-MXZHL4U5.cjs.map +0 -1
  164. package/dist/chunk-NFGUJ52G.cjs.map +0 -1
  165. package/dist/chunk-O7MINPKZ.js.map +0 -1
  166. package/dist/chunk-OJGTJOWI.cjs.map +0 -1
  167. package/dist/chunk-PGAPZ6UE.cjs.map +0 -1
  168. package/dist/chunk-QAZO3ANW.cjs.map +0 -1
  169. package/dist/chunk-RX3A6KIY.js.map +0 -1
  170. package/dist/chunk-SHDSOOBF.cjs.map +0 -1
  171. package/dist/chunk-SPSKDNEE.js.map +0 -1
  172. package/dist/chunk-U4KTOH7C.js +0 -22
  173. package/dist/chunk-U4KTOH7C.js.map +0 -1
  174. package/dist/chunk-U5VFJVQ2.js.map +0 -1
  175. package/dist/chunk-VPU6UY4O.cjs.map +0 -1
  176. package/dist/chunk-W6UMY7PF.cjs.map +0 -1
  177. package/dist/chunk-XS6OYYVR.cjs.map +0 -1
  178. package/dist/chunk-XYJBRKBZ.js.map +0 -1
@@ -1,16 +1,15 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var chunk7F2YQWMW_cjs = require('./chunk-7F2YQWMW.cjs');
4
+ var chunkLBEKRN6Y_cjs = require('./chunk-LBEKRN6Y.cjs');
5
5
  var chunkUDCQTOVU_cjs = require('./chunk-UDCQTOVU.cjs');
6
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');
7
+ var chunk2PNSVBLQ_cjs = require('./chunk-2PNSVBLQ.cjs');
8
+ var chunkJ3C72RPK_cjs = require('./chunk-J3C72RPK.cjs');
9
+ var chunkLPUWXIPR_cjs = require('./chunk-LPUWXIPR.cjs');
10
+ var chunkNDBMKGQ5_cjs = require('./chunk-NDBMKGQ5.cjs');
12
11
  var chunkXOR4MPEN_cjs = require('./chunk-XOR4MPEN.cjs');
13
- var chunkNFGUJ52G_cjs = require('./chunk-NFGUJ52G.cjs');
12
+ var chunkBIGGXHAW_cjs = require('./chunk-BIGGXHAW.cjs');
14
13
  var lkCore = require('@intellectif/lk-core');
15
14
  var react = require('react');
16
15
  var jsxRuntime = require('react/jsx-runtime');
@@ -112,7 +111,7 @@ function marksFromDetails(details) {
112
111
  return details.map((detail) => {
113
112
  const heard = Array.isArray(detail.learnerResponse) ? detail.learnerResponse.join(" ") : detail.learnerResponse;
114
113
  const reference = Array.isArray(detail.correctResponse) ? detail.correctResponse.join(" ") : detail.correctResponse;
115
- const correct = chunk54DX6SLS_cjs.detailIsRight(detail);
114
+ const correct = chunkLPUWXIPR_cjs.detailIsRight(detail);
116
115
  const state = correct ? "correct" : detail.outcome === "incorrect-omission" ? "omitted" : "mispronounced";
117
116
  return {
118
117
  itemId: detail.itemId,
@@ -160,7 +159,7 @@ function OutcomeSummary({
160
159
  "data-status": reading.status,
161
160
  "data-passed": String(reading.grade.passed),
162
161
  children: scoreShown ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
163
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade", children: s.scoreAnnouncement(chunk7F2YQWMW_cjs.percentOfGrade(reading.grade), reading.grade.passed) }),
162
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade", children: s.scoreAnnouncement(chunkLBEKRN6Y_cjs.percentOfGrade(reading.grade), reading.grade.passed) }),
164
163
  reading.grade.feedback ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-grade-feedback", dir: "auto", children: reading.grade.feedback }) : null
165
164
  ] })
166
165
  }
@@ -209,16 +208,17 @@ function ReadAloud({
209
208
  breakThreshold,
210
209
  monotoneThreshold,
211
210
  workletUrl,
212
- delivery
211
+ delivery,
212
+ ai
213
213
  }) {
214
214
  const isExam = renderMode === "exam";
215
- const policy = chunkVPU6UY4O_cjs.useDeliveryPolicy(delivery);
215
+ const policy = chunk2PNSVBLQ_cjs.useDeliveryPolicy(delivery);
216
216
  const isReview = renderMode === "review";
217
- const s = chunkNFGUJ52G_cjs.useLkStrings(strings);
218
- const slot = react.useContext(chunkJ2QIHZ3H_cjs.SequenceSlotContext);
217
+ const s = chunkBIGGXHAW_cjs.useLkStrings(strings);
218
+ const slot = react.useContext(chunkLPUWXIPR_cjs.SequenceSlotContext);
219
219
  const captureGroup = slot?.captureGroup;
220
220
  const devError = react.useMemo(() => {
221
- if (!chunk54DX6SLS_cjs.isDevelopment()) {
221
+ if (!chunkLPUWXIPR_cjs.isDevelopment()) {
222
222
  return null;
223
223
  }
224
224
  if (data.redacted === true) {
@@ -409,7 +409,7 @@ function ReadAloud({
409
409
  [data, s.readAloudSlowRecording]
410
410
  );
411
411
  const takeAudio = isReview ? playbackUrl : takeUrl;
412
- const playback = chunk7F2YQWMW_cjs.usePlaybackRefusal(takeAudio);
412
+ const playback = chunkLBEKRN6Y_cjs.usePlaybackRefusal(takeAudio);
413
413
  const submitRef = react.useRef(null);
414
414
  if (devError) {
415
415
  throw devError;
@@ -456,7 +456,7 @@ function ReadAloud({
456
456
  if (run !== runRef.current) {
457
457
  return;
458
458
  }
459
- const result = chunk7F2YQWMW_cjs.readAssessResult(answer);
459
+ const result = chunkLBEKRN6Y_cjs.readAssessResult(answer);
460
460
  if (result.status === "failed") {
461
461
  raise({ kind: "assess-failed", take: take2, retryable: result.retryable });
462
462
  fire("assessment-failed", { takes, durationMs, retryable: result.retryable });
@@ -480,16 +480,16 @@ function ReadAloud({
480
480
  return;
481
481
  }
482
482
  onComplete?.(
483
- chunkJ2QIHZ3H_cjs.stampTake(
483
+ chunkLPUWXIPR_cjs.stampTake(
484
484
  {
485
485
  score: grade.score,
486
486
  maxScore: grade.maxScore,
487
487
  passed: grade.passed,
488
488
  timeSpent,
489
489
  xapiStatement: lkCore.xAPIBuilder.buildAnsweredStatement({
490
- actor: chunk54DX6SLS_cjs.ANONYMOUS_ACTOR,
490
+ actor: chunkLPUWXIPR_cjs.ANONYMOUS_ACTOR,
491
491
  object: {
492
- id: chunk54DX6SLS_cjs.objectIdFor(data.id),
492
+ id: chunkLPUWXIPR_cjs.objectIdFor(data.id),
493
493
  name: { [data.locale ?? "en-US"]: data.title },
494
494
  ...lkCore.xapiDefinitionFor(data)
495
495
  },
@@ -499,7 +499,7 @@ function ReadAloud({
499
499
  // optional, and an empty list is the honest reading of "no per-word
500
500
  // marks were stored" — never a mark of its own.
501
501
  scoringResult: {
502
- score: chunk7F2YQWMW_cjs.fractionOfGrade(grade),
502
+ score: chunkLBEKRN6Y_cjs.fractionOfGrade(grade),
503
503
  maxScore: 1,
504
504
  passed: grade.passed,
505
505
  feedback: grade.feedback,
@@ -519,7 +519,7 @@ function ReadAloud({
519
519
  submittingRef.current = true;
520
520
  const takes = recorder.takesUsed;
521
521
  const run = runRef.current;
522
- const take2 = chunkJ2QIHZ3H_cjs.mintTake();
522
+ const take2 = chunkLPUWXIPR_cjs.mintTake();
523
523
  beginTakeReport(take2);
524
524
  try {
525
525
  let ref = null;
@@ -545,7 +545,7 @@ function ReadAloud({
545
545
  setUploaded(ref);
546
546
  fire("recording-uploaded", { takes, durationMs: current.durationMs });
547
547
  }
548
- onSubmit?.(chunkJ2QIHZ3H_cjs.stampTake(responseOf(ref, takes), take2));
548
+ onSubmit?.(chunkLPUWXIPR_cjs.stampTake(responseOf(ref, takes), take2));
549
549
  fire("submitted", { takes, durationMs: current?.durationMs ?? 0 });
550
550
  if (isExam || ref === null) {
551
551
  complete();
@@ -593,8 +593,16 @@ function ReadAloud({
593
593
  };
594
594
  const contentLang = typeof data.locale === "string" ? data.locale : void 0;
595
595
  const contentDir = chunkOD65OZIW_cjs.localeDirectionOf(data.locale);
596
- const outcomeReading = react.useMemo(() => chunk7F2YQWMW_cjs.readOutcome(outcome), [outcome]);
597
- const keptEvidence = react.useMemo(() => chunk7F2YQWMW_cjs.readEvidence(assessment), [assessment]);
596
+ const coachingItem = {
597
+ id: data.id,
598
+ title: data.title,
599
+ referenceText: data.referenceText,
600
+ locale: data.locale,
601
+ ...data.instructions !== void 0 ? { instructions: data.instructions } : {},
602
+ ...data.ai !== void 0 ? { ai: data.ai } : {}
603
+ };
604
+ const outcomeReading = react.useMemo(() => chunkLBEKRN6Y_cjs.readOutcome(outcome), [outcome]);
605
+ const keptEvidence = react.useMemo(() => chunkLBEKRN6Y_cjs.readEvidence(assessment), [assessment]);
598
606
  const storedGrade = outcomeReading?.kind === "graded" && outcomeReading.status === "graded" ? outcomeReading.grade : null;
599
607
  const storedMarks = react.useMemo(
600
608
  () => policy.feedback && isReview && keptEvidence === null && storedGrade?.details !== void 0 ? marksFromDetails(storedGrade.details) : null,
@@ -642,7 +650,7 @@ function ReadAloud({
642
650
  return { text: s.answerSubmitted, feedback: null };
643
651
  }
644
652
  return {
645
- text: `${s.answerSubmitted} ${s.scoreAnnouncement(chunk7F2YQWMW_cjs.percentOfGrade(grade), grade.passed)}`,
653
+ text: `${s.answerSubmitted} ${s.scoreAnnouncement(chunkLBEKRN6Y_cjs.percentOfGrade(grade), grade.passed)}`,
646
654
  feedback: grade.feedback
647
655
  };
648
656
  }
@@ -675,7 +683,7 @@ function ReadAloud({
675
683
  data.media !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "lk-ra-model", children: [
676
684
  /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "lk-ra-model-label", children: s.readAloudModelRecording }),
677
685
  /* @__PURE__ */ jsxRuntime.jsx(
678
- chunkUKUHVCZX_cjs.ActivityMedia,
686
+ chunkNDBMKGQ5_cjs.ActivityMedia,
679
687
  {
680
688
  media: data.media,
681
689
  renderMode,
@@ -692,7 +700,7 @@ function ReadAloud({
692
700
  slowMedia !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "lk-ra-model", "data-slow": "true", children: [
693
701
  /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "lk-ra-model-label", children: s.readAloudSlowRecording }),
694
702
  /* @__PURE__ */ jsxRuntime.jsx(
695
- chunkUKUHVCZX_cjs.ActivityMedia,
703
+ chunkNDBMKGQ5_cjs.ActivityMedia,
696
704
  {
697
705
  media: slowMedia,
698
706
  renderMode,
@@ -825,28 +833,32 @@ function ReadAloud({
825
833
  busy ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-pending", role: "status", "aria-busy": "true", children: phase.kind === "uploading" ? s.readAloudUploading : s.readAloudAssessing }) : null,
826
834
  alertText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-ra-alert", role: "alert", children: alertText }, errorNonce) : null,
827
835
  feedbackAssessment !== null ? /* @__PURE__ */ jsxRuntime.jsx(
828
- chunk7F2YQWMW_cjs.PronunciationFeedback,
836
+ chunkLBEKRN6Y_cjs.PronunciationFeedback,
829
837
  {
830
- data: { referenceText: data.referenceText, locale: data.locale },
838
+ data: coachingItem,
831
839
  assessment: feedbackAssessment,
832
840
  ...feedbackGrade !== null ? { grade: feedbackGrade } : {},
833
841
  ...feedbackAudio !== null ? { audioUrl: feedbackAudio } : {},
834
842
  ...breakThreshold !== void 0 ? { breakThreshold } : {},
835
843
  ...monotoneThreshold !== void 0 ? { monotoneThreshold } : {},
836
844
  ...locale !== void 0 ? { locale } : {},
837
- ...strings !== void 0 ? { strings } : {}
845
+ ...strings !== void 0 ? { strings } : {},
846
+ ...ai !== void 0 ? { ai } : {},
847
+ ...onInteraction !== void 0 ? { onInteraction } : {},
848
+ renderMode,
849
+ delivery: policy
838
850
  }
839
851
  ) : null,
840
852
  storedMarks !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-ra-marks", children: [
841
853
  /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "lk-ra-words", "aria-label": s.pronunciationWordsLabel, dir: contentDir, children: storedMarks.map((entry, index) => {
842
- const sentence = chunk7F2YQWMW_cjs.markSentence(entry, s);
854
+ const sentence = chunkLBEKRN6Y_cjs.markSentence(entry, s);
843
855
  return /* @__PURE__ */ jsxRuntime.jsxs(
844
856
  "li",
845
857
  {
846
858
  className: "lk-ra-word",
847
859
  "data-state": entry.state,
848
860
  children: [
849
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: chunk7F2YQWMW_cjs.VISUALLY_HIDDEN, children: sentence }),
861
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: chunkLBEKRN6Y_cjs.VISUALLY_HIDDEN, children: sentence }),
850
862
  /* @__PURE__ */ jsxRuntime.jsx(
851
863
  "span",
852
864
  {
@@ -862,9 +874,24 @@ function ReadAloud({
862
874
  index
863
875
  );
864
876
  }) }),
865
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "lk-ra-legend", children: STORED_STATES.map((state2) => /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": state2, children: s.pronunciationLegend(state2) }, state2)) })
877
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "lk-ra-legend", children: STORED_STATES.map((state2) => /* @__PURE__ */ jsxRuntime.jsx("li", { "data-state": state2, children: s.pronunciationLegend(state2) }, state2)) }),
878
+ /* @__PURE__ */ jsxRuntime.jsx(
879
+ chunkLBEKRN6Y_cjs.ReadingCoaching,
880
+ {
881
+ data: coachingItem,
882
+ grade: storedGrade,
883
+ renderMode,
884
+ delivery: policy,
885
+ ...ai !== void 0 ? { ai } : {},
886
+ ...locale !== void 0 ? { locale } : {},
887
+ ...onInteraction !== void 0 ? { onInteraction } : {},
888
+ strings: s,
889
+ contentLang,
890
+ contentDir
891
+ }
892
+ )
866
893
  ] }) : null,
867
- /* @__PURE__ */ jsxRuntime.jsx(chunkVPU6UY4O_cjs.FeedbackRegion, { id: `${data.id}-feedback`, children: isReview ? (
894
+ /* @__PURE__ */ jsxRuntime.jsx(chunk2PNSVBLQ_cjs.FeedbackRegion, { id: `${data.id}-feedback`, children: isReview ? (
868
895
  // A grade read back is feedback; "not graded yet" and a grade that
869
896
  // could not be read are not.
870
897
  outcomeReading !== void 0 && (policy.feedback || outcomeReading.kind !== "graded") ? /* @__PURE__ */ jsxRuntime.jsx(OutcomeSummary, { reading: outcomeReading, s, scoreShown: gradeShownInPanel }) : null
@@ -874,18 +901,18 @@ function ReadAloud({
874
901
  // but a live region is the only thing that TELLS a screen-reader
875
902
  // learner a grade arrived, since nothing takes focus. Clipped rather
876
903
  // than `display: none`, which would stop it being announced at all.
877
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: chunk7F2YQWMW_cjs.VISUALLY_HIDDEN, children: /* @__PURE__ */ jsxRuntime.jsx(AnnouncementText, { announcement }) })
904
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lk-visually-hidden", style: chunkLBEKRN6Y_cjs.VISUALLY_HIDDEN, children: /* @__PURE__ */ jsxRuntime.jsx(AnnouncementText, { announcement }) })
878
905
  ) : /* @__PURE__ */ jsxRuntime.jsx(AnnouncementText, { announcement }) })
879
906
  ]
880
907
  }
881
908
  );
882
909
  }
883
910
  function ReadAloud2(props) {
884
- const strings = chunkNFGUJ52G_cjs.useLkStrings(props.strings);
885
- return /* @__PURE__ */ jsxRuntime.jsx(chunkFISEZBLF_cjs.ActivityErrorBoundary, { activityTitle: props.data?.title, strings, children: /* @__PURE__ */ jsxRuntime.jsx(ReadAloud, { ...props }) });
911
+ const strings = chunkBIGGXHAW_cjs.useLkStrings(props.strings);
912
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkJ3C72RPK_cjs.ActivityErrorBoundary, { activityTitle: props.data?.title, strings, children: /* @__PURE__ */ jsxRuntime.jsx(ReadAloud, { ...props }) });
886
913
  }
887
914
 
888
915
  exports.ReadAloud = ReadAloud2;
889
916
  exports.stopCaptureGroup = stopCaptureGroup;
890
- //# sourceMappingURL=chunk-DZ7VLLDQ.cjs.map
891
- //# sourceMappingURL=chunk-DZ7VLLDQ.cjs.map
917
+ //# sourceMappingURL=chunk-TP5UMRAU.cjs.map
918
+ //# sourceMappingURL=chunk-TP5UMRAU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/shared/capture-registry.ts","../src/components/ReadAloud/recording-bounds.ts","../src/components/ReadAloud/ReadAloud.tsx","../src/components/ReadAloud/index.tsx"],"names":["READ_ALOUD_MAX_SECONDS","READ_ALOUD_MAX_TAKES","detailIsRight","jsxs","Fragment","jsx","percentOfGrade","useDeliveryPolicy","useLkStrings","useContext","SequenceSlotContext","useMemo","isDevelopment","assertRedacted","validateActivity","ActivitySchemaError","useSpeechRecorder","useActivityState","useState","useId","useRef","useEffect","take","useCallback","usePlaybackRefusal","readAssessResult","stampTake","xAPIBuilder","ANONYMOUS_ACTOR","objectIdFor","xapiDefinitionFor","fractionOfGrade","mintTake","localeDirectionOf","readOutcome","readEvidence","ActivityMedia","PronunciationFeedback","markSentence","VISUALLY_HIDDE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,CAAA,EAAM,UAAA,EAAY,mBAAmB,CAAA,GAC5E;AAAA,YACF,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMFA,cAAA,CAAC,UAAK,SAAA,EAAU,oBAAA,EAAqB,OAAOkC,iCAAA,EAC1C,QAAA,kBAAAlC,cAAA,CAAC,gBAAA,EAAA,EAAiB,YAAA,EAA4B,CAAA,EAChD;AAAA,4BAEAA,cAAA,CAAC,gBAAA,EAAA,EAAiB,YAAA,EAA4B,CAAA,EAElD;AAAA;AAAA;AAAA,GACF;AAEJ;AChgDO,SAASsC,WAAU,KAAA,EAAuB;AAC/C,EAAA,MAAM,OAAA,GAAUnC,8BAAA,CAAa,KAAA,CAAM,OAAO,CAAA;AAC1C,EAAA,uBACEH,cAAAA,CAACuC,uCAAA,EAAA,EAAsB,aAAA,EAAe,KAAA,CAAM,IAAA,EAAM,KAAA,EAAO,OAAA,EACvD,QAAA,kBAAAvC,cAAAA,CAAC,SAAA,EAAA,EAAe,GAAG,OAAO,CAAA,EAC5B,CAAA;AAEJ","file":"chunk-TP5UMRAU.cjs","sourcesContent":["'use client';\n\n/**\n * Microphone captures that must stop when the region holding them goes away,\n * keyed by group name.\n *\n * Module-level for the reason `playback-group.ts` is: the thing that knows a\n * pane was hidden — the sequence — is not the thing holding the microphone,\n * and a context would have to be threaded through every activity component to\n * reach one. The caller mints the group name per region; a sequence uses the\n * slot's, so hiding one slot stops that slot's capture and no other's. The name\n * reaches a recorder only through `SequenceSlotContext`, never as a prop, so no\n * consumer string can join another region's group.\n *\n * This **supplements** a recorder's own teardown and never replaces it. The\n * sequence's pane effect runs only on a `hidden` transition, not on unmount,\n * and neither a preview nor a standalone render has panes at all — so a\n * component that records still releases the microphone from its own cleanup,\n * and this registry only covers the case where the component is left mounted\n * and merely hidden.\n *\n * No `useCaptureGroup` hook, unlike playback: that one re-registers after every\n * commit because the element behind a ref can be replaced while the ref object\n * is not, whereas a recorder's `stop` keeps one identity for the life of the\n * hook and a plain effect registers it exactly once.\n */\nconst groups = new Map<string, Set<() => void>>();\n\n/** Adds a capture's stop to a group; returns the matching removal. */\nexport function joinCaptureGroup(group: string, stop: () => void): () => void {\n let members = groups.get(group);\n if (members === undefined) {\n members = new Set();\n groups.set(group, members);\n }\n members.add(stop);\n return () => {\n const current = groups.get(group);\n if (current === undefined) {\n return;\n }\n current.delete(stop);\n if (current.size === 0) {\n groups.delete(group);\n }\n };\n}\n\n/**\n * Stops every capture in the group.\n *\n * The members are copied before they are called. Each `stop` is expected to\n * run its own removal, and a component that answers one by starting again\n * would otherwise be stopped by the sweep that its own stop provoked.\n */\nexport function stopCaptureGroup(group: string): void {\n const members = groups.get(group);\n if (members === undefined) {\n return;\n }\n for (const stop of [...members]) {\n stop();\n }\n}\n","'use client';\n\nimport { READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES } from '@intellectif/lk-core';\n\n/** The bounds a take is captured under, as the recorder and the sentences use them. */\nexport interface RecordingBounds {\n /** Above 0, and at most `READ_ALOUD_MAX_SECONDS`. */\n maxSeconds: number;\n /** At least 0 and below `maxSeconds`, or `undefined` for no minimum. */\n minSeconds: number | undefined;\n /** A whole number from 1 to `READ_ALOUD_MAX_TAKES`, or `undefined` for no limit. */\n maxTakes: number | undefined;\n}\n\nconst isNumber = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value);\n\n/**\n * The one reading of an item's `recording`: every bound the component captures\n * under, every sentence that names one, and the key that decides whether a new\n * `data` is a new reading all come from here, so no two of them can read the\n * same field differently.\n *\n * `practice` renders unvalidated content in production, so what comes in may\n * be anything a server stored. What comes out is always a set of bounds the\n * schema accepts, and bounds the schema accepts come out unchanged. Three\n * rules decide the rest, and each errs toward a take the learner can finish:\n *\n * - **A present bound that cannot be read is the schema's own ceiling**, never\n * no bound at all: a `maxSeconds` of `\"20\"` or `NaN` records up to\n * `READ_ALOUD_MAX_SECONDS`, and a `maxTakes` of `\"1\"` allows\n * `READ_ALOUD_MAX_TAKES`. Unreadable data can make the recorder stricter\n * than the ceiling, never looser: `maxTakes: \"1\"` used to mean unlimited\n * takes. `null` is an absent optional, as it is everywhere a host sends JSON.\n * - **A count is a whole number in range**: `0` and `1.5` read as `1`, `999`\n * as the ceiling.\n * - **A minimum the maximum cannot reach is no minimum.** A `minSeconds` of 30\n * under a `maxSeconds` of 20 stopped every take at 20 and then refused it as\n * too short, so the item could never be answered. The schema refuses that\n * pair; a reading that honoured it would leave the learner a dead end.\n */\nexport function readRecordingBounds(recording: unknown): RecordingBounds {\n const bounds =\n typeof recording === 'object' && recording !== null\n ? (recording as Record<string, unknown>)\n : {};\n const maxSeconds =\n isNumber(bounds.maxSeconds) && bounds.maxSeconds > 0\n ? Math.min(bounds.maxSeconds, READ_ALOUD_MAX_SECONDS)\n : READ_ALOUD_MAX_SECONDS;\n const minSeconds =\n isNumber(bounds.minSeconds) && bounds.minSeconds >= 0 && bounds.minSeconds < maxSeconds\n ? bounds.minSeconds\n : undefined;\n const takes = bounds.maxTakes;\n const maxTakes =\n takes === undefined || takes === null\n ? undefined\n : isNumber(takes)\n ? Math.min(Math.max(1, Math.floor(takes)), READ_ALOUD_MAX_TAKES)\n : READ_ALOUD_MAX_TAKES;\n return { maxSeconds, minSeconds, maxTakes };\n}\n\n/**\n * A length of audio as the whole seconds a sentence says beside `maxSeconds`,\n * never more than it. A bound may be fractional — the schema allows 2.5 — and\n * rounding a take that ran to it said \"3 of 2.5 seconds\". Rounded to the\n * nearest second for a finished take, and down for the counter of one still\n * running, which should not reach its bound before the take does.\n */\nexport function secondsWithin(\n milliseconds: number,\n maxSeconds: number,\n rounding: 'nearest' | 'down',\n): number {\n const seconds = milliseconds / 1000;\n const whole = rounding === 'nearest' ? Math.round(seconds) : Math.floor(seconds);\n return Math.min(Math.max(0, whole), maxSeconds);\n}\n","'use client';\n\nimport {\n type ActivityMedia as ActivityMediaData,\n ActivitySchemaError,\n assertRedacted,\n type GradeRecord,\n type InteractionKind,\n type LearnerResponse,\n type MediaPlaybackPolicy,\n type ReadAloudData,\n type ReadAloudLearnerResponse,\n type ReadAloudWordAlignment,\n type RecordingRef,\n type ScoringDetail,\n type SpeechAssessment,\n validateActivity,\n xAPIBuilder,\n xapiDefinitionFor,\n} from '@intellectif/lk-core';\nimport {\n type CSSProperties,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useActivityState } from '../../hooks/useActivityState.js';\nimport type { RecordedTake, SpeechRecorderStatus } from '../../hooks/useSpeechRecorder.js';\nimport { useSpeechRecorder } from '../../hooks/useSpeechRecorder.js';\nimport { localeDirectionOf } from '../../i18n/direction.js';\nimport { useLkStrings } from '../../i18n/LkIntlProvider.js';\nimport type { LkStrings } from '../../i18n/strings.js';\nimport { ANONYMOUS_ACTOR, detailIsRight, isDevelopment, objectIdFor } from '../_internal.js';\nimport { PronunciationFeedback } from '../PronunciationFeedback/index.js';\nimport { markSentence, VISUALLY_HIDDEN } from '../PronunciationFeedback/PronunciationFeedback.js';\nimport { ActivityMedia } from '../shared/ActivityMedia.js';\nimport { ReadingCoaching } from '../shared/AiCoaching.js';\nimport { joinCaptureGroup } from '../shared/capture-registry.js';\nimport { useDeliveryPolicy } from '../shared/delivery.js';\nimport { FeedbackRegion } from '../shared/FeedbackRegion.js';\nimport { usePlaybackRefusal } from '../shared/playback-refusal.js';\nimport {\n fractionOfGrade,\n type OutcomeReading,\n percentOfGrade,\n type ReadGrade,\n readAssessResult,\n readEvidence,\n readOutcome,\n} from '../shared/read-grade.js';\nimport {\n mintTake,\n SequenceSlotContext,\n stampTake,\n type TakeState,\n} from '../shared/sequence-slot.js';\nimport type { ActivityProps, Renderable } from '../types.js';\nimport { readRecordingBounds, secondsWithin } from './recording-bounds.js';\n\n/**\n * Names playback groups for the model recordings. Per mount and never derived\n * from `useId`: two separately hydrated roots derive the same id for the same\n * tree position, and their recordings would pause each other. The name never\n * reaches the DOM.\n */\nlet modelsGroupCount = 0;\n\n/** A title with something in it a screen reader can say. */\nconst VISIBLE_TEXT_RE = /[^\\p{White_Space}\\p{Cc}\\p{Cf}\\p{Default_Ignorable_Code_Point}]/u;\n\n/** A stored mark's id, as `gradeReadAloud` numbers the reference words. */\nconst MARK_ID_RE = /^w\\d+$/;\n\n/** The states a mark rebuilt from stored details can carry: insertions are not stored. */\nconst STORED_STATES: readonly ReadAloudWordAlignment['state'][] = [\n 'correct',\n 'mispronounced',\n 'omitted',\n];\n\n/** The level meter's resolution, in steps the skin can select on. */\nconst LEVEL_STEPS = 10;\n\n/**\n * What an application's assessor came back with.\n *\n * `code` is a plain `string` and not `SpeechUnscorableCode`: an application's\n * own assessor may refuse a take for a reason the SDK has no name for, and a\n * narrower type would make it unreportable. This component classifies the two\n * codes that mean \"nothing was heard\" and treats every other one the same way.\n */\nexport type ReadAloudAssessResult =\n | { status: 'graded'; assessment: SpeechAssessment; grade: GradeRecord }\n | { status: 'unscorable'; code: string; assessment?: SpeechAssessment }\n | { status: 'failed'; retryable: boolean };\n\n/**\n * How a take reaches the application, and how a judgement comes back.\n *\n * Named `recordingBinding` rather than `recording` because both\n * `ReadAloudData.recording` (the bounds) and `ReadAloudLearnerResponse.recording`\n * (the stored take) already exist: the plain name would read as one of those.\n */\nexport interface RecordingBinding {\n /**\n * Puts the take in your storage and returns its key. **Required** outside\n * `review`: without it a learner can speak into a control that submits\n * nothing. Settle it — a promise that never does leaves the submit pending\n * for ever.\n */\n upload(take: RecordedTake): Promise<RecordingRef>;\n /**\n * Judges the stored take. `practice` only — an exam never assesses on the\n * client. Optional: a binding without it records, uploads and submits, and\n * the feedback is replaced by a notice.\n */\n assess?(ref: RecordingRef): Promise<ReadAloudAssessResult>;\n /** A playable link to a stored take. `review` only. */\n playbackUrl?(ref: RecordingRef): Promise<string>;\n}\n\nexport interface ReadAloudProps extends ActivityProps<ReadAloudData> {\n /** How a take is stored and judged. See {@link RecordingBinding}. */\n recordingBinding?: RecordingBinding;\n /**\n * The evidence behind a stored grade, for `review`. Without it a graded\n * outcome still shows its marks, rebuilt from `outcome.grade.details`; with\n * neither, the score is shown and no marks are.\n */\n assessment?: SpeechAssessment;\n /**\n * Confidence above which a break note is shown, 0..1, forwarded to\n * {@link PronunciationFeedback}. No default — see its own prop.\n */\n breakThreshold?: number;\n /** The same, for the monotone note. */\n monotoneThreshold?: number;\n /**\n * The URL of a self-hosted copy of `CAPTURE_PROCESSOR_SOURCE`, handed to the\n * recorder, for a Content-Security-Policy whose `script-src` does not allow\n * `blob:`. Without it the capture module is loaded from a `blob:` URL, and a\n * policy that refuses one sends every take through the deprecated\n * main-thread `ScriptProcessorNode` — a take that still records, so nothing\n * says so. See `useSpeechRecorder`'s option of the same name.\n */\n workletUrl?: string;\n /**\n * Never called. A read-aloud answer is a key in your storage, and there is\n * none until the take has been uploaded — so there is no intermediate\n * response to report, and reporting the take itself would offer a host a\n * recording it has nowhere to put. `onSubmit` carries the response, once.\n */\n onChange?: (response: LearnerResponse) => void;\n}\n\n/** What the live region says: the SDK's own sentence, then any grader feedback. */\ninterface Announcement {\n text: string;\n feedback: string | null;\n}\n\n/**\n * How far the submitted take has got. `idle` also means \"nothing submitted yet\".\n *\n * Every other phase names its `take`, the number `mintTake` gave the submit\n * that reached it: a phase describes one take, and a pager told about it must\n * be able to tell that take from the one before it.\n */\ntype SubmitPhase =\n | { kind: 'idle' }\n | { kind: 'uploading'; take: number }\n | { kind: 'upload-failed'; take: number }\n | { kind: 'assessing'; take: number }\n | { kind: 'submitted'; take: number }\n | { kind: 'unassessed'; take: number }\n /**\n * The assessor's judgement, as `readAssessResult` read it: `grade` is `null`\n * when what came back cannot be shown as a grade, and `assessment` is `null`\n * when there is no evidence to mark words from.\n */\n | {\n kind: 'graded';\n take: number;\n assessment: SpeechAssessment | null;\n grade: ReadGrade | null;\n }\n | { kind: 'unscorable'; take: number; code: string | undefined }\n | { kind: 'assess-failed'; take: number; retryable: boolean };\n\n/**\n * Whether the screen offers \"Try again\" for the take this phase describes —\n * the one answer to that question, read by the button that offers it and by\n * the take state a pager is told, so the two cannot disagree. A retry re-sends\n * the SAME take: a take that failed to upload is sent again, and a stored take\n * whose assessment failed is judged again without being uploaded twice.\n */\nfunction offersRetry(phase: SubmitPhase, uploaded: RecordingRef | null): boolean {\n return (\n phase.kind === 'upload-failed' ||\n (phase.kind === 'assess-failed' && phase.retryable && uploaded !== null)\n );\n}\n\n/**\n * The state of the phase's take, as a pager deciding whether its set is\n * finished reads it. Derived from the phase alone, so no path through a submit\n * can leave a pager waiting on a take this component has finished with: every\n * path ends in a phase.\n */\nfunction takeStateOf(phase: SubmitPhase, uploaded: RecordingRef | null): TakeState {\n if (phase.kind === 'uploading' || phase.kind === 'assessing') {\n return 'in-flight';\n }\n return offersRetry(phase, uploaded) ? 'retryable' : 'settled';\n}\n\n/**\n * Whether the recorder is capturing, or about to: the one answer to \"is a take\n * being recorded\", read by everything that must hold still for one. A\n * permission prompt counts — a prompt answered after the pane went away would\n * otherwise open a microphone nobody is in front of, and a model recording\n * played while the prompt is up would be charged a play and then silenced.\n */\nfunction capturing(status: SpeechRecorderStatus): boolean {\n return status === 'recording' || status === 'requesting-permission';\n}\n\n/**\n * What a take is a take OF: the item, the words, their language and the bounds\n * the take is captured under. A change to any of these is a different reading,\n * and a take of the old one answers nothing.\n *\n * Deliberately NOT the identity of `data`. `redact()` returns a new object on\n * every call, and `activities={raw.map(redact)}` is a documented way to pass a\n * paper, so a host that rebuilds its items on every render is ordinary — and a\n * reset keyed on identity silently threw away every grade still in flight and\n * refunded the take budget on each of those renders, so a `maxTakes: 1` exam\n * accepted a second take. The title, the instructions and the model recordings\n * are presentation; editing them leaves the take a take of the same reading.\n *\n * The bounds are the CLAMPED ones, which are what the recorder is given. Read\n * field by field into strings, so no value unvalidated data carries can make\n * the key throw.\n */\nfunction readingKeyOf(\n data: Renderable<ReadAloudData>,\n bounds: { maxSeconds: number; minSeconds: number | undefined; maxTakes: number | undefined },\n): string {\n const text = (value: unknown): string | null => (typeof value === 'string' ? value : null);\n return JSON.stringify([\n text(data.id),\n text(data.referenceText),\n text(data.locale),\n String(bounds.maxSeconds),\n String(bounds.minSeconds),\n String(bounds.maxTakes),\n ]);\n}\n\n/**\n * The slower model recording as an `ActivityMedia`: it follows the model\n * recording's playback policy minus `maxPlays` (`controls`, `seek`, `rate`,\n * the native hints), so a locked scrubber or a fixed speed binds both files —\n * and it never carries a budget of its own, so `<ActivityMedia>` never demands\n * a binding for it. `undefined` when there is no slow recording.\n */\nfunction slowMediaFor(\n data: Renderable<ReadAloudData>,\n label: string,\n): ActivityMediaData | undefined {\n const slow = data.slowMedia;\n if (slow === undefined) {\n return undefined;\n }\n const policy: MediaPlaybackPolicy = data.media?.playback ?? {};\n const { maxPlays: _budget, ...inherited } = policy;\n const hasPolicy = Object.values(inherited).some((value) => value !== undefined);\n return {\n type: 'audio',\n url: slow.url,\n alt: slow.alt ?? label,\n ...(hasPolicy ? { playback: inherited } : {}),\n };\n}\n\n/**\n * Word marks rebuilt from stored scoring details — a server-recorded mark shown\n * after the fact, with no assessment on the client. Inserted words are not in\n * the details (`gradeReadAloud` stores one mark per REFERENCE word, and a word\n * the learner added is not one the item asked for), so none appear.\n *\n * The details are a read grade's, so every entry is well-formed; what is left\n * to decide here is whether they are word marks at all, rather than a rubric's\n * own breakdown.\n */\nfunction marksFromDetails(details: readonly ScoringDetail[]): ReadAloudWordAlignment[] | null {\n if (details.length === 0 || !details.every((detail) => MARK_ID_RE.test(detail.itemId))) {\n return null;\n }\n return details.map((detail) => {\n const heard = Array.isArray(detail.learnerResponse)\n ? detail.learnerResponse.join(' ')\n : detail.learnerResponse;\n const reference = Array.isArray(detail.correctResponse)\n ? detail.correctResponse.join(' ')\n : detail.correctResponse;\n const correct = detailIsRight(detail);\n const state: ReadAloudWordAlignment['state'] = correct\n ? 'correct'\n : detail.outcome === 'incorrect-omission'\n ? 'omitted'\n : 'mispronounced';\n return {\n itemId: detail.itemId,\n reference,\n heard,\n state,\n // `ScoringDetail.score` is the word's accuracy divided by 100; the marks\n // carry it back in the units the assessment used.\n ...(typeof detail.score === 'number' ? { accuracy: detail.score * 100 } : {}),\n };\n });\n}\n\n/** The stored take a learner response points at, or `null` for a blank or another type. */\nfunction recordingOf(response: LearnerResponse | undefined): RecordingRef | null {\n return response !== undefined && response.type === 'read-aloud' ? response.recording : null;\n}\n\n/** The response this component emits; `takes` is written only when one was made. */\nfunction responseOf(recording: RecordingRef | null, takes: number): ReadAloudLearnerResponse {\n return { type: 'read-aloud', recording, ...(takes > 0 ? { takes } : {}) };\n}\n\n/**\n * Which learner message an unscorable code earns. The two codes that mean\n * \"nothing was heard\" send the learner back to a quieter room; every other one,\n * the SDK's and an application's own alike — and no code at all — says only\n * that this take could not be assessed. **The code itself is never shown** — it\n * is a developer's label.\n */\nfunction unscorableMessage(code: string | undefined, s: LkStrings): string {\n return code === 'no_speech' || code === 'insufficient_voiced_time'\n ? s.readAloudNotHeard\n : s.readAloudNotAssessed;\n}\n\n/**\n * The announcement, with grader feedback in its own isolated span: its\n * direction is its own, so an English \"Well read.\" in an Arabic interface keeps\n * its full stop at its end. Its language is not guessed — feedback may be\n * written in the interface's language or the reading's.\n */\nfunction AnnouncementText({ announcement }: { announcement: Announcement | null }) {\n if (announcement === null) {\n return null;\n }\n return (\n <>\n {announcement.text}\n {announcement.feedback ? (\n <>\n {' '}\n <span dir=\"auto\">{announcement.feedback}</span>\n </>\n ) : null}\n </>\n );\n}\n\n/**\n * The server's outcome in `review`, as `readOutcome` read it. Nothing on this\n * path scores, infers or defaults a grade.\n *\n * `scoreShown` says whether the grade is already on screen — it is, whenever\n * `<PronunciationFeedback>` was given the same grade — so the sentence is not\n * rendered twice. The wrapper and its attributes are rendered either way,\n * because they are what a stylesheet and a diagnostic read.\n */\nfunction OutcomeSummary({\n reading,\n s,\n scoreShown,\n}: {\n reading: OutcomeReading;\n s: LkStrings;\n scoreShown: boolean;\n}) {\n switch (reading.kind) {\n case 'graded':\n return (\n <div\n className=\"lk-ra-outcome\"\n data-status={reading.status}\n data-passed={String(reading.grade.passed)}\n >\n {scoreShown ? null : (\n <>\n <p className=\"lk-ra-grade\">\n {s.scoreAnnouncement(percentOfGrade(reading.grade), reading.grade.passed)}\n </p>\n {reading.grade.feedback ? (\n <p className=\"lk-ra-grade-feedback\" dir=\"auto\">\n {reading.grade.feedback}\n </p>\n ) : null}\n </>\n )}\n </div>\n );\n case 'deferred':\n return (\n <div className=\"lk-ra-outcome\" data-status=\"deferred\">\n <p className=\"lk-ra-grade\">{s.awaitingGrade}</p>\n </div>\n );\n case 'unscorable':\n // An unscorable code is a developer-facing label: it goes on the element\n // for diagnostics and routing, and never in front of the learner as text.\n return (\n <div\n className=\"lk-ra-outcome\"\n data-status=\"unscorable\"\n {...(reading.code !== undefined ? { 'data-code': reading.code } : {})}\n >\n <p className=\"lk-ra-grade\">{s.couldNotBeGraded}</p>\n </div>\n );\n default:\n // A stored outcome that claims a grade and carries none that can be read\n // gets the deferred vocabulary's own sentence rather than \"Score NaN%.\":\n // there is a grade, and this screen cannot say what it was. No\n // `data-passed`, because there is no verdict to style.\n return (\n <div\n className=\"lk-ra-outcome\"\n {...(reading.status !== undefined ? { 'data-status': reading.status } : {})}\n >\n <p className=\"lk-ra-grade\">{s.couldNotBeGraded}</p>\n </div>\n );\n }\n}\n\n/**\n * Reads a text aloud and hands the recording to the application.\n *\n * The SDK records; it never judges. A take is captured as mono 16-bit PCM WAV\n * at 16 kHz — the one format `inspectWav` measures directly — handed to\n * `recordingBinding.upload`, and reported through `onSubmit`. Whether anything\n * assesses it, and where, is the application's: in `practice` an optional\n * `assess` may come back with a grade, and in `exam` nothing is ever assessed\n * on the client.\n *\n * **`recordingBinding.upload` is required outside `review`** and its absence\n * throws at render, in production too: a learner must never speak into a\n * control that stores nothing. `assess` is not required — a binding without it\n * records, uploads and submits, and shows a notice in place of the feedback.\n *\n * **A grade that comes back is read, not trusted** — whether `assess` returned\n * it or `outcome` carries it. A score that is not a number between 0 and its\n * maximum, or a `passed` that is not a boolean, is shown as could-not-be-graded\n * and never reaches `onComplete` or a statement; `onComplete` fires exactly when\n * a score is on screen, with that score.\n *\n * **AI coaching**, with a `pronunciationCoaching` port: under the marks, a\n * button asks a model to explain them — in `practice` once a take is graded,\n * and in `review` wherever marks are shown, from kept evidence or from the\n * stored grade's details. Never in `exam`. The marks are the engine's, and\n * coaching on a word it did not mark is refused whole.\n *\n * **Under a strict Content-Security-Policy** the take is played back from a\n * `blob:` URL, so `media-src` must allow `blob:` — refused, the player and the\n * per-word buttons give way to a note saying the take cannot be played here —\n * and the capture module loads from one too, so either `script-src` allows\n * `blob:` or `workletUrl` names a self-hosted copy of `CAPTURE_PROCESSOR_SOURCE`.\n *\n * ```tsx\n * <ReadAloud\n * data={item}\n * recordingBinding={{ upload, assess }}\n * onSubmit={persist}\n * onComplete={record}\n * />\n * ```\n */\nexport function ReadAloud({\n data,\n onComplete,\n onSubmit,\n onInteraction,\n value,\n defaultValue,\n defaultSubmitted,\n renderMode = 'practice',\n outcome,\n mediaBudget,\n mediaStrings,\n strings,\n theme,\n locale,\n disabled,\n recordingBinding,\n assessment,\n breakThreshold,\n monotoneThreshold,\n workletUrl,\n delivery,\n ai,\n}: ReadAloudProps) {\n const isExam = renderMode === 'exam';\n // A read-aloud's grade comes back from the host's assessor, but showing it is\n // still feedback: without it the learner hears that the take was handed in,\n // and the grade still reaches `onComplete`. It has no solution and no hints.\n const policy = useDeliveryPolicy(delivery);\n const isReview = renderMode === 'review';\n const s = useLkStrings(strings);\n // The pager slot this component sits in, if any: the capture group its pane\n // stops, and where the state of each take is reported. A context and never a\n // prop, so none of it is on this component's published signature — a\n // consumer string in a prop could stop another pager's microphone. `null`\n // for a standalone component, which then belongs to no group at all and\n // releases the microphone from its own unmount alone.\n const slot = useContext(SequenceSlotContext);\n const captureGroup = slot?.captureGroup;\n\n const devError = useMemo(() => {\n if (!isDevelopment()) {\n return null;\n }\n // No `hasKey` branch, unlike `<Dictation>`: a read-aloud item has no answer\n // key, so `redact()` produces a projection the strict redacted schema\n // describes exactly and there is no revealed variant to make room for.\n if (data.redacted === true) {\n try {\n assertRedacted(data);\n return null;\n } catch (error) {\n return error instanceof Error ? error : new Error(String(error));\n }\n }\n const result = validateActivity('read-aloud', data);\n return result.success ? null : new ActivitySchemaError('read-aloud', result.errors);\n }, [data]);\n\n // The bounds a take is captured under, READ and not merely defaulted, because\n // `practice` renders unvalidated content in production: a `maxSeconds` of\n // 100000 arms a recording that never stops itself, a `maxTakes` of \"1\" meant\n // unlimited takes, and a minimum above the maximum refused every take. One\n // reader owns all of it — see `readRecordingBounds`.\n const { maxSeconds, minSeconds, maxTakes } = readRecordingBounds(data.recording);\n const readingKey = readingKeyOf(data, { maxSeconds, minSeconds, maxTakes });\n\n const recorder = useSpeechRecorder(\n useMemo(\n () => ({\n maxDurationMs: maxSeconds * 1000,\n ...(minSeconds !== undefined ? { minDurationMs: minSeconds * 1000 } : {}),\n ...(maxTakes !== undefined ? { maxTakes } : {}),\n // Forwarded, never defaulted: without it the recorder mints its own\n // `blob:` module, which is the one a strict policy refuses.\n ...(workletUrl !== undefined ? { workletUrl } : {}),\n }),\n [maxSeconds, minSeconds, maxTakes, workletUrl],\n ),\n );\n\n const { state, start, complete, getTimeSpent, reset } = useActivityState(\n defaultSubmitted === true ? 'completed' : 'idle',\n );\n const [phase, setPhase] = useState<SubmitPhase>({ kind: 'idle' });\n const [uploaded, setUploaded] = useState<RecordingRef | null>(null);\n const [takeUrl, setTakeUrl] = useState<string | null>(null);\n const [playbackUrl, setPlaybackUrl] = useState<string | null>(null);\n // Re-keys the alert so the SAME message announces again — a learner who is\n // refused the microphone twice hears it twice.\n const [errorNonce, setErrorNonce] = useState(0);\n\n const ids = useId();\n const titleId = `${ids}-title`;\n // Per mount, not per activity id: two renderings of one item on a page (a\n // review list, a preview beside a sequence) are separate players.\n const [modelsGroup] = useState(() => {\n modelsGroupCount += 1;\n return `lk-ra-models-${modelsGroupCount}`;\n });\n\n // The latest callbacks, so an effect can fire an event without depending on a\n // binding or a handler the host rebuilds on every render.\n const interactionRef = useRef(onInteraction);\n interactionRef.current = onInteraction;\n const bindingRef = useRef(recordingBinding);\n bindingRef.current = recordingBinding;\n // Guards a second submit while one is in flight: two clicks would upload the\n // same take twice and charge the application for two assessments.\n const submittingRef = useRef(false);\n // Which reading this instance is on. Everything asynchronous reads it once\n // and re-reads it after every await, so an instance that has been unmounted,\n // or handed a different reading, reports nothing for the one it has left —\n // the treatment the playback-url effect below already gives itself.\n //\n // A counter rather than the boolean `live` that effect uses, because a\n // boolean cleared on the reading reset would stay cleared and leave a\n // perfectly live component unable to submit its next take.\n const runRef = useRef(0);\n // The pager slot as of the latest render, and the last take it was told\n // about, so an unmount can tell it that take is over — a take whose result\n // this instance will now never report must not hold a set open for ever.\n const slotRef = useRef(slot);\n slotRef.current = slot;\n const reportedTakeRef = useRef<number | null>(null);\n useEffect(\n () => () => {\n runRef.current += 1;\n const take = reportedTakeRef.current;\n if (take !== null) {\n slotRef.current?.takeState(take, 'settled');\n }\n },\n [],\n );\n\n const fire = useCallback(\n (type: InteractionKind, payload: Record<string, unknown>): void => {\n interactionRef.current?.({ type, activityId: data.id, timestamp: Date.now(), payload });\n },\n [data.id],\n );\n\n // `recording-started` and `recording-stopped` are reported from the recorder's\n // own status rather than from the click handlers: a take also ends when it\n // reaches its bound, and a handler would report only the ends a learner asked\n // for.\n const lastStatusRef = useRef<SpeechRecorderStatus>(recorder.status);\n useEffect(() => {\n if (lastStatusRef.current === recorder.status) {\n return;\n }\n lastStatusRef.current = recorder.status;\n if (recorder.status === 'recording') {\n fire('recording-started', { takes: recorder.takesUsed, durationMs: 0 });\n } else if (recorder.status === 'recorded' && recorder.take !== null) {\n fire('recording-stopped', {\n takes: recorder.takesUsed,\n durationMs: recorder.take.durationMs,\n });\n }\n }, [recorder.status, recorder.take, recorder.takesUsed, fire]);\n\n useEffect(() => {\n if (recorder.error !== null) {\n setErrorNonce((nonce) => nonce + 1);\n }\n }, [recorder.error]);\n\n // The take preview. Guarded because an embedder may forbid object URLs, and a\n // preview is worth less than the take it previews.\n const take = recorder.take;\n useEffect(() => {\n if (take === null || typeof URL.createObjectURL !== 'function') {\n return;\n }\n const url = URL.createObjectURL(take.blob);\n setTakeUrl(url);\n return () => {\n URL.revokeObjectURL(url);\n setTakeUrl(null);\n };\n }, [take]);\n\n const restored = recordingOf(value ?? defaultValue);\n const restoredKey = restored?.key ?? null;\n // Keyed by the reading as well as the take: the reading reset below clears\n // the link, and a link nothing mints again would leave the stored take with\n // no player for as long as it stays on screen.\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the stored take and the reading, not by the identity of a response object a host rebuilds every render\n useEffect(() => {\n const binding = bindingRef.current;\n if (!isReview || restored === null || binding?.playbackUrl === undefined) {\n return;\n }\n let live = true;\n void Promise.resolve(binding.playbackUrl(restored)).then(\n (url) => {\n if (live) {\n setPlaybackUrl(url);\n }\n },\n () => {\n /* a link that could not be minted; the marks still render without it */\n },\n );\n return () => {\n live = false;\n };\n }, [isReview, restoredKey, readingKey]);\n\n // What the registry may do to this component, and it is narrow: release the\n // DEVICE, and only while one is actually open.\n //\n // The pager stops a hidden slot's captures on EVERY hidden transition, so a\n // join that discarded unconditionally threw away a take that was already\n // encoded — and `discard` deliberately refunds nothing, so Next then Prev\n // left the learner an activity they could no longer answer and no message\n // saying why. That contradicts the pager's own founding principle: slots stay\n // mounted precisely so nobody silently loses an answer. A capture still\n // running has nothing to lose yet; a finished take has everything.\n //\n // The status is read from a ref so this callback keeps ONE identity and the\n // effect below joins the group exactly once, as `playback-group`'s does.\n const statusRef = useRef(recorder.status);\n statusRef.current = recorder.status;\n const releaseMicrophone = useCallback(() => {\n if (capturing(statusRef.current)) {\n recorder.discard();\n }\n }, [recorder.discard]);\n\n // The registry SUPPLEMENTS the recorder's own unmount cleanup; it covers the\n // one case that cleanup cannot, a component left mounted and merely hidden.\n useEffect(() => {\n if (captureGroup === undefined) {\n return;\n }\n return joinCaptureGroup(captureGroup, releaseMicrophone);\n }, [captureGroup, releaseMicrophone]);\n\n // Identity-guarded so the mount run is a no-op: without it this fires after\n // the first paint and undoes every seed it was just given.\n const defaultSubmittedRef = useRef(defaultSubmitted);\n useEffect(() => {\n defaultSubmittedRef.current = defaultSubmitted;\n }, [defaultSubmitted]);\n // Keyed by the READING, never by the identity of `data` — see `readingKeyOf`\n // for the regression that identity caused. A host that rebuilds an\n // unchanged item keeps the take, the budget and any grade still in flight.\n const lastReadingRef = useRef(readingKey);\n useEffect(() => {\n if (lastReadingRef.current === readingKey) {\n return;\n }\n lastReadingRef.current = readingKey;\n submittingRef.current = false;\n // Anything still in flight belongs to the reading that has just left.\n runRef.current += 1;\n setPhase({ kind: 'idle' });\n setUploaded(null);\n setPlaybackUrl(null);\n // `reset`, not `discard`: the takes belong to the READING, and `discard`\n // refunds none of them on purpose. A new reading that inherited the old\n // one's spent takes renders a recorder that looks live and refuses to\n // record — reachable in `<ActivityPreview>`, whose remount key is derived\n // from the media alone, so an author who tries one take and then edits the\n // reference text can never record again without reloading the page.\n recorder.reset();\n reset(defaultSubmittedRef.current === true ? 'completed' : 'idle');\n }, [readingKey, reset, recorder.reset]);\n\n // What became of each take, told to the pager slot this sits in: the one\n // channel through which a sequence learns whether its set can be reported.\n //\n // Read from the committed PHASE, and only from it. Every way a submit can end\n // — a grade, a take with no grade, a failure, a retry, a learner recording\n // again, a reading reset — ends in a phase, so none of them can leave a set\n // waiting on a take this component is done with. And an effect runs after\n // the commit, which is after `onSubmit` and `onComplete` were called for the\n // same phase: a pager told a take has settled has already been handed\n // everything that take produced. The one state that must not wait for a\n // commit — a take on its way — is reported as the submit starts.\n const phaseTake = phase.kind === 'idle' ? null : phase.take;\n const phaseTakeState = takeStateOf(phase, uploaded);\n useEffect(() => {\n // An idle phase settles the take before it: re-recording drops a take\n // whose failure was being offered a retry, and so does a reading reset.\n const take = phaseTake ?? reportedTakeRef.current;\n if (slot === null || take === null) {\n return;\n }\n reportedTakeRef.current = take;\n slot.takeState(take, phaseTakeState);\n }, [slot, phaseTake, phaseTakeState]);\n\n // Model recordings stay silent for as long as the learner records: a\n // microphone that hears the model reading would assess the model's\n // pronunciation, not theirs.\n //\n // Pausing once, when the capture starts, is not enough — the play controls\n // are still on screen and still work throughout the take, so the hazard\n // simply moves one door along. The listener holds the guard for the whole\n // capture and is removed with it; `play` does not bubble, so it is taken in\n // the capture phase. It is what silences the browser's own control bar; a\n // budgeted model is refused before it is charged, by the `disabled` its\n // player is rendered with below.\n const modelsRef = useRef<HTMLDivElement>(null);\n const isCapturing = capturing(recorder.status);\n useEffect(() => {\n if (!isCapturing) {\n return;\n }\n const node = modelsRef.current;\n if (node === null) {\n return;\n }\n const hush = (): void => {\n for (const media of node.querySelectorAll('audio, video')) {\n const element = media as HTMLMediaElement;\n if (!element.paused) {\n element.pause();\n }\n }\n };\n hush();\n node.addEventListener('play', hush, true);\n return () => {\n node.removeEventListener('play', hush, true);\n };\n }, [isCapturing]);\n\n const slowMedia = useMemo(\n () => slowMediaFor(data, s.readAloudSlowRecording),\n [data, s.readAloudSlowRecording],\n );\n\n // The learner's own take, as every element that plays it plays it: the\n // preview before it is sent, the stored link a review mints, and the\n // per-word buttons in the feedback panel. One refusal covers all of them.\n const takeAudio = isReview ? playbackUrl : takeUrl;\n const playback = usePlaybackRefusal(takeAudio);\n // Where focus goes when a retry takes the \"Try again\" button away: the\n // submit it retries, which says it is busy for as long as the retry runs.\n const submitRef = useRef<HTMLButtonElement>(null);\n\n // All hooks are called before these throws, so hook order stays stable.\n if (devError) {\n throw devError;\n }\n // `review` needs no upload: it renders what a server already stored.\n if (!isReview && recordingBinding?.upload === undefined) {\n throw new Error(\n `ReadAloud \"${data.id}\" was rendered in renderMode \"${renderMode}\" without ` +\n '`recordingBinding.upload`. The learner could record a take that is stored ' +\n 'nowhere and submitted as nothing, which looks like a working activity the ' +\n 'whole way through. Pass a `recordingBinding` whose `upload` puts the take in ' +\n 'your storage and returns its key. `assess` is optional: without it the take is ' +\n 'still recorded, uploaded and submitted, and a notice replaces the feedback.',\n );\n }\n\n const submitted = state === 'completed';\n const inactive = disabled === true || submitted || isReview;\n const busy = phase.kind === 'uploading' || phase.kind === 'assessing';\n const takesLeft = maxTakes === undefined ? undefined : Math.max(0, maxTakes - recorder.takesUsed);\n\n /** Marks a failure so the alert announces even when the sentence repeats. */\n const raise = (next: SubmitPhase): void => {\n setErrorNonce((nonce) => nonce + 1);\n setPhase(next);\n };\n\n /**\n * Tells the pager slot, if there is one, that `take` is on its way — before\n * anything is awaited. The report a pager's set waits on must exist before\n * the first result it waits for can arrive; the take's later states follow\n * from the phase it reaches (see the effect above).\n */\n const beginTakeReport = (take: number): void => {\n reportedTakeRef.current = take;\n slot?.takeState(take, 'in-flight');\n };\n\n const runAssess = async (\n ref: RecordingRef,\n current: RecordedTake | null,\n take: number,\n ): Promise<void> => {\n const assess = bindingRef.current?.assess;\n const durationMs = current?.durationMs ?? 0;\n const takes = recorder.takesUsed;\n const run = runRef.current;\n if (assess === undefined) {\n // D5: a binding that stores but does not judge is a supported binding,\n // not a mistake — it is what an authoring preview supplies.\n setPhase({ kind: 'unassessed', take });\n return;\n }\n setPhase({ kind: 'assessing', take });\n fire('assessment-requested', { takes, durationMs });\n let answer: unknown;\n try {\n answer = await assess(ref);\n } catch {\n // Detached while the assessor was working: an instance that has been\n // unmounted, or handed a different reading, reports nothing for the one\n // it has left — not a phase, not an event, and not a grade.\n if (run !== runRef.current) {\n return;\n }\n raise({ kind: 'assess-failed', take, retryable: true });\n fire('assessment-failed', { takes, durationMs, retryable: true });\n return;\n }\n if (run !== runRef.current) {\n return;\n }\n // Read once, here, and nothing below touches `answer` again: the phase the\n // screen renders from, `onComplete` and the statement all take what the\n // reader returned, so they cannot disagree about what came back.\n const result = readAssessResult(answer);\n if (result.status === 'failed') {\n raise({ kind: 'assess-failed', take, retryable: result.retryable });\n fire('assessment-failed', { takes, durationMs, retryable: result.retryable });\n return;\n }\n if (result.status === 'unscorable') {\n // Reported as a failed assessment because that is what it is to a\n // consumer's log — a take that produced no grade — and `code` says which\n // kind. `retryable` is true because another take is offered.\n setPhase({ kind: 'unscorable', take, code: result.code });\n fire('assessment-failed', {\n takes,\n durationMs,\n retryable: true,\n ...(result.code !== undefined ? { code: result.code } : {}),\n });\n return;\n }\n const timeSpent = getTimeSpent();\n setPhase({ kind: 'graded', take, assessment: result.assessment, grade: result.grade });\n const grade = result.grade;\n if (grade === null) {\n // A judgement that carries no grade the reader can show is not an\n // `ActivityResult`: reporting one would mean inventing the score, exactly\n // as an `unscorable` result would. To a consumer's log it is what an\n // unscorable take is — an assessment that produced no grade, with another\n // take offered.\n fire('assessment-failed', { takes, durationMs, retryable: true });\n return;\n }\n\n // xAPI's `score.scaled` is a fraction in [-1, 1], and the SDK's builder\n // writes `ScoringResult.score` into it verbatim, then validates — so a\n // points-based grade (82 out of 100, which `GradeRecord` allows and a\n // grader's own units readily produce) does not merely ship a wrong number:\n // the build THROWS, and the grade never reaches the screen at all. The read\n // grade's fraction is in 0..1 by construction, and `passed` is a boolean by\n // construction, so the statement validates whatever the host sent. The\n // learner's own numbers go to `onComplete` untouched.\n //\n // Stamped with its take, as the response was: a pager records a grade only\n // for the take its slot holds now, so a grade that outlived a newer take\n // can never be filed beside that newer take's response.\n onComplete?.(\n stampTake(\n {\n score: grade.score,\n maxScore: grade.maxScore,\n passed: grade.passed,\n timeSpent,\n xapiStatement: xAPIBuilder.buildAnsweredStatement({\n actor: ANONYMOUS_ACTOR,\n object: {\n id: objectIdFor(data.id),\n name: { [data.locale ?? 'en-US']: data.title },\n ...xapiDefinitionFor(data),\n },\n timeSpentMs: timeSpent,\n response: result.recognizedText ?? '',\n // `ScoringResult.details` is required where `GradeRecord.details` is\n // optional, and an empty list is the honest reading of \"no per-word\n // marks were stored\" — never a mark of its own.\n scoringResult: {\n score: fractionOfGrade(grade),\n maxScore: 1,\n passed: grade.passed,\n feedback: grade.feedback,\n details: grade.details ?? [],\n },\n }),\n },\n take,\n ),\n );\n };\n\n const submitTake = async (current: RecordedTake | null): Promise<void> => {\n const binding = bindingRef.current;\n if (inactive || submittingRef.current || binding === undefined) {\n return;\n }\n submittingRef.current = true;\n const takes = recorder.takesUsed;\n const run = runRef.current;\n // Every submit is a take of its own, a retried upload included: a number\n // no earlier submit on this page had, so whatever an earlier one still\n // brings back cannot be taken for this one's.\n const take = mintTake();\n beginTakeReport(take);\n try {\n let ref: RecordingRef | null = null;\n if (current !== null) {\n setPhase({ kind: 'uploading', take });\n try {\n ref = await binding.upload(current);\n } catch {\n if (run !== runRef.current) {\n return;\n }\n // The take never reached storage, so nothing is submitted: a take\n // that failed to upload must not become a blank response.\n raise({ kind: 'upload-failed', take });\n fire('recording-upload-failed', {\n takes,\n durationMs: current.durationMs,\n retryable: true,\n });\n return;\n }\n // Detached while the take travelled. The bytes are in the application's\n // storage and this instance drops their key, which is a smaller cost\n // than the alternative: `onSubmit` carries no activity id, so a\n // response reported for a reading the learner has left is one a pager\n // would file against whatever is on screen now.\n if (run !== runRef.current) {\n return;\n }\n setUploaded(ref);\n fire('recording-uploaded', { takes, durationMs: current.durationMs });\n }\n onSubmit?.(stampTake(responseOf(ref, takes), take));\n fire('submitted', { takes, durationMs: current?.durationMs ?? 0 });\n if (isExam || ref === null) {\n // Exam never assesses, never scores, never reveals, and builds no xAPI\n // statement: its `correctResponsesPattern` would be the answer key, and\n // a read-aloud is graded on a server from the stored bytes.\n complete();\n setPhase({ kind: 'submitted', take });\n return;\n }\n await runAssess(ref, current, take);\n } finally {\n submittingRef.current = false;\n }\n };\n\n /**\n * Judges the take that is already stored, again — the SAME take, so the same\n * number. Guarded like a submit: an assessment costs an application money,\n * and two presses of one retry must not buy two of them.\n */\n const retryAssess = async (ref: RecordingRef, take: number): Promise<void> => {\n if (submittingRef.current) {\n return;\n }\n submittingRef.current = true;\n beginTakeReport(take);\n try {\n await runAssess(ref, recorder.take, take);\n } finally {\n submittingRef.current = false;\n }\n };\n\n const handleSubmit = (event: React.FormEvent): void => {\n event.preventDefault();\n if (inactive || busy || recorder.take === null || phase.kind !== 'idle') {\n return;\n }\n void submitTake(recorder.take);\n };\n\n const beginTake = (): void => {\n if (inactive || busy || !recorder.canRecord) {\n return;\n }\n if (recorder.take !== null) {\n fire('recording-discarded', {\n takes: recorder.takesUsed,\n durationMs: recorder.take.durationMs,\n });\n }\n setPhase({ kind: 'idle' });\n setUploaded(null);\n start();\n void recorder.start();\n };\n\n // The reading's own language and the direction its tag names. No `_`→`-`\n // normalisation, unlike `<Dictation>`: `ReadAloudData.locale` is canonical by\n // schema, so there is nothing to normalise.\n const contentLang = typeof data.locale === 'string' ? data.locale : undefined;\n const contentDir = localeDirectionOf(data.locale);\n // What the marks and the coaching on them read of the item: its text and\n // language for the marks, and its name and the author's settings for a model.\n const coachingItem = {\n id: data.id,\n title: data.title,\n referenceText: data.referenceText,\n locale: data.locale,\n ...(data.instructions !== undefined ? { instructions: data.instructions } : {}),\n ...(data.ai !== undefined ? { ai: data.ai } : {}),\n };\n\n // What the host sent, as the one reader of a host's grade reads it. Every\n // path below that shows or decides anything about a grade — the summary, the\n // panel, the marks, who renders the score, the announcement — reads these and\n // never `outcome` or `assessment` directly.\n const outcomeReading = useMemo(() => readOutcome(outcome), [outcome]);\n const keptEvidence = useMemo(() => readEvidence(assessment), [assessment]);\n const storedGrade =\n outcomeReading?.kind === 'graded' && outcomeReading.status === 'graded'\n ? outcomeReading.grade\n : null;\n // The marks a review shows: the assessment when the caller kept one, and the\n // stored details otherwise. With neither, the score is shown and no marks are.\n const storedMarks = useMemo(\n () =>\n policy.feedback && isReview && keptEvidence === null && storedGrade?.details !== undefined\n ? marksFromDetails(storedGrade.details)\n : null,\n [policy.feedback, isReview, keptEvidence, storedGrade],\n );\n // No panel at all without feedback: the marks, the score and the grader's\n // words are all in it.\n const feedbackAssessment = !policy.feedback\n ? null\n : isReview\n ? keptEvidence\n : phase.kind === 'graded'\n ? phase.assessment\n : null;\n const feedbackGrade = isReview ? storedGrade : phase.kind === 'graded' ? phase.grade : null;\n // A take the page refused to play is handed to no per-word button: each of\n // them would do nothing when pressed, and the note in the player's place\n // already says why.\n const feedbackAudio = playback.refused ? null : takeAudio;\n\n // Whether the score and the grader's words are already on screen inside the\n // feedback panel, which is what decides who renders them here.\n //\n // The props say the panel WAS GIVEN a grade; only the DOM says it rendered\n // one. The panel can fail outright — D2's dev throw for evidence the\n // validator refuses is one way, and nothing on either path validates a host's\n // grade either — and clipping on the props alone then hides a score that\n // exists nowhere, leaving a learner \"this activity could not be displayed\"\n // and no percentage at all. So the props may only ever clip for the single\n // commit before the fact arrives, and the fact may always un-clip: a grade on\n // screen twice is a far smaller defect than a grade nowhere. `.lk-pf-grade`\n // is the panel's own hook for this, named as such in its source.\n const rootRef = useRef<HTMLFormElement>(null);\n const [panelLostTheGrade, setPanelLostTheGrade] = useState(false);\n // Only a READ grade is handed to the panel, and the panel shows a read grade's\n // score without exception — so the prediction is made from the reader's\n // output, and never from a grade the panel would refuse.\n const panelHasGrade = feedbackAssessment !== null && feedbackGrade !== null;\n const gradeShownInPanel = panelHasGrade && !panelLostTheGrade;\n // Deliberately without a dependency list: what it reads is the committed DOM,\n // which no list can name. The updater keeps the settled value a fixed point,\n // so a render that changes nothing here costs one extra pass and then stops.\n useEffect(() => {\n const root = rootRef.current;\n const lost = panelHasGrade && (root === null || root.querySelector('.lk-pf-grade') === null);\n setPanelLostTheGrade((was) => (was === lost ? was : lost));\n });\n\n const announcement = useMemo<Announcement | null>(() => {\n if (isReview) {\n return null;\n }\n // The two moments of a capture, said once each. The per-second counter used\n // to be a live region of its own, so a ten-second take produced ten\n // announcements — and on any device without headphones a screen reader\n // speaks each of them into the take about to be assessed FOR PRONUNCIATION.\n // This component already stops the model recordings for exactly that\n // reason; the counter it generates itself is the same hazard.\n if (recorder.status === 'recording') {\n return { text: s.readAloudRecordingStarted, feedback: null };\n }\n // The length is in the sentence because the counter is no longer announced:\n // a take that ran to its bound reads back as \"20 of 20 seconds\", which is\n // how a learner hears that it stopped itself rather than that they stopped it.\n const stopped: Announcement | null =\n recorder.status === 'recorded' && take !== null\n ? {\n text: s.readAloudRecordingStopped(\n secondsWithin(take.durationMs, maxSeconds, 'nearest'),\n maxSeconds,\n ),\n feedback: null,\n }\n : null;\n if (isExam) {\n if (phase.kind === 'submitted' || submitted) {\n return { text: s.answerSubmitted, feedback: null };\n }\n return phase.kind === 'idle' ? stopped : null;\n }\n switch (phase.kind) {\n case 'graded': {\n const grade = phase.grade;\n // A judgement with no grade that can be read says so, in the same\n // sentence a review uses — never nothing, which reads as a grade\n // still on its way.\n if (grade === null) {\n return { text: `${s.answerSubmitted} ${s.couldNotBeGraded}`, feedback: null };\n }\n // Graded, and said to be handed in only: the policy shows no grades.\n if (!policy.feedback) {\n return { text: s.answerSubmitted, feedback: null };\n }\n return {\n text: `${s.answerSubmitted} ${s.scoreAnnouncement(percentOfGrade(grade), grade.passed)}`,\n feedback: grade.feedback,\n };\n }\n case 'unscorable':\n return { text: unscorableMessage(phase.code, s), feedback: null };\n case 'unassessed':\n return { text: s.readAloudAssessmentUnavailable, feedback: null };\n case 'idle':\n return stopped;\n default:\n // Uploading and assessing have their own pending sentence, and both\n // failures have an alert; a stale \"recording stopped\" beside either\n // would be the loudest thing on the screen.\n return null;\n }\n }, [isReview, isExam, phase, submitted, s, recorder.status, take, maxSeconds, policy.feedback]);\n\n const alertText =\n recorder.error !== null\n ? s.readAloudRecorderError(recorder.error)\n : phase.kind === 'upload-failed'\n ? s.readAloudUploadFailed\n : phase.kind === 'assess-failed'\n ? s.readAloudAssessmentFailed\n : null;\n\n return (\n <form\n className=\"lk-ra\"\n ref={rootRef}\n // A title with nothing to say would name the form with silence.\n aria-labelledby={VISIBLE_TEXT_RE.test(data.title) ? titleId : undefined}\n lang={locale}\n data-render-mode={renderMode}\n style={theme as CSSProperties | undefined}\n onSubmit={handleSubmit}\n >\n {/*\n The form's name: read from here, it keeps the content's language. A\n paragraph of its own, so without a language to go by its own first\n letter decides its direction.\n */}\n <p id={titleId} className=\"lk-ra-title\" dir={contentDir ?? 'auto'} lang={contentLang}>\n {data.title}\n </p>\n\n {typeof data.instructions === 'string' && data.instructions !== '' ? (\n <p className=\"lk-ra-instructions\" dir={contentDir ?? 'auto'} lang={contentLang}>\n {data.instructions}\n </p>\n ) : null}\n\n {/* The reading itself. Never redacted: a read-aloud has no answer key, so\n the learner's copy carries the text in full. */}\n <p className=\"lk-ra-reference\" dir={contentDir ?? 'auto'} lang={contentLang}>\n {data.referenceText}\n </p>\n\n {data.media !== undefined || slowMedia !== undefined ? (\n <div className=\"lk-ra-models\" ref={modelsRef}>\n {/*\n Each model recording is a named group (a fieldset with a legend,\n which is what `role=\"group\"` plus a label spells natively), so the\n two players are told apart by name and not only by position.\n */}\n {data.media !== undefined ? (\n <fieldset className=\"lk-ra-model\">\n <legend className=\"lk-ra-model-label\">{s.readAloudModelRecording}</legend>\n {/* The ONLY budgeted recording: the binding is whatever the pager or the caller passes.\n Disabled while a take is captured, so a press is refused BEFORE a play is\n charged — silenced after the charge, it cost the learner a play they never\n heard. Nothing is announced for the refusal: a screen reader speaking now\n would speak into the take. */}\n <ActivityMedia\n media={data.media}\n renderMode={renderMode}\n playbackGroup={modelsGroup}\n {...(mediaBudget !== undefined ? { mediaBudget } : {})}\n {...(mediaStrings !== undefined ? { mediaStrings } : {})}\n {...(strings !== undefined ? { strings } : {})}\n {...(onInteraction !== undefined ? { onInteraction } : {})}\n {...(locale !== undefined ? { locale } : {})}\n {...(disabled === true || isCapturing ? { disabled: true } : {})}\n />\n </fieldset>\n ) : null}\n {slowMedia !== undefined ? (\n <fieldset className=\"lk-ra-model\" data-slow=\"true\">\n <legend className=\"lk-ra-model-label\">{s.readAloudSlowRecording}</legend>\n {/* No budget of its own, by contract — so no binding is passed and none is demanded. */}\n <ActivityMedia\n media={slowMedia}\n renderMode={renderMode}\n playbackGroup={modelsGroup}\n {...(mediaStrings !== undefined ? { mediaStrings } : {})}\n {...(strings !== undefined ? { strings } : {})}\n {...(locale !== undefined ? { locale } : {})}\n {...(disabled === true || isCapturing ? { disabled: true } : {})}\n />\n </fieldset>\n ) : null}\n </div>\n ) : null}\n\n {/* Gone once the item is committed, rather than left behind disabled: a\n submitted exam answer is not a control a learner should still meet. */}\n {isReview || submitted ? null : (\n <div\n className=\"lk-ra-recorder\"\n data-status={recorder.status}\n data-level={\n recorder.status === 'recording'\n ? Math.min(LEVEL_STEPS, Math.round(recorder.level * LEVEL_STEPS))\n : undefined\n }\n >\n {recorder.status === 'recording' ? (\n <button\n type=\"button\"\n className=\"lk-ra-stop\"\n disabled={inactive}\n onClick={() => recorder.stop()}\n >\n {s.readAloudStop}\n </button>\n ) : (\n // aria-disabled, never disabled, once the takes are spent: a\n // natively disabled button drops keyboard focus to the page body,\n // and this is the control a learner comes back to.\n <button\n type=\"button\"\n className=\"lk-ra-record\"\n disabled={inactive}\n aria-disabled={!recorder.canRecord || busy || undefined}\n onClick={beginTake}\n >\n {recorder.take === null ? s.readAloudRecord : s.readAloudRerecord}\n </button>\n )}\n {recorder.status === 'recording' ? (\n // Visible, and hidden from assistive technology, beside the level\n // meter the recorder's `data-level` drives. Its text changes every\n // whole second, so as a live region it announced ten times in a\n // ten-second take — into the microphone. What a screen-reader\n // learner needs instead is said once each, below.\n <p className=\"lk-ra-progress\" aria-hidden=\"true\">\n {s.readAloudRecordingProgress(\n secondsWithin(recorder.elapsedMs, maxSeconds, 'down'),\n maxSeconds,\n )}\n </p>\n ) : null}\n {takesLeft !== undefined && maxTakes !== undefined ? (\n <p className=\"lk-ra-takes\">{s.readAloudTakesRemaining(takesLeft, maxTakes)}</p>\n ) : null}\n </div>\n )}\n\n {takeAudio === null ? null : playback.refused ? (\n // In the player's place, not beside it: a player the page will not\n // load looks exactly like one that works until it is pressed, and then\n // does nothing. A note rather than an alert — the learner can still\n // submit, and nothing here asks them to act.\n <p className=\"lk-ra-take-unavailable\" role=\"note\">\n {s.readAloudPlaybackUnavailable}\n </p>\n ) : (\n // biome-ignore lint/a11y/useMediaCaption: the learner's own take has no caption track to offer; its accessible name says whose recording it is\n <audio\n className=\"lk-ra-take\"\n controls\n src={takeAudio}\n aria-label={s.readAloudYourRecording}\n onError={(event) => playback.refuse(event.currentTarget)}\n {...(isReview ? {} : { 'data-take': recorder.takesUsed })}\n />\n )}\n\n {isReview || submitted ? null : (\n <div className=\"lk-ra-actions\">\n <button\n ref={submitRef}\n type=\"submit\"\n className=\"lk-ra-submit\"\n disabled={disabled === true}\n aria-disabled={recorder.take === null || phase.kind !== 'idle' || undefined}\n aria-busy={busy || undefined}\n >\n {s.submit}\n </button>\n {isExam ? (\n // Explicit, and only here: an exam answer with no recording is a\n // decision a learner takes, never something a failed upload does\n // for them.\n <button\n type=\"button\"\n className=\"lk-ra-submit-blank\"\n disabled={inactive}\n aria-disabled={busy || undefined}\n onClick={() => {\n if (!busy) {\n void submitTake(null);\n }\n }}\n >\n {s.readAloudSubmitWithoutRecording}\n </button>\n ) : null}\n {offersRetry(phase, uploaded) ? (\n <button\n type=\"button\"\n className=\"lk-ra-retry\"\n onClick={() => {\n // The retry takes this button away with the phase it answers,\n // and focus on a removed element drops to the page body — a\n // keyboard learner is then back at the top of the page with no\n // idea the retry started. It goes to the submit being retried.\n submitRef.current?.focus();\n if (phase.kind === 'upload-failed') {\n void submitTake(recorder.take);\n } else if (phase.kind === 'assess-failed' && uploaded !== null) {\n void retryAssess(uploaded, phase.take);\n }\n }}\n >\n {s.readAloudTryAgain}\n </button>\n ) : null}\n </div>\n )}\n\n {busy ? (\n <p className=\"lk-ra-pending\" role=\"status\" aria-busy=\"true\">\n {phase.kind === 'uploading' ? s.readAloudUploading : s.readAloudAssessing}\n </p>\n ) : null}\n\n {alertText !== null ? (\n <p key={errorNonce} className=\"lk-ra-alert\" role=\"alert\">\n {alertText}\n </p>\n ) : null}\n\n {feedbackAssessment !== null ? (\n <PronunciationFeedback\n data={coachingItem}\n assessment={feedbackAssessment}\n {...(feedbackGrade !== null ? { grade: feedbackGrade } : {})}\n {...(feedbackAudio !== null ? { audioUrl: feedbackAudio } : {})}\n {...(breakThreshold !== undefined ? { breakThreshold } : {})}\n {...(monotoneThreshold !== undefined ? { monotoneThreshold } : {})}\n {...(locale !== undefined ? { locale } : {})}\n {...(strings !== undefined ? { strings } : {})}\n {...(ai !== undefined ? { ai } : {})}\n {...(onInteraction !== undefined ? { onInteraction } : {})}\n renderMode={renderMode}\n delivery={policy}\n />\n ) : null}\n\n {storedMarks !== null ? (\n <div className=\"lk-ra-marks\">\n {/* The list's name and the hidden sentences are interface text; only\n the words carry the reading's language. */}\n <ol className=\"lk-ra-words\" aria-label={s.pronunciationWordsLabel} dir={contentDir}>\n {storedMarks.map((entry, index) => {\n const sentence = markSentence(entry, s);\n return (\n <li\n // biome-ignore lint/suspicious/noArrayIndexKey: mark order is the identity; words repeat\n key={index}\n className=\"lk-ra-word\"\n data-state={entry.state}\n >\n {/* One channel for assistive technology, not two: the same\n sentence as a `title` is an accessible description, read\n straight after the name it repeats. */}\n <span className=\"lk-visually-hidden\" style={VISUALLY_HIDDEN}>\n {sentence}\n </span>\n <span\n className=\"lk-ra-word-text\"\n aria-hidden=\"true\"\n dir={contentDir ?? 'auto'}\n lang={contentLang}\n >\n {entry.reference}\n </span>\n </li>\n );\n })}\n </ol>\n {/* Three rows, not four: a stored mark set carries no insertions. */}\n <ul className=\"lk-ra-legend\">\n {STORED_STATES.map((state) => (\n <li key={state} data-state={state}>\n {s.pronunciationLegend(state)}\n </li>\n ))}\n </ul>\n {/* The same coaching the panel offers, on the marks read back here:\n the stored grade's, which carry no sounds. */}\n <ReadingCoaching\n data={coachingItem}\n grade={storedGrade}\n renderMode={renderMode}\n delivery={policy}\n {...(ai !== undefined ? { ai } : {})}\n {...(locale !== undefined ? { locale } : {})}\n {...(onInteraction !== undefined ? { onInteraction } : {})}\n strings={s}\n contentLang={contentLang}\n contentDir={contentDir}\n />\n </div>\n ) : null}\n\n <FeedbackRegion id={`${data.id}-feedback`}>\n {isReview ? (\n // A grade read back is feedback; \"not graded yet\" and a grade that\n // could not be read are not.\n outcomeReading !== undefined && (policy.feedback || outcomeReading.kind !== 'graded') ? (\n <OutcomeSummary reading={outcomeReading} s={s} scoreShown={gradeShownInPanel} />\n ) : null\n ) : gradeShownInPanel ? (\n // Announced, not repeated. A grade the feedback panel is already\n // showing would otherwise be read on screen twice, feedback and all —\n // but a live region is the only thing that TELLS a screen-reader\n // learner a grade arrived, since nothing takes focus. Clipped rather\n // than `display: none`, which would stop it being announced at all.\n <span className=\"lk-visually-hidden\" style={VISUALLY_HIDDEN}>\n <AnnouncementText announcement={announcement} />\n </span>\n ) : (\n <AnnouncementText announcement={announcement} />\n )}\n </FeedbackRegion>\n </form>\n );\n}\n","'use client';\n\nimport { useLkStrings } from '../../i18n/LkIntlProvider.js';\nimport { ActivityErrorBoundary } from '../ActivityErrorBoundary.js';\nimport { ReadAloud as ReadAloudCore, type ReadAloudProps } from './ReadAloud.js';\n\n// `RecordedTake` travels with `RecordingBinding` because `upload`, the one\n// method a binding must have, takes one: a binding written against this subpath\n// must not need a second import path to name its own argument.\nexport type { RecordedTake } from '../../hooks/useSpeechRecorder.js';\nexport type { ReadAloudAssessResult, ReadAloudProps, RecordingBinding } from './ReadAloud.js';\n\n/**\n * Public Read Aloud activity: the core wrapped in `ActivityErrorBoundary` so a\n * render failure (including the dev schema-validation throw and the\n * missing-`upload` guard) degrades to an accessible fallback instead of\n * crashing the host.\n */\nexport function ReadAloud(props: ReadAloudProps) {\n const strings = useLkStrings(props.strings);\n return (\n <ActivityErrorBoundary activityTitle={props.data?.title} strings={strings}>\n <ReadAloudCore {...props} />\n </ActivityErrorBoundary>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useLkStrings } from './chunk-C4PSJ3ZC.js';
2
+ import { useLkStrings } from './chunk-HNLRVRQR.js';
3
3
  import { resolvePlaybackPolicy } from '@intellectif/lk-core';
4
4
  import { useRef, useEffect, useId, useState, useCallback } from 'react';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -593,5 +593,5 @@ function ActivityMedia(props) {
593
593
  }
594
594
 
595
595
  export { ActivityMedia };
596
- //# sourceMappingURL=chunk-HYOUMTPW.js.map
597
- //# sourceMappingURL=chunk-HYOUMTPW.js.map
596
+ //# sourceMappingURL=chunk-TS7J6DTY.js.map
597
+ //# sourceMappingURL=chunk-TS7J6DTY.js.map