@intellectif/lk-react 21.0.0 → 23.0.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 (166) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +4 -4
  3. package/dist/{WrittenResponse-BVPmrmQL.d.cts → WrittenResponse-CgRrjM4S.d.ts} +14 -4
  4. package/dist/{WrittenResponse-IAJvvL-g.d.ts → WrittenResponse-D2K1VW_V.d.cts} +14 -4
  5. package/dist/ai/LkAiProvider.cjs +3 -3
  6. package/dist/ai/LkAiProvider.d.cts +12 -1
  7. package/dist/ai/LkAiProvider.d.ts +12 -1
  8. package/dist/ai/LkAiProvider.js +1 -1
  9. package/dist/ai/useAiHelp.cjs +9 -5
  10. package/dist/ai/useAiHelp.d.cts +58 -3
  11. package/dist/ai/useAiHelp.d.ts +58 -3
  12. package/dist/ai/useAiHelp.js +3 -3
  13. package/dist/{chunk-M3K6BF5M.js → chunk-2OP5YHRR.js} +13 -8
  14. package/dist/chunk-2OP5YHRR.js.map +1 -0
  15. package/dist/{chunk-AY3WN4FB.js → chunk-4MXECBZT.js} +9 -9
  16. package/dist/chunk-4MXECBZT.js.map +1 -0
  17. package/dist/{chunk-EANGKAKG.cjs → chunk-54DX6SLS.cjs} +12 -2
  18. package/dist/chunk-54DX6SLS.cjs.map +1 -0
  19. package/dist/{chunk-WNDNQ6NR.js → chunk-6GQLCCGN.js} +11 -13
  20. package/dist/chunk-6GQLCCGN.js.map +1 -0
  21. package/dist/{chunk-Y4IDF5UO.cjs → chunk-6RIM5EQP.cjs} +140 -9
  22. package/dist/chunk-6RIM5EQP.cjs.map +1 -0
  23. package/dist/{chunk-NILHU555.cjs → chunk-7F2YQWMW.cjs} +17 -12
  24. package/dist/chunk-7F2YQWMW.cjs.map +1 -0
  25. package/dist/{chunk-YWJ5XJDU.cjs → chunk-B4JRBV56.cjs} +6 -6
  26. package/dist/{chunk-YWJ5XJDU.cjs.map → chunk-B4JRBV56.cjs.map} +1 -1
  27. package/dist/{chunk-CB2A56Q7.cjs → chunk-B7JU52YQ.cjs} +32 -35
  28. package/dist/chunk-B7JU52YQ.cjs.map +1 -0
  29. package/dist/{chunk-EYLBSS4Y.js → chunk-C4PSJ3ZC.js} +10 -2
  30. package/dist/chunk-C4PSJ3ZC.js.map +1 -0
  31. package/dist/{chunk-NDIKHMLJ.js → chunk-CXIP7ERK.js} +138 -8
  32. package/dist/chunk-CXIP7ERK.js.map +1 -0
  33. package/dist/{chunk-ZDDBWUUA.js → chunk-DPNCCWOV.js} +120 -27
  34. package/dist/chunk-DPNCCWOV.js.map +1 -0
  35. package/dist/{chunk-PPFVTXGJ.js → chunk-DXFCYNST.js} +11 -3
  36. package/dist/chunk-DXFCYNST.js.map +1 -0
  37. package/dist/{chunk-WXESKL75.cjs → chunk-DZ7VLLDQ.cjs} +30 -30
  38. package/dist/chunk-DZ7VLLDQ.cjs.map +1 -0
  39. package/dist/{chunk-U6SEII5V.js → chunk-E4UF4XZM.js} +4 -4
  40. package/dist/{chunk-U6SEII5V.js.map → chunk-E4UF4XZM.js.map} +1 -1
  41. package/dist/{chunk-XM5Q2ZCH.js → chunk-ERV666AR.js} +10 -13
  42. package/dist/chunk-ERV666AR.js.map +1 -0
  43. package/dist/{chunk-6SNNMVBV.cjs → chunk-FISEZBLF.cjs} +7 -7
  44. package/dist/{chunk-6SNNMVBV.cjs.map → chunk-FISEZBLF.cjs.map} +1 -1
  45. package/dist/{chunk-X4YWXZ4J.js → chunk-HYOUMTPW.js} +3 -3
  46. package/dist/{chunk-X4YWXZ4J.js.map → chunk-HYOUMTPW.js.map} +1 -1
  47. package/dist/{chunk-5Q2KFIZQ.js → chunk-HZIT24BK.js} +4 -4
  48. package/dist/{chunk-5Q2KFIZQ.js.map → chunk-HZIT24BK.js.map} +1 -1
  49. package/dist/{chunk-GPGCBDBN.cjs → chunk-IYGF7PZY.cjs} +24 -24
  50. package/dist/{chunk-GPGCBDBN.cjs.map → chunk-IYGF7PZY.cjs.map} +1 -1
  51. package/dist/{chunk-XB2AHEU5.js → chunk-JMEZYYCE.js} +11 -11
  52. package/dist/{chunk-XB2AHEU5.js.map → chunk-JMEZYYCE.js.map} +1 -1
  53. package/dist/{chunk-KRM6DX47.js → chunk-KI6DJ5ZF.js} +10 -13
  54. package/dist/chunk-KI6DJ5ZF.js.map +1 -0
  55. package/dist/{chunk-WGHMWBEJ.cjs → chunk-MXZHL4U5.cjs} +29 -31
  56. package/dist/chunk-MXZHL4U5.cjs.map +1 -0
  57. package/dist/{chunk-GHKMX5UT.cjs → chunk-NFGUJ52G.cjs} +10 -2
  58. package/dist/chunk-NFGUJ52G.cjs.map +1 -0
  59. package/dist/{chunk-W6TWQY6S.js → chunk-O7MINPKZ.js} +10 -10
  60. package/dist/chunk-O7MINPKZ.js.map +1 -0
  61. package/dist/{chunk-MPHX3Y42.cjs → chunk-OJGTJOWI.cjs} +2 -2
  62. package/dist/chunk-OJGTJOWI.cjs.map +1 -0
  63. package/dist/{chunk-W2P5RILE.cjs → chunk-PGAPZ6UE.cjs} +32 -35
  64. package/dist/chunk-PGAPZ6UE.cjs.map +1 -0
  65. package/dist/{chunk-OKEN6NJL.cjs → chunk-QAZO3ANW.cjs} +32 -32
  66. package/dist/chunk-QAZO3ANW.cjs.map +1 -0
  67. package/dist/{chunk-MCTNLUKO.js → chunk-RX3A6KIY.js} +2 -2
  68. package/dist/chunk-RX3A6KIY.js.map +1 -0
  69. package/dist/{chunk-LHFC2BCM.cjs → chunk-SHDSOOBF.cjs} +21 -21
  70. package/dist/{chunk-LHFC2BCM.cjs.map → chunk-SHDSOOBF.cjs.map} +1 -1
  71. package/dist/{chunk-U2BX2RWY.js → chunk-SPSKDNEE.js} +11 -11
  72. package/dist/{chunk-U2BX2RWY.js.map → chunk-SPSKDNEE.js.map} +1 -1
  73. package/dist/{chunk-5MO7ACSB.js → chunk-TGTP5DKF.js} +10 -10
  74. package/dist/{chunk-5MO7ACSB.js.map → chunk-TGTP5DKF.js.map} +1 -1
  75. package/dist/{chunk-GND3OBVE.js → chunk-U5VFJVQ2.js} +3 -3
  76. package/dist/{chunk-GND3OBVE.js.map → chunk-U5VFJVQ2.js.map} +1 -1
  77. package/dist/{chunk-7JBXDQTD.cjs → chunk-UKUHVCZX.cjs} +5 -5
  78. package/dist/{chunk-7JBXDQTD.cjs.map → chunk-UKUHVCZX.cjs.map} +1 -1
  79. package/dist/{chunk-M4UJBLVR.cjs → chunk-VPU6UY4O.cjs} +4 -4
  80. package/dist/{chunk-M4UJBLVR.cjs.map → chunk-VPU6UY4O.cjs.map} +1 -1
  81. package/dist/{chunk-CQ37UD4T.cjs → chunk-W6UMY7PF.cjs} +5 -5
  82. package/dist/{chunk-CQ37UD4T.cjs.map → chunk-W6UMY7PF.cjs.map} +1 -1
  83. package/dist/{chunk-GW3YIPDE.cjs → chunk-WZ2TBXVB.cjs} +18 -18
  84. package/dist/{chunk-GW3YIPDE.cjs.map → chunk-WZ2TBXVB.cjs.map} +1 -1
  85. package/dist/{chunk-XZCMUDFP.cjs → chunk-XS6OYYVR.cjs} +129 -36
  86. package/dist/chunk-XS6OYYVR.cjs.map +1 -0
  87. package/dist/{chunk-PJMXHDY5.js → chunk-XYJBRKBZ.js} +3 -3
  88. package/dist/{chunk-PJMXHDY5.js.map → chunk-XYJBRKBZ.js.map} +1 -1
  89. package/dist/components/ActivityPreview.cjs +17 -17
  90. package/dist/components/ActivityPreview.d.cts +2 -2
  91. package/dist/components/ActivityPreview.d.ts +2 -2
  92. package/dist/components/ActivityPreview.js +16 -16
  93. package/dist/components/ActivitySequence.cjs +18 -18
  94. package/dist/components/ActivitySequence.d.cts +2 -2
  95. package/dist/components/ActivitySequence.d.ts +2 -2
  96. package/dist/components/ActivitySequence.js +17 -17
  97. package/dist/components/Dictation.cjs +10 -10
  98. package/dist/components/Dictation.d.cts +1 -1
  99. package/dist/components/Dictation.d.ts +1 -1
  100. package/dist/components/Dictation.js +9 -9
  101. package/dist/components/FillInTheBlanks.cjs +10 -10
  102. package/dist/components/FillInTheBlanks.d.cts +1 -1
  103. package/dist/components/FillInTheBlanks.d.ts +1 -1
  104. package/dist/components/FillInTheBlanks.js +9 -9
  105. package/dist/components/GapSelect.cjs +10 -10
  106. package/dist/components/GapSelect.d.cts +1 -1
  107. package/dist/components/GapSelect.d.ts +1 -1
  108. package/dist/components/GapSelect.js +9 -9
  109. package/dist/components/InteractiveVideo.cjs +17 -17
  110. package/dist/components/InteractiveVideo.d.cts +2 -2
  111. package/dist/components/InteractiveVideo.d.ts +2 -2
  112. package/dist/components/InteractiveVideo.js +15 -15
  113. package/dist/components/MultipleChoice.cjs +10 -10
  114. package/dist/components/MultipleChoice.d.cts +1 -1
  115. package/dist/components/MultipleChoice.d.ts +1 -1
  116. package/dist/components/MultipleChoice.js +9 -9
  117. package/dist/components/PronunciationFeedback.cjs +5 -5
  118. package/dist/components/PronunciationFeedback.d.cts +1 -1
  119. package/dist/components/PronunciationFeedback.d.ts +1 -1
  120. package/dist/components/PronunciationFeedback.js +4 -4
  121. package/dist/components/ReadAloud.cjs +8 -8
  122. package/dist/components/ReadAloud.d.cts +2 -2
  123. package/dist/components/ReadAloud.d.ts +2 -2
  124. package/dist/components/ReadAloud.js +7 -7
  125. package/dist/components/StimulusPanel.cjs +4 -4
  126. package/dist/components/StimulusPanel.d.cts +1 -1
  127. package/dist/components/StimulusPanel.d.ts +1 -1
  128. package/dist/components/StimulusPanel.js +3 -3
  129. package/dist/components/WrittenResponse.cjs +9 -7
  130. package/dist/components/WrittenResponse.d.cts +3 -3
  131. package/dist/components/WrittenResponse.d.ts +3 -3
  132. package/dist/components/WrittenResponse.js +8 -6
  133. package/dist/i18n/LkIntlProvider.cjs +7 -7
  134. package/dist/i18n/LkIntlProvider.d.cts +2 -2
  135. package/dist/i18n/LkIntlProvider.d.ts +2 -2
  136. package/dist/i18n/LkIntlProvider.js +1 -1
  137. package/dist/index.cjs +45 -41
  138. package/dist/index.d.cts +3 -3
  139. package/dist/index.d.ts +3 -3
  140. package/dist/index.js +19 -19
  141. package/dist/theme/skin.css +23 -0
  142. package/dist/{types-Botf4Wqj.d.cts → types-CO0XLEN6.d.cts} +19 -0
  143. package/dist/{types-7lGlo0zE.d.ts → types-CrtIcRcK.d.ts} +19 -0
  144. package/package.json +3 -3
  145. package/dist/chunk-AY3WN4FB.js.map +0 -1
  146. package/dist/chunk-CB2A56Q7.cjs.map +0 -1
  147. package/dist/chunk-EANGKAKG.cjs.map +0 -1
  148. package/dist/chunk-EYLBSS4Y.js.map +0 -1
  149. package/dist/chunk-GHKMX5UT.cjs.map +0 -1
  150. package/dist/chunk-KRM6DX47.js.map +0 -1
  151. package/dist/chunk-M3K6BF5M.js.map +0 -1
  152. package/dist/chunk-MCTNLUKO.js.map +0 -1
  153. package/dist/chunk-MPHX3Y42.cjs.map +0 -1
  154. package/dist/chunk-NDIKHMLJ.js.map +0 -1
  155. package/dist/chunk-NILHU555.cjs.map +0 -1
  156. package/dist/chunk-OKEN6NJL.cjs.map +0 -1
  157. package/dist/chunk-PPFVTXGJ.js.map +0 -1
  158. package/dist/chunk-W2P5RILE.cjs.map +0 -1
  159. package/dist/chunk-W6TWQY6S.js.map +0 -1
  160. package/dist/chunk-WGHMWBEJ.cjs.map +0 -1
  161. package/dist/chunk-WNDNQ6NR.js.map +0 -1
  162. package/dist/chunk-WXESKL75.cjs.map +0 -1
  163. package/dist/chunk-XM5Q2ZCH.js.map +0 -1
  164. package/dist/chunk-XZCMUDFP.cjs.map +0 -1
  165. package/dist/chunk-Y4IDF5UO.cjs.map +0 -1
  166. package/dist/chunk-ZDDBWUUA.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/i18n/strings.ts","../src/i18n/LkIntlProvider.tsx"],"names":[],"mappings":";;;;;;AA+dO,IAAM,eAAA,GAA6B;AAAA,EACxC,MAAA,EAAQ,QAAA;AAAA,EACR,YAAA,EAAc,eAAA;AAAA,EACd,aAAA,EAAe,gBAAA;AAAA,E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"chunk-C4PSJ3ZC.js","sourcesContent":["import type { ReadAloudDimension, ReadAloudWordState, Stimulus } from '@intellectif/lk-core';\nimport type { CaptionSize } from '../components/InteractiveVideo/prefs.js';\nimport type { VideoShortcutAction } from '../components/InteractiveVideo/shortcuts.js';\nimport type { MediaTransportStrings } from '../components/types.js';\nimport type { SpeechRecorderError } from '../hooks/useSpeechRecorder.js';\n\n/**\n * Every string the SDK's own chrome renders.\n *\n * Until 0.8.1 these were literals, and `locale` set only the `lang` attribute —\n * so a learner sitting a Spanish paper read a Spanish passage inside an English\n * scaffold, and \"No plays remaining\" on a listening exam was untranslatable.\n * This is the whole surface, in one place, so a consumer can replace it.\n *\n * **Interpolation and plurals are functions, not format strings.** A message\n * like `\"Question {n} of {total}\"` needs a parser, and a parser needs plural\n * rules for every locale the SDK does not know. A function hands both problems\n * to the consumer, who has `Intl.PluralRules` and knows their own language:\n *\n * ```ts\n * questionProgress: (index, total) => `Pregunta ${index} de ${total}`,\n * wordCount: (n) => `${n} ${n === 1 ? 'palabra' : 'palabras'}`,\n * ```\n *\n * It also lets a translation reorder its arguments, which a positional token\n * cannot, and TypeScript checks the arity. No parser, no message catalogue\n * format, no runtime dependency.\n *\n * **What is deliberately NOT here: thrown errors.** Every `throw` in this\n * package is addressed to the developer who wired the component up, not to the\n * learner. Translating them would make them unsearchable and would put the one\n * audience who can act on them behind a translation. They stay English.\n */\nexport interface LkStrings {\n // ── Submission ─────────────────────────────────────────────────────────\n /** Multiple Choice submit button, and Written Response. */\n submit: string;\n /** Fill-in-the-Blanks in `practice`: the learner is checking their own work. */\n checkAnswers: string;\n /** Fill-in-the-Blanks in `exam`: nothing is checked on the client. */\n submitAnswers: string;\n\n // ── Outcome, announced after submit ────────────────────────────────────\n /**\n * The scored result, read by a screen reader on submit.\n *\n * `percent` is already rounded to a whole number. The authored overall\n * feedback is appended SEPARATELY by the component, so a translation of this\n * sentence never has to carry the author's words — the two were previously\n * concatenated into one literal, which made the score sentence untranslatable\n * without also touching authored content.\n */\n scoreAnnouncement: (percent: number, passed: boolean) => string;\n /** Prefix announced on submit, before the score sentence. */\n answerSubmitted: string;\n /** An answer submitted for grading that has none yet. Never rendered as 0%. */\n notGradedYet: string;\n /** An outcome that carries no grade and never will. */\n noGradeAvailable: string;\n\n // ── Tries and what they cost (a scoring policy, in practice) ───────────\n /** The button that reopens a graded answer for another try. */\n tryAgain: string;\n /** Ends the tries on a question and shows the right answer. */\n showAnswer: string;\n /** Ends the tries on a question where the paper shows no right answers. */\n keepAnswer: string;\n /**\n * After a graded try, how many more there are, and what each costs: a whole\n * percentage of the question's marks, `0` when a try costs nothing.\n */\n triesLeft: (tries: number, costPercent: number) => string;\n /**\n * When an earlier try is the one that counts: which rule chose it, and what\n * the try just made scored, as a whole percentage.\n */\n countedTry: (counts: 'first' | 'best', percent: number) => string;\n /**\n * When hints or tries cost this answer something: what it scored before\n * that, as a whole percentage. The score sentence before it is what it counts.\n */\n scoreBeforeCosts: (percent: number) => string;\n /** Beside the hints on a paper where they cost marks, before one is asked for. */\n hintCost: (percent: number) => string;\n\n // ── Feedback disclosure ────────────────────────────────────────────────\n showFeedback: string;\n hideFeedback: string;\n\n // ── Fill-in-the-Blanks ─────────────────────────────────────────────────\n /** Accessible name of a blank's input. `ordinal` is 1-based. */\n blankLabel: (ordinal: number) => string;\n\n // ── Gap select ────────────────────────────────────────────────────────────\n /** Accessible name of the selector for one gap in a Gap Select passage. */\n gapLabel: (ordinal: number) => string;\n /**\n * The empty first entry of a gap's selector — how a learner leaves a gap\n * alone, and how they take an answer back. Never a real choice.\n */\n gapPlaceholder: string;\n showHint: string;\n hideHint: string;\n\n // ── Written Response ───────────────────────────────────────────────────\n /**\n * Announced when an essay is handed in. Distinct from {@link LkStrings.awaitingGrade},\n * which is the `review`-mode state of a submission made earlier: this one\n * confirms the act, and is the only thing a learner hears at the moment they\n * commit work that nothing on the client will grade.\n */\n responseSubmitted: string;\n /** Live word counter. Needs the count for languages whose plural rules differ. */\n wordCount: (count: number) => string;\n /** The authored bounds, e.g. \"50–200 words\". `min` is 0 when unbounded below. */\n wordBounds: (min: number, max: number) => string;\n /** A rubric criterion the grader marked not applicable. */\n notApplicable: string;\n /** A returned grade flagged for a human to look at — learner-visible by design. */\n awaitingHumanReview: string;\n /** Submitted, no grade back yet. */\n awaitingGrade: string;\n /** The grader could not produce a grade. */\n couldNotBeGraded: string;\n\n // ── Sequence pager ─────────────────────────────────────────────────────\n previous: string;\n next: string;\n /** Progress label, also the question region's accessible name. `index` is 1-based. */\n questionProgress: (index: number, total: number) => string;\n /** Shown when no renderer is registered for an activity type. */\n unsupportedActivity: string;\n\n // ── Dictation ──────────────────────────────────────────────────────────\n /** Accessible name of the box the learner types the recording into. */\n dictationInputLabel: string;\n /** Accessible name of the group holding the recording. */\n dictationRecording: string;\n /** Accessible name of the group holding the slower recording, and its default `alt`. */\n dictationSlowRecording: string;\n /** The progressive-hint button, with how many transcript words are shown so far. */\n dictationRevealNextWord: (revealed: number, total: number) => string;\n /** Hides every revealed hint word again. */\n dictationResetHints: string;\n /** The solution toggle: shows the transcript after the attempt is marked. */\n showSolution: string;\n hideSolution: string;\n /** Accessible name of the revealed transcript. */\n dictationSolutionLabel: string;\n /** Accessible name of the word-by-word marked result. */\n dictationMarksLabel: string;\n /** Tells the learner the marks compare the normalised text, not what they typed. */\n dictationDiffNote: string;\n /**\n * The four sentences a screen reader hears for a marked word — the only\n * channel the marks have for assistive technology; the glyphs and the\n * character diff are decoration.\n */\n dictationWordCorrect: (word: string) => string;\n dictationWordWrong: (word: string, expected: string) => string;\n dictationWordMissing: (expected: string) => string;\n /**\n * A wrong word, where the right answer may not show — the paper withholds\n * solutions, or the learner is offered another try: it is wrong, and not\n * what it should be.\n */\n dictationWordWrongUnnamed: (word: string) => string;\n /** A missing word, where the right answer may not show: missing, and not named. */\n dictationWordMissingUnnamed: string;\n dictationWordExtra: (word: string) => string;\n /** The legend rows; the character-level marks reuse the same four. */\n dictationLegendCorrect: string;\n dictationLegendWrong: string;\n dictationLegendMissing: string;\n dictationLegendExtra: string;\n /** Marked result of an attempt with no words in it once punctuation and spacing are ignored, an empty one included. */\n dictationNothingTyped: string;\n /**\n * Appended to the score announcement, e.g. \"4 of 6 words correct.\" — a whole\n * sentence, because authored feedback may follow it.\n */\n dictationWordsSummary: (correct: number, total: number) => string;\n\n // ── Read aloud ─────────────────────────────────────────────────────────\n /** Accessible name of the group holding the model recording. */\n readAloudModelRecording: string;\n /** Accessible name of the group holding the slower model recording, and its default `alt`. */\n readAloudSlowRecording: string;\n /** Starts a take. */\n readAloudRecord: string;\n /** Ends the take in progress. */\n readAloudStop: string;\n /** Throws the take away so the learner can start over. */\n readAloudRerecord: string;\n /** Accessible name of the player for the take the learner just made. */\n readAloudYourRecording: string;\n /**\n * In place of the player for the learner's own take, and of the buttons that\n * play one word of it, when the page refuses to play it — most often a\n * Content-Security-Policy whose `media-src` does not allow `blob:`. Said\n * rather than left as controls that do nothing when pressed.\n */\n readAloudPlaybackUnavailable: string;\n /**\n * Live progress while recording. Whole seconds, not a `m:ss` clock: a\n * recording is bounded in seconds by the item, and a translation should not\n * have to reimplement a clock to change the word around it.\n *\n * Shown on screen and hidden from assistive technology: it changes every\n * second, and a screen reader that spoke each change would speak into the\n * take being assessed. The two sentences below are what is announced instead.\n */\n readAloudRecordingProgress: (seconds: number, maxSeconds: number) => string;\n /** Announced once when a capture begins. */\n readAloudRecordingStarted: string;\n /**\n * Announced once when a capture ends, by the learner or at its own bound.\n * Carries the length because the progress counter is not announced: a take\n * that reads back as \"20 of 20 seconds\" is one that stopped itself.\n */\n readAloudRecordingStopped: (seconds: number, maxSeconds: number) => string;\n /** How many takes are left. Called with 0 as well, so the wording is one translation's. */\n readAloudTakesRemaining: (remaining: number, max: number) => string;\n /** `exam` only: hands the item in with no recording at all, deliberately. */\n readAloudSubmitWithoutRecording: string;\n /** Pending, while the take travels to the application's storage. */\n readAloudUploading: string;\n /** The take never reached storage, so nothing was submitted. */\n readAloudUploadFailed: string;\n /** Retries whichever step just failed. */\n readAloudTryAgain: string;\n /** Pending, while the assessor judges the take. */\n readAloudAssessing: string;\n /** The binding stores recordings but judges none, so there is no feedback to show. */\n readAloudAssessmentUnavailable: string;\n /** The assessor found no speech, or too little of it, in the take. */\n readAloudNotHeard: string;\n /** The assessor produced no grade for any other reason. The code itself is never shown. */\n readAloudNotAssessed: string;\n /** The assessment could not be run at all — a failure of the call, not of the reading. */\n readAloudAssessmentFailed: string;\n /**\n * What went wrong with the microphone or with the take. One function rather\n * than five keys, so a translation keeps the five sentences together and the\n * SDK keeps one name for the concept.\n */\n readAloudRecorderError: (reason: SpeechRecorderError) => string;\n\n // ── Pronunciation feedback ─────────────────────────────────────────────\n /** Accessible name of the whole feedback region. */\n pronunciationFeedbackLabel: string;\n /** Name of one scored dimension, as a learner reads it. */\n pronunciationDimension: (dimension: ReadAloudDimension) => string;\n /** A dimension or a word the engine did not measure. NEVER rendered as 0%. */\n pronunciationNotAssessed: string;\n /** Accessible name of the word-by-word marks. */\n pronunciationWordsLabel: string;\n /** One legend row per marking state — the same four states the marks carry. */\n pronunciationLegend: (state: ReadAloudWordState) => string;\n /**\n * The four sentences a screen reader hears for a marked word: the only\n * channel the marks have for assistive technology, since the glyph and the\n * decoration are both hidden from it.\n */\n pronunciationWordCorrect: (word: string) => string;\n pronunciationWordMispronounced: (word: string) => string;\n pronunciationWordOmitted: (word: string) => string;\n pronunciationWordInserted: (word: string) => string;\n /** Opens one word's syllables, sounds and timings. */\n pronunciationWordDetails: (word: string) => string;\n pronunciationSyllables: string;\n pronunciationPhonemes: string;\n /** A syllable the engine also spelled out, e.g. `('ˈhæ', 'ha')`. */\n pronunciationSyllableSpelling: (syllable: string, grapheme: string) => string;\n /** A sound the engine named no symbol for; `ordinal` is 1-based. */\n pronunciationPhonemePosition: (ordinal: number) => string;\n /** Introduces the sounds the engine thought it heard in a sound's place. */\n pronunciationHeardAs: string;\n /** Plays one word out of the learner's own take. */\n pronunciationPlayWord: (word: string) => string;\n pronunciationBreakUnexpected: string;\n pronunciationBreakMissing: string;\n /** Shown only past the caller's own monotone threshold; the SDK sets none. */\n pronunciationMonotone: string;\n /** Names the alphabet the phoneme symbols are written in. */\n pronunciationIpaNote: string;\n\n // ── Interactive video ──────────────────────────────────────────────────\n // Play, pause, mute, volume, speed, the progress bar's name and the time\n // readout are the `media` strings below: the same controls, the same words.\n /** Jump buttons, e.g. \"Back 10 seconds\". */\n videoBack: (seconds: number) => string;\n videoForward: (seconds: number) => string;\n /** The centre button once the video has ended. */\n videoReplay: string;\n /** The time readout flips between elapsed and remaining; these name what a press shows next. */\n videoShowRemaining: string;\n videoShowElapsed: string;\n /** The captions button, named by what a press does. */\n videoCaptionsShow: string;\n videoCaptionsHide: string;\n /** In the captions menu when a caption file could not be read. */\n videoCaptionsFailed: string;\n /** The same, for the second language: the first line keeps working. */\n videoSecondaryCaptionsFailed: string;\n /** A speed in the speed menu, e.g. \"1.25×\". */\n videoSpeedValue: (rate: number) => string;\n videoSettings: string;\n videoCaptionLanguage: string;\n /** The captions page's item, and page, for a second caption line under the first. */\n videoSecondCaptionLanguage: string;\n /**\n * The captions row of the settings menu when two languages show, from the\n * tracks' own labels: \"English + Español\". A translation may order them as its\n * language reads, but the first argument is always the upper line.\n */\n videoCaptionPair: (primary: string, secondary: string) => string;\n /** Announced when Shift + C finds no other language to show. */\n videoNoSecondLanguage: string;\n videoCaptionSize: string;\n videoCaptionSizeValue: (size: CaptionSize) => string;\n videoCaptionBackground: string;\n videoKeyboardShortcuts: string;\n videoShortcutList: string;\n /** Closes the shortcut list. */\n videoClose: string;\n /** A setting's state in the settings menu. */\n videoOn: string;\n videoOff: string;\n /** What each row of the shortcut list does. */\n videoShortcut: (action: VideoShortcutAction) => string;\n /** The button that opens the panel below the video, and its two tabs. */\n videoPanel: string;\n videoContents: string;\n videoTranscript: string;\n videoTranscriptSearch: string;\n videoTranscriptNoMatch: string;\n videoPictureInPicture: string;\n videoFullscreen: string;\n videoExitFullscreen: string;\n /**\n * Why the video will not play, by `MediaError.code` (1 aborted, 2 network,\n * 3 decode, 4 source), with 0 for anything else.\n */\n videoError: (code: number) => string;\n videoTryAgain: string;\n /** A quiz with no title of its own. */\n videoQuiz: string;\n /** Where the learner is inside a quiz, e.g. \"Question 2 of 5\". */\n videoQuestionProgress: (index: number, total: number) => string;\n /** A step of the quiz's step indicator, for assistive technology. */\n videoQuestionStep: (index: number, answered: boolean) => string;\n videoNextQuestion: string;\n videoContinue: string;\n videoSkipQuiz: string;\n videoRewatch: string;\n /** Exam mode, once a question is submitted: saved, not graded. */\n videoAnswerSaved: string;\n /** The end card, while an answer is still being stored or graded: why Finish waits. */\n videoAnswerPending: string;\n videoRequired: string;\n /** A quiz's progress in the contents panel and on the end screen. */\n videoQuizProgress: (answered: number, total: number) => string;\n /** Announced when a quiz opens. */\n videoQuizOpened: (time: string, questions: number) => string;\n /** Announced when a seek stopped at a required quiz. */\n videoHeldAtQuiz: (time: string) => string;\n /** Announced when a seek stopped at the furthest point reached. */\n videoHeldAhead: string;\n videoEnded: string;\n /** Practice end screen: questions answered, and the score. */\n videoEndScore: (answered: number, total: number, percent: number) => string;\n /** Exam end screen: questions answered, no score. */\n videoEndAnswered: (answered: number, total: number) => string;\n videoWatchAgain: string;\n videoFinish: string;\n\n // ── Authoring preview ──────────────────────────────────────────────────\n /**\n * `<ActivityPreview>`, in place of a draft that still has something missing.\n * Author-facing, not learner-facing — but an editor is translated too.\n */\n previewIncomplete: string;\n /** `<ActivityPreview>`, in place of a draft with something wrong in it. */\n previewInvalid: string;\n\n // ── Embedded media ────────────────────────────────────────────────────────\n /**\n * Accessible name of a provider iframe whose author supplied no `alt`.\n * `MediaSchema` requires `alt` on an embed, so validated content never\n * reaches this — but `validateActivity` is opt-in, and a screen-reader\n * learner meeting an unvalidated one should not meet it in English.\n */\n embeddedMedia: string;\n\n // ── Shared stimulus ────────────────────────────────────────────────────\n /**\n * Accessible name of the stimulus region when the author gave it no title.\n * Keyed by `Stimulus['kind']`, because \"Recording\" and \"Passage\" do not share\n * a gender or an article in every language.\n */\n stimulusKind: Record<Stimulus['kind'], string>;\n /**\n * How far the material carries, e.g. \"Questions 3–8\". Called with equal\n * `first` and `last` for a single question, so a translation can choose its\n * own singular rather than receive a pre-pluralised English one.\n */\n stimulusRange: (first: number, last: number) => string;\n\n // ── Error boundary ─────────────────────────────────────────────────────\n /** Production fallback when an activity throws during render. */\n activityFailed: string;\n /** The same, when the activity's title is known. */\n activityFailedNamed: (title: string) => string;\n /** Production fallback when the activity has no title to name. */\n activityFailedUnnamed: string;\n\n // ── AI help ────────────────────────────────────────────────────────────\n /** The button that asks for an explanation of a graded answer. */\n aiExplain: string;\n /** The same button while the explanation is being written. */\n aiExplaining: string;\n /** The heading over an explanation, and its accessible name. */\n aiExplanation: string;\n /** When no explanation can be shown: the port failed, or its answer was refused. */\n aiExplanationUnavailable: string;\n /** The button that asks for a hint. */\n aiHint: string;\n /** The same button while the hint is being written. */\n aiHintLoading: string;\n /** The label before each hint. */\n aiHintNumber: (hintNumber: number) => string;\n /** The accessible name of the list of hints. */\n aiHints: string;\n /** When no hint can be shown: the port failed, or its hint gave the answer away. */\n aiHintUnavailable: string;\n /** In place of the hint button once every hint has been used. */\n aiNoMoreHints: string;\n /** Beneath every AI text: who wrote it. */\n aiNotice: string;\n /** The button that asks for feedback on a draft of a written response. */\n aiWritingFeedback: string;\n /** The same button while the feedback is being written. */\n aiWritingFeedbackLoading: string;\n /** The heading over feedback on a draft, and its accessible name. */\n aiWritingFeedbackHeading: string;\n /** When no feedback can be shown: the port failed, or its feedback was refused. */\n aiWritingFeedbackUnavailable: string;\n /** In place of the feedback button once the learner has used every request. */\n aiNoMoreWritingFeedback: string;\n /** Above feedback the learner has revised the draft since: its corrections may be out of date. */\n aiWritingFeedbackOutdated: string;\n /** The accessible name of the list of corrections the feedback suggests. */\n aiCorrections: string;\n /**\n * The rubric's weighted total of a model's judgements of a draft, as a whole\n * percentage — said to be an indication and not a grade, which it is not.\n */\n aiIndicativeScore: (percent: number) => string;\n\n // ── Audio transport ────────────────────────────────────────────────────\n /**\n * The listening-paper transport. Shipped in 0.8.0 as its own `mediaStrings`\n * prop, which still works — this is the same shape, reachable from the one\n * provider so a consumer does not wire two mechanisms.\n */\n media: MediaTransportStrings;\n}\n\n/** A partial override, nested one level for {@link LkStrings.media}. */\nexport type LkStringsOverride = Partial<Omit<LkStrings, 'media' | 'stimulusKind'>> & {\n media?: Partial<MediaTransportStrings>;\n stimulusKind?: Partial<Record<Stimulus['kind'], string>>;\n};\n\n/**\n * English defaults, byte-identical to what every component rendered before the\n * strings surface existed. Supplying no override changes nothing on screen.\n */\nexport const DEFAULT_STRINGS: LkStrings = {\n submit: 'Submit',\n checkAnswers: 'Check answers',\n submitAnswers: 'Submit answers',\n\n scoreAnnouncement: (percent, passed) =>\n `Score ${percent}%. ${passed ? 'Passed.' : 'Not passed.'}`,\n answerSubmitted: 'Answer submitted.',\n notGradedYet: 'Not graded yet.',\n noGradeAvailable: 'No grade available.',\n\n tryAgain: 'Try again',\n showAnswer: 'Show answer',\n keepAnswer: 'Keep this answer',\n triesLeft: (tries, costPercent) =>\n `${tries} ${tries === 1 ? 'try' : 'tries'} left.${\n costPercent > 0 ? ` Each costs ${costPercent}% of the marks.` : ''\n }`,\n countedTry: (counts, percent) =>\n `Your ${counts === 'first' ? 'first' : 'best'} try counts. This one scored ${percent}%.`,\n scoreBeforeCosts: (percent) => `Before hints and tries, this answer scored ${percent}%.`,\n hintCost: (percent) => `Each hint costs ${percent}% of this question's marks.`,\n\n showFeedback: 'Show feedback',\n hideFeedback: 'Hide feedback',\n\n blankLabel: (ordinal) => `Fill in blank ${ordinal}`,\n\n gapLabel: (ordinal) => `Choose the answer for gap ${ordinal}`,\n gapPlaceholder: 'Choose…',\n showHint: 'Show hint',\n hideHint: 'Hide hint',\n\n responseSubmitted:\n 'Response submitted. It will be graded and your result will appear here later.',\n wordCount: (count) => `${count} ${count === 1 ? 'word' : 'words'}`,\n wordBounds: (min, max) => (min > 0 ? `${min}–${max} words` : `up to ${max} words`),\n notApplicable: 'Not applicable',\n awaitingHumanReview: 'This grade is awaiting review by a teacher.',\n awaitingGrade: 'Not graded yet. This response is waiting for its grade.',\n couldNotBeGraded: 'This response could not be graded.',\n\n previous: 'Previous',\n next: 'Next',\n questionProgress: (index, total) => `Question ${index} of ${total}`,\n unsupportedActivity: 'This activity type has no renderer. Supply one through the renderers prop.',\n\n dictationInputLabel: 'Type what you hear',\n dictationRecording: 'Recording',\n dictationSlowRecording: 'Slow recording',\n dictationRevealNextWord: (revealed, total) =>\n `Reveal the next word (${revealed} of ${total} shown)`,\n dictationResetHints: 'Reset hints',\n showSolution: 'Show solution',\n hideSolution: 'Hide solution',\n dictationSolutionLabel: 'Solution',\n dictationMarksLabel: 'Your answer, word by word',\n dictationDiffNote: 'Compared after ignoring case, punctuation and extra spaces.',\n dictationWordCorrect: (word) => `“${word}” is correct`,\n dictationWordWrong: (word, expected) => `“${word}” should be “${expected}”`,\n dictationWordMissing: (expected) => `“${expected}” is missing`,\n dictationWordWrongUnnamed: (word) => `“${word}” is wrong`,\n dictationWordMissingUnnamed: 'A word is missing',\n dictationWordExtra: (word) => `“${word}” is extra`,\n dictationLegendCorrect: 'Correct',\n dictationLegendWrong: 'Wrong',\n dictationLegendMissing: 'Missing',\n dictationLegendExtra: 'Extra',\n dictationNothingTyped: 'Nothing to compare: no words were entered.',\n dictationWordsSummary: (correct, total) =>\n `${correct} of ${total} ${total === 1 ? 'word' : 'words'} correct.`,\n\n readAloudModelRecording: 'Model recording',\n readAloudSlowRecording: 'Slow model recording',\n readAloudRecord: 'Record',\n readAloudStop: 'Stop recording',\n readAloudRerecord: 'Record again',\n readAloudYourRecording: 'Your recording',\n readAloudPlaybackUnavailable: 'Your recording cannot be played back on this page.',\n readAloudRecordingProgress: (seconds, maxSeconds) =>\n `Recording: ${seconds} of ${maxSeconds} seconds`,\n readAloudRecordingStarted: 'Recording started.',\n readAloudRecordingStopped: (seconds, maxSeconds) =>\n `Recording stopped. ${seconds} of ${maxSeconds} seconds recorded.`,\n readAloudTakesRemaining: (remaining, max) =>\n `${remaining} of ${max} recording${max === 1 ? '' : 's'} left`,\n readAloudSubmitWithoutRecording: 'Submit without recording',\n readAloudUploading: 'Sending your recording…',\n readAloudUploadFailed: 'Your recording could not be sent.',\n readAloudTryAgain: 'Try again',\n readAloudAssessing: 'Checking your pronunciation…',\n readAloudAssessmentUnavailable: 'Pronunciation feedback is not available for this activity.',\n readAloudNotHeard: 'We could not hear you. Record again somewhere quieter.',\n readAloudNotAssessed: 'This recording could not be assessed. Try recording it again.',\n readAloudAssessmentFailed: 'Your pronunciation could not be checked.',\n readAloudRecorderError: (reason) => {\n switch (reason) {\n case 'permission-denied':\n return 'This page is not allowed to use the microphone.';\n case 'no-device':\n return 'No microphone was found.';\n case 'unsupported':\n return 'This browser cannot record audio.';\n case 'too-short':\n return 'That recording was too short.';\n default:\n return 'The recording could not be made.';\n }\n },\n\n pronunciationFeedbackLabel: 'Pronunciation feedback',\n pronunciationDimension: (dimension) => {\n switch (dimension) {\n case 'accuracy':\n return 'Accuracy';\n case 'fluency':\n return 'Fluency';\n case 'completeness':\n return 'Completeness';\n default:\n return 'Intonation';\n }\n },\n pronunciationNotAssessed: 'Not assessed',\n pronunciationWordsLabel: 'Your reading, word by word',\n pronunciationLegend: (state) => {\n switch (state) {\n case 'correct':\n return 'Read correctly';\n case 'mispronounced':\n return 'Mispronounced';\n case 'omitted':\n return 'Not read';\n default:\n return 'Added';\n }\n },\n pronunciationWordCorrect: (word) => `“${word}” was read correctly`,\n pronunciationWordMispronounced: (word) => `“${word}” was mispronounced`,\n pronunciationWordOmitted: (word) => `“${word}” was not read`,\n pronunciationWordInserted: (word) => `“${word}” was added`,\n pronunciationWordDetails: (word) => `Details for “${word}”`,\n pronunciationSyllables: 'Syllables',\n pronunciationPhonemes: 'Sounds',\n pronunciationSyllableSpelling: (syllable, grapheme) => `${syllable} (spelled “${grapheme}”)`,\n pronunciationPhonemePosition: (ordinal) => `Sound ${ordinal}`,\n pronunciationHeardAs: 'Heard as',\n pronunciationPlayWord: (word) => `Play “${word}”`,\n pronunciationBreakUnexpected: 'There was an unexpected pause here.',\n pronunciationBreakMissing: 'A pause was expected here.',\n pronunciationMonotone: 'Your reading stayed on one note. Try varying your pitch.',\n pronunciationIpaNote: 'Sounds are written in the International Phonetic Alphabet.',\n videoBack: (seconds) => `Back ${seconds} seconds`,\n videoForward: (seconds) => `Forward ${seconds} seconds`,\n videoReplay: 'Replay',\n videoShowRemaining: 'Show time remaining',\n videoShowElapsed: 'Show time elapsed',\n videoCaptionsShow: 'Show captions',\n videoCaptionsHide: 'Hide captions',\n videoCaptionsFailed: 'Captions could not be loaded.',\n videoSecondaryCaptionsFailed: 'The second language could not be loaded.',\n videoSpeedValue: (rate) => (rate === 1 ? 'Normal' : `${rate}×`),\n videoSettings: 'Settings',\n videoCaptionLanguage: 'Captions',\n videoSecondCaptionLanguage: 'Second language',\n videoCaptionPair: (primary, secondary) => `${primary} + ${secondary}`,\n videoNoSecondLanguage: 'No second language for this video.',\n videoCaptionSize: 'Caption size',\n videoCaptionSizeValue: (size) =>\n size === 'small' ? 'Small' : size === 'large' ? 'Large' : 'Medium',\n videoCaptionBackground: 'Caption background',\n videoKeyboardShortcuts: 'Keyboard shortcuts',\n videoShortcutList: 'Shortcut list',\n videoClose: 'Close',\n videoOn: 'On',\n videoOff: 'Off',\n videoShortcut: (action) => {\n switch (action) {\n case 'play-pause':\n return 'Play or pause';\n case 'jump-10':\n return 'Back or forward 10 seconds';\n case 'jump-5':\n return 'Back or forward 5 seconds';\n case 'jump-1':\n return 'Back or forward 1 second';\n case 'frame':\n return 'Previous or next frame, while paused';\n case 'speed':\n return 'Slower or faster';\n case 'percent':\n return 'Jump to 0% – 90%';\n case 'start-end':\n return 'Start or end';\n case 'chapter':\n return 'Previous or next chapter or quiz';\n case 'mute':\n return 'Mute';\n case 'captions':\n return 'Captions';\n case 'secondary-captions':\n return 'Second caption language on/off';\n case 'transcript':\n return 'Transcript';\n case 'picture-in-picture':\n return 'Picture in picture';\n case 'fullscreen':\n return 'Fullscreen';\n default:\n return 'This list';\n }\n },\n videoPanel: 'Contents and transcript',\n videoContents: 'Contents',\n videoTranscript: 'Transcript',\n videoTranscriptSearch: 'Search the transcript',\n videoTranscriptNoMatch: 'No lines match.',\n videoPictureInPicture: 'Picture in picture',\n videoFullscreen: 'Fullscreen',\n videoExitFullscreen: 'Exit fullscreen',\n videoError: (code) =>\n code === 2\n ? 'The connection dropped while the video was loading.'\n : code === 3\n ? 'This video file could not be played.'\n : code === 4\n ? 'The video could not be loaded.'\n : 'The video stopped before it could play.',\n videoTryAgain: 'Try again',\n videoQuiz: 'Quiz',\n videoQuestionProgress: (index, total) => `Question ${index} of ${total}`,\n videoQuestionStep: (index, answered) => `Question ${index}${answered ? ', answered' : ''}`,\n videoNextQuestion: 'Next question',\n videoContinue: 'Continue video',\n videoSkipQuiz: 'Skip quiz',\n videoRewatch: 'Rewatch',\n videoAnswerSaved: 'Answer saved',\n videoAnswerPending: 'Saving your answer…',\n videoRequired: 'Required',\n videoQuizProgress: (answered, total) =>\n answered === total\n ? 'Answered'\n : answered === 0\n ? 'Not started'\n : `${answered} of ${total} answered`,\n videoQuizOpened: (time, questions) =>\n `Video paused. Quiz at ${time}, ${questions} question${questions === 1 ? '' : 's'}.`,\n videoHeldAtQuiz: (time) => `Finish the quiz at ${time} to continue.`,\n videoHeldAhead: 'You can rewind, but not skip ahead.',\n videoEnded: 'You reached the end',\n videoEndScore: (answered, total, percent) => `You answered ${answered} of ${total} · ${percent}%`,\n videoEndAnswered: (answered, total) => `You answered ${answered} of ${total} questions`,\n videoWatchAgain: 'Watch again',\n videoFinish: 'Finish',\n\n previewIncomplete: 'This activity is not finished yet, so it cannot be previewed.',\n previewInvalid: 'This activity has a problem to fix before it can be previewed.',\n\n embeddedMedia: 'Embedded media',\n\n stimulusKind: {\n text: 'Passage',\n audio: 'Recording',\n video: 'Video',\n image: 'Image',\n mixed: 'Material',\n },\n stimulusRange: (first, last) =>\n first === last ? `Question ${first}` : `Questions ${first}–${last}`,\n\n activityFailed: 'Activity failed to render',\n activityFailedNamed: (title) => `\"${title}\" could not be displayed.`,\n activityFailedUnnamed: 'This activity could not be displayed.',\n aiExplain: 'Explain my answer',\n aiExplaining: 'Explaining…',\n aiExplanation: 'Explanation',\n aiExplanationUnavailable: 'No explanation is available right now.',\n aiHint: 'Get a hint',\n aiHintLoading: 'Finding a hint…',\n aiHintNumber: (hintNumber) => `Hint ${hintNumber}`,\n aiHints: 'Hints',\n aiHintUnavailable: 'No hint is available right now.',\n aiNoMoreHints: 'No more hints for this question.',\n aiNotice: 'Written by AI. It can make mistakes.',\n aiWritingFeedback: 'Get feedback on my draft',\n aiWritingFeedbackLoading: 'Reading your draft…',\n aiWritingFeedbackHeading: 'Feedback on your draft',\n aiWritingFeedbackUnavailable: 'No feedback is available right now.',\n aiNoMoreWritingFeedback: 'No more feedback for this answer.',\n aiWritingFeedbackOutdated: 'You have changed your text since this feedback.',\n aiCorrections: 'Suggested corrections',\n aiIndicativeScore: (percent) => `Indicative score: ${percent}%. Not a grade.`,\n\n media: {\n play: 'Play',\n pause: 'Pause',\n preparing: 'Preparing…',\n mute: 'Mute',\n unmute: 'Unmute',\n volume: 'Volume',\n speed: 'Playback speed',\n seek: 'Seek',\n timeValue: (elapsed, duration) => `${elapsed} of ${duration}`,\n playsRemaining: (remaining, max) =>\n `${remaining} of ${max} play${max === 1 ? '' : 's'} remaining`,\n noPlaysRemaining: 'No plays remaining',\n lastPlayConfirm: 'This is your last play. Start it now?',\n lastPlayStart: 'Start last play',\n lastPlayCancel: 'Not yet',\n seekBlocked: 'Rewinding is not available for this recording.',\n rateBlocked: 'Playback speed is fixed for this recording.',\n playFailed: 'The recording could not be started. Try again.',\n },\n};\n\n/**\n * Layers an override onto a base dictionary.\n *\n * Two levels deep and no further, because the shape is two levels deep. A\n * generic deep merge would silently accept a nested object where a function\n * belongs and fail at render instead of at the call site.\n */\nexport function mergeStrings(base: LkStrings, override?: LkStringsOverride): LkStrings {\n if (override === undefined) {\n return base;\n }\n const { media, stimulusKind, ...flat } = override;\n return {\n ...base,\n ...flat,\n stimulusKind: { ...base.stimulusKind, ...stimulusKind },\n media: { ...base.media, ...media },\n };\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { LkStrings, LkStringsOverride } from './strings.js';\nimport { DEFAULT_STRINGS, mergeStrings } from './strings.js';\n\nexport type { LkStrings, LkStringsOverride } from './strings.js';\nexport { DEFAULT_STRINGS, mergeStrings } from './strings.js';\n\n/** Writing direction of the surrounding UI. `auto` defers to the locale. */\nexport type LkDirection = 'ltr' | 'rtl' | 'auto';\n\ninterface LkIntlValue {\n strings: LkStrings;\n locale: string | undefined;\n direction: 'ltr' | 'rtl';\n}\n\nconst LkIntlContext = createContext<LkIntlValue | null>(null);\n\n/**\n * Locales written right-to-left, by language subtag.\n *\n * A short list rather than a dependency: these are the RTL scripts in living\n * use, and the set has not changed in decades. `Intl.Locale.textInfo` would be\n * better but is not available everywhere this package runs, and an explicit\n * `direction` prop overrides this in either direction anyway.\n */\nconst RTL_LANGUAGES = new Set(['ar', 'arc', 'dv', 'fa', 'he', 'ku', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/** Resolves a BCP 47 tag to a writing direction. */\nexport function directionForLocale(locale: string | undefined): 'ltr' | 'rtl' {\n if (locale === undefined) {\n return 'ltr';\n }\n const language = locale.split('-')[0]?.toLowerCase() ?? '';\n return RTL_LANGUAGES.has(language) ? 'rtl' : 'ltr';\n}\n\nexport interface LkIntlProviderProps {\n /**\n * Replaces the SDK's own chrome text. Anything omitted keeps its English\n * default, so a partial translation degrades to mixed rather than to blank.\n *\n * A nested provider REPLACES the one above it rather than layering onto it —\n * as a nested `ThemeProvider` restarts from `defaultTheme`. To layer, use a\n * component's own `strings` prop, or compose with `mergeStrings`.\n */\n strings?: LkStringsOverride;\n /**\n * BCP 47 tag for the SDK's chrome — NOT for the authored content, which\n * carries its own `locale`. Sets `lang` on the wrapper so a screen reader\n * reads \"Question 3 of 10\" in the interface language rather than in the\n * language of the passage beside it (WCAG 3.1.2).\n */\n locale?: string;\n /**\n * Writing direction. Defaults to `auto`, which derives it from `locale`.\n * Set it explicitly when the surrounding application already manages `dir`\n * and you do not want a second element declaring one.\n */\n direction?: LkDirection;\n children: React.ReactNode;\n}\n\n/**\n * Supplies the SDK's chrome text and writing direction to everything beneath.\n *\n * Mirrors `ThemeProvider`: a provider for the whole tree, and a per-component\n * prop for the exceptions. The component prop wins, so a single activity can\n * be relabelled without a second provider.\n *\n * ```tsx\n * <LkIntlProvider locale=\"es\" strings={{\n * submit: 'Enviar',\n * checkAnswers: 'Comprobar respuestas',\n * questionProgress: (i, total) => `Pregunta ${i} de ${total}`,\n * wordCount: (n) => `${n} ${n === 1 ? 'palabra' : 'palabras'}`,\n * media: { noPlaysRemaining: 'No quedan reproducciones' },\n * }}>\n * <ActivitySequence … />\n * </LkIntlProvider>\n * ```\n *\n * The SDK ships **English only**. Bundling Spanish, Portuguese or Arabic would\n * mean shipping translations nobody in this repo can review, and a wrong\n * \"No plays remaining\" on a listening exam is worse than an English one that a\n * teacher can see is untranslated. The mechanism is the deliverable; the words\n * belong to whoever speaks the language.\n */\nexport function LkIntlProvider({\n strings,\n locale,\n direction = 'auto',\n children,\n}: LkIntlProviderProps): React.JSX.Element {\n const value = useMemo<LkIntlValue>(\n () => ({\n strings: mergeStrings(DEFAULT_STRINGS, strings),\n locale,\n direction: direction === 'auto' ? directionForLocale(locale) : direction,\n }),\n [strings, locale, direction],\n );\n\n // Declare `dir` only when something actually told us the direction. With no\n // locale and no explicit `direction`, writing dir=\"ltr\" would flip an RTL\n // host's own subtree back to left-to-right — the context value stays\n // concrete for `useLkDirection`; it is only the DOM declaration we withhold.\n const declared = direction === 'auto' && locale === undefined ? undefined : value.direction;\n\n return (\n <LkIntlContext.Provider value={value}>\n <div className=\"lk-intl\" lang={locale} dir={declared}>\n {children}\n </div>\n </LkIntlContext.Provider>\n );\n}\n\n/**\n * The strings in force, with an optional per-component override layered on top.\n *\n * Usable without a provider: every component calls this, and one rendered\n * standalone still needs its labels. Falling back to the English defaults is\n * what keeps `<MultipleChoice>` working with no setup at all.\n */\nexport function useLkStrings(override?: LkStringsOverride): LkStrings {\n const context = useContext(LkIntlContext);\n const base = context?.strings ?? DEFAULT_STRINGS;\n return useMemo(() => mergeStrings(base, override), [base, override]);\n}\n\n/** The direction in force. `ltr` with no provider. */\nexport function useLkDirection(): 'ltr' | 'rtl' {\n return useContext(LkIntlContext)?.direction ?? 'ltr';\n}\n"]}
