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.
- package/dist/automation/index.cjs +167 -60
- package/dist/automation/index.mjs +167 -60
- package/dist/docx/embedded.cjs +4 -1
- package/dist/docx/embedded.mjs +4 -1
- package/dist/docx/index.cjs +4 -1
- package/dist/docx/index.mjs +4 -1
- package/dist/docx/load/index.cjs +4 -1
- package/dist/docx/load/index.mjs +4 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +145 -38
- package/dist/xlsx/index.mjs +145 -38
- package/dist/xlsx/layout/merge-sweep.d.ts +36 -0
- package/dist/xlsx/layout/merge-sweep.d.ts.map +1 -0
- package/dist/xlsx/layout/metrics.d.ts +5 -0
- package/dist/xlsx/layout/metrics.d.ts.map +1 -1
- package/dist/xlsx/layout/row-autofit.d.ts +6 -0
- package/dist/xlsx/layout/row-autofit.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +143 -39
- package/dist/xlsx/ui/index.mjs +143 -39
- package/package.json +2 -2
|
@@ -3528,7 +3528,10 @@ function writeTable(doc, table4, node3, base2, writeParagraph, replaceSlots2) {
|
|
|
3528
3528
|
"Cannot change the structure of a merged, nested, or complex table. The original DOCX package remains unchanged."
|
|
3529
3529
|
);
|
|
3530
3530
|
const width = table4.rows[0]?.length ?? 0;
|
|
3531
|
-
|
|
3531
|
+
const reshaped = structural || !base2;
|
|
3532
|
+
if (!width || table4.rows.some(
|
|
3533
|
+
(row3) => reshaped && row3.length !== width || row3.some((cell) => !cell.paragraphs.length)
|
|
3534
|
+
))
|
|
3532
3535
|
throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
|
|
3533
3536
|
const oldRows = flatRows(node3).map((entry3) => entry3.element);
|
|
3534
3537
|
const sourceById = /* @__PURE__ */ new Map();
|
|
@@ -19360,13 +19363,13 @@ function rejectUnsafeRunSegmentation(paragraph2, base2, oldRuns) {
|
|
|
19360
19363
|
`Cannot edit paragraph ${paragraph2.id}: changing run boundaries could drop unsupported run properties. The original DOCX package remains unchanged.`
|
|
19361
19364
|
);
|
|
19362
19365
|
}
|
|
19363
|
-
function writeParagraphImpl(doc, paragraph2, node3, base2, allocator,
|
|
19364
|
-
const continuation =
|
|
19365
|
-
const ranges =
|
|
19366
|
+
function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans3) {
|
|
19367
|
+
const continuation = spans3?.next.get(paragraph2.id);
|
|
19368
|
+
const ranges = spans3 && {
|
|
19366
19369
|
...continuation ?? { before: /* @__PURE__ */ new Set(), after: /* @__PURE__ */ new Set() },
|
|
19367
|
-
rangeIds:
|
|
19370
|
+
rangeIds: spans3.rangeIds
|
|
19368
19371
|
};
|
|
19369
|
-
const sameRanges = continuationKey(continuation) === continuationKey(
|
|
19372
|
+
const sameRanges = continuationKey(continuation) === continuationKey(spans3?.original.get(paragraph2.id));
|
|
19370
19373
|
if (base2 && sameRanges && JSON.stringify(paragraph2) === JSON.stringify(base2)) return node3;
|
|
19371
19374
|
const slots = collectInlineSlots(node3);
|
|
19372
19375
|
if (!slots)
|
|
@@ -19427,7 +19430,7 @@ function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans2) {
|
|
|
19427
19430
|
children2(node3, "bookmarkEnd"),
|
|
19428
19431
|
paragraph2.bookmarks ?? [],
|
|
19429
19432
|
base2?.bookmarks ?? [],
|
|
19430
|
-
() =>
|
|
19433
|
+
() => spans3?.nextId() ?? "0"
|
|
19431
19434
|
);
|
|
19432
19435
|
for (const bookmark of [...children2(node3, "bookmarkStart"), ...children2(node3, "bookmarkEnd")])
|
|
19433
19436
|
node3.removeChild(bookmark);
|
|
@@ -19449,9 +19452,9 @@ function writeParagraphImpl(doc, paragraph2, node3, base2, allocator, spans2) {
|
|
|
19449
19452
|
if (!pPr.childNodes.length) node3.removeChild(pPr);
|
|
19450
19453
|
return node3;
|
|
19451
19454
|
}
|
|
19452
|
-
function createParagraph(doc, paragraph2, allocator,
|
|
19455
|
+
function createParagraph(doc, paragraph2, allocator, spans3) {
|
|
19453
19456
|
const node3 = makeW(doc, "p");
|
|
19454
|
-
return writeParagraphImpl(doc, paragraph2, node3, void 0, allocator,
|
|
19457
|
+
return writeParagraphImpl(doc, paragraph2, node3, void 0, allocator, spans3);
|
|
19455
19458
|
}
|
|
19456
19459
|
|
|
19457
19460
|
// docx/docpr-ids.ts
|
|
@@ -19540,7 +19543,7 @@ var RelationshipAllocator = class {
|
|
|
19540
19543
|
|
|
19541
19544
|
// docx/write.ts
|
|
19542
19545
|
var twips2 = (pixels) => String(Math.round(pixels * 15));
|
|
19543
|
-
function createTable(doc, table4, allocator, contentWidthTwips,
|
|
19546
|
+
function createTable(doc, table4, allocator, contentWidthTwips, spans3) {
|
|
19544
19547
|
const node3 = makeW(doc, "tbl");
|
|
19545
19548
|
const { tblPr, tblGrid } = buildNewTableProperties(doc, table4, contentWidthTwips);
|
|
19546
19549
|
node3.appendChild(tblPr);
|
|
@@ -19556,7 +19559,7 @@ function createTable(doc, table4, allocator, contentWidthTwips, spans2) {
|
|
|
19556
19559
|
const tcPr = buildCellProperties(doc, cell);
|
|
19557
19560
|
if (tcPr) tc.appendChild(tcPr);
|
|
19558
19561
|
for (const paragraph2 of cell.paragraphs)
|
|
19559
|
-
tc.appendChild(createParagraph(doc, paragraph2, allocator,
|
|
19562
|
+
tc.appendChild(createParagraph(doc, paragraph2, allocator, spans3));
|
|
19560
19563
|
if (!cell.paragraphs.length) tc.appendChild(makeW(doc, "p"));
|
|
19561
19564
|
tr.appendChild(tc);
|
|
19562
19565
|
}
|
|
@@ -19584,13 +19587,13 @@ function baseMap(blocks) {
|
|
|
19584
19587
|
}
|
|
19585
19588
|
function applyBlocks(doc, container, blocks, original, allocator, contentWidthTwips, anchor = null) {
|
|
19586
19589
|
const nextId3 = annotationIdAllocator(doc, blocks);
|
|
19587
|
-
const
|
|
19590
|
+
const spans3 = {
|
|
19588
19591
|
next: commentContinuations(blocks),
|
|
19589
19592
|
original: commentContinuations(original),
|
|
19590
19593
|
rangeIds: newMoveRangeIds(blocks, nextId3),
|
|
19591
19594
|
nextId: nextId3
|
|
19592
19595
|
};
|
|
19593
|
-
const boundWriteParagraph = (writeDoc, paragraph2, node3, base2) => writeParagraphImpl(writeDoc, paragraph2, node3, base2, allocator,
|
|
19596
|
+
const boundWriteParagraph = (writeDoc, paragraph2, node3, base2) => writeParagraphImpl(writeDoc, paragraph2, node3, base2, allocator, spans3);
|
|
19594
19597
|
const flat = flatBlocks(container);
|
|
19595
19598
|
const oldNodes = flat.map((entry3) => entry3.element);
|
|
19596
19599
|
const oldById = /* @__PURE__ */ new Map();
|
|
@@ -19604,7 +19607,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
|
|
|
19604
19607
|
const base2 = bases.get(block.id);
|
|
19605
19608
|
if (block.type === "paragraph")
|
|
19606
19609
|
output.push(
|
|
19607
|
-
old ? boundWriteParagraph(doc, block, old, base2?.type === "paragraph" ? base2 : void 0) : createParagraph(doc, block, allocator,
|
|
19610
|
+
old ? boundWriteParagraph(doc, block, old, base2?.type === "paragraph" ? base2 : void 0) : createParagraph(doc, block, allocator, spans3)
|
|
19608
19611
|
);
|
|
19609
19612
|
else
|
|
19610
19613
|
output.push(
|
|
@@ -19615,7 +19618,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
|
|
|
19615
19618
|
base2?.type === "table" ? base2 : void 0,
|
|
19616
19619
|
boundWriteParagraph,
|
|
19617
19620
|
replaceSlots
|
|
19618
|
-
) : createTable(doc, block, allocator, contentWidthTwips,
|
|
19621
|
+
) : createTable(doc, block, allocator, contentWidthTwips, spans3)
|
|
19619
19622
|
);
|
|
19620
19623
|
}
|
|
19621
19624
|
const nested = flat.some((entry3) => entry3.sdt) || blocks.some((block) => block.contentControl);
|
|
@@ -48160,9 +48163,9 @@ function toHtml(cells3, theme3) {
|
|
|
48160
48163
|
for (let r = link.range.start.row; r <= link.range.end.row; r++)
|
|
48161
48164
|
for (let c2 = link.range.start.col; c2 <= link.range.end.col; c2++) links.set(`${r},${c2}`, link);
|
|
48162
48165
|
const covered = /* @__PURE__ */ new Set();
|
|
48163
|
-
const
|
|
48166
|
+
const spans3 = /* @__PURE__ */ new Map();
|
|
48164
48167
|
for (const m of cells3.merges) {
|
|
48165
|
-
|
|
48168
|
+
spans3.set(`${m.start.row},${m.start.col}`, m);
|
|
48166
48169
|
for (let r = m.start.row; r <= m.end.row; r++)
|
|
48167
48170
|
for (let c2 = m.start.col; c2 <= m.end.col; c2++)
|
|
48168
48171
|
if (r !== m.start.row || c2 !== m.start.col) covered.add(`${r},${c2}`);
|
|
@@ -48174,7 +48177,7 @@ function toHtml(cells3, theme3) {
|
|
|
48174
48177
|
if (covered.has(`${r},${c2}`)) continue;
|
|
48175
48178
|
const cell = cells3.data[r]?.[c2] ?? null;
|
|
48176
48179
|
const attrs3 = [];
|
|
48177
|
-
const span3 =
|
|
48180
|
+
const span3 = spans3.get(`${r},${c2}`);
|
|
48178
48181
|
if (span3 && span3.end.row > span3.start.row)
|
|
48179
48182
|
attrs3.push(`rowspan="${span3.end.row - span3.start.row + 1}"`);
|
|
48180
48183
|
if (span3 && span3.end.col > span3.start.col)
|
|
@@ -50537,16 +50540,27 @@ function columnOverrides(sheet, mdw, defaultPx) {
|
|
|
50537
50540
|
}
|
|
50538
50541
|
return out;
|
|
50539
50542
|
}
|
|
50540
|
-
function
|
|
50541
|
-
const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
|
|
50543
|
+
function pixelScale(zoom) {
|
|
50542
50544
|
const factor = zoom / 100;
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
+
return (px2) => px2 > 0 ? Math.max(1, Math.round(px2 * factor)) : 0;
|
|
50546
|
+
}
|
|
50547
|
+
function columnAxis(sheet, mdw, scale2) {
|
|
50545
50548
|
const defaultColPx = defaultColumnPixels(sheet.defaultColWidth, mdw);
|
|
50546
50549
|
const colOverrides = [...columnOverrides(sheet, mdw, defaultColPx)].map(
|
|
50547
50550
|
([c2, px2]) => [c2, scale2(px2)]
|
|
50548
50551
|
);
|
|
50549
|
-
|
|
50552
|
+
return new AxisMetrics(scale2(defaultColPx), MAX_COL + 1, colOverrides);
|
|
50553
|
+
}
|
|
50554
|
+
function createColumnWidths(sheet, options2 = {}) {
|
|
50555
|
+
const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
|
|
50556
|
+
const cols = columnAxis(sheet, options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH, pixelScale(zoom));
|
|
50557
|
+
return (c2) => cols.size(c2);
|
|
50558
|
+
}
|
|
50559
|
+
function createGridMetrics(sheet, options2 = {}) {
|
|
50560
|
+
const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
|
|
50561
|
+
const mdw = options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
|
|
50562
|
+
const scale2 = pixelScale(zoom);
|
|
50563
|
+
const cols = columnAxis(sheet, mdw, scale2);
|
|
50550
50564
|
const defaultRowPx = pointsToPixels(sheet.defaultRowHeight);
|
|
50551
50565
|
const rowOverrides = [];
|
|
50552
50566
|
for (const [r, info] of sheet.rowInfo) {
|
|
@@ -54846,6 +54860,87 @@ function cellView(workbook, sheetIndex2, row3, col, cf, options2 = {}) {
|
|
|
54846
54860
|
return view;
|
|
54847
54861
|
}
|
|
54848
54862
|
|
|
54863
|
+
// xlsx/layout/merge-sweep.ts
|
|
54864
|
+
var NONE = { merged: false, spanned: false };
|
|
54865
|
+
var SINGLE3 = { merged: true, spanned: false };
|
|
54866
|
+
var SPANNED = { merged: true, spanned: true };
|
|
54867
|
+
var spans2 = (merge2) => merge2.start.row !== merge2.end.row || merge2.start.col !== merge2.end.col;
|
|
54868
|
+
function firstRightOf(merges, col) {
|
|
54869
|
+
let lo = 0;
|
|
54870
|
+
let hi = merges.length;
|
|
54871
|
+
while (lo < hi) {
|
|
54872
|
+
const mid = lo + hi >> 1;
|
|
54873
|
+
if ((merges[mid]?.start.col ?? 0) <= col) lo = mid + 1;
|
|
54874
|
+
else hi = mid;
|
|
54875
|
+
}
|
|
54876
|
+
return lo;
|
|
54877
|
+
}
|
|
54878
|
+
var MergeSweep = class {
|
|
54879
|
+
/** The merges by first row; `next` is the first one the sweep has not reached. */
|
|
54880
|
+
byRow;
|
|
54881
|
+
next = 0;
|
|
54882
|
+
row = Number.NEGATIVE_INFINITY;
|
|
54883
|
+
/** The merges covering the current row, by first column. */
|
|
54884
|
+
active = [];
|
|
54885
|
+
/** The last row of the earliest-ending active merge. */
|
|
54886
|
+
firstEnd = Number.POSITIVE_INFINITY;
|
|
54887
|
+
overlapping = false;
|
|
54888
|
+
constructor(merges) {
|
|
54889
|
+
this.byRow = [...merges].sort((a2, b) => a2.start.row - b.start.row);
|
|
54890
|
+
}
|
|
54891
|
+
/** How many merges cover the current row, which is everything the sweep holds. */
|
|
54892
|
+
get size() {
|
|
54893
|
+
return this.active.length;
|
|
54894
|
+
}
|
|
54895
|
+
/** Moves to `row`, which must not be above the previous one. */
|
|
54896
|
+
moveTo(row3) {
|
|
54897
|
+
if (row3 < this.row) throw new RangeError(`Rows must not go up: ${row3} after ${this.row}`);
|
|
54898
|
+
this.row = row3;
|
|
54899
|
+
if (row3 > this.firstEnd) this.dropEnded(row3);
|
|
54900
|
+
for (; this.next < this.byRow.length; this.next++) {
|
|
54901
|
+
const merge2 = this.byRow[this.next];
|
|
54902
|
+
if (!merge2 || merge2.start.row > row3) break;
|
|
54903
|
+
if (merge2.end.row >= row3) this.add(merge2);
|
|
54904
|
+
}
|
|
54905
|
+
}
|
|
54906
|
+
/** How the merges cover column `col` of the current row. */
|
|
54907
|
+
at(col) {
|
|
54908
|
+
if (this.overlapping) {
|
|
54909
|
+
let merged = false;
|
|
54910
|
+
for (const merge3 of this.active) {
|
|
54911
|
+
if (col < merge3.start.col || col > merge3.end.col) continue;
|
|
54912
|
+
if (spans2(merge3)) return SPANNED;
|
|
54913
|
+
merged = true;
|
|
54914
|
+
}
|
|
54915
|
+
return merged ? SINGLE3 : NONE;
|
|
54916
|
+
}
|
|
54917
|
+
const merge2 = this.active[firstRightOf(this.active, col) - 1];
|
|
54918
|
+
if (!merge2 || col > merge2.end.col) return NONE;
|
|
54919
|
+
return spans2(merge2) ? SPANNED : SINGLE3;
|
|
54920
|
+
}
|
|
54921
|
+
add(merge2) {
|
|
54922
|
+
const at2 = firstRightOf(this.active, merge2.start.col);
|
|
54923
|
+
const before = this.active[at2 - 1];
|
|
54924
|
+
const after = this.active[at2];
|
|
54925
|
+
if (before && before.end.col >= merge2.start.col || after && merge2.end.col >= after.start.col)
|
|
54926
|
+
this.overlapping = true;
|
|
54927
|
+
this.active.splice(at2, 0, merge2);
|
|
54928
|
+
this.firstEnd = Math.min(this.firstEnd, merge2.end.row);
|
|
54929
|
+
}
|
|
54930
|
+
dropEnded(row3) {
|
|
54931
|
+
let kept = 0;
|
|
54932
|
+
let firstEnd = Number.POSITIVE_INFINITY;
|
|
54933
|
+
for (const merge2 of this.active) {
|
|
54934
|
+
if (merge2.end.row < row3) continue;
|
|
54935
|
+
this.active[kept++] = merge2;
|
|
54936
|
+
firstEnd = Math.min(firstEnd, merge2.end.row);
|
|
54937
|
+
}
|
|
54938
|
+
this.active.length = kept;
|
|
54939
|
+
this.firstEnd = firstEnd;
|
|
54940
|
+
if (!kept) this.overlapping = false;
|
|
54941
|
+
}
|
|
54942
|
+
};
|
|
54943
|
+
|
|
54849
54944
|
// xlsx/layout/row-autofit.ts
|
|
54850
54945
|
var LINE_HEIGHTS = [
|
|
54851
54946
|
[6, 8.25],
|
|
@@ -54905,30 +55000,39 @@ function wrappedLineCount(text8, width, measure2) {
|
|
|
54905
55000
|
}
|
|
54906
55001
|
return lines2;
|
|
54907
55002
|
}
|
|
54908
|
-
function
|
|
55003
|
+
function fitRowHeights(workbook, sheetIndex2, rows, measure2) {
|
|
55004
|
+
const heights = /* @__PURE__ */ new Map();
|
|
54909
55005
|
const sheet = workbook.sheets[sheetIndex2];
|
|
54910
|
-
if (!sheet) return
|
|
54911
|
-
const
|
|
54912
|
-
|
|
54913
|
-
|
|
54914
|
-
|
|
54915
|
-
|
|
54916
|
-
|
|
54917
|
-
|
|
54918
|
-
|
|
54919
|
-
|
|
54920
|
-
|
|
54921
|
-
|
|
54922
|
-
const
|
|
54923
|
-
|
|
54924
|
-
|
|
54925
|
-
|
|
54926
|
-
|
|
54927
|
-
|
|
55006
|
+
if (!sheet) return heights;
|
|
55007
|
+
const filled = [];
|
|
55008
|
+
for (const row3 of new Set(rows)) {
|
|
55009
|
+
if (sheet.rows.get(row3)?.size) filled.push(row3);
|
|
55010
|
+
else heights.set(row3, sheet.defaultRowHeight);
|
|
55011
|
+
}
|
|
55012
|
+
filled.sort((a2, b) => a2 - b);
|
|
55013
|
+
const merges = new MergeSweep(sheet.merges);
|
|
55014
|
+
let colWidth;
|
|
55015
|
+
for (const row3 of filled) {
|
|
55016
|
+
merges.moveTo(row3);
|
|
55017
|
+
let tallest = 0;
|
|
55018
|
+
for (const col of sheet.rows.get(row3)?.keys() ?? []) {
|
|
55019
|
+
const cover = merges.at(col);
|
|
55020
|
+
if (cover.spanned) continue;
|
|
55021
|
+
const view = cellView(workbook, sheetIndex2, row3, col, void 0, { merged: cover.merged });
|
|
55022
|
+
if (!view.text) continue;
|
|
55023
|
+
const fonts = view.rich?.length ? view.rich.map((run2) => run2.font) : [view.font];
|
|
55024
|
+
const sizePt = Math.max(...fonts.map((f6) => f6.sizePx * 3 / 4));
|
|
55025
|
+
let lines2 = 1;
|
|
55026
|
+
if (view.wrap) {
|
|
55027
|
+
colWidth ??= createColumnWidths(sheet, { zoom: 100 });
|
|
55028
|
+
const width = colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
|
|
55029
|
+
lines2 = wrappedLineCount(view.text, width, (text8) => measure2(text8, view.font));
|
|
55030
|
+
}
|
|
55031
|
+
tallest = Math.max(tallest, lines2 * lineHeightPoints(sizePt));
|
|
54928
55032
|
}
|
|
54929
|
-
tallest
|
|
55033
|
+
heights.set(row3, tallest > 0 ? tallest : sheet.defaultRowHeight);
|
|
54930
55034
|
}
|
|
54931
|
-
return
|
|
55035
|
+
return heights;
|
|
54932
55036
|
}
|
|
54933
55037
|
var approximateMeasure = (text8, font) => text8.length * font.sizePx * (font.bold ? 0.58 : 0.53);
|
|
54934
55038
|
|
|
@@ -54936,13 +55040,16 @@ var approximateMeasure = (text8, font) => text8.length * font.sizePx * (font.bol
|
|
|
54936
55040
|
var MAX_HEIGHT2 = 409;
|
|
54937
55041
|
function autoGrowRows(ctx, s, rows, measure2 = approximateMeasure) {
|
|
54938
55042
|
const sheet = sheetAt(ctx.workbook, s);
|
|
54939
|
-
const
|
|
54940
|
-
for (const row3 of new Set(rows)) {
|
|
55043
|
+
const candidates = [...new Set(rows)].filter((row3) => {
|
|
54941
55044
|
const info = sheet.rowInfo.get(row3);
|
|
54942
|
-
|
|
54943
|
-
|
|
55045
|
+
return !info?.customHeight && !info?.hidden;
|
|
55046
|
+
});
|
|
55047
|
+
const fits = fitRowHeights(ctx.workbook, s, candidates, measure2);
|
|
55048
|
+
const updates = [];
|
|
55049
|
+
for (const row3 of candidates) {
|
|
55050
|
+
const fit3 = Math.min(MAX_HEIGHT2, fits.get(row3) ?? sheet.defaultRowHeight);
|
|
54944
55051
|
const next = Math.abs(fit3 - sheet.defaultRowHeight) < 1e-9 ? void 0 : fit3;
|
|
54945
|
-
const current =
|
|
55052
|
+
const current = sheet.rowInfo.get(row3)?.height;
|
|
54946
55053
|
if (current === next) continue;
|
|
54947
55054
|
if (current !== void 0 && next !== void 0 && Math.abs(current - next) < 1e-9) continue;
|
|
54948
55055
|
updates.push([row3, next]);
|
|
@@ -55884,7 +55991,7 @@ function inspectZip(bytes, limits, check3) {
|
|
|
55884
55991
|
if (count2 > limits.maxEntries) fail2("LIMIT_ENTRIES", "Too many ZIP entries");
|
|
55885
55992
|
if (centralStart + centralSize !== end) fail2("INVALID_ZIP", "Invalid central directory bounds");
|
|
55886
55993
|
const entries = /* @__PURE__ */ new Map(), canonical2 = /* @__PURE__ */ new Set();
|
|
55887
|
-
const
|
|
55994
|
+
const spans3 = [];
|
|
55888
55995
|
let offset2 = centralStart, total2 = 0;
|
|
55889
55996
|
const extras = (start, length, name3) => {
|
|
55890
55997
|
const stop = start + length;
|
|
@@ -55954,14 +56061,14 @@ function inspectZip(bytes, limits, check3) {
|
|
|
55954
56061
|
dataEnd += 12;
|
|
55955
56062
|
}
|
|
55956
56063
|
if (dataEnd > centralStart) fail2("ZIP_MISMATCH", "ZIP entry overlaps the central directory");
|
|
55957
|
-
|
|
56064
|
+
spans3.push({ start: local, end: dataEnd });
|
|
55958
56065
|
entries.set(name3, { name: name3, compressed, size: size3, crc, directory });
|
|
55959
56066
|
offset2 += 46 + nameLength + extraLength + commentLength;
|
|
55960
56067
|
}
|
|
55961
56068
|
if (offset2 !== end) fail2("INVALID_ZIP", "Central directory length or count mismatch");
|
|
55962
|
-
|
|
56069
|
+
spans3.sort((a2, b) => a2.start - b.start);
|
|
55963
56070
|
let previousEnd = 0;
|
|
55964
|
-
for (const span3 of
|
|
56071
|
+
for (const span3 of spans3) {
|
|
55965
56072
|
if (span3.start !== previousEnd)
|
|
55966
56073
|
fail2("ZIP_MISMATCH", "Overlapping, prefixed, or unindexed ZIP records");
|
|
55967
56074
|
previousEnd = span3.end;
|
|
@@ -68691,13 +68798,13 @@ function flattenCornerCurve(points) {
|
|
|
68691
68798
|
return flattened ? [points[0], ...flattened] : void 0;
|
|
68692
68799
|
}
|
|
68693
68800
|
function connectorCurveMiddle(points) {
|
|
68694
|
-
const
|
|
68801
|
+
const spans3 = connectorCurveSpans(points);
|
|
68695
68802
|
if (points.length === 5) {
|
|
68696
68803
|
const flattened = flattenCornerCurve(points);
|
|
68697
68804
|
if (flattened) return connectorPolylineMiddle(flattened);
|
|
68698
68805
|
return mix(points[0], points.at(-1), 0.5);
|
|
68699
68806
|
}
|
|
68700
|
-
const row3 = [...
|
|
68807
|
+
const row3 = [...spans3[0]];
|
|
68701
68808
|
for (let count2 = row3.length - 1; count2 > 0; count2--)
|
|
68702
68809
|
for (let i2 = 0; i2 < count2; i2++) row3[i2] = mix(row3[i2], row3[i2 + 1], 0.5);
|
|
68703
68810
|
return row3[0];
|
|
@@ -79753,7 +79860,7 @@ function assertParentIndependent(facts, from, ids) {
|
|
|
79753
79860
|
|
|
79754
79861
|
// visio/edit-group.ts
|
|
79755
79862
|
var clean5 = (value3) => Math.abs(value3) < 1e-12 ? 0 : value3;
|
|
79756
|
-
var
|
|
79863
|
+
var NONE2 = /* @__PURE__ */ new Map();
|
|
79757
79864
|
function topLevel2(root) {
|
|
79758
79865
|
const containers = children3(root, "Shapes");
|
|
79759
79866
|
if (containers.length !== 1)
|
|
@@ -79768,7 +79875,7 @@ function assertGroupable(shape2, document) {
|
|
|
79768
79875
|
assertShapeLocks(shape2, document, ["LockGroup"]);
|
|
79769
79876
|
assertUnlayeredShape(shape2, document);
|
|
79770
79877
|
}
|
|
79771
|
-
var transformOf = (shape2, instances =
|
|
79878
|
+
var transformOf = (shape2, instances = NONE2) => {
|
|
79772
79879
|
const local = cells(instances.get(shape2)?.view ?? shape2);
|
|
79773
79880
|
const width = numeric4(local.get("Width")), height = numeric4(local.get("Height"));
|
|
79774
79881
|
return {
|
|
@@ -79790,7 +79897,7 @@ var transformOf = (shape2, instances = NONE) => {
|
|
|
79790
79897
|
)
|
|
79791
79898
|
};
|
|
79792
79899
|
};
|
|
79793
|
-
function visioShapeBounds(shapes, instances =
|
|
79900
|
+
function visioShapeBounds(shapes, instances = NONE2) {
|
|
79794
79901
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
79795
79902
|
for (const shape2 of shapes) {
|
|
79796
79903
|
const box5 = transformOf(shape2, instances);
|
|
@@ -79810,7 +79917,7 @@ function visioShapeBounds(shapes, instances = NONE) {
|
|
|
79810
79917
|
}
|
|
79811
79918
|
return { minX, minY, maxX, maxY };
|
|
79812
79919
|
}
|
|
79813
|
-
function groupVisioShapes(root, document, edit, check3, instances =
|
|
79920
|
+
function groupVisioShapes(root, document, edit, check3, instances = NONE2) {
|
|
79814
79921
|
check3();
|
|
79815
79922
|
const siblings = topLevel2(root);
|
|
79816
79923
|
for (const node3 of Array.from(root.getElementsByTagName("*")))
|
|
@@ -79883,7 +79990,7 @@ function groupVisioShapes(root, document, edit, check3, instances = NONE) {
|
|
|
79883
79990
|
}
|
|
79884
79991
|
return true;
|
|
79885
79992
|
}
|
|
79886
|
-
function ungroupVisioShape(root, document, edit, check3, instances =
|
|
79993
|
+
function ungroupVisioShape(root, document, edit, check3, instances = NONE2) {
|
|
79887
79994
|
check3();
|
|
79888
79995
|
const candidates = topLevel2(root).filter((shape2) => attribute3(shape2, "ID") === edit.shapeId);
|
|
79889
79996
|
if (candidates.length !== 1 || attribute3(candidates[0], "Type") !== "Group")
|