@intellectif/lk-core 1.2.0 → 1.3.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 (103) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +2 -2
  3. package/dist/ai-B222dtHH.d.cts +2154 -0
  4. package/dist/ai-B222dtHH.d.cts.map +1 -0
  5. package/dist/ai-B222dtHH.d.ts +2154 -0
  6. package/dist/ai-B222dtHH.d.ts.map +1 -0
  7. package/dist/ai-check.cjs +749 -617
  8. package/dist/ai-check.cjs.map +1 -1
  9. package/dist/ai-check.d.cts +82 -80
  10. package/dist/ai-check.d.cts.map +1 -0
  11. package/dist/ai-check.d.ts +82 -80
  12. package/dist/ai-check.d.ts.map +1 -0
  13. package/dist/ai-check.js +747 -618
  14. package/dist/ai-check.js.map +1 -1
  15. package/dist/ai-writing-CCBjTOM3.js +2496 -0
  16. package/dist/ai-writing-CCBjTOM3.js.map +1 -0
  17. package/dist/ai-writing-DCVkv4Zj.cjs +2735 -0
  18. package/dist/ai-writing-DCVkv4Zj.cjs.map +1 -0
  19. package/dist/{index-BChYtrEe.d.ts → index-BWPRPIXL.d.ts} +263 -258
  20. package/dist/index-BWPRPIXL.d.ts.map +1 -0
  21. package/dist/index-CXyOV8sm.d.cts +153 -0
  22. package/dist/index-CXyOV8sm.d.cts.map +1 -0
  23. package/dist/index-CegM8o15.d.ts +153 -0
  24. package/dist/index-CegM8o15.d.ts.map +1 -0
  25. package/dist/index-Dyu66R4-.d.cts +1071 -0
  26. package/dist/index-Dyu66R4-.d.cts.map +1 -0
  27. package/dist/{index-VXt_v3YI.d.cts → index-O4_ExlAD.d.cts} +263 -258
  28. package/dist/index-O4_ExlAD.d.cts.map +1 -0
  29. package/dist/index-UGxRSopE.d.ts +1071 -0
  30. package/dist/index-UGxRSopE.d.ts.map +1 -0
  31. package/dist/index.cjs +1210 -1146
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +909 -857
  34. package/dist/index.d.cts.map +1 -0
  35. package/dist/index.d.ts +909 -857
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +1063 -1147
  38. package/dist/index.js.map +1 -1
  39. package/dist/item-group-DXiR8nOr.js +445 -0
  40. package/dist/item-group-DXiR8nOr.js.map +1 -0
  41. package/dist/item-group-DroFXgLb.cjs +505 -0
  42. package/dist/item-group-DroFXgLb.cjs.map +1 -0
  43. package/dist/registry-DVi0LR_i.cjs +5915 -0
  44. package/dist/registry-DVi0LR_i.cjs.map +1 -0
  45. package/dist/registry-Dsx9mNsS.js +5449 -0
  46. package/dist/registry-Dsx9mNsS.js.map +1 -0
  47. package/dist/schemas-Bdw0nGPo.js +152 -0
  48. package/dist/schemas-Bdw0nGPo.js.map +1 -0
  49. package/dist/schemas-DVbAOrtd.cjs +224 -0
  50. package/dist/schemas-DVbAOrtd.cjs.map +1 -0
  51. package/dist/schemas.cjs +16 -34
  52. package/dist/schemas.d.cts +2 -2
  53. package/dist/schemas.d.ts +2 -2
  54. package/dist/schemas.js +3 -34
  55. package/dist/scoring-B2_HEhMT.cjs +1748 -0
  56. package/dist/scoring-B2_HEhMT.cjs.map +1 -0
  57. package/dist/scoring-BZqUkuDF.js +1604 -0
  58. package/dist/scoring-BZqUkuDF.js.map +1 -0
  59. package/dist/scoring.cjs +37 -75
  60. package/dist/scoring.d.cts +3 -1103
  61. package/dist/scoring.d.ts +3 -1103
  62. package/dist/scoring.js +3 -75
  63. package/dist/xapi-CMTph7wG.js +332 -0
  64. package/dist/xapi-CMTph7wG.js.map +1 -0
  65. package/dist/xapi-DNzkSJ0S.cjs +362 -0
  66. package/dist/xapi-DNzkSJ0S.cjs.map +1 -0
  67. package/dist/xapi.cjs +7 -16
  68. package/dist/xapi.d.cts +2 -150
  69. package/dist/xapi.d.ts +2 -150
  70. package/dist/xapi.js +2 -16
  71. package/package.json +4 -4
  72. package/dist/activity-D705CXng.d.cts +0 -2162
  73. package/dist/activity-D705CXng.d.ts +0 -2162
  74. package/dist/chunk-46BXIGLG.cjs +0 -272
  75. package/dist/chunk-46BXIGLG.cjs.map +0 -1
  76. package/dist/chunk-4YANYTFN.cjs +0 -1256
  77. package/dist/chunk-4YANYTFN.cjs.map +0 -1
  78. package/dist/chunk-7KOWU4RO.js +0 -2207
  79. package/dist/chunk-7KOWU4RO.js.map +0 -1
  80. package/dist/chunk-7THXD7AN.cjs +0 -5057
  81. package/dist/chunk-7THXD7AN.cjs.map +0 -1
  82. package/dist/chunk-CYCTIXUN.cjs +0 -118
  83. package/dist/chunk-CYCTIXUN.cjs.map +0 -1
  84. package/dist/chunk-CYPA5BW5.js +0 -118
  85. package/dist/chunk-CYPA5BW5.js.map +0 -1
  86. package/dist/chunk-JTNDIBZO.js +0 -272
  87. package/dist/chunk-JTNDIBZO.js.map +0 -1
  88. package/dist/chunk-MV2N2WNS.js +0 -352
  89. package/dist/chunk-MV2N2WNS.js.map +0 -1
  90. package/dist/chunk-MXI26H62.cjs +0 -2207
  91. package/dist/chunk-MXI26H62.cjs.map +0 -1
  92. package/dist/chunk-QS7B42ZR.js +0 -5057
  93. package/dist/chunk-QS7B42ZR.js.map +0 -1
  94. package/dist/chunk-QX2ERL72.js +0 -1256
  95. package/dist/chunk-QX2ERL72.js.map +0 -1
  96. package/dist/chunk-ZWXQSKCX.cjs +0 -352
  97. package/dist/chunk-ZWXQSKCX.cjs.map +0 -1
  98. package/dist/schemas.cjs.map +0 -1
  99. package/dist/schemas.js.map +0 -1
  100. package/dist/scoring.cjs.map +0 -1
  101. package/dist/scoring.js.map +0 -1
  102. package/dist/xapi.cjs.map +0 -1
  103. package/dist/xapi.js.map +0 -1
