ooxml-core 1.19.1 → 1.19.2

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.
@@ -3522,7 +3522,10 @@ function writeTable(doc, table4, node3, base2, writeParagraph, replaceSlots2) {
3522
3522
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
3523
3523
  );
3524
3524
  const width = table4.rows[0]?.length ?? 0;
3525
- if (!width || table4.rows.some((row3) => row3.length !== width || row3.some((cell) => !cell.paragraphs.length)))
3525
+ const reshaped = structural || !base2;
3526
+ if (!width || table4.rows.some(
3527
+ (row3) => reshaped && row3.length !== width || row3.some((cell) => !cell.paragraphs.length)
3528
+ ))
3526
3529
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
3527
3530
  const oldRows = flatRows(node3).map((entry3) => entry3.element);
3528
3531
  const sourceById = /* @__PURE__ */ new Map();
@@ -19354,13 +19357,13 @@ function rejectUnsafeRunSegmentation(paragraph2, base2, oldRuns) {
19354
19357
  `Cannot edit paragraph ${paragraph2.id}: changing run boundaries could drop unsupported run properties. The original DOCX package remains unchanged.`
19355
19358
  );
19356
19359
  }
19357
- function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans2) {
19358
- const continuation = spans2?.next.get(paragraph2.id);
19359
- const ranges = spans2 && {
19360
+ function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans3) {
19361
+ const continuation = spans3?.next.get(paragraph2.id);
19362
+ const ranges = spans3 && {
19360
19363
  ...continuation ?? { before: /* @__PURE__ */ new Set(), after: /* @__PURE__ */ new Set() },
19361
- rangeIds: spans2.rangeIds
19364
+ rangeIds: spans3.rangeIds
19362
19365
  };
19363
- const sameRanges = continuationKey(continuation) === continuationKey(spans2?.original.get(paragraph2.id));
19366
+ const sameRanges = continuationKey(continuation) === continuationKey(spans3?.original.get(paragraph2.id));
19364
19367
  if (base2 && sameRanges && JSON.stringify(paragraph2) === JSON.stringify(base2)) return node3;
19365
19368
  const slots = collectInlineSlots(node3);
19366
19369
  if (!slots)
@@ -19421,7 +19424,7 @@ function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans2) {
19421
19424
  children2(node3, "bookmarkEnd"),
19422
19425
  paragraph2.bookmarks ?? [],
19423
19426
  base2?.bookmarks ?? [],
19424
- () => spans2?.nextId() ?? "0"
19427
+ () => spans3?.nextId() ?? "0"
19425
19428
  );
19426
19429
  for (const bookmark of [...children2(node3, "bookmarkStart"), ...children2(node3, "bookmarkEnd")])
19427
19430
  node3.removeChild(bookmark);
@@ -19443,9 +19446,9 @@ function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans2) {
19443
19446
  if (!pPr.childNodes.length) node3.removeChild(pPr);
19444
19447
  return node3;
19445
19448
  }
