odf.js 5.2.0 → 5.4.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 (94) hide show
  1. package/README.md +6 -4
  2. package/dist/{cascade-rhqUQrUa.d.ts → cascade-BZ7zqXhL.d.ts} +2 -2
  3. package/dist/{cascade-BmvsXcAz.d.cts → cascade-DWQfTwaM.d.cts} +2 -2
  4. package/dist/{codec-BoPvy83Y.d.cts → codec-CCjdir_f.d.cts} +13 -13
  5. package/dist/{codec-BQB05qN1.d.ts → codec-heu5sgsK.d.ts} +13 -13
  6. package/dist/codec.d.cts +1 -1
  7. package/dist/codec.d.ts +1 -1
  8. package/dist/{constructs-CJpDDQV0.d.ts → constructs-C1S8qlVv.d.ts} +9 -2
  9. package/dist/{constructs-Dy_DMFs3.d.cts → constructs-FLBse5UV.d.cts} +9 -2
  10. package/dist/{embedded-BBJoUl86.js → embedded-BSSdoKcK.js} +151 -24
  11. package/dist/{embedded-ztNK8w6V.d.cts → embedded-BzPTTzdf.d.cts} +1 -1
  12. package/dist/{embedded-FMIPM1fw.cjs → embedded-DbLrCGPi.cjs} +148 -21
  13. package/dist/{embedded-CLuwn306.d.ts → embedded-Zv8KtFUo.d.ts} +1 -1
  14. package/dist/{form-BGCT81ss.d.cts → form-CWWCkG-r.d.cts} +2 -2
  15. package/dist/{form-D3H5H2NL.d.ts → form-RJTtSmwn.d.ts} +2 -2
  16. package/dist/{forms-D1-0spCe.d.ts → forms-CyLw7lpE.d.ts} +1 -1
  17. package/dist/{forms-cIjw-Jf-.d.cts → forms-Eh1N15Qy.d.cts} +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.cts +15 -15
  20. package/dist/index.d.ts +15 -15
  21. package/dist/index.js +1 -1
  22. package/dist/{masterpage-XJ2v2khe.d.cts → masterpage-Bt6gxuoL.d.cts} +2 -1
  23. package/dist/{masterpage-C1McDhMv.d.ts → masterpage-By_F05W4.d.ts} +2 -1
  24. package/dist/{paragraph-BBmSl_sK.d.cts → paragraph-BEAeuCLf.d.cts} +4 -3
  25. package/dist/{paragraph-6hzAZpmi.d.ts → paragraph-DdcX8JuK.d.ts} +4 -3
  26. package/dist/{properties-BF_Fv6B3.d.cts → properties-C-JKQZUD.d.cts} +2 -0
  27. package/dist/{properties-DjAIdPry.d.ts → properties-Rral02h1.d.ts} +2 -0
  28. package/dist/read-24g5eZw6.d.ts +25 -0
  29. package/dist/{read-lc0t0UHK.d.ts → read-BLoaDxr_.d.ts} +2 -1
  30. package/dist/{read-B4238IGr.d.cts → read-C3Ei_MYc.d.cts} +2 -1
  31. package/dist/{read-CTfeWaWq.d.cts → read-CDSmR3qt.d.cts} +2 -1
  32. package/dist/{read-CdvX2qnz.d.ts → read-DJqvINGW.d.ts} +2 -1
  33. package/dist/{read-Db_GZ0ZH.d.ts → read-DfEHXwgn.d.ts} +2 -1
  34. package/dist/{read-DOYWO6BM.d.cts → read-IOYq80AA.d.cts} +2 -1
  35. package/dist/read-rwDsgR0d.d.cts +25 -0
  36. package/dist/{registry-CaJpWDke.d.cts → registry-CphRYjDD.d.cts} +1 -1
  37. package/dist/{registry-BVeEpUMI.d.ts → registry-D5RGBteE.d.ts} +1 -1
  38. package/dist/{serialize-DvaE_t5D.d.ts → serialize-B-lq0LiG.d.ts} +1 -1
  39. package/dist/{serialize-9xvti0FF.d.cts → serialize-D1fti8C5.d.cts} +1 -1
  40. package/dist/styles/properties.cjs +25 -3
  41. package/dist/styles/properties.d.cts +1 -1
  42. package/dist/styles/properties.d.ts +1 -1
  43. package/dist/styles/properties.js +25 -3
  44. package/dist/styles/registry.d.cts +1 -1
  45. package/dist/styles/registry.d.ts +1 -1
  46. package/dist/styles/serialize.d.cts +1 -1
  47. package/dist/styles/serialize.d.ts +1 -1
  48. package/dist/typed/draw/embedded.cjs +1 -1
  49. package/dist/typed/draw/embedded.d.cts +1 -1
  50. package/dist/typed/draw/embedded.d.ts +1 -1
  51. package/dist/typed/draw/embedded.js +1 -1
  52. package/dist/typed/draw/shapes.cjs +4 -1
  53. package/dist/typed/draw/shapes.js +4 -1
  54. package/dist/typed/odb/form.cjs +1 -1
  55. package/dist/typed/odb/form.d.cts +1 -1
  56. package/dist/typed/odb/form.d.ts +1 -1
  57. package/dist/typed/odb/form.js +1 -1
  58. package/dist/typed/odg/read.cjs +14 -4
  59. package/dist/typed/odg/read.d.cts +1 -1
  60. package/dist/typed/odg/read.d.ts +1 -1
  61. package/dist/typed/odg/read.js +14 -4
  62. package/dist/typed/odp/read.cjs +51 -4
  63. package/dist/typed/odp/read.d.cts +1 -1
  64. package/dist/typed/odp/read.d.ts +1 -1
  65. package/dist/typed/odp/read.js +52 -5
  66. package/dist/typed/ods/read.cjs +1 -1
  67. package/dist/typed/ods/read.d.cts +1 -1
  68. package/dist/typed/ods/read.d.ts +1 -1
  69. package/dist/typed/ods/read.js +1 -1
  70. package/dist/typed/odt/read.cjs +1 -1
  71. package/dist/typed/odt/read.d.cts +2 -2
  72. package/dist/typed/odt/read.d.ts +2 -2
  73. package/dist/typed/odt/read.js +1 -1
  74. package/dist/typed/shared/cascade.d.cts +1 -1
  75. package/dist/typed/shared/cascade.d.ts +1 -1
  76. package/dist/typed/shared/constructs.cjs +75 -2
  77. package/dist/typed/shared/constructs.d.cts +2 -2
  78. package/dist/typed/shared/constructs.d.ts +2 -2
  79. package/dist/typed/shared/constructs.js +69 -3
  80. package/dist/typed/shared/forms.d.cts +1 -1
  81. package/dist/typed/shared/forms.d.ts +1 -1
  82. package/dist/typed/shared/masterpage.cjs +7 -0
  83. package/dist/typed/shared/masterpage.d.cts +2 -2
  84. package/dist/typed/shared/masterpage.d.ts +2 -2
  85. package/dist/typed/shared/masterpage.js +7 -1
  86. package/dist/typed/shared/paragraph.cjs +30 -7
  87. package/dist/typed/shared/paragraph.d.cts +2 -2
  88. package/dist/typed/shared/paragraph.d.ts +2 -2
  89. package/dist/typed/shared/paragraph.js +31 -9
  90. package/dist/typed/shared/text.cjs +3 -0
  91. package/dist/typed/shared/text.js +3 -0
  92. package/package.json +2 -2
  93. package/dist/read-Cs1ktkWB.d.cts +0 -15
  94. package/dist/read-DHuiGh_y.d.ts +0 -15
