@superdoc-dev/cli 0.17.0-next.42 → 0.17.0-next.44

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 +1121 -198
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68164,7 +68164,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
68164
68164
  emptyOptions2 = {};
68165
68165
  });
68166
68166
 
68167
- // ../../packages/superdoc/dist/chunks/SuperConverter-DRKaQwZS.es.js
68167
+ // ../../packages/superdoc/dist/chunks/SuperConverter-Ed3nFN54.es.js
68168
68168
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68169
68169
  const fieldValue = extension$1.config[field];
68170
68170
  if (typeof fieldValue === "function")
@@ -77740,6 +77740,50 @@ function getCellSpacingPx(cellSpacing) {
77740
77740
  const asPx = (cellSpacing.type ?? "").toLowerCase() === "dxa" && v >= 20 ? v / TWIPS_PER_PX : v;
77741
77741
  return Math.max(0, asPx);
77742
77742
  }
77743
+ function getBorderBandProfile(value) {
77744
+ if (value == null || typeof value !== "object")
77745
+ return null;
77746
+ if ("none" in value && value.none)
77747
+ return null;
77748
+ const raw = value;
77749
+ if (!raw.style)
77750
+ return null;
77751
+ const formula = COMPOUND_PROFILES[raw.style];
77752
+ if (!formula)
77753
+ return null;
77754
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
77755
+ if (w <= 0)
77756
+ return null;
77757
+ const segments = formula(w).map((s) => Math.max(1, s));
77758
+ return {
77759
+ segments,
77760
+ band: segments.reduce((sum, s) => sum + s, 0)
77761
+ };
77762
+ }
77763
+ function getBorderBandWidthPx(value) {
77764
+ if (value == null)
77765
+ return 0;
77766
+ if (typeof value !== "object")
77767
+ return 0;
77768
+ if ("none" in value && value.none)
77769
+ return 0;
77770
+ const raw = value;
77771
+ if (raw.style === "none")
77772
+ return 0;
77773
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
77774
+ const width = Math.max(0, w);
77775
+ if (width === 0)
77776
+ return 0;
77777
+ if (raw.style === "thick")
77778
+ return Math.max(width, 1);
77779
+ const profile = getBorderBandProfile(value);
77780
+ if (profile)
77781
+ return profile.band;
77782
+ return width;
77783
+ }
77784
+ function isNativeCssDoubleStyle(style) {
77785
+ return style === "double";
77786
+ }
77743
77787
  function coerceRelativeHeight(raw) {
77744
77788
  if (typeof raw === "number" && Number.isFinite(raw))
77745
77789
  return raw;
@@ -79347,6 +79391,11 @@ function resolveConditionalProps(propertyType, styleType, styleId, translatedLin
79347
79391
  const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
79348
79392
  if (props)
79349
79393
  chain.push(props);
79394
+ if (styleType === "wholeTable" && propertyType === "tableCellProperties") {
79395
+ const baseProps = def?.tableCellProperties;
79396
+ if (baseProps)
79397
+ chain.push(baseProps);
79398
+ }
79350
79399
  currentId = def?.basedOn;
79351
79400
  }
79352
79401
  if (chain.length === 0)
@@ -79360,7 +79409,7 @@ function resolveCellStyles(propertyType, tableInfo, translatedLinkedStyles) {
79360
79409
  const cellStyleProps = [];
79361
79410
  const tableStyleId = tableInfo.tableProperties.tableStyleId;
79362
79411
  const { rowBandSize, colBandSize } = resolveEffectiveBandSizes(tableStyleId, translatedLinkedStyles);
79363
- determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle).forEach((styleType) => {
79412
+ determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle, tableInfo.gridColumnStart, tableInfo.gridColumnSpan, tableInfo.numGridCols).forEach((styleType) => {
79364
79413
  const typeProps = resolveConditionalProps(propertyType, styleType, tableStyleId, translatedLinkedStyles);
79365
79414
  if (typeProps)
79366
79415
  cellStyleProps.push(typeProps);
@@ -79378,12 +79427,15 @@ function resolveTableCellProperties(inlineProps, tableInfo, translatedLinkedStyl
79378
79427
  chain.push(inlineProps);
79379
79428
  return combineProperties(chain, { fullOverrideProps: ["shading"] });
79380
79429
  }
79381
- function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
79430
+ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle, gridColumnStart, gridColumnSpan, numGridCols) {
79382
79431
  const applicable = new Set(["wholeTable"]);
79383
79432
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
79384
79433
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
79434
+ const columnStart = gridColumnStart ?? cellIndex;
79435
+ const columnEnd = columnStart + (gridColumnSpan ?? 1);
79436
+ const columnCount = numGridCols != null && numCells != null ? Math.max(numGridCols, numCells) : numGridCols ?? numCells;
79385
79437
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
79386
- const bandColIndex = Math.max(0, cellIndex - (tblLook?.firstColumn ? 1 : 0));
79438
+ const bandColIndex = Math.max(0, columnStart - (tblLook?.firstColumn ? 1 : 0));
79387
79439
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
79388
79440
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
79389
79441
  if (!tblLook?.noHBand)
@@ -79392,8 +79444,8 @@ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells
79392
79444
  applicable.add(colGroup % 2 === 0 ? "band1Vert" : "band2Vert");
79393
79445
  const isFirstRow = !!tblLook?.firstRow && rowIndex === 0;
79394
79446
  const isLastRow = !!tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1;
79395
- const isFirstCol = !!tblLook?.firstColumn && cellIndex === 0;
79396
- const isLastCol = !!tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1;
79447
+ const isFirstCol = !!tblLook?.firstColumn && columnStart === 0;
79448
+ const isLastCol = !!tblLook?.lastColumn && columnCount != null && columnCount > 0 && columnEnd >= columnCount;
79397
79449
  if (isFirstRow)
79398
79450
  applicable.add("firstRow");
79399
79451
  if (isFirstCol)
@@ -104735,34 +104787,62 @@ function hydrateImageBlocks(blocks, mediaFiles) {
104735
104787
  if (blk.kind === "drawing") {
104736
104788
  const drawingBlock = blk;
104737
104789
  if (drawingBlock.drawingKind === "vectorShape" || drawingBlock.drawingKind === "textboxShape") {
104738
- const parts = drawingBlock.textContent?.parts;
104739
- if (!parts || parts.length === 0)
104740
- return blk;
104741
- let partsChanged = false;
104742
- const hydratedParts = parts.map((part) => {
104743
- if (part?.kind !== "image" || !part.src || part.src.startsWith("data:"))
104790
+ let blockChanged = false;
104791
+ let nextBlock = drawingBlock;
104792
+ if (drawingBlock.drawingKind === "textboxShape") {
104793
+ const contentBlocks = drawingBlock.contentBlocks;
104794
+ if (Array.isArray(contentBlocks) && contentBlocks.length > 0) {
104795
+ let contentBlocksChanged = false;
104796
+ const hydratedContentBlocks = contentBlocks.map((paragraphBlock) => {
104797
+ if (paragraphBlock.kind !== "paragraph" || !paragraphBlock.runs?.length)
104798
+ return paragraphBlock;
104799
+ const hydratedRuns = hydrateRuns(paragraphBlock.runs);
104800
+ if (hydratedRuns !== paragraphBlock.runs) {
104801
+ contentBlocksChanged = true;
104802
+ return {
104803
+ ...paragraphBlock,
104804
+ runs: hydratedRuns
104805
+ };
104806
+ }
104807
+ return paragraphBlock;
104808
+ });
104809
+ if (contentBlocksChanged) {
104810
+ blockChanged = true;
104811
+ nextBlock = {
104812
+ ...drawingBlock,
104813
+ contentBlocks: hydratedContentBlocks
104814
+ };
104815
+ }
104816
+ }
104817
+ }
104818
+ const parts = nextBlock.textContent?.parts;
104819
+ if (parts && parts.length > 0) {
104820
+ let partsChanged = false;
104821
+ const hydratedParts = parts.map((part) => {
104822
+ if (part?.kind !== "image" || !part.src || part.src.startsWith("data:"))
104823
+ return part;
104824
+ const resolvedSrc = resolveImageSrc(part.src, part.rId, undefined, part.extension);
104825
+ if (resolvedSrc) {
104826
+ partsChanged = true;
104827
+ return {
104828
+ ...part,
104829
+ src: resolvedSrc
104830
+ };
104831
+ }
104744
104832
  return part;
104745
- const resolvedSrc = resolveImageSrc(part.src, part.rId, undefined, part.extension);
104746
- if (resolvedSrc) {
104747
- partsChanged = true;
104748
- return {
104749
- ...part,
104750
- src: resolvedSrc
104833
+ });
104834
+ if (partsChanged) {
104835
+ blockChanged = true;
104836
+ nextBlock = {
104837
+ ...nextBlock,
104838
+ textContent: {
104839
+ ...nextBlock.textContent,
104840
+ parts: hydratedParts
104841
+ }
104751
104842
  };
104752
104843
  }
104753
- return part;
104754
- });
104755
- if (partsChanged) {
104756
- const vectorShapeBlock = drawingBlock;
104757
- return {
104758
- ...vectorShapeBlock,
104759
- textContent: {
104760
- ...vectorShapeBlock.textContent,
104761
- parts: hydratedParts
104762
- }
104763
- };
104764
104844
  }
104765
- return blk;
104845
+ return blockChanged ? nextBlock : blk;
104766
104846
  }
104767
104847
  if (drawingBlock.drawingKind !== "shapeGroup")
104768
104848
  return blk;
@@ -106927,6 +107007,7 @@ function shapeContainerNodeToDrawingBlock(node3, nextBlockId, positions) {
106927
107007
  const textContent = shapeTextboxNode ? extractTextboxTextContent(shapeTextboxNode) : undefined;
106928
107008
  return buildDrawingBlock({
106929
107009
  ...rawAttrs,
107010
+ ...resolveInlineAlignmentFromWrapper(rawAttrs),
106930
107011
  ...textContent ? { textContent } : {},
106931
107012
  ...rawAttrs.textAlign == null && textContent?.horizontalAlign ? { textAlign: textContent.horizontalAlign } : {},
106932
107013
  ...rawAttrs.textInsets == null ? { textInsets: resolveTextboxInsetsFromAttrs(textboxAttrs) } : {},
@@ -107217,10 +107298,40 @@ function normalizeLegacyBorderStyle(value) {
107217
107298
  return "dotDash";
107218
107299
  case "dotdotdash":
107219
107300
  return "dotDotDash";
107301
+ case "dashsmallgap":
107302
+ return "dashSmallGap";
107303
+ case "thinthicksmallgap":
107304
+ return "thinThickSmallGap";
107305
+ case "thickthinsmallgap":
107306
+ return "thickThinSmallGap";
107307
+ case "thinthickthinsmallgap":
107308
+ return "thinThickThinSmallGap";
107309
+ case "thinthickmediumgap":
107310
+ return "thinThickMediumGap";
107311
+ case "thickthinmediumgap":
107312
+ return "thickThinMediumGap";
107313
+ case "thinthickthinmediumgap":
107314
+ return "thinThickThinMediumGap";
107315
+ case "thinthicklargegap":
107316
+ return "thinThickLargeGap";
107317
+ case "thickthinlargegap":
107318
+ return "thickThinLargeGap";
107319
+ case "thinthickthinlargegap":
107320
+ return "thinThickThinLargeGap";
107220
107321
  case "wave":
107221
107322
  return "wave";
107222
107323
  case "doublewave":
107223
107324
  return "doubleWave";
107325
+ case "dashdotstroked":
107326
+ return "dashDotStroked";
107327
+ case "threedemboss":
107328
+ return "threeDEmboss";
107329
+ case "threedengrave":
107330
+ return "threeDEngrave";
107331
+ case "outset":
107332
+ return "outset";
107333
+ case "inset":
107334
+ return "inset";
107224
107335
  case "single":
107225
107336
  default:
107226
107337
  return "single";
@@ -107331,14 +107442,21 @@ function tableNodeToBlock(node3, { nextBlockId, positions, storyKey, trackedChan
107331
107442
  tableStyleId: effectiveStyleId ?? undefined
107332
107443
  } : undefined;
107333
107444
  const rows = [];
107445
+ const grid = node3.attrs?.grid;
107446
+ const numGridCols = Array.isArray(grid) && grid.length > 0 ? grid.length : undefined;
107447
+ let activeRowSpans = [];
107334
107448
  node3.content.forEach((rowNode, rowIndex) => {
107449
+ const { placements, nextActiveRowSpans } = placeRowCellsOnGrid(rowNode, activeRowSpans);
107450
+ activeRowSpans = nextActiveRowSpans;
107335
107451
  const parsedRow = parseTableRow({
107336
107452
  rowNode,
107337
107453
  rowIndex,
107338
107454
  numRows: node3?.content?.length ?? 1,
107339
107455
  context: parserDeps,
107340
107456
  defaultCellPadding,
107341
- tableProperties: tablePropertiesForCascade
107457
+ tableProperties: tablePropertiesForCascade,
107458
+ cellGridPlacements: placements,
107459
+ numGridCols
107342
107460
  });
107343
107461
  if (parsedRow) {
107344
107462
  if (!shouldHideTrackedNode(parsedRow.attrs?.trackedChange, parserDeps.trackedChangesConfig))
@@ -117046,7 +117164,7 @@ var isRegExp = (value) => {
117046
117164
  return true;
117047
117165
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
117048
117166
  return objectIncludes(attrsA, attrsB);
117049
- }, 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) => {
117167
+ }, 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) => {
117050
117168
  const radians = shadow.direction * Math.PI / 180;
117051
117169
  return {
117052
117170
  dx: shadow.distance * Math.cos(radians),
@@ -135146,6 +135264,37 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135146
135264
  required.bottom = Math.max(required.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
135147
135265
  }
135148
135266
  return hasEffectExtent(required) ? required : undefined;
135267
+ }, resolveWrapperAlignment = (justification) => {
135268
+ switch (justification) {
135269
+ case "center":
135270
+ case "distribute":
135271
+ return "center";
135272
+ case "right":
135273
+ case "end":
135274
+ return "right";
135275
+ default:
135276
+ return;
135277
+ }
135278
+ }, resolveInlineAlignmentFromWrapper = (rawAttrs) => {
135279
+ if (rawAttrs.wrap?.type !== "Inline" || !isPlainObject3(rawAttrs.wrapperParagraph))
135280
+ return {};
135281
+ const wrapper = rawAttrs.wrapperParagraph;
135282
+ const justification = (isPlainObject3(wrapper.paragraphProperties) ? wrapper.paragraphProperties : undefined)?.justification;
135283
+ const textAlign = typeof wrapper.textAlign === "string" ? wrapper.textAlign : undefined;
135284
+ const effectiveAlignment = resolveWrapperAlignment(justification) ?? textAlign;
135285
+ if (effectiveAlignment !== "center" && effectiveAlignment !== "right")
135286
+ return {};
135287
+ const metadata = { inlineParagraphAlignment: effectiveAlignment };
135288
+ const { paragraphAttrs } = computeParagraphAttrs({
135289
+ type: "paragraph",
135290
+ attrs: wrapper
135291
+ });
135292
+ const indent2 = paragraphAttrs.indent;
135293
+ if (typeof indent2?.left === "number")
135294
+ metadata.paragraphIndentLeft = indent2.left;
135295
+ if (typeof indent2?.right === "number")
135296
+ metadata.paragraphIndentRight = indent2.right;
135297
+ return metadata;
135149
135298
  }, getAttrs$1 = (node3) => {
135150
135299
  return isPlainObject3(node3.attrs) ? { ...node3.attrs } : {};
135151
135300
  }, parseFullWidth = (value) => {
@@ -135528,6 +135677,39 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135528
135677
  value: measurement.value,
135529
135678
  type: measurement.type ?? "px"
135530
135679
  };
135680
+ }, placeRowCellsOnGrid = (rowNode, activeRowSpans) => {
135681
+ const placements = [];
135682
+ const nextActiveRowSpans = activeRowSpans.map((count2) => Math.max(0, count2 - 1));
135683
+ let column = 0;
135684
+ const cellSpan = (cellNode) => {
135685
+ const colspan = cellNode.attrs?.colspan;
135686
+ if (typeof colspan === "number" && colspan > 0)
135687
+ return colspan;
135688
+ const colwidth = cellNode.attrs?.colwidth;
135689
+ return Array.isArray(colwidth) && colwidth.length > 0 ? colwidth.length : 1;
135690
+ };
135691
+ for (const cellNode of Array.isArray(rowNode.content) ? rowNode.content : []) {
135692
+ if (!isTableCellNode(cellNode)) {
135693
+ placements.push(null);
135694
+ continue;
135695
+ }
135696
+ while ((activeRowSpans[column] ?? 0) > 0)
135697
+ column += 1;
135698
+ const span = cellSpan(cellNode);
135699
+ placements.push({
135700
+ gridColumnStart: column,
135701
+ gridColumnSpan: span
135702
+ });
135703
+ const rowspan = typeof cellNode.attrs?.rowspan === "number" ? cellNode.attrs.rowspan : 1;
135704
+ if (rowspan > 1)
135705
+ for (let covered = column;covered < column + span; covered += 1)
135706
+ nextActiveRowSpans[covered] = Math.max(nextActiveRowSpans[covered] ?? 0, rowspan - 1);
135707
+ column += span;
135708
+ }
135709
+ return {
135710
+ placements,
135711
+ nextActiveRowSpans
135712
+ };
135531
135713
  }, isTableRowNode = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", isTableSkipPlaceholderCell = (node3) => {
135532
135714
  const placeholder = node3.attrs?.__placeholder;
135533
135715
  return placeholder === "gridBefore" || placeholder === "gridAfter";
@@ -135570,7 +135752,12 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135570
135752
  numCells,
135571
135753
  numRows,
135572
135754
  rowCnfStyle,
135573
- cellCnfStyle
135755
+ cellCnfStyle,
135756
+ ...args2.gridPlacement != null && args2.numGridCols != null ? {
135757
+ gridColumnStart: args2.gridPlacement.gridColumnStart,
135758
+ gridColumnSpan: args2.gridPlacement.gridColumnSpan,
135759
+ numGridCols: args2.numGridCols
135760
+ } : {}
135574
135761
  } : undefined;
135575
135762
  const inlineTcProps = cellNode.attrs?.tableCellProperties;
135576
135763
  const resolvedTcProps = resolveTableCellProperties(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
@@ -135861,7 +136048,9 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135861
136048
  tableProperties,
135862
136049
  numCells: rowNode?.content?.length || 1,
135863
136050
  numRows,
135864
- rowCnfStyle
136051
+ rowCnfStyle,
136052
+ gridPlacement: args2.cellGridPlacements?.[cellIndex] ?? null,
136053
+ numGridCols: args2.numGridCols
135865
136054
  });
135866
136055
  if (parsedCell)
135867
136056
  cells.push(parsedCell);
@@ -136448,7 +136637,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136448
136637
  state.kern = kernNode.attributes["w:val"];
136449
136638
  }
136450
136639
  }, SuperConverter;
136451
- var init_SuperConverter_DRKaQwZS_es = __esm(() => {
136640
+ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
136452
136641
  init_rolldown_runtime_Bg48TavK_es();
136453
136642
  init_jszip_C49i9kUs_es();
136454
136643
  init_xml_js_CqGKpaft_es();
@@ -140894,6 +141083,71 @@ var init_SuperConverter_DRKaQwZS_es = __esm(() => {
140894
141083
  "highlight",
140895
141084
  "link"
140896
141085
  ];
141086
+ COMPOUND_PROFILES = {
141087
+ double: (w) => [
141088
+ w,
141089
+ w,
141090
+ w
141091
+ ],
141092
+ triple: (w) => [
141093
+ w,
141094
+ w,
141095
+ w,
141096
+ w,
141097
+ w
141098
+ ],
141099
+ thinThickSmallGap: (w) => [
141100
+ w,
141101
+ PT_075,
141102
+ PT_075
141103
+ ],
141104
+ thickThinSmallGap: (w) => [
141105
+ PT_075,
141106
+ PT_075,
141107
+ w
141108
+ ],
141109
+ thinThickMediumGap: (w) => [
141110
+ w,
141111
+ w / 2,
141112
+ w / 2
141113
+ ],
141114
+ thickThinMediumGap: (w) => [
141115
+ w / 2,
141116
+ w / 2,
141117
+ w
141118
+ ],
141119
+ thinThickLargeGap: (w) => [
141120
+ PT_150,
141121
+ w,
141122
+ PT_075
141123
+ ],
141124
+ thickThinLargeGap: (w) => [
141125
+ PT_075,
141126
+ w,
141127
+ PT_150
141128
+ ],
141129
+ thinThickThinSmallGap: (w) => [
141130
+ PT_075,
141131
+ PT_075,
141132
+ w,
141133
+ PT_075,
141134
+ PT_075
141135
+ ],
141136
+ thinThickThinMediumGap: (w) => [
141137
+ w / 2,
141138
+ w / 2,
141139
+ w,
141140
+ w / 2,
141141
+ w / 2
141142
+ ],
141143
+ thinThickThinLargeGap: (w) => [
141144
+ PT_075,
141145
+ w,
141146
+ PT_150,
141147
+ w,
141148
+ PT_075
141149
+ ]
141150
+ };
140897
141151
  SPACE_CHARS = new Set([" ", " "]);
140898
141152
  idlessSdtContainerKeys = /* @__PURE__ */ new WeakMap;
140899
141153
  DRAWING_DIAGNOSTIC_CODES = {
@@ -163719,13 +163973,28 @@ var init_SuperConverter_DRKaQwZS_es = __esm(() => {
163719
163973
  "single",
163720
163974
  "double",
163721
163975
  "dashed",
163976
+ "dashSmallGap",
163722
163977
  "dotted",
163723
163978
  "thick",
163724
163979
  "triple",
163725
163980
  "dotDash",
163726
163981
  "dotDotDash",
163982
+ "thinThickSmallGap",
163983
+ "thickThinSmallGap",
163984
+ "thinThickThinSmallGap",
163985
+ "thinThickMediumGap",
163986
+ "thickThinMediumGap",
163987
+ "thinThickThinMediumGap",
163988
+ "thinThickLargeGap",
163989
+ "thickThinLargeGap",
163990
+ "thinThickThinLargeGap",
163727
163991
  "wave",
163728
- "doubleWave"
163992
+ "doubleWave",
163993
+ "dashDotStroked",
163994
+ "threeDEmboss",
163995
+ "threeDEngrave",
163996
+ "outset",
163997
+ "inset"
163729
163998
  ]);
163730
163999
  FONT_FAMILY_FALLBACKS$1 = Object.freeze({
163731
164000
  swiss: "Arial, sans-serif",
@@ -165374,7 +165643,7 @@ var init_SuperConverter_DRKaQwZS_es = __esm(() => {
165374
165643
  };
165375
165644
  });
165376
165645
 
165377
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-ChACxHAH.es.js
165646
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-PSeH6IV5.es.js
165378
165647
  function parseSizeUnit(val = "0") {
165379
165648
  const length3 = val.toString() || "0";
165380
165649
  const value = Number.parseFloat(length3);
@@ -176177,9 +176446,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
176177
176446
  }
176178
176447
  };
176179
176448
  };
176180
- var init_create_headless_toolbar_ChACxHAH_es = __esm(() => {
176449
+ var init_create_headless_toolbar_PSeH6IV5_es = __esm(() => {
176181
176450
  init_rolldown_runtime_Bg48TavK_es();
176182
- init_SuperConverter_DRKaQwZS_es();
176451
+ init_SuperConverter_Ed3nFN54_es();
176183
176452
  init_jszip_C49i9kUs_es();
176184
176453
  init_uuid_B2wVPhPi_es();
176185
176454
  init_constants_D9qj59G2_es();
@@ -226272,7 +226541,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226272
226541
  init_remark_gfm_BUJjZJLy_es();
226273
226542
  });
226274
226543
 
226275
- // ../../packages/superdoc/dist/chunks/src-ly1ZYfUZ.es.js
226544
+ // ../../packages/superdoc/dist/chunks/src-bMRzO9Kl.es.js
226276
226545
  function deleteProps(obj, propOrProps) {
226277
226546
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226278
226547
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -231117,6 +231386,12 @@ function updateTableWrapper(tableWrapper, table2) {
231117
231386
  borderWidth = Math.ceil(Math.max(borderLeftMax, borderRightMax));
231118
231387
  tableWrapper.style.setProperty("--table-border-width", `${borderWidth || defaultBorderWidth}px`);
231119
231388
  }
231389
+ function cellWidthDxa(widthPx) {
231390
+ return {
231391
+ value: widthPx * 15,
231392
+ type: "dxa"
231393
+ };
231394
+ }
231120
231395
  function cloneBorders(borders, sides) {
231121
231396
  if (!borders || typeof borders !== "object")
231122
231397
  return {};
@@ -270293,6 +270568,19 @@ function countHeaderRows(block) {
270293
270568
  break;
270294
270569
  return count2;
270295
270570
  }
270571
+ function countRepeatableHeaderRows(block) {
270572
+ const headerCount = countHeaderRows(block);
270573
+ if (headerCount === 0)
270574
+ return 0;
270575
+ let bandEnd = headerCount;
270576
+ for (let r$1 = 0;r$1 < headerCount && r$1 < block.rows.length; r$1++)
270577
+ for (const cell2 of block.rows[r$1]?.cells ?? []) {
270578
+ const rowSpan = cell2.rowSpan ?? 1;
270579
+ if (rowSpan > 1)
270580
+ bandEnd = Math.max(bandEnd, r$1 + rowSpan);
270581
+ }
270582
+ return Math.min(bandEnd, block.rows.length);
270583
+ }
270296
270584
  function sumRowHeights(rows, fromRow, toRow) {
270297
270585
  let total = 0;
270298
270586
  for (let i3 = fromRow;i3 < toRow && i3 < rows.length; i3++)
@@ -270677,7 +270965,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
270677
270965
  });
270678
270966
  return;
270679
270967
  }
270680
- const headerCount = countHeaderRows(block);
270968
+ const headerCount = countRepeatableHeaderRows(block);
270681
270969
  const headerPrefixHeights = [0];
270682
270970
  for (let i3 = 0;i3 < headerCount; i3 += 1)
270683
270971
  headerPrefixHeights.push(headerPrefixHeights[i3] + (measure.rows[i3]?.height ?? 0));
@@ -271576,7 +271864,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
271576
271864
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
271577
271865
  const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
271578
271866
  const rawWrap = attrs?.wrap;
271579
- const isInlineShapeGroup = block.drawingKind === "shapeGroup" && rawWrap?.type === "Inline";
271867
+ const isInlineAlignableDrawing = (block.drawingKind === "shapeGroup" || block.drawingKind === "textboxShape") && rawWrap?.type === "Inline";
271580
271868
  const inlineParagraphAlignment = attrs?.inlineParagraphAlignment === "center" || attrs?.inlineParagraphAlignment === "right" ? attrs.inlineParagraphAlignment : undefined;
271581
271869
  if (width > maxWidthForBlock && maxWidthForBlock > 0) {
271582
271870
  const scale = maxWidthForBlock / width;
@@ -271595,7 +271883,7 @@ function layoutDrawingBlock({ block, measure, columns, ensurePage, advanceColumn
271595
271883
  state = advanceColumn(state);
271596
271884
  const pmRange = extractBlockPmRange(block);
271597
271885
  let x = columnX(state) + marginLeft + indentLeft;
271598
- if (isInlineShapeGroup && inlineParagraphAlignment) {
271886
+ if (isInlineAlignableDrawing && inlineParagraphAlignment) {
271599
271887
  const pIndentLeft = typeof attrs?.paragraphIndentLeft === "number" ? attrs.paragraphIndentLeft : 0;
271600
271888
  const pIndentRight = typeof attrs?.paragraphIndentRight === "number" ? attrs.paragraphIndentRight : 0;
271601
271889
  const alignBox = Math.max(0, maxWidthForBlock - pIndentLeft - pIndentRight);
@@ -275920,6 +276208,17 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
275920
276208
  endChar = text5.length > 0 ? text5.length : start$1 + 1;
275921
276209
  continue;
275922
276210
  }
276211
+ if (text5.length === 0 && isAtomicLayoutRun(run2)) {
276212
+ const atomicWidth = getAtomicRunLayoutWidth(run2);
276213
+ if (width > 0 && width + atomicWidth > effectiveMaxWidth - WIDTH_FUDGE_PX) {
276214
+ didBreakInThisLine = true;
276215
+ break;
276216
+ }
276217
+ width += atomicWidth;
276218
+ endRun = r$1;
276219
+ endChar = 1;
276220
+ continue;
276221
+ }
275923
276222
  for (let c = start$1;c < text5.length; c += 1) {
275924
276223
  const ch = text5[c];
275925
276224
  if (ch === "\t") {
@@ -276008,6 +276307,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
276008
276307
  endRun = startRun;
276009
276308
  endChar = startChar + 1;
276010
276309
  }
276310
+ const lineMaxAtomicHeight = getLineMaxAtomicHeight(runs2, startRun, startChar, endRun, endChar);
276011
276311
  const line = {
276012
276312
  fromRun: startRun,
276013
276313
  fromChar: startChar,
@@ -276016,8 +276316,9 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
276016
276316
  width,
276017
276317
  ascent: 0,
276018
276318
  descent: 0,
276019
- lineHeight: lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize),
276020
- maxWidth: effectiveMaxWidth
276319
+ lineHeight: Math.max(lineHeightForRuns(runs2, startRun, endRun, lastMeasuredFontSize), lineMaxAtomicHeight),
276320
+ maxWidth: effectiveMaxWidth,
276321
+ ...lineMaxAtomicHeight > 0 ? { maxImageHeight: lineMaxAtomicHeight } : {}
276021
276322
  };
276022
276323
  lines.push(line);
276023
276324
  if (lineMaxTextFontSize > 0)
@@ -283469,12 +283770,14 @@ function computeAutoFitColumnWidths(input2) {
283469
283770
  const currentWidths = fixedLayout.columnWidths.slice(0, gridColumnCount);
283470
283771
  const minBounds = new Array(gridColumnCount).fill(0);
283471
283772
  const maxBounds = new Array(gridColumnCount).fill(0);
283773
+ const textBounds = new Array(gridColumnCount).fill(0);
283472
283774
  const preferredOverrides = new Array(gridColumnCount).fill(undefined);
283473
283775
  const multiSpanCells = [];
283474
283776
  accumulateBounds({
283475
283777
  rows: normalizedRows,
283476
283778
  minBounds,
283477
283779
  maxBounds,
283780
+ textBounds,
283478
283781
  preferredOverrides,
283479
283782
  multiSpanCells
283480
283783
  });
@@ -283497,7 +283800,26 @@ function computeAutoFitColumnWidths(input2) {
283497
283800
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
283498
283801
  } else {
283499
283802
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
283500
- if (!shouldPreservePreferredGrid) {
283803
+ if (workingInput.contentSizeAutoTable === true) {
283804
+ const columnBandAllowances = workingInput.columnBandAllowances;
283805
+ resolvedWidths = maxBounds.map((max$2, index2) => {
283806
+ const allowance = columnBandAllowances?.[index2] ?? 0;
283807
+ const withAllowance = Math.max(max$2, minBounds[index2]) + allowance;
283808
+ const textFloor = textBounds[index2] + allowance * 2;
283809
+ return Math.max(withAllowance, textFloor);
283810
+ });
283811
+ for (const spanCell of multiSpanCells) {
283812
+ const covered = resolvedWidths.slice(spanCell.startColumn, spanCell.startColumn + spanCell.span);
283813
+ const currentTotal = sumWidths$1(covered);
283814
+ const demand = spanCell.preferredWidth ?? spanCell.maxContentWidth;
283815
+ if (currentTotal < demand && covered.length > 0) {
283816
+ const topUp = (demand - currentTotal) / covered.length;
283817
+ for (let index2 = 0;index2 < covered.length; index2++)
283818
+ resolvedWidths[spanCell.startColumn + index2] += topUp;
283819
+ }
283820
+ }
283821
+ targetTableWidth = Math.min(sumWidths$1(resolvedWidths), maxResolvedTableWidth);
283822
+ } else if (!shouldPreservePreferredGrid) {
283501
283823
  resolvedWidths = redistributeTowardMaximumsWithinCurrentTable(resolvedWidths, minBounds, maxBounds);
283502
283824
  resolvedWidths = redistributeTowardContentWeightedShape(resolvedWidths, minBounds, maxBounds);
283503
283825
  }
@@ -283559,7 +283881,8 @@ function resolveAutoFitContext(input2) {
283559
283881
  span: cell2.span,
283560
283882
  preferredWidth: cell2.preferredWidth,
283561
283883
  minContentWidth: cell2.minContentWidth,
283562
- maxContentWidth: cell2.maxContentWidth
283884
+ maxContentWidth: cell2.maxContentWidth,
283885
+ horizontalInsets: cell2.horizontalInsets
283563
283886
  }))
283564
283887
  })),
283565
283888
  minColumnWidth
@@ -283592,7 +283915,8 @@ function normalizeLegacyRows(rows) {
283592
283915
  span,
283593
283916
  preferredWidth: sanitizeOptionalWidth(cell2.preferredWidth),
283594
283917
  minContentWidth: Math.max(0, cell2.minContentWidth ?? 0),
283595
- maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0)
283918
+ maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0),
283919
+ horizontalInsets: Math.max(0, cell2.horizontalInsets ?? 0)
283596
283920
  });
283597
283921
  columnIndex += span;
283598
283922
  }
@@ -283629,7 +283953,8 @@ function buildNormalizedRows(workingInput, rowMetrics) {
283629
283953
  span: Math.max(1, placedCell.span ?? metrics?.span ?? 1),
283630
283954
  preferredWidth: sanitizeOptionalWidth(metrics?.preferredWidth ?? placedCell.preferredWidth),
283631
283955
  minContentWidth: Math.max(0, metrics?.minContentWidth ?? 0),
283632
- maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0)
283956
+ maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0),
283957
+ horizontalInsets: Math.max(0, metrics?.horizontalInsets ?? 0)
283633
283958
  };
283634
283959
  }),
283635
283960
  skippedColumns: (workingRow.skippedColumns ?? []).map((skipped) => ({
@@ -283643,7 +283968,7 @@ function buildNormalizedRows(workingInput, rowMetrics) {
283643
283968
  });
283644
283969
  }
283645
283970
  function accumulateBounds(args$1) {
283646
- const { rows, minBounds, maxBounds, preferredOverrides, multiSpanCells } = args$1;
283971
+ const { rows, minBounds, maxBounds, textBounds, preferredOverrides, multiSpanCells } = args$1;
283647
283972
  for (const row2 of rows) {
283648
283973
  for (const skipped of row2.skippedColumns) {
283649
283974
  minBounds[skipped.columnIndex] = Math.max(minBounds[skipped.columnIndex], skipped.minContentWidth);
@@ -283655,6 +283980,7 @@ function accumulateBounds(args$1) {
283655
283980
  if (cell2.span === 1) {
283656
283981
  minBounds[cell2.startColumn] = Math.max(minBounds[cell2.startColumn], cell2.minContentWidth);
283657
283982
  maxBounds[cell2.startColumn] = Math.max(maxBounds[cell2.startColumn], cell2.maxContentWidth);
283983
+ textBounds[cell2.startColumn] = Math.max(textBounds[cell2.startColumn], Math.max(0, cell2.maxContentWidth - cell2.horizontalInsets));
283658
283984
  if (preferredOverrides[cell2.startColumn] == null && cell2.preferredWidth != null)
283659
283985
  preferredOverrides[cell2.startColumn] = cell2.preferredWidth;
283660
283986
  } else
@@ -284098,16 +284424,29 @@ function buildAutoFitWorkingGridInput(block, constraints) {
284098
284424
  layoutMode,
284099
284425
  preferredColumnWidths,
284100
284426
  preferredTableWidth,
284101
- gridColumnCount
284427
+ gridColumnCount,
284428
+ rows
284102
284429
  });
284103
284430
  const preserveExplicitAutoGrid = shouldPreserveExplicitAutoGrid({
284104
284431
  layoutMode,
284432
+ tableWidth,
284105
284433
  preferredColumnWidths,
284106
284434
  preferredTableWidth,
284107
284435
  gridColumnCount,
284108
284436
  rows
284109
284437
  });
284110
- const autoGridWidthBudget = resolveAutoGridWidthBudget({
284438
+ const contentSizeAutoTable = resolveContentSizeAutoTable({
284439
+ layoutMode,
284440
+ tableWidth,
284441
+ preferredTableWidth,
284442
+ preferredColumnWidths,
284443
+ maxTableWidth,
284444
+ rows,
284445
+ preserveAutoGrid,
284446
+ preserveExplicitAutoGrid
284447
+ });
284448
+ const columnBandAllowances = contentSizeAutoTable ? resolveColumnBandAllowances(block.attrs?.borders, gridColumnCount) : undefined;
284449
+ const autoGridWidthBudget = contentSizeAutoTable ? undefined : resolveAutoGridWidthBudget({
284111
284450
  layoutMode,
284112
284451
  tableWidth,
284113
284452
  preferredColumnWidths,
@@ -284122,6 +284461,8 @@ function buildAutoFitWorkingGridInput(block, constraints) {
284122
284461
  ...preserveAutoGrid ? { preserveAutoGrid } : {},
284123
284462
  ...preserveExplicitAutoGrid ? { preserveExplicitAutoGrid } : {},
284124
284463
  ...autoGridWidthBudget != null ? { autoGridWidthBudget } : {},
284464
+ ...contentSizeAutoTable ? { contentSizeAutoTable } : {},
284465
+ ...columnBandAllowances ? { columnBandAllowances } : {},
284125
284466
  preferredTableWidth,
284126
284467
  preferredColumnWidths,
284127
284468
  gridColumnCount,
@@ -284143,19 +284484,21 @@ function shouldPreserveAuthoredGrid(args$1) {
284143
284484
  return approximatelyEqual(totalPreferredColumnWidth, preferredTableWidth) || isSlightlyUnderPreferredTableWidth(totalPreferredColumnWidth, preferredTableWidth);
284144
284485
  }
284145
284486
  function shouldPreserveAutoGrid(args$1) {
284146
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount } = args$1;
284487
+ const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
284147
284488
  if (layoutMode !== "autofit")
284148
284489
  return false;
284149
284490
  if (preferredTableWidth != null)
284150
284491
  return false;
284151
284492
  if (preferredColumnWidths.length === 0 || preferredColumnWidths.length !== gridColumnCount)
284152
284493
  return false;
284494
+ if (preferredColumnWidths.length === 1 && !hasConcreteCellWidthRequest(rows))
284495
+ return false;
284153
284496
  if (!hasNonUniformGrid(preferredColumnWidths))
284154
284497
  return false;
284155
284498
  return true;
284156
284499
  }
284157
284500
  function shouldPreserveExplicitAutoGrid(args$1) {
284158
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
284501
+ const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
284159
284502
  if (layoutMode !== "autofit")
284160
284503
  return false;
284161
284504
  if (preferredTableWidth == null || preferredTableWidth <= 0)
@@ -284164,8 +284507,52 @@ function shouldPreserveExplicitAutoGrid(args$1) {
284164
284507
  return false;
284165
284508
  if (!hasNonUniformGrid(preferredColumnWidths) && !hasConcreteCellWidthRequest(rows))
284166
284509
  return false;
284510
+ if (isPercentTableWidth(tableWidth))
284511
+ return true;
284167
284512
  return approximatelyEqual(sumWidths(preferredColumnWidths), preferredTableWidth);
284168
284513
  }
284514
+ function isPercentTableWidth(tableWidth) {
284515
+ return typeof tableWidth === "object" && tableWidth != null && typeof tableWidth.type === "string" && tableWidth.type.toLowerCase() === "pct";
284516
+ }
284517
+ function resolveContentSizeAutoTable(args$1) {
284518
+ const { layoutMode, tableWidth, preferredTableWidth, preferredColumnWidths, maxTableWidth, rows, preserveAutoGrid, preserveExplicitAutoGrid } = args$1;
284519
+ if (layoutMode !== "autofit")
284520
+ return false;
284521
+ if (preferredTableWidth != null)
284522
+ return false;
284523
+ if (preserveAutoGrid || preserveExplicitAutoGrid)
284524
+ return false;
284525
+ if (!isAutoOrNilTableWidth(tableWidth))
284526
+ return false;
284527
+ if (hasConcreteCellWidthRequest(rows))
284528
+ return false;
284529
+ if (sumWidths(preferredColumnWidths) > maxTableWidth + 0.5)
284530
+ return false;
284531
+ return true;
284532
+ }
284533
+ function isAutoOrNilTableWidth(tableWidth) {
284534
+ if (tableWidth == null)
284535
+ return true;
284536
+ if (hasAutoTableWidthSemantics(tableWidth))
284537
+ return true;
284538
+ if (typeof tableWidth === "object" && typeof tableWidth.type === "string")
284539
+ return tableWidth.type.toLowerCase() === "nil";
284540
+ return false;
284541
+ }
284542
+ function resolveColumnBandAllowances(borders, gridColumnCount) {
284543
+ if (gridColumnCount <= 0)
284544
+ return;
284545
+ const left$1 = getBorderBandWidthPx(borders?.left);
284546
+ const insideV = getBorderBandWidthPx(borders?.insideV);
284547
+ const right$1 = getBorderBandWidthPx(borders?.right);
284548
+ const allowances = [];
284549
+ for (let i3 = 0;i3 < gridColumnCount; i3++) {
284550
+ const edgeLeft = i3 === 0 ? left$1 : insideV;
284551
+ const edgeRight = i3 === gridColumnCount - 1 ? right$1 : insideV;
284552
+ allowances.push((edgeLeft + edgeRight) / 2);
284553
+ }
284554
+ return allowances.some((a2) => a2 > 0) ? allowances : undefined;
284555
+ }
284169
284556
  function resolveAutoGridWidthBudget(args$1) {
284170
284557
  const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, maxTableWidth } = args$1;
284171
284558
  if (layoutMode !== "autofit")
@@ -284466,7 +284853,8 @@ async function measureTableCellContentMetrics(cell2, options) {
284466
284853
  if (contentBlocks.length === 0) {
284467
284854
  const emptyMetrics = {
284468
284855
  minWidthPx: horizontalInsets,
284469
- maxWidthPx: horizontalInsets
284856
+ maxWidthPx: horizontalInsets,
284857
+ horizontalInsetsPx: horizontalInsets
284470
284858
  };
284471
284859
  tableCellMetricsCache.set(cacheKey, emptyMetrics);
284472
284860
  return emptyMetrics;
@@ -284480,7 +284868,8 @@ async function measureTableCellContentMetrics(cell2, options) {
284480
284868
  }
284481
284869
  const result = {
284482
284870
  minWidthPx: minContentWidthPx + horizontalInsets,
284483
- maxWidthPx: maxContentWidthPx + horizontalInsets
284871
+ maxWidthPx: maxContentWidthPx + horizontalInsets,
284872
+ horizontalInsetsPx: horizontalInsets
284484
284873
  };
284485
284874
  tableCellMetricsCache.set(cacheKey, result);
284486
284875
  return result;
@@ -284510,7 +284899,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
284510
284899
  span,
284511
284900
  preferredWidth: normalizedCell?.preferredWidth,
284512
284901
  minContentWidth: metrics.minWidthPx,
284513
- maxContentWidth: metrics.maxWidthPx
284902
+ maxContentWidth: metrics.maxWidthPx,
284903
+ horizontalInsets: metrics.horizontalInsetsPx
284514
284904
  };
284515
284905
  }))
284516
284906
  };
@@ -284525,7 +284915,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
284525
284915
  span: cellMetrics.span,
284526
284916
  preferredWidth: cellMetrics.preferredWidth,
284527
284917
  minContentWidth: cellMetrics.minContentWidth,
284528
- maxContentWidth: cellMetrics.maxContentWidth
284918
+ maxContentWidth: cellMetrics.maxContentWidth,
284919
+ horizontalInsets: cellMetrics.horizontalInsets
284529
284920
  })),
284530
284921
  skippedAfter: normalizedRow.skippedAfter ?? []
284531
284922
  };
@@ -284729,14 +285120,14 @@ function capitalizeText$1(text5, fullText, startOffset) {
284729
285120
  return result;
284730
285121
  }
284731
285122
  function measureFieldAnnotationWidth(run2, fontContext) {
284732
- const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1 : DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1;
285123
+ const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
284733
285124
  const font = buildFontString$1({
284734
285125
  fontFamily: normalizeFontFamily$1(run2.fontFamily ?? "Arial"),
284735
285126
  fontSize,
284736
285127
  bold: run2.bold,
284737
285128
  italic: run2.italic
284738
285129
  }, fontContext);
284739
- return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING$1);
285130
+ return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING);
284740
285131
  }
284741
285132
  function isExplicitLineBreakRun(run2) {
284742
285133
  return run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line";
@@ -284777,18 +285168,7 @@ function clearTextMeasurementCaches() {
284777
285168
  canvasContext = null;
284778
285169
  }
284779
285170
  function getTableBorderWidthPx(value) {
284780
- if (value == null)
284781
- return 0;
284782
- if (typeof value === "object" && "none" in value && value.none)
284783
- return 0;
284784
- const raw = value;
284785
- const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
284786
- const width = Math.max(0, w);
284787
- if (raw.style === "none")
284788
- return 0;
284789
- if (raw.style === "thick")
284790
- return Math.max(width * 2, 3);
284791
- return width;
285171
+ return getBorderBandWidthPx(value);
284792
285172
  }
284793
285173
  function getTableBorderWidths(borders) {
284794
285174
  return {
@@ -284922,6 +285302,15 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
284922
285302
  endRunIndex: runs2.length
284923
285303
  };
284924
285304
  let foundDecimal = false;
285305
+ const measureAtomicText$1 = (text5, atomicRun, fontSize) => {
285306
+ const { font } = buildFontString({
285307
+ fontFamily: atomicRun.fontFamily ?? "Arial",
285308
+ fontSize,
285309
+ bold: atomicRun.bold,
285310
+ italic: atomicRun.italic
285311
+ }, fontContext);
285312
+ return measureRunWidth(text5, font, ctx$1, atomicRun, 0);
285313
+ };
284925
285314
  for (let i3 = startRunIndex;i3 < runs2.length; i3++) {
284926
285315
  const run2 = runs2[i3];
284927
285316
  if (isTabRun(run2)) {
@@ -284963,40 +285352,13 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
284963
285352
  });
284964
285353
  continue;
284965
285354
  }
284966
- if (isImageRun(run2)) {
284967
- const leftSpace = run2.distLeft ?? 0;
284968
- const rightSpace = run2.distRight ?? 0;
284969
- const imageWidth = run2.width + leftSpace + rightSpace;
284970
- result.runs.push({
284971
- runIndex: i3,
284972
- width: imageWidth
284973
- });
284974
- result.totalWidth += imageWidth;
284975
- continue;
284976
- }
284977
- if (run2.kind === "math") {
284978
- const mathWidth = run2.width ?? 20;
284979
- result.runs.push({
284980
- runIndex: i3,
284981
- width: mathWidth
284982
- });
284983
- result.totalWidth += mathWidth;
284984
- continue;
284985
- }
284986
- if (isFieldAnnotationRun(run2)) {
284987
- const fontSize = run2.fontSize ?? DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
284988
- const { font } = buildFontString({
284989
- fontFamily: run2.fontFamily ?? "Arial",
284990
- fontSize,
284991
- bold: run2.bold,
284992
- italic: run2.italic
284993
- }, fontContext);
284994
- const pillWidth = (run2.displayLabel ? measureRunWidth(run2.displayLabel, font, ctx$1, run2, 0) : 0) + FIELD_ANNOTATION_PILL_PADDING;
285355
+ if (isImageRun(run2) || run2.kind === "math" || isFieldAnnotationRun(run2)) {
285356
+ const { width } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
284995
285357
  result.runs.push({
284996
285358
  runIndex: i3,
284997
- width: pillWidth
285359
+ width
284998
285360
  });
284999
- result.totalWidth += pillWidth;
285361
+ result.totalWidth += width;
285000
285362
  continue;
285001
285363
  }
285002
285364
  result.runs.push({
@@ -285026,6 +285388,13 @@ async function measureBlock(block, constraints, fontContext = DEFAULT_FONT_MEASU
285026
285388
  }
285027
285389
  async function measureParagraphBlock(block, maxWidth, fontContext) {
285028
285390
  const ctx$1 = getCanvasContext();
285391
+ const measureAtomicText$1 = (text5, run2, fontSize) => {
285392
+ const family2 = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
285393
+ const weight = run2.bold ? "bold" : "normal";
285394
+ ctx$1.font = `${run2.italic ? "italic" : "normal"} ${weight} ${fontSize}px ${family2}`;
285395
+ const displayText = applyTextTransform(text5, run2);
285396
+ return displayText ? ctx$1.measureText(displayText).width : 0;
285397
+ };
285029
285398
  const wordLayout = block.attrs?.wordLayout;
285030
285399
  const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
285031
285400
  const fallbackFontSize = normalizeFontSize2((firstTextRunWithSize ?? block.runs.find((run2) => typeof run2.fontSize === "number" && run2.fontSize > 0))?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
@@ -285555,12 +285924,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
285555
285924
  continue;
285556
285925
  }
285557
285926
  if (isImageRun(run2)) {
285558
- const leftSpace = run2.distLeft ?? 0;
285559
- const rightSpace = run2.distRight ?? 0;
285560
- const imageWidth = run2.width + leftSpace + rightSpace;
285561
- const topSpace = run2.distTop ?? 0;
285562
- const bottomSpace = run2.distBottom ?? 0;
285563
- const imageHeight = run2.height + topSpace + bottomSpace;
285927
+ const { width: imageWidth, height: imageHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
285564
285928
  let imageStartX;
285565
285929
  if (activeTabGroup && currentLine) {
285566
285930
  imageStartX = activeTabGroup.currentX;
@@ -285651,9 +286015,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
285651
286015
  continue;
285652
286016
  }
285653
286017
  if (run2.kind === "math") {
285654
- const mathRun = run2;
285655
- const mathWidth = mathRun.width ?? 20;
285656
- const mathHeight = mathRun.height ?? 24;
286018
+ const { width: mathWidth, height: mathHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
285657
286019
  if (!currentLine)
285658
286020
  currentLine = {
285659
286021
  fromRun: runIndex,
@@ -285690,26 +286052,7 @@ async function measureParagraphBlock(block, maxWidth, fontContext) {
285690
286052
  continue;
285691
286053
  }
285692
286054
  if (isFieldAnnotationRun(run2)) {
285693
- const displayText = applyTextTransform(run2.displayLabel || "", run2);
285694
- const annotationFontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
285695
- const annotationFontFamily = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif", faceOf(run2));
285696
- const fontWeight = run2.bold ? "bold" : "normal";
285697
- ctx$1.font = `${run2.italic ? "italic" : "normal"} ${fontWeight} ${annotationFontSize}px ${annotationFontFamily}`;
285698
- const textWidth = displayText ? ctx$1.measureText(displayText).width : 0;
285699
- const annotationHorizontalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING;
285700
- const annotationVerticalPadding = run2.highlighted === false ? 0 : FIELD_ANNOTATION_VERTICAL_PADDING;
285701
- const annotationWidth = textWidth + annotationHorizontalPadding;
285702
- let annotationHeight = annotationFontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + annotationVerticalPadding;
285703
- if (run2.variant === "signature" && run2.imageSrc) {
285704
- const signatureHeight = 28 + annotationVerticalPadding;
285705
- annotationHeight = Math.max(annotationHeight, signatureHeight);
285706
- }
285707
- if (run2.variant === "image" && run2.imageSrc && run2.size?.height) {
285708
- const imageHeight = run2.size.height + annotationVerticalPadding;
285709
- annotationHeight = Math.max(annotationHeight, imageHeight);
285710
- }
285711
- if (run2.variant === "html" && run2.size?.height)
285712
- annotationHeight = Math.max(annotationHeight, run2.size.height);
286055
+ const { width: annotationWidth, height: annotationHeight } = getAtomicRunLayoutSize(run2, measureAtomicText$1);
285713
286056
  let annotationStartX;
285714
286057
  if (pendingTabAlignment && currentLine)
285715
286058
  annotationStartX = alignPendingTabForWidth(annotationWidth);
@@ -286526,12 +286869,17 @@ async function measureTableBlock(block, constraints, fontContext) {
286526
286869
  });
286527
286870
  if (rowspan === 1)
286528
286871
  rowBaseHeights[rowIndex] = Math.max(rowBaseHeights[rowIndex], totalCellHeight);
286529
- else
286872
+ else {
286873
+ const firstBlockMeasure = blockMeasures[0];
286874
+ const firstLineHeight = firstBlockMeasure?.kind === "paragraph" && firstBlockMeasure.lines.length > 0 ? firstBlockMeasure.lines[0].lineHeight : undefined;
286875
+ const minRowHeight = Math.min(totalCellHeight, firstLineHeight != null ? firstLineHeight + paddingTop + paddingBottom : totalCellHeight / rowspan);
286530
286876
  spanConstraints.push({
286531
286877
  startRow: rowIndex,
286532
286878
  rowSpan: rowspan,
286533
- requiredHeight: totalCellHeight
286879
+ requiredHeight: totalCellHeight,
286880
+ minRowHeight
286534
286881
  });
286882
+ }
286535
286883
  gridColIndex += colspan;
286536
286884
  }
286537
286885
  for (let col = gridColIndex;col < gridColumnCount; col++)
@@ -286543,6 +286891,12 @@ async function measureTableBlock(block, constraints, fontContext) {
286543
286891
  });
286544
286892
  }
286545
286893
  const rowHeights = [...rowBaseHeights];
286894
+ for (const constraint of spanConstraints) {
286895
+ const spanLength = Math.min(constraint.rowSpan, rowHeights.length - constraint.startRow);
286896
+ for (let i3 = 0;i3 < spanLength; i3++)
286897
+ if (rowBaseHeights[constraint.startRow + i3] === 0)
286898
+ rowHeights[constraint.startRow + i3] = Math.max(rowHeights[constraint.startRow + i3], constraint.minRowHeight);
286899
+ }
286546
286900
  for (const constraint of spanConstraints) {
286547
286901
  const { startRow, rowSpan, requiredHeight } = constraint;
286548
286902
  if (rowSpan <= 0)
@@ -286557,6 +286911,34 @@ async function measureTableBlock(block, constraints, fontContext) {
286557
286911
  rowHeights[startRow + i3] += increment2;
286558
286912
  }
286559
286913
  }
286914
+ if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) !== "separate" && block.rows.length > 0) {
286915
+ const tableBordersForBands = block.attrs?.borders;
286916
+ const bandReservation = (band) => band > 2 ? band - 1 : 0;
286917
+ const gridlineBand = (gridline) => {
286918
+ let band = 0;
286919
+ const rowAbove = gridline > 0 ? block.rows[gridline - 1] : undefined;
286920
+ const rowBelow = gridline < block.rows.length ? block.rows[gridline] : undefined;
286921
+ for (const row2 of [rowAbove, rowBelow]) {
286922
+ if (!row2)
286923
+ continue;
286924
+ const override = row2.attrs?.borders;
286925
+ const eff = override ? {
286926
+ ...tableBordersForBands ?? {},
286927
+ ...override
286928
+ } : tableBordersForBands;
286929
+ const value = gridline === 0 ? eff?.top : gridline === block.rows.length ? eff?.bottom : eff?.insideH;
286930
+ band = Math.max(band, getBorderBandWidthPx(value));
286931
+ }
286932
+ for (const cell2 of rowAbove?.cells ?? [])
286933
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.bottom));
286934
+ for (const cell2 of rowBelow?.cells ?? [])
286935
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.top));
286936
+ return band;
286937
+ };
286938
+ for (let i3 = 0;i3 < block.rows.length; i3++)
286939
+ rowHeights[i3] += bandReservation(gridlineBand(i3));
286940
+ rowHeights[block.rows.length - 1] += bandReservation(gridlineBand(block.rows.length));
286941
+ }
286560
286942
  block.rows.forEach((row2, index2) => {
286561
286943
  const spec = row2.attrs?.rowHeight;
286562
286944
  if (spec?.value != null && Number.isFinite(spec.value))
@@ -294204,7 +294586,10 @@ var Node$13 = class Node$14 {
294204
294586
  const headerCells = [];
294205
294587
  const cells = [];
294206
294588
  for (let index2 = 0;index2 < colsCount; index2++) {
294207
- const cellAttrs = columnWidths ? { colwidth: [columnWidths[index2]] } : null;
294589
+ const cellAttrs = columnWidths ? {
294590
+ colwidth: [columnWidths[index2]],
294591
+ tableCellProperties: { cellWidth: cellWidthDxa(columnWidths[index2]) }
294592
+ } : null;
294208
294593
  const cell2 = createCell2(types3.tableCell, cellContent, cellAttrs);
294209
294594
  if (cell2)
294210
294595
  cells.push(cell2);
@@ -309513,15 +309898,30 @@ menclose::after {
309513
309898
  single: "solid",
309514
309899
  double: "double",
309515
309900
  dashed: "dashed",
309901
+ dashSmallGap: "dashed",
309516
309902
  dotted: "dotted",
309517
309903
  thick: "solid",
309518
309904
  triple: "solid",
309519
309905
  dotDash: "dashed",
309520
309906
  dotDotDash: "dashed",
309907
+ thinThickSmallGap: "solid",
309908
+ thickThinSmallGap: "solid",
309909
+ thinThickThinSmallGap: "solid",
309910
+ thinThickMediumGap: "solid",
309911
+ thickThinMediumGap: "solid",
309912
+ thinThickThinMediumGap: "solid",
309913
+ thinThickLargeGap: "solid",
309914
+ thickThinLargeGap: "solid",
309915
+ thinThickThinLargeGap: "solid",
309521
309916
  wave: "solid",
309522
- doubleWave: "solid"
309917
+ doubleWave: "solid",
309918
+ dashDotStroked: "dashed",
309919
+ threeDEmboss: "ridge",
309920
+ threeDEngrave: "groove",
309921
+ outset: "solid",
309922
+ inset: "solid"
309523
309923
  }[style2];
309524
- }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border) => {
309924
+ }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border, widthOverridePx) => {
309525
309925
  if (!border)
309526
309926
  return;
309527
309927
  if (border.style === "none" || border.width === 0) {
@@ -309529,18 +309929,40 @@ menclose::after {
309529
309929
  return;
309530
309930
  }
309531
309931
  const style2 = borderStyleToCSS(border.style);
309532
- const width = border.width ?? 1;
309533
309932
  const color2 = border.color ?? "#000000";
309534
309933
  const safeColor = isValidHexColor2(color2) ? color2 : "#000000";
309535
- const actualWidth = border.style === "thick" ? Math.max(width * 2, 3) : width;
309934
+ const actualWidth = widthOverridePx ?? getBorderBandWidthPx(border);
309536
309935
  element3.style[`border${side}`] = `${actualWidth}px ${style2} ${safeColor}`;
309537
- }, applyCellBorders = (element3, borders) => {
309936
+ }, applyCellBorders = (element3, borders, widthOverridesPx) => {
309538
309937
  if (!borders)
309539
309938
  return;
309540
309939
  applyBorder(element3, "Top", borders.top);
309541
- applyBorder(element3, "Right", borders.right);
309940
+ applyBorder(element3, "Right", borders.right, widthOverridesPx?.right);
309542
309941
  applyBorder(element3, "Bottom", borders.bottom);
309543
- applyBorder(element3, "Left", borders.left);
309942
+ applyBorder(element3, "Left", borders.left, widthOverridesPx?.left);
309943
+ }, BEVEL_LIGHT_AUTO = "#F0F0F0", BEVEL_DARK_AUTO = "#A0A0A0", bevelDarkColor = (color2) => {
309944
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
309945
+ return BEVEL_DARK_AUTO;
309946
+ const half = (i3) => Math.floor(parseInt(color2.slice(i3, i3 + 2), 16) / 2);
309947
+ return `#${[
309948
+ 1,
309949
+ 3,
309950
+ 5
309951
+ ].map((i3) => half(i3).toString(16).padStart(2, "0")).join("")}`;
309952
+ }, bevelLightColor = (color2) => {
309953
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
309954
+ return BEVEL_LIGHT_AUTO;
309955
+ return color2;
309956
+ }, bevelToneSpec = (spec, visualSide, owner) => {
309957
+ if (!spec || spec.style !== "outset" && spec.style !== "inset")
309958
+ return spec;
309959
+ const raisedSide = visualSide === "top" || visualSide === "left";
309960
+ const light = spec.style === "outset" === (owner === "table") === raisedSide;
309961
+ return {
309962
+ ...spec,
309963
+ style: "single",
309964
+ color: light ? bevelLightColor(spec.color) : bevelDarkColor(spec.color)
309965
+ };
309544
309966
  }, borderValueToSpec = (value) => {
309545
309967
  if (!value)
309546
309968
  return;
@@ -309623,7 +310045,7 @@ menclose::after {
309623
310045
  left: borders.right,
309624
310046
  right: borders.left
309625
310047
  };
309626
- }, getFiniteNumber = (value) => {
310048
+ }, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, getFiniteNumber = (value) => {
309627
310049
  if (typeof value !== "number" || !Number.isFinite(value))
309628
310050
  return;
309629
310051
  return value;
@@ -310649,7 +311071,7 @@ menclose::after {
310649
311071
  hasSdtContainerChrome
310650
311072
  };
310651
311073
  }, renderTableCell = (deps) => {
310652
- 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;
311074
+ 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;
310653
311075
  const padding = cell2?.attrs?.padding || {
310654
311076
  top: 0,
310655
311077
  left: 4,
@@ -310657,9 +311079,16 @@ menclose::after {
310657
311079
  bottom: 0
310658
311080
  };
310659
311081
  const buildTableImageHyperlinkAnchor = (imageEl, hyperlink, display) => buildImageHyperlinkAnchor(doc$12, imageEl, hyperlink, display);
310660
- const paddingLeft = isRtl ? padding.right ?? 4 : padding.left ?? 4;
311082
+ const compoundBandEats = (border, bandInCellPx) => {
311083
+ const profile = border ? getBorderBandProfile(border) : null;
311084
+ if (!profile)
311085
+ return 0;
311086
+ const bandInCell = bandInCellPx ?? profile.band;
311087
+ return Math.max(0, bandInCell - profile.band / 2);
311088
+ };
311089
+ const paddingLeft = Math.max(0, (isRtl ? padding.right ?? 4 : padding.left ?? 4) - compoundBandEats(borders?.left, borderBandOverridesPx?.left));
310661
311090
  const paddingTop = padding.top ?? 0;
310662
- const paddingRight = isRtl ? padding.left ?? 4 : padding.right ?? 4;
311091
+ const paddingRight = Math.max(0, (isRtl ? padding.left ?? 4 : padding.right ?? 4) - compoundBandEats(borders?.right, borderBandOverridesPx?.right));
310663
311092
  const paddingBottom = padding.bottom ?? 0;
310664
311093
  const cellEl = doc$12.createElement("div");
310665
311094
  cellEl.style.position = "absolute";
@@ -310674,7 +311103,7 @@ menclose::after {
310674
311103
  cellEl.style.paddingRight = `${paddingRight}px`;
310675
311104
  cellEl.style.paddingBottom = `${paddingBottom}px`;
310676
311105
  if (borders)
310677
- applyCellBorders(cellEl, borders);
311106
+ applyCellBorders(cellEl, borders, borderBandOverridesPx);
310678
311107
  else if (useDefaultBorder)
310679
311108
  cellEl.style.border = "1px solid rgba(0,0,0,0.6)";
310680
311109
  if (cell2?.attrs?.background)
@@ -311148,16 +311577,25 @@ menclose::after {
311148
311577
  elem.dataset.trackChangeAuthorColor = meta2.color;
311149
311578
  if (meta2.date)
311150
311579
  elem.dataset.trackChangeDate = meta2.date;
311151
- }, 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 }) => {
311580
+ }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, separateBorders, nextRowSuppressesSharedTop }) => {
311152
311581
  const hasExplicitBorders = hasExplicitCellBorders(cellBorders);
311153
311582
  const cellBounds = getTableCellGridBounds(cellPosition);
311154
311583
  const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
311155
- const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext || nextRowLeavesRightGap === true;
311156
- const hasInteriorNeighborBorder = !touchesTopBoundary && !deferTopToAboveCell && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
311584
+ const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
311585
+ const hasInteriorNeighborBorder = !touchesTopBoundary && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
311586
+ if (separateBorders && cellSpacingPx === 0) {
311587
+ const cb = cellBorders ?? {};
311588
+ return {
311589
+ top: resolveTableBorderValue(cb.top, touchesTopBoundary ? tableBorders?.top : tableBorders?.insideH),
311590
+ right: resolveTableBorderValue(cb.right, cellBounds.touchesRightEdge ? tableBorders?.right : tableBorders?.insideV),
311591
+ bottom: resolveTableBorderValue(cb.bottom, touchesBottomBoundary ? tableBorders?.bottom : tableBorders?.insideH),
311592
+ left: resolveTableBorderValue(cb.left, cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV)
311593
+ };
311594
+ }
311157
311595
  if (cellSpacingPx === 0 && (hasExplicitBorders || hasInteriorNeighborBorder)) {
311158
311596
  const cb = cellBorders ?? {};
311159
311597
  return {
311160
- top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : deferTopToAboveCell ? undefined : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
311598
+ top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
311161
311599
  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),
311162
311600
  right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, tableBorders?.right) : isPresentBorder(cb.right) && !isPresentBorder(rightCellBorders?.left) ? cb.right : undefined,
311163
311601
  bottom: touchesBottomBoundary ? resolveTableBorderValue(cb.bottom, tableBorders?.bottom) : undefined
@@ -311197,8 +311635,102 @@ menclose::after {
311197
311635
  bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : interiorBottom,
311198
311636
  left: baseBorders.left
311199
311637
  };
311638
+ }, appendCompoundBorderRects = (doc$12, container, cellElement, borders, rect, edges) => {
311639
+ if (!borders)
311640
+ return;
311641
+ const { ownsBottomBand, rightIsBoundary, leftIsBoundary, suppressMid } = edges;
311642
+ const sideInfo = [
311643
+ "top",
311644
+ "right",
311645
+ "bottom",
311646
+ "left"
311647
+ ].map((side) => {
311648
+ const spec = borders[side];
311649
+ const profile = spec ? getBorderBandProfile(spec) : null;
311650
+ if (!spec || !profile)
311651
+ return null;
311652
+ if (isNativeCssDoubleStyle(spec.style)) {
311653
+ if (side === "top" || side === "bottom" && ownsBottomBand || side === "left" && leftIsBoundary || side === "right" && rightIsBoundary)
311654
+ return null;
311655
+ }
311656
+ const { segments } = profile;
311657
+ return {
311658
+ side,
311659
+ band: Math.max(1, Math.round(profile.band)),
311660
+ outerRule: Math.max(1, Math.round(segments[0])),
311661
+ innerRule: Math.max(1, Math.round(segments[segments.length - 1])),
311662
+ midRule: segments.length === 5 ? Math.max(1, Math.round(segments[2])) : 0,
311663
+ midOffset: segments.length === 5 ? Math.round(segments[0] + segments[1]) : 0,
311664
+ color: spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000"
311665
+ };
311666
+ });
311667
+ if (!sideInfo.some(Boolean))
311668
+ return;
311669
+ const x0$1 = Math.round(rect.x);
311670
+ const y0 = Math.round(rect.y);
311671
+ const x1 = Math.round(rect.x + rect.width);
311672
+ const y1 = Math.round(rect.y + rect.height);
311673
+ for (const info of sideInfo) {
311674
+ if (!info)
311675
+ continue;
311676
+ const cssSide = info.side[0].toUpperCase() + info.side.slice(1);
311677
+ cellElement.style[`border${cssSide}Color`] = "transparent";
311678
+ }
311679
+ const [top$1, right$1, bottom$1, left$1] = sideInfo;
311680
+ const rectEl = doc$12.createElement("div");
311681
+ rectEl.className = "superdoc-compound-border-rect";
311682
+ const st = rectEl.style;
311683
+ st.position = "absolute";
311684
+ st.boxSizing = "border-box";
311685
+ st.pointerEvents = "none";
311686
+ const topInset = top$1 ? top$1.band - top$1.innerRule : 0;
311687
+ const leftInset = left$1 ? leftIsBoundary ? left$1.band - left$1.innerRule : Math.round(left$1.band / 2) - left$1.innerRule : 0;
311688
+ const bottomInset = bottom$1 ? ownsBottomBand ? bottom$1.band - bottom$1.innerRule : Math.round(bottom$1.band / 2) - bottom$1.outerRule : 0;
311689
+ const rightInset = right$1 ? rightIsBoundary ? right$1.band - right$1.innerRule : Math.round(right$1.band / 2) - right$1.outerRule : 0;
311690
+ st.left = `${x0$1 + leftInset}px`;
311691
+ st.top = `${y0 + topInset}px`;
311692
+ st.width = `${x1 - x0$1 - leftInset - rightInset}px`;
311693
+ st.height = `${y1 - y0 - topInset - bottomInset}px`;
311694
+ if (top$1)
311695
+ st.borderTop = `${top$1.innerRule}px solid ${top$1.color}`;
311696
+ if (bottom$1)
311697
+ st.borderBottom = `${ownsBottomBand ? bottom$1.innerRule : bottom$1.outerRule}px solid ${bottom$1.color}`;
311698
+ if (left$1)
311699
+ st.borderLeft = `${left$1.innerRule}px solid ${left$1.color}`;
311700
+ if (right$1)
311701
+ st.borderRight = `${rightIsBoundary ? right$1.innerRule : right$1.outerRule}px solid ${right$1.color}`;
311702
+ container.appendChild(rectEl);
311703
+ const midTop = top$1 && top$1.midRule > 0 && !suppressMid?.top ? top$1 : null;
311704
+ const midLeft = left$1 && left$1.midRule > 0 && !suppressMid?.left ? left$1 : null;
311705
+ const midBottom = bottom$1 && bottom$1.midRule > 0 && ownsBottomBand && !suppressMid?.bottom ? bottom$1 : null;
311706
+ const midRight = right$1 && right$1.midRule > 0 && rightIsBoundary && !suppressMid?.right ? right$1 : null;
311707
+ if (midTop || midLeft || midBottom || midRight) {
311708
+ const mid = doc$12.createElement("div");
311709
+ mid.className = "superdoc-compound-border-mid";
311710
+ const ms = mid.style;
311711
+ ms.position = "absolute";
311712
+ ms.boxSizing = "border-box";
311713
+ ms.pointerEvents = "none";
311714
+ const tIn = midTop ? midTop.midOffset : 0;
311715
+ const lIn = midLeft ? midLeft.midOffset : 0;
311716
+ const bIn = midBottom ? midBottom.midOffset : 0;
311717
+ const rIn = midRight ? midRight.midOffset : 0;
311718
+ ms.left = `${x0$1 + lIn}px`;
311719
+ ms.top = `${y0 + tIn}px`;
311720
+ ms.width = `${x1 - x0$1 - lIn - rIn}px`;
311721
+ ms.height = `${y1 - y0 - tIn - bIn}px`;
311722
+ if (midTop)
311723
+ ms.borderTop = `${midTop.midRule}px solid ${midTop.color}`;
311724
+ if (midBottom)
311725
+ ms.borderBottom = `${midBottom.midRule}px solid ${midBottom.color}`;
311726
+ if (midLeft)
311727
+ ms.borderLeft = `${midLeft.midRule}px solid ${midLeft.color}`;
311728
+ if (midRight)
311729
+ ms.borderRight = `${midRight.midRule}px solid ${midRight.color}`;
311730
+ container.appendChild(mid);
311731
+ }
311200
311732
  }, renderTableRow = (deps) => {
311201
- 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;
311733
+ 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;
311202
311734
  const totalCols = columnWidths.length;
311203
311735
  const rowTrackedChange = row2?.attrs?.trackedChange;
311204
311736
  let rowTrackedChangeConfig;
@@ -311262,17 +311794,6 @@ menclose::after {
311262
311794
  return cells[i3]?.attrs?.borders;
311263
311795
  }
311264
311796
  };
311265
- const findCellRightEdgeAtColumn = (measureCells, gridCol) => {
311266
- if (!measureCells)
311267
- return;
311268
- for (let i3 = 0;i3 < measureCells.length; i3++) {
311269
- const start$1 = measureCells[i3].gridColumnStart ?? i3;
311270
- const span = measureCells[i3].colSpan ?? 1;
311271
- if (gridCol >= start$1 && gridCol < start$1 + span)
311272
- return start$1 + span;
311273
- }
311274
- };
311275
- const nextRowMaxCol = nextRowOccupiedRightCol != null && nextRowOccupiedRightCol > 0 ? nextRowOccupiedRightCol : nextRowMeasure?.cells?.length ? Math.max(...nextRowMeasure.cells.map((c) => (c.gridColumnStart ?? 0) + (c.colSpan ?? 1))) : Infinity;
311276
311797
  for (let cellIndex = 0;cellIndex < rowMeasure.cells.length; cellIndex += 1) {
311277
311798
  const cellMeasure = rowMeasure.cells[cellIndex];
311278
311799
  const cell2 = row2?.cells?.[cellIndex];
@@ -311293,8 +311814,6 @@ menclose::after {
311293
311814
  const aboveCellBorders = findCellBordersAtColumn(prevRow?.cells, prevRowMeasure?.cells, gridColumnStart);
311294
311815
  const leftCellBorders = gridColumnStart > 0 ? findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart - 1) : undefined;
311295
311816
  const rightCellBorders = findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart + colSpan);
311296
- const nextRowLeavesRightGap = gridColumnStart + colSpan > nextRowMaxCol;
311297
- const aboveCellRightEdge = findCellRightEdgeAtColumn(prevRowMeasure?.cells, gridColumnStart);
311298
311817
  const resolvedBorders = resolveRenderedCellBorders({
311299
311818
  cellBorders: cellBordersAttr,
311300
311819
  hasBordersAttribute,
@@ -311306,11 +311825,16 @@ menclose::after {
311306
311825
  aboveCellBorders,
311307
311826
  leftCellBorders,
311308
311827
  rightCellBorders,
311309
- nextRowLeavesRightGap,
311310
- deferTopToAboveCell: aboveCellRightEdge !== undefined && aboveCellRightEdge > rowRightEdgeCol,
311828
+ separateBorders,
311311
311829
  nextRowSuppressesSharedTop
311312
311830
  });
311313
311831
  const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
311832
+ const tonedBorders = separateBorders && finalBorders ? {
311833
+ top: bevelToneSpec(finalBorders.top, "top", "cell"),
311834
+ right: bevelToneSpec(finalBorders.right, "right", "cell"),
311835
+ bottom: bevelToneSpec(finalBorders.bottom, "bottom", "cell"),
311836
+ left: bevelToneSpec(finalBorders.left, "left", "cell")
311837
+ } : finalBorders;
311314
311838
  let cellHeight;
311315
311839
  if (partialRow)
311316
311840
  cellHeight = partialRow.partialHeight;
@@ -311323,6 +311847,34 @@ menclose::after {
311323
311847
  const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
311324
311848
  if (isRtl && computedCellWidth > 0)
311325
311849
  x = tableContentWidth - x - computedCellWidth;
311850
+ const cellGridBounds = getTableCellGridBounds(cellPosition);
311851
+ const cellIsIntentionallyBorderless = hasBordersAttribute && !hasExplicitCellBorders(cellBordersAttr);
311852
+ const cb = cellBordersAttr ?? {};
311853
+ const effectiveSideSpecs = cellIsIntentionallyBorderless ? {} : {
311854
+ top: cellGridBounds.touchesTopEdge || continuesFromPrev === true ? resolveTableBorderValue(cb.top, effectiveTableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? borderValueToSpec(effectiveTableBorders?.insideH),
311855
+ bottom: cellGridBounds.touchesBottomEdge || continuesOnNext === true ? resolveTableBorderValue(cb.bottom, effectiveTableBorders?.bottom) : resolveBorderConflict(cb.bottom, undefined) ?? borderValueToSpec(effectiveTableBorders?.insideH),
311856
+ left: cellGridBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, effectiveTableBorders?.left) : resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(effectiveTableBorders?.insideV),
311857
+ right: cellGridBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, effectiveTableBorders?.right) : resolveBorderConflict(cb.right, rightCellBorders?.left) ?? borderValueToSpec(effectiveTableBorders?.insideV)
311858
+ };
311859
+ const rectBorders = (isRtl ? swapCellBordersLR(effectiveSideSpecs) : effectiveSideSpecs) ?? effectiveSideSpecs;
311860
+ const visualTouchesLeft = isRtl ? cellGridBounds.touchesRightEdge : cellGridBounds.touchesLeftEdge;
311861
+ const visualTouchesRight = isRtl ? cellGridBounds.touchesLeftEdge : cellGridBounds.touchesRightEdge;
311862
+ const leftStraddleProfile = !visualTouchesLeft && rectBorders.left ? getBorderBandProfile(rectBorders.left) : null;
311863
+ const rightStraddleProfile = !visualTouchesRight && rectBorders.right ? getBorderBandProfile(rectBorders.right) : null;
311864
+ let paintBorders = tonedBorders;
311865
+ let borderBandOverridesPx;
311866
+ if (leftStraddleProfile || rightStraddleProfile) {
311867
+ paintBorders = { ...tonedBorders ?? {} };
311868
+ borderBandOverridesPx = {};
311869
+ if (leftStraddleProfile) {
311870
+ paintBorders.left = rectBorders.left;
311871
+ borderBandOverridesPx.left = leftStraddleProfile.band / 2;
311872
+ }
311873
+ if (rightStraddleProfile) {
311874
+ paintBorders.right = rectBorders.right;
311875
+ borderBandOverridesPx.right = rightStraddleProfile.band / 2;
311876
+ }
311877
+ }
311326
311878
  const { cellElement } = renderTableCell({
311327
311879
  doc: doc$12,
311328
311880
  x,
@@ -311330,7 +311882,8 @@ menclose::after {
311330
311882
  rowHeight: cellHeight,
311331
311883
  cellMeasure,
311332
311884
  cell: cell2,
311333
- borders: finalBorders,
311885
+ borders: paintBorders,
311886
+ borderBandOverridesPx,
311334
311887
  useDefaultBorder: false,
311335
311888
  renderLine: renderLine$1,
311336
311889
  captureLineSnapshot,
@@ -311353,7 +311906,68 @@ menclose::after {
311353
311906
  if (rowTrackedChange && rowTrackedChangeConfig)
311354
311907
  applyRowTrackedChangeToCell(cellElement, rowTrackedChange, rowTrackedChangeConfig);
311355
311908
  container.appendChild(cellElement);
311909
+ const tableProvidesMid = (value) => {
311910
+ const profile = value != null && typeof value === "object" ? getBorderBandProfile(value) : null;
311911
+ return profile != null && profile.segments.length === 5;
311912
+ };
311913
+ const suppressMid = {
311914
+ top: tableProvidesMid(cellGridBounds.touchesTopEdge || continuesFromPrev === true ? effectiveTableBorders?.top : effectiveTableBorders?.insideH),
311915
+ bottom: tableProvidesMid(cellGridBounds.touchesBottomEdge || continuesOnNext === true ? effectiveTableBorders?.bottom : effectiveTableBorders?.insideH),
311916
+ left: tableProvidesMid(visualTouchesLeft ? isRtl ? effectiveTableBorders?.right : effectiveTableBorders?.left : effectiveTableBorders?.insideV),
311917
+ right: tableProvidesMid(visualTouchesRight ? isRtl ? effectiveTableBorders?.left : effectiveTableBorders?.right : effectiveTableBorders?.insideV)
311918
+ };
311919
+ appendCompoundBorderRects(doc$12, container, cellElement, rectBorders, {
311920
+ x,
311921
+ y: y$1,
311922
+ width: computedCellWidth > 0 ? computedCellWidth : cellMeasure.width ?? 0,
311923
+ height: cellHeight
311924
+ }, {
311925
+ ownsBottomBand: cellGridBounds.touchesBottomEdge || continuesOnNext === true,
311926
+ rightIsBoundary: visualTouchesRight,
311927
+ leftIsBoundary: visualTouchesLeft,
311928
+ suppressMid
311929
+ });
311930
+ }
311931
+ }, buildColumnOccupancy = (rows, numCols) => {
311932
+ const occupancy = rows.map(() => new Array(numCols).fill(null));
311933
+ rows.forEach((row2, rowIndex) => {
311934
+ row2?.cells?.forEach((cell2, cellIndex) => {
311935
+ const startCol = cell2.gridColumnStart ?? 0;
311936
+ const endCol = Math.min(numCols, startCol + (cell2.colSpan ?? 1));
311937
+ const endRow = Math.min(rows.length, rowIndex + (cell2.rowSpan ?? 1));
311938
+ const ref$1 = {
311939
+ rowIndex,
311940
+ cellIndex
311941
+ };
311942
+ for (let r$1 = rowIndex;r$1 < endRow; r$1 += 1)
311943
+ for (let c = startCol;c < endCol; c += 1)
311944
+ occupancy[r$1][c] = ref$1;
311945
+ });
311946
+ });
311947
+ return occupancy;
311948
+ }, computeBoundaryGapSegments = (occupancy, belowRowIndex) => {
311949
+ const above = occupancy[belowRowIndex - 1];
311950
+ const below = occupancy[belowRowIndex];
311951
+ if (!above || !below)
311952
+ return [];
311953
+ const segments = [];
311954
+ let current = null;
311955
+ for (let c = 0;c < above.length; c += 1) {
311956
+ const aboveCell = above[c];
311957
+ const isGap = aboveCell !== null && below[c] === null;
311958
+ if (isGap && current && current.aboveCell === aboveCell)
311959
+ current.endColExclusive = c + 1;
311960
+ else if (isGap) {
311961
+ current = {
311962
+ startCol: c,
311963
+ endColExclusive: c + 1,
311964
+ aboveCell
311965
+ };
311966
+ segments.push(current);
311967
+ } else
311968
+ current = null;
311356
311969
  }
311970
+ return segments;
311357
311971
  }, renderTableFragment = (deps) => {
311358
311972
  const { doc: doc$12, fragment: fragment2, block, measure, cellSpacingPx, effectiveColumnWidths, chrome: chrome2, context, sdtBoundary, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, applyStyles: applyStyles$3, resolvePhysical } = deps;
311359
311973
  if (!doc$12) {
@@ -311505,11 +312119,23 @@ menclose::after {
311505
312119
  }
311506
312120
  if (block.id)
311507
312121
  container.setAttribute("data-sd-block-id", block.id);
311508
- if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && tableBorders) {
311509
- applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
311510
- applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
311511
- applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
311512
- applyBorder(container, "Left", borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left));
312122
+ const borderCollapse = block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse");
312123
+ const separateBorders = borderCollapse === "separate";
312124
+ if (borderCollapse === "separate" && tableBorders) {
312125
+ applyBorder(container, "Top", bevelToneSpec(borderValueToSpec(tableBorders.top), "top", "table"));
312126
+ applyBorder(container, "Right", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right), "right", "table"));
312127
+ applyBorder(container, "Bottom", bevelToneSpec(borderValueToSpec(tableBorders.bottom), "bottom", "table"));
312128
+ applyBorder(container, "Left", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left), "left", "table"));
312129
+ for (const [cssSide, value] of [
312130
+ ["Top", tableBorders.top],
312131
+ ["Right", isRtl ? tableBorders.left : tableBorders.right],
312132
+ ["Bottom", tableBorders.bottom],
312133
+ ["Left", isRtl ? tableBorders.right : tableBorders.left]
312134
+ ]) {
312135
+ const spec = borderValueToSpec(value);
312136
+ if (spec && getBorderBandProfile(spec) && !isNativeCssDoubleStyle(spec.style))
312137
+ container.style[`border${cssSide}Color`] = "transparent";
312138
+ }
311513
312139
  }
311514
312140
  const allRowHeights = measure.rows.map((r$1, idx) => {
311515
312141
  if (fragment2.partialRow && fragment2.partialRow.rowIndex === idx)
@@ -311542,9 +312168,8 @@ menclose::after {
311542
312168
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
311543
312169
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
311544
312170
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
311545
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
311546
312171
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
311547
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
312172
+ separateBorders,
311548
312173
  totalRows: block.rows.length,
311549
312174
  tableBorders,
311550
312175
  columnWidths: effectiveColumnWidths,
@@ -311648,10 +312273,16 @@ menclose::after {
311648
312273
  }
311649
312274
  }
311650
312275
  }
312276
+ const interiorRowBoundaries = [];
311651
312277
  for (let r$1 = fragment2.fromRow;r$1 < fragment2.toRow; r$1 += 1) {
311652
312278
  const rowMeasure = measure.rows[r$1];
311653
312279
  if (!rowMeasure)
311654
312280
  break;
312281
+ if (r$1 > fragment2.fromRow)
312282
+ interiorRowBoundaries.push({
312283
+ y: y$1,
312284
+ belowRowIndex: r$1
312285
+ });
311655
312286
  const isFirstRenderedBodyRow = r$1 === fragment2.fromRow;
311656
312287
  const isLastRenderedBodyRow = r$1 === fragment2.toRow - 1;
311657
312288
  const partialRowData = fragment2.partialRow && fragment2.partialRow.rowIndex === r$1 ? fragment2.partialRow : undefined;
@@ -311666,9 +312297,8 @@ menclose::after {
311666
312297
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
311667
312298
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
311668
312299
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
311669
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
311670
312300
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
311671
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
312301
+ separateBorders,
311672
312302
  totalRows: block.rows.length,
311673
312303
  tableBorders,
311674
312304
  columnWidths: effectiveColumnWidths,
@@ -311694,6 +312324,171 @@ menclose::after {
311694
312324
  });
311695
312325
  y$1 += actualRowHeight + cellSpacingPx;
311696
312326
  }
312327
+ {
312328
+ const sides = [
312329
+ [
312330
+ "top",
312331
+ tableBorders?.top,
312332
+ fragment2.continuesFromPrev !== true
312333
+ ],
312334
+ [
312335
+ "right",
312336
+ isRtl ? tableBorders?.left : tableBorders?.right,
312337
+ true
312338
+ ],
312339
+ [
312340
+ "bottom",
312341
+ tableBorders?.bottom,
312342
+ fragment2.continuesOnNext !== true
312343
+ ],
312344
+ [
312345
+ "left",
312346
+ isRtl ? tableBorders?.right : tableBorders?.left,
312347
+ true
312348
+ ]
312349
+ ];
312350
+ let outlineEl = null;
312351
+ for (const [side, value, enabled] of sides) {
312352
+ if (!enabled || value == null || typeof value !== "object")
312353
+ continue;
312354
+ const spec = value;
312355
+ const profile = getBorderBandProfile(value);
312356
+ if (!profile)
312357
+ continue;
312358
+ if (isNativeCssDoubleStyle(spec.style))
312359
+ continue;
312360
+ const rule = Math.max(1, Math.round(profile.segments[0]));
312361
+ const color2 = spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000";
312362
+ if (!outlineEl) {
312363
+ outlineEl = doc$12.createElement("div");
312364
+ outlineEl.className = "superdoc-compound-border-outline";
312365
+ const st = outlineEl.style;
312366
+ st.position = "absolute";
312367
+ st.inset = "0";
312368
+ st.boxSizing = "border-box";
312369
+ st.pointerEvents = "none";
312370
+ container.appendChild(outlineEl);
312371
+ }
312372
+ const cssSide = side[0].toUpperCase() + side.slice(1);
312373
+ outlineEl.style[`border${cssSide}`] = `${rule}px solid ${color2}`;
312374
+ }
312375
+ }
312376
+ {
312377
+ const midProfileOf = (value) => {
312378
+ if (value == null || typeof value !== "object")
312379
+ return null;
312380
+ const profile = getBorderBandProfile(value);
312381
+ return profile && profile.segments.length === 5 ? profile : null;
312382
+ };
312383
+ const colorOf = (value) => {
312384
+ const c = value?.color;
312385
+ return c && /^#[0-9A-Fa-f]{6}$/.test(c) ? c : "#000000";
312386
+ };
312387
+ const midOffsetOf = (profile) => Math.round(profile.segments[0] + profile.segments[1]);
312388
+ const midRuleOf = (profile) => Math.max(1, Math.round(profile.segments[2]));
312389
+ const topBorder = tableBorders?.top;
312390
+ const bottomBorder = tableBorders?.bottom;
312391
+ const leftBorder = isRtl ? tableBorders?.right : tableBorders?.left;
312392
+ const rightBorder = isRtl ? tableBorders?.left : tableBorders?.right;
312393
+ const topMid = fragment2.continuesFromPrev !== true ? midProfileOf(topBorder) : null;
312394
+ const bottomMid = fragment2.continuesOnNext !== true ? midProfileOf(bottomBorder) : null;
312395
+ const leftMid = midProfileOf(leftBorder);
312396
+ const rightMid = midProfileOf(rightBorder);
312397
+ const insideHMid = midProfileOf(tableBorders?.insideH);
312398
+ const insideVMid = midProfileOf(tableBorders?.insideV);
312399
+ const fragmentWidth = fragment2.width;
312400
+ const fragmentHeight = fragment2.height;
312401
+ const ringTopInset = topMid ? midOffsetOf(topMid) : 0;
312402
+ const ringBottomInset = bottomMid ? midOffsetOf(bottomMid) : 0;
312403
+ const ringLeftInset = leftMid ? midOffsetOf(leftMid) : 0;
312404
+ const ringRightInset = rightMid ? midOffsetOf(rightMid) : 0;
312405
+ if (topMid || bottomMid || leftMid || rightMid) {
312406
+ const ring = doc$12.createElement("div");
312407
+ ring.className = "superdoc-compound-border-midring";
312408
+ const rs = ring.style;
312409
+ rs.position = "absolute";
312410
+ rs.boxSizing = "border-box";
312411
+ rs.pointerEvents = "none";
312412
+ rs.left = `${ringLeftInset}px`;
312413
+ rs.top = `${ringTopInset}px`;
312414
+ rs.width = `${fragmentWidth - ringLeftInset - ringRightInset}px`;
312415
+ rs.height = `${fragmentHeight - ringTopInset - ringBottomInset}px`;
312416
+ if (topMid)
312417
+ rs.borderTop = `${midRuleOf(topMid)}px solid ${colorOf(topBorder)}`;
312418
+ if (bottomMid)
312419
+ rs.borderBottom = `${midRuleOf(bottomMid)}px solid ${colorOf(bottomBorder)}`;
312420
+ if (leftMid)
312421
+ rs.borderLeft = `${midRuleOf(leftMid)}px solid ${colorOf(leftBorder)}`;
312422
+ if (rightMid)
312423
+ rs.borderRight = `${midRuleOf(rightMid)}px solid ${colorOf(rightBorder)}`;
312424
+ container.appendChild(ring);
312425
+ }
312426
+ const appendStrip = (className, l, t, w, h$2, color2) => {
312427
+ const strip = doc$12.createElement("div");
312428
+ strip.className = className;
312429
+ const ss = strip.style;
312430
+ ss.position = "absolute";
312431
+ ss.pointerEvents = "none";
312432
+ ss.left = `${l}px`;
312433
+ ss.top = `${t}px`;
312434
+ ss.width = `${w}px`;
312435
+ ss.height = `${h$2}px`;
312436
+ ss.background = color2;
312437
+ container.appendChild(strip);
312438
+ };
312439
+ if (insideVMid && effectiveColumnWidths.length > 1) {
312440
+ const rule = midRuleOf(insideVMid);
312441
+ const color2 = colorOf(tableBorders?.insideV);
312442
+ let cum = 0;
312443
+ for (let i3 = 0;i3 < effectiveColumnWidths.length - 1; i3 += 1) {
312444
+ cum += effectiveColumnWidths[i3];
312445
+ const gx = isRtl ? fragmentWidth - cum : cum;
312446
+ appendStrip("superdoc-compound-border-midv", Math.round(gx - rule / 2), ringTopInset, rule, fragmentHeight - ringTopInset - ringBottomInset, color2);
312447
+ }
312448
+ }
312449
+ if (insideHMid && interiorRowBoundaries.length > 0) {
312450
+ const rule = midRuleOf(insideHMid);
312451
+ const color2 = colorOf(tableBorders?.insideH);
312452
+ for (const { y: gy } of interiorRowBoundaries)
312453
+ appendStrip("superdoc-compound-border-midh", ringLeftInset, Math.round(gy + midOffsetOf(insideHMid)), fragmentWidth - ringLeftInset - ringRightInset, rule, color2);
312454
+ }
312455
+ }
312456
+ if (cellSpacingPx === 0 && !separateBorders && interiorRowBoundaries.length > 0 && block.rows?.length) {
312457
+ const occupancy = buildColumnOccupancy(measure.rows, effectiveColumnWidths.length);
312458
+ const columnX = [0];
312459
+ for (const width of effectiveColumnWidths)
312460
+ columnX.push(columnX[columnX.length - 1] + width);
312461
+ for (const { y: boundaryY, belowRowIndex } of interiorRowBoundaries)
312462
+ for (const segment of computeBoundaryGapSegments(occupancy, belowRowIndex)) {
312463
+ if (segment.aboveCell.rowIndex < fragment2.fromRow)
312464
+ continue;
312465
+ const aboveCell = block.rows[segment.aboveCell.rowIndex]?.cells?.[segment.aboveCell.cellIndex];
312466
+ const boundaryRowBorders = block.rows[belowRowIndex - 1]?.attrs?.borders;
312467
+ const effectiveInsideH = boundaryRowBorders ? {
312468
+ ...tableBorders ?? {},
312469
+ ...boundaryRowBorders
312470
+ }.insideH : tableBorders?.insideH;
312471
+ const cellBottom = aboveCell?.attrs?.borders?.bottom;
312472
+ const spec = isExplicitNoneBorder(cellBottom) ? undefined : resolveTableBorderValue(cellBottom, effectiveInsideH);
312473
+ if (!isPresentBorder(spec))
312474
+ continue;
312475
+ const x = columnX[segment.startCol];
312476
+ const width = columnX[segment.endColExclusive] - x;
312477
+ if (width <= 0)
312478
+ continue;
312479
+ const strip = doc$12.createElement("div");
312480
+ strip.className = "superdoc-row-boundary-gap";
312481
+ const ss = strip.style;
312482
+ ss.position = "absolute";
312483
+ ss.pointerEvents = "none";
312484
+ ss.left = `${isRtl ? fragment2.width - x - width : x}px`;
312485
+ ss.top = `${boundaryY}px`;
312486
+ ss.width = `${width}px`;
312487
+ ss.height = "0";
312488
+ applyBorder(strip, "Top", spec);
312489
+ container.appendChild(strip);
312490
+ }
312491
+ }
311697
312492
  return container;
311698
312493
  }, getOwnContainerKey = (item) => {
311699
312494
  if (item.kind !== "fragment")
@@ -318131,7 +318926,51 @@ menclose::after {
318131
318926
  getStats() {
318132
318927
  return this.cache.getStats();
318133
318928
  }
318134
- }, sharedHeaderFooterCache, HEADER_FOOTER_VARIANTS$12, canvas = null, ctx = null, isWordChar$1 = (char) => {
318929
+ }, sharedHeaderFooterCache, HEADER_FOOTER_VARIANTS$12, isAtomicLayoutRun = (run2) => typeof run2.src === "string" || run2.kind === "math" || run2.kind === "fieldAnnotation", resolveFieldAnnotationFontSize = (value) => {
318930
+ if (typeof value === "number" && Number.isFinite(value))
318931
+ return value;
318932
+ if (typeof value === "string") {
318933
+ const parsed = parseFloat(value);
318934
+ if (Number.isFinite(parsed) && parsed > 0)
318935
+ return parsed;
318936
+ }
318937
+ return 16;
318938
+ }, getImageRunSize = (run2) => {
318939
+ const distLeft = run2.distLeft ?? 0;
318940
+ const distRight = run2.distRight ?? 0;
318941
+ const distTop = run2.distTop ?? 0;
318942
+ const distBottom = run2.distBottom ?? 0;
318943
+ return {
318944
+ width: (run2.width ?? 0) + distLeft + distRight,
318945
+ height: (run2.height ?? 0) + distTop + distBottom
318946
+ };
318947
+ }, getMathRunSize = (run2) => ({
318948
+ width: run2.width ?? 20,
318949
+ height: run2.height ?? 24
318950
+ }), getFieldAnnotationRunSize = (run2, measureText$1) => {
318951
+ const fontSize = resolveFieldAnnotationFontSize(run2.fontSize);
318952
+ const horizontalPadding = run2.highlighted === false ? 0 : 8;
318953
+ const verticalPadding = run2.highlighted === false ? 0 : 6;
318954
+ const label = run2.displayLabel ?? "";
318955
+ const width = (label ? measureText$1(label, run2, fontSize) : 0) + horizontalPadding;
318956
+ let height = fontSize * FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER + verticalPadding;
318957
+ if (run2.variant === "signature" && run2.imageSrc)
318958
+ height = Math.max(height, 28 + verticalPadding);
318959
+ if (run2.variant === "image" && run2.imageSrc && run2.size?.height)
318960
+ height = Math.max(height, run2.size.height + verticalPadding);
318961
+ if (run2.variant === "html" && run2.size?.height)
318962
+ height = Math.max(height, run2.size.height);
318963
+ return {
318964
+ width,
318965
+ height
318966
+ };
318967
+ }, getAtomicRunLayoutSize = (run2, measureText$1) => {
318968
+ if (typeof run2.src === "string")
318969
+ return getImageRunSize(run2);
318970
+ if (run2.kind === "math")
318971
+ return getMathRunSize(run2);
318972
+ return getFieldAnnotationRunSize(run2, measureText$1);
318973
+ }, canvas = null, ctx = null, isWordChar$1 = (char) => {
318135
318974
  if (!char)
318136
318975
  return false;
318137
318976
  const code6 = char.charCodeAt(0);
@@ -318160,6 +318999,26 @@ menclose::after {
318160
318999
  }, DEFAULT_TAB_INTERVAL_TWIPS$12 = 720, TWIPS_PER_PX$2, TAB_EPSILON$1 = 0.1, WIDTH_FUDGE_PX = 0.5, twipsToPx$1 = (twips) => twips / TWIPS_PER_PX$2, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$2), sanitizeIndent$1 = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0, sanitizeRawIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0, sanitizeDecimalSeparator$1 = (value) => value === "," ? "," : ".", getRunWidth = (run2) => {
318161
319000
  const width = run2.width;
318162
319001
  return typeof width === "number" ? width : 0;
319002
+ }, measureAtomicText = (text5, run2, fontSize) => {
319003
+ const family2 = run2.fontFamily || "Arial";
319004
+ const context = getCtx();
319005
+ if (!context)
319006
+ return Math.max(0, text5.length * (fontSize * 0.6));
319007
+ context.font = `${run2.italic ? "italic " : ""}${run2.bold ? "bold " : ""}${fontSize}px ${family2}`.trim();
319008
+ return context.measureText(text5).width;
319009
+ }, getAtomicRunLayoutWidth = (run2) => getAtomicRunLayoutSize(run2, measureAtomicText).width, getAtomicRunLayoutHeight = (run2) => getAtomicRunLayoutSize(run2, measureAtomicText).height, getLineMaxAtomicHeight = (runs2, fromRun, fromChar, toRun, toChar) => {
319010
+ let max$2 = 0;
319011
+ for (let r$1 = fromRun;r$1 <= toRun; r$1 += 1) {
319012
+ const run2 = runs2[r$1];
319013
+ if (!isAtomicLayoutRun(run2))
319014
+ continue;
319015
+ if (r$1 === toRun && toChar === 0)
319016
+ continue;
319017
+ if (r$1 === fromRun && r$1 === toRun && toChar <= fromChar)
319018
+ continue;
319019
+ max$2 = Math.max(max$2, getAtomicRunLayoutHeight(run2));
319020
+ }
319021
+ return max$2;
318163
319022
  }, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
318164
319023
  const size$1 = run2?.fontSize ?? 16;
318165
319024
  const family2 = run2?.fontFamily ?? "Arial";
@@ -318232,7 +319091,7 @@ menclose::after {
318232
319091
  };
318233
319092
  const text5 = runText(run2);
318234
319093
  if (!text5) {
318235
- const runWidth = getRunWidth(run2);
319094
+ const runWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
318236
319095
  if (runWidth > 0) {
318237
319096
  totalWidth += runWidth;
318238
319097
  endRun = r$1;
@@ -318291,7 +319150,7 @@ menclose::after {
318291
319150
  break;
318292
319151
  const text5 = runText(run2);
318293
319152
  if (!text5) {
318294
- totalWidth += getRunWidth(run2);
319153
+ totalWidth += isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
318295
319154
  continue;
318296
319155
  }
318297
319156
  const sliceStart = r$1 === startRunIndex ? startChar : 0;
@@ -318469,7 +319328,21 @@ menclose::after {
318469
319328
  }
318470
319329
  const text5 = runText(run2);
318471
319330
  if (!text5) {
318472
- cursorX += getRunWidth(run2);
319331
+ const atomicWidth = isAtomicLayoutRun(run2) ? getAtomicRunLayoutWidth(run2) : getRunWidth(run2);
319332
+ const pendingTabAlign = consumePendingTabAlignStart();
319333
+ if (pendingTabAlign != null) {
319334
+ const segment = {
319335
+ runIndex,
319336
+ fromChar: 0,
319337
+ toChar: 1,
319338
+ width: atomicWidth,
319339
+ x: pendingTabAlign.paintX,
319340
+ ...pendingTabAlign.precedingTabEndX !== undefined ? { precedingTabEndX: pendingTabAlign.precedingTabEndX } : {}
319341
+ };
319342
+ cursorX = pendingTabAlign.layoutX + atomicWidth;
319343
+ segments.push(segment);
319344
+ } else
319345
+ cursorX += atomicWidth;
318473
319346
  lineWidth = Math.max(lineWidth, cursorX);
318474
319347
  continue;
318475
319348
  }
@@ -323887,7 +324760,7 @@ menclose::after {
323887
324760
  }
323888
324761
  }, EMUS_PER_INCH = 914400, maxSize = 5000, cache, makeKey = (text5, font, letterSpacing) => {
323889
324762
  return `${text5}|${font}|${letterSpacing || 0}`;
323890
- }, fontMetricsCache, MAX_CACHE_SIZE = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", DEFAULT_MIN_COLUMN_WIDTH = 8, TWIPS_PER_PX$1 = 15, PLACEHOLDER_COLUMN_MAX_WIDTH = 1, DEFAULT_CELL_PADDING$1, DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1 = 16, FIELD_ANNOTATION_PILL_PADDING$1 = 8, TABLE_CELL_METRICS_CACHE_SIZE = 2000, TABLE_AUTOFIT_RESULT_CACHE_SIZE = 500, NO_WRAP_MAX_WIDTH, TOKEN_BOUNDARY_PATTERN, LruCache = class {
324763
+ }, fontMetricsCache, MAX_CACHE_SIZE = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", DEFAULT_MIN_COLUMN_WIDTH = 8, TWIPS_PER_PX$1 = 15, PLACEHOLDER_COLUMN_MAX_WIDTH = 1, DEFAULT_CELL_PADDING$1, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, FIELD_ANNOTATION_PILL_PADDING = 8, TABLE_CELL_METRICS_CACHE_SIZE = 2000, TABLE_AUTOFIT_RESULT_CACHE_SIZE = 500, NO_WRAP_MAX_WIDTH, TOKEN_BOUNDARY_PATTERN, LruCache = class {
323891
324764
  constructor(maxSize$1) {
323892
324765
  this.cache = /* @__PURE__ */ new Map;
323893
324766
  this.maxSize = maxSize$1;
@@ -323921,7 +324794,7 @@ menclose::after {
323921
324794
  this.cache.delete(oldestKey);
323922
324795
  }
323923
324796
  }
323924
- }, tableCellMetricsCache, autoFitTableResultCache, canvasContext$1 = null, computeTabStops2, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS2 = 720, TWIPS_PER_PX2, twipsToPx2 = (twips) => twips / TWIPS_PER_PX2, pxToTwips = (px) => Math.round(px * TWIPS_PER_PX2), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON = 0.1, DEFAULT_CELL_PADDING, DEFAULT_DECIMAL_SEPARATOR2 = ".", ALLOWED_TAB_VALS, FIELD_ANNOTATION_PILL_PADDING = 8, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, FIELD_ANNOTATION_VERTICAL_PADDING = 6, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize2 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
324797
+ }, tableCellMetricsCache, autoFitTableResultCache, canvasContext$1 = null, computeTabStops2, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS2 = 720, TWIPS_PER_PX2, twipsToPx2 = (twips) => twips / TWIPS_PER_PX2, pxToTwips = (px) => Math.round(px * TWIPS_PER_PX2), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON = 0.1, DEFAULT_CELL_PADDING, DEFAULT_DECIMAL_SEPARATOR2 = ".", ALLOWED_TAB_VALS, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize2 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
323925
324798
  if (isValidFontSize(value))
323926
324799
  return value;
323927
324800
  if (typeof value === "string") {
@@ -326493,13 +327366,13 @@ menclose::after {
326493
327366
  return;
326494
327367
  console.log(...args$1);
326495
327368
  }, 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;
326496
- var init_src_ly1ZYfUZ_es = __esm(() => {
327369
+ var init_src_bMRzO9Kl_es = __esm(() => {
326497
327370
  init_rolldown_runtime_Bg48TavK_es();
326498
- init_SuperConverter_DRKaQwZS_es();
327371
+ init_SuperConverter_Ed3nFN54_es();
326499
327372
  init_jszip_C49i9kUs_es();
326500
327373
  init_xml_js_CqGKpaft_es();
326501
327374
  init_uuid_B2wVPhPi_es();
326502
- init_create_headless_toolbar_ChACxHAH_es();
327375
+ init_create_headless_toolbar_PSeH6IV5_es();
326503
327376
  init_constants_D9qj59G2_es();
326504
327377
  init_unified_BDuVPlMu_es();
326505
327378
  init_remark_gfm_BUJjZJLy_es();
@@ -337046,7 +337919,10 @@ ${err.toString()}`);
337046
337919
  for (let r$1 = 0;r$1 < rows; r$1++) {
337047
337920
  const cellNodes = [];
337048
337921
  for (let c = 0;c < columns; c++) {
337049
- const cellAttrs = widths ? { colwidth: [widths[c]] } : {};
337922
+ const cellAttrs = widths ? {
337923
+ colwidth: [widths[c]],
337924
+ tableCellProperties: { cellWidth: cellWidthDxa(widths[c]) }
337925
+ } : {};
337050
337926
  const cell2 = tableCellType.createAndFill(cellAttrs);
337051
337927
  if (!cell2)
337052
337928
  return false;
@@ -339709,6 +340585,10 @@ ${err.toString()}`);
339709
340585
  return { style: attrs.style };
339710
340586
  } },
339711
340587
  wrapAttributes: { rendered: false },
340588
+ wrapperParagraph: {
340589
+ default: null,
340590
+ rendered: false
340591
+ },
339712
340592
  anchorData: { rendered: false },
339713
340593
  marginOffset: { rendered: false },
339714
340594
  attributes: { rendered: false },
@@ -361271,13 +362151,28 @@ function print() { __p += __j.call(arguments, '') }
361271
362151
  "single",
361272
362152
  "double",
361273
362153
  "dashed",
362154
+ "dashSmallGap",
361274
362155
  "dotted",
361275
362156
  "thick",
361276
362157
  "triple",
361277
362158
  "dotDash",
361278
362159
  "dotDotDash",
362160
+ "thinThickSmallGap",
362161
+ "thickThinSmallGap",
362162
+ "thinThickThinSmallGap",
362163
+ "thinThickMediumGap",
362164
+ "thickThinMediumGap",
362165
+ "thinThickThinMediumGap",
362166
+ "thinThickLargeGap",
362167
+ "thickThinLargeGap",
362168
+ "thinThickThinLargeGap",
361279
362169
  "wave",
361280
- "doubleWave"
362170
+ "doubleWave",
362171
+ "dashDotStroked",
362172
+ "threeDEmboss",
362173
+ "threeDEngrave",
362174
+ "outset",
362175
+ "inset"
361281
362176
  ]);
361282
362177
  BORDER_STYLE_NUMBER = {
361283
362178
  single: 1,
@@ -361288,8 +362183,23 @@ function print() { __p += __j.call(arguments, '') }
361288
362183
  dotDash: 6,
361289
362184
  dotDotDash: 7,
361290
362185
  triple: 8,
362186
+ thinThickSmallGap: 9,
362187
+ thickThinSmallGap: 10,
362188
+ thinThickThinSmallGap: 11,
362189
+ thinThickMediumGap: 12,
362190
+ thickThinMediumGap: 13,
362191
+ thinThickThinMediumGap: 14,
362192
+ thinThickLargeGap: 15,
362193
+ thickThinLargeGap: 16,
362194
+ thinThickThinLargeGap: 17,
361291
362195
  wave: 18,
361292
- doubleWave: 19
362196
+ doubleWave: 19,
362197
+ dashSmallGap: 20,
362198
+ dashDotStroked: 21,
362199
+ threeDEmboss: 22,
362200
+ threeDEngrave: 23,
362201
+ outset: 24,
362202
+ inset: 25
361293
362203
  };
361294
362204
  BORDER_STYLE_LINES = {
361295
362205
  single: 1,
@@ -361300,8 +362210,21 @@ function print() { __p += __j.call(arguments, '') }
361300
362210
  dotDash: 1,
361301
362211
  dotDotDash: 1,
361302
362212
  triple: 3,
362213
+ thinThickSmallGap: 2,
362214
+ thickThinSmallGap: 2,
362215
+ thinThickThinSmallGap: 3,
362216
+ thinThickMediumGap: 2,
362217
+ thickThinMediumGap: 2,
362218
+ thinThickThinMediumGap: 3,
362219
+ thinThickLargeGap: 2,
362220
+ thickThinLargeGap: 2,
362221
+ thinThickThinLargeGap: 3,
361303
362222
  wave: 1,
361304
- doubleWave: 2
362223
+ doubleWave: 2,
362224
+ dashSmallGap: 1,
362225
+ dashDotStroked: 1,
362226
+ threeDEmboss: 1,
362227
+ threeDEngrave: 1
361305
362228
  };
361306
362229
  PX_PER_PT$12 = 96 / 72;
361307
362230
  BORDER_SIDES3 = [
@@ -369754,11 +370677,11 @@ function print() { __p += __j.call(arguments, '') }
369754
370677
  ]);
369755
370678
  });
369756
370679
 
369757
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CjKDFHjb.es.js
370680
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DNNbMZCp.es.js
369758
370681
  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;
369759
- var init_create_super_doc_ui_CjKDFHjb_es = __esm(() => {
369760
- init_SuperConverter_DRKaQwZS_es();
369761
- init_create_headless_toolbar_ChACxHAH_es();
370682
+ var init_create_super_doc_ui_DNNbMZCp_es = __esm(() => {
370683
+ init_SuperConverter_Ed3nFN54_es();
370684
+ init_create_headless_toolbar_PSeH6IV5_es();
369762
370685
  DEFAULT_TEXT_ALIGN_OPTIONS = [
369763
370686
  {
369764
370687
  label: "Left",
@@ -370049,15 +370972,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
370049
370972
 
370050
370973
  // ../../packages/superdoc/dist/super-editor.es.js
370051
370974
  var init_super_editor_es = __esm(() => {
370052
- init_src_ly1ZYfUZ_es();
370053
- init_SuperConverter_DRKaQwZS_es();
370975
+ init_src_bMRzO9Kl_es();
370976
+ init_SuperConverter_Ed3nFN54_es();
370054
370977
  init_jszip_C49i9kUs_es();
370055
370978
  init_xml_js_CqGKpaft_es();
370056
- init_create_headless_toolbar_ChACxHAH_es();
370979
+ init_create_headless_toolbar_PSeH6IV5_es();
370057
370980
  init_constants_D9qj59G2_es();
370058
370981
  init_unified_BDuVPlMu_es();
370059
370982
  init_DocxZipper_BzS208BW_es();
370060
- init_create_super_doc_ui_CjKDFHjb_es();
370983
+ init_create_super_doc_ui_DNNbMZCp_es();
370061
370984
  init_ui_CGB3qmy3_es();
370062
370985
  init_eventemitter3_UwU_CLPU_es();
370063
370986
  init_errors_C_DoKMoN_es();