ooxml-core 1.18.0 → 1.19.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.
Files changed (82) hide show
  1. package/dist/{PptxHandler-X6AO6LKJ.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
  2. package/dist/{PptxHandler-5X4VOWAO.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
  3. package/dist/{PptxHandler-4AHDZDA5.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
  4. package/dist/{PresentationBuilder-UY3S4YE2.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
  5. package/dist/{PresentationBuilder-LRX55PXA.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
  6. package/dist/{PresentationBuilder-MJB4LIFS.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
  7. package/dist/automation/index.cjs +535 -266
  8. package/dist/automation/index.mjs +535 -266
  9. package/dist/chart/axis-range-auto.d.ts +10 -0
  10. package/dist/chart/axis-range-auto.d.ts.map +1 -0
  11. package/dist/chart/axis-range-types.d.ts +27 -0
  12. package/dist/chart/axis-range-types.d.ts.map +1 -0
  13. package/dist/chart/axis-range.d.ts +37 -0
  14. package/dist/chart/axis-range.d.ts.map +1 -0
  15. package/dist/chart/axis-ticks.d.ts +8 -0
  16. package/dist/chart/axis-ticks.d.ts.map +1 -0
  17. package/dist/chart/index.cjs +815 -165
  18. package/dist/chart/index.d.ts +6 -0
  19. package/dist/chart/index.d.ts.map +1 -1
  20. package/dist/chart/index.mjs +795 -166
  21. package/dist/chart/line-dash.d.ts +2 -0
  22. package/dist/chart/line-dash.d.ts.map +1 -0
  23. package/dist/chart/marker-shape.d.ts +70 -0
  24. package/dist/chart/marker-shape.d.ts.map +1 -0
  25. package/dist/chart/render/chart-svg-axes.d.ts +9 -0
  26. package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
  27. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  28. package/dist/chart/render/chart-svg-markers.d.ts +6 -0
  29. package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
  30. package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
  31. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
  32. package/dist/chart/render/chart-view-axes.d.ts +30 -0
  33. package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
  34. package/dist/chart/render/chart-view-markers.d.ts +27 -0
  35. package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
  36. package/dist/chart/render/chart-view-series.d.ts.map +1 -1
  37. package/dist/chart/render/chart-view.d.ts +4 -1
  38. package/dist/chart/render/chart-view.d.ts.map +1 -1
  39. package/dist/chart/render/index.d.ts +2 -0
  40. package/dist/chart/render/index.d.ts.map +1 -1
  41. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  42. package/dist/chart/render/summary.d.ts +6 -1
  43. package/dist/chart/render/summary.d.ts.map +1 -1
  44. package/dist/{chunk-7NWQUCGX.mjs → chunk-3XFPCZKB.mjs} +1 -1
  45. package/dist/{chunk-Z5Y53IZD.mjs → chunk-75GLSRZE.mjs} +4 -4
  46. package/dist/{chunk-LT7RCEHY.mjs → chunk-BIVNVDAH.mjs} +1 -1
  47. package/dist/{chunk-I5ZE3VLI.mjs → chunk-QBJRB6WW.mjs} +1 -1
  48. package/dist/{chunk-U7IDT6VT.mjs → chunk-RUZEMWDI.mjs} +1 -1
  49. package/dist/docx/index.cjs +695 -168
  50. package/dist/docx/index.mjs +695 -168
  51. package/dist/docx/layout/index.cjs +697 -170
  52. package/dist/docx/layout/index.mjs +697 -170
  53. package/dist/docx/ui/index.cjs +704 -177
  54. package/dist/docx/ui/index.mjs +704 -177
  55. package/dist/index.cjs +912 -262
  56. package/dist/index.mjs +912 -262
  57. package/dist/pptx/automation/index.cjs +54 -0
  58. package/dist/pptx/automation/index.mjs +5 -5
  59. package/dist/pptx/cli/index.cjs +54 -0
  60. package/dist/pptx/cli/index.mjs +4 -4
  61. package/dist/pptx/converter/index.mjs +2 -2
  62. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  63. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  64. package/dist/pptx/index.cjs +54 -0
  65. package/dist/pptx/index.mjs +5 -5
  66. package/dist/teams/index.cjs +71 -5
  67. package/dist/teams/index.mjs +71 -5
  68. package/dist/visio/index.cjs +483 -214
  69. package/dist/visio/index.mjs +483 -214
  70. package/dist/visio/ui/index.cjs +504 -235
  71. package/dist/visio/ui/index.mjs +504 -235
  72. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  73. package/dist/xlsx/index.cjs +818 -281
  74. package/dist/xlsx/index.mjs +818 -281
  75. package/dist/xlsx/load/index.cjs +58 -5
  76. package/dist/xlsx/load/index.mjs +58 -5
  77. package/dist/xlsx/read/chart.d.ts.map +1 -1
  78. package/dist/xlsx/ui/index.cjs +835 -298
  79. package/dist/xlsx/ui/index.mjs +835 -298
  80. package/package.json +1 -1
  81. /package/dist/{chunk-C363NN2C.mjs → chunk-H6TNNXJK.mjs} +0 -0
  82. /package/dist/{chunk-R4BCOQHB.cjs → chunk-MHMVD23Y.cjs} +0 -0
@@ -118,11 +118,11 @@ function checkXmlLimits(xml, label2, limits = {}) {
118
118
  throw new Error(`${label2} XML exceeds the nesting depth limit of ${maxDepth}`);
119
119
  }
120
120
  }
121
- function parseXml(xml, options = {}) {
122
- const label2 = options.label ?? "OOXML";
121
+ function parseXml(xml, options2 = {}) {
122
+ const label2 = options2.label ?? "OOXML";
123
123
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
124
124
  throw new Error(`${label2} XML with DTD or entity declarations is not supported`);
125
- checkXmlLimits(xml, label2, options.limits);
125
+ checkXmlLimits(xml, label2, options2.limits);
126
126
  let parseError = "";
127
127
  let parsed;
128
128
  try {
@@ -2891,8 +2891,8 @@ function rgbToHsl(r, g2, b) {
2891
2891
  }
2892
2892
  return { h: h2, s: clampUnitInterval(s), l: clampUnitInterval(l) };
2893
2893
  }
2894
- function hslToRgb(h2, s, l, roundChannel = Math.round, options) {
2895
- const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
2894
+ function hslToRgb(h2, s, l, roundChannel = Math.round, options2) {
2895
+ const sC = options2?.clampSaturation === false ? s : clampUnitInterval(s);
2896
2896
  const lC = clampUnitInterval(l);
2897
2897
  const hN = (h2 % 360 + 360) % 360;
2898
2898
  const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
@@ -5071,13 +5071,13 @@ var APPLIED = /* @__PURE__ */ new Set([
5071
5071
  "lumMod",
5072
5072
  "lumOff"
5073
5073
  ]);
5074
- function resolveDrawingColor(color2, theme3, options) {
5074
+ function resolveDrawingColor(color2, theme3, options2) {
5075
5075
  const base2 = baseHex(color2, theme3);
5076
5076
  const rgb7 = base2 ? hexToRgbChannels(base2) : null;
5077
5077
  if (!rgb7) return void 0;
5078
- if (options?.transformOrder === "document") {
5078
+ if (options2?.transformOrder === "document") {
5079
5079
  const value3 = orderedColorTransforms(rgb7, color2.transforms);
5080
- const round6 = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
5080
+ const round6 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
5081
5081
  return {
5082
5082
  hex: `#${toHex(round6(value3.r))}${toHex(round6(value3.g))}${toHex(round6(value3.b))}`,
5083
5083
  alpha: value3.alpha,
@@ -5128,7 +5128,7 @@ function resolveDrawingColor(color2, theme3, options) {
5128
5128
  if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
5129
5129
  const lumOff = parseDrawingFraction(find3("lumOff"));
5130
5130
  if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
5131
- const round6 = options?.hslRounding === "halfDown" ? (value3) => Math.ceil(value3 - 0.5) : Math.round;
5131
+ const round6 = options2?.hslRounding === "halfDown" ? (value3) => Math.ceil(value3 - 0.5) : Math.round;
5132
5132
  ({ r, g: g2, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round6));
5133
5133
  }
5134
5134
  let alpha = parseDrawingPercent(find3("alpha")) ?? 1;
@@ -14353,14 +14353,14 @@ function scottBinCount(values2, min, max) {
14353
14353
  const width = 3.49 * sd * values2.length ** (-1 / 3);
14354
14354
  return Math.max(1, Math.ceil((max - min) / width));
14355
14355
  }
14356
- function computeHistogramBins(values2, options, format5 = String) {
14357
- const closed = options.intervalClosed ?? "l";
14356
+ function computeHistogramBins(values2, options2, format5 = String) {
14357
+ const closed = options2.intervalClosed ?? "l";
14358
14358
  const finite4 = values2.map((value3, sourceIndex) => ({ value: value3, sourceIndex })).filter((item) => Number.isFinite(item.value));
14359
14359
  if (finite4.length === 0) {
14360
14360
  return [];
14361
14361
  }
14362
- const underflow = typeof options.underflow === "number" ? options.underflow : void 0;
14363
- const overflow = typeof options.overflow === "number" ? options.overflow : void 0;
14362
+ const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
14363
+ const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
14364
14364
  const under = underflow === void 0 ? [] : finite4.filter(
14365
14365
  (item) => closed === "r" ? item.value <= underflow : item.value < underflow
14366
14366
  );
@@ -14377,8 +14377,8 @@ function computeHistogramBins(values2, options, format5 = String) {
14377
14377
  if (regular.length > 0) {
14378
14378
  const min = Math.min(...regular.map((item) => item.value));
14379
14379
  const max = Math.max(...regular.map((item) => item.value));
14380
- const requestedSize = options.binSize && options.binSize > 0 ? options.binSize : void 0;
14381
- const requestedCount = options.binCount && options.binCount > 0 ? options.binCount : void 0;
14380
+ const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
14381
+ const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
14382
14382
  const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
14383
14383
  const count2 = requestedSize ? Math.max(
14384
14384
  closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
@@ -14429,9 +14429,9 @@ function aggregateByCategory(values2, rawCategories) {
14429
14429
  }
14430
14430
 
14431
14431
  // chart/waterfall.ts
14432
- function buildWaterfallSteps(values2, options) {
14432
+ function buildWaterfallSteps(values2, options2) {
14433
14433
  const subtotalIndices = new Set(
14434
- options?.subtotalIndices ?? (values2.length > 0 ? [values2.length - 1] : [])
14434
+ options2?.subtotalIndices ?? (values2.length > 0 ? [values2.length - 1] : [])
14435
14435
  );
14436
14436
  const steps = [];
14437
14437
  let runningTotal = 0;
@@ -14976,12 +14976,12 @@ function resolveChartGradient(fill, resolve3) {
14976
14976
  }
14977
14977
 
14978
14978
  // chart/bar-cluster-geometry.ts
14979
- function assertBarClusterOptions(options) {
14979
+ function assertBarClusterOptions(options2) {
14980
14980
  for (const [field2, min, max] of [
14981
14981
  ["barGapWidth", 0, 500],
14982
14982
  ["barOverlap", -100, 100]
14983
14983
  ]) {
14984
- const value3 = options[field2];
14984
+ const value3 = options2[field2];
14985
14985
  if (value3 !== void 0 && (!Number.isInteger(value3) || value3 < min || value3 > max))
14986
14986
  throw new RangeError(`${field2} must be an integer from ${min} to ${max}`);
14987
14987
  }
@@ -16239,8 +16239,8 @@ function titleXml(context, title) {
16239
16239
  chartTextXml(context, tx, false) + layoutXml(context, title.layout) + valXml("overlay", title.overlay) + shapePropertiesXml(context, title.spPr) + textBodyXml(context, title.txPr) + raw(context, title.extLst)
16240
16240
  );
16241
16241
  }
16242
- function labelOptionsXml(context, options) {
16243
- return numberFormatXml(options.numberFormat) + shapePropertiesXml(context, options.spPr) + textBodyXml(context, options.txPr) + valXml("dLblPos", options.position) + valXml("showLegendKey", options.showLegendKey) + valXml("showVal", options.showValue) + valXml("showCatName", options.showCategoryName) + valXml("showSerName", options.showSeriesName) + valXml("showPercent", options.showPercent) + valXml("showBubbleSize", options.showBubbleSize) + (options.separator === void 0 ? "" : textElement("separator", options.separator));
16242
+ function labelOptionsXml(context, options2) {
16243
+ return numberFormatXml(options2.numberFormat) + shapePropertiesXml(context, options2.spPr) + textBodyXml(context, options2.txPr) + valXml("dLblPos", options2.position) + valXml("showLegendKey", options2.showLegendKey) + valXml("showVal", options2.showValue) + valXml("showCatName", options2.showCategoryName) + valXml("showSerName", options2.showSeriesName) + valXml("showPercent", options2.showPercent) + valXml("showBubbleSize", options2.showBubbleSize) + (options2.separator === void 0 ? "" : textElement("separator", options2.separator));
16244
16244
  }
16245
16245
  function labelXml(context, label2) {
16246
16246
  return elementXml(
@@ -16410,7 +16410,7 @@ function styleXml(context, space) {
16410
16410
  );
16411
16411
  }
16412
16412
  var relationship = (local, id3, content2 = "") => id3 === void 0 ? "" : elementXml(local, content2, ` r:id="${escapeAttribute(id3)}"`);
16413
- function writeChartSpace(space, options = {}) {
16413
+ function writeChartSpace(space, options2 = {}) {
16414
16414
  const bindings = new Map(CHART_ROOT_BINDINGS);
16415
16415
  for (const { prefix: prefix3, uri } of space.namespaceDeclarations ?? [])
16416
16416
  if (!bindings.has(prefix3) && /^[A-Za-z_][\w.-]*$/.test(prefix3)) bindings.set(prefix3, uri);
@@ -16425,9 +16425,77 @@ function writeChartSpace(space, options = {}) {
16425
16425
  space.externalDataRelId,
16426
16426
  valXml("autoUpdate", space.externalDataAutoUpdate)
16427
16427
  ) + raw(context, space.printSettings) + relationship("userShapes", space.userShapesRelId) + raw(context, space.extLst);
16428
- const breakAfter = options.declarationBreak ?? "\r\n";
16428
+ const breakAfter = options2.declarationBreak ?? "\r\n";
16429
16429
  return `${DECLARATION2}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
16430
16430
  }
16431
+ var AUTOMATIC_MARKER_CYCLE = [
16432
+ "diamond",
16433
+ "square",
16434
+ "triangle",
16435
+ "x",
16436
+ "star",
16437
+ "circle",
16438
+ "plus",
16439
+ "dot",
16440
+ "dash"
16441
+ ];
16442
+ function automaticMarkerSymbol(seriesIdx) {
16443
+ const length = AUTOMATIC_MARKER_CYCLE.length;
16444
+ const normalized = (Math.trunc(seriesIdx) % length + length) % length;
16445
+ return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
16446
+ }
16447
+
16448
+ // chart/render/chart-view-markers.ts
16449
+ function summaryMarkers(source2, group2, seriesPosition) {
16450
+ if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
16451
+ const enabled2 = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
16452
+ const symbol = source2.marker?.symbol;
16453
+ const marker4 = {
16454
+ ...source2.marker,
16455
+ symbol: symbol && symbol !== "auto" ? symbol : source2.marker || enabled2 ? automaticMarkerSymbol(source2.index ?? seriesPosition) : "none"
16456
+ };
16457
+ const pointMarkers = {};
16458
+ for (const point2 of source2.dataPoints) {
16459
+ if (point2.index === void 0 || !point2.marker) continue;
16460
+ const override = point2.marker;
16461
+ pointMarkers[point2.index] = {
16462
+ ...marker4,
16463
+ ...override,
16464
+ ...override.symbol === "auto" || !source2.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source2.index ?? seriesPosition) } : {},
16465
+ ...marker4.spPr || override.spPr ? {
16466
+ spPr: {
16467
+ ...marker4.spPr,
16468
+ ...override.spPr,
16469
+ ...marker4.spPr?.line || override.spPr?.line ? { line: { ...marker4.spPr?.line, ...override.spPr?.line } } : {}
16470
+ }
16471
+ } : {}
16472
+ };
16473
+ }
16474
+ return { marker: marker4, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
16475
+ }
16476
+ function seriesMarkerViews(source2, drawingColor2) {
16477
+ const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor2(fill.color) : void 0;
16478
+ const resolve3 = (marker4) => {
16479
+ const fill = fillColor(marker4.spPr?.fill);
16480
+ const stroke = fillColor(marker4.spPr?.line?.fill);
16481
+ const width = marker4.spPr?.line?.widthEmu;
16482
+ return {
16483
+ ...marker4.symbol !== void 0 ? { symbol: marker4.symbol } : {},
16484
+ ...marker4.size !== void 0 ? { size: marker4.size } : {},
16485
+ ...fill !== void 0 ? { fill } : {},
16486
+ ...stroke !== void 0 ? { stroke } : {},
16487
+ ...width !== void 0 ? { strokeWidth: width / 9525 } : {}
16488
+ };
16489
+ };
16490
+ return {
16491
+ ...source2.marker ? { marker: resolve3(source2.marker) } : {},
16492
+ ...source2.pointMarkers ? {
16493
+ pointMarkers: Object.fromEntries(
16494
+ Object.entries(source2.pointMarkers).map(([i2, marker4]) => [i2, resolve3(marker4)])
16495
+ )
16496
+ } : {}
16497
+ };
16498
+ }
16431
16499
 
16432
16500
  // chart/render/summary-analysis.ts
16433
16501
  function summaryTrendline(source2) {
@@ -16470,17 +16538,17 @@ function summaryAnalysis(series) {
16470
16538
  }
16471
16539
 
16472
16540
  // chart/render/summary-labels.ts
16473
- function level(options, custom) {
16541
+ function level(options2, custom) {
16474
16542
  const out = {};
16475
- if (options.deleted !== void 0) out.deleted = options.deleted;
16476
- if (options.showValue !== void 0) out.showValue = options.showValue;
16477
- if (options.showCategoryName !== void 0) out.showCategory = options.showCategoryName;
16478
- if (options.showSeriesName !== void 0) out.showSeriesName = options.showSeriesName;
16479
- if (options.showPercent !== void 0) out.showPercent = options.showPercent;
16480
- if (options.showBubbleSize !== void 0) out.showBubbleSize = options.showBubbleSize;
16481
- if (options.separator !== void 0) out.separator = options.separator;
16482
- if (options.position) out.position = options.position;
16483
- if (options.numberFormat?.formatCode) out.numberFormat = options.numberFormat.formatCode;
16543
+ if (options2.deleted !== void 0) out.deleted = options2.deleted;
16544
+ if (options2.showValue !== void 0) out.showValue = options2.showValue;
16545
+ if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
16546
+ if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
16547
+ if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
16548
+ if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
16549
+ if (options2.separator !== void 0) out.separator = options2.separator;
16550
+ if (options2.position) out.position = options2.position;
16551
+ if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
16484
16552
  if (custom?.text !== void 0) out.text = custom.text;
16485
16553
  return out;
16486
16554
  }
@@ -16587,7 +16655,10 @@ function extraGroups(chartSpace, firstType) {
16587
16655
  const type = group2.kind === "bar" ? "column" : group2.kind;
16588
16656
  const entry3 = {
16589
16657
  chartType: type,
16590
- series: group2.series.map((source2) => chartSummarySeries(source2, type, group2.dataLabels)),
16658
+ series: group2.series.map((source2, index3) => ({
16659
+ ...chartSummarySeries(source2, type, group2.dataLabels),
16660
+ ...summaryMarkers(source2, group2, index3)
16661
+ })),
16591
16662
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
16592
16663
  };
16593
16664
  if (group2.grouping && GROUPINGS.has(group2.grouping))
@@ -16605,13 +16676,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
16605
16676
  const group2 = chartSpace.plotArea.groups[0];
16606
16677
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
16607
16678
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
16608
- const series = (group2?.series ?? []).map(
16609
- (source2) => chartSummarySeries(source2, chartType, group2?.dataLabels)
16610
- );
16679
+ const series = (group2?.series ?? []).map((source2, index3) => ({
16680
+ ...chartSummarySeries(source2, chartType, group2?.dataLabels),
16681
+ ...group2 ? summaryMarkers(source2, group2, index3) : {}
16682
+ }));
16611
16683
  const summary = {
16612
16684
  chartType,
16613
16685
  series,
16614
- showLegend: chartSpace.legend !== void 0
16686
+ showLegend: chartSpace.legend !== void 0,
16687
+ axes: chartSpace.plotArea.axes,
16688
+ axisIds: group2?.axisIds ?? []
16615
16689
  };
16616
16690
  const combined = extraGroups(chartSpace, chartType);
16617
16691
  if (combined.length) summary.extraGroups = combined;
@@ -16963,14 +17037,14 @@ function* units(raw2) {
16963
17037
  exp2++;
16964
17038
  }
16965
17039
  }
16966
- function niceScale(dataMin, dataMax, options = {}) {
16967
- const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
17040
+ function niceScale(dataMin, dataMax, options2 = {}) {
17041
+ const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
16968
17042
  let lo = Number.isFinite(dataMin) ? dataMin : 0;
16969
17043
  let hi = Number.isFinite(dataMax) ? dataMax : 0;
16970
17044
  if (lo > hi) [lo, hi] = [hi, lo];
16971
17045
  if (lo === hi) {
16972
17046
  if (lo === 0) hi = 1;
16973
- else if (options.noZero) {
17047
+ else if (options2.noZero) {
16974
17048
  const pad8 = Math.abs(lo) * 0.1 || 1;
16975
17049
  lo -= pad8;
16976
17050
  hi += pad8;
@@ -16979,7 +17053,7 @@ function niceScale(dataMin, dataMax, options = {}) {
16979
17053
  }
16980
17054
  let fixedLo = false;
16981
17055
  let fixedHi = false;
16982
- if (!options.noZero) {
17056
+ if (!options2.noZero) {
16983
17057
  if (lo >= 0 && hi - lo >= hi / 6) {
16984
17058
  lo = 0;
16985
17059
  fixedLo = true;
@@ -17019,6 +17093,194 @@ function formatAxisValue(value3, percent = false) {
17019
17093
  return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
17020
17094
  }
17021
17095
 
17096
+ // chart/axis-range.ts
17097
+ function computeLogValueRange(series, logBase) {
17098
+ const allValues = series.flatMap((item) => item.values).filter((value3) => value3 !== null && Number.isFinite(value3) && value3 > 0);
17099
+ if (allValues.length === 0) {
17100
+ return { min: 1, max: logBase, span: 1, logScale: true, logBase };
17101
+ }
17102
+ const dataMin = Math.min(...allValues);
17103
+ const dataMax = Math.max(...allValues);
17104
+ const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
17105
+ const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
17106
+ const min = logBase ** logMin;
17107
+ const max = logBase ** Math.max(logMax, logMin + 1);
17108
+ return {
17109
+ min,
17110
+ max,
17111
+ span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
17112
+ logScale: true,
17113
+ logBase
17114
+ };
17115
+ }
17116
+ function withAxisBounds(automatic, axis, logBase) {
17117
+ const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
17118
+ const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
17119
+ const min = validMin ?? automatic.min;
17120
+ let max = validMax ?? automatic.max;
17121
+ const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
17122
+ if (max <= min) {
17123
+ max = logBase ? min * logBase : min + 1;
17124
+ }
17125
+ const span3 = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
17126
+ return {
17127
+ min,
17128
+ max,
17129
+ span: Math.max(span3, Number.EPSILON),
17130
+ ...majorUnit !== void 0 ? { majorUnit } : {},
17131
+ ...logBase ? { logScale: true, logBase } : {},
17132
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
17133
+ };
17134
+ }
17135
+
17136
+ // chart/axis-ticks.ts
17137
+ var LOG_EXPONENT_TOLERANCE = 1e-12;
17138
+ function generateLogTicks(range2) {
17139
+ if (!range2.logScale || !range2.logBase) {
17140
+ return [];
17141
+ }
17142
+ const base2 = range2.logBase;
17143
+ const logMin = Math.log(range2.min) / Math.log(base2);
17144
+ const logMax = Math.log(range2.max) / Math.log(base2);
17145
+ const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
17146
+ const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
17147
+ if (lastExponent < firstExponent) {
17148
+ return range2.min === range2.max ? [range2.min] : [range2.min, range2.max];
17149
+ }
17150
+ return Array.from(
17151
+ { length: lastExponent - firstExponent + 1 },
17152
+ (_unused, index3) => base2 ** (firstExponent + index3)
17153
+ );
17154
+ }
17155
+ function generateIntervalTicks(range2, unit3) {
17156
+ if (!Number.isFinite(unit3) || unit3 <= 0 || range2.logScale) {
17157
+ return [];
17158
+ }
17159
+ const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-12;
17160
+ const first3 = Math.ceil((range2.min - tolerance) / unit3);
17161
+ const last = Math.floor((range2.max + tolerance) / unit3);
17162
+ const count2 = Math.min(Math.max(last - first3 + 1, 0), 2e3);
17163
+ return Array.from({ length: count2 }, (_, index3) => (first3 + index3) * unit3);
17164
+ }
17165
+ function generateAxisTicks(range2, axis, defaultIntervals) {
17166
+ if (range2.logScale && range2.logBase) {
17167
+ return generateLogTicks(range2);
17168
+ }
17169
+ const explicit = generateIntervalTicks(range2, axis?.majorUnit ?? 0);
17170
+ if (explicit.length > 0) {
17171
+ return explicit;
17172
+ }
17173
+ const automatic = generateIntervalTicks(range2, range2.majorUnit ?? 0);
17174
+ if (automatic.length > 0) {
17175
+ return automatic;
17176
+ }
17177
+ return Array.from(
17178
+ { length: defaultIntervals + 1 },
17179
+ (_, index3) => range2.min + range2.span / defaultIntervals * index3
17180
+ );
17181
+ }
17182
+ function generateMinorAxisTicks(range2, axis) {
17183
+ const minor = generateIntervalTicks(range2, axis?.minorUnit ?? 0);
17184
+ if (minor.length === 0) {
17185
+ return [];
17186
+ }
17187
+ const majorUnit = axis?.majorUnit;
17188
+ if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
17189
+ return minor;
17190
+ }
17191
+ const tolerance = Math.max(1, Math.abs(range2.min), Math.abs(range2.max)) * 1e-10;
17192
+ return minor.filter(
17193
+ (value3) => Math.abs(value3 / majorUnit - Math.round(value3 / majorUnit)) > tolerance
17194
+ );
17195
+ }
17196
+
17197
+ // chart/render/chart-view-axes.ts
17198
+ function options(axis) {
17199
+ return {
17200
+ ...axis.scaling,
17201
+ ...axis.scaling.logBase === void 0 ? {} : { logScale: true },
17202
+ ...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
17203
+ ...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
17204
+ };
17205
+ }
17206
+ function applyChartAxes(model, chart, color2) {
17207
+ if (!chart.axes?.length) return;
17208
+ const axes2 = chart.axes;
17209
+ const linked = axes2.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
17210
+ const candidates = linked.length ? linked : axes2;
17211
+ const xy = model.type === "scatter" || model.type === "bubble";
17212
+ const value3 = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
17213
+ const category = candidates.find(
17214
+ (axis) => xy ? axis.kind === "val" && axis !== value3 : axis.kind === "cat" || axis.kind === "date"
17215
+ );
17216
+ const secondary = axes2.find((axis) => axis.kind === "val" && axis !== value3 && axis !== category);
17217
+ const paint2 = (shape2) => {
17218
+ const ln2 = shape2?.line;
17219
+ const fill = ln2?.fill;
17220
+ const resolved = fill?.kind === "none" ? "none" : color2(fill?.kind === "solid" ? fill.color : void 0);
17221
+ return {
17222
+ ...resolved === void 0 ? {} : { color: resolved },
17223
+ ...ln2?.widthEmu === void 0 ? {} : { width: ln2.widthEmu / EMU_PER_PIXEL },
17224
+ ...ln2?.dash === void 0 ? {} : { dash: ln2.dash }
17225
+ };
17226
+ };
17227
+ const bind = (axis, scale2, values2) => {
17228
+ const opts = options(axis);
17229
+ const automatic = opts.logScale ? computeLogValueRange(
17230
+ [{ values: values2 ?? [] }],
17231
+ opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
17232
+ ) : {
17233
+ min: scale2?.min ?? 0,
17234
+ max: scale2?.max ?? 1,
17235
+ span: (scale2?.max ?? 1) - (scale2?.min ?? 0),
17236
+ ...scale2 ? { majorUnit: scale2.majorUnit } : {}
17237
+ };
17238
+ const logBase = automatic.logBase;
17239
+ const range2 = withAxisBounds(automatic, opts, logBase);
17240
+ if (scale2) {
17241
+ scale2.min = range2.min;
17242
+ scale2.max = range2.max;
17243
+ scale2.ticks = generateAxisTicks(range2, opts, 5);
17244
+ }
17245
+ return {
17246
+ source: axis,
17247
+ range: range2,
17248
+ minorTicks: generateMinorAxisTicks(range2, opts),
17249
+ line: paint2(axis.spPr),
17250
+ majorGrid: paint2(axis.majorGridlinesSpPr),
17251
+ minorGrid: paint2(axis.minorGridlinesSpPr)
17252
+ };
17253
+ };
17254
+ const out = {};
17255
+ if (value3)
17256
+ out.value = bind(
17257
+ value3,
17258
+ model.valueAxis,
17259
+ [
17260
+ ...model.series,
17261
+ ...model.extraGroups?.filter((g2) => !g2.secondary).flatMap((g2) => g2.series) ?? []
17262
+ ].flatMap((s) => s.values)
17263
+ );
17264
+ if (category)
17265
+ out.category = bind(
17266
+ category,
17267
+ model.xAxis ?? {
17268
+ min: 0,
17269
+ max: Math.max(1, model.categories.length - 1),
17270
+ majorUnit: 1,
17271
+ ticks: []
17272
+ },
17273
+ model.series.flatMap((s) => s.xValues ?? [])
17274
+ );
17275
+ if (secondary)
17276
+ out.secondary = bind(
17277
+ secondary,
17278
+ model.secondaryAxis,
17279
+ model.extraGroups?.filter((g2) => g2.secondary).flatMap((g2) => g2.series.flatMap((s) => s.values))
17280
+ );
17281
+ model.axes = out;
17282
+ }
17283
+
17022
17284
  // chart/render/chart-view-analysis.ts
17023
17285
  function strokeOf(line3, fallback, resolve3) {
17024
17286
  if (line3?.fill?.kind === "none") return void 0;
@@ -17068,15 +17330,15 @@ function seriesName(series, index3, evaluateRef2) {
17068
17330
  const fromRef = resolveRef(series.nameRef, evaluateRef2)?.map(toText).filter((t) => t !== "").join(" ");
17069
17331
  return fromRef || series.name || `Series${index3 + 1}`;
17070
17332
  }
17071
- function seriesContext(chart, theme3, options) {
17333
+ function seriesContext(chart, theme3, options2) {
17072
17334
  const scheme = chartColorScheme(theme3);
17073
17335
  const resolver = { scheme: (name3) => scheme[name3] };
17074
17336
  return {
17075
17337
  theme: theme3,
17076
17338
  scheme,
17077
17339
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
17078
- evaluateRef: options.evaluateRef ?? (() => []),
17079
- seriesColor: options.seriesColor,
17340
+ evaluateRef: options2.evaluateRef ?? (() => []),
17341
+ seriesColor: options2.seriesColor,
17080
17342
  drawingColor: (color2) => color2 && drawingColorCss(resolveDrawingColor(color2, resolver, { transformOrder: "document" })),
17081
17343
  gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
17082
17344
  fill,
@@ -17102,7 +17364,11 @@ function seriesView(ctx, s, index3, total2, categoriesOf) {
17102
17364
  })
17103
17365
  );
17104
17366
  if (Object.keys(points).length) view.pointGradients = points;
17105
- Object.assign(view, analysisView(s, color2, ctx.drawingColor));
17367
+ Object.assign(
17368
+ view,
17369
+ analysisView(s, color2, ctx.drawingColor),
17370
+ seriesMarkerViews(s, ctx.drawingColor)
17371
+ );
17106
17372
  return view;
17107
17373
  }
17108
17374
 
@@ -17397,11 +17663,11 @@ function histogramView(chart, model) {
17397
17663
  const first3 = model.series[0];
17398
17664
  if (!first3) return;
17399
17665
  const raw2 = first3.values.map((v) => v ?? Number.NaN);
17400
- const options = chart.histogram ?? {};
17401
- const bins = options.aggregateByCategory ? aggregateByCategory(
17666
+ const options2 = chart.histogram ?? {};
17667
+ const bins = options2.aggregateByCategory ? aggregateByCategory(
17402
17668
  first3.values.map((v) => v ?? 0),
17403
17669
  model.categories
17404
- ) : computeHistogramBins(raw2, options, formatAxisValue);
17670
+ ) : computeHistogramBins(raw2, options2, formatAxisValue);
17405
17671
  model.categories = bins.map((bin) => bin.label);
17406
17672
  first3.values = bins.map((bin) => bin.value);
17407
17673
  model.barGapWidth = 0;
@@ -17425,11 +17691,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
17425
17691
  "treemap",
17426
17692
  "sunburst"
17427
17693
  ]);
17428
- function chartSummaryView(chart, theme3, options = {}) {
17694
+ function chartSummaryView(chart, theme3, options2 = {}) {
17429
17695
  const type = chart.chartType;
17430
17696
  const radial = type === "pie" || type === "doughnut";
17431
17697
  const byPoint = radial || type === "treemap" || type === "sunburst";
17432
- const ctx = seriesContext(chart, theme3, options);
17698
+ const ctx = seriesContext(chart, theme3, options2);
17433
17699
  const { palette, scheme, drawingColor: drawingColor2 } = ctx;
17434
17700
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
17435
17701
  const rawCategories = [];
@@ -17515,6 +17781,7 @@ function chartSummaryView(chart, theme3, options = {}) {
17515
17781
  else if (!byPoint) model.valueAxis = valueAxis(model);
17516
17782
  applyDataLabels(model, chart.series, extra);
17517
17783
  chartExtraAxes(model);
17784
+ applyChartAxes(model, chart, ctx.drawingColor);
17518
17785
  return model;
17519
17786
  }
17520
17787
 
@@ -22184,8 +22451,8 @@ function createWorksheet(name3, sheetId5) {
22184
22451
  preserved: /* @__PURE__ */ new Map()
22185
22452
  };
22186
22453
  }
22187
- function createWorkbook(options = {}) {
22188
- const names = options.sheets?.length ? options.sheets : ["Sheet1"];
22454
+ function createWorkbook(options2 = {}) {
22455
+ const names = options2.sheets?.length ? options2.sheets : ["Sheet1"];
22189
22456
  return {
22190
22457
  sheets: names.map((name3, index3) => createWorksheet(name3, index3 + 1)),
22191
22458
  styles: [defaultCellStyle()],
@@ -23400,15 +23667,15 @@ function renderAbs(v, section3, generalWidth) {
23400
23667
  }
23401
23668
  return { text: text8, zero: general === "0" };
23402
23669
  }
23403
- function hashFill(options) {
23404
- const width = options.width ?? 0;
23405
- const one2 = options.measure ? options.measure("#") : 1;
23670
+ function hashFill(options2) {
23671
+ const width = options2.width ?? 0;
23672
+ const one2 = options2.measure ? options2.measure("#") : 1;
23406
23673
  return "#".repeat(Math.max(1, Math.floor(one2 > 0 ? width / one2 : width)));
23407
23674
  }
23408
- function fitNumber(value3, format5, options) {
23409
- const date1904 = options.date1904 ?? false;
23410
- const width = options.width ?? 0;
23411
- const fits = (text8) => (options.measure ? options.measure(text8) : text8.length) <= width;
23675
+ function fitNumber(value3, format5, options2) {
23676
+ const date1904 = options2.date1904 ?? false;
23677
+ const width = options2.width ?? 0;
23678
+ const fits = (text8) => (options2.measure ? options2.measure(text8) : text8.length) <= width;
23412
23679
  const first3 = formatNumber(value3, format5, date1904);
23413
23680
  if (fits(first3.text) || first3.text === OVERFLOW_TEXT) return first3;
23414
23681
  const choice2 = chooseSection(compileFormat(format5), value3);
@@ -23419,7 +23686,7 @@ function fitNumber(value3, format5, options) {
23419
23686
  if (fits(next.text)) return next;
23420
23687
  }
23421
23688
  }
23422
- const fill = hashFill(options);
23689
+ const fill = hashFill(options2);
23423
23690
  return first3.color ? { text: fill, color: first3.color } : { text: fill };
23424
23691
  }
23425
23692
  function formatNumber(value3, format5, date1904, generalWidth) {
@@ -23441,13 +23708,13 @@ function formatNumber(value3, format5, date1904, generalWidth) {
23441
23708
  const minus = value3 < 0 && !abs2 && !zero;
23442
23709
  return result(minus ? `-${text8}` : text8, section3);
23443
23710
  }
23444
- function formatValue(value3, format5, options = {}) {
23711
+ function formatValue(value3, format5, options2 = {}) {
23445
23712
  if (value3 === null) return { text: "" };
23446
23713
  if (typeof value3 === "boolean") return { text: value3 ? "TRUE" : "FALSE" };
23447
23714
  if (typeof value3 === "string") return formatText(value3, compileFormat(format5).text);
23448
23715
  if (isCellError(value3)) return { text: value3.error };
23449
- if (options.width !== void 0) return fitNumber(value3, format5, options);
23450
- return formatNumber(value3, format5, options.date1904 ?? false);
23716
+ if (options2.width !== void 0) return fitNumber(value3, format5, options2);
23717
+ return formatNumber(value3, format5, options2.date1904 ?? false);
23451
23718
  }
23452
23719
  function isDateFormat(format5) {
23453
23720
  return compileFormat(format5).isDate;
@@ -23658,7 +23925,7 @@ function parseFractionInput(text8) {
23658
23925
  numFmt: den < 10 ? "# ?/?" : "# ??/??"
23659
23926
  };
23660
23927
  }
23661
- function parseCellInput(text8, options = {}) {
23928
+ function parseCellInput(text8, options2 = {}) {
23662
23929
  if (text8 === "") return { value: null };
23663
23930
  if (text8.startsWith("=") && text8.length > 1) return { value: null, formula: text8.slice(1) };
23664
23931
  if (text8.startsWith("'")) return { value: text8.slice(1) };
@@ -23669,7 +23936,7 @@ function parseCellInput(text8, options = {}) {
23669
23936
  if (upper2 === "TRUE" || upper2 === "FALSE") return { value: upper2 === "TRUE" };
23670
23937
  if (isErrorCode(upper2)) return { value: cellError(upper2) };
23671
23938
  }
23672
- const parsed = parseNumberInput(trimmed2) ?? parseFractionInput(trimmed2) ?? parseDateTimeInput(trimmed2, options.date1904 ?? false);
23939
+ const parsed = parseNumberInput(trimmed2) ?? parseFractionInput(trimmed2) ?? parseDateTimeInput(trimmed2, options2.date1904 ?? false);
23673
23940
  if (!parsed) return { value: text8 };
23674
23941
  return parsed.numFmt ? { value: parsed.value, numFmt: parsed.numFmt } : { value: parsed.value };
23675
23942
  }
@@ -24611,7 +24878,7 @@ var pivotColumnFields = (pivot) => [
24611
24878
  // i18n/locale.ts
24612
24879
  var SUPPORTED_OFFICE_LOCALES = ["en", "fr", "de", "es", "zh-CN"];
24613
24880
  var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
24614
- function normalizeLocale(input, supported2, fallback, options = {}) {
24881
+ function normalizeLocale(input, supported2, fallback, options2 = {}) {
24615
24882
  const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
24616
24883
  const language = parts[0];
24617
24884
  if (!language) return fallback;
@@ -24620,7 +24887,7 @@ function normalizeLocale(input, supported2, fallback, options = {}) {
24620
24887
  if (exact) return exact;
24621
24888
  const base2 = find3(language);
24622
24889
  if (base2) return base2;
24623
- const rejected = options.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
24890
+ const rejected = options2.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
24624
24891
  if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
24625
24892
  return supported2.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
24626
24893
  }
@@ -24820,8 +25087,8 @@ function trimmedCaptions(caps) {
24820
25087
  }
24821
25088
  return Object.keys(out).length ? out : void 0;
24822
25089
  }
24823
- function authoredCaptions(options) {
24824
- const own2 = options.captions ?? localizedPivotCaptions(options.locale);
25090
+ function authoredCaptions(options2) {
25091
+ const own2 = options2.captions ?? localizedPivotCaptions(options2.locale);
24825
25092
  return own2 && Object.keys(own2).length ? structuredClone(own2) : void 0;
24826
25093
  }
24827
25094
 
@@ -28920,6 +29187,8 @@ function parseChart(xml, anchor, partName, name3) {
28920
29187
  showLegend: summary.showLegend,
28921
29188
  partName
28922
29189
  };
29190
+ if (summary.axes) object.axes = summary.axes;
29191
+ if (summary.axisIds) object.axisIds = summary.axisIds;
28923
29192
  if (summary.grouping) object.grouping = summary.grouping;
28924
29193
  if (summary.barGapWidth !== void 0) object.barGapWidth = summary.barGapWidth;
28925
29194
  if (summary.barOverlap !== void 0) object.barOverlap = summary.barOverlap;
@@ -29464,9 +29733,9 @@ function readPrintOptions(node3) {
29464
29733
  for (const key2 of KEYS) if (boolAttr(node3, key2)) out[key2] = true;
29465
29734
  return Object.keys(out).length ? out : void 0;
29466
29735
  }
29467
- function printOptionsXml(options) {
29468
- if (!options) return "";
29469
- const attrs3 = KEYS.filter((key2) => options[key2]).map((key2) => ` ${key2}="1"`);
29736
+ function printOptionsXml(options2) {
29737
+ if (!options2) return "";
29738
+ const attrs3 = KEYS.filter((key2) => options2[key2]).map((key2) => ` ${key2}="1"`);
29470
29739
  return attrs3.length ? `<printOptions${attrs3.join("")}/>` : "";
29471
29740
  }
29472
29741
 
@@ -30253,10 +30522,10 @@ var PackageWriter = class {
30253
30522
  async build() {
30254
30523
  const zip = new JSZip__default.default();
30255
30524
  const date2 = new Date(Date.UTC(1980, 0, 1));
30256
- const options = { date: date2, createFolders: false };
30257
- zip.file("[Content_Types].xml", this.contentTypesXml(), options);
30525
+ const options2 = { date: date2, createFolders: false };
30526
+ zip.file("[Content_Types].xml", this.contentTypesXml(), options2);
30258
30527
  const names = [...this.parts.keys()].sort((a2, b) => rank2(a2) - rank2(b) || a2.localeCompare(b));
30259
- for (const name3 of names) zip.file(name3, this.parts.get(name3) ?? "", options);
30528
+ for (const name3 of names) zip.file(name3, this.parts.get(name3) ?? "", options2);
30260
30529
  return zip.generateAsync({
30261
30530
  type: "uint8array",
30262
30531
  compression: "DEFLATE",
@@ -31668,7 +31937,7 @@ var int3 = (value3) => Math.trunc(num2(value3));
31668
31937
  var optNum = (args, i2, fallback) => i2 < args.length ? num2(args[i2]) : fallback;
31669
31938
  var optBool = (args, i2, fallback) => i2 < args.length ? bool(args[i2]) : fallback;
31670
31939
  var omitted = (args, i2) => i2 >= args.length || args[i2] === null;
31671
- function collectNumbers(ctx, args, options = {}) {
31940
+ function collectNumbers(ctx, args, options2 = {}) {
31672
31941
  const out = [];
31673
31942
  for (const arg of args) {
31674
31943
  ctx.forEach(arg, (value3, kind) => {
@@ -31677,7 +31946,7 @@ function collectNumbers(ctx, args, options = {}) {
31677
31946
  return;
31678
31947
  }
31679
31948
  if (isError(value3)) {
31680
- if (options.ignoreErrors) return;
31949
+ if (options2.ignoreErrors) return;
31681
31950
  throw new ErrorSignal(value3);
31682
31951
  }
31683
31952
  if (kind === "direct") {
@@ -31685,7 +31954,7 @@ function collectNumbers(ctx, args, options = {}) {
31685
31954
  else out.push(toNumber2(value3));
31686
31955
  return;
31687
31956
  }
31688
- if (options.includeAll) {
31957
+ if (options2.includeAll) {
31689
31958
  if (typeof value3 === "boolean") out.push(value3 ? 1 : 0);
31690
31959
  else if (typeof value3 === "string") out.push(0);
31691
31960
  }
@@ -36637,11 +36906,11 @@ var SUM_FUNCTIONS = [
36637
36906
  255,
36638
36907
  (args, ctx) => {
36639
36908
  const code = int3(args[0]);
36640
- const options = int3(args[1]);
36641
- if (code < 1 || code > 19 || options < 0 || options > 7) fail(ERR.VALUE);
36642
- const skipNested = options <= 3;
36643
- const skipHidden = options === 1 || options === 3 || options === 5 || options === 7;
36644
- const skipErrors = options === 2 || options === 3 || options === 6 || options === 7;
36909
+ const options2 = int3(args[1]);
36910
+ if (code < 1 || code > 19 || options2 < 0 || options2 > 7) fail(ERR.VALUE);
36911
+ const skipNested = options2 <= 3;
36912
+ const skipHidden = options2 === 1 || options2 === 3 || options2 === 5 || options2 === 7;
36913
+ const skipErrors = options2 === 2 || options2 === 3 || options2 === 6 || options2 === 7;
36645
36914
  if (code >= 14) {
36646
36915
  if (args.length !== 4) fail(ERR.VALUE);
36647
36916
  const values2 = subtotalValues(ctx, [args[2] ?? null], skipHidden, skipErrors, skipNested);
@@ -41203,9 +41472,9 @@ var Deferred = class {
41203
41472
  };
41204
41473
  var MAX_NESTED_COMPUTE = 40;
41205
41474
  var EngineHost = class {
41206
- constructor(workbook, options) {
41475
+ constructor(workbook, options2) {
41207
41476
  this.workbook = workbook;
41208
- this.options = options;
41477
+ this.options = options2;
41209
41478
  }
41210
41479
  workbook;
41211
41480
  options;
@@ -42302,8 +42571,8 @@ var Engine = class extends EngineStructure {
42302
42571
  return [...this.cycles].map(({ sheet, row: row3, col }) => ({ sheet, row: row3, col }));
42303
42572
  }
42304
42573
  };
42305
- function createCalcEngine(workbook, options = {}) {
42306
- return new Engine(workbook, options);
42574
+ function createCalcEngine(workbook, options2 = {}) {
42575
+ return new Engine(workbook, options2);
42307
42576
  }
42308
42577
 
42309
42578
  // xlsx/formula/move.ts
@@ -48661,15 +48930,15 @@ function pasteAt(ctx, s, at2, payload, request) {
48661
48930
  function pasteSelection(ctx, sheet, selection, payload, request) {
48662
48931
  const dest = normalizeRange(selection);
48663
48932
  const clip = typeof payload === "string" ? { tsv: payload, html: "", cells: cellsFromText(ctx.workbook, payload) } : payload;
48664
- const options = resolvePasteOptions(request);
48665
- if (options.mode === "widths")
48666
- return pasteWidths(ctx, sheet, dest, clip.cells, options.transpose, !!clip.cut);
48667
- const height = options.transpose ? clip.cells.cols : clip.cells.rows;
48668
- const width = options.transpose ? clip.cells.rows : clip.cells.cols;
48933
+ const options2 = resolvePasteOptions(request);
48934
+ if (options2.mode === "widths")
48935
+ return pasteWidths(ctx, sheet, dest, clip.cells, options2.transpose, !!clip.cut);
48936
+ const height = options2.transpose ? clip.cells.cols : clip.cells.rows;
48937
+ const width = options2.transpose ? clip.cells.rows : clip.cells.cols;
48669
48938
  const rows = dest.end.row - dest.start.row + 1;
48670
48939
  const cols = dest.end.col - dest.start.col + 1;
48671
48940
  if (clip.cut || !height || !width || rows === 1 && cols === 1 || dest.start.row === 0 && dest.end.row === MAX_ROW || dest.start.col === 0 && dest.end.col === MAX_COL)
48672
- return pasteAt(ctx, sheet, dest.start, clip, options);
48941
+ return pasteAt(ctx, sheet, dest.start, clip, options2);
48673
48942
  if (rows % height || cols % width)
48674
48943
  throw new RangeError("The copy and paste areas are not compatible sizes.");
48675
48944
  if (rows * cols > 25e4) throw new RangeError("The selected paste area is too large.");
@@ -48689,16 +48958,16 @@ function pasteSelection(ctx, sheet, selection, payload, request) {
48689
48958
  () => {
48690
48959
  for (let row3 = dest.start.row; row3 <= dest.end.row; row3 += height)
48691
48960
  for (let col = dest.start.col; col <= dest.end.col; col += width)
48692
- pasteAt(tileContext, sheet, { row: row3, col }, tileClip, options);
48693
- if (["all", "formats", "noBorders", "mergeFormats"].includes(options.mode))
48961
+ pasteAt(tileContext, sheet, { row: row3, col }, tileClip, options2);
48962
+ if (["all", "formats", "noBorders", "mergeFormats"].includes(options2.mode))
48694
48963
  pasteConditionalFormats(
48695
48964
  sheetAt(ctx.workbook, sheet),
48696
48965
  dest,
48697
48966
  clip.cells,
48698
- options.transpose,
48699
- options.skipBlanks,
48967
+ options2.transpose,
48968
+ options2.skipBlanks,
48700
48969
  void 0,
48701
- options.mode === "mergeFormats"
48970
+ options2.mode === "mergeFormats"
48702
48971
  );
48703
48972
  return dest;
48704
48973
  },
@@ -49149,7 +49418,7 @@ function numberInputText(value3, numFmt, date1904 = false) {
49149
49418
  if (/%/.test(numFmt.replace(/"[^"]*"|\\./g, ""))) return `${plainNumber(value3 * 100)}%`;
49150
49419
  return plainNumber(value3);
49151
49420
  }
49152
- function formulaBarText(workbook, cell, options = {}) {
49421
+ function formulaBarText(workbook, cell, options2 = {}) {
49153
49422
  if (!cell) return "";
49154
49423
  if (cell.formula !== void 0) return `=${cell.formula}`;
49155
49424
  const value3 = cell.value;
@@ -49163,7 +49432,7 @@ function formulaBarText(workbook, cell, options = {}) {
49163
49432
  workbook.date1904
49164
49433
  );
49165
49434
  const text8 = cell.richText?.length ? cell.richText.map((run2) => run2.text).join("") : value3;
49166
- if (text8 === "" || options.quote === false) return text8;
49435
+ if (text8 === "" || options2.quote === false) return text8;
49167
49436
  const parsed = parseCellInput(text8, { date1904: workbook.date1904 });
49168
49437
  const literal2 = parsed.formula === void 0 && parsed.value === text8;
49169
49438
  return literal2 ? text8 : `'${text8}`;
@@ -49789,9 +50058,9 @@ var SessionCalculator = class {
49789
50058
  // xlsx/edit/goal-solver.ts
49790
50059
  var DEFAULT_GOAL_ITERATIONS = 100;
49791
50060
  var DEFAULT_GOAL_MAX_CHANGE = 1e-3;
49792
- function solveGoal(f6, goal, start, options = {}) {
49793
- const maxIterations = options.maxIterations ?? DEFAULT_GOAL_ITERATIONS;
49794
- const tolerance = options.maxChange ?? DEFAULT_GOAL_MAX_CHANGE;
50061
+ function solveGoal(f6, goal, start, options2 = {}) {
50062
+ const maxIterations = options2.maxIterations ?? DEFAULT_GOAL_ITERATIONS;
50063
+ const tolerance = options2.maxChange ?? DEFAULT_GOAL_MAX_CHANGE;
49795
50064
  let iterations = 0;
49796
50065
  let best;
49797
50066
  let negative;
@@ -50268,10 +50537,10 @@ function columnOverrides(sheet, mdw, defaultPx) {
50268
50537
  }
50269
50538
  return out;
50270
50539
  }
50271
- function createGridMetrics(sheet, options = {}) {
50272
- const zoom = zoomPercent(options.zoom ?? sheet.view.zoom);
50540
+ function createGridMetrics(sheet, options2 = {}) {
50541
+ const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
50273
50542
  const factor = zoom / 100;
50274
- const mdw = options.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
50543
+ const mdw = options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
50275
50544
  const scale2 = (px2) => px2 > 0 ? Math.max(1, Math.round(px2 * factor)) : 0;
50276
50545
  const defaultColPx = defaultColumnPixels(sheet.defaultColWidth, mdw);
50277
50546
  const colOverrides = [...columnOverrides(sheet, mdw, defaultColPx)].map(
@@ -50293,8 +50562,8 @@ function createGridMetrics(sheet, options = {}) {
50293
50562
  for (const merge2 of sheet.merges) lastColUsed = Math.max(lastColUsed, merge2.end.col);
50294
50563
  for (const info of sheet.columns)
50295
50564
  if (info.max < MAX_COL) lastColUsed = Math.max(lastColUsed, info.max);
50296
- const lastRow = Math.min(MAX_ROW, lastRowUsed + (options.extraRows ?? 50));
50297
- const lastCol = Math.min(MAX_COL, lastColUsed + (options.extraCols ?? 20));
50565
+ const lastRow = Math.min(MAX_ROW, lastRowUsed + (options2.extraRows ?? 50));
50566
+ const lastCol = Math.min(MAX_COL, lastColUsed + (options2.extraCols ?? 20));
50298
50567
  return {
50299
50568
  zoom,
50300
50569
  lastRow,
@@ -50514,37 +50783,37 @@ function writePivot(ctx, s, pivot, old, label2, inside2) {
50514
50783
  );
50515
50784
  }
50516
50785
  var startRow = (range2, offset2) => range2.start.row + offset2;
50517
- function createPivotTable(ctx, s, destination, options) {
50518
- const data = pivotSourceData(ctx.workbook, s, options.source);
50519
- const name3 = options.name ?? uniqueName(ctx);
50786
+ function createPivotTable(ctx, s, destination, options2) {
50787
+ const data = pivotSourceData(ctx.workbook, s, options2.source);
50788
+ const name3 = options2.name ?? uniqueName(ctx);
50520
50789
  checkName2(ctx, name3);
50521
- const aggregate2 = options.aggregate ?? "sum";
50522
- const captions = authoredCaptions(options);
50790
+ const aggregate2 = options2.aggregate ?? "sum";
50791
+ const captions = authoredCaptions(options2);
50523
50792
  const pivot = {
50524
50793
  ...data,
50525
50794
  ...captions ? { captions } : {},
50526
50795
  name: name3,
50527
- rowField: options.rowField,
50528
- layout: options.layout ?? "tabular",
50529
- subtotalPosition: options.subtotalPosition ?? (options.layout && options.layout !== "tabular" ? "top" : "bottom"),
50530
- ...options.secondRowField ? { secondRowField: options.secondRowField } : {},
50531
- ...options.secondRowField && options.moreRowFields?.length ? { moreRowFields: [...options.moreRowFields] } : {},
50532
- ...options.fieldSubtotals?.length ? { fieldSubtotals: normalizedFieldSubtotals(options.fieldSubtotals) } : {},
50533
- ...options.dateGroups?.length ? { dateGroups: structuredClone(options.dateGroups) } : {},
50796
+ rowField: options2.rowField,
50797
+ layout: options2.layout ?? "tabular",
50798
+ subtotalPosition: options2.subtotalPosition ?? (options2.layout && options2.layout !== "tabular" ? "top" : "bottom"),
50799
+ ...options2.secondRowField ? { secondRowField: options2.secondRowField } : {},
50800
+ ...options2.secondRowField && options2.moreRowFields?.length ? { moreRowFields: [...options2.moreRowFields] } : {},
50801
+ ...options2.fieldSubtotals?.length ? { fieldSubtotals: normalizedFieldSubtotals(options2.fieldSubtotals) } : {},
50802
+ ...options2.dateGroups?.length ? { dateGroups: structuredClone(options2.dateGroups) } : {},
50534
50803
  ...ctx.workbook.date1904 ? { date1904: true } : {},
50535
- ...options.subtotals !== void 0 ? { subtotals: options.subtotals } : {},
50536
- ...options.repeatLabels !== void 0 ? { repeatLabels: options.repeatLabels } : {},
50537
- valueField: options.valueField,
50804
+ ...options2.subtotals !== void 0 ? { subtotals: options2.subtotals } : {},
50805
+ ...options2.repeatLabels !== void 0 ? { repeatLabels: options2.repeatLabels } : {},
50806
+ valueField: options2.valueField,
50538
50807
  aggregate: aggregate2,
50539
- valueCaption: pivotCaption(aggregate2, options.valueField, { captions }),
50540
- ...options.pageFilter !== void 0 ? { pageFilter: structuredClone(options.pageFilter) } : {},
50541
- ...options.fieldGroups?.length ? { fieldGroups: structuredClone(options.fieldGroups) } : {},
50542
- ...options.valuesAxis !== void 0 ? { valuesAxis: options.valuesAxis } : {},
50543
- ...options.valuesPosition !== void 0 ? { valuesPosition: options.valuesPosition } : {},
50544
- ...options.additionalValues ? { additionalValues: normalizedPivotMeasures(options.additionalValues, { captions }) } : {},
50808
+ valueCaption: pivotCaption(aggregate2, options2.valueField, { captions }),
50809
+ ...options2.pageFilter !== void 0 ? { pageFilter: structuredClone(options2.pageFilter) } : {},
50810
+ ...options2.fieldGroups?.length ? { fieldGroups: structuredClone(options2.fieldGroups) } : {},
50811
+ ...options2.valuesAxis !== void 0 ? { valuesAxis: options2.valuesAxis } : {},
50812
+ ...options2.valuesPosition !== void 0 ? { valuesPosition: options2.valuesPosition } : {},
50813
+ ...options2.additionalValues ? { additionalValues: normalizedPivotMeasures(options2.additionalValues, { captions }) } : {},
50545
50814
  location: { start: { ...destination }, end: { ...destination } },
50546
- ...options.columnField ? { columnField: options.columnField } : {},
50547
- ...options.columnField && options.moreColumnFields?.length ? { moreColumnFields: [...options.moreColumnFields] } : {}
50815
+ ...options2.columnField ? { columnField: options2.columnField } : {},
50816
+ ...options2.columnField && options2.moreColumnFields?.length ? { moreColumnFields: [...options2.moreColumnFields] } : {}
50548
50817
  };
50549
50818
  if (pivot.dateGroups) reconcileDateAxes(pivot);
50550
50819
  const dates = pivotDateFieldsOf(ctx.workbook, s, pivot);
@@ -54509,7 +54778,7 @@ function displayText2(value3, style3, numFmt, workbook, sheet) {
54509
54778
  });
54510
54779
  return formatted.color ? { text: formatted.text, color: formatted.color } : { text: formatted.text };
54511
54780
  }
54512
- function cellView(workbook, sheetIndex2, row3, col, cf, options = {}) {
54781
+ function cellView(workbook, sheetIndex2, row3, col, cf, options2 = {}) {
54513
54782
  const sheet = workbook.sheets[sheetIndex2];
54514
54783
  if (!sheet) throw new RangeError(`No sheet at index ${sheetIndex2}`);
54515
54784
  const cell = getCell(sheet, row3, col);
@@ -54547,10 +54816,10 @@ function cellView(workbook, sheetIndex2, row3, col, cf, options = {}) {
54547
54816
  vAlign: alignment.vertical ?? "bottom",
54548
54817
  wrap: wrap3,
54549
54818
  shrink,
54550
- indentPx: indentable ? (alignment.indent ?? 0) * (options.indentPx ?? INDENT_PX_PER_LEVEL) : 0,
54819
+ indentPx: indentable ? (alignment.indent ?? 0) * (options2.indentPx ?? INDENT_PX_PER_LEVEL) : 0,
54551
54820
  rotation,
54552
54821
  isNumber,
54553
- overflow: (formulaText !== void 0 || typeof value3 === "string" && value3 !== "") && !wrap3 && !shrink && rotation === 0 && !vertical2 && hAlign !== "fill" && !(options.merged ?? sheet.merges.some((m) => rangeContains(m, { row: row3, col }))),
54822
+ overflow: (formulaText !== void 0 || typeof value3 === "string" && value3 !== "") && !wrap3 && !shrink && rotation === 0 && !vertical2 && hAlign !== "fill" && !(options2.merged ?? sheet.merges.some((m) => rangeContains(m, { row: row3, col }))),
54554
54823
  hasComment: sheet.comments.some((c2) => c2.address.row === row3 && c2.address.col === col),
54555
54824
  hasHyperlink: false,
54556
54825
  validationList: sheet.dataValidations.some(
@@ -55164,11 +55433,11 @@ function check2(workbook, dv, value3, at2, evaluate) {
55164
55433
  if (dv.type === "whole" && !Number.isInteger(n)) return false;
55165
55434
  return compare(operator, n, a2, b);
55166
55435
  }
55167
- function validateCellInput(workbook, sheet, row3, col, value3, options = {}) {
55436
+ function validateCellInput(workbook, sheet, row3, col, value3, options2 = {}) {
55168
55437
  const dv = validationAt(workbook, sheet, row3, col);
55169
55438
  if (!dv || dv.type === "none" || dv.showErrorMessage !== true) return { ok: true };
55170
55439
  if (value3 === null || value3 === "") return dv.allowBlank === false ? failure(dv) : { ok: true };
55171
- const evaluate = options.evaluate ?? defaultEvaluate(workbook);
55440
+ const evaluate = options2.evaluate ?? defaultEvaluate(workbook);
55172
55441
  return check2(workbook, dv, value3, { sheet, row: row3, col }, evaluate) ? { ok: true } : failure(dv);
55173
55442
  }
55174
55443
  function failure(dv) {
@@ -55182,10 +55451,10 @@ function failure(dv) {
55182
55451
  }
55183
55452
 
55184
55453
  // xlsx/edit/session.ts
55185
- function createEditSession(workbook, options = {}) {
55454
+ function createEditSession(workbook, options2 = {}) {
55186
55455
  const calc = createCalcEngine(workbook);
55187
- const autoRecalc = options.recalc ?? true;
55188
- const history = new History(options.historyLimit ?? 100);
55456
+ const autoRecalc = options2.recalc ?? true;
55457
+ const history = new History(options2.historyLimit ?? 100);
55189
55458
  const listeners = /* @__PURE__ */ new Set();
55190
55459
  let open;
55191
55460
  const emit = (change) => {
@@ -55284,8 +55553,8 @@ function createEditSession(workbook, options = {}) {
55284
55553
  return result2;
55285
55554
  };
55286
55555
  const ctx = { workbook, calc, run: run2 };
55287
- if (options.defaultSheetBase) ctx.defaultSheetBase = options.defaultSheetBase;
55288
- const autoRows = options.autoRowHeight ?? true;
55556
+ if (options2.defaultSheetBase) ctx.defaultSheetBase = options2.defaultSheetBase;
55557
+ const autoRows = options2.autoRowHeight ?? true;
55289
55558
  const refitRows = (current) => {
55290
55559
  const { sheet: s, kind, ranges } = current;
55291
55560
  if (!autoRows || s === void 0 || !ranges.length || !current.step.entries.length) return;
@@ -55293,7 +55562,7 @@ function createEditSession(workbook, options = {}) {
55293
55562
  const sheet = workbook.sheets[s];
55294
55563
  if (!sheet) return;
55295
55564
  try {
55296
- autoGrowRows(ctx, s, rowsToRefit(sheet, ranges), options.measureText);
55565
+ autoGrowRows(ctx, s, rowsToRefit(sheet, ranges), options2.measureText);
55297
55566
  } catch (error) {
55298
55567
  const message = `Row height update failed: ${error instanceof Error ? error.message : String(error)}`;
55299
55568
  if (!workbook.warnings.includes(message)) workbook.warnings.push(message);
@@ -55356,7 +55625,7 @@ function createEditSession(workbook, options = {}) {
55356
55625
  setDefinedName: (name3) => setDefinedName(ctx, name3),
55357
55626
  deleteDefinedName: (name3, localSheet) => deleteDefinedName(ctx, name3, localSheet),
55358
55627
  setDrawingAnchor: (s, index3, anchor) => setDrawingAnchor(ctx, s, index3, anchor),
55359
- createPivotTable: (s, destination, options2) => createPivotTable(ctx, s, destination, options2),
55628
+ createPivotTable: (s, destination, options3) => createPivotTable(ctx, s, destination, options3),
55360
55629
  refreshPivotTable: (s, name3, patch2) => refreshPivotTable(ctx, s, name3, patch2),
55361
55630
  deletePivotTable: (s, name3) => deletePivotTable(ctx, s, name3),
55362
55631
  setSlicerSelection: (cache3, keys) => setSlicerSelection(ctx, cache3, keys),
@@ -55406,8 +55675,8 @@ function createEditSession(workbook, options = {}) {
55406
55675
  setDocumentProperties: (patch2) => setDocumentProperties(ctx, patch2),
55407
55676
  setAutoRecalc: (enabled2) => setCalcMode(ctx, enabled2 ? "auto" : "manual"),
55408
55677
  autoRecalc: () => autoRecalc && calcModeOf(workbook) === "auto",
55409
- calculateNow(options2) {
55410
- calculator.now(options2?.full ?? false);
55678
+ calculateNow(options3) {
55679
+ calculator.now(options3?.full ?? false);
55411
55680
  emit({ kind: "cells", label: "Calculate now", structural: false });
55412
55681
  },
55413
55682
  prepareCalculation: (opts) => calculator.prepare(opts?.timeRemaining),
@@ -55911,8 +56180,8 @@ var VisioPackage = class _VisioPackage {
55911
56180
  if (Date.now() >= this.deadline)
55912
56181
  fail2("LIMIT_RUNTIME", "Visio package processing deadline exceeded");
55913
56182
  };
55914
- static async open(input, options = {}) {
55915
- const limits = { ...DEFAULTS2, ...options };
56183
+ static async open(input, options2 = {}) {
56184
+ const limits = { ...DEFAULTS2, ...options2 };
55916
56185
  for (const value3 of Object.values(limits))
55917
56186
  if (!Number.isFinite(value3) || value3 <= 0)
55918
56187
  fail2("INVALID_LIMITS", "Package limits must be finite positive numbers");
@@ -56393,16 +56662,16 @@ function emfInputView(input) {
56393
56662
  return null;
56394
56663
  }
56395
56664
  }
56396
- function emfInputOptions(options) {
56397
- if (!options || typeof options !== "object") return null;
56665
+ function emfInputOptions(options2) {
56666
+ if (!options2 || typeof options2 !== "object") return null;
56398
56667
  try {
56399
- const prototype = Object.getPrototypeOf(options);
56668
+ const prototype = Object.getPrototypeOf(options2);
56400
56669
  if (prototype !== null && prototype !== Object.prototype) return null;
56401
56670
  const snapshot = {};
56402
56671
  for (const key2 of Object.keys(
56403
56672
  VISIO_EMF_ADMISSION_LIMITS
56404
56673
  )) {
56405
- const descriptor = Object.getOwnPropertyDescriptor(options, key2);
56674
+ const descriptor = Object.getOwnPropertyDescriptor(options2, key2);
56406
56675
  if (!descriptor) continue;
56407
56676
  if (!("value" in descriptor)) return null;
56408
56677
  const value3 = descriptor.value;
@@ -56418,18 +56687,18 @@ function emfInputOptions(options) {
56418
56687
 
56419
56688
  // visio/emf-admission-context.ts
56420
56689
  var EmfAdmissionContext = class {
56421
- constructor(view, options) {
56690
+ constructor(view, options2) {
56422
56691
  this.view = view;
56423
56692
  this.limits = { ...VISIO_EMF_ADMISSION_LIMITS };
56424
- if (!options || typeof options !== "object") {
56693
+ if (!options2 || typeof options2 !== "object") {
56425
56694
  this.emit("invalid", "limits", "Expected an options object.");
56426
56695
  return;
56427
56696
  }
56428
- const cap = options.maxDiagnostics;
56697
+ const cap = options2.maxDiagnostics;
56429
56698
  if (cap !== void 0 && Number.isInteger(cap) && cap > 0 && cap <= this.limits.maxDiagnostics)
56430
56699
  this.limits.maxDiagnostics = cap;
56431
56700
  for (const key2 of Object.keys(VISIO_EMF_ADMISSION_LIMITS)) {
56432
- const value3 = options[key2];
56701
+ const value3 = options2[key2];
56433
56702
  if (value3 === void 0) continue;
56434
56703
  if (!Number.isSafeInteger(value3) || value3 < 1 || value3 > this.limits[key2])
56435
56704
  this.emit("invalid", "limits", "Limits must be positive integers below the hard ceiling.");
@@ -56982,8 +57251,8 @@ function inspectEmfObjectRecord(c2) {
56982
57251
  }
56983
57252
 
56984
57253
  // visio/emf-admission.ts
56985
- function inspectVisioEmfAdmission(input, options = {}) {
56986
- const snapshot = emfInputOptions(options);
57254
+ function inspectVisioEmfAdmission(input, options2 = {}) {
57255
+ const snapshot = emfInputOptions(options2);
56987
57256
  const view = snapshot === null ? null : emfInputView(input);
56988
57257
  const c2 = new EmfAdmissionContext(view ?? new DataView(new ArrayBuffer(0)), snapshot ?? {});
56989
57258
  if (snapshot === null) {
@@ -57207,9 +57476,9 @@ function record(value3, allowed) {
57207
57476
  }
57208
57477
  return result2;
57209
57478
  }
57210
- function limitsFor(options) {
57479
+ function limitsFor(options2) {
57211
57480
  const result2 = { ...VISIO_FOREIGN_VECTOR_LIMITS };
57212
- const values2 = record(options, Object.keys(result2));
57481
+ const values2 = record(options2, Object.keys(result2));
57213
57482
  for (const key2 of Object.keys(values2)) {
57214
57483
  const value3 = values2[key2];
57215
57484
  if (typeof value3 !== "number" || !Number.isSafeInteger(value3) || value3 < 1 || value3 > result2[key2])
@@ -57563,9 +57832,9 @@ var ATTRS = {
57563
57832
  clipPath: ["id", "clipPathUnits", "clip-rule", ...BASE2]
57564
57833
  };
57565
57834
  var ID = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
57566
- function sanitizeVisioForeignVectorTree(root, options = {}) {
57835
+ function sanitizeVisioForeignVectorTree(root, options2 = {}) {
57567
57836
  try {
57568
- return sanitize(root, limitsFor(options));
57837
+ return sanitize(root, limitsFor(options2));
57569
57838
  } catch (error) {
57570
57839
  if (error instanceof VisioForeignVectorError) throw error;
57571
57840
  unsafe("Unable to inspect converter output safely.");
@@ -58081,10 +58350,10 @@ function jpeg(bytes, limits) {
58081
58350
  }
58082
58351
  return invalid("JPEG has no image terminator.");
58083
58352
  }
58084
- function inspectVisioRasterImage(bytes, options = {}) {
58085
- if (!options || typeof options !== "object" || Array.isArray(options))
58353
+ function inspectVisioRasterImage(bytes, options2 = {}) {
58354
+ if (!options2 || typeof options2 !== "object" || Array.isArray(options2))
58086
58355
  throw new VisioImageError("invalid-limit", "Image limits must be an options object.");
58087
- const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...options };
58356
+ const limits = { ...VISIO_RASTER_IMAGE_LIMITS, ...options2 };
58088
58357
  for (const key2 of Object.keys(VISIO_RASTER_IMAGE_LIMITS)) {
58089
58358
  const value3 = limits[key2];
58090
58359
  if (!Number.isSafeInteger(value3) || value3 <= 0 || value3 > VISIO_RASTER_IMAGE_LIMITS[key2])
@@ -58095,10 +58364,10 @@ function inspectVisioRasterImage(bytes, options = {}) {
58095
58364
  throw new VisioImageError("image-limit", "Raster image bytes exceed the configured limit.");
58096
58365
  return inspect2(bytes, limits);
58097
58366
  }
58098
- async function readVisioImage(pkg, sourcePart, foreignData, report, options = {}) {
58367
+ async function readVisioImage(pkg, sourcePart, foreignData, report, options2 = {}) {
58099
58368
  const limits = {
58100
58369
  ...VISIO_RASTER_IMAGE_LIMITS,
58101
- ...options
58370
+ ...options2
58102
58371
  };
58103
58372
  if (Object.values(limits).some((value3) => !Number.isSafeInteger(value3) || value3 <= 0))
58104
58373
  throw new VisioPackageError("INVALID_LIMIT", "Image limits must be positive safe integers.");
@@ -58358,7 +58627,7 @@ async function readEmbeddedChartObject(pkg, sourcePart, foreignData, report) {
58358
58627
  }
58359
58628
 
58360
58629
  // visio/prepare-images.ts
58361
- async function prepareImages(shapes, pkg, sourcePart, report, options, converter) {
58630
+ async function prepareImages(shapes, pkg, sourcePart, report, options2, converter) {
58362
58631
  for (const shape2 of shapes) {
58363
58632
  if (shape2.deleted) continue;
58364
58633
  const localReport = (code, message, extra) => report(code, message, { part: sourcePart, shapeId: shape2.id, ...extra });
@@ -58386,12 +58655,12 @@ async function prepareImages(shapes, pkg, sourcePart, report, options, converter
58386
58655
  sourcePart,
58387
58656
  shape2.foreignData,
58388
58657
  localReport,
58389
- options
58658
+ options2
58390
58659
  );
58391
58660
  if (image) shape2.image = image;
58392
58661
  }
58393
58662
  }
58394
- await prepareImages(shape2.children, pkg, sourcePart, report, options, converter);
58663
+ await prepareImages(shape2.children, pkg, sourcePart, report, options2, converter);
58395
58664
  }
58396
58665
  }
58397
58666
 
@@ -62859,8 +63128,8 @@ function readVisioAnnotations(sheet, pageId2) {
62859
63128
  }
62860
63129
 
62861
63130
  // visio/shape-metadata.ts
62862
- function createMetadataBudget(options = {}) {
62863
- const maxRows = options.maxRows ?? 1e5, maxCharacters = options.maxCharacters ?? 5e6;
63131
+ function createMetadataBudget(options2 = {}) {
63132
+ const maxRows = options2.maxRows ?? 1e5, maxCharacters = options2.maxCharacters ?? 5e6;
62864
63133
  if (![maxRows, maxCharacters].every((v) => Number.isSafeInteger(v) && v > 0))
62865
63134
  throw new VisioPackageError("INVALID_LIMIT", "Metadata limits must be positive safe integers.");
62866
63135
  let rows = 0, characters = 0;
@@ -64427,21 +64696,21 @@ function option(value3, fallback) {
64427
64696
  throw new VisioPackageError("INVALID_LIMIT", "Parser limits must be positive safe integers.");
64428
64697
  return value3;
64429
64698
  }
64430
- async function parseVsdx(input, options = {}) {
64431
- const deadline = Date.now() + (options.limits?.maxRuntimeMs ?? 1e4);
64699
+ async function parseVsdx(input, options2 = {}) {
64700
+ const deadline = Date.now() + (options2.limits?.maxRuntimeMs ?? 1e4);
64432
64701
  const checkTime = () => {
64433
64702
  if (Date.now() >= deadline)
64434
64703
  throw new VisioPackageError("LIMIT_RUNTIME", "Visio parsing deadline exceeded.");
64435
64704
  };
64436
- const maxShapes = option(options.maxShapes, 25e3), maxShapeDepth = option(options.maxShapeDepth, 64);
64437
- const maxCurveWork = option(options.maxCurveWork, 2e7);
64705
+ const maxShapes = option(options2.maxShapes, 25e3), maxShapeDepth = option(options2.maxShapeDepth, 64);
64706
+ const maxCurveWork = option(options2.maxCurveWork, 2e7);
64438
64707
  let curveWork = 0;
64439
- const maxGeometry = option(options.maxGeometryCommands, 5e5), maxText = option(options.maxTextCharacters, 5e6);
64440
- const maxDiagnostics = option(options.maxDiagnostics, 2e3);
64441
- const maxRuns = option(options.maxTextRuns, 1e5), maxParagraphs = option(options.maxParagraphs, 5e4);
64708
+ const maxGeometry = option(options2.maxGeometryCommands, 5e5), maxText = option(options2.maxTextCharacters, 5e6);
64709
+ const maxDiagnostics = option(options2.maxDiagnostics, 2e3);
64710
+ const maxRuns = option(options2.maxTextRuns, 1e5), maxParagraphs = option(options2.maxParagraphs, 5e4);
64442
64711
  const diagnosticState = diagnosticCollector(maxDiagnostics);
64443
64712
  const report = diagnosticState.report;
64444
- const pkg = await VisioPackage.open(input, options.limits);
64713
+ const pkg = await VisioPackage.open(input, options2.limits);
64445
64714
  const types = await pkg.readXml("[Content_Types].xml", "Types");
64446
64715
  if (types.namespaceURI !== "http://schemas.openxmlformats.org/package/2006/content-types")
64447
64716
  throw new VisioPackageError("INVALID_CONTENT_TYPES", "Invalid content type namespace.");
@@ -64451,7 +64720,7 @@ async function parseVsdx(input, options = {}) {
64451
64720
  const documentType = elements(types).find(
64452
64721
  (node3) => node3.localName === "Override" && attribute3(node3, "PartName") === `/${documentPart}`
64453
64722
  )?.getAttribute("ContentType");
64454
- if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(options.stencil && documentType && STENCIL_MAIN_TYPES.has(documentType)))
64723
+ if (documentType !== "application/vnd.ms-visio.drawing.main+xml" && !(options2.stencil && documentType && STENCIL_MAIN_TYPES.has(documentType)))
64455
64724
  throw new VisioPackageError(
64456
64725
  "UNSUPPORTED_FORMAT",
64457
64726
  "Only VSDX drawing packages are supported; VSD, VDX, VSDM and templates are not supported."
@@ -64524,8 +64793,8 @@ async function parseVsdx(input, options = {}) {
64524
64793
  pkg,
64525
64794
  part,
64526
64795
  report,
64527
- options.images,
64528
- options.metafileConverter
64796
+ options2.images,
64797
+ options2.metafileConverter
64529
64798
  );
64530
64799
  masters.set(id3, masterShapes2);
64531
64800
  masterRecords.push({ id: id3, node: master2, shapes: masterShapes2 });
@@ -64533,7 +64802,7 @@ async function parseVsdx(input, options = {}) {
64533
64802
  }
64534
64803
  let geometryCount = 0, textCount = 0, expansionCount = 0, textRuns = 0, paragraphCount = 0;
64535
64804
  const context = {
64536
- metadataBudget: createMetadataBudget(options.metadata),
64805
+ metadataBudget: createMetadataBudget(options2.metadata),
64537
64806
  layerBudget: createLayerBudget(),
64538
64807
  masters,
64539
64808
  layers: /* @__PURE__ */ new Map(),
@@ -64585,11 +64854,11 @@ async function parseVsdx(input, options = {}) {
64585
64854
  }
64586
64855
  };
64587
64856
  const documentMasters = listVisioMasters(masterRecords, context, {
64588
- metadataBudget: createMetadataBudget(options.metadata),
64857
+ metadataBudget: createMetadataBudget(options2.metadata),
64589
64858
  layerBudget: createLayerBudget()
64590
64859
  });
64591
- const pagesPart = await related(pkg, documentPart, "pages", !options.stencil);
64592
- if (!pagesPart && !options.stencil)
64860
+ const pagesPart = await related(pkg, documentPart, "pages", !options2.stencil);
64861
+ if (!pagesPart && !options2.stencil)
64593
64862
  throw new VisioPackageError("INVALID_DOCUMENT", "Missing Visio pages part.");
64594
64863
  const pages = [], pageIds2 = /* @__PURE__ */ new Set();
64595
64864
  const comments = [];
@@ -64643,8 +64912,8 @@ async function parseVsdx(input, options = {}) {
64643
64912
  pkg,
64644
64913
  part,
64645
64914
  localReport,
64646
- options.images,
64647
- options.metafileConverter
64915
+ options2.images,
64916
+ options2.metafileConverter
64648
64917
  );
64649
64918
  const shapes = normalizeShapes(rawShapes, context);
64650
64919
  normalizeVisioPageGeometry(shapes, drawingToPageScale, checkTime);
@@ -65974,9 +66243,9 @@ function cellUnit(name3, relative) {
65974
66243
  return !relative && /\.[XY]\d+$/i.test(name3) ? "length" : "scalar";
65975
66244
  }
65976
66245
  var isBooleanLiteral = (ref) => ref.shapeId === void 0 && /^(true|false)$/i.test(ref.cell);
65977
- function indexCells2(roots, options) {
66246
+ function indexCells2(roots, options2) {
65978
66247
  const cells3 = /* @__PURE__ */ new Map();
65979
- const maxCells = bound(options.maxCells, 1e5);
66248
+ const maxCells = bound(options2.maxCells, 1e5);
65980
66249
  const add4 = (item) => {
65981
66250
  const id3 = key(item);
65982
66251
  if (cells3.has(id3)) fail2("EDIT_AMBIGUOUS_CELL", "Duplicate local ShapeSheet cell.");
@@ -66002,11 +66271,11 @@ function indexCells2(roots, options) {
66002
66271
  const visit2 = (parent, inherited, nested) => {
66003
66272
  for (const container of children3(parent, "Shapes"))
66004
66273
  for (const node3 of children3(container, "Shape")) {
66005
- options.check?.();
66274
+ options2.check?.();
66006
66275
  const shapeId2 = attribute3(node3, "ID");
66007
66276
  if (!shapeId2 || ids.has(shapeId2)) fail2("INVALID_SHAPE_ID", "Shape IDs must be unique.");
66008
66277
  ids.add(shapeId2);
66009
- const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute3(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute3(node3, "Type") !== void 0 && attribute3(node3, "Type") !== "Shape" || children3(node3, "ForeignData").length > 0 || children3(node3, "Rel").length > 0) || connected.has(shapeId2) && !options.glueShapes?.has(node3) || !options.lineEditShapes?.has(node3) && children3(node3, "Cell").some(
66278
+ const unsafe2 = inherited || nested || node3.hasAttribute("Master") || node3.hasAttribute("MasterShape") || attribute3(node3, "Type") === "Group" || !isLocalForeignFrameShape(node3) && (attribute3(node3, "Type") !== void 0 && attribute3(node3, "Type") !== "Shape" || children3(node3, "ForeignData").length > 0 || children3(node3, "Rel").length > 0) || connected.has(shapeId2) && !options2.glueShapes?.has(node3) || !options2.lineEditShapes?.has(node3) && children3(node3, "Cell").some(
66010
66279
  (cell) => /^(BeginX|BeginY|EndX|EndY)$/i.test(attribute3(cell, "N") ?? "") || attribute3(cell, "N")?.toLowerCase() === "oned" && (attribute3(cell, "V") !== "0" || !!executableCellFormula(attribute3(cell, "F")) || attribute3(cell, "F") === "Inh")
66011
66280
  ) || children3(node3, "Shapes").length > 0 || ["1", "true"].includes(attribute3(node3, "Del") ?? "");
66012
66281
  sheets.push({ node: node3, shapeId: shapeId2, unsafe: unsafe2 });
@@ -66099,7 +66368,7 @@ function indexCells2(roots, options) {
66099
66368
  }
66100
66369
  }
66101
66370
  for (const node3 of Array.from(root.getElementsByTagName("*"))) {
66102
- options.check?.();
66371
+ options2.check?.();
66103
66372
  if (node3.hasAttribute("F") && !indexedNodes.has(node3))
66104
66373
  fail2(
66105
66374
  "EDIT_UNKNOWN_DEPENDENCY",
@@ -66111,12 +66380,12 @@ function indexCells2(roots, options) {
66111
66380
  }
66112
66381
 
66113
66382
  // visio/edit-recalculate-values.ts
66114
- function createVisioCellEvaluator(cells3, options = {}, verifyCaches = false) {
66383
+ function createVisioCellEvaluator(cells3, options2 = {}, verifyCaches = false) {
66115
66384
  const active = /* @__PURE__ */ new Set(), values2 = /* @__PURE__ */ new Map();
66116
- let steps = bound(options.maxSteps, 1e5);
66117
- const maxDepth = bound(options.maxDepth, 64);
66385
+ let steps = bound(options2.maxSteps, 1e5);
66386
+ const maxDepth = bound(options2.maxDepth, 64);
66118
66387
  const evaluate = (id3) => {
66119
- options.check?.();
66388
+ options2.check?.();
66120
66389
  if (--steps < 0)
66121
66390
  fail2("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
66122
66391
  const cached6 = values2.get(id3);
@@ -66125,7 +66394,7 @@ function createVisioCellEvaluator(cells3, options = {}, verifyCaches = false) {
66125
66394
  if (active.size >= maxDepth)
66126
66395
  fail2("LIMIT_FORMULA_DEPTH", "ShapeSheet dependency depth limit exceeded.");
66127
66396
  const item = cells3.get(id3);
66128
- if (!item || item.unsafe && (!item.node || !options.masterMovePins?.has(item.node) && !options.groupRotationCells?.has(item.node)))
66397
+ if (!item || item.unsafe && (!item.node || !options2.masterMovePins?.has(item.node) && !options2.groupRotationCells?.has(item.node)))
66129
66398
  fail2(
66130
66399
  "EDIT_UNSUPPORTED_DEPENDENCY",
66131
66400
  "Affected formula references missing, inherited or grouped cells."
@@ -66149,7 +66418,7 @@ function createVisioCellEvaluator(cells3, options = {}, verifyCaches = false) {
66149
66418
  key({ pageId: item.pageId, shapeId: ref.shapeId ?? item.shapeId, cell: ref.cell })
66150
66419
  ),
66151
66420
  {
66152
- ...options.pageContext?.get(item.pageId),
66421
+ ...options2.pageContext?.get(item.pageId),
66153
66422
  onStep: () => {
66154
66423
  if (--steps < 0)
66155
66424
  fail2("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
@@ -66181,8 +66450,8 @@ function createVisioCellEvaluator(cells3, options = {}, verifyCaches = false) {
66181
66450
  }
66182
66451
 
66183
66452
  // visio/edit-recalculate.ts
66184
- function recalculateVisioCells(roots, changed, options = {}) {
66185
- const cells3 = indexCells2(roots, options);
66453
+ function recalculateVisioCells(roots, changed, options2 = {}) {
66454
+ const cells3 = indexCells2(roots, options2);
66186
66455
  const reverse2 = /* @__PURE__ */ new Map();
66187
66456
  for (const [id3, item] of cells3)
66188
66457
  for (const dependency of item.dependencies) {
@@ -66192,9 +66461,9 @@ function recalculateVisioCells(roots, changed, options = {}) {
66192
66461
  }
66193
66462
  const affected = new Set(changed.map(key));
66194
66463
  const pending2 = [...affected];
66195
- const maxAffected = bound(options.maxAffectedCells, 1e4);
66464
+ const maxAffected = bound(options2.maxAffectedCells, 1e4);
66196
66465
  for (let i2 = 0; i2 < pending2.length; i2++) {
66197
- options.check?.();
66466
+ options2.check?.();
66198
66467
  for (const id3 of reverse2.get(pending2[i2]) ?? [])
66199
66468
  if (!affected.has(id3)) {
66200
66469
  affected.add(id3);
@@ -66203,7 +66472,7 @@ function recalculateVisioCells(roots, changed, options = {}) {
66203
66472
  if (affected.size > maxAffected)
66204
66473
  fail2("LIMIT_FORMULA_AFFECTED", "Affected ShapeSheet cell limit exceeded.");
66205
66474
  }
66206
- const evaluate = createVisioCellEvaluator(cells3, options);
66475
+ const evaluate = createVisioCellEvaluator(cells3, options2);
66207
66476
  const values2 = /* @__PURE__ */ new Map();
66208
66477
  for (const id3 of affected) values2.set(id3, evaluate(id3));
66209
66478
  const pages = /* @__PURE__ */ new Set();
@@ -66219,10 +66488,10 @@ function recalculateVisioCells(roots, changed, options = {}) {
66219
66488
  }
66220
66489
  return [...pages];
66221
66490
  }
66222
- function assertVisioShapesUnreferenced(roots, removed, options = {}) {
66223
- const cells3 = indexCells2(roots, options);
66491
+ function assertVisioShapesUnreferenced(roots, removed, options2 = {}) {
66492
+ const cells3 = indexCells2(roots, options2);
66224
66493
  for (const cell of cells3.values()) {
66225
- options.check?.();
66494
+ options2.check?.();
66226
66495
  if (removed.get(cell.pageId)?.has(cell.shapeId)) continue;
66227
66496
  if (cell.dependencies.some((id3) => {
66228
66497
  const parts = JSON.parse(id3);
@@ -66233,24 +66502,24 @@ function assertVisioShapesUnreferenced(roots, removed, options = {}) {
66233
66502
  for (const [pageId2, ids] of removed)
66234
66503
  for (const connections2 of children3(roots.get(pageId2), "Connects"))
66235
66504
  for (const connection of children3(connections2, "Connect")) {
66236
- options.check?.();
66505
+ options2.check?.();
66237
66506
  if (["FromSheet", "ToSheet"].some((name3) => ids.has(attribute3(connection, name3) ?? "")))
66238
66507
  fail2("EDIT_REFERENCED_DELETE", "Shape participates in a Connect record.");
66239
66508
  }
66240
66509
  }
66241
- function assertVisioShapeUnreferenced(roots, pageId2, shapeId2, options = {}) {
66242
- assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options);
66510
+ function assertVisioShapeUnreferenced(roots, pageId2, shapeId2, options2 = {}) {
66511
+ assertVisioShapesUnreferenced(roots, /* @__PURE__ */ new Map([[pageId2, /* @__PURE__ */ new Set([shapeId2])]]), options2);
66243
66512
  }
66244
- function createVisioDependencyQuery(roots, options = {}) {
66245
- const cells3 = indexCells2(roots, options);
66513
+ function createVisioDependencyQuery(roots, options2 = {}) {
66514
+ const cells3 = indexCells2(roots, options2);
66246
66515
  return (source2, targets) => {
66247
66516
  const wanted = new Set(targets.map(key));
66248
66517
  const seen = /* @__PURE__ */ new Set();
66249
66518
  const pending2 = [key(source2)];
66250
- const maxSteps = bound(options.maxSteps, 1e5);
66519
+ const maxSteps = bound(options2.maxSteps, 1e5);
66251
66520
  let found = false;
66252
66521
  while (pending2.length) {
66253
- options.check?.();
66522
+ options2.check?.();
66254
66523
  const id3 = pending2.pop();
66255
66524
  if (seen.has(id3)) continue;
66256
66525
  seen.add(id3);
@@ -67382,13 +67651,13 @@ function unique3(items, key2, what) {
67382
67651
  return result2;
67383
67652
  }
67384
67653
  var cellMap2 = (parent) => unique3(children3(parent, "Cell"), (cell) => attribute3(cell, "N") ?? "", "cell");
67385
- function instanceSheet(instance, template, options = {}) {
67654
+ function instanceSheet(instance, template, options2 = {}) {
67386
67655
  for (const node3 of [instance, template]) {
67387
67656
  const type = attribute3(node3, "Type");
67388
- if (!(options.group ? ["Shape", "Group", void 0] : ["Shape", void 0]).includes(type) || !options.group && children3(node3, "Shapes").length > 0 || children3(node3, "ForeignData").length || deleted2(node3))
67657
+ if (!(options2.group ? ["Shape", "Group", void 0] : ["Shape", void 0]).includes(type) || !options2.group && children3(node3, "Shapes").length > 0 || children3(node3, "ForeignData").length || deleted2(node3))
67389
67658
  fail2(
67390
67659
  "UNSUPPORTED_INSTANCE_EDIT",
67391
- options.group ? "A stencil shape that holds a picture or a deleted part cannot be changed." : "Only stencil shapes made of one plain shape can be changed; grouped, picture and deleted ones cannot."
67660
+ options2.group ? "A stencil shape that holds a picture or a deleted part cannot be changed." : "Only stencil shapes made of one plain shape can be changed; grouped, picture and deleted ones cannot."
67392
67661
  );
67393
67662
  }
67394
67663
  if (template.hasAttribute("Master") || template.hasAttribute("MasterShape"))
@@ -67467,7 +67736,7 @@ function effectiveFormula(cell) {
67467
67736
  return own2 === "Inh" ? executableCellFormula(attribute3(cell.inherited, "F")) : executableCellFormula(own2);
67468
67737
  }
67469
67738
  var AFTER_SECTIONS = ["Text", "Data1", "Data2", "Data3", "ForeignData", "Shapes"];
67470
- function writeInstanceCell(sheet, cell, value3, options = {}) {
67739
+ function writeInstanceCell(sheet, cell, value3, options2 = {}) {
67471
67740
  const { instance } = sheet;
67472
67741
  const create2 = (name3) => instance.ownerDocument.createElementNS(instance.namespaceURI, name3);
67473
67742
  let node3 = cell.local;
@@ -67513,9 +67782,9 @@ function writeInstanceCell(sheet, cell, value3, options = {}) {
67513
67782
  }
67514
67783
  node3.setAttribute("V", value3);
67515
67784
  node3.removeAttribute("E");
67516
- const unit3 = options.unit ?? attribute3(cell.inherited, "U");
67517
- if (unit3 !== void 0 && (created || options.unit !== void 0)) node3.setAttribute("U", unit3);
67518
- if (options.formula) node3.setAttribute("F", options.formula);
67785
+ const unit3 = options2.unit ?? attribute3(cell.inherited, "U");
67786
+ if (unit3 !== void 0 && (created || options2.unit !== void 0)) node3.setAttribute("U", unit3);
67787
+ if (options2.formula) node3.setAttribute("F", options2.formula);
67519
67788
  else node3.removeAttribute("F");
67520
67789
  return node3;
67521
67790
  }
@@ -69675,7 +69944,7 @@ function proveConnectorShape(shape2, route = routeOf(shape2)) {
69675
69944
  "Only right-angle and curved connectors drawn here can be rerouted."
69676
69945
  );
69677
69946
  }
69678
- function rerouteConnector(roots, pageId2, glue, check3, options = {}) {
69947
+ function rerouteConnector(roots, pageId2, glue, check3, options2 = {}) {
69679
69948
  const root = roots.get(pageId2);
69680
69949
  const shape2 = glue.shape;
69681
69950
  const stencil = isStencilConnector(shape2);
@@ -69687,7 +69956,7 @@ function rerouteConnector(roots, pageId2, glue, check3, options = {}) {
69687
69956
  if (target2) return glueSites(root, target2);
69688
69957
  return [
69689
69958
  {
69690
- point: options.free?.[end] ?? {
69959
+ point: options2.free?.[end] ?? {
69691
69960
  x: numeric4(local.get(`${prefix2(end)}X`)),
69692
69961
  y: numeric4(local.get(`${prefix2(end)}Y`))
69693
69962
  }
@@ -69696,7 +69965,7 @@ function rerouteConnector(roots, pageId2, glue, check3, options = {}) {
69696
69965
  };
69697
69966
  const chosen = chooseSites(sites("begin"), sites("end"));
69698
69967
  if (isStencilLine(shape2)) {
69699
- if (options.route && options.route !== "straight")
69968
+ if (options2.route && options2.route !== "straight")
69700
69969
  fail2(
69701
69970
  "UNSUPPORTED_GEOMETRY_EDIT",
69702
69971
  "This connector is a straight line from a stencil; only Visio's Dynamic connector can be restyled."
@@ -69715,12 +69984,12 @@ function rerouteConnector(roots, pageId2, glue, check3, options = {}) {
69715
69984
  const target2 = glue.ends[end];
69716
69985
  return target2 && target2.point === void 0 ? walkShape(glueBox(root, target2.target)) : { point: sites(end)[0].point };
69717
69986
  };
69718
- const route = options.route ?? current;
69987
+ const route = options2.route ?? current;
69719
69988
  if (route === "straight" && current === "straight" && ENDS.every(
69720
69989
  (end) => sameLineCoordinate(numeric4(local.get(`${prefix2(end)}X`)), chosen[end].point.x) && sameLineCoordinate(numeric4(local.get(`${prefix2(end)}Y`)), chosen[end].point.y)
69721
69990
  ))
69722
69991
  return [];
69723
- if (options.route) setRouteCells(shape2, options.route);
69992
+ if (options2.route) setRouteCells(shape2, options2.route);
69724
69993
  const obstacles = route === "right-angle" ? connectorObstacles(
69725
69994
  root,
69726
69995
  /* @__PURE__ */ new Set([
@@ -70072,14 +70341,14 @@ async function measuresOwnText(root, shapeId2, template, check3) {
70072
70341
  return false;
70073
70342
  }
70074
70343
  }
70075
- async function refreshTextSizes(targets, result2, options, deadline) {
70344
+ async function refreshTextSizes(targets, result2, options2, deadline) {
70076
70345
  if (!targets.length || !result2.changedParts.length) return result2;
70077
70346
  const check3 = () => {
70078
70347
  if (Date.now() >= deadline) throw new VisioPackageError("LIMIT_RUNTIME", "Deadline exceeded.");
70079
70348
  };
70080
70349
  const limits = {
70081
70350
  ...DEFAULTS2,
70082
- ...options.limits,
70351
+ ...options2.limits,
70083
70352
  maxInputBytes: Math.max(DEFAULTS2.maxInputBytes, result2.bytes.length),
70084
70353
  maxRuntimeMs: Math.max(1, deadline - Date.now())
70085
70354
  };
@@ -70169,7 +70438,7 @@ async function refreshTextSizes(targets, result2, options, deadline) {
70169
70438
  }
70170
70439
  const bytes = await writeEditedPackage(
70171
70440
  parts,
70172
- options.maxOutputBytes ?? limits.maxInputBytes,
70441
+ options2.maxOutputBytes ?? limits.maxInputBytes,
70173
70442
  deadline,
70174
70443
  check3
70175
70444
  );
@@ -70438,14 +70707,14 @@ function cacheRows(path2) {
70438
70707
  }
70439
70708
  return rows.every((row3) => Number.isFinite(row3.x) && Number.isFinite(row3.y)) ? rows : [];
70440
70709
  }
70441
- async function refreshLineJumpCaches(pageIds2, source2, result2, options, deadline) {
70710
+ async function refreshLineJumpCaches(pageIds2, source2, result2, options2, deadline) {
70442
70711
  if (!pageIds2.size || !result2.changedParts.length) return result2;
70443
70712
  const check3 = () => {
70444
70713
  if (Date.now() >= deadline) fail2("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
70445
70714
  };
70446
70715
  const limits = {
70447
70716
  ...DEFAULTS2,
70448
- ...options.limits,
70717
+ ...options2.limits,
70449
70718
  maxRuntimeMs: Math.max(1, deadline - Date.now())
70450
70719
  };
70451
70720
  const { pkg, parts, pages } = await openEditablePackage(result2.bytes, limits, check3);
@@ -70525,7 +70794,7 @@ async function refreshLineJumpCaches(pageIds2, source2, result2, options, deadli
70525
70794
  return {
70526
70795
  bytes: await writeEditedPackage(
70527
70796
  parts,
70528
- options.maxOutputBytes ?? limits.maxInputBytes,
70797
+ options2.maxOutputBytes ?? limits.maxInputBytes,
70529
70798
  deadline,
70530
70799
  check3
70531
70800
  ),
@@ -74547,9 +74816,9 @@ function snapshotStencilMasterDrop(edit) {
74547
74816
  y: edit.y
74548
74817
  };
74549
74818
  }
74550
- async function editVsdxMasterDrops(source2, commands, options, lone, apply3) {
74551
- const limits = { ...DEFAULTS2, ...options.limits };
74552
- const maxOutput = options.maxOutputBytes ?? limits.maxInputBytes;
74819
+ async function editVsdxMasterDrops(source2, commands, options2, lone, apply3) {
74820
+ const limits = { ...DEFAULTS2, ...options2.limits };
74821
+ const maxOutput = options2.maxOutputBytes ?? limits.maxInputBytes;
74553
74822
  const deadline = Date.now() + limits.maxRuntimeMs;
74554
74823
  const check3 = () => {
74555
74824
  if (Date.now() >= deadline) fail2("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
@@ -75745,12 +76014,12 @@ function resizeVisioShapeAtAnchor(roots, document, edit, check3, glueShapes = /*
75745
76014
  }
75746
76015
 
75747
76016
  // visio/edit-transform-formula.ts
75748
- function editableTransformCell(roots, edit, node3, check3, options = {}) {
76017
+ function editableTransformCell(roots, edit, node3, check3, options2 = {}) {
75749
76018
  const formula = executableCellFormula(attribute3(node3, "F"));
75750
76019
  if (!formula || !analyzeVisioFormula(formula).references.length) return editableCell(node3);
75751
76020
  const evaluate = createVisioCellEvaluator(
75752
- indexCells2(roots, { ...options, check: check3 }),
75753
- { ...options, check: check3 },
76021
+ indexCells2(roots, { ...options2, check: check3 }),
76022
+ { ...options2, check: check3 },
75754
76023
  true
75755
76024
  );
75756
76025
  editableCell(
@@ -76219,7 +76488,7 @@ async function assertDuplicateScope(pkg, pagePaths, targetPage, newIds, check3,
76219
76488
  }
76220
76489
 
76221
76490
  // visio/formula-master.ts
76222
- function analyzeVisioMasterFormula(source2, options) {
76491
+ function analyzeVisioMasterFormula(source2, options2) {
76223
76492
  const ast = parseVisioFormula(source2);
76224
76493
  const analysis = analyzeVisioFormula(ast);
76225
76494
  const references = /* @__PURE__ */ new Map();
@@ -76240,7 +76509,7 @@ function analyzeVisioMasterFormula(source2, options) {
76240
76509
  if (["TEXTWIDTH", "TEXTHEIGHT", "SHAPETEXT"].includes(node3.name)) {
76241
76510
  const text8 = node3.args[0];
76242
76511
  const count2 = node3.name === "TEXTHEIGHT" ? node3.args.length === 2 : node3.args.length === 1;
76243
- local = options.textFieldFree && count2 && text8?.kind === "reference" && text8.reference.shapeId === void 0 && text8.reference.cell.toLowerCase() === "thetext";
76512
+ local = options2.textFieldFree && count2 && text8?.kind === "reference" && text8.reference.shapeId === void 0 && text8.reference.cell.toLowerCase() === "thetext";
76244
76513
  readsText = true;
76245
76514
  }
76246
76515
  if (["LUM", "HUE", "SAT"].includes(node3.name)) {
@@ -76875,16 +77144,16 @@ async function recalculatePageFormulas(pkg, pagesPart, pages, paths, dirty, chec
76875
77144
  );
76876
77145
  }
76877
77146
  if (!needed) return;
76878
- const options = { check: check3, pageContext: after };
77147
+ const options2 = { check: check3, pageContext: after };
76879
77148
  const changed = [];
76880
- for (const cell of indexCells2(roots, options).values()) {
77149
+ for (const cell of indexCells2(roots, options2).values()) {
76881
77150
  if (!cell.node) continue;
76882
77151
  const functions = pageFunctions(attribute3(cell.node, "F") ?? "");
76883
77152
  const old = before.get(cell.pageId), current = after.get(cell.pageId);
76884
77153
  if (functions.has("PAGENUMBER") && old?.pageNumber !== current.pageNumber || functions.has("PAGECOUNT") && old?.pageCount !== current.pageCount)
76885
77154
  changed.push(cell);
76886
77155
  }
76887
- for (const id3 of recalculateVisioCells(roots, changed, options)) {
77156
+ for (const id3 of recalculateVisioCells(roots, changed, options2)) {
76888
77157
  const root = roots.get(id3);
76889
77158
  const sheet = sheets.get(id3);
76890
77159
  if (sheet) {
@@ -80207,14 +80476,14 @@ async function editVsdxComments(pkg, parts, pages, edits, limits, maxOutput, dea
80207
80476
  }
80208
80477
 
80209
80478
  // visio/clipboard.ts
80210
- async function captureVisioClipboard(input, pageId2, shapeIds2, options = {}) {
80479
+ async function captureVisioClipboard(input, pageId2, shapeIds2, options2 = {}) {
80211
80480
  pageId2 = clipboardId(pageId2);
80212
80481
  if (!Array.isArray(shapeIds2) || !shapeIds2.length || shapeIds2.length > 1e3)
80213
80482
  fail2("INVALID_CLIPBOARD", "Capture requires one to 1000 selected shapes.");
80214
80483
  const selected2 = shapeIds2.map(clipboardId);
80215
80484
  if (new Set(selected2).size !== selected2.length)
80216
80485
  fail2("INVALID_CLIPBOARD", "Capture selection must be unique.");
80217
- const limits = { ...DEFAULTS2, ...options.limits };
80486
+ const limits = { ...DEFAULTS2, ...options2.limits };
80218
80487
  for (const value3 of Object.values(limits))
80219
80488
  if (!Number.isSafeInteger(value3) || value3 <= 0)
80220
80489
  fail2("INVALID_LIMITS", "Capture limits require positive safe integers.");
@@ -80301,13 +80570,13 @@ async function retarget(clipboard, bytes, pageId2, limits) {
80301
80570
  fail2("UNSUPPORTED_SUBPROCESS", "The new page does not share the source page settings.");
80302
80571
  return { ...clipboard, pageContext: target2.xml };
80303
80572
  }
80304
- async function editVsdxSubprocess(source2, edit, options) {
80305
- const limits = { ...DEFAULTS2, ...options.limits };
80573
+ async function editVsdxSubprocess(source2, edit, options2) {
80574
+ const limits = { ...DEFAULTS2, ...options2.limits };
80306
80575
  const deadline = Date.now() + limits.maxRuntimeMs;
80307
80576
  const remaining = () => {
80308
80577
  const time = deadline - Date.now();
80309
80578
  if (time <= 0) fail2("LIMIT_RUNTIME", "Visio edit deadline exceeded.");
80310
- return { ...options, limits: { ...options.limits, maxRuntimeMs: time } };
80579
+ return { ...options2, limits: { ...options2.limits, maxRuntimeMs: time } };
80311
80580
  };
80312
80581
  const changed = /* @__PURE__ */ new Set();
80313
80582
  const diagnostics = /* @__PURE__ */ new Map();
@@ -81441,7 +81710,7 @@ function positive4(value3) {
81441
81710
  fail2("INVALID_LIMITS", "Edit limits must be positive safe integers.");
81442
81711
  return value3;
81443
81712
  }
81444
- async function editVsdx(input, edits, options = {}) {
81713
+ async function editVsdx(input, edits, options2 = {}) {
81445
81714
  const clock = {
81446
81715
  deadline: 0,
81447
81716
  autoSize: /* @__PURE__ */ new Set(),
@@ -81449,36 +81718,36 @@ async function editVsdx(input, edits, options = {}) {
81449
81718
  jumpPages: /* @__PURE__ */ new Set(),
81450
81719
  jumpSource: void 0
81451
81720
  };
81452
- const edited = await editVsdxTransaction(input, edits, options, clock);
81453
- const resized = await refreshTextSizes(clock.textSizes, edited, options, clock.deadline);
81721
+ const edited = await editVsdxTransaction(input, edits, options2, clock);
81722
+ const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
81454
81723
  const result2 = await refreshLineJumpCaches(
81455
81724
  clock.jumpPages,
81456
81725
  clock.jumpSource,
81457
81726
  resized,
81458
- options,
81727
+ options2,
81459
81728
  clock.deadline
81460
81729
  );
81461
81730
  return growAutoSizePages(
81462
81731
  clock.autoSize,
81463
81732
  result2,
81464
81733
  (bytes, growth) => editVsdxTransaction(bytes, growth, {
81465
- ...options,
81466
- limits: { ...options.limits, maxRuntimeMs: Math.max(1, clock.deadline - Date.now()) }
81734
+ ...options2,
81735
+ limits: { ...options2.limits, maxRuntimeMs: Math.max(1, clock.deadline - Date.now()) }
81467
81736
  })
81468
81737
  );
81469
81738
  }
81470
- async function editVsdxTransaction(input, edits, options, clock = {
81739
+ async function editVsdxTransaction(input, edits, options2, clock = {
81471
81740
  deadline: 0,
81472
81741
  autoSize: /* @__PURE__ */ new Set(),
81473
81742
  textSizes: [],
81474
81743
  jumpPages: /* @__PURE__ */ new Set(),
81475
81744
  jumpSource: void 0
81476
81745
  }) {
81477
- const limits = { ...DEFAULTS2, ...options.limits };
81746
+ const limits = { ...DEFAULTS2, ...options2.limits };
81478
81747
  for (const value3 of Object.values(limits)) positive4(value3);
81479
- const maxEdits = positive4(options.maxEdits ?? 1e3);
81480
- const maxText = positive4(options.maxTextCharacters ?? 1e6);
81481
- const maxOutput = positive4(options.maxOutputBytes ?? limits.maxInputBytes);
81748
+ const maxEdits = positive4(options2.maxEdits ?? 1e3);
81749
+ const maxText = positive4(options2.maxTextCharacters ?? 1e6);
81750
+ const maxOutput = positive4(options2.maxOutputBytes ?? limits.maxInputBytes);
81482
81751
  const deadline = Date.now() + limits.maxRuntimeMs;
81483
81752
  clock.deadline = deadline;
81484
81753
  const check3 = () => {
@@ -81497,13 +81766,13 @@ async function editVsdxTransaction(input, edits, options, clock = {
81497
81766
  if (subprocess) {
81498
81767
  if (allCommands.length !== 1)
81499
81768
  fail2("EDIT_MIXED_SUBPROCESS_TRANSACTION", "A subprocess requires its own transaction.");
81500
- return editVsdxSubprocess(original, subprocess, options);
81769
+ return editVsdxSubprocess(original, subprocess, options2);
81501
81770
  }
81502
81771
  if (allCommands.some(isVisioMasterDrop))
81503
81772
  return editVsdxMasterDrops(
81504
81773
  original,
81505
81774
  allCommands,
81506
- options,
81775
+ options2,
81507
81776
  async (bytes2, instance, info) => {
81508
81777
  const opened = await openEditablePackage(bytes2, limits, check3);
81509
81778
  return editVsdxMasterInstance(
@@ -81518,7 +81787,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
81518
81787
  info
81519
81788
  );
81520
81789
  },
81521
- (bytes2, rest) => editVsdx(bytes2, rest, options)
81790
+ (bytes2, rest) => editVsdx(bytes2, rest, options2)
81522
81791
  );
81523
81792
  const { pkg, parts, pages } = await openEditablePackage(original, limits, check3);
81524
81793
  const builtIn = await changeStencilShapeToBuiltIn(
@@ -81527,7 +81796,7 @@ async function editVsdxTransaction(input, edits, options, clock = {
81527
81796
  pages,
81528
81797
  allCommands,
81529
81798
  { limits, maxOutput, deadline, check: check3 },
81530
- (bytes2, edits2) => editVsdx(bytes2, edits2, options)
81799
+ (bytes2, edits2) => editVsdx(bytes2, edits2, options2)
81531
81800
  );
81532
81801
  if (builtIn) return builtIn;
81533
81802
  if (allCommands.some(isVisioCommentEdit)) {
@@ -81610,8 +81879,8 @@ async function editVsdxTransaction(input, edits, options, clock = {
81610
81879
  check3
81611
81880
  );
81612
81881
  const moved = await editVsdxTransaction(resized.bytes, commands, {
81613
- ...options,
81614
- limits: { ...options.limits, maxRuntimeMs: Math.max(1, deadline - Date.now()) }
81882
+ ...options2,
81883
+ limits: { ...options2.limits, maxRuntimeMs: Math.max(1, deadline - Date.now()) }
81615
81884
  });
81616
81885
  return {
81617
81886
  bytes: moved.bytes,