@@ -1,6 +1,7 @@
1
- import { childrenWithTag, elementsWithTag, findChildElement, rootElement } from "../../xml/query.js";
1
+ import { attrValue, childrenWithTag, elementsWithTag, findChildElement, rootElement } from "../../xml/query.js";
2
2
  import { decodeOdfText } from "../shared/text.js";
3
3
  import { readOdfMetadata } from "../shared/metadata.js";
4
+ import { collectOdfNonContentPartResidue, collectOdfUnmappedShapeResidue, odfAttributeElement, odfResidue } from "../shared/constructs.js";
4
5
  import { resolveDrawPageSize } from "../shared/masterpage.js";
5
6
  import { walkDrawShapes } from "../draw/shapes.js";
6
7
  import { SLIDE_SIZE_WIDESCREEN, assemblePackage } from "document-schema.js";
@@ -14,13 +15,53 @@ function readSlideNotes(page) {
14
15
  if (notes === void 0) return "";
15
16
  return elementsWithTag(notes.children, "text:p").map(decodeOdfText).join("\n");
16
17
  }
18
+ const ODP_TRANSITION_ATTRIBUTES = [
19
+ "presentation:transition-type",
20
+ "presentation:transition-style",
21
+ "presentation:transition-speed",
22
+ "presentation:duration",
23
+ "smil:type",
24
+ "smil:subtype",
25
+ "smil:direction",
26
+ "smil:fadeColor"
27
+ ];
28
+ function findDrawingPageProperties(pkg, styleName) {
29
+ if (styleName === void 0) return;
30
+ for (const partPath of ["content.xml", "styles.xml"]) {
31
+ const part = pkg.parts[partPath];
32
+ if (part?.kind !== "xml") continue;
33
+ const root = rootElement(part.nodes);
34
+ if (root === void 0) continue;
35
+ for (const containerTag of ["office:automatic-styles", "office:styles"]) {
36
+ const container = findChildElement(root.children, containerTag);
37
+ if (container === void 0) continue;
38
+ for (const style of childrenWithTag(container, "style:style")) if (attrValue(style, "style:family") === "drawing-page" && attrValue(style, "style:name") === styleName) return childrenWithTag(style, "style:drawing-page-properties")[0];
39
+ }
40
+ }
41
+ }
42
+ const ODP_PRESENTATION_EXTRA_TAGS = /* @__PURE__ */ new Set([
43
+ "presentation:sound",
44
+ "presentation:animations",
45
+ "anim:par",
46
+ "anim:seq"
47
+ ]);
48
+ function readSlideResidue(page, pkg) {
49
+ const elements = [];
50
+ const drawingPageProperties = findDrawingPageProperties(pkg, attrValue(page, "draw:style-name"));
51
+ if (drawingPageProperties !== void 0 && ODP_TRANSITION_ATTRIBUTES.some((name) => attrValue(drawingPageProperties, name) !== void 0)) elements.push(odfAttributeElement(drawingPageProperties, ...ODP_TRANSITION_ATTRIBUTES));
52
+ for (const child of page.children) if (child.type === "element" && ODP_PRESENTATION_EXTRA_TAGS.has(child.tag)) elements.push(child);
53
+ collectOdfUnmappedShapeResidue(page.children, elements);
54
+ return elements.length > 0 ? odfResidue("odp", ...elements) : void 0;
55
+ }
17
56
  function readSlide(page, pkg, listIdState) {
18
57
  const shapes = [];
19
58
  walkDrawShapes(page.children, [], pkg, shapes, { next: 0 }, listIdState);
59
+ const source = readSlideResidue(page, pkg);
20
60
  return {
21
61
  size: readSlideSize(page, pkg),
22
62
  shapes,
23
- notes: readSlideNotes(page)
63
+ notes: readSlideNotes(page),
64
+ ...source !== void 0 ? { source } : {}
24
65
  };
25
66
  }
