documents.js 1.62.0 → 1.64.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 (196) hide show
  1. package/README.md +150 -24
  2. package/dist/convert/convert.cjs +72 -20
  3. package/dist/convert/convert.d.cts +6 -2
  4. package/dist/convert/convert.d.ts +6 -2
  5. package/dist/convert/convert.js +73 -21
  6. package/dist/convert/local.cjs +15 -2
  7. package/dist/convert/local.js +15 -2
  8. package/dist/convert/port.d.cts +8 -4
  9. package/dist/convert/port.d.ts +8 -4
  10. package/dist/edit/docx/content.d.cts +1 -1
  11. package/dist/edit/docx/content.d.ts +1 -1
  12. package/dist/edit/docx/paragraph.d.cts +3 -3
  13. package/dist/edit/docx/paragraph.d.ts +3 -3
  14. package/dist/edit/ods/address.cjs +42 -24
  15. package/dist/edit/ods/address.d.cts +12 -2
  16. package/dist/edit/ods/address.d.ts +12 -2
  17. package/dist/edit/ods/address.js +39 -25
  18. package/dist/edit/ods/column-row.cjs +68 -6
  19. package/dist/edit/ods/column-row.d.cts +5 -1
  20. package/dist/edit/ods/column-row.d.ts +5 -1
  21. package/dist/edit/ods/column-row.js +68 -10
  22. package/dist/edit/ods/content.cjs +10 -2
  23. package/dist/edit/ods/content.js +10 -2
  24. package/dist/edit/ods/floating.cjs +90 -0
  25. package/dist/edit/ods/floating.d.cts +7 -0
  26. package/dist/edit/ods/floating.d.ts +7 -0
  27. package/dist/edit/ods/floating.js +88 -0
  28. package/dist/edit/ods/print-settings.cjs +158 -2
  29. package/dist/edit/ods/print-settings.js +159 -3
  30. package/dist/edit/ods/sheet.cjs +13 -0
  31. package/dist/edit/ods/sheet.d.cts +5 -1
  32. package/dist/edit/ods/sheet.d.ts +5 -1
  33. package/dist/edit/ods/sheet.js +14 -1
  34. package/dist/edit/odt/content.cjs +8 -4
  35. package/dist/edit/odt/content.js +8 -4
  36. package/dist/edit/odt/editor.cjs +7 -0
  37. package/dist/edit/odt/editor.d.cts +3 -0
  38. package/dist/edit/odt/editor.d.ts +3 -0
  39. package/dist/edit/odt/editor.js +7 -0
  40. package/dist/edit/odt/formula.cjs +19 -0
  41. package/dist/edit/odt/formula.d.cts +8 -0
  42. package/dist/edit/odt/formula.d.ts +8 -0
  43. package/dist/edit/odt/formula.js +17 -0
  44. package/dist/evaluate-BU5N1Jk1.d.ts +11 -0
  45. package/dist/evaluate-BhMXY6DM.d.cts +11 -0
  46. package/dist/firebird/backup.d.cts +1 -1
  47. package/dist/firebird/backup.d.ts +1 -1
  48. package/dist/firebird/data.cjs +30 -16
  49. package/dist/firebird/data.d.cts +3 -2
  50. package/dist/firebird/data.d.ts +3 -2
  51. package/dist/firebird/data.js +30 -17
  52. package/dist/fonts/obfuscation.cjs +50 -0
  53. package/dist/fonts/obfuscation.d.cts +9 -0
  54. package/dist/fonts/obfuscation.d.ts +9 -0
  55. package/dist/fonts/obfuscation.js +46 -0
  56. package/dist/fonts/odf.cjs +86 -0
  57. package/dist/fonts/odf.d.cts +9 -0
  58. package/dist/fonts/odf.d.ts +9 -0
  59. package/dist/fonts/odf.js +84 -0
  60. package/dist/fonts/ooxml.cjs +129 -0
  61. package/dist/fonts/ooxml.d.cts +9 -0
  62. package/dist/fonts/ooxml.d.ts +9 -0
  63. package/dist/fonts/ooxml.js +127 -0
  64. package/dist/fonts/registry.cjs +18 -0
  65. package/dist/fonts/registry.d.cts +2 -0
  66. package/dist/fonts/registry.d.ts +2 -0
  67. package/dist/fonts/registry.js +16 -0
  68. package/dist/formula-CgydMiTt.d.ts +10 -0
  69. package/dist/formula-CiwPw8nY.d.cts +10 -0
  70. package/dist/hsqldb/binary-script.d.cts +1 -1
  71. package/dist/hsqldb/binary-script.d.ts +1 -1
  72. package/dist/hsqldb/cache.d.cts +1 -1
  73. package/dist/hsqldb/cache.d.ts +1 -1
  74. package/dist/hsqldb/rowformat.cjs +22 -13
  75. package/dist/hsqldb/rowformat.js +22 -13
  76. package/dist/hsqldb/script.d.cts +1 -18
  77. package/dist/hsqldb/script.d.ts +1 -18
  78. package/dist/index.cjs +88 -0
  79. package/dist/index.d.cts +27 -9
  80. package/dist/index.d.ts +27 -9
  81. package/dist/index.js +20 -3
  82. package/dist/layout/sheets.cjs +30 -24
  83. package/dist/layout/sheets.js +31 -25
  84. package/dist/layout/slides.cjs +6 -4
  85. package/dist/layout/slides.js +7 -5
  86. package/dist/lexer-DGPWx_f2.d.cts +42 -0
  87. package/dist/lexer-DGPWx_f2.d.ts +42 -0
  88. package/dist/mathml/layout.d.cts +1 -1
  89. package/dist/mathml/layout.d.ts +1 -1
  90. package/dist/mathml/variant.d.cts +1 -6
  91. package/dist/mathml/variant.d.ts +1 -6
  92. package/dist/odb/csv.d.cts +1 -1
  93. package/dist/odb/csv.d.ts +1 -1
  94. package/dist/odb/formula/definition.cjs +49 -0
  95. package/dist/odb/formula/definition.d.cts +8 -0
  96. package/dist/odb/formula/definition.d.ts +8 -0
  97. package/dist/odb/formula/definition.js +46 -0
  98. package/dist/odb/formula/errors.cjs +47 -0
  99. package/dist/odb/formula/errors.d.cts +21 -0
  100. package/dist/odb/formula/errors.d.ts +21 -0
  101. package/dist/odb/formula/errors.js +43 -0
  102. package/dist/odb/formula/evaluate.cjs +283 -0
  103. package/dist/odb/formula/evaluate.d.cts +43 -0
  104. package/dist/odb/formula/evaluate.d.ts +43 -0
  105. package/dist/odb/formula/evaluate.js +281 -0
  106. package/dist/odb/formula/parser.cjs +198 -0
  107. package/dist/odb/formula/parser.d.cts +29 -0
  108. package/dist/odb/formula/parser.d.ts +29 -0
  109. package/dist/odb/formula/parser.js +197 -0
  110. package/dist/odb/read.d.cts +1 -1
  111. package/dist/odb/read.d.ts +1 -1
  112. package/dist/odb/report/content.cjs +27 -0
  113. package/dist/odb/report/content.d.cts +14 -0
  114. package/dist/odb/report/content.d.ts +14 -0
  115. package/dist/odb/report/content.js +25 -0
  116. package/dist/odb/report/render.cjs +106 -0
  117. package/dist/odb/report/render.d.cts +7 -0
  118. package/dist/odb/report/render.d.ts +7 -0
  119. package/dist/odb/report/render.js +106 -0
  120. package/dist/odb/report/source.cjs +45 -0
  121. package/dist/odb/report/source.d.cts +14 -0
  122. package/dist/odb/report/source.d.ts +14 -0
  123. package/dist/odb/report/source.js +42 -0
  124. package/dist/odb/spreadsheet.d.cts +1 -1
  125. package/dist/odb/spreadsheet.d.ts +1 -1
  126. package/dist/odb/sql/errors.cjs +38 -0
  127. package/dist/odb/sql/errors.d.cts +17 -0
  128. package/dist/odb/sql/errors.d.ts +17 -0
  129. package/dist/odb/sql/errors.js +35 -0
  130. package/dist/odb/sql/evaluate.cjs +312 -0
  131. package/dist/odb/sql/evaluate.d.cts +2 -0
  132. package/dist/odb/sql/evaluate.d.ts +2 -0
  133. package/dist/odb/sql/evaluate.js +311 -0
  134. package/dist/odb/sql/lexer.cjs +282 -0
  135. package/dist/odb/sql/lexer.d.cts +2 -0
  136. package/dist/odb/sql/lexer.d.ts +2 -0
  137. package/dist/odb/sql/lexer.js +281 -0
  138. package/dist/odb/sql/parser.cjs +479 -0
  139. package/dist/odb/sql/parser.d.cts +2 -0
  140. package/dist/odb/sql/parser.d.ts +2 -0
  141. package/dist/odb/sql/parser.js +478 -0
  142. package/dist/odb/values.cjs +75 -0
  143. package/dist/odb/values.d.cts +2 -0
  144. package/dist/odb/values.d.ts +2 -0
  145. package/dist/odb/values.js +69 -0
  146. package/dist/odf/odt/read.cjs +43 -21
  147. package/dist/odf/odt/read.js +43 -21
  148. package/dist/odf-package/formula.cjs +59 -0
  149. package/dist/odf-package/formula.d.cts +11 -0
  150. package/dist/odf-package/formula.d.ts +11 -0
  151. package/dist/odf-package/formula.js +58 -0
  152. package/dist/odf-package/manifest.cjs +29 -0
  153. package/dist/odf-package/manifest.d.cts +5 -2
  154. package/dist/odf-package/manifest.d.ts +5 -2
  155. package/dist/odf-package/manifest.js +30 -2
  156. package/dist/odf-package/media.cjs +2 -1
  157. package/dist/odf-package/media.js +2 -2
  158. package/dist/omml/read.cjs +265 -0
  159. package/dist/omml/read.d.cts +12 -0
  160. package/dist/omml/read.d.ts +12 -0
  161. package/dist/omml/read.js +263 -0
  162. package/dist/omml/shared.cjs +67 -0
  163. package/dist/omml/shared.d.cts +2 -0
  164. package/dist/omml/shared.d.ts +2 -0
  165. package/dist/omml/shared.js +64 -0
  166. package/dist/omml/write.cjs +3 -51
  167. package/dist/omml/write.d.cts +2 -2
  168. package/dist/omml/write.d.ts +2 -2
  169. package/dist/omml/write.js +1 -49
  170. package/dist/ooxml/docx/extras.cjs +15 -0
  171. package/dist/ooxml/docx/extras.d.cts +12 -0
  172. package/dist/ooxml/docx/extras.d.ts +12 -0
  173. package/dist/ooxml/docx/extras.js +14 -0
  174. package/dist/ooxml/docx/formula.cjs +109 -0
  175. package/dist/ooxml/docx/formula.d.cts +2 -0
  176. package/dist/ooxml/docx/formula.d.ts +2 -0
  177. package/dist/ooxml/docx/formula.js +108 -0
  178. package/dist/ooxml/docx/read.cjs +10 -2
  179. package/dist/ooxml/docx/read.d.cts +6 -2
  180. package/dist/ooxml/docx/read.d.ts +6 -2
  181. package/dist/ooxml/docx/read.js +11 -3
  182. package/dist/parser-B9vC1T6T.d.cts +101 -0
  183. package/dist/parser-DQSgYJzQ.d.ts +101 -0
  184. package/dist/registry-CrSqLIcn.d.ts +19 -0
  185. package/dist/registry-lqJej0Jr.d.cts +19 -0
  186. package/dist/script-DsGGIzGU.d.cts +19 -0
  187. package/dist/script-DsGGIzGU.d.ts +19 -0
  188. package/dist/shared-DLZ3IQUl.d.cts +15 -0
  189. package/dist/shared-DUOzjwcL.d.ts +15 -0
  190. package/dist/values-BetetbaH.d.cts +23 -0
  191. package/dist/values-BetetbaH.d.ts +23 -0
  192. package/dist/variant-BMrebjMw.d.cts +7 -0
  193. package/dist/variant-BMrebjMw.d.ts +7 -0
  194. package/dist/{write-DuyfnbL_.d.cts → write-BQ6SK8r8.d.cts} +2 -6
  195. package/dist/{write-Zqwx6pka.d.ts → write-THs7ipBq.d.ts} +2 -6
  196. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { Package } from "odf.js";
