@harbour-enterprises/superdoc 1.0.0-beta.95 → 1.0.0-beta.97

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-DC5ZtOHL.es.js → PdfViewer-BHcBfUWj.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer--l9mxuw6.cjs → PdfViewer-YvkZg201.cjs} +1 -1
  3. package/dist/chunks/{index-DA6_gKCn.cjs → index-DZ_AI-HW.cjs} +3 -3
  4. package/dist/chunks/{index-D_AIVJix.es.js → index-DeQfFbTb.es.js} +3 -3
  5. package/dist/chunks/{index-DJD7xO_i-CVT8OSh8.cjs → index-Pvlqsxge-IH3eauKE.cjs} +1 -1
  6. package/dist/chunks/{index-DJD7xO_i-DlZGZmeW.es.js → index-Pvlqsxge-vW641SZt.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-DLfNMkAR.cjs → super-editor.es-BP3PKkwh.cjs} +244 -91
  8. package/dist/chunks/{super-editor.es-L0F8-awY.es.js → super-editor.es-BinyZw4F.es.js} +244 -91
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-CAiO-oW4.js → converter-BEVM5t3i.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DRP7HhmI.js → docx-zipper-vETk3IMG.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-D5oQ83xJ.js → editor-B8k1bwD_.js} +245 -92
  13. package/dist/super-editor/chunks/{index-DJD7xO_i.js → index-Pvlqsxge.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-ax2sbcF_.js → toolbar-j1GSUGWU.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +254 -101
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -42422,7 +42422,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42422
42422
  static getStoredSuperdocVersion(docx) {
42423
42423
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42424
42424
  }
42425
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.95") {
42425
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.97") {
42426
42426
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42427
42427
  }
42428
42428
  /**
@@ -67497,7 +67497,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67497
67497
  const shouldSkipNodeView = (editor) => {
67498
67498
  return isHeadless(editor);
67499
67499
  };
67500
- const summaryVersion = "1.0.0-beta.95";
67500
+ const summaryVersion = "1.0.0-beta.97";
67501
67501
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67502
67502
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67503
67503
  function mapAttributes(attrs) {
@@ -68286,7 +68286,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68286
68286
  { default: remarkStringify2 },
68287
68287
  { default: remarkGfm2 }
68288
68288
  ] = await Promise.all([
68289
- Promise.resolve().then(() => indexDJD7xO_i),
68289
+ Promise.resolve().then(() => indexPvlqsxge),
68290
68290
  Promise.resolve().then(() => indexDRCvimau),
68291
68291
  Promise.resolve().then(() => indexC_x_N6Uh),
68292
68292
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68491,7 +68491,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68491
68491
  * Process collaboration migrations
68492
68492
  */
68493
68493
  processCollaborationMigrations() {
68494
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.95");
68494
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.97");
68495
68495
  if (!this.options.ydoc) return;
68496
68496
  const metaMap = this.options.ydoc.getMap("meta");
68497
68497
  let docVersion = metaMap.get("version");
@@ -70815,12 +70815,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70815
70815
  })(SectionType || {});
70816
70816
  const DEFAULT_PARAGRAPH_SECTION_TYPE = "nextPage";
70817
70817
  const DEFAULT_BODY_SECTION_TYPE = "continuous";
70818
- const TWIPS_PER_INCH$3 = 1440;
70819
- const PX_PER_INCH$2 = 96;
70818
+ const TWIPS_PER_INCH$4 = 1440;
70819
+ const PX_PER_INCH$3 = 96;
70820
70820
  const DEFAULT_COLUMN_GAP_INCHES = 0.5;
70821
70821
  function twipsToPixels$1(twips) {
70822
70822
  const n = Number(twips);
70823
- return Number.isFinite(n) ? n / TWIPS_PER_INCH$3 * PX_PER_INCH$2 : void 0;
70823
+ return Number.isFinite(n) ? n / TWIPS_PER_INCH$4 * PX_PER_INCH$3 : void 0;
70824
70824
  }
70825
70825
  function parseColumnCount(rawValue) {
70826
70826
  if (rawValue == null) return 1;
@@ -70830,7 +70830,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70830
70830
  function parseColumnGap(gapTwips) {
70831
70831
  if (gapTwips == null) return DEFAULT_COLUMN_GAP_INCHES;
70832
70832
  const gap = Number(gapTwips);
70833
- return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$3 : DEFAULT_COLUMN_GAP_INCHES;
70833
+ return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$4 : DEFAULT_COLUMN_GAP_INCHES;
70834
70834
  }
70835
70835
  function extractNormalizedMargins(attrs) {
70836
70836
  const sectionMargins = attrs.sectionMargins;
@@ -70914,7 +70914,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70914
70914
  const gapInches = parseColumnGap(cols.attributes["w:space"]);
70915
70915
  return {
70916
70916
  count,
70917
- gap: gapInches * PX_PER_INCH$2
70917
+ gap: gapInches * PX_PER_INCH$3
70918
70918
  };
70919
70919
  }
70920
70920
  function extractVerticalAlign(elements) {
@@ -71150,8 +71150,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71150
71150
  }
71151
71151
  return ranges;
71152
71152
  }
71153
- const TWIPS_PER_INCH$2 = 1440;
71154
- const PX_PER_INCH$1 = 96;
71153
+ const TWIPS_PER_INCH$3 = 1440;
71154
+ const PX_PER_INCH$2 = 96;
71155
71155
  const PX_PER_PT = 96 / 72;
71156
71156
  SectionType.NEXT_PAGE;