26
67
  function readOdpContent(pkg) {
@@ -30,18 +71,24 @@ function readOdpContent(pkg) {
30
71
  const presentation = body === void 0 ? void 0 : findChildElement(body.children, "office:presentation");
31
72
  const pages = presentation === void 0 ? [] : childrenWithTag(presentation, "draw:page");
32
73
  const listIdState = { next: 1 };
74
+ const slides = pages.map((page) => readSlide(page, pkg, listIdState));
75
+ const source = {};
76
+ collectOdfNonContentPartResidue(pkg, "odp", source);
33
77
  return {
34
78
  metadata: readOdfMetadata(pkg),
35
- slides: pages.map((page) => readSlide(page, pkg, listIdState))
79
+ slides,
80
+ ...Object.keys(source).length > 0 ? { source } : {}
36
81
  };
37
82
  }
38
83
  function readOdp(pkg) {
39
- const { metadata, slides } = readOdpContent(pkg);
40
- return assemblePackage({
84
+ const { metadata, slides, source } = readOdpContent(pkg);
85
+ const assembled = assemblePackage({
41
86
  kind: "presentation",
42
87
  metadata,
43
88
  slides
44
89
  });
90
+ if (source !== void 0) assembled.source = source;
91
+ return assembled;
45
92
  }
46
93
  //#endregion
47
94
  export { readOdp, readOdpContent };
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_embedded = require("../../embedded-FMIPM1fw.cjs");
2
+ const require_embedded = require("../../embedded-DbLrCGPi.cjs");
3
3
  exports.readOds = require_embedded.readOds;
4
4
  exports.readOdsContent = require_embedded.readOdsContent;
@@ -1,2 +1,2 @@
1
- import { n as readOds, r as readOdsContent, t as OdsDocument } from "../../read-B4238IGr.cjs";
1
+ import { n as readOds, r as readOdsContent, t as OdsDocument } from "../../read-C3Ei_MYc.cjs";
2
2
  export { OdsDocument, readOds, readOdsContent };
@@ -1,2 +1,2 @@
1
- import { n as readOds, r as readOdsContent, t as OdsDocument } from "../../read-CdvX2qnz.js";
1
+ import { n as readOds, r as readOdsContent, t as OdsDocument } from "../../read-DJqvINGW.js";
2
2
  export { OdsDocument, readOds, readOdsContent };
@@ -1,2 +1,2 @@
1
- import { o as readOds, s as readOdsContent } from "../../embedded-BBJoUl86.js";
1
+ import { o as readOds, s as readOdsContent } from "../../embedded-BSSdoKcK.js";
2
2
  export { readOds, readOdsContent };
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_embedded = require("../../embedded-FMIPM1fw.cjs");
2
+ const require_embedded = require("../../embedded-DbLrCGPi.cjs");
3
3
  exports.readOdt = require_embedded.readOdt;
4
4
  exports.readOdtContent = require_embedded.readOdtContent;
@@ -1,2 +1,2 @@
1
- import { i as readOdtContent, n as OdtReadOptions, r as readOdt, t as OdtDocument } from "../../read-Cs1ktkWB.cjs";
2
- export { OdtDocument, OdtReadOptions, readOdt, readOdtContent };
1
+ import { a as readOdt, i as OdtReadOptions, n as OdtHeaderFooterPart, o as readOdtContent, r as OdtHeaderFooterVariant, t as OdtDocument } from "../../read-rwDsgR0d.cjs";
2
+ export { OdtDocument, OdtHeaderFooterPart, OdtHeaderFooterVariant, OdtReadOptions, readOdt, readOdtContent };
@@ -1,2 +1,2 @@
1
- import { i as readOdtContent, n as OdtReadOptions, r as readOdt, t as OdtDocument } from "../../read-DHuiGh_y.js";
2
- export { OdtDocument, OdtReadOptions, readOdt, readOdtContent };
1
+ import { a as readOdt, i as OdtReadOptions, n as OdtHeaderFooterPart, o as readOdtContent, r as OdtHeaderFooterVariant, t as OdtDocument } from "../../read-24g5eZw6.js";
2
+ export { OdtDocument, OdtHeaderFooterPart, OdtHeaderFooterVariant, OdtReadOptions, readOdt, readOdtContent };
@@ -1,2 +1,2 @@
1
- import { a as readOdtContent, i as readOdt } from "../../embedded-BBJoUl86.js";
1
+ import { a as readOdtContent, i as readOdt } from "../../embedded-BSSdoKcK.js";
2
2
  export { readOdt, readOdtContent };
@@ -1,2 +1,2 @@
1
- import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as resolveStyleElementChain, r as StyleElementChainResult, t as CascadeDiagnostic } from "../../cascade-BmvsXcAz.cjs";
1
+ import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as resolveStyleElementChain, r as StyleElementChainResult, t as CascadeDiagnostic } from "../../cascade-DWQfTwaM.cjs";
2
2
  export { CascadeDiagnostic, StyleCascadeResult, StyleElementChainResult, findStyleElement, resolveStyle, resolveStyleElementChain };
@@ -1,2 +1,2 @@
1
- import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as resolveStyleElementChain, r as StyleElementChainResult, t as CascadeDiagnostic } from "../../cascade-rhqUQrUa.js";
1
+ import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as resolveStyleElementChain, r as StyleElementChainResult, t as CascadeDiagnostic } from "../../cascade-BZ7zqXhL.js";
2
2
  export { CascadeDiagnostic, StyleCascadeResult, StyleElementChainResult, findStyleElement, resolveStyle, resolveStyleElementChain };
@@ -28,6 +28,72 @@ function odfResidue(format, ...elements) {
28
28
  xml: require_xml_build.buildXml(elements)
29
29
  };
30
30
  }