2
+ import { ProvidedFont } from "pdf-codec";
3
+ //#region src/fonts/odf.d.ts
4
+ declare class OdfEmbeddedFontError extends Error {
5
+ constructor(detail: string);
6
+ }
7
+ declare function extractOdfEmbeddedFonts(pkg: Package): ProvidedFont[];
8
+ //#endregion
9
+ export { OdfEmbeddedFontError, extractOdfEmbeddedFonts };
@@ -0,0 +1,9 @@
1
+ import { Package } from "odf.js";
2
+ import { ProvidedFont } from "pdf-codec";
3
+ //#region src/fonts/odf.d.ts
4
+ declare class OdfEmbeddedFontError extends Error {
5
+ constructor(detail: string);
6
+ }
7
+ declare function extractOdfEmbeddedFonts(pkg: Package): ProvidedFont[];
8
+ //#endregion
9
+ export { OdfEmbeddedFontError, extractOdfEmbeddedFonts };
@@ -0,0 +1,84 @@
1
+ import { looksLikeSfnt } from "./obfuscation.js";
2
+ import { attrValue, base64ToBytes, childrenWithTag, decodeXmlText, rootElement } from "odf.js";
3
+ import { parseSfnt } from "pdf-codec/sfnt";
4
+ import { parseOs2 } from "pdf-codec/font-tables";
5
+ //#region src/fonts/odf.ts
6
+ const FONT_FACE_DECL_PARTS = ["content.xml", "styles.xml"];
7
+ const FS_SELECTION_ITALIC = 1;
8
+ const FS_SELECTION_BOLD = 32;
9
+ const BOLD_WEIGHT_THRESHOLD = 600;
10
+ var OdfEmbeddedFontError = class extends Error {
11
+ constructor(detail) {
12
+ super(`extractOdfEmbeddedFonts: ${detail}`);
13
+ this.name = "OdfEmbeddedFontError";
14
+ }
15
+ };
16
+ function normaliseFamily(value) {
17
+ const first = decodeXmlText(value).split(",")[0]?.trim() ?? "";
18
+ const quoted = /^'(.*)'$|^"(.*)"$/.exec(first);
19
+ return (quoted?.[1] ?? quoted?.[2] ?? first).trim();
20
+ }
21
+ function boldFromWeightAttribute(weight) {
22
+ const keyword = weight.trim().toLowerCase();
23
+ if (keyword === "bold" || keyword === "bolder") return true;
24
+ if (keyword === "normal" || keyword === "lighter") return false;
25
+ const numeric = Number.parseInt(keyword, 10);
26
+ return Number.isNaN(numeric) ? void 0 : numeric >= BOLD_WEIGHT_THRESHOLD;
27
+ }
28
+ function italicFromStyleAttribute(style) {
29
+ const keyword = style.trim().toLowerCase();
30
+ if (keyword === "italic" || keyword === "oblique") return true;
31
+ return keyword === "normal" ? false : void 0;
32
+ }
33
+ function styleFromFontBytes(bytes) {
34
+ const font = parseSfnt(bytes);
35
+ if (font === void 0) return;
36
+ const os2 = parseOs2(font);
37
+ if (os2 === void 0) return;
38
+ return {
39
+ bold: (os2.fsSelection & FS_SELECTION_BOLD) !== 0,
40
+ italic: (os2.fsSelection & FS_SELECTION_ITALIC) !== 0
41
+ };
42
+ }
43
+ function fontPartBytes(pkg, href) {
44
+ const part = pkg.parts[href];
45
+ if (part === void 0) throw new OdfEmbeddedFontError(`svg:font-face-uri references ${JSON.stringify(href)}, which is not a part of this package`);
46
+ if (part.kind !== "binary") throw new OdfEmbeddedFontError(`embedded font part ${JSON.stringify(href)} is an XML part, not binary font data`);
47
+ return base64ToBytes(part.base64);
48
+ }
49
+ function collectFontFace(pkg, fontFace, seenHrefs, out) {
50
+ const declaredFamily = attrValue(fontFace, "svg:font-family") ?? attrValue(fontFace, "style:name");
51
+ for (const src of childrenWithTag(fontFace, "svg:font-face-src")) for (const uri of childrenWithTag(src, "svg:font-face-uri")) {
52
+ const rawHref = attrValue(uri, "xlink:href");
53
+ if (rawHref === void 0) throw new OdfEmbeddedFontError("a <svg:font-face-uri> carries no xlink:href");
54
+ const href = decodeXmlText(rawHref);
55
+ if (seenHrefs.has(href)) continue;
56
+ seenHrefs.add(href);
57
+ if (declaredFamily === void 0) throw new OdfEmbeddedFontError(`the <style:font-face> embedding ${JSON.stringify(href)} declares neither svg:font-family nor style:name`);
58
+ const bytes = fontPartBytes(pkg, href);
59
+ if (!looksLikeSfnt(bytes)) throw new OdfEmbeddedFontError(`embedded font part ${JSON.stringify(href)} does not begin with a recognisable sfnt signature`);
60
+ const declaredWeight = attrValue(uri, "loext:font-weight");
61
+ const declaredStyle = attrValue(uri, "loext:font-style");
62
+ const intrinsic = styleFromFontBytes(bytes);
63
+ out.push({
64
+ family: normaliseFamily(declaredFamily),
65
+ bold: (declaredWeight === void 0 ? void 0 : boldFromWeightAttribute(declaredWeight)) ?? intrinsic?.bold ?? false,
66
+ italic: (declaredStyle === void 0 ? void 0 : italicFromStyleAttribute(declaredStyle)) ?? intrinsic?.italic ?? false,
67
+ bytes
68
+ });
69
+ }
70
+ }
71
+ function extractOdfEmbeddedFonts(pkg) {
72
+ const out = [];
73
+ const seenHrefs = /* @__PURE__ */ new Set();
74
+ for (const partPath of FONT_FACE_DECL_PARTS) {
75
+ const part = pkg.parts[partPath];
76
+ if (part?.kind !== "xml") continue;
77
+ const root = rootElement(part.nodes);
78
+ if (root === void 0) continue;
79
+ for (const decls of childrenWithTag(root, "office:font-face-decls")) for (const fontFace of childrenWithTag(decls, "style:font-face")) collectFontFace(pkg, fontFace, seenHrefs, out);
80
+ }
81
+ return out;
82
+ }
83
+ //#endregion
84
+ export { OdfEmbeddedFontError, extractOdfEmbeddedFonts };
@@ -0,0 +1,129 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_fonts_obfuscation = require("./obfuscation.cjs");
3
+ let ooxml_js = require("ooxml.js");
4
+ //#region src/fonts/ooxml.ts
5
+ const OFFICE_DOCUMENT_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
6
+ const FONT_TABLE_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";
7
+ const ROOT_RELS_PART = "_rels/.rels";
8
+ const DOCX_EMBED_ELEMENTS = [
9
+ [
10
+ "w:embedRegular",
11
+ false,
12
+ false
13
+ ],
14
+ [
15
+ "w:embedBold",
16
+ true,
17
+ false
18
+ ],
19
+ [
20
+ "w:embedItalic",
21
+ false,
22
+ true
23
+ ],
24
+ [
25
+ "w:embedBoldItalic",
26
+ true,
27
+ true
28
+ ]
29
+ ];
30
+ const PPTX_EMBED_ELEMENTS = [
31
+ [
32
+ "p:regular",
33
+ false,
34
+ false
35
+ ],
36
+ [
37
+ "p:bold",
38
+ true,
39
+ false
40
+ ],
41
+ [
42
+ "p:italic",
43
+ false,
44
+ true
45
+ ],
46
+ [
47
+ "p:boldItalic",
48
+ true,
49
+ true
50
+ ]
51
+ ];
52
+ var OoxmlEmbeddedFontError = class extends Error {
53
+ constructor(detail) {
54
+ super(`extractOoxmlEmbeddedFonts: ${detail}`);
55
+ this.name = "OoxmlEmbeddedFontError";
56
+ }
57
+ };
58
+ function relatedPartPath(pkg, fromPartPath, relationshipType) {
59
+ for (const relationship of (0, ooxml_js.resolveRelationships)(pkg, fromPartPath).values()) if (relationship.type === relationshipType && relationship.targetMode === void 0) return relationship.target;
60
+ }
61
+ function officeDocumentPartPath(pkg) {
62
+ const rels = (0, ooxml_js.rootElement)(pkg.parts[ROOT_RELS_PART]);
63
+ if (rels !== void 0) for (const relationship of (0, ooxml_js.childrenWithTag)(rels, "Relationship")) {
64
+ if ((0, ooxml_js.attr)(relationship, "Type") !== OFFICE_DOCUMENT_RELATIONSHIP || (0, ooxml_js.attr)(relationship, "TargetMode") !== void 0) continue;
65
+ const target = (0, ooxml_js.attr)(relationship, "Target");
66
+ if (target !== void 0) return target.startsWith("/") ? target.slice(1) : target;
67
+ }
68
+ throw new OoxmlEmbeddedFontError(`the package declares no officeDocument relationship in ${ROOT_RELS_PART}`);
69
+ }
70
+ function fontPartBytes(pkg, fromPartPath, relationships, relationshipId) {
71
+ const relationship = relationships.get(relationshipId);
72
+ if (relationship === void 0) throw new OoxmlEmbeddedFontError(`${fromPartPath} references relationship id ${JSON.stringify(relationshipId)}, which its .rels part does not declare`);
73
+ const part = pkg.parts[relationship.target];
74
+ if (part === void 0) throw new OoxmlEmbeddedFontError(`relationship id ${JSON.stringify(relationshipId)} targets ${JSON.stringify(relationship.target)}, which is not a part of this package`);
75
+ if (part.kind !== "binary") throw new OoxmlEmbeddedFontError(`embedded font part ${JSON.stringify(relationship.target)} is an XML part, not binary font data`);
76
+ return (0, ooxml_js.base64ToBytes)(part.base64);
77
+ }
78
+ function collectFaces(pkg, declaringPartPath, relationships, fontElementChildren, fontElement, family, fontKeyAttribute, out) {
79
+ for (const [tag, bold, italic] of fontElementChildren) for (const embed of (0, ooxml_js.childrenWithTag)(fontElement, tag)) {
80
+ const relationshipId = (0, ooxml_js.attr)(embed, "r:id");
81
+ if (relationshipId === void 0) throw new OoxmlEmbeddedFontError(`<${tag}> for font ${JSON.stringify(family)} carries no r:id`);
82
+ const fontKey = fontKeyAttribute === void 0 ? void 0 : (0, ooxml_js.attr)(embed, fontKeyAttribute);
83
+ out.push({
84
+ family,
85
+ bold,
86
+ italic,
87
+ bytes: require_fonts_obfuscation.deobfuscateEmbeddedFont(fontPartBytes(pkg, declaringPartPath, relationships, relationshipId), fontKey)
88
+ });
89
+ }
90
+ }
91
+ function extractDocxFonts(pkg) {
92
+ const fontTablePath = relatedPartPath(pkg, officeDocumentPartPath(pkg), FONT_TABLE_RELATIONSHIP);
93
+ if (fontTablePath === void 0) return [];
94
+ const fontTablePart = pkg.parts[fontTablePath];
95
+ if (fontTablePart?.kind !== "xml") throw new OoxmlEmbeddedFontError(`font table part ${JSON.stringify(fontTablePath)} is missing or is not an XML part`);
96
+ const fonts = (0, ooxml_js.rootElement)(fontTablePart);
97
+ if (fonts === void 0) return [];
98
+ const relationships = (0, ooxml_js.resolveRelationships)(pkg, fontTablePath);
99
+ const out = [];
100
+ for (const font of (0, ooxml_js.childrenWithTag)(fonts, "w:font")) {
101
+ const family = (0, ooxml_js.attr)(font, "w:name");
102
+ if (family === void 0) throw new OoxmlEmbeddedFontError(`a <w:font> in ${JSON.stringify(fontTablePath)} carries no w:name`);
103
+ collectFaces(pkg, fontTablePath, relationships, DOCX_EMBED_ELEMENTS, font, (0, ooxml_js.decodeEntities)(family), "w:fontKey", out);
104
+ }
105
+ return out;
106
+ }
107
+ function extractPptxFonts(pkg) {
108
+ const presentationPartPath = officeDocumentPartPath(pkg);
109
+ const presentationPart = pkg.parts[presentationPartPath];
110
+ if (presentationPart?.kind !== "xml") throw new OoxmlEmbeddedFontError(`presentation part ${JSON.stringify(presentationPartPath)} is missing or is not an XML part`);
111
+ const presentation = (0, ooxml_js.rootElement)(presentationPart);
112
+ if (presentation === void 0) return [];
113
+ const relationships = (0, ooxml_js.resolveRelationships)(pkg, presentationPartPath);
114
+ const out = [];
115
+ for (const list of (0, ooxml_js.childrenWithTag)(presentation, "p:embeddedFontLst")) for (const embeddedFont of (0, ooxml_js.childrenWithTag)(list, "p:embeddedFont")) {
116
+ const fontElement = (0, ooxml_js.childrenWithTag)(embeddedFont, "p:font")[0];
117
+ if (fontElement === void 0) throw new OoxmlEmbeddedFontError(`a <p:embeddedFont> in ${JSON.stringify(presentationPartPath)} carries no <p:font>`);
118
+ const family = (0, ooxml_js.attr)(fontElement, "typeface");
119
+ if (family === void 0) throw new OoxmlEmbeddedFontError(`a <p:font> in ${JSON.stringify(presentationPartPath)} carries no typeface`);
120
+ collectFaces(pkg, presentationPartPath, relationships, PPTX_EMBED_ELEMENTS, embeddedFont, (0, ooxml_js.decodeEntities)(family), void 0, out);
121
+ }
122
+ return out;
123
+ }
124
+ function extractOoxmlEmbeddedFonts(pkg, kind) {
125
+ return kind === "docx" ? extractDocxFonts(pkg) : extractPptxFonts(pkg);
126
+ }
127
+ //#endregion
128
+ exports.OoxmlEmbeddedFontError = OoxmlEmbeddedFontError;
129
+ exports.extractOoxmlEmbeddedFonts = extractOoxmlEmbeddedFonts;
@@ -0,0 +1,9 @@
1
+ import { ProvidedFont } from "pdf-codec";
2
+ import { Package } from "ooxml.js";
3
+ //#region src/fonts/ooxml.d.ts
4
+ declare class OoxmlEmbeddedFontError extends Error {
5
+ constructor(detail: string);
6
+ }
7
+ declare function extractOoxmlEmbeddedFonts(pkg: Package, kind: 'docx' | 'pptx'): ProvidedFont[];
8
+ //#endregion
9
+ export { OoxmlEmbeddedFontError, extractOoxmlEmbeddedFonts };
@@ -0,0 +1,9 @@
1
+ import { Package } from "ooxml.js";
2
+ import { ProvidedFont } from "pdf-codec";
3
+ //#region src/fonts/ooxml.d.ts
4
+ declare class OoxmlEmbeddedFontError extends Error {
5
+ constructor(detail: string);
6
+ }
7
+ declare function extractOoxmlEmbeddedFonts(pkg: Package, kind: 'docx' | 'pptx'): ProvidedFont[];
8
+ //#endregion
9
+ export { OoxmlEmbeddedFontError, extractOoxmlEmbeddedFonts };
@@ -0,0 +1,127 @@
1
+ import { deobfuscateEmbeddedFont } from "./obfuscation.js";
2
+ import { attr, base64ToBytes, childrenWithTag, decodeEntities, resolveRelationships, rootElement } from "ooxml.js";
3
+ //#region src/fonts/ooxml.ts
4
+ const OFFICE_DOCUMENT_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
5
+ const FONT_TABLE_RELATIONSHIP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";
6
+ const ROOT_RELS_PART = "_rels/.rels";
7
+ const DOCX_EMBED_ELEMENTS = [
8
+ [
9
+ "w:embedRegular",
10
+ false,
11
+ false
12
+ ],
13
+ [
14
+ "w:embedBold",
15
+ true,
16
+ false
17
+ ],
18
+ [
19
+ "w:embedItalic",
20
+ false,
21
+ true
22
+ ],
23
+ [
24
+ "w:embedBoldItalic",
25
+ true,
26
+ true
27
+ ]
28
+ ];
29
+ const PPTX_EMBED_ELEMENTS = [
30
+ [
31
+ "p:regular",
32
+ false,
33
+ false
34
+ ],
35
+ [
36
+ "p:bold",
37
+ true,
38
+ false
39
+ ],
40
+ [
41
+ "p:italic",
42
+ false,
43
+ true
44
+ ],
45
+ [
46
+ "p:boldItalic",
47
+ true,
48
+ true
49
+ ]
50
+ ];
51
+ var OoxmlEmbeddedFontError = class extends Error {
52
+ constructor(detail) {
53
+ super(`extractOoxmlEmbeddedFonts: ${detail}`);
54
+ this.name = "OoxmlEmbeddedFontError";
55
+ }
56
+ };
57
+ function relatedPartPath(pkg, fromPartPath, relationshipType) {
58
+ for (const relationship of resolveRelationships(pkg, fromPartPath).values()) if (relationship.type === relationshipType && relationship.targetMode === void 0) return relationship.target;
59
+ }
60
+ function officeDocumentPartPath(pkg) {
61
+ const rels = rootElement(pkg.parts[ROOT_RELS_PART]);
62
+ if (rels !== void 0) for (const relationship of childrenWithTag(rels, "Relationship")) {
63
+ if (attr(relationship, "Type") !== OFFICE_DOCUMENT_RELATIONSHIP || attr(relationship, "TargetMode") !== void 0) continue;
64
+ const target = attr(relationship, "Target");
65
+ if (target !== void 0) return target.startsWith("/") ? target.slice(1) : target;
66
+ }
67
+ throw new OoxmlEmbeddedFontError(`the package declares no officeDocument relationship in ${ROOT_RELS_PART}`);
68
+ }
69
+ function fontPartBytes(pkg, fromPartPath, relationships, relationshipId) {
70
+ const relationship = relationships.get(relationshipId);
71
+ if (relationship === void 0) throw new OoxmlEmbeddedFontError(`${fromPartPath} references relationship id ${JSON.stringify(relationshipId)}, which its .rels part does not declare`);
72
+ const part = pkg.parts[relationship.target];
73
+ if (part === void 0) throw new OoxmlEmbeddedFontError(`relationship id ${JSON.stringify(relationshipId)} targets ${JSON.stringify(relationship.target)}, which is not a part of this package`);
74
+ if (part.kind !== "binary") throw new OoxmlEmbeddedFontError(`embedded font part ${JSON.stringify(relationship.target)} is an XML part, not binary font data`);
75
+ return base64ToBytes(part.base64);
76
+ }
77
+ function collectFaces(pkg, declaringPartPath, relationships, fontElementChildren, fontElement, family, fontKeyAttribute, out) {
78
+ for (const [tag, bold, italic] of fontElementChildren) for (const embed of childrenWithTag(fontElement, tag)) {
79
+ const relationshipId = attr(embed, "r:id");
80
+ if (relationshipId === void 0) throw new OoxmlEmbeddedFontError(`<${tag}> for font ${JSON.stringify(family)} carries no r:id`);
81
+ const fontKey = fontKeyAttribute === void 0 ? void 0 : attr(embed, fontKeyAttribute);
82
+ out.push({
83
+ family,
84
+ bold,
85
+ italic,
86
+ bytes: deobfuscateEmbeddedFont(fontPartBytes(pkg, declaringPartPath, relationships, relationshipId), fontKey)
87
+ });
88
+ }
89
+ }
90
+ function extractDocxFonts(pkg) {
91
+ const fontTablePath = relatedPartPath(pkg, officeDocumentPartPath(pkg), FONT_TABLE_RELATIONSHIP);
92
+ if (fontTablePath === void 0) return [];
93
+ const fontTablePart = pkg.parts[fontTablePath];
94
+ if (fontTablePart?.kind !== "xml") throw new OoxmlEmbeddedFontError(`font table part ${JSON.stringify(fontTablePath)} is missing or is not an XML part`);
95
+ const fonts = rootElement(fontTablePart);
96
+ if (fonts === void 0) return [];
97
+ const relationships = resolveRelationships(pkg, fontTablePath);
98
+ const out = [];
99
+ for (const font of childrenWithTag(fonts, "w:font")) {
100
+ const family = attr(font, "w:name");
101
+ if (family === void 0) throw new OoxmlEmbeddedFontError(`a <w:font> in ${JSON.stringify(fontTablePath)} carries no w:name`);
102
+ collectFaces(pkg, fontTablePath, relationships, DOCX_EMBED_ELEMENTS, font, decodeEntities(family), "w:fontKey", out);
103
+ }
104
+ return out;
105
+ }
106
+ function extractPptxFonts(pkg) {
107
+ const presentationPartPath = officeDocumentPartPath(pkg);
108
+ const presentationPart = pkg.parts[presentationPartPath];
109
+ if (presentationPart?.kind !== "xml") throw new OoxmlEmbeddedFontError(`presentation part ${JSON.stringify(presentationPartPath)} is missing or is not an XML part`);
110
+ const presentation = rootElement(presentationPart);
111
+ if (presentation === void 0) return [];
112
+ const relationships = resolveRelationships(pkg, presentationPartPath);
113
+ const out = [];
114
+ for (const list of childrenWithTag(presentation, "p:embeddedFontLst")) for (const embeddedFont of childrenWithTag(list, "p:embeddedFont")) {
115
+ const fontElement = childrenWithTag(embeddedFont, "p:font")[0];
116
+ if (fontElement === void 0) throw new OoxmlEmbeddedFontError(`a <p:embeddedFont> in ${JSON.stringify(presentationPartPath)} carries no <p:font>`);
117
+ const family = attr(fontElement, "typeface");
118
+ if (family === void 0) throw new OoxmlEmbeddedFontError(`a <p:font> in ${JSON.stringify(presentationPartPath)} carries no typeface`);
119
+ collectFaces(pkg, presentationPartPath, relationships, PPTX_EMBED_ELEMENTS, embeddedFont, decodeEntities(family), void 0, out);
120
+ }
121
+ return out;
122
+ }
123
+ function extractOoxmlEmbeddedFonts(pkg, kind) {
124
+ return kind === "docx" ? extractDocxFonts(pkg) : extractPptxFonts(pkg);
125
+ }
126
+ //#endregion
127
+ export { OoxmlEmbeddedFontError, extractOoxmlEmbeddedFonts };
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_fonts_odf = require("./odf.cjs");
3
+ const require_fonts_ooxml = require("./ooxml.cjs");
4
+ let pdf_codec = require("pdf-codec");
5
+ //#region src/fonts/registry.ts
6
+ function extractSourceFonts(source) {
7
+ return source.kind === "odf" ? require_fonts_odf.extractOdfEmbeddedFonts(source.package) : require_fonts_ooxml.extractOoxmlEmbeddedFonts(source.package, source.kind);
8
+ }
9
+ function createDocumentFontRegistry(source, options) {
10
+ return (0, pdf_codec.createFontRegistry)({
11
+ sourceFonts: extractSourceFonts(source),
12
+ fonts: options?.fonts,
13
+ onSubstitution: options?.onFontSubstitution
14
+ });
15
+ }
16
+ //#endregion
17
+ exports.createDocumentFontRegistry = createDocumentFontRegistry;
18
+ exports.extractSourceFonts = extractSourceFonts;
@@ -0,0 +1,2 @@
1
+ import { i as extractSourceFonts, n as FontSourcePackage, r as createDocumentFontRegistry, t as DocumentFontRegistryOptions } from "../registry-lqJej0Jr.cjs";
2
+ export { DocumentFontRegistryOptions, FontSourcePackage, createDocumentFontRegistry, extractSourceFonts };
@@ -0,0 +1,2 @@
1
+ import { i as extractSourceFonts, n as FontSourcePackage, r as createDocumentFontRegistry, t as DocumentFontRegistryOptions } from "../registry-CrSqLIcn.js";
2
+ export { DocumentFontRegistryOptions, FontSourcePackage, createDocumentFontRegistry, extractSourceFonts };
@@ -0,0 +1,16 @@
1
+ import { extractOdfEmbeddedFonts } from "./odf.js";
2
+ import { extractOoxmlEmbeddedFonts } from "./ooxml.js";
3
+ import { createFontRegistry } from "pdf-codec";
4
+ //#region src/fonts/registry.ts
5
+ function extractSourceFonts(source) {
6
+ return source.kind === "odf" ? extractOdfEmbeddedFonts(source.package) : extractOoxmlEmbeddedFonts(source.package, source.kind);
7
+ }
8
+ function createDocumentFontRegistry(source, options) {
9
+ return createFontRegistry({
10
+ sourceFonts: extractSourceFonts(source),
11
+ fonts: options?.fonts,
12
+ onSubstitution: options?.onFontSubstitution
13
+ });
14
+ }
15
+ //#endregion
16
+ export { createDocumentFontRegistry, extractSourceFonts };
@@ -0,0 +1,10 @@
1
+ import { t as OmmlDiagnostic } from "./shared-DUOzjwcL.js";
2
+ import { XmlNode } from "ooxml.js";
3
+ import { ContentSection } from "document-schema.js";
4
+ //#region src/ooxml/docx/formula.d.ts
5
+ type OmmlDiagnosticSink = (diagnostic: OmmlDiagnostic, context: {
6
+ readonly sourcePath?: string;
7
+ }) => void;
8
+ declare function spliceDocxFormulas(sections: readonly ContentSection[], bodyChildren: readonly XmlNode[], onMathDiagnostic?: OmmlDiagnosticSink): ContentSection[];
9
+ //#endregion
10
+ export { spliceDocxFormulas as n, OmmlDiagnosticSink as t };
@@ -0,0 +1,10 @@
1
+ import { t as OmmlDiagnostic } from "./shared-DLZ3IQUl.cjs";
2
+ import { ContentSection } from "document-schema.js";
3
+ import { XmlNode } from "ooxml.js";
4
+ //#region src/ooxml/docx/formula.d.ts
5
+ type OmmlDiagnosticSink = (diagnostic: OmmlDiagnostic, context: {
6
+ readonly sourcePath?: string;
7
+ }) => void;
8
+ declare function spliceDocxFormulas(sections: readonly ContentSection[], bodyChildren: readonly XmlNode[], onMathDiagnostic?: OmmlDiagnosticSink): ContentSection[];
9
+ //#endregion
10
+ export { spliceDocxFormulas as n, OmmlDiagnosticSink as t };
@@ -1,5 +1,5 @@
1
1
  import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
