@learnosity/lib-qti-converter 0.12.6 → 0.12.8

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 (37) hide show
  1. package/package.json +10 -9
  2. package/packages/cli/dist/batchProcessors-CUJoQD8a.js +3753 -0
  3. package/packages/cli/dist/batchProcessors-CUJoQD8a.js.map +1 -0
  4. package/packages/cli/dist/batchWorker.js +1 -1
  5. package/packages/cli/dist/{create-prompt-DU9wLVhI.js → create-prompt-DyNnKXYU.js} +63 -53
  6. package/packages/cli/dist/create-prompt-DyNnKXYU.js.map +1 -0
  7. package/packages/cli/dist/{dist-DjpU2mIj.js → dist-D3v6G5F8.js} +6 -6
  8. package/packages/cli/dist/{dist-DjpU2mIj.js.map → dist-D3v6G5F8.js.map} +1 -1
  9. package/packages/cli/dist/{learnosityToQti-CXDJoJpl.js → learnosityToQti-CvfVQ6Kl.js} +4 -4
  10. package/packages/cli/dist/{learnosityToQti-CXDJoJpl.js.map → learnosityToQti-CvfVQ6Kl.js.map} +1 -1
  11. package/packages/cli/dist/{learnosityToQtiPackage-7v-s4ybk.js → learnosityToQtiPackage-CXMsJNQD.js} +7 -8
  12. package/packages/cli/dist/{learnosityToQtiPackage-7v-s4ybk.js.map → learnosityToQtiPackage-CXMsJNQD.js.map} +1 -1
  13. package/packages/cli/dist/main.js +7 -7
  14. package/packages/cli/dist/main.js.map +1 -1
  15. package/packages/cli/dist/nodeFileAccess-BhCoGDOi.js +294 -0
  16. package/packages/cli/dist/nodeFileAccess-BhCoGDOi.js.map +1 -0
  17. package/packages/cli/dist/{pathUtils-CgoDQyJk.js → pathUtils-DmtCfutO.js} +27 -167
  18. package/packages/cli/dist/pathUtils-DmtCfutO.js.map +1 -0
  19. package/packages/cli/dist/{qtiPackageToLearnosity-hT4QZ7YX.js → qtiPackageToLearnosity-FhfNr7gf.js} +5 -5
  20. package/packages/cli/dist/{qtiPackageToLearnosity-hT4QZ7YX.js.map → qtiPackageToLearnosity-FhfNr7gf.js.map} +1 -1
  21. package/packages/cli/dist/{qtiToLearnosity-BU7mHhIu.js → qtiToLearnosity-5lQ5f3-t.js} +5 -5
  22. package/packages/cli/dist/{qtiToLearnosity-BU7mHhIu.js.map → qtiToLearnosity-5lQ5f3-t.js.map} +1 -1
  23. package/packages/cli/dist/resolveOptions-lHxSyq9F.js +2879 -0
  24. package/packages/cli/dist/resolveOptions-lHxSyq9F.js.map +1 -0
  25. package/packages/cli/dist/{resolveOptions-ehwJSkQy.js → table-7b-8MN2z.js} +2520 -2883
  26. package/packages/cli/dist/table-7b-8MN2z.js.map +1 -0
  27. package/packages/core/dist/index.d.ts +184 -184
  28. package/packages/core/dist/index.js +90 -64
  29. package/packages/core/dist/node.d.ts +196 -196
  30. package/packages/core/dist/node.js +95 -66
  31. package/packages/cli/dist/batchProcessors-C8k2v0o_.js +0 -217
  32. package/packages/cli/dist/batchProcessors-C8k2v0o_.js.map +0 -1
  33. package/packages/cli/dist/create-prompt-DU9wLVhI.js.map +0 -1
  34. package/packages/cli/dist/pathUtils-CgoDQyJk.js.map +0 -1
  35. package/packages/cli/dist/resolveOptions-ehwJSkQy.js.map +0 -1
  36. package/packages/cli/dist/table-DYcNeyJ_.js +0 -2306
  37. package/packages/cli/dist/table-DYcNeyJ_.js.map +0 -1