31
+ const ODF_EXTENSION_NAMESPACE_PREFIXES = /* @__PURE__ */ new Set([
32
+ "loext:",
33
+ "calcext:",
34
+ "officeooo:",
35
+ "ooo:",
36
+ "oooc:",
37
+ "ooow:",
38
+ "formx:",
39
+ "field:",
40
+ "drawooo:",
41
+ "tableooo:"
42
+ ]);
43
+ function isOdfExtensionElement(element) {
44
+ return [...ODF_EXTENSION_NAMESPACE_PREFIXES].some((prefix) => element.tag.startsWith(prefix));
45
+ }
46
+ const ODF_UNMAPPED_SHAPE_TAGS = /* @__PURE__ */ new Set([
47
+ "dr3d:scene",
48
+ "draw:connector",
49
+ "draw:measure",
50
+ "draw:applet",
51
+ "draw:plugin",
52
+ "draw:floating-frame"
53
+ ]);
54
+ function collectOdfUnmappedShapeResidue(children, out) {
55
+ for (const node of children) {
56
+ if (node.type !== "element") continue;
57
+ if (node.tag === "draw:g") collectOdfUnmappedShapeResidue(node.children, out);
58
+ else if (ODF_UNMAPPED_SHAPE_TAGS.has(node.tag) || isOdfExtensionElement(node)) out.push(node);
59
+ }
60
+ }
61
+ function odfAttributeElement(element, ...attributeNames) {
62
+ return {
63
+ ...element,
64
+ children: [],
65
+ attributes: element.attributes.filter((attribute) => attributeNames.includes(attribute.name))
66
+ };
67
+ }
68
+ function addOdfPackageResidue(out, key, format, ...elements) {
69
+ if (elements.length === 0) return;
70
+ const addition = require_xml_build.buildXml(elements);
71
+ const existing = out[key];
72
+ out[key] = existing === void 0 ? {
73
+ format,
74
+ xml: addition
75
+ } : {
76
+ format,
77
+ xml: `${existing.xml}${addition}`
78
+ };
79
+ }
80
+ const ODF_CONSUMED_PART_PATHS = /* @__PURE__ */ new Set([
81
+ "content.xml",
82
+ "styles.xml",
83
+ "meta.xml",
84
+ "META-INF/manifest.xml"
85
+ ]);
86
+ function isEmbeddedObjectPart(path) {
87
+ const [firstSegment] = path.split("/");
88
+ return firstSegment !== void 0 && /^Object \d+$/.test(firstSegment);
89
+ }
90
+ function collectOdfNonContentPartResidue(pkg, format, out) {
91
+ for (const [path, part] of Object.entries(pkg.parts)) {
92
+ if (part.kind !== "xml" || ODF_CONSUMED_PART_PATHS.has(path) || isEmbeddedObjectPart(path)) continue;
93
+ const elements = part.nodes.filter((node) => node.type === "element");
94
+ if (elements.length > 0) out[path] = odfResidue(format, ...elements);
95
+ }
96
+ }
31
97
  function readOdfBooleanAttribute(element, name) {
32
98
  const raw = require_xml_query.attrValue(element, name);
33
99
  if (raw === "true") return true;
@@ -132,8 +198,8 @@ function isOdfBlockScopedHalf(half, paragraphElement) {
132
198
  function pairOdfMarkerHalves(halves, paragraphElement) {
133
199
  const byKey = /* @__PURE__ */ new Map();
134
200
  for (const half of halves) {
135
- const existing = byKey.get(half.key);
136
- if (existing === void 0) byKey.set(half.key, [half]);
201
+ const existing = byKey.get(`${half.kind} ${half.key}`);
202
+ if (existing === void 0) byKey.set(`${half.kind} ${half.key}`, [half]);
137
203
  else existing.push(half);
138
204
  }
139
205
  const extents = [];
@@ -372,15 +438,22 @@ function collectOdfNamedExpressions(nodes, out) {
372
438
  }
373
439
  }
374
440
  //#endregion
441
+ exports.ODF_CONSUMED_PART_PATHS = ODF_CONSUMED_PART_PATHS;
375
442
  exports.ODF_INDEX_WRAPPER_TAGS = ODF_INDEX_WRAPPER_TAGS;
443
+ exports.ODF_UNMAPPED_SHAPE_TAGS = ODF_UNMAPPED_SHAPE_TAGS;
444
+ exports.addOdfPackageResidue = addOdfPackageResidue;
376
445
  exports.collectOdfDataStyleDefinitions = collectOdfDataStyleDefinitions;
377
446
  exports.collectOdfFieldMasterDefinitions = collectOdfFieldMasterDefinitions;
378
447
  exports.collectOdfFontFaceDefinitions = collectOdfFontFaceDefinitions;
379
448
  exports.collectOdfNamedExpressions = collectOdfNamedExpressions;
449
+ exports.collectOdfNonContentPartResidue = collectOdfNonContentPartResidue;
380
450
  exports.collectOdfProvenanceRegions = collectOdfProvenanceRegions;
451
+ exports.collectOdfUnmappedShapeResidue = collectOdfUnmappedShapeResidue;
381
452
  exports.insertOdfConstructMarkers = insertOdfConstructMarkers;
382
453
  exports.isOdfBlockScopedHalf = isOdfBlockScopedHalf;
454
+ exports.isOdfExtensionElement = isOdfExtensionElement;
383
455
  exports.isOdfIndexWrapper = isOdfIndexWrapper;
456
+ exports.odfAttributeElement = odfAttributeElement;
384
457
  exports.odfBookmarkAnchorDescriptor = odfBookmarkAnchorDescriptor;
385
458
  exports.odfChangedRegionId = odfChangedRegionId;
386
459
  exports.odfDivisionDescriptor = odfDivisionDescriptor;
@@ -1,2 +1,2 @@
1
- import { C as pairOdfMarkerHalves, S as odfResidue, _ as odfChangedRegionId, a as OdfMarkerHalf, b as odfIndexControlDescriptor, c as collectOdfDataStyleDefinitions, d as collectOdfNamedExpressions, f as collectOdfProvenanceRegions, g as odfBookmarkAnchorDescriptor, h as isOdfIndexWrapper, i as OdfMarkerEvent, l as collectOdfFieldMasterDefinitions, m as isOdfBlockScopedHalf, n as OdfConstructExtent, o as OdfMarkerKind, p as insertOdfConstructMarkers, r as OdfDefinitionsSink, s as OdfResidueFormat, t as ODF_INDEX_WRAPPER_TAGS, u as collectOdfFontFaceDefinitions, v as odfDivisionDescriptor, w as resolveOdfMarkerEvents, x as odfMarkerHalfEventIndex, y as odfFieldDescriptor } from "../../constructs-Dy_DMFs3.cjs";
2
- export { ODF_INDEX_WRAPPER_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfProvenanceRegions, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfIndexWrapper, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
1
+ import { A as pairOdfMarkerHalves, C as odfBookmarkAnchorDescriptor, D as odfIndexControlDescriptor, E as odfFieldDescriptor, O as odfMarkerHalfEventIndex, S as odfAttributeElement, T as odfDivisionDescriptor, _ as collectOdfUnmappedShapeResidue, a as OdfDefinitionsSink, b as isOdfExtensionElement, c as OdfMarkerKind, d as collectOdfDataStyleDefinitions, f as collectOdfFieldMasterDefinitions, g as collectOdfProvenanceRegions, h as collectOdfNonContentPartResidue, i as OdfConstructExtent, j as resolveOdfMarkerEvents, k as odfResidue, l as OdfResidueFormat, m as collectOdfNamedExpressions, n as ODF_INDEX_WRAPPER_TAGS, o as OdfMarkerEvent, p as collectOdfFontFaceDefinitions, r as ODF_UNMAPPED_SHAPE_TAGS, s as OdfMarkerHalf, t as ODF_CONSUMED_PART_PATHS, u as addOdfPackageResidue, v as insertOdfConstructMarkers, w as odfChangedRegionId, x as isOdfIndexWrapper, y as isOdfBlockScopedHalf } from "../../constructs-FLBse5UV.cjs";
2
+ export { ODF_CONSUMED_PART_PATHS, ODF_INDEX_WRAPPER_TAGS, ODF_UNMAPPED_SHAPE_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, addOdfPackageResidue, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfNonContentPartResidue, collectOdfProvenanceRegions, collectOdfUnmappedShapeResidue, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfExtensionElement, isOdfIndexWrapper, odfAttributeElement, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
@@ -1,2 +1,2 @@
1
- import { C as pairOdfMarkerHalves, S as odfResidue, _ as odfChangedRegionId, a as OdfMarkerHalf, b as odfIndexControlDescriptor, c as collectOdfDataStyleDefinitions, d as collectOdfNamedExpressions, f as collectOdfProvenanceRegions, g as odfBookmarkAnchorDescriptor, h as isOdfIndexWrapper, i as OdfMarkerEvent, l as collectOdfFieldMasterDefinitions, m as isOdfBlockScopedHalf, n as OdfConstructExtent, o as OdfMarkerKind, p as insertOdfConstructMarkers, r as OdfDefinitionsSink, s as OdfResidueFormat, t as ODF_INDEX_WRAPPER_TAGS, u as collectOdfFontFaceDefinitions, v as odfDivisionDescriptor, w as resolveOdfMarkerEvents, x as odfMarkerHalfEventIndex, y as odfFieldDescriptor } from "../../constructs-CJpDDQV0.js";
2
- export { ODF_INDEX_WRAPPER_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfProvenanceRegions, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfIndexWrapper, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
1
+ import { A as pairOdfMarkerHalves, C as odfBookmarkAnchorDescriptor, D as odfIndexControlDescriptor, E as odfFieldDescriptor, O as odfMarkerHalfEventIndex, S as odfAttributeElement, T as odfDivisionDescriptor, _ as collectOdfUnmappedShapeResidue, a as OdfDefinitionsSink, b as isOdfExtensionElement, c as OdfMarkerKind, d as collectOdfDataStyleDefinitions, f as collectOdfFieldMasterDefinitions, g as collectOdfProvenanceRegions, h as collectOdfNonContentPartResidue, i as OdfConstructExtent, j as resolveOdfMarkerEvents, k as odfResidue, l as OdfResidueFormat, m as collectOdfNamedExpressions, n as ODF_INDEX_WRAPPER_TAGS, o as OdfMarkerEvent, p as collectOdfFontFaceDefinitions, r as ODF_UNMAPPED_SHAPE_TAGS, s as OdfMarkerHalf, t as ODF_CONSUMED_PART_PATHS, u as addOdfPackageResidue, v as insertOdfConstructMarkers, w as odfChangedRegionId, x as isOdfIndexWrapper, y as isOdfBlockScopedHalf } from "../../constructs-C1S8qlVv.js";
2
+ export { ODF_CONSUMED_PART_PATHS, ODF_INDEX_WRAPPER_TAGS, ODF_UNMAPPED_SHAPE_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, addOdfPackageResidue, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfNonContentPartResidue, collectOdfProvenanceRegions, collectOdfUnmappedShapeResidue, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfExtensionElement, isOdfIndexWrapper, odfAttributeElement, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
@@ -27,6 +27,72 @@ function odfResidue(format, ...elements) {
27
27
  xml: buildXml(elements)
28
28
  };
29
29
  }
30
+ const ODF_EXTENSION_NAMESPACE_PREFIXES = /* @__PURE__ */ new Set([
31
+ "loext:",
32
+ "calcext:",
33
+ "officeooo:",
34
+ "ooo:",
35
+ "oooc:",
36
+ "ooow:",
37
+ "formx:",
38
+ "field:",
39
+ "drawooo:",
40
+ "tableooo:"
41
+ ]);
42
+ function isOdfExtensionElement(element) {
43
+ return [...ODF_EXTENSION_NAMESPACE_PREFIXES].some((prefix) => element.tag.startsWith(prefix));
44
+ }
45
+ const ODF_UNMAPPED_SHAPE_TAGS = /* @__PURE__ */ new Set([
46
+ "dr3d:scene",
47
+ "draw:connector",
48
+ "draw:measure",
49
+ "draw:applet",
50
+ "draw:plugin",
51
+ "draw:floating-frame"
52
+ ]);
53
+ function collectOdfUnmappedShapeResidue(children, out) {
54
+ for (const node of children) {
55
+ if (node.type !== "element") continue;
56
+ if (node.tag === "draw:g") collectOdfUnmappedShapeResidue(node.children, out);
57
+ else if (ODF_UNMAPPED_SHAPE_TAGS.has(node.tag) || isOdfExtensionElement(node)) out.push(node);
58
+ }
59
+ }
60
+ function odfAttributeElement(element, ...attributeNames) {
61
+ return {
62
+ ...element,
63
+ children: [],
64
+ attributes: element.attributes.filter((attribute) => attributeNames.includes(attribute.name))
65
+ };
66
+ }
67
+ function addOdfPackageResidue(out, key, format, ...elements) {
68
+ if (elements.length === 0) return;
69
+ const addition = buildXml(elements);
70
+ const existing = out[key];
71
+ out[key] = existing === void 0 ? {
72
+ format,
73
+ xml: addition
74
+ } : {
75
+ format,
76
+ xml: `${existing.xml}${addition}`
77
+ };
78
+ }
79
+ const ODF_CONSUMED_PART_PATHS = /* @__PURE__ */ new Set([
80
+ "content.xml",
81
+ "styles.xml",
82
+ "meta.xml",
83
+ "META-INF/manifest.xml"
84
+ ]);
85
+ function isEmbeddedObjectPart(path) {
86
+ const [firstSegment] = path.split("/");
87
+ return firstSegment !== void 0 && /^Object \d+$/.test(firstSegment);
88
+ }
89
+ function collectOdfNonContentPartResidue(pkg, format, out) {
90
+ for (const [path, part] of Object.entries(pkg.parts)) {
91
+ if (part.kind !== "xml" || ODF_CONSUMED_PART_PATHS.has(path) || isEmbeddedObjectPart(path)) continue;
92
+ const elements = part.nodes.filter((node) => node.type === "element");
93
+ if (elements.length > 0) out[path] = odfResidue(format, ...elements);
94
+ }
95
+ }
30
96
  function readOdfBooleanAttribute(element, name) {
31
97
  const raw = attrValue(element, name);
32
98
  if (raw === "true") return true;
@@ -131,8 +197,8 @@ function isOdfBlockScopedHalf(half, paragraphElement) {
131
197
  function pairOdfMarkerHalves(halves, paragraphElement) {
132
198
  const byKey = /* @__PURE__ */ new Map();
133
199
  for (const half of halves) {
134
- const existing = byKey.get(half.key);
135
- if (existing === void 0) byKey.set(half.key, [half]);
200
+ const existing = byKey.get(`${half.kind} ${half.key}`);
201
+ if (existing === void 0) byKey.set(`${half.kind} ${half.key}`, [half]);
136
202
  else existing.push(half);
137
203
  }
138
204
  const extents = [];
@@ -371,4 +437,4 @@ function collectOdfNamedExpressions(nodes, out) {
371
437
  }
372
438
  }
373
439
  //#endregion
374
- export { ODF_INDEX_WRAPPER_TAGS, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfProvenanceRegions, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfIndexWrapper, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
440
+ export { ODF_CONSUMED_PART_PATHS, ODF_INDEX_WRAPPER_TAGS, ODF_UNMAPPED_SHAPE_TAGS, addOdfPackageResidue, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfNonContentPartResidue, collectOdfProvenanceRegions, collectOdfUnmappedShapeResidue, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfExtensionElement, isOdfIndexWrapper, odfAttributeElement, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
@@ -1,2 +1,2 @@
1
- import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-cIjw-Jf-.cjs";
1
+ import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-Eh1N15Qy.cjs";
2
2
  export { OdbFormControl, OdbFormDefinition, readOdfFormControlConstructs, readOdfFormDefinitions };
@@ -1,2 +1,2 @@
1
- import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-D1-0spCe.js";
1
+ import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-CyLw7lpE.js";
2
2
  export { OdbFormControl, OdbFormDefinition, readOdfFormControlConstructs, readOdfFormDefinitions };
@@ -34,6 +34,13 @@ function resolveDrawPageSize(page, pkg) {
34
34
  const properties = resolvePageLayoutProperties(pkg, require_xml_query.attrValue(page, "draw:master-page-name"));
35
35
  return properties === void 0 ? void 0 : require_typed_shared_geometry.parsePageSize(properties);
36
36
  }
37
+ function readOdfMasterPageElements(pkg) {
38
+ const stylesPart = pkg.parts[STYLES_PART];
39
+ const stylesRoot = stylesPart?.kind === "xml" ? require_xml_query.rootElement(stylesPart.nodes) : void 0;
40
+ const masterStyles = stylesRoot === void 0 ? void 0 : require_xml_query.findChildElement(stylesRoot.children, "office:master-styles");
41
+ return masterStyles === void 0 ? [] : require_xml_query.childrenWithTag(masterStyles, "style:master-page");
42
+ }
37
43
  //#endregion
44
+ exports.readOdfMasterPageElements = readOdfMasterPageElements;
38
45
  exports.resolveDrawPageSize = resolveDrawPageSize;
39
46
  exports.resolvePageLayoutProperties = resolvePageLayoutProperties;
@@ -1,2 +1,2 @@
1
- import { n as resolvePageLayoutProperties, t as resolveDrawPageSize } from "../../masterpage-XJ2v2khe.cjs";
2
- export { resolveDrawPageSize, resolvePageLayoutProperties };
1
+ import { n as resolveDrawPageSize, r as resolvePageLayoutProperties, t as readOdfMasterPageElements } from "../../masterpage-Bt6gxuoL.cjs";
2
+ export { readOdfMasterPageElements, resolveDrawPageSize, resolvePageLayoutProperties };
@@ -1,2 +1,2 @@
1
- import { n as resolvePageLayoutProperties, t as resolveDrawPageSize } from "../../masterpage-C1McDhMv.js";
2
- export { resolveDrawPageSize, resolvePageLayoutProperties };
1
+ import { n as resolveDrawPageSize, r as resolvePageLayoutProperties, t as readOdfMasterPageElements } from "../../masterpage-By_F05W4.js";
2
+ export { readOdfMasterPageElements, resolveDrawPageSize, resolvePageLayoutProperties };
@@ -33,5 +33,11 @@ function resolveDrawPageSize(page, pkg) {
33
33
  const properties = resolvePageLayoutProperties(pkg, attrValue(page, "draw:master-page-name"));
34
34
  return properties === void 0 ? void 0 : parsePageSize(properties);
35
35
  }
36
+ function readOdfMasterPageElements(pkg) {
37
+ const stylesPart = pkg.parts[STYLES_PART];
38
+ const stylesRoot = stylesPart?.kind === "xml" ? rootElement(stylesPart.nodes) : void 0;
39
+ const masterStyles = stylesRoot === void 0 ? void 0 : findChildElement(stylesRoot.children, "office:master-styles");
40
+ return masterStyles === void 0 ? [] : childrenWithTag(masterStyles, "style:master-page");
41
+ }
36
42
  //#endregion
37
- export { resolveDrawPageSize, resolvePageLayoutProperties };
43
+ export { readOdfMasterPageElements, resolveDrawPageSize, resolvePageLayoutProperties };
@@ -51,7 +51,7 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
51
51
  startRun,
52
52
  endRun: out.length
53
53
  });
54
- } else if (node.tag === "text:bookmark") {
54
+ } else if (node.tag === "text:bookmark" || node.tag === "text:reference-mark") {
55
55
  const name = require_xml_query.attrValue(node, "text:name");
56
56
  if (name !== void 0) {
57
57
  const runPosition = out.length;
@@ -61,6 +61,18 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
61
61
  endRun: runPosition
62
62
  });
63
63
  }
64
+ } else if (node.tag === "text:reference-mark-start" || node.tag === "text:reference-mark-end") {
65
+ const name = require_xml_query.attrValue(node, "text:name");
66
+ if (name !== void 0) walk.halves.push({
67
+ kind: "referenceMark",
68
+ side: node.tag === "text:reference-mark-start" ? "start" : "end",
69
+ key: require_xml_entities.decodeXmlText(name),
70
+ element: node,
71
+ parent: container,
72
+ runPosition: out.length,
73
+ order: walk.order++,
74
+ descriptor: () => require_typed_shared_constructs.odfBookmarkAnchorDescriptor(require_xml_entities.decodeXmlText(name))
75
+ });
64
76
  } else if (node.tag === "text:bookmark-start" || node.tag === "text:bookmark-end") {
65
77
  const name = require_xml_query.attrValue(node, "text:name");
66
78
  if (name !== void 0) walk.halves.push({
@@ -177,6 +189,10 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
177
189
  order: walk.order++,
178
190
  descriptor: () => void 0
179
191
  });
192
+ } else if (node.tag === "text:ruby" || node.tag === "text:meta" || require_typed_shared_constructs.isOdfExtensionElement(node)) {
193
+ if (node.tag === "text:ruby") for (const base of require_xml_query.childrenWithTag(node, "text:ruby-base")) collectRuns(base, baseProperties, pkg, out, walk, hyperlinkTarget);
194
+ else collectRuns(node, baseProperties, pkg, out, walk, hyperlinkTarget);
195
+ walk.residueElements.push(node);
180
196
  }
181
197
  }
182
198
  }
@@ -201,21 +217,25 @@ function runFromText(text, properties) {
201
217
  function readOdfParagraph(pElement, pkg, context = {}) {
202
218
  const styleName = require_xml_query.attrValue(pElement, "text:style-name");
203
219
  const paragraphProperties = require_typed_shared_cascade.resolveStyle(styleName, "paragraph", pkg).properties;
204
- let source;
205
- if (context.format !== void 0 && styleName !== void 0) {
206
- const unknownElements = require_typed_shared_cascade.resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...require_xml_query.childrenWithTag(style, "style:paragraph-properties").filter((properties) => require_styles_properties.parseParagraphProperties(properties).hasUnknown), ...require_xml_query.childrenWithTag(style, "style:text-properties").filter((properties) => require_styles_properties.parseTextProperties(properties).hasUnknown)]);
207
- if (unknownElements.length > 0) source = require_typed_shared_constructs.odfResidue(context.format, ...unknownElements);
208
- }
209
220
  const runs = [];
210
221
  const walk = {
211
222
  extents: [],
212
223
  halves: [],
224
+ residueElements: [],
213
225
  order: 0,
214
226
  provenanceRegions: context.provenanceRegions,
215
227
  definitions: context.definitions,
216
228
  listIdState: context.listIdState ?? { next: 1 }
217
229
  };
218
230
  collectRuns(pElement, paragraphProperties, pkg, runs, walk);
231
+ let source;
232
+ if (context.format !== void 0) {
233
+ const residueElements = [];
234
+ if (styleName !== void 0) residueElements.push(...require_typed_shared_cascade.resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...require_xml_query.childrenWithTag(style, "style:paragraph-properties").filter((properties) => require_styles_properties.parseParagraphProperties(properties).hasUnknown), ...require_xml_query.childrenWithTag(style, "style:text-properties").filter((properties) => require_styles_properties.parseTextProperties(properties).hasUnknown)]));
235
+ if (require_xml_query.attrValue(pElement, "text:is-list-header") !== void 0) residueElements.push(require_typed_shared_constructs.odfAttributeElement(pElement, "text:is-list-header"));
236
+ residueElements.push(...walk.residueElements);
237
+ if (residueElements.length > 0) source = require_typed_shared_constructs.odfResidue(context.format, ...residueElements);
238
+ }
219
239
  const { extents: pairedExtents, paired } = require_typed_shared_constructs.pairOdfMarkerHalves(walk.halves, pElement);