71157
71157
  SectionType.CONTINUOUS;
@@ -71290,7 +71290,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71290
71290
  }
71291
71291
  return filtered;
71292
71292
  };
71293
- const twipsToPx$1 = (value) => value / TWIPS_PER_INCH$2 * PX_PER_INCH$1;
71293
+ const twipsToPx$2 = (value) => value / TWIPS_PER_INCH$3 * PX_PER_INCH$2;
71294
71294
  const ptToPx = (pt) => {
71295
71295
  if (pt == null || !Number.isFinite(pt)) return void 0;
71296
71296
  return pt * PX_PER_PT;
@@ -72800,8 +72800,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72800
72800
  const beforeAutospacing = toBooleanFlag(source.beforeAutospacing ?? source.beforeAutoSpacing);
72801
72801
  const afterAutospacing = toBooleanFlag(source.afterAutospacing ?? source.afterAutoSpacing);
72802
72802
  const contextualSpacing = toBooleanFlag(source.contextualSpacing);
72803
- const before = beforeRaw != null ? twipsToPx$1(beforeRaw) : pickNumber(source.lineSpaceBefore);
72804
- const after = afterRaw != null ? twipsToPx$1(afterRaw) : pickNumber(source.lineSpaceAfter);
72803
+ const before = beforeRaw != null ? twipsToPx$2(beforeRaw) : pickNumber(source.lineSpaceBefore);
72804
+ const after = afterRaw != null ? twipsToPx$2(afterRaw) : pickNumber(source.lineSpaceAfter);
72805
72805
  const line = normalizeLineValue(lineRaw, lineRule);
72806
72806
  if (before != null) spacing.before = before;
72807
72807
  if (after != null) spacing.after = after;
@@ -72831,9 +72831,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72831
72831
  if (value > 0 && value <= MAX_AUTO_LINE_MULTIPLIER) {
72832
72832
  return value;
72833
72833
  }
72834
- return twipsToPx$1(value);
72834
+ return twipsToPx$2(value);
72835
72835
  }
72836
- return twipsToPx$1(value);
72836
+ return twipsToPx$2(value);
72837
72837
  };
72838
72838
  const normalizeLineRule = (value) => {
72839
72839
  if (value === "auto" || value === "exact" || value === "atLeast") {
@@ -72870,7 +72870,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72870
72870
  if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
72871
72871
  return num;
72872
72872
  }
72873
- return twipsToPx$1(Number(num));
72873
+ return twipsToPx$2(Number(num));
72874
72874
  };
72875
72875
  const left2 = convert2(pickNumber(source.left));
72876
72876
  const right2 = convert2(pickNumber(source.right));
@@ -73450,9 +73450,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73450
73450
  const family = run2.fontFamily ?? "Times New Roman";
73451
73451
  return `${style2}${weight}${size2} ${family}`;
73452
73452
  };
73453
- const TWIPS_PER_INCH$1 = 1440;
73453
+ const TWIPS_PER_INCH$2 = 1440;
73454
73454
  const PIXELS_PER_INCH = 96;
73455
- const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$1 / PIXELS_PER_INCH);
73455
+ const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$2 / PIXELS_PER_INCH);
73456
73456
  const PIXELS_PER_TWIP = 1 / TWIPS_PER_PIXEL;
73457
73457
  const toFiniteNumber = (value) => {
73458
73458
  if (value == null) return null;
@@ -74476,7 +74476,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74476
74476
  }
74477
74477
  const spacingTwips = parseNumberAttr(getAttribute(findChild(rPr, "w:spacing"), "w:val"));
74478
74478
  if (spacingTwips != null && Number.isFinite(spacingTwips)) {
74479
- run2.letterSpacing = twipsToPx$1(spacingTwips);
74479
+ run2.letterSpacing = twipsToPx$2(spacingTwips);
74480
74480
  }
74481
74481
  return Object.keys(run2).length ? run2 : void 0;
74482
74482
  };
@@ -74551,6 +74551,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74551
74551
  }
74552
74552
  return false;
74553
74553
  };
