@superdoc-dev/mcp 0.12.0-next.47 → 0.12.0-next.49

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 +1986 -386
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
50479
50479
  emptyOptions2 = {};
50480
50480
  });
50481
50481
 
50482
- // ../../packages/superdoc/dist/chunks/SuperConverter-DIgF4xk_.es.js
50482
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DlrS7cQT.es.js
50483
50483
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
50484
50484
  const fieldValue = extension$1.config[field];
50485
50485
  if (typeof fieldValue === "function")
@@ -54261,14 +54261,17 @@ function executeTrackChangesDecide(adapter, rawInput, options) {
54261
54261
  return adapter.rejectAll(input, revisionOptions);
54262
54262
  }
54263
54263
  const { id, story } = canonical.target;
54264
+ const side = canonical.target.side;
54264
54265
  if (canonical.decision === "accept")
54265
54266
  return adapter.accept({
54266
54267
  id,
54267
- ...story ? { story } : {}
54268
+ ...story ? { story } : {},
54269
+ ...side ? { side } : {}
54268
54270
  }, revisionOptions);
54269
54271
  return adapter.reject({
54270
54272
  id,
54271
- ...story ? { story } : {}
54273
+ ...story ? { story } : {},
54274
+ ...side ? { side } : {}
54272
54275
  }, revisionOptions);
54273
54276
  }
54274
54277
  function isValidLegacyPartialIdRangeTarget(input) {
@@ -54319,11 +54322,13 @@ function normalizeReviewDecideTarget(target) {
54319
54322
  });
54320
54323
  const story = readOptionalStory(target, "target.story", false);
54321
54324
  const moveRole = readOptionalMoveRole(target);
54325
+ const side = readOptionalReplacementSide(target);
54322
54326
  return {
54323
54327
  kind: "id",
54324
54328
  id,
54325
54329
  ...story ? { story } : {},
54326
- ...moveRole ? { moveRole } : {}
54330
+ ...moveRole ? { moveRole } : {},
54331
+ ...side ? { side } : {}
54327
54332
  };
54328
54333
  }
54329
54334
  if (kind === "range") {
@@ -54414,11 +54419,13 @@ function normalizeReviewDecideTarget(target) {
54414
54419
  if (typeof target.id === "string" && target.id.length > 0) {
54415
54420
  const story = readOptionalStory(target, "target.story", false);
54416
54421
  const moveRole = readOptionalMoveRole(target);
54422
+ const side = readOptionalReplacementSide(target);
54417
54423
  return {
54418
54424
  kind: "id",
54419
54425
  id: target.id,
54420
54426
  ...story ? { story } : {},
54421
- ...moveRole ? { moveRole } : {}
54427
+ ...moveRole ? { moveRole } : {},
54428
+ ...side ? { side } : {}
54422
54429
  };
54423
54430
  }
54424
54431
  }
@@ -54574,6 +54581,21 @@ function readOptionalMoveRole(target) {
54574
54581
  });
54575
54582
  return moveRole;
54576
54583
  }
54584
+ function readOptionalReplacementSide(target) {
54585
+ if (!("side" in target))
54586
+ return;
54587
+ const side = target.side;
54588
+ if (side === undefined || side === null)
54589
+ return;
54590
+ if (side === "inserted")
54591
+ return "inserted";
54592
+ if (side === "deleted")
54593
+ return "deleted";
54594
+ throw new DocumentApiValidationError("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', {
54595
+ field: "target.side",
54596
+ value: side
54597
+ });
54598
+ }
54577
54599
  function validateRangeTargetSide(side) {
54578
54600
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination")
54579
54601
  return;
@@ -60055,6 +60077,50 @@ function getCellSpacingPx(cellSpacing) {
60055
60077
  const asPx = (cellSpacing.type ?? "").toLowerCase() === "dxa" && v >= 20 ? v / TWIPS_PER_PX : v;
60056
60078
  return Math.max(0, asPx);
60057
60079
  }
60080
+ function getBorderBandProfile(value) {
60081
+ if (value == null || typeof value !== "object")
60082
+ return null;
60083
+ if ("none" in value && value.none)
60084
+ return null;
60085
+ const raw = value;
60086
+ if (!raw.style)
60087
+ return null;
60088
+ const formula = COMPOUND_PROFILES[raw.style];
60089
+ if (!formula)
60090
+ return null;
60091
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
60092
+ if (w <= 0)
60093
+ return null;
60094
+ const segments = formula(w).map((s) => Math.max(1, s));
60095
+ return {
60096
+ segments,
60097
+ band: segments.reduce((sum, s) => sum + s, 0)
60098
+ };
60099
+ }
60100
+ function getBorderBandWidthPx(value) {
60101
+ if (value == null)
60102
+ return 0;
60103
+ if (typeof value !== "object")
60104
+ return 0;
60105
+ if ("none" in value && value.none)
60106
+ return 0;
60107
+ const raw = value;
60108
+ if (raw.style === "none")
60109
+ return 0;
60110
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
60111
+ const width = Math.max(0, w);
60112
+ if (width === 0)
60113
+ return 0;
60114
+ if (raw.style === "thick")
60115
+ return Math.max(width, 1);
60116
+ const profile = getBorderBandProfile(value);
60117
+ if (profile)
60118
+ return profile.band;
60119
+ return width;
60120
+ }
60121
+ function isNativeCssDoubleStyle(style) {
60122
+ return style === "double";
60123
+ }
60058
60124
  function coerceRelativeHeight(raw) {
60059
60125
  if (typeof raw === "number" && Number.isFinite(raw))
60060
60126
  return raw;
@@ -61662,6 +61728,11 @@ function resolveConditionalProps(propertyType, styleType, styleId, translatedLin
61662
61728
  const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
61663
61729
  if (props)
61664
61730
  chain.push(props);
61731
+ if (styleType === "wholeTable" && propertyType === "tableCellProperties") {
61732
+ const baseProps = def?.tableCellProperties;
61733
+ if (baseProps)
61734
+ chain.push(baseProps);
61735
+ }
61665
61736
  currentId = def?.basedOn;
61666
61737
  }
61667
61738
  if (chain.length === 0)
@@ -61675,7 +61746,7 @@ function resolveCellStyles(propertyType, tableInfo, translatedLinkedStyles) {
61675
61746
  const cellStyleProps = [];
61676
61747
  const tableStyleId = tableInfo.tableProperties.tableStyleId;
61677
61748
  const { rowBandSize, colBandSize } = resolveEffectiveBandSizes(tableStyleId, translatedLinkedStyles);
61678
- determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle).forEach((styleType) => {
61749
+ 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) => {
61679
61750
  const typeProps = resolveConditionalProps(propertyType, styleType, tableStyleId, translatedLinkedStyles);
61680
61751
  if (typeProps)
61681
61752
  cellStyleProps.push(typeProps);
@@ -61693,12 +61764,15 @@ function resolveTableCellProperties(inlineProps, tableInfo, translatedLinkedStyl
61693
61764
  chain.push(inlineProps);
61694
61765
  return combineProperties(chain, { fullOverrideProps: ["shading"] });
61695
61766
  }
61696
- function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
61767
+ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle, gridColumnStart, gridColumnSpan, numGridCols) {
61697
61768
  const applicable = new Set(["wholeTable"]);
61698
61769
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
61699
61770
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
61771
+ const columnStart = gridColumnStart ?? cellIndex;
61772
+ const columnEnd = columnStart + (gridColumnSpan ?? 1);
61773
+ const columnCount = numGridCols != null && numCells != null ? Math.max(numGridCols, numCells) : numGridCols ?? numCells;
61700
61774
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
61701
- const bandColIndex = Math.max(0, cellIndex - (tblLook?.firstColumn ? 1 : 0));
61775
+ const bandColIndex = Math.max(0, columnStart - (tblLook?.firstColumn ? 1 : 0));
61702
61776
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
61703
61777
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
61704
61778
  if (!tblLook?.noHBand)
@@ -61707,8 +61781,8 @@ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells
61707
61781
  applicable.add(colGroup % 2 === 0 ? "band1Vert" : "band2Vert");
61708
61782
  const isFirstRow = !!tblLook?.firstRow && rowIndex === 0;
61709
61783
  const isLastRow = !!tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1;
61710
- const isFirstCol = !!tblLook?.firstColumn && cellIndex === 0;
61711
- const isLastCol = !!tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1;
61784
+ const isFirstCol = !!tblLook?.firstColumn && columnStart === 0;
61785
+ const isLastCol = !!tblLook?.lastColumn && columnCount != null && columnCount > 0 && columnEnd >= columnCount;
61712
61786
  if (isFirstRow)
61713
61787
  applicable.add("firstRow");
61714
61788
  if (isFirstCol)
@@ -62699,6 +62773,31 @@ function hasValidDrawingContent(drawingContent) {
62699
62773
  return false;
62700
62774
  return drawingChildren.some((child) => child && typeof child === "object" && (child.name === "wp:inline" || child.name === "wp:anchor"));
62701
62775
  }
62776
+ function resolvePprChangeWordId(params, change) {
62777
+ const idStr = String(change?.id ?? "");
62778
+ const allocator = params?.converter?.wordIdAllocator;
62779
+ if (allocator) {
62780
+ const partPath = params?.currentPartPath || "word/document.xml";
62781
+ const sourceId = /^\d+$/.test(idStr) ? idStr : undefined;
62782
+ return String(allocator.allocate({
62783
+ partPath,
62784
+ sourceId,
62785
+ logicalId: idStr
62786
+ }));
62787
+ }
62788
+ return toDecimalWordId(change?.id);
62789
+ }
62790
+ function toDecimalWordId(id) {
62791
+ const str = String(id);
62792
+ if (/^\d+$/.test(str))
62793
+ return str;
62794
+ let hash2 = 2166136261;
62795
+ for (let i$1 = 0;i$1 < str.length; i$1++) {
62796
+ hash2 ^= str.charCodeAt(i$1);
62797
+ hash2 = Math.imul(hash2, 16777619);
62798
+ }
62799
+ return String(1e6 + (hash2 >>> 0) % 1e9);
62800
+ }
62702
62801
  function getSectPr(pPrNode) {
62703
62802
  const sectPr = pPrNode?.elements?.find((el) => el.name === "w:sectPr");
62704
62803
  return sectPr ? carbonCopy(sectPr) : undefined;
@@ -62868,6 +62967,8 @@ function generateParagraphProperties(params) {
62868
62967
  const { node: node2 } = params;
62869
62968
  const { attrs = {} } = node2;
62870
62969
  const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
62970
+ if (params?.isFinalDoc && paragraphProperties.change)
62971
+ delete paragraphProperties.change;
62871
62972
  const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
62872
62973
  delete paragraphProperties.runPropertiesInlineKeys;
62873
62974
  if (Array.isArray(inlineKeys) && inlineKeys.length === 0)
@@ -62884,10 +62985,14 @@ function generateParagraphProperties(params) {
62884
62985
  wordIdAllocator: params?.converter?.wordIdAllocator || null,
62885
62986
  partPath: resolveExportPartPath$1(params)
62886
62987
  } : null;
62887
- let pPr = translator$129.decode({ node: {
62888
- ...node2,
62889
- attrs: { paragraphProperties }
62890
- } });
62988
+ let pPr = translator$129.decode({
62989
+ node: {
62990
+ ...node2,
62991
+ attrs: { paragraphProperties }
62992
+ },
62993
+ converter: params?.converter,
62994
+ currentPartPath: resolveExportPartPath$1(params)
62995
+ });
62891
62996
  if (!params?.isFinalDoc && paragraphSplitTrackFormatMark) {
62892
62997
  const insertionElement = createParagraphSplitInsertionElement(paragraphSplitTrackFormatMark, paragraphSplitWordIdOptions);
62893
62998
  if (insertionElement)
@@ -73594,11 +73699,24 @@ function getDefinitionForLevel(data, level) {
73594
73699
  return cachedLevels.get(parsedLevel);
73595
73700
  return data?.elements?.find((item) => Number(item.attributes?.["w:ilvl"]) === parsedLevel);
73596
73701
  }
73597
- function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr) {
73702
+ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr, options = {}) {
73703
+ const formerProperties = { ...paragraphNode.attrs.paragraphProperties || {} };
73598
73704
  const newProperties = {
73599
- ...paragraphNode.attrs.paragraphProperties || {},
73705
+ ...formerProperties,
73600
73706
  numberingProperties: newNumberingProperties ? { ...newNumberingProperties } : null
73601
73707
  };
73708
+ if (options.trackChange && newNumberingProperties && !formerProperties.change) {
73709
+ const former = { ...formerProperties };
73710
+ delete former.change;
73711
+ const user = editor?.options?.user || {};
73712
+ newProperties.change = {
73713
+ id: v4_default(),
73714
+ author: user.name || "",
73715
+ authorEmail: user.email || "",
73716
+ date: (/* @__PURE__ */ new Date()).toISOString(),
73717
+ paragraphProperties: former
73718
+ };
73719
+ }
73602
73720
  if (!newNumberingProperties && paragraphNode.attrs.paragraphProperties?.styleId === "ListParagraph")
73603
73721
  newProperties.styleId = null;
73604
73722
  if (newProperties.indent)
@@ -89561,10 +89679,40 @@ function normalizeLegacyBorderStyle(value) {
89561
89679
  return "dotDash";
89562
89680
  case "dotdotdash":
89563
89681
  return "dotDotDash";
89682
+ case "dashsmallgap":
89683
+ return "dashSmallGap";
89684
+ case "thinthicksmallgap":
89685
+ return "thinThickSmallGap";
89686
+ case "thickthinsmallgap":
89687
+ return "thickThinSmallGap";
89688
+ case "thinthickthinsmallgap":
89689
+ return "thinThickThinSmallGap";
89690
+ case "thinthickmediumgap":
89691
+ return "thinThickMediumGap";
89692
+ case "thickthinmediumgap":
89693
+ return "thickThinMediumGap";
89694
+ case "thinthickthinmediumgap":
89695
+ return "thinThickThinMediumGap";
89696
+ case "thinthicklargegap":
89697
+ return "thinThickLargeGap";
89698
+ case "thickthinlargegap":
89699
+ return "thickThinLargeGap";
89700
+ case "thinthickthinlargegap":
89701
+ return "thinThickThinLargeGap";
89564
89702
  case "wave":
89565
89703
  return "wave";
89566
89704
  case "doublewave":
89567
89705
  return "doubleWave";
89706
+ case "dashdotstroked":
89707
+ return "dashDotStroked";
89708
+ case "threedemboss":
89709
+ return "threeDEmboss";
89710
+ case "threedengrave":
89711
+ return "threeDEngrave";
89712
+ case "outset":
89713
+ return "outset";
89714
+ case "inset":
89715
+ return "inset";
89568
89716
  case "single":
89569
89717
  default:
89570
89718
  return "single";
@@ -89675,14 +89823,21 @@ function tableNodeToBlock(node2, { nextBlockId, positions, storyKey, trackedChan
89675
89823
  tableStyleId: effectiveStyleId ?? undefined
89676
89824
  } : undefined;
89677
89825
  const rows = [];
89826
+ const grid = node2.attrs?.grid;
89827
+ const numGridCols = Array.isArray(grid) && grid.length > 0 ? grid.length : undefined;
89828
+ let activeRowSpans = [];
89678
89829
  node2.content.forEach((rowNode, rowIndex) => {
89830
+ const { placements, nextActiveRowSpans } = placeRowCellsOnGrid(rowNode, activeRowSpans);
89831
+ activeRowSpans = nextActiveRowSpans;
89679
89832
  const parsedRow = parseTableRow({
89680
89833
  rowNode,
89681
89834
  rowIndex,
89682
89835
  numRows: node2?.content?.length ?? 1,
89683
89836
  context: parserDeps,
89684
89837
  defaultCellPadding,
89685
- tableProperties: tablePropertiesForCascade
89838
+ tableProperties: tablePropertiesForCascade,
89839
+ cellGridPlacements: placements,
89840
+ numGridCols
89686
89841
  });
89687
89842
  if (parsedRow) {
89688
89843
  if (!shouldHideTrackedNode(parsedRow.attrs?.trackedChange, parserDeps.trackedChangesConfig))
@@ -95590,6 +95745,28 @@ function groupTrackedChanges(editor) {
95590
95745
  wordRevisionIds: structural.sourceId ? structural.side === "insertion" ? { insert: structural.sourceId } : { delete: structural.sourceId } : undefined
95591
95746
  });
95592
95747
  }
95748
+ const pprChanges = enumeratePprChanges(editor.state);
95749
+ for (const ppr of pprChanges) {
95750
+ const excerpt = normalizeExcerpt(editor.state.doc.textBetween(ppr.from, ppr.to, " ", ""));
95751
+ grouped.push({
95752
+ rawId: ppr.id,
95753
+ commandRawId: ppr.id,
95754
+ id: ppr.id,
95755
+ from: ppr.from,
95756
+ to: ppr.to,
95757
+ hasInsert: false,
95758
+ hasDelete: false,
95759
+ hasFormat: true,
95760
+ attrs: {
95761
+ id: ppr.id,
95762
+ author: ppr.author || undefined,
95763
+ authorEmail: ppr.authorEmail || undefined,
95764
+ authorImage: ppr.authorImage || undefined,
95765
+ date: ppr.date || undefined
95766
+ },
95767
+ excerpt
95768
+ });
95769
+ }
95593
95770
  grouped.sort((a, b) => {
95594
95771
  if (a.from !== b.from)
95595
95772
  return a.from - b.from;
@@ -96062,7 +96239,7 @@ function applyPagination(items, opts) {
96062
96239
  };
96063
96240
  }
96064
96241
  function resolveBlock(editor, nodeId) {
96065
- const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem"));
96242
+ 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"));
96066
96243
  if (matches$1.length === 0)
96067
96244
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Block target was not found.", { nodeId });
96068
96245
  if (matches$1.length > 1)
@@ -96080,7 +96257,7 @@ function resolveBlocksInRange(editor, fromId, toId$1) {
96080
96257
  from: fromId,
96081
96258
  to: toId$1
96082
96259
  });
96083
- return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem") && c$1.pos >= from2.pos && c$1.pos <= to.pos);
96260
+ return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading") && c$1.pos >= from2.pos && c$1.pos <= to.pos);
96084
96261
  }
96085
96262
  function getAbstractNumId(editor, numId) {
96086
96263
  const definitions = editor.converter?.numbering?.definitions;
@@ -96315,7 +96492,15 @@ function getListText(candidate) {
96315
96492
  }
96316
96493
  function projectListItemCandidate(editor, candidate) {
96317
96494
  const attrs = candidate.node.attrs ?? {};
96318
- const { numId, level } = getNumberingProperties(candidate.node);
96495
+ let { numId, level } = getNumberingProperties(candidate.node);
96496
+ if (numId == null)
96497
+ try {
96498
+ const effective = calculateResolvedParagraphProperties(editor, candidate.node, editor.state.doc.resolve(candidate.pos))?.numberingProperties;
96499
+ if (effective) {
96500
+ numId = toFiniteNumber(effective.numId);
96501
+ level = toFiniteNumber(effective.ilvl) ?? level ?? 0;
96502
+ }
96503
+ } catch {}
96319
96504
  const listRendering = getListRendering(attrs.listRendering);
96320
96505
  const path2 = listRendering?.path;
96321
96506
  const ordinal = getListOrdinalFromPath(path2);
@@ -96427,8 +96612,17 @@ function listListItems(editor, query) {
96427
96612
  }
96428
96613
  });
96429
96614
  }
96615
+ function hasNumberingMetadata(candidate) {
96616
+ const { numId } = getNumberingProperties(candidate.node);
96617
+ if (numId != null)
96618
+ return true;
96619
+ return getListRendering((candidate.node.attrs ?? {}).listRendering) != null;
96620
+ }
96430
96621
  function resolveListItem(editor, address) {
96431
- const matches$1 = getBlockIndex(editor).candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address.nodeId);
96622
+ const index2 = getBlockIndex(editor);
96623
+ let matches$1 = index2.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address.nodeId);
96624
+ if (matches$1.length === 0)
96625
+ matches$1 = index2.candidates.filter((candidate) => candidate.nodeId === address.nodeId && hasNumberingMetadata(candidate));
96432
96626
  if (matches$1.length === 0)
96433
96627
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "List item target was not found.", { target: address });
96434
96628
  if (matches$1.length > 1)
@@ -99390,7 +99584,7 @@ var isRegExp = (value) => {
99390
99584
  return true;
99391
99585
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
99392
99586
  return objectIncludes(attrsA, attrsB);
99393
- }, 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) => {
99587
+ }, 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) => {
99394
99588
  const radians = shadow.direction * Math.PI / 180;
99395
99589
  return {
99396
99590
  dx: shadow.distance * Math.cos(radians),
@@ -117903,6 +118097,39 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117903
118097
  value: measurement.value,
117904
118098
  type: measurement.type ?? "px"
117905
118099
  };
118100
+ }, placeRowCellsOnGrid = (rowNode, activeRowSpans) => {
118101
+ const placements = [];
118102
+ const nextActiveRowSpans = activeRowSpans.map((count) => Math.max(0, count - 1));
118103
+ let column = 0;
118104
+ const cellSpan = (cellNode) => {
118105
+ const colspan = cellNode.attrs?.colspan;
118106
+ if (typeof colspan === "number" && colspan > 0)
118107
+ return colspan;
118108
+ const colwidth = cellNode.attrs?.colwidth;
118109
+ return Array.isArray(colwidth) && colwidth.length > 0 ? colwidth.length : 1;
118110
+ };
118111
+ for (const cellNode of Array.isArray(rowNode.content) ? rowNode.content : []) {
118112
+ if (!isTableCellNode(cellNode)) {
118113
+ placements.push(null);
118114
+ continue;
118115
+ }
118116
+ while ((activeRowSpans[column] ?? 0) > 0)
118117
+ column += 1;
118118
+ const span = cellSpan(cellNode);
118119
+ placements.push({
118120
+ gridColumnStart: column,
118121
+ gridColumnSpan: span
118122
+ });
118123
+ const rowspan = typeof cellNode.attrs?.rowspan === "number" ? cellNode.attrs.rowspan : 1;
118124
+ if (rowspan > 1)
118125
+ for (let covered = column;covered < column + span; covered += 1)
118126
+ nextActiveRowSpans[covered] = Math.max(nextActiveRowSpans[covered] ?? 0, rowspan - 1);
118127
+ column += span;
118128
+ }
118129
+ return {
118130
+ placements,
118131
+ nextActiveRowSpans
118132
+ };
117906
118133
  }, isTableRowNode = (node2) => node2.type === "tableRow" || node2.type === "table_row", isTableCellNode = (node2) => node2.type === "tableCell" || node2.type === "table_cell" || node2.type === "tableHeader" || node2.type === "table_header", isTableSkipPlaceholderCell = (node2) => {
117907
118134
  const placeholder = node2.attrs?.__placeholder;
117908
118135
  return placeholder === "gridBefore" || placeholder === "gridAfter";
@@ -117945,7 +118172,12 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117945
118172
  numCells,
117946
118173
  numRows,
117947
118174
  rowCnfStyle,
117948
- cellCnfStyle
118175
+ cellCnfStyle,
118176
+ ...args.gridPlacement != null && args.numGridCols != null ? {
118177
+ gridColumnStart: args.gridPlacement.gridColumnStart,
118178
+ gridColumnSpan: args.gridPlacement.gridColumnSpan,
118179
+ numGridCols: args.numGridCols
118180
+ } : {}
117949
118181
  } : undefined;
117950
118182
  const inlineTcProps = cellNode.attrs?.tableCellProperties;
117951
118183
  const resolvedTcProps = resolveTableCellProperties(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
@@ -118236,7 +118468,9 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118236
118468
  tableProperties,
118237
118469
  numCells: rowNode?.content?.length || 1,
118238
118470
  numRows,
118239
- rowCnfStyle
118471
+ rowCnfStyle,
118472
+ gridPlacement: args.cellGridPlacements?.[cellIndex] ?? null,
118473
+ numGridCols: args.numGridCols
118240
118474
  });
118241
118475
  if (parsedCell)
118242
118476
  cells.push(parsedCell);
@@ -118789,7 +119023,34 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118789
119023
  "data-track-change-date": change.date || ""
118790
119024
  }));
118791
119025
  }