220
240
  walk.extents.push(...pairedExtents);
221
241
  for (const half of walk.halves) if (half.kind === "annotation" && half.side === "start" && !paired.has(half.element) && !require_typed_shared_constructs.isOdfBlockScopedHalf(half, pElement)) {
@@ -238,8 +258,11 @@ function readOdfParagraph(pElement, pkg, context = {}) {
238
258
  spacingAfterPt: paragraphProperties.spacingAfterPt,
239
259
  lineSpacing: paragraphProperties.lineSpacing,
240
260
  indentLeftPt: paragraphProperties.indentLeftPt,
241
- indentFirstLinePt: paragraphProperties.indentFirstLinePt
261
+ indentFirstLinePt: paragraphProperties.indentFirstLinePt,
262
+ pageBreakBefore: paragraphProperties.pageBreakBefore,
263
+ pageBreakAfter: paragraphProperties.pageBreakAfter
242
264
  };
243
265
  }
244
266
  //#endregion
267
+ exports.readOdfConstructBodyBlocks = readOdfConstructBodyBlocks;
245
268
  exports.readOdfParagraph = readOdfParagraph;
@@ -1,2 +1,2 @@
1
- import { n as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-BBmSl_sK.cjs";
2
- export { OdfParagraphContext, readOdfParagraph };
1
+ import { n as readOdfConstructBodyBlocks, r as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-BEAeuCLf.cjs";
2
+ export { OdfParagraphContext, readOdfConstructBodyBlocks, readOdfParagraph };
@@ -1,2 +1,2 @@
1
- import { n as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-6hzAZpmi.js";
2
- export { OdfParagraphContext, readOdfParagraph };
1
+ import { n as readOdfConstructBodyBlocks, r as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-DdcX8JuK.js";
2
+ export { OdfParagraphContext, readOdfConstructBodyBlocks, readOdfParagraph };
@@ -4,7 +4,7 @@ import { attrValue, childrenWithTag, findChildElement } from "../../xml/query.js
4
4
  import { decodeOdfText, getOdfSpaceCount, isOdfFieldElement } from "./text.js";
5
5
  import { resolveStyle, resolveStyleElementChain } from "./cascade.js";
6
6
  import { mintOdfListNumId, readOdfListParagraphs } from "./list.js";
7
- import { isOdfBlockScopedHalf, odfBookmarkAnchorDescriptor, odfFieldDescriptor, odfResidue, pairOdfMarkerHalves } from "./constructs.js";
7
+ import { isOdfBlockScopedHalf, isOdfExtensionElement, odfAttributeElement, odfBookmarkAnchorDescriptor, odfFieldDescriptor, odfResidue, pairOdfMarkerHalves } from "./constructs.js";
8
8
  //#region src/typed/shared/paragraph.ts
9
9
  function readOdfConstructBodyBlocks(body, pkg, context, listIdState) {
10
10
  const blocks = [];
@@ -50,7 +50,7 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
50
50
  startRun,
51
51
  endRun: out.length
52
52
  });
53
- } else if (node.tag === "text:bookmark") {
53
+ } else if (node.tag === "text:bookmark" || node.tag === "text:reference-mark") {
54
54
  const name = attrValue(node, "text:name");
55
55
  if (name !== void 0) {
56
56
  const runPosition = out.length;
@@ -60,6 +60,18 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
60
60
  endRun: runPosition
61
61
  });
62
62
  }
63
+ } else if (node.tag === "text:reference-mark-start" || node.tag === "text:reference-mark-end") {
64
+ const name = attrValue(node, "text:name");
65
+ if (name !== void 0) walk.halves.push({
66
+ kind: "referenceMark",
67
+ side: node.tag === "text:reference-mark-start" ? "start" : "end",
68
+ key: decodeXmlText(name),
69
+ element: node,
70
+ parent: container,
71
+ runPosition: out.length,
72
+ order: walk.order++,
73
+ descriptor: () => odfBookmarkAnchorDescriptor(decodeXmlText(name))
74
+ });
63
75
  } else if (node.tag === "text:bookmark-start" || node.tag === "text:bookmark-end") {
64
76
  const name = attrValue(node, "text:name");
65
77
  if (name !== void 0) walk.halves.push({
@@ -176,6 +188,10 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
176
188
  order: walk.order++,
177
189
  descriptor: () => void 0
178
190
  });
191
+ } else if (node.tag === "text:ruby" || node.tag === "text:meta" || isOdfExtensionElement(node)) {
192
+ if (node.tag === "text:ruby") for (const base of childrenWithTag(node, "text:ruby-base")) collectRuns(base, baseProperties, pkg, out, walk, hyperlinkTarget);
193
+ else collectRuns(node, baseProperties, pkg, out, walk, hyperlinkTarget);
194
+ walk.residueElements.push(node);
179
195
  }
