@harbour-enterprises/superdoc 1.0.4 → 2.0.0-next.10

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 (53) hide show
  1. package/dist/chunks/{PdfViewer-CEsyOAkj.cjs → PdfViewer-BPeCb-xB.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-HJvoIAmw.es.js → PdfViewer-CEK62Xt7.es.js} +1 -1
  3. package/dist/chunks/{index-Bv0DGtbh-K1rWUuu7.cjs → index-BjfjH1jR-CqVyr7iV.cjs} +1 -1
  4. package/dist/chunks/{index-Bv0DGtbh-urKMoo8D.es.js → index-BjfjH1jR-DA6bQUce.es.js} +1 -1
  5. package/dist/chunks/{index-Bz20imLv.es.js → index-D0T8-Wdm.es.js} +3 -3
  6. package/dist/chunks/{index-BnbidVv1.cjs → index-qzVJpQrS.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-DJA6a1gh.cjs → super-editor.es-B6s3KBGi.cjs} +85 -32
  8. package/dist/chunks/{super-editor.es-KVC6ktpa.es.js → super-editor.es-DYbXag4d.es.js} +85 -32
  9. package/dist/images/altText_add.svg +3 -0
  10. package/dist/images/altText_disclaimer.svg +3 -0
  11. package/dist/images/altText_done.svg +3 -0
  12. package/dist/images/altText_spinner.svg +30 -0
  13. package/dist/images/altText_warning.svg +3 -0
  14. package/dist/images/annotation-check.svg +11 -0
  15. package/dist/images/annotation-comment.svg +16 -0
  16. package/dist/images/annotation-help.svg +26 -0
  17. package/dist/images/annotation-insert.svg +10 -0
  18. package/dist/images/annotation-key.svg +11 -0
  19. package/dist/images/annotation-newparagraph.svg +11 -0
  20. package/dist/images/annotation-noicon.svg +7 -0
  21. package/dist/images/annotation-note.svg +42 -0
  22. package/dist/images/annotation-paperclip.svg +6 -0
  23. package/dist/images/annotation-paragraph.svg +16 -0
  24. package/dist/images/annotation-pushpin.svg +7 -0
  25. package/dist/images/cursor-editorFreeHighlight.svg +6 -0
  26. package/dist/images/cursor-editorFreeText.svg +3 -0
  27. package/dist/images/cursor-editorInk.svg +4 -0
  28. package/dist/images/cursor-editorTextHighlight.svg +8 -0
  29. package/dist/images/editor-toolbar-delete.svg +5 -0
  30. package/dist/images/loading-icon.gif +0 -0
  31. package/dist/images/messageBar_closingButton.svg +3 -0
  32. package/dist/images/messageBar_warning.svg +3 -0
  33. package/dist/images/toolbarButton-editorHighlight.svg +6 -0
  34. package/dist/images/toolbarButton-menuArrow.svg +3 -0
  35. package/dist/super-editor/ai-writer.es.js +2 -2
  36. package/dist/super-editor/chunks/{converter-gJwtBYAj.js → converter-WYQ7aFni.js} +45 -3
  37. package/dist/super-editor/chunks/{docx-zipper-W2QGfyJo.js → docx-zipper-ClbA5S-4.js} +1 -1
  38. package/dist/super-editor/chunks/{editor-R8q_NUAb.js → editor-CxwcruHz.js} +42 -31
  39. package/dist/super-editor/chunks/{index-Bv0DGtbh.js → index-BjfjH1jR.js} +1 -1
  40. package/dist/super-editor/chunks/{toolbar-Bh9zkddg.js → toolbar-D-4TWvLd.js} +2 -2
  41. package/dist/super-editor/converter.es.js +1 -1
  42. package/dist/super-editor/docx-zipper.es.js +2 -2
  43. package/dist/super-editor/editor.es.js +3 -3
  44. package/dist/super-editor/file-zipper.es.js +1 -1
  45. package/dist/super-editor/super-editor.es.js +6 -6
  46. package/dist/super-editor/toolbar.es.js +2 -2
  47. package/dist/super-editor.cjs +1 -1
  48. package/dist/super-editor.es.js +1 -1
  49. package/dist/superdoc.cjs +2 -2
  50. package/dist/superdoc.es.js +2 -2
  51. package/dist/superdoc.umd.js +87 -34
  52. package/dist/superdoc.umd.js.map +1 -1
  53. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-gvuFr0vx.cjs");