118792
- }, 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_MODES, 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 }) => {
119026
+ }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, enumeratePprChanges = (state) => {
119027
+ const doc$2 = state?.doc;
119028
+ if (!doc$2)
119029
+ return [];
119030
+ const out = [];
119031
+ try {
119032
+ doc$2.descendants((node2, pos) => {
119033
+ if (node2.isText)
119034
+ return false;
119035
+ const change = node2?.attrs?.paragraphProperties?.change;
119036
+ if (change && typeof change.id === "string" && change.id && change.paragraphProperties)
119037
+ out.push({
119038
+ id: change.id,
119039
+ from: pos,
119040
+ to: pos + node2.nodeSize,
119041
+ author: change.author || "",
119042
+ authorEmail: change.authorEmail || "",
119043
+ authorImage: change.authorImage || "",
119044
+ date: change.date || "",
119045
+ formerProperties: change.paragraphProperties || {},
119046
+ subtype: "paragraph-format"
119047
+ });
119048
+ });
119049
+ } catch {
119050
+ return out;
119051
+ }
119052
+ return out;
119053
+ }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, 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 }) => {
118793
119054
  if (!runProps?.elements?.length || !state)
118794
119055
  return;
118795
119056
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -118823,7 +119084,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118823
119084
  state.kern = kernNode.attributes["w:val"];
118824
119085
  }
118825
119086
  }, SuperConverter;
118826
- var init_SuperConverter_DIgF4xk__es = __esm(() => {
119087
+ var init_SuperConverter_DlrS7cQT_es = __esm(() => {
118827
119088
  init_rolldown_runtime_Bg48TavK_es();
118828
119089
  init_jszip_C49i9kUs_es();
118829
119090
  init_xml_js_CqGKpaft_es();
@@ -123269,6 +123530,71 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
123269
123530
  "highlight",
123270
123531
  "link"
123271
123532
  ];
123533
+ COMPOUND_PROFILES = {
123534
+ double: (w) => [
123535
+ w,
123536
+ w,
123537
+ w
123538
+ ],
123539
+ triple: (w) => [
123540
+ w,
123541
+ w,
123542
+ w,
123543
+ w,
123544
+ w
123545
+ ],
123546
+ thinThickSmallGap: (w) => [
123547
+ w,
123548
+ PT_075,
123549
+ PT_075
123550
+ ],
123551
+ thickThinSmallGap: (w) => [
123552
+ PT_075,
123553
+ PT_075,
123554
+ w
123555
+ ],
123556
+ thinThickMediumGap: (w) => [
123557
+ w,
123558
+ w / 2,
123559
+ w / 2
123560
+ ],
123561
+ thickThinMediumGap: (w) => [
123562
+ w / 2,
123563
+ w / 2,
123564
+ w
123565
+ ],
123566
+ thinThickLargeGap: (w) => [
123567
+ PT_150,
123568
+ w,
123569
+ PT_075
123570
+ ],
123571
+ thickThinLargeGap: (w) => [
123572
+ PT_075,
123573
+ w,
123574
+ PT_150
123575
+ ],
123576
+ thinThickThinSmallGap: (w) => [
123577
+ PT_075,
123578
+ PT_075,
123579
+ w,
123580
+ PT_075,
123581
+ PT_075
123582
+ ],
123583
+ thinThickThinMediumGap: (w) => [
123584
+ w / 2,
123585
+ w / 2,
123586
+ w,
123587
+ w / 2,
123588
+ w / 2
123589
+ ],
123590
+ thinThickThinLargeGap: (w) => [
123591
+ PT_075,
123592
+ w,
123593
+ PT_150,
123594
+ w,
123595
+ PT_075
123596
+ ]
123597
+ };
123272
123598
  SPACE_CHARS = new Set([" ", " "]);
123273
123599
  idlessSdtContainerKeys = /* @__PURE__ */ new WeakMap;
123274
123600
  DRAWING_DIAGNOSTIC_CODES = {
@@ -123636,6 +123962,8 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
123636
123962
  ...params.node,
123637
123963
  attrs: change
123638
123964
  } });
123965
+ if (decodedAttrs["w:id"] != null)
123966
+ decodedAttrs["w:id"] = resolvePprChangeWordId(params, change);
123639
123967
  const hasParagraphProperties$1 = Object.prototype.hasOwnProperty.call(change, "paragraphProperties");
123640
123968
  const paragraphProperties = hasParagraphProperties$1 ? change.paragraphProperties : undefined;
123641
123969
  let pPrNode = paragraphProperties && typeof paragraphProperties === "object" ? pPrTranslator.decode({
@@ -146094,13 +146422,28 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
146094
146422
  "single",
146095
146423
  "double",
146096
146424
  "dashed",
146425
+ "dashSmallGap",
146097
146426
  "dotted",
146098
146427
  "thick",
146099
146428
  "triple",
146100
146429
  "dotDash",
146101
146430
  "dotDotDash",
146431
+ "thinThickSmallGap",
146432
+ "thickThinSmallGap",
146433
+ "thinThickThinSmallGap",
146434
+ "thinThickMediumGap",
146435
+ "thickThinMediumGap",
146436
+ "thinThickThinMediumGap",
146437
+ "thinThickLargeGap",
146438
+ "thickThinLargeGap",
146439
+ "thinThickThinLargeGap",
146102
146440
  "wave",
146103
- "doubleWave"
146441
+ "doubleWave",
146442
+ "dashDotStroked",
146443
+ "threeDEmboss",
146444
+ "threeDEngrave",
146445
+ "outset",
146446
+ "inset"
146104
146447
  ]);
146105
146448
  FONT_FAMILY_FALLBACKS$1 = Object.freeze({
146106
146449
  swiss: "Arial, sans-serif",
@@ -147359,7 +147702,15 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
147359
147702
  }
147360
147703
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = [], editor, exportJsonOnly = false, fieldsHighlightColor, preserveSdtWrappers = false) {
147361
147704
  this.exportWarnings = [];
147362
- const exportableComments = comments.filter((c$1) => !c$1.trackedChange);
147705
+ const isSyntheticTrackedChangeRow = (c$1) => {
147706
+ const linkId = c$1.trackedChangeLink?.trackedChangeId;
147707
+ if (!c$1.trackedChange || !linkId)
147708
+ return false;
147709
+ const identity = c$1.commentId ?? c$1.id;
147710
+ return identity != null && String(identity) === String(linkId);
147711
+ };
147712
+ 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);
147713
+ const exportableComments = comments.filter((c$1) => !isSyntheticTrackedChangeRow(c$1) && !(c$1.trackedChange && !hasCommentBody(c$1)));
147363
147714
  const commentsWithParaIds = exportableComments.map((c$1) => prepareCommentParaIds(c$1));
147364
147715
  const commentDefinitions = commentsWithParaIds.map((c$1, index2) => getCommentDefinition(c$1, index2, commentsWithParaIds, editor));
147365
147716
  let statFieldCacheMap;
@@ -147749,7 +148100,7 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
147749
148100
  };
147750
148101
  });
147751
148102
 
