@superdoc-dev/cli 0.17.0-next.43 → 0.17.0-next.45

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 (2) hide show
  1. package/dist/index.js +1459 -153
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -2899,13 +2899,13 @@ More content with **bold** and *italic*.`
2899
2899
  },
2900
2900
  "lists.attach": {
2901
2901
  memberPath: "lists.attach",
2902
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
2902
+ description: 'Convert non-list paragraphs to list items under an existing list sequence. With changeMode:"tracked" the former (unnumbered) paragraph properties are recorded as a w:pPrChange so a reviewer can accept/reject the numbering.',
2903
2903
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
2904
2904
  requiresDocumentContext: true,
2905
2905
  metadata: mutationOperation({
2906
2906
  idempotency: "conditional",
2907
2907
  supportsDryRun: true,
2908
- supportsTrackedMode: false,
2908
+ supportsTrackedMode: true,
2909
2909
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
2910
2910
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2911
2911
  }),
@@ -11013,6 +11013,27 @@ var init_schemas = __esm(() => {
11013
11013
  },
11014
11014
  additionalProperties: false
11015
11015
  },
11016
+ numbering: {
11017
+ type: "object",
11018
+ description: 'Computed numbering rendering (marker/path/kind) for numbered list items and numbered headings — e.g. the rendered clause label "2.3.". Absent for non-numbered blocks.',
11019
+ properties: {
11020
+ marker: { oneOf: [{ type: "string" }, { type: "null" }] },
11021
+ path: { oneOf: [{ type: "array", items: { type: "number" } }, { type: "null" }] },
11022
+ kind: { oneOf: [{ type: "string" }, { type: "null" }] }
11023
+ },
11024
+ additionalProperties: false
11025
+ },
11026
+ indent: {
11027
+ type: "object",
11028
+ description: "Direct paragraph indentation in twips (only non-zero fields present).",
11029
+ properties: {
11030
+ left: { type: "number" },
11031
+ right: { type: "number" },
11032
+ firstLine: { type: "number" },
11033
+ hanging: { type: "number" }
11034
+ },
11035
+ additionalProperties: false
11036
+ },
11016
11037
  ref: {
11017
11038
  type: "string",
11018
11039
  description: "Ref handle for this block. Pass directly to superdoc_format or superdoc_edit ref param. Only present for non-empty blocks."
@@ -12524,6 +12545,10 @@ var init_schemas = __esm(() => {
12524
12545
  moveRole: {
12525
12546
  enum: ["pair", "source", "destination"],
12526
12547
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
12548
+ },
12549
+ side: {
12550
+ enum: ["inserted", "deleted"],
12551
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half, leaving the other half as a standalone pending change."
12527
12552
  }
12528
12553
  }, ["kind", "id"]),
12529
12554
  objectSchema({
@@ -12560,6 +12585,10 @@ var init_schemas = __esm(() => {
12560
12585
  moveRole: {
12561
12586
  enum: ["pair", "source", "destination"],
12562
12587
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
12588
+ },
12589
+ side: {
12590
+ enum: ["inserted", "deleted"],
12591
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half."
12563
12592
  }
12564
12593
  }, ["id"]),
12565
12594
  objectSchema({
@@ -17601,10 +17630,11 @@ function executeTrackChangesDecide(adapter, rawInput, options) {
17601
17630
  return adapter.rejectAll(input, revisionOptions);
17602
17631
  }
17603
17632
  const { id, story } = canonical.target;
17633
+ const side = canonical.target.side;
17604
17634
  if (canonical.decision === "accept") {
17605
- return adapter.accept({ id, ...story ? { story } : {} }, revisionOptions);
17635
+ return adapter.accept({ id, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
17606
17636
  }
17607
- return adapter.reject({ id, ...story ? { story } : {} }, revisionOptions);
17637
+ return adapter.reject({ id, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
17608
17638
  }
17609
17639
  function isValidLegacyPartialIdRangeTarget(input) {
17610
17640
  if (typeof input !== "object" || input == null)
@@ -17650,11 +17680,13 @@ function normalizeReviewDecideTarget(target) {
17650
17680
  }
17651
17681
  const story = readOptionalStory(target, "target.story", false);
17652
17682
  const moveRole = readOptionalMoveRole(target);
17683
+ const side = readOptionalReplacementSide(target);
17653
17684
  return {
17654
17685
  kind: "id",
17655
17686
  id,
17656
17687
  ...story ? { story } : {},
17657
- ...moveRole ? { moveRole } : {}
17688
+ ...moveRole ? { moveRole } : {},
17689
+ ...side ? { side } : {}
17658
17690
  };
17659
17691
  }
17660
17692
  if (kind === "range") {
@@ -17729,11 +17761,13 @@ function normalizeReviewDecideTarget(target) {
17729
17761
  if (typeof target.id === "string" && target.id.length > 0) {
17730
17762
  const story = readOptionalStory(target, "target.story", false);
17731
17763
  const moveRole = readOptionalMoveRole(target);
17764
+ const side = readOptionalReplacementSide(target);
17732
17765
  return {
17733
17766
  kind: "id",
17734
17767
  id: target.id,
17735
17768
  ...story ? { story } : {},
17736
- ...moveRole ? { moveRole } : {}
17769
+ ...moveRole ? { moveRole } : {},
17770
+ ...side ? { side } : {}
17737
17771
  };
17738
17772
  }
17739
17773
  }
@@ -17850,6 +17884,18 @@ function readOptionalMoveRole(target) {
17850
17884
  }
17851
17885
  return moveRole;
17852
17886
  }
17887
+ function readOptionalReplacementSide(target) {
17888
+ if (!("side" in target))
17889
+ return;
17890
+ const side = target.side;
17891
+ if (side === undefined || side === null)
17892
+ return;
17893
+ if (side === "inserted")
17894
+ return "inserted";
17895
+ if (side === "deleted")
17896
+ return "deleted";
17897
+ throw new DocumentApiValidationError("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', { field: "target.side", value: side });
17898
+ }
17853
17899
  function validateRangeTargetSide(side) {
17854
17900
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination") {
17855
17901
  return;
@@ -68164,7 +68210,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
68164
68210
  emptyOptions2 = {};
68165
68211
  });
68166
68212
 
68167
- // ../../packages/superdoc/dist/chunks/SuperConverter-DIgF4xk_.es.js
68213
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DlrS7cQT.es.js
68168
68214
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68169
68215
  const fieldValue = extension$1.config[field];
68170
68216
  if (typeof fieldValue === "function")
@@ -71946,14 +71992,17 @@ function executeTrackChangesDecide2(adapter, rawInput, options) {
71946
71992
  return adapter.rejectAll(input, revisionOptions);
71947
71993
  }
71948
71994
  const { id: id2, story } = canonical.target;
71995
+ const side = canonical.target.side;
71949
71996
  if (canonical.decision === "accept")
71950
71997
  return adapter.accept({
71951
71998
  id: id2,
71952
- ...story ? { story } : {}
71999
+ ...story ? { story } : {},
72000
+ ...side ? { side } : {}
71953
72001
  }, revisionOptions);
71954
72002
  return adapter.reject({
71955
72003
  id: id2,
71956
- ...story ? { story } : {}
72004
+ ...story ? { story } : {},
72005
+ ...side ? { side } : {}
71957
72006
  }, revisionOptions);
71958
72007
  }
71959
72008
  function isValidLegacyPartialIdRangeTarget2(input) {
@@ -72004,11 +72053,13 @@ function normalizeReviewDecideTarget2(target) {
72004
72053
  });
72005
72054
  const story = readOptionalStory2(target, "target.story", false);
72006
72055
  const moveRole = readOptionalMoveRole2(target);
72056
+ const side = readOptionalReplacementSide2(target);
72007
72057
  return {
72008
72058
  kind: "id",
72009
72059
  id: id2,
72010
72060
  ...story ? { story } : {},
72011
- ...moveRole ? { moveRole } : {}
72061
+ ...moveRole ? { moveRole } : {},
72062
+ ...side ? { side } : {}
72012
72063
  };
72013
72064
  }
72014
72065
  if (kind === "range") {
@@ -72099,11 +72150,13 @@ function normalizeReviewDecideTarget2(target) {
72099
72150
  if (typeof target.id === "string" && target.id.length > 0) {
72100
72151
  const story = readOptionalStory2(target, "target.story", false);
72101
72152
  const moveRole = readOptionalMoveRole2(target);
72153
+ const side = readOptionalReplacementSide2(target);
72102
72154
  return {
72103
72155
  kind: "id",
72104
72156
  id: target.id,
72105
72157
  ...story ? { story } : {},
72106
- ...moveRole ? { moveRole } : {}
72158
+ ...moveRole ? { moveRole } : {},
72159
+ ...side ? { side } : {}
72107
72160
  };
72108
72161
  }
72109
72162
  }
@@ -72259,6 +72312,21 @@ function readOptionalMoveRole2(target) {
72259
72312
  });
72260
72313
  return moveRole;
72261
72314
  }
72315
+ function readOptionalReplacementSide2(target) {
72316
+ if (!("side" in target))
72317
+ return;
72318
+ const side = target.side;
72319
+ if (side === undefined || side === null)
72320
+ return;
72321
+ if (side === "inserted")
72322
+ return "inserted";
72323
+ if (side === "deleted")
72324
+ return "deleted";
72325
+ throw new DocumentApiValidationError2("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', {
72326
+ field: "target.side",
72327
+ value: side
72328
+ });
72329
+ }
72262
72330
  function validateRangeTargetSide2(side) {
72263
72331
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination")
72264
72332
  return;
@@ -77740,6 +77808,50 @@ function getCellSpacingPx(cellSpacing) {
77740
77808
  const asPx = (cellSpacing.type ?? "").toLowerCase() === "dxa" && v >= 20 ? v / TWIPS_PER_PX : v;
77741
77809
  return Math.max(0, asPx);
77742
77810
  }
77811
+ function getBorderBandProfile(value) {
77812
+ if (value == null || typeof value !== "object")
77813
+ return null;
77814
+ if ("none" in value && value.none)
77815
+ return null;
77816
+ const raw = value;
77817
+ if (!raw.style)
77818
+ return null;
77819
+ const formula = COMPOUND_PROFILES[raw.style];
77820
+ if (!formula)
77821
+ return null;
77822
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
77823
+ if (w <= 0)
77824
+ return null;
77825
+ const segments = formula(w).map((s) => Math.max(1, s));
77826
+ return {
77827
+ segments,
77828
+ band: segments.reduce((sum, s) => sum + s, 0)
77829
+ };
77830
+ }
77831
+ function getBorderBandWidthPx(value) {
77832
+ if (value == null)
77833
+ return 0;
77834
+ if (typeof value !== "object")
77835
+ return 0;
77836
+ if ("none" in value && value.none)
77837
+ return 0;
77838
+ const raw = value;
77839
+ if (raw.style === "none")
77840
+ return 0;
77841
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
77842
+ const width = Math.max(0, w);
77843
+ if (width === 0)
77844
+ return 0;
77845
+ if (raw.style === "thick")
77846
+ return Math.max(width, 1);
77847
+ const profile = getBorderBandProfile(value);
77848
+ if (profile)
77849
+ return profile.band;
77850
+ return width;
77851
+ }
77852
+ function isNativeCssDoubleStyle(style) {
77853
+ return style === "double";
77854
+ }
77743
77855
  function coerceRelativeHeight(raw) {
77744
77856
  if (typeof raw === "number" && Number.isFinite(raw))
77745
77857
  return raw;
@@ -79347,6 +79459,11 @@ function resolveConditionalProps(propertyType, styleType, styleId, translatedLin
79347
79459
  const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
79348
79460
  if (props)
79349
79461
  chain.push(props);
79462
+ if (styleType === "wholeTable" && propertyType === "tableCellProperties") {
79463
+ const baseProps = def?.tableCellProperties;
79464
+ if (baseProps)
79465
+ chain.push(baseProps);
79466
+ }
79350
79467
  currentId = def?.basedOn;
79351
79468
  }
79352
79469
  if (chain.length === 0)
@@ -79360,7 +79477,7 @@ function resolveCellStyles(propertyType, tableInfo, translatedLinkedStyles) {
79360
79477
  const cellStyleProps = [];
79361
79478
  const tableStyleId = tableInfo.tableProperties.tableStyleId;
79362
79479
  const { rowBandSize, colBandSize } = resolveEffectiveBandSizes(tableStyleId, translatedLinkedStyles);
79363
- determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle).forEach((styleType) => {
79480
+ determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle, tableInfo.gridColumnStart, tableInfo.gridColumnSpan, tableInfo.numGridCols).forEach((styleType) => {
79364
79481
  const typeProps = resolveConditionalProps(propertyType, styleType, tableStyleId, translatedLinkedStyles);
79365
79482
  if (typeProps)
79366
79483
  cellStyleProps.push(typeProps);
@@ -79378,12 +79495,15 @@ function resolveTableCellProperties(inlineProps, tableInfo, translatedLinkedStyl
79378
79495
  chain.push(inlineProps);
79379
79496
  return combineProperties(chain, { fullOverrideProps: ["shading"] });
79380
79497
  }
79381
- function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
79498
+ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle, gridColumnStart, gridColumnSpan, numGridCols) {
79382
79499
  const applicable = new Set(["wholeTable"]);
79383
79500
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
79384
79501
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
79502
+ const columnStart = gridColumnStart ?? cellIndex;
79503
+ const columnEnd = columnStart + (gridColumnSpan ?? 1);
79504
+ const columnCount = numGridCols != null && numCells != null ? Math.max(numGridCols, numCells) : numGridCols ?? numCells;
79385
79505
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
79386
- const bandColIndex = Math.max(0, cellIndex - (tblLook?.firstColumn ? 1 : 0));
79506
+ const bandColIndex = Math.max(0, columnStart - (tblLook?.firstColumn ? 1 : 0));
79387
79507
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
79388
79508
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
79389
79509
  if (!tblLook?.noHBand)
@@ -79392,8 +79512,8 @@ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells
79392
79512
  applicable.add(colGroup % 2 === 0 ? "band1Vert" : "band2Vert");
79393
79513
  const isFirstRow = !!tblLook?.firstRow && rowIndex === 0;
79394
79514
  const isLastRow = !!tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1;
79395
- const isFirstCol = !!tblLook?.firstColumn && cellIndex === 0;
79396
- const isLastCol = !!tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1;
79515
+ const isFirstCol = !!tblLook?.firstColumn && columnStart === 0;
79516
+ const isLastCol = !!tblLook?.lastColumn && columnCount != null && columnCount > 0 && columnEnd >= columnCount;
79397
79517
  if (isFirstRow)
79398
79518
  applicable.add("firstRow");
79399
79519
  if (isFirstCol)
@@ -80384,6 +80504,31 @@ function hasValidDrawingContent(drawingContent) {
80384
80504
  return false;
80385
80505
  return drawingChildren.some((child) => child && typeof child === "object" && (child.name === "wp:inline" || child.name === "wp:anchor"));
80386
80506
  }
80507
+ function resolvePprChangeWordId(params3, change) {
80508
+ const idStr = String(change?.id ?? "");
80509
+ const allocator = params3?.converter?.wordIdAllocator;
80510
+ if (allocator) {
80511
+ const partPath = params3?.currentPartPath || "word/document.xml";
80512
+ const sourceId = /^\d+$/.test(idStr) ? idStr : undefined;
80513
+ return String(allocator.allocate({
80514
+ partPath,
80515
+ sourceId,
80516
+ logicalId: idStr
80517
+ }));
80518
+ }
80519
+ return toDecimalWordId(change?.id);
80520
+ }
80521
+ function toDecimalWordId(id2) {
80522
+ const str = String(id2);
80523
+ if (/^\d+$/.test(str))
80524
+ return str;
80525
+ let hash = 2166136261;
80526
+ for (let i$1 = 0;i$1 < str.length; i$1++) {
80527
+ hash ^= str.charCodeAt(i$1);
80528
+ hash = Math.imul(hash, 16777619);
80529
+ }
80530
+ return String(1e6 + (hash >>> 0) % 1e9);
80531
+ }
80387
80532
  function getSectPr(pPrNode) {
80388
80533
  const sectPr = pPrNode?.elements?.find((el) => el.name === "w:sectPr");
80389
80534
  return sectPr ? carbonCopy(sectPr) : undefined;
@@ -80553,6 +80698,8 @@ function generateParagraphProperties(params3) {
80553
80698
  const { node: node3 } = params3;
80554
80699
  const { attrs = {} } = node3;
80555
80700
  const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
80701
+ if (params3?.isFinalDoc && paragraphProperties.change)
80702
+ delete paragraphProperties.change;
80556
80703
  const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
80557
80704
  delete paragraphProperties.runPropertiesInlineKeys;
80558
80705
  if (Array.isArray(inlineKeys) && inlineKeys.length === 0)
@@ -80569,10 +80716,14 @@ function generateParagraphProperties(params3) {
80569
80716
  wordIdAllocator: params3?.converter?.wordIdAllocator || null,
80570
80717
  partPath: resolveExportPartPath$1(params3)
80571
80718
  } : null;
80572
- let pPr = translator$129.decode({ node: {
80573
- ...node3,
80574
- attrs: { paragraphProperties }
80575
- } });
80719
+ let pPr = translator$129.decode({
80720
+ node: {
80721
+ ...node3,
80722
+ attrs: { paragraphProperties }
80723
+ },
80724
+ converter: params3?.converter,
80725
+ currentPartPath: resolveExportPartPath$1(params3)
80726
+ });
80576
80727
  if (!params3?.isFinalDoc && paragraphSplitTrackFormatMark) {
80577
80728
  const insertionElement = createParagraphSplitInsertionElement(paragraphSplitTrackFormatMark, paragraphSplitWordIdOptions);
80578
80729
  if (insertionElement)
@@ -91279,11 +91430,24 @@ function getDefinitionForLevel(data, level) {
91279
91430
  return cachedLevels.get(parsedLevel);
91280
91431
  return data?.elements?.find((item) => Number(item.attributes?.["w:ilvl"]) === parsedLevel);
91281
91432
  }
91282
- function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr) {
91433
+ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr, options = {}) {
91434
+ const formerProperties = { ...paragraphNode.attrs.paragraphProperties || {} };
91283
91435
  const newProperties = {
91284
- ...paragraphNode.attrs.paragraphProperties || {},
91436
+ ...formerProperties,
91285
91437
  numberingProperties: newNumberingProperties ? { ...newNumberingProperties } : null
91286
91438
  };
91439
+ if (options.trackChange && newNumberingProperties && !formerProperties.change) {
91440
+ const former = { ...formerProperties };
91441
+ delete former.change;
91442
+ const user = editor?.options?.user || {};
91443
+ newProperties.change = {
91444
+ id: v4_default(),
91445
+ author: user.name || "",
91446
+ authorEmail: user.email || "",
91447
+ date: (/* @__PURE__ */ new Date()).toISOString(),
91448
+ paragraphProperties: former
91449
+ };
91450
+ }
91287
91451
  if (!newNumberingProperties && paragraphNode.attrs.paragraphProperties?.styleId === "ListParagraph")
91288
91452
  newProperties.styleId = null;
91289
91453
  if (newProperties.indent)
@@ -107246,10 +107410,40 @@ function normalizeLegacyBorderStyle(value) {
107246
107410
  return "dotDash";
107247
107411
  case "dotdotdash":
107248
107412
  return "dotDotDash";
107413
+ case "dashsmallgap":
107414
+ return "dashSmallGap";
107415
+ case "thinthicksmallgap":
107416
+ return "thinThickSmallGap";
107417
+ case "thickthinsmallgap":
107418
+ return "thickThinSmallGap";
107419
+ case "thinthickthinsmallgap":
107420
+ return "thinThickThinSmallGap";
107421
+ case "thinthickmediumgap":
107422
+ return "thinThickMediumGap";
107423
+ case "thickthinmediumgap":
107424
+ return "thickThinMediumGap";
107425
+ case "thinthickthinmediumgap":
107426
+ return "thinThickThinMediumGap";
107427
+ case "thinthicklargegap":
107428
+ return "thinThickLargeGap";
107429
+ case "thickthinlargegap":
107430
+ return "thickThinLargeGap";
107431
+ case "thinthickthinlargegap":
107432
+ return "thinThickThinLargeGap";
107249
107433
  case "wave":
107250
107434
  return "wave";
107251
107435
  case "doublewave":
107252
107436
  return "doubleWave";
107437
+ case "dashdotstroked":
107438
+ return "dashDotStroked";
107439
+ case "threedemboss":
107440
+ return "threeDEmboss";
107441
+ case "threedengrave":
107442
+ return "threeDEngrave";
107443
+ case "outset":
107444
+ return "outset";
107445
+ case "inset":
107446
+ return "inset";
107253
107447
  case "single":
107254
107448
  default:
107255
107449
  return "single";
@@ -107360,14 +107554,21 @@ function tableNodeToBlock(node3, { nextBlockId, positions, storyKey, trackedChan
107360
107554
  tableStyleId: effectiveStyleId ?? undefined
107361
107555
  } : undefined;
107362
107556
  const rows = [];
107557
+ const grid = node3.attrs?.grid;
107558
+ const numGridCols = Array.isArray(grid) && grid.length > 0 ? grid.length : undefined;
107559
+ let activeRowSpans = [];
107363
107560
  node3.content.forEach((rowNode, rowIndex) => {
107561
+ const { placements, nextActiveRowSpans } = placeRowCellsOnGrid(rowNode, activeRowSpans);
107562
+ activeRowSpans = nextActiveRowSpans;
107364
107563
  const parsedRow = parseTableRow({
107365
107564
  rowNode,
107366
107565
  rowIndex,
107367
107566
  numRows: node3?.content?.length ?? 1,
107368
107567
  context: parserDeps,
107369
107568
  defaultCellPadding,
107370
- tableProperties: tablePropertiesForCascade
107569
+ tableProperties: tablePropertiesForCascade,
107570
+ cellGridPlacements: placements,
107571
+ numGridCols
107371
107572
  });
107372
107573
  if (parsedRow) {
107373
107574
  if (!shouldHideTrackedNode(parsedRow.attrs?.trackedChange, parserDeps.trackedChangesConfig))
@@ -113275,6 +113476,28 @@ function groupTrackedChanges(editor) {
113275
113476
  wordRevisionIds: structural.sourceId ? structural.side === "insertion" ? { insert: structural.sourceId } : { delete: structural.sourceId } : undefined
113276
113477
  });
113277
113478
  }
113479
+ const pprChanges = enumeratePprChanges(editor.state);
113480
+ for (const ppr of pprChanges) {
113481
+ const excerpt = normalizeExcerpt(editor.state.doc.textBetween(ppr.from, ppr.to, " ", ""));
113482
+ grouped.push({
113483
+ rawId: ppr.id,
113484
+ commandRawId: ppr.id,
113485
+ id: ppr.id,
113486
+ from: ppr.from,
113487
+ to: ppr.to,
113488
+ hasInsert: false,
113489
+ hasDelete: false,
113490
+ hasFormat: true,
113491
+ attrs: {
113492
+ id: ppr.id,
113493
+ author: ppr.author || undefined,
113494
+ authorEmail: ppr.authorEmail || undefined,
113495
+ authorImage: ppr.authorImage || undefined,
113496
+ date: ppr.date || undefined
113497
+ },
113498
+ excerpt
113499
+ });
113500
+ }
113278
113501
  grouped.sort((a, b) => {
113279
113502
  if (a.from !== b.from)
113280
113503
  return a.from - b.from;
@@ -113747,7 +113970,7 @@ function applyPagination(items, opts) {
113747
113970
  };
113748
113971
  }
113749
113972
  function resolveBlock(editor, nodeId) {
113750
- const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem"));
113973
+ const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading"));
113751
113974
  if (matches$1.length === 0)
113752
113975
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Block target was not found.", { nodeId });
113753
113976
  if (matches$1.length > 1)
@@ -113765,7 +113988,7 @@ function resolveBlocksInRange(editor, fromId, toId$1) {
113765
113988
  from: fromId,
113766
113989
  to: toId$1
113767
113990
  });
113768
- return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem") && c$1.pos >= from5.pos && c$1.pos <= to.pos);
113991
+ return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading") && c$1.pos >= from5.pos && c$1.pos <= to.pos);
113769
113992
  }
113770
113993
  function getAbstractNumId(editor, numId) {
113771
113994
  const definitions = editor.converter?.numbering?.definitions;
@@ -114000,7 +114223,15 @@ function getListText(candidate) {
114000
114223
  }
114001
114224
  function projectListItemCandidate(editor, candidate) {
114002
114225
  const attrs = candidate.node.attrs ?? {};
114003
- const { numId, level } = getNumberingProperties(candidate.node);
114226
+ let { numId, level } = getNumberingProperties(candidate.node);
114227
+ if (numId == null)
114228
+ try {
114229
+ const effective = calculateResolvedParagraphProperties(editor, candidate.node, editor.state.doc.resolve(candidate.pos))?.numberingProperties;
114230
+ if (effective) {
114231
+ numId = toFiniteNumber(effective.numId);
114232
+ level = toFiniteNumber(effective.ilvl) ?? level ?? 0;
114233
+ }
114234
+ } catch {}
114004
114235
  const listRendering = getListRendering(attrs.listRendering);
114005
114236
  const path2 = listRendering?.path;
114006
114237
  const ordinal = getListOrdinalFromPath(path2);
@@ -114112,8 +114343,17 @@ function listListItems(editor, query2) {
114112
114343
  }
114113
114344
  });
114114
114345
  }
114346
+ function hasNumberingMetadata(candidate) {
114347
+ const { numId } = getNumberingProperties(candidate.node);
114348
+ if (numId != null)
114349
+ return true;
114350
+ return getListRendering((candidate.node.attrs ?? {}).listRendering) != null;
114351
+ }
114115
114352
  function resolveListItem(editor, address2) {
114116
- const matches$1 = getBlockIndex(editor).candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
114353
+ const index2 = getBlockIndex(editor);
114354
+ let matches$1 = index2.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
114355
+ if (matches$1.length === 0)
114356
+ matches$1 = index2.candidates.filter((candidate) => candidate.nodeId === address2.nodeId && hasNumberingMetadata(candidate));
114117
114357
  if (matches$1.length === 0)
114118
114358
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "List item target was not found.", { target: address2 });
114119
114359
  if (matches$1.length > 1)
@@ -117075,7 +117315,7 @@ var isRegExp = (value) => {
117075
117315
  return true;
117076
117316
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
117077
117317
  return objectIncludes(attrsA, attrsB);
117078
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, resolveOuterShadowOffset = (shadow) => {
117318
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, PT_075 = 1, PT_150 = 2, COMPOUND_PROFILES, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, resolveOuterShadowOffset = (shadow) => {
117079
117319
  const radians = shadow.direction * Math.PI / 180;
117080
117320
  return {
117081
117321
  dx: shadow.distance * Math.cos(radians),
@@ -135588,6 +135828,39 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135588
135828
  value: measurement.value,
135589
135829
  type: measurement.type ?? "px"
135590
135830
  };
135831
+ }, placeRowCellsOnGrid = (rowNode, activeRowSpans) => {
135832
+ const placements = [];
135833
+ const nextActiveRowSpans = activeRowSpans.map((count2) => Math.max(0, count2 - 1));
135834
+ let column = 0;
135835
+ const cellSpan = (cellNode) => {
135836
+ const colspan = cellNode.attrs?.colspan;
135837
+ if (typeof colspan === "number" && colspan > 0)
135838
+ return colspan;
135839
+ const colwidth = cellNode.attrs?.colwidth;
135840
+ return Array.isArray(colwidth) && colwidth.length > 0 ? colwidth.length : 1;
135841
+ };
135842
+ for (const cellNode of Array.isArray(rowNode.content) ? rowNode.content : []) {
135843
+ if (!isTableCellNode(cellNode)) {
135844
+ placements.push(null);
135845
+ continue;
135846
+ }
135847
+ while ((activeRowSpans[column] ?? 0) > 0)
135848
+ column += 1;
135849
+ const span = cellSpan(cellNode);
135850
+ placements.push({
135851
+ gridColumnStart: column,
135852
+ gridColumnSpan: span
135853
+ });
135854
+ const rowspan = typeof cellNode.attrs?.rowspan === "number" ? cellNode.attrs.rowspan : 1;
135855
+ if (rowspan > 1)
135856
+ for (let covered = column;covered < column + span; covered += 1)
135857
+ nextActiveRowSpans[covered] = Math.max(nextActiveRowSpans[covered] ?? 0, rowspan - 1);
135858
+ column += span;
135859
+ }
135860
+ return {
135861
+ placements,
135862
+ nextActiveRowSpans
135863
+ };
135591
135864
  }, isTableRowNode = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", isTableSkipPlaceholderCell = (node3) => {
135592
135865
  const placeholder = node3.attrs?.__placeholder;
135593
135866
  return placeholder === "gridBefore" || placeholder === "gridAfter";
@@ -135630,7 +135903,12 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135630
135903
  numCells,
135631
135904
  numRows,
135632
135905
  rowCnfStyle,
135633
- cellCnfStyle
135906
+ cellCnfStyle,
135907
+ ...args2.gridPlacement != null && args2.numGridCols != null ? {
135908
+ gridColumnStart: args2.gridPlacement.gridColumnStart,
135909
+ gridColumnSpan: args2.gridPlacement.gridColumnSpan,
135910
+ numGridCols: args2.numGridCols
135911
+ } : {}
135634
135912
  } : undefined;
135635
135913
  const inlineTcProps = cellNode.attrs?.tableCellProperties;
135636
135914
  const resolvedTcProps = resolveTableCellProperties(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
@@ -135921,7 +136199,9 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135921
136199
  tableProperties,
135922
136200
  numCells: rowNode?.content?.length || 1,
135923
136201
  numRows,
135924
- rowCnfStyle
136202
+ rowCnfStyle,
136203
+ gridPlacement: args2.cellGridPlacements?.[cellIndex] ?? null,
136204
+ numGridCols: args2.numGridCols
135925
136205
  });
135926
136206
  if (parsedCell)
135927
136207
  cells.push(parsedCell);
@@ -136474,7 +136754,34 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136474
136754
  "data-track-change-date": change.date || ""
136475
136755
  }));
136476
136756
  }
136477
- }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.43.1", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
136757
+ }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, enumeratePprChanges = (state) => {
136758
+ const doc$2 = state?.doc;
136759
+ if (!doc$2)
136760
+ return [];
136761
+ const out = [];
136762
+ try {
136763
+ doc$2.descendants((node3, pos) => {
136764
+ if (node3.isText)
136765
+ return false;
136766
+ const change = node3?.attrs?.paragraphProperties?.change;
136767
+ if (change && typeof change.id === "string" && change.id && change.paragraphProperties)
136768
+ out.push({
136769
+ id: change.id,
136770
+ from: pos,
136771
+ to: pos + node3.nodeSize,
136772
+ author: change.author || "",
136773
+ authorEmail: change.authorEmail || "",
136774
+ authorImage: change.authorImage || "",
136775
+ date: change.date || "",
136776
+ formerProperties: change.paragraphProperties || {},
136777
+ subtype: "paragraph-format"
136778
+ });
136779
+ });
136780
+ } catch {
136781
+ return out;
136782
+ }
136783
+ return out;
136784
+ }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.43.1", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
136478
136785
  if (!runProps?.elements?.length || !state)
136479
136786
  return;
136480
136787
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -136508,7 +136815,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136508
136815
  state.kern = kernNode.attributes["w:val"];
136509
136816
  }
136510
136817
  }, SuperConverter;
136511
- var init_SuperConverter_DIgF4xk__es = __esm(() => {
136818
+ var init_SuperConverter_DlrS7cQT_es = __esm(() => {
136512
136819
  init_rolldown_runtime_Bg48TavK_es();
136513
136820
  init_jszip_C49i9kUs_es();
136514
136821
  init_xml_js_CqGKpaft_es();
@@ -140954,6 +141261,71 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
140954
141261
  "highlight",
140955
141262
  "link"
140956
141263
  ];
141264
+ COMPOUND_PROFILES = {
141265
+ double: (w) => [
141266
+ w,
141267
+ w,
141268
+ w
141269
+ ],
141270
+ triple: (w) => [
141271
+ w,
141272
+ w,
141273
+ w,
141274
+ w,
141275
+ w
141276
+ ],
141277
+ thinThickSmallGap: (w) => [
141278
+ w,
141279
+ PT_075,
141280
+ PT_075
141281
+ ],
141282
+ thickThinSmallGap: (w) => [
141283
+ PT_075,
141284
+ PT_075,
141285
+ w
141286
+ ],
141287
+ thinThickMediumGap: (w) => [
141288
+ w,
141289
+ w / 2,
141290
+ w / 2
141291
+ ],
141292
+ thickThinMediumGap: (w) => [
141293
+ w / 2,
141294
+ w / 2,
141295
+ w
141296
+ ],
141297
+ thinThickLargeGap: (w) => [
141298
+ PT_150,
141299
+ w,
141300
+ PT_075
141301
+ ],
141302
+ thickThinLargeGap: (w) => [
141303
+ PT_075,
141304
+ w,
141305
+ PT_150
141306
+ ],
141307
+ thinThickThinSmallGap: (w) => [
141308
+ PT_075,
141309
+ PT_075,
141310
+ w,
141311
+ PT_075,
141312
+ PT_075
141313
+ ],
141314
+ thinThickThinMediumGap: (w) => [
141315
+ w / 2,
141316
+ w / 2,
141317
+ w,
141318
+ w / 2,
141319
+ w / 2
141320
+ ],
141321
+ thinThickThinLargeGap: (w) => [
141322
+ PT_075,
141323
+ w,
141324
+ PT_150,
141325
+ w,
141326
+ PT_075
141327
+ ]
141328
+ };
140957
141329
  SPACE_CHARS = new Set([" ", " "]);
140958
141330
  idlessSdtContainerKeys = /* @__PURE__ */ new WeakMap;
140959
141331
  DRAWING_DIAGNOSTIC_CODES = {
@@ -141321,6 +141693,8 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
141321
141693
  ...params3.node,
141322
141694
  attrs: change
141323
141695
  } });
141696
+ if (decodedAttrs["w:id"] != null)
141697
+ decodedAttrs["w:id"] = resolvePprChangeWordId(params3, change);
141324
141698
  const hasParagraphProperties$1 = Object.prototype.hasOwnProperty.call(change, "paragraphProperties");
141325
141699
  const paragraphProperties = hasParagraphProperties$1 ? change.paragraphProperties : undefined;
141326
141700
  let pPrNode = paragraphProperties && typeof paragraphProperties === "object" ? pPrTranslator.decode({
@@ -163779,13 +164153,28 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
163779
164153
  "single",
163780
164154
  "double",
163781
164155
  "dashed",
164156
+ "dashSmallGap",
163782
164157
  "dotted",
163783
164158
  "thick",
163784
164159
  "triple",
163785
164160
  "dotDash",
163786
164161
  "dotDotDash",
164162
+ "thinThickSmallGap",
164163
+ "thickThinSmallGap",
164164
+ "thinThickThinSmallGap",
164165
+ "thinThickMediumGap",
164166
+ "thickThinMediumGap",
164167
+ "thinThickThinMediumGap",
164168
+ "thinThickLargeGap",
164169
+ "thickThinLargeGap",
164170
+ "thinThickThinLargeGap",
163787
164171
  "wave",
163788
- "doubleWave"
164172
+ "doubleWave",
164173
+ "dashDotStroked",
164174
+ "threeDEmboss",
164175
+ "threeDEngrave",
164176
+ "outset",
164177
+ "inset"
163789
164178
  ]);
163790
164179
  FONT_FAMILY_FALLBACKS$1 = Object.freeze({
163791
164180
  swiss: "Arial, sans-serif",
@@ -165044,7 +165433,15 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
165044
165433
  }
165045
165434
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = [], editor, exportJsonOnly = false, fieldsHighlightColor, preserveSdtWrappers = false) {
165046
165435
  this.exportWarnings = [];
165047
- const exportableComments = comments.filter((c$1) => !c$1.trackedChange);
165436
+ const isSyntheticTrackedChangeRow = (c$1) => {
165437
+ const linkId = c$1.trackedChangeLink?.trackedChangeId;
165438
+ if (!c$1.trackedChange || !linkId)
165439
+ return false;
165440
+ const identity = c$1.commentId ?? c$1.id;
165441
+ return identity != null && String(identity) === String(linkId);
165442
+ };
165443
+ const hasCommentBody = (c$1) => Boolean(typeof c$1.commentText === "string" && c$1.commentText.length > 0 || c$1.commentJSON || Array.isArray(c$1.elements) && c$1.elements.length || typeof c$1.text === "string" && c$1.text.length > 0);
165444
+ const exportableComments = comments.filter((c$1) => !isSyntheticTrackedChangeRow(c$1) && !(c$1.trackedChange && !hasCommentBody(c$1)));
165048
165445
  const commentsWithParaIds = exportableComments.map((c$1) => prepareCommentParaIds(c$1));
165049
165446
  const commentDefinitions = commentsWithParaIds.map((c$1, index2) => getCommentDefinition(c$1, index2, commentsWithParaIds, editor));
165050
165447
  let statFieldCacheMap;
@@ -165434,7 +165831,7 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
165434
165831
  };
165435
165832
  });
165436
165833
 
165437
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT4yIoZ-.es.js
165834
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Bm-c7KZd.es.js
165438
165835
  function parseSizeUnit(val = "0") {
165439
165836
  const length3 = val.toString() || "0";
165440
165837
  const value = Number.parseFloat(length3);
@@ -169867,7 +170264,25 @@ function executeTextDelete(_editor, tr, target, _step, mapping) {
169867
170264
  tr.delete(absFrom, absTo);
169868
170265
  return { changed: true };
169869
170266
  }
169870
- function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
170267
+ function withTrackedParagraphPropertyChange(editor, existing, nextParagraphProperties, changeMode) {
170268
+ if (changeMode !== "tracked")
170269
+ return nextParagraphProperties;
170270
+ if (existing?.change)
170271
+ return nextParagraphProperties;
170272
+ const { change: _existingChange, ...formerProperties } = existing ?? {};
170273
+ const user = editor?.options?.user ?? {};
170274
+ return {
170275
+ ...nextParagraphProperties,
170276
+ change: {
170277
+ id: v4_default(),
170278
+ author: user.name || "",
170279
+ authorEmail: user.email || "",
170280
+ date: (/* @__PURE__ */ new Date()).toISOString(),
170281
+ paragraphProperties: formerProperties
170282
+ }
170283
+ };
170284
+ }
170285
+ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment, changeMode) {
169871
170286
  if (!alignment)
169872
170287
  return false;
169873
170288
  let changed = false;
@@ -169878,10 +170293,10 @@ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
169878
170293
  const justification = mapAlignmentToJustificationForParagraph(alignment, calculateResolvedParagraphProperties(editor, node3, typeof tr.doc.resolve === "function" ? tr.doc.resolve(pos) : null)?.rightToLeft === true);
169879
170294
  if (existing?.justification === justification)
169880
170295
  return;
169881
- const updated = {
170296
+ const updated = withTrackedParagraphPropertyChange(editor, existing, {
169882
170297
  ...existing ?? {},
169883
170298
  justification
169884
- };
170299
+ }, changeMode);
169885
170300
  tr.setNodeMarkup(pos, undefined, {
169886
170301
  ...node3.attrs,
169887
170302
  paragraphProperties: updated
@@ -169906,7 +170321,7 @@ function expandToBlockBoundaries$1(doc2, from5, to) {
169906
170321
  to: expandedTo
169907
170322
  };
169908
170323
  }
169909
- function executeStyleApply3(editor, tr, target, step$1, mapping) {
170324
+ function executeStyleApply3(editor, tr, target, step$1, mapping, changeMode) {
169910
170325
  let absFrom = mapping.map(target.absFrom);
169911
170326
  let absTo = mapping.map(target.absTo);
169912
170327
  if (step$1.args.scope === "block") {
@@ -169918,7 +170333,7 @@ function executeStyleApply3(editor, tr, target, step$1, mapping) {
169918
170333
  if (step$1.args.inline)
169919
170334
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
169920
170335
  if (step$1.args.alignment)
169921
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
170336
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
169922
170337
  return { changed };
169923
170338
  }
169924
170339
  function validateMappedSpanContiguity(target, mapping, stepId) {
@@ -169989,7 +170404,7 @@ function executeSpanTextDelete(_editor, tr, target, step$1, mapping) {
169989
170404
  tr.delete(absFrom, absTo);
169990
170405
  return { changed: true };
169991
170406
  }
169992
- function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
170407
+ function executeSpanStyleApply(editor, tr, target, step$1, mapping, changeMode) {
169993
170408
  validateMappedSpanContiguity(target, mapping, step$1.id);
169994
170409
  const firstSeg = target.segments[0];
169995
170410
  const lastSeg = target.segments[target.segments.length - 1];
@@ -170004,7 +170419,7 @@ function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
170004
170419
  if (step$1.args.inline)
170005
170420
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
170006
170421
  if (step$1.args.alignment)
170007
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
170422
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
170008
170423
  return { changed };
170009
170424
  }
170010
170425
  function getReplacementText(replacement) {
@@ -176237,9 +176652,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
176237
176652
  }
176238
176653
  };
176239
176654
  };
176240
- var init_create_headless_toolbar_BT4yIoZ_es = __esm(() => {
176655
+ var init_create_headless_toolbar_Bm_c7KZd_es = __esm(() => {
176241
176656
  init_rolldown_runtime_Bg48TavK_es();
176242
- init_SuperConverter_DIgF4xk__es();
176657
+ init_SuperConverter_DlrS7cQT_es();
176243
176658
  init_jszip_C49i9kUs_es();
176244
176659
  init_uuid_B2wVPhPi_es();
176245
176660
  init_constants_D9qj59G2_es();
@@ -226332,7 +226747,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226332
226747
  init_remark_gfm_BUJjZJLy_es();
226333
226748
  });
226334
226749
 
226335
- // ../../packages/superdoc/dist/chunks/src-BrcexyXf.es.js
226750
+ // ../../packages/superdoc/dist/chunks/src-CVmBLxZV.es.js
226336
226751
  function deleteProps(obj, propOrProps) {
226337
226752
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226338
226753
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -231177,6 +231592,12 @@ function updateTableWrapper(tableWrapper, table2) {
231177
231592
  borderWidth = Math.ceil(Math.max(borderLeftMax, borderRightMax));
231178
231593
  tableWrapper.style.setProperty("--table-border-width", `${borderWidth || defaultBorderWidth}px`);
231179
231594
  }
231595
+ function cellWidthDxa(widthPx) {
231596
+ return {
231597
+ value: widthPx * 15,
231598
+ type: "dxa"
231599
+ };
231600
+ }
231180
231601
  function cloneBorders(borders, sides) {
231181
231602
  if (!borders || typeof borders !== "object")
231182
231603
  return {};
@@ -244358,7 +244779,7 @@ function trackChangesGetWrapper(editor, input2) {
244358
244779
  imported: Boolean(toNonEmptyString(resolved.change.attrs.sourceId))
244359
244780
  };
244360
244781
  }
244361
- function decideSingle(hostEditor, decision, id2, story, options) {
244782
+ function decideSingle(hostEditor, decision, id2, story, options, side) {
244362
244783
  const resolved = resolveTrackedChangeInStory(hostEditor, {
244363
244784
  kind: "entity",
244364
244785
  entityType: "trackedChange",
@@ -244376,7 +244797,7 @@ function decideSingle(hostEditor, decision, id2, story, options) {
244376
244797
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${decision === "accept" ? "Accept" : "Reject"} tracked change command is not available on the story editor.`, { reason: "missing_command" });
244377
244798
  checkRevision(hostEditor, options?.expectedRevision);