@@ -0,0 +1,445 @@
1
+ import { G as groupCaptionsField, W as GROUP_CAPTIONS_REVEAL_DICTATION, _t as MediaSchema, a as readSchema, t as getActivityTypeDescriptor, vt as RedactedMediaSchema, yt as maxUnits } from "./registry-Dsx9mNsS.js";
2
+ import * as z from "zod/v4";
3
+ //#region src/timeline-limits.ts
4
+ /**
5
+ * The bounds of an interactive video — an item group with a `timeline`.
6
+ *
7
+ * A leaf module on purpose: the schemas, the authoring checks and the timeline
8
+ * helpers all read these, and nothing here may import any of them back.
9
+ */
10
+ /**
11
+ * The item types an interactive video may present. CLOSED on purpose: a type
12
+ * added to the SDK later, or a custom type a host registers, is not silently
13
+ * embeddable. Each one here was chosen, and each works inside a paused video —
14
+ * a read-aloud's microphone included, because every quiz pauses the video
15
+ * first.
16
+ */
17
+ const INTERACTIVE_VIDEO_ITEM_TYPES = [
18
+ "multiple-choice",
19
+ "fill-in-the-blanks",
20
+ "gap-select",
21
+ "dictation",
22
+ "read-aloud"
23
+ ];
24
+ /** Whether `type` is one of the item types an interactive video may present. */
25
+ function isInteractiveVideoItemType(type) {
26
+ return INTERACTIVE_VIDEO_ITEM_TYPES.includes(type);
27
+ }
28
+ /** The most quizzes one video may hold. */
29
+ const TIMELINE_MAX_QUIZZES = 100;
30
+ /**
31
+ * The most questions one interactive video may hold, across all its quizzes.
32
+ * The player keeps every one of them mounted, so an answer survives the
33
+ * learner rewinding past its quiz.
34
+ */
35
+ const TIMELINE_MAX_ITEMS = 200;
36
+ /** The most chapters one video may hold. */
37
+ const TIMELINE_MAX_CHAPTERS = 100;
38
+ /** The longest quiz or chapter title, in UTF-16 units. A title sits on one line of the player. */
39
+ const TIMELINE_MAX_TITLE_LENGTH = 120;
40
+ //#endregion
41
+ //#region src/schemas/item-group.ts
42
+ /**
43
+ * An authored slot key.
44
+ *
45
+ * A `.` is rejected here, not at render time: `flattenSequence` uses the first
46
+ * `.` to separate a group from its item, so a key containing one would produce
47
+ * an ambiguous slot id. `keyOf` already threw on it — this moves the rejection
48
+ * to `validateItemGroup`, where an author finds it, instead of leaving it to
49
+ * surface when a learner opens the paper. Content that would newly fail
50
+ * validation already threw at flatten time, so it can never have been sat.
51
+ */
52
+ const SlotKeySchema = z.string().min(1).refine((key) => !key.includes("."), { error: "slotKey must not contain \".\" — that character separates a group from its item in a slot id, so a key containing one would make the slot ambiguous." });
53
+ function hasBody(stimulus) {
54
+ return typeof stimulus.body === "string" && stimulus.body.trim().length > 0;
55
+ }
56
+ /** Which media types can carry a stimulus of each kind. `text`/`mixed` accept any. */
57
+ function mediaFits(kind, mediaType) {
58
+ switch (kind) {
59
+ case "audio": return mediaType === "audio";
60
+ case "video": return mediaType === "video" || mediaType === "embed";
61
+ case "image": return mediaType === "image";
62
+ default: return true;
63
+ }
64
+ }
65
+ /**
66
+ * Zod schema for a {@link Stimulus}. Loose: unknown keys preserved.
67
+ *
68
+ * The semantic guards exist because a stimulus that does not carry what its
69
+ * `kind` promises is an authoring error that must not reach an exam: an
70
+ * "audio" stimulus with no recording renders as a blank panel above six
71
+ * listening questions. Unrepresentable in JSON Schema; dropped from
72
+ * `stimulusJsonSchema` by design.
73
+ */
74
+ const StimulusSchema = z.looseObject({
75
+ id: z.string().min(1),
76
+ kind: z.enum([
77
+ "text",
78
+ "audio",
79
+ "video",
80
+ "image",
81
+ "mixed"
82
+ ]),
83
+ title: z.string().optional(),
84
+ body: z.string().optional(),
85
+ bodyHtml: z.string().optional(),
86
+ media: MediaSchema.optional(),
87
+ transcript: z.string().optional(),
88
+ locale: z.string().optional(),
89
+ attribution: z.string().optional()
90
+ }).refine((stimulus) => stimulus.bodyHtml === void 0 || hasBody(stimulus), {
91
+ error: "bodyHtml requires a plain-text body: it is the accessible fallback rendered when no sanitiser is supplied.",
92
+ path: ["body"]
93
+ }).refine((stimulus) => stimulus.kind !== "text" && stimulus.kind !== "mixed" || hasBody(stimulus), {
94
+ error: "A text or mixed stimulus needs a non-empty body.",
95
+ path: ["body"]
96
+ }).refine((stimulus) => stimulus.kind === "text" || stimulus.media !== void 0, {
97
+ error: "An audio, video, image or mixed stimulus needs media.",
98
+ path: ["media"]
99
+ }).refine((stimulus) => stimulus.media === void 0 || mediaFits(stimulus.kind, stimulus.media.type), {
100
+ error: "media.type does not fit the stimulus kind: audio needs audio; video needs video or embed; image needs image.",
101
+ path: ["media", "type"]
102
+ });
103
+ const TimelineTitleSchema = maxUnits(z.string(), 120).refine((title) => title.trim().length > 0, { error: "A title must not be empty." });
104
+ /** Seconds from the start of the video. zod rejects NaN and ±Infinity itself. */
105
+ const TimelineTimeSchema = z.number().min(0, { error: "A time is 0 seconds or more." });
106
+ /**
107
+ * A quiz. STRICT, like every part of a timeline: a misspelt `requried` would
108
+ * otherwise be kept and the quiz silently optional on a paper that believed it
109
+ * was required.
110
+ */
111
+ const TimelineCueSchema = z.strictObject({
112
+ id: maxUnits(z.string().min(1), 64),
113
+ at: TimelineTimeSchema,
114
+ itemIds: z.array(z.string().min(1)).min(1).max(200),
115
+ title: TimelineTitleSchema.optional(),
116
+ required: z.boolean().optional()
117
+ });
118
+ const TimelineChapterSchema = z.strictObject({
119
+ at: TimelineTimeSchema,
120
+ title: TimelineTitleSchema
121
+ });
122
+ /**
123
+ * A timeline on its own: its quizzes, chapters and navigation. The rules that
124
+ * need the group — every item in exactly one quiz, a video stimulus, the five
125
+ * item types — are {@link timelineIssues}, which both group schemas run.
126
+ */
127
+ const MediaTimelineSchema = z.strictObject({
128
+ cues: z.array(TimelineCueSchema).max(100),
129
+ chapters: z.array(TimelineChapterSchema).max(100).optional(),
130
+ navigation: z.enum(["free", "no-skip-ahead"]).optional()
131
+ }).check((ctx) => {
132
+ const seen = /* @__PURE__ */ new Set();
133
+ ctx.value.cues.forEach((cue, index) => {
134
+ if (seen.has(cue.id)) ctx.issues.push({
135
+ code: "custom",
136
+ input: cue.id,
137
+ message: `Quiz id "${cue.id}" is used twice: events, drafts and the contents panel name a quiz by its id.`,
138
+ path: [
139
+ "cues",
140
+ index,
141
+ "id"
142
+ ]
143
+ });
144
+ seen.add(cue.id);
145
+ });
146
+ const chapters = ctx.value.chapters ?? [];
147
+ chapters.forEach((chapter, index) => {
148
+ const previous = chapters[index - 1];
149
+ if (previous !== void 0 && chapter.at <= previous.at) ctx.issues.push({
150
+ code: "custom",
151
+ input: chapter.at,
152
+ message: "Chapter times must be strictly increasing.",
153
+ path: [
154
+ "chapters",
155
+ index,
156
+ "at"
157
+ ]
158
+ });
159
+ });
160
+ });
161
+ /** A URL only this document can resolve, or one that inlines the bytes. */
162
+ function isLocalOnlyUrl(url) {
163
+ return typeof url === "string" && /^(data|blob):/i.test(url);
164
+ }
165
+ /**
166
+ * The rules of an interactive video that span the timeline, the stimulus and
167
+ * the items. Run by the content schema and, for everything but the two
168
+ * authoring-only rules, by the strict redacted schema — a projection built by
169
+ * hand never passed through the content schema.
170
+ *
171
+ * Items are read defensively: the redacted schema leaves them opaque, and each
172
+ * is proven against its own type's schema elsewhere.
173
+ */
174
+ function timelineIssues(group, scope) {
175
+ const timeline = group.timeline;
176
+ if (timeline === void 0) return [];
177
+ const issues = [];
178
+ const media = group.stimulus.media;
179
+ if (group.stimulus.kind !== "video") issues.push({
180
+ path: ["stimulus", "kind"],
181
+ input: group.stimulus.kind,
182
+ message: "An interactive video needs a video stimulus: quizzes open at moments of a video, and nothing else has them."
183
+ });
184
+ else if (media !== void 0 && media.type !== "video") issues.push({
185
+ path: [
186
+ "stimulus",
187
+ "media",
188
+ "type"
189
+ ],
190
+ input: media.type,
191
+ message: "An interactive video needs a video file. An embedded provider player cannot be paused at the moment a quiz opens."
192
+ });
193
+ if (group.shuffle === "within-group") issues.push({
194
+ path: ["shuffle"],
195
+ input: group.shuffle,
196
+ message: "An interactive video presents its questions in the order its quizzes open; shuffle: \"within-group\" cannot apply to it."
197
+ });
198
+ if (group.items.length > 200) issues.push({
199
+ path: ["items"],
200
+ input: group.items.length,
201
+ message: `An interactive video holds at most 200 questions.`
202
+ });
203
+ const itemIds = /* @__PURE__ */ new Map();
204
+ group.items.forEach((item, index) => {
205
+ const { id, type, media: itemMedia } = item ?? {};
206
+ if (typeof id === "string") itemIds.set(id, index);
207
+ if (!isInteractiveVideoItemType(type)) issues.push({
208
+ path: [
209
+ "items",
210
+ index,
211
+ "type"
212
+ ],
213
+ input: type,
214
+ message: `An interactive video may hold only ${INTERACTIVE_VIDEO_ITEM_TYPES.join(", ")} questions.`
215
+ });
216
+ if (scope === "content" && type === "dictation" && itemMedia === void 0) issues.push({
217
+ path: [
218
+ "items",
219
+ index,
220
+ "media"
221
+ ],
222
+ input: itemMedia,
223
+ message: "A dictation inside an interactive video needs its own recording."
224
+ });
225
+ });
226
+ const placed = /* @__PURE__ */ new Set();
227
+ timeline.cues.forEach((cue, cueIndex) => {
228
+ cue.itemIds.forEach((itemId, position) => {
229
+ const path = [
230
+ "timeline",
231
+ "cues",
232
+ cueIndex,
233
+ "itemIds",
234
+ position
235
+ ];
236
+ if (!itemIds.has(itemId)) issues.push({
237
+ path,
238
+ input: itemId,
239
+ message: `No item in this group has the id "${itemId}".`
240
+ });
241
+ else if (placed.has(itemId)) issues.push({
242
+ path,
243
+ input: itemId,
244
+ message: `Item "${itemId}" is placed twice: every question belongs to exactly one quiz.`
245
+ });
246
+ placed.add(itemId);
247
+ });
248
+ });
249
+ for (const [itemId, index] of itemIds) if (!placed.has(itemId)) issues.push({
250
+ path: ["items", index],
251
+ input: itemId,
252
+ message: `Item "${itemId}" is in no quiz, so the video would never show it.`
253
+ });
254
+ if (scope === "content" && media !== void 0) {
255
+ const urls = [
256
+ [media.url, [
257
+ "stimulus",
258
+ "media",
259
+ "url"
260
+ ]],
261
+ [media.poster, [
262
+ "stimulus",
263
+ "media",
264
+ "poster"
265
+ ]],
266
+ ...(media.tracks ?? []).map((track, index) => [track.src, [
267
+ "stimulus",
268
+ "media",
269
+ "tracks",
270
+ index,
271
+ "src"
272
+ ]])
273
+ ];
274
+ for (const [url, path] of urls) if (isLocalOnlyUrl(url)) issues.push({
275
+ path,
276
+ input: url,
277
+ message: "An interactive video is stored and served: its URLs cannot be data: or blob: URLs."
278
+ });
279
+ }
280
+ return issues;
281
+ }
282
+ /**
283
+ * The structural minimum of an item as seen by the CONTAINER schema. Each
284
+ * item's own contract is checked against its registered schema by
285
+ * {@link validateItemGroup} — a zod schema cannot dispatch on a registry
286
+ * that consumers extend at runtime.
287
+ */
288
+ const ItemShapeSchema = z.looseObject({
289
+ type: z.string().min(1),
290
+ id: z.string().min(1),
291
+ slotKey: SlotKeySchema.optional()
292
+ });
293
+ /**
294
+ * Zod schema for an {@link ItemGroup} CONTAINER. Loose: unknown keys
295
+ * preserved. Validates the group's own fields and the stimulus in full, and
296
+ * each item only structurally (`type` and `id`); use {@link validateItemGroup}
297
+ * to validate the items against their registered schemas as well.
298
+ */
299
+ const ItemGroupSchema = z.looseObject({
300
+ schemaVersion: z.literal("1.0"),
301
+ type: z.literal("item-group"),
302
+ id: z.string().min(1),
303
+ title: z.string().optional(),
304
+ slotKey: SlotKeySchema.optional(),
305
+ stimulus: StimulusSchema,
306
+ items: z.array(ItemShapeSchema).min(1),
307
+ shuffle: z.enum(["none", "within-group"]).optional(),
308
+ timeline: MediaTimelineSchema.optional()
309
+ }).refine((group) => group.items.every((item) => item.type !== "item-group"), {
310
+ error: "Item groups do not nest: every item must be an activity.",
311
+ path: ["items"]
312
+ }).refine((group) => new Set(group.items.map((item) => item.id)).size === group.items.length, {
313
+ error: "Item ids must be unique within a group.",
314
+ path: ["items"]
315
+ }).check((ctx) => {
316
+ for (const issue of timelineIssues(ctx.value, "content")) ctx.issues.push({
317
+ code: "custom",
318
+ ...issue
319
+ });
320
+ });
321
+ /** Strict learner-safe stimulus: everything but the author-only `transcript`. */
322
+ const RedactedStimulusSchema = z.strictObject({
323
+ id: z.string().min(1),
324
+ kind: z.enum([
325
+ "text",
326
+ "audio",
327
+ "video",
328
+ "image",
329
+ "mixed"
330
+ ]),
331
+ title: z.string().optional(),
332
+ body: z.string().optional(),
333
+ bodyHtml: z.string().optional(),
334
+ media: RedactedMediaSchema.optional(),
335
+ locale: z.string().optional(),
336
+ attribution: z.string().optional()
337
+ });
338
+ /**
339
+ * Strict learner-safe item group. Items are left opaque here — each is proven
340
+ * learner-safe by `assertRedacted` against its OWN type's redacted schema,
341
+ * which is the only place that knowledge lives. The one exception is the one
342
+ * rule that spans the container and an item: a captioned stimulus recording
343
+ * played to a dictation is not learner-safe, because the captions are the
344
+ * dictation's answer.
345
+ */
346
+ const RedactedItemGroupSchema = z.strictObject({
347
+ redacted: z.literal(true),
348
+ schemaVersion: z.literal("1.0"),
349
+ type: z.literal("item-group"),
350
+ id: z.string().min(1),
351
+ title: z.string().optional(),
352
+ slotKey: SlotKeySchema.optional(),
353
+ stimulus: RedactedStimulusSchema,
354
+ items: z.array(z.unknown()).min(1),
355
+ shuffle: z.enum(["none", "within-group"]).optional(),
356
+ timeline: MediaTimelineSchema.optional()
357
+ }).check((ctx) => {
358
+ for (const issue of timelineIssues(ctx.value, "redacted")) ctx.issues.push({
359
+ code: "custom",
360
+ ...issue
361
+ });
362
+ const captions = groupCaptionsField(ctx.value);
363
+ if (captions !== void 0) ctx.issues.push({
364
+ code: "custom",
365
+ input: ctx.value.stimulus.media?.[captions],
366
+ message: GROUP_CAPTIONS_REVEAL_DICTATION,
367
+ path: [
368
+ "stimulus",
369
+ "media",
370
+ captions
371
+ ]
372
+ });
373
+ });
374
+ function toValidationErrors(issues, prefix) {
375
+ return issues.map((issue) => ({
376
+ path: [...prefix, ...issue.path.map(String)],
377
+ message: issue.message,
378
+ code: issue.code
379
+ }));
380
+ }
381
+ /**
382
+ * Validates an item group in full: the container and stimulus against
383
+ * {@link ItemGroupSchema}, then every item against the schema registered for
384
+ * its `type`. Errors from items are reported at `items.<index>.…`.
385
+ *
386
+ * Unlike `validateActivity`, an item whose type is not registered is REPORTED
387
+ * (code `unknown_activity_type`) rather than thrown: a group is validated as
388
+ * a whole, and an author fixing a six-item group wants every problem listed,
389
+ * not the first one that happened to throw.
390
+ */
391
+ function validateItemGroup(data) {
392
+ const container = ItemGroupSchema.safeParse(data);
393
+ if (!container.success) return {
394
+ success: false,
395
+ errors: toValidationErrors(container.error.issues, [])
396
+ };
397
+ const errors = [];
398
+ const items = [];
399
+ container.data.items.forEach((item, index) => {
400
+ const descriptor = getActivityTypeDescriptor(item.type);
401
+ if (descriptor === void 0) {
402
+ errors.push({
403
+ path: [
404
+ "items",
405
+ String(index),
406
+ "type"
407
+ ],
408
+ message: `Activity type "${item.type}" is not registered`,
409
+ code: "unknown_activity_type"
410
+ });
411
+ return;
412
+ }
413
+ const parsed = readSchema(descriptor.schema, item, `Activity type "${descriptor.type}"`);
414
+ if (!parsed.success) {
415
+ errors.push(...toValidationErrors(parsed.issues, ["items", String(index)]));
416
+ return;
417
+ }
418
+ items.push(parsed.data);
419
+ });
420
+ const captions = groupCaptionsField(container.data);
421
+ if (captions !== void 0) errors.push({
422
+ path: [
423
+ "stimulus",
424
+ "media",
425
+ captions
426
+ ],
427
+ message: GROUP_CAPTIONS_REVEAL_DICTATION,
428
+ code: "custom"
429
+ });
430
+ if (errors.length > 0) return {
431
+ success: false,
432
+ errors
433
+ };
434
+ return {
435
+ success: true,
436
+ data: {
437
+ ...container.data,
438
+ items
439
+ }
440
+ };
441
+ }
442
+ //#endregion
443
+ export { INTERACTIVE_VIDEO_ITEM_TYPES as a, TIMELINE_MAX_QUIZZES as c, validateItemGroup as i, TIMELINE_MAX_TITLE_LENGTH as l, RedactedItemGroupSchema as n, TIMELINE_MAX_CHAPTERS as o, StimulusSchema as r, TIMELINE_MAX_ITEMS as s, ItemGroupSchema as t, isInteractiveVideoItemType as u };
444
+
445
+ //# sourceMappingURL=item-group-DXiR8nOr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-group-DXiR8nOr.js","names":[],"sources":["../src/timeline-limits.ts","../src/schemas/item-group.ts"],"sourcesContent":["/**\n * The bounds of an interactive video — an item group with a `timeline`.\n *\n * A leaf module on purpose: the schemas, the authoring checks and the timeline\n * helpers all read these, and nothing here may import any of them back.\n */\n\n/**\n * The item types an interactive video may present. CLOSED on purpose: a type\n * added to the SDK later, or a custom type a host registers, is not silently\n * embeddable. Each one here was chosen, and each works inside a paused video —\n * a read-aloud's microphone included, because every quiz pauses the video\n * first.\n */\nexport const INTERACTIVE_VIDEO_ITEM_TYPES = [\n 'multiple-choice',\n 'fill-in-the-blanks',\n 'gap-select',\n 'dictation',\n 'read-aloud',\n] as const;\n\n/** One of {@link INTERACTIVE_VIDEO_ITEM_TYPES}. */\nexport type InteractiveVideoItemType = (typeof INTERACTIVE_VIDEO_ITEM_TYPES)[number];\n\n/** Whether `type` is one of the item types an interactive video may present. */\nexport function isInteractiveVideoItemType(type: unknown): type is InteractiveVideoItemType {\n return (INTERACTIVE_VIDEO_ITEM_TYPES as readonly unknown[]).includes(type);\n}\n\n/** The most quizzes one video may hold. */\nexport const TIMELINE_MAX_QUIZZES = 100;\n\n/**\n * The most questions one interactive video may hold, across all its quizzes.\n * The player keeps every one of them mounted, so an answer survives the\n * learner rewinding past its quiz.\n */\nexport const TIMELINE_MAX_ITEMS = 200;\n\n/** The most chapters one video may hold. */\nexport const TIMELINE_MAX_CHAPTERS = 100;\n\n/** The longest quiz or chapter title, in UTF-16 units. A title sits on one line of the player. */\nexport const TIMELINE_MAX_TITLE_LENGTH = 120;\n","import * as z from 'zod/v4';\nimport { getActivityTypeDescriptor } from '../registry/index.js';\nimport {\n INTERACTIVE_VIDEO_ITEM_TYPES,\n isInteractiveVideoItemType,\n TIMELINE_MAX_CHAPTERS,\n TIMELINE_MAX_ITEMS,\n TIMELINE_MAX_QUIZZES,\n TIMELINE_MAX_TITLE_LENGTH,\n} from '../timeline-limits.js';\nimport type { ActivityData, ValidationError, ValidationResult } from '../types/activity.js';\nimport type { ItemGroup, StimulusKind } from '../types/item-group.js';\nimport { GROUP_CAPTIONS_REVEAL_DICTATION, groupCaptionsField } from './dictation.js';\nimport { MediaSchema, RedactedMediaSchema } from './media.js';\nimport { readSchema } from './read-schema.js';\nimport { maxUnits } from './text-length.js';\n\n/**\n * An authored slot key.\n *\n * A `.` is rejected here, not at render time: `flattenSequence` uses the first\n * `.` to separate a group from its item, so a key containing one would produce\n * an ambiguous slot id. `keyOf` already threw on it — this moves the rejection\n * to `validateItemGroup`, where an author finds it, instead of leaving it to\n * surface when a learner opens the paper. Content that would newly fail\n * validation already threw at flatten time, so it can never have been sat.\n */\nconst SlotKeySchema = z\n .string()\n .min(1)\n .refine((key) => !key.includes('.'), {\n error:\n 'slotKey must not contain \".\" — that character separates a group from its item in a slot id, so a key containing one would make the slot ambiguous.',\n });\n\nfunction hasBody(stimulus: { body?: string | undefined }): boolean {\n return typeof stimulus.body === 'string' && stimulus.body.trim().length > 0;\n}\n\n/** Which media types can carry a stimulus of each kind. `text`/`mixed` accept any. */\nfunction mediaFits(kind: StimulusKind, mediaType: string | undefined): boolean {\n switch (kind) {\n case 'audio':\n return mediaType === 'audio';\n case 'video':\n return mediaType === 'video' || mediaType === 'embed';\n case 'image':\n return mediaType === 'image';\n default:\n return true;\n }\n}\n\n/**\n * Zod schema for a {@link Stimulus}. Loose: unknown keys preserved.\n *\n * The semantic guards exist because a stimulus that does not carry what its\n * `kind` promises is an authoring error that must not reach an exam: an\n * \"audio\" stimulus with no recording renders as a blank panel above six\n * listening questions. Unrepresentable in JSON Schema; dropped from\n * `stimulusJsonSchema` by design.\n */\nexport const StimulusSchema = z\n .looseObject({\n id: z.string().min(1),\n kind: z.enum(['text', 'audio', 'video', 'image', 'mixed']),\n title: z.string().optional(),\n body: z.string().optional(),\n bodyHtml: z.string().optional(),\n media: MediaSchema.optional(),\n transcript: z.string().optional(),\n locale: z.string().optional(),\n attribution: z.string().optional(),\n })\n .refine((stimulus) => stimulus.bodyHtml === undefined || hasBody(stimulus), {\n error:\n 'bodyHtml requires a plain-text body: it is the accessible fallback rendered when no sanitiser is supplied.',\n path: ['body'],\n })\n .refine(\n (stimulus) => (stimulus.kind !== 'text' && stimulus.kind !== 'mixed') || hasBody(stimulus),\n {\n error: 'A text or mixed stimulus needs a non-empty body.',\n path: ['body'],\n },\n )\n .refine((stimulus) => stimulus.kind === 'text' || stimulus.media !== undefined, {\n error: 'An audio, video, image or mixed stimulus needs media.',\n path: ['media'],\n })\n .refine(\n (stimulus) => stimulus.media === undefined || mediaFits(stimulus.kind, stimulus.media.type),\n {\n error:\n 'media.type does not fit the stimulus kind: audio needs audio; video needs video or embed; image needs image.',\n path: ['media', 'type'],\n },\n );\n\nconst TimelineTitleSchema = maxUnits(z.string(), TIMELINE_MAX_TITLE_LENGTH).refine(\n (title) => title.trim().length > 0,\n { error: 'A title must not be empty.' },\n);\n\n/** Seconds from the start of the video. zod rejects NaN and ±Infinity itself. */\nconst TimelineTimeSchema = z.number().min(0, { error: 'A time is 0 seconds or more.' });\n\n/**\n * A quiz. STRICT, like every part of a timeline: a misspelt `requried` would\n * otherwise be kept and the quiz silently optional on a paper that believed it\n * was required.\n */\nexport const TimelineCueSchema = z.strictObject({\n id: maxUnits(z.string().min(1), 64),\n at: TimelineTimeSchema,\n itemIds: z.array(z.string().min(1)).min(1).max(TIMELINE_MAX_ITEMS),\n title: TimelineTitleSchema.optional(),\n required: z.boolean().optional(),\n});\n\nexport const TimelineChapterSchema = z.strictObject({\n at: TimelineTimeSchema,\n title: TimelineTitleSchema,\n});\n\n/**\n * A timeline on its own: its quizzes, chapters and navigation. The rules that\n * need the group — every item in exactly one quiz, a video stimulus, the five\n * item types — are {@link timelineIssues}, which both group schemas run.\n */\nexport const MediaTimelineSchema = z\n .strictObject({\n cues: z.array(TimelineCueSchema).max(TIMELINE_MAX_QUIZZES),\n chapters: z.array(TimelineChapterSchema).max(TIMELINE_MAX_CHAPTERS).optional(),\n navigation: z.enum(['free', 'no-skip-ahead']).optional(),\n })\n .check((ctx) => {\n const seen = new Set<string>();\n ctx.value.cues.forEach((cue, index) => {\n if (seen.has(cue.id)) {\n ctx.issues.push({\n code: 'custom',\n input: cue.id,\n message: `Quiz id \"${cue.id}\" is used twice: events, drafts and the contents panel name a quiz by its id.`,\n path: ['cues', index, 'id'],\n });\n }\n seen.add(cue.id);\n });\n // Strictly increasing, not merely sorted: two chapters starting at one\n // moment leave the first with no length, and the scrubber no room to draw it.\n const chapters = ctx.value.chapters ?? [];\n chapters.forEach((chapter, index) => {\n const previous = chapters[index - 1];\n if (previous !== undefined && chapter.at <= previous.at) {\n ctx.issues.push({\n code: 'custom',\n input: chapter.at,\n message: 'Chapter times must be strictly increasing.',\n path: ['chapters', index, 'at'],\n });\n }\n });\n });\n\n/** A URL only this document can resolve, or one that inlines the bytes. */\nfunction isLocalOnlyUrl(url: unknown): boolean {\n return typeof url === 'string' && /^(data|blob):/i.test(url);\n}\n\n/**\n * The rules of an interactive video that span the timeline, the stimulus and\n * the items. Run by the content schema and, for everything but the two\n * authoring-only rules, by the strict redacted schema — a projection built by\n * hand never passed through the content schema.\n *\n * Items are read defensively: the redacted schema leaves them opaque, and each\n * is proven against its own type's schema elsewhere.\n */\nfunction timelineIssues(\n group: {\n stimulus: {\n kind: string;\n media?:\n | {\n type: string;\n url: string;\n poster?: string | undefined;\n tracks?: readonly { src: string }[] | undefined;\n }\n | undefined;\n };\n items: readonly unknown[];\n shuffle?: string | undefined;\n timeline?: { cues: readonly { itemIds: readonly string[] }[] } | undefined;\n },\n scope: 'content' | 'redacted',\n): { path: (string | number)[]; message: string; input: unknown }[] {\n const timeline = group.timeline;\n if (timeline === undefined) {\n return [];\n }\n const issues: { path: (string | number)[]; message: string; input: unknown }[] = [];\n const media = group.stimulus.media;\n\n // Reported at the field that is wrong, so an editor's own check at that path\n // can stand in for it without hiding anything else about the stimulus.\n if (group.stimulus.kind !== 'video') {\n issues.push({\n path: ['stimulus', 'kind'],\n input: group.stimulus.kind,\n message:\n 'An interactive video needs a video stimulus: quizzes open at moments of a video, and nothing else has them.',\n });\n } else if (media !== undefined && media.type !== 'video') {\n issues.push({\n path: ['stimulus', 'media', 'type'],\n input: media.type,\n message:\n 'An interactive video needs a video file. An embedded provider player cannot be paused at the moment a quiz opens.',\n });\n }\n if (group.shuffle === 'within-group') {\n issues.push({\n path: ['shuffle'],\n input: group.shuffle,\n message:\n 'An interactive video presents its questions in the order its quizzes open; shuffle: \"within-group\" cannot apply to it.',\n });\n }\n if (group.items.length > TIMELINE_MAX_ITEMS) {\n issues.push({\n path: ['items'],\n input: group.items.length,\n message: `An interactive video holds at most ${TIMELINE_MAX_ITEMS} questions.`,\n });\n }\n\n const itemIds = new Map<string, number>();\n group.items.forEach((item, index) => {\n const {\n id,\n type,\n media: itemMedia,\n } = (item ?? {}) as { id?: unknown; type?: unknown; media?: unknown };\n if (typeof id === 'string') {\n itemIds.set(id, index);\n }\n if (!isInteractiveVideoItemType(type)) {\n issues.push({\n path: ['items', index, 'type'],\n input: type,\n message: `An interactive video may hold only ${INTERACTIVE_VIDEO_ITEM_TYPES.join(', ')} questions.`,\n });\n }\n // The \"play the stimulus\" fallback a dictation has in a listening group\n // means nothing halfway through a video.\n if (scope === 'content' && type === 'dictation' && itemMedia === undefined) {\n issues.push({\n path: ['items', index, 'media'],\n input: itemMedia,\n message: 'A dictation inside an interactive video needs its own recording.',\n });\n }\n });\n\n const placed = new Set<string>();\n timeline.cues.forEach((cue, cueIndex) => {\n cue.itemIds.forEach((itemId, position) => {\n const path = ['timeline', 'cues', cueIndex, 'itemIds', position];\n if (!itemIds.has(itemId)) {\n issues.push({\n path,\n input: itemId,\n message: `No item in this group has the id \"${itemId}\".`,\n });\n } else if (placed.has(itemId)) {\n issues.push({\n path,\n input: itemId,\n message: `Item \"${itemId}\" is placed twice: every question belongs to exactly one quiz.`,\n });\n }\n placed.add(itemId);\n });\n });\n for (const [itemId, index] of itemIds) {\n if (!placed.has(itemId)) {\n issues.push({\n path: ['items', index],\n input: itemId,\n message: `Item \"${itemId}\" is in no quiz, so the video would never show it.`,\n });\n }\n }\n\n // A `data:` video swells the payload and every fingerprint over it; a stored\n // `blob:` URL means nothing in another document.\n if (scope === 'content' && media !== undefined) {\n const urls: [unknown, (string | number)[]][] = [\n [media.url, ['stimulus', 'media', 'url']],\n [media.poster, ['stimulus', 'media', 'poster']],\n ...(media.tracks ?? []).map((track, index): [unknown, (string | number)[]] => [\n track.src,\n ['stimulus', 'media', 'tracks', index, 'src'],\n ]),\n ];\n for (const [url, path] of urls) {\n if (isLocalOnlyUrl(url)) {\n issues.push({\n path,\n input: url,\n message:\n 'An interactive video is stored and served: its URLs cannot be data: or blob: URLs.',\n });\n }\n }\n }\n return issues;\n}\n\n/**\n * The structural minimum of an item as seen by the CONTAINER schema. Each\n * item's own contract is checked against its registered schema by\n * {@link validateItemGroup} — a zod schema cannot dispatch on a registry\n * that consumers extend at runtime.\n */\nconst ItemShapeSchema = z.looseObject({\n type: z.string().min(1),\n id: z.string().min(1),\n slotKey: SlotKeySchema.optional(),\n});\n\n/**\n * Zod schema for an {@link ItemGroup} CONTAINER. Loose: unknown keys\n * preserved. Validates the group's own fields and the stimulus in full, and\n * each item only structurally (`type` and `id`); use {@link validateItemGroup}\n * to validate the items against their registered schemas as well.\n */\nexport const ItemGroupSchema = z\n .looseObject({\n schemaVersion: z.literal('1.0'),\n type: z.literal('item-group'),\n id: z.string().min(1),\n title: z.string().optional(),\n slotKey: SlotKeySchema.optional(),\n stimulus: StimulusSchema,\n items: z.array(ItemShapeSchema).min(1),\n shuffle: z.enum(['none', 'within-group']).optional(),\n timeline: MediaTimelineSchema.optional(),\n })\n .refine((group) => group.items.every((item) => item.type !== 'item-group'), {\n error: 'Item groups do not nest: every item must be an activity.',\n path: ['items'],\n })\n .refine((group) => new Set(group.items.map((item) => item.id)).size === group.items.length, {\n error: 'Item ids must be unique within a group.',\n path: ['items'],\n })\n .check((ctx) => {\n for (const issue of timelineIssues(ctx.value, 'content')) {\n ctx.issues.push({ code: 'custom', ...issue });\n }\n });\n\n/** Strict learner-safe stimulus: everything but the author-only `transcript`. */\nexport const RedactedStimulusSchema = z.strictObject({\n id: z.string().min(1),\n kind: z.enum(['text', 'audio', 'video', 'image', 'mixed']),\n title: z.string().optional(),\n body: z.string().optional(),\n bodyHtml: z.string().optional(),\n media: RedactedMediaSchema.optional(),\n locale: z.string().optional(),\n attribution: z.string().optional(),\n});\n\n/**\n * Strict learner-safe item group. Items are left opaque here — each is proven\n * learner-safe by `assertRedacted` against its OWN type's redacted schema,\n * which is the only place that knowledge lives. The one exception is the one\n * rule that spans the container and an item: a captioned stimulus recording\n * played to a dictation is not learner-safe, because the captions are the\n * dictation's answer.\n */\nexport const RedactedItemGroupSchema = z\n .strictObject({\n redacted: z.literal(true),\n schemaVersion: z.literal('1.0'),\n type: z.literal('item-group'),\n id: z.string().min(1),\n title: z.string().optional(),\n slotKey: SlotKeySchema.optional(),\n stimulus: RedactedStimulusSchema,\n items: z.array(z.unknown()).min(1),\n shuffle: z.enum(['none', 'within-group']).optional(),\n timeline: MediaTimelineSchema.optional(),\n })\n .check((ctx) => {\n for (const issue of timelineIssues(ctx.value, 'redacted')) {\n ctx.issues.push({ code: 'custom', ...issue });\n }\n const captions = groupCaptionsField(ctx.value);\n if (captions !== undefined) {\n ctx.issues.push({\n code: 'custom',\n input: ctx.value.stimulus.media?.[captions],\n message: GROUP_CAPTIONS_REVEAL_DICTATION,\n path: ['stimulus', 'media', captions],\n });\n }\n });\n\nfunction toValidationErrors(\n issues: readonly { path: readonly PropertyKey[]; message: string; code: string }[],\n prefix: string[],\n): ValidationError[] {\n return issues.map((issue) => ({\n path: [...prefix, ...issue.path.map(String)],\n message: issue.message,\n code: issue.code,\n }));\n}\n\n/**\n * Validates an item group in full: the container and stimulus against\n * {@link ItemGroupSchema}, then every item against the schema registered for\n * its `type`. Errors from items are reported at `items.<index>.…`.\n *\n * Unlike `validateActivity`, an item whose type is not registered is REPORTED\n * (code `unknown_activity_type`) rather than thrown: a group is validated as\n * a whole, and an author fixing a six-item group wants every problem listed,\n * not the first one that happened to throw.\n */\nexport function validateItemGroup(data: unknown): ValidationResult<ItemGroup> {\n const container = ItemGroupSchema.safeParse(data);\n if (!container.success) {\n return { success: false, errors: toValidationErrors(container.error.issues, []) };\n }\n\n const errors: ValidationError[] = [];\n const items: ActivityData[] = [];\n container.data.items.forEach((item, index) => {\n const descriptor = getActivityTypeDescriptor(item.type);\n if (descriptor === undefined) {\n errors.push({\n path: ['items', String(index), 'type'],\n message: `Activity type \"${item.type}\" is not registered`,\n code: 'unknown_activity_type',\n });\n return;\n }\n const parsed = readSchema(descriptor.schema, item, `Activity type \"${descriptor.type}\"`);\n if (!parsed.success) {\n errors.push(...toValidationErrors(parsed.issues, ['items', String(index)]));\n return;\n }\n items.push(parsed.data as ActivityData);\n });\n const captions = groupCaptionsField(container.data);\n if (captions !== undefined) {\n errors.push({\n path: ['stimulus', 'media', captions],\n message: GROUP_CAPTIONS_REVEAL_DICTATION,\n code: 'custom',\n });\n }\n\n if (errors.length > 0) {\n return { success: false, errors };\n }\n // zod4 optional outputs are `T | undefined`; the wire type uses exact\n // optionals. Structurally identical at runtime — the cast is type-level.\n return { success: true, data: { ...container.data, items } as unknown as ItemGroup };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;AACF;;AAMA,SAAgB,2BAA2B,MAAiD;CAC1F,OAAQ,6BAAoD,SAAS,IAAI;AAC3E;;AAGA,MAAa,uBAAuB;;;;;;AAOpC,MAAa,qBAAqB;;AAGlC,MAAa,wBAAwB;;AAGrC,MAAa,4BAA4B;;;;;;;;;;;;;ACjBzC,MAAM,gBAAgB,EACnB,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,QAAQ,QAAQ,CAAC,IAAI,SAAS,GAAG,GAAG,EACnC,OACE,uJACJ,CAAC;AAEH,SAAS,QAAQ,UAAkD;CACjE,OAAO,OAAO,SAAS,SAAS,YAAY,SAAS,KAAK,KAAK,CAAC,CAAC,SAAS;AAC5E;;AAGA,SAAS,UAAU,MAAoB,WAAwC;CAC7E,QAAQ,MAAR;EACE,KAAK,SACH,OAAO,cAAc;EACvB,KAAK,SACH,OAAO,cAAc,WAAW,cAAc;EAChD,KAAK,SACH,OAAO,cAAc;EACvB,SACE,OAAO;CACX;AACF;;;;;;;;;;AAWA,MAAa,iBAAiB,EAC3B,YAAY;CACX,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,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