180
196
  }
181
197
  }
@@ -200,21 +216,25 @@ function runFromText(text, properties) {
200
216
  function readOdfParagraph(pElement, pkg, context = {}) {
201
217
  const styleName = attrValue(pElement, "text:style-name");
202
218
  const paragraphProperties = resolveStyle(styleName, "paragraph", pkg).properties;
203
- let source;
204
- if (context.format !== void 0 && styleName !== void 0) {
205
- const unknownElements = resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...childrenWithTag(style, "style:paragraph-properties").filter((properties) => parseParagraphProperties(properties).hasUnknown), ...childrenWithTag(style, "style:text-properties").filter((properties) => parseTextProperties(properties).hasUnknown)]);
206
- if (unknownElements.length > 0) source = odfResidue(context.format, ...unknownElements);
207
- }
208
219
  const runs = [];
209
220
  const walk = {
210
221
  extents: [],
211
222
  halves: [],
223
+ residueElements: [],
212
224
  order: 0,
213
225
  provenanceRegions: context.provenanceRegions,
214
226
  definitions: context.definitions,
215
227
  listIdState: context.listIdState ?? { next: 1 }
216
228
  };
217
229
  collectRuns(pElement, paragraphProperties, pkg, runs, walk);
230
+ let source;
231
+ if (context.format !== void 0) {
232
+ const residueElements = [];
233
+ if (styleName !== void 0) residueElements.push(...resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...childrenWithTag(style, "style:paragraph-properties").filter((properties) => parseParagraphProperties(properties).hasUnknown), ...childrenWithTag(style, "style:text-properties").filter((properties) => parseTextProperties(properties).hasUnknown)]));
234
+ if (attrValue(pElement, "text:is-list-header") !== void 0) residueElements.push(odfAttributeElement(pElement, "text:is-list-header"));
235
+ residueElements.push(...walk.residueElements);
236
+ if (residueElements.length > 0) source = odfResidue(context.format, ...residueElements);
237
+ }
218
238
  const { extents: pairedExtents, paired } = pairOdfMarkerHalves(walk.halves, pElement);