4
- const superdoc = require("./index-BnbidVv1.cjs");
4
+ const superdoc = require("./index-qzVJpQrS.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, A as h, P as Transition, a0 as process$1, K as watchEffect, a as computed, r as ref, j as onMounted, X as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, s as createVNode, x as unref } from "./vue-CLFbn_1r.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-Bz20imLv.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-D0T8-Wdm.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-DJA6a1gh.cjs");
3
+ const superEditor_es = require("./super-editor.es-B6s3KBGi.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-KVC6ktpa.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DYbXag4d.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-KVC6ktpa.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DYbXag4d.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-D_2kqkfV.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17470,7 +17470,7 @@ const _sfc_main = {
17470
17470
  __name: "SuperDoc",
17471
17471
  emits: ["selection-update"],
17472
17472
  setup(__props, { emit: __emit }) {
17473
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-HJvoIAmw.es.js"));
17473
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CEK62Xt7.es.js"));
17474
17474
  const superdocStore = useSuperdocStore();
17475
17475
  const commentsStore = useCommentsStore();
17476
17476
  const {
@@ -18374,7 +18374,7 @@ class SuperDoc extends EventEmitter {
18374
18374
  this.config.colors = shuffleArray(this.config.colors);
18375
18375
  this.userColorMap = /* @__PURE__ */ new Map();
18376
18376
  this.colorIndex = 0;
18377
- this.version = "1.0.4";
18377
+ this.version = "2.0.0-next.10";
18378
18378
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18379
18379
  this.superdocId = config.superdocId || v4();
18380
18380
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-DJA6a1gh.cjs");
2
+ const superEditor_es = require("./super-editor.es-B6s3KBGi.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DIclNhoR.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17487,7 +17487,7 @@ const _sfc_main = {
17487
17487
  __name: "SuperDoc",
17488
17488
  emits: ["selection-update"],
17489
17489
  setup(__props, { emit: __emit }) {
17490
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CEsyOAkj.cjs")));
17490
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BPeCb-xB.cjs")));
17491
17491
  const superdocStore = useSuperdocStore();
17492
17492
  const commentsStore = useCommentsStore();
17493
17493
  const {
@@ -18391,7 +18391,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18391
18391
  this.config.colors = shuffleArray(this.config.colors);
18392
18392
  this.userColorMap = /* @__PURE__ */ new Map();
18393
18393
  this.colorIndex = 0;
18394
- this.version = "1.0.4";
18394
+ this.version = "2.0.0-next.10";
18395
18395
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18396
18396
  this.superdocId = config.superdocId || uuid.v4();
18397
18397
  this.colors = this.config.colors;
@@ -39216,11 +39216,15 @@ const encode$1 = (params2, encodedAttrs = {}) => {
39216
39216
  }
39217
39217
  if (elements.length === 1) {
39218
39218
  text = elements[0].text;
39219
- const xmlSpace = encodedAttrs.xmlSpace ?? elements[0]?.attributes?.["xml:space"];
39219
+ const docXmlSpace = params2.converter?.documentAttributes?.["xml:space"];
39220
+ const xmlSpace = encodedAttrs.xmlSpace ?? attributes?.["xml:space"] ?? elements[0]?.attributes?.["xml:space"] ?? docXmlSpace;
39220
39221
  if (xmlSpace !== "preserve" && typeof text === "string") {
39221
39222
  text = text.replace(/^[ \t\n\r]+/, "").replace(/[ \t\n\r]+$/, "");
39222
39223
  }
39223
39224
  text = text.replace(/\[\[sdspace\]\]/g, "");
39225
+ if (xmlSpace !== "preserve" && typeof text === "string" && !text.trim()) {
39226
+ return null;
39227
+ }
39224
39228
  } else if (!elements.length && encodedAttrs.xmlSpace === "preserve") {
39225
39229
  text = " ";
39226
39230
  } else return null;
@@ -42203,8 +42207,46 @@ const _SuperConverter = class _SuperConverter2 {
42203
42207
  this.declaration = this.initialJSON?.declaration;
42204
42208
  this.resolveDocumentGuid();
42205
42209
  }
42210
+ /**
42211
+ * Parses XML content into JSON format while preserving whitespace-only text runs.
42212
+ *
42213
+ * This method wraps xml-js's xml2json parser with additional preprocessing to prevent
42214
+ * the parser from dropping whitespace-only content in <w:t> and <w:delText> elements.
42215
+ * This is critical for correctly handling documents that rely on document-level
42216
+ * xml:space="preserve" rather than per-element attributes, which is common in
42217
+ * PDF-to-DOCX converted documents.
42218
+ *
42219
+ * The whitespace preservation strategy:
42220
+ * 1. Before parsing, wraps whitespace-only content with [[sdspace]] placeholders
42221
+ * 2. xml-js parser preserves the placeholder-wrapped text
42222
+ * 3. During text node processing (t-translator.js), placeholders are removed
42223
+ *
42224
+ * @param {string} xml - The XML string to parse
42225
+ * @returns {Object} The parsed JSON representation of the XML document
42226
+ *
42227
+ * @example
42228
+ * // Handles whitespace-only text runs
42229
+ * const xml = '<w:t> </w:t>';
42230
+ * const result = parseXmlToJson(xml);
42231
+ * // Result preserves the space: { elements: [{ text: '[[sdspace]] [[sdspace]]' }] }
42232
+ *
42233
+ * @example
42234
+ * // Handles elements with attributes
42235
+ * const xml = '<w:t xml:space="preserve"> text </w:t>';
42236
+ * const result = parseXmlToJson(xml);
42237
+ * // Preserves content and attributes
42238
+ *
42239
+ * @example
42240
+ * // Handles both w:t and w:delText elements
42241
+ * const xml = '<w:delText> </w:delText>';
42242
+ * const result = parseXmlToJson(xml);
42243
+ * // Preserves whitespace in deleted text
42244
+ */
42206
42245
  parseXmlToJson(xml) {
42207
- const newXml = xml.replace(/(<w:t xml:space="preserve">)(\s+)(<\/w:t>)/g, "$1[[sdspace]]$2[[sdspace]]$3");
42246
+ const newXml = xml.replace(
42247
+ /(<w:(?:t|delText)(?:\s[^>]*)?>)(\s+)(<\/w:(?:t|delText)>)/g,
42248
+ "$1[[sdspace]]$2[[sdspace]]$3"
42249
+ );
42208
42250
  return JSON.parse(xmljs.xml2json(newXml, null, 2));
42209
42251
  }
42210
42252
  /**
@@ -42427,7 +42469,7 @@ const _SuperConverter = class _SuperConverter2 {
42427
42469
  static getStoredSuperdocVersion(docx) {
42428
42470
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42429
42471
  }
42430
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.4") {
42472
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.10") {
42431
42473
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42432
42474
  }
42433
42475
  /**
@@ -60508,7 +60550,7 @@ const isHeadless = (editor) => {
60508
60550
  const shouldSkipNodeView = (editor) => {
60509
60551
  return isHeadless(editor);
60510
60552
  };
60511
- const summaryVersion = "1.0.4";
60553
+ const summaryVersion = "2.0.0-next.10";
60512
60554
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
60513
60555
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
60514
60556
  function mapAttributes(attrs) {
@@ -61297,7 +61339,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61297
61339
  { default: remarkStringify },
61298
61340
  { default: remarkGfm }
61299
61341
  ] = await Promise.all([
61300
- Promise.resolve().then(() => require("./index-Bv0DGtbh-K1rWUuu7.cjs")),
61342
+ Promise.resolve().then(() => require("./index-BjfjH1jR-CqVyr7iV.cjs")),
61301
61343
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
61302
61344
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
61303
61345
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -61502,7 +61544,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61502
61544
  * Process collaboration migrations
61503
61545
  */
61504
61546
  processCollaborationMigrations() {
61505
- console.debug("[checkVersionMigrations] Current editor version", "1.0.4");
61547
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.10");
61506
61548
  if (!this.options.ydoc) return;
61507
61549
  const metaMap = this.options.ydoc.getMap("meta");
61508
61550
  let docVersion = metaMap.get("version");
@@ -73868,7 +73910,8 @@ function measureCharacterX(block, line, charOffset, availableWidthOverride, alig
73868
73910
  }
73869
73911
  const text = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
73870
73912
  const runLength = text.length;
73871
- const displayText = applyTextTransform$2(text, run2.textTransform);
73913
+ const transform = isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? void 0 : run2.textTransform;
73914
+ const displayText = applyTextTransform$2(text, transform);
73872
73915
  if (currentCharOffset + runLength >= charOffset) {
73873
73916
  const offsetInRun = charOffset - currentCharOffset;
73874
73917
  ctx2.font = getRunFontString(run2);
@@ -73918,7 +73961,8 @@ function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
73918
73961
  return segmentBaseX + (offsetInSegment >= segmentChars ? segment.width ?? 0 : 0);
73919
73962
  }
73920
73963
  const text = run2.text ?? "";
73921
- const displayText = applyTextTransform$2(text, run2.textTransform);
73964
+ const transform = "textTransform" in run2 ? run2.textTransform : void 0;
73965
+ const displayText = applyTextTransform$2(text, transform);
73922
73966
  const displaySegmentText = displayText.slice(segment.fromChar, segment.toChar);
73923
73967
  const textUpToTarget = displaySegmentText.slice(0, offsetInSegment);
73924
73968
  ctx2.font = getRunFontString(run2);
@@ -74016,7 +74060,8 @@ function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride, alig
74016
74060
  }
74017
74061
  const text = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
74018
74062
  const runLength = text.length;
74019
- const displayText = applyTextTransform$2(text, run2.textTransform);
74063
+ const transform = isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? void 0 : run2.textTransform;
74064
+ const displayText = applyTextTransform$2(text, transform);
74020
74065
  if (runLength === 0) continue;
74021
74066
  ctx2.font = getRunFontString(run2);
74022
74067
  for (let i = 0; i <= runLength; i++) {
@@ -74494,12 +74539,12 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
74494
74539
  if (markerTextWidth == null && marker.markerText) {
74495
74540
  markerTextWidth = measureMarkerText(marker.markerText, marker);
74496
74541
  }
74497
- if (!Number.isFinite(markerTextWidth) || markerTextWidth < 0) {
74542
+ if (!Number.isFinite(markerTextWidth) || markerTextWidth !== void 0 && markerTextWidth < 0) {
74498
74543
  markerTextWidth = markerBoxWidth;
74499
74544
  }
74500
- markerTextWidth = Math.max(0, markerTextWidth);
74545
+ const finalMarkerTextWidth = Math.max(0, markerTextWidth ?? 0);
74501
74546
  let markerStartPos;
74502
- if (wordLayout?.firstLineIndentMode === true && Number.isFinite(marker.markerX)) {
74547
+ if (wordLayout?.firstLineIndentMode === true && typeof marker.markerX === "number" && Number.isFinite(marker.markerX)) {
74503
74548
  markerStartPos = marker.markerX;
74504
74549
  } else {
74505
74550
  markerStartPos = indentLeft - hanging + firstLine;
@@ -74507,18 +74552,18 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
74507
74552
  if (!Number.isFinite(markerStartPos)) {
74508
74553
  markerStartPos = 0;
74509
74554
  }
74510
- const currentPos = markerStartPos + markerTextWidth;
74555
+ const currentPos = markerStartPos + finalMarkerTextWidth;
74511
74556
  const suffix2 = marker.suffix ?? "tab";
74512
74557
  if (suffix2 === "space") {
74513
- return markerStartPos + markerTextWidth + SPACE_SUFFIX_GAP_PX;
74558
+ return markerStartPos + finalMarkerTextWidth + SPACE_SUFFIX_GAP_PX;
74514
74559
  }
74515
74560
  if (suffix2 === "nothing") {
74516
- return markerStartPos + markerTextWidth;
74561
+ return markerStartPos + finalMarkerTextWidth;
74517
74562
  }
74518
74563
  const markerJustification = marker.justification ?? "left";
74519
74564
  if (markerJustification !== "left") {
74520
74565
  const gutterWidth = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : LIST_MARKER_GAP$1;
74521
- return markerStartPos + markerTextWidth + Math.max(gutterWidth, LIST_MARKER_GAP$1);
74566
+ return markerStartPos + finalMarkerTextWidth + Math.max(gutterWidth, LIST_MARKER_GAP$1);
74522
74567
  }
74523
74568
  if (wordLayout?.firstLineIndentMode === true) {
74524
74569
  let targetTabStop;
@@ -74542,7 +74587,7 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
74542
74587
  if (tabWidth2 < LIST_MARKER_GAP$1) {
74543
74588
  tabWidth2 = LIST_MARKER_GAP$1;
74544
74589
  }
74545
- return markerStartPos + markerTextWidth + tabWidth2;
74590
+ return markerStartPos + finalMarkerTextWidth + tabWidth2;
74546
74591
  }
74547
74592
  const textStart = indentLeft + firstLine;
74548
74593
  let tabWidth = textStart - currentPos;
@@ -74551,7 +74596,7 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
74551
74596
  } else if (tabWidth < LIST_MARKER_GAP$1) {
74552
74597
  tabWidth = LIST_MARKER_GAP$1;
74553
74598
  }
74554
- return markerStartPos + markerTextWidth + tabWidth;
74599
+ return markerStartPos + finalMarkerTextWidth + tabWidth;
74555
74600
  }
74556
74601
  function getWordLayoutConfig(block) {
74557
74602
  if (!block || block.kind !== "paragraph") {
@@ -78832,7 +78877,8 @@ const getNextTabStopPx$1 = (currentX, tabStops, startIndex) => {
78832
78877
  function measureRunSliceWidth(run2, fromChar, toChar) {
78833
78878
  const context = getCtx();
78834
78879
  const fullText = runText(run2);
78835
- const text = applyTextTransform$1(fullText.slice(fromChar, toChar), run2.textTransform, fullText, fromChar);
78880
+ const transform = isTextRun$2(run2) ? run2.textTransform : void 0;
78881
+ const text = applyTextTransform$1(fullText.slice(fromChar, toChar), transform, fullText, fromChar);
78836
78882
  if (!context) {
78837
78883
  const textRun = isTextRun$2(run2) ? run2 : null;
78838
78884
  const size2 = textRun?.fontSize ?? 16;
@@ -82133,14 +82179,15 @@ function getAtomNodeTypes(schema) {
82133
82179
  if (!schema) return [];
82134
82180
  const types2 = [];
82135
82181
  try {
82136
- schema.nodes.forEach((nodeType, name) => {
82182
+ for (const name in schema.nodes) {
82137
82183
  if (name === "text") {
82138
- return;
82184
+ continue;
82139
82185
  }
82140
- if (nodeType.isAtom || nodeType.isLeaf) {
82186
+ const nodeType = schema.nodes[name];
82187
+ if (nodeType && (nodeType.isAtom || nodeType.isLeaf)) {
82141
82188
  types2.push(name);
82142
82189
  }
82143
- });
82190
+ }
82144
82191
  } catch {
82145
82192
  return [];
82146
82193
  }
@@ -83543,6 +83590,7 @@ function shouldRequirePageBoundary(current, next) {
83543
83590
  function hasIntrinsicBoundarySignals(_2) {
83544
83591
  return false;
83545
83592
  }
83593
+ const DEFAULT_HEADER_FOOTER_MARGIN_PX = 0;
83546
83594
  function shouldIgnoreSectionBreak(paragraph, index2, total, hasBodySectPr) {
83547
83595
  const paragraphAttrs = paragraph.attrs ?? {};
83548
83596
  const paragraphProperties = paragraphAttrs?.paragraphProperties;
@@ -83583,14 +83631,15 @@ function buildSectionRangesFromParagraphs(paragraphs, hasBodySectPr) {
83583
83631
  const sectionData = extractSectionData(item.node);
83584
83632
  if (!sectionData) return;
83585
83633
  const sectPr = getSectPrFromNode(item.node);
83634
+ const hasAnyMargin = sectionData.headerPx != null || sectionData.footerPx != null || sectionData.topPx != null || sectionData.rightPx != null || sectionData.bottomPx != null || sectionData.leftPx != null;
83586
83635
  const range2 = {
83587
83636
  sectionIndex: idx,
83588
83637
  startParagraphIndex: currentStart,
83589
83638
  endParagraphIndex: item.index,
83590
83639
  sectPr,
83591
- margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
83592
- header: sectionData.headerPx ?? 0,
83593
- footer: sectionData.footerPx ?? 0,
83640
+ margins: hasAnyMargin ? {
83641
+ header: sectionData.headerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
83642
+ footer: sectionData.footerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
83594
83643
  top: sectionData.topPx,
83595
83644
  right: sectionData.rightPx,
83596
83645
  bottom: sectionData.bottomPx,
@@ -83632,14 +83681,15 @@ function createFinalSectionFromBodySectPr(bodySectPr, currentStart, totalParagra
83632
83681
  };
83633
83682
  const bodySectionData = extractSectionData(tempNode);
83634
83683
  if (!bodySectionData) return null;
83684
+ const hasAnyMargin = bodySectionData.headerPx != null || bodySectionData.footerPx != null || bodySectionData.topPx != null || bodySectionData.rightPx != null || bodySectionData.bottomPx != null || bodySectionData.leftPx != null;
83635
83685
  return {
83636
83686
  sectionIndex,
83637
83687
  startParagraphIndex: currentStart,
83638
83688
  endParagraphIndex: totalParagraphs - 1,
83639
83689
  sectPr: bodySectPr,
83640
- margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
83641
- header: bodySectionData.headerPx ?? 0,
83642
- footer: bodySectionData.footerPx ?? 0,
83690
+ margins: hasAnyMargin ? {
83691
+ header: bodySectionData.headerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
83692
+ footer: bodySectionData.footerPx ?? DEFAULT_HEADER_FOOTER_MARGIN_PX,
83643
83693
  top: bodySectionData.topPx,
83644
83694
  right: bodySectionData.rightPx,
83645
83695
  bottom: bodySectionData.bottomPx,
@@ -86367,7 +86417,10 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
86367
86417
  tabStops: cloneIfObject(resolvedExtended.tabStops),
86368
86418
  keepLines: resolvedExtended.keepLines,
86369
86419
  keepNext: resolvedExtended.keepNext,
86370
- numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
86420
+ numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties),
86421
+ // Extract contextualSpacing from style resolution - this is a sibling to spacing in OOXML,
86422
+ // not nested within it. When true, suppresses spacing between paragraphs of the same style.
86423
+ contextualSpacing: resolvedExtended.contextualSpacing
86371
86424
  };
86372
86425
  return hydrated;
86373
86426
  };
@@ -87102,7 +87155,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
87102
87155
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
87103
87156
  }
87104
87157
  }
87105
- const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
87158
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing") ?? hydrated?.contextualSpacing;
87106
87159
  if (contextualSpacingValue != null) {
87107
87160
  paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
87108
87161
  }
@@ -93056,7 +93109,7 @@ const capitalizeText = (text, fullText, startOffset) => {
93056
93109
  return result;
93057
93110
  };
93058
93111
  const applyTextTransform = (text, run2, startOffset) => {
93059
- const transform = run2.textTransform;
93112
+ const transform = "textTransform" in run2 ? run2.textTransform : void 0;
93060
93113
  if (!text || !transform || transform === "none") return text;
93061
93114
  if (transform === "uppercase") return text.toUpperCase();
93062
93115
  if (transform === "lowercase") return text.toLowerCase();