@@ -1,16 +1,26 @@
1
1
  'use client';
2
- import { useLearnerAi } from './chunk-MCTNLUKO.js';
2
+ import { useLearnerAi } from './chunk-RX3A6KIY.js';
3
3
  import { SequenceSlotContext } from './chunk-U4KTOH7C.js';
4
- import { isDevelopment } from './chunk-PPFVTXGJ.js';
5
- import { combineDeliveryPolicies, aiExplanationRequest, checkAiExplanation, aiHintRequest, checkAiHint, OPEN_DELIVERY_POLICY, aiSupports, aiAllowedByContent } from '@intellectif/lk-core';
4
+ import { isDevelopment } from './chunk-DXFCYNST.js';
5
+ import { combineDeliveryPolicies, aiExplanationRequest, checkAiExplanation, aiHintRequest, checkAiHint, aiWritingFeedbackRequest, checkAiWritingFeedback, OPEN_DELIVERY_POLICY, aiSupports, aiAllowedByContent } from '@intellectif/lk-core';
6
6
  import { useContext, useState, useRef, useEffect, useCallback } from 'react';
7
7
 
8
8
  var DEFAULT_MAX_HINTS = 3;
9
9
  var MAX_HINTS_CEILING = 10;
10
- function hintLimit(ai) {
11
- const asked = ai?.maxHints;
10
+ function limitOf(asked) {
12
11
  return typeof asked === "number" && Number.isInteger(asked) && asked >= 1 ? Math.min(asked, MAX_HINTS_CEILING) : DEFAULT_MAX_HINTS;
13
12
  }
13
+ function hintLimit(ai) {
14
+ return limitOf(ai?.maxHints);
15
+ }
16
+ function writingFeedbackLimit(ai) {
17
+ return limitOf(ai?.maxWritingFeedback);
18
+ }
19
+ function writingFeedbackOffered(input) {
20
+ const { data, renderMode, submitted, disabled } = input;
21
+ const delivery = input.delivery ?? OPEN_DELIVERY_POLICY;
22
+ return delivery.feedback && delivery.solutions && delivery.ai.explanations && renderMode === "practice" && !submitted && !disabled && data.redacted !== true && aiSupports(data.type, "writing-feedback") && aiAllowedByContent(data, "writing-feedback");
23
+ }
14
24
  function hintOffered(input) {
15
25
  const { data, renderMode, submitted, disabled } = input;
16
26
  const delivery = input.delivery ?? OPEN_DELIVERY_POLICY;
@@ -253,7 +263,127 @@ function useAiHints(input) {
253
263
  ask
254
264
  };
255
265
  }
266
+ var draftOf = (response) => response.type === "written-response" ? response.text : "";
267
+ function useAiWritingFeedback(input) {
268
+ const { data, submitted, response } = input;
269
+ const around = useContext(SequenceSlotContext);
270
+ const renderMode = modeInForce(input.renderMode, around?.renderMode);
271
+ const delivery = combineDeliveryPolicies(input.delivery, around?.delivery);
272
+ const disabled = input.disabled === true;
273
+ const ai = useLearnerAi(input.ai);
274
+ const resetKey = data.id;
275
+ const [state, setState] = useState({
276
+ key: resetKey,
277
+ shown: [],
278
+ status: "idle"
279
+ });
280
+ const run = useRef(0);
281
+ const controller = useRef(null);
282
+ const current = state.key === resetKey ? state : { key: resetKey, shown: [], status: "idle" };
283
+ const offered = ai?.writingFeedback !== void 0 && writingFeedbackOffered({ data, renderMode, submitted, disabled, delivery });
284
+ const limit = writingFeedbackLimit(ai);
285
+ const latest = useRef({ input, ai, offered, limit, current });
286
+ latest.current = { input, ai, offered, limit, current };
287
+ useEffect(() => {
288
+ return () => {
289
+ run.current += 1;
290
+ controller.current?.abort();
291
+ controller.current = null;
292
+ };
293
+ }, [resetKey]);
294
+ useEffect(() => {
295
+ if (!offered) {
296
+ run.current += 1;
297
+ controller.current?.abort();
298
+ controller.current = null;
299
+ setState(
300
+ (previous) => previous.status === "loading" ? { ...previous, status: "idle" } : previous
301
+ );
302
+ }
303
+ }, [offered]);
304
+ const ask = useCallback(() => {
305
+ const now = latest.current;
306
+ const port = now.ai?.writingFeedback;
307
+ const held = now.current;
308
+ if (port === void 0 || !now.offered || held.status === "loading" || held.shown.length >= now.limit) {
309
+ return;
310
+ }
311
+ const key = held.key;
312
+ const about = draftOf(now.input.response);
313
+ const request = aiWritingFeedbackRequest({
314
+ data: now.input.data,
315
+ response: now.input.response,
316
+ previousFeedback: held.shown.map((one) => one.feedback.text),
317
+ ...localeOf(now.ai, now.input.locale)
318
+ });
319
+ if (request === null) {
320
+ return;
321
+ }
322
+ run.current += 1;
323
+ const mine = run.current;
324
+ controller.current?.abort();
325
+ const abort = new AbortController();
326
+ controller.current = abort;
327
+ setState({ ...held, status: "loading" });
328
+ callPort(() => port(request, { signal: abort.signal })).then(
329
+ (raw) => {
330
+ if (run.current !== mine) {
331
+ return;
332
+ }
333
+ const checked = checkAiWritingFeedback(raw, request);
334
+ if (!checked.ok) {
335
+ warnRefused("writing feedback", now.input.data.id, checked.refusal);
336
+ setState((was) => ({ ...was, status: "unavailable" }));
337
+ latest.current.input.onInteraction?.({
338
+ type: "ai-help-refused",
339
+ activityId: now.input.data.id,
340
+ timestamp: Date.now(),
341
+ payload: {
342
+ feature: "writing-feedback",
343
+ reason: checked.refusal,
344
+ draftNumber: request.draftNumber
345
+ }
346
+ });
347
+ return;
348
+ }
349
+ const { feedback } = checked;
350
+ setState((was) => ({
351
+ ...was,
352
+ shown: was.key === key ? [...was.shown, { feedback, about }] : was.shown,
353
+ status: "idle"
354
+ }));
355
+ latest.current.input.onInteraction?.({
356
+ type: "ai-writing-feedback-shown",
357
+ activityId: now.input.data.id,
358
+ timestamp: Date.now(),
359
+ payload: {
360
+ draftNumber: request.draftNumber,
361
+ corrections: feedback.corrections.length,
362
+ ...feedback.indicativeScore !== null ? { indicativeScore: feedback.indicativeScore } : {},
363
+ ...shownPayload(feedback)
364
+ }
365
+ });
366
+ },
367
+ () => {
368
+ if (run.current === mine) {
369
+ setState((was) => ({ ...was, status: "unavailable" }));
370
+ }
371
+ }
372
+ );
373
+ }, []);
374
+ const last = current.shown[current.shown.length - 1];
375
+ return {
376
+ offered,
377
+ status: current.status,
378
+ feedback: current.shown.map((one) => one.feedback),
379
+ latest: last?.feedback ?? null,
380
+ current: last !== void 0 && last.about === draftOf(response),
381
+ limit,
382
+ used: current.shown.length,
383
+ ask
384
+ };
385
+ }
256
386
 
257
- export { useAiExplanation, useAiHints };
258
- //# sourceMappingURL=chunk-NDIKHMLJ.js.map
259
- //# sourceMappingURL=chunk-NDIKHMLJ.js.map
387
+ export { useAiExplanation, useAiHints, useAiWritingFeedback };
388
+ //# sourceMappingURL=chunk-CXIP7ERK.js.map
389
+ //# sourceMappingURL=chunk-CXIP7ERK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ai/rules.ts","../src/ai/useAiHelp.ts"],"names":[],"mappings":";;;;;;AAqBA,IAAM,iBAAA,GAAoB,CAAA;AAC1B,IAAM,iBAAA,GAAoB,EAAA;AAG1B,SAAS,QAAQ,KAAA,EAAwB;AACvC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,MAAA,CAAO,SAAA,CAAU,KAAK,CAAA,IAAK,KAAA,IAAS,CAAA,GACpE,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,iBAAiB,CAAA,GACjC,iBAAA;AACN;AAGO,SAAS,UAAU,EAAA,EAAmC;AAC3D,EAAA,OAAO,OAAA,CAAQ,IAAI,QAAQ,CAAA;AAC7B;AAGO,SAAS,qBAAqB,EAAA,EAAmC;AACtE,EAAA,OAAO,OAAA,CAAQ,IAAI,kBAAkB,CAAA;AACvC;AAUO,SAAS,uBAAuB,KAAA,EAM3B;AACV,EAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,SAAA,EAAW,UAAS,GAAI,KAAA;AAClD,EAAA,MAAM,QAAA,GAAW,MAAM,QAAA,IAAY,oBAAA;AACnC,EAAA,OACE,QAAA,CAAS,YACT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Q,MAAM,QAAA,IAAY,IAAA;AAAA,IAC1B,SAAS,IAAA,KAAS,MAAA,IAAa,IAAA,CAAK,KAAA,KAAU,QAAQ,QAAQ,CAAA;AAAA,IAC9D,KAAA;AAAA,IACA,IAAA,EAAM,QAAQ,KAAA,CAAM,MAAA;AAAA,IACpB;AAAA,GACF;AACF","file":"chunk-CXIP7ERK.js","sourcesContent":["/**\n * When AI help is offered, and what the SDK does with what a port answers.\n *\n * Internal: these are the rules behind {@link useAiHints} and\n * {@link useAiExplanation}, which are what a host calls. They live apart from\n * the hooks so the hooks' module exports nothing but the hooks themselves.\n */\nimport {\n type AiRefusal,\n aiAllowedByContent,\n aiSupports,\n type ItemOutcome,\n type LearnerResponse,\n OPEN_DELIVERY_POLICY,\n type ResolvedDeliveryPolicy,\n} from '@intellectif/lk-core';\nimport { isDevelopment } from '../components/_internal.js';\nimport type { RenderableActivity, RenderMode } from '../components/types.js';\nimport type { LearnerAi } from './LkAiProvider.js';\n\n/** The most hints a question gives when the host names no number, and the most it may name. */\nconst DEFAULT_MAX_HINTS = 3;\nconst MAX_HINTS_CEILING = 10;\n\n/** A host's limit as a whole number from 1 to 10; anything else is the default, 3. */\nfunction limitOf(asked: unknown): number {\n return typeof asked === 'number' && Number.isInteger(asked) && asked >= 1\n ? Math.min(asked, MAX_HINTS_CEILING)\n : DEFAULT_MAX_HINTS;\n}\n\n/** `maxHints` as a whole number from 1 to 10; anything else is the default. */\nexport function hintLimit(ai: LearnerAi | undefined): number {\n return limitOf(ai?.maxHints);\n}\n\n/** `maxWritingFeedback` as a whole number from 1 to 10; anything else is the default. */\nexport function writingFeedbackLimit(ai: LearnerAi | undefined): number {\n return limitOf(ai?.maxWritingFeedback);\n}\n\n/**\n * Whether the learner may ask for feedback on a draft: `practice`, before\n * submit, on a written response that is not disabled or redacted, whose author\n * left explanations on. The paper's policy must show feedback and solutions —\n * a correction is the right form beside a wrong one — and allow AI\n * explanations, which writing feedback is: a model's words about the\n * learner's own answer.\n */\nexport function writingFeedbackOffered(input: {\n data: RenderableActivity;\n renderMode: RenderMode;\n submitted: boolean;\n disabled: boolean;\n delivery?: ResolvedDeliveryPolicy;\n}): boolean {\n const { data, renderMode, submitted, disabled } = input;\n const delivery = input.delivery ?? OPEN_DELIVERY_POLICY;\n return (\n delivery.feedback &&\n delivery.solutions &&\n delivery.ai.explanations &&\n renderMode === 'practice' &&\n !submitted &&\n !disabled &&\n data.redacted !== true &&\n aiSupports(data.type, 'writing-feedback') &&\n aiAllowedByContent(data, 'writing-feedback')\n );\n}\n\n/**\n * Whether the learner may ask for a hint: `practice`, before submit, on a\n * question that is not disabled, of a type that takes hints, whose author left\n * hints on, and whole — a redacted item is an exam's, and gives none.\n */\nexport function hintOffered(input: {\n data: RenderableActivity;\n renderMode: RenderMode;\n submitted: boolean;\n disabled: boolean;\n /** The paper's policy: hints at all, and AI hints in particular. Open when absent. */\n delivery?: ResolvedDeliveryPolicy;\n}): boolean {\n const { data, renderMode, submitted, disabled } = input;\n const delivery = input.delivery ?? OPEN_DELIVERY_POLICY;\n return (\n delivery.hints &&\n delivery.ai.hints &&\n renderMode === 'practice' &&\n !submitted &&\n !disabled &&\n data.redacted !== true &&\n aiSupports(data.type, 'hint') &&\n aiAllowedByContent(data, 'hint')\n );\n}\n\n/**\n * Whether the learner may ask for an explanation: of a graded answer — in\n * `practice` once submitted, or in `review` when the grade of record is\n * scored — of a type the SDK explains, whose author left explanations on.\n * Never in `exam`.\n */\nexport function explanationOffered(input: {\n data: RenderableActivity;\n renderMode: RenderMode;\n submitted: boolean;\n outcome: ItemOutcome | undefined;\n /**\n * The paper's policy. An explanation needs AI explanations on, and more: it\n * explains a grade, so it needs the grade shown (`feedback`), and it all but\n * always says what the right answer was, so it needs `solutions` too. On a\n * paper that hides the answer, \"Explain my answer\" would hand it over.\n */\n delivery?: ResolvedDeliveryPolicy;\n}): boolean {\n const { data, renderMode, submitted, outcome } = input;\n const delivery = input.delivery ?? OPEN_DELIVERY_POLICY;\n if (!delivery.feedback || !delivery.solutions || !delivery.ai.explanations) {\n return false;\n }\n const graded =\n (renderMode === 'practice' && submitted) ||\n (renderMode === 'review' && outcome?.status === 'scored');\n return graded && aiSupports(data.type, 'explanation') && aiAllowedByContent(data, 'explanation');\n}\n\n/** Calls a port, turning a synchronous throw into a rejection. */\nexport function callPort<T>(call: () => Promise<T>): Promise<T> {\n try {\n return Promise.resolve(call());\n } catch (error) {\n return Promise.reject(error);\n }\n}\n\n/** Tells a developer why a port's answer was not shown. Silent in production. */\nexport function warnRefused(\n feature: 'explanation' | 'hint' | 'writing feedback',\n activityId: string,\n reason: AiRefusal,\n): void {\n if (isDevelopment()) {\n console.warn(\n `learning-kit: the AI ${feature} for \"${activityId}\" was not shown (${reason}). The learner saw \"not available\" instead.`,\n );\n }\n}\n\n/** The language to write in: the host's choice for the learner, else the interface language. */\nexport const localeOf = (\n ai: LearnerAi | undefined,\n locale: string | undefined,\n): { learnerLocale?: string } => {\n const chosen = ai?.learnerLocale ?? locale;\n return chosen === undefined ? {} : { learnerLocale: chosen };\n};\n\n/** What an explanation is about: when any of it changes, the explanation shown no longer is. */\nexport function explanationKey(\n renderMode: RenderMode,\n submitted: boolean,\n response: LearnerResponse,\n outcome: ItemOutcome | undefined,\n): string {\n let graded = '';\n if (outcome !== undefined) {\n graded = `${outcome.status}:${'score' in outcome ? outcome.score : ''}`;\n }\n return `${renderMode}|${submitted}|${graded}|${JSON.stringify(response)}`;\n}\n","'use client';\n\nimport {\n type AiTextResult,\n type AiWritingFeedback,\n aiExplanationRequest,\n aiHintRequest,\n aiWritingFeedbackRequest,\n checkAiExplanation,\n checkAiHint,\n checkAiWritingFeedback,\n combineDeliveryPolicies,\n type DeliveryPolicy,\n type InteractionEvent,\n type ItemOutcome,\n type LearnerResponse,\n} from '@intellectif/lk-core';\nimport { useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport { SequenceSlotContext } from '../components/shared/sequence-slot.js';\nimport type { RenderableActivity, RenderMode } from '../components/types.js';\nimport { type LearnerAi, useLearnerAi } from './LkAiProvider.js';\nimport {\n callPort,\n explanationKey,\n explanationOffered,\n hintLimit,\n hintOffered,\n localeOf,\n warnRefused,\n writingFeedbackLimit,\n writingFeedbackOffered,\n} from './rules.js';\n\n/**\n * The question AI help is being asked about, as the SDK's own components know\n * it. A host drawing its own question passes what it has; everything optional\n * defaults to what the components pass.\n */\nexport interface AiHelpSituation {\n /** The question, as `data` is given to any activity component. */\n data: RenderableActivity;\n /** The learner's answer as it stands: submitted, restored, or being written. */\n response: LearnerResponse;\n /** Whether the learner has committed that answer. */\n submitted: boolean;\n /**\n * Pass on the `renderMode` your question was given. Left out, the paper\n * around the question answers for it — a question inside `<ActivitySequence>`\n * or `<InteractiveVideo>` knows its mode — and `practice` only where there is\n * no paper at all. An `exam` around the question wins over anything passed\n * here.\n */\n renderMode?: RenderMode;\n /**\n * The AI ports to use, overriding {@link LkAiProvider}'s for this question.\n * A question inside `<ActivitySequence>` or `<InteractiveVideo>` is handed\n * the ports in force as `ai` — pass that straight in.\n */\n ai?: LearnerAi;\n /** The interface language: the default language for what a model writes. */\n locale?: string;\n /** Where `ai-hint-shown` and `ai-explanation-shown` go. */\n onInteraction?: (event: InteractionEvent) => void;\n /**\n * The delivery policy your question was handed. The paper around the\n * question holds as well — a set that switched AI hints off keeps them off\n * here, whatever is passed — so leaving it out never turns anything on.\n */\n delivery?: DeliveryPolicy | null;\n}\n\nexport interface AiExplanationInput extends AiHelpSituation {\n /** The grade of record, which `review` explains. */\n outcome?: ItemOutcome;\n}\n\nexport interface AiExplanationHelp {\n /**\n * Whether to offer the learner an explanation at all: a port is present, the\n * answer is graded, the type is one the SDK explains, and the author left\n * explanations on. False in `exam`, always.\n */\n offered: boolean;\n status: 'idle' | 'loading' | 'shown' | 'unavailable';\n /** What to show, once it has arrived and been checked. Its `text` is text, never HTML. */\n explanation: AiTextResult | null;\n /**\n * Asks the port, when the learner presses something. Does nothing while a\n * call is on its way, and nothing at all where `offered` is false — so an\n * exam cannot reach a model through this hook, whatever ports are in scope.\n *\n * One identity for the life of the question, so it is safe in an effect's\n * dependencies.\n */\n ask: () => void;\n}\n\nexport interface AiHintsInput extends AiHelpSituation {\n /** A disabled question gives no hints, as it takes no answer. */\n disabled?: boolean;\n}\n\nexport interface AiHintsHelp {\n /**\n * Whether the learner may ask for hints here at all: a port is present, the\n * mode is `practice`, the answer is not in, the question is not disabled or\n * redacted, the type takes hints and the author left them on. It stays true\n * once `used` reaches `limit` — there are no more to give, but the question\n * is still one that gives them.\n */\n offered: boolean;\n status: 'idle' | 'loading' | 'unavailable';\n /** Every hint shown for this question, in the order they were given. */\n hints: readonly AiTextResult[];\n /** The host's `maxHints`, as a whole number from 1 to 10 (3 by default). */\n limit: number;\n /** How many hints have been shown. A refused hint is not counted. */\n used: number;\n /**\n * Asks for the next hint. Does nothing at the limit, while a call is on its\n * way, or where `offered` is false. One identity for the life of the\n * question.\n */\n ask: () => void;\n}\n\n/**\n * The mode a question is answered in: what the caller says, and what the paper\n * around it says.\n *\n * A host drawing its own question is given `renderMode` like every other prop\n * and is expected to pass it on, but nothing makes it — and a hook that took\n * `practice` on trust would offer hints on a paper of record, as soon as an\n * `LkAiProvider` sat anywhere above the pager. So an `exam` around the question\n * wins, and where the caller says nothing the paper answers for it. A question\n * standing on its own belongs to no paper, and is `practice` as before.\n */\nfunction modeInForce(asked: RenderMode | undefined, around: RenderMode | undefined): RenderMode {\n if (around === 'exam') {\n return 'exam';\n }\n return asked ?? around ?? 'practice';\n}\n\n/**\n * What the record of help a learner was shown carries beside the fact of it:\n * who wrote it, and what the call cost — both only where the port sent them.\n *\n * The text is deliberately absent. A host that wants to keep what a learner\n * read has it in its own port; an interaction is a record of what happened, and\n * is kept for every learner and every question.\n */\nfunction shownPayload(result: AiTextResult): Record<string, unknown> {\n return {\n ...(result.provenance !== undefined ? { provenance: result.provenance } : {}),\n ...(result.usage !== undefined ? { usage: result.usage } : {}),\n };\n}\n\ntype ExplanationState =\n | { key: string; status: 'idle' | 'loading' | 'unavailable' }\n | { key: string; status: 'shown'; result: AiTextResult };\n\n/**\n * \"Explain my answer\", without the SDK's own button and panel: the rules, the\n * call, the checks and the record, for a question you draw yourself.\n *\n * It is what `<MultipleChoice>` and the others use, so a host's own question\n * offers help on exactly the same terms: never in `exam`, never where the\n * item's author switched explanations off, and never an explanation whose\n * verdict contradicts the grade the SDK computed.\n *\n * ```tsx\n * const { offered, status, explanation, ask } = useAiExplanation({\n * data, response, submitted, renderMode, outcome, ai: question.ai,\n * });\n * if (!offered) return null;\n * return explanation === null ? (\n * <button type=\"button\" onClick={ask} aria-busy={status === 'loading'}>Explain my answer</button>\n * ) : (\n * <section>\n * <p>{explanation.text}</p>\n * <p>Written by AI. It can make mistakes.</p>\n * </section>\n * );\n * ```\n *\n * **Say who wrote it.** The SDK's own panel carries \"Written by AI. It can make\n * mistakes.\"; a page that drops that line passes a model's words off as the\n * course's.\n *\n * When the answer or its grade changes, the explanation is dropped and a call\n * still on its way is abandoned — a late explanation never lands beside an\n * answer it was not written for — as it is when the caller unmounts.\n */\nexport function useAiExplanation(input: AiExplanationInput): AiExplanationHelp {\n const { data, response, submitted, outcome } = input;\n const around = useContext(SequenceSlotContext);\n const renderMode = modeInForce(input.renderMode, around?.renderMode);\n const delivery = combineDeliveryPolicies(input.delivery, around?.delivery);\n const ai = useLearnerAi(input.ai);\n const resetKey = explanationKey(renderMode, submitted, response, outcome);\n const [state, setState] = useState<ExplanationState>({ key: resetKey, status: 'idle' });\n const run = useRef(0);\n const controller = useRef<AbortController | null>(null);\n const current: ExplanationState =\n state.key === resetKey ? state : { key: resetKey, status: 'idle' };\n const offered =\n ai?.explain !== undefined &&\n explanationOffered({ data, renderMode, submitted, outcome, delivery });\n\n // What `ask` reads, as of this render, so `ask` itself can keep one identity\n // for the life of the question. The state goes in too: an event handler runs\n // after the render that set it, so the ref is what the learner last saw.\n const latest = useRef({ input, renderMode, ai, resetKey, offered, current });\n latest.current = { input, renderMode, ai, resetKey, offered, current };\n\n // Another answer, or the caller going away: abandon the call in flight.\n // biome-ignore lint/correctness/useExhaustiveDependencies: the key is the trigger — its cleanup runs when the answer changes\n useEffect(() => {\n return () => {\n run.current += 1;\n controller.current?.abort();\n controller.current = null;\n };\n }, [resetKey]);\n\n const ask = useCallback((): void => {\n const now = latest.current;\n const port = now.ai?.explain;\n if (port === undefined || !now.offered || now.current.status === 'loading') {\n return;\n }\n const key = now.resetKey;\n const request = aiExplanationRequest({\n data: now.input.data,\n response: now.input.response,\n ...(now.renderMode === 'review' && now.input.outcome !== undefined\n ? { outcome: now.input.outcome }\n : {}),\n ...localeOf(now.ai, now.input.locale),\n });\n if (request === null) {\n setState({ key, status: 'unavailable' });\n return;\n }\n run.current += 1;\n const mine = run.current;\n controller.current?.abort();\n const abort = new AbortController();\n controller.current = abort;\n setState({ key, status: 'loading' });\n callPort(() => port(request, { signal: abort.signal })).then(\n (raw) => {\n if (run.current !== mine) {\n return;\n }\n const checked = checkAiExplanation(raw, request);\n if (!checked.ok) {\n warnRefused('explanation', now.input.data.id, checked.refusal);\n setState({ key, status: 'unavailable' });\n latest.current.input.onInteraction?.({\n type: 'ai-help-refused',\n activityId: now.input.data.id,\n timestamp: Date.now(),\n payload: { feature: 'explanation', reason: checked.refusal },\n });\n return;\n }\n setState({ key, status: 'shown', result: checked.result });\n latest.current.input.onInteraction?.({\n type: 'ai-explanation-shown',\n activityId: now.input.data.id,\n timestamp: Date.now(),\n payload: shownPayload(checked.result),\n });\n },\n () => {\n if (run.current === mine) {\n setState({ key, status: 'unavailable' });\n }\n },\n );\n }, []);\n\n return {\n offered,\n status: current.status,\n explanation: current.status === 'shown' ? current.result : null,\n ask,\n };\n}\n\ninterface HintState {\n key: string;\n hints: AiTextResult[];\n status: 'idle' | 'loading' | 'unavailable';\n}\n\n/**\n * \"Get a hint\", without the SDK's own button and list: the rules, the call, the\n * checks and the record, for a question you draw yourself.\n *\n * It is what `<MultipleChoice>` and the others use, so a host's own question\n * gives hints on exactly the same terms: only in `practice` before submit, up\n * to the host's limit, never on a redacted item or a type the SDK does not hint\n * for, and never a hint that gives the answer away — which is refused rather\n * than shown, and not counted.\n *\n * ```tsx\n * const { offered, status, hints, used, limit, ask } = useAiHints({\n * data, response, submitted, renderMode, ai: question.ai,\n * });\n * ```\n *\n * **Say who wrote them**, as the SDK's own list does: \"Written by AI. It can\n * make mistakes.\"\n *\n * Keep the hints on screen after submit — the learner can see what they were\n * given — while `offered` turns false. Another question starts with none.\n */\nexport function useAiHints(input: AiHintsInput): AiHintsHelp {\n const { data, submitted } = input;\n const around = useContext(SequenceSlotContext);\n const renderMode = modeInForce(input.renderMode, around?.renderMode);\n const delivery = combineDeliveryPolicies(input.delivery, around?.delivery);\n const disabled = input.disabled === true;\n const ai = useLearnerAi(input.ai);\n const resetKey = data.id;\n const [state, setState] = useState<HintState>({ key: resetKey, hints: [], status: 'idle' });\n const run = useRef(0);\n const controller = useRef<AbortController | null>(null);\n const current: HintState =\n state.key === resetKey ? state : { key: resetKey, hints: [], status: 'idle' };\n const offered =\n ai?.hint !== undefined && hintOffered({ data, renderMode, submitted, disabled, delivery });\n const limit = hintLimit(ai);\n\n const latest = useRef({ input, renderMode, ai, offered, limit, current });\n latest.current = { input, renderMode, ai, offered, limit, current };\n\n // Another question, or the caller going away: abandon the call in flight.\n // biome-ignore lint/correctness/useExhaustiveDependencies: the key is the trigger — its cleanup runs when the question changes\n useEffect(() => {\n return () => {\n run.current += 1;\n controller.current?.abort();\n controller.current = null;\n };\n }, [resetKey]);\n\n // Submitted, or disabled, while a hint was on its way: it would arrive for an\n // answer that can no longer use it.\n useEffect(() => {\n if (!offered) {\n run.current += 1;\n controller.current?.abort();\n controller.current = null;\n setState((previous) =>\n previous.status === 'loading' ? { ...previous, status: 'idle' } : previous,\n );\n }\n }, [offered]);\n\n const ask = useCallback((): void => {\n const now = latest.current;\n const port = now.ai?.hint;\n const held = now.current;\n if (\n port === undefined ||\n !now.offered ||\n held.status === 'loading' ||\n held.hints.length >= now.limit\n ) {\n return;\n }\n const key = held.key;\n const request = aiHintRequest({\n data: now.input.data,\n response: now.input.response,\n previousHints: held.hints.map((hint) => hint.text),\n ...localeOf(now.ai, now.input.locale),\n });\n if (request === null) {\n setState({ ...held, status: 'unavailable' });\n return;\n }\n run.current += 1;\n const mine = run.current;\n controller.current?.abort();\n const abort = new AbortController();\n controller.current = abort;\n setState({ ...held, status: 'loading' });\n callPort(() => port(request, { signal: abort.signal })).then(\n (raw) => {\n if (run.current !== mine) {\n return;\n }\n const checked = checkAiHint(raw, request);\n if (!checked.ok) {\n warnRefused('hint', now.input.data.id, checked.refusal);\n setState((shown) => ({ ...shown, status: 'unavailable' }));\n latest.current.input.onInteraction?.({\n type: 'ai-help-refused',\n activityId: now.input.data.id,\n timestamp: Date.now(),\n payload: {\n feature: 'hint',\n reason: checked.refusal,\n hintNumber: request.hintNumber,\n },\n });\n return;\n }\n setState((shown) => ({\n ...shown,\n hints: shown.key === key ? [...shown.hints, checked.result] : shown.hints,\n status: 'idle',\n }));\n latest.current.input.onInteraction?.({\n type: 'ai-hint-shown',\n activityId: now.input.data.id,\n timestamp: Date.now(),\n payload: { hintNumber: request.hintNumber, ...shownPayload(checked.result) },\n });\n },\n () => {\n if (run.current === mine) {\n setState((shown) => ({ ...shown, status: 'unavailable' }));\n }\n },\n );\n }, []);\n\n return {\n offered,\n status: current.status,\n hints: current.hints,\n limit,\n used: current.hints.length,\n ask,\n };\n}\n\nexport interface AiWritingFeedbackInput extends AiHelpSituation {\n /** A disabled question takes no feedback, as it takes no answer. */\n disabled?: boolean;\n}\n\nexport interface AiWritingFeedbackHelp {\n /**\n * Whether the learner may ask for feedback here at all: a port is present,\n * the mode is `practice`, the answer is not in, the question is a written\n * response that is not disabled or redacted, its author left explanations on,\n * and the paper shows feedback and solutions and allows AI explanations. It\n * stays true once `used` reaches `limit`.\n */\n offered: boolean;\n status: 'idle' | 'loading' | 'unavailable';\n /** Every piece of feedback shown for this question, oldest first. */\n feedback: readonly AiWritingFeedback[];\n /** The latest, or `null` before any. Its `text` is text, never HTML. */\n latest: AiWritingFeedback | null;\n /**\n * Whether `latest` is about the draft as it stands. Once the learner revises,\n * its corrections point at words that may no longer be there: say so.\n */\n current: boolean;\n /** The host's `maxWritingFeedback`, as a whole number from 1 to 10 (3 by default). */\n limit: number;\n /** How many times feedback has been shown. A refused reply is not counted. */\n used: number;\n /**\n * Asks for feedback on the draft as it stands. Does nothing at the limit,\n * while a call is on its way, on an empty draft, or where `offered` is false.\n * One identity for the life of the question.\n */\n ask: () => void;\n}\n\ninterface WritingFeedbackState {\n key: string;\n shown: { feedback: AiWritingFeedback; about: string }[];\n status: 'idle' | 'loading' | 'unavailable';\n}\n\n/** The text of a written response; another type's response is no draft at all. */\nconst draftOf = (response: LearnerResponse): string =>\n response.type === 'written-response' ? response.text : '';\n\n/**\n * \"Get feedback on my draft\", without the SDK's own button and panel: the\n * rules, the call, the checks and the record, for a written response you draw\n * yourself.\n *\n * It is what `<WrittenResponse>` uses, so a host's own essay box gets feedback\n * on the same terms: only in `practice` before submit, up to the host's limit,\n * and never feedback that corrects words the learner did not write — which is\n * refused rather than shown, and not counted.\n *\n * ```tsx\n * const { offered, status, latest, current, used, limit, ask } = useAiWritingFeedback({\n * data, response, submitted, renderMode, ai: question.ai,\n * });\n * ```\n *\n * **Say who wrote it**, as the SDK's own panel does: \"Written by AI. It can make\n * mistakes.\" And show `indicativeScore` as what it is — an indication, not a\n * grade.\n */\nexport function useAiWritingFeedback(input: AiWritingFeedbackInput): AiWritingFeedbackHelp {\n const { data, submitted, response } = input;\n const around = useContext(SequenceSlotContext);\n const renderMode = modeInForce(input.renderMode, around?.renderMode);\n const delivery = combineDeliveryPolicies(input.delivery, around?.delivery);\n const disabled = input.disabled === true;\n const ai = useLearnerAi(input.ai);\n const resetKey = data.id;\n const [state, setState] = useState<WritingFeedbackState>({\n key: resetKey,\n shown: [],\n status: 'idle',\n });\n const run = useRef(0);\n const controller = useRef<AbortController | null>(null);\n const current: WritingFeedbackState =\n state.key === resetKey ? state : { key: resetKey, shown: [], status: 'idle' };\n const offered =\n ai?.writingFeedback !== undefined &&\n writingFeedbackOffered({ data, renderMode, submitted, disabled, delivery });\n const limit = writingFeedbackLimit(ai);\n\n const latest = useRef({ input, ai, offered, limit, current });\n latest.current = { input, ai, offered, limit, current };\n\n // Another question, or the caller going away: abandon the call in flight.\n // biome-ignore lint/correctness/useExhaustiveDependencies: the key is the trigger — its cleanup runs when the question changes\n useEffect(() => {\n return () => {\n run.current += 1;\n controller.current?.abort();\n controller.current = null;\n };\n }, [resetKey]);\n\n // Submitted, or disabled, while feedback was on its way: it would arrive for\n // a draft that can no longer be revised.\n useEffect(() => {\n if (!offered) {\n run.current += 1;\n controller.current?.abort();\n controller.current = null;\n setState((previous) =>\n previous.status === 'loading' ? { ...previous, status: 'idle' } : previous,\n );\n }\n }, [offered]);\n\n const ask = useCallback((): void => {\n const now = latest.current;\n const port = now.ai?.writingFeedback;\n const held = now.current;\n if (\n port === undefined ||\n !now.offered ||\n held.status === 'loading' ||\n held.shown.length >= now.limit\n ) {\n return;\n }\n const key = held.key;\n const about = draftOf(now.input.response);\n const request = aiWritingFeedbackRequest({\n data: now.input.data,\n response: now.input.response,\n previousFeedback: held.shown.map((one) => one.feedback.text),\n ...localeOf(now.ai, now.input.locale),\n });\n if (request === null) {\n // An empty draft: nothing to give feedback on, and nothing went wrong.\n return;\n }\n run.current += 1;\n const mine = run.current;\n controller.current?.abort();\n const abort = new AbortController();\n controller.current = abort;\n setState({ ...held, status: 'loading' });\n callPort(() => port(request, { signal: abort.signal })).then(\n (raw) => {\n if (run.current !== mine) {\n return;\n }\n const checked = checkAiWritingFeedback(raw, request);\n if (!checked.ok) {\n warnRefused('writing feedback', now.input.data.id, checked.refusal);\n setState((was) => ({ ...was, status: 'unavailable' }));\n latest.current.input.onInteraction?.({\n type: 'ai-help-refused',\n activityId: now.input.data.id,\n timestamp: Date.now(),\n payload: {\n feature: 'writing-feedback',\n reason: checked.refusal,\n draftNumber: request.draftNumber,\n },\n });\n return;\n }\n const { feedback } = checked;\n setState((was) => ({\n ...was,\n shown: was.key === key ? [...was.shown, { feedback, about }] : was.shown,\n status: 'idle',\n }));\n latest.current.input.onInteraction?.({\n type: 'ai-writing-feedback-shown',\n activityId: now.input.data.id,\n timestamp: Date.now(),\n payload: {\n draftNumber: request.draftNumber,\n corrections: feedback.corrections.length,\n ...(feedback.indicativeScore !== null\n ? { indicativeScore: feedback.indicativeScore }\n : {}),\n ...shownPayload(feedback),\n },\n });\n },\n () => {\n if (run.current === mine) {\n setState((was) => ({ ...was, status: 'unavailable' }));\n }\n },\n );\n }, []);\n\n const last = current.shown[current.shown.length - 1];\n return {\n offered,\n status: current.status,\n feedback: current.shown.map((one) => one.feedback),\n latest: last?.feedback ?? null,\n current: last !== undefined && last.about === draftOf(response),\n limit,\n used: current.shown.length,\n ask,\n };\n}\n"]}
@@ -1,10 +1,12 @@
1
1
  'use client';
2
- import { useDeliveryPolicy, FeedbackRegion, outcomeShowsMarks } from './chunk-PJMXHDY5.js';
3
- import { ActivityErrorBoundary } from './chunk-U6SEII5V.js';
4
- import { isDevelopment, ANONYMOUS_ACTOR, objectIdFor } from './chunk-PPFVTXGJ.js';
5
- import { ActivityMedia } from './chunk-X4YWXZ4J.js';
2
+ import { useAiWritingFeedback } from './chunk-CXIP7ERK.js';
3
+ import { useLearnerAi } from './chunk-RX3A6KIY.js';
4
+ import { useDeliveryPolicy, FeedbackRegion, outcomeShowsMarks } from './chunk-XYJBRKBZ.js';
5
+ import { ActivityErrorBoundary } from './chunk-E4UF4XZM.js';
6
+ import { isDevelopment, ANONYMOUS_ACTOR, objectIdFor } from './chunk-DXFCYNST.js';
7
+ import { ActivityMedia } from './chunk-HYOUMTPW.js';
6
8
  import { useActivityState } from './chunk-6N43WDVG.js';
7
- import { useLkStrings } from './chunk-EYLBSS4Y.js';
9
+ import { useLkStrings } from './chunk-C4PSJ3ZC.js';
8
10
  import { validateActivity, ActivitySchemaError, countWords, evaluate, xAPIBuilder } from '@intellectif/lk-core';
9
11
  import { useMemo, useState, useRef, useEffect } from 'react';
10
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -25,31 +27,107 @@ function keyedCorrections(corrections) {
25
27
  return { key, correction };
26
28
  });