244378
244799
  const commandRawId = resolved.change.commandRawId ?? resolved.change.rawId;
244379
- if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId))).steps[0]?.effect !== "changed")
244800
+ if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId, side ? { side } : undefined))).steps[0]?.effect !== "changed")
244380
244801
  return decisionFailureReceipt(resolved.editor, `${decision === "accept" ? "Accept" : "Reject"} tracked change "${id2}" produced no change.`, {
244381
244802
  id: id2,
244382
244803
  story
@@ -244388,10 +244809,10 @@ function decideSingle(hostEditor, decision, id2, story, options) {
244388
244809
  return { success: true };
244389
244810
  }
244390
244811
  function trackChangesAcceptWrapper(editor, input2, options) {
244391
- return decideSingle(editor, "accept", input2.id, input2.story, options);
244812
+ return decideSingle(editor, "accept", input2.id, input2.story, options, input2.side);
244392
244813
  }
244393
244814
  function trackChangesRejectWrapper(editor, input2, options) {
244394
- return decideSingle(editor, "reject", input2.id, input2.story, options);
244815
+ return decideSingle(editor, "reject", input2.id, input2.story, options, input2.side);
244395
244816
  }
244396
244817
  function decideAll(editor, decision, input2, options) {
244397
244818
  const index2 = getTrackedChangeIndex(editor);
@@ -245457,6 +245878,7 @@ function replyToCommentHandler(editor, input2, options) {
245457
245878
  };
245458
245879
  if (trackedPayload && inheritedTrackedFields)
245459
245880
  emitCommentLifecycleUpdate(editor, "update", trackedPayload);
245881
+ incrementRevision(editor);
245460
245882
  return {
245461
245883
  success: true,
245462
245884
  id: replyId,
@@ -248152,6 +248574,13 @@ function extractBlockNumbering(node3) {
248152
248574
  function extractBlockFormatting(node3, styleCtx) {
248153
248575
  const pProps = node3.attrs.paragraphProperties;
248154
248576
  const styleId$1 = pProps?.styleId ?? null;
248577
+ const rawIndent = pProps?.indent;
248578
+ const indent2 = rawIndent && typeof rawIndent === "object" ? Object.fromEntries([
248579
+ "left",
248580
+ "right",
248581
+ "firstLine",
248582
+ "hanging"
248583
+ ].filter((k$1) => typeof rawIndent[k$1] === "number" && rawIndent[k$1] !== 0).map((k$1) => [k$1, rawIndent[k$1]])) : undefined;
248155
248584
  let fontFamily;
248156
248585
  let fontSize;
248157
248586
  let bold2;
@@ -248200,6 +248629,7 @@ function extractBlockFormatting(node3, styleCtx) {
248200
248629
  ...underline ? { underline } : {},
248201
248630
  ...color2 ? { color: color2 } : {},
248202
248631
  ...pProps?.justification ? { alignment: pProps.justification } : {},
248632
+ ...indent2 && Object.keys(indent2).length > 0 ? { indent: indent2 } : {},
248203
248633
  ...headingLevel ? { headingLevel } : {}
248204
248634
  };
248205
248635
  }
@@ -248287,6 +248717,7 @@ function blocksListWrapper(editor, input2) {
248287
248717
  }],
248288
248718
  blockIndex: offset$1 + i3
248289
248719
  }) : undefined;
248720
+ const listRendering = candidate.node.attrs?.listRendering;
248290
248721
  return {
248291
248722
  ordinal: offset$1 + i3,
248292
248723
  nodeId: candidate.nodeId,
@@ -248295,6 +248726,11 @@ function blocksListWrapper(editor, input2) {
248295
248726
  ...fullText !== undefined ? { text: fullText } : {},
248296
248727
  isEmpty: textLength === 0,
248297
248728
  ...extractBlockFormatting(candidate.node, styleCtx),
248729
+ ...listRendering ? { numbering: {
248730
+ marker: listRendering.markerText ?? null,
248731
+ path: listRendering.path ?? null,
248732
+ kind: listRendering.numberingType ?? null
248733
+ } } : {},
248298
248734
  ...numbering ? { paragraphNumbering: numbering } : {},
248299
248735
  ...ref$1 ? { ref: ref$1 } : {}
248300
248736
  };
@@ -249627,7 +250063,9 @@ function listsCreateWrapper(editor, input2, options) {
249627
250063
  };
249628
250064
  }
249629
250065
  function listsAttachWrapper(editor, input2, options) {
249630
- rejectTrackedMode("lists.attach", options);
250066
+ const trackChange = (options?.changeMode ?? "direct") === "tracked";
250067
+ if (trackChange)
250068
+ ensureTrackedCapability(editor, { operation: "lists.attach" });
249631
250069
  const attachTo = resolveListItem(editor, input2.attachTo);
249632
250070
  if (attachTo.numId == null)
249633
250071
  return toListsFailure$1("INVALID_TARGET", "attachTo target must be a list item with numbering metadata.", { attachTo: input2.attachTo });
@@ -249654,7 +250092,7 @@ function listsAttachWrapper(editor, input2, options) {
249654
250092
  updateNumberingProperties({
249655
250093
  numId,
249656
250094
  ilvl: level
249657
- }, block.node, block.pos, editor, tr);
250095
+ }, block.node, block.pos, editor, tr, { trackChange });
249658
250096
  dispatchEditorTransaction$1(editor, tr);
249659
250097
  clearIndexCache(editor);
249660
250098
  return true;
@@ -253997,11 +254435,17 @@ function tablesSetShadingAdapter(editor, input2, options) {
253997
254435
  color: "auto"
253998
254436
  };
253999
254437
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
254000
- tr.setNodeMarkup(resolved.pos, null, {
254438
+ const nextAttrs = {
254001
254439
  ...currentAttrs,
254002
254440
  [propsKey]: currentProps,
254003
254441
  ...syncAttrs
254004
- });
254442
+ };
254443
+ if (resolved.scope === "cell")
254444
+ if (normalizedColor === "auto")
254445
+ delete nextAttrs.background;
254446
+ else
254447
+ nextAttrs.background = { color: normalizedColor };
254448
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
254005
254449
  if (resolved.scope === "table")
254006
254450
  applyShadingToCells(tr, resolved.node, resolved.pos + 1, normalizedColor);
254007
254451
  applyDirectMutationMeta(tr);
@@ -254028,11 +254472,14 @@ function tablesClearShadingAdapter(editor, input2, options) {
254028
254472
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
254029
254473
  delete currentProps.shading;
254030
254474
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
254031
- tr.setNodeMarkup(resolved.pos, null, {
254475
+ const nextAttrs = {
254032
254476
  ...currentAttrs,
254033
254477
  [propsKey]: currentProps,
254034
254478
  ...syncAttrs
254035
- });
254479
+ };
254480
+ if (resolved.scope === "cell")
254481
+ delete nextAttrs.background;
254482
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
254036
254483
  if (resolved.scope === "table") {
254037
254484
  const tableNode = resolved.node;
254038
254485
  const tableStart = resolved.pos + 1;
@@ -255075,7 +255522,7 @@ function registerBuiltInExecutors() {
255075
255522
  registerStepExecutor("text.delete", { execute: (ctx$1, targets, step3) => executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeTextDelete(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanTextDelete(e, tr, t, s2, m$1)) });
255076
255523
  registerStepExecutor("format.apply", { execute: (ctx$1, targets, step3) => {
255077
255524
  ensureFormatStepCapabilities(ctx$1, step3);
255078
- return executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeStyleApply3(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1));
255525
+ return executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeStyleApply3(e, tr, t, s2, m$1, ctx$1.changeMode), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1, ctx$1.changeMode));
255079
255526
  } });
255080
255527
  registerStepExecutor("create.paragraph", { execute: (ctx$1, targets, step3) => executeCreateStep(ctx$1.editor, ctx$1.tr, step3, targets, ctx$1.mapping) });
255081
255528
  registerStepExecutor("create.heading", { execute: (ctx$1, targets, step3) => executeCreateStep(ctx$1.editor, ctx$1.tr, step3, targets, ctx$1.mapping) });
@@ -270353,6 +270800,19 @@ function countHeaderRows(block) {
270353
270800
  break;
270354
270801
  return count2;
270355
270802
  }
270803
+ function countRepeatableHeaderRows(block) {
270804
+ const headerCount = countHeaderRows(block);
270805
+ if (headerCount === 0)
270806
+ return 0;
270807
+ let bandEnd = headerCount;
270808
+ for (let r$1 = 0;r$1 < headerCount && r$1 < block.rows.length; r$1++)
270809
+ for (const cell2 of block.rows[r$1]?.cells ?? []) {
270810
+ const rowSpan = cell2.rowSpan ?? 1;
270811
+ if (rowSpan > 1)
270812
+ bandEnd = Math.max(bandEnd, r$1 + rowSpan);
270813
+ }
270814
+ return Math.min(bandEnd, block.rows.length);
270815
+ }
270356
270816
  function sumRowHeights(rows, fromRow, toRow) {
270357
270817
  let total = 0;
270358
270818
  for (let i3 = fromRow;i3 < toRow && i3 < rows.length; i3++)
@@ -270737,7 +271197,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
270737
271197
  });
270738
271198
  return;
270739
271199
  }