147752
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT4yIoZ-.es.js
148103
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Bm-c7KZd.es.js
147753
148104
  function parseSizeUnit(val = "0") {
147754
148105
  const length = val.toString() || "0";
147755
148106
  const value = Number.parseFloat(length);
@@ -152182,7 +152533,25 @@ function executeTextDelete(_editor, tr, target, _step, mapping) {
152182
152533
  tr.delete(absFrom, absTo);
152183
152534
  return { changed: true };
152184
152535
  }
152185
- function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
152536
+ function withTrackedParagraphPropertyChange(editor, existing, nextParagraphProperties, changeMode) {
152537
+ if (changeMode !== "tracked")
152538
+ return nextParagraphProperties;
152539
+ if (existing?.change)
152540
+ return nextParagraphProperties;
152541
+ const { change: _existingChange, ...formerProperties } = existing ?? {};
152542
+ const user = editor?.options?.user ?? {};
152543
+ return {
152544
+ ...nextParagraphProperties,
152545
+ change: {
152546
+ id: v4_default(),
152547
+ author: user.name || "",
152548
+ authorEmail: user.email || "",
152549
+ date: (/* @__PURE__ */ new Date()).toISOString(),
152550
+ paragraphProperties: formerProperties
152551
+ }
152552
+ };
152553
+ }
152554
+ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment, changeMode) {
152186
152555
  if (!alignment)
152187
152556
  return false;
152188
152557
  let changed = false;
@@ -152193,10 +152562,10 @@ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
152193
152562
  const justification = mapAlignmentToJustificationForParagraph(alignment, calculateResolvedParagraphProperties(editor, node2, typeof tr.doc.resolve === "function" ? tr.doc.resolve(pos) : null)?.rightToLeft === true);
152194
152563
  if (existing?.justification === justification)
152195
152564
  return;
152196
- const updated = {
152565
+ const updated = withTrackedParagraphPropertyChange(editor, existing, {
152197
152566
  ...existing ?? {},
152198
152567
  justification
152199
- };
152568
+ }, changeMode);
152200
152569
  tr.setNodeMarkup(pos, undefined, {
152201
152570
  ...node2.attrs,
152202
152571
  paragraphProperties: updated
@@ -152221,7 +152590,7 @@ function expandToBlockBoundaries$1(doc3, from2, to) {
152221
152590
  to: expandedTo
152222
152591
  };
152223
152592
  }
152224
- function executeStyleApply2(editor, tr, target, step$1, mapping) {
152593
+ function executeStyleApply2(editor, tr, target, step$1, mapping, changeMode) {
152225
152594
  let absFrom = mapping.map(target.absFrom);
152226
152595
  let absTo = mapping.map(target.absTo);
152227
152596
  if (step$1.args.scope === "block") {
@@ -152233,7 +152602,7 @@ function executeStyleApply2(editor, tr, target, step$1, mapping) {
152233
152602
  if (step$1.args.inline)
152234
152603
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
152235
152604
  if (step$1.args.alignment)
152236
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
152605
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
152237
152606
  return { changed };
152238
152607
  }
152239
152608
  function validateMappedSpanContiguity(target, mapping, stepId) {
@@ -152304,7 +152673,7 @@ function executeSpanTextDelete(_editor, tr, target, step$1, mapping) {
152304
152673
  tr.delete(absFrom, absTo);
152305
152674
  return { changed: true };
152306
152675
  }
152307
- function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
152676
+ function executeSpanStyleApply(editor, tr, target, step$1, mapping, changeMode) {
152308
152677
  validateMappedSpanContiguity(target, mapping, step$1.id);
152309
152678
  const firstSeg = target.segments[0];
152310
152679
  const lastSeg = target.segments[target.segments.length - 1];
@@ -152319,7 +152688,7 @@ function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
152319
152688
  if (step$1.args.inline)
152320
152689
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
152321
152690
  if (step$1.args.alignment)
152322
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
152691
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
152323
152692
  return { changed };
152324
152693
  }
152325
152694
  function getReplacementText(replacement) {
@@ -158552,9 +158921,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
158552
158921
  }
158553
158922
  };
158554
158923
  };
158555
- var init_create_headless_toolbar_BT4yIoZ_es = __esm(() => {
158924
+ var init_create_headless_toolbar_Bm_c7KZd_es = __esm(() => {
158556
158925
  init_rolldown_runtime_Bg48TavK_es();
158557
- init_SuperConverter_DIgF4xk__es();
158926
+ init_SuperConverter_DlrS7cQT_es();
158558
158927
  init_jszip_C49i9kUs_es();
158559
158928
  init_uuid_B2wVPhPi_es();
158560
158929
  init_constants_D9qj59G2_es();
@@ -214168,7 +214537,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
214168
214537
  init_remark_gfm_BUJjZJLy_es();
214169
214538
  });
214170
214539
 
214171
- // ../../packages/superdoc/dist/chunks/src-BrcexyXf.es.js
214540
+ // ../../packages/superdoc/dist/chunks/src-CVmBLxZV.es.js
214172
214541
  function deleteProps(obj, propOrProps) {
214173
214542
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
214174
214543
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -219013,6 +219382,12 @@ function updateTableWrapper(tableWrapper, table2) {
219013
219382
  borderWidth = Math.ceil(Math.max(borderLeftMax, borderRightMax));
219014
219383
  tableWrapper.style.setProperty("--table-border-width", `${borderWidth || defaultBorderWidth}px`);
219015
219384
  }
219385
+ function cellWidthDxa(widthPx) {
219386
+ return {
219387
+ value: widthPx * 15,
219388
+ type: "dxa"
219389
+ };
219390
+ }
219016
219391
  function cloneBorders(borders, sides) {
219017
219392
  if (!borders || typeof borders !== "object")
219018
219393
  return {};
@@ -232061,7 +232436,7 @@ function trackChangesGetWrapper(editor, input2) {
232061
232436
  imported: Boolean(toNonEmptyString(resolved.change.attrs.sourceId))
232062
232437
  };
232063
232438
  }
232064
- function decideSingle(hostEditor, decision, id2, story, options) {
232439
+ function decideSingle(hostEditor, decision, id2, story, options, side) {
232065
232440
  const resolved = resolveTrackedChangeInStory(hostEditor, {
232066
232441
  kind: "entity",
232067
232442
  entityType: "trackedChange",
@@ -232079,7 +232454,7 @@ function decideSingle(hostEditor, decision, id2, story, options) {
232079
232454
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${decision === "accept" ? "Accept" : "Reject"} tracked change command is not available on the story editor.`, { reason: "missing_command" });
232080
232455
  checkRevision(hostEditor, options?.expectedRevision);
232081
232456
  const commandRawId = resolved.change.commandRawId ?? resolved.change.rawId;
232082
- if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId))).steps[0]?.effect !== "changed")
232457
+ if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId, side ? { side } : undefined))).steps[0]?.effect !== "changed")
232083
232458
  return decisionFailureReceipt(resolved.editor, `${decision === "accept" ? "Accept" : "Reject"} tracked change "${id2}" produced no change.`, {
232084
232459
  id: id2,
232085
232460
  story
@@ -232091,10 +232466,10 @@ function decideSingle(hostEditor, decision, id2, story, options) {
232091
232466
  return { success: true };
232092
232467
  }
232093
232468
  function trackChangesAcceptWrapper(editor, input2, options) {
232094
- return decideSingle(editor, "accept", input2.id, input2.story, options);
232469
+ return decideSingle(editor, "accept", input2.id, input2.story, options, input2.side);
232095
232470
  }
232096
232471
  function trackChangesRejectWrapper(editor, input2, options) {
232097
- return decideSingle(editor, "reject", input2.id, input2.story, options);
232472
+ return decideSingle(editor, "reject", input2.id, input2.story, options, input2.side);
232098
232473
  }
232099
232474
  function decideAll(editor, decision, input2, options) {
232100
232475
  const index2 = getTrackedChangeIndex(editor);
@@ -233160,6 +233535,7 @@ function replyToCommentHandler(editor, input2, options) {
233160
233535
  };
233161
233536
  if (trackedPayload && inheritedTrackedFields)
233162
233537
  emitCommentLifecycleUpdate(editor, "update", trackedPayload);
233538
+ incrementRevision(editor);
233163
233539
  return {
233164
233540
  success: true,
233165
233541
  id: replyId,
@@ -235855,6 +236231,13 @@ function extractBlockNumbering(node2) {
235855
236231
  function extractBlockFormatting(node2, styleCtx) {
235856
236232
  const pProps = node2.attrs.paragraphProperties;
235857
236233
  const styleId$1 = pProps?.styleId ?? null;
236234
+ const rawIndent = pProps?.indent;
236235
+ const indent2 = rawIndent && typeof rawIndent === "object" ? Object.fromEntries([
236236
+ "left",
236237
+ "right",
236238
+ "firstLine",
236239
+ "hanging"
236240
+ ].filter((k$1) => typeof rawIndent[k$1] === "number" && rawIndent[k$1] !== 0).map((k$1) => [k$1, rawIndent[k$1]])) : undefined;
235858
236241
  let fontFamily;
235859
236242
  let fontSize;
235860
236243
  let bold;
@@ -235903,6 +236286,7 @@ function extractBlockFormatting(node2, styleCtx) {
235903
236286
  ...underline ? { underline } : {},
235904
236287
  ...color2 ? { color: color2 } : {},
235905
236288
  ...pProps?.justification ? { alignment: pProps.justification } : {},
236289
+ ...indent2 && Object.keys(indent2).length > 0 ? { indent: indent2 } : {},
235906
236290
  ...headingLevel ? { headingLevel } : {}
235907
236291
  };
235908
236292
  }
@@ -235990,6 +236374,7 @@ function blocksListWrapper(editor, input2) {
235990
236374
  }],
235991
236375
  blockIndex: offset$1 + i3
235992
236376
  }) : undefined;
236377
+ const listRendering = candidate.node.attrs?.listRendering;
235993
236378
  return {
235994
236379
  ordinal: offset$1 + i3,
235995
236380
  nodeId: candidate.nodeId,
@@ -235998,6 +236383,11 @@ function blocksListWrapper(editor, input2) {
235998
236383
  ...fullText !== undefined ? { text: fullText } : {},
235999
236384
  isEmpty: textLength === 0,
236000
236385
  ...extractBlockFormatting(candidate.node, styleCtx),
236386
+ ...listRendering ? { numbering: {
236387
+ marker: listRendering.markerText ?? null,
236388
+ path: listRendering.path ?? null,
236389
+ kind: listRendering.numberingType ?? null
236390
+ } } : {},
236001
236391
  ...numbering ? { paragraphNumbering: numbering } : {},
236002
236392
  ...ref$1 ? { ref: ref$1 } : {}
236003
236393
  };
@@ -237330,7 +237720,9 @@ function listsCreateWrapper(editor, input2, options) {
237330
237720
  };
237331
237721
  }
237332
237722
  function listsAttachWrapper(editor, input2, options) {
237333
- rejectTrackedMode("lists.attach", options);
237723
+ const trackChange = (options?.changeMode ?? "direct") === "tracked";
237724
+ if (trackChange)
237725
+ ensureTrackedCapability(editor, { operation: "lists.attach" });
237334
237726
  const attachTo = resolveListItem(editor, input2.attachTo);
237335
237727
  if (attachTo.numId == null)
237336
237728
  return toListsFailure$1("INVALID_TARGET", "attachTo target must be a list item with numbering metadata.", { attachTo: input2.attachTo });
@@ -237357,7 +237749,7 @@ function listsAttachWrapper(editor, input2, options) {
237357
237749
  updateNumberingProperties({
237358
237750
  numId,
237359
237751
  ilvl: level
237360
- }, block.node, block.pos, editor, tr);
237752
+ }, block.node, block.pos, editor, tr, { trackChange });
237361
237753
  dispatchEditorTransaction$1(editor, tr);
237362
237754
  clearIndexCache(editor);
237363
237755
  return true;
@@ -241700,11 +242092,17 @@ function tablesSetShadingAdapter(editor, input2, options) {
241700
242092
  color: "auto"
241701
242093
  };
241702
242094
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
241703
- tr.setNodeMarkup(resolved.pos, null, {
242095
+ const nextAttrs = {
241704
242096
  ...currentAttrs,
241705
242097
  [propsKey]: currentProps,
241706
242098
  ...syncAttrs
241707
- });
242099
+ };
242100
+ if (resolved.scope === "cell")
242101
+ if (normalizedColor === "auto")
242102
+ delete nextAttrs.background;
242103
+ else
242104
+ nextAttrs.background = { color: normalizedColor };
242105
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
241708
242106
  if (resolved.scope === "table")
241709
242107
  applyShadingToCells(tr, resolved.node, resolved.pos + 1, normalizedColor);
241710
242108
  applyDirectMutationMeta(tr);
@@ -241731,11 +242129,14 @@ function tablesClearShadingAdapter(editor, input2, options) {
241731
242129
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
241732
242130
  delete currentProps.shading;
241733
242131
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
241734
- tr.setNodeMarkup(resolved.pos, null, {
242132
+ const nextAttrs = {
241735
242133
  ...currentAttrs,
241736
242134
  [propsKey]: currentProps,
241737
242135
  ...syncAttrs
241738
- });
242136
+ };
242137
+ if (resolved.scope === "cell")
242138
+ delete nextAttrs.background;
242139
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
241739
242140
  if (resolved.scope === "table") {
241740
242141
  const tableNode = resolved.node;
241741
242142
  const tableStart = resolved.pos + 1;
@@ -242778,7 +243179,7 @@ function registerBuiltInExecutors() {
242778
243179
  registerStepExecutor("text.delete", { execute: (ctx$1, targets, step2) => executeTextStep(ctx$1, targets, step2, (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)) });
242779
243180
  registerStepExecutor("format.apply", { execute: (ctx$1, targets, step2) => {
242780
243181
  ensureFormatStepCapabilities(ctx$1, step2);
242781
- return executeTextStep(ctx$1, targets, step2, (e, tr, t, s2, m$1) => executeStyleApply2(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1));
243182
+ return executeTextStep(ctx$1, targets, step2, (e, tr, t, s2, m$1) => executeStyleApply2(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));
242782
243183
  } });
242783
243184
  registerStepExecutor("create.paragraph", { execute: (ctx$1, targets, step2) => executeCreateStep(ctx$1.editor, ctx$1.tr, step2, targets, ctx$1.mapping) });
242784
243185
  registerStepExecutor("create.heading", { execute: (ctx$1, targets, step2) => executeCreateStep(ctx$1.editor, ctx$1.tr, step2, targets, ctx$1.mapping) });
@@ -258056,6 +258457,19 @@ function countHeaderRows(block) {
258056
258457
  break;
258057
258458
  return count;
258058
258459
  }
258460
+ function countRepeatableHeaderRows(block) {
258461
+ const headerCount = countHeaderRows(block);
258462
+ if (headerCount === 0)
258463
+ return 0;
258464
+ let bandEnd = headerCount;
258465
+ for (let r$1 = 0;r$1 < headerCount && r$1 < block.rows.length; r$1++)
258466
+ for (const cell2 of block.rows[r$1]?.cells ?? []) {
258467
+ const rowSpan = cell2.rowSpan ?? 1;
258468
+ if (rowSpan > 1)
258469
+ bandEnd = Math.max(bandEnd, r$1 + rowSpan);
258470
+ }
258471
+ return Math.min(bandEnd, block.rows.length);
258472
+ }
258059
258473
  function sumRowHeights(rows, fromRow, toRow) {
258060
258474
  let total = 0;
258061
258475
  for (let i3 = fromRow;i3 < toRow && i3 < rows.length; i3++)
@@ -258440,7 +258854,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
258440
258854
  });
258441
258855
  return;
258442
258856
  }
258443
- const headerCount = countHeaderRows(block);
258857
+ const headerCount = countRepeatableHeaderRows(block);
258444
258858
  const headerPrefixHeights = [0];
258445
258859
  for (let i3 = 0;i3 < headerCount; i3 += 1)
258446
258860
  headerPrefixHeights.push(headerPrefixHeights[i3] + (measure.rows[i3]?.height ?? 0));
@@ -271245,12 +271659,14 @@ function computeAutoFitColumnWidths(input2) {
271245
271659
  const currentWidths = fixedLayout.columnWidths.slice(0, gridColumnCount);
271246
271660
  const minBounds = new Array(gridColumnCount).fill(0);
271247
271661
  const maxBounds = new Array(gridColumnCount).fill(0);
271662
+ const textBounds = new Array(gridColumnCount).fill(0);
271248
271663
  const preferredOverrides = new Array(gridColumnCount).fill(undefined);
271249
271664
  const multiSpanCells = [];
271250
271665
  accumulateBounds({
271251
271666
  rows: normalizedRows,
271252
271667
  minBounds,
271253
271668
  maxBounds,
271669
+ textBounds,
271254
271670
  preferredOverrides,
271255
271671
  multiSpanCells
271256
271672
  });
@@ -271273,7 +271689,26 @@ function computeAutoFitColumnWidths(input2) {
271273
271689
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
271274
271690
  } else {
271275
271691
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
271276
- if (!shouldPreservePreferredGrid) {
271692
+ if (workingInput.contentSizeAutoTable === true) {
271693
+ const columnBandAllowances = workingInput.columnBandAllowances;
271694
+ resolvedWidths = maxBounds.map((max$2, index2) => {
271695
+ const allowance = columnBandAllowances?.[index2] ?? 0;
271696
+ const withAllowance = Math.max(max$2, minBounds[index2]) + allowance;
271697
+ const textFloor = textBounds[index2] + allowance * 2;
271698
+ return Math.max(withAllowance, textFloor);
271699
+ });
271700
+ for (const spanCell of multiSpanCells) {
271701
+ const covered = resolvedWidths.slice(spanCell.startColumn, spanCell.startColumn + spanCell.span);
271702
+ const currentTotal = sumWidths$1(covered);
271703
+ const demand = spanCell.preferredWidth ?? spanCell.maxContentWidth;
271704
+ if (currentTotal < demand && covered.length > 0) {
271705
+ const topUp = (demand - currentTotal) / covered.length;
271706
+ for (let index2 = 0;index2 < covered.length; index2++)
271707
+ resolvedWidths[spanCell.startColumn + index2] += topUp;
271708
+ }
271709
+ }
271710
+ targetTableWidth = Math.min(sumWidths$1(resolvedWidths), maxResolvedTableWidth);
271711
+ } else if (!shouldPreservePreferredGrid) {
271277
271712
  resolvedWidths = redistributeTowardMaximumsWithinCurrentTable(resolvedWidths, minBounds, maxBounds);
271278
271713
  resolvedWidths = redistributeTowardContentWeightedShape(resolvedWidths, minBounds, maxBounds);
271279
271714
  }
@@ -271335,7 +271770,8 @@ function resolveAutoFitContext(input2) {
271335
271770
  span: cell2.span,
271336
271771
  preferredWidth: cell2.preferredWidth,
271337
271772
  minContentWidth: cell2.minContentWidth,
271338
- maxContentWidth: cell2.maxContentWidth
271773
+ maxContentWidth: cell2.maxContentWidth,
271774
+ horizontalInsets: cell2.horizontalInsets
271339
271775
  }))
271340
271776
  })),
271341
271777
  minColumnWidth
@@ -271368,7 +271804,8 @@ function normalizeLegacyRows(rows) {
271368
271804
  span,
271369
271805
  preferredWidth: sanitizeOptionalWidth(cell2.preferredWidth),
271370
271806
  minContentWidth: Math.max(0, cell2.minContentWidth ?? 0),
271371
- maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0)
271807
+ maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0),
271808
+ horizontalInsets: Math.max(0, cell2.horizontalInsets ?? 0)
271372
271809
  });
271373
271810
  columnIndex += span;
271374
271811
  }
@@ -271405,7 +271842,8 @@ function buildNormalizedRows(workingInput, rowMetrics) {
271405
271842
  span: Math.max(1, placedCell.span ?? metrics?.span ?? 1),
271406
271843
  preferredWidth: sanitizeOptionalWidth(metrics?.preferredWidth ?? placedCell.preferredWidth),
271407
271844
  minContentWidth: Math.max(0, metrics?.minContentWidth ?? 0),
271408
- maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0)
271845
+ maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0),
271846
+ horizontalInsets: Math.max(0, metrics?.horizontalInsets ?? 0)
271409
271847
  };
271410
271848
  }),
271411
271849
  skippedColumns: (workingRow.skippedColumns ?? []).map((skipped) => ({
@@ -271419,7 +271857,7 @@ function buildNormalizedRows(workingInput, rowMetrics) {
271419
271857
  });
271420
271858
  }
271421
271859
  function accumulateBounds(args$1) {
271422
- const { rows, minBounds, maxBounds, preferredOverrides, multiSpanCells } = args$1;
271860
+ const { rows, minBounds, maxBounds, textBounds, preferredOverrides, multiSpanCells } = args$1;
271423
271861
  for (const row2 of rows) {
271424
271862
  for (const skipped of row2.skippedColumns) {
271425
271863
  minBounds[skipped.columnIndex] = Math.max(minBounds[skipped.columnIndex], skipped.minContentWidth);
@@ -271431,6 +271869,7 @@ function accumulateBounds(args$1) {
271431
271869
  if (cell2.span === 1) {
271432
271870
  minBounds[cell2.startColumn] = Math.max(minBounds[cell2.startColumn], cell2.minContentWidth);
271433
271871
  maxBounds[cell2.startColumn] = Math.max(maxBounds[cell2.startColumn], cell2.maxContentWidth);
271872
+ textBounds[cell2.startColumn] = Math.max(textBounds[cell2.startColumn], Math.max(0, cell2.maxContentWidth - cell2.horizontalInsets));
271434
271873
  if (preferredOverrides[cell2.startColumn] == null && cell2.preferredWidth != null)
271435
271874
  preferredOverrides[cell2.startColumn] = cell2.preferredWidth;
271436
271875
  } else
@@ -271874,16 +272313,29 @@ function buildAutoFitWorkingGridInput(block, constraints) {
271874
272313
  layoutMode,
271875
272314
  preferredColumnWidths,
271876
272315
  preferredTableWidth,
271877
- gridColumnCount
272316
+ gridColumnCount,
272317
+ rows
271878
272318
  });
271879
272319
  const preserveExplicitAutoGrid = shouldPreserveExplicitAutoGrid({
271880
272320
  layoutMode,
272321
+ tableWidth,
271881
272322
  preferredColumnWidths,
271882
272323
  preferredTableWidth,
271883
272324
  gridColumnCount,
271884
272325
  rows
271885
272326
  });
271886
- const autoGridWidthBudget = resolveAutoGridWidthBudget({
272327
+ const contentSizeAutoTable = resolveContentSizeAutoTable({
272328
+ layoutMode,
272329
+ tableWidth,
272330
+ preferredTableWidth,
272331
+ preferredColumnWidths,
272332
+ maxTableWidth,
272333
+ rows,
272334
+ preserveAutoGrid,
272335
+ preserveExplicitAutoGrid
272336
+ });
272337
+ const columnBandAllowances = contentSizeAutoTable ? resolveColumnBandAllowances(block.attrs?.borders, gridColumnCount) : undefined;
272338
+ const autoGridWidthBudget = contentSizeAutoTable ? undefined : resolveAutoGridWidthBudget({
271887
272339
  layoutMode,
271888
272340
  tableWidth,
271889
272341
  preferredColumnWidths,
@@ -271898,6 +272350,8 @@ function buildAutoFitWorkingGridInput(block, constraints) {
271898
272350
  ...preserveAutoGrid ? { preserveAutoGrid } : {},
271899
272351
  ...preserveExplicitAutoGrid ? { preserveExplicitAutoGrid } : {},
271900
272352
  ...autoGridWidthBudget != null ? { autoGridWidthBudget } : {},
272353
+ ...contentSizeAutoTable ? { contentSizeAutoTable } : {},
272354
+ ...columnBandAllowances ? { columnBandAllowances } : {},
271901
272355
  preferredTableWidth,
271902
272356
  preferredColumnWidths,
271903
272357
  gridColumnCount,
@@ -271919,19 +272373,21 @@ function shouldPreserveAuthoredGrid(args$1) {
271919
272373
  return approximatelyEqual(totalPreferredColumnWidth, preferredTableWidth) || isSlightlyUnderPreferredTableWidth(totalPreferredColumnWidth, preferredTableWidth);
271920
272374
  }
271921
272375
  function shouldPreserveAutoGrid(args$1) {
271922
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount } = args$1;
272376
+ const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
271923
272377
  if (layoutMode !== "autofit")
271924
272378
  return false;
271925
272379
  if (preferredTableWidth != null)
271926
272380
  return false;
271927
272381
  if (preferredColumnWidths.length === 0 || preferredColumnWidths.length !== gridColumnCount)
271928
272382
  return false;
272383
+ if (preferredColumnWidths.length === 1 && !hasConcreteCellWidthRequest(rows))
272384
+ return false;
271929
272385
  if (!hasNonUniformGrid(preferredColumnWidths))
271930
272386
  return false;
271931
272387
  return true;
271932
272388
  }
271933
272389
  function shouldPreserveExplicitAutoGrid(args$1) {
271934
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
272390
+ const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
271935
272391
  if (layoutMode !== "autofit")
271936
272392
  return false;
271937
272393
  if (preferredTableWidth == null || preferredTableWidth <= 0)
@@ -271940,8 +272396,52 @@ function shouldPreserveExplicitAutoGrid(args$1) {
271940
272396
  return false;
271941
272397
  if (!hasNonUniformGrid(preferredColumnWidths) && !hasConcreteCellWidthRequest(rows))
271942
272398
  return false;
272399
+ if (isPercentTableWidth(tableWidth))
272400
+ return true;
271943
272401
  return approximatelyEqual(sumWidths(preferredColumnWidths), preferredTableWidth);
271944
272402
  }
272403
+ function isPercentTableWidth(tableWidth) {
272404
+ return typeof tableWidth === "object" && tableWidth != null && typeof tableWidth.type === "string" && tableWidth.type.toLowerCase() === "pct";
272405
+ }
272406
+ function resolveContentSizeAutoTable(args$1) {
272407
+ const { layoutMode, tableWidth, preferredTableWidth, preferredColumnWidths, maxTableWidth, rows, preserveAutoGrid, preserveExplicitAutoGrid } = args$1;
272408
+ if (layoutMode !== "autofit")
272409
+ return false;
272410
+ if (preferredTableWidth != null)
272411
+ return false;
272412
+ if (preserveAutoGrid || preserveExplicitAutoGrid)
272413
+ return false;
272414
+ if (!isAutoOrNilTableWidth(tableWidth))
272415
+ return false;
272416
+ if (hasConcreteCellWidthRequest(rows))
272417
+ return false;
272418
+ if (sumWidths(preferredColumnWidths) > maxTableWidth + 0.5)
272419
+ return false;
272420
+ return true;
272421
+ }
272422
+ function isAutoOrNilTableWidth(tableWidth) {
272423
+ if (tableWidth == null)
272424
+ return true;
272425
+ if (hasAutoTableWidthSemantics(tableWidth))
272426
+ return true;
272427
+ if (typeof tableWidth === "object" && typeof tableWidth.type === "string")
272428
+ return tableWidth.type.toLowerCase() === "nil";
272429
+ return false;
272430
+ }
272431
+ function resolveColumnBandAllowances(borders, gridColumnCount) {
272432
+ if (gridColumnCount <= 0)
272433
+ return;
272434
+ const left$1 = getBorderBandWidthPx(borders?.left);
272435
+ const insideV = getBorderBandWidthPx(borders?.insideV);
272436
+ const right$1 = getBorderBandWidthPx(borders?.right);
272437
+ const allowances = [];
272438
+ for (let i3 = 0;i3 < gridColumnCount; i3++) {
272439
+ const edgeLeft = i3 === 0 ? left$1 : insideV;
272440
+ const edgeRight = i3 === gridColumnCount - 1 ? right$1 : insideV;
272441
+ allowances.push((edgeLeft + edgeRight) / 2);
272442
+ }
272443
+ return allowances.some((a2) => a2 > 0) ? allowances : undefined;
272444
+ }
271945
272445
  function resolveAutoGridWidthBudget(args$1) {
271946
272446
  const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, maxTableWidth } = args$1;
271947
272447
  if (layoutMode !== "autofit")
@@ -272242,7 +272742,8 @@ async function measureTableCellContentMetrics(cell2, options) {
272242
272742
  if (contentBlocks.length === 0) {
272243
272743
  const emptyMetrics = {
272244
272744
  minWidthPx: horizontalInsets,
272245
- maxWidthPx: horizontalInsets
272745
+ maxWidthPx: horizontalInsets,
272746
+ horizontalInsetsPx: horizontalInsets
272246
272747
  };
272247
272748
  tableCellMetricsCache.set(cacheKey, emptyMetrics);
272248
272749
  return emptyMetrics;
@@ -272256,7 +272757,8 @@ async function measureTableCellContentMetrics(cell2, options) {
272256
272757
  }
272257
272758
  const result = {
272258
272759
  minWidthPx: minContentWidthPx + horizontalInsets,
272259
- maxWidthPx: maxContentWidthPx + horizontalInsets
272760
+ maxWidthPx: maxContentWidthPx + horizontalInsets,
272761
+ horizontalInsetsPx: horizontalInsets
272260
272762
  };
272261
272763
  tableCellMetricsCache.set(cacheKey, result);
272262
272764
  return result;
@@ -272286,7 +272788,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
272286
272788
  span,
272287
272789
  preferredWidth: normalizedCell?.preferredWidth,
272288
272790
  minContentWidth: metrics.minWidthPx,
272289
- maxContentWidth: metrics.maxWidthPx
272791
+ maxContentWidth: metrics.maxWidthPx,
272792
+ horizontalInsets: metrics.horizontalInsetsPx
272290
272793
  };
272291
272794
  }))
272292
272795
  };
@@ -272301,7 +272804,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
272301
272804
  span: cellMetrics.span,
272302
272805
  preferredWidth: cellMetrics.preferredWidth,
272303
272806
  minContentWidth: cellMetrics.minContentWidth,
272304
- maxContentWidth: cellMetrics.maxContentWidth
272807
+ maxContentWidth: cellMetrics.maxContentWidth,
272808
+ horizontalInsets: cellMetrics.horizontalInsets
272305
272809
  })),
272306
272810
  skippedAfter: normalizedRow.skippedAfter ?? []
272307
272811
  };
@@ -272553,18 +273057,7 @@ function clearTextMeasurementCaches() {
272553
273057
  canvasContext = null;
272554
273058
  }
272555
273059
  function getTableBorderWidthPx(value) {
272556
- if (value == null)
272557
- return 0;
272558
- if (typeof value === "object" && "none" in value && value.none)
272559
- return 0;
272560
- const raw = value;
272561
- const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
272562
- const width = Math.max(0, w);
272563
- if (raw.style === "none")
272564
- return 0;
272565
- if (raw.style === "thick")
272566
- return Math.max(width * 2, 3);
272567
- return width;
273060
+ return getBorderBandWidthPx(value);
272568
273061
  }
272569
273062
  function getTableBorderWidths(borders) {
272570
273063
  return {
@@ -274265,12 +274758,17 @@ async function measureTableBlock(block, constraints, fontContext) {
274265
274758
  });
274266
274759
  if (rowspan === 1)
274267
274760
  rowBaseHeights[rowIndex] = Math.max(rowBaseHeights[rowIndex], totalCellHeight);
274268
- else
274761
+ else {
274762
+ const firstBlockMeasure = blockMeasures[0];
274763
+ const firstLineHeight = firstBlockMeasure?.kind === "paragraph" && firstBlockMeasure.lines.length > 0 ? firstBlockMeasure.lines[0].lineHeight : undefined;
274764
+ const minRowHeight = Math.min(totalCellHeight, firstLineHeight != null ? firstLineHeight + paddingTop + paddingBottom : totalCellHeight / rowspan);
274269
274765
  spanConstraints.push({
274270
274766
  startRow: rowIndex,
274271
274767
  rowSpan: rowspan,
274272
- requiredHeight: totalCellHeight
274768
+ requiredHeight: totalCellHeight,
274769
+ minRowHeight
274273
274770
  });
274771
+ }
274274
274772
  gridColIndex += colspan;
274275
274773
  }
274276
274774
  for (let col = gridColIndex;col < gridColumnCount; col++)
@@ -274282,6 +274780,12 @@ async function measureTableBlock(block, constraints, fontContext) {
274282
274780
  });
274283
274781
  }
274284
274782
  const rowHeights = [...rowBaseHeights];
274783
+ for (const constraint of spanConstraints) {
274784
+ const spanLength = Math.min(constraint.rowSpan, rowHeights.length - constraint.startRow);
274785
+ for (let i3 = 0;i3 < spanLength; i3++)
274786
+ if (rowBaseHeights[constraint.startRow + i3] === 0)
274787
+ rowHeights[constraint.startRow + i3] = Math.max(rowHeights[constraint.startRow + i3], constraint.minRowHeight);
274788
+ }
274285
274789
  for (const constraint of spanConstraints) {
274286
274790
  const { startRow, rowSpan, requiredHeight } = constraint;
274287
274791
  if (rowSpan <= 0)
@@ -274296,6 +274800,34 @@ async function measureTableBlock(block, constraints, fontContext) {
274296
274800
  rowHeights[startRow + i3] += increment2;
274297
274801
  }
274298
274802
  }
274803
+ if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) !== "separate" && block.rows.length > 0) {
274804
+ const tableBordersForBands = block.attrs?.borders;
274805
+ const bandReservation = (band) => band > 2 ? band - 1 : 0;
274806
+ const gridlineBand = (gridline) => {
274807
+ let band = 0;
274808
+ const rowAbove = gridline > 0 ? block.rows[gridline - 1] : undefined;
274809
+ const rowBelow = gridline < block.rows.length ? block.rows[gridline] : undefined;
274810
+ for (const row2 of [rowAbove, rowBelow]) {
274811
+ if (!row2)
274812
+ continue;
274813
+ const override = row2.attrs?.borders;
274814
+ const eff = override ? {
274815
+ ...tableBordersForBands ?? {},
274816
+ ...override
274817
+ } : tableBordersForBands;
274818
+ const value = gridline === 0 ? eff?.top : gridline === block.rows.length ? eff?.bottom : eff?.insideH;
274819
+ band = Math.max(band, getBorderBandWidthPx(value));
274820
+ }
274821
+ for (const cell2 of rowAbove?.cells ?? [])
274822
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.bottom));
274823
+ for (const cell2 of rowBelow?.cells ?? [])
274824
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.top));
274825
+ return band;
274826
+ };
274827
+ for (let i3 = 0;i3 < block.rows.length; i3++)
274828
+ rowHeights[i3] += bandReservation(gridlineBand(i3));
274829
+ rowHeights[block.rows.length - 1] += bandReservation(gridlineBand(block.rows.length));
274830
+ }
274299
274831
  block.rows.forEach((row2, index2) => {
274300
274832
  const spec = row2.attrs?.rowHeight;
274301
274833
  if (spec?.value != null && Number.isFinite(spec.value))
@@ -281943,7 +282475,10 @@ var Node$13 = class Node$14 {
281943
282475
  const headerCells = [];
281944
282476
  const cells = [];
281945
282477
  for (let index2 = 0;index2 < colsCount; index2++) {
281946
- const cellAttrs = columnWidths ? { colwidth: [columnWidths[index2]] } : null;
282478
+ const cellAttrs = columnWidths ? {
282479
+ colwidth: [columnWidths[index2]],
282480
+ tableCellProperties: { cellWidth: cellWidthDxa(columnWidths[index2]) }
282481
+ } : null;
281947
282482
  const cell2 = createCell2(types2.tableCell, cellContent, cellAttrs);
281948
282483
  if (cell2)
281949
282484
  cells.push(cell2);
@@ -284345,11 +284880,12 @@ var Node$13 = class Node$14 {
284345
284880
  return buildGraphFromSpans({
284346
284881
  spans: enumerateTrackedMarkSpans(state),
284347
284882
  structuralChanges: enumerateStructuralRowChanges(state),
284883
+ pprChanges: enumeratePprChanges(state),
284348
284884
  doc: state?.doc ?? null,
284349
284885
  story,
284350
284886
  replacementsMode
284351
284887
  });
284352
- }, buildGraphFromSpans = ({ spans, structuralChanges = [], doc: doc$12, story, replacementsMode }) => {
284888
+ }, buildGraphFromSpans = ({ spans, structuralChanges = [], pprChanges = [], doc: doc$12, story, replacementsMode }) => {
284353
284889
  const mergedSegments = mergeAdjacentSpans(spans.map((span) => ({
284354
284890
  attrs: readTrackedAttrs(span.mark, span.mark.type.name),
284355
284891
  span
@@ -284427,6 +284963,22 @@ var Node$13 = class Node$14 {
284427
284963
  mergedSegments.push(...logical.segments);
284428
284964
  appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
284429
284965
  }
284966
+ for (const ppr of pprChanges) {
284967
+ const logical = buildPprLogicalChange({
284968
+ ppr,
284969
+ doc: doc$12,
284970
+ story
284971
+ });
284972
+ if (!logical)
284973
+ continue;
284974
+ const internalKey = `pprchange:${ppr.from}`;
284975
+ if (changes.has(internalKey))
284976
+ continue;
284977
+ changes.set(internalKey, logical);
284978
+ if (logical.id && logical.id !== internalKey && !changes.has(logical.id))
284979
+ changes.set(logical.id, logical);
284980
+ appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
284981
+ }
284430
284982
  const segments = mergedSegments.slice().sort((a2, b$1) => a2.from - b$1.from || a2.to - b$1.to);
284431
284983
  const graph = {
284432
284984
  changes,
@@ -284539,6 +285091,12 @@ var Node$13 = class Node$14 {
284539
285091
  type = CanonicalChangeType.Formatting;
284540
285092
  else
284541
285093
  type = "";
285094
+ if (type === CanonicalChangeType.Replacement && !(inserted.length && deleted.length)) {
285095
+ if (inserted.length)
285096
+ type = CanonicalChangeType.Insertion;
285097
+ else if (deleted.length)
285098
+ type = CanonicalChangeType.Deletion;
285099
+ }
284542
285100
  const subtype = subtypeFromChangeType(type) ?? "";
284543
285101
  const primary = segments[0]?.attrs ?? null;
284544
285102
  let replacement = null;
@@ -284675,6 +285233,90 @@ var Node$13 = class Node$14 {
284675
285233
  enumerable: false
284676
285234
  });
284677
285235
  return logical;
285236
+ }, buildPprLogicalChange = ({ ppr, doc: doc$12, story }) => {
285237
+ const from$1 = ppr.from;
285238
+ const to = ppr.to;
285239
+ if (!(from$1 < to))
285240
+ return null;
285241
+ const side = SegmentSide.Formatting;
285242
+ const attrs = {
285243
+ id: ppr.id,
285244
+ revisionGroupId: ppr.id,
285245
+ splitFromId: "",
285246
+ changeType: CanonicalChangeType.Formatting,
285247
+ replacementGroupId: "",
285248
+ replacementSideId: "",
285249
+ overlapParentId: "",
285250
+ sourceIds: {},
285251
+ sourceId: "",
285252
+ importedAuthor: "",
285253
+ origin: "",
285254
+ author: ppr.author,
285255
+ authorId: "",
285256
+ authorEmail: ppr.authorEmail,
285257
+ authorImage: ppr.authorImage,
285258
+ date: ppr.date,
285259
+ markType: "",
285260
+ side,
285261
+ subtype: ppr.subtype,
285262
+ explicitChangeType: CanonicalChangeType.Formatting,
285263
+ hasReviewMetadata: true
285264
+ };
285265
+ const segment = {
285266
+ segmentId: `${ppr.id}:pprchange:${from$1}:${to}:0`,
285267
+ changeId: ppr.id,
285268
+ markType: "",
285269
+ side,
285270
+ from: from$1,
285271
+ to,
285272
+ text: "",
285273
+ mark: null,
285274
+ markRuns: [],
285275
+ attrs,
285276
+ parentId: "",
285277
+ parentSide: "",
285278
+ overlapRole: "standalone",
285279
+ pprChange: true
285280
+ };
285281
+ if (doc$12)
285282
+ try {
285283
+ segment.text = doc$12.textBetween(from$1, to, " ", "");
285284
+ } catch {
285285
+ segment.text = "";
285286
+ }
285287
+ const segments = [segment];
285288
+ const logical = {
285289
+ id: ppr.id,
285290
+ type: CanonicalChangeType.Formatting,
285291
+ subtype: ppr.subtype,
285292
+ state: "open",
285293
+ segments,
285294
+ coverageSegments: [...segments],
285295
+ insertedSegments: [],
285296
+ deletedSegments: [],
285297
+ formattingSegments: [...segments],
285298
+ replacement: null,
285299
+ author: ppr.author,
285300
+ authorId: "",
285301
+ authorEmail: ppr.authorEmail,
285302
+ authorImage: ppr.authorImage,
285303
+ date: ppr.date,
285304
+ sourceIds: {},
285305
+ revisionGroupId: ppr.id,
285306
+ splitFromId: "",
285307
+ sourcePlatform: "",
285308
+ story,
285309
+ parent: null,
285310
+ children: [],
285311
+ before: [],
285312
+ after: [],
285313
+ excerpt: segment.text.length > 200 ? `${segment.text.slice(0, 200)}…` : segment.text
285314
+ };
285315
+ Object.defineProperty(logical, "pprChange", {
285316
+ value: ppr,
285317
+ enumerable: false
285318
+ });
285319
+ return logical;
284678
285320
  }, aggregateSourceIds = (segments) => {
284679
285321
  const out = {};
284680
285322
  const sorted = [...segments].sort((a2, b$1) => {
@@ -287389,6 +288031,10 @@ var Node$13 = class Node$14 {
287389
288031
  touchedChangeIds: applyResult.touchedChangeIds,
287390
288032
  diagnostics: plan.diagnostics
287391
288033
  };
288034
+ }, normalizeReplacementSide = (value) => {
288035
+ if (value === SegmentSide.Inserted || value === SegmentSide.Deleted)
288036
+ return value;
288037
+ return null;
287392
288038
  }, normalizeDecisionTarget = (target) => {
287393
288039
  if (!target || typeof target !== "object")
287394
288040
  return {
@@ -287402,11 +288048,18 @@ var Node$13 = class Node$14 {
287402
288048
  ok: false,
287403
288049
  failure: failure$3("INVALID_TARGET", 'target.kind = "id" requires a non-empty id.')
287404
288050
  };
288051
+ const side = normalizeReplacementSide(t.side);
288052
+ if (t.side != null && !side)
288053
+ return {
288054
+ ok: false,
288055
+ failure: failure$3("INVALID_TARGET", 'target.side must be "inserted" or "deleted" when provided.')
288056
+ };
287405
288057
  return {
287406
288058
  ok: true,
287407
288059
  value: {
287408
288060
  kind: "id",
287409
- id: t.id
288061
+ id: t.id,
288062
+ ...side ? { side } : {}
287410
288063
  }
287411
288064
  };
287412
288065
  }
@@ -287510,7 +288163,8 @@ var Node$13 = class Node$14 {
287510
288163
  ranges: change.segments.map((s2) => ({
287511
288164
  from: s2.from,
287512
288165
  to: s2.to
287513
- }))
288166
+ })),
288167
+ ...normalized.side ? { side: normalized.side } : {}
287514
288168
  }]
287515
288169
  };
287516
288170
  }
@@ -287753,7 +288407,7 @@ var Node$13 = class Node$14 {
287753
288407
  suppressedInsideTable.add(change.id);
287754
288408
  continue;
287755
288409
  }
287756
- if (isInsideStayingTable(change)) {
288410
+ if (!change.pprChange && isInsideStayingTable(change)) {
287757
288411
  const failureResult = planContainedInlineChild(change);
287758
288412
  if (failureResult)
287759
288413
  return {
@@ -287762,6 +288416,36 @@ var Node$13 = class Node$14 {
287762
288416
  };
287763
288417
  continue;
287764
288418
  }
288419
+ if (change.type === CanonicalChangeType.Replacement && selection.side) {
288420
+ touched.add(change.id);
288421
+ const sideResult = planReplacementSideDecision({
288422
+ ops,
288423
+ change,
288424
+ decision,
288425
+ side: selection.side,
288426
+ removedRanges,
288427
+ retired,
288428
+ resolvedRanges
288429
+ });
288430
+ if (!sideResult.ok)
288431
+ return {
288432
+ ok: false,
288433
+ failure: sideResult.failure
288434
+ };
288435
+ continue;
288436
+ }
288437
+ if (selection.side) {
288438
+ const standaloneSide = change.type === CanonicalChangeType.Insertion ? "inserted" : change.type === CanonicalChangeType.Deletion ? "deleted" : null;
288439
+ if (standaloneSide !== selection.side)
288440
+ return {
288441
+ ok: false,
288442
+ 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: {
288443
+ changeId: change.id,
288444
+ requestedSide: selection.side,
288445
+ currentSide: standaloneSide
288446
+ } })
288447
+ };
288448
+ }
287765
288449
  const isFull = selection.coverage === "full";
287766
288450
  if (!isFull) {
287767
288451
  if (change.type === CanonicalChangeType.Structural)
@@ -287784,14 +288468,26 @@ var Node$13 = class Node$14 {
287784
288468
  };
287785
288469
  }
287786
288470
  touched.add(change.id);
287787
- if (isFull)
288471
+ if (isFull && !change.pprChange)
287788
288472
  for (const segment of change.segments)
287789
288473
  resolvedRanges.push({
287790
288474
  from: segment.from,
287791
288475
  to: segment.to,
287792
288476
  cause: `${decision}:${change.id}`
287793
288477
  });
287794
- if (change.type === CanonicalChangeType.Structural) {
288478
+ if (change.pprChange) {
288479
+ const pprResult = planPprDecision({
288480
+ ops,
288481
+ change,
288482
+ decision,
288483
+ retired
288484
+ });
288485
+ if (!pprResult.ok)
288486
+ return {
288487
+ ok: false,
288488
+ failure: pprResult.failure
288489
+ };
288490
+ } else if (change.type === CanonicalChangeType.Structural) {
287795
288491
  const structuralResult = planStructuralDecision({
287796
288492
  ops,
287797
288493
  change,
@@ -287876,6 +288572,22 @@ var Node$13 = class Node$14 {
287876
288572
  continue;
287877
288573
  if (!isInsideStayingTable(change))
287878
288574
  continue;
288575
+ if (change.pprChange) {
288576
+ cascadedInsideStayingTable.add(change.id);
288577
+ touched.add(change.id);
288578
+ const pprResult = planPprDecision({
288579
+ ops,
288580
+ change,
288581
+ decision,
288582
+ retired
288583
+ });
288584
+ if (!pprResult.ok)
288585
+ return {
288586
+ ok: false,
288587
+ failure: pprResult.failure
288588
+ };
288589
+ continue;
288590
+ }
287879
288591
  const failureResult = planContainedInlineChild(change);
287880
288592
  if (failureResult)
287881
288593
  return {
@@ -288060,6 +288772,22 @@ var Node$13 = class Node$14 {
288060
288772
  });
288061
288773
  retired.add(change.id);
288062
288774
  return { ok: true };
288775
+ }, planPprDecision = ({ ops, change, decision, retired }) => {
288776
+ const ppr = change.pprChange;
288777
+ if (!ppr)
288778
+ return {
288779
+ ok: false,
288780
+ failure: failure$3("CAPABILITY_UNAVAILABLE", `change "${change.id}" is not a paragraph-property change.`)
288781
+ };
288782
+ ops.push({
288783
+ kind: "resolvePprChange",
288784
+ from: ppr.from,
288785
+ changeId: change.id,
288786
+ decision,
288787
+ formerProperties: ppr.formerProperties
288788
+ });
288789
+ retired.add(change.id);
288790
+ return { ok: true };
288063
288791
  }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
288064
288792
  const inserted = change.insertedSegments;
288065
288793
  const deleted = change.deletedSegments;
@@ -288144,6 +288872,55 @@ var Node$13 = class Node$14 {
288144
288872
  }
288145
288873
  retired.add(change.id);
288146
288874
  return { ok: true };
288875
+ }, planReplacementSideDecision = ({ ops, change, decision, side, removedRanges, resolvedRanges }) => {
288876
+ const inserted = change.insertedSegments;
288877
+ const deleted = change.deletedSegments;
288878
+ if (!inserted.length || !deleted.length)
288879
+ return {
288880
+ ok: false,
288881
+ failure: failure$3("PRECONDITION_FAILED", `replacement "${change.id}" missing inserted or deleted side.`)
288882
+ };
288883
+ const segments = side === SegmentSide.Inserted ? inserted : deleted;
288884
+ for (const seg of segments)
288885
+ resolvedRanges.push({
288886
+ from: seg.from,
288887
+ to: seg.to,
288888
+ cause: `${decision}-replacement-${side}:${change.id}`
288889
+ });
288890
+ const removeContent = (seg, cause) => {
288891
+ ops.push({
288892
+ kind: "removeContent",
288893
+ from: seg.from,
288894
+ to: seg.to,
288895
+ changeId: change.id,
288896
+ side
288897
+ });
288898
+ removedRanges.push({
288899
+ from: seg.from,
288900
+ to: seg.to,
288901
+ cause: `${cause}:${change.id}`
288902
+ });
288903
+ };
288904
+ const dropMark = (seg) => pushRemoveMarkOpsForSegment({
288905
+ ops,
288906
+ segment: seg,
288907
+ changeId: change.id,
288908
+ side
288909
+ });
288910
+ if (side === SegmentSide.Deleted)
288911
+ if (decision === "accept")
288912
+ for (const seg of deleted)
288913
+ removeContent(seg, "accept-replacement-deleted-side");
288914
+ else
288915
+ for (const seg of deleted)
288916
+ dropMark(seg);
288917
+ else if (decision === "accept")
288918
+ for (const seg of inserted)
288919
+ dropMark(seg);
288920
+ else
288921
+ for (const seg of inserted)
288922
+ removeContent(seg, "reject-replacement-inserted-side");
288923
+ return { ok: true };
288147
288924
  }, getParentRestoreContext = ({ graph, change }) => {
288148
288925
  const explicit = getExplicitParentRestoreContext({
288149
288926
  graph,
@@ -288512,6 +289289,31 @@ var Node$13 = class Node$14 {
288512
289289
  });
288513
289290
  continue;
288514
289291
  }
289292
+ if (op.kind === "resolvePprChange") {
289293
+ const mappedFrom = tr.mapping.map(op.from, 1);
289294
+ const node2 = tr.doc.nodeAt(mappedFrom);
289295
+ const pp = node2?.attrs?.paragraphProperties;
289296
+ if (node2 && pp && pp.change)
289297
+ if (op.decision === "accept") {
289298
+ const kept = { ...pp };
289299
+ delete kept.change;
289300
+ tr.setNodeMarkup(mappedFrom, undefined, {
289301
+ ...node2.attrs,
289302
+ paragraphProperties: kept
289303
+ });
289304
+ } else {
289305
+ const former = { ...op.formerProperties || {} };
289306
+ const nextAttrs = {
289307
+ ...node2.attrs,
289308
+ paragraphProperties: former,
289309
+ numberingProperties: former.numberingProperties ?? null
289310
+ };
289311
+ if (!former.numberingProperties)
289312
+ nextAttrs.listRendering = null;
289313
+ tr.setNodeMarkup(mappedFrom, undefined, nextAttrs);
289314
+ }
289315
+ continue;
289316
+ }
288515
289317
  }
288516
289318
  for (const op of contentOps)
288517
289319
  tr.step(new ReplaceStep(op.from, op.to, Slice.empty));
@@ -297252,15 +298054,30 @@ menclose::after {
297252
298054
  single: "solid",
297253
298055
  double: "double",
297254
298056
  dashed: "dashed",
298057
+ dashSmallGap: "dashed",
297255
298058
  dotted: "dotted",
297256
298059
  thick: "solid",
297257
298060
  triple: "solid",
297258
298061
  dotDash: "dashed",
297259
298062
  dotDotDash: "dashed",
298063
+ thinThickSmallGap: "solid",
298064
+ thickThinSmallGap: "solid",
298065
+ thinThickThinSmallGap: "solid",
298066
+ thinThickMediumGap: "solid",
298067
+ thickThinMediumGap: "solid",
298068
+ thinThickThinMediumGap: "solid",
298069
+ thinThickLargeGap: "solid",
298070
+ thickThinLargeGap: "solid",
298071
+ thinThickThinLargeGap: "solid",
297260
298072
  wave: "solid",
297261
- doubleWave: "solid"
298073
+ doubleWave: "solid",
298074
+ dashDotStroked: "dashed",
298075
+ threeDEmboss: "ridge",
298076
+ threeDEngrave: "groove",
298077
+ outset: "solid",
298078
+ inset: "solid"
297262
298079
  }[style2];
297263
- }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border) => {
298080
+ }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border, widthOverridePx) => {
297264
298081
  if (!border)
297265
298082
  return;
297266
298083
  if (border.style === "none" || border.width === 0) {
@@ -297268,18 +298085,40 @@ menclose::after {
297268
298085
  return;
297269
298086
  }
297270
298087
  const style2 = borderStyleToCSS(border.style);
297271
- const width = border.width ?? 1;
297272
298088
  const color2 = border.color ?? "#000000";
297273
298089
  const safeColor = isValidHexColor2(color2) ? color2 : "#000000";
297274
- const actualWidth = border.style === "thick" ? Math.max(width * 2, 3) : width;
298090
+ const actualWidth = widthOverridePx ?? getBorderBandWidthPx(border);
297275
298091
  element3.style[`border${side}`] = `${actualWidth}px ${style2} ${safeColor}`;
297276
- }, applyCellBorders = (element3, borders) => {
298092
+ }, applyCellBorders = (element3, borders, widthOverridesPx) => {
297277
298093
  if (!borders)
297278
298094
  return;
297279
298095
  applyBorder(element3, "Top", borders.top);
297280
- applyBorder(element3, "Right", borders.right);
298096
+ applyBorder(element3, "Right", borders.right, widthOverridesPx?.right);
297281
298097
  applyBorder(element3, "Bottom", borders.bottom);
297282
- applyBorder(element3, "Left", borders.left);
298098
+ applyBorder(element3, "Left", borders.left, widthOverridesPx?.left);
298099
+ }, BEVEL_LIGHT_AUTO = "#F0F0F0", BEVEL_DARK_AUTO = "#A0A0A0", bevelDarkColor = (color2) => {
298100
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
298101
+ return BEVEL_DARK_AUTO;
298102
+ const half = (i3) => Math.floor(parseInt(color2.slice(i3, i3 + 2), 16) / 2);
298103
+ return `#${[
298104
+ 1,
298105
+ 3,
298106
+ 5
298107
+ ].map((i3) => half(i3).toString(16).padStart(2, "0")).join("")}`;
298108
+ }, bevelLightColor = (color2) => {
298109
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
298110
+ return BEVEL_LIGHT_AUTO;
298111
+ return color2;
298112
+ }, bevelToneSpec = (spec, visualSide, owner) => {
298113
+ if (!spec || spec.style !== "outset" && spec.style !== "inset")
298114
+ return spec;
298115
+ const raisedSide = visualSide === "top" || visualSide === "left";
298116
+ const light = spec.style === "outset" === (owner === "table") === raisedSide;
298117
+ return {
298118
+ ...spec,
298119
+ style: "single",
298120
+ color: light ? bevelLightColor(spec.color) : bevelDarkColor(spec.color)
298121
+ };
297283
298122
  }, borderValueToSpec = (value) => {
297284
298123
  if (!value)
297285
298124
  return;
@@ -298388,7 +299227,7 @@ menclose::after {
298388
299227
  hasSdtContainerChrome
298389
299228
  };
298390
299229
  }, renderTableCell = (deps) => {
298391
- 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;
299230
+ 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;
298392
299231
  const padding = cell2?.attrs?.padding || {
298393
299232
  top: 0,
298394
299233
  left: 4,
@@ -298396,9 +299235,16 @@ menclose::after {
298396
299235
  bottom: 0
298397
299236
  };
298398
299237
  const buildTableImageHyperlinkAnchor = (imageEl, hyperlink, display) => buildImageHyperlinkAnchor(doc$12, imageEl, hyperlink, display);
298399
- const paddingLeft = isRtl ? padding.right ?? 4 : padding.left ?? 4;
299238
+ const compoundBandEats = (border, bandInCellPx) => {
299239
+ const profile = border ? getBorderBandProfile(border) : null;
299240
+ if (!profile)
299241
+ return 0;
299242
+ const bandInCell = bandInCellPx ?? profile.band;
299243
+ return Math.max(0, bandInCell - profile.band / 2);
299244
+ };
299245
+ const paddingLeft = Math.max(0, (isRtl ? padding.right ?? 4 : padding.left ?? 4) - compoundBandEats(borders?.left, borderBandOverridesPx?.left));
298400
299246
  const paddingTop = padding.top ?? 0;
298401
- const paddingRight = isRtl ? padding.left ?? 4 : padding.right ?? 4;
299247
+ const paddingRight = Math.max(0, (isRtl ? padding.left ?? 4 : padding.right ?? 4) - compoundBandEats(borders?.right, borderBandOverridesPx?.right));
298402
299248
  const paddingBottom = padding.bottom ?? 0;
298403
299249
  const cellEl = doc$12.createElement("div");
298404
299250
  cellEl.style.position = "absolute";
@@ -298413,7 +299259,7 @@ menclose::after {
298413
299259
  cellEl.style.paddingRight = `${paddingRight}px`;
298414
299260
  cellEl.style.paddingBottom = `${paddingBottom}px`;
298415
299261
  if (borders)
298416
- applyCellBorders(cellEl, borders);
299262
+ applyCellBorders(cellEl, borders, borderBandOverridesPx);
298417
299263
  else if (useDefaultBorder)
298418
299264
  cellEl.style.border = "1px solid rgba(0,0,0,0.6)";
298419
299265
  if (cell2?.attrs?.background)
@@ -298887,16 +299733,25 @@ menclose::after {
298887
299733
  elem.dataset.trackChangeAuthorColor = meta4.color;
298888
299734
  if (meta4.date)
298889
299735
  elem.dataset.trackChangeDate = meta4.date;
298890
- }, 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 }) => {
299736
+ }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, separateBorders, nextRowSuppressesSharedTop }) => {
298891
299737
  const hasExplicitBorders = hasExplicitCellBorders(cellBorders);
298892
299738
  const cellBounds = getTableCellGridBounds(cellPosition);
298893
299739
  const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
298894
- const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext || nextRowLeavesRightGap === true;
298895
- const hasInteriorNeighborBorder = !touchesTopBoundary && !deferTopToAboveCell && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
299740
+ const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
299741
+ const hasInteriorNeighborBorder = !touchesTopBoundary && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
299742
+ if (separateBorders && cellSpacingPx === 0) {
299743
+ const cb = cellBorders ?? {};
299744
+ return {
299745
+ top: resolveTableBorderValue(cb.top, touchesTopBoundary ? tableBorders?.top : tableBorders?.insideH),
299746
+ right: resolveTableBorderValue(cb.right, cellBounds.touchesRightEdge ? tableBorders?.right : tableBorders?.insideV),
299747
+ bottom: resolveTableBorderValue(cb.bottom, touchesBottomBoundary ? tableBorders?.bottom : tableBorders?.insideH),
299748
+ left: resolveTableBorderValue(cb.left, cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV)
299749
+ };
299750
+ }
298896
299751
  if (cellSpacingPx === 0 && (hasExplicitBorders || hasInteriorNeighborBorder)) {
298897
299752
  const cb = cellBorders ?? {};
298898
299753
  return {
298899
- top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : deferTopToAboveCell ? undefined : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
299754
+ top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
298900
299755
  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),
298901
299756
  right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, tableBorders?.right) : isPresentBorder(cb.right) && !isPresentBorder(rightCellBorders?.left) ? cb.right : undefined,
298902
299757
  bottom: touchesBottomBoundary ? resolveTableBorderValue(cb.bottom, tableBorders?.bottom) : undefined
@@ -298936,8 +299791,102 @@ menclose::after {
298936
299791
  bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : interiorBottom,
298937
299792
  left: baseBorders.left
298938
299793
  };
299794
+ }, appendCompoundBorderRects = (doc$12, container, cellElement, borders, rect, edges) => {
299795
+ if (!borders)
299796
+ return;
299797
+ const { ownsBottomBand, rightIsBoundary, leftIsBoundary, suppressMid } = edges;
299798
+ const sideInfo = [
299799
+ "top",
299800
+ "right",
299801
+ "bottom",
299802
+ "left"
299803
+ ].map((side) => {
299804
+ const spec = borders[side];
299805
+ const profile = spec ? getBorderBandProfile(spec) : null;
299806
+ if (!spec || !profile)
299807
+ return null;
299808
+ if (isNativeCssDoubleStyle(spec.style)) {
299809
+ if (side === "top" || side === "bottom" && ownsBottomBand || side === "left" && leftIsBoundary || side === "right" && rightIsBoundary)
299810
+ return null;
299811
+ }
299812
+ const { segments } = profile;
299813
+ return {
299814
+ side,
299815
+ band: Math.max(1, Math.round(profile.band)),
299816
+ outerRule: Math.max(1, Math.round(segments[0])),
299817
+ innerRule: Math.max(1, Math.round(segments[segments.length - 1])),
299818
+ midRule: segments.length === 5 ? Math.max(1, Math.round(segments[2])) : 0,
299819
+ midOffset: segments.length === 5 ? Math.round(segments[0] + segments[1]) : 0,
299820
+ color: spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000"
299821
+ };
299822
+ });
299823
+ if (!sideInfo.some(Boolean))
299824
+ return;
299825
+ const x0$1 = Math.round(rect.x);
299826
+ const y0 = Math.round(rect.y);
299827
+ const x1 = Math.round(rect.x + rect.width);
299828
+ const y1 = Math.round(rect.y + rect.height);
299829
+ for (const info of sideInfo) {
299830
+ if (!info)
299831
+ continue;
299832
+ const cssSide = info.side[0].toUpperCase() + info.side.slice(1);
299833
+ cellElement.style[`border${cssSide}Color`] = "transparent";
299834
+ }
299835
+ const [top$1, right$1, bottom$1, left$1] = sideInfo;
299836
+ const rectEl = doc$12.createElement("div");
299837
+ rectEl.className = "superdoc-compound-border-rect";
299838
+ const st = rectEl.style;
299839
+ st.position = "absolute";
299840
+ st.boxSizing = "border-box";
299841
+ st.pointerEvents = "none";
299842
+ const topInset = top$1 ? top$1.band - top$1.innerRule : 0;
299843
+ const leftInset = left$1 ? leftIsBoundary ? left$1.band - left$1.innerRule : Math.round(left$1.band / 2) - left$1.innerRule : 0;
299844
+ const bottomInset = bottom$1 ? ownsBottomBand ? bottom$1.band - bottom$1.innerRule : Math.round(bottom$1.band / 2) - bottom$1.outerRule : 0;
299845
+ const rightInset = right$1 ? rightIsBoundary ? right$1.band - right$1.innerRule : Math.round(right$1.band / 2) - right$1.outerRule : 0;
299846
+ st.left = `${x0$1 + leftInset}px`;
299847
+ st.top = `${y0 + topInset}px`;
299848
+ st.width = `${x1 - x0$1 - leftInset - rightInset}px`;
299849
+ st.height = `${y1 - y0 - topInset - bottomInset}px`;
299850
+ if (top$1)
299851
+ st.borderTop = `${top$1.innerRule}px solid ${top$1.color}`;
299852
+ if (bottom$1)
299853
+ st.borderBottom = `${ownsBottomBand ? bottom$1.innerRule : bottom$1.outerRule}px solid ${bottom$1.color}`;
299854
+ if (left$1)
299855
+ st.borderLeft = `${left$1.innerRule}px solid ${left$1.color}`;
299856
+ if (right$1)
299857
+ st.borderRight = `${rightIsBoundary ? right$1.innerRule : right$1.outerRule}px solid ${right$1.color}`;
299858
+ container.appendChild(rectEl);
299859
+ const midTop = top$1 && top$1.midRule > 0 && !suppressMid?.top ? top$1 : null;
299860
+ const midLeft = left$1 && left$1.midRule > 0 && !suppressMid?.left ? left$1 : null;
299861
+ const midBottom = bottom$1 && bottom$1.midRule > 0 && ownsBottomBand && !suppressMid?.bottom ? bottom$1 : null;
299862
+ const midRight = right$1 && right$1.midRule > 0 && rightIsBoundary && !suppressMid?.right ? right$1 : null;
299863
+ if (midTop || midLeft || midBottom || midRight) {
299864
+ const mid = doc$12.createElement("div");
299865
+ mid.className = "superdoc-compound-border-mid";
299866
+ const ms = mid.style;
299867
+ ms.position = "absolute";
299868
+ ms.boxSizing = "border-box";
299869
+ ms.pointerEvents = "none";
299870
+ const tIn = midTop ? midTop.midOffset : 0;
299871
+ const lIn = midLeft ? midLeft.midOffset : 0;
299872
+ const bIn = midBottom ? midBottom.midOffset : 0;
299873
+ const rIn = midRight ? midRight.midOffset : 0;
299874
+ ms.left = `${x0$1 + lIn}px`;
299875
+ ms.top = `${y0 + tIn}px`;
299876
+ ms.width = `${x1 - x0$1 - lIn - rIn}px`;
299877
+ ms.height = `${y1 - y0 - tIn - bIn}px`;
299878
+ if (midTop)
299879
+ ms.borderTop = `${midTop.midRule}px solid ${midTop.color}`;
299880
+ if (midBottom)
299881
+ ms.borderBottom = `${midBottom.midRule}px solid ${midBottom.color}`;
299882
+ if (midLeft)
299883
+ ms.borderLeft = `${midLeft.midRule}px solid ${midLeft.color}`;
299884
+ if (midRight)
299885
+ ms.borderRight = `${midRight.midRule}px solid ${midRight.color}`;
299886
+ container.appendChild(mid);
299887
+ }
298939
299888
  }, renderTableRow = (deps) => {
298940
- 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;
299889
+ 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;
298941
299890
  const totalCols = columnWidths.length;
298942
299891
  const rowTrackedChange = row2?.attrs?.trackedChange;
298943
299892
  let rowTrackedChangeConfig;
@@ -299001,17 +299950,6 @@ menclose::after {
299001
299950
  return cells[i3]?.attrs?.borders;
299002
299951
  }
299003
299952
  };
299004
- const findCellRightEdgeAtColumn = (measureCells, gridCol) => {
299005
- if (!measureCells)
299006
- return;
299007
- for (let i3 = 0;i3 < measureCells.length; i3++) {
299008
- const start$1 = measureCells[i3].gridColumnStart ?? i3;
299009
- const span = measureCells[i3].colSpan ?? 1;
299010
- if (gridCol >= start$1 && gridCol < start$1 + span)
299011
- return start$1 + span;
299012
- }
299013
- };
299014
- const nextRowMaxCol = nextRowOccupiedRightCol != null && nextRowOccupiedRightCol > 0 ? nextRowOccupiedRightCol : nextRowMeasure?.cells?.length ? Math.max(...nextRowMeasure.cells.map((c) => (c.gridColumnStart ?? 0) + (c.colSpan ?? 1))) : Infinity;
299015
299953
  for (let cellIndex = 0;cellIndex < rowMeasure.cells.length; cellIndex += 1) {
299016
299954
  const cellMeasure = rowMeasure.cells[cellIndex];
299017
299955
  const cell2 = row2?.cells?.[cellIndex];
@@ -299032,8 +299970,6 @@ menclose::after {
299032
299970
  const aboveCellBorders = findCellBordersAtColumn(prevRow?.cells, prevRowMeasure?.cells, gridColumnStart);
299033
299971
  const leftCellBorders = gridColumnStart > 0 ? findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart - 1) : undefined;
299034
299972
  const rightCellBorders = findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart + colSpan);
299035
- const nextRowLeavesRightGap = gridColumnStart + colSpan > nextRowMaxCol;
299036
- const aboveCellRightEdge = findCellRightEdgeAtColumn(prevRowMeasure?.cells, gridColumnStart);
299037
299973
  const resolvedBorders = resolveRenderedCellBorders({
299038
299974
  cellBorders: cellBordersAttr,
299039
299975
  hasBordersAttribute,
@@ -299045,11 +299981,16 @@ menclose::after {
299045
299981
  aboveCellBorders,
299046
299982
  leftCellBorders,
299047
299983
  rightCellBorders,
299048
- nextRowLeavesRightGap,
299049
- deferTopToAboveCell: aboveCellRightEdge !== undefined && aboveCellRightEdge > rowRightEdgeCol,
299984
+ separateBorders,
299050
299985
  nextRowSuppressesSharedTop
299051
299986
  });
299052
299987
  const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
299988
+ const tonedBorders = separateBorders && finalBorders ? {
299989
+ top: bevelToneSpec(finalBorders.top, "top", "cell"),
299990
+ right: bevelToneSpec(finalBorders.right, "right", "cell"),
299991
+ bottom: bevelToneSpec(finalBorders.bottom, "bottom", "cell"),
299992
+ left: bevelToneSpec(finalBorders.left, "left", "cell")
299993
+ } : finalBorders;
299053
299994
  let cellHeight;
299054
299995
  if (partialRow)
299055
299996
  cellHeight = partialRow.partialHeight;
@@ -299062,6 +300003,34 @@ menclose::after {
299062
300003
  const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
299063
300004
  if (isRtl && computedCellWidth > 0)
299064
300005
  x = tableContentWidth - x - computedCellWidth;
300006
+ const cellGridBounds = getTableCellGridBounds(cellPosition);
300007
+ const cellIsIntentionallyBorderless = hasBordersAttribute && !hasExplicitCellBorders(cellBordersAttr);
300008
+ const cb = cellBordersAttr ?? {};
300009
+ const effectiveSideSpecs = cellIsIntentionallyBorderless ? {} : {
300010
+ top: cellGridBounds.touchesTopEdge || continuesFromPrev === true ? resolveTableBorderValue(cb.top, effectiveTableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? borderValueToSpec(effectiveTableBorders?.insideH),
300011
+ bottom: cellGridBounds.touchesBottomEdge || continuesOnNext === true ? resolveTableBorderValue(cb.bottom, effectiveTableBorders?.bottom) : resolveBorderConflict(cb.bottom, undefined) ?? borderValueToSpec(effectiveTableBorders?.insideH),
300012
+ left: cellGridBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, effectiveTableBorders?.left) : resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(effectiveTableBorders?.insideV),
300013
+ right: cellGridBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, effectiveTableBorders?.right) : resolveBorderConflict(cb.right, rightCellBorders?.left) ?? borderValueToSpec(effectiveTableBorders?.insideV)
300014
+ };
300015
+ const rectBorders = (isRtl ? swapCellBordersLR(effectiveSideSpecs) : effectiveSideSpecs) ?? effectiveSideSpecs;
300016
+ const visualTouchesLeft = isRtl ? cellGridBounds.touchesRightEdge : cellGridBounds.touchesLeftEdge;
300017
+ const visualTouchesRight = isRtl ? cellGridBounds.touchesLeftEdge : cellGridBounds.touchesRightEdge;
300018
+ const leftStraddleProfile = !visualTouchesLeft && rectBorders.left ? getBorderBandProfile(rectBorders.left) : null;
300019
+ const rightStraddleProfile = !visualTouchesRight && rectBorders.right ? getBorderBandProfile(rectBorders.right) : null;
300020
+ let paintBorders = tonedBorders;
300021
+ let borderBandOverridesPx;
300022
+ if (leftStraddleProfile || rightStraddleProfile) {
300023
+ paintBorders = { ...tonedBorders ?? {} };
300024
+ borderBandOverridesPx = {};
300025
+ if (leftStraddleProfile) {
300026
+ paintBorders.left = rectBorders.left;
300027
+ borderBandOverridesPx.left = leftStraddleProfile.band / 2;
300028
+ }
300029
+ if (rightStraddleProfile) {
300030
+ paintBorders.right = rectBorders.right;
300031
+ borderBandOverridesPx.right = rightStraddleProfile.band / 2;
300032
+ }
300033
+ }
299065
300034
  const { cellElement } = renderTableCell({
299066
300035
  doc: doc$12,
299067
300036
  x,
@@ -299069,7 +300038,8 @@ menclose::after {
299069
300038
  rowHeight: cellHeight,
299070
300039
  cellMeasure,
299071
300040
  cell: cell2,
299072
- borders: finalBorders,
300041
+ borders: paintBorders,
300042
+ borderBandOverridesPx,
299073
300043
  useDefaultBorder: false,
299074
300044
  renderLine: renderLine$1,
299075
300045
  captureLineSnapshot,
@@ -299092,7 +300062,68 @@ menclose::after {
299092
300062
  if (rowTrackedChange && rowTrackedChangeConfig)
299093
300063
  applyRowTrackedChangeToCell(cellElement, rowTrackedChange, rowTrackedChangeConfig);
299094
300064
  container.appendChild(cellElement);
300065
+ const tableProvidesMid = (value) => {
300066
+ const profile = value != null && typeof value === "object" ? getBorderBandProfile(value) : null;
300067
+ return profile != null && profile.segments.length === 5;
300068
+ };
300069
+ const suppressMid = {
300070
+ top: tableProvidesMid(cellGridBounds.touchesTopEdge || continuesFromPrev === true ? effectiveTableBorders?.top : effectiveTableBorders?.insideH),
300071
+ bottom: tableProvidesMid(cellGridBounds.touchesBottomEdge || continuesOnNext === true ? effectiveTableBorders?.bottom : effectiveTableBorders?.insideH),
300072
+ left: tableProvidesMid(visualTouchesLeft ? isRtl ? effectiveTableBorders?.right : effectiveTableBorders?.left : effectiveTableBorders?.insideV),
300073
+ right: tableProvidesMid(visualTouchesRight ? isRtl ? effectiveTableBorders?.left : effectiveTableBorders?.right : effectiveTableBorders?.insideV)
300074
+ };
300075
+ appendCompoundBorderRects(doc$12, container, cellElement, rectBorders, {
300076
+ x,
300077
+ y: y$1,
300078
+ width: computedCellWidth > 0 ? computedCellWidth : cellMeasure.width ?? 0,
300079
+ height: cellHeight
300080
+ }, {
300081
+ ownsBottomBand: cellGridBounds.touchesBottomEdge || continuesOnNext === true,
300082
+ rightIsBoundary: visualTouchesRight,
300083
+ leftIsBoundary: visualTouchesLeft,
300084
+ suppressMid
300085
+ });
300086
+ }
300087
+ }, buildColumnOccupancy = (rows, numCols) => {
300088
+ const occupancy = rows.map(() => new Array(numCols).fill(null));
300089
+ rows.forEach((row2, rowIndex) => {
300090
+ row2?.cells?.forEach((cell2, cellIndex) => {
300091
+ const startCol = cell2.gridColumnStart ?? 0;
300092
+ const endCol = Math.min(numCols, startCol + (cell2.colSpan ?? 1));
300093
+ const endRow = Math.min(rows.length, rowIndex + (cell2.rowSpan ?? 1));
300094
+ const ref$1 = {
300095
+ rowIndex,
300096
+ cellIndex
300097
+ };
300098
+ for (let r$1 = rowIndex;r$1 < endRow; r$1 += 1)
300099
+ for (let c = startCol;c < endCol; c += 1)
300100
+ occupancy[r$1][c] = ref$1;
300101
+ });
300102
+ });
300103
+ return occupancy;
300104
+ }, computeBoundaryGapSegments = (occupancy, belowRowIndex) => {
300105
+ const above = occupancy[belowRowIndex - 1];
300106
+ const below = occupancy[belowRowIndex];
300107
+ if (!above || !below)
300108
+ return [];
300109
+ const segments = [];
300110
+ let current = null;
300111
+ for (let c = 0;c < above.length; c += 1) {
300112
+ const aboveCell = above[c];
300113
+ const isGap = aboveCell !== null && below[c] === null;
300114
+ if (isGap && current && current.aboveCell === aboveCell)
300115
+ current.endColExclusive = c + 1;
300116
+ else if (isGap) {
300117
+ current = {
300118
+ startCol: c,
300119
+ endColExclusive: c + 1,
300120
+ aboveCell
300121
+ };
300122
+ segments.push(current);
300123
+ } else
300124
+ current = null;
299095
300125
  }
300126
+ return segments;
299096
300127
  }, renderTableFragment = (deps) => {
299097
300128
  const { doc: doc$12, fragment, 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;
299098
300129
  if (!doc$12) {
@@ -299244,11 +300275,23 @@ menclose::after {
299244
300275
  }
299245
300276
  if (block.id)
299246
300277
  container.setAttribute("data-sd-block-id", block.id);
299247
- if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && tableBorders) {
299248
- applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
299249
- applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
299250
- applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
299251
- applyBorder(container, "Left", borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left));
300278
+ const borderCollapse = block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse");
300279
+ const separateBorders = borderCollapse === "separate";
300280
+ if (borderCollapse === "separate" && tableBorders) {
300281
+ applyBorder(container, "Top", bevelToneSpec(borderValueToSpec(tableBorders.top), "top", "table"));
300282
+ applyBorder(container, "Right", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right), "right", "table"));
300283
+ applyBorder(container, "Bottom", bevelToneSpec(borderValueToSpec(tableBorders.bottom), "bottom", "table"));
300284
+ applyBorder(container, "Left", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left), "left", "table"));
300285
+ for (const [cssSide, value] of [
300286
+ ["Top", tableBorders.top],
300287
+ ["Right", isRtl ? tableBorders.left : tableBorders.right],
300288
+ ["Bottom", tableBorders.bottom],
300289
+ ["Left", isRtl ? tableBorders.right : tableBorders.left]
300290
+ ]) {
300291
+ const spec = borderValueToSpec(value);
300292
+ if (spec && getBorderBandProfile(spec) && !isNativeCssDoubleStyle(spec.style))
300293
+ container.style[`border${cssSide}Color`] = "transparent";
300294
+ }
299252
300295
  }
299253
300296
  const allRowHeights = measure.rows.map((r$1, idx) => {
299254
300297
  if (fragment.partialRow && fragment.partialRow.rowIndex === idx)
@@ -299281,9 +300324,8 @@ menclose::after {
299281
300324
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
299282
300325
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
299283
300326
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
299284
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
299285
300327
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
299286
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
300328
+ separateBorders,
299287
300329
  totalRows: block.rows.length,
299288
300330
  tableBorders,
299289
300331
  columnWidths: effectiveColumnWidths,
@@ -299387,10 +300429,16 @@ menclose::after {
299387
300429
  }
299388
300430
  }
299389
300431
  }
300432
+ const interiorRowBoundaries = [];
299390
300433
  for (let r$1 = fragment.fromRow;r$1 < fragment.toRow; r$1 += 1) {
299391
300434
  const rowMeasure = measure.rows[r$1];
299392
300435
  if (!rowMeasure)
299393
300436
  break;
300437
+ if (r$1 > fragment.fromRow)
300438
+ interiorRowBoundaries.push({
300439
+ y: y$1,
300440
+ belowRowIndex: r$1
300441
+ });
299394
300442
  const isFirstRenderedBodyRow = r$1 === fragment.fromRow;
299395
300443
  const isLastRenderedBodyRow = r$1 === fragment.toRow - 1;
299396
300444
  const partialRowData = fragment.partialRow && fragment.partialRow.rowIndex === r$1 ? fragment.partialRow : undefined;
@@ -299405,9 +300453,8 @@ menclose::after {
299405
300453
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
299406
300454
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
299407
300455
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
299408
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
299409
300456
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
299410
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
300457
+ separateBorders,
299411
300458
  totalRows: block.rows.length,
299412
300459
  tableBorders,
299413
300460
  columnWidths: effectiveColumnWidths,
@@ -299433,6 +300480,171 @@ menclose::after {
299433
300480
  });
299434
300481
  y$1 += actualRowHeight + cellSpacingPx;
299435
300482
  }
300483
+ {
300484
+ const sides = [
300485
+ [
300486
+ "top",
300487
+ tableBorders?.top,
300488
+ fragment.continuesFromPrev !== true
300489
+ ],
300490
+ [
300491
+ "right",
300492
+ isRtl ? tableBorders?.left : tableBorders?.right,
300493
+ true
300494
+ ],
300495
+ [
300496
+ "bottom",
300497
+ tableBorders?.bottom,
300498
+ fragment.continuesOnNext !== true
300499
+ ],
300500
+ [
300501
+ "left",
300502
+ isRtl ? tableBorders?.right : tableBorders?.left,
300503
+ true
300504
+ ]
300505
+ ];
300506
+ let outlineEl = null;
300507
+ for (const [side, value, enabled] of sides) {
300508
+ if (!enabled || value == null || typeof value !== "object")
300509
+ continue;
300510
+ const spec = value;
300511
+ const profile = getBorderBandProfile(value);
300512
+ if (!profile)
300513
+ continue;
300514
+ if (isNativeCssDoubleStyle(spec.style))
300515
+ continue;
300516
+ const rule = Math.max(1, Math.round(profile.segments[0]));
300517
+ const color2 = spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000";
300518
+ if (!outlineEl) {
300519
+ outlineEl = doc$12.createElement("div");
300520
+ outlineEl.className = "superdoc-compound-border-outline";
300521
+ const st = outlineEl.style;
300522
+ st.position = "absolute";
300523
+ st.inset = "0";
300524
+ st.boxSizing = "border-box";
300525
+ st.pointerEvents = "none";
300526
+ container.appendChild(outlineEl);
300527
+ }
300528
+ const cssSide = side[0].toUpperCase() + side.slice(1);
300529
+ outlineEl.style[`border${cssSide}`] = `${rule}px solid ${color2}`;
300530
+ }
300531
+ }
300532
+ {
300533
+ const midProfileOf = (value) => {
300534
+ if (value == null || typeof value !== "object")
300535
+ return null;
300536
+ const profile = getBorderBandProfile(value);
300537
+ return profile && profile.segments.length === 5 ? profile : null;
300538
+ };
300539
+ const colorOf = (value) => {
300540
+ const c = value?.color;
300541
+ return c && /^#[0-9A-Fa-f]{6}$/.test(c) ? c : "#000000";
300542
+ };
300543
+ const midOffsetOf = (profile) => Math.round(profile.segments[0] + profile.segments[1]);
300544
+ const midRuleOf = (profile) => Math.max(1, Math.round(profile.segments[2]));
300545
+ const topBorder = tableBorders?.top;
300546
+ const bottomBorder = tableBorders?.bottom;
300547
+ const leftBorder = isRtl ? tableBorders?.right : tableBorders?.left;
300548
+ const rightBorder = isRtl ? tableBorders?.left : tableBorders?.right;
300549
+ const topMid = fragment.continuesFromPrev !== true ? midProfileOf(topBorder) : null;
300550
+ const bottomMid = fragment.continuesOnNext !== true ? midProfileOf(bottomBorder) : null;
300551
+ const leftMid = midProfileOf(leftBorder);
300552
+ const rightMid = midProfileOf(rightBorder);
300553
+ const insideHMid = midProfileOf(tableBorders?.insideH);
300554
+ const insideVMid = midProfileOf(tableBorders?.insideV);
300555
+ const fragmentWidth = fragment.width;
300556
+ const fragmentHeight = fragment.height;
300557
+ const ringTopInset = topMid ? midOffsetOf(topMid) : 0;
300558
+ const ringBottomInset = bottomMid ? midOffsetOf(bottomMid) : 0;
300559
+ const ringLeftInset = leftMid ? midOffsetOf(leftMid) : 0;
300560
+ const ringRightInset = rightMid ? midOffsetOf(rightMid) : 0;
300561
+ if (topMid || bottomMid || leftMid || rightMid) {
300562
+ const ring = doc$12.createElement("div");
300563
+ ring.className = "superdoc-compound-border-midring";
300564
+ const rs = ring.style;
300565
+ rs.position = "absolute";
300566
+ rs.boxSizing = "border-box";
300567
+ rs.pointerEvents = "none";
300568
+ rs.left = `${ringLeftInset}px`;
300569
+ rs.top = `${ringTopInset}px`;
300570
+ rs.width = `${fragmentWidth - ringLeftInset - ringRightInset}px`;
300571
+ rs.height = `${fragmentHeight - ringTopInset - ringBottomInset}px`;
300572
+ if (topMid)
300573
+ rs.borderTop = `${midRuleOf(topMid)}px solid ${colorOf(topBorder)}`;
300574
+ if (bottomMid)
300575
+ rs.borderBottom = `${midRuleOf(bottomMid)}px solid ${colorOf(bottomBorder)}`;
300576
+ if (leftMid)
300577
+ rs.borderLeft = `${midRuleOf(leftMid)}px solid ${colorOf(leftBorder)}`;
300578
+ if (rightMid)
300579
+ rs.borderRight = `${midRuleOf(rightMid)}px solid ${colorOf(rightBorder)}`;
300580
+ container.appendChild(ring);
300581
+ }
300582
+ const appendStrip = (className, l, t, w, h$2, color2) => {
300583
+ const strip = doc$12.createElement("div");
300584
+ strip.className = className;
300585
+ const ss = strip.style;
300586
+ ss.position = "absolute";
300587
+ ss.pointerEvents = "none";
300588
+ ss.left = `${l}px`;
300589
+ ss.top = `${t}px`;
300590
+ ss.width = `${w}px`;
300591
+ ss.height = `${h$2}px`;
300592
+ ss.background = color2;
300593
+ container.appendChild(strip);
300594
+ };
300595
+ if (insideVMid && effectiveColumnWidths.length > 1) {
300596
+ const rule = midRuleOf(insideVMid);
300597
+ const color2 = colorOf(tableBorders?.insideV);
300598
+ let cum = 0;
300599
+ for (let i3 = 0;i3 < effectiveColumnWidths.length - 1; i3 += 1) {
300600
+ cum += effectiveColumnWidths[i3];
300601
+ const gx = isRtl ? fragmentWidth - cum : cum;
300602
+ appendStrip("superdoc-compound-border-midv", Math.round(gx - rule / 2), ringTopInset, rule, fragmentHeight - ringTopInset - ringBottomInset, color2);
300603
+ }
300604
+ }
300605
+ if (insideHMid && interiorRowBoundaries.length > 0) {
300606
+ const rule = midRuleOf(insideHMid);
300607
+ const color2 = colorOf(tableBorders?.insideH);
300608
+ for (const { y: gy } of interiorRowBoundaries)
300609
+ appendStrip("superdoc-compound-border-midh", ringLeftInset, Math.round(gy + midOffsetOf(insideHMid)), fragmentWidth - ringLeftInset - ringRightInset, rule, color2);
300610
+ }
300611
+ }
300612
+ if (cellSpacingPx === 0 && !separateBorders && interiorRowBoundaries.length > 0 && block.rows?.length) {
300613
+ const occupancy = buildColumnOccupancy(measure.rows, effectiveColumnWidths.length);
300614
+ const columnX = [0];
300615
+ for (const width of effectiveColumnWidths)
300616
+ columnX.push(columnX[columnX.length - 1] + width);
300617
+ for (const { y: boundaryY, belowRowIndex } of interiorRowBoundaries)
300618
+ for (const segment of computeBoundaryGapSegments(occupancy, belowRowIndex)) {
300619
+ if (segment.aboveCell.rowIndex < fragment.fromRow)
300620
+ continue;
300621
+ const aboveCell = block.rows[segment.aboveCell.rowIndex]?.cells?.[segment.aboveCell.cellIndex];
300622
+ const boundaryRowBorders = block.rows[belowRowIndex - 1]?.attrs?.borders;
300623
+ const effectiveInsideH = boundaryRowBorders ? {
300624
+ ...tableBorders ?? {},
300625
+ ...boundaryRowBorders
300626
+ }.insideH : tableBorders?.insideH;
300627
+ const cellBottom = aboveCell?.attrs?.borders?.bottom;
300628
+ const spec = isExplicitNoneBorder(cellBottom) ? undefined : resolveTableBorderValue(cellBottom, effectiveInsideH);
300629
+ if (!isPresentBorder(spec))
300630
+ continue;
300631
+ const x = columnX[segment.startCol];
300632
+ const width = columnX[segment.endColExclusive] - x;
300633
+ if (width <= 0)
300634
+ continue;
300635
+ const strip = doc$12.createElement("div");
300636
+ strip.className = "superdoc-row-boundary-gap";
300637
+ const ss = strip.style;
300638
+ ss.position = "absolute";
300639
+ ss.pointerEvents = "none";
300640
+ ss.left = `${isRtl ? fragment.width - x - width : x}px`;
300641
+ ss.top = `${boundaryY}px`;
300642
+ ss.width = `${width}px`;
300643
+ ss.height = "0";
300644
+ applyBorder(strip, "Top", spec);
300645
+ container.appendChild(strip);
300646
+ }
300647
+ }
299436
300648
  return container;
299437
300649
  }, getOwnContainerKey = (item) => {
299438
300650
  if (item.kind !== "fragment")
@@ -314310,13 +315522,13 @@ menclose::after {
314310
315522
  return;
314311
315523
  console.log(...args$1);
314312
315524
  }, 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;
314313
- var init_src_BrcexyXf_es = __esm(() => {
315525
+ var init_src_CVmBLxZV_es = __esm(() => {
314314
315526
  init_rolldown_runtime_Bg48TavK_es();
314315
- init_SuperConverter_DIgF4xk__es();
315527
+ init_SuperConverter_DlrS7cQT_es();
314316
315528
  init_jszip_C49i9kUs_es();
314317
315529
  init_xml_js_CqGKpaft_es();
314318
315530
  init_uuid_B2wVPhPi_es();
314319
- init_create_headless_toolbar_BT4yIoZ_es();
315531
+ init_create_headless_toolbar_Bm_c7KZd_es();
314320
315532
  init_constants_D9qj59G2_es();
314321
315533
  init_unified_BDuVPlMu_es();
314322
315534
  init_remark_gfm_BUJjZJLy_es();
@@ -315684,13 +316896,13 @@ var init_src_BrcexyXf_es = __esm(() => {
315684
316896
  },
315685
316897
  "lists.attach": {
315686
316898
  memberPath: "lists.attach",
315687
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
316899
+ 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.',
315688
316900
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
315689
316901
  requiresDocumentContext: true,
315690
316902
  metadata: mutationOperation({
315691
316903
  idempotency: "conditional",
315692
316904
  supportsDryRun: true,
315693
- supportsTrackedMode: false,
316905
+ supportsTrackedMode: true,
315694
316906
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
315695
316907
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
315696
316908
  }),
@@ -324863,7 +326075,10 @@ ${err.toString()}`);
324863
326075
  for (let r$1 = 0;r$1 < rows; r$1++) {
324864
326076
  const cellNodes = [];
324865
326077
  for (let c = 0;c < columns; c++) {
324866
- const cellAttrs = widths ? { colwidth: [widths[c]] } : {};
326078
+ const cellAttrs = widths ? {
326079
+ colwidth: [widths[c]],
326080
+ tableCellProperties: { cellWidth: cellWidthDxa(widths[c]) }
326081
+ } : {};
324867
326082
  const cell2 = tableCellType.createAndFill(cellAttrs);
324868
326083
  if (!cell2)
324869
326084
  return false;
@@ -338287,7 +339502,7 @@ function print() { __p += __j.call(arguments, '') }
338287
339502
  })
338288
339503
  });
338289
339504
  },
338290
- acceptTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
339505
+ acceptTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
338291
339506
  return dispatchReviewDecision({
338292
339507
  editor,
338293
339508
  state,
@@ -338295,7 +339510,8 @@ function print() { __p += __j.call(arguments, '') }
338295
339510
  decision: "accept",
338296
339511
  target: {
338297
339512
  kind: "id",
338298
- id: id2
339513
+ id: id2,
339514
+ ...options.side ? { side: options.side } : {}
338299
339515
  }
338300
339516
  }).applied;
338301
339517
  },
@@ -338308,7 +339524,7 @@ function print() { __p += __j.call(arguments, '') }
338308
339524
  target: { kind: "all" }
338309
339525
  }).applied;
338310
339526
  },
338311
- rejectTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
339527
+ rejectTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
338312
339528
  return dispatchReviewDecision({
338313
339529
  editor,
338314
339530
  state,
@@ -338316,7 +339532,8 @@ function print() { __p += __j.call(arguments, '') }
338316
339532
  decision: "reject",
338317
339533
  target: {
338318
339534
  kind: "id",
338319
- id: id2
339535
+ id: id2,
339536
+ ...options.side ? { side: options.side } : {}
338320
339537
  }
338321
339538
  }).applied;
338322
339539
  },
@@ -349092,13 +350309,28 @@ function print() { __p += __j.call(arguments, '') }
349092
350309
  "single",
349093
350310
  "double",
349094
350311
  "dashed",
350312
+ "dashSmallGap",
349095
350313
  "dotted",
349096
350314
  "thick",
349097
350315
  "triple",
349098
350316
  "dotDash",
349099
350317
  "dotDotDash",
350318
+ "thinThickSmallGap",
350319
+ "thickThinSmallGap",
350320
+ "thinThickThinSmallGap",
350321
+ "thinThickMediumGap",
350322
+ "thickThinMediumGap",
350323
+ "thinThickThinMediumGap",
350324
+ "thinThickLargeGap",
350325
+ "thickThinLargeGap",
350326
+ "thinThickThinLargeGap",
349100
350327
  "wave",
349101
- "doubleWave"
350328
+ "doubleWave",
350329
+ "dashDotStroked",
350330
+ "threeDEmboss",
350331
+ "threeDEngrave",
350332
+ "outset",
350333
+ "inset"
349102
350334
  ]);
