@longsightgroup/qti3-migrator 0.9.5

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 (68) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +13 -0
  3. package/dist/diagnostics.d.ts +7 -0
  4. package/dist/diagnostics.d.ts.map +1 -0
  5. package/dist/diagnostics.js +7 -0
  6. package/dist/diagnostics.js.map +1 -0
  7. package/dist/index.d.ts +7 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +262 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/options.d.ts +3 -0
  12. package/dist/options.d.ts.map +1 -0
  13. package/dist/options.js +7 -0
  14. package/dist/options.js.map +1 -0
  15. package/dist/qti12-item.d.ts +7 -0
  16. package/dist/qti12-item.d.ts.map +1 -0
  17. package/dist/qti12-item.js +393 -0
  18. package/dist/qti12-item.js.map +1 -0
  19. package/dist/qti2-body.d.ts +11 -0
  20. package/dist/qti2-body.d.ts.map +1 -0
  21. package/dist/qti2-body.js +90 -0
  22. package/dist/qti2-body.js.map +1 -0
  23. package/dist/qti2-choices.d.ts +7 -0
  24. package/dist/qti2-choices.d.ts.map +1 -0
  25. package/dist/qti2-choices.js +74 -0
  26. package/dist/qti2-choices.js.map +1 -0
  27. package/dist/qti2-graphic.d.ts +10 -0
  28. package/dist/qti2-graphic.d.ts.map +1 -0
  29. package/dist/qti2-graphic.js +30 -0
  30. package/dist/qti2-graphic.js.map +1 -0
  31. package/dist/qti2-item.d.ts +8 -0
  32. package/dist/qti2-item.d.ts.map +1 -0
  33. package/dist/qti2-item.js +494 -0
  34. package/dist/qti2-item.js.map +1 -0
  35. package/dist/qti2-response.d.ts +9 -0
  36. package/dist/qti2-response.d.ts.map +1 -0
  37. package/dist/qti2-response.js +32 -0
  38. package/dist/qti2-response.js.map +1 -0
  39. package/dist/source.d.ts +30 -0
  40. package/dist/source.d.ts.map +1 -0
  41. package/dist/source.js +197 -0
  42. package/dist/source.js.map +1 -0
  43. package/dist/text.d.ts +5 -0
  44. package/dist/text.d.ts.map +1 -0
  45. package/dist/text.js +19 -0
  46. package/dist/text.js.map +1 -0
  47. package/dist/types.d.ts +61 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/types.js +2 -0
  50. package/dist/types.js.map +1 -0
  51. package/dist/xml.d.ts +16 -0
  52. package/dist/xml.d.ts.map +1 -0
  53. package/dist/xml.js +101 -0
  54. package/dist/xml.js.map +1 -0
  55. package/package.json +56 -0
  56. package/src/diagnostics.ts +21 -0
  57. package/src/index.ts +393 -0
  58. package/src/options.ts +8 -0
  59. package/src/qti12-item.ts +507 -0
  60. package/src/qti2-body.ts +138 -0
  61. package/src/qti2-choices.ts +96 -0
  62. package/src/qti2-graphic.ts +32 -0
  63. package/src/qti2-item.ts +650 -0
  64. package/src/qti2-response.ts +41 -0
  65. package/src/source.ts +251 -0
  66. package/src/text.ts +21 -0
  67. package/src/types.ts +73 -0
  68. package/src/xml.ts +119 -0
