oasis-editor 0.0.89 → 0.0.91

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.
@@ -2519,7 +2519,7 @@ function OasisEditorAppLazy(props = {}) {
2519
2519
  onCleanup(() => {
2520
2520
  cancelled = true;
2521
2521
  });
2522
- import("./OasisEditorApp-cKm4OFIF.js").then((m) => {
2522
+ import("./OasisEditorApp-Cwd5XBHr.js").then((m) => {
2523
2523
  cancelled = true;
2524
2524
  setProgress(1);
2525
2525
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -3110,6 +3110,16 @@ const DEFAULT_TEXT_STYLE = asRequired({
3110
3110
  noProof: false,
3111
3111
  webHidden: false,
3112
3112
  specVanish: false,
3113
+ rtl: false,
3114
+ complexScript: false,
3115
+ snapToGrid: true,
3116
+ fitText: null,
3117
+ emphasisMark: null,
3118
+ textBorder: null,
3119
+ outline: false,
3120
+ shadow: false,
3121
+ emboss: false,
3122
+ imprint: false,
3113
3123
  textEffect: null,
3114
3124
  characterScale: null,
3115
3125
  characterSpacing: null,
@@ -3953,8 +3963,11 @@ function resolveEffectiveTableCellFormatting(options) {
3953
3963
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
3954
3964
  const { table, rowIndex, cellIndex, visualColumnIndex, columnCount, styles } = options;
3955
3965
  const named = resolveNamedTableStyle((_a = table.style) == null ? void 0 : _a.styleId, styles);
3956
- const baseTableStyle = mergeTableStyles(named.tableStyle, table.style);
3957
3966
  const row = table.rows[rowIndex];
3967
+ const baseTableStyle = (row == null ? void 0 : row.propertyExceptions) ? mergeTableStyles(
3968
+ mergeTableStyles(named.tableStyle, table.style),
3969
+ row.propertyExceptions
3970
+ ) : mergeTableStyles(named.tableStyle, table.style);
3958
3971
  const cell = row == null ? void 0 : row.cells[cellIndex];
3959
3972
  const keys = conditionalKeys({
3960
3973
  rowIndex,
@@ -5442,19 +5455,16 @@ function projectFootnoteBlocksForPage(document2, footnoteReferenceIds, page, tot
5442
5455
  for (const footnoteId of footnoteReferenceIds) {
5443
5456
  const footnote = (_b = (_a = document2.footnotes) == null ? void 0 : _a.items) == null ? void 0 : _b[footnoteId];
5444
5457
  if (!footnote) continue;
5445
- const projected = projectBlocks(
5446
- footnote.blocks,
5447
- {
5448
- pageIndex: page.index,
5449
- totalPages,
5450
- measuredHeights,
5451
- measuredParagraphLayouts,
5452
- styles: document2.styles,
5453
- contentWidth,
5454
- measurer,
5455
- defaultTabStop: (_c = document2.settings) == null ? void 0 : _c.defaultTabStop
5456
- }
5457
- );
5458
+ const projected = projectBlocks(footnote.blocks, {
5459
+ pageIndex: page.index,
5460
+ totalPages,
5461
+ measuredHeights,
5462
+ measuredParagraphLayouts,
5463
+ styles: document2.styles,
5464
+ contentWidth,
5465
+ measurer,
5466
+ defaultTabStop: (_c = document2.settings) == null ? void 0 : _c.defaultTabStop
5467
+ });
5458
5468
  for (const block of projected) {
5459
5469
  blocks.push({
5460
5470
  ...block,
@@ -12969,25 +12979,12 @@ function estimateTableRowHeight(row, styles, measurer, defaultTabStop, contentWi
12969
12979
  let blockHeights = 0;
12970
12980
  for (let blockIndex = 0; blockIndex < cell.blocks.length; blockIndex += 1) {
12971
12981
  const paragraph = cell.blocks[blockIndex];
12972
- const previousParagraph = cell.blocks[blockIndex - 1];
12973
- const nextParagraph = cell.blocks[blockIndex + 1];
12974
12982
  blockHeights += estimateParagraphBlockHeight(
12975
12983
  paragraph,
12976
12984
  styles,
12977
12985
  paragraphContentWidth,
12978
12986
  measurer,
12979
- {
12980
- allowSpacingBefore: !shouldCollapseContextualSpacing(
12981
- previousParagraph,
12982
- paragraph,
12983
- styles
12984
- ),
12985
- allowSpacingAfter: !shouldCollapseContextualSpacing(
12986
- paragraph,
12987
- nextParagraph,
12988
- styles
12989
- )
12990
- },
12987
+ {},
12991
12988
  defaultTabStop
12992
12989
  );
12993
12990
  }
@@ -13185,7 +13182,12 @@ function projectHeaderFooterBlocks(blocks, context2 = {}) {
13185
13182
  const MAX_COLUMN_BALANCE_ITERATIONS = 100;
13186
13183
  function projectColumnedBlocksLayout(context2, count, runTrackLayout) {
13187
13184
  var _a, _b;
13188
- const { pageSettings, maxPageHeight, pageOffset = 0, existingPages = [] } = context2;
13185
+ const {
13186
+ pageSettings,
13187
+ maxPageHeight,
13188
+ pageOffset = 0,
13189
+ existingPages = []
13190
+ } = context2;
13189
13191
  const colWidth = ((_a = getPageColumnRects(pageSettings)[0]) == null ? void 0 : _a.width) ?? getPageContentWidth(pageSettings);
13190
13192
  const runTracks = (blocks, trackHeight) => runTrackLayout({
13191
13193
  ...context2,
@@ -14283,19 +14285,16 @@ function resolveEffectiveVerticalMetrics(pageSettings, headerBlocks, footerBlock
14283
14285
  };
14284
14286
  }
14285
14287
  function createHeaderFooterVariantProjector(context2) {
14286
- return (blocks, contentWidth, pageIndex, totalPageCount) => blocks ? context2.projectHeaderFooterBlocks(
14287
- blocks,
14288
- {
14289
- pageIndex,
14290
- totalPages: totalPageCount,
14291
- measuredHeights: context2.measuredHeights,
14292
- measuredParagraphLayouts: context2.measuredParagraphLayouts,
14293
- styles: context2.documentStyles,
14294
- contentWidth,
14295
- measurer: context2.measurer,
14296
- defaultTabStop: context2.defaultTabStop
14297
- }
14298
- ) : void 0;
14288
+ return (blocks, contentWidth, pageIndex, totalPageCount) => blocks ? context2.projectHeaderFooterBlocks(blocks, {
14289
+ pageIndex,
14290
+ totalPages: totalPageCount,
14291
+ measuredHeights: context2.measuredHeights,
14292
+ measuredParagraphLayouts: context2.measuredParagraphLayouts,
14293
+ styles: context2.documentStyles,
14294
+ contentWidth,
14295
+ measurer: context2.measurer,
14296
+ defaultTabStop: context2.defaultTabStop
14297
+ }) : void 0;
14299
14298
  }
14300
14299
  function projectTallestHeaderVariant(section, contentWidth, projectHeaderFooterVariant) {
14301
14300
  const variants = [
@@ -15157,6 +15156,35 @@ function resolveTableIndentLeft(table) {
15157
15156
  const raw = (_a = table.style) == null ? void 0 : _a.indentLeft;
15158
15157
  return typeof raw === "number" && Number.isFinite(raw) ? toPx(raw) : 0;
15159
15158
  }
15159
+ function resolveTableCellSpacingPx(table) {
15160
+ var _a;
15161
+ const px = parseDimensionToPx((_a = table.style) == null ? void 0 : _a.cellSpacing);
15162
+ return px !== null && px > 0 ? px : 0;
15163
+ }
15164
+ function lineNaturalWidth(line) {
15165
+ if (line.slots.length < 2) return 0;
15166
+ return line.slots[line.slots.length - 1].left - line.slots[0].left;
15167
+ }
15168
+ function applyFitTextScale(paragraph, scalePercent) {
15169
+ return {
15170
+ ...paragraph,
15171
+ runs: paragraph.runs.map((run) => {
15172
+ var _a;
15173
+ const existing = (_a = run.styles) == null ? void 0 : _a.characterScale;
15174
+ const combined = typeof existing === "number" && existing > 0 ? existing * scalePercent / 100 : scalePercent;
15175
+ return { ...run, styles: { ...run.styles, characterScale: combined } };
15176
+ })
15177
+ };
15178
+ }
15179
+ function resolveTableLeftOffset(table, tableWidth, contentWidth) {
15180
+ var _a;
15181
+ const align = (_a = table.style) == null ? void 0 : _a.align;
15182
+ if (align === "center" || align === "right") {
15183
+ const slack = Math.max(0, contentWidth - tableWidth);
15184
+ return align === "center" ? slack / 2 : slack;
15185
+ }
15186
+ return resolveTableIndentLeft(table);
15187
+ }
15160
15188
  function resolveDefaultBorder() {
15161
15189
  return { width: 1, color: "#6f6f6f", type: "solid" };
15162
15190
  }
@@ -15220,7 +15248,7 @@ function resolveVerticalContentOffset(cell, contentHeightPx, contentNaturalHeigh
15220
15248
  return 0;
15221
15249
  }
15222
15250
  function buildCanvasTableLayout(options) {
15223
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
15251
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
15224
15252
  const {
15225
15253
  table: sourceTable,
15226
15254
  state,
@@ -15235,7 +15263,8 @@ function buildCanvasTableLayout(options) {
15235
15263
  style: resolveEffectiveTableStyle(sourceTable, state.document.styles)
15236
15264
  };
15237
15265
  const tableWidth = resolveCanvasTableWidth(table, contentWidth);
15238
- const tableLeft = originX + resolveTableIndentLeft(table);
15266
+ const tableLeft = originX + resolveTableLeftOffset(table, tableWidth, contentWidth);
15267
+ const cellSpacingPx = resolveTableCellSpacingPx(table);
15239
15268
  const tableEntries = buildTableCellLayout(table);
15240
15269
  const unsupported = [];
15241
15270
  const visualColumnCount = Math.max(
@@ -15244,13 +15273,17 @@ function buildCanvasTableLayout(options) {
15244
15273
  (entry) => entry.visualColumnIndex + Math.max(1, entry.colSpan)
15245
15274
  )
15246
15275
  );
15276
+ const columnsWidthBudget = Math.max(
15277
+ visualColumnCount,
15278
+ tableWidth - (visualColumnCount + 1) * cellSpacingPx
15279
+ );
15247
15280
  let resolvedColumnWidths = [];
15248
15281
  if (table.gridCols && table.gridCols.length >= visualColumnCount) {
15249
15282
  const gridTotalWidth = table.gridCols.reduce((a, b) => a + b, 0);
15250
- const scale = gridTotalWidth > 0 ? tableWidth / gridTotalWidth : 1;
15283
+ const scale = gridTotalWidth > 0 ? columnsWidthBudget / gridTotalWidth : 1;
15251
15284
  resolvedColumnWidths = table.gridCols.map((w) => w * scale);
15252
15285
  } else {
15253
- const baseCellWidth = tableWidth / visualColumnCount;
15286
+ const baseCellWidth = columnsWidthBudget / visualColumnCount;
15254
15287
  resolvedColumnWidths = Array(visualColumnCount).fill(baseCellWidth);
15255
15288
  for (const entry of tableEntries) {
15256
15289
  if (Math.max(1, entry.colSpan) !== 1) continue;
@@ -15273,9 +15306,9 @@ function buildCanvasTableLayout(options) {
15273
15306
  }
15274
15307
  }
15275
15308
  }
15276
- const columnOffsets = [0];
15309
+ const columnOffsets = [cellSpacingPx];
15277
15310
  for (let i = 0; i < resolvedColumnWidths.length; i++) {
15278
- columnOffsets[i + 1] = columnOffsets[i] + resolvedColumnWidths[i];
15311
+ columnOffsets[i + 1] = columnOffsets[i] + resolvedColumnWidths[i] + cellSpacingPx;
15279
15312
  }
15280
15313
  const cellEntriesByKey = new Map(
15281
15314
  tableEntries.map(
@@ -15301,8 +15334,14 @@ function buildCanvasTableLayout(options) {
15301
15334
  if ((_f = effectiveRowStyles[rowIndex]) == null ? void 0 : _f.hidden) {
15302
15335
  continue;
15303
15336
  }
15337
+ if (((_h = (_g = effectiveRowStyles[rowIndex]) == null ? void 0 : _g.revision) == null ? void 0 : _h.type) === "delete") {
15338
+ continue;
15339
+ }
15304
15340
  for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
15305
15341
  const sourceCell = row.cells[cellIndex];
15342
+ if (((_j = (_i = sourceCell.style) == null ? void 0 : _i.revision) == null ? void 0 : _j.type) === "delete") {
15343
+ continue;
15344
+ }
15306
15345
  const entry = cellEntriesByKey.get(`${rowIndex}:${cellIndex}`);
15307
15346
  if (!entry) {
15308
15347
  continue;
@@ -15349,22 +15388,22 @@ function buildCanvasTableLayout(options) {
15349
15388
  const colSpan = Math.max(1, entry.colSpan);
15350
15389
  const width = Math.max(
15351
15390
  1,
15352
- (columnOffsets[visualCol + colSpan] ?? tableWidth) - (columnOffsets[visualCol] ?? 0)
15391
+ (columnOffsets[visualCol + colSpan] ?? tableWidth) - (columnOffsets[visualCol] ?? 0) - cellSpacingPx
15353
15392
  );
15354
15393
  const padding = resolveCellPadding(cell);
15355
- const logicalLeft = ((_g = table.style) == null ? void 0 : _g.bidiVisual) ? (_h = cell.style) == null ? void 0 : _h.borderEnd : (_i = cell.style) == null ? void 0 : _i.borderStart;
15356
- const logicalRight = ((_j = table.style) == null ? void 0 : _j.bidiVisual) ? (_k = cell.style) == null ? void 0 : _k.borderStart : (_l = cell.style) == null ? void 0 : _l.borderEnd;
15394
+ const logicalLeft = ((_k = table.style) == null ? void 0 : _k.bidiVisual) ? (_l = cell.style) == null ? void 0 : _l.borderEnd : (_m = cell.style) == null ? void 0 : _m.borderStart;
15395
+ const logicalRight = ((_n = table.style) == null ? void 0 : _n.bidiVisual) ? (_o = cell.style) == null ? void 0 : _o.borderStart : (_p = cell.style) == null ? void 0 : _p.borderEnd;
15357
15396
  const borders = {
15358
- top: resolveBorder((_m = cell.style) == null ? void 0 : _m.borderTop),
15359
- right: resolveBorder(((_n = cell.style) == null ? void 0 : _n.borderRight) ?? logicalRight),
15360
- bottom: resolveBorder((_o = cell.style) == null ? void 0 : _o.borderBottom),
15361
- left: resolveBorder(((_p = cell.style) == null ? void 0 : _p.borderLeft) ?? logicalLeft),
15362
- ...((_q = cell.style) == null ? void 0 : _q.borderTopLeftToBottomRight) ? {
15397
+ top: resolveBorder((_q = cell.style) == null ? void 0 : _q.borderTop),
15398
+ right: resolveBorder(((_r = cell.style) == null ? void 0 : _r.borderRight) ?? logicalRight),
15399
+ bottom: resolveBorder((_s = cell.style) == null ? void 0 : _s.borderBottom),
15400
+ left: resolveBorder(((_t = cell.style) == null ? void 0 : _t.borderLeft) ?? logicalLeft),
15401
+ ...((_u = cell.style) == null ? void 0 : _u.borderTopLeftToBottomRight) ? {
15363
15402
  topLeftToBottomRight: resolveBorder(
15364
15403
  cell.style.borderTopLeftToBottomRight
15365
15404
  )
15366
15405
  } : {},
15367
- ...((_r = cell.style) == null ? void 0 : _r.borderTopRightToBottomLeft) ? {
15406
+ ...((_v = cell.style) == null ? void 0 : _v.borderTopRightToBottomLeft) ? {
15368
15407
  topRightToBottomLeft: resolveBorder(
15369
15408
  cell.style.borderTopRightToBottomLeft
15370
15409
  )
@@ -15377,15 +15416,35 @@ function buildCanvasTableLayout(options) {
15377
15416
  const verticalMode = resolveCellVerticalMode(cell);
15378
15417
  const isRotated = verticalMode === "rotate-cw" || verticalMode === "rotate-ccw";
15379
15418
  const isStacked = verticalMode === "stack";
15419
+ const isFitText = !!((_w = cell.style) == null ? void 0 : _w.fitText) && !isRotated && !isStacked;
15380
15420
  const explicitRowHeightPx = parseDimensionToPx(effectiveRow.height);
15381
- const wrapWidth = isRotated || ((_s = cell.style) == null ? void 0 : _s.noWrap) ? isRotated && explicitRowHeightPx !== null && explicitRowHeightPx > 0 ? Math.max(
15421
+ const wrapWidth = isRotated || ((_x = cell.style) == null ? void 0 : _x.noWrap) ? isRotated && explicitRowHeightPx !== null && explicitRowHeightPx > 0 ? Math.max(
15382
15422
  MIN_TABLE_CELL_CONTENT_WIDTH_PX,
15383
15423
  explicitRowHeightPx - borders.top.width - borders.bottom.width - padding.top - padding.bottom
15384
15424
  ) : NO_WRAP_WIDTH_PX : contentWidthPx;
15385
15425
  const projectedParagraphs = [];
15386
15426
  let contentNaturalHeightPx = 0;
15387
15427
  for (const original of cell.blocks) {
15388
- const paragraph = fitImagesToCellWidth(original, contentWidthPx);
15428
+ let paragraph = fitImagesToCellWidth(original, contentWidthPx);
15429
+ if (isFitText) {
15430
+ const noWrapProjected = projectParagraphLayout(
15431
+ paragraph,
15432
+ pageIndex,
15433
+ void 0,
15434
+ state.document.styles,
15435
+ NO_WRAP_WIDTH_PX,
15436
+ void 0,
15437
+ (_y = state.document.settings) == null ? void 0 : _y.defaultTabStop
15438
+ );
15439
+ const naturalWidth = noWrapProjected.lines.length > 0 ? lineNaturalWidth(noWrapProjected.lines[0]) : 0;
15440
+ if (naturalWidth > 0 && contentWidthPx > 0) {
15441
+ const scalePercent = Math.max(
15442
+ 1,
15443
+ Math.min(600, contentWidthPx / naturalWidth * 100)
15444
+ );
15445
+ paragraph = applyFitTextScale(paragraph, scalePercent);
15446
+ }
15447
+ }
15389
15448
  const paragraphStyle = resolveEffectiveParagraphStyle(
15390
15449
  paragraph.style,
15391
15450
  state.document.styles
@@ -15402,7 +15461,7 @@ function buildCanvasTableLayout(options) {
15402
15461
  spacingAfter
15403
15462
  });
15404
15463
  const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
15405
- const paragraphStyleSize = ((_u = (_t = paragraph.runs[0]) == null ? void 0 : _t.styles) == null ? void 0 : _u.fontSize) ?? 14.6667;
15464
+ const paragraphStyleSize = ((_A = (_z = paragraph.runs[0]) == null ? void 0 : _z.styles) == null ? void 0 : _A.fontSize) ?? 14.6667;
15406
15465
  contentNaturalHeightPx = Math.max(
15407
15466
  contentNaturalHeightPx,
15408
15467
  hasExplicitRowHeight ? paragraphStyleSize * 1.25 : stackLength
@@ -15416,23 +15475,38 @@ function buildCanvasTableLayout(options) {
15416
15475
  state.document.styles,
15417
15476
  wrapWidth,
15418
15477
  void 0,
15419
- (_v = state.document.settings) == null ? void 0 : _v.defaultTabStop
15478
+ (_B = state.document.settings) == null ? void 0 : _B.defaultTabStop
15420
15479
  );
15421
15480
  const linesBottom = projected.lines.length > 0 ? Math.max(...projected.lines.map((line) => line.top + line.height)) : 1;
15422
15481
  let effectiveSpacingBefore = spacingBefore;
15423
15482
  if (!isRotated && projectedParagraphs.length > 0) {
15424
15483
  const previous = projectedParagraphs[projectedParagraphs.length - 1];
15425
- const collapsed = Math.min(previous.spacingAfter, spacingBefore);
15426
- if (collapsed > 0) {
15427
- if (previous.spacingAfter >= spacingBefore) {
15428
- effectiveSpacingBefore = 0;
15429
- } else {
15430
- const previousHeight = previous.height;
15431
- previous.height = Math.max(1, previous.height - collapsed);
15432
- contentNaturalHeightPx = Math.max(
15433
- 0,
15434
- contentNaturalHeightPx - (previousHeight - previous.height)
15435
- );
15484
+ if (((_C = state.document.settings) == null ? void 0 : _C.allowSpaceOfSameStyleInTable) && shouldCollapseContextualSpacing(
15485
+ previous.paragraph,
15486
+ paragraph,
15487
+ state.document.styles
15488
+ )) {
15489
+ const removedAfter = previous.spacingAfter;
15490
+ previous.height = Math.max(1, previous.height - removedAfter);
15491
+ previous.spacingAfter = 0;
15492
+ contentNaturalHeightPx = Math.max(
15493
+ 0,
15494
+ contentNaturalHeightPx - removedAfter
15495
+ );
15496
+ effectiveSpacingBefore = 0;
15497
+ } else {
15498
+ const collapsed = Math.min(previous.spacingAfter, spacingBefore);
15499
+ if (collapsed > 0) {
15500
+ if (previous.spacingAfter >= spacingBefore) {
15501
+ effectiveSpacingBefore = 0;
15502
+ } else {
15503
+ const previousHeight = previous.height;
15504
+ previous.height = Math.max(1, previous.height - collapsed);
15505
+ contentNaturalHeightPx = Math.max(
15506
+ 0,
15507
+ contentNaturalHeightPx - (previousHeight - previous.height)
15508
+ );
15509
+ }
15436
15510
  }
15437
15511
  }
15438
15512
  }
@@ -15464,6 +15538,16 @@ function buildCanvasTableLayout(options) {
15464
15538
  contentNaturalHeightPx += paragraphHeight;
15465
15539
  }
15466
15540
  }
15541
+ if ((_D = cell.style) == null ? void 0 : _D.hideMark) {
15542
+ const allEmpty = cell.blocks.every(
15543
+ (para) => para.runs.every(
15544
+ (run) => (run.kind === "text" || run.kind === void 0) && (!run.text || run.text.length === 0)
15545
+ )
15546
+ );
15547
+ if (allEmpty) {
15548
+ contentNaturalHeightPx = 0;
15549
+ }
15550
+ }
15467
15551
  prepared.push({
15468
15552
  rowIndex,
15469
15553
  cellIndex,
@@ -15483,9 +15567,10 @@ function buildCanvasTableLayout(options) {
15483
15567
  }
15484
15568
  const rowCount = Math.max(1, table.rows.length);
15485
15569
  const explicitRowHeights = table.rows.map((row) => {
15570
+ var _a2;
15486
15571
  const rowIndex = table.rows.indexOf(row);
15487
15572
  const effective = effectiveRowStyles[rowIndex];
15488
- if (effective == null ? void 0 : effective.hidden) {
15573
+ if ((effective == null ? void 0 : effective.hidden) || ((_a2 = effective == null ? void 0 : effective.revision) == null ? void 0 : _a2.type) === "delete") {
15489
15574
  return 0;
15490
15575
  }
15491
15576
  const explicit = parseDimensionToPx(effective == null ? void 0 : effective.height);
@@ -15494,7 +15579,7 @@ function buildCanvasTableLayout(options) {
15494
15579
  const fallbackPerRow = estimatedHeight > 0 ? estimatedHeight / rowCount : DEFAULT_TABLE_ROW_HEIGHT;
15495
15580
  const rowHeights = [];
15496
15581
  for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
15497
- if ((_w = effectiveRowStyles[rowIndex]) == null ? void 0 : _w.hidden) {
15582
+ if (((_E = effectiveRowStyles[rowIndex]) == null ? void 0 : _E.hidden) || ((_G = (_F = effectiveRowStyles[rowIndex]) == null ? void 0 : _F.revision) == null ? void 0 : _G.type) === "delete") {
15498
15583
  rowHeights[rowIndex] = 0;
15499
15584
  continue;
15500
15585
  }
@@ -15510,10 +15595,10 @@ function buildCanvasTableLayout(options) {
15510
15595
  rowHeights[rowIndex] = Math.max(baseFloor, measured, 1);
15511
15596
  }
15512
15597
  const rowOffsets = [];
15513
- let cumulativeY = 0;
15598
+ let cumulativeY = cellSpacingPx;
15514
15599
  for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
15515
15600
  rowOffsets[rowIndex] = cumulativeY;
15516
- cumulativeY += rowHeights[rowIndex] ?? DEFAULT_TABLE_ROW_HEIGHT;
15601
+ cumulativeY += (rowHeights[rowIndex] ?? DEFAULT_TABLE_ROW_HEIGHT) + cellSpacingPx;
15517
15602
  }
15518
15603
  const cells = [];
15519
15604
  for (const cellEntry of prepared) {
@@ -15532,7 +15617,7 @@ function buildCanvasTableLayout(options) {
15532
15617
  const top = originY + (rowOffsets[rowIndex] ?? 0);
15533
15618
  const height = Math.max(
15534
15619
  1,
15535
- rowHeights.slice(rowIndex, rowIndex + rowSpan).reduce((sum, current) => sum + current, 0)
15620
+ rowHeights.slice(rowIndex, rowIndex + rowSpan).reduce((sum, current) => sum + current, 0) + (rowSpan - 1) * cellSpacingPx
15536
15621
  );
15537
15622
  const contentLeft = left + borders.left.width + padding.left;
15538
15623
  const contentTop = top + borders.top.width + padding.top;
@@ -15578,13 +15663,13 @@ function buildCanvasTableLayout(options) {
15578
15663
  contentTop,
15579
15664
  contentWidth: contentWidthPx,
15580
15665
  contentHeight: contentHeightPx,
15581
- shading: (_x = cell.style) == null ? void 0 : _x.shading,
15666
+ shading: (_H = cell.style) == null ? void 0 : _H.shading,
15582
15667
  anchorPosition,
15583
15668
  padding,
15584
15669
  borders,
15585
15670
  paragraphs,
15586
15671
  verticalMode: cellEntry.verticalMode,
15587
- revision: ((_y = cell.style) == null ? void 0 : _y.revision) ?? (((_z = cell.style) == null ? void 0 : _z.propertyRevision) ? { ...cell.style.propertyRevision, type: "property" } : void 0)
15672
+ revision: ((_I = cell.style) == null ? void 0 : _I.revision) ?? (((_J = cell.style) == null ? void 0 : _J.propertyRevision) ? { ...cell.style.propertyRevision, type: "property" } : void 0)
15588
15673
  });
15589
15674
  }
15590
15675
  return {
@@ -15592,7 +15677,8 @@ function buildCanvasTableLayout(options) {
15592
15677
  left: tableLeft,
15593
15678
  top: originY,
15594
15679
  width: tableWidth,
15595
- height: rowHeights.reduce((sum, current) => sum + current, 0),
15680
+ // Total height includes the leading/trailing/inter-row cell-spacing gaps.
15681
+ height: rowHeights.reduce((sum, current) => sum + current, 0) + (rowHeights.length + 1) * cellSpacingPx,
15596
15682
  rowHeights,
15597
15683
  cells,
15598
15684
  unsupported: Array.from(new Set(unsupported))
@@ -18557,7 +18643,9 @@ async function loadPreciseFontProgramsForFamilies(families) {
18557
18643
  const buffer = await font.blob().then((blob) => blob.arrayBuffer());
18558
18644
  const program = selectFaceProgram(new Uint8Array(buffer), font);
18559
18645
  registerPreciseFont(family, bold, italic, program);
18560
- registered.push(`${family} ${bold ? "B" : ""}${italic ? "I" : ""}`.trim());
18646
+ registered.push(
18647
+ `${family} ${bold ? "B" : ""}${italic ? "I" : ""}`.trim()
18648
+ );
18561
18649
  changed = true;
18562
18650
  } catch (error) {
18563
18651
  failed.push(`${family} (${font.style ?? "?"}): ${String(error)}`);
@@ -20568,6 +20656,36 @@ function underlineStyleDashArray(underlineStyle) {
20568
20656
  return void 0;
20569
20657
  }
20570
20658
  }
20659
+ function drawEdge(ctx, border, x1, y1, x2, y2) {
20660
+ if (!border || border.type === "none" || border.width <= 0) {
20661
+ return;
20662
+ }
20663
+ ctx.save();
20664
+ ctx.beginPath();
20665
+ ctx.strokeStyle = border.color;
20666
+ ctx.lineWidth = border.width;
20667
+ if (border.type === "dashed") {
20668
+ ctx.setLineDash([5, 3]);
20669
+ } else if (border.type === "dotted") {
20670
+ ctx.setLineDash([1, 3]);
20671
+ } else {
20672
+ ctx.setLineDash([]);
20673
+ }
20674
+ ctx.moveTo(x1, y1);
20675
+ ctx.lineTo(x2, y2);
20676
+ ctx.stroke();
20677
+ ctx.restore();
20678
+ }
20679
+ function drawBorderBox(ctx, left, top, width, height, borders) {
20680
+ const right = left + width;
20681
+ const bottom = top + height;
20682
+ drawEdge(ctx, borders.top, left, top, right, top);
20683
+ drawEdge(ctx, borders.right, right, top, right, bottom);
20684
+ drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
20685
+ drawEdge(ctx, borders.left, left, top, left, bottom);
20686
+ drawEdge(ctx, borders.topLeftToBottomRight, left, top, right, bottom);
20687
+ drawEdge(ctx, borders.topRightToBottomLeft, right, top, left, bottom);
20688
+ }
20571
20689
  const canvasTextLogger = createEditorLogger("canvas-text");
20572
20690
  const loggedCanvasFontKeys = /* @__PURE__ */ new Set();
20573
20691
  const MAX_CANVAS_FONT_LOGS = 40;
@@ -20824,6 +20942,16 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
20824
20942
  styles.highlight
20825
20943
  );
20826
20944
  }
20945
+ if (styles.textBorder) {
20946
+ drawFragmentBorder(
20947
+ ctx,
20948
+ line,
20949
+ fragment,
20950
+ originX,
20951
+ originY,
20952
+ styles.textBorder
20953
+ );
20954
+ }
20827
20955
  if (fragment.image && !fragment.image.floating) {
20828
20956
  const slot = slotByOffset.get(fragment.startOffset);
20829
20957
  if (slot) {
@@ -20898,6 +21026,18 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
20898
21026
  "doubleStrike"
20899
21027
  );
20900
21028
  }
21029
+ if (styles.emphasisMark) {
21030
+ drawFragmentEmphasis(
21031
+ ctx,
21032
+ line,
21033
+ fragment,
21034
+ slotByOffset,
21035
+ originX,
21036
+ originY,
21037
+ styles.emphasisMark,
21038
+ styles.color ?? "#000000"
21039
+ );
21040
+ }
20901
21041
  ctx.restore();
20902
21042
  }
20903
21043
  const isLastLine = line.index === lines.length - 1;
@@ -20977,6 +21117,82 @@ function drawScaledText(ctx, text, x, y, scale) {
20977
21117
  ctx.fillText(text, 0, 0);
20978
21118
  ctx.restore();
20979
21119
  }
21120
+ function drawStyledText(ctx, text, x, y, scale, styles) {
21121
+ if (!styles.outline && !styles.shadow && !styles.emboss && !styles.imprint) {
21122
+ drawScaledText(ctx, text, x, y, scale);
21123
+ return;
21124
+ }
21125
+ if (styles.emboss || styles.imprint) {
21126
+ const offset = styles.imprint ? 1 : -1;
21127
+ ctx.save();
21128
+ ctx.shadowColor = "transparent";
21129
+ ctx.fillStyle = "rgba(255,255,255,0.75)";
21130
+ drawScaledText(ctx, text, x + offset, y + offset, scale);
21131
+ ctx.restore();
21132
+ }
21133
+ ctx.save();
21134
+ if (styles.shadow) {
21135
+ ctx.shadowColor = "rgba(0,0,0,0.45)";
21136
+ ctx.shadowOffsetX = 1;
21137
+ ctx.shadowOffsetY = 1;
21138
+ ctx.shadowBlur = 1;
21139
+ }
21140
+ if (styles.outline) {
21141
+ ctx.strokeStyle = ctx.fillStyle;
21142
+ ctx.lineWidth = 0.75;
21143
+ if (scale === 1) {
21144
+ ctx.strokeText(text, x, y);
21145
+ } else {
21146
+ ctx.translate(x, y);
21147
+ ctx.scale(scale, 1);
21148
+ ctx.strokeText(text, 0, 0);
21149
+ }
21150
+ } else {
21151
+ drawScaledText(ctx, text, x, y, scale);
21152
+ }
21153
+ ctx.restore();
21154
+ }
21155
+ function drawFragmentBorder(ctx, line, fragment, originX, originY, border) {
21156
+ if (border.type === "none" || border.width <= 0) return;
21157
+ const bounds = resolveFragmentPaintBounds(line, fragment);
21158
+ if (!bounds) return;
21159
+ const edge = { ...border, width: Math.max(0.5, border.width * PX_PER_POINT) };
21160
+ drawBorderBox(
21161
+ ctx,
21162
+ originX + bounds.left,
21163
+ originY + line.top + 1,
21164
+ Math.max(0, bounds.right - bounds.left),
21165
+ Math.max(2, line.height - 2),
21166
+ { top: edge, right: edge, bottom: edge, left: edge }
21167
+ );
21168
+ }
21169
+ const EMPHASIS_GLYPH = {
21170
+ dot: "•",
21171
+ comma: "‚",
21172
+ circle: "○",
21173
+ underDot: "•"
21174
+ };
21175
+ function drawFragmentEmphasis(ctx, line, fragment, slotByOffset, originX, originY, mark, color) {
21176
+ if (mark === "none") return;
21177
+ const glyph = EMPHASIS_GLYPH[mark];
21178
+ if (!glyph) return;
21179
+ const below = mark === "underDot";
21180
+ const y = below ? originY + line.top + line.height + 1 : originY + line.top + 2;
21181
+ ctx.save();
21182
+ ctx.fillStyle = color;
21183
+ ctx.textAlign = "center";
21184
+ ctx.textBaseline = below ? "top" : "bottom";
21185
+ ctx.font = `400 ${Math.max(6, line.height * 0.35)}px Calibri`;
21186
+ for (const char of fragment.chars) {
21187
+ if (char.char === "\n" || char.char === " " || char.char === " ") continue;
21188
+ const slot = slotByOffset.get(char.paragraphOffset);
21189
+ const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
21190
+ if (!slot) continue;
21191
+ const centerX = nextSlot ? (slot.left + nextSlot.left) / 2 : slot.left + line.height * 0.25;
21192
+ ctx.fillText(glyph, originX + centerX, y);
21193
+ }
21194
+ ctx.restore();
21195
+ }
20980
21196
  function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, styles, originX, baselineY) {
20981
21197
  const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
20982
21198
  const hasManualCharacterSpacing = styles.characterSpacing !== void 0 && styles.characterSpacing !== null && styles.characterSpacing !== 0;
@@ -20988,7 +21204,14 @@ function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, s
20988
21204
  segmentLeft = null;
20989
21205
  return;
20990
21206
  }
20991
- drawScaledText(ctx, segmentText, originX + segmentLeft, baselineY, scale);
21207
+ drawStyledText(
21208
+ ctx,
21209
+ segmentText,
21210
+ originX + segmentLeft,
21211
+ baselineY,
21212
+ scale,
21213
+ styles
21214
+ );
20992
21215
  segmentText = "";
20993
21216
  segmentLeft = null;
20994
21217
  };
@@ -21020,7 +21243,14 @@ function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, s
21020
21243
  const renderedChar = getRenderedChar(char.char, styles);
21021
21244
  if (hasManualCharacterSpacing) {
21022
21245
  flushSegment();
21023
- drawScaledText(ctx, renderedChar, originX + slot.left, baselineY, scale);
21246
+ drawStyledText(
21247
+ ctx,
21248
+ renderedChar,
21249
+ originX + slot.left,
21250
+ baselineY,
21251
+ scale,
21252
+ styles
21253
+ );
21024
21254
  continue;
21025
21255
  }
21026
21256
  if (char.char === " ") {
@@ -21105,36 +21335,6 @@ function drawWavyLine(ctx, x1, x2, y) {
21105
21335
  }
21106
21336
  ctx.stroke();
21107
21337
  }
21108
- function drawEdge(ctx, border, x1, y1, x2, y2) {
21109
- if (!border || border.type === "none" || border.width <= 0) {
21110
- return;
21111
- }
21112
- ctx.save();
21113
- ctx.beginPath();
21114
- ctx.strokeStyle = border.color;
21115
- ctx.lineWidth = border.width;
21116
- if (border.type === "dashed") {
21117
- ctx.setLineDash([5, 3]);
21118
- } else if (border.type === "dotted") {
21119
- ctx.setLineDash([1, 3]);
21120
- } else {
21121
- ctx.setLineDash([]);
21122
- }
21123
- ctx.moveTo(x1, y1);
21124
- ctx.lineTo(x2, y2);
21125
- ctx.stroke();
21126
- ctx.restore();
21127
- }
21128
- function drawBorderBox(ctx, left, top, width, height, borders) {
21129
- const right = left + width;
21130
- const bottom = top + height;
21131
- drawEdge(ctx, borders.top, left, top, right, top);
21132
- drawEdge(ctx, borders.right, right, top, right, bottom);
21133
- drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
21134
- drawEdge(ctx, borders.left, left, top, left, bottom);
21135
- drawEdge(ctx, borders.topLeftToBottomRight, left, top, right, bottom);
21136
- drawEdge(ctx, borders.topRightToBottomLeft, right, top, left, bottom);
21137
- }
21138
21338
  const __vite_import_meta_env__ = { "DEV": false };
21139
21339
  function drawVerticalCell(ctx, cell, state, pageIndex, onUpdate, painters) {
21140
21340
  const box = {
@@ -31942,6 +32142,7 @@ const WORD_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
31942
32142
  const DRAWINGML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
31943
32143
  const OFFICE_REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
31944
32144
  const WORD14_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
32145
+ const MARKUP_COMPAT_NS = "http://schemas.openxmlformats.org/markup-compatibility/2006";
31945
32146
  function getChildrenByTagNameNS(element, namespace, localName) {
31946
32147
  if (!element) {
31947
32148
  return [];
@@ -31949,8 +32150,22 @@ function getChildrenByTagNameNS(element, namespace, localName) {
31949
32150
  const result = [];
31950
32151
  for (let index = 0; index < element.childNodes.length; index += 1) {
31951
32152
  const node = element.childNodes[index];
31952
- if ((node == null ? void 0 : node.nodeType) === node.ELEMENT_NODE && node.namespaceURI === namespace && node.localName === localName) {
31953
- result.push(node);
32153
+ if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) continue;
32154
+ const el = node;
32155
+ if (el.namespaceURI === MARKUP_COMPAT_NS && el.localName === "AlternateContent") {
32156
+ for (let j = 0; j < el.childNodes.length; j += 1) {
32157
+ const child = el.childNodes[j];
32158
+ if ((child == null ? void 0 : child.nodeType) !== child.ELEMENT_NODE) continue;
32159
+ const childEl = child;
32160
+ if (childEl.namespaceURI === MARKUP_COMPAT_NS && childEl.localName === "Fallback") {
32161
+ result.push(...getChildrenByTagNameNS(childEl, namespace, localName));
32162
+ break;
32163
+ }
32164
+ }
32165
+ continue;
32166
+ }
32167
+ if (el.namespaceURI === namespace && el.localName === localName) {
32168
+ result.push(el);
31954
32169
  }
31955
32170
  }
31956
32171
  return result;
@@ -31986,6 +32201,19 @@ function findElementDeep(element, localName) {
31986
32201
  }
31987
32202
  return null;
31988
32203
  }
32204
+ function collectExtAttributes(element) {
32205
+ const result = {};
32206
+ const attrs = element.attributes;
32207
+ for (let i = 0; i < attrs.length; i += 1) {
32208
+ const attr = attrs[i];
32209
+ if (!attr) continue;
32210
+ const ns = attr.namespaceURI;
32211
+ if (!ns || ns === WORD_NS) continue;
32212
+ if (attr.prefix === "xmlns" || attr.localName === "xmlns") continue;
32213
+ result[`${attr.prefix}:${attr.localName}`] = attr.value;
32214
+ }
32215
+ return Object.keys(result).length > 0 ? result : void 0;
32216
+ }
31989
32217
  function isWordTrue(value) {
31990
32218
  return value === "1" || value === "true" || value === "on";
31991
32219
  }
@@ -32358,6 +32586,15 @@ function parseSettings(xml) {
32358
32586
  const val = getAttributeValue(adjustLineHeightInTable, "val");
32359
32587
  settings.adjustLineHeightInTable = val !== "0" && val !== "false";
32360
32588
  }
32589
+ const allowSpace = getFirstChildByTagNameNS(
32590
+ compat,
32591
+ WORD_NS,
32592
+ "allowSpaceOfSameStyleInTable"
32593
+ );
32594
+ if (allowSpace) {
32595
+ const val = getAttributeValue(allowSpace, "val");
32596
+ settings.allowSpaceOfSameStyleInTable = val !== "0" && val !== "false";
32597
+ }
32361
32598
  }
32362
32599
  return settings;
32363
32600
  }
@@ -32538,6 +32775,66 @@ function parseParagraphList(paragraphProperties, numberingMaps) {
32538
32775
  indent: effective.indent
32539
32776
  };
32540
32777
  }
32778
+ function parseDocxBorder(borderNode) {
32779
+ if (!borderNode) {
32780
+ return void 0;
32781
+ }
32782
+ const value = getAttributeValue(borderNode, "val");
32783
+ if (value === "nil" || value === "none") {
32784
+ return { width: 0, type: "none", color: "transparent" };
32785
+ }
32786
+ const size = Number(getAttributeValue(borderNode, "sz"));
32787
+ const width = Number.isFinite(size) && size > 0 ? Math.round(size / 8 * 1e4) / 1e4 : 0.75;
32788
+ const color = normalizeImportedHexColor(getAttributeValue(borderNode, "color")) ?? "#000000";
32789
+ const normalizedValue = (value == null ? void 0 : value.toLowerCase()) ?? "single";
32790
+ const type = normalizedValue.includes("dotted") || normalizedValue.includes("dot") ? "dotted" : normalizedValue.includes("dash") ? "dashed" : "solid";
32791
+ return { width, type, color };
32792
+ }
32793
+ function parseDocxBoxBorders(container) {
32794
+ if (!container) {
32795
+ return {};
32796
+ }
32797
+ return {
32798
+ borderTop: parseDocxBorder(
32799
+ getFirstChildByTagNameNS(container, WORD_NS, "top")
32800
+ ),
32801
+ borderRight: parseDocxBorder(
32802
+ getFirstChildByTagNameNS(container, WORD_NS, "right")
32803
+ ),
32804
+ borderBottom: parseDocxBorder(
32805
+ getFirstChildByTagNameNS(container, WORD_NS, "bottom")
32806
+ ),
32807
+ borderLeft: parseDocxBorder(
32808
+ getFirstChildByTagNameNS(container, WORD_NS, "left")
32809
+ ),
32810
+ borderStart: parseDocxBorder(
32811
+ getFirstChildByTagNameNS(container, WORD_NS, "start")
32812
+ ),
32813
+ borderEnd: parseDocxBorder(
32814
+ getFirstChildByTagNameNS(container, WORD_NS, "end")
32815
+ ),
32816
+ borderTopLeftToBottomRight: parseDocxBorder(
32817
+ getFirstChildByTagNameNS(container, WORD_NS, "tl2br")
32818
+ ),
32819
+ borderTopRightToBottomLeft: parseDocxBorder(
32820
+ getFirstChildByTagNameNS(container, WORD_NS, "tr2bl")
32821
+ )
32822
+ };
32823
+ }
32824
+ function parseDocxTableBorders(container) {
32825
+ if (!container) {
32826
+ return {};
32827
+ }
32828
+ return {
32829
+ ...parseDocxBoxBorders(container),
32830
+ borderInsideH: parseDocxBorder(
32831
+ getFirstChildByTagNameNS(container, WORD_NS, "insideH")
32832
+ ),
32833
+ borderInsideV: parseDocxBorder(
32834
+ getFirstChildByTagNameNS(container, WORD_NS, "insideV")
32835
+ )
32836
+ };
32837
+ }
32541
32838
  function stripUndefined(value) {
32542
32839
  const entries2 = Object.entries(value).filter(([, v]) => v !== void 0);
32543
32840
  return entries2.length > 0 ? Object.fromEntries(entries2) : void 0;
@@ -32606,6 +32903,24 @@ function normalizeImportedRunStyle(style2, paragraphStyleId) {
32606
32903
  effective.specVanish,
32607
32904
  defaultEffective.specVanish
32608
32905
  ),
32906
+ rtl: hd(style2.rtl, effective.rtl, defaultEffective.rtl),
32907
+ complexScript: hd(
32908
+ style2.complexScript,
32909
+ effective.complexScript,
32910
+ defaultEffective.complexScript
32911
+ ),
32912
+ snapToGrid: hd(
32913
+ style2.snapToGrid,
32914
+ effective.snapToGrid,
32915
+ defaultEffective.snapToGrid
32916
+ ),
32917
+ outline: hd(style2.outline, effective.outline, defaultEffective.outline),
32918
+ shadow: hd(style2.shadow, effective.shadow, defaultEffective.shadow),
32919
+ emboss: hd(style2.emboss, effective.emboss, defaultEffective.emboss),
32920
+ imprint: hd(style2.imprint, effective.imprint, defaultEffective.imprint),
32921
+ fitText: dd(effective.fitText, defaultEffective.fitText),
32922
+ emphasisMark: dd(effective.emphasisMark, defaultEffective.emphasisMark),
32923
+ textBorder: dd(effective.textBorder, defaultEffective.textBorder),
32609
32924
  textEffect: dd(effective.textEffect, defaultEffective.textEffect),
32610
32925
  characterScale: dd(
32611
32926
  effective.characterScale,
@@ -32692,6 +33007,57 @@ function parseRunStyle(runProperties, theme) {
32692
33007
  if (specVanish !== void 0) {
32693
33008
  styles.specVanish = specVanish;
32694
33009
  }
33010
+ const rtl = parseOnOffProperty(runProperties, "rtl");
33011
+ if (rtl !== void 0) {
33012
+ styles.rtl = rtl;
33013
+ }
33014
+ const complexScript = parseOnOffProperty(runProperties, "cs");
33015
+ if (complexScript !== void 0) {
33016
+ styles.complexScript = complexScript;
33017
+ }
33018
+ const snapToGrid = parseOnOffProperty(runProperties, "snapToGrid");
33019
+ if (snapToGrid !== void 0) {
33020
+ styles.snapToGrid = snapToGrid;
33021
+ }
33022
+ const outline = parseOnOffProperty(runProperties, "outline");
33023
+ if (outline !== void 0) {
33024
+ styles.outline = outline;
33025
+ }
33026
+ const shadow = parseOnOffProperty(runProperties, "shadow");
33027
+ if (shadow !== void 0) {
33028
+ styles.shadow = shadow;
33029
+ }
33030
+ const emboss = parseOnOffProperty(runProperties, "emboss");
33031
+ if (emboss !== void 0) {
33032
+ styles.emboss = emboss;
33033
+ }
33034
+ const imprint = parseOnOffProperty(runProperties, "imprint");
33035
+ if (imprint !== void 0) {
33036
+ styles.imprint = imprint;
33037
+ }
33038
+ const emphasisMark = getAttributeValue(
33039
+ getFirstChildByTagNameNS(runProperties, WORD_NS, "em"),
33040
+ "val"
33041
+ );
33042
+ if (emphasisMark === "dot" || emphasisMark === "comma" || emphasisMark === "circle" || emphasisMark === "underDot" || emphasisMark === "none") {
33043
+ styles.emphasisMark = emphasisMark;
33044
+ }
33045
+ const fitText = getAttributeValue(
33046
+ getFirstChildByTagNameNS(runProperties, WORD_NS, "fitText"),
33047
+ "val"
33048
+ );
33049
+ if (fitText) {
33050
+ const parsed = twipsToPoints(fitText);
33051
+ if (parsed !== void 0 && parsed > 0) {
33052
+ styles.fitText = parsed;
33053
+ }
33054
+ }
33055
+ const textBorder = parseDocxBorder(
33056
+ getFirstChildByTagNameNS(runProperties, WORD_NS, "bdr")
33057
+ );
33058
+ if (textBorder) {
33059
+ styles.textBorder = textBorder;
33060
+ }
32695
33061
  const textEffect = getAttributeValue(
32696
33062
  getFirstChildByTagNameNS(runProperties, WORD_NS, "effect"),
32697
33063
  "val"
@@ -32862,66 +33228,6 @@ function parseRunStyle(runProperties, theme) {
32862
33228
  }
32863
33229
  return emptyOrUndefined(styles);
32864
33230
  }
32865
- function parseDocxBorder(borderNode) {
32866
- if (!borderNode) {
32867
- return void 0;
32868
- }
32869
- const value = getAttributeValue(borderNode, "val");
32870
- if (value === "nil" || value === "none") {
32871
- return { width: 0, type: "none", color: "transparent" };
32872
- }
32873
- const size = Number(getAttributeValue(borderNode, "sz"));
32874
- const width = Number.isFinite(size) && size > 0 ? Math.round(size / 8 * 1e4) / 1e4 : 0.75;
32875
- const color = normalizeImportedHexColor(getAttributeValue(borderNode, "color")) ?? "#000000";
32876
- const normalizedValue = (value == null ? void 0 : value.toLowerCase()) ?? "single";
32877
- const type = normalizedValue.includes("dotted") || normalizedValue.includes("dot") ? "dotted" : normalizedValue.includes("dash") ? "dashed" : "solid";
32878
- return { width, type, color };
32879
- }
32880
- function parseDocxBoxBorders(container) {
32881
- if (!container) {
32882
- return {};
32883
- }
32884
- return {
32885
- borderTop: parseDocxBorder(
32886
- getFirstChildByTagNameNS(container, WORD_NS, "top")
32887
- ),
32888
- borderRight: parseDocxBorder(
32889
- getFirstChildByTagNameNS(container, WORD_NS, "right")
32890
- ),
32891
- borderBottom: parseDocxBorder(
32892
- getFirstChildByTagNameNS(container, WORD_NS, "bottom")
32893
- ),
32894
- borderLeft: parseDocxBorder(
32895
- getFirstChildByTagNameNS(container, WORD_NS, "left")
32896
- ),
32897
- borderStart: parseDocxBorder(
32898
- getFirstChildByTagNameNS(container, WORD_NS, "start")
32899
- ),
32900
- borderEnd: parseDocxBorder(
32901
- getFirstChildByTagNameNS(container, WORD_NS, "end")
32902
- ),
32903
- borderTopLeftToBottomRight: parseDocxBorder(
32904
- getFirstChildByTagNameNS(container, WORD_NS, "tl2br")
32905
- ),
32906
- borderTopRightToBottomLeft: parseDocxBorder(
32907
- getFirstChildByTagNameNS(container, WORD_NS, "tr2bl")
32908
- )
32909
- };
32910
- }
32911
- function parseDocxTableBorders(container) {
32912
- if (!container) {
32913
- return {};
32914
- }
32915
- return {
32916
- ...parseDocxBoxBorders(container),
32917
- borderInsideH: parseDocxBorder(
32918
- getFirstChildByTagNameNS(container, WORD_NS, "insideH")
32919
- ),
32920
- borderInsideV: parseDocxBorder(
32921
- getFirstChildByTagNameNS(container, WORD_NS, "insideV")
32922
- )
32923
- };
32924
- }
32925
33231
  function normalizeImportedParagraphStyle(style2) {
32926
33232
  if (!style2) {
32927
33233
  return void 0;
@@ -33309,8 +33615,12 @@ function parseTableStyle(tblPr, tableStyleId) {
33309
33615
  getFirstChildByTagNameNS(tblPr, WORD_NS, "jc"),
33310
33616
  "val"
33311
33617
  );
33312
- if (jc === "left" || jc === "center" || jc === "right") {
33313
- style2.align = jc;
33618
+ if (jc === "left" || jc === "start") {
33619
+ style2.align = "left";
33620
+ } else if (jc === "center") {
33621
+ style2.align = "center";
33622
+ } else if (jc === "right" || jc === "end") {
33623
+ style2.align = "right";
33314
33624
  }
33315
33625
  const layout = parseTableLayout(tblPr);
33316
33626
  if (layout) {
@@ -33430,6 +33740,17 @@ function parseTableRowStyle(rowProperties) {
33430
33740
  if (cellSpacing !== void 0) {
33431
33741
  style2.cellSpacing = cellSpacing;
33432
33742
  }
33743
+ const rowJc = getAttributeValue(
33744
+ getFirstChildByTagNameNS(rowProperties, WORD_NS, "jc"),
33745
+ "val"
33746
+ );
33747
+ if (rowJc === "left" || rowJc === "start") {
33748
+ style2.align = "left";
33749
+ } else if (rowJc === "center") {
33750
+ style2.align = "center";
33751
+ } else if (rowJc === "right" || rowJc === "end") {
33752
+ style2.align = "right";
33753
+ }
33433
33754
  const cantSplit = parseOnOffProperty(rowProperties, "cantSplit");
33434
33755
  if (cantSplit !== void 0) {
33435
33756
  style2.cantSplit = cantSplit;
@@ -33482,6 +33803,17 @@ function getTableCellVMerge(cellProperties) {
33482
33803
  const value = getAttributeValue(vMerge, "val");
33483
33804
  return value === "restart" ? "restart" : "continue";
33484
33805
  }
33806
+ function getTableCellHMerge(cellProperties) {
33807
+ if (!cellProperties) {
33808
+ return void 0;
33809
+ }
33810
+ const hMerge = getFirstChildByTagNameNS(cellProperties, WORD_NS, "hMerge");
33811
+ if (!hMerge) {
33812
+ return void 0;
33813
+ }
33814
+ const value = getAttributeValue(hMerge, "val");
33815
+ return value === "restart" ? "restart" : "continue";
33816
+ }
33485
33817
  function parseTableCellVerticalAlign(cellProperties) {
33486
33818
  if (!cellProperties) {
33487
33819
  return void 0;
@@ -35347,6 +35679,12 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
35347
35679
  }
35348
35680
  collapseCellAutospacing(paragraphs, autospacingFlags);
35349
35681
  const colSpan = getTableCellColSpan(cellProperties);
35682
+ const hMerge = getTableCellHMerge(cellProperties);
35683
+ if (hMerge === "continue" && cells.length > 0) {
35684
+ const anchor = cells[cells.length - 1];
35685
+ anchor.colSpan = (anchor.colSpan ?? 1) + colSpan;
35686
+ continue;
35687
+ }
35350
35688
  const vMerge = getTableCellVMerge(cellProperties);
35351
35689
  const cellStyle = parseTableCellStyle(cellProperties);
35352
35690
  const cell = createEditorTableCell(
@@ -35356,6 +35694,8 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
35356
35694
  );
35357
35695
  if (cellStyle) cell.style = cellStyle;
35358
35696
  cell.conditionalStyle = parseTableConditionalFlags(cellProperties);
35697
+ const cellExtAttrs = collectExtAttributes(cellNode);
35698
+ if (cellExtAttrs) cell.extAttributes = cellExtAttrs;
35359
35699
  if (vMerge === "continue") {
35360
35700
  cell.blocks = [];
35361
35701
  }
@@ -35370,9 +35710,22 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
35370
35710
  row.style = rowStyle;
35371
35711
  }
35372
35712
  row.conditionalStyle = rowConditionalStyle;
35713
+ const rowExtAttrs = collectExtAttributes(rowNode);
35714
+ if (rowExtAttrs) row.extAttributes = rowExtAttrs;
35373
35715
  const tblPrEx = getFirstChildByTagNameNS(rowNode, WORD_NS, "tblPrEx");
35374
35716
  if (tblPrEx) {
35375
- row.tblPrExXml = new XMLSerializer().serializeToString(tblPrEx);
35717
+ const exceptions = parseTableStyle(tblPrEx);
35718
+ if (exceptions) {
35719
+ row.propertyExceptions = exceptions;
35720
+ }
35721
+ const changeEl = getFirstChildByTagNameNS(
35722
+ tblPrEx,
35723
+ WORD_NS,
35724
+ "tblPrExChange"
35725
+ );
35726
+ if (changeEl) {
35727
+ row.tblPrExChangeXml = new XMLSerializer().serializeToString(changeEl);
35728
+ }
35376
35729
  }
35377
35730
  rows.push(row);
35378
35731
  }
@@ -36203,6 +36556,12 @@ async function importDocxToEditorDocument(buffer, options = {}) {
36203
36556
  defaultTabStop: docSettings.defaultTabStop
36204
36557
  };
36205
36558
  }
36559
+ if (docSettings.allowSpaceOfSameStyleInTable) {
36560
+ doc2.settings = {
36561
+ ...doc2.settings ?? {},
36562
+ allowSpaceOfSameStyleInTable: true
36563
+ };
36564
+ }
36206
36565
  let result = doc2;
36207
36566
  if (editorFootnotes) {
36208
36567
  result.footnotes = editorFootnotes;
@@ -36389,7 +36748,7 @@ function importDocxInWorker(buffer, options = {}) {
36389
36748
  const worker = new Worker(
36390
36749
  new URL(
36391
36750
  /* @vite-ignore */
36392
- "" + new URL("assets/importDocxWorker-DVDyiqYf.js", import.meta.url).href,
36751
+ "" + new URL("assets/importDocxWorker-6DqfSWfq.js", import.meta.url).href,
36393
36752
  import.meta.url
36394
36753
  ),
36395
36754
  {
@@ -38939,7 +39298,11 @@ function parseFontSizePtToPx(pt) {
38939
39298
  return fontSizePtToPx(value);
38940
39299
  }
38941
39300
  const UNDERLINE_STYLE_OPTIONS = [
38942
- { value: "single", labelKey: "underline.style.single", preview: { borderStyle: "solid" } },
39301
+ {
39302
+ value: "single",
39303
+ labelKey: "underline.style.single",
39304
+ preview: { borderStyle: "solid" }
39305
+ },
38943
39306
  {
38944
39307
  value: "double",
38945
39308
  labelKey: "underline.style.double",
@@ -38950,13 +39313,21 @@ const UNDERLINE_STYLE_OPTIONS = [
38950
39313
  labelKey: "underline.style.thick",
38951
39314
  preview: { borderStyle: "solid", borderBottomWidth: "3px" }
38952
39315
  },
38953
- { value: "dotted", labelKey: "underline.style.dotted", preview: { borderStyle: "dotted" } },
39316
+ {
39317
+ value: "dotted",
39318
+ labelKey: "underline.style.dotted",
39319
+ preview: { borderStyle: "dotted" }
39320
+ },
38954
39321
  {
38955
39322
  value: "dottedHeavy",
38956
39323
  labelKey: "underline.style.dottedHeavy",
38957
39324
  preview: { borderStyle: "dotted", borderBottomWidth: "3px" }
38958
39325
  },
38959
- { value: "dash", labelKey: "underline.style.dashed", preview: { borderStyle: "dashed" } },
39326
+ {
39327
+ value: "dash",
39328
+ labelKey: "underline.style.dashed",
39329
+ preview: { borderStyle: "dashed" }
39330
+ },
38960
39331
  {
38961
39332
  value: "dashedHeavy",
38962
39333
  labelKey: "underline.style.dashedHeavy",
@@ -38972,7 +39343,11 @@ const UNDERLINE_STYLE_OPTIONS = [
38972
39343
  labelKey: "underline.style.longDashesHeavy",
38973
39344
  preview: { borderStyle: "dashed", borderBottomWidth: "3px" }
38974
39345
  },
38975
- { value: "dotDash", labelKey: "underline.style.dotDash", preview: { borderStyle: "dashed" } },
39346
+ {
39347
+ value: "dotDash",
39348
+ labelKey: "underline.style.dotDash",
39349
+ preview: { borderStyle: "dashed" }
39350
+ },
38976
39351
  {
38977
39352
  value: "dashDotHeavy",
38978
39353
  labelKey: "underline.style.dotDashHeavy",