270740
- const headerCount = countHeaderRows(block);
271200
+ const headerCount = countRepeatableHeaderRows(block);
270741
271201
  const headerPrefixHeights = [0];
270742
271202
  for (let i3 = 0;i3 < headerCount; i3 += 1)
270743
271203
  headerPrefixHeights.push(headerPrefixHeights[i3] + (measure.rows[i3]?.height ?? 0));
@@ -283542,12 +284002,14 @@ function computeAutoFitColumnWidths(input2) {
283542
284002
  const currentWidths = fixedLayout.columnWidths.slice(0, gridColumnCount);
283543
284003
  const minBounds = new Array(gridColumnCount).fill(0);
283544
284004
  const maxBounds = new Array(gridColumnCount).fill(0);
284005
+ const textBounds = new Array(gridColumnCount).fill(0);
283545
284006
  const preferredOverrides = new Array(gridColumnCount).fill(undefined);
283546
284007
  const multiSpanCells = [];
283547
284008
  accumulateBounds({
283548
284009
  rows: normalizedRows,
283549
284010
  minBounds,
283550
284011
  maxBounds,
284012
+ textBounds,
283551
284013
  preferredOverrides,
283552
284014
  multiSpanCells
283553
284015
  });
@@ -283570,7 +284032,26 @@ function computeAutoFitColumnWidths(input2) {
283570
284032
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
283571
284033
  } else {
283572
284034
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
283573
- if (!shouldPreservePreferredGrid) {
284035
+ if (workingInput.contentSizeAutoTable === true) {
284036
+ const columnBandAllowances = workingInput.columnBandAllowances;
284037
+ resolvedWidths = maxBounds.map((max$2, index2) => {
284038
+ const allowance = columnBandAllowances?.[index2] ?? 0;
284039
+ const withAllowance = Math.max(max$2, minBounds[index2]) + allowance;
284040
+ const textFloor = textBounds[index2] + allowance * 2;
284041
+ return Math.max(withAllowance, textFloor);
284042
+ });
284043
+ for (const spanCell of multiSpanCells) {
284044
+ const covered = resolvedWidths.slice(spanCell.startColumn, spanCell.startColumn + spanCell.span);
284045
+ const currentTotal = sumWidths$1(covered);
284046
+ const demand = spanCell.preferredWidth ?? spanCell.maxContentWidth;
284047
+ if (currentTotal < demand && covered.length > 0) {
284048
+ const topUp = (demand - currentTotal) / covered.length;
284049
+ for (let index2 = 0;index2 < covered.length; index2++)
284050
+ resolvedWidths[spanCell.startColumn + index2] += topUp;
284051
+ }
284052
+ }
284053
+ targetTableWidth = Math.min(sumWidths$1(resolvedWidths), maxResolvedTableWidth);
284054
+ } else if (!shouldPreservePreferredGrid) {
283574
284055
  resolvedWidths = redistributeTowardMaximumsWithinCurrentTable(resolvedWidths, minBounds, maxBounds);
283575
284056
  resolvedWidths = redistributeTowardContentWeightedShape(resolvedWidths, minBounds, maxBounds);
283576
284057
  }
@@ -283632,7 +284113,8 @@ function resolveAutoFitContext(input2) {
283632
284113
  span: cell2.span,
283633
284114
  preferredWidth: cell2.preferredWidth,
283634
284115
  minContentWidth: cell2.minContentWidth,
283635
- maxContentWidth: cell2.maxContentWidth
284116
+ maxContentWidth: cell2.maxContentWidth,
284117
+ horizontalInsets: cell2.horizontalInsets
283636
284118
  }))
283637
284119
  })),