219
239
  walk.extents.push(...pairedExtents);
220
240
  for (const half of walk.halves) if (half.kind === "annotation" && half.side === "start" && !paired.has(half.element) && !isOdfBlockScopedHalf(half, pElement)) {
@@ -237,8 +257,10 @@ function readOdfParagraph(pElement, pkg, context = {}) {
237
257
  spacingAfterPt: paragraphProperties.spacingAfterPt,
238
258
  lineSpacing: paragraphProperties.lineSpacing,
239
259
  indentLeftPt: paragraphProperties.indentLeftPt,
240
- indentFirstLinePt: paragraphProperties.indentFirstLinePt
260
+ indentFirstLinePt: paragraphProperties.indentFirstLinePt,
261
+ pageBreakBefore: paragraphProperties.pageBreakBefore,
262
+ pageBreakAfter: paragraphProperties.pageBreakAfter
241
263
  };
242
264
  }
243
265
  //#endregion
244
- export { readOdfParagraph };
266
+ export { readOdfConstructBodyBlocks, readOdfParagraph };
@@ -46,6 +46,9 @@ const ODF_FIELD_TAGS = /* @__PURE__ */ new Set([
46
46
  "text:user-field-input",
47
47
  "text:sequence",
48
48
  "text:sequence-ref",
49
+ "text:bookmark-ref",
50
+ "text:note-ref",
51
+ "text:reference-ref",
49
52
  "text:database-display",
50
53
  "text:database-name",
51
54
  "text:database-next",
@@ -45,6 +45,9 @@ const ODF_FIELD_TAGS = /* @__PURE__ */ new Set([
45
45
  "text:user-field-input",
46
46
  "text:sequence",
47
47
  "text:sequence-ref",
48
+ "text:bookmark-ref",
49
+ "text:note-ref",
50
+ "text:reference-ref",
48
51
  "text:database-display",
49
52
  "text:database-name",
50
53
  "text:database-next",