27
29
  }
30
+ function CriteriaList({ criteria, s }) {
31
+ return /* @__PURE__ */ jsx("ul", { className: "lk-wr-criteria", children: criteria.map((criterion) => /* @__PURE__ */ jsxs(
32
+ "li",
33
+ {
34
+ className: "lk-wr-criterion",
35
+ "data-na": String(criterion.notApplicable === true),
36
+ children: [
37
+ /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-name", children: criterion.name }),
38
+ criterion.notApplicable === true ? /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-score", children: s.notApplicable }) : /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-score", children: criterion.band ?? (typeof criterion.score === "number" ? criterionPercent(criterion) : "") }),
39
+ criterion.comment ? /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-comment", children: criterion.comment }) : null
40
+ ]
41
+ },
42
+ criterion.name
43
+ )) });
44
+ }
45
+ function CorrectionsList({
46
+ corrections,
47
+ label
48
+ }) {
49
+ return /* @__PURE__ */ jsx("ul", { className: "lk-wr-corrections", ...label !== void 0 ? { "aria-label": label } : {}, children: keyedCorrections(corrections).map(({ key, correction }) => /* @__PURE__ */ jsxs("li", { className: "lk-wr-correction", children: [
50
+ /* @__PURE__ */ jsx("del", { className: "lk-wr-correction-original", children: correction.original }),
51
+ " ",
52
+ /* @__PURE__ */ jsx("ins", { className: "lk-wr-correction-corrected", children: correction.corrected }),
53
+ correction.explanation ? /* @__PURE__ */ jsx("span", { className: "lk-wr-correction-explanation", children: correction.explanation }) : null
54
+ ] }, key)) });
55
+ }
28
56
  function GradeBody({ grade, s }) {
29
57
  return /* @__PURE__ */ jsxs(Fragment, { children: [
30
58
  grade.feedback ? /* @__PURE__ */ jsx("p", { className: "lk-wr-grade-feedback", children: grade.feedback }) : null,
31
- grade.criteria && grade.criteria.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "lk-wr-criteria", children: grade.criteria.map((criterion) => /* @__PURE__ */ jsxs(
32
- "li",
33
- {
34
- className: "lk-wr-criterion",
35
- "data-na": String(criterion.notApplicable === true),
36
- children: [
37
- /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-name", children: criterion.name }),
38
- criterion.notApplicable === true ? /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-score", children: s.notApplicable }) : /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-score", children: criterion.band ?? (typeof criterion.score === "number" ? criterionPercent(criterion) : "") }),
39
- criterion.comment ? /* @__PURE__ */ jsx("span", { className: "lk-wr-criterion-comment", children: criterion.comment }) : null
40
- ]
41
- },
42
- criterion.name
43
- )) }) : null,
44
- grade.corrections && grade.corrections.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "lk-wr-corrections", children: keyedCorrections(grade.corrections).map(({ key, correction }) => /* @__PURE__ */ jsxs("li", { className: "lk-wr-correction", children: [
45
- /* @__PURE__ */ jsx("del", { className: "lk-wr-correction-original", children: correction.original }),
46
- " ",
47
- /* @__PURE__ */ jsx("ins", { className: "lk-wr-correction-corrected", children: correction.corrected }),
48
- correction.explanation ? /* @__PURE__ */ jsx("span", { className: "lk-wr-correction-explanation", children: correction.explanation }) : null
49
- ] }, key)) }) : null,
59
+ grade.criteria && grade.criteria.length > 0 ? /* @__PURE__ */ jsx(CriteriaList, { criteria: grade.criteria, s }) : null,
60
+ grade.corrections && grade.corrections.length > 0 ? /* @__PURE__ */ jsx(CorrectionsList, { corrections: grade.corrections }) : null,
50
61
  grade.requiresHumanReview === true ? /* @__PURE__ */ jsx("p", { className: "lk-wr-review-flag", children: s.awaitingHumanReview }) : null