283638
284120
  minColumnWidth
@@ -283665,7 +284147,8 @@ function normalizeLegacyRows(rows) {
283665
284147
  span,
283666
284148
  preferredWidth: sanitizeOptionalWidth(cell2.preferredWidth),
283667
284149
  minContentWidth: Math.max(0, cell2.minContentWidth ?? 0),
283668
- maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0)
284150
+ maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0),
284151
+ horizontalInsets: Math.max(0, cell2.horizontalInsets ?? 0)
283669
284152
  });
283670
284153
  columnIndex += span;
283671
284154
  }
@@ -283702,7 +284185,8 @@ function buildNormalizedRows(workingInput, rowMetrics) {
283702
284185
  span: Math.max(1, placedCell.span ?? metrics?.span ?? 1),
283703
284186
  preferredWidth: sanitizeOptionalWidth(metrics?.preferredWidth ?? placedCell.preferredWidth),
283704
284187
  minContentWidth: Math.max(0, metrics?.minContentWidth ?? 0),
283705
- maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0)
284188
+ maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0),
284189
+ horizontalInsets: Math.max(0, metrics?.horizontalInsets ?? 0)
283706
284190
  };
283707
284191
  }),
283708
284192
  skippedColumns: (workingRow.skippedColumns ?? []).map((skipped) => ({
@@ -283716,7 +284200,7 @@ function buildNormalizedRows(workingInput, rowMetrics) {
283716
284200
  });
283717
284201
  }
283718
284202
  function accumulateBounds(args$1) {
283719
- const { rows, minBounds, maxBounds, preferredOverrides, multiSpanCells } = args$1;
284203
+ const { rows, minBounds, maxBounds, textBounds, preferredOverrides, multiSpanCells } = args$1;
283720
284204
  for (const row2 of rows) {
283721
284205
  for (const skipped of row2.skippedColumns) {
283722
284206
  minBounds[skipped.columnIndex] = Math.max(minBounds[skipped.columnIndex], skipped.minContentWidth);
@@ -283728,6 +284212,7 @@ function accumulateBounds(args$1) {
283728
284212
  if (cell2.span === 1) {
283729
284213
  minBounds[cell2.startColumn] = Math.max(minBounds[cell2.startColumn], cell2.minContentWidth);
283730
284214
  maxBounds[cell2.startColumn] = Math.max(maxBounds[cell2.startColumn], cell2.maxContentWidth);
284215
+ textBounds[cell2.startColumn] = Math.max(textBounds[cell2.startColumn], Math.max(0, cell2.maxContentWidth - cell2.horizontalInsets));
283731
284216
  if (preferredOverrides[cell2.startColumn] == null && cell2.preferredWidth != null)
283732
284217
  preferredOverrides[cell2.startColumn] = cell2.preferredWidth;
283733
284218
  } else
@@ -284171,16 +284656,29 @@ function buildAutoFitWorkingGridInput(block, constraints) {
284171
284656
  layoutMode,
284172
284657
  preferredColumnWidths,
284173
284658
  preferredTableWidth,
284174
- gridColumnCount
284659
+ gridColumnCount,
284660
+ rows
284175
284661
  });
284176
284662
  const preserveExplicitAutoGrid = shouldPreserveExplicitAutoGrid({
284177
284663
  layoutMode,
284664
+ tableWidth,
284178
284665
  preferredColumnWidths,
284179
284666
  preferredTableWidth,
284180
284667
  gridColumnCount,
284181
284668
  rows
284182
284669
  });
284183
- const autoGridWidthBudget = resolveAutoGridWidthBudget({
284670
+ const contentSizeAutoTable = resolveContentSizeAutoTable({
284671
+ layoutMode,
284672
+ tableWidth,
284673
+ preferredTableWidth,
284674
+ preferredColumnWidths,
284675
+ maxTableWidth,
284676
+ rows,
284677
+ preserveAutoGrid,
284678
+ preserveExplicitAutoGrid
284679
+ });
284680
+ const columnBandAllowances = contentSizeAutoTable ? resolveColumnBandAllowances(block.attrs?.borders, gridColumnCount) : undefined;
284681
+ const autoGridWidthBudget = contentSizeAutoTable ? undefined : resolveAutoGridWidthBudget({
284184
284682
  layoutMode,
284185
284683
  tableWidth,
284186
284684
  preferredColumnWidths,
@@ -284195,6 +284693,8 @@ function buildAutoFitWorkingGridInput(block, constraints) {
284195
284693
  ...preserveAutoGrid ? { preserveAutoGrid } : {},
284196
284694
  ...preserveExplicitAutoGrid ? { preserveExplicitAutoGrid } : {},
284197
284695
  ...autoGridWidthBudget != null ? { autoGridWidthBudget } : {},
284696
+ ...contentSizeAutoTable ? { contentSizeAutoTable } : {},
284697
+ ...columnBandAllowances ? { columnBandAllowances } : {},
284198
284698
  preferredTableWidth,
284199
284699
  preferredColumnWidths,
284200
284700
  gridColumnCount,
@@ -284216,19 +284716,21 @@ function shouldPreserveAuthoredGrid(args$1) {
284216
284716
  return approximatelyEqual(totalPreferredColumnWidth, preferredTableWidth) || isSlightlyUnderPreferredTableWidth(totalPreferredColumnWidth, preferredTableWidth);
284217
284717
  }
284218
284718
  function shouldPreserveAutoGrid(args$1) {
284219
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount } = args$1;
284719
+ const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
284220
284720
  if (layoutMode !== "autofit")
284221
284721
  return false;
284222
284722
  if (preferredTableWidth != null)
284223
284723
  return false;
284224
284724
  if (preferredColumnWidths.length === 0 || preferredColumnWidths.length !== gridColumnCount)
284225
284725
  return false;
284726
+ if (preferredColumnWidths.length === 1 && !hasConcreteCellWidthRequest(rows))
284727
+ return false;
284226
284728
  if (!hasNonUniformGrid(preferredColumnWidths))
284227
284729
  return false;
284228
284730
  return true;
284229
284731
  }
284230
284732
  function shouldPreserveExplicitAutoGrid(args$1) {
284231
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
284733
+ const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
284232
284734
  if (layoutMode !== "autofit")
284233
284735
  return false;
284234
284736
  if (preferredTableWidth == null || preferredTableWidth <= 0)
@@ -284237,8 +284739,52 @@ function shouldPreserveExplicitAutoGrid(args$1) {
284237
284739
  return false;
284238
284740
  if (!hasNonUniformGrid(preferredColumnWidths) && !hasConcreteCellWidthRequest(rows))
284239
284741
  return false;
284742
+ if (isPercentTableWidth(tableWidth))
284743
+ return true;
284240
284744
  return approximatelyEqual(sumWidths(preferredColumnWidths), preferredTableWidth);
284241
284745
  }
284746
+ function isPercentTableWidth(tableWidth) {
284747
+ return typeof tableWidth === "object" && tableWidth != null && typeof tableWidth.type === "string" && tableWidth.type.toLowerCase() === "pct";
284748
+ }
284749
+ function resolveContentSizeAutoTable(args$1) {
284750
+ const { layoutMode, tableWidth, preferredTableWidth, preferredColumnWidths, maxTableWidth, rows, preserveAutoGrid, preserveExplicitAutoGrid } = args$1;
284751
+ if (layoutMode !== "autofit")
284752
+ return false;
284753
+ if (preferredTableWidth != null)
284754
+ return false;
284755
+ if (preserveAutoGrid || preserveExplicitAutoGrid)
284756
+ return false;
284757
+ if (!isAutoOrNilTableWidth(tableWidth))
284758
+ return false;
284759
+ if (hasConcreteCellWidthRequest(rows))
284760
+ return false;
284761
+ if (sumWidths(preferredColumnWidths) > maxTableWidth + 0.5)
284762
+ return false;
284763
+ return true;
284764
+ }
284765
+ function isAutoOrNilTableWidth(tableWidth) {
284766
+ if (tableWidth == null)
284767
+ return true;
284768
+ if (hasAutoTableWidthSemantics(tableWidth))
284769
+ return true;
284770
+ if (typeof tableWidth === "object" && typeof tableWidth.type === "string")
284771
+ return tableWidth.type.toLowerCase() === "nil";
284772
+ return false;
284773
+ }
284774
+ function resolveColumnBandAllowances(borders, gridColumnCount) {
284775
+ if (gridColumnCount <= 0)
284776
+ return;
284777
+ const left$1 = getBorderBandWidthPx(borders?.left);
284778
+ const insideV = getBorderBandWidthPx(borders?.insideV);
284779
+ const right$1 = getBorderBandWidthPx(borders?.right);
284780
+ const allowances = [];
284781
+ for (let i3 = 0;i3 < gridColumnCount; i3++) {
284782
+ const edgeLeft = i3 === 0 ? left$1 : insideV;
284783
+ const edgeRight = i3 === gridColumnCount - 1 ? right$1 : insideV;
284784
+ allowances.push((edgeLeft + edgeRight) / 2);
284785
+ }
284786
+ return allowances.some((a2) => a2 > 0) ? allowances : undefined;
284787
+ }
284242
284788
  function resolveAutoGridWidthBudget(args$1) {
284243
284789
  const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, maxTableWidth } = args$1;
284244
284790
  if (layoutMode !== "autofit")
@@ -284539,7 +285085,8 @@ async function measureTableCellContentMetrics(cell2, options) {
284539
285085
  if (contentBlocks.length === 0) {
284540
285086
  const emptyMetrics = {
284541
285087
  minWidthPx: horizontalInsets,
284542
- maxWidthPx: horizontalInsets
285088
+ maxWidthPx: horizontalInsets,
285089
+ horizontalInsetsPx: horizontalInsets
284543
285090
  };
284544
285091
  tableCellMetricsCache.set(cacheKey, emptyMetrics);
284545
285092
  return emptyMetrics;
@@ -284553,7 +285100,8 @@ async function measureTableCellContentMetrics(cell2, options) {
284553
285100
  }
284554
285101
  const result = {
284555
285102
  minWidthPx: minContentWidthPx + horizontalInsets,
284556
- maxWidthPx: maxContentWidthPx + horizontalInsets
285103
+ maxWidthPx: maxContentWidthPx + horizontalInsets,
285104
+ horizontalInsetsPx: horizontalInsets
284557
285105
  };
284558
285106
  tableCellMetricsCache.set(cacheKey, result);
284559
285107
  return result;
@@ -284583,7 +285131,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
284583
285131
  span,
284584
285132
  preferredWidth: normalizedCell?.preferredWidth,
284585
285133
  minContentWidth: metrics.minWidthPx,
284586
- maxContentWidth: metrics.maxWidthPx
285134
+ maxContentWidth: metrics.maxWidthPx,
285135
+ horizontalInsets: metrics.horizontalInsetsPx
284587
285136
  };
284588
285137
  }))
284589
285138
  };
@@ -284598,7 +285147,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
284598
285147
  span: cellMetrics.span,
284599
285148
  preferredWidth: cellMetrics.preferredWidth,
284600
285149
  minContentWidth: cellMetrics.minContentWidth,
284601
- maxContentWidth: cellMetrics.maxContentWidth
285150
+ maxContentWidth: cellMetrics.maxContentWidth,
285151
+ horizontalInsets: cellMetrics.horizontalInsets
284602
285152
  })),
284603
285153
  skippedAfter: normalizedRow.skippedAfter ?? []
284604
285154
  };
@@ -284850,18 +285400,7 @@ function clearTextMeasurementCaches() {
284850
285400
  canvasContext = null;
284851
285401
  }
284852
285402
  function getTableBorderWidthPx(value) {
284853
- if (value == null)
284854
- return 0;
284855
- if (typeof value === "object" && "none" in value && value.none)
284856
- return 0;
284857
- const raw = value;
284858
- const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
284859
- const width = Math.max(0, w);
284860
- if (raw.style === "none")
284861
- return 0;
284862
- if (raw.style === "thick")
284863
- return Math.max(width * 2, 3);
284864
- return width;
285403
+ return getBorderBandWidthPx(value);
284865
285404
  }
284866
285405
  function getTableBorderWidths(borders) {
284867
285406
  return {
@@ -286562,12 +287101,17 @@ async function measureTableBlock(block, constraints, fontContext) {
286562
287101
  });
286563
287102
  if (rowspan === 1)
286564
287103
  rowBaseHeights[rowIndex] = Math.max(rowBaseHeights[rowIndex], totalCellHeight);
286565
- else
287104
+ else {
287105
+ const firstBlockMeasure = blockMeasures[0];
287106
+ const firstLineHeight = firstBlockMeasure?.kind === "paragraph" && firstBlockMeasure.lines.length > 0 ? firstBlockMeasure.lines[0].lineHeight : undefined;
287107
+ const minRowHeight = Math.min(totalCellHeight, firstLineHeight != null ? firstLineHeight + paddingTop + paddingBottom : totalCellHeight / rowspan);
286566
287108
  spanConstraints.push({
286567
287109
  startRow: rowIndex,
286568
287110
  rowSpan: rowspan,
286569
- requiredHeight: totalCellHeight
287111
+ requiredHeight: totalCellHeight,
287112
+ minRowHeight
286570
287113
  });
287114
+ }
286571
287115
  gridColIndex += colspan;
286572
287116
  }
286573
287117
  for (let col = gridColIndex;col < gridColumnCount; col++)
@@ -286579,6 +287123,12 @@ async function measureTableBlock(block, constraints, fontContext) {
286579
287123
  });
286580
287124
  }