349103
350335
  BORDER_STYLE_NUMBER = {
349104
350336
  single: 1,
@@ -349109,8 +350341,23 @@ function print() { __p += __j.call(arguments, '') }
349109
350341
  dotDash: 6,
349110
350342
  dotDotDash: 7,
349111
350343
  triple: 8,
350344
+ thinThickSmallGap: 9,
350345
+ thickThinSmallGap: 10,
350346
+ thinThickThinSmallGap: 11,
350347
+ thinThickMediumGap: 12,
350348
+ thickThinMediumGap: 13,
350349
+ thinThickThinMediumGap: 14,
350350
+ thinThickLargeGap: 15,
350351
+ thickThinLargeGap: 16,
350352
+ thinThickThinLargeGap: 17,
349112
350353
  wave: 18,
349113
- doubleWave: 19
350354
+ doubleWave: 19,
350355
+ dashSmallGap: 20,
350356
+ dashDotStroked: 21,
350357
+ threeDEmboss: 22,
350358
+ threeDEngrave: 23,
350359
+ outset: 24,
350360
+ inset: 25
349114
350361
  };
349115
350362
  BORDER_STYLE_LINES = {
349116
350363
  single: 1,
@@ -349121,8 +350368,21 @@ function print() { __p += __j.call(arguments, '') }
349121
350368
  dotDash: 1,
349122
350369
  dotDotDash: 1,
349123
350370
  triple: 3,
350371
+ thinThickSmallGap: 2,
350372
+ thickThinSmallGap: 2,
350373
+ thinThickThinSmallGap: 3,
350374
+ thinThickMediumGap: 2,
350375
+ thickThinMediumGap: 2,
350376
+ thinThickThinMediumGap: 3,
350377
+ thinThickLargeGap: 2,
350378
+ thickThinLargeGap: 2,
350379
+ thinThickThinLargeGap: 3,
349124
350380
  wave: 1,
349125
- doubleWave: 2
350381
+ doubleWave: 2,
350382
+ dashSmallGap: 1,
350383
+ dashDotStroked: 1,
350384
+ threeDEmboss: 1,
350385
+ threeDEngrave: 1
349126
350386
  };