51
62
  ] });
52
63
  }
64
+ function DraftFeedback({
65
+ help,
66
+ draft,
67
+ disabled,
68
+ s
69
+ }) {
70
+ const buttonRef = useRef(null);
71
+ const panelRef = useRef(null);
72
+ const refocus = useRef(false);
73
+ const latest = help.latest;
74
+ useEffect(() => {
75
+ if (latest !== null && refocus.current) {
76
+ refocus.current = false;
77
+ panelRef.current?.focus();
78
+ }
79
+ }, [latest]);
80
+ useEffect(() => {
81
+ if (help.status === "unavailable") {
82
+ refocus.current = false;
83
+ }
84
+ }, [help.status]);
85
+ if (!help.offered && help.used === 0) {
86
+ return null;
87
+ }
88
+ const loading = help.status === "loading";
89
+ const empty = draft.trim() === "";
90
+ const ask = () => {
91
+ refocus.current = typeof document !== "undefined" && document.activeElement === buttonRef.current;
92
+ help.ask();
93
+ };
94
+ return /* @__PURE__ */ jsxs("div", { className: "lk-ai lk-wr-ai", "data-state": help.status, children: [
95
+ /* @__PURE__ */ jsxs("div", { "aria-live": "polite", children: [
96
+ latest !== null ? /* @__PURE__ */ jsxs(
97
+ "section",
98
+ {
99
+ ref: panelRef,
100
+ className: "lk-ai-panel",
101
+ tabIndex: -1,
102
+ "aria-label": s.aiWritingFeedbackHeading,
103
+ "data-current": String(help.current),
104
+ children: [
105
+ /* @__PURE__ */ jsx("p", { className: "lk-ai-heading", children: s.aiWritingFeedbackHeading }),
106
+ help.current ? null : /* @__PURE__ */ jsx("p", { className: "lk-ai-note", children: s.aiWritingFeedbackOutdated }),
107
+ /* @__PURE__ */ jsx("p", { className: "lk-ai-text", children: latest.text }),
108
+ latest.corrections.length > 0 ? /* @__PURE__ */ jsx(CorrectionsList, { corrections: latest.corrections, label: s.aiCorrections }) : null,
109
+ latest.criteria.length > 0 ? /* @__PURE__ */ jsx(CriteriaList, { criteria: latest.criteria, s }) : null,
110
+ latest.indicativeScore !== null ? /* @__PURE__ */ jsx("p", { className: "lk-wr-indicative", children: s.aiIndicativeScore(Math.round(latest.indicativeScore * 100)) }) : null,
111
+ /* @__PURE__ */ jsx("p", { className: "lk-ai-notice", children: s.aiNotice })
112
+ ]
113
+ }
114
+ ) : null,
115
+ help.status === "unavailable" ? /* @__PURE__ */ jsx("p", { className: "lk-ai-unavailable", children: s.aiWritingFeedbackUnavailable }) : null
116
+ ] }),
117
+ help.offered ? help.used < help.limit ? /* @__PURE__ */ jsx(
118
+ "button",
119
+ {
120
+ ref: buttonRef,
121
+ type: "button",
122
+ className: "lk-ai-button",
123
+ "aria-busy": loading || void 0,
124
+ "aria-disabled": loading || empty || disabled || void 0,
125
+ onClick: ask,
126
+ children: loading ? s.aiWritingFeedbackLoading : s.aiWritingFeedback
127
+ }
128
+ ) : /* @__PURE__ */ jsx("p", { className: "lk-ai-note", children: s.aiNoMoreWritingFeedback }) : null
129
+ ] });
130
+ }
53
131
  function OutcomeSummary({ outcome, s }) {
54
132
  if (outcome.status === "scored" || outcome.status === "graded") {
55
133
  const percent = outcome.maxScore > 0 ? Math.round(outcome.score / outcome.maxScore * 100) : Math.round(outcome.score * 100);
@@ -89,10 +167,12 @@ function WrittenResponse({
89
167
  theme,
90
168
  locale,
91
169
  disabled,
92
- delivery
170
+ delivery,
171
+ ai: aiProp
93
172
  }) {
94
173
  const s = useLkStrings(strings);
95
174
  const policy = useDeliveryPolicy(delivery);
175
+ const ai = useLearnerAi(aiProp);
96
176
  const devError = useMemo(() => {
97
177
  if (!isDevelopment()) {
98
178
  return null;
@@ -130,6 +210,18 @@ function WrittenResponse({
130
210
  setSummary(null);
131
211
  reset(defaultSubmittedRef.current === true ? "completed" : "idle");
132
212
  }, [data, reset]);
213
+ const draft = isControlled ? textOf(value) : innerText;
214
+ const writingFeedback = useAiWritingFeedback({
215
+ data,
216
+ response: { type: "written-response", text: draft, wordCount: countWords(draft) },
217
+ submitted: state === "completed",
218
+ renderMode,
219
+ delivery: policy,
220
+ disabled: disabled === true,
221
+ ...ai !== void 0 ? { ai } : {},
222
+ ...locale !== void 0 ? { locale } : {},
223
+ ...onInteraction !== void 0 ? { onInteraction } : {}
224
+ });
133
225
  if (devError) {
134
226
  throw devError;
135
227
  }
@@ -278,6 +370,7 @@ function WrittenResponse({
278
370
  ]
279
371
  }
280
372
  ),
373
+ ai?.writingFeedback !== void 0 ? /* @__PURE__ */ jsx(DraftFeedback, { help: writingFeedback, draft: text, disabled: disabled === true, s }) : null,
281
374
  isReview ? null : /* @__PURE__ */ jsx(
282
375
  "button",
283
376
  {
@@ -298,5 +391,5 @@ function WrittenResponse2(props) {
298
391
  }
299
392
 
300
393
  export { WrittenResponse2 as WrittenResponse };
301
- //# sourceMappingURL=chunk-ZDDBWUUA.js.map
302
- //# sourceMappingURL=chunk-ZDDBWUUA.js.map
394
+ //# sourceMappingURL=chunk-DPNCCWOV.js.map
395
+ //# sourceMappingURL=chunk-DPNCCWOV.js.map