@@ -0,0 +1,30 @@
1
+ import { attr, toNumber } from "./xml.js";
2
+ export function graphicObject(object, coords) {
3
+ const dimensions = inferImageDimensions(coords);
4
+ return {
5
+ data: attr(object, "data") ?? "",
6
+ alt: attr(object, "alt") ?? attr(object, "label") ?? "Image",
7
+ type: attr(object, "type") ?? undefined,
8
+ width: toNumber(attr(object, "width")) ?? dimensions.width,
9
+ height: toNumber(attr(object, "height")) ?? dimensions.height,
10
+ };
11
+ }
12
+ export function hotspotShape(value) {
13
+ return value === "circle" || value === "poly" ? value : "rect";
14
+ }
15
+ function inferImageDimensions(coords) {
16
+ let maxX = 1;
17
+ let maxY = 1;
18
+ for (const entry of coords) {
19
+ const coordinateValues = entry
20
+ .split(/[\s,]+/)
21
+ .map(Number)
22
+ .filter(Number.isFinite);
23
+ for (let index = 0; index < coordinateValues.length; index += 2) {
24
+ maxX = Math.max(maxX, coordinateValues[index] ?? 1);
25
+ maxY = Math.max(maxY, coordinateValues[index + 1] ?? 1);
26
+ }
27
+ }
28
+ return { width: Math.ceil(maxX), height: Math.ceil(maxY) };
29
+ }
30
+ //# sourceMappingURL=qti2-graphic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti2-graphic.js","sourceRoot":"","sources":["../src/qti2-graphic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;AAE3D,MAAM,UAAU,aAAa,CAAC,MAAyB,EAAE,MAAyB;IAChF,MAAM,UAAU,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAChD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;QAChC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,OAAO;QAC5D,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,SAAS;QACvC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK;QAC1D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM;KAC9D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAoB;IAC/C,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACjE,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAyB;IACrD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,gBAAgB,GAAG,KAAK;aAC3B,KAAK,CAAC,QAAQ,CAAC;aACf,GAAG,CAAC,MAAM,CAAC;aACX,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,gBAAgB,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YAChE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YACpD,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Qti3AuthoringItem } from "@longsightgroup/qti3-writer";
2
+ import type { QtiMigrationDiagnostic, QtiMigrationSourceFormat, ResolvedQtiMigrationOptions } from "./types.js";
3
+ export declare function migrateQti2ItemXml(xml: string, path: string, sourceFormat: QtiMigrationSourceFormat, options: ResolvedQtiMigrationOptions): {
4
+ authoringItem?: Qti3AuthoringItem | undefined;
5
+ diagnostics: readonly QtiMigrationDiagnostic[];
6
+ };
7
+ export declare function itemTitleFromXml(xml: string): string;
8
+ //# sourceMappingURL=qti2-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti2-item.d.ts","sourceRoot":"","sources":["../src/qti2-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAOvB,MAAM,6BAA6B,CAAC;AAqBrC,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAcpB,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,wBAAwB,EACtC,OAAO,EAAE,2BAA2B,GACnC;IACD,aAAa,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9C,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAChD,CAmFA;AAufD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQpD"}
@@ -0,0 +1,494 @@
1
+ import {} from "@longsightgroup/qti3-writer";
2
+ import { bodyWithGapPlaceholders, bodyWithHottextPlaceholders, bodyWithInlineChoicePlaceholders, bodyWithoutInteraction, bodyWithTextEntryPlaceholders, collectInteractionElements, prompt, trusted, } from "./qti2-body.js";
3
+ import { associableChoices, gapChoice, graphicGapChoice, simpleChoices } from "./qti2-choices.js";
4
+ import { graphicObject, hotspotShape } from "./qti2-graphic.js";
5
+ import { hasMapping, orderedIdentifierValues, pairValues, responseValues, } from "./qti2-response.js";
6
+ import { diagnostic } from "./diagnostics.js";
7
+ import { normalizeIdentifier, stripTags } from "./text.js";
8
+ import { attr, findAllDescendantsByAnyLocalName, findAllDescendantsByLocalName, findDescendantByLocalName, localName, parseXml, serializeChildren, textOf, toNumber, } from "./xml.js";
9
+ export function migrateQti2ItemXml(xml, path, sourceFormat, options) {
10
+ const diagnostics = [];
11
+ const doc = parseXml(xml, path);
12
+ const root = doc.documentElement;
13
+ if (localName(root) !== "assessmentitem") {
14
+ return {
15
+ diagnostics: [
16
+ diagnostic("qti2_item_root", "error", "Expected QTI 2.x assessmentItem root.", {
17
+ path,
18
+ sourceFormat,
19
+ }),
20
+ ],
21
+ };
22
+ }
23
+ const body = findDescendantByLocalName(root, "itembody");
24
+ if (!body) {
25
+ return {
26
+ diagnostics: [
27
+ diagnostic("qti2_item_body_missing", "error", "QTI 2.x item is missing itemBody.", {
28
+ path,
29
+ sourceFormat,
30
+ }),
31
+ ],
32
+ };
33
+ }
34
+ const responseDecls = findAllDescendantsByLocalName(root, "responsedeclaration");
35
+ const responseDeclMap = new Map();
36
+ for (const declaration of responseDecls) {
37
+ const identifier = attr(declaration, "identifier");
38
+ if (identifier)
39
+ responseDeclMap.set(identifier, declaration);
40
+ }
41
+ const context = {
42
+ identifier: normalizeIdentifier(attr(root, "identifier"), "ITEM"),
43
+ title: attr(root, "title")?.trim() || "Imported Item",
44
+ body,
45
+ responseDecls,
46
+ responseDeclMap,
47
+ sourceFormat,
48
+ path,
49
+ options,
50
+ diagnostics,
51
+ };
52
+ const interactionCheck = supportedInteractionForItem(body, sourceFormat, path);
53
+ if (interactionCheck.diagnostics.length) {
54
+ return { diagnostics: interactionCheck.diagnostics };
55
+ }
56
+ const interaction = interactionCheck.interaction;
57
+ if (!interaction) {
58
+ return {
59
+ diagnostics: [
60
+ diagnostic("qti2_interaction_unsupported", "error", "No supported QTI 2.x interaction found.", {
61
+ path,
62
+ sourceFormat,
63
+ }),
64
+ ],
65
+ };
66
+ }
67
+ const mapper = qti2Mappers[localName(interaction)];
68
+ if (!mapper) {
69
+ return {
70
+ diagnostics: [
71
+ diagnostic("qti2_interaction_unsupported", "error", `Unsupported QTI 2.x interaction ${localName(interaction)}.`, { path, sourceFormat }),
72
+ ],
73
+ };
74
+ }
75
+ try {
76
+ return { authoringItem: mapper(interaction, context), diagnostics };
77
+ }
78
+ catch (error) {
79
+ if (error instanceof Qti2MigrationBlocked) {
80
+ return { diagnostics: error.diagnostics };
81
+ }
82
+ throw error;
83
+ }
84
+ }
85
+ const qti2Mappers = {
86
+ choiceinteraction: mapChoice,
87
+ orderinteraction: mapOrder,
88
+ matchinteraction: mapMatch,
89
+ associateinteraction: mapAssociate,
90
+ textentryinteraction: mapTextEntry,
91
+ extendedtextinteraction: mapExtendedText,
92
+ inlinechoiceinteraction: mapInlineChoice,
93
+ hottextinteraction: mapHottext,
94
+ gapmatchinteraction: mapGapMatch,
95
+ hotspotinteraction: mapHotspot,
96
+ graphicorderinteraction: mapGraphicOrder,
97
+ graphicassociateinteraction: mapGraphicAssociate,
98
+ graphicgapmatchinteraction: mapGraphicGapMatch,
99
+ };
100
+ const supportedInteractionNames = new Set(Object.keys(qti2Mappers));
101
+ function supportedInteractionForItem(root, sourceFormat, path) {
102
+ const interactions = collectInteractionElements(root);
103
+ const unsupported = interactions.filter((interaction) => !supportedInteractionNames.has(localName(interaction)));
104
+ if (unsupported.length) {
105
+ return {
106
+ diagnostics: [
107
+ diagnostic("qti2_interaction_unsupported", "error", `Unsupported QTI 2.x interaction ${localName(unsupported[0])}.`, { path, sourceFormat }),
108
+ ],
109
+ };
110
+ }
111
+ const supported = interactions.filter((interaction) => supportedInteractionNames.has(localName(interaction)));
112
+ const supportedNames = new Set(supported.map((interaction) => localName(interaction)));
113
+ const supportsMultipleSlots = supportedNames.size === 1 &&
114
+ (supportedNames.has("inlinechoiceinteraction") || supportedNames.has("textentryinteraction"));
115
+ if (supported.length > 1 && !supportsMultipleSlots) {
116
+ return {
117
+ diagnostics: [
118
+ diagnostic("qti2_composite_interactions_unsupported", "error", "QTI 2.x item contains multiple interactions; partial migration is not allowed.", { path, sourceFormat }),
119
+ ],
120
+ };
121
+ }
122
+ return { interaction: supported[0], diagnostics: [] };
123
+ }
124
+ function mapChoice(interaction, context) {
125
+ const responseIdentifier = responseIdentifierFor(interaction);
126
+ const declaration = context.responseDeclMap.get(responseIdentifier);
127
+ const cardinality = (attr(declaration, "cardinality") ?? "").toLowerCase();
128
+ const maxChoices = toNumber(attr(interaction, "maxChoices"));
129
+ const choices = simpleChoices(interaction);
130
+ const correctValues = orderedIdentifierValues(declaration);
131
+ if (cardinality === "ordered") {
132
+ return {
133
+ interactionType: "order",
134
+ identifier: context.identifier,
135
+ title: context.title,
136
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
137
+ responseIdentifier,
138
+ choices,
139
+ correctOrder: correctValues.length
140
+ ? correctValues
141
+ : choices.map((choice) => choice.identifier),
142
+ shuffle: attr(interaction, "shuffle") === "true",
143
+ minChoices: toNumber(attr(interaction, "minChoices")),
144
+ maxChoices,
145
+ };
146
+ }
147
+ const choiceCardinality = cardinality === "multiple" || (maxChoices ?? 0) > 1 ? "multiple" : "single";
148
+ const correctResponse = correctValues.filter((value) => choices.some((choice) => choice.identifier === value));
149
+ repairOrError({
150
+ needed: !correctResponse.length,
151
+ context,
152
+ code: "qti2_choice_correct_response_missing",
153
+ message: "QTI 2.x choice interaction has no valid correct response.",
154
+ repairMessage: "QTI 2.x choice response was missing or invalid; using the first declared choice.",
155
+ });
156
+ return {
157
+ interactionType: "choice",
158
+ identifier: context.identifier,
159
+ title: context.title,
160
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
161
+ responseIdentifier,
162
+ responseCardinality: choiceCardinality,
163
+ choices,
164
+ correctResponse: correctResponse.length
165
+ ? correctResponse
166
+ : choices.slice(0, 1).map((choice) => choice.identifier),
167
+ shuffle: attr(interaction, "shuffle") === "true",
168
+ minChoices: toNumber(attr(interaction, "minChoices")),
169
+ maxChoices: choiceCardinality === "single" ? 1 : maxChoices,
170
+ scoring: hasMapping(declaration) ? "map_response" : "match_correct",
171
+ };
172
+ }
173
+ function mapOrder(interaction, context) {
174
+ const responseIdentifier = responseIdentifierFor(interaction);
175
+ const choices = simpleChoices(interaction);
176
+ const correctOrder = orderedIdentifierValues(context.responseDeclMap.get(responseIdentifier));
177
+ return {
178
+ interactionType: "order",
179
+ identifier: context.identifier,
180
+ title: context.title,
181
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
182
+ responseIdentifier,
183
+ choices,
184
+ correctOrder: correctOrder.length ? correctOrder : choices.map((choice) => choice.identifier),
185
+ shuffle: attr(interaction, "shuffle") === "true",
186
+ minChoices: toNumber(attr(interaction, "minChoices")),
187
+ maxChoices: toNumber(attr(interaction, "maxChoices")),
188
+ };
189
+ }
190
+ function mapMatch(interaction, context) {
191
+ const responseIdentifier = responseIdentifierFor(interaction);
192
+ const sets = findAllDescendantsByLocalName(interaction, "simplematchset");
193
+ return {
194
+ interactionType: "match",
195
+ identifier: context.identifier,
196
+ title: context.title,
197
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
198
+ responseIdentifier,
199
+ sources: associableChoices(sets[0], "SOURCE"),
200
+ targets: associableChoices(sets[1], "TARGET"),
201
+ correctResponse: pairValues(context.responseDeclMap.get(responseIdentifier)),
202
+ shuffle: attr(interaction, "shuffle") === "true",
203
+ minAssociations: toNumber(attr(interaction, "minAssociations")),
204
+ maxAssociations: toNumber(attr(interaction, "maxAssociations")),
205
+ };
206
+ }
207
+ function mapAssociate(interaction, context) {
208
+ const responseIdentifier = responseIdentifierFor(interaction);
209
+ return {
210
+ interactionType: "associate",
211
+ identifier: context.identifier,
212
+ title: context.title,
213
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
214
+ responseIdentifier,
215
+ choices: associableChoices(interaction, "CHOICE"),
216
+ correctResponse: pairValues(context.responseDeclMap.get(responseIdentifier)),
217
+ shuffle: attr(interaction, "shuffle") === "true",
218
+ minAssociations: toNumber(attr(interaction, "minAssociations")),
219
+ maxAssociations: toNumber(attr(interaction, "maxAssociations")),
220
+ scoring: hasMapping(context.responseDeclMap.get(responseIdentifier))
221
+ ? "map_response"
222
+ : "match_correct",
223
+ };
224
+ }
225
+ function mapTextEntry(interaction, context) {
226
+ const interactions = findAllDescendantsByLocalName(context.body, "textentryinteraction");
227
+ const responses = interactions.map((entry, index) => {
228
+ const responseIdentifier = responseIdentifierFor(entry, `RESPONSE_${index + 1}`);
229
+ return {
230
+ responseIdentifier,
231
+ answers: textEntryAnswers(context.responseDeclMap.get(responseIdentifier), context),
232
+ };
233
+ });
234
+ return {
235
+ interactionType: "textEntry",
236
+ identifier: context.identifier,
237
+ title: context.title,
238
+ bodyHtml: bodyWithTextEntryPlaceholders(context.body, interactions, responseIdentifierFor),
239
+ responses,
240
+ };
241
+ }
242
+ function mapExtendedText(interaction, context) {
243
+ const responseIdentifier = responseIdentifierFor(interaction);
244
+ const declaration = context.responseDeclMap.get(responseIdentifier);
245
+ return {
246
+ interactionType: "extendedText",
247
+ identifier: context.identifier,
248
+ title: context.title,
249
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
250
+ responseIdentifier,
251
+ expectedLength: toNumber(attr(interaction, "expectedLength")),
252
+ expectedLines: toNumber(attr(interaction, "expectedLines")),
253
+ minStrings: toNumber(attr(interaction, "minStrings")),
254
+ maxStrings: toNumber(attr(interaction, "maxStrings")),
255
+ placeholderText: attr(interaction, "placeholderText") ?? undefined,
256
+ format: extendedTextFormat(attr(interaction, "format")),
257
+ responseBaseType: baseType(attr(declaration, "baseType") ?? attr(declaration, "base-type")),
258
+ responseCardinality: responseCardinality(attr(declaration, "cardinality")),
259
+ };
260
+ }
261
+ function mapInlineChoice(interaction, context) {
262
+ const interactions = findAllDescendantsByLocalName(context.body, "inlinechoiceinteraction");
263
+ const slots = interactions.map((entry, index) => {
264
+ const responseIdentifier = responseIdentifierFor(entry, `RESPONSE_${index + 1}`);
265
+ const declaration = context.responseDeclMap.get(responseIdentifier);
266
+ const correctResponse = responseValues(declaration)[0];
267
+ return {
268
+ responseIdentifier,
269
+ shuffle: attr(entry, "shuffle") === "true",
270
+ required: attr(entry, "required") === "true",
271
+ options: findAllDescendantsByLocalName(entry, "inlinechoice").map((choice, choiceIndex) => ({
272
+ identifier: normalizeIdentifier(attr(choice, "identifier"), `CHOICE_${choiceIndex + 1}`),
273
+ contentHtml: trusted(serializeChildren(choice)),
274
+ text: textOf(choice) || undefined,
275
+ fixed: attr(choice, "fixed") === "true",
276
+ })),
277
+ correctResponse: correctResponse ? normalizeIdentifier(correctResponse) : undefined,
278
+ };
279
+ });
280
+ return {
281
+ interactionType: "inlineChoice",
282
+ identifier: context.identifier,
283
+ title: context.title,
284
+ bodyHtml: bodyWithInlineChoicePlaceholders(context.body, interactions, responseIdentifierFor),
285
+ slots,
286
+ scoring: "all_or_nothing",
287
+ };
288
+ }
289
+ function mapHottext(interaction, context) {
290
+ const responseIdentifier = responseIdentifierFor(interaction);
291
+ const hottexts = findAllDescendantsByLocalName(interaction, "hottext");
292
+ const choices = hottexts.map((hottext, index) => ({
293
+ identifier: normalizeIdentifier(attr(hottext, "identifier"), `H${index + 1}`),
294
+ contentHtml: trusted(serializeChildren(hottext)),
295
+ text: textOf(hottext) || undefined,
296
+ }));
297
+ return {
298
+ interactionType: "hottext",
299
+ identifier: context.identifier,
300
+ title: context.title,
301
+ promptHtml: prompt(interaction),
302
+ bodyHtml: bodyWithHottextPlaceholders(interaction, hottexts),
303
+ responseIdentifier,
304
+ choices,
305
+ correctResponse: responseValues(context.responseDeclMap.get(responseIdentifier)).map((value) => normalizeIdentifier(value)),
306
+ minChoices: toNumber(attr(interaction, "minChoices")),
307
+ maxChoices: toNumber(attr(interaction, "maxChoices")),
308
+ };
309
+ }
310
+ function mapGapMatch(interaction, context) {
311
+ const responseIdentifier = responseIdentifierFor(interaction);
312
+ const choices = findAllDescendantsByAnyLocalName(interaction, [
313
+ "gaptext",
314
+ "gapimg",
315
+ ]).map((choice, index) => gapChoice(choice, index));
316
+ const targets = findAllDescendantsByLocalName(interaction, "gap").map((gap, index) => ({
317
+ identifier: normalizeIdentifier(attr(gap, "identifier"), `GAP_${index + 1}`),
318
+ }));
319
+ return {
320
+ interactionType: "gapMatch",
321
+ identifier: context.identifier,
322
+ title: context.title,
323
+ promptHtml: prompt(interaction),
324
+ bodyHtml: bodyWithGapPlaceholders(interaction),
325
+ responseIdentifier,
326
+ choices,
327
+ targets,
328
+ correctResponse: pairValues(context.responseDeclMap.get(responseIdentifier)),
329
+ shuffle: attr(interaction, "shuffle") === "true",
330
+ minAssociations: toNumber(attr(interaction, "minAssociations")),
331
+ maxAssociations: toNumber(attr(interaction, "maxAssociations")),
332
+ scoring: hasMapping(context.responseDeclMap.get(responseIdentifier))
333
+ ? "map_response"
334
+ : "match_correct",
335
+ };
336
+ }
337
+ function mapHotspot(interaction, context) {
338
+ const responseIdentifier = responseIdentifierFor(interaction);
339
+ const object = findDescendantByLocalName(interaction, "object");
340
+ const choices = findAllDescendantsByLocalName(interaction, "hotspotchoice").map((choice, index) => ({
341
+ identifier: normalizeIdentifier(attr(choice, "identifier"), `H${index + 1}`),
342
+ shape: hotspotShape(attr(choice, "shape")),
343
+ coords: attr(choice, "coords") ?? "",
344
+ }));
345
+ return {
346
+ interactionType: "hotspot",
347
+ identifier: context.identifier,
348
+ title: context.title,
349
+ promptHtml: prompt(interaction),
350
+ responseIdentifier,
351
+ object: graphicObject(object, choices.map((choice) => choice.coords)),
352
+ choices,
353
+ correctResponse: responseValues(context.responseDeclMap.get(responseIdentifier)).map((value) => normalizeIdentifier(value)),
354
+ minChoices: toNumber(attr(interaction, "minChoices")),
355
+ maxChoices: toNumber(attr(interaction, "maxChoices")),
356
+ };
357
+ }
358
+ function mapGraphicOrder(interaction, context) {
359
+ const responseIdentifier = responseIdentifierFor(interaction);
360
+ const object = findDescendantByLocalName(interaction, "object");
361
+ const hotspots = findAllDescendantsByLocalName(interaction, "hotspotchoice").map((hotspot, index) => ({
362
+ identifier: normalizeIdentifier(attr(hotspot, "identifier"), `H${index + 1}`),
363
+ shape: hotspotShape(attr(hotspot, "shape")),
364
+ coords: attr(hotspot, "coords") ?? "",
365
+ hotspotLabel: attr(hotspot, "hotspotLabel") ?? attr(hotspot, "hotspot-label") ?? undefined,
366
+ }));
367
+ return {
368
+ interactionType: "graphicOrder",
369
+ identifier: context.identifier,
370
+ title: context.title,
371
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
372
+ promptHtml: prompt(interaction),
373
+ responseIdentifier,
374
+ object: graphicObject(object, hotspots.map((hotspot) => hotspot.coords)),
375
+ hotspots,
376
+ correctOrder: orderedIdentifierValues(context.responseDeclMap.get(responseIdentifier)),
377
+ minChoices: toNumber(attr(interaction, "minChoices")),
378
+ maxChoices: toNumber(attr(interaction, "maxChoices")),
379
+ };
380
+ }
381
+ function mapGraphicAssociate(interaction, context) {
382
+ const responseIdentifier = responseIdentifierFor(interaction);
383
+ const object = findDescendantByLocalName(interaction, "object");
384
+ const hotspots = findAllDescendantsByLocalName(interaction, "associablehotspot").map((hotspot, index) => ({
385
+ identifier: normalizeIdentifier(attr(hotspot, "identifier"), `H${index + 1}`),
386
+ shape: hotspotShape(attr(hotspot, "shape")),
387
+ coords: attr(hotspot, "coords") ?? "",
388
+ matchMax: toNumber(attr(hotspot, "matchMax")),
389
+ }));
390
+ return {
391
+ interactionType: "graphicAssociate",
392
+ identifier: context.identifier,
393
+ title: context.title,
394
+ bodyHtml: bodyWithoutInteraction(context.body, interaction),
395
+ promptHtml: prompt(interaction),
396
+ responseIdentifier,
397
+ object: graphicObject(object, hotspots.map((hotspot) => hotspot.coords)),
398
+ hotspots,
399
+ correctResponse: pairValues(context.responseDeclMap.get(responseIdentifier)),
400
+ minAssociations: toNumber(attr(interaction, "minAssociations")),
401
+ maxAssociations: toNumber(attr(interaction, "maxAssociations")),
402
+ scoring: hasMapping(context.responseDeclMap.get(responseIdentifier))
403
+ ? "map_response"
404
+ : "match_correct",
405
+ };
406
+ }
407
+ function mapGraphicGapMatch(interaction, context) {
408
+ const responseIdentifier = responseIdentifierFor(interaction);
409
+ const object = findDescendantByLocalName(interaction, "object");
410
+ const choices = findAllDescendantsByAnyLocalName(interaction, ["gaptext", "gapimg"]).map((choice, index) => graphicGapChoice(choice, index));
411
+ const targets = findAllDescendantsByLocalName(interaction, "associablehotspot").map((target, index) => ({
412
+ targetType: "hotspot",
413
+ identifier: normalizeIdentifier(attr(target, "identifier"), `T${index + 1}`),
414
+ shape: hotspotShape(attr(target, "shape")),
415
+ coords: attr(target, "coords") ?? "",
416
+ matchMax: toNumber(attr(target, "matchMax")),
417
+ }));
418
+ const targetCoords = targets.flatMap((target) => target.targetType === "inlineGap" ? [] : [target.coords]);
419
+ return {
420
+ interactionType: "graphicGapMatch",
421
+ identifier: context.identifier,
422
+ title: context.title,
423
+ promptHtml: prompt(interaction),
424
+ responseIdentifier,
425
+ object: graphicObject(object, targetCoords),
426
+ choices,
427
+ targets,
428
+ correctResponse: pairValues(context.responseDeclMap.get(responseIdentifier)),
429
+ minAssociations: toNumber(attr(interaction, "minAssociations")),
430
+ maxAssociations: toNumber(attr(interaction, "maxAssociations")),
431
+ scoring: hasMapping(context.responseDeclMap.get(responseIdentifier))
432
+ ? "map_response"
433
+ : "match_correct",
434
+ };
435
+ }
436
+ function responseIdentifierFor(interaction, fallback = "RESPONSE") {
437
+ return normalizeIdentifier(attr(interaction, "responseIdentifier") ?? attr(interaction, "response-identifier"), fallback);
438
+ }
439
+ function textEntryAnswers(declaration, context) {
440
+ const correctValues = responseValues(declaration);
441
+ repairOrError({
442
+ needed: !correctValues.length,
443
+ context,
444
+ code: "qti2_text_entry_correct_response_missing",
445
+ message: "QTI 2.x text entry interaction has no correct text value.",
446
+ repairMessage: "QTI 2.x text entry response did not declare a correct value; using an empty answer.",
447
+ });
448
+ if (!correctValues.length)
449
+ return [{ value: "", score: 1, caseSensitive: false }];
450
+ return correctValues.map((value) => ({ value, score: 1, caseSensitive: false }));
451
+ }
452
+ function repairOrError(input) {
453
+ if (!input.needed)
454
+ return;
455
+ if (input.context.options.repairPolicy === "safe") {
456
+ input.context.diagnostics.push(diagnostic(`${input.code}_repaired`, "warning", input.repairMessage, {
457
+ path: input.context.path,
458
+ sourceFormat: input.context.sourceFormat,
459
+ }));
460
+ return;
461
+ }
462
+ throw new Qti2MigrationBlocked([
463
+ diagnostic(input.code, "error", input.message, {
464
+ path: input.context.path,
465
+ sourceFormat: input.context.sourceFormat,
466
+ }),
467
+ ]);
468
+ }
469
+ class Qti2MigrationBlocked extends Error {
470
+ diagnostics;
471
+ constructor(diagnostics) {
472
+ super("QTI 2.x migration blocked by strict policy.");
473
+ this.diagnostics = diagnostics;
474
+ }
475
+ }
476
+ function baseType(value) {
477
+ const normalized = value?.toLowerCase();
478
+ return normalized === "integer" || normalized === "float" ? normalized : "string";
479
+ }
480
+ function responseCardinality(value) {
481
+ const normalized = value?.toLowerCase();
482
+ return normalized === "multiple" || normalized === "ordered" ? normalized : "single";
483
+ }
484
+ function extendedTextFormat(value) {
485
+ return value === "preformatted" || value === "xhtml" ? value : "plain";
486
+ }
487
+ export function itemTitleFromXml(xml) {
488
+ const doc = parseXml(xml, "item-title");
489
+ const root = doc.documentElement;
490
+ return (attr(root, "title")?.trim() ||
491
+ stripTags(serializeChildren(root)).slice(0, 40) ||
492
+ "Imported Item");
493
+ }
494
+ //# sourceMappingURL=qti2-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti2-item.js","sourceRoot":"","sources":["../src/qti2-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,MAAM,EACN,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,UAAU,EACV,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3D,OAAO,EACL,IAAI,EACJ,gCAAgC,EAChC,6BAA6B,EAC7B,yBAAyB,EACzB,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,MAAM,EACN,QAAQ,GAET,MAAM,UAAU,CAAC;AAElB,MAAM,UAAU,kBAAkB,CAChC,GAAW,EACX,IAAY,EACZ,YAAsC,EACtC,OAAoC;IAKpC,MAAM,WAAW,GAA6B,EAAE,CAAC;IACjD,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe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AAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe,CAAC;IACjC,OAAO,CACL,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE;QAC3B,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC/C,eAAe,CAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type XmlElement } from "./xml.js";
2
+ export declare function responseValues(declaration: XmlElement | undefined): string[];
3
+ export declare function pairValues(declaration: XmlElement | undefined): {
4
+ sourceIdentifier: string;
5
+ targetIdentifier: string;
6
+ }[];
7
+ export declare function orderedIdentifierValues(declaration: XmlElement | undefined): string[];
8
+ export declare function hasMapping(declaration: XmlElement | undefined): boolean;
9
+ //# sourceMappingURL=qti2-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti2-response.d.ts","sourceRoot":"","sources":["../src/qti2-response.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAElB,wBAAgB,cAAc,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,EAAE,CAO5E;AAED,wBAAgB,UAAU,CACxB,WAAW,EAAE,UAAU,GAAG,SAAS,GAClC;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,EAAE,CAU1D;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,EAAE,CAKrF;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAEvE"}
@@ -0,0 +1,32 @@
1
+ import { normalizeIdentifier } from "./text.js";
2
+ import { findAllDescendantsByLocalName, findDescendantByLocalName, textOf, } from "./xml.js";
3
+ export function responseValues(declaration) {
4
+ if (!declaration)
5
+ return [];
6
+ const correct = findDescendantByLocalName(declaration, "correctresponse");
7
+ const source = correct ?? declaration;
8
+ return findAllDescendantsByLocalName(source, "value")
9
+ .map((value) => textOf(value))
10
+ .filter(Boolean);
11
+ }
12
+ export function pairValues(declaration) {
13
+ return responseValues(declaration)
14
+ .map((value) => {
15
+ const [sourceIdentifier = "", targetIdentifier = ""] = value.split(/\s+/);
16
+ return {
17
+ sourceIdentifier: normalizeIdentifier(sourceIdentifier),
18
+ targetIdentifier: normalizeIdentifier(targetIdentifier),
19
+ };
20
+ })
21
+ .filter((pair) => pair.sourceIdentifier && pair.targetIdentifier);
22
+ }
23
+ export function orderedIdentifierValues(declaration) {
24
+ return responseValues(declaration)
25
+ .flatMap((value) => value.split(/\s+/))
26
+ .map((value) => normalizeIdentifier(value))
27
+ .filter(Boolean);
28
+ }
29
+ export function hasMapping(declaration) {
30
+ return Boolean(findDescendantByLocalName(declaration, "mapping"));
31
+ }
32
+ //# sourceMappingURL=qti2-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti2-response.js","sourceRoot":"","sources":["../src/qti2-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,MAAM,GAEP,MAAM,UAAU,CAAC;AAElB,MAAM,UAAU,cAAc,CAAC,WAAmC;IAChE,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,OAAO,IAAI,WAAW,CAAC;IACtC,OAAO,6BAA6B,CAAC,MAAM,EAAE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