@@ -0,0 +1,294 @@
1
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
2
+ import { closeSync, existsSync, openSync, readFileSync, readSync, realpathSync } from "fs";
3
+ //#region ../core/src/qti-to-learnosity/utils/passageResolver.ts
4
+ /**
5
+ * Passage HTML file resolver
6
+ * Resolves and reads external HTML files referenced by <object> tags in QTI passages
7
+ */
8
+ /**
9
+ * Resolve `candidate` and confirm it stays inside `root`.
10
+ *
11
+ * The `data` attribute of an <object> tag comes from the QTI file being
12
+ * converted, which is untrusted input. Without this check a crafted value such
13
+ * as "../../../../etc/passwd" would let a QTI package read arbitrary files.
14
+ *
15
+ * @param candidate - Path to check (absolute or already joined)
16
+ * @param root - Directory the path must stay within
17
+ * @returns Absolute path if contained by root, undefined otherwise
18
+ */
19
+ function containedPath$1(candidate, root) {
20
+ const resolvedRoot = resolve(root);
21
+ const resolvedCandidate = resolve(candidate);
22
+ const rel = relative(resolvedRoot, resolvedCandidate);
23
+ if (rel === "" || isAbsolute(rel) || rel.split(sep)[0] === "..") return;
24
+ return resolvedCandidate;
25
+ }
26
+ /**
27
+ * Resolve and read a passage HTML file referenced by an <object> tag
28
+ *
29
+ * @param objectDataPath - The path from the object's data attribute (e.g., "passages/passage.html")
30
+ * @param sourceFile - The absolute path to the source QTI XML file
31
+ * @returns The HTML content of the passage file, or undefined if not found
32
+ */
33
+ function resolvePassageFile(objectDataPath, sourceFile) {
34
+ if (!sourceFile || !objectDataPath) return;
35
+ const sourceDir = dirname(sourceFile);
36
+ const root = dirname(sourceDir);
37
+ const candidates = [];
38
+ if (isAbsolute(objectDataPath)) candidates.push(objectDataPath);
39
+ else {
40
+ candidates.push(join(sourceDir, objectDataPath));
41
+ candidates.push(join(root, objectDataPath));
42
+ }
43
+ for (const candidate of candidates) {
44
+ const passagePath = containedPath$1(candidate, root);
45
+ if (!passagePath || !existsSync(passagePath)) continue;
46
+ try {
47
+ return readFileSync(passagePath, "utf-8").replace(/^\uFEFF/, "");
48
+ } catch {
49
+ return;
50
+ }
51
+ }
52
+ }
53
+ //#endregion
54
+ //#region ../core/src/qti-to-learnosity/utils/lomFinder.ts
55
+ /**
56
+ * LOM file discovery utility
57
+ * Locates LOM metadata files for QTI items
58
+ */
59
+ /**
60
+ * Find LOM file for a given QTI item file path
61
+ * Checks for:
62
+ * - .../items/<id>.xml → .../metadata/<id>.lom.xml
63
+ * - <dir>/<id>.xml → <dir>/metadata/<id>.lom.xml
64
+ * - <dir>/<id>.xml → <dir>/../metadata/<id>.lom.xml
65
+ *
66
+ * @param itemPath - Absolute path to the QTI item XML file
67
+ * @returns LOM XML content if found, undefined otherwise
68
+ */
69
+ function findAndReadLomFile(itemPath) {
70
+ const dir = dirname(itemPath);
71
+ const lomFilename = `${basename(itemPath).replace(/\.xml$/i, "")}.lom.xml`;
72
+ if (dir.endsWith("/items") || dir.endsWith("\\items")) {
73
+ const parentDir = dirname(dir);
74
+ const lomPath = join(parentDir, "metadata", lomFilename);
75
+ if (existsSync(lomPath)) try {
76
+ return readFileSync(lomPath, "utf-8");
77
+ } catch {
78
+ return;
79
+ }
80
+ }
81
+ const lomPath1 = join(dir, "metadata", lomFilename);
82
+ if (existsSync(lomPath1)) try {
83
+ return readFileSync(lomPath1, "utf-8");
84
+ } catch {
85
+ return;
86
+ }
87
+ const lomPath2 = join(dir, "..", "metadata", lomFilename);
88
+ if (existsSync(lomPath2)) try {
89
+ return readFileSync(lomPath2, "utf-8");
90
+ } catch {
91
+ return;
92
+ }
93
+ }
94
+ //#endregion
95
+ //#region ../core/src/qti-to-learnosity/utils/imageDimensions.ts
96
+ /**
97
+ * Image dimension resolver
98
+ *
99
+ * Resolves an image file referenced by a QTI `<object data="...">` /
100
+ * `<img src="...">` tag and reads its intrinsic pixel dimensions directly from
101
+ * the file header. This is a dependency-free reader for the formats commonly
102
+ * found in QTI packages (GIF, PNG, JPEG). It reads only the small header region
103
+ * needed to determine dimensions, not the whole file.
104
+ *
105
+ * QTI legitimately allows an `<object>` without width/height attributes, but
106
+ * some Learnosity question types (e.g. hotspot) need pixel dimensions to convert
107
+ * absolute coordinates into percentages. When the markup omits them, the
108
+ * dimensions are recovered from the referenced image file.
109
+ */
110
+ /**
111
+ * Only the leading bytes of an image are needed to read its dimensions: GIF and
112
+ * PNG carry them in the first ~24 bytes, and a JPEG's first Start-Of-Frame
113
+ * marker is virtually always within the first segments. Cap the read so a huge
114
+ * asset can never be loaded whole into memory.
115
+ */
116
+ const MAX_HEADER_BYTES = 65536;
117
+ /**
118
+ * Check that `resolvedCandidate` stays lexically inside `resolvedRoot`.
119
+ *
120
+ * Both arguments must already be absolute/normalised. Returns true when the
121
+ * candidate is contained (and is not the root itself).
122
+ */
123
+ function isContained(resolvedCandidate, resolvedRoot) {
124
+ const rel = relative(resolvedRoot, resolvedCandidate);
125
+ return rel !== "" && !isAbsolute(rel) && rel.split(sep)[0] !== "..";
126
+ }
127
+ /**
128
+ * Resolve `candidate` and confirm it stays inside `root`, both lexically and
129
+ * after dereferencing symlinks.
130
+ *
131
+ * The `data`/`src` attribute comes from the QTI file being converted, which is
132
+ * untrusted input. A lexical check alone is insufficient: a package could place
133
+ * a symlink under `root` that targets a file outside it (e.g. `/dev/zero`), so
134
+ * the real path is re-verified against the real root before it is returned for
135
+ * reading.
136
+ *
137
+ * @returns The real (symlink-dereferenced) absolute path if contained, else undefined.
138
+ */
139
+ function containedPath(candidate, root) {
140
+ const resolvedRoot = resolve(root);
141
+ const resolvedCandidate = resolve(candidate);
142
+ if (!isContained(resolvedCandidate, resolvedRoot)) return;
143
+ if (!existsSync(resolvedCandidate)) return;
144
+ let realCandidate;
145
+ let realRoot;
146
+ try {
147
+ realCandidate = realpathSync(resolvedCandidate);
148
+ realRoot = realpathSync(resolvedRoot);
149
+ } catch {
150
+ return;
151
+ }
152
+ if (!isContained(realCandidate, realRoot)) return;
153
+ return realCandidate;
154
+ }
155
+ /**
156
+ * Read up to {@link MAX_HEADER_BYTES} from the start of a file without loading
157
+ * the whole file into memory. Returns the bytes actually read.
158
+ */
159
+ function readHeaderBytes(path) {
160
+ let fd;
161
+ try {
162
+ fd = openSync(path, "r");
163
+ const buf = Buffer.alloc(MAX_HEADER_BYTES);
164
+ const bytesRead = readSync(fd, buf, 0, MAX_HEADER_BYTES, 0);
165
+ return buf.subarray(0, bytesRead);
166
+ } catch {
167
+ return;
168
+ } finally {
169
+ if (fd !== void 0) try {
170
+ closeSync(fd);
171
+ } catch {}
172
+ }
173
+ }
174
+ /**
175
+ * Read image dimensions from an in-memory file header buffer.
176
+ * Exported for unit testing without touching the filesystem.
177
+ *
178
+ * Supports GIF (87a/89a), PNG, and JPEG (baseline and progressive).
179
+ *
180
+ * @param buf - The image file bytes (at least the header region)
181
+ * @returns The pixel dimensions, or undefined if the format is unrecognised
182
+ */
183
+ function readImageDimensionsFromBuffer(buf) {
184
+ if (buf.length >= 10 && buf[0] === 71 && buf[1] === 73 && buf[2] === 70) {
185
+ const width = buf.readUInt16LE(6);
186
+ const height = buf.readUInt16LE(8);
187
+ if (width > 0 && height > 0) return {
188
+ width,
189
+ height
190
+ };
191
+ return;
192
+ }
193
+ if (buf.length >= 24 && buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71) {
194
+ const width = buf.readUInt32BE(16);
195
+ const height = buf.readUInt32BE(20);
196
+ if (width > 0 && height > 0) return {
197
+ width,
198
+ height
199
+ };
200
+ return;
201
+ }
202
+ if (buf.length >= 4 && buf[0] === 255 && buf[1] === 216) {
203
+ let offset = 2;
204
+ while (offset + 9 < buf.length) {
205
+ if (buf[offset] !== 255) {
206
+ offset++;
207
+ continue;
208
+ }
209
+ let markerOffset = offset;
210
+ while (markerOffset < buf.length && buf[markerOffset] === 255) markerOffset++;
211
+ if (markerOffset >= buf.length) break;
212
+ const marker = buf[markerOffset];
213
+ const segmentStart = markerOffset + 1;
214
+ if (marker === 0) {
215
+ offset = segmentStart;
216
+ continue;
217
+ }
218
+ if (marker === 216 || marker === 217 || marker >= 208 && marker <= 215) {
219
+ offset = segmentStart;
220
+ continue;
221
+ }
222
+ if (segmentStart + 1 >= buf.length) break;
223
+ const segmentLength = buf.readUInt16BE(segmentStart);
224
+ if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
225
+ if (segmentStart + 6 >= buf.length) break;
226
+ const height = buf.readUInt16BE(segmentStart + 3);
227
+ const width = buf.readUInt16BE(segmentStart + 5);
228
+ if (width > 0 && height > 0) return {
229
+ width,
230
+ height
231
+ };
232
+ return;
233
+ }
234
+ offset = segmentStart + segmentLength;
235
+ }
236
+ }
237
+ }
238
+ /**
239
+ * Resolve and read the intrinsic dimensions of an image referenced by a QTI
240
+ * `<object>`/`<img>` tag.
241
+ *
242
+ * Security model: the `objectDataPath` comes from untrusted QTI markup, so every
243
+ * resolved path is confined to a containment root before it is read.
244
+ *
245
+ * - When `packageRoot` is supplied (the normal case for package conversion), any
246
+ * asset located anywhere inside the package is allowed — including assets a
247
+ * sibling directory up, e.g. `questions/item.xml` referencing
248
+ * `../images/foo.png`. This does not rely on directory names.
249
+ * - When `packageRoot` is omitted (in-memory callers with no package context),
250
+ * the read is confined to the source file's own directory. This is the safe
251
+ * default: no path is read from outside where the item lives.
252
+ *
253
+ * @param objectDataPath - Path from the data/src attribute (e.g. "754493.gif")
254
+ * @param sourceFile - Absolute path to the source QTI XML file
255
+ * @param packageRoot - Absolute path to the package root that bounds all reads
256
+ * @returns The image dimensions, or undefined if it cannot be resolved/read.
257
+ */
258
+ function resolveImageDimensions(objectDataPath, sourceFile, packageRoot) {
259
+ if (!sourceFile || !objectDataPath) return;
260
+ const sourceDir = dirname(sourceFile);
261
+ let root = sourceDir;
262
+ let shouldTryPackageRoot = false;
263
+ if (packageRoot) {
264
+ const resolvedRoot = resolve(packageRoot);
265
+ const resolvedSourceDir = resolve(sourceDir);
266
+ const rel = relative(resolvedRoot, resolvedSourceDir);
267
+ const sourceInsideRoot = rel === "" || !isAbsolute(rel) && rel.split(sep)[0] !== "..";
268
+ root = sourceInsideRoot ? resolvedRoot : resolvedSourceDir;
269
+ shouldTryPackageRoot = sourceInsideRoot && resolvedRoot !== resolvedSourceDir;
270
+ }
271
+ const candidates = [];
272
+ if (isAbsolute(objectDataPath)) candidates.push(objectDataPath);
273
+ else {
274
+ candidates.push(join(sourceDir, objectDataPath));
275
+ if (shouldTryPackageRoot) candidates.push(join(root, objectDataPath));
276
+ }
277
+ for (const candidate of candidates) {
278
+ const imagePath = containedPath(candidate, root);
279
+ if (!imagePath) continue;
280
+ const buf = readHeaderBytes(imagePath);
281
+ if (buf) return readImageDimensionsFromBuffer(buf);
282
+ }
283
+ }
284
+ //#endregion
285
+ //#region ../core/src/qti-to-learnosity/nodeFileAccess.ts
286
+ const nodeFileAccess = {
287
+ resolvePassageFile,
288
+ findAndReadLomFile,
289
+ resolveImageDimensions
290
+ };
291
+ //#endregion
292
+ export { nodeFileAccess as t };
293
+
294
+ //# sourceMappingURL=nodeFileAccess-BhCoGDOi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeFileAccess-BhCoGDOi.js","names":["containedPath"],"sources":["../../core/src/qti-to-learnosity/utils/passageResolver.ts","../../core/src/qti-to-learnosity/utils/lomFinder.ts","../../core/src/qti-to-learnosity/utils/imageDimensions.ts","../../core/src/qti-to-learnosity/nodeFileAccess.ts"],"sourcesContent":["/**\n * Passage HTML file resolver\n * Resolves and reads external HTML files referenced by <object> tags in QTI passages\n */\n\nimport { existsSync, readFileSync } from 'fs';\nimport { dirname, join, isAbsolute, resolve, relative, sep } from 'path';\n\n/**\n * Resolve `candidate` and confirm it stays inside `root`.\n *\n * The `data` attribute of an <object> tag comes from the QTI file being\n * converted, which is untrusted input. Without this check a crafted value such\n * as \"../../../../etc/passwd\" would let a QTI package read arbitrary files.\n *\n * @param candidate - Path to check (absolute or already joined)\n * @param root - Directory the path must stay within\n * @returns Absolute path if contained by root, undefined otherwise\n */\nfunction containedPath(candidate: string, root: string): string | undefined {\n // These two resolve() calls are the sanitiser, not a sink: normalising both\n // sides is what makes the relative() comparison below meaningful.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const resolvedRoot = resolve(root);\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const resolvedCandidate = resolve(candidate);\n const rel = relative(resolvedRoot, resolvedCandidate);\n\n // Empty means the candidate is the root itself; a leading \"..\" segment or an\n // absolute result means it escaped the root (e.g. a different drive).\n if (rel === '' || isAbsolute(rel) || rel.split(sep)[0] === '..') {\n return undefined;\n }\n\n return resolvedCandidate;\n}\n\n/**\n * Resolve and read a passage HTML file referenced by an <object> tag\n *\n * @param objectDataPath - The path from the object's data attribute (e.g., \"passages/passage.html\")\n * @param sourceFile - The absolute path to the source QTI XML file\n * @returns The HTML content of the passage file, or undefined if not found\n */\nexport function resolvePassageFile(\n objectDataPath: string,\n sourceFile?: string\n): string | undefined {\n if (!sourceFile || !objectDataPath) {\n return undefined;\n }\n\n // Get the directory containing the source XML file\n const sourceDir = dirname(sourceFile);\n\n // Passages sit either beside the item (passages/passage.html) or one level\n // up (items/item.xml -> ../passages/passage.html), so the parent directory\n // is the widest location a passage may legitimately be read from.\n const root = dirname(sourceDir);\n\n // Candidates, in priority order: relative to the source directory, then\n // relative to its parent. Absolute values are taken as-is. Each one is passed\n // through containedPath() below before it reaches the filesystem.\n const candidates: string[] = [];\n\n if (isAbsolute(objectDataPath)) {\n candidates.push(objectDataPath);\n } else {\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n candidates.push(join(sourceDir, objectDataPath));\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n candidates.push(join(root, objectDataPath));\n }\n\n for (const candidate of candidates) {\n // Every candidate is confined to `root` before it reaches the filesystem\n const passagePath = containedPath(candidate, root);\n\n if (!passagePath || !existsSync(passagePath)) {\n continue;\n }\n\n try {\n return readFileSync(passagePath, 'utf-8').replace(/^\\uFEFF/, '');\n } catch {\n // File exists but couldn't be read\n return undefined;\n }\n }\n\n return undefined;\n}\n\n","/**\n * LOM file discovery utility\n * Locates LOM metadata files for QTI items\n */\n\nimport { existsSync, readFileSync } from 'fs';\nimport { dirname, basename, join } from 'path';\n\n/**\n * Find LOM file for a given QTI item file path\n * Checks for:\n * - .../items/<id>.xml → .../metadata/<id>.lom.xml\n * - <dir>/<id>.xml → <dir>/metadata/<id>.lom.xml\n * - <dir>/<id>.xml → <dir>/../metadata/<id>.lom.xml\n *\n * @param itemPath - Absolute path to the QTI item XML file\n * @returns LOM XML content if found, undefined otherwise\n */\nexport function findAndReadLomFile(itemPath: string): string | undefined {\n const dir = dirname(itemPath);\n const filename = basename(itemPath);\n const itemId = filename.replace(/\\.xml$/i, '');\n\n // basename() strips every directory separator, so lomFilename cannot carry\n // traversal segments. The joins below stay within dir or its parent, both of\n // which are derived from the item path the operator asked us to convert.\n const lomFilename = `${itemId}.lom.xml`;\n\n // Pattern 1: .../items/<id>.xml → .../metadata/<id>.lom.xml (sibling folder)\n if (dir.endsWith('/items') || dir.endsWith('\\\\items')) {\n const parentDir = dirname(dir);\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const lomPath = join(parentDir, 'metadata', lomFilename);\n\n if (existsSync(lomPath)) {\n try {\n return readFileSync(lomPath, 'utf-8');\n } catch {\n return undefined;\n }\n }\n }\n\n // Pattern 2: <dir>/<id>.xml → <dir>/metadata/<id>.lom.xml\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const lomPath1 = join(dir, 'metadata', lomFilename);\n\n if (existsSync(lomPath1)) {\n try {\n return readFileSync(lomPath1, 'utf-8');\n } catch {\n return undefined;\n }\n }\n\n // Pattern 3: <dir>/<id>.xml → <dir>/../metadata/<id>.lom.xml\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const lomPath2 = join(dir, '..', 'metadata', lomFilename);\n\n if (existsSync(lomPath2)) {\n try {\n return readFileSync(lomPath2, 'utf-8');\n } catch {\n return undefined;\n }\n }\n\n return undefined;\n}\n","/**\n * Image dimension resolver\n *\n * Resolves an image file referenced by a QTI `<object data=\"...\">` /\n * `<img src=\"...\">` tag and reads its intrinsic pixel dimensions directly from\n * the file header. This is a dependency-free reader for the formats commonly\n * found in QTI packages (GIF, PNG, JPEG). It reads only the small header region\n * needed to determine dimensions, not the whole file.\n *\n * QTI legitimately allows an `<object>` without width/height attributes, but\n * some Learnosity question types (e.g. hotspot) need pixel dimensions to convert\n * absolute coordinates into percentages. When the markup omits them, the\n * dimensions are recovered from the referenced image file.\n */\n\nimport { existsSync, closeSync, openSync, readSync, realpathSync } from 'fs';\nimport { dirname, join, isAbsolute, resolve, relative, sep } from 'path';\n\nexport interface ImageDimensions {\n width: number;\n height: number;\n}\n\n/**\n * Only the leading bytes of an image are needed to read its dimensions: GIF and\n * PNG carry them in the first ~24 bytes, and a JPEG's first Start-Of-Frame\n * marker is virtually always within the first segments. Cap the read so a huge\n * asset can never be loaded whole into memory.\n */\nconst MAX_HEADER_BYTES = 64 * 1024;\n\n/**\n * Check that `resolvedCandidate` stays lexically inside `resolvedRoot`.\n *\n * Both arguments must already be absolute/normalised. Returns true when the\n * candidate is contained (and is not the root itself).\n */\nfunction isContained(resolvedCandidate: string, resolvedRoot: string): boolean {\n const rel = relative(resolvedRoot, resolvedCandidate);\n\n return rel !== '' && !isAbsolute(rel) && rel.split(sep)[0] !== '..';\n}\n\n/**\n * Resolve `candidate` and confirm it stays inside `root`, both lexically and\n * after dereferencing symlinks.\n *\n * The `data`/`src` attribute comes from the QTI file being converted, which is\n * untrusted input. A lexical check alone is insufficient: a package could place\n * a symlink under `root` that targets a file outside it (e.g. `/dev/zero`), so\n * the real path is re-verified against the real root before it is returned for\n * reading.\n *\n * @returns The real (symlink-dereferenced) absolute path if contained, else undefined.\n */\nfunction containedPath(candidate: string, root: string): string | undefined {\n // These resolve() calls are the sanitiser, not a sink: normalising both\n // sides is what makes the relative() comparison below meaningful.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const resolvedRoot = resolve(root);\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const resolvedCandidate = resolve(candidate);\n\n // Lexical containment first (cheap, and rejects obvious \"../\" escapes even\n // when the target does not exist).\n if (!isContained(resolvedCandidate, resolvedRoot)) {\n return undefined;\n }\n\n if (!existsSync(resolvedCandidate)) {\n return undefined;\n }\n\n // Dereference symlinks on both sides and re-verify: this closes the gap\n // where a symlink inside root points outside it. If realpath fails (broken\n // link, race), treat as not resolvable.\n let realCandidate: string;\n let realRoot: string;\n\n try {\n realCandidate = realpathSync(resolvedCandidate);\n realRoot = realpathSync(resolvedRoot);\n } catch {\n return undefined;\n }\n\n if (!isContained(realCandidate, realRoot)) {\n return undefined;\n }\n\n return realCandidate;\n}\n\n/**\n * Read up to {@link MAX_HEADER_BYTES} from the start of a file without loading\n * the whole file into memory. Returns the bytes actually read.\n */\nfunction readHeaderBytes(path: string): Buffer | undefined {\n let fd: number | undefined;\n\n try {\n fd = openSync(path, 'r');\n const buf = Buffer.alloc(MAX_HEADER_BYTES);\n const bytesRead = readSync(fd, buf, 0, MAX_HEADER_BYTES, 0);\n\n return buf.subarray(0, bytesRead);\n } catch {\n return undefined;\n } finally {\n if (fd !== undefined) {\n try {\n closeSync(fd);\n } catch {\n // Best-effort close; nothing actionable if it fails.\n }\n }\n }\n}\n\n/**\n * Read image dimensions from an in-memory file header buffer.\n * Exported for unit testing without touching the filesystem.\n *\n * Supports GIF (87a/89a), PNG, and JPEG (baseline and progressive).\n *\n * @param buf - The image file bytes (at least the header region)\n * @returns The pixel dimensions, or undefined if the format is unrecognised\n */\nexport function readImageDimensionsFromBuffer(buf: Buffer): ImageDimensions | undefined {\n // GIF: \"GIF87a\" or \"GIF89a\"; width/height are little-endian uint16 at offset 6/8.\n if (\n buf.length >= 10 &&\n buf[0] === 0x47 && // G\n buf[1] === 0x49 && // I\n buf[2] === 0x46 // F\n ) {\n const width = buf.readUInt16LE(6);\n const height = buf.readUInt16LE(8);\n\n if (width > 0 && height > 0) {\n return { width, height };\n }\n\n return undefined;\n }\n\n // PNG: 8-byte signature, then IHDR with width/height as big-endian uint32\n // at offset 16/20.\n if (\n buf.length >= 24 &&\n buf[0] === 0x89 &&\n buf[1] === 0x50 && // P\n buf[2] === 0x4e && // N\n buf[3] === 0x47 // G\n ) {\n const width = buf.readUInt32BE(16);\n const height = buf.readUInt32BE(20);\n\n if (width > 0 && height > 0) {\n return { width, height };\n }\n\n return undefined;\n }\n\n // JPEG: starts with 0xFFD8. Scan marker segments for a Start Of Frame\n // (SOF0-SOF15, excluding non-SOF markers 0xC4/0xC8/0xCC) which carries\n // height/width as big-endian uint16.\n if (buf.length >= 4 && buf[0] === 0xff && buf[1] === 0xd8) {\n let offset = 2;\n\n while (offset + 9 < buf.length) {\n // A marker is 0xFF followed by a non-0xFF, non-0x00 marker code.\n // JPEG permits any number of 0xFF fill bytes before the marker code,\n // so skip the whole run of 0xFF and land on the marker byte itself.\n if (buf[offset] !== 0xff) {\n offset++;\n continue;\n }\n\n let markerOffset = offset;\n\n while (markerOffset < buf.length && buf[markerOffset] === 0xff) {\n markerOffset++;\n }\n\n if (markerOffset >= buf.length) {\n break;\n }\n\n const marker = buf[markerOffset];\n // The length field (if any) follows the marker code byte.\n const segmentStart = markerOffset + 1;\n\n // 0x00 after 0xFF is a stuffed byte inside entropy-coded data, not a\n // marker; skip past it and keep scanning.\n if (marker === 0x00) {\n offset = segmentStart;\n continue;\n }\n\n // Standalone markers without a length payload.\n if (marker === 0xd8 || marker === 0xd9 || (marker >= 0xd0 && marker <= 0xd7)) {\n offset = segmentStart;\n continue;\n }\n\n if (segmentStart + 1 >= buf.length) {\n break;\n }\n\n const segmentLength = buf.readUInt16BE(segmentStart);\n\n // SOF markers carrying frame dimensions (exclude DHT 0xC4, JPG 0xC8,\n // DAC 0xCC which share the 0xCn range but are not frame headers).\n const isSof =\n marker >= 0xc0 &&\n marker <= 0xcf &&\n marker !== 0xc4 &&\n marker !== 0xc8 &&\n marker !== 0xcc;\n\n if (isSof) {\n // SOF payload after the 2-byte length: precision (1 byte),\n // height (2 bytes), width (2 bytes).\n if (segmentStart + 6 >= buf.length) {\n break;\n }\n\n const height = buf.readUInt16BE(segmentStart + 3);\n const width = buf.readUInt16BE(segmentStart + 5);\n\n if (width > 0 && height > 0) {\n return { width, height };\n }\n\n return undefined;\n }\n\n // Advance past this segment: length field + its payload.\n offset = segmentStart + segmentLength;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolve and read the intrinsic dimensions of an image referenced by a QTI\n * `<object>`/`<img>` tag.\n *\n * Security model: the `objectDataPath` comes from untrusted QTI markup, so every\n * resolved path is confined to a containment root before it is read.\n *\n * - When `packageRoot` is supplied (the normal case for package conversion), any\n * asset located anywhere inside the package is allowed — including assets a\n * sibling directory up, e.g. `questions/item.xml` referencing\n * `../images/foo.png`. This does not rely on directory names.\n * - When `packageRoot` is omitted (in-memory callers with no package context),\n * the read is confined to the source file's own directory. This is the safe\n * default: no path is read from outside where the item lives.\n *\n * @param objectDataPath - Path from the data/src attribute (e.g. \"754493.gif\")\n * @param sourceFile - Absolute path to the source QTI XML file\n * @param packageRoot - Absolute path to the package root that bounds all reads\n * @returns The image dimensions, or undefined if it cannot be resolved/read.\n */\nexport function resolveImageDimensions(\n objectDataPath: string,\n sourceFile?: string,\n packageRoot?: string\n): ImageDimensions | undefined {\n if (!sourceFile || !objectDataPath) {\n return undefined;\n }\n\n const sourceDir = dirname(sourceFile);\n\n // The containment root: the package root when known (so any in-package asset\n // resolves regardless of directory naming), otherwise the item's own\n // directory. If a packageRoot is given but the source file somehow sits\n // outside it, fall back to the source directory rather than trusting it.\n let root = sourceDir;\n let shouldTryPackageRoot = false;\n\n if (packageRoot) {\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const resolvedRoot = resolve(packageRoot);\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const resolvedSourceDir = resolve(sourceDir);\n const rel = relative(resolvedRoot, resolvedSourceDir);\n const sourceInsideRoot = rel === '' || (!isAbsolute(rel) && rel.split(sep)[0] !== '..');\n\n root = sourceInsideRoot ? resolvedRoot : resolvedSourceDir;\n shouldTryPackageRoot = sourceInsideRoot && resolvedRoot !== resolvedSourceDir;\n }\n\n const candidates: string[] = [];\n\n if (isAbsolute(objectDataPath)) {\n candidates.push(objectDataPath);\n } else {\n // Resolve relative to the item first (most common), then relative to the\n // package root. Both are re-checked for containment before any read.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n candidates.push(join(sourceDir, objectDataPath));\n\n if (shouldTryPackageRoot) {\n // The candidate is rechecked by containedPath() for lexical and\n // realpath containment before it can reach the filesystem.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n candidates.push(join(root, objectDataPath));\n }\n }\n\n for (const candidate of candidates) {\n // containedPath dereferences symlinks and re-verifies containment, so\n // the returned path is safe to read.\n const imagePath = containedPath(candidate, root);\n\n if (!imagePath) {\n continue;\n }\n\n // Read only a bounded header region: enough for GIF/PNG and to scan the\n // early JPEG marker segments that carry frame dimensions, without\n // loading a potentially very large asset into memory.\n const buf = readHeaderBytes(imagePath);\n\n if (buf) {\n return readImageDimensionsFromBuffer(buf);\n }\n }\n\n return undefined;\n}\n","/**\n * Filesystem-backed {@link FileAccess} for Node.js callers (the CLI and\n * disk-based package conversion). Reads passage HTML and LOM metadata from the\n * local filesystem.\n *\n * This module imports Node built-ins (via the resolver helpers) and is therefore\n * NOT part of the browser-safe surface — it is wired in by Node entry points.\n */\nimport type { FileAccess } from './fileAccess.js';\nimport { resolvePassageFile } from './utils/passageResolver.js';\nimport { findAndReadLomFile } from './utils/lomFinder.js';\nimport { resolveImageDimensions } from './utils/imageDimensions.js';\n\nexport const nodeFileAccess: FileAccess = {\n resolvePassageFile,\n findAndReadLomFile,\n resolveImageDimensions,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAASA,gBAAc,WAAmB,MAAkC;CAIxE,MAAM,eAAe,QAAQ,IAAI;CAEjC,MAAM,oBAAoB,QAAQ,SAAS;CAC3C,MAAM,MAAM,SAAS,cAAc,iBAAiB;CAIpD,IAAI,QAAQ,MAAM,WAAW,GAAG,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,MACvD;CAGJ,OAAO;AACX;;;;;;;;AASA,SAAgB,mBACZ,gBACA,YACkB;CAClB,IAAI,CAAC,cAAc,CAAC,gBAChB;CAIJ,MAAM,YAAY,QAAQ,UAAU;CAKpC,MAAM,OAAO,QAAQ,SAAS;CAK9B,MAAM,aAAuB,CAAC;CAE9B,IAAI,WAAW,cAAc,GACzB,WAAW,KAAK,cAAc;MAC3B;EAEH,WAAW,KAAK,KAAK,WAAW,cAAc,CAAC;EAE/C,WAAW,KAAK,KAAK,MAAM,cAAc,CAAC;CAC9C;CAEA,KAAK,MAAM,aAAa,YAAY;EAEhC,MAAM,cAAcA,gBAAc,WAAW,IAAI;EAEjD,IAAI,CAAC,eAAe,CAAC,WAAW,WAAW,GACvC;EAGJ,IAAI;GACA,OAAO,aAAa,aAAa,OAAO,CAAC,CAAC,QAAQ,WAAW,EAAE;EACnE,QAAQ;GAEJ;EACJ;CACJ;AAGJ;;;;;;;;;;;;;;;;;ACzEA,SAAgB,mBAAmB,UAAsC;CACrE,MAAM,MAAM,QAAQ,QAAQ;CAO5B,MAAM,cAAc,GANH,SAAS,QACJ,CAAC,CAAC,QAAQ,WAAW,EAKf,EAAE;CAG9B,IAAI,IAAI,SAAS,QAAQ,KAAK,IAAI,SAAS,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as isEnterKey, b as isTabKey, c as usePrefix, d as useEffect, f as useState, h as isBackspaceKey, l as makeTheme, o as useKeypress, t as createPrompt } from "./create-prompt-DU9wLVhI.js";
3
- import { i as chalk$1, o as require_string_width } from "./table-DYcNeyJ_.js";
2
+ import { _ as isEnterKey, b as isTabKey, c as usePrefix, d as useEffect, f as useState, h as isBackspaceKey, l as makeTheme, o as useKeypress, t as createPrompt } from "./create-prompt-DyNnKXYU.js";
3
+ import { i as chalk$1, o as require_string_width, x as DiagnosticCode } from "./table-7b-8MN2z.js";
4
4
  import process$1 from "node:process";