349127
350387
  PX_PER_PT$12 = 96 / 72;
349128
350388
  BORDER_SIDES2 = [
@@ -357575,11 +358835,11 @@ function print() { __p += __j.call(arguments, '') }
357575
358835
  ]);
357576
358836
  });
357577
358837
 
357578
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B-QEvuPe.es.js
358838
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D2qFX5i6.es.js
357579
358839
  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;
357580
- var init_create_super_doc_ui_B_QEvuPe_es = __esm(() => {
357581
- init_SuperConverter_DIgF4xk__es();
357582
- init_create_headless_toolbar_BT4yIoZ_es();
358840
+ var init_create_super_doc_ui_D2qFX5i6_es = __esm(() => {
358841
+ init_SuperConverter_DlrS7cQT_es();
358842
+ init_create_headless_toolbar_Bm_c7KZd_es();
357583
358843
  DEFAULT_TEXT_ALIGN_OPTIONS = [
357584
358844
  {
357585
358845
  label: "Left",
@@ -357870,15 +359130,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
357870
359130
 
357871
359131
  // ../../packages/superdoc/dist/super-editor.es.js
357872
359132
  var init_super_editor_es = __esm(() => {
357873
- init_src_BrcexyXf_es();
357874
- init_SuperConverter_DIgF4xk__es();
359133
+ init_src_CVmBLxZV_es();
359134
+ init_SuperConverter_DlrS7cQT_es();
357875
359135
  init_jszip_C49i9kUs_es();
357876
359136
  init_xml_js_CqGKpaft_es();
357877
- init_create_headless_toolbar_BT4yIoZ_es();
359137
+ init_create_headless_toolbar_Bm_c7KZd_es();
357878
359138
  init_constants_D9qj59G2_es();
357879
359139
  init_unified_BDuVPlMu_es();
357880
359140
  init_DocxZipper_BzS208BW_es();
357881
- init_create_super_doc_ui_B_QEvuPe_es();
359141
+ init_create_super_doc_ui_D2qFX5i6_es();
357882
359142
  init_ui_CGB3qmy3_es();
357883
359143
  init_eventemitter3_UwU_CLPU_es();
357884
359144
  init_errors_C_DoKMoN_es();
@@ -361105,13 +362365,13 @@ More content with **bold** and *italic*.`
361105
362365
  },
361106
362366
  "lists.attach": {
361107
362367
  memberPath: "lists.attach",
361108
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
362368
+ 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.',
361109
362369
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
361110
362370
  requiresDocumentContext: true,
361111
362371
  metadata: mutationOperation2({
361112
362372
  idempotency: "conditional",
361113
362373
  supportsDryRun: true,
361114
- supportsTrackedMode: false,
362374
+ supportsTrackedMode: true,
361115
362375
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
361116
362376
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
361117
362377
  }),
@@ -369196,6 +370456,27 @@ var init_schemas4 = __esm(() => {
369196
370456
  },
369197
370457
  additionalProperties: false
369198
370458
  },
370459
+ numbering: {
370460
+ type: "object",
370461
+ 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.',
370462
+ properties: {
370463
+ marker: { oneOf: [{ type: "string" }, { type: "null" }] },
370464
+ path: { oneOf: [{ type: "array", items: { type: "number" } }, { type: "null" }] },
370465
+ kind: { oneOf: [{ type: "string" }, { type: "null" }] }
370466
+ },
370467
+ additionalProperties: false
370468
+ },
370469
+ indent: {
370470
+ type: "object",
370471
+ description: "Direct paragraph indentation in twips (only non-zero fields present).",
370472
+ properties: {
370473
+ left: { type: "number" },
370474
+ right: { type: "number" },
370475
+ firstLine: { type: "number" },
370476
+ hanging: { type: "number" }
370477
+ },
370478
+ additionalProperties: false
370479
+ },
369199
370480
  ref: {
369200
370481
  type: "string",
369201
370482
  description: "Ref handle for this block. Pass directly to superdoc_format or superdoc_edit ref param. Only present for non-empty blocks."
@@ -370707,6 +371988,10 @@ var init_schemas4 = __esm(() => {
370707
371988
  moveRole: {
370708
371989
  enum: ["pair", "source", "destination"],
370709
371990
  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."
371991
+ },
371992
+ side: {
371993
+ enum: ["inserted", "deleted"],
371994
+ 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."
370710
371995
  }
370711
371996
  }, ["kind", "id"]),
370712
371997
  objectSchema({
@@ -370743,6 +372028,10 @@ var init_schemas4 = __esm(() => {
370743
372028
  moveRole: {
370744
372029
  enum: ["pair", "source", "destination"],
370745
372030
  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."
372031
+ },
372032
+ side: {
372033
+ enum: ["inserted", "deleted"],
372034
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half."
370746
372035
  }
370747
372036
  }, ["id"]),
370748
372037
  objectSchema({
@@ -375828,10 +377117,11 @@ function executeTrackChangesDecide2(adapter, rawInput, options) {
375828
377117
  return adapter.rejectAll(input2, revisionOptions);
375829
377118
  }
375830
377119
  const { id: id2, story } = canonical.target;
377120
+ const side = canonical.target.side;
375831
377121
  if (canonical.decision === "accept") {
375832
- return adapter.accept({ id: id2, ...story ? { story } : {} }, revisionOptions);
377122
+ return adapter.accept({ id: id2, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
375833
377123
  }
375834
- return adapter.reject({ id: id2, ...story ? { story } : {} }, revisionOptions);
377124
+ return adapter.reject({ id: id2, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
375835
377125
  }
375836
377126
  function isValidLegacyPartialIdRangeTarget2(input2) {
375837
377127
  if (typeof input2 !== "object" || input2 == null)
@@ -375877,11 +377167,13 @@ function normalizeReviewDecideTarget2(target) {
375877
377167
  }
375878
377168
  const story = readOptionalStory2(target, "target.story", false);
375879
377169
  const moveRole = readOptionalMoveRole2(target);
377170
+ const side = readOptionalReplacementSide2(target);
375880
377171
  return {
375881
377172
  kind: "id",
375882
377173
  id: id2,
375883
377174
  ...story ? { story } : {},
375884
- ...moveRole ? { moveRole } : {}
377175
+ ...moveRole ? { moveRole } : {},
377176
+ ...side ? { side } : {}
375885
377177
  };
375886
377178
  }
375887
377179
  if (kind === "range") {
@@ -375956,11 +377248,13 @@ function normalizeReviewDecideTarget2(target) {
375956
377248
  if (typeof target.id === "string" && target.id.length > 0) {
375957
377249
  const story = readOptionalStory2(target, "target.story", false);
375958
377250
  const moveRole = readOptionalMoveRole2(target);
377251
+ const side = readOptionalReplacementSide2(target);
375959
377252
  return {
375960
377253
  kind: "id",
375961
377254
  id: target.id,
375962
377255
  ...story ? { story } : {},
375963
- ...moveRole ? { moveRole } : {}
377256
+ ...moveRole ? { moveRole } : {},
377257
+ ...side ? { side } : {}
375964
377258
  };
375965
377259
  }
375966
377260
  }
@@ -376077,6 +377371,18 @@ function readOptionalMoveRole2(target) {
376077
377371
  }
376078
377372
  return moveRole;
376079
377373
  }
377374
+ function readOptionalReplacementSide2(target) {
377375
+ if (!("side" in target))
377376
+ return;
377377
+ const side = target.side;
377378
+ if (side === undefined || side === null)
377379
+ return;
377380
+ if (side === "inserted")
377381
+ return "inserted";
377382
+ if (side === "deleted")
377383
+ return "deleted";
377384
+ throw new DocumentApiValidationError3("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', { field: "target.side", value: side });
377385
+ }
376080
377386
  function validateRangeTargetSide2(side) {
376081
377387
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination") {
376082
377388
  return;
@@ -380965,6 +382271,9 @@ function resolveEffectiveHeaderFooterRef2({
380965
382271
  }
380966
382272
  return null;
380967
382273
  }
382274
+ // ../../packages/layout-engine/contracts/src/border-band.ts
382275
+ var init_border_band = () => {};
382276
+
380968
382277
  // ../../packages/layout-engine/contracts/src/ooxml-z-index.ts
380969
382278
  function coerceRelativeHeight2(raw) {
380970
382279
  if (typeof raw === "number" && Number.isFinite(raw))
@@ -381478,6 +382787,7 @@ var init_engines = () => {};
381478
382787
 
381479
382788
  // ../../packages/layout-engine/contracts/src/index.ts
381480
382789
  var init_src = __esm(() => {
382790
+ init_border_band();
381481
382791
  init_justify_utils();
381482
382792
  init_pm_range();
381483
382793
  init_graphic_placement();
@@ -388041,13 +389351,28 @@ var init_borders = __esm(() => {
388041
389351
  "single",
388042
389352
  "double",
388043
389353
  "dashed",
389354
+ "dashSmallGap",
388044
389355
  "dotted",
388045
389356
  "thick",
388046
389357
  "triple",
388047
389358
  "dotDash",
388048
389359
  "dotDotDash",
389360
+ "thinThickSmallGap",
389361
+ "thickThinSmallGap",
389362
+ "thinThickThinSmallGap",
389363
+ "thinThickMediumGap",
389364
+ "thickThinMediumGap",
389365
+ "thinThickThinMediumGap",
389366
+ "thinThickLargeGap",
389367
+ "thickThinLargeGap",
389368
+ "thinThickThinLargeGap",
388049
389369
  "wave",
388050
- "doubleWave"
389370
+ "doubleWave",
389371
+ "dashDotStroked",
389372
+ "threeDEmboss",
389373
+ "threeDEngrave",
389374
+ "outset",
389375
+ "inset"
388051
389376
  ]);
388052
389377
  });
388053
389378
 
@@ -388657,6 +389982,11 @@ function resolveConditionalProps2(propertyType, styleType, styleId2, translatedL
388657
389982
  const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
388658
389983
  if (props)
388659
389984
  chain.push(props);
389985
+ if (styleType === "wholeTable" && propertyType === "tableCellProperties") {
389986
+ const baseProps = def?.tableCellProperties;
389987
+ if (baseProps)
389988
+ chain.push(baseProps);
389989
+ }
388660
389990
  currentId = def?.basedOn;
388661
389991
  }
388662
389992
  if (chain.length === 0)
@@ -388671,7 +390001,7 @@ function resolveCellStyles2(propertyType, tableInfo, translatedLinkedStyles) {
388671
390001
  const cellStyleProps = [];
388672
390002
  const tableStyleId = tableInfo.tableProperties.tableStyleId;
388673
390003
  const { rowBandSize, colBandSize } = resolveEffectiveBandSizes2(tableStyleId, translatedLinkedStyles);
388674
- const cellStyleTypes = determineCellStyleTypes2(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK2, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle);
390004
+ const cellStyleTypes = determineCellStyleTypes2(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK2, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle, tableInfo.gridColumnStart, tableInfo.gridColumnSpan, tableInfo.numGridCols);
388675
390005
  cellStyleTypes.forEach((styleType) => {
388676
390006
  const typeProps = resolveConditionalProps2(propertyType, styleType, tableStyleId, translatedLinkedStyles);
388677
390007
  if (typeProps) {
@@ -388694,12 +390024,15 @@ function resolveTableCellProperties2(inlineProps, tableInfo, translatedLinkedSty
388694
390024
  }
388695
390025
  return combineProperties2(chain, { fullOverrideProps: ["shading"] });
388696
390026
  }
388697
- function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
390027
+ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle, gridColumnStart, gridColumnSpan, numGridCols) {
388698
390028
  const applicable = new Set(["wholeTable"]);
388699
390029
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
388700
390030
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
390031
+ const columnStart = gridColumnStart ?? cellIndex;
390032
+ const columnEnd = columnStart + (gridColumnSpan ?? 1);
390033
+ const columnCount = numGridCols != null && numCells != null ? Math.max(numGridCols, numCells) : numGridCols ?? numCells;
388701
390034
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
388702
- const bandColIndex = Math.max(0, cellIndex - (tblLook?.firstColumn ? 1 : 0));
390035
+ const bandColIndex = Math.max(0, columnStart - (tblLook?.firstColumn ? 1 : 0));
388703
390036
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
388704
390037
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
388705
390038
  if (!tblLook?.noHBand) {
@@ -388710,8 +390043,8 @@ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCell
388710
390043
  }
388711
390044
  const isFirstRow = !!tblLook?.firstRow && rowIndex === 0;
388712
390045
  const isLastRow = !!tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1;
388713
- const isFirstCol = !!tblLook?.firstColumn && cellIndex === 0;
388714
- const isLastCol = !!tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1;
390046
+ const isFirstCol = !!tblLook?.firstColumn && columnStart === 0;
390047
+ const isLastCol = !!tblLook?.lastColumn && columnCount != null && columnCount > 0 && columnEnd >= columnCount;
388715
390048
  if (isFirstRow)
388716
390049
  applicable.add("firstRow");
388717
390050
  if (isFirstCol)
@@ -392052,10 +393385,40 @@ function normalizeLegacyBorderStyle2(value) {
392052
393385
  return "dotDash";
392053
393386
  case "dotdotdash":
392054
393387
  return "dotDotDash";
393388
+ case "dashsmallgap":
393389
+ return "dashSmallGap";
393390
+ case "thinthicksmallgap":
393391
+ return "thinThickSmallGap";
393392
+ case "thickthinsmallgap":
393393
+ return "thickThinSmallGap";
393394
+ case "thinthickthinsmallgap":
393395
+ return "thinThickThinSmallGap";
393396
+ case "thinthickmediumgap":
393397
+ return "thinThickMediumGap";
393398
+ case "thickthinmediumgap":
393399
+ return "thickThinMediumGap";
393400
+ case "thinthickthinmediumgap":
393401
+ return "thinThickThinMediumGap";
393402
+ case "thinthicklargegap":
393403
+ return "thinThickLargeGap";
393404
+ case "thickthinlargegap":
393405
+ return "thickThinLargeGap";
393406
+ case "thinthickthinlargegap":
393407
+ return "thinThickThinLargeGap";
392055
393408
  case "wave":
392056
393409
  return "wave";
392057
393410
  case "doublewave":
392058
393411
  return "doubleWave";
393412
+ case "dashdotstroked":
393413
+ return "dashDotStroked";
393414
+ case "threedemboss":
393415
+ return "threeDEmboss";
393416
+ case "threedengrave":
393417
+ return "threeDEngrave";
393418
+ case "outset":
393419
+ return "outset";
393420
+ case "inset":
393421
+ return "inset";
392059
393422
  case "single":
392060
393423
  default:
392061
393424
  return "single";
@@ -392193,14 +393556,21 @@ function tableNodeToBlock2(node3, {
392193
393556
  tableStyleId: effectiveStyleId ?? undefined
392194
393557
  } : undefined;
392195
393558
  const rows = [];
393559
+ const grid = node3.attrs?.grid;
393560
+ const numGridCols = Array.isArray(grid) && grid.length > 0 ? grid.length : undefined;
393561
+ let activeRowSpans = [];
392196
393562
  node3.content.forEach((rowNode, rowIndex) => {
393563
+ const { placements: placements2, nextActiveRowSpans } = placeRowCellsOnGrid2(rowNode, activeRowSpans);
393564
+ activeRowSpans = nextActiveRowSpans;
392197
393565
  const parsedRow = parseTableRow2({
392198
393566
  rowNode,
392199
393567
  rowIndex,
392200
393568
  numRows: node3?.content?.length ?? 1,
392201
393569
  context: parserDeps,
392202
393570
  defaultCellPadding,
392203
- tableProperties: tablePropertiesForCascade
393571
+ tableProperties: tablePropertiesForCascade,
393572
+ cellGridPlacements: placements2,
393573
+ numGridCols
392204
393574
  });
392205
393575
  if (parsedRow) {
392206
393576
  if (!shouldHideTrackedNode2(parsedRow.attrs?.trackedChange, parserDeps.trackedChangesConfig)) {
@@ -392331,7 +393701,36 @@ function tableNodeToBlock2(node3, {
392331
393701
  };
392332
393702
  return tableBlock;
392333
393703
  }
392334
- var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode2 = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", isTableSkipPlaceholderCell2 = (node3) => {
393704
+ var placeRowCellsOnGrid2 = (rowNode, activeRowSpans) => {
393705
+ const placements2 = [];
393706
+ const nextActiveRowSpans = activeRowSpans.map((count) => Math.max(0, count - 1));
393707
+ let column = 0;
393708
+ const cellSpan = (cellNode) => {
393709
+ const colspan = cellNode.attrs?.colspan;
393710
+ if (typeof colspan === "number" && colspan > 0)
393711
+ return colspan;
393712
+ const colwidth = cellNode.attrs?.colwidth;
393713
+ return Array.isArray(colwidth) && colwidth.length > 0 ? colwidth.length : 1;
393714
+ };
393715
+ for (const cellNode of Array.isArray(rowNode.content) ? rowNode.content : []) {
393716
+ if (!isTableCellNode2(cellNode)) {
393717
+ placements2.push(null);
393718
+ continue;
393719
+ }
393720
+ while ((activeRowSpans[column] ?? 0) > 0)
393721
+ column += 1;
393722
+ const span = cellSpan(cellNode);
393723
+ placements2.push({ gridColumnStart: column, gridColumnSpan: span });
393724
+ const rowspan = typeof cellNode.attrs?.rowspan === "number" ? cellNode.attrs.rowspan : 1;
393725
+ if (rowspan > 1) {
393726
+ for (let covered = column;covered < column + span; covered += 1) {
393727
+ nextActiveRowSpans[covered] = Math.max(nextActiveRowSpans[covered] ?? 0, rowspan - 1);
393728
+ }
393729
+ }
393730
+ column += span;
393731
+ }
393732
+ return { placements: placements2, nextActiveRowSpans };
393733
+ }, isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode2 = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", isTableSkipPlaceholderCell2 = (node3) => {
392335
393734
  const placeholder = node3.attrs?.__placeholder;
392336
393735
  return placeholder === "gridBefore" || placeholder === "gridAfter";
392337
393736
  }, convertResolvedCellBorder2 = (value) => {
@@ -392366,7 +393765,20 @@ var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "ta
392366
393765
  const blocks2 = [];
392367
393766
  const rowCnfStyle = args3.rowCnfStyle ?? null;
392368
393767
  const cellCnfStyle = cellNode.attrs?.tableCellProperties?.cnfStyle ?? null;
392369
- const tableInfo = tableProperties ? { tableProperties, rowIndex, cellIndex, numCells, numRows, rowCnfStyle, cellCnfStyle } : undefined;
393768
+ const tableInfo = tableProperties ? {
393769
+ tableProperties,
393770
+ rowIndex,
393771
+ cellIndex,
393772
+ numCells,
393773
+ numRows,
393774
+ rowCnfStyle,
393775
+ cellCnfStyle,
393776
+ ...args3.gridPlacement != null && args3.numGridCols != null ? {
393777
+ gridColumnStart: args3.gridPlacement.gridColumnStart,
393778
+ gridColumnSpan: args3.gridPlacement.gridColumnSpan,
393779
+ numGridCols: args3.numGridCols
393780
+ } : {}
393781
+ } : undefined;
392370
393782
  const inlineTcProps = cellNode.attrs?.tableCellProperties;
392371
393783
  const resolvedTcProps = resolveTableCellProperties2(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
392372
393784
  const cellBackground = cellNode.attrs?.background;
@@ -392666,7 +394078,9 @@ var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "ta
392666
394078
  tableProperties,
392667
394079
  numCells: rowNode?.content?.length || 1,
392668
394080
  numRows,
392669
- rowCnfStyle
394081
+ rowCnfStyle,
394082
+ gridPlacement: args3.cellGridPlacements?.[cellIndex] ?? null,
394083
+ numGridCols: args3.numGridCols
392670
394084
  });
392671
394085
  if (parsedCell) {
392672
394086
  cells.push(parsedCell);
@@ -424958,6 +426372,27 @@ var init_pPr_base_translators = __esm(() => {
424958
426372
  });
424959
426373
 
424960
426374
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/pPrChange/pPrChange-translator.js
426375
+ function resolvePprChangeWordId2(params3, change) {
426376
+ const idStr = String(change?.id ?? "");
426377
+ const allocator = params3?.converter?.wordIdAllocator;
426378
+ if (allocator) {
426379
+ const partPath = params3?.currentPartPath || "word/document.xml";
426380
+ const sourceId = /^\d+$/.test(idStr) ? idStr : undefined;
426381
+ return String(allocator.allocate({ partPath, sourceId, logicalId: idStr }));
426382
+ }
426383
+ return toDecimalWordId2(change?.id);
426384
+ }
426385
+ function toDecimalWordId2(id2) {
426386
+ const str = String(id2);
426387
+ if (/^\d+$/.test(str))
426388
+ return str;
426389
+ let hash5 = 2166136261;
426390
+ for (let i3 = 0;i3 < str.length; i3++) {
426391
+ hash5 ^= str.charCodeAt(i3);
426392
+ hash5 = Math.imul(hash5, 16777619);
426393
+ }
426394
+ return String(1e6 + (hash5 >>> 0) % 1e9);
426395
+ }
424961
426396
  function getSectPr2(pPrNode) {
424962
426397
  const sectPr = pPrNode?.elements?.find((el) => el.name === "w:sectPr");
424963
426398
  return sectPr ? carbonCopy2(sectPr) : undefined;
@@ -425002,6 +426437,9 @@ var init_pPrChange_translator = __esm(() => {
425002
426437
  const decodedAttrs = this.decodeAttributes({
425003
426438
  node: { ...params3.node, attrs: change }
425004
426439
  });
426440
+ if (decodedAttrs["w:id"] != null) {
426441
+ decodedAttrs["w:id"] = resolvePprChangeWordId2(params3, change);
426442
+ }
425005
426443
  const hasParagraphProperties2 = Object.prototype.hasOwnProperty.call(change, "paragraphProperties");
425006
426444
  const paragraphProperties = hasParagraphProperties2 ? change.paragraphProperties : undefined;
425007
426445
  let pPrNode = paragraphProperties && typeof paragraphProperties === "object" ? pPrTranslator2.decode({
@@ -426416,6 +427854,178 @@ var init_baseListDefinitions = __esm(() => {
426416
427854
  ]
426417
427855
  };
426418
427856
  });
427857
+
427858
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js
427859
+ import { randomUUID } from "crypto";
427860
+ var native_default2;
427861
+ var init_native = __esm(() => {
427862
+ native_default2 = { randomUUID };
427863
+ });
427864
+
427865
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js
427866
+ import { randomFillSync } from "crypto";
427867
+ function rng2() {
427868
+ if (poolPtr > rnds8Pool.length - 16) {
427869
+ randomFillSync(rnds8Pool);
427870
+ poolPtr = 0;
427871
+ }
427872
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
427873
+ }
427874
+ var rnds8Pool, poolPtr;
427875
+ var init_rng = __esm(() => {
427876
+ rnds8Pool = new Uint8Array(256);
427877
+ poolPtr = rnds8Pool.length;
427878
+ });
427879
+
427880
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/regex.js
427881
+ var regex_default2;
427882
+ var init_regex = __esm(() => {
427883
+ regex_default2 = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
427884
+ });
427885
+
427886
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/validate.js
427887
+ function validate2(uuid3) {
427888
+ return typeof uuid3 === "string" && regex_default2.test(uuid3);
427889
+ }
427890
+ var validate_default2;
427891
+ var init_validate = __esm(() => {
427892
+ init_regex();
427893
+ validate_default2 = validate2;
427894
+ });
427895
+
427896
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
427897
+ function unsafeStringify2(arr, offset2 = 0) {
427898
+ return (byteToHex2[arr[offset2 + 0]] + byteToHex2[arr[offset2 + 1]] + byteToHex2[arr[offset2 + 2]] + byteToHex2[arr[offset2 + 3]] + "-" + byteToHex2[arr[offset2 + 4]] + byteToHex2[arr[offset2 + 5]] + "-" + byteToHex2[arr[offset2 + 6]] + byteToHex2[arr[offset2 + 7]] + "-" + byteToHex2[arr[offset2 + 8]] + byteToHex2[arr[offset2 + 9]] + "-" + byteToHex2[arr[offset2 + 10]] + byteToHex2[arr[offset2 + 11]] + byteToHex2[arr[offset2 + 12]] + byteToHex2[arr[offset2 + 13]] + byteToHex2[arr[offset2 + 14]] + byteToHex2[arr[offset2 + 15]]).toLowerCase();
427899
+ }
427900
+ var byteToHex2;
427901
+ var init_stringify = __esm(() => {
427902
+ byteToHex2 = [];
427903
+ for (let i3 = 0;i3 < 256; ++i3) {
427904
+ byteToHex2.push((i3 + 256).toString(16).slice(1));
427905
+ }
427906
+ });
427907
+
427908
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js
427909
+ function v42(options, buf, offset2) {
427910
+ if (native_default2.randomUUID && !buf && !options) {
427911
+ return native_default2.randomUUID();
427912
+ }
427913
+ options = options || {};
427914
+ const rnds = options.random ?? options.rng?.() ?? rng2();
427915
+ if (rnds.length < 16) {
427916
+ throw new Error("Random bytes length must be >= 16");
427917
+ }
427918
+ rnds[6] = rnds[6] & 15 | 64;
427919
+ rnds[8] = rnds[8] & 63 | 128;
427920
+ if (buf) {
427921
+ offset2 = offset2 || 0;
427922
+ if (offset2 < 0 || offset2 + 16 > buf.length) {
427923
+ throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
427924
+ }
427925
+ for (let i3 = 0;i3 < 16; ++i3) {
427926
+ buf[offset2 + i3] = rnds[i3];
427927
+ }
427928
+ return buf;
427929
+ }
427930
+ return unsafeStringify2(rnds);
427931
+ }
427932
+ var v4_default2;
427933
+ var init_v42 = __esm(() => {
427934
+ init_native();
427935
+ init_rng();
427936
+ init_stringify();
427937
+ v4_default2 = v42;
427938
+ });
427939
+
427940
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/sha1.js
427941
+ import { createHash } from "crypto";
427942
+ function sha12(bytes) {
427943
+ if (Array.isArray(bytes)) {
427944
+ bytes = Buffer.from(bytes);
427945
+ } else if (typeof bytes === "string") {
427946
+ bytes = Buffer.from(bytes, "utf8");
427947
+ }
427948
+ return createHash("sha1").update(bytes).digest();
427949
+ }
427950
+ var sha1_default2;
427951
+ var init_sha1 = __esm(() => {
427952
+ sha1_default2 = sha12;
427953
+ });
427954
+
427955
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/parse.js
427956
+ function parse9(uuid3) {
427957
+ if (!validate_default2(uuid3)) {
427958
+ throw TypeError("Invalid UUID");
427959
+ }
427960
+ let v;
427961
+ return Uint8Array.of((v = parseInt(uuid3.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid3.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
427962
+ }
427963
+ var parse_default2;
427964
+ var init_parse4 = __esm(() => {
427965
+ init_validate();
427966
+ parse_default2 = parse9;
427967
+ });
427968
+
427969
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v35.js
427970
+ function stringToBytes2(str) {
427971
+ str = unescape(encodeURIComponent(str));
427972
+ const bytes = new Uint8Array(str.length);
427973
+ for (let i3 = 0;i3 < str.length; ++i3) {
427974
+ bytes[i3] = str.charCodeAt(i3);
427975
+ }
427976
+ return bytes;
427977
+ }
427978
+ function v352(version3, hash5, value, namespace, buf, offset2) {
427979
+ const valueBytes = typeof value === "string" ? stringToBytes2(value) : value;
427980
+ const namespaceBytes = typeof namespace === "string" ? parse_default2(namespace) : namespace;
427981
+ if (typeof namespace === "string") {
427982
+ namespace = parse_default2(namespace);
427983
+ }
427984
+ if (namespace?.length !== 16) {
427985
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
427986
+ }
427987
+ let bytes = new Uint8Array(16 + valueBytes.length);
427988
+ bytes.set(namespaceBytes);
427989
+ bytes.set(valueBytes, namespaceBytes.length);
427990
+ bytes = hash5(bytes);
427991
+ bytes[6] = bytes[6] & 15 | version3;
427992
+ bytes[8] = bytes[8] & 63 | 128;
427993
+ if (buf) {
427994
+ offset2 = offset2 || 0;
427995
+ if (offset2 < 0 || offset2 + 16 > buf.length) {
427996
+ throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
427997
+ }
427998
+ for (let i3 = 0;i3 < 16; ++i3) {
427999
+ buf[offset2 + i3] = bytes[i3];
428000
+ }
428001
+ return buf;
428002
+ }
428003
+ return unsafeStringify2(bytes);
428004
+ }
428005
+ var DNS2 = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL3 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
428006
+ var init_v35 = __esm(() => {
428007
+ init_parse4();
428008
+ init_stringify();
428009
+ });
428010
+
428011
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v5.js
428012
+ function v52(value, namespace, buf, offset2) {
428013
+ return v352(80, sha1_default2, value, namespace, buf, offset2);
428014
+ }
428015
+ var v5_default2;
428016
+ var init_v5 = __esm(() => {
428017
+ init_sha1();
428018
+ init_v35();
428019
+ v52.DNS = DNS2;
428020
+ v52.URL = URL3;
428021
+ v5_default2 = v52;
428022
+ });
428023
+
428024
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/index.js
428025
+ var init_esm2 = __esm(() => {
428026
+ init_v42();
428027
+ init_v5();
428028
+ });
426419
428029
  // ../../packages/super-editor/src/editors/v1/core/helpers/getExtensionConfigField.ts
426420
428030
  function getExtensionConfigField2(extension2, field, context = { name: "" }) {
426421
428031
  const fieldValue = extension2.config[field];
@@ -427492,178 +429102,6 @@ var init_dist11 = __esm(() => {
427492
429102
  columnResizingPluginKey2 = new PluginKey2("tableColumnResizing");
427493
429103
  });
427494
429104
 
427495
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js
427496
- import { randomUUID } from "crypto";
427497
- var native_default2;
427498
- var init_native = __esm(() => {
427499
- native_default2 = { randomUUID };
427500
- });
427501
-
427502
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js
427503
- import { randomFillSync } from "crypto";
427504
- function rng2() {
427505
- if (poolPtr > rnds8Pool.length - 16) {
427506
- randomFillSync(rnds8Pool);
427507
- poolPtr = 0;
427508
- }
427509
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
427510
- }
427511
- var rnds8Pool, poolPtr;
427512
- var init_rng = __esm(() => {
427513
- rnds8Pool = new Uint8Array(256);
427514
- poolPtr = rnds8Pool.length;
427515
- });
427516
-
427517
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/regex.js
427518
- var regex_default2;
427519
- var init_regex = __esm(() => {
427520
- regex_default2 = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
427521
- });
427522
-
427523
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/validate.js
427524
- function validate2(uuid3) {
427525
- return typeof uuid3 === "string" && regex_default2.test(uuid3);
427526
- }
427527
- var validate_default2;
427528
- var init_validate = __esm(() => {
427529
- init_regex();
427530
- validate_default2 = validate2;
427531
- });
427532
-
427533
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
427534
- function unsafeStringify2(arr, offset2 = 0) {
427535
- return (byteToHex2[arr[offset2 + 0]] + byteToHex2[arr[offset2 + 1]] + byteToHex2[arr[offset2 + 2]] + byteToHex2[arr[offset2 + 3]] + "-" + byteToHex2[arr[offset2 + 4]] + byteToHex2[arr[offset2 + 5]] + "-" + byteToHex2[arr[offset2 + 6]] + byteToHex2[arr[offset2 + 7]] + "-" + byteToHex2[arr[offset2 + 8]] + byteToHex2[arr[offset2 + 9]] + "-" + byteToHex2[arr[offset2 + 10]] + byteToHex2[arr[offset2 + 11]] + byteToHex2[arr[offset2 + 12]] + byteToHex2[arr[offset2 + 13]] + byteToHex2[arr[offset2 + 14]] + byteToHex2[arr[offset2 + 15]]).toLowerCase();
427536
- }
427537
- var byteToHex2;
427538
- var init_stringify = __esm(() => {
427539
- byteToHex2 = [];
427540
- for (let i4 = 0;i4 < 256; ++i4) {
427541
- byteToHex2.push((i4 + 256).toString(16).slice(1));
427542
- }
427543
- });
427544
-
427545
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js
427546
- function v42(options, buf, offset2) {
427547
- if (native_default2.randomUUID && !buf && !options) {
427548
- return native_default2.randomUUID();
427549
- }
427550
- options = options || {};
427551
- const rnds = options.random ?? options.rng?.() ?? rng2();
427552
- if (rnds.length < 16) {
427553
- throw new Error("Random bytes length must be >= 16");
427554
- }
427555
- rnds[6] = rnds[6] & 15 | 64;
427556
- rnds[8] = rnds[8] & 63 | 128;
427557
- if (buf) {
427558
- offset2 = offset2 || 0;
427559
- if (offset2 < 0 || offset2 + 16 > buf.length) {
427560
- throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
427561
- }
427562
- for (let i4 = 0;i4 < 16; ++i4) {
427563
- buf[offset2 + i4] = rnds[i4];
427564
- }
427565
- return buf;
427566
- }
427567
- return unsafeStringify2(rnds);
427568
- }
427569
- var v4_default2;
427570
- var init_v42 = __esm(() => {
427571
- init_native();
427572
- init_rng();
427573
- init_stringify();
427574
- v4_default2 = v42;
427575
- });
427576
-
427577
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/sha1.js
427578
- import { createHash } from "crypto";
427579
- function sha12(bytes) {
427580
- if (Array.isArray(bytes)) {
427581
- bytes = Buffer.from(bytes);
427582
- } else if (typeof bytes === "string") {
427583
- bytes = Buffer.from(bytes, "utf8");
427584
- }
427585
- return createHash("sha1").update(bytes).digest();
427586
- }
427587
- var sha1_default2;
427588
- var init_sha1 = __esm(() => {
427589
- sha1_default2 = sha12;
427590
- });
427591
-
427592
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/parse.js
427593
- function parse9(uuid3) {
427594
- if (!validate_default2(uuid3)) {
427595
- throw TypeError("Invalid UUID");
427596
- }
427597
- let v;
427598
- return Uint8Array.of((v = parseInt(uuid3.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid3.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
427599
- }
427600
- var parse_default2;
427601
- var init_parse4 = __esm(() => {
427602
- init_validate();
427603
- parse_default2 = parse9;
427604
- });
427605
-
427606
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v35.js
427607
- function stringToBytes2(str) {
427608
- str = unescape(encodeURIComponent(str));
427609
- const bytes = new Uint8Array(str.length);
427610
- for (let i4 = 0;i4 < str.length; ++i4) {
427611
- bytes[i4] = str.charCodeAt(i4);
427612
- }
427613
- return bytes;
427614
- }
427615
- function v352(version3, hash5, value, namespace, buf, offset2) {
427616
- const valueBytes = typeof value === "string" ? stringToBytes2(value) : value;
427617
- const namespaceBytes = typeof namespace === "string" ? parse_default2(namespace) : namespace;
427618
- if (typeof namespace === "string") {
427619
- namespace = parse_default2(namespace);
427620
- }
427621
- if (namespace?.length !== 16) {
427622
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
427623
- }
427624
- let bytes = new Uint8Array(16 + valueBytes.length);
427625
- bytes.set(namespaceBytes);
427626
- bytes.set(valueBytes, namespaceBytes.length);
427627
- bytes = hash5(bytes);
427628
- bytes[6] = bytes[6] & 15 | version3;
427629
- bytes[8] = bytes[8] & 63 | 128;
427630
- if (buf) {
427631
- offset2 = offset2 || 0;
427632
- if (offset2 < 0 || offset2 + 16 > buf.length) {
427633
- throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
427634
- }
427635
- for (let i4 = 0;i4 < 16; ++i4) {
427636
- buf[offset2 + i4] = bytes[i4];
427637
- }
427638
- return buf;
427639
- }
427640
- return unsafeStringify2(bytes);
427641
- }
427642
- var DNS2 = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL3 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
427643
- var init_v35 = __esm(() => {
427644
- init_parse4();
427645
- init_stringify();
427646
- });
427647
-
427648
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v5.js
427649
- function v52(value, namespace, buf, offset2) {
427650
- return v352(80, sha1_default2, value, namespace, buf, offset2);
427651
- }
427652
- var v5_default2;
427653
- var init_v5 = __esm(() => {
427654
- init_sha1();
427655
- init_v35();
427656
- v52.DNS = DNS2;
427657
- v52.URL = URL3;
427658
- v5_default2 = v52;
427659
- });
427660
-
427661
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/index.js
427662
- var init_esm2 = __esm(() => {
427663
- init_v42();
427664
- init_v5();
427665
- });
427666
-
427667
429105
  // ../../packages/super-editor/src/editors/v1/core/super-converter/exporter-docx-defs.js
427668
429106
  var DEFAULT_DOCX_DEFS2, DEFAULT_CUSTOM_XML2, COMMENT_REF2, DEFAULT_LINKED_STYLES2, COMMENTS_XML_DEF2, FOOTNOTES_XML_DEF2, COMMENTS_EXTENDED_XML_DEF, COMMENTS_EXTENSIBLE_XML_DEF, COMMENTS_IDS_XML_DEF, DOCUMENT_RELS_XML_DEF, PEOPLE_XML_DEF, COMMENTS_XML_DEFINITIONS2;
427669
429107
  var init_exporter_docx_defs = __esm(() => {
@@ -430628,6 +432066,9 @@ function generateParagraphProperties2(params3) {
430628
432066
  const { node: node4 } = params3;
430629
432067
  const { attrs = {} } = node4;
430630
432068
  const paragraphProperties = carbonCopy2(attrs.paragraphProperties || {});
432069
+ if (params3?.isFinalDoc && paragraphProperties.change) {
432070
+ delete paragraphProperties.change;
432071
+ }
430631
432072
  const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
430632
432073
  delete paragraphProperties.runPropertiesInlineKeys;
430633
432074
  if (Array.isArray(inlineKeys) && inlineKeys.length === 0) {
@@ -430645,7 +432086,11 @@ function generateParagraphProperties2(params3) {
430645
432086
  wordIdAllocator: params3?.converter?.wordIdAllocator || null,
430646
432087
  partPath: resolveExportPartPath2(params3)
430647
432088
  } : null;
430648
- let pPr = translator108.decode({ node: { ...node4, attrs: { paragraphProperties } } });
432089
+ let pPr = translator108.decode({
432090
+ node: { ...node4, attrs: { paragraphProperties } },
432091
+ converter: params3?.converter,
432092
+ currentPartPath: resolveExportPartPath2(params3)
432093
+ });
430649
432094
  if (!params3?.isFinalDoc && paragraphSplitTrackFormatMark) {
430650
432095
  const insertionElement = createParagraphSplitInsertionElement2(paragraphSplitTrackFormatMark, paragraphSplitWordIdOptions);
430651
432096
  if (insertionElement) {
@@ -466628,6 +468073,38 @@ function upsertSimpleElement2(elements, tagName, value) {
466628
468073
  }
466629
468074
  var APP_XML_PATH2 = "docProps/app.xml", EP_NAMESPACE2 = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
466630
468075
 
468076
+ // ../../packages/super-editor/src/editors/v1/extensions/track-changes/trackChangesHelpers/pprChanges.js
468077
+ var enumeratePprChanges2 = (state) => {
468078
+ const doc6 = state?.doc;
468079
+ if (!doc6)
468080
+ return [];
468081
+ const out = [];
468082
+ try {
468083
+ doc6.descendants((node4, pos) => {
468084
+ if (node4.isText)
468085
+ return false;
468086
+ const change = node4?.attrs?.paragraphProperties?.change;
468087
+ if (change && typeof change.id === "string" && change.id && change.paragraphProperties) {
468088
+ out.push({
468089
+ id: change.id,
468090
+ from: pos,
468091
+ to: pos + node4.nodeSize,
468092
+ author: change.author || "",
468093
+ authorEmail: change.authorEmail || "",
468094
+ authorImage: change.authorImage || "",
468095
+ date: change.date || "",
468096
+ formerProperties: change.paragraphProperties || {},
468097
+ subtype: "paragraph-format"
468098
+ });
468099
+ }
468100
+ return;
468101
+ });
468102
+ } catch {
468103
+ return out;
468104
+ }
468105
+ return out;
468106
+ };
468107
+
466631
468108
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/tracked-change-type-utils.ts
466632
468109
  function projectInternalTrackChangeType2(type, structural) {
466633
468110
  if (type !== "structural")
@@ -466950,6 +468427,28 @@ function groupTrackedChanges2(editor) {
466950
468427
  wordRevisionIds: structural.sourceId ? structural.side === "insertion" ? { insert: structural.sourceId } : { delete: structural.sourceId } : undefined
466951
468428
  });
466952
468429
  }
468430
+ const pprChanges = enumeratePprChanges2(editor.state);
468431
+ for (const ppr of pprChanges) {
468432
+ const excerpt = normalizeExcerpt2(editor.state.doc.textBetween(ppr.from, ppr.to, " ", ""));
468433
+ grouped.push({
468434
+ rawId: ppr.id,
468435
+ commandRawId: ppr.id,
468436
+ id: ppr.id,
468437
+ from: ppr.from,
468438
+ to: ppr.to,
468439
+ hasInsert: false,
468440
+ hasDelete: false,
468441
+ hasFormat: true,
468442
+ attrs: {
468443
+ id: ppr.id,
468444
+ author: ppr.author || undefined,
468445
+ authorEmail: ppr.authorEmail || undefined,
468446
+ authorImage: ppr.authorImage || undefined,
468447
+ date: ppr.date || undefined
468448
+ },
468449
+ excerpt
468450
+ });
468451
+ }
466953
468452
  grouped.sort((a2, b2) => {
466954
468453
  if (a2.from !== b2.from)
466955
468454
  return a2.from - b2.from;
@@ -467090,10 +468589,38 @@ var init_content_controls2 = __esm(() => {
467090
468589
  init_sdt_properties_write();
467091
468590
  });
467092
468591
 
468592
+ // ../../packages/super-editor/src/editors/v1/extensions/paragraph/resolvedPropertiesCache.js
468593
+ function getResolvedParagraphProperties2(node4) {
468594
+ return resolvedParagraphPropertiesCache2.get(node4);
468595
+ }
468596
+ function calculateResolvedParagraphProperties2(editor, node4, $pos) {
468597
+ if (!editor.converter) {
468598
+ return node4.attrs.paragraphProperties || {};
468599
+ }
468600
+ const cached2 = getResolvedParagraphProperties2(node4);
468601
+ if (cached2) {
468602
+ return cached2;
468603
+ }
468604
+ const tableNode = findParentNodeClosestToPos2($pos, (node5) => node5.type.name === "table");
468605
+ const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
468606
+ const paragraphProperties = resolveParagraphProperties2({
468607
+ translatedNumbering: editor.converter.translatedNumbering,
468608
+ translatedLinkedStyles: editor.converter.translatedLinkedStyles
468609
+ }, node4.attrs.paragraphProperties || {}, tableStyleId);
468610
+ resolvedParagraphPropertiesCache2.set(node4, paragraphProperties);
468611
+ return paragraphProperties;
468612
+ }
468613
+ var resolvedParagraphPropertiesCache2;
468614
+ var init_resolvedPropertiesCache = __esm(() => {
468615
+ init_ooxml();
468616
+ init_helpers5();
468617
+ resolvedParagraphPropertiesCache2 = new WeakMap;
468618
+ });
468619
+
467093
468620
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/list-sequence-helpers.ts
467094
468621
  function resolveBlock2(editor, nodeId) {
467095
468622
  const index3 = getBlockIndex2(editor);
467096
- const matches3 = index3.candidates.filter((c) => c.nodeId === nodeId && (c.nodeType === "paragraph" || c.nodeType === "listItem"));
468623
+ const matches3 = index3.candidates.filter((c) => c.nodeId === nodeId && (c.nodeType === "paragraph" || c.nodeType === "listItem" || c.nodeType === "heading"));
467097
468624
  if (matches3.length === 0) {
467098
468625
  throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "Block target was not found.", { nodeId });
467099
468626
  }
@@ -467115,7 +468642,7 @@ function resolveBlocksInRange2(editor, fromId, toId3) {
467115
468642
  });
467116
468643
  }
467117
468644
  const index3 = getBlockIndex2(editor);
467118
- return index3.candidates.filter((c) => (c.nodeType === "paragraph" || c.nodeType === "listItem") && c.pos >= from4.pos && c.pos <= to.pos);
468645
+ return index3.candidates.filter((c) => (c.nodeType === "paragraph" || c.nodeType === "listItem" || c.nodeType === "heading") && c.pos >= from4.pos && c.pos <= to.pos);
467119
468646
  }
467120
468647
  function getAbstractNumId2(editor, numId) {
467121
468648
  const converter = editor;
@@ -467343,7 +468870,17 @@ function getListText2(candidate) {
467343
468870
  }
467344
468871
  function projectListItemCandidate2(editor, candidate) {
467345
468872
  const attrs = candidate.node.attrs ?? {};
467346
- const { numId, level } = getNumberingProperties3(candidate.node);
468873
+ let { numId, level } = getNumberingProperties3(candidate.node);
468874
+ if (numId == null) {
468875
+ try {
468876
+ const resolved = calculateResolvedParagraphProperties2(editor, candidate.node, editor.state.doc.resolve(candidate.pos));
468877
+ const effective = resolved?.numberingProperties;
468878
+ if (effective) {
468879
+ numId = toFiniteNumber2(effective.numId);
468880
+ level = toFiniteNumber2(effective.ilvl) ?? level ?? 0;
468881
+ }
468882
+ } catch {}
468883
+ }
467347
468884
  const listRendering = getListRendering2(attrs.listRendering);
467348
468885
  const path3 = listRendering?.path;
467349
468886
  const ordinal = getListOrdinalFromPath2(path3);
@@ -467451,9 +468988,19 @@ function listListItems2(editor, query2) {
467451
468988
  page: { limit: query2?.limit ?? total, offset: safeOffset, returned: items.length }
467452
468989
  });
467453
468990
  }
468991
+ function hasNumberingMetadata2(candidate) {
468992
+ const { numId } = getNumberingProperties3(candidate.node);
468993
+ if (numId != null)
468994
+ return true;
468995
+ const attrs = candidate.node.attrs ?? {};
468996
+ return getListRendering2(attrs.listRendering) != null;
468997
+ }
467454
468998
  function resolveListItem2(editor, address2) {
467455
468999
  const index3 = getBlockIndex2(editor);
467456
- const matches3 = index3.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
469000
+ let matches3 = index3.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
469001
+ if (matches3.length === 0) {
469002
+ matches3 = index3.candidates.filter((candidate) => candidate.nodeId === address2.nodeId && hasNumberingMetadata2(candidate));
469003
+ }
467457
469004
  if (matches3.length === 0) {
467458
469005
  throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "List item target was not found.", {
467459
469006
  target: address2
@@ -467469,6 +469016,7 @@ function resolveListItem2(editor, address2) {
467469
469016
  }
467470
469017
  var init_list_item_resolver = __esm(() => {
467471
469018
  init_list_numbering_helpers();
469019
+ init_resolvedPropertiesCache();
467472
469020
  init_dist2();
467473
469021
  init_errors4();
467474
469022
  init_revision_tracker();
@@ -469004,7 +470552,15 @@ var init_SuperConverter = __esm(() => {
469004
470552
  }
469005
470553
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = [], editor, exportJsonOnly = false, fieldsHighlightColor, preserveSdtWrappers = false) {
469006
470554
  this.exportWarnings = [];
469007
- const exportableComments = comments.filter((c) => !c.trackedChange);
470555
+ const isSyntheticTrackedChangeRow = (c) => {
470556
+ const linkId = c.trackedChangeLink?.trackedChangeId;
470557
+ if (!c.trackedChange || !linkId)
470558
+ return false;
470559
+ const identity2 = c.commentId ?? c.id;
470560
+ return identity2 != null && String(identity2) === String(linkId);
470561
+ };
470562
+ const hasCommentBody = (c) => Boolean(typeof c.commentText === "string" && c.commentText.length > 0 || c.commentJSON || Array.isArray(c.elements) && c.elements.length || typeof c.text === "string" && c.text.length > 0);
470563
+ const exportableComments = comments.filter((c) => !isSyntheticTrackedChangeRow(c) && !(c.trackedChange && !hasCommentBody(c)));
469008
470564
  const commentsWithParaIds = exportableComments.map((c) => prepareCommentParaIds2(c));
469009
470565
  const commentDefinitions = commentsWithParaIds.map((c, index3) => getCommentDefinition2(c, index3, commentsWithParaIds, editor));
469010
470566
  let statFieldCacheMap;
@@ -469767,34 +471323,6 @@ var init_styles3 = __esm(() => {
469767
471323
  init_ooxml();
469768
471324
  });
469769
471325
 
469770
- // ../../packages/super-editor/src/editors/v1/extensions/paragraph/resolvedPropertiesCache.js
469771
- function getResolvedParagraphProperties2(node4) {
469772
- return resolvedParagraphPropertiesCache2.get(node4);
469773
- }
469774
- function calculateResolvedParagraphProperties2(editor, node4, $pos) {
469775
- if (!editor.converter) {
469776
- return node4.attrs.paragraphProperties || {};
469777
- }
469778
- const cached2 = getResolvedParagraphProperties2(node4);
469779
- if (cached2) {
469780
- return cached2;
469781
- }
469782
- const tableNode = findParentNodeClosestToPos2($pos, (node5) => node5.type.name === "table");
469783
- const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
469784
- const paragraphProperties = resolveParagraphProperties2({
469785
- translatedNumbering: editor.converter.translatedNumbering,
469786
- translatedLinkedStyles: editor.converter.translatedLinkedStyles
469787
- }, node4.attrs.paragraphProperties || {}, tableStyleId);
469788
- resolvedParagraphPropertiesCache2.set(node4, paragraphProperties);
469789
- return paragraphProperties;
469790
- }
469791
- var resolvedParagraphPropertiesCache2;
469792
- var init_resolvedPropertiesCache = __esm(() => {
469793
- init_ooxml();
469794
- init_helpers5();
469795
- resolvedParagraphPropertiesCache2 = new WeakMap;
469796
- });
469797
-
469798
471326
  // ../../packages/super-editor/src/editors/v1/extensions/run/calculateInlineRunPropertiesPlugin.js
469799
471327
  function extractTableInfo2($pos, depth) {
469800
471328
  const rowNode = $pos.node(depth - 1);
@@ -473357,11 +474885,24 @@ var init_list_helpers2 = __esm(() => {
473357
474885
  });
473358
474886
 
473359
474887
  // ../../packages/super-editor/src/editors/v1/core/commands/changeListLevel.js
473360
- function updateNumberingProperties2(newNumberingProperties, paragraphNode, pos, editor, tr) {
474888
+ function updateNumberingProperties2(newNumberingProperties, paragraphNode, pos, editor, tr, options = {}) {
474889
+ const formerProperties = { ...paragraphNode.attrs.paragraphProperties || {} };
473361
474890
  const newProperties = {
473362
- ...paragraphNode.attrs.paragraphProperties || {},
474891
+ ...formerProperties,
473363
474892
  numberingProperties: newNumberingProperties ? { ...newNumberingProperties } : null
473364
474893
  };
474894
+ if (options.trackChange && newNumberingProperties && !formerProperties.change) {
474895
+ const former = { ...formerProperties };
474896
+ delete former.change;
474897
+ const user = editor?.options?.user || {};
474898
+ newProperties.change = {
474899
+ id: v4_default2(),
474900
+ author: user.name || "",
474901
+ authorEmail: user.email || "",
474902
+ date: new Date().toISOString(),
474903
+ paragraphProperties: former
474904
+ };
474905
+ }
473365
474906
  if (!newNumberingProperties && paragraphNode.attrs.paragraphProperties?.styleId === "ListParagraph") {
473366
474907
  newProperties.styleId = null;
473367
474908
  }
@@ -473379,6 +474920,7 @@ function updateNumberingProperties2(newNumberingProperties, paragraphNode, pos,
473379
474920
  tr.setNodeMarkup(pos, null, newAttrs);
473380
474921
  }
473381
474922
  var init_changeListLevel = __esm(() => {
474923
+ init_esm2();
473382
474924
  init_helpers5();
473383
474925
  init_list_helpers2();
473384
474926
  init_list_numbering_helpers();
@@ -477651,7 +479193,25 @@ function executeTextDelete2(_editor, tr, target, _step, mapping) {
477651
479193
  tr.delete(absFrom, absTo);
477652
479194
  return { changed: true };
477653
479195
  }
477654
- function applyAlignmentToRange2(editor, tr, absFrom, absTo, alignment) {
479196
+ function withTrackedParagraphPropertyChange2(editor, existing, nextParagraphProperties, changeMode) {
479197
+ if (changeMode !== "tracked")
479198
+ return nextParagraphProperties;
479199
+ if (existing?.change)
479200
+ return nextParagraphProperties;
479201
+ const { change: _existingChange, ...formerProperties } = existing ?? {};
479202
+ const user = editor?.options?.user ?? {};
479203
+ return {
479204
+ ...nextParagraphProperties,
479205
+ change: {
479206
+ id: v4_default2(),
479207
+ author: user.name || "",
479208
+ authorEmail: user.email || "",
479209
+ date: new Date().toISOString(),
479210
+ paragraphProperties: formerProperties
479211
+ }
479212
+ };
479213
+ }
479214
+ function applyAlignmentToRange2(editor, tr, absFrom, absTo, alignment, changeMode) {
477655
479215
  if (!alignment)
477656
479216
  return false;
477657
479217
  let changed = false;
@@ -477666,7 +479226,7 @@ function applyAlignmentToRange2(editor, tr, absFrom, absTo, alignment) {
477666
479226
  const currentJustification = existing?.justification;
477667
479227
  if (currentJustification === justification)
477668
479228
  return;
477669
- const updated = { ...existing ?? {}, justification };
479229
+ const updated = withTrackedParagraphPropertyChange2(editor, existing, { ...existing ?? {}, justification }, changeMode);
477670
479230
  tr.setNodeMarkup(pos, undefined, { ...node4.attrs, paragraphProperties: updated });
477671
479231
  changed = true;
477672
479232
  });
@@ -477685,7 +479245,7 @@ function expandToBlockBoundaries2(doc6, from4, to) {
477685
479245
  });
477686
479246
  return { from: expandedFrom, to: expandedTo };
477687
479247
  }
477688
- function executeStyleApply4(editor, tr, target, step3, mapping) {
479248
+ function executeStyleApply4(editor, tr, target, step3, mapping, changeMode) {
477689
479249
  let absFrom = mapping.map(target.absFrom);
477690
479250
  let absTo = mapping.map(target.absTo);
477691
479251
  if (step3.args.scope === "block") {
@@ -477698,7 +479258,7 @@ function executeStyleApply4(editor, tr, target, step3, mapping) {
477698
479258
  changed = applyInlinePatchToRange2(editor, tr, absFrom, absTo, step3.args.inline) || changed;
477699
479259
  }
477700
479260
  if (step3.args.alignment) {
477701
- changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment) || changed;
479261
+ changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment, changeMode) || changed;
477702
479262
  }
477703
479263
  return { changed };
477704
479264
  }
@@ -477777,7 +479337,7 @@ function executeSpanTextDelete2(_editor, tr, target, step3, mapping) {
477777
479337
  tr.delete(absFrom, absTo);
477778
479338
  return { changed: true };
477779
479339
  }
477780
- function executeSpanStyleApply2(editor, tr, target, step3, mapping) {
479340
+ function executeSpanStyleApply2(editor, tr, target, step3, mapping, changeMode) {
477781
479341
  validateMappedSpanContiguity2(target, mapping, step3.id);
477782
479342
  const firstSeg = target.segments[0];
477783
479343
  const lastSeg = target.segments[target.segments.length - 1];
@@ -477793,7 +479353,7 @@ function executeSpanStyleApply2(editor, tr, target, step3, mapping) {
477793
479353
  changed = applyInlinePatchToRange2(editor, tr, absFrom, absTo, step3.args.inline) || changed;
477794
479354
  }
477795
479355
  if (step3.args.alignment) {
477796
- changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment) || changed;
479356
+ changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment, changeMode) || changed;
477797
479357
  }
477798
479358
  return { changed };
477799
479359
  }
@@ -478455,6 +480015,7 @@ var init_executor = __esm(() => {
478455
480015
  init_replacement_normalizer();
478456
480016
  init_word_diff();
478457
480017
  init_resolvedPropertiesCache();
480018
+ init_esm2();
478458
480019
  init_dist3();
478459
480020
  init_text_with_tabs();
478460
480021
  init_safe_regex();
@@ -481944,7 +483505,7 @@ function trackChangesGetWrapper2(editor, input2) {
481944
483505
  imported: Boolean(toNonEmptyString2(resolved.change.attrs.sourceId))
481945
483506
  };
481946
483507
  }
481947
- function decideSingle2(hostEditor, decision, id2, story, options) {
483508
+ function decideSingle2(hostEditor, decision, id2, story, options, side) {
481948
483509
  const resolved = resolveTrackedChangeInStory2(hostEditor, {
481949
483510
  kind: "entity",
481950
483511
  entityType: "trackedChange",
@@ -481961,7 +483522,7 @@ function decideSingle2(hostEditor, decision, id2, story, options) {
481961
483522
  }
481962
483523
  checkRevision2(hostEditor, options?.expectedRevision);
481963
483524
  const commandRawId = resolved.change.commandRawId ?? resolved.change.rawId;
481964
- const receipt2 = executeDomainCommand2(resolved.editor, () => Boolean(command2(commandRawId)));
483525
+ const receipt2 = executeDomainCommand2(resolved.editor, () => Boolean(command2(commandRawId, side ? { side } : undefined)));
481965
483526
  if (receipt2.steps[0]?.effect !== "changed") {
481966
483527
  return decisionFailureReceipt2(resolved.editor, `${decision === "accept" ? "Accept" : "Reject"} tracked change "${id2}" produced no change.`, {
481967
483528
  id: id2,
@@ -481976,10 +483537,10 @@ function decideSingle2(hostEditor, decision, id2, story, options) {
481976
483537
  return { success: true };
481977
483538
  }
481978
483539
  function trackChangesAcceptWrapper2(editor, input2, options) {
481979
- return decideSingle2(editor, "accept", input2.id, input2.story, options);
483540
+ return decideSingle2(editor, "accept", input2.id, input2.story, options, input2.side);
481980
483541
  }
481981
483542
  function trackChangesRejectWrapper2(editor, input2, options) {
481982
- return decideSingle2(editor, "reject", input2.id, input2.story, options);
483543
+ return decideSingle2(editor, "reject", input2.id, input2.story, options, input2.side);
481983
483544
  }
481984
483545
  function decideAll2(editor, decision, input2, options) {
481985
483546
  const index3 = getTrackedChangeIndex2(editor);
@@ -483059,6 +484620,7 @@ function replyToCommentHandler2(editor, input2, options) {
483059
484620
  if (trackedPayload && inheritedTrackedFields) {
483060
484621
  emitCommentLifecycleUpdate2(editor, "update", trackedPayload);
483061
484622
  }
484623
+ incrementRevision2(editor);
483062
484624
  return { success: true, id: replyId, inserted: [toCommentAddress2(replyId)] };
483063
484625
  }
483064
484626
  function moveCommentHandler2(editor, input2, options) {
@@ -491144,6 +492706,8 @@ function extractBlockNumbering2(node4) {
491144
492706
  function extractBlockFormatting2(node4, styleCtx) {
491145
492707
  const pProps = node4.attrs.paragraphProperties;
491146
492708
  const styleId3 = pProps?.styleId ?? null;
492709
+ const rawIndent = pProps?.indent;
492710
+ const indent3 = rawIndent && typeof rawIndent === "object" ? Object.fromEntries(["left", "right", "firstLine", "hanging"].filter((k2) => typeof rawIndent[k2] === "number" && rawIndent[k2] !== 0).map((k2) => [k2, rawIndent[k2]])) : undefined;
491147
492711
  let fontFamily;
491148
492712
  let fontSize;
491149
492713
  let bold;
@@ -491192,6 +492756,7 @@ function extractBlockFormatting2(node4, styleCtx) {
491192
492756
  ...underline ? { underline } : {},
491193
492757
  ...color3 ? { color: color3 } : {},
491194
492758
  ...pProps?.justification ? { alignment: pProps.justification } : {},
492759
+ ...indent3 && Object.keys(indent3).length > 0 ? { indent: indent3 } : {},
491195
492760
  ...headingLevel ? { headingLevel } : {}
491196
492761
  };
491197
492762
  }
@@ -491272,6 +492837,7 @@ function blocksListWrapper2(editor, input2) {
491272
492837
  segments: [{ blockId: candidate.nodeId, start: 0, end: textLength }],
491273
492838
  blockIndex: offset2 + i4
491274
492839
  }) : undefined;
492840
+ const listRendering = candidate.node.attrs?.listRendering;
491275
492841
  return {
491276
492842
  ordinal: offset2 + i4,
491277
492843
  nodeId: candidate.nodeId,
@@ -491280,6 +492846,13 @@ function blocksListWrapper2(editor, input2) {
491280
492846
  ...fullText !== undefined ? { text: fullText } : {},
491281
492847
  isEmpty: textLength === 0,
491282
492848
  ...extractBlockFormatting2(candidate.node, styleCtx),
492849
+ ...listRendering ? {
492850
+ numbering: {
492851
+ marker: listRendering.markerText ?? null,
492852
+ path: listRendering.path ?? null,
492853
+ kind: listRendering.numberingType ?? null
492854
+ }
492855
+ } : {},
491283
492856
  ...numbering ? { paragraphNumbering: numbering } : {},
491284
492857
  ...ref3 ? { ref: ref3 } : {}
491285
492858
  };
@@ -492641,7 +494214,9 @@ function listsCreateWrapper2(editor, input2, options) {
492641
494214
  };
492642
494215
  }
492643
494216
  function listsAttachWrapper2(editor, input2, options) {
492644
- rejectTrackedMode2("lists.attach", options);
494217
+ const trackChange = (options?.changeMode ?? "direct") === "tracked";
494218
+ if (trackChange)
494219
+ ensureTrackedCapability2(editor, { operation: "lists.attach" });
492645
494220
  const attachTo = resolveListItem2(editor, input2.attachTo);
492646
494221
  if (attachTo.numId == null) {
492647
494222
  return toListsFailure2("INVALID_TARGET", "attachTo target must be a list item with numbering metadata.", {
@@ -492666,7 +494241,7 @@ function listsAttachWrapper2(editor, input2, options) {
492666
494241
  const receipt2 = executeDomainCommand2(editor, () => {
492667
494242
  const { tr } = editor.state;
492668
494243
  for (const block of targets) {
492669
- updateNumberingProperties2({ numId, ilvl: level }, block.node, block.pos, editor, tr);
494244
+ updateNumberingProperties2({ numId, ilvl: level }, block.node, block.pos, editor, tr, { trackChange });
492670
494245
  }
492671
494246
  dispatchEditorTransaction3(editor, tr);
492672
494247
  clearIndexCache2(editor);
@@ -497313,7 +498888,14 @@ function tablesSetShadingAdapter2(editor, input2, options) {
497313
498888
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
497314
498889
  currentProps.shading = { fill: normalizedColor, val: "clear", color: "auto" };
497315
498890
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs2(currentProps) : {};
497316
- tr.setNodeMarkup(resolved.pos, null, { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs });
498891
+ const nextAttrs = { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs };
498892
+ if (resolved.scope === "cell") {
498893
+ if (normalizedColor === "auto")
498894
+ delete nextAttrs.background;
498895
+ else
498896
+ nextAttrs.background = { color: normalizedColor };
498897
+ }
498898
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
497317
498899
  if (resolved.scope === "table") {
497318
498900
  applyShadingToCells2(tr, resolved.node, resolved.pos + 1, normalizedColor);
497319
498901
  }
@@ -497344,7 +498926,11 @@ function tablesClearShadingAdapter2(editor, input2, options) {
497344
498926
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
497345
498927
  delete currentProps.shading;
497346
498928
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs2(currentProps) : {};
497347
- tr.setNodeMarkup(resolved.pos, null, { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs });
498929
+ const nextAttrs = { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs };
498930
+ if (resolved.scope === "cell") {
498931
+ delete nextAttrs.background;
498932
+ }
498933
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
497348
498934
  if (resolved.scope === "table") {
497349
498935
  const tableNode = resolved.node;
497350
498936
  const tableStart = resolved.pos + 1;
@@ -498466,7 +500052,7 @@ function registerBuiltInExecutors2() {
498466
500052
  registerStepExecutor2("format.apply", {
498467
500053
  execute: (ctx2, targets, step3) => {
498468
500054
  ensureFormatStepCapabilities2(ctx2, step3);
498469
- return executeTextStep2(ctx2, targets, step3, (e, tr, t, s2, m2) => executeStyleApply4(e, tr, t, s2, m2), (e, tr, t, s2, m2) => executeSpanStyleApply2(e, tr, t, s2, m2));
500055
+ return executeTextStep2(ctx2, targets, step3, (e, tr, t, s2, m2) => executeStyleApply4(e, tr, t, s2, m2, ctx2.changeMode), (e, tr, t, s2, m2) => executeSpanStyleApply2(e, tr, t, s2, m2, ctx2.changeMode));
498470
500056
  }
498471
500057
  });
498472
500058
  registerStepExecutor2("create.paragraph", {
@@ -520698,6 +522284,13 @@ EXAMPLES:
520698
522284
  "destination"
520699
522285
  ],
520700
522286
  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."
522287
+ },
522288
+ side: {
522289
+ enum: [
522290
+ "inserted",
522291
+ "deleted"
522292
+ ],
522293
+ 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."
520701
522294
  }
520702
522295
  },
520703
522296
  additionalProperties: false,
@@ -520896,6 +522489,13 @@ EXAMPLES:
520896
522489
  "destination"
520897
522490
  ],
520898
522491
  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."
522492
+ },
522493
+ side: {
522494
+ enum: [
522495
+ "inserted",
522496
+ "deleted"
522497
+ ],
522498
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half."
520899
522499
  }
520900
522500
  },
520901
522501
  additionalProperties: false,