ooxml-core 1.4.0 → 1.5.0

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.
@@ -7608,8 +7608,8 @@ function svgBlipRelId(blip) {
7608
7608
  return svgBlip && getR(svgBlip, "embed") || void 0;
7609
7609
  }
7610
7610
  function textBoxParagraphs(graphicData) {
7611
- const box2 = descendantNS(graphicData, WPS_NS2, "txbx");
7612
- const content2 = descendantNS(box2, W_NS2, "txbxContent");
7611
+ const box3 = descendantNS(graphicData, WPS_NS2, "txbx");
7612
+ const content2 = descendantNS(box3, W_NS2, "txbxContent");
7613
7613
  if (!content2) return void 0;
7614
7614
  const paragraphs = [];
7615
7615
  const visit2 = (node) => {
@@ -13106,11 +13106,35 @@ function rowMatchesFilter(workbook, sheet, row2, filter2) {
13106
13106
  return text2 === "" ? !!column.blank : (column.values ?? []).includes(text2);
13107
13107
  });
13108
13108
  }
13109
+ function setRowFiltered(sheet, row2, filteredOut, hasCriteria = false) {
13110
+ const info = { ...sheet.rowInfo.get(row2) };
13111
+ const manual = info.manuallyHidden || info.hidden && !info.filteredOut;
13112
+ if (filteredOut) {
13113
+ info.hidden = true;
13114
+ info.filteredOut = true;
13115
+ if (manual) info.manuallyHidden = true;
13116
+ } else {
13117
+ delete info.filteredOut;
13118
+ delete info.manuallyHidden;
13119
+ if (manual) {
13120
+ info.hidden = true;
13121
+ if (hasCriteria) info.filteredOut = false;
13122
+ } else delete info.hidden;
13123
+ }
13124
+ if (Object.keys(info).length) sheet.rowInfo.set(row2, info);
13125
+ else sheet.rowInfo.delete(row2);
13126
+ }
13127
+ function clearFilteredRows(sheet) {
13128
+ for (const [row2, info] of sheet.rowInfo)
13129
+ if (info.filteredOut !== void 0 || info.manuallyHidden !== void 0)
13130
+ setRowFiltered(sheet, row2, false);
13131
+ }
13109
13132
  function isFilteredRow(workbook, sheet, row2) {
13133
+ const filter2 = sheet.autoFilter;
13134
+ if (!filter2) return false;
13110
13135
  const info = sheet.rowInfo.get(row2);
13111
13136
  if (info?.filteredOut !== void 0) return info.filteredOut;
13112
- const filter2 = sheet.autoFilter;
13113
- return !!info?.hidden && !!filter2 && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
13137
+ return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
13114
13138
  }
13115
13139
  function readFilteredRows(workbook) {
13116
13140
  for (const sheet of workbook.sheets)
@@ -23505,31 +23529,31 @@ function fitLeastSquares(x, y, hasIntercept) {
23505
23529
  }
23506
23530
  return { slopes, intercept, inverse, means, n, hasIntercept, ssTotal, ssResid };
23507
23531
  }