5
5
  import { access, readFile } from "fs/promises";
6
6
  import { resolve } from "path";
7
7
  import os from "node:os";
8
8
  import { homedir } from "os";
9
9
  import tty from "node:tty";
10
- //#region ../../node_modules/.pnpm/@inquirer+input@5.1.3_@types+node@26.3.0/node_modules/@inquirer/input/dist/index.js
10
+ //#region ../../node_modules/.pnpm/@inquirer+input@5.1.6_@types+node@26.6.2/node_modules/@inquirer/input/dist/index.js
11
11
  const inputTheme = { validationFailureMode: "keep" };
12
12
  var dist_default = createPrompt((config, done) => {
13
13
  const { prefill = "tab" } = config;
@@ -76,152 +76,6 @@ var dist_default = createPrompt((config, done) => {
76
76
  ].filter((v) => v !== void 0).join(" "), error];
77
77
  });
78
78
  //#endregion
79
- //#region ../core/src/types.ts
80
- /**
81
- * Common diagnostic codes
82
- */
83
- const DiagnosticCode = {
84
- NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
85
- CONFIG_FILE_NOT_FOUND: "CONFIG_FILE_NOT_FOUND",
86
- CONFIG_FILE_INVALID_JSON: "CONFIG_FILE_INVALID_JSON",
87
- CONFIG_SCHEMA_INVALID: "CONFIG_SCHEMA_INVALID",
88
- CONFIG_UNKNOWN_KEY: "CONFIG_UNKNOWN_KEY",
89
- CONFIG_LOADED: "CONFIG_LOADED",
90
- CONFIG_DISABLED: "CONFIG_DISABLED",
91
- PACKAGE_ZIP_ENTRY_UNSAFE: "PACKAGE_ZIP_ENTRY_UNSAFE",
92
- PACKAGE_MANIFEST_MISSING: "PACKAGE_MANIFEST_MISSING",
93
- PACKAGE_MANIFEST_INVALID_XML: "PACKAGE_MANIFEST_INVALID_XML",
94
- MANIFEST_RESOURCE_UNKNOWN_TYPE: "MANIFEST_RESOURCE_UNKNOWN_TYPE",
95
- PACKAGE_ITEM_FILE_MISSING: "PACKAGE_ITEM_FILE_MISSING",
96
- PACKAGE_LOADED: "PACKAGE_LOADED",
97
- PACKAGE_WRITTEN: "PACKAGE_WRITTEN",
98
- PACKAGE_STYLESHEET_INCLUDED: "PACKAGE_STYLESHEET_INCLUDED",
99
- LRN_SCHEMA_INVALID: "LRN_SCHEMA_INVALID",
100
- LRN_MISSING_REQUIRED_FIELD: "LRN_MISSING_REQUIRED_FIELD",
101
- LRN_WIDGET_REF_NOT_FOUND: "LRN_WIDGET_REF_NOT_FOUND",
102
- LRN_UNSUPPORTED_QUESTION_TYPE: "LRN_UNSUPPORTED_QUESTION_TYPE",
103
- LRN_UNKNOWN_KEY: "LRN_UNKNOWN_KEY",
104
- LRN_FEATURE_REF_NOT_FOUND: "LRN_FEATURE_REF_NOT_FOUND",
105
- LRN_UNSUPPORTED_FEATURE_TYPE: "LRN_UNSUPPORTED_FEATURE_TYPE",
106
- LRN_ITEM_SHAPE_UNRECOGNIZED: "LRN_ITEM_SHAPE_UNRECOGNIZED",
107
- LRN_ITEM_SHAPE_FLAT_NORMALIZED: "LRN_ITEM_SHAPE_FLAT_NORMALIZED",
108
- LRN_TAGS_OBJECT_NORMALIZED: "LRN_TAGS_OBJECT_NORMALIZED",
109
- LRN_BUNDLE_DIR_NOT_FOUND: "LRN_BUNDLE_DIR_NOT_FOUND",
110
- LRN_MANIFEST_MISSING: "LRN_MANIFEST_MISSING",
111
- LRN_MANIFEST_INVALID_JSON: "LRN_MANIFEST_INVALID_JSON",
112
- LRN_MANIFEST_SCHEMA_INVALID: "LRN_MANIFEST_SCHEMA_INVALID",
113
- LRN_PATH_UNSAFE: "LRN_PATH_UNSAFE",
114
- LRN_ACTIVITY_FILE_INVALID_JSON: "LRN_ACTIVITY_FILE_INVALID_JSON",
115
- LRN_ITEM_FILE_MISSING: "LRN_ITEM_FILE_MISSING",
116
- LRN_ITEM_FILE_INVALID_JSON: "LRN_ITEM_FILE_INVALID_JSON",
117
- LRN_ITEM_CONVERSION_FAILED: "LRN_ITEM_CONVERSION_FAILED",
118
- LRN_ACTIVITY_FILE_MISSING: "LRN_ACTIVITY_FILE_MISSING",
119
- LRN_ACTIVITY_DUPLICATE_ITEM_REF: "LRN_ACTIVITY_DUPLICATE_ITEM_REF",
120
- LRN_MANIFEST_UNUSED_KEY: "LRN_MANIFEST_UNUSED_KEY",
121
- LRN_BUNDLE_AUTO_ACTIVITY_CREATED: "LRN_BUNDLE_AUTO_ACTIVITY_CREATED",
122
- LRN_MULTIPLE_QUESTIONS: "LRN_MULTIPLE_QUESTIONS",
123
- LRN_MISSING_STIMULUS: "LRN_MISSING_STIMULUS",
124
- LRN_INVALID_VALIDATION: "LRN_INVALID_VALIDATION",
125
- LRN_MISSING_CORRECT_RESPONSE: "LRN_MISSING_CORRECT_RESPONSE",
126
- LRN_ACTIVITY_NO_ITEMS: "LRN_ACTIVITY_NO_ITEMS",
127
- LRN_CLOZE_NO_PLACEHOLDERS: "LRN_CLOZE_NO_PLACEHOLDERS",
128
- LRN_CLOZE_VALID_RESPONSE_LEN_MISMATCH: "LRN_CLOZE_VALID_RESPONSE_LEN_MISMATCH",
129
- LRN_CLOZE_MISSING_CORRECT_RESPONSE: "LRN_CLOZE_MISSING_CORRECT_RESPONSE",
130
- LRN_CLOZE_UNSUPPORTED_SCORING: "LRN_CLOZE_UNSUPPORTED_SCORING",
131
- LRN_MATH_CLOZE_NO_PLACEHOLDERS: "LRN_MATH_CLOZE_NO_PLACEHOLDERS",
132
- LRN_MATH_CLOZE_VALIDATION_MISMATCH: "LRN_MATH_CLOZE_VALIDATION_MISMATCH",
133
- LRN_MATH_CLOZE_MISSING_IMAGE: "LRN_MATH_CLOZE_MISSING_IMAGE",
134
- LRN_LONGTEXT_UNSUPPORTED_VALIDATION_KEY: "LRN_LONGTEXT_UNSUPPORTED_VALIDATION_KEY",
135
- LRN_LONGTEXT_MAX_LENGTH_IGNORED: "LRN_LONGTEXT_MAX_LENGTH_IGNORED",
136
- LRN_LONGTEXT_MAX_SCORE_IGNORED: "LRN_LONGTEXT_MAX_SCORE_IGNORED",
137
- LRN_LONGTEXT_NO_STIMULUS: "LRN_LONGTEXT_NO_STIMULUS",
138
- LRN_PLAINTEXT_NO_STIMULUS: "LRN_PLAINTEXT_NO_STIMULUS",
139
- LRN_PLAINTEXT_PLACEHOLDER_IGNORED: "LRN_PLAINTEXT_PLACEHOLDER_IGNORED",
140
- LRN_PLAINTEXT_MAX_LENGTH_IGNORED: "LRN_PLAINTEXT_MAX_LENGTH_IGNORED",
141
- LRN_PLAINTEXT_UI_STYLE_IGNORED: "LRN_PLAINTEXT_UI_STYLE_IGNORED",
142
- LRN_SHORTTEXT_MISSING_CORRECT_RESPONSE: "LRN_SHORTTEXT_MISSING_CORRECT_RESPONSE",
143
- LRN_SHORTTEXT_UNSUPPORTED_SCORING: "LRN_SHORTTEXT_UNSUPPORTED_SCORING",
144
- LRN_CLOZEDROPDOWN_UNSUPPORTED_SCORING: "LRN_CLOZEDROPDOWN_UNSUPPORTED_SCORING",
145
- LRN_CLOZEASSOCIATION_NO_PLACEHOLDERS: "LRN_CLOZEASSOCIATION_NO_PLACEHOLDERS",
146
- LRN_CLOZEASSOCIATION_VALUE_COUNT_MISMATCH: "LRN_CLOZEASSOCIATION_VALUE_COUNT_MISMATCH",
147
- LRN_CLOZEASSOCIATION_INVALID_VALID_RESPONSE: "LRN_CLOZEASSOCIATION_INVALID_VALID_RESPONSE",
148
- LRN_CLOZEASSOCIATION_MISSING_POSSIBLE_RESPONSES: "LRN_CLOZEASSOCIATION_MISSING_POSSIBLE_RESPONSES",
149
- LRN_CLOZEASSOCIATION_UNSUPPORTED_SCORING: "LRN_CLOZEASSOCIATION_UNSUPPORTED_SCORING",
150
- LRN_CLOZEASSOCIATION_DUPLICATE_RESPONSE: "LRN_CLOZEASSOCIATION_DUPLICATE_RESPONSE",
151
- LRN_CLASSIFICATION_CELL_ORDER_ASSUMED: "LRN_CLASSIFICATION_CELL_ORDER_ASSUMED",
152
- LRN_TOKENHIGHLIGHT_UNSUPPORTED_SCORING: "LRN_TOKENHIGHLIGHT_UNSUPPORTED_SCORING",
153
- LRN_TOKENHIGHLIGHT_NO_TOKENS: "LRN_TOKENHIGHLIGHT_NO_TOKENS",
154
- LRN_TOKENHIGHLIGHT_INVALID_TOKEN_INDEX: "LRN_TOKENHIGHLIGHT_INVALID_TOKEN_INDEX",
155
- LRN_SHAREDPASSAGE_MISSING_CONTENT: "LRN_SHAREDPASSAGE_MISSING_CONTENT",
156
- LRN_LAYOUT_PARSE_WARNING: "LRN_LAYOUT_PARSE_WARNING",
157
- LRN_LAYOUT_WIDGET_REF_MISSING: "LRN_LAYOUT_WIDGET_REF_MISSING",
158
- CONTENT_MATHJAX_DOM_STRIPPED: "CONTENT_MATHJAX_DOM_STRIPPED",
159
- CONTENT_EDITOR_ARTEFACT_STRIPPED: "CONTENT_EDITOR_ARTEFACT_STRIPPED",
160
- CONTENT_HTML_UNSAFE: "CONTENT_HTML_UNSAFE",
161
- CONTENT_TOO_LARGE_SKIPPED: "CONTENT_TOO_LARGE_SKIPPED",
162
- CONTENT_HTML_VOID_ELEMENT_FIXED: "CONTENT_HTML_VOID_ELEMENT_FIXED",
163
- CONTENT_HTML_OBSOLETE_TAG_REPLACED: "CONTENT_HTML_OBSOLETE_TAG_REPLACED",
164
- CONTENT_REMOTE_ASSET_NOT_PACKAGED: "CONTENT_REMOTE_ASSET_NOT_PACKAGED",
165
- CONTENT_SIMPLE_FEATURE_CONVERTED: "CONTENT_SIMPLE_FEATURE_CONVERTED",
166
- CONTENT_HTML_STIMULUS_WRAPPED: "CONTENT_HTML_STIMULUS_WRAPPED",
167
- QTI_NO_CHOICES: "QTI_NO_CHOICES",
168
- QTI_NO_CORRECT_RESPONSE: "QTI_NO_CORRECT_RESPONSE",
169
- QTI_MISSING_INTERACTION: "QTI_MISSING_INTERACTION",
170
- QTI_STIMULUS_CREATED: "QTI_STIMULUS_CREATED",
171
- QTI_STIMULUS_INLINED_STANDALONE: "QTI_STIMULUS_INLINED_STANDALONE",
172
- QTI_UNSUPPORTED_INTERACTION: "QTI_UNSUPPORTED_INTERACTION",
173
- QTI_MISSING_RESPONSE_DECLARATION: "QTI_MISSING_RESPONSE_DECLARATION",
174
- QTI_MISSING_CORRECT_RESPONSE: "QTI_MISSING_CORRECT_RESPONSE",
175
- QTI_CHOICE_NO_TEXT: "QTI_CHOICE_NO_TEXT",
176
- QTI_PROMPT_MISSING: "QTI_PROMPT_MISSING",
177
- QTI_DTD_NOT_ALLOWED: "QTI_DTD_NOT_ALLOWED",
178
- QTI_TEXT_ENTRY_NO_DECLARATION: "QTI_TEXT_ENTRY_NO_DECLARATION",
179
- QTI_TEXT_ENTRY_MULTIPLE_VALUES: "QTI_TEXT_ENTRY_MULTIPLE_VALUES",
180
- QTI_ALT_RESPONSES_TRIMMED: "QTI_ALT_RESPONSES_TRIMMED",
181
- QTI_SHUFFLE_NOT_SUPPORTED: "QTI_SHUFFLE_NOT_SUPPORTED",
182
- QTI_METADATA_TAG_TOO_LONG: "QTI_METADATA_TAG_TOO_LONG",
183
- QTI_METADATA_TAG_TRUNCATED: "QTI_METADATA_TAG_TRUNCATED",
184
- QTI_EXTENDED_TEXT_MULTIPLE_INTERACTIONS: "QTI_EXTENDED_TEXT_MULTIPLE_INTERACTIONS",
185
- QTI_EXTENDED_TEXT_NO_DECLARATION: "QTI_EXTENDED_TEXT_NO_DECLARATION",
186
- QTI_MATCH_INVALID_STRUCTURE: "QTI_MATCH_INVALID_STRUCTURE",
187
- QTI_MATCH_INVALID_DIRECTED_PAIR: "QTI_MATCH_INVALID_DIRECTED_PAIR",
188
- QTI_MATCH_STEM_NOT_FOUND: "QTI_MATCH_STEM_NOT_FOUND",
189
- QTI_MATCH_OPTION_NOT_FOUND: "QTI_MATCH_OPTION_NOT_FOUND",
190
- QTI_ASSOCIATION_INVALID_STRUCTURE: "QTI_ASSOCIATION_INVALID_STRUCTURE",
191
- QTI_ASSOCIATION_INVALID_PAIR: "QTI_ASSOCIATION_INVALID_PAIR",
192
- QTI_ASSOCIATION_NO_CHOICES: "QTI_ASSOCIATION_NO_CHOICES",
193
- QTI_ASSOCIATION_CHOICE_NOT_FOUND: "QTI_ASSOCIATION_CHOICE_NOT_FOUND",
194
- QTI_GAPMATCH_INVALID_STRUCTURE: "QTI_GAPMATCH_INVALID_STRUCTURE",
195
- QTI_GAPMATCH_NO_GAPS: "QTI_GAPMATCH_NO_GAPS",
196
- QTI_GAPMATCH_NO_GAPTEXTS: "QTI_GAPMATCH_NO_GAPTEXTS",
197
- QTI_GAPMATCH_INVALID_PAIR: "QTI_GAPMATCH_INVALID_PAIR",
198
- QTI_GAPMATCH_GAP_NOT_FOUND: "QTI_GAPMATCH_GAP_NOT_FOUND",
199
- QTI_GAPMATCH_GAPTEXT_NOT_FOUND: "QTI_GAPMATCH_GAPTEXT_NOT_FOUND",
200
- QTI_INLINECHOICE_INVALID_STRUCTURE: "QTI_INLINECHOICE_INVALID_STRUCTURE",
201
- QTI_INLINECHOICE_NO_CHOICES: "QTI_INLINECHOICE_NO_CHOICES",
202
- QTI_INLINECHOICE_NO_INTERACTIONS: "QTI_INLINECHOICE_NO_INTERACTIONS",
203
- QTI_INLINECHOICE_MISSING_DECLARATION: "QTI_INLINECHOICE_MISSING_DECLARATION",
204
- QTI_INLINECHOICE_CHOICE_NOT_FOUND: "QTI_INLINECHOICE_CHOICE_NOT_FOUND",
205
- QTI_PASSAGE_ONLY_ITEM: "QTI_PASSAGE_ONLY_ITEM",
206
- QTI_PASSAGE_EMPTY_ITEMBODY: "QTI_PASSAGE_EMPTY_ITEMBODY",
207
- QTI_DRAWING_CONVERTED: "QTI_DRAWING_CONVERTED",
208
- QTI_MULTIPLE_INTERACTIONS: "QTI_MULTIPLE_INTERACTIONS",
209
- QTI_TEST_ROOT_MISSING: "QTI_TEST_ROOT_MISSING",
210
- QTI_TEST_NO_ITEM_REFS: "QTI_TEST_NO_ITEM_REFS",
211
- QTI_TEST_ITEMREF_MISSING_ID: "QTI_TEST_ITEMREF_MISSING_ID",
212
- QTI_PACKAGE_MANIFEST_MISSING: "QTI_PACKAGE_MANIFEST_MISSING",
213
- QTI_PACKAGE_TEST_NOT_FOUND: "QTI_PACKAGE_TEST_NOT_FOUND",
214
- QTI_PACKAGE_ITEM_NOT_FOUND: "QTI_PACKAGE_ITEM_NOT_FOUND",
215
- QTI_PACKAGE_MULTIPLE_TESTS: "QTI_PACKAGE_MULTIPLE_TESTS",
216
- QTI_PACKAGE_NO_CONTENT: "QTI_PACKAGE_NO_CONTENT",
217
- QTI_PACKAGE_DUPLICATE_IDENTIFIER: "QTI_PACKAGE_DUPLICATE_IDENTIFIER",
218
- QTI_ITEM_CONVERSION_FAILED: "QTI_ITEM_CONVERSION_FAILED",
219
- LRN_BUNDLE_WRITTEN: "LRN_BUNDLE_WRITTEN",
220
- QTI_DOWNGRADE_NAMESPACE: "QTI_DOWNGRADE_NAMESPACE",
221
- QTI_DOWNGRADE_SCHEMA_LOCATION: "QTI_DOWNGRADE_SCHEMA_LOCATION",
222
- QTI_DOWNGRADE_IDENTIFIER_SANITIZED: "QTI_DOWNGRADE_IDENTIFIER_SANITIZED"
223
- };
224
- //#endregion
225
79
  //#region ../../node_modules/.pnpm/ansi-regex@6.3.0/node_modules/ansi-regex/index.js