2
- import { HsqldbTable } from "./script.cjs";
2
+ import { r as HsqldbTable } from "../script-DsGGIzGU.cjs";
3
3
  //#region src/hsqldb/binary-script.d.ts
4
4
  declare class HsqldbBinaryScriptParseError extends Error {
5
5
  readonly offset: number;
@@ -1,5 +1,5 @@
1
1
  import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
2
- import { HsqldbTable } from "./script.js";
2
+ import { r as HsqldbTable } from "../script-DsGGIzGU.js";
3
3
  //#region src/hsqldb/binary-script.d.ts
4
4
  declare class HsqldbBinaryScriptParseError extends Error {
5
5
  readonly offset: number;
@@ -1,5 +1,5 @@
1
1
  import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
2
- import { HsqldbColumn, HsqldbTable } from "./script.cjs";
2
+ import { r as HsqldbTable, t as HsqldbColumn } from "../script-DsGGIzGU.cjs";
3
3
  import { ContentCellValue } from "document-schema.js";
4
4
  //#region src/hsqldb/cache.d.ts
5
5
  interface HsqldbCacheFileInfo {
@@ -1,5 +1,5 @@
1
1
  import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
2
- import { HsqldbColumn, HsqldbTable } from "./script.js";
2
+ import { r as HsqldbTable, t as HsqldbColumn } from "../script-DsGGIzGU.js";
3
3
  import { ContentCellValue } from "document-schema.js";
4
4
  //#region src/hsqldb/cache.d.ts
5
5
  interface HsqldbCacheFileInfo {
@@ -124,15 +124,30 @@ function signedBigIntFromBytes(bytes) {
124
124
  const firstByte = bytes[0];
125
125
  return firstByte !== void 0 && (firstByte & 128) !== 0 ? magnitude - (1n << BigInt(8 * bytes.length)) : magnitude;
126
126
  }
127
- function decimalNumberFromUnscaled(unscaled, scale) {
127
+ function exactDecimalDigits(unscaled, scale) {
128
128
  const isNegative = unscaled < 0n;
129
129
  const magnitudeDigits = (isNegative ? -unscaled : unscaled).toString();
130
130
  const sign = isNegative ? "-" : "";
131
- if (scale <= 0) return Number(`${sign}${magnitudeDigits}${"0".repeat(-scale)}`);
131
+ if (scale <= 0) return `${sign}${magnitudeDigits}${"0".repeat(-scale)}`;
132
132
  const padded = magnitudeDigits.padStart(scale + 1, "0");
133
- const wholePart = padded.slice(0, padded.length - scale);
134
- const fractionPart = padded.slice(padded.length - scale);
135
- return Number(`${sign}${wholePart}.${fractionPart}`);
133
+ return `${sign}${padded.slice(0, padded.length - scale)}.${padded.slice(padded.length - scale)}`;
134
+ }
135
+ function trimTrailingFractionZeros(digits) {
136
+ if (!digits.includes(".")) return digits;
137
+ const trimmed = digits.replace(/0+$/, "");
138
+ return trimmed.endsWith(".") ? trimmed.slice(0, -1) : trimmed;
139
+ }
140
+ function numericCellValue(unscaled, scale) {
141
+ const exact = trimTrailingFractionZeros(exactDecimalDigits(unscaled, scale));
142
+ const value = Number(exact);
143
+ return String(value) === exact ? {
144
+ kind: "number",
145
+ value
146
+ } : {
147
+ kind: "number",
148
+ value,
149
+ exactValue: exact
150
+ };
136
151
  }
137
152
  function pad2(n) {
138
153
  return String(n).padStart(2, "0");
@@ -219,10 +234,7 @@ function readHsqldbColumnValue(cursor, typeCode, options) {
219
234
  kind: "number",
220
235
  value: cursor.readInt32()
221
236
  };
222
- case -5: return {
223
- kind: "number",
224
- value: Number(cursor.readBigInt64())
225
- };
237
+ case -5: return numericCellValue(cursor.readBigInt64(), 0);
226
238
  case 6:
227
239
  case 7:
228
240
  case 8: return {
@@ -234,10 +246,7 @@ function readHsqldbColumnValue(cursor, typeCode, options) {
234
246
  const byteLength = cursor.readInt32();
235
247
  const magnitudeBytes = cursor.readBytes(byteLength);
236
248
  const scale = cursor.readInt32();
237
- return {
238
- kind: "number",
239
- value: decimalNumberFromUnscaled(signedBigIntFromBytes(magnitudeBytes), scale)
240
- };
249
+ return numericCellValue(signedBigIntFromBytes(magnitudeBytes), scale);
241
250
  }
242
251
  case 16: return {
243
252
  kind: "boolean",
@@ -123,15 +123,30 @@ function signedBigIntFromBytes(bytes) {
123
123
  const firstByte = bytes[0];
124
124
  return firstByte !== void 0 && (firstByte & 128) !== 0 ? magnitude - (1n << BigInt(8 * bytes.length)) : magnitude;
125
125
  }
126
- function decimalNumberFromUnscaled(unscaled, scale) {
126
+ function exactDecimalDigits(unscaled, scale) {
127
127
  const isNegative = unscaled < 0n;
128
128
  const magnitudeDigits = (isNegative ? -unscaled : unscaled).toString();
129
129
  const sign = isNegative ? "-" : "";
130
- if (scale <= 0) return Number(`${sign}${magnitudeDigits}${"0".repeat(-scale)}`);
130
+ if (scale <= 0) return `${sign}${magnitudeDigits}${"0".repeat(-scale)}`;
131
131
  const padded = magnitudeDigits.padStart(scale + 1, "0");
132
- const wholePart = padded.slice(0, padded.length - scale);
133
- const fractionPart = padded.slice(padded.length - scale);
134
- return Number(`${sign}${wholePart}.${fractionPart}`);
132
+ return `${sign}${padded.slice(0, padded.length - scale)}.${padded.slice(padded.length - scale)}`;
133
+ }
134
+ function trimTrailingFractionZeros(digits) {
135
+ if (!digits.includes(".")) return digits;
136
+ const trimmed = digits.replace(/0+$/, "");
137
+ return trimmed.endsWith(".") ? trimmed.slice(0, -1) : trimmed;
138
+ }
139
+ function numericCellValue(unscaled, scale) {
140
+ const exact = trimTrailingFractionZeros(exactDecimalDigits(unscaled, scale));
141
+ const value = Number(exact);
142
+ return String(value) === exact ? {
143
+ kind: "number",
144
+ value
145
+ } : {
146
+ kind: "number",
147
+ value,
148
+ exactValue: exact
149
+ };
135
150
  }
136
151
  function pad2(n) {
137
152
  return String(n).padStart(2, "0");
@@ -218,10 +233,7 @@ function readHsqldbColumnValue(cursor, typeCode, options) {
218
233
  kind: "number",
219
234
  value: cursor.readInt32()
220
235
  };
221
- case -5: return {
222
- kind: "number",
223
- value: Number(cursor.readBigInt64())
224
- };
236
+ case -5: return numericCellValue(cursor.readBigInt64(), 0);
225
237
  case 6:
226
238
  case 7:
227
239
  case 8: return {
@@ -233,10 +245,7 @@ function readHsqldbColumnValue(cursor, typeCode, options) {
233
245
  const byteLength = cursor.readInt32();
234
246
  const magnitudeBytes = cursor.readBytes(byteLength);
235
247
  const scale = cursor.readInt32();
236
- return {
237
- kind: "number",
238
- value: decimalNumberFromUnscaled(signedBigIntFromBytes(magnitudeBytes), scale)
239
- };
248
+ return numericCellValue(signedBigIntFromBytes(magnitudeBytes), scale);
240
249
  }
241
250
  case 16: return {
242
251
  kind: "boolean",
@@ -1,19 +1,2 @@
1
- import { ContentCellValue } from "document-schema.js";
2
- //#region src/hsqldb/script.d.ts
3
- declare class HsqldbScriptParseError extends Error {
4
- readonly statement: string;
5
- constructor(message: string, statement: string);
6
- }
7
- interface HsqldbColumn {
8
- readonly name: string;
9
- readonly type: string;
10
- }
11
- interface HsqldbTable {
12
- readonly tableName: string;
13
- readonly columns: readonly HsqldbColumn[];
14
- readonly rows: readonly (readonly ContentCellValue[])[];
15
- }
16
- declare function displayTextFor(value: ContentCellValue): string;
17
- declare function parseHsqldbScript(bytes: Uint8Array): HsqldbTable[];
18
- //#endregion
1
+ import { a as parseHsqldbScript, i as displayTextFor, n as HsqldbScriptParseError, r as HsqldbTable, t as HsqldbColumn } from "../script-DsGGIzGU.cjs";
19
2
  export { HsqldbColumn, HsqldbScriptParseError, HsqldbTable, displayTextFor, parseHsqldbScript };
@@ -1,19 +1,2 @@
1
- import { ContentCellValue } from "document-schema.js";
2
- //#region src/hsqldb/script.d.ts
3
- declare class HsqldbScriptParseError extends Error {
4
- readonly statement: string;
5
- constructor(message: string, statement: string);
6
- }
7
- interface HsqldbColumn {
8
- readonly name: string;
9
- readonly type: string;
10
- }
11
- interface HsqldbTable {
12
- readonly tableName: string;
13
- readonly columns: readonly HsqldbColumn[];
14
- readonly rows: readonly (readonly ContentCellValue[])[];
15
- }
16
- declare function displayTextFor(value: ContentCellValue): string;
17
- declare function parseHsqldbScript(bytes: Uint8Array): HsqldbTable[];
18
- //#endregion
1
+ import { a as parseHsqldbScript, i as displayTextFor, n as HsqldbScriptParseError, r as HsqldbTable, t as HsqldbColumn } from "../script-DsGGIzGU.js";
19
2
  export { HsqldbColumn, HsqldbScriptParseError, HsqldbTable, displayTextFor, parseHsqldbScript };