23508
- function fitStatistics(fit) {
23509
- const k = fit.slopes.length;
23510
- const df = fit.n - k - (fit.hasIntercept ? 1 : 0);
23532
+ function fitStatistics(fit2) {
23533
+ const k = fit2.slopes.length;
23534
+ const df = fit2.n - k - (fit2.hasIntercept ? 1 : 0);
23511
23535
  if (df < 1) fail(ERR.NUM);
23512
- const ssRegression = fit.ssTotal - fit.ssResid;
23513
- const variance2 = fit.ssResid / df;
23536
+ const ssRegression = fit2.ssTotal - fit2.ssResid;
23537
+ const variance2 = fit2.ssResid / df;
23514
23538
  const standardError = Math.sqrt(variance2);
23515
- const slopeErrors = fit.inverse.map((row2, j) => Math.sqrt(variance2 * (row2[j] ?? 0)));
23539
+ const slopeErrors = fit2.inverse.map((row2, j) => Math.sqrt(variance2 * (row2[j] ?? 0)));
23516
23540
  let interceptError;
23517
- if (fit.hasIntercept) {
23541
+ if (fit2.hasIntercept) {
23518
23542
  let quad = 0;
23519
23543
  for (let a2 = 0; a2 < k; a2++)
23520
23544
  for (let b = 0; b < k; b++)
23521
- quad += (fit.means[a2] ?? 0) * (fit.inverse[a2]?.[b] ?? 0) * (fit.means[b] ?? 0);
23522
- interceptError = Math.sqrt(variance2 * (1 / fit.n + quad));
23545
+ quad += (fit2.means[a2] ?? 0) * (fit2.inverse[a2]?.[b] ?? 0) * (fit2.means[b] ?? 0);
23546
+ interceptError = Math.sqrt(variance2 * (1 / fit2.n + quad));
23523
23547
  }
23524
23548
  return {
23525
23549
  slopeErrors,
23526
23550
  interceptError,
23527
- rSquared: fit.ssTotal === 0 ? 1 : ssRegression / fit.ssTotal,
23551
+ rSquared: fit2.ssTotal === 0 ? 1 : ssRegression / fit2.ssTotal,
23528
23552
  standardError,
23529
- fStatistic: fit.ssResid === 0 ? Infinity : ssRegression / k / variance2,
23553
+ fStatistic: fit2.ssResid === 0 ? Infinity : ssRegression / k / variance2,
23530
23554
  df,
23531
23555
  ssRegression,
23532
- ssResidual: fit.ssResid
23556
+ ssResidual: fit2.ssResid
23533
23557
  };
23534
23558
  }
23535
23559
 
@@ -23566,13 +23590,13 @@ var row = (values2, width) => [
23566
23590
  ...values2,
23567
23591
  ...new Array(Math.max(0, width - values2.length)).fill(ERR.NA)
23568
23592
  ];
23569
- function coefficientTable(fit, stats, transform7) {
23570
- const k = fit.slopes.length;
23593
+ function coefficientTable(fit2, stats, transform7) {
23594
+ const k = fit2.slopes.length;
23571
23595
  const width = k + 1;
23572
- const slopes = [...fit.slopes].reverse().map(transform7);
23573
- const head = [...slopes, transform7(fit.intercept)];
23596
+ const slopes = [...fit2.slopes].reverse().map(transform7);
23597
+ const head = [...slopes, transform7(fit2.intercept)];
23574
23598
  if (!stats) return new Matrix([head]);
23575
- const s = fitStatistics(fit);
23599
+ const s = fitStatistics(fit2);
23576
23600
  const errors = [...s.slopeErrors].reverse();
23577
23601
  return new Matrix([
23578
23602
  head,
@@ -23582,16 +23606,16 @@ function coefficientTable(fit, stats, transform7) {
23582
23606
  row([s.ssRegression, s.ssResidual], width)
23583
23607
  ]);
23584
23608
  }
23585
- function predictions(ctx, args, lay, fit, transform7) {
23586
- const predict = (obs) => transform7(fit.intercept + fit.slopes.reduce((a2, m, j) => a2 + m * (obs[j] ?? 0), 0));
23609
+ function predictions(ctx, args, lay, fit2, transform7) {
23610
+ const predict = (obs) => transform7(fit2.intercept + fit2.slopes.reduce((a2, m, j) => a2 + m * (obs[j] ?? 0), 0));
23587
23611
  if (omitted(args, 2)) {
23588
23612
  const out2 = lay.x.map(predict);
23589
23613
  return new Matrix(lay.column ? out2.map((v) => [v]) : [out2]);
23590
23614
  }
23591
23615
  const target = numbersOf2(ctx, args[2]);
23592
- if (fit.slopes.length === 1) return new Matrix(target.map((r) => r.map((v) => predict([v]))));
23616
+ if (fit2.slopes.length === 1) return new Matrix(target.map((r) => r.map((v) => predict([v]))));
23593
23617
  const observations = asObservations(target, lay.column);
23594
- if ((observations[0]?.length ?? 0) !== fit.slopes.length) fail(ERR.REF);
23618
+ if ((observations[0]?.length ?? 0) !== fit2.slopes.length) fail(ERR.REF);
23595
23619
  const out = observations.map(predict);
23596
23620
  return new Matrix(lay.column ? out.map((v) => [v]) : [out]);
23597
23621
  }
@@ -23610,8 +23634,8 @@ var REGRESSION_FUNCTIONS = [
23610
23634
  4,
23611
23635
  (args, ctx) => {
23612
23636
  const lay = layout2(ctx, args);
23613
- const fit = fitLeastSquares(lay.x, lay.y, withConst(args, 2));
23614
- return coefficientTable(fit, !omitted(args, 3) && bool(args[3]), (v) => v);
23637
+ const fit2 = fitLeastSquares(lay.x, lay.y, withConst(args, 2));
23638
+ return coefficientTable(fit2, !omitted(args, 3) && bool(args[3]), (v) => v);
23615
23639
  },
23616
23640
  ARGS
23617
23641
  ),
@@ -23624,11 +23648,11 @@ var REGRESSION_FUNCTIONS = [
23624
23648
  4,
23625
23649
  (args, ctx) => {
23626
23650
  const lay = logs(layout2(ctx, args));
23627
- const fit = fitLeastSquares(lay.x, lay.y, withConst(args, 2));
23651
+ const fit2 = fitLeastSquares(lay.x, lay.y, withConst(args, 2));
23628
23652
  const stats = !omitted(args, 3) && bool(args[3]);
23629
- const table2 = coefficientTable(fit, stats, Math.exp);
23653
+ const table2 = coefficientTable(fit2, stats, Math.exp);
23630
23654
  if (!stats) return table2;
23631
- const plain2 = coefficientTable(fit, true, (v) => v).data;
23655
+ const plain2 = coefficientTable(fit2, true, (v) => v).data;
23632
23656
  return new Matrix([table2.data[0] ?? [], ...plain2.slice(1)]);
23633
23657
  },
23634
23658
  ARGS
@@ -23642,8 +23666,8 @@ var REGRESSION_FUNCTIONS = [
23642
23666
  4,
23643
23667
  (args, ctx) => {
23644
23668
  const lay = layout2(ctx, args);
23645
- const fit = fitLeastSquares(lay.x, lay.y, withConst(args, 3));
23646
- return predictions(ctx, args, lay, fit, (v) => v);
23669
+ const fit2 = fitLeastSquares(lay.x, lay.y, withConst(args, 3));
23670
+ return predictions(ctx, args, lay, fit2, (v) => v);
23647
23671
  },
23648
23672
  ARGS
23649
23673
  ),
@@ -23656,8 +23680,8 @@ var REGRESSION_FUNCTIONS = [
23656
23680
  4,
23657
23681
  (args, ctx) => {
23658
23682
  const lay = logs(layout2(ctx, args));
23659
- const fit = fitLeastSquares(lay.x, lay.y, withConst(args, 3));
23660
- return predictions(ctx, args, lay, fit, Math.exp);
23683
+ const fit2 = fitLeastSquares(lay.x, lay.y, withConst(args, 3));
23684
+ return predictions(ctx, args, lay, fit2, Math.exp);
23661
23685
  },
23662
23686
  ARGS
23663
23687
  )
@@ -24423,8 +24447,8 @@ var STATISTICAL_MORE = [
24423
24447
  (args, ctx) => {
24424
24448
  const x = num2(args[0]);
24425
24449
  const { xs, ys } = pairedNumbers(ctx, args[2] ?? null, args[1] ?? null);
24426
- const fit = linearFit(xs, ys);
24427
- return fit.intercept + fit.slope * x;
24450
+ const fit2 = linearFit(xs, ys);
24451
+ return fit2.intercept + fit2.slope * x;
24428
24452
  },
24429
24453
  ["value", "any"]
24430
24454
  )
@@ -26402,15 +26426,15 @@ var push2 = (c2, area) => {
26402
26426
  function spans(areas) {
26403
26427
  const boxes = /* @__PURE__ */ new Map();
26404
26428
  for (const { sheet, range } of areas) {
26405
- const box2 = boxes.get(sheet);
26406
- if (!box2) {
26429
+ const box3 = boxes.get(sheet);
26430
+ if (!box3) {
26407
26431
  boxes.set(sheet, { sheet, range: { start: { ...range.start }, end: { ...range.end } } });
26408
26432
  continue;
26409
26433
  }
26410
- box2.range.start.row = Math.min(box2.range.start.row, range.start.row);
26411
- box2.range.start.col = Math.min(box2.range.start.col, range.start.col);
26412
- box2.range.end.row = Math.max(box2.range.end.row, range.end.row);
26413
- box2.range.end.col = Math.max(box2.range.end.col, range.end.col);
26434
+ box3.range.start.row = Math.min(box3.range.start.row, range.start.row);
26435
+ box3.range.start.col = Math.min(box3.range.start.col, range.start.col);
26436
+ box3.range.end.row = Math.max(box3.range.end.row, range.end.row);
26437
+ box3.range.end.col = Math.max(box3.range.end.col, range.end.col);
26414
26438
  }
26415
26439
  return [...boxes.values()];
26416
26440
  }
@@ -27960,12 +27984,12 @@ function within(spec2, range) {
27960
27984
  start: { row: spec2.start.row, col: spec2.start.col },
27961
27985
  end: { row: spec2.end.row, col: spec2.end.col }
27962
27986
  });
27963
- const box2 = normalizeRange(range);
27964
- return r.start.row >= box2.start.row && r.end.row <= box2.end.row && r.start.col >= box2.start.col && r.end.col <= box2.end.col;
27987
+ const box3 = normalizeRange(range);
27988
+ return r.start.row >= box3.start.row && r.end.row <= box3.end.row && r.start.col >= box3.start.col && r.end.col <= box3.end.col;
27965
27989
  }
27966
- var shifted = (box2, dRow, dCol) => ({
27967
- start: { row: box2.start.row + dRow, col: box2.start.col + dCol },
27968
- end: { row: box2.end.row + dRow, col: box2.end.col + dCol }
27990
+ var shifted = (box3, dRow, dCol) => ({
27991
+ start: { row: box3.start.row + dRow, col: box3.start.col + dCol },
27992
+ end: { row: box3.end.row + dRow, col: box3.end.col + dCol }
27969
27993
  });
27970
27994
  function withPrefix(sheet, body) {
27971
27995
  return sheet === void 0 ? body : prefixText({ sheet }) + body;
@@ -29328,7 +29352,7 @@ var headerFooterOf = (page) => {
29328
29352
  };
29329
29353
  function setupXml(sheet, page) {
29330
29354
  const source2 = snapshotElement(sheet, "pageSetup");
29331
- const fit = page.fitToWidth !== void 0 || page.fitToHeight !== void 0;
29355
+ const fit2 = page.fitToWidth !== void 0 || page.fitToHeight !== void 0;
29332
29356
  const pick4 = (p) => ({
29333
29357
  orientation: p.orientation,
29334
29358
  paperSize: p.paperSize,
@@ -29336,13 +29360,13 @@ function setupXml(sheet, page) {
29336
29360
  fitToWidth: p.fitToWidth,
29337
29361
  fitToHeight: p.fitToHeight
29338
29362
  });
29339
- const modelled = fit || page.orientation !== void 0 || page.paperSize !== void 0 || page.scale !== void 0;
29363
+ const modelled = fit2 || page.orientation !== void 0 || page.paperSize !== void 0 || page.scale !== void 0;
29340
29364
  if (!source2 && !modelled) return "";
29341
29365
  if (source2) {
29342
- const before = readPageSetup(void 0, source2, void 0, fit) ?? {};
29366
+ const before = readPageSetup(void 0, source2, void 0, fit2) ?? {};
29343
29367
  if (sameModel(pick4(before), pick4(page))) return snapshotXml(sheet, "pageSetup") ?? "";
29344
29368
  }
29345
- const fitValues = fit ? { fitToWidth: page.fitToWidth, fitToHeight: page.fitToHeight } : {};
29369
+ const fitValues = fit2 ? { fitToWidth: page.fitToWidth, fitToHeight: page.fitToHeight } : {};
29346
29370
  return `<pageSetup${mergedAttrs(source2, {
29347
29371
  paperSize: page.paperSize,
29348
29372
  scale: page.scale,
@@ -29936,17 +29960,17 @@ function writeSheetDrawing(ctx, sheet, partName, rels, sourceDrawing) {
29936
29960
  var sqref = (ranges) => ranges.map((range) => formatRange(range)).join(" ");
29937
29961
  function sheetPrXml(sheet) {
29938
29962
  const source2 = snapshotElement(sheet, "sheetPr");
29939
- const fit = sheet.pageSetup?.fitToWidth !== void 0 || sheet.pageSetup?.fitToHeight !== void 0;
29940
- if (source2 && sameModel(readTabColor(source2), sheet.tabColor) && readFitToPage(source2) === fit)
29963
+ const fit2 = sheet.pageSetup?.fitToWidth !== void 0 || sheet.pageSetup?.fitToHeight !== void 0;
29964
+ if (source2 && sameModel(readTabColor(source2), sheet.tabColor) && readFitToPage(source2) === fit2)
29941
29965
  return snapshotXml(sheet, "sheetPr") ?? "";
29942
29966
  const sourceAttrs = source2 ? Array.from(source2.attributes).filter((a2) => !a2.name.startsWith("xmlns")).map((a2) => ` ${a2.name}="${escapeAttr3(a2.value)}"`).join("") : "";
29943
29967
  const children4 = source2 ? elements(source2) : [];
29944
29968
  const outline2 = children4.find((node) => node.localName === "outlinePr");
29945
29969
  const setUp = children4.find((node) => node.localName === "pageSetUpPr");
29946
29970
  let setUpXml = "";
29947
- if (setUp || fit) {
29971
+ if (setUp || fit2) {
29948
29972
  const keep2 = setUp ? Array.from(setUp.attributes).filter((a2) => a2.name !== "fitToPage" && !a2.name.startsWith("xmlns")).map((a2) => ` ${a2.name}="${escapeAttr3(a2.value)}"`).join("") : "";
29949
- setUpXml = `<pageSetUpPr${keep2}${fit ? ' fitToPage="1"' : ""}/>`;
29973
+ setUpXml = `<pageSetUpPr${keep2}${fit2 ? ' fitToPage="1"' : ""}/>`;
29950
29974
  if (setUpXml === "<pageSetUpPr/>") setUpXml = "";
29951
29975
  }
29952
29976
  const inner2 = colorXml(sheet.tabColor, "tabColor") + (outline2 ? outerXml(outline2) : "") + setUpXml;
@@ -31719,8 +31743,10 @@ function shiftSheetContent(sheet, shift2, band) {
31719
31743
  if (sheet.autoFilter) {
31720
31744
  const old = sheet.autoFilter.range;
31721
31745
  const range = moveRange(old);
31722
- if (!range) delete sheet.autoFilter;
31723
- else {
31746
+ if (!range) {
31747
+ delete sheet.autoFilter;
31748
+ clearFilteredRows(sheet);
31749
+ } else {
31724
31750
  const filter2 = { ...sheet.autoFilter, range };
31725
31751
  if (shift2.axis === "col" && filter2.columns)
31726
31752
  filter2.columns = filter2.columns.flatMap((fc) => {
@@ -31871,6 +31897,9 @@ function shiftAxis(ctx, s, axis, at2, count2, insert) {
31871
31897
  const sheet = sheetAt(ctx.workbook, s);
31872
31898
  const noun = axis === "row" ? count2 === 1 ? "row" : "rows" : count2 === 1 ? "column" : "columns";
31873
31899
  const shift2 = { axis, at: at2, count: insert ? count2 : -count2 };
31900
+ const info = { sheet: s, structural: true };
31901
+ if (!sheet.autoFilter || shiftRange(sheet.autoFilter.range, shift2))
31902
+ info.calc = { kind: "shift", sheet: s, shift: shift2 };
31874
31903
  ctx.run(
31875
31904
  `${insert ? "Insert" : "Delete"} ${noun}`,
31876
31905
  "structure",
@@ -31879,7 +31908,7 @@ function shiftAxis(ctx, s, axis, at2, count2, insert) {
31879
31908
  applyAxisShift(ctx, sheet, shift2);
31880
31909
  if (insert) inheritFormats(sheet, axis, at2, count2);
31881
31910
  },
31882
- { sheet: s, structural: true, calc: { kind: "shift", sheet: s, shift: shift2 } }
31911
+ info
31883
31912
  );
31884
31913
  }
31885
31914
  var insertRows = (ctx, s, at2, count2) => shiftAxis(ctx, s, "row", at2, count2, true);
@@ -32930,9 +32959,9 @@ function setRowHeight(ctx, s, rows, height) {
32930
32959
  for (const row2 of rows) {
32931
32960
  const info = { ...sheet.rowInfo.get(row2) };
32932
32961
  if (height === "auto") {
32933
- const fit = fitRowHeight(ctx, sheet, row2);
32934
- if (fit === sheet.defaultRowHeight) delete info.height;
32935
- else info.height = fit;
32962
+ const fit2 = fitRowHeight(ctx, sheet, row2);
32963
+ if (fit2 === sheet.defaultRowHeight) delete info.height;
32964
+ else info.height = fit2;
32936
32965
  delete info.customHeight;
32937
32966
  } else {
32938
32967
  const h2 = Math.max(0, Math.min(MAX_HEIGHT, height));
@@ -32976,11 +33005,12 @@ function setHidden(ctx, s, axis, indices, hidden) {
32976
33005
  continue;
32977
33006
  }
32978
33007
  const filter2 = sheet.autoFilter;
32979
- if (filter2?.columns?.length && row2 > filter2.range.start.row && row2 <= filter2.range.end.row)
33008
+ if (hidden && filter2?.columns?.length && row2 > filter2.range.start.row && row2 <= filter2.range.end.row)
32980
33009
  info.filteredOut = false;
32981
33010
  if (hidden) info.hidden = true;
32982
33011
  else {
32983
33012
  delete info.hidden;
33013
+ delete info.filteredOut;
32984
33014
  if (info.height === 0) delete info.height;
32985
33015
  }
32986
33016
  if (Object.keys(info).length) sheet.rowInfo.set(row2, info);
@@ -33133,22 +33163,7 @@ function applyFilter(ctx, sheet, filter2) {
33133
33163
  const { range } = filter2;
33134
33164
  for (let row2 = range.start.row + 1; row2 <= range.end.row; row2++) {
33135
33165
  const visible = rowMatchesFilter(ctx.workbook, sheet, row2, filter2);
33136
- const info = { ...sheet.rowInfo.get(row2) };
33137
- const manual = info.manuallyHidden || info.hidden && !info.filteredOut;
33138
- if (visible) {
33139
- delete info.filteredOut;
33140
- delete info.manuallyHidden;
33141
- if (manual) {
33142
- info.hidden = true;
33143
- if (filter2.columns?.length) info.filteredOut = false;
33144
- } else delete info.hidden;
33145
- } else {
33146
- info.hidden = true;
33147
- info.filteredOut = true;
33148
- if (manual) info.manuallyHidden = true;
33149
- }
33150
- if (Object.keys(info).length) sheet.rowInfo.set(row2, info);
33151
- else sheet.rowInfo.delete(row2);
33166
+ setRowFiltered(sheet, row2, !visible, !!filter2.columns?.length);
33152
33167
  }
33153
33168
  }
33154
33169
  function setAutoFilter(ctx, s, range) {
@@ -37402,9 +37417,9 @@ function wrappedLineCount(text2, width, measure) {
37402
37417
  current = word.trimStart();
37403
37418
  }
37404
37419
  while (current.length > 1 && measure(current) > width) {
37405
- let fit = 1;
37406
- while (fit < current.length && measure(current.slice(0, fit + 1)) <= width) fit++;
37407
- current = current.slice(fit);
37420
+ let fit2 = 1;
37421
+ while (fit2 < current.length && measure(current.slice(0, fit2 + 1)) <= width) fit2++;
37422
+ current = current.slice(fit2);
37408
37423
  lines++;
37409
37424
  }
37410
37425
  }
@@ -37446,8 +37461,8 @@ function autoGrowRows(ctx, s, rows, measure = approximateMeasure) {
37446
37461
  for (const row2 of new Set(rows)) {
37447
37462
  const info = sheet.rowInfo.get(row2);
37448
37463
  if (info?.customHeight || info?.hidden) continue;
37449
- const fit = Math.min(MAX_HEIGHT2, autoFitRowHeight(ctx.workbook, s, row2, measure));
37450
- const next = Math.abs(fit - sheet.defaultRowHeight) < 1e-9 ? void 0 : fit;
37464
+ const fit2 = Math.min(MAX_HEIGHT2, autoFitRowHeight(ctx.workbook, s, row2, measure));
37465
+ const next = Math.abs(fit2 - sheet.defaultRowHeight) < 1e-9 ? void 0 : fit2;
37451
37466
  const current = info?.height;
37452
37467
  if (current === next) continue;
37453
37468
  if (current !== void 0 && next !== void 0 && Math.abs(current - next) < 1e-9) continue;
@@ -46206,6 +46221,203 @@ async function replaceScopedTextRanges(pkg, pagePaths, roots, document, edit, ch
46206
46221
  return true;
46207
46222
  }
46208
46223
 
46224
+ // visio/basic-shapes.ts
46225
+ var VISIO_BASIC_SHAPES = [
46226
+ "rectangle",
46227
+ "square",
46228
+ "triangle",
46229
+ "right-triangle",
46230
+ "pentagon",
46231
+ "hexagon",
46232
+ "octagon",
46233
+ "star",
46234
+ "diamond",
46235
+ "rounded-rectangle",
46236
+ "cross",
46237
+ "parallelogram",
46238
+ "trapezoid",
46239
+ "can",
46240
+ "cube",
46241
+ "chevron"
46242
+ ];
46243
+ var isVisioBasicShape = (value) => VISIO_BASIC_SHAPES.includes(value);
46244
+ function fit(points) {
46245
+ const xs = points.map(([x]) => x), ys = points.map(([, y]) => y);
46246
+ const left2 = Math.min(...xs), bottom = Math.min(...ys);
46247
+ const width = Math.max(...xs) - left2, height = Math.max(...ys) - bottom;
46248
+ return points.map(([x, y]) => [(x - left2) / width, (y - bottom) / height]);
46249
+ }
46250
+ function polygon(count2, inner2) {
46251
+ const steps = inner2 === void 0 ? count2 : count2 * 2;
46252
+ return fit(
46253
+ Array.from({ length: steps }, (_, index2) => {
46254
+ const radius = inner2 !== void 0 && index2 % 2 ? inner2 : 1;
46255
+ const angle = Math.PI / 2 + index2 * 2 * Math.PI / steps;
46256
+ return [radius * Math.cos(angle), radius * Math.sin(angle)];
46257
+ })
46258
+ );
46259
+ }
46260
+ function arc(cy, ry, from, to) {
46261
+ const segments = 12;
46262
+ return Array.from({ length: segments + 1 }, (_, index2) => {
46263
+ const angle = from + (to - from) * index2 / segments;
46264
+ return [0.5 + 0.5 * Math.cos(angle), cy + ry * Math.sin(angle)];
46265
+ });
46266
+ }
46267
+ var box2 = [
46268
+ [0, 0],
46269
+ [1, 0],
46270
+ [1, 1],
46271
+ [0, 1]
46272
+ ];
46273
+ var LID = 0.2;
46274
+ var CUT = 1 / (2 + Math.SQRT2);
46275
+ var OUTLINES = {
46276
+ rectangle: { paths: [box2] },
46277
+ square: { paths: [box2] },
46278
+ triangle: {
46279
+ paths: [
46280
+ [
46281
+ [0, 0],
46282
+ [1, 0],
46283
+ [0.5, 1]
46284
+ ]
46285
+ ]
46286
+ },
46287
+ "right-triangle": {
46288
+ paths: [
46289
+ [
46290
+ [0, 0],
46291
+ [1, 0],
46292
+ [0, 1]
46293
+ ]
46294
+ ]
46295
+ },
46296
+ pentagon: { paths: [polygon(5)] },
46297
+ hexagon: {
46298
+ paths: [
46299
+ [
46300
+ [0.25, 0],
46301
+ [0.75, 0],
46302
+ [1, 0.5],
46303
+ [0.75, 1],
46304
+ [0.25, 1],
46305
+ [0, 0.5]
46306
+ ]
46307
+ ]
46308
+ },
46309
+ octagon: {
46310
+ paths: [
46311
+ [
46312
+ [CUT, 0],
46313
+ [1 - CUT, 0],
46314
+ [1, CUT],
46315
+ [1, 1 - CUT],
46316
+ [1 - CUT, 1],
46317
+ [CUT, 1],
46318
+ [0, 1 - CUT],
46319
+ [0, CUT]
46320
+ ]
46321
+ ]
46322
+ },
46323
+ star: { paths: [polygon(5, 0.382)] },
46324
+ diamond: {
46325
+ paths: [
46326
+ [
46327
+ [0.5, 0],
46328
+ [1, 0.5],
46329
+ [0.5, 1],
46330
+ [0, 0.5]
46331
+ ]
46332
+ ]
46333
+ },
46334
+ "rounded-rectangle": { paths: [box2], rounding: 0.15 },
46335
+ cross: {
46336
+ paths: [
46337
+ [
46338
+ [1 / 3, 0],
46339
+ [2 / 3, 0],
46340
+ [2 / 3, 1 / 3],
46341
+ [1, 1 / 3],
46342
+ [1, 2 / 3],
46343
+ [2 / 3, 2 / 3],
46344
+ [2 / 3, 1],
46345
+ [1 / 3, 1],
46346
+ [1 / 3, 2 / 3],
46347
+ [0, 2 / 3],
46348
+ [0, 1 / 3],
46349
+ [1 / 3, 1 / 3]
46350
+ ]
46351
+ ]
46352
+ },
46353
+ parallelogram: {
46354
+ paths: [
46355
+ [
46356
+ [0, 0],
46357
+ [0.75, 0],
46358
+ [1, 1],
46359
+ [0.25, 1]
46360
+ ]
46361
+ ]
46362
+ },
46363
+ trapezoid: {
46364
+ paths: [
46365
+ [
46366
+ [0, 0],
46367
+ [1, 0],
46368
+ [0.75, 1],
46369
+ [0.25, 1]
46370
+ ]
46371
+ ]
46372
+ },
46373
+ can: {
46374
+ paths: [
46375
+ // The body: down the left side, round the front of the base, up the right side and
46376
+ // back along the front of the lid.
46377
+ [...arc(LID / 2, LID / 2, Math.PI, 2 * Math.PI), ...arc(1 - LID / 2, LID / 2, 0, -Math.PI)],
46378
+ // The lid, drawn over the body.
46379
+ arc(1 - LID / 2, LID / 2, 0, 2 * Math.PI).slice(0, -1)
46380
+ ]
46381
+ },
46382
+ cube: {
46383
+ paths: [
46384
+ [
46385
+ [0, 0],
46386
+ [0.75, 0],
46387
+ [0.75, 0.75],
46388
+ [0, 0.75]
46389
+ ],
46390
+ [
46391
+ [0, 0.75],
46392
+ [0.75, 0.75],
46393
+ [1, 1],
46394
+ [0.25, 1]
46395
+ ],
46396
+ [
46397
+ [0.75, 0],
46398
+ [1, 0.25],
46399
+ [1, 1],
46400
+ [0.75, 0.75]
46401
+ ]
46402
+ ]
46403
+ },
46404
+ chevron: {
46405
+ paths: [
46406
+ [
46407
+ [0, 0],
46408
+ [0.75, 0],
46409
+ [1, 0.5],
46410
+ [0.75, 1],
46411
+ [0, 1],
46412
+ [0.25, 0.5]
46413
+ ]
46414
+ ]
46415
+ }
46416
+ };
46417
+ function visioBasicShapeOutline(shape2) {
46418
+ return OUTLINES[shape2];
46419
+ }
46420
+
46209
46421
  // visio/edit-text-range-commands.ts
46210
46422
  var invalidXmlText = /[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
46211
46423
  function textRangeBoundary(text2, offset2) {
@@ -46572,7 +46784,10 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
46572
46784
  return { ...target, type: edit.type, beginX, beginY, endX, endY };
46573
46785
  }
46574
46786
  case "create-rectangle":
46575
- case "create-ellipse":
46787
+ case "create-ellipse": {
46788
+ const shape2 = edit.type === "create-rectangle" ? edit.shape : void 0;
46789
+ if (shape2 !== void 0 && !isVisioBasicShape(shape2))
46790
+ fail2("INVALID_EDIT", "Unknown basic shape.");
46576
46791
  return {
46577
46792
  ...target,
46578
46793
  type: edit.type,
@@ -46580,8 +46795,10 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
46580
46795
  y: numeric5(edit.y),
46581
46796
  width: numeric5(edit.width, true),
46582
46797
  height: numeric5(edit.height, true),
46583
- ...edit.text === void 0 ? {} : { text: text2(edit.text) }
46798
+ ...edit.text === void 0 ? {} : { text: text2(edit.text) },
46799
+ ...shape2 === void 0 ? {} : { shape: shape2 }
46584
46800
  };
46801
+ }
46585
46802
  case "rotate-shape":
46586
46803
  return { ...target, type: edit.type, angle: numeric5(edit.angle) };
46587
46804
  case "flip-shape":
@@ -46995,24 +47212,25 @@ function createRectangle(root, document, edit) {
46995
47212
  }
46996
47213
  const doc = root.ownerDocument;
46997
47214
  const node = (name) => doc.createElementNS(root.namespaceURI, name);
46998
- const section = node("Section");
46999
- section.setAttribute("N", "Geometry");
47000
- section.setAttribute("IX", "0");
47001
- for (const [index2, [x, y]] of [
47002
- [0, 0],
47003
- [1, 0],
47004
- [1, 1],
47005
- [0, 1],
47006
- [0, 0]
47007
- ].entries()) {
47008
- const row2 = node("Row");
47009
- row2.setAttribute("IX", String(index2 + 1));
47010
- row2.setAttribute("T", index2 ? "RelLineTo" : "RelMoveTo");
47011
- setCell(row2, "X", x);
47012
- setCell(row2, "Y", y);
47013
- section.appendChild(row2);
47215
+ const outline2 = visioBasicShapeOutline(
47216
+ edit.type === "create-rectangle" ? edit.shape ?? "rectangle" : "rectangle"
47217
+ );
47218
+ if (outline2.rounding)
47219
+ setCell(shape2, "Rounding", outline2.rounding * Math.min(edit.width, edit.height));
47220
+ for (const [sectionIndex, points] of outline2.paths.entries()) {
47221
+ const section = node("Section");
47222
+ section.setAttribute("N", "Geometry");
47223
+ section.setAttribute("IX", String(sectionIndex));
47224
+ for (const [index2, [x, y]] of [...points, points[0]].entries()) {
47225
+ const row2 = node("Row");
47226
+ row2.setAttribute("IX", String(index2 + 1));
47227
+ row2.setAttribute("T", index2 ? "RelLineTo" : "RelMoveTo");
47228
+ setCell(row2, "X", x);
47229
+ setCell(row2, "Y", y);
47230
+ section.appendChild(row2);
47231
+ }
47232
+ shape2.appendChild(section);
47014
47233
  }
47015
- shape2.appendChild(section);
47016
47234
  const text2 = node("Text");
47017
47235
  text2.appendChild(doc.createTextNode(encodeVisioPlainText(edit.text ?? "")));
47018
47236
  shape2.appendChild(text2);
@@ -12263,10 +12263,11 @@ function rowMatchesFilter(workbook, sheet, row2, filter2) {
12263
12263
  });
12264
12264
  }
12265
12265
  function isFilteredRow(workbook, sheet, row2) {
12266
+ const filter2 = sheet.autoFilter;
12267
+ if (!filter2) return false;
12266
12268
  const info = sheet.rowInfo.get(row2);
12267
12269
  if (info?.filteredOut !== void 0) return info.filteredOut;
12268
- const filter2 = sheet.autoFilter;
12269
- return !!info?.hidden && !!filter2 && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
12270
+ return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
12270
12271
  }
12271
12272
  var init_filter_rows = __esm({
12272
12273
  "xlsx/filter-rows.ts"() {
@@ -12236,10 +12236,11 @@ function rowMatchesFilter(workbook, sheet, row2, filter2) {
12236
12236
  });
12237
12237
  }
12238
12238
  function isFilteredRow(workbook, sheet, row2) {
12239
+ const filter2 = sheet.autoFilter;
12240
+ if (!filter2) return false;
12239
12241
  const info = sheet.rowInfo.get(row2);
12240
12242
  if (info?.filteredOut !== void 0) return info.filteredOut;
12241
- const filter2 = sheet.autoFilter;
12242
- return !!info?.hidden && !!filter2 && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
12243
+ return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
12243
12244
  }
12244
12245
  var init_filter_rows = __esm({
12245
12246
  "xlsx/filter-rows.ts"() {