226
80
  function ansiRegex({ onlyFirst = false } = {}) {
227
81
  return new RegExp(`(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
@@ -724,11 +578,15 @@ const wideRanges = [
724
578
  94192,
725
579
  94198,
726
580
  94208,
727
- 101589,
581
+ 101594,
728
582
  101631,
729
- 101662,
583
+ 101664,
730
584
  101760,
731
585
  101874,
586
+ 101888,
587
+ 102801,
588
+ 102816,
589
+ 102866,
732
590
  110576,
733
591
  110579,
734
592
  110581,
@@ -736,7 +594,7 @@ const wideRanges = [
736
594
  110589,
737
595
  110590,
738
596
  110592,
739
- 110882,
597
+ 110888,
740
598
  110898,
741
599
  110898,
742
600
  110928,
@@ -744,7 +602,7 @@ const wideRanges = [
744
602
  110933,
745
603
  110933,
746
604
  110948,
747
- 110951,
605
+ 110952,
748
606
  110960,
749
607
  111355,
750
608
  119552,
@@ -759,6 +617,8 @@ const wideRanges = [
759
617
  127374,
760
618
  127377,
761
619
  127386,
620
+ 127406,
621
+ 127406,
762
622
  127488,
763
623
  127490,
764
624
  127504,
@@ -812,13 +672,15 @@ const wideRanges = [
812
672
  128720,
813
673
  128722,
814
674
  128725,
815
- 128728,
675
+ 128729,
816
676
  128732,
817
677
  128735,
818
678
  128747,
819
679
  128748,
820
680
  128756,
821
681
  128764,
682
+ 128986,
683
+ 128986,
822
684
  128992,
823
685
  129003,
824
686
  129008,
@@ -832,24 +694,22 @@ const wideRanges = [
832
694
  129648,
833
695
  129660,
834
696
  129664,
835
- 129674,
836
- 129678,
837
697
  129734,
838
698
  129736,
839
699
  129736,
840
- 129741,
841
- 129756,
700
+ 129740,
701
+ 129757,
842
702
  129759,
843
- 129770,
703
+ 129771,
844
704
  129775,
845
- 129784,
705
+ 129786,
846
706
  131072,
847
707
  196605,
848
708
  196608,
849
709
  262141
850
710
  ];
851
711
  //#endregion
852
- //#region ../../node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/utilities.js
712
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.7.0/node_modules/get-east-asian-width/utilities.js
853
713
  /**
854
714
  Binary search on a sorted flat array of [start, end] pairs.
855
715
 
@@ -870,7 +730,7 @@ const isInRange = (ranges, codePoint) => {
870
730
  return false;
871
731
  };
872
732
  //#endregion
873
- //#region ../../node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/lookup.js
733
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.7.0/node_modules/get-east-asian-width/lookup.js
874
734
  const commonCjkCodePoint = 19968;
875
735
  const [wideFastPathStart, wideFastPathEnd] = /* #__PURE__ */ findWideFastPathRange(wideRanges);
876
736
  function findWideFastPathRange(ranges) {
@@ -891,7 +751,7 @@ const isAmbiguous = (codePoint) => {
891
751
  if (codePoint < 161 || codePoint > 1114109) return false;
892
752
  return isInRange(ambiguousRanges, codePoint);
893
753
  };
894
- const isFullWidth = (codePoint) => {
754
+ const isFullwidth = (codePoint) => {
895
755
  if (codePoint < 12288 || codePoint > 65510) return false;
896
756
  return isInRange(fullwidthRanges, codePoint);
897
757
  };
@@ -901,13 +761,13 @@ const isWide = (codePoint) => {
901
761
  return isInRange(wideRanges, codePoint);
902
762
  };
903
763
  //#endregion
904
- //#region ../../node_modules/.pnpm/get-east-asian-width@1.6.0/node_modules/get-east-asian-width/index.js
764
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.7.0/node_modules/get-east-asian-width/index.js
905
765
  function validate(codePoint) {
906
766
  if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
907
767
  }
908
768
  function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
909
769
  validate(codePoint);
910
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
770
+ if (isFullwidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
911
771
  return 1;
912
772
  }
913
773
  //#endregion
@@ -2382,6 +2242,6 @@ function expandTilde(filePath) {
2382
2242
  return filePath;
2383
2243
  }
2384
2244
  //#endregion
2385
- export { chalk as a, DiagnosticCode as c, boxen as i, dist_default as l, loadConfig as n, eastAsianWidth as o, showBanner as r, stripAnsi as s, expandTilde as t };
2245
+ export { chalk as a, dist_default as c, boxen as i, loadConfig as n, eastAsianWidth as o, showBanner as r, stripAnsi as s, expandTilde as t };
2386
2246
 
2387
- //# sourceMappingURL=pathUtils-CgoDQyJk.js.map
2247
+ //# sourceMappingURL=pathUtils-DmtCfutO.js.map