74554
+ const safeGetProperty = (obj, key2) => {
74555
+ if (!obj || typeof obj !== "object") {
74556
+ return void 0;
74557
+ }
74558
+ const record = obj;
74559
+ return record[key2];
74560
+ };
74554
74561
  const isExplicitFalse = (value) => {
74555
74562
  if (value === false || value === 0) return true;
74556
74563
  if (typeof value === "string") {
@@ -74693,10 +74700,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74693
74700
  const convertIndentTwipsToPx = (indent2) => {
74694
74701
  if (!indent2) return void 0;
74695
74702
  const result = {};
74696
- if (isFiniteNumber(indent2.left)) result.left = twipsToPx$1(Number(indent2.left));
74697
- if (isFiniteNumber(indent2.right)) result.right = twipsToPx$1(Number(indent2.right));
74698
- if (isFiniteNumber(indent2.firstLine)) result.firstLine = twipsToPx$1(Number(indent2.firstLine));
74699
- if (isFiniteNumber(indent2.hanging)) result.hanging = twipsToPx$1(Number(indent2.hanging));
74703
+ const toNum = (v2) => {
74704
+ if (typeof v2 === "string" && v2.trim() !== "" && isFinite(Number(v2))) return Number(v2);
74705
+ if (isFiniteNumber(v2)) return Number(v2);
74706
+ return void 0;
74707
+ };
74708
+ const left2 = toNum(indent2.left);
74709
+ const right2 = toNum(indent2.right);
74710
+ const firstLine = toNum(indent2.firstLine);
74711
+ const hanging = toNum(indent2.hanging);
74712
+ if (left2 != null) result.left = twipsToPx$2(left2);
74713
+ if (right2 != null) result.right = twipsToPx$2(right2);
74714
+ if (firstLine != null) result.firstLine = twipsToPx$2(firstLine);
74715
+ if (hanging != null) result.hanging = twipsToPx$2(hanging);
74700
74716
  return Object.keys(result).length > 0 ? result : void 0;
74701
74717
  };
74702
74718
  const toAdapterNumberingProps = (value) => {
@@ -74721,7 +74737,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74721
74737
  if (!stop || typeof stop.pos !== "number") continue;
74722
74738
  const alignment2 = normalizeResolvedTabAlignment(stop.val);
74723
74739
  if (!alignment2) continue;
74724
- const position2 = twipsToPx$1(stop.pos);
74740
+ const position2 = twipsToPx$2(stop.pos);
74725
74741
  if (!Number.isFinite(position2)) continue;
74726
74742
  const resolvedStop = {
74727
74743
  position: position2,
@@ -75043,8 +75059,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75043
75059
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
75044
75060
  }
75045
75061
  }
75046
- if (normalizedSpacing?.contextualSpacing != null) {
75047
- paragraphAttrs.contextualSpacing = normalizedSpacing.contextualSpacing;
75062
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
75063
+ if (contextualSpacingValue != null) {
75064
+ paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
75048
75065
  }
75049
75066
  const hasExplicitIndent = Boolean(normalizedIndent);
75050
75067
  const hasNumberingIndent = Boolean(computed2.numbering?.indent?.left || computed2.numbering?.indent?.hanging);
@@ -75096,7 +75113,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75096
75113
  paragraphAttrs.tabs = normalizedTabs;
75097
75114
  }
75098
75115
  }
75099
- const asString = (value) => {
75116
+ const asString2 = (value) => {
75100
75117
  return typeof value === "string" ? value : void 0;
75101
75118
  };
75102
75119
  const normalizeFramePr = (value) => {
@@ -75119,7 +75136,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75119
75136
  };
75120
75137
  const framePr = normalizeFramePr(attrs.framePr) ?? normalizeFramePr(attrs.paragraphProperties?.framePr) ?? extractFramePrFromElements(attrs.paragraphProperties);
75121
75138
  if (framePr) {
75122
- const rawXAlign = asString(framePr["w:xAlign"] ?? framePr.xAlign);
75139
+ const rawXAlign = asString2(framePr["w:xAlign"] ?? framePr.xAlign);
75123
75140
  const xAlign = typeof rawXAlign === "string" ? rawXAlign.toLowerCase() : void 0;
75124
75141
  if (xAlign === "left" || xAlign === "right" || xAlign === "center") {
75125
75142
  paragraphAttrs.floatAlignment = xAlign;
@@ -75129,7 +75146,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75129
75146
  paragraphAttrs.dropCap = dropCap;
75130
75147
  const dropCapMode = typeof dropCap === "string" ? dropCap.toLowerCase() : "drop";
75131
75148
  const linesValue = pickNumber(framePr["w:lines"] ?? framePr.lines);
75132
- const wrapValue = asString(framePr["w:wrap"] ?? framePr.wrap);
75149
+ const wrapValue = asString2(framePr["w:wrap"] ?? framePr.wrap);
75133
75150
  const dropCapRunInfo = extractDropCapRunFromParagraph(para);
75134
75151
  if (dropCapRunInfo) {
75135
75152
  const descriptor = {
@@ -75147,23 +75164,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75147
75164
  }
75148
75165
  }
75149
75166
  const frame = {};
75150
- const wrap2 = asString(framePr["w:wrap"] ?? framePr.wrap);
75167
+ const wrap2 = asString2(framePr["w:wrap"] ?? framePr.wrap);
75151
75168
  if (wrap2) frame.wrap = wrap2;
75152
75169
  if (xAlign) {
75153
75170
  frame.xAlign = xAlign;
75154
75171
  }
75155
- const rawYAlign = asString(framePr["w:yAlign"] ?? framePr.yAlign);
75172
+ const rawYAlign = asString2(framePr["w:yAlign"] ?? framePr.yAlign);
75156
75173
  if (rawYAlign) {
75157
75174
  frame.yAlign = rawYAlign;
75158
75175
  }
75159
- const hAnchor = asString(framePr["w:hAnchor"] ?? framePr.hAnchor);
75176
+ const hAnchor = asString2(framePr["w:hAnchor"] ?? framePr.hAnchor);
75160
75177
  if (hAnchor) frame.hAnchor = hAnchor;
75161
- const vAnchor = asString(framePr["w:vAnchor"] ?? framePr.vAnchor);
75178
+ const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
75162
75179
  if (vAnchor) frame.vAnchor = vAnchor;
75163
75180
  const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
75164
- if (xTwips != null) frame.x = twipsToPx$1(xTwips);
75181
+ if (xTwips != null) frame.x = twipsToPx$2(xTwips);
75165
75182
  const yTwips = pickNumber(framePr["w:y"] ?? framePr.y);
75166
- if (yTwips != null) frame.y = twipsToPx$1(yTwips);
75183
+ if (yTwips != null) frame.y = twipsToPx$2(yTwips);
75167
75184
  if (Object.keys(frame).length > 0) {
75168
75185
  paragraphAttrs.frame = frame;
75169
75186
  }
@@ -75251,7 +75268,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75251
75268
  }
75252
75269
  }
75253
75270
  }
75254
- const wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
75271
+ let wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
75272
+ if (!wordLayout && enrichedNumberingProps.resolvedLevelIndent) {
75273
+ const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
75274
+ const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
75275
+ if (firstLinePx > 0) {
75276
+ wordLayout = {
75277
+ // Treat as first-line-indent mode: text starts after the marker+firstLine offset.
75278
+ firstLineIndentMode: true,
75279
+ textStartPx: firstLinePx
75280
+ };
75281
+ }
75282
+ }
75283
+ if (wordLayout && (!wordLayout.textStartPx || !Number.isFinite(wordLayout.textStartPx)) && enrichedNumberingProps.resolvedLevelIndent) {
75284
+ const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
75285
+ const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
75286
+ if (firstLinePx > 0) {
75287
+ wordLayout = {
75288
+ ...wordLayout,
75289
+ firstLineIndentMode: wordLayout.firstLineIndentMode ?? true,
75290
+ textStartPx: firstLinePx
75291
+ };
75292
+ }
75293
+ }
75255
75294
  if (wordLayout) {
75256
75295
  if (wordLayout.marker) {
75257
75296
  if (listRendering?.markerText) {
@@ -77162,7 +77201,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77162
77201
  const entry = value;
77163
77202
  if (typeof entry.value !== "number") return void 0;
77164
77203
  if (!entry.type || entry.type === "px" || entry.type === "pixel") return entry.value;
77165
- if (entry.type === "dxa") return twipsToPx$1(entry.value);
77204
+ if (entry.type === "dxa") return twipsToPx$2(entry.value);
77166
77205
  return void 0;
77167
77206
  };
77168
77207
  const normalizeTableWidth = (value) => {
@@ -77174,7 +77213,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77174
77213
  return { width: raw, type: measurement.type ?? "px" };
77175
77214
  }
77176
77215
  if (measurement.type === "dxa") {
77177
- return { width: twipsToPx$1(raw), type: "px" };
77216
+ return { width: twipsToPx$2(raw), type: "px" };
77178
77217
  }
77179
77218
  return { width: raw, type: measurement.type };
77180
77219
  };
@@ -77202,13 +77241,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77202
77241
  const line = parseIntSafe$1(attrs["w:line"]);
77203
77242
  const rawLineRule = attrs["w:lineRule"];
77204
77243
  const lineRule = rawLineRule === "auto" || rawLineRule === "exact" || rawLineRule === "atLeast" ? rawLineRule : void 0;
77205
- if (before != null) spacing.before = twipsToPx$1(before);
77206
- if (after != null) spacing.after = twipsToPx$1(after);
77244
+ if (before != null) spacing.before = twipsToPx$2(before);
77245
+ if (after != null) spacing.after = twipsToPx$2(after);
77207
77246
  if (line != null) {
77208
77247
  if (lineRule === "auto") {
77209
77248
  spacing.line = line / 240;
77210
77249
  } else {
77211
- spacing.line = twipsToPx$1(line);
77250
+ spacing.line = twipsToPx$2(line);
77212
77251
  }
77213
77252
  }
77214
77253
  if (lineRule) spacing.lineRule = lineRule;
@@ -77234,7 +77273,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77234
77273
  if (rawValue == null) return void 0;
77235
77274
  const rawRule = heightObj.rule ?? heightObj.hRule;
77236
77275
  const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
77237
- const valuePx = twipsToPx$1(rawValue);
77276
+ const valuePx = twipsToPx$2(rawValue);
77238
77277
  return {
77239
77278
  value: valuePx,
77240
77279
  rule
@@ -77484,10 +77523,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77484
77523
  anchor.alignV = floatingProps.tblpYSpec;
77485
77524
  }
77486
77525
  if (floatingProps.tblpX !== void 0) {
77487
- anchor.offsetH = twipsToPx$1(floatingProps.tblpX);
77526
+ anchor.offsetH = twipsToPx$2(floatingProps.tblpX);
77488
77527
  }
77489
77528
  if (floatingProps.tblpY !== void 0) {
77490
- anchor.offsetV = twipsToPx$1(floatingProps.tblpY);
77529
+ anchor.offsetV = twipsToPx$2(floatingProps.tblpY);
77491
77530
  }
77492
77531
  const hasDistances = floatingProps.leftFromText !== void 0 || floatingProps.rightFromText !== void 0 || floatingProps.topFromText !== void 0 || floatingProps.bottomFromText !== void 0;
77493
77532
  const wrap2 = {
@@ -77498,16 +77537,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77498
77537
  };
77499
77538
  if (hasDistances) {
77500
77539
  if (floatingProps.topFromText !== void 0) {
77501
- wrap2.distTop = twipsToPx$1(floatingProps.topFromText);
77540
+ wrap2.distTop = twipsToPx$2(floatingProps.topFromText);
77502
77541
  }
77503
77542
  if (floatingProps.bottomFromText !== void 0) {
77504
- wrap2.distBottom = twipsToPx$1(floatingProps.bottomFromText);
77543
+ wrap2.distBottom = twipsToPx$2(floatingProps.bottomFromText);
77505
77544
  }
77506
77545
  if (floatingProps.leftFromText !== void 0) {
77507
- wrap2.distLeft = twipsToPx$1(floatingProps.leftFromText);
77546
+ wrap2.distLeft = twipsToPx$2(floatingProps.leftFromText);
77508
77547
  }
77509
77548
  if (floatingProps.rightFromText !== void 0) {
77510
- wrap2.distRight = twipsToPx$1(floatingProps.rightFromText);
77549
+ wrap2.distRight = twipsToPx$2(floatingProps.rightFromText);
77511
77550
  }
77512
77551
  }
77513
77552
  return { anchor, wrap: wrap2 };
@@ -84680,7 +84719,7 @@ ${l}
84680
84719
  }
84681
84720
  const runsForLine = sliceRunsForLine(block, line);
84682
84721
  const trackedConfig = this.resolveTrackedChangesConfig(block);
84683
- const textSlices = runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
84722
+ runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
84684
84723
  if (runsForLine.length === 0) {
84685
84724
  const span = this.doc.createElement("span");
84686
84725
  span.innerHTML = "&nbsp;";
@@ -84727,19 +84766,7 @@ ${l}
84727
84766
  });