19446
- function createParagraph(doc, paragraph2, allocator, spans2) {
19449
+ function createParagraph(doc, paragraph2, allocator, spans3) {
19447
19450
  const node3 = makeW(doc, "p");
19448
- return writeParagraphImpl(doc, paragraph2, node3, void 0, allocator, spans2);
19451
+ return writeParagraphImpl(doc, paragraph2, node3, void 0, allocator, spans3);
19449
19452
  }
19450
19453
 
19451
19454
  // docx/docpr-ids.ts
@@ -19534,7 +19537,7 @@ var RelationshipAllocator = class {
19534
19537
 
19535
19538
  // docx/write.ts
19536
19539
  var twips2 = (pixels) => String(Math.round(pixels * 15));
19537
- function createTable(doc, table4, allocator, contentWidthTwips, spans2) {
19540
+ function createTable(doc, table4, allocator, contentWidthTwips, spans3) {
19538
19541
  const node3 = makeW(doc, "tbl");
19539
19542
  const { tblPr, tblGrid } = buildNewTableProperties(doc, table4, contentWidthTwips);
19540
19543
  node3.appendChild(tblPr);
@@ -19550,7 +19553,7 @@ function createTable(doc, table4, allocator, contentWidthTwips, spans2) {
19550
19553
  const tcPr = buildCellProperties(doc, cell);
19551
19554
  if (tcPr) tc.appendChild(tcPr);
19552
19555
  for (const paragraph2 of cell.paragraphs)
19553
- tc.appendChild(createParagraph(doc, paragraph2, allocator, spans2));
19556
+ tc.appendChild(createParagraph(doc, paragraph2, allocator, spans3));
19554
19557
  if (!cell.paragraphs.length) tc.appendChild(makeW(doc, "p"));
19555
19558
  tr.appendChild(tc);
19556
19559
  }
@@ -19578,13 +19581,13 @@ function baseMap(blocks) {
19578
19581
  }
19579
19582
  function applyBlocks(doc, container, blocks, original, allocator, contentWidthTwips, anchor = null) {
19580
19583
  const nextId3 = annotationIdAllocator(doc, blocks);
19581
- const spans2 = {
19584
+ const spans3 = {
19582
19585
  next: commentContinuations(blocks),
19583
19586
  original: commentContinuations(original),
19584
19587
  rangeIds: newMoveRangeIds(blocks, nextId3),
19585
19588
  nextId: nextId3
19586
19589
  };
19587
- const boundWriteParagraph = (writeDoc, paragraph2, node3, base2) => writeParagraphImpl(writeDoc, paragraph2, node3, base2, allocator, spans2);
19590
+ const boundWriteParagraph = (writeDoc, paragraph2, node3, base2) => writeParagraphImpl(writeDoc, paragraph2, node3, base2, allocator, spans3);
19588
19591
  const flat = flatBlocks(container);
19589
19592
  const oldNodes = flat.map((entry3) => entry3.element);
19590
19593
  const oldById = /* @__PURE__ */ new Map();
@@ -19598,7 +19601,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
19598
19601
  const base2 = bases.get(block.id);
19599
19602
  if (block.type === "paragraph")
19600
19603
  output.push(
19601
- old ? boundWriteParagraph(doc, block, old, base2?.type === "paragraph" ? base2 : void 0) : createParagraph(doc, block, allocator, spans2)
19604
+ old ? boundWriteParagraph(doc, block, old, base2?.type === "paragraph" ? base2 : void 0) : createParagraph(doc, block, allocator, spans3)
19602
19605
  );
19603
19606
  else
19604
19607
  output.push(
@@ -19609,7 +19612,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
19609
19612
  base2?.type === "table" ? base2 : void 0,
19610
19613
  boundWriteParagraph,
19611
19614
  replaceSlots
19612
- ) : createTable(doc, block, allocator, contentWidthTwips, spans2)
19615
+ ) : createTable(doc, block, allocator, contentWidthTwips, spans3)
19613
19616
  );
19614
19617
  }
19615
19618
  const nested = flat.some((entry3) => entry3.sdt) || blocks.some((block) => block.contentControl);
@@ -48154,9 +48157,9 @@ function toHtml(cells3, theme3) {
48154
48157
  for (let r = link.range.start.row; r <= link.range.end.row; r++)
48155
48158
  for (let c2 = link.range.start.col; c2 <= link.range.end.col; c2++) links.set(`${r},${c2}`, link);
48156
48159
  const covered = /* @__PURE__ */ new Set();
48157
- const spans2 = /* @__PURE__ */ new Map();
48160
+ const spans3 = /* @__PURE__ */ new Map();
48158
48161
  for (const m of cells3.merges) {
48159
- spans2.set(`${m.start.row},${m.start.col}`, m);
48162
+ spans3.set(`${m.start.row},${m.start.col}`, m);
48160
48163
  for (let r = m.start.row; r <= m.end.row; r++)
48161
48164
  for (let c2 = m.start.col; c2 <= m.end.col; c2++)
48162
48165
  if (r !== m.start.row || c2 !== m.start.col) covered.add(`${r},${c2}`);
@@ -48168,7 +48171,7 @@ function toHtml(cells3, theme3) {
48168
48171
  if (covered.has(`${r},${c2}`)) continue;
48169
48172
  const cell = cells3.data[r]?.[c2] ?? null;
48170
48173
  const attrs3 = [];
48171
- const span3 = spans2.get(`${r},${c2}`);
48174
+ const span3 = spans3.get(`${r},${c2}`);
48172
48175
  if (span3 && span3.end.row > span3.start.row)
48173
48176
  attrs3.push(`rowspan="${span3.end.row - span3.start.row + 1}"`);
48174
48177
  if (span3 && span3.end.col > span3.start.col)
@@ -50531,16 +50534,27 @@ function columnOverrides(sheet, mdw, defaultPx) {
50531
50534
  }
50532
50535
  return out;
50533
50536
  }
50534
- function createGridMetrics(sheet, options2 = {}) {
50535
- const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
50537
+ function pixelScale(zoom) {
50536
50538
  const factor = zoom / 100;
50537
- const mdw = options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
50538
- const scale2 = (px2) => px2 > 0 ? Math.max(1, Math.round(px2 * factor)) : 0;
50539
+ return (px2) => px2 > 0 ? Math.max(1, Math.round(px2 * factor)) : 0;
50540
+ }
50541
+ function columnAxis(sheet, mdw, scale2) {
50539
50542
  const defaultColPx = defaultColumnPixels(sheet.defaultColWidth, mdw);
50540
50543
  const colOverrides = [...columnOverrides(sheet, mdw, defaultColPx)].map(
50541
50544
  ([c2, px2]) => [c2, scale2(px2)]
50542
50545
  );
50543
- const cols = new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
50546
+ return new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
50547
+ }
50548
+ function createColumnWidths(sheet, options2 = {}) {
50549
+ const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
50550
+ const cols = columnAxis(sheet, options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH, pixelScale(zoom));
50551
+ return (c2) => cols.size(c2);
50552
+ }
50553
+ function createGridMetrics(sheet, options2 = {}) {
50554
+ const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
50555
+ const mdw = options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
50556
+ const scale2 = pixelScale(zoom);
50557
+ const cols = columnAxis(sheet, mdw, scale2);
50544
50558
  const defaultRowPx = pointsToPixels(sheet.defaultRowHeight);
50545
50559
  const rowOverrides = [];
50546
50560
  for (const [r, info] of sheet.rowInfo) {
@@ -54840,6 +54854,87 @@ function cellView(workbook, sheetIndex2, row3, col, cf, options2 = {}) {
54840
54854
  return view;
54841
54855
  }
54842
54856
 
54857
+ // xlsx/layout/merge-sweep.ts
54858
+ var NONE = { merged: false, spanned: false };
54859
+ var SINGLE3 = { merged: true, spanned: false };
54860
+ var SPANNED = { merged: true, spanned: true };
54861
+ var spans2 = (merge2) => merge2.start.row !== merge2.end.row || merge2.start.col !== merge2.end.col;
54862
+ function firstRightOf(merges, col) {
54863
+ let lo = 0;
54864
+ let hi = merges.length;
54865
+ while (lo < hi) {
54866
+ const mid = lo + hi >> 1;
54867
+ if ((merges[mid]?.start.col ?? 0) <= col) lo = mid + 1;
54868
+ else hi = mid;
54869
+ }
54870
+ return lo;
54871
+ }
54872
+ var MergeSweep = class {
54873
+ /** The merges by first row; `next` is the first one the sweep has not reached. */
54874
+ byRow;
54875
+ next = 0;
54876
+ row = Number.NEGATIVE_INFINITY;
54877
+ /** The merges covering the current row, by first column. */
54878
+ active = [];
54879
+ /** The last row of the earliest-ending active merge. */
54880
+ firstEnd = Number.POSITIVE_INFINITY;
54881
+ overlapping = false;
54882
+ constructor(merges) {
54883
+ this.byRow = [...merges].sort((a2, b) => a2.start.row - b.start.row);
54884
+ }
54885
+ /** How many merges cover the current row, which is everything the sweep holds. */
54886
+ get size() {
54887
+ return this.active.length;
54888
+ }
54889
+ /** Moves to `row`, which must not be above the previous one. */
54890
+ moveTo(row3) {
54891
+ if (row3 < this.row) throw new RangeError(`Rows must not go up: ${row3} after ${this.row}`);
54892
+ this.row = row3;
54893
+ if (row3 > this.firstEnd) this.dropEnded(row3);
54894
+ for (; this.next < this.byRow.length; this.next++) {
54895
+ const merge2 = this.byRow[this.next];
54896
+ if (!merge2 || merge2.start.row > row3) break;
54897
+ if (merge2.end.row >= row3) this.add(merge2);
54898
+ }
54899
+ }
54900
+ /** How the merges cover column `col` of the current row. */
54901
+ at(col) {
54902
+ if (this.overlapping) {
54903
+ let merged = false;
54904
+ for (const merge3 of this.active) {
54905
+ if (col < merge3.start.col || col > merge3.end.col) continue;
54906
+ if (spans2(merge3)) return SPANNED;
54907
+ merged = true;
54908
+ }
54909
+ return merged ? SINGLE3 : NONE;
54910
+ }
54911
+ const merge2 = this.active[firstRightOf(this.active, col) - 1];
54912
+ if (!merge2 || col > merge2.end.col) return NONE;
54913
+ return spans2(merge2) ? SPANNED : SINGLE3;
54914
+ }
54915
+ add(merge2) {
54916
+ const at2 = firstRightOf(this.active, merge2.start.col);
54917
+ const before = this.active[at2 - 1];
54918
+ const after = this.active[at2];
54919
+ if (before && before.end.col >= merge2.start.col || after && merge2.end.col >= after.start.col)
54920
+ this.overlapping = true;
54921
+ this.active.splice(at2, 0, merge2);
54922
+ this.firstEnd = Math.min(this.firstEnd, merge2.end.row);
54923
+ }
54924
+ dropEnded(row3) {
54925
+ let kept = 0;
54926
+ let firstEnd = Number.POSITIVE_INFINITY;
54927
+ for (const merge2 of this.active) {
54928
+ if (merge2.end.row < row3) continue;
54929
+ this.active[kept++] = merge2;
54930
+ firstEnd = Math.min(firstEnd, merge2.end.row);
54931
+ }
54932
+ this.active.length = kept;
54933
+ this.firstEnd = firstEnd;
54934
+ if (!kept) this.overlapping = false;
54935
+ }
54936
+ };
54937
+
54843
54938
  // xlsx/layout/row-autofit.ts
54844
54939
  var LINE_HEIGHTS = [
54845
54940
  [6, 8.25],
@@ -54899,30 +54994,39 @@ function wrappedLineCount(text8, width, measure2) {
54899
54994
  }
54900
54995
  return lines2;
54901
54996
  }
54902
- function autoFitRowHeight(workbook, sheetIndex2, row3, measure2) {
54997
+ function fitRowHeights(workbook, sheetIndex2, rows, measure2) {
54998
+ const heights = /* @__PURE__ */ new Map();
54903
54999
  const sheet = workbook.sheets[sheetIndex2];
54904
- if (!sheet) return 15;
54905
- const cells3 = sheet.rows.get(row3);
54906
- if (!cells3?.size) return sheet.defaultRowHeight;
54907
- const metrics = createGridMetrics(sheet, { zoom: 100 });
54908
- let tallest = 0;
54909
- for (const col of cells3.keys()) {
54910
- const merged = sheet.merges.some(
54911
- (m) => row3 >= m.start.row && row3 <= m.end.row && col >= m.start.col && col <= m.end.col && (m.start.row !== m.end.row || m.start.col !== m.end.col)
54912
- );
54913
- if (merged) continue;
54914
- const view = cellView(workbook, sheetIndex2, row3, col);
54915
- if (!view.text) continue;
54916
- const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
54917
- const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
54918
- let lines2 = 1;
54919
- if (view.wrap) {
54920
- const width = metrics.colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
54921
- lines2 = wrappedLineCount(view.text, width, (text8) => measure2(text8, view.font));
55000
+ if (!sheet) return heights;
55001
+ const filled = [];
55002
+ for (const row3 of new Set(rows)) {
55003
+ if (sheet.rows.get(row3)?.size) filled.push(row3);
55004
+ else heights.set(row3, sheet.defaultRowHeight);
55005
+ }
55006
+ filled.sort((a2, b) => a2 - b);
55007
+ const merges = new MergeSweep(sheet.merges);
55008
+ let colWidth;
55009
+ for (const row3 of filled) {
55010
+ merges.moveTo(row3);
55011
+ let tallest = 0;
55012
+ for (const col of sheet.rows.get(row3)?.keys() ?? []) {
55013
+ const cover = merges.at(col);
55014
+ if (cover.spanned) continue;
55015
+ const view = cellView(workbook, sheetIndex2, row3, col, void 0, { merged: cover.merged });
55016
+ if (!view.text) continue;
55017
+ const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
55018
+ const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
55019
+ let lines2 = 1;
55020
+ if (view.wrap) {
55021
+ colWidth ??= createColumnWidths(sheet, { zoom: 100 });
55022
+ const width = colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
55023
+ lines2 = wrappedLineCount(view.text, width, (text8) => measure2(text8, view.font));
55024
+ }
55025
+ tallest = Math.max(tallest, lines2 * lineHeightPoints(sizePt));
54922
55026
  }
54923
- tallest = Math.max(tallest, lines2 * lineHeightPoints(sizePt));
55027
+ heights.set(row3, tallest > 0 ? tallest : sheet.defaultRowHeight);
54924
55028
  }
54925
- return tallest > 0 ? tallest : sheet.defaultRowHeight;
55029
+ return heights;
54926
55030
  }
54927
55031
  var approximateMeasure = (text8, font) => text8.length * font.sizePx * (font.bold ? 0.58 : 0.53);
54928
55032
 
@@ -54930,13 +55034,16 @@ var approximateMeasure = (text8, font) => text8.length * font.sizePx * (font.bol
54930
55034
  var MAX_HEIGHT2 = 409;
54931
55035
  function autoGrowRows(ctx, s, rows, measure2 = approximateMeasure) {
54932
55036
  const sheet = sheetAt(ctx.workbook, s);
54933
- const updates = [];
54934
- for (const row3 of new Set(rows)) {
55037
+ const candidates = [...new Set(rows)].filter((row3) => {
54935
55038
  const info = sheet.rowInfo.get(row3);
54936
- if (info?.customHeight || info?.hidden) continue;
54937
- const fit3 = Math.min(MAX_HEIGHT2, autoFitRowHeight(ctx.workbook, s, row3, measure2));
55039
+ return !info?.customHeight && !info?.hidden;
55040
+ });
55041
+ const fits = fitRowHeights(ctx.workbook, s, candidates, measure2);
55042
+ const updates = [];
55043
+ for (const row3 of candidates) {
55044
+ const fit3 = Math.min(MAX_HEIGHT2, fits.get(row3) ?? sheet.defaultRowHeight);
54938
55045
  const next = Math.abs(fit3 - sheet.defaultRowHeight) < 1e-9 ? void 0 : fit3;
54939
- const current = info?.height;
55046
+ const current = sheet.rowInfo.get(row3)?.height;
54940
55047
  if (current === next) continue;
54941
55048
  if (current !== void 0 && next !== void 0 && Math.abs(current - next) < 1e-9) continue;
54942
55049
  updates.push([row3, next]);
@@ -55878,7 +55985,7 @@ function inspectZip(bytes, limits, check3) {
55878
55985
  if (count2 > limits.maxEntries) fail2("LIMIT_ENTRIES", "Too many ZIP entries");
55879
55986
  if (centralStart + centralSize !== end) fail2("INVALID_ZIP", "Invalid central directory bounds");
55880
55987
  const entries = /* @__PURE__ */ new Map(), canonical2 = /* @__PURE__ */ new Set();
55881
- const spans2 = [];
55988
+ const spans3 = [];
55882
55989
  let offset2 = centralStart, total2 = 0;
55883
55990
  const extras = (start, length, name3) => {
55884
55991
  const stop = start + length;
@@ -55948,14 +56055,14 @@ function inspectZip(bytes, limits, check3) {
55948
56055
  dataEnd += 12;
55949
56056
  }
55950
56057
  if (dataEnd > centralStart) fail2("ZIP_MISMATCH", "ZIP entry overlaps the central directory");
55951
- spans2.push({ start: local, end: dataEnd });
56058
+ spans3.push({ start: local, end: dataEnd });
55952
56059
  entries.set(name3, { name: name3, compressed, size: size3, crc, directory });
55953
56060
  offset2 += 46 + nameLength + extraLength + commentLength;
55954
56061
  }
55955
56062
  if (offset2 !== end) fail2("INVALID_ZIP", "Central directory length or count mismatch");
55956
- spans2.sort((a2, b) => a2.start - b.start);
56063
+ spans3.sort((a2, b) => a2.start - b.start);
55957
56064
  let previousEnd = 0;
55958
- for (const span3 of spans2) {
56065
+ for (const span3 of spans3) {
55959
56066
  if (span3.start !== previousEnd)
55960
56067
  fail2("ZIP_MISMATCH", "Overlapping, prefixed, or unindexed ZIP records");
55961
56068
  previousEnd = span3.end;
@@ -68685,13 +68792,13 @@ function flattenCornerCurve(points) {
68685
68792
  return flattened ? [points[0], ...flattened] : void 0;
68686
68793
  }
68687
68794
  function connectorCurveMiddle(points) {
68688
- const spans2 = connectorCurveSpans(points);
68795
+ const spans3 = connectorCurveSpans(points);
68689
68796
  if (points.length === 5) {
68690
68797
  const flattened = flattenCornerCurve(points);
68691
68798
  if (flattened) return connectorPolylineMiddle(flattened);
68692
68799
  return mix(points[0], points.at(-1), 0.5);
68693
68800
  }
68694
- const row3 = [...spans2[0]];
68801
+ const row3 = [...spans3[0]];
68695
68802
  for (let count2 = row3.length - 1; count2 > 0; count2--)
68696
68803
  for (let i2 = 0; i2 < count2; i2++) row3[i2] = mix(row3[i2], row3[i2 + 1], 0.5);
68697
68804
  return row3[0];
@@ -79747,7 +79854,7 @@ function assertParentIndependent(facts, from, ids) {
79747
79854
 
79748
79855
  // visio/edit-group.ts
79749
79856
  var clean5 = (value3) => Math.abs(value3) < 1e-12 ? 0 : value3;
79750
- var NONE = /* @__PURE__ */ new Map();
79857
+ var NONE2 = /* @__PURE__ */ new Map();
79751
79858
  function topLevel2(root) {
79752
79859
  const containers = children3(root, "Shapes");
79753
79860
  if (containers.length !== 1)
@@ -79762,7 +79869,7 @@ function assertGroupable(shape2, document) {
79762
79869
  assertShapeLocks(shape2, document, ["LockGroup"]);
79763
79870
  assertUnlayeredShape(shape2, document);
79764
79871
  }
79765
- var transformOf = (shape2, instances = NONE) => {
79872
+ var transformOf = (shape2, instances = NONE2) => {
79766
79873
  const local = cells(instances.get(shape2)?.view ?? shape2);
79767
79874
  const width = numeric4(local.get("Width")), height = numeric4(local.get("Height"));
79768
79875
  return {
@@ -79784,7 +79891,7 @@ var transformOf = (shape2, instances = NONE) => {
79784
79891
  )
79785
79892
  };
79786
79893
  };
79787
- function visioShapeBounds(shapes, instances = NONE) {
79894
+ function visioShapeBounds(shapes, instances = NONE2) {
79788
79895
  let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
79789
79896
  for (const shape2 of shapes) {
79790
79897
  const box5 = transformOf(shape2, instances);
@@ -79804,7 +79911,7 @@ function visioShapeBounds(shapes, instances = NONE) {
79804
79911
  }
79805
79912
  return { minX, minY, maxX, maxY };
79806
79913
  }
79807
- function groupVisioShapes(root, document, edit, check3, instances = NONE) {
79914
+ function groupVisioShapes(root, document, edit, check3, instances = NONE2) {
79808
79915
  check3();
79809
79916
  const siblings = topLevel2(root);
79810
79917
  for (const node3 of Array.from(root.getElementsByTagName("*")))
@@ -79877,7 +79984,7 @@ function groupVisioShapes(root, document, edit, check3, instances = NONE) {
79877
79984
  }
79878
79985
  return true;
79879
79986
  }
79880
- function ungroupVisioShape(root, document, edit, check3, instances = NONE) {
79987
+ function ungroupVisioShape(root, document, edit, check3, instances = NONE2) {
79881
79988
  check3();
79882
79989
  const candidates = topLevel2(root).filter((shape2) => attribute3(shape2, "ID") === edit.shapeId);
79883
79990
  if (candidates.length !== 1 || attribute3(candidates[0], "Type") !== "Group")
@@ -2833,7 +2833,10 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
2833
2833
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
2834
2834
  );
2835
2835
  const width = table.rows[0]?.length ?? 0;
2836
- if (!width || table.rows.some((row) => row.length !== width || row.some((cell) => !cell.paragraphs.length)))
2836
+ const reshaped = structural || !base;
2837
+ if (!width || table.rows.some(
2838
+ (row) => reshaped && row.length !== width || row.some((cell) => !cell.paragraphs.length)
2839
+ ))
2837
2840
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
2838
2841
  const oldRows = flatRows(node).map((entry2) => entry2.element);
2839
2842
  const sourceById = /* @__PURE__ */ new Map();
@@ -2827,7 +2827,10 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
2827
2827
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
2828
2828
  );
2829
2829
  const width = table.rows[0]?.length ?? 0;
2830
- if (!width || table.rows.some((row) => row.length !== width || row.some((cell) => !cell.paragraphs.length)))
2830
+ const reshaped = structural || !base;
2831
+ if (!width || table.rows.some(
2832
+ (row) => reshaped && row.length !== width || row.some((cell) => !cell.paragraphs.length)
2833
+ ))
2831
2834
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
2832
2835
  const oldRows = flatRows(node).map((entry2) => entry2.element);
2833
2836
  const sourceById = /* @__PURE__ */ new Map();
@@ -4088,7 +4088,10 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
4088
4088
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
4089
4089
  );
4090
4090
  const width = table.rows[0]?.length ?? 0;
4091
- if (!width || table.rows.some((row) => row.length !== width || row.some((cell) => !cell.paragraphs.length)))
4091
+ const reshaped = structural || !base;
4092
+ if (!width || table.rows.some(
4093
+ (row) => reshaped && row.length !== width || row.some((cell) => !cell.paragraphs.length)
4094
+ ))
4092
4095
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
4093
4096
  const oldRows = flatRows(node).map((entry2) => entry2.element);
4094
4097
  const sourceById = /* @__PURE__ */ new Map();
@@ -4082,7 +4082,10 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
4082
4082
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
4083
4083
  );
4084
4084
  const width = table.rows[0]?.length ?? 0;
4085
- if (!width || table.rows.some((row) => row.length !== width || row.some((cell) => !cell.paragraphs.length)))
4085
+ const reshaped = structural || !base;
4086
+ if (!width || table.rows.some(
4087
+ (row) => reshaped && row.length !== width || row.some((cell) => !cell.paragraphs.length)
4088
+ ))
4086
4089
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
4087
4090
  const oldRows = flatRows(node).map((entry2) => entry2.element);
4088
4091
  const sourceById = /* @__PURE__ */ new Map();
@@ -5417,7 +5417,10 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
5417
5417
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
5418
5418
  );
5419
5419
  const width = table.rows[0]?.length ?? 0;
5420
- if (!width || table.rows.some((row) => row.length !== width || row.some((cell) => !cell.paragraphs.length)))
5420
+ const reshaped = structural || !base;
5421
+ if (!width || table.rows.some(
5422
+ (row) => reshaped && row.length !== width || row.some((cell) => !cell.paragraphs.length)
5423
+ ))
5421
5424
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
5422
5425
  const oldRows = flatRows(node).map((entry2) => entry2.element);
5423
5426
  const sourceById = /* @__PURE__ */ new Map();
@@ -5411,7 +5411,10 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
5411
5411
  "Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
5412
5412
  );
5413
5413
  const width = table.rows[0]?.length ?? 0;
5414
- if (!width || table.rows.some((row) => row.length !== width || row.some((cell) => !cell.paragraphs.length)))
5414
+ const reshaped = structural || !base;
5415
+ if (!width || table.rows.some(
5416
+ (row) => reshaped && row.length !== width || row.some((cell) => !cell.paragraphs.length)
5417
+ ))
5415
5418
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
5416
5419
  const oldRows = flatRows(node).map((entry2) => entry2.element);
5417
5420
  const sourceById = /* @__PURE__ */ new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"write-table.d.ts","sourceRoot":"","sources":["../../docx/write-table.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAS,SAAS,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AASlE,OAAO,EAA4C,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAEpG,KAAK,eAAe,GAAG,CACtB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,UAAU,EAChB,IAAI,CAAC,EAAE,SAAS,KACZ,UAAU,CAAC;AAChB,KAAK,WAAW,GAAG,CAClB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EAAE,EACjB,IAAI,EAAE,UAAU,EAAE,KACd,IAAI,CAAC;AAEV,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE;AA6ED,wBAAgB,UAAU,CACzB,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,KAAK,GAAG,SAAS,EACvB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,WAAW,GACvB,UAAU,CAyHZ"}
1
+ {"version":3,"file":"write-table.d.ts","sourceRoot":"","sources":["../../docx/write-table.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAS,SAAS,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AASlE,OAAO,EAA4C,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAEpG,KAAK,eAAe,GAAG,CACtB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,UAAU,EAChB,IAAI,CAAC,EAAE,SAAS,KACZ,UAAU,CAAC;AAChB,KAAK,WAAW,GAAG,CAClB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EAAE,EACjB,IAAI,EAAE,UAAU,EAAE,KACd,IAAI,CAAC;AAEV,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE;AA6ED,wBAAgB,UAAU,CACzB,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,KAAK,GAAG,SAAS,EACvB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,WAAW,GACvB,UAAU,CA+HZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"row-autofit.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/row-autofit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAKtD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC3B,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,OAAO,GAAE,WAAgC,GACvC,MAAM,EAAE,CA8BV;AAKD,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,EAAE,CAepF"}
1
+ {"version":3,"file":"row-autofit.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/row-autofit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAKtD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC3B,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,OAAO,GAAE,WAAgC,GACvC,MAAM,EAAE,CAiCV;AAKD,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,EAAE,CAepF"}