286581
287125
  const rowHeights = [...rowBaseHeights];
287126
+ for (const constraint of spanConstraints) {
287127
+ const spanLength = Math.min(constraint.rowSpan, rowHeights.length - constraint.startRow);
287128
+ for (let i3 = 0;i3 < spanLength; i3++)
287129
+ if (rowBaseHeights[constraint.startRow + i3] === 0)
287130
+ rowHeights[constraint.startRow + i3] = Math.max(rowHeights[constraint.startRow + i3], constraint.minRowHeight);
287131
+ }
286582
287132
  for (const constraint of spanConstraints) {
286583
287133
  const { startRow, rowSpan, requiredHeight } = constraint;
286584
287134
  if (rowSpan <= 0)
@@ -286593,6 +287143,34 @@ async function measureTableBlock(block, constraints, fontContext) {
286593
287143
  rowHeights[startRow + i3] += increment2;
286594
287144
  }
286595
287145
  }
287146
+ if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) !== "separate" && block.rows.length > 0) {
287147
+ const tableBordersForBands = block.attrs?.borders;
287148
+ const bandReservation = (band) => band > 2 ? band - 1 : 0;
287149
+ const gridlineBand = (gridline) => {
287150
+ let band = 0;
287151
+ const rowAbove = gridline > 0 ? block.rows[gridline - 1] : undefined;
287152
+ const rowBelow = gridline < block.rows.length ? block.rows[gridline] : undefined;
287153
+ for (const row2 of [rowAbove, rowBelow]) {
287154
+ if (!row2)
287155
+ continue;
287156
+ const override = row2.attrs?.borders;
287157
+ const eff = override ? {
287158
+ ...tableBordersForBands ?? {},
287159
+ ...override
287160
+ } : tableBordersForBands;
287161
+ const value = gridline === 0 ? eff?.top : gridline === block.rows.length ? eff?.bottom : eff?.insideH;
287162
+ band = Math.max(band, getBorderBandWidthPx(value));
287163
+ }
287164
+ for (const cell2 of rowAbove?.cells ?? [])
287165
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.bottom));
287166
+ for (const cell2 of rowBelow?.cells ?? [])
287167
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.top));
287168
+ return band;
287169
+ };
287170
+ for (let i3 = 0;i3 < block.rows.length; i3++)
287171
+ rowHeights[i3] += bandReservation(gridlineBand(i3));
287172
+ rowHeights[block.rows.length - 1] += bandReservation(gridlineBand(block.rows.length));
287173
+ }
286596
287174
  block.rows.forEach((row2, index2) => {
286597
287175
  const spec = row2.attrs?.rowHeight;
286598
287176
  if (spec?.value != null && Number.isFinite(spec.value))
@@ -294240,7 +294818,10 @@ var Node$13 = class Node$14 {
294240
294818
  const headerCells = [];
294241
294819
  const cells = [];
294242
294820
  for (let index2 = 0;index2 < colsCount; index2++) {
294243
- const cellAttrs = columnWidths ? { colwidth: [columnWidths[index2]] } : null;
294821
+ const cellAttrs = columnWidths ? {
294822
+ colwidth: [columnWidths[index2]],
294823
+ tableCellProperties: { cellWidth: cellWidthDxa(columnWidths[index2]) }
294824
+ } : null;
294244
294825
  const cell2 = createCell2(types3.tableCell, cellContent, cellAttrs);
294245
294826
  if (cell2)
294246
294827
  cells.push(cell2);
@@ -296642,11 +297223,12 @@ var Node$13 = class Node$14 {
296642
297223
  return buildGraphFromSpans({
296643
297224
  spans: enumerateTrackedMarkSpans(state),
296644
297225
  structuralChanges: enumerateStructuralRowChanges(state),
297226
+ pprChanges: enumeratePprChanges(state),
296645
297227
  doc: state?.doc ?? null,
296646
297228
  story,
296647
297229
  replacementsMode
296648
297230
  });
296649
- }, buildGraphFromSpans = ({ spans, structuralChanges = [], doc: doc$12, story, replacementsMode }) => {
297231
+ }, buildGraphFromSpans = ({ spans, structuralChanges = [], pprChanges = [], doc: doc$12, story, replacementsMode }) => {
296650
297232
  const mergedSegments = mergeAdjacentSpans(spans.map((span) => ({
296651
297233
  attrs: readTrackedAttrs(span.mark, span.mark.type.name),
296652
297234
  span
@@ -296724,6 +297306,22 @@ var Node$13 = class Node$14 {
296724
297306
  mergedSegments.push(...logical.segments);
296725
297307
  appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
296726
297308
  }
297309
+ for (const ppr of pprChanges) {
297310
+ const logical = buildPprLogicalChange({
297311
+ ppr,
297312
+ doc: doc$12,
297313
+ story
297314
+ });
297315
+ if (!logical)
297316
+ continue;
297317
+ const internalKey = `pprchange:${ppr.from}`;
297318
+ if (changes.has(internalKey))
297319
+ continue;
297320
+ changes.set(internalKey, logical);
297321
+ if (logical.id && logical.id !== internalKey && !changes.has(logical.id))
297322
+ changes.set(logical.id, logical);
297323
+ appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
297324
+ }
296727
297325
  const segments = mergedSegments.slice().sort((a2, b$1) => a2.from - b$1.from || a2.to - b$1.to);
296728
297326
  const graph = {
296729
297327
  changes,
@@ -296836,6 +297434,12 @@ var Node$13 = class Node$14 {
296836
297434
  type = CanonicalChangeType.Formatting;
296837
297435
  else
296838
297436
  type = "";
297437
+ if (type === CanonicalChangeType.Replacement && !(inserted.length && deleted.length)) {
297438
+ if (inserted.length)
297439
+ type = CanonicalChangeType.Insertion;
297440
+ else if (deleted.length)
297441
+ type = CanonicalChangeType.Deletion;
297442
+ }
296839
297443
  const subtype = subtypeFromChangeType(type) ?? "";
296840
297444
  const primary = segments[0]?.attrs ?? null;
296841
297445
  let replacement = null;
@@ -296972,6 +297576,90 @@ var Node$13 = class Node$14 {
296972
297576
  enumerable: false
296973
297577
  });
296974
297578
  return logical;
297579
+ }, buildPprLogicalChange = ({ ppr, doc: doc$12, story }) => {
297580
+ const from$1 = ppr.from;
297581
+ const to = ppr.to;
297582
+ if (!(from$1 < to))
297583
+ return null;
297584
+ const side = SegmentSide.Formatting;
297585
+ const attrs = {
297586
+ id: ppr.id,
297587
+ revisionGroupId: ppr.id,
297588
+ splitFromId: "",
297589
+ changeType: CanonicalChangeType.Formatting,
297590
+ replacementGroupId: "",
297591
+ replacementSideId: "",
297592
+ overlapParentId: "",
297593
+ sourceIds: {},
297594
+ sourceId: "",
297595
+ importedAuthor: "",
297596
+ origin: "",
297597
+ author: ppr.author,
297598
+ authorId: "",
297599
+ authorEmail: ppr.authorEmail,
297600
+ authorImage: ppr.authorImage,
297601
+ date: ppr.date,
297602
+ markType: "",
297603
+ side,
297604
+ subtype: ppr.subtype,
297605
+ explicitChangeType: CanonicalChangeType.Formatting,
297606
+ hasReviewMetadata: true
297607
+ };
297608
+ const segment = {
297609
+ segmentId: `${ppr.id}:pprchange:${from$1}:${to}:0`,
297610
+ changeId: ppr.id,
297611
+ markType: "",
297612
+ side,
297613
+ from: from$1,
297614
+ to,
297615
+ text: "",
297616
+ mark: null,
297617
+ markRuns: [],
297618
+ attrs,
297619
+ parentId: "",
297620
+ parentSide: "",
297621
+ overlapRole: "standalone",
297622
+ pprChange: true
297623
+ };
297624
+ if (doc$12)
297625
+ try {
297626
+ segment.text = doc$12.textBetween(from$1, to, " ", "");
297627
+ } catch {
297628
+ segment.text = "";
297629
+ }
297630
+ const segments = [segment];
297631
+ const logical = {
297632
+ id: ppr.id,
297633
+ type: CanonicalChangeType.Formatting,
297634
+ subtype: ppr.subtype,
297635
+ state: "open",
297636
+ segments,
297637
+ coverageSegments: [...segments],
297638
+ insertedSegments: [],
297639
+ deletedSegments: [],
297640
+ formattingSegments: [...segments],
297641
+ replacement: null,
297642
+ author: ppr.author,
297643
+ authorId: "",
297644
+ authorEmail: ppr.authorEmail,
297645
+ authorImage: ppr.authorImage,
297646
+ date: ppr.date,
297647
+ sourceIds: {},
297648
+ revisionGroupId: ppr.id,
297649
+ splitFromId: "",
297650
+ sourcePlatform: "",
297651
+ story,
297652
+ parent: null,
297653
+ children: [],
297654
+ before: [],
297655
+ after: [],
297656
+ excerpt: segment.text.length > 200 ? `${segment.text.slice(0, 200)}…` : segment.text
297657
+ };
297658
+ Object.defineProperty(logical, "pprChange", {
297659
+ value: ppr,
297660
+ enumerable: false
297661
+ });
297662
+ return logical;
296975
297663
  }, aggregateSourceIds = (segments) => {
296976
297664
  const out = {};
296977
297665
  const sorted = [...segments].sort((a2, b$1) => {
@@ -299686,6 +300374,10 @@ var Node$13 = class Node$14 {
299686
300374
  touchedChangeIds: applyResult.touchedChangeIds,
299687
300375
  diagnostics: plan.diagnostics
299688
300376
  };
300377
+ }, normalizeReplacementSide = (value) => {
300378
+ if (value === SegmentSide.Inserted || value === SegmentSide.Deleted)
300379
+ return value;
300380
+ return null;
299689
300381
  }, normalizeDecisionTarget = (target) => {
299690
300382
  if (!target || typeof target !== "object")
299691
300383
  return {
@@ -299699,11 +300391,18 @@ var Node$13 = class Node$14 {
299699
300391
  ok: false,
299700
300392
  failure: failure$3("INVALID_TARGET", 'target.kind = "id" requires a non-empty id.')
299701
300393
  };
300394
+ const side = normalizeReplacementSide(t.side);
300395
+ if (t.side != null && !side)
300396
+ return {
300397
+ ok: false,
300398
+ failure: failure$3("INVALID_TARGET", 'target.side must be "inserted" or "deleted" when provided.')
300399
+ };
299702
300400
  return {
299703
300401
  ok: true,
299704
300402
  value: {
299705
300403
  kind: "id",
299706
- id: t.id
300404
+ id: t.id,
300405
+ ...side ? { side } : {}
299707
300406
  }
299708
300407
  };
299709
300408
  }
@@ -299807,7 +300506,8 @@ var Node$13 = class Node$14 {
299807
300506
  ranges: change.segments.map((s2) => ({
299808
300507
  from: s2.from,
299809
300508
  to: s2.to
299810
- }))
300509
+ })),
300510
+ ...normalized.side ? { side: normalized.side } : {}
299811
300511
  }]
299812
300512
  };
299813
300513
  }
@@ -300050,7 +300750,7 @@ var Node$13 = class Node$14 {
300050
300750
  suppressedInsideTable.add(change.id);
300051
300751
  continue;
300052
300752
  }
300053
- if (isInsideStayingTable(change)) {
300753
+ if (!change.pprChange && isInsideStayingTable(change)) {
300054
300754
  const failureResult = planContainedInlineChild(change);
300055
300755
  if (failureResult)
300056
300756
  return {
@@ -300059,6 +300759,36 @@ var Node$13 = class Node$14 {
300059
300759
  };
300060
300760
  continue;
300061
300761
  }
300762
+ if (change.type === CanonicalChangeType.Replacement && selection.side) {
300763
+ touched.add(change.id);
300764
+ const sideResult = planReplacementSideDecision({
300765
+ ops,
300766
+ change,
300767
+ decision,
300768
+ side: selection.side,
300769
+ removedRanges,
300770
+ retired,
300771
+ resolvedRanges
300772
+ });
300773
+ if (!sideResult.ok)
300774
+ return {
300775
+ ok: false,
300776
+ failure: sideResult.failure
300777
+ };
300778
+ continue;
300779
+ }
300780
+ if (selection.side) {
300781
+ const standaloneSide = change.type === CanonicalChangeType.Insertion ? "inserted" : change.type === CanonicalChangeType.Deletion ? "deleted" : null;
300782
+ if (standaloneSide !== selection.side)
300783
+ return {
300784
+ ok: false,
300785
+ failure: failure$3("INVALID_TARGET", `target.side "${selection.side}" does not apply: this change is not a paired replacement${standaloneSide ? ` (its only side is "${standaloneSide}")` : ""}. The targeted side may have already been resolved.`, { details: {
300786
+ changeId: change.id,
300787
+ requestedSide: selection.side,
300788
+ currentSide: standaloneSide
300789
+ } })
300790
+ };
300791
+ }
300062
300792
  const isFull = selection.coverage === "full";
300063
300793
  if (!isFull) {
300064
300794
  if (change.type === CanonicalChangeType.Structural)
@@ -300081,14 +300811,26 @@ var Node$13 = class Node$14 {
300081
300811
  };
300082
300812
  }
300083
300813
  touched.add(change.id);
300084
- if (isFull)
300814
+ if (isFull && !change.pprChange)
300085
300815
  for (const segment of change.segments)
300086
300816
  resolvedRanges.push({
300087
300817
  from: segment.from,
300088
300818
  to: segment.to,
300089
300819
  cause: `${decision}:${change.id}`
300090
300820
  });
300091
- if (change.type === CanonicalChangeType.Structural) {
300821
+ if (change.pprChange) {
300822
+ const pprResult = planPprDecision({
300823
+ ops,
300824
+ change,
300825
+ decision,
300826
+ retired
300827
+ });
300828
+ if (!pprResult.ok)
300829
+ return {
300830
+ ok: false,
300831
+ failure: pprResult.failure
300832
+ };
300833
+ } else if (change.type === CanonicalChangeType.Structural) {
300092
300834
  const structuralResult = planStructuralDecision({
300093
300835
  ops,
300094
300836
  change,
@@ -300173,6 +300915,22 @@ var Node$13 = class Node$14 {
300173
300915
  continue;
300174
300916
  if (!isInsideStayingTable(change))
300175
300917
  continue;
300918
+ if (change.pprChange) {
300919
+ cascadedInsideStayingTable.add(change.id);
300920
+ touched.add(change.id);
300921
+ const pprResult = planPprDecision({
300922
+ ops,
300923
+ change,
300924
+ decision,
300925
+ retired
300926
+ });
300927
+ if (!pprResult.ok)
300928
+ return {
300929
+ ok: false,
300930
+ failure: pprResult.failure
300931
+ };
300932
+ continue;
300933
+ }
300176
300934
  const failureResult = planContainedInlineChild(change);
300177
300935
  if (failureResult)
300178
300936
  return {
@@ -300357,6 +301115,22 @@ var Node$13 = class Node$14 {
300357
301115
  });
300358
301116
  retired.add(change.id);
300359
301117
  return { ok: true };
301118
+ }, planPprDecision = ({ ops, change, decision, retired }) => {
301119
+ const ppr = change.pprChange;
301120
+ if (!ppr)
301121
+ return {
301122
+ ok: false,
301123
+ failure: failure$3("CAPABILITY_UNAVAILABLE", `change "${change.id}" is not a paragraph-property change.`)
301124
+ };
301125
+ ops.push({
301126
+ kind: "resolvePprChange",
301127
+ from: ppr.from,
301128
+ changeId: change.id,
301129
+ decision,
301130
+ formerProperties: ppr.formerProperties
301131
+ });
301132
+ retired.add(change.id);
301133
+ return { ok: true };
300360
301134
  }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
300361
301135
  const inserted = change.insertedSegments;
300362
301136
  const deleted = change.deletedSegments;
@@ -300441,6 +301215,55 @@ var Node$13 = class Node$14 {
300441
301215
  }
300442
301216
  retired.add(change.id);
300443
301217
  return { ok: true };
301218
+ }, planReplacementSideDecision = ({ ops, change, decision, side, removedRanges, resolvedRanges }) => {
301219
+ const inserted = change.insertedSegments;
301220
+ const deleted = change.deletedSegments;
301221
+ if (!inserted.length || !deleted.length)
301222
+ return {
301223
+ ok: false,
301224
+ failure: failure$3("PRECONDITION_FAILED", `replacement "${change.id}" missing inserted or deleted side.`)
301225
+ };
301226
+ const segments = side === SegmentSide.Inserted ? inserted : deleted;
301227
+ for (const seg of segments)
301228
+ resolvedRanges.push({
301229
+ from: seg.from,
301230
+ to: seg.to,
301231
+ cause: `${decision}-replacement-${side}:${change.id}`
301232
+ });
301233
+ const removeContent = (seg, cause) => {
301234
+ ops.push({
301235
+ kind: "removeContent",
301236
+ from: seg.from,
301237
+ to: seg.to,
301238
+ changeId: change.id,
301239
+ side
301240
+ });
301241
+ removedRanges.push({
301242
+ from: seg.from,
301243
+ to: seg.to,
301244
+ cause: `${cause}:${change.id}`
301245
+ });
301246
+ };
301247
+ const dropMark = (seg) => pushRemoveMarkOpsForSegment({
301248
+ ops,
301249
+ segment: seg,
301250
+ changeId: change.id,
301251
+ side
301252
+ });
301253
+ if (side === SegmentSide.Deleted)
301254
+ if (decision === "accept")
301255
+ for (const seg of deleted)
301256
+ removeContent(seg, "accept-replacement-deleted-side");
301257
+ else
301258
+ for (const seg of deleted)
301259
+ dropMark(seg);
301260
+ else if (decision === "accept")
301261
+ for (const seg of inserted)
301262
+ dropMark(seg);
301263
+ else
301264
+ for (const seg of inserted)
301265
+ removeContent(seg, "reject-replacement-inserted-side");
301266
+ return { ok: true };
300444
301267
  }, getParentRestoreContext = ({ graph, change }) => {
300445
301268
  const explicit = getExplicitParentRestoreContext({
300446
301269
  graph,
@@ -300809,6 +301632,31 @@ var Node$13 = class Node$14 {
300809
301632
  });
300810
301633
  continue;
300811
301634
  }
301635
+ if (op.kind === "resolvePprChange") {
301636
+ const mappedFrom = tr.mapping.map(op.from, 1);
301637
+ const node3 = tr.doc.nodeAt(mappedFrom);
301638
+ const pp = node3?.attrs?.paragraphProperties;
301639
+ if (node3 && pp && pp.change)
301640
+ if (op.decision === "accept") {
301641
+ const kept = { ...pp };
301642
+ delete kept.change;
301643
+ tr.setNodeMarkup(mappedFrom, undefined, {
301644
+ ...node3.attrs,
301645
+ paragraphProperties: kept
301646
+ });
301647
+ } else {
301648
+ const former = { ...op.formerProperties || {} };
301649
+ const nextAttrs = {
301650
+ ...node3.attrs,
301651
+ paragraphProperties: former,
301652
+ numberingProperties: former.numberingProperties ?? null
301653
+ };
301654
+ if (!former.numberingProperties)
301655
+ nextAttrs.listRendering = null;
301656
+ tr.setNodeMarkup(mappedFrom, undefined, nextAttrs);
301657
+ }
301658
+ continue;
301659
+ }
300812
301660
  }
300813
301661
  for (const op of contentOps)
300814
301662
  tr.step(new ReplaceStep(op.from, op.to, Slice.empty));
@@ -309549,15 +310397,30 @@ menclose::after {
309549
310397
  single: "solid",
309550
310398
  double: "double",
309551
310399
  dashed: "dashed",
310400
+ dashSmallGap: "dashed",
309552
310401
  dotted: "dotted",
309553
310402
  thick: "solid",
309554
310403
  triple: "solid",
309555
310404
  dotDash: "dashed",
309556
310405
  dotDotDash: "dashed",
310406
+ thinThickSmallGap: "solid",
310407
+ thickThinSmallGap: "solid",
310408
+ thinThickThinSmallGap: "solid",
310409
+ thinThickMediumGap: "solid",
310410
+ thickThinMediumGap: "solid",
310411
+ thinThickThinMediumGap: "solid",
310412
+ thinThickLargeGap: "solid",
310413
+ thickThinLargeGap: "solid",
310414
+ thinThickThinLargeGap: "solid",
309557
310415
  wave: "solid",
309558
- doubleWave: "solid"
310416
+ doubleWave: "solid",
310417
+ dashDotStroked: "dashed",
310418
+ threeDEmboss: "ridge",
310419
+ threeDEngrave: "groove",
310420
+ outset: "solid",
310421
+ inset: "solid"
309559
310422
  }[style2];
309560
- }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border) => {
310423
+ }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border, widthOverridePx) => {
309561
310424
  if (!border)
309562
310425
  return;
309563
310426
  if (border.style === "none" || border.width === 0) {
@@ -309565,18 +310428,40 @@ menclose::after {
309565
310428
  return;
309566
310429
  }
309567
310430
  const style2 = borderStyleToCSS(border.style);
309568
- const width = border.width ?? 1;
309569
310431
  const color2 = border.color ?? "#000000";
309570
310432
  const safeColor = isValidHexColor2(color2) ? color2 : "#000000";
309571
- const actualWidth = border.style === "thick" ? Math.max(width * 2, 3) : width;
310433
+ const actualWidth = widthOverridePx ?? getBorderBandWidthPx(border);
309572
310434
  element3.style[`border${side}`] = `${actualWidth}px ${style2} ${safeColor}`;
309573
- }, applyCellBorders = (element3, borders) => {
310435
+ }, applyCellBorders = (element3, borders, widthOverridesPx) => {
309574
310436
  if (!borders)
309575
310437
  return;
309576
310438
  applyBorder(element3, "Top", borders.top);
309577
- applyBorder(element3, "Right", borders.right);
310439
+ applyBorder(element3, "Right", borders.right, widthOverridesPx?.right);
309578
310440
  applyBorder(element3, "Bottom", borders.bottom);
309579
- applyBorder(element3, "Left", borders.left);
310441
+ applyBorder(element3, "Left", borders.left, widthOverridesPx?.left);
310442
+ }, BEVEL_LIGHT_AUTO = "#F0F0F0", BEVEL_DARK_AUTO = "#A0A0A0", bevelDarkColor = (color2) => {
310443
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
310444
+ return BEVEL_DARK_AUTO;
310445
+ const half = (i3) => Math.floor(parseInt(color2.slice(i3, i3 + 2), 16) / 2);
310446
+ return `#${[
310447
+ 1,
310448
+ 3,
310449
+ 5
310450
+ ].map((i3) => half(i3).toString(16).padStart(2, "0")).join("")}`;
310451
+ }, bevelLightColor = (color2) => {
310452
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
310453
+ return BEVEL_LIGHT_AUTO;
310454
+ return color2;
310455
+ }, bevelToneSpec = (spec, visualSide, owner) => {
310456
+ if (!spec || spec.style !== "outset" && spec.style !== "inset")
310457
+ return spec;
310458
+ const raisedSide = visualSide === "top" || visualSide === "left";
310459
+ const light = spec.style === "outset" === (owner === "table") === raisedSide;
310460
+ return {
310461
+ ...spec,
310462
+ style: "single",
310463
+ color: light ? bevelLightColor(spec.color) : bevelDarkColor(spec.color)
310464
+ };
309580
310465
  }, borderValueToSpec = (value) => {
309581
310466
  if (!value)
309582
310467
  return;
@@ -310685,7 +311570,7 @@ menclose::after {
310685
311570
  hasSdtContainerChrome
310686
311571
  };
310687
311572
  }, renderTableCell = (deps) => {
310688
- const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, context, applySdtDataset: applySdtDataset$1, chrome: chrome2, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, tableIndent, isRtl, cellWidth, fromLine, toLine, resolvePhysical } = deps;
311573
+ const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, context, applySdtDataset: applySdtDataset$1, chrome: chrome2, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, tableIndent, isRtl, cellWidth, fromLine, toLine, resolvePhysical, borderBandOverridesPx } = deps;
310689
311574
  const padding = cell2?.attrs?.padding || {
310690
311575
  top: 0,
310691
311576
  left: 4,
@@ -310693,9 +311578,16 @@ menclose::after {
310693
311578
  bottom: 0
310694
311579
  };
310695
311580
  const buildTableImageHyperlinkAnchor = (imageEl, hyperlink, display) => buildImageHyperlinkAnchor(doc$12, imageEl, hyperlink, display);
310696
- const paddingLeft = isRtl ? padding.right ?? 4 : padding.left ?? 4;
311581
+ const compoundBandEats = (border, bandInCellPx) => {
311582
+ const profile = border ? getBorderBandProfile(border) : null;
311583
+ if (!profile)
311584
+ return 0;
311585
+ const bandInCell = bandInCellPx ?? profile.band;
311586
+ return Math.max(0, bandInCell - profile.band / 2);
311587
+ };
311588
+ const paddingLeft = Math.max(0, (isRtl ? padding.right ?? 4 : padding.left ?? 4) - compoundBandEats(borders?.left, borderBandOverridesPx?.left));
310697
311589
  const paddingTop = padding.top ?? 0;
310698
- const paddingRight = isRtl ? padding.left ?? 4 : padding.right ?? 4;
311590
+ const paddingRight = Math.max(0, (isRtl ? padding.left ?? 4 : padding.right ?? 4) - compoundBandEats(borders?.right, borderBandOverridesPx?.right));
310699
311591
  const paddingBottom = padding.bottom ?? 0;
310700
311592
  const cellEl = doc$12.createElement("div");
310701
311593
  cellEl.style.position = "absolute";
@@ -310710,7 +311602,7 @@ menclose::after {
310710
311602
  cellEl.style.paddingRight = `${paddingRight}px`;
310711
311603
  cellEl.style.paddingBottom = `${paddingBottom}px`;
310712
311604
  if (borders)
310713
- applyCellBorders(cellEl, borders);
311605
+ applyCellBorders(cellEl, borders, borderBandOverridesPx);
310714
311606
  else if (useDefaultBorder)
310715
311607
  cellEl.style.border = "1px solid rgba(0,0,0,0.6)";
310716
311608
  if (cell2?.attrs?.background)
@@ -311184,16 +312076,25 @@ menclose::after {
311184
312076
  elem.dataset.trackChangeAuthorColor = meta2.color;
311185
312077
  if (meta2.date)
311186
312078
  elem.dataset.trackChangeDate = meta2.date;
311187
- }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, nextRowLeavesRightGap, deferTopToAboveCell, nextRowSuppressesSharedTop }) => {
312079
+ }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, separateBorders, nextRowSuppressesSharedTop }) => {
311188
312080
  const hasExplicitBorders = hasExplicitCellBorders(cellBorders);
311189
312081
  const cellBounds = getTableCellGridBounds(cellPosition);
311190
312082
  const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
311191
- const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext || nextRowLeavesRightGap === true;
311192
- const hasInteriorNeighborBorder = !touchesTopBoundary && !deferTopToAboveCell && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
312083
+ const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
312084
+ const hasInteriorNeighborBorder = !touchesTopBoundary && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
312085
+ if (separateBorders && cellSpacingPx === 0) {
312086
+ const cb = cellBorders ?? {};
312087
+ return {
312088
+ top: resolveTableBorderValue(cb.top, touchesTopBoundary ? tableBorders?.top : tableBorders?.insideH),
312089
+ right: resolveTableBorderValue(cb.right, cellBounds.touchesRightEdge ? tableBorders?.right : tableBorders?.insideV),
312090
+ bottom: resolveTableBorderValue(cb.bottom, touchesBottomBoundary ? tableBorders?.bottom : tableBorders?.insideH),
312091
+ left: resolveTableBorderValue(cb.left, cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV)
312092
+ };
312093
+ }
311193
312094
  if (cellSpacingPx === 0 && (hasExplicitBorders || hasInteriorNeighborBorder)) {
311194
312095
  const cb = cellBorders ?? {};
311195
312096
  return {
311196
- top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : deferTopToAboveCell ? undefined : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
312097
+ top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
311197
312098
  left: cellBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, tableBorders?.left) : isPresentBorder(cb.left) ? resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(tableBorders?.insideV) : isPresentBorder(leftCellBorders?.right) ? undefined : isExplicitNoneBorder(cb.left) && isExplicitNoneBorder(leftCellBorders?.right) ? undefined : borderValueToSpec(tableBorders?.insideV),
311198
312099
  right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, tableBorders?.right) : isPresentBorder(cb.right) && !isPresentBorder(rightCellBorders?.left) ? cb.right : undefined,
311199
312100
  bottom: touchesBottomBoundary ? resolveTableBorderValue(cb.bottom, tableBorders?.bottom) : undefined
@@ -311233,8 +312134,102 @@ menclose::after {
311233
312134
  bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : interiorBottom,
311234
312135
  left: baseBorders.left
311235
312136
  };
312137
+ }, appendCompoundBorderRects = (doc$12, container, cellElement, borders, rect, edges) => {
312138
+ if (!borders)
312139
+ return;
312140
+ const { ownsBottomBand, rightIsBoundary, leftIsBoundary, suppressMid } = edges;
312141
+ const sideInfo = [
312142
+ "top",
312143
+ "right",
312144
+ "bottom",
312145
+ "left"
312146
+ ].map((side) => {
312147
+ const spec = borders[side];
312148
+ const profile = spec ? getBorderBandProfile(spec) : null;
312149
+ if (!spec || !profile)
312150
+ return null;
312151
+ if (isNativeCssDoubleStyle(spec.style)) {
312152
+ if (side === "top" || side === "bottom" && ownsBottomBand || side === "left" && leftIsBoundary || side === "right" && rightIsBoundary)
312153
+ return null;
312154
+ }
312155
+ const { segments } = profile;
312156
+ return {
312157
+ side,
312158
+ band: Math.max(1, Math.round(profile.band)),
312159
+ outerRule: Math.max(1, Math.round(segments[0])),
312160
+ innerRule: Math.max(1, Math.round(segments[segments.length - 1])),
312161
+ midRule: segments.length === 5 ? Math.max(1, Math.round(segments[2])) : 0,
312162
+ midOffset: segments.length === 5 ? Math.round(segments[0] + segments[1]) : 0,
312163
+ color: spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000"
312164
+ };
312165
+ });
312166
+ if (!sideInfo.some(Boolean))
312167
+ return;
312168
+ const x0$1 = Math.round(rect.x);
312169
+ const y0 = Math.round(rect.y);
312170
+ const x1 = Math.round(rect.x + rect.width);
312171
+ const y1 = Math.round(rect.y + rect.height);
312172
+ for (const info of sideInfo) {
312173
+ if (!info)
312174
+ continue;
312175
+ const cssSide = info.side[0].toUpperCase() + info.side.slice(1);
312176
+ cellElement.style[`border${cssSide}Color`] = "transparent";
312177
+ }
312178
+ const [top$1, right$1, bottom$1, left$1] = sideInfo;
312179
+ const rectEl = doc$12.createElement("div");
312180
+ rectEl.className = "superdoc-compound-border-rect";
312181
+ const st = rectEl.style;
312182
+ st.position = "absolute";
312183
+ st.boxSizing = "border-box";
312184
+ st.pointerEvents = "none";
312185
+ const topInset = top$1 ? top$1.band - top$1.innerRule : 0;
312186
+ const leftInset = left$1 ? leftIsBoundary ? left$1.band - left$1.innerRule : Math.round(left$1.band / 2) - left$1.innerRule : 0;
312187
+ const bottomInset = bottom$1 ? ownsBottomBand ? bottom$1.band - bottom$1.innerRule : Math.round(bottom$1.band / 2) - bottom$1.outerRule : 0;
312188
+ const rightInset = right$1 ? rightIsBoundary ? right$1.band - right$1.innerRule : Math.round(right$1.band / 2) - right$1.outerRule : 0;
312189
+ st.left = `${x0$1 + leftInset}px`;
312190
+ st.top = `${y0 + topInset}px`;
312191
+ st.width = `${x1 - x0$1 - leftInset - rightInset}px`;
312192
+ st.height = `${y1 - y0 - topInset - bottomInset}px`;
312193
+ if (top$1)
312194
+ st.borderTop = `${top$1.innerRule}px solid ${top$1.color}`;
312195
+ if (bottom$1)
312196
+ st.borderBottom = `${ownsBottomBand ? bottom$1.innerRule : bottom$1.outerRule}px solid ${bottom$1.color}`;
312197
+ if (left$1)
312198
+ st.borderLeft = `${left$1.innerRule}px solid ${left$1.color}`;
312199
+ if (right$1)
312200
+ st.borderRight = `${rightIsBoundary ? right$1.innerRule : right$1.outerRule}px solid ${right$1.color}`;
312201
+ container.appendChild(rectEl);
312202
+ const midTop = top$1 && top$1.midRule > 0 && !suppressMid?.top ? top$1 : null;
312203
+ const midLeft = left$1 && left$1.midRule > 0 && !suppressMid?.left ? left$1 : null;
312204
+ const midBottom = bottom$1 && bottom$1.midRule > 0 && ownsBottomBand && !suppressMid?.bottom ? bottom$1 : null;
312205
+ const midRight = right$1 && right$1.midRule > 0 && rightIsBoundary && !suppressMid?.right ? right$1 : null;
312206
+ if (midTop || midLeft || midBottom || midRight) {
312207
+ const mid = doc$12.createElement("div");
312208
+ mid.className = "superdoc-compound-border-mid";
312209
+ const ms = mid.style;
312210
+ ms.position = "absolute";
312211
+ ms.boxSizing = "border-box";
312212
+ ms.pointerEvents = "none";
312213
+ const tIn = midTop ? midTop.midOffset : 0;
312214
+ const lIn = midLeft ? midLeft.midOffset : 0;
312215
+ const bIn = midBottom ? midBottom.midOffset : 0;
312216
+ const rIn = midRight ? midRight.midOffset : 0;
312217
+ ms.left = `${x0$1 + lIn}px`;
312218
+ ms.top = `${y0 + tIn}px`;
312219
+ ms.width = `${x1 - x0$1 - lIn - rIn}px`;
312220
+ ms.height = `${y1 - y0 - tIn - bIn}px`;
312221
+ if (midTop)
312222
+ ms.borderTop = `${midTop.midRule}px solid ${midTop.color}`;
312223
+ if (midBottom)
312224
+ ms.borderBottom = `${midBottom.midRule}px solid ${midBottom.color}`;
312225
+ if (midLeft)
312226
+ ms.borderLeft = `${midLeft.midRule}px solid ${midLeft.color}`;
312227
+ if (midRight)
312228
+ ms.borderRight = `${midRight.midRule}px solid ${midRight.color}`;
312229
+ container.appendChild(mid);
312230
+ }
311236
312231
  }, renderTableRow = (deps) => {
311237
- const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, prevRow, prevRowMeasure, nextRow, nextRowMeasure, rowOccupiedRightCol, nextRowOccupiedRightCol, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
312232
+ const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, prevRow, prevRowMeasure, nextRow, rowOccupiedRightCol, separateBorders, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
311238
312233
  const totalCols = columnWidths.length;
311239
312234
  const rowTrackedChange = row2?.attrs?.trackedChange;
311240
312235
  let rowTrackedChangeConfig;
@@ -311298,17 +312293,6 @@ menclose::after {
311298
312293
  return cells[i3]?.attrs?.borders;
311299
312294
  }
311300
312295
  };
311301
- const findCellRightEdgeAtColumn = (measureCells, gridCol) => {
311302
- if (!measureCells)
311303
- return;
311304
- for (let i3 = 0;i3 < measureCells.length; i3++) {
311305
- const start$1 = measureCells[i3].gridColumnStart ?? i3;
311306
- const span = measureCells[i3].colSpan ?? 1;
311307
- if (gridCol >= start$1 && gridCol < start$1 + span)
311308
- return start$1 + span;
311309
- }
311310
- };
311311
- const nextRowMaxCol = nextRowOccupiedRightCol != null && nextRowOccupiedRightCol > 0 ? nextRowOccupiedRightCol : nextRowMeasure?.cells?.length ? Math.max(...nextRowMeasure.cells.map((c) => (c.gridColumnStart ?? 0) + (c.colSpan ?? 1))) : Infinity;
311312
312296
  for (let cellIndex = 0;cellIndex < rowMeasure.cells.length; cellIndex += 1) {
311313
312297
  const cellMeasure = rowMeasure.cells[cellIndex];
311314
312298
  const cell2 = row2?.cells?.[cellIndex];
@@ -311329,8 +312313,6 @@ menclose::after {
311329
312313
  const aboveCellBorders = findCellBordersAtColumn(prevRow?.cells, prevRowMeasure?.cells, gridColumnStart);
311330
312314
  const leftCellBorders = gridColumnStart > 0 ? findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart - 1) : undefined;
311331
312315
  const rightCellBorders = findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart + colSpan);
311332
- const nextRowLeavesRightGap = gridColumnStart + colSpan > nextRowMaxCol;
311333
- const aboveCellRightEdge = findCellRightEdgeAtColumn(prevRowMeasure?.cells, gridColumnStart);
311334
312316
  const resolvedBorders = resolveRenderedCellBorders({
311335
312317
  cellBorders: cellBordersAttr,
311336
312318
  hasBordersAttribute,
@@ -311342,11 +312324,16 @@ menclose::after {
311342
312324
  aboveCellBorders,
311343
312325
  leftCellBorders,
311344
312326
  rightCellBorders,
311345
- nextRowLeavesRightGap,
311346
- deferTopToAboveCell: aboveCellRightEdge !== undefined && aboveCellRightEdge > rowRightEdgeCol,
312327
+ separateBorders,
311347
312328
  nextRowSuppressesSharedTop
311348
312329
  });
311349
312330
  const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
312331
+ const tonedBorders = separateBorders && finalBorders ? {
312332
+ top: bevelToneSpec(finalBorders.top, "top", "cell"),
312333
+ right: bevelToneSpec(finalBorders.right, "right", "cell"),
312334
+ bottom: bevelToneSpec(finalBorders.bottom, "bottom", "cell"),
312335
+ left: bevelToneSpec(finalBorders.left, "left", "cell")
312336
+ } : finalBorders;
311350
312337
  let cellHeight;
311351
312338
  if (partialRow)
311352
312339
  cellHeight = partialRow.partialHeight;
@@ -311359,6 +312346,34 @@ menclose::after {
311359
312346
  const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
311360
312347
  if (isRtl && computedCellWidth > 0)
311361
312348
  x = tableContentWidth - x - computedCellWidth;
312349
+ const cellGridBounds = getTableCellGridBounds(cellPosition);
312350
+ const cellIsIntentionallyBorderless = hasBordersAttribute && !hasExplicitCellBorders(cellBordersAttr);
312351
+ const cb = cellBordersAttr ?? {};
312352
+ const effectiveSideSpecs = cellIsIntentionallyBorderless ? {} : {
312353
+ top: cellGridBounds.touchesTopEdge || continuesFromPrev === true ? resolveTableBorderValue(cb.top, effectiveTableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? borderValueToSpec(effectiveTableBorders?.insideH),
312354
+ bottom: cellGridBounds.touchesBottomEdge || continuesOnNext === true ? resolveTableBorderValue(cb.bottom, effectiveTableBorders?.bottom) : resolveBorderConflict(cb.bottom, undefined) ?? borderValueToSpec(effectiveTableBorders?.insideH),
312355
+ left: cellGridBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, effectiveTableBorders?.left) : resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(effectiveTableBorders?.insideV),
312356
+ right: cellGridBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, effectiveTableBorders?.right) : resolveBorderConflict(cb.right, rightCellBorders?.left) ?? borderValueToSpec(effectiveTableBorders?.insideV)
312357
+ };
312358
+ const rectBorders = (isRtl ? swapCellBordersLR(effectiveSideSpecs) : effectiveSideSpecs) ?? effectiveSideSpecs;
312359
+ const visualTouchesLeft = isRtl ? cellGridBounds.touchesRightEdge : cellGridBounds.touchesLeftEdge;
312360
+ const visualTouchesRight = isRtl ? cellGridBounds.touchesLeftEdge : cellGridBounds.touchesRightEdge;
312361
+ const leftStraddleProfile = !visualTouchesLeft && rectBorders.left ? getBorderBandProfile(rectBorders.left) : null;
312362
+ const rightStraddleProfile = !visualTouchesRight && rectBorders.right ? getBorderBandProfile(rectBorders.right) : null;
312363
+ let paintBorders = tonedBorders;
312364
+ let borderBandOverridesPx;
312365
+ if (leftStraddleProfile || rightStraddleProfile) {
312366
+ paintBorders = { ...tonedBorders ?? {} };
312367
+ borderBandOverridesPx = {};
312368
+ if (leftStraddleProfile) {
312369
+ paintBorders.left = rectBorders.left;
312370
+ borderBandOverridesPx.left = leftStraddleProfile.band / 2;
312371
+ }
312372
+ if (rightStraddleProfile) {
312373
+ paintBorders.right = rectBorders.right;
312374
+ borderBandOverridesPx.right = rightStraddleProfile.band / 2;
312375
+ }
312376
+ }
311362
312377
  const { cellElement } = renderTableCell({
311363
312378
  doc: doc$12,
311364
312379
  x,
@@ -311366,7 +312381,8 @@ menclose::after {
311366
312381
  rowHeight: cellHeight,
311367
312382
  cellMeasure,
311368
312383
  cell: cell2,
311369
- borders: finalBorders,
312384
+ borders: paintBorders,
312385
+ borderBandOverridesPx,
311370
312386
  useDefaultBorder: false,
311371
312387
  renderLine: renderLine$1,
311372
312388
  captureLineSnapshot,
@@ -311389,7 +312405,68 @@ menclose::after {
311389
312405
  if (rowTrackedChange && rowTrackedChangeConfig)
311390
312406
  applyRowTrackedChangeToCell(cellElement, rowTrackedChange, rowTrackedChangeConfig);
311391
312407
  container.appendChild(cellElement);
312408
+ const tableProvidesMid = (value) => {
312409
+ const profile = value != null && typeof value === "object" ? getBorderBandProfile(value) : null;
312410
+ return profile != null && profile.segments.length === 5;
312411
+ };
312412
+ const suppressMid = {
312413
+ top: tableProvidesMid(cellGridBounds.touchesTopEdge || continuesFromPrev === true ? effectiveTableBorders?.top : effectiveTableBorders?.insideH),
312414
+ bottom: tableProvidesMid(cellGridBounds.touchesBottomEdge || continuesOnNext === true ? effectiveTableBorders?.bottom : effectiveTableBorders?.insideH),
312415
+ left: tableProvidesMid(visualTouchesLeft ? isRtl ? effectiveTableBorders?.right : effectiveTableBorders?.left : effectiveTableBorders?.insideV),
312416
+ right: tableProvidesMid(visualTouchesRight ? isRtl ? effectiveTableBorders?.left : effectiveTableBorders?.right : effectiveTableBorders?.insideV)
312417
+ };
312418
+ appendCompoundBorderRects(doc$12, container, cellElement, rectBorders, {
312419
+ x,
312420
+ y: y$1,
312421
+ width: computedCellWidth > 0 ? computedCellWidth : cellMeasure.width ?? 0,
312422
+ height: cellHeight
312423
+ }, {
312424
+ ownsBottomBand: cellGridBounds.touchesBottomEdge || continuesOnNext === true,
312425
+ rightIsBoundary: visualTouchesRight,
312426
+ leftIsBoundary: visualTouchesLeft,
312427
+ suppressMid
312428
+ });
312429
+ }
312430
+ }, buildColumnOccupancy = (rows, numCols) => {
312431
+ const occupancy = rows.map(() => new Array(numCols).fill(null));
312432
+ rows.forEach((row2, rowIndex) => {
312433
+ row2?.cells?.forEach((cell2, cellIndex) => {
312434
+ const startCol = cell2.gridColumnStart ?? 0;
312435
+ const endCol = Math.min(numCols, startCol + (cell2.colSpan ?? 1));
312436
+ const endRow = Math.min(rows.length, rowIndex + (cell2.rowSpan ?? 1));
312437
+ const ref$1 = {
312438
+ rowIndex,
312439
+ cellIndex
312440
+ };
312441
+ for (let r$1 = rowIndex;r$1 < endRow; r$1 += 1)
312442
+ for (let c = startCol;c < endCol; c += 1)
312443
+ occupancy[r$1][c] = ref$1;
312444
+ });
312445
+ });
312446
+ return occupancy;
312447
+ }, computeBoundaryGapSegments = (occupancy, belowRowIndex) => {
312448
+ const above = occupancy[belowRowIndex - 1];
312449
+ const below = occupancy[belowRowIndex];
312450
+ if (!above || !below)
312451
+ return [];
312452
+ const segments = [];
312453
+ let current = null;
312454
+ for (let c = 0;c < above.length; c += 1) {
312455
+ const aboveCell = above[c];
312456
+ const isGap = aboveCell !== null && below[c] === null;
312457
+ if (isGap && current && current.aboveCell === aboveCell)
312458
+ current.endColExclusive = c + 1;
312459
+ else if (isGap) {
312460
+ current = {
312461
+ startCol: c,
312462
+ endColExclusive: c + 1,
312463
+ aboveCell
312464
+ };
312465
+ segments.push(current);
312466
+ } else
312467
+ current = null;
311392
312468
  }
312469
+ return segments;
311393
312470
  }, renderTableFragment = (deps) => {
311394
312471
  const { doc: doc$12, fragment: fragment2, block, measure, cellSpacingPx, effectiveColumnWidths, chrome: chrome2, context, sdtBoundary, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, applyStyles: applyStyles$3, resolvePhysical } = deps;
311395
312472
  if (!doc$12) {
@@ -311541,11 +312618,23 @@ menclose::after {
311541
312618
  }
311542
312619
  if (block.id)
311543
312620
  container.setAttribute("data-sd-block-id", block.id);
311544
- if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && tableBorders) {
311545
- applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
311546
- applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
311547
- applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
311548
- applyBorder(container, "Left", borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left));
312621
+ const borderCollapse = block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse");
312622
+ const separateBorders = borderCollapse === "separate";
312623
+ if (borderCollapse === "separate" && tableBorders) {
312624
+ applyBorder(container, "Top", bevelToneSpec(borderValueToSpec(tableBorders.top), "top", "table"));
312625
+ applyBorder(container, "Right", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right), "right", "table"));
312626
+ applyBorder(container, "Bottom", bevelToneSpec(borderValueToSpec(tableBorders.bottom), "bottom", "table"));
312627
+ applyBorder(container, "Left", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left), "left", "table"));
312628
+ for (const [cssSide, value] of [
312629
+ ["Top", tableBorders.top],
312630
+ ["Right", isRtl ? tableBorders.left : tableBorders.right],
312631
+ ["Bottom", tableBorders.bottom],
312632
+ ["Left", isRtl ? tableBorders.right : tableBorders.left]
312633
+ ]) {
312634
+ const spec = borderValueToSpec(value);
312635
+ if (spec && getBorderBandProfile(spec) && !isNativeCssDoubleStyle(spec.style))
312636
+ container.style[`border${cssSide}Color`] = "transparent";
312637
+ }
311549
312638
  }
311550
312639
  const allRowHeights = measure.rows.map((r$1, idx) => {
311551
312640
  if (fragment2.partialRow && fragment2.partialRow.rowIndex === idx)
@@ -311578,9 +312667,8 @@ menclose::after {
311578
312667
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
311579
312668
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
311580
312669
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
311581
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
311582
312670
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
311583
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
312671
+ separateBorders,
311584
312672
  totalRows: block.rows.length,
311585
312673
  tableBorders,
311586
312674
  columnWidths: effectiveColumnWidths,
@@ -311684,10 +312772,16 @@ menclose::after {
311684
312772
  }
311685
312773
  }
311686
312774
  }
312775
+ const interiorRowBoundaries = [];
311687
312776
  for (let r$1 = fragment2.fromRow;r$1 < fragment2.toRow; r$1 += 1) {
311688
312777
  const rowMeasure = measure.rows[r$1];
311689
312778
  if (!rowMeasure)
311690
312779
  break;
312780
+ if (r$1 > fragment2.fromRow)
312781
+ interiorRowBoundaries.push({
312782
+ y: y$1,
312783
+ belowRowIndex: r$1
312784
+ });
311691
312785
  const isFirstRenderedBodyRow = r$1 === fragment2.fromRow;
311692
312786
  const isLastRenderedBodyRow = r$1 === fragment2.toRow - 1;
311693
312787
  const partialRowData = fragment2.partialRow && fragment2.partialRow.rowIndex === r$1 ? fragment2.partialRow : undefined;
@@ -311702,9 +312796,8 @@ menclose::after {
311702
312796
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
311703
312797
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
311704
312798
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
311705
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
311706
312799
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
311707
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
312800
+ separateBorders,
311708
312801
  totalRows: block.rows.length,
311709
312802
  tableBorders,
311710
312803
  columnWidths: effectiveColumnWidths,
@@ -311730,6 +312823,171 @@ menclose::after {
311730
312823
  });
311731
312824
  y$1 += actualRowHeight + cellSpacingPx;
311732
312825
  }
312826
+ {
312827
+ const sides = [
312828
+ [
312829
+ "top",
312830
+ tableBorders?.top,
312831
+ fragment2.continuesFromPrev !== true
312832
+ ],
312833
+ [
312834
+ "right",
312835
+ isRtl ? tableBorders?.left : tableBorders?.right,
312836
+ true
312837
+ ],
312838
+ [
312839
+ "bottom",
312840
+ tableBorders?.bottom,
312841
+ fragment2.continuesOnNext !== true
312842
+ ],
312843
+ [
312844
+ "left",
312845
+ isRtl ? tableBorders?.right : tableBorders?.left,
312846
+ true
312847
+ ]
312848
+ ];
312849
+ let outlineEl = null;
312850
+ for (const [side, value, enabled] of sides) {
312851
+ if (!enabled || value == null || typeof value !== "object")
312852
+ continue;
312853
+ const spec = value;
312854
+ const profile = getBorderBandProfile(value);
312855
+ if (!profile)
312856
+ continue;
312857
+ if (isNativeCssDoubleStyle(spec.style))
312858
+ continue;
312859
+ const rule = Math.max(1, Math.round(profile.segments[0]));
312860
+ const color2 = spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000";
312861
+ if (!outlineEl) {
312862
+ outlineEl = doc$12.createElement("div");
312863
+ outlineEl.className = "superdoc-compound-border-outline";
312864
+ const st = outlineEl.style;
312865
+ st.position = "absolute";
312866
+ st.inset = "0";
312867
+ st.boxSizing = "border-box";
312868
+ st.pointerEvents = "none";
312869
+ container.appendChild(outlineEl);
312870
+ }
312871
+ const cssSide = side[0].toUpperCase() + side.slice(1);
312872
+ outlineEl.style[`border${cssSide}`] = `${rule}px solid ${color2}`;
312873
+ }
312874
+ }
312875
+ {
312876
+ const midProfileOf = (value) => {
312877
+ if (value == null || typeof value !== "object")
312878
+ return null;
312879
+ const profile = getBorderBandProfile(value);
312880
+ return profile && profile.segments.length === 5 ? profile : null;
312881
+ };
312882
+ const colorOf = (value) => {
312883
+ const c = value?.color;
312884
+ return c && /^#[0-9A-Fa-f]{6}$/.test(c) ? c : "#000000";
312885
+ };
312886
+ const midOffsetOf = (profile) => Math.round(profile.segments[0] + profile.segments[1]);
312887
+ const midRuleOf = (profile) => Math.max(1, Math.round(profile.segments[2]));
312888
+ const topBorder = tableBorders?.top;
312889
+ const bottomBorder = tableBorders?.bottom;
312890
+ const leftBorder = isRtl ? tableBorders?.right : tableBorders?.left;
312891
+ const rightBorder = isRtl ? tableBorders?.left : tableBorders?.right;
312892
+ const topMid = fragment2.continuesFromPrev !== true ? midProfileOf(topBorder) : null;
312893
+ const bottomMid = fragment2.continuesOnNext !== true ? midProfileOf(bottomBorder) : null;
312894
+ const leftMid = midProfileOf(leftBorder);
312895
+ const rightMid = midProfileOf(rightBorder);
312896
+ const insideHMid = midProfileOf(tableBorders?.insideH);
312897
+ const insideVMid = midProfileOf(tableBorders?.insideV);
312898
+ const fragmentWidth = fragment2.width;
312899
+ const fragmentHeight = fragment2.height;
312900
+ const ringTopInset = topMid ? midOffsetOf(topMid) : 0;
312901
+ const ringBottomInset = bottomMid ? midOffsetOf(bottomMid) : 0;
312902
+ const ringLeftInset = leftMid ? midOffsetOf(leftMid) : 0;
312903
+ const ringRightInset = rightMid ? midOffsetOf(rightMid) : 0;
312904
+ if (topMid || bottomMid || leftMid || rightMid) {
312905
+ const ring = doc$12.createElement("div");
312906
+ ring.className = "superdoc-compound-border-midring";
312907
+ const rs = ring.style;
312908
+ rs.position = "absolute";
312909
+ rs.boxSizing = "border-box";
312910
+ rs.pointerEvents = "none";
312911
+ rs.left = `${ringLeftInset}px`;
312912
+ rs.top = `${ringTopInset}px`;
312913
+ rs.width = `${fragmentWidth - ringLeftInset - ringRightInset}px`;
312914
+ rs.height = `${fragmentHeight - ringTopInset - ringBottomInset}px`;
312915
+ if (topMid)
312916
+ rs.borderTop = `${midRuleOf(topMid)}px solid ${colorOf(topBorder)}`;
312917
+ if (bottomMid)
312918
+ rs.borderBottom = `${midRuleOf(bottomMid)}px solid ${colorOf(bottomBorder)}`;
312919
+ if (leftMid)
312920
+ rs.borderLeft = `${midRuleOf(leftMid)}px solid ${colorOf(leftBorder)}`;
312921
+ if (rightMid)
312922
+ rs.borderRight = `${midRuleOf(rightMid)}px solid ${colorOf(rightBorder)}`;
312923
+ container.appendChild(ring);
312924
+ }
312925
+ const appendStrip = (className, l, t, w, h$2, color2) => {
312926
+ const strip = doc$12.createElement("div");
312927
+ strip.className = className;
312928
+ const ss = strip.style;
312929
+ ss.position = "absolute";
312930
+ ss.pointerEvents = "none";
312931
+ ss.left = `${l}px`;
312932
+ ss.top = `${t}px`;
312933
+ ss.width = `${w}px`;
312934
+ ss.height = `${h$2}px`;
312935
+ ss.background = color2;
312936
+ container.appendChild(strip);
312937
+ };
312938
+ if (insideVMid && effectiveColumnWidths.length > 1) {
312939
+ const rule = midRuleOf(insideVMid);
312940
+ const color2 = colorOf(tableBorders?.insideV);
312941
+ let cum = 0;
312942
+ for (let i3 = 0;i3 < effectiveColumnWidths.length - 1; i3 += 1) {
312943
+ cum += effectiveColumnWidths[i3];
312944
+ const gx = isRtl ? fragmentWidth - cum : cum;
312945
+ appendStrip("superdoc-compound-border-midv", Math.round(gx - rule / 2), ringTopInset, rule, fragmentHeight - ringTopInset - ringBottomInset, color2);
312946
+ }
312947
+ }
312948
+ if (insideHMid && interiorRowBoundaries.length > 0) {
312949
+ const rule = midRuleOf(insideHMid);
312950
+ const color2 = colorOf(tableBorders?.insideH);
312951
+ for (const { y: gy } of interiorRowBoundaries)
312952
+ appendStrip("superdoc-compound-border-midh", ringLeftInset, Math.round(gy + midOffsetOf(insideHMid)), fragmentWidth - ringLeftInset - ringRightInset, rule, color2);
312953
+ }
312954
+ }
312955
+ if (cellSpacingPx === 0 && !separateBorders && interiorRowBoundaries.length > 0 && block.rows?.length) {
312956
+ const occupancy = buildColumnOccupancy(measure.rows, effectiveColumnWidths.length);
312957
+ const columnX = [0];
312958
+ for (const width of effectiveColumnWidths)
312959
+ columnX.push(columnX[columnX.length - 1] + width);
312960
+ for (const { y: boundaryY, belowRowIndex } of interiorRowBoundaries)
312961
+ for (const segment of computeBoundaryGapSegments(occupancy, belowRowIndex)) {
312962
+ if (segment.aboveCell.rowIndex < fragment2.fromRow)
312963
+ continue;
312964
+ const aboveCell = block.rows[segment.aboveCell.rowIndex]?.cells?.[segment.aboveCell.cellIndex];
312965
+ const boundaryRowBorders = block.rows[belowRowIndex - 1]?.attrs?.borders;
312966
+ const effectiveInsideH = boundaryRowBorders ? {
312967
+ ...tableBorders ?? {},
312968
+ ...boundaryRowBorders
312969
+ }.insideH : tableBorders?.insideH;
312970
+ const cellBottom = aboveCell?.attrs?.borders?.bottom;
312971
+ const spec = isExplicitNoneBorder(cellBottom) ? undefined : resolveTableBorderValue(cellBottom, effectiveInsideH);
312972
+ if (!isPresentBorder(spec))
312973
+ continue;
312974
+ const x = columnX[segment.startCol];
312975
+ const width = columnX[segment.endColExclusive] - x;
312976
+ if (width <= 0)
312977
+ continue;
312978
+ const strip = doc$12.createElement("div");
312979
+ strip.className = "superdoc-row-boundary-gap";
312980
+ const ss = strip.style;
312981
+ ss.position = "absolute";
312982
+ ss.pointerEvents = "none";
312983
+ ss.left = `${isRtl ? fragment2.width - x - width : x}px`;
312984
+ ss.top = `${boundaryY}px`;
312985
+ ss.width = `${width}px`;
312986
+ ss.height = "0";
312987
+ applyBorder(strip, "Top", spec);
312988
+ container.appendChild(strip);
312989
+ }
312990
+ }
311733
312991
  return container;
311734
312992
  }, getOwnContainerKey = (item) => {
311735
312993
  if (item.kind !== "fragment")
@@ -326607,13 +327865,13 @@ menclose::after {
326607
327865
  return;
326608
327866
  console.log(...args$1);
326609
327867
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
326610
- var init_src_BrcexyXf_es = __esm(() => {
327868
+ var init_src_CVmBLxZV_es = __esm(() => {
326611
327869
  init_rolldown_runtime_Bg48TavK_es();
326612
- init_SuperConverter_DIgF4xk__es();
327870
+ init_SuperConverter_DlrS7cQT_es();
326613
327871
  init_jszip_C49i9kUs_es();
326614
327872
  init_xml_js_CqGKpaft_es();
326615
327873
  init_uuid_B2wVPhPi_es();
326616
- init_create_headless_toolbar_BT4yIoZ_es();
327874
+ init_create_headless_toolbar_Bm_c7KZd_es();
326617
327875
  init_constants_D9qj59G2_es();
326618
327876
  init_unified_BDuVPlMu_es();
326619
327877
  init_remark_gfm_BUJjZJLy_es();
@@ -327981,13 +329239,13 @@ var init_src_BrcexyXf_es = __esm(() => {
327981
329239
  },
327982
329240
  "lists.attach": {
327983
329241
  memberPath: "lists.attach",
327984
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
329242
+ description: 'Convert non-list paragraphs to list items under an existing list sequence. With changeMode:"tracked" the former (unnumbered) paragraph properties are recorded as a w:pPrChange so a reviewer can accept/reject the numbering.',
327985
329243
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
327986
329244
  requiresDocumentContext: true,
327987
329245
  metadata: mutationOperation2({
327988
329246
  idempotency: "conditional",
327989
329247
  supportsDryRun: true,
327990
- supportsTrackedMode: false,
329248
+ supportsTrackedMode: true,
327991
329249
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
327992
329250
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
327993
329251
  }),
@@ -337160,7 +338418,10 @@ ${err.toString()}`);
337160
338418
  for (let r$1 = 0;r$1 < rows; r$1++) {
337161
338419
  const cellNodes = [];
337162
338420
  for (let c = 0;c < columns; c++) {
337163
- const cellAttrs = widths ? { colwidth: [widths[c]] } : {};
338421
+ const cellAttrs = widths ? {
338422
+ colwidth: [widths[c]],
338423
+ tableCellProperties: { cellWidth: cellWidthDxa(widths[c]) }
338424
+ } : {};
337164
338425
  const cell2 = tableCellType.createAndFill(cellAttrs);
337165
338426
  if (!cell2)
337166
338427
  return false;
@@ -350584,7 +351845,7 @@ function print() { __p += __j.call(arguments, '') }
350584
351845
  })
350585
351846
  });
350586
351847
  },
350587
- acceptTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
351848
+ acceptTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
350588
351849
  return dispatchReviewDecision({
350589
351850
  editor,
350590
351851
  state,
@@ -350592,7 +351853,8 @@ function print() { __p += __j.call(arguments, '') }
350592
351853
  decision: "accept",
350593
351854
  target: {
350594
351855
  kind: "id",
350595
- id: id2
351856
+ id: id2,
351857
+ ...options.side ? { side: options.side } : {}
350596
351858
  }
350597
351859
  }).applied;
350598
351860
  },
@@ -350605,7 +351867,7 @@ function print() { __p += __j.call(arguments, '') }
350605
351867
  target: { kind: "all" }
350606
351868
  }).applied;
350607
351869
  },
350608
- rejectTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
351870
+ rejectTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
350609
351871
  return dispatchReviewDecision({
350610
351872
  editor,
350611
351873
  state,
@@ -350613,7 +351875,8 @@ function print() { __p += __j.call(arguments, '') }
350613
351875
  decision: "reject",
350614
351876
  target: {
350615
351877
  kind: "id",
350616
- id: id2
351878
+ id: id2,
351879
+ ...options.side ? { side: options.side } : {}
350617
351880
  }
350618
351881
  }).applied;
350619
351882
  },
@@ -361389,13 +362652,28 @@ function print() { __p += __j.call(arguments, '') }
361389
362652
  "single",
361390
362653
  "double",
361391
362654
  "dashed",
362655
+ "dashSmallGap",
361392
362656
  "dotted",
361393
362657
  "thick",
361394
362658
  "triple",
361395
362659
  "dotDash",
361396
362660
  "dotDotDash",
362661
+ "thinThickSmallGap",
362662
+ "thickThinSmallGap",
362663
+ "thinThickThinSmallGap",
362664
+ "thinThickMediumGap",
362665
+ "thickThinMediumGap",
362666
+ "thinThickThinMediumGap",
362667
+ "thinThickLargeGap",
362668
+ "thickThinLargeGap",
362669
+ "thinThickThinLargeGap",
361397
362670
  "wave",
361398
- "doubleWave"
362671
+ "doubleWave",
362672
+ "dashDotStroked",
362673
+ "threeDEmboss",
362674
+ "threeDEngrave",
362675
+ "outset",
362676
+ "inset"
361399
362677
  ]);
361400
362678
  BORDER_STYLE_NUMBER = {
361401
362679
  single: 1,
@@ -361406,8 +362684,23 @@ function print() { __p += __j.call(arguments, '') }
361406
362684
  dotDash: 6,
361407
362685
  dotDotDash: 7,
361408
362686
  triple: 8,
362687
+ thinThickSmallGap: 9,
362688
+ thickThinSmallGap: 10,
362689
+ thinThickThinSmallGap: 11,
362690
+ thinThickMediumGap: 12,
362691
+ thickThinMediumGap: 13,
362692
+ thinThickThinMediumGap: 14,
362693
+ thinThickLargeGap: 15,
362694
+ thickThinLargeGap: 16,
362695
+ thinThickThinLargeGap: 17,
361409
362696
  wave: 18,
361410
- doubleWave: 19
362697
+ doubleWave: 19,
362698
+ dashSmallGap: 20,
362699
+ dashDotStroked: 21,
362700
+ threeDEmboss: 22,
362701
+ threeDEngrave: 23,
362702
+ outset: 24,
362703
+ inset: 25
361411
362704
  };
361412
362705
  BORDER_STYLE_LINES = {
361413
362706
  single: 1,
@@ -361418,8 +362711,21 @@ function print() { __p += __j.call(arguments, '') }
361418
362711
  dotDash: 1,
361419
362712
  dotDotDash: 1,
361420
362713
  triple: 3,
362714
+ thinThickSmallGap: 2,
362715
+ thickThinSmallGap: 2,
362716
+ thinThickThinSmallGap: 3,
362717
+ thinThickMediumGap: 2,
362718
+ thickThinMediumGap: 2,
362719
+ thinThickThinMediumGap: 3,
362720
+ thinThickLargeGap: 2,
362721
+ thickThinLargeGap: 2,
362722
+ thinThickThinLargeGap: 3,
361421
362723
  wave: 1,
361422
- doubleWave: 2
362724
+ doubleWave: 2,
362725
+ dashSmallGap: 1,
362726
+ dashDotStroked: 1,
362727
+ threeDEmboss: 1,
362728
+ threeDEngrave: 1
361423
362729
  };
361424
362730
  PX_PER_PT$12 = 96 / 72;
361425
362731
  BORDER_SIDES3 = [
@@ -369872,11 +371178,11 @@ function print() { __p += __j.call(arguments, '') }
369872
371178
  ]);
369873
371179
  });
369874
371180
 
369875
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B-QEvuPe.es.js
371181
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D2qFX5i6.es.js
369876
371182
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
369877
- var init_create_super_doc_ui_B_QEvuPe_es = __esm(() => {
369878
- init_SuperConverter_DIgF4xk__es();
369879
- init_create_headless_toolbar_BT4yIoZ_es();
371183
+ var init_create_super_doc_ui_D2qFX5i6_es = __esm(() => {
371184
+ init_SuperConverter_DlrS7cQT_es();
371185
+ init_create_headless_toolbar_Bm_c7KZd_es();
369880
371186
  DEFAULT_TEXT_ALIGN_OPTIONS = [
369881
371187
  {
369882
371188
  label: "Left",
@@ -370167,15 +371473,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
370167
371473
 
370168
371474
  // ../../packages/superdoc/dist/super-editor.es.js
370169
371475
  var init_super_editor_es = __esm(() => {
370170
- init_src_BrcexyXf_es();
370171
- init_SuperConverter_DIgF4xk__es();
371476
+ init_src_CVmBLxZV_es();
371477
+ init_SuperConverter_DlrS7cQT_es();
370172
371478
  init_jszip_C49i9kUs_es();
370173
371479
  init_xml_js_CqGKpaft_es();
370174
- init_create_headless_toolbar_BT4yIoZ_es();
371480
+ init_create_headless_toolbar_Bm_c7KZd_es();
370175
371481
  init_constants_D9qj59G2_es();
370176
371482
  init_unified_BDuVPlMu_es();
370177
371483
  init_DocxZipper_BzS208BW_es();
370178
- init_create_super_doc_ui_B_QEvuPe_es();
371484
+ init_create_super_doc_ui_D2qFX5i6_es();
370179
371485
  init_ui_CGB3qmy3_es();
370180
371486
  init_eventemitter3_UwU_CLPU_es();
370181
371487
  init_errors_C_DoKMoN_es();