84728
84767
  }
84729
84768
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
84730
- const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
84731
- const shouldJustify = !skipJustify && effectiveAlignment === "justify" && !hasExplicitPositioning;
84732
- if (shouldJustify) {
84733
- const spaceCount = textSlices.reduce(
84734
- (sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
84735
- 0
84736
- );
84737
- const slack = availableWidth - line.width;
84738
- if (spaceCount > 0 && slack !== 0) {
84739
- const spacingPerSpace = slack / spaceCount;
84740
- el.style.wordSpacing = `${spacingPerSpace}px`;
84741
- }
84742
- }
84769
+ availableWidthOverride ?? line.maxWidth ?? line.width;
84743
84770
  if (hasExplicitPositioning && line.segments) {
84744
84771
  const paraIndent = block.attrs?.indent;
84745
84772
  const indentLeft = paraIndent?.left ?? 0;
@@ -86902,6 +86929,32 @@ ${l}
86902
86929
  pmEnd: end2 ?? (start2 != null ? start2 + 1 : void 0)
86903
86930
  };
86904
86931
  };
86932
+ const getParagraphAttrs = (block) => {
86933
+ if (!block.attrs || typeof block.attrs !== "object") {
86934
+ return void 0;
86935
+ }
86936
+ return block.attrs;
86937
+ };
86938
+ const asString = (value) => {
86939
+ return typeof value === "string" ? value : void 0;
86940
+ };
86941
+ const asBoolean = (value) => {
86942
+ if (value === true || value === 1) return true;
86943
+ if (typeof value === "string") {
86944
+ const normalized = value.toLowerCase();
86945
+ return normalized === "true" || normalized === "1" || normalized === "on";
86946
+ }
86947
+ return false;
86948
+ };
86949
+ const asSafeNumber = (value) => {
86950
+ if (typeof value !== "number") {
86951
+ return 0;
86952
+ }
86953
+ if (!Number.isFinite(value) || value < 0) {
86954
+ return 0;
86955
+ }
86956
+ return value;
86957
+ };
86905
86958
  function calculateFirstLineIndent(block, measure) {
86906
86959
  const wordLayout = block.attrs?.wordLayout;
86907
86960
  if (!wordLayout?.firstLineIndentMode) {
@@ -86919,7 +86972,8 @@ ${l}
86919
86972
  function layoutParagraphBlock(ctx2, anchors) {
86920
86973
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
86921
86974
  const remeasureParagraph2 = ctx2.remeasureParagraph;
86922
- const frame = block.attrs?.frame;
86975
+ const blockAttrs = getParagraphAttrs(block);
86976
+ const frame = blockAttrs?.frame;
86923
86977
  if (anchors?.anchoredDrawings?.length) {
86924
86978
  for (const entry of anchors.anchoredDrawings) {
86925
86979
  if (anchors.placedAnchoredIds.has(entry.block.id)) continue;
@@ -87044,9 +87098,10 @@ ${l}
87044
87098
  didRemeasureForColumnWidth = true;
87045
87099
  }
87046
87100
  let fromLine = 0;
87047
- const spacing = block.attrs?.spacing ?? {};
87048
- const styleId = block.attrs?.styleId;
87049
- const contextualSpacing = Boolean(block.attrs?.contextualSpacing);
87101
+ const attrs = getParagraphAttrs(block);
87102
+ const spacing = attrs?.spacing ?? {};
87103
+ const styleId = asString(attrs?.styleId);
87104
+ const contextualSpacing = asBoolean(attrs?.contextualSpacing);
87050
87105
  let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
87051
87106
  const spacingAfter = Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
87052
87107
  let appliedSpacingBefore = spacingBefore === 0;
@@ -87127,14 +87182,13 @@ ${l}
87127
87182
  while (fromLine < lines.length) {
87128
87183
  let state2 = ensurePage();
87129
87184
  if (state2.trailingSpacing == null) state2.trailingSpacing = 0;
87130
- if (contextualSpacing) {
87131
- const prevStyle = state2.lastParagraphStyleId;
87132
- if (styleId && prevStyle && prevStyle === styleId) {
87133
- spacingBefore = 0;
87134
- }
87135
- }
87136
87185
  if (contextualSpacing && state2.lastParagraphStyleId && styleId && state2.lastParagraphStyleId === styleId) {
87137
87186
  spacingBefore = 0;
87187
+ const prevTrailing = asSafeNumber(state2.trailingSpacing);
87188
+ if (prevTrailing > 0) {
87189
+ state2.cursorY -= prevTrailing;
87190
+ state2.trailingSpacing = 0;
87191
+ }
87138
87192
  }
87139
87193
  if (!appliedSpacingBefore && spacingBefore > 0) {
87140
87194
  while (!appliedSpacingBefore) {
@@ -90034,7 +90088,13 @@ ${l}
90034
90088
  return ctx$2;
90035
90089
  }
90036
90090
  function isTextRun(run2) {
90037
- return run2.kind === "tab" ? false : true;
90091
+ if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
90092
+ return false;
90093
+ }
90094
+ if ("src" in run2) {
90095
+ return false;
90096
+ }
90097
+ return true;
90038
90098
  }
90039
90099
  function fontString(run2) {
90040
90100
  const textRun = isTextRun(run2) ? run2 : null;
@@ -90047,6 +90107,42 @@ ${l}
90047
90107
  function runText(run2) {
90048
90108
  return "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
90049
90109
  }
90110
+ const DEFAULT_TAB_INTERVAL_TWIPS$1 = 720;
90111
+ const TWIPS_PER_INCH$1 = 1440;
90112
+ const PX_PER_INCH$1 = 96;
90113
+ const TWIPS_PER_PX$1 = TWIPS_PER_INCH$1 / PX_PER_INCH$1;
90114
+ const TAB_EPSILON$1 = 0.1;
90115
+ const WIDTH_FUDGE_PX = 0.5;
90116
+ const twipsToPx$1 = (twips) => twips / TWIPS_PER_PX$1;
90117
+ const pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1);
90118
+ const buildTabStopsPx$1 = (indent2, tabs, tabIntervalTwips) => {
90119
+ const paragraphIndentTwips = {
90120
+ left: pxToTwips$1(Math.max(0, indent2?.left ?? 0)),
90121
+ right: pxToTwips$1(Math.max(0, indent2?.right ?? 0)),
90122
+ firstLine: pxToTwips$1(Math.max(0, indent2?.firstLine ?? 0)),
90123
+ hanging: pxToTwips$1(Math.max(0, indent2?.hanging ?? 0))
90124
+ };
90125
+ const stops = computeTabStops$1({
90126
+ explicitStops: tabs ?? [],
90127
+ defaultTabInterval: tabIntervalTwips ?? DEFAULT_TAB_INTERVAL_TWIPS$1,
90128
+ paragraphIndent: paragraphIndentTwips
90129
+ });
90130
+ return stops.map((stop) => ({
90131
+ pos: twipsToPx$1(stop.pos),
90132
+ val: stop.val,
90133
+ leader: stop.leader
90134
+ }));
90135
+ };
90136
+ const getNextTabStopPx$1 = (currentX, tabStops, startIndex) => {
90137
+ let index2 = startIndex;
90138
+ while (index2 < tabStops.length && tabStops[index2].pos <= currentX + TAB_EPSILON$1) {
90139
+ index2 += 1;
90140
+ }
90141
+ if (index2 < tabStops.length) {
90142
+ return { target: tabStops[index2].pos, nextIndex: index2 + 1 };
90143
+ }
90144
+ return { target: currentX + twipsToPx$1(DEFAULT_TAB_INTERVAL_TWIPS$1), nextIndex: index2 };
90145
+ };
90050
90146
  function measureRunSliceWidth(run2, fromChar, toChar) {
90051
90147
  const context = getCtx();
90052
90148
  const text2 = runText(run2).slice(fromChar, toChar);
@@ -90070,13 +90166,38 @@ ${l}
90070
90166
  return maxSize2 * 1.2;
90071
90167
  }
90072
90168
  function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
90169
+ if (!Number.isFinite(maxWidth) || maxWidth <= 0) {
90170
+ throw new Error(`remeasureParagraph: maxWidth must be a positive number, got ${maxWidth}`);
90171
+ }
90172
+ if (!Number.isFinite(firstLineIndent)) {
90173
+ throw new Error(`remeasureParagraph: firstLineIndent must be a finite number, got ${firstLineIndent}`);
90174
+ }
90175
+ if (!block) {
90176
+ throw new Error("remeasureParagraph: block must be defined");
90177
+ }
90178
+ if (!Array.isArray(block.runs)) {
90179
+ throw new Error(`remeasureParagraph: block.runs must be an array, got ${typeof block.runs}`);
90180
+ }
90073
90181
  const runs2 = block.runs ?? [];
90074
90182
  const lines = [];
90183
+ const attrs = block.attrs;
90184
+ const indent2 = attrs?.indent;
90185
+ const wordLayout = attrs?.wordLayout;
90186
+ const indentLeft = Math.max(0, indent2?.left ?? 0);
90187
+ const indentRight = Math.max(0, indent2?.right ?? 0);
90188
+ const indentFirstLine = Math.max(0, indent2?.firstLine ?? 0);
90189
+ const indentHanging = Math.max(0, indent2?.hanging ?? 0);
90190
+ const rawFirstLineOffset = Math.max(0, firstLineIndent || indentFirstLine - indentHanging);
90191
+ const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
90192
+ const textStartPx = wordLayout?.textStartPx;
90193
+ const treatAsHanging = textStartPx && indentLeft === 0 && indentHanging === 0;
90194
+ const firstLineWidth = typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - textStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
90195
+ const tabStops = buildTabStopsPx$1(indent2, attrs?.tabs, attrs?.tabIntervalTwips);
90075
90196
  let currentRun = 0;
90076
90197
  let currentChar = 0;
90077
90198
  while (currentRun < runs2.length) {
90078
90199
  const isFirstLine = lines.length === 0;
90079
- const effectiveMaxWidth = isFirstLine ? maxWidth - firstLineIndent : maxWidth;
90200
+ const effectiveMaxWidth = Math.max(1, isFirstLine ? firstLineWidth : contentWidth);
90080
90201
  const startRun = currentRun;
90081
90202
  const startChar = currentChar;
90082
90203
  let width = 0;
@@ -90084,13 +90205,26 @@ ${l}
90084
90205
  let lastBreakChar = -1;
90085
90206
  let endRun = currentRun;
90086
90207
  let endChar = currentChar;
90208
+ let tabStopCursor = 0;
90209
+ let didBreakInThisLine = false;
90087
90210
  for (let r2 = currentRun; r2 < runs2.length; r2 += 1) {
90088
90211
  const run2 = runs2[r2];
90212
+ if (run2.kind === "tab") {
90213
+ const { target, nextIndex } = getNextTabStopPx$1(width, tabStops, tabStopCursor);
90214
+ const tabAdvance = Math.max(0, target - width);
90215
+ width += tabAdvance;
90216
+ tabStopCursor = nextIndex;
90217
+ endRun = r2;
90218
+ endChar = 1;
90219
+ lastBreakRun = r2;
90220
+ lastBreakChar = 1;
90221
+ continue;
90222
+ }
90089
90223
  const text2 = runText(run2);
90090
90224
  const start2 = r2 === currentRun ? currentChar : 0;
90091
90225
  for (let c2 = start2; c2 < text2.length; c2 += 1) {
90092
90226
  const w2 = measureRunSliceWidth(run2, c2, c2 + 1);
90093
- if (width + w2 > effectiveMaxWidth && width > 0) {
90227
+ if (width + w2 > effectiveMaxWidth - WIDTH_FUDGE_PX && width > 0) {
90094
90228
  if (lastBreakRun >= 0) {
90095
90229
  endRun = lastBreakRun;
90096
90230
  endChar = lastBreakChar;
@@ -90098,6 +90232,7 @@ ${l}
90098
90232
  endRun = r2;
90099
90233
  endChar = c2;
90100
90234
  }
90235
+ didBreakInThisLine = true;
90101
90236
  break;
90102
90237
  }
90103
90238
  width += w2;
@@ -90109,9 +90244,7 @@ ${l}
90109
90244
  lastBreakChar = c2 + 1;
90110
90245
  }
90111
90246
  }
90112
- if (endRun !== r2 || endRun === r2 && (r2 === lastBreakRun ? endChar === lastBreakChar : false)) {
90113
- break;
90114
- }
90247
+ if (didBreakInThisLine) break;
90115
90248
  }
90116
90249
  if (startRun === endRun && startChar === endChar) {
90117
90250
  endRun = startRun;
@@ -90125,11 +90258,15 @@ ${l}
90125
90258
  width,
90126
90259
  ascent: 0,
90127
90260
  descent: 0,
90128
- lineHeight: lineHeightForRuns(runs2, startRun, endRun)
90261
+ lineHeight: lineHeightForRuns(runs2, startRun, endRun),
90262
+ maxWidth: effectiveMaxWidth
90129
90263
  };
90130
90264
  lines.push(line);
90131
90265
  currentRun = endRun;
90132
90266
  currentChar = endChar;
90267
+ if (currentRun >= runs2.length) {
90268
+ break;
90269
+ }
90133
90270
  if (currentChar >= runText(runs2[currentRun]).length) {
90134
90271
  currentRun += 1;
90135
90272
  currentChar = 0;
@@ -92342,7 +92479,7 @@ ${l}
92342
92479
  async function measureParagraphBlock(block, maxWidth) {
92343
92480
  const ctx2 = getCanvasContext();
92344
92481
  const wordLayout = block.attrs?.wordLayout;
92345
- const WIDTH_FUDGE_PX = 0.5;
92482
+ const WIDTH_FUDGE_PX2 = 0.5;
92346
92483
  const lines = [];
92347
92484
  const indent2 = block.attrs?.indent;
92348
92485
  const spacing = block.attrs?.spacing;
@@ -92358,7 +92495,8 @@ ${l}
92358
92495
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
92359
92496
  let initialAvailableWidth;
92360
92497
  const textStartPx = wordLayout?.textStartPx;
92361
- if (typeof textStartPx === "number" && textStartPx > indentLeft) {
92498
+ const treatAsHanging = isWordLayoutList && indentLeft === 0 && hanging === 0 && typeof textStartPx === "number";
92499
+ if (typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging) {
92362
92500
  initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
92363
92501
  } else {
92364
92502
  initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
@@ -92405,6 +92543,21 @@ ${l}
92405
92543
  totalHeight: metrics.lineHeight
92406
92544
  };
92407
92545
  }
92546
+ const isListLike = Boolean(block.attrs?.numId || wordLayout?.marker);
92547
+ if (isListLike) {
92548
+ console.log(
92549
+ "[measureParagraph][list]",
92550
+ JSON.stringify({
92551
+ blockId: block.id,
92552
+ maxWidth,
92553
+ indentLeft,
92554
+ indentRight,
92555
+ textStartPx: textStartPx ?? null,
92556
+ firstLineOffset: firstLineOffset ?? null,
92557
+ initialAvailableWidth
92558
+ })
92559
+ );
92560
+ }
92408
92561
  let currentLine = null;
92409
92562
  const getEffectiveWidth = (baseWidth) => {
92410
92563
  if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop") {
@@ -92812,7 +92965,7 @@ ${l}
92812
92965
  };
92813
92966
  } else {
92814
92967
  const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
92815
- if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0) {
92968
+ if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
92816
92969
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
92817
92970
  const { spaceCount: _sc, ...lineBase } = currentLine;
92818
92971
  const completedLine = {
@@ -92878,7 +93031,7 @@ ${l}
92878
93031
  };
92879
93032
  } else {
92880
93033
  const boundarySpacing2 = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
92881
- if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0) {
93034
+ if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
92882
93035
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
92883
93036
  const { spaceCount: _sc, ...lineBase } = currentLine;
92884
93037
  const completedLine = { ...lineBase, ...metrics };
@@ -92936,7 +93089,7 @@ ${l}
92936
93089
  const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
92937
93090
  const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
92938
93091
  const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
92939
- const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX, font, ctx2, run2);
93092
+ const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2);
92940
93093
  let chunkCharOffset = wordStartChar;
92941
93094
  for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
92942
93095
  const chunk = chunks[chunkIndex];
@@ -92958,7 +93111,7 @@ ${l}
92958
93111
  });
92959
93112
  if (isLastChunk) {
92960
93113
  const ls = run2.letterSpacing ?? 0;
92961
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
93114
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
92962
93115
  currentLine.toChar = wordEndWithSpace;
92963
93116
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
92964
93117
  charPosInRun = wordEndWithSpace;
@@ -92990,7 +93143,7 @@ ${l}
92990
93143
  spaceCount: 0
92991
93144
  };
92992
93145
  const ls = run2.letterSpacing ?? 0;
92993
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
93146
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
92994
93147
  currentLine.toChar = wordEndWithSpace;
92995
93148
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
92996
93149
  charPosInRun = wordEndWithSpace;
@@ -93032,7 +93185,7 @@ ${l}
93032
93185
  spaceCount: 0
93033
93186
  };
93034
93187
  const ls = run2.letterSpacing ?? 0;
93035
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
93188
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93036
93189
  currentLine.toChar = wordEndWithSpace;
93037
93190
  currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
93038
93191
  charPosInRun = wordEndWithSpace;
@@ -93047,7 +93200,7 @@ ${l}
93047
93200
  const justifyAlignment = block.attrs?.alignment === "justify";
93048
93201
  const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
93049
93202
  (isLastWord ? 0 : run2.letterSpacing ?? 0);
93050
- const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX;
93203
+ const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
93051
93204
  let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
93052
93205
  let compressedWidth = null;
93053
93206
  if (shouldBreak && justifyAlignment) {
@@ -93092,7 +93245,7 @@ ${l}
93092
93245
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
93093
93246
  spaceCount: 0
93094
93247
  };
93095
- if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
93248
+ if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93096
93249
  currentLine.toChar = wordEndWithSpace;
93097
93250
  currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
93098
93251
  charPosInRun = wordEndWithSpace;
@@ -93102,7 +93255,7 @@ ${l}
93102
93255
  }
93103
93256
  } else {
93104
93257
  currentLine.toRun = runIndex;
93105
- if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX) {
93258
+ if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
93106
93259
  currentLine.toChar = wordEndNoSpace;
93107
93260
  currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
93108
93261
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
@@ -151950,7 +152103,7 @@ ${style2}
151950
152103
  this.config.colors = shuffleArray(this.config.colors);
151951
152104
  this.userColorMap = /* @__PURE__ */ new Map();
151952
152105
  this.colorIndex = 0;
151953
- this.version = "1.0.0-beta.95";
152106
+ this.version = "1.0.0-beta.97";
151954
152107
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151955
152108
  this.superdocId = config2.superdocId || v4();
151956
152109
  this.colors = this.config.colors;
@@ -154422,7 +154575,7 @@ ${style2}
154422
154575
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
154423
154576
  );
154424
154577
  }
154425
- const indexDJD7xO_i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154578
+ const indexPvlqsxge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154426
154579
  __proto__: null,
154427
154580
  unified
154428
154581
  }, Symbol.toStringTag, { value: "Module" }));
@@ -164640,8 +164793,8 @@ ${style2}
164640
164793
  const type2 = typeof value;
164641
164794
  if (type2 !== "object" || !value)
164642
164795
  return [PRIMITIVE, type2];
164643
- const asString = toString.call(value).slice(8, -1);
164644
- switch (asString) {
164796
+ const asString2 = toString.call(value).slice(8, -1);
164797
+ switch (asString2) {
164645
164798
  case "Array":
164646
164799
  return [ARRAY, EMPTY];
164647
164800
  case "Object":
@@ -164655,13 +164808,13 @@ ${style2}
164655
164808
  case "Set":
164656
164809
  return [SET, EMPTY];
164657
164810
  case "DataView":
164658
- return [ARRAY, asString];
164811
+ return [ARRAY, asString2];
164659
164812
  }
164660
- if (asString.includes("Array"))
164661
- return [ARRAY, asString];
164662
- if (asString.includes("Error"))
164663
- return [ERROR, asString];
164664
- return [OBJECT, asString];
164813
+ if (asString2.includes("Array"))
164814
+ return [ARRAY, asString2];
164815
+ if (asString2.includes("Error"))
164816
+ return [ERROR, asString2];
164817
+ return [OBJECT, asString2];
164665
164818
  };
164666
164819
  const shouldSkip = ([TYPE, type2]) => TYPE === PRIMITIVE && (type2 === "function" || type2 === "symbol");
164667
164820
  const serializer = (strict, json, $2, _2) => {