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
package/dist/index.mjs CHANGED
@@ -141,8 +141,8 @@ function rgbToHsl(r, g2, b) {
141
141
  }
142
142
  return { h: h2, s: clampUnitInterval(s2), l: clampUnitInterval(l) };
143
143
  }
144
- function hslToRgb(h2, s2, l, roundChannel = Math.round, options) {
145
- const sC = options?.clampSaturation === false ? s2 : clampUnitInterval(s2);
144
+ function hslToRgb(h2, s2, l, roundChannel = Math.round, options2) {
145
+ const sC = options2?.clampSaturation === false ? s2 : clampUnitInterval(s2);
146
146
  const lC = clampUnitInterval(l);
147
147
  const hN = (h2 % 360 + 360) % 360;
148
148
  const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
@@ -646,9 +646,11 @@ __export(chart_exports, {
646
646
  aggregateByCategory: () => aggregateByCategory,
647
647
  assertBarClusterOptions: () => assertBarClusterOptions,
648
648
  autoSeriesColor: () => autoSeriesColor,
649
+ automaticMarkerSymbol: () => automaticMarkerSymbol,
649
650
  axisTargetIntervals: () => axisTargetIntervals,
650
651
  buildChartGradientDef: () => buildChartGradientDef,
651
652
  buildHierarchyRoots: () => buildHierarchyRoots,
653
+ buildMarkerPrimitive: () => buildMarkerPrimitive,
652
654
  buildWaterfallSteps: () => buildWaterfallSteps,
653
655
  builtInChartStyleXml: () => builtInChartStyleXml,
654
656
  builtInChartTextStyle: () => builtInChartTextStyle,
@@ -660,10 +662,13 @@ __export(chart_exports, {
660
662
  chartErrorBarAmount: () => chartErrorBarAmount,
661
663
  chartExSummary: () => chartExSummary,
662
664
  chartGradientMarkup: () => chartGradientMarkup,
665
+ chartLineDashArray: () => chartLineDashArray,
666
+ chartMarkerRadius: () => chartMarkerRadius,
663
667
  chartPaletteColors: () => chartPaletteColors,
664
668
  chartPaletteSeriesColor: () => chartPaletteSeriesColor,
665
669
  chartPaletteSeriesColorChoice: () => chartPaletteSeriesColorChoice,
666
670
  chartSampleVariance: () => chartSampleVariance,
671
+ chartSeriesMarkerSvg: () => chartSeriesMarkerSvg,
667
672
  chartSourceValues: () => chartSourceValues,
668
673
  chartSpaceKind: () => chartSpaceKind,
669
674
  chartSummaryFromSpace: () => chartSummaryFromSpace,
@@ -674,18 +679,25 @@ __export(chart_exports, {
674
679
  chartTrendlineType: () => chartTrendlineType,
675
680
  clusteredBarGeometry: () => clusteredBarGeometry,
676
681
  composeDataLabelText: () => composeDataLabelText,
682
+ computeAxisStackedValueRange: () => computeAxisStackedValueRange,
683
+ computeAxisValueRange: () => computeAxisValueRange,
677
684
  computeBoxStats: () => computeBoxStats,
678
685
  computeBubbleRadius: () => computeBubbleRadius,
679
686
  computeHierarchicalSunburstArcs: () => computeHierarchicalSunburstArcs,
680
687
  computeHistogramBins: () => computeHistogramBins,
681
688
  computeLinearRegression: () => computeLinearRegression,
689
+ computeLogValueRange: () => computeLogValueRange,
682
690
  computeRSquared: () => computeRSquared,
683
691
  computeRadarPoints: () => computeRadarPoints,
684
692
  computeStackedSeriesPlots: () => computeStackedSeriesPlots,
693
+ computeStackedValueRangeForAxis: () => computeStackedValueRangeForAxis,
685
694
  computeSunburstArcs: () => computeSunburstArcs,
695
+ computeValueRangeForAxis: () => computeValueRangeForAxis,
696
+ computeValueRangeForChart: () => computeValueRangeForChart,
686
697
  computeWaterfallRange: () => computeWaterfallRange,
687
698
  effectiveBuiltInChartStyle: () => effectiveBuiltInChartStyle,
688
699
  findChartColorPalette: () => findChartColorPalette,
700
+ findLogAxis: () => findLogAxis,
689
701
  fitChartTrendline: () => fitChartTrendline,
690
702
  fitPolynomial: () => fitPolynomial,
691
703
  formatChartNumber: () => formatChartNumber,
@@ -697,6 +709,9 @@ __export(chart_exports, {
697
709
  formatPolynomialEquation: () => formatPolynomialEquation,
698
710
  formatPowerEquation: () => formatPowerEquation,
699
711
  formatTrendlineCoefficient: () => formatTrendlineCoefficient,
712
+ generateAxisTicks: () => generateAxisTicks,
713
+ generateLogTicks: () => generateLogTicks,
714
+ generateMinorAxisTicks: () => generateMinorAxisTicks,
700
715
  getChartStylePalette: () => getChartStylePalette,
701
716
  groupRowsByCategory: () => groupRowsByCategory,
702
717
  hasManualLayoutFields: () => hasManualLayoutFields,
@@ -704,6 +719,8 @@ __export(chart_exports, {
704
719
  impliesAutoTitle: () => impliesAutoTitle,
705
720
  isChartexOnlyType: () => isChartexOnlyType,
706
721
  layoutTreemap: () => layoutTreemap,
722
+ markerOutline: () => markerOutline,
723
+ markerRadius: () => markerRadius,
707
724
  maxBubbleSize: () => maxBubbleSize,
708
725
  medianBubbleRadius: () => medianBubbleRadius,
709
726
  modulateLuminance: () => modulateLuminance,
@@ -731,16 +748,20 @@ __export(chart_exports, {
731
748
  resolveDataLabelFlags: () => resolveDataLabelFlags,
732
749
  resolveManualLayoutRect: () => resolveManualLayoutRect,
733
750
  scottBinCount: () => scottBinCount,
751
+ seriesMarkerViews: () => seriesMarkerViews,
734
752
  shade: () => shade,
735
753
  sortGradientStops: () => sortGradientStops,
736
754
  squarify: () => squarify,
737
755
  stockCandle: () => stockCandle,
738
756
  stockSlots: () => stockSlots,
757
+ summaryMarkers: () => summaryMarkers,
739
758
  sunburstArcPath: () => sunburstArcPath,
740
759
  themeColor: () => themeColor,
741
760
  tint: () => tint,
742
761
  updateGradientStop: () => updateGradientStop,
762
+ valueToYLog: () => valueToYLog,
743
763
  visibleRuns: () => visibleRuns,
764
+ withAxisBounds: () => withAxisBounds,
744
765
  withChartGradientDirection: () => withChartGradientDirection,
745
766
  withinLinearTransform: () => withinLinearTransform,
746
767
  writeChartAxisFormatting: () => writeChartAxisFormatting,
@@ -1357,12 +1378,12 @@ function formatCompactAxisValue(value, formatCode) {
1357
1378
  }
1358
1379
 
1359
1380
  // chart/bubble-radius.ts
1360
- function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options) {
1361
- const scale = (options?.bubbleScale ?? 100) / 100;
1381
+ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
1382
+ const scale = (options2?.bubbleScale ?? 100) / 100;
1362
1383
  if (sizeVal === void 0) return medianRadius * scale;
1363
1384
  const denom = maxBubble > 0 ? maxBubble : 1;
1364
1385
  const magnitude = Math.abs(sizeVal);
1365
- const ratio = (options?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
1386
+ const ratio = (options2?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
1366
1387
  return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
1367
1388
  }
1368
1389
  function maxBubbleSize(sizes) {
@@ -1763,14 +1784,14 @@ function scottBinCount(values, min, max) {
1763
1784
  const width = 3.49 * sd * values.length ** (-1 / 3);
1764
1785
  return Math.max(1, Math.ceil((max - min) / width));
1765
1786
  }
1766
- function computeHistogramBins(values, options, format = String) {
1767
- const closed = options.intervalClosed ?? "l";
1787
+ function computeHistogramBins(values, options2, format = String) {
1788
+ const closed = options2.intervalClosed ?? "l";
1768
1789
  const finite4 = values.map((value, sourceIndex) => ({ value, sourceIndex })).filter((item) => Number.isFinite(item.value));
1769
1790
  if (finite4.length === 0) {
1770
1791
  return [];
1771
1792
  }
1772
- const underflow = typeof options.underflow === "number" ? options.underflow : void 0;
1773
- const overflow = typeof options.overflow === "number" ? options.overflow : void 0;
1793
+ const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
1794
+ const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
1774
1795
  const under = underflow === void 0 ? [] : finite4.filter(
1775
1796
  (item) => closed === "r" ? item.value <= underflow : item.value < underflow
1776
1797
  );
@@ -1787,8 +1808,8 @@ function computeHistogramBins(values, options, format = String) {
1787
1808
  if (regular.length > 0) {
1788
1809
  const min = Math.min(...regular.map((item) => item.value));
1789
1810
  const max = Math.max(...regular.map((item) => item.value));
1790
- const requestedSize = options.binSize && options.binSize > 0 ? options.binSize : void 0;
1791
- const requestedCount = options.binCount && options.binCount > 0 ? options.binCount : void 0;
1811
+ const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
1812
+ const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
1792
1813
  const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
1793
1814
  const count = requestedSize ? Math.max(
1794
1815
  closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
@@ -1839,9 +1860,9 @@ function aggregateByCategory(values, rawCategories) {
1839
1860
  }
1840
1861
 
1841
1862
  // chart/waterfall.ts
1842
- function buildWaterfallSteps(values, options) {
1863
+ function buildWaterfallSteps(values, options2) {
1843
1864
  const subtotalIndices = new Set(
1844
- options?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
1865
+ options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
1845
1866
  );
1846
1867
  const steps = [];
1847
1868
  let runningTotal = 0;
@@ -1917,13 +1938,13 @@ var noFit = () => ({
1917
1938
  rSquared: 0,
1918
1939
  coefficients: []
1919
1940
  });
1920
- function fitModel(options, xVals, yVals) {
1941
+ function fitModel(options2, xVals, yVals) {
1921
1942
  const xs = [...xVals];
1922
1943
  const ys = [...yVals];
1923
- switch (options.kind) {
1944
+ switch (options2.kind) {
1924
1945
  case "linear": {
1925
1946
  const reg = computeLinearRegression(xs, ys);
1926
- const fixed = options.intercept;
1947
+ const fixed = options2.intercept;
1927
1948
  const slope = fixed !== void 0 ? ys.reduce((s2, y, i2) => s2 + (y - fixed) * xs[i2], 0) / xs.reduce((s2, x) => s2 + x * x, 0) : reg.slope;
1928
1949
  const b = fixed ?? reg.intercept;
1929
1950
  return {
@@ -1973,7 +1994,7 @@ function fitModel(options, xVals, yVals) {
1973
1994
  };
1974
1995
  }
1975
1996
  case "polynomial": {
1976
- const order = Math.min(options.order ?? 2, 6);
1997
+ const order = Math.min(options2.order ?? 2, 6);
1977
1998
  const coeffs = fitPolynomial(xs, ys, order);
1978
1999
  const evaluate = (x) => coeffs.reduce((s2, c2, i2) => s2 + c2 * x ** i2, 0);
1979
2000
  return {
@@ -1987,11 +2008,11 @@ function fitModel(options, xVals, yVals) {
1987
2008
  return void 0;
1988
2009
  }
1989
2010
  }
1990
- function fitChartTrendline(options, xVals, yVals) {
2011
+ function fitChartTrendline(options2, xVals, yVals) {
1991
2012
  const count = yVals.length;
1992
2013
  if (count < 2) return noFit();
1993
- if (options.kind === "movingAvg") {
1994
- const period = options.period ?? 2;
2014
+ if (options2.kind === "movingAvg") {
2015
+ const period = options2.period ?? 2;
1995
2016
  const points2 = [];
1996
2017
  for (let i2 = period - 1; i2 < count; i2++) {
1997
2018
  let sum = 0;
@@ -2000,10 +2021,10 @@ function fitChartTrendline(options, xVals, yVals) {
2000
2021
  }
2001
2022
  return { points: points2, equation: `${period}-period moving average`, rSquared: 0, coefficients: [] };
2002
2023
  }
2003
- const model = fitModel(options, xVals, yVals);
2024
+ const model = fitModel(options2, xVals, yVals);
2004
2025
  if (!model) return noFit();
2005
- const startX = Math.min(...xVals) - (options.backward ?? 0);
2006
- const endX = Math.max(...xVals) + (options.forward ?? 0);
2026
+ const startX = Math.min(...xVals) - (options2.backward ?? 0);
2027
+ const endX = Math.max(...xVals) + (options2.forward ?? 0);
2007
2028
  const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
2008
2029
  const points = [];
2009
2030
  for (let step = 0; step <= steps; step++) {
@@ -2026,18 +2047,18 @@ function chartSampleVariance(values) {
2026
2047
  const mean = values.reduce((sum, value) => sum + value, 0) / count;
2027
2048
  return values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / Math.max(count - 1, 1);
2028
2049
  }
2029
- function chartErrorBarAmount(options, values, displayIndex, sourceIndex, side) {
2030
- switch (options.valueType) {
2050
+ function chartErrorBarAmount(options2, values, displayIndex, sourceIndex, side) {
2051
+ switch (options2.valueType) {
2031
2052
  case "fixedVal":
2032
- return options.value ?? 0;
2053
+ return options2.value ?? 0;
2033
2054
  case "percentage":
2034
- return Math.abs(values[displayIndex] ?? 0) * ((options.value ?? 0) / 100);
2055
+ return Math.abs(values[displayIndex] ?? 0) * ((options2.value ?? 0) / 100);
2035
2056
  case "stdDev":
2036
- return Math.sqrt(chartSampleVariance(values)) * (options.value ?? 1);
2057
+ return Math.sqrt(chartSampleVariance(values)) * (options2.value ?? 1);
2037
2058
  case "stdErr":
2038
2059
  return Math.sqrt(chartSampleVariance(values) / Math.max(values.length, 1));
2039
2060
  case "cust":
2040
- return side === "plus" ? options.customPlus?.[sourceIndex] ?? 0 : options.customMinus?.[sourceIndex] ?? 0;
2061
+ return side === "plus" ? options2.customPlus?.[sourceIndex] ?? 0 : options2.customMinus?.[sourceIndex] ?? 0;
2041
2062
  }
2042
2063
  }
2043
2064
 
@@ -2308,11 +2329,11 @@ function checkXmlLimits(xml, label, limits = {}) {
2308
2329
  throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth2}`);
2309
2330
  }
2310
2331
  }
2311
- function parseXml(xml, options = {}) {
2312
- const label = options.label ?? "OOXML";
2332
+ function parseXml(xml, options2 = {}) {
2333
+ const label = options2.label ?? "OOXML";
2313
2334
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
2314
2335
  throw new Error(`${label} XML with DTD or entity declarations is not supported`);
2315
- checkXmlLimits(xml, label, options.limits);
2336
+ checkXmlLimits(xml, label, options2.limits);
2316
2337
  let parseError = "";
2317
2338
  let parsed;
2318
2339
  try {
@@ -2697,13 +2718,13 @@ var APPLIED = /* @__PURE__ */ new Set([
2697
2718
  "lumMod",
2698
2719
  "lumOff"
2699
2720
  ]);
2700
- function resolveDrawingColor(color, theme, options) {
2721
+ function resolveDrawingColor(color, theme, options2) {
2701
2722
  const base = baseHex(color, theme);
2702
2723
  const rgb = base ? hexToRgbChannels(base) : null;
2703
2724
  if (!rgb) return void 0;
2704
- if (options?.transformOrder === "document") {
2725
+ if (options2?.transformOrder === "document") {
2705
2726
  const value = orderedColorTransforms(rgb, color.transforms);
2706
- const round3 = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
2727
+ const round3 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
2707
2728
  return {
2708
2729
  hex: `#${toHex(round3(value.r))}${toHex(round3(value.g))}${toHex(round3(value.b))}`,
2709
2730
  alpha: value.alpha,
@@ -2754,7 +2775,7 @@ function resolveDrawingColor(color, theme, options) {
2754
2775
  if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
2755
2776
  const lumOff = parseDrawingFraction(find("lumOff"));
2756
2777
  if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
2757
- const round3 = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
2778
+ const round3 = options2?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
2758
2779
  ({ r, g: g2, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round3));
2759
2780
  }
2760
2781
  let alpha = parseDrawingPercent(find("alpha")) ?? 1;
@@ -3740,7 +3761,7 @@ function resolveInnerRect(fillToRect, focalPoint) {
3740
3761
  function lerpEdge(inner, outer, t) {
3741
3762
  return inner + (outer - inner) * t;
3742
3763
  }
3743
- function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
3764
+ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options2) {
3744
3765
  if (stops.length === 0) {
3745
3766
  return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
3746
3767
  }
@@ -3748,8 +3769,8 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
3748
3769
  const inner = resolveInnerRect(fillToRect, focalPoint);
3749
3770
  const rects = [];
3750
3771
  const alphaRects = [];
3751
- const masked = options?.independentOpacity && sorted.some((stop) => (stop.opacity ?? 1) < 1);
3752
- const bands = options?.bands ?? BAND_COUNT;
3772
+ const masked = options2?.independentOpacity && sorted.some((stop) => (stop.opacity ?? 1) < 1);
3773
+ const bands = options2?.bands ?? BAND_COUNT;
3753
3774
  if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
3754
3775
  for (let i2 = bands; i2 >= 0; i2 -= 1) {
3755
3776
  const t = i2 / bands;
@@ -3942,12 +3963,12 @@ function chartGradientMarkup(def) {
3942
3963
 
3943
3964
  // chart/bar-cluster-geometry.ts
3944
3965
  var DEFAULT_BAR_GAP_WIDTH = 150;
3945
- function assertBarClusterOptions(options) {
3966
+ function assertBarClusterOptions(options2) {
3946
3967
  for (const [field, min, max] of [
3947
3968
  ["barGapWidth", 0, 500],
3948
3969
  ["barOverlap", -100, 100]
3949
3970
  ]) {
3950
- const value = options[field];
3971
+ const value = options2[field];
3951
3972
  if (value !== void 0 && (!Number.isInteger(value) || value < min || value > max))
3952
3973
  throw new RangeError(`${field} must be an integer from ${min} to ${max}`);
3953
3974
  }
@@ -5233,8 +5254,8 @@ function titleXml(context, title) {
5233
5254
  chartTextXml(context, tx, false) + layoutXml(context, title.layout) + valXml("overlay", title.overlay) + shapePropertiesXml(context, title.spPr) + textBodyXml(context, title.txPr) + raw(context, title.extLst)
5234
5255
  );
5235
5256
  }
5236
- function labelOptionsXml(context, options) {
5237
- 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));
5257
+ function labelOptionsXml(context, options2) {
5258
+ 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));
5238
5259
  }
5239
5260
  function labelXml(context, label) {
5240
5261
  return elementXml(
@@ -5404,7 +5425,7 @@ function styleXml(context, space3) {
5404
5425
  );
5405
5426
  }
5406
5427
  var relationship = (local, id, content2 = "") => id === void 0 ? "" : elementXml(local, content2, ` r:id="${escapeAttribute(id)}"`);
5407
- function writeChartSpace(space3, options = {}) {
5428
+ function writeChartSpace(space3, options2 = {}) {
5408
5429
  const bindings = new Map(CHART_ROOT_BINDINGS);
5409
5430
  for (const { prefix, uri } of space3.namespaceDeclarations ?? [])
5410
5431
  if (!bindings.has(prefix) && /^[A-Za-z_][\w.-]*$/.test(prefix)) bindings.set(prefix, uri);
@@ -5419,10 +5440,204 @@ function writeChartSpace(space3, options = {}) {
5419
5440
  space3.externalDataRelId,
5420
5441
  valXml("autoUpdate", space3.externalDataAutoUpdate)
5421
5442
  ) + raw(context, space3.printSettings) + relationship("userShapes", space3.userShapesRelId) + raw(context, space3.extLst);
5422
- const breakAfter = options.declarationBreak ?? "\r\n";
5443
+ const breakAfter = options2.declarationBreak ?? "\r\n";
5423
5444
  return `${DECLARATION2}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
5424
5445
  }
5425
5446
 
5447
+ // chart/marker-shape.ts
5448
+ var CHART_PX_PER_PT = 4 / 3;
5449
+ var DEFAULT_MARKER_OUTLINE_PT = 0.75;
5450
+ function markerOutline(marker) {
5451
+ if (!marker.stroke) {
5452
+ return {};
5453
+ }
5454
+ return {
5455
+ stroke: marker.stroke,
5456
+ strokeWidth: (marker.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT) * CHART_PX_PER_PT
5457
+ };
5458
+ }
5459
+ var AUTOMATIC_MARKER_CYCLE = [
5460
+ "diamond",
5461
+ "square",
5462
+ "triangle",
5463
+ "x",
5464
+ "star",
5465
+ "circle",
5466
+ "plus",
5467
+ "dot",
5468
+ "dash"
5469
+ ];
5470
+ function automaticMarkerSymbol(seriesIdx) {
5471
+ const length = AUTOMATIC_MARKER_CYCLE.length;
5472
+ const normalized = (Math.trunc(seriesIdx) % length + length) % length;
5473
+ return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
5474
+ }
5475
+ function markerRadius(size, defaultRadius) {
5476
+ if (size === void 0 || !Number.isFinite(size) || size <= 0) {
5477
+ return defaultRadius;
5478
+ }
5479
+ return size / 2;
5480
+ }
5481
+ function polygonPoints(vertices) {
5482
+ return vertices.map(([x, y]) => `${x.toFixed(2)},${y.toFixed(2)}`).join(" ");
5483
+ }
5484
+ function starVertices(cx2, cy, r) {
5485
+ const inner = r * 0.5;
5486
+ const out = [];
5487
+ for (let i2 = 0; i2 < 10; i2++) {
5488
+ const radius = i2 % 2 === 0 ? r : inner;
5489
+ const angle = -Math.PI / 2 + Math.PI * i2 / 5;
5490
+ out.push([cx2 + radius * Math.cos(angle), cy + radius * Math.sin(angle)]);
5491
+ }
5492
+ return out;
5493
+ }
5494
+ function rectPolygon(x, y, w, h2) {
5495
+ return polygonPoints([
5496
+ [x, y],
5497
+ [x + w, y],
5498
+ [x + w, y + h2],
5499
+ [x, y + h2]
5500
+ ]);
5501
+ }
5502
+ function buildMarkerPrimitive(input) {
5503
+ const { symbol, cx: cx2, cy, fill } = input;
5504
+ const part = input.part === void 0 ? {} : { part: input.part };
5505
+ if (symbol === "none") {
5506
+ return null;
5507
+ }
5508
+ const r = markerRadius(input.size, input.defaultRadius);
5509
+ const outline = input.stroke ? {
5510
+ stroke: input.stroke,
5511
+ strokeWidth: input.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT * CHART_PX_PER_PT
5512
+ } : void 0;
5513
+ const polygonStroke = outline ?? { stroke: fill, strokeWidth: 0 };
5514
+ const lineStroke = input.stroke ?? fill;
5515
+ switch (symbol) {
5516
+ case "square":
5517
+ case "dash": {
5518
+ const h2 = symbol === "dash" ? r * 0.64 : r * 2;
5519
+ const y = cy - h2 / 2;
5520
+ if (outline) {
5521
+ return {
5522
+ kind: "polygon",
5523
+ points: rectPolygon(cx2 - r, y, r * 2, h2),
5524
+ fill,
5525
+ ...outline,
5526
+ ...part
5527
+ };
5528
+ }
5529
+ return { kind: "rect", x: cx2 - r, y, w: r * 2, h: h2, fill, ...part };
5530
+ }
5531
+ case "diamond":
5532
+ return {
5533
+ kind: "polygon",
5534
+ points: polygonPoints([
5535
+ [cx2, cy - r],
5536
+ [cx2 + r, cy],
5537
+ [cx2, cy + r],
5538
+ [cx2 - r, cy]
5539
+ ]),
5540
+ fill,
5541
+ ...polygonStroke,
5542
+ ...part
5543
+ };
5544
+ case "triangle":
5545
+ return {
5546
+ kind: "polygon",
5547
+ points: polygonPoints([
5548
+ [cx2, cy - r],
5549
+ [cx2 + r * 0.9, cy + r * 0.75],
5550
+ [cx2 - r * 0.9, cy + r * 0.75]
5551
+ ]),
5552
+ fill,
5553
+ ...polygonStroke,
5554
+ ...part
5555
+ };
5556
+ case "star":
5557
+ return {
5558
+ kind: "polygon",
5559
+ points: polygonPoints(starVertices(cx2, cy, r)),
5560
+ fill,
5561
+ ...polygonStroke,
5562
+ ...part
5563
+ };
5564
+ case "plus":
5565
+ return {
5566
+ kind: "path",
5567
+ d: `M${(cx2 - r).toFixed(2)},${cy.toFixed(2)} L${(cx2 + r).toFixed(2)},${cy.toFixed(2)} M${cx2.toFixed(2)},${(cy - r).toFixed(2)} L${cx2.toFixed(2)},${(cy + r).toFixed(2)}`,
5568
+ fill: "none",
5569
+ stroke: lineStroke,
5570
+ strokeWidth: Math.max(1, r * 0.4),
5571
+ ...part
5572
+ };
5573
+ case "x":
5574
+ return {
5575
+ kind: "path",
5576
+ d: `M${(cx2 - r).toFixed(2)},${(cy - r).toFixed(2)} L${(cx2 + r).toFixed(2)},${(cy + r).toFixed(2)} M${(cx2 + r).toFixed(2)},${(cy - r).toFixed(2)} L${(cx2 - r).toFixed(2)},${(cy + r).toFixed(2)}`,
5577
+ fill: "none",
5578
+ stroke: lineStroke,
5579
+ strokeWidth: Math.max(1, r * 0.4),
5580
+ ...part
5581
+ };
5582
+ case "dot":
5583
+ return { kind: "circle", cx: cx2, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline };
5584
+ default:
5585
+ return { kind: "circle", cx: cx2, cy, r, fill, ...part, ...outline };
5586
+ }
5587
+ }
5588
+
5589
+ // chart/render/chart-view-markers.ts
5590
+ function summaryMarkers(source, group2, seriesPosition) {
5591
+ if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
5592
+ const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
5593
+ const symbol = source.marker?.symbol;
5594
+ const marker = {
5595
+ ...source.marker,
5596
+ symbol: symbol && symbol !== "auto" ? symbol : source.marker || enabled ? automaticMarkerSymbol(source.index ?? seriesPosition) : "none"
5597
+ };
5598
+ const pointMarkers = {};
5599
+ for (const point of source.dataPoints) {
5600
+ if (point.index === void 0 || !point.marker) continue;
5601
+ const override = point.marker;
5602
+ pointMarkers[point.index] = {
5603
+ ...marker,
5604
+ ...override,
5605
+ ...override.symbol === "auto" || !source.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source.index ?? seriesPosition) } : {},
5606
+ ...marker.spPr || override.spPr ? {
5607
+ spPr: {
5608
+ ...marker.spPr,
5609
+ ...override.spPr,
5610
+ ...marker.spPr?.line || override.spPr?.line ? { line: { ...marker.spPr?.line, ...override.spPr?.line } } : {}
5611
+ }
5612
+ } : {}
5613
+ };
5614
+ }
5615
+ return { marker, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
5616
+ }
5617
+ function seriesMarkerViews(source, drawingColor) {
5618
+ const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor(fill.color) : void 0;
5619
+ const resolve = (marker) => {
5620
+ const fill = fillColor(marker.spPr?.fill);
5621
+ const stroke = fillColor(marker.spPr?.line?.fill);
5622
+ const width = marker.spPr?.line?.widthEmu;
5623
+ return {
5624
+ ...marker.symbol !== void 0 ? { symbol: marker.symbol } : {},
5625
+ ...marker.size !== void 0 ? { size: marker.size } : {},
5626
+ ...fill !== void 0 ? { fill } : {},
5627
+ ...stroke !== void 0 ? { stroke } : {},
5628
+ ...width !== void 0 ? { strokeWidth: width / 9525 } : {}
5629
+ };
5630
+ };
5631
+ return {
5632
+ ...source.marker ? { marker: resolve(source.marker) } : {},
5633
+ ...source.pointMarkers ? {
5634
+ pointMarkers: Object.fromEntries(
5635
+ Object.entries(source.pointMarkers).map(([i2, marker]) => [i2, resolve(marker)])
5636
+ )
5637
+ } : {}
5638
+ };
5639
+ }
5640
+
5426
5641
  // chart/render/summary-analysis.ts
5427
5642
  function summaryTrendline(source) {
5428
5643
  const kind = chartTrendlineKind(source.trendlineType);
@@ -5464,17 +5679,17 @@ function summaryAnalysis(series) {
5464
5679
  }
5465
5680
 
5466
5681
  // chart/render/summary-labels.ts
5467
- function level(options, custom) {
5682
+ function level(options2, custom) {
5468
5683
  const out = {};
5469
- if (options.deleted !== void 0) out.deleted = options.deleted;
5470
- if (options.showValue !== void 0) out.showValue = options.showValue;
5471
- if (options.showCategoryName !== void 0) out.showCategory = options.showCategoryName;
5472
- if (options.showSeriesName !== void 0) out.showSeriesName = options.showSeriesName;
5473
- if (options.showPercent !== void 0) out.showPercent = options.showPercent;
5474
- if (options.showBubbleSize !== void 0) out.showBubbleSize = options.showBubbleSize;
5475
- if (options.separator !== void 0) out.separator = options.separator;
5476
- if (options.position) out.position = options.position;
5477
- if (options.numberFormat?.formatCode) out.numberFormat = options.numberFormat.formatCode;
5684
+ if (options2.deleted !== void 0) out.deleted = options2.deleted;
5685
+ if (options2.showValue !== void 0) out.showValue = options2.showValue;
5686
+ if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
5687
+ if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
5688
+ if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
5689
+ if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
5690
+ if (options2.separator !== void 0) out.separator = options2.separator;
5691
+ if (options2.position) out.position = options2.position;
5692
+ if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
5478
5693
  if (custom?.text !== void 0) out.text = custom.text;
5479
5694
  return out;
5480
5695
  }
@@ -5581,7 +5796,10 @@ function extraGroups(chartSpace, firstType) {
5581
5796
  const type = group2.kind === "bar" ? "column" : group2.kind;
5582
5797
  const entry3 = {
5583
5798
  chartType: type,
5584
- series: group2.series.map((source) => chartSummarySeries(source, type, group2.dataLabels)),
5799
+ series: group2.series.map((source, index) => ({
5800
+ ...chartSummarySeries(source, type, group2.dataLabels),
5801
+ ...summaryMarkers(source, group2, index)
5802
+ })),
5585
5803
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
5586
5804
  };
5587
5805
  if (group2.grouping && GROUPINGS.has(group2.grouping))
@@ -5599,13 +5817,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
5599
5817
  const group2 = chartSpace.plotArea.groups[0];
5600
5818
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
5601
5819
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
5602
- const series = (group2?.series ?? []).map(
5603
- (source) => chartSummarySeries(source, chartType, group2?.dataLabels)
5604
- );
5820
+ const series = (group2?.series ?? []).map((source, index) => ({
5821
+ ...chartSummarySeries(source, chartType, group2?.dataLabels),
5822
+ ...group2 ? summaryMarkers(source, group2, index) : {}
5823
+ }));
5605
5824
  const summary = {
5606
5825
  chartType,
5607
5826
  series,
5608
- showLegend: chartSpace.legend !== void 0
5827
+ showLegend: chartSpace.legend !== void 0,
5828
+ axes: chartSpace.plotArea.axes,
5829
+ axisIds: group2?.axisIds ?? []
5609
5830
  };
5610
5831
  const combined = extraGroups(chartSpace, chartType);
5611
5832
  if (combined.length) summary.extraGroups = combined;
@@ -6259,7 +6480,7 @@ function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
6259
6480
  function chartStroke(model, part) {
6260
6481
  const entry3 = model.appearance?.[part];
6261
6482
  return {
6262
- color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
6483
+ color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part.startsWith("gridline") ? GRID_COLOR : AXIS_COLOR),
6263
6484
  width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
6264
6485
  };
6265
6486
  }
@@ -6550,6 +6771,60 @@ function scatterAnalysis(model, px3, py, out) {
6550
6771
  });
6551
6772
  }
6552
6773
 
6774
+ // chart/render/chart-svg-markers.ts
6775
+ function chartMarkerRadius(series, index, defaultRadius = 3) {
6776
+ const marker = { ...series.marker, ...series.pointMarkers?.[index] };
6777
+ if (marker.symbol === "none") return 0;
6778
+ const radius = markerRadius(marker.size, defaultRadius);
6779
+ return marker.symbol === "dot" ? Math.max(radius * 0.6, 1) : radius;
6780
+ }
6781
+ function chartSeriesMarkerSvg(series, index, cx2, cy, defaultRadius = 3) {
6782
+ const marker = { ...series.marker, ...series.pointMarkers?.[index] };
6783
+ const primitive = buildMarkerPrimitive({
6784
+ ...marker,
6785
+ symbol: marker.symbol,
6786
+ size: marker.size,
6787
+ cx: cx2,
6788
+ cy,
6789
+ fill: marker.fill ?? series.pointColors?.[index] ?? series.color,
6790
+ defaultRadius
6791
+ });
6792
+ if (!primitive) return "";
6793
+ let geometry;
6794
+ switch (primitive.kind) {
6795
+ case "circle":
6796
+ geometry = `cx="${n(primitive.cx)}" cy="${n(primitive.cy)}" r="${n(primitive.r)}"`;
6797
+ break;
6798
+ case "rect":
6799
+ geometry = `x="${n(primitive.x)}" y="${n(primitive.y)}" width="${n(primitive.w)}" height="${n(primitive.h)}"`;
6800
+ break;
6801
+ case "path":
6802
+ geometry = `d="${esc(primitive.d)}"`;
6803
+ break;
6804
+ case "polygon":
6805
+ geometry = `points="${esc(primitive.points)}"`;
6806
+ break;
6807
+ }
6808
+ const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
6809
+ const filter = series.shadowFilter ? ` filter="${esc(series.shadowFilter)}"` : "";
6810
+ return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter}/>`;
6811
+ }
6812
+
6813
+ // chart/line-dash.ts
6814
+ function chartLineDashArray(style, width) {
6815
+ if (!style || style === "solid") {
6816
+ return void 0;
6817
+ }
6818
+ const unit = Math.max(width, 1);
6819
+ if (style === "dot" || style === "sysDot") {
6820
+ return `${unit} ${unit * 2}`;
6821
+ }
6822
+ if (style === "lgDash") {
6823
+ return `${unit * 6} ${unit * 3}`;
6824
+ }
6825
+ return `${unit * 3} ${unit * 2}`;
6826
+ }
6827
+
6553
6828
  // chart/render/chart-scale.ts
6554
6829
  var clean = (n2) => Number(n2.toPrecision(12));
6555
6830
  function* units(raw2) {
@@ -6560,14 +6835,14 @@ function* units(raw2) {
6560
6835
  exp++;
6561
6836
  }
6562
6837
  }
6563
- function niceScale(dataMin, dataMax, options = {}) {
6564
- const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
6838
+ function niceScale(dataMin, dataMax, options2 = {}) {
6839
+ const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
6565
6840
  let lo = Number.isFinite(dataMin) ? dataMin : 0;
6566
6841
  let hi = Number.isFinite(dataMax) ? dataMax : 0;
6567
6842
  if (lo > hi) [lo, hi] = [hi, lo];
6568
6843
  if (lo === hi) {
6569
6844
  if (lo === 0) hi = 1;
6570
- else if (options.noZero) {
6845
+ else if (options2.noZero) {
6571
6846
  const pad2 = Math.abs(lo) * 0.1 || 1;
6572
6847
  lo -= pad2;
6573
6848
  hi += pad2;
@@ -6576,7 +6851,7 @@ function niceScale(dataMin, dataMax, options = {}) {
6576
6851
  }
6577
6852
  let fixedLo = false;
6578
6853
  let fixedHi = false;
6579
- if (!options.noZero) {
6854
+ if (!options2.noZero) {
6580
6855
  if (lo >= 0 && hi - lo >= hi / 6) {
6581
6856
  lo = 0;
6582
6857
  fixedLo = true;
@@ -6616,6 +6891,329 @@ function formatAxisValue(value, percent = false) {
6616
6891
  return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
6617
6892
  }
6618
6893
 
6894
+ // chart/render/chart-svg-axes.ts
6895
+ function axisTickText(value, axis, percent = false) {
6896
+ return formatChartNumber(value, axis?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
6897
+ }
6898
+ function axisLine(model, axis, part, x1, y1, x2, y2) {
6899
+ if (axis?.source.deleted) return "";
6900
+ return styledAxisLine(x1, y1, x2, y2, axis?.line, chartStroke(model, part));
6901
+ }
6902
+ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
6903
+ const color = paint2?.color ?? fallback.color;
6904
+ const width = paint2?.width ?? fallback.width;
6905
+ if (color === "none" || width === 0) return "";
6906
+ const dash = chartLineDashArray(paint2?.dash, width);
6907
+ return line(x1, y1, x2, y2, esc(color), width).replace(
6908
+ "/>",
6909
+ dash ? ` stroke-dasharray="${dash}"/>` : "/>"
6910
+ );
6911
+ }
6912
+ function axisGridlines(model, axis, ticks, position, plot, vertical) {
6913
+ const draw2 = (values, paint2, minor2) => {
6914
+ const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
6915
+ return values.map((value) => {
6916
+ const p = position(value);
6917
+ return vertical ? styledAxisLine(p, plot.y, p, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p, plot.x + plot.w, p, paint2, fallback);
6918
+ }).join("");
6919
+ };
6920
+ const major = !axis || axis.source.majorGridlines ? draw2(ticks, axis?.majorGrid, false) : "";
6921
+ const minor = axis?.source.minorGridlines ? draw2(axis.minorTicks, axis.minorGrid, true) : "";
6922
+ return major + minor;
6923
+ }
6924
+
6925
+ // chart/axis-range-auto.ts
6926
+ function computeAxisValueRange(series, plotHeightPx) {
6927
+ let dataMin = Number.POSITIVE_INFINITY, dataMax = Number.NEGATIVE_INFINITY;
6928
+ for (const item of series) {
6929
+ for (const value of item.values) {
6930
+ if (value !== null && Number.isFinite(value) && value < dataMin) {
6931
+ dataMin = value;
6932
+ }
6933
+ if (value !== null && Number.isFinite(value) && value > dataMax) {
6934
+ dataMax = value;
6935
+ }
6936
+ }
6937
+ }
6938
+ if (dataMin === Number.POSITIVE_INFINITY) {
6939
+ return { min: 0, max: 1, span: 1 };
6940
+ }
6941
+ const { min, max, majorUnit } = niceValueAxisBounds(
6942
+ dataMin,
6943
+ dataMax,
6944
+ plotHeightPx !== void 0 ? axisTargetIntervals(plotHeightPx) : void 0
6945
+ );
6946
+ return { min, max, span: Math.max(max - min, Number.EPSILON), majorUnit };
6947
+ }
6948
+ function computeAxisStackedValueRange(series, catCount, plotHeightPx) {
6949
+ let maxSum = 0, minSum = 0;
6950
+ for (let ci = 0; ci < catCount; ci++) {
6951
+ let pos = 0, neg = 0;
6952
+ for (const s2 of series) {
6953
+ const v = s2.values[ci] ?? 0;
6954
+ if (v >= 0) {
6955
+ pos += v;
6956
+ } else {
6957
+ neg += v;
6958
+ }
6959
+ }
6960
+ maxSum = Math.max(maxSum, pos);
6961
+ minSum = Math.min(minSum, neg);
6962
+ }
6963
+ const { min, max, majorUnit } = niceValueAxisBounds(
6964
+ Math.min(minSum, 0),
6965
+ Math.max(maxSum, 0),
6966
+ plotHeightPx !== void 0 ? axisTargetIntervals(plotHeightPx) : void 0
6967
+ );
6968
+ return { min, max, span: Math.max(max - min, Number.EPSILON), majorUnit };
6969
+ }
6970
+
6971
+ // chart/axis-range.ts
6972
+ function computeLogValueRange(series, logBase) {
6973
+ const allValues = series.flatMap((item) => item.values).filter((value) => value !== null && Number.isFinite(value) && value > 0);
6974
+ if (allValues.length === 0) {
6975
+ return { min: 1, max: logBase, span: 1, logScale: true, logBase };
6976
+ }
6977
+ const dataMin = Math.min(...allValues);
6978
+ const dataMax = Math.max(...allValues);
6979
+ const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
6980
+ const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
6981
+ const min = logBase ** logMin;
6982
+ const max = logBase ** Math.max(logMax, logMin + 1);
6983
+ return {
6984
+ min,
6985
+ max,
6986
+ span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
6987
+ logScale: true,
6988
+ logBase
6989
+ };
6990
+ }
6991
+ function computeValueRangeForAxis(series, axis, plotHeightPx) {
6992
+ const requestedLogBase = axis?.logBase ?? 10;
6993
+ const logBase = axis?.logScale && Number.isFinite(requestedLogBase) && requestedLogBase > 1 ? requestedLogBase : axis?.logScale ? 10 : void 0;
6994
+ const automatic = logBase ? computeLogValueRange(series, logBase) : computeAxisValueRange(series, plotHeightPx);
6995
+ return withAxisBounds(automatic, axis, logBase);
6996
+ }
6997
+ function computeStackedValueRangeForAxis(series, catCount, axis, isPercent, plotSizePx) {
6998
+ if (isPercent) {
6999
+ return {
7000
+ ...percentStackedRange(series, catCount, plotSizePx),
7001
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
7002
+ };
7003
+ }
7004
+ return withAxisBounds(computeAxisStackedValueRange(series, catCount, plotSizePx), axis);
7005
+ }
7006
+ function percentStackedRange(series, catCount, plotSizePx) {
7007
+ const shares = series.map((entry3) => ({
7008
+ ...entry3,
7009
+ values: Array.from({ length: catCount }, (_, ci) => {
7010
+ const total = series.reduce((sum, s2) => sum + Math.abs(s2.values[ci] ?? 0), 0);
7011
+ return total > 0 ? (entry3.values[ci] ?? 0) / total * 100 : 0;
7012
+ })
7013
+ }));
7014
+ const automatic = computeAxisStackedValueRange(shares, catCount, plotSizePx);
7015
+ if (automatic.min >= 0) {
7016
+ return { min: 0, max: 100, span: 100 };
7017
+ }
7018
+ const min = Math.max(automatic.min, -100);
7019
+ const unit = automatic.majorUnit;
7020
+ return {
7021
+ min,
7022
+ max: 100,
7023
+ span: 100 - min,
7024
+ ...unit !== void 0 && 100 % unit === 0 && min % unit === 0 ? { majorUnit: unit } : {}
7025
+ };
7026
+ }
7027
+ function withAxisBounds(automatic, axis, logBase) {
7028
+ const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
7029
+ const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
7030
+ const min = validMin ?? automatic.min;
7031
+ let max = validMax ?? automatic.max;
7032
+ const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
7033
+ if (max <= min) {
7034
+ max = logBase ? min * logBase : min + 1;
7035
+ }
7036
+ const span = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
7037
+ return {
7038
+ min,
7039
+ max,
7040
+ span: Math.max(span, Number.EPSILON),
7041
+ ...majorUnit !== void 0 ? { majorUnit } : {},
7042
+ ...logBase ? { logScale: true, logBase } : {},
7043
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
7044
+ };
7045
+ }
7046
+ function valueToYLog(val2, range, topY, bottomY) {
7047
+ const base = range.logBase ?? 10;
7048
+ const logValue = Math.log(Math.max(val2, range.min)) / Math.log(base);
7049
+ const logMin = Math.log(range.min) / Math.log(base);
7050
+ const ratio = (logValue - logMin) / range.span;
7051
+ return range.reverseOrder ? topY + ratio * (bottomY - topY) : bottomY - ratio * (bottomY - topY);
7052
+ }
7053
+ function findLogAxis(axes) {
7054
+ return axes?.find((axis) => axis.axisType === "valAx" && axis.logScale);
7055
+ }
7056
+ function computeValueRangeForChart(series, axes, plotHeightPx) {
7057
+ const primaryAxis = axes?.find((axis) => axis.axisType === "valAx" && axis.axPos === "l") ?? axes?.find((axis) => axis.axisType === "valAx" && axis.axPos !== "r");
7058
+ return computeValueRangeForAxis(series, primaryAxis, plotHeightPx);
7059
+ }
7060
+
7061
+ // chart/axis-ticks.ts
7062
+ var LOG_EXPONENT_TOLERANCE = 1e-12;
7063
+ function generateLogTicks(range) {
7064
+ if (!range.logScale || !range.logBase) {
7065
+ return [];
7066
+ }
7067
+ const base = range.logBase;
7068
+ const logMin = Math.log(range.min) / Math.log(base);
7069
+ const logMax = Math.log(range.max) / Math.log(base);
7070
+ const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
7071
+ const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
7072
+ if (lastExponent < firstExponent) {
7073
+ return range.min === range.max ? [range.min] : [range.min, range.max];
7074
+ }
7075
+ return Array.from(
7076
+ { length: lastExponent - firstExponent + 1 },
7077
+ (_unused, index) => base ** (firstExponent + index)
7078
+ );
7079
+ }
7080
+ function generateIntervalTicks(range, unit) {
7081
+ if (!Number.isFinite(unit) || unit <= 0 || range.logScale) {
7082
+ return [];
7083
+ }
7084
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-12;
7085
+ const first2 = Math.ceil((range.min - tolerance) / unit);
7086
+ const last = Math.floor((range.max + tolerance) / unit);
7087
+ const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
7088
+ return Array.from({ length: count }, (_, index) => (first2 + index) * unit);
7089
+ }
7090
+ function generateAxisTicks(range, axis, defaultIntervals) {
7091
+ if (range.logScale && range.logBase) {
7092
+ return generateLogTicks(range);
7093
+ }
7094
+ const explicit = generateIntervalTicks(range, axis?.majorUnit ?? 0);
7095
+ if (explicit.length > 0) {
7096
+ return explicit;
7097
+ }
7098
+ const automatic = generateIntervalTicks(range, range.majorUnit ?? 0);
7099
+ if (automatic.length > 0) {
7100
+ return automatic;
7101
+ }
7102
+ return Array.from(
7103
+ { length: defaultIntervals + 1 },
7104
+ (_, index) => range.min + range.span / defaultIntervals * index
7105
+ );
7106
+ }
7107
+ function generateMinorAxisTicks(range, axis) {
7108
+ const minor = generateIntervalTicks(range, axis?.minorUnit ?? 0);
7109
+ if (minor.length === 0) {
7110
+ return [];
7111
+ }
7112
+ const majorUnit = axis?.majorUnit;
7113
+ if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
7114
+ return minor;
7115
+ }
7116
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-10;
7117
+ return minor.filter(
7118
+ (value) => Math.abs(value / majorUnit - Math.round(value / majorUnit)) > tolerance
7119
+ );
7120
+ }
7121
+
7122
+ // chart/render/chart-view-axes.ts
7123
+ function chartAxisRatio(value, scale, axis) {
7124
+ const range = axis?.range;
7125
+ const ratio = range?.logScale ? Math.log(Math.max(value, range.min) / range.min) / Math.log(range.max / range.min) : (value - scale.min) / (scale.max - scale.min || 1);
7126
+ return range?.reverseOrder ? 1 - ratio : ratio;
7127
+ }
7128
+ function chartAxisLabels(axis) {
7129
+ return axis?.source.deleted !== true && axis?.source.tickLabelPosition !== "none";
7130
+ }
7131
+ function options(axis) {
7132
+ return {
7133
+ ...axis.scaling,
7134
+ ...axis.scaling.logBase === void 0 ? {} : { logScale: true },
7135
+ ...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
7136
+ ...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
7137
+ };
7138
+ }
7139
+ function applyChartAxes(model, chart, color) {
7140
+ if (!chart.axes?.length) return;
7141
+ const axes = chart.axes;
7142
+ const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
7143
+ const candidates = linked.length ? linked : axes;
7144
+ const xy = model.type === "scatter" || model.type === "bubble";
7145
+ const value = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
7146
+ const category = candidates.find(
7147
+ (axis) => xy ? axis.kind === "val" && axis !== value : axis.kind === "cat" || axis.kind === "date"
7148
+ );
7149
+ const secondary = axes.find((axis) => axis.kind === "val" && axis !== value && axis !== category);
7150
+ const paint2 = (shape) => {
7151
+ const ln = shape?.line;
7152
+ const fill = ln?.fill;
7153
+ const resolved = fill?.kind === "none" ? "none" : color(fill?.kind === "solid" ? fill.color : void 0);
7154
+ return {
7155
+ ...resolved === void 0 ? {} : { color: resolved },
7156
+ ...ln?.widthEmu === void 0 ? {} : { width: ln.widthEmu / EMU_PER_PIXEL },
7157
+ ...ln?.dash === void 0 ? {} : { dash: ln.dash }
7158
+ };
7159
+ };
7160
+ const bind = (axis, scale, values) => {
7161
+ const opts = options(axis);
7162
+ const automatic = opts.logScale ? computeLogValueRange(
7163
+ [{ values: values ?? [] }],
7164
+ opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
7165
+ ) : {
7166
+ min: scale?.min ?? 0,
7167
+ max: scale?.max ?? 1,
7168
+ span: (scale?.max ?? 1) - (scale?.min ?? 0),
7169
+ ...scale ? { majorUnit: scale.majorUnit } : {}
7170
+ };
7171
+ const logBase = automatic.logBase;
7172
+ const range = withAxisBounds(automatic, opts, logBase);
7173
+ if (scale) {
7174
+ scale.min = range.min;
7175
+ scale.max = range.max;
7176
+ scale.ticks = generateAxisTicks(range, opts, 5);
7177
+ }
7178
+ return {
7179
+ source: axis,
7180
+ range,
7181
+ minorTicks: generateMinorAxisTicks(range, opts),
7182
+ line: paint2(axis.spPr),
7183
+ majorGrid: paint2(axis.majorGridlinesSpPr),
7184
+ minorGrid: paint2(axis.minorGridlinesSpPr)
7185
+ };
7186
+ };
7187
+ const out = {};
7188
+ if (value)
7189
+ out.value = bind(
7190
+ value,
7191
+ model.valueAxis,
7192
+ [
7193
+ ...model.series,
7194
+ ...model.extraGroups?.filter((g2) => !g2.secondary).flatMap((g2) => g2.series) ?? []
7195
+ ].flatMap((s2) => s2.values)
7196
+ );
7197
+ if (category)
7198
+ out.category = bind(
7199
+ category,
7200
+ model.xAxis ?? {
7201
+ min: 0,
7202
+ max: Math.max(1, model.categories.length - 1),
7203
+ majorUnit: 1,
7204
+ ticks: []
7205
+ },
7206
+ model.series.flatMap((s2) => s2.xValues ?? [])
7207
+ );
7208
+ if (secondary)
7209
+ out.secondary = bind(
7210
+ secondary,
7211
+ model.secondaryAxis,
7212
+ model.extraGroups?.filter((g2) => g2.secondary).flatMap((g2) => g2.series.flatMap((s2) => s2.values))
7213
+ );
7214
+ model.axes = out;
7215
+ }
7216
+
6619
7217
  // chart/render/chart-view-analysis.ts
6620
7218
  function strokeOf(line3, fallback, resolve) {
6621
7219
  if (line3?.fill?.kind === "none") return void 0;
@@ -6665,15 +7263,15 @@ function seriesName(series, index, evaluateRef) {
6665
7263
  const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
6666
7264
  return fromRef || series.name || `Series${index + 1}`;
6667
7265
  }
6668
- function seriesContext(chart, theme, options) {
7266
+ function seriesContext(chart, theme, options2) {
6669
7267
  const scheme = chartColorScheme(theme);
6670
7268
  const resolver = { scheme: (name) => scheme[name] };
6671
7269
  return {
6672
7270
  theme,
6673
7271
  scheme,
6674
7272
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
6675
- evaluateRef: options.evaluateRef ?? (() => []),
6676
- seriesColor: options.seriesColor,
7273
+ evaluateRef: options2.evaluateRef ?? (() => []),
7274
+ seriesColor: options2.seriesColor,
6677
7275
  drawingColor: (color) => color && drawingColorCss(resolveDrawingColor(color, resolver, { transformOrder: "document" })),
6678
7276
  gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
6679
7277
  fill,
@@ -6699,7 +7297,11 @@ function seriesView(ctx, s2, index, total, categoriesOf) {
6699
7297
  })
6700
7298
  );
6701
7299
  if (Object.keys(points).length) view.pointGradients = points;
6702
- Object.assign(view, analysisView(s2, color, ctx.drawingColor));
7300
+ Object.assign(
7301
+ view,
7302
+ analysisView(s2, color, ctx.drawingColor),
7303
+ seriesMarkerViews(s2, ctx.drawingColor)
7304
+ );
6703
7305
  return view;
6704
7306
  }
6705
7307
 
@@ -6999,11 +7601,11 @@ function histogramView(chart, model) {
6999
7601
  const first2 = model.series[0];
7000
7602
  if (!first2) return;
7001
7603
  const raw2 = first2.values.map((v) => v ?? Number.NaN);
7002
- const options = chart.histogram ?? {};
7003
- const bins = options.aggregateByCategory ? aggregateByCategory(
7604
+ const options2 = chart.histogram ?? {};
7605
+ const bins = options2.aggregateByCategory ? aggregateByCategory(
7004
7606
  first2.values.map((v) => v ?? 0),
7005
7607
  model.categories
7006
- ) : computeHistogramBins(raw2, options, formatAxisValue);
7608
+ ) : computeHistogramBins(raw2, options2, formatAxisValue);
7007
7609
  model.categories = bins.map((bin) => bin.label);
7008
7610
  first2.values = bins.map((bin) => bin.value);
7009
7611
  model.barGapWidth = 0;
@@ -7027,11 +7629,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
7027
7629
  "treemap",
7028
7630
  "sunburst"
7029
7631
  ]);
7030
- function chartSummaryView(chart, theme, options = {}) {
7632
+ function chartSummaryView(chart, theme, options2 = {}) {
7031
7633
  const type = chart.chartType;
7032
7634
  const radial = type === "pie" || type === "doughnut";
7033
7635
  const byPoint = radial || type === "treemap" || type === "sunburst";
7034
- const ctx = seriesContext(chart, theme, options);
7636
+ const ctx = seriesContext(chart, theme, options2);
7035
7637
  const { palette, scheme, drawingColor } = ctx;
7036
7638
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
7037
7639
  const rawCategories = [];
@@ -7117,6 +7719,7 @@ function chartSummaryView(chart, theme, options = {}) {
7117
7719
  else if (!byPoint) model.valueAxis = valueAxis(model);
7118
7720
  applyDataLabels(model, chart.series, extra);
7119
7721
  chartExtraAxes(model);
7722
+ applyChartAxes(model, chart, ctx.drawingColor);
7120
7723
  return model;
7121
7724
  }
7122
7725
 
@@ -7124,15 +7727,13 @@ function chartSummaryView(chart, theme, options = {}) {
7124
7727
  function cartesianAxes(model, area, out) {
7125
7728
  const scale = model.valueAxis;
7126
7729
  if (!scale) return void 0;
7127
- const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
7730
+ const labels = scale.ticks.map((t) => axisTickText(t, model.axes?.value, scale.percent));
7128
7731
  const valueAttrs = chartTextAttributes(model, "valueAxis");
7129
7732
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
7130
7733
  const valueSize = valueAttrs.size ?? 10;
7131
7734
  const categorySize = categoryAttrs.size ?? 10;
7132
- const grid = chartStroke(model, "gridlineMajor");
7133
- const axis = chartStroke(model, "categoryAxis");
7134
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
7135
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
7735
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
7736
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
7136
7737
  const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
7137
7738
  const horizontal = model.horizontal;
7138
7739
  const cats = Math.max(1, model.categories.length);
@@ -7141,7 +7742,7 @@ function cartesianAxes(model, area, out) {
7141
7742
  Math.max(...model.categories.map((c2) => textWidth(c2, categorySize)), 8) + 6
7142
7743
  );
7143
7744
  const second = horizontal ? void 0 : model.secondaryAxis;
7144
- const secondLabels = second?.ticks.map((t) => formatAxisValue(t, second.percent)) ?? [];
7745
+ const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
7145
7746
  const secondW = second ? valueLabels ? Math.max(...secondLabels.map((l) => textWidth(l, valueSize)), 8) + 8 : 4 : 0;
7146
7747
  const plot = horizontal ? {
7147
7748
  x: area.x + catW,
@@ -7154,29 +7755,47 @@ function cartesianAxes(model, area, out) {
7154
7755
  w: Math.max(1, area.w - labelW - 4 - secondW),
7155
7756
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
7156
7757
  };
7157
- const span = scale.max - scale.min || 1;
7158
- const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
7758
+ const value = horizontal ? (v) => plot.x + chartAxisRatio(v, scale, model.axes?.value) * plot.w : (v) => plot.y + plot.h - chartAxisRatio(v, scale, model.axes?.value) * plot.h;
7159
7759
  const bandSize = (horizontal ? plot.h : plot.w) / cats;
7160
- const band = horizontal ? (i2) => plot.y + plot.h - bandSize * (i2 + 0.5) : (i2) => plot.x + bandSize * (i2 + 0.5);
7760
+ const index = (i2) => model.axes?.category?.range.reverseOrder ? cats - 1 - i2 : i2;
7761
+ const band = horizontal ? (i2) => plot.y + plot.h - bandSize * (index(i2) + 0.5) : (i2) => plot.x + bandSize * (index(i2) + 0.5);
7161
7762
  out.push(chartAreaRect(model, "plotArea", plot));
7763
+ out.push(axisGridlines(model, model.axes?.value, scale.ticks, value, plot, horizontal));
7764
+ if (model.axes?.category?.source.majorGridlines || model.axes?.category?.source.minorGridlines)
7765
+ out.push(
7766
+ axisGridlines(
7767
+ model,
7768
+ model.axes.category,
7769
+ model.categories.map((_, i2) => i2),
7770
+ band,
7771
+ plot,
7772
+ !horizontal
7773
+ )
7774
+ );
7162
7775
  scale.ticks.forEach((t, i2) => {
7163
7776
  const p = value(t);
7164
7777
  const label = labels[i2] ?? "";
7165
7778
  if (horizontal) {
7166
- out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
7167
7779
  if (valueLabels)
7168
7780
  out.push(
7169
7781
  text2(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
7170
7782
  );
7171
7783
  } else {
7172
- out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
7173
7784
  if (valueLabels)
7174
7785
  out.push(text2(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
7175
7786
  }
7176
7787
  });
7177
- const zero = value(Math.min(Math.max(0, scale.min), scale.max));
7178
- if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
7179
- else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
7788
+ const source = model.axes?.value?.source;
7789
+ const crossing = source?.crosses === "max" ? scale.max : source?.crosses === "min" ? scale.min : source?.crossesAt ?? 0;
7790
+ const zero = value(Math.min(Math.max(crossing, scale.min), scale.max));
7791
+ if (horizontal)
7792
+ out.push(
7793
+ axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
7794
+ );
7795
+ else
7796
+ out.push(
7797
+ axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
7798
+ );
7180
7799
  const step = Math.max(
7181
7800
  1,
7182
7801
  Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
@@ -7201,20 +7820,23 @@ function cartesianAxes(model, area, out) {
7201
7820
  });
7202
7821
  const frame2 = { plot, value, band, bandSize };
7203
7822
  if (second) {
7204
- const secondSpan = second.max - second.min || 1;
7205
- frame2.secondary = (v) => plot.y + plot.h - (v - second.min) / secondSpan * plot.h;
7206
- const secondAxis = chartStroke(model, "valueAxis");
7823
+ frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
7207
7824
  out.push(
7208
- line(
7825
+ axisLine(
7826
+ model,
7827
+ model.axes?.secondary,
7828
+ "valueAxis",
7209
7829
  plot.x + plot.w,
7210
7830
  plot.y,
7211
7831
  plot.x + plot.w,
7212
- plot.y + plot.h,
7213
- secondAxis.color,
7214
- secondAxis.width
7832
+ plot.y + plot.h
7215
7833
  )
7216
7834
  );
7217
- if (valueLabels)
7835
+ if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
7836
+ out.push(
7837
+ axisGridlines(model, model.axes.secondary, second.ticks, frame2.secondary, plot, false)
7838
+ );
7839
+ if (chartAxisLabels(model.axes?.secondary))
7218
7840
  second.ticks.forEach(
7219
7841
  (t, i2) => out.push(
7220
7842
  text2(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i2] ?? "", {
@@ -7258,18 +7880,19 @@ function linesAndAreas(model, frame2, out) {
7258
7880
  index: i2,
7259
7881
  x: frame2.band(i2),
7260
7882
  y: frame2.value(top),
7261
- radius: area ? 0 : 3
7883
+ radius: area ? 0 : chartMarkerRadius(s2, i2, 2.5)
7262
7884
  });
7263
7885
  lower.push([frame2.band(i2), frame2.value(below2)]);
7264
7886
  });
7265
7887
  layers2.push({
7888
+ series: s2,
7266
7889
  points,
7267
7890
  lower,
7268
7891
  color: s2.color,
7269
7892
  filter: s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""
7270
7893
  });
7271
7894
  });
7272
- for (const { points, lower, color, filter } of area ? [...layers2].reverse() : layers2) {
7895
+ for (const { points, lower, color, filter, series } of area ? [...layers2].reverse() : layers2) {
7273
7896
  if (area) {
7274
7897
  const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7275
7898
  out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
@@ -7288,9 +7911,9 @@ function linesAndAreas(model, frame2, out) {
7288
7911
  else segment2.push(`${n(x)},${n(y)}`);
7289
7912
  }
7290
7913
  flush();
7291
- for (const [x, y] of points)
7292
- if (!Number.isNaN(x))
7293
- out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
7914
+ points.forEach(([x, y], index) => {
7915
+ if (!Number.isNaN(x)) out.push(chartSeriesMarkerSvg(series, index, x, y, 2.5));
7916
+ });
7294
7917
  }
7295
7918
  pointLabels(model, marks, out);
7296
7919
  }
@@ -7300,16 +7923,14 @@ function scatter(model, area, out) {
7300
7923
  const ys = model.valueAxis;
7301
7924
  const xs = model.xAxis;
7302
7925
  if (!ys || !xs) return;
7303
- const yLabels = ys.ticks.map((t) => formatAxisValue(t));
7926
+ const yLabels = ys.ticks.map((t) => axisTickText(t, model.axes?.value));
7304
7927
  const valueAttrs = chartTextAttributes(model, "valueAxis");
7305
7928
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
7306
7929
  const valueSize = valueAttrs.size ?? 10;
7307
7930
  const categorySize = categoryAttrs.size ?? 10;
7308
- const grid = chartStroke(model, "gridlineMajor");
7309
7931
  const xAxis = chartStroke(model, "categoryAxis");
7310
- const yAxis = chartStroke(model, "valueAxis");
7311
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
7312
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
7932
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
7933
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
7313
7934
  const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
7314
7935
  const plot = {
7315
7936
  x: area.x + labelW,
@@ -7329,17 +7950,24 @@ function scatter(model, area, out) {
7329
7950
  s2.values.forEach((_, i2) => {
7330
7951
  reach = Math.max(reach, radiusOf(s2.sizes?.[i2] ?? void 0) ?? 0);
7331
7952
  });
7332
- const widen = (s2, length) => {
7953
+ const widen = (s2, length, axis) => {
7954
+ if (axis?.range.logScale) return s2;
7333
7955
  const pad2 = reach * (s2.max - s2.min || 1) / Math.max(1, length - 2 * reach);
7334
- return { ...s2, min: s2.min - pad2, max: s2.max + pad2 };
7956
+ return {
7957
+ ...s2,
7958
+ min: axis?.source.scaling.min === void 0 ? s2.min - pad2 : s2.min,
7959
+ max: axis?.source.scaling.max === void 0 ? s2.max + pad2 : s2.max
7960
+ };
7335
7961
  };
7336
- const xView = widen(xs, plot.w);
7337
- const yView = widen(ys, plot.h);
7338
- const px3 = (v) => plot.x + (v - xView.min) / (xView.max - xView.min || 1) * plot.w;
7339
- const py = (v) => plot.y + plot.h - (v - yView.min) / (yView.max - yView.min || 1) * plot.h;
7962
+ const xView = widen(xs, plot.w, model.axes?.category);
7963
+ const yView = widen(ys, plot.h, model.axes?.value);
7964
+ const px3 = (v) => plot.x + chartAxisRatio(v, xView, model.axes?.category) * plot.w;
7965
+ const py = (v) => plot.y + plot.h - chartAxisRatio(v, yView, model.axes?.value) * plot.h;
7340
7966
  out.push(chartAreaRect(model, "plotArea", plot));
7967
+ out.push(axisGridlines(model, model.axes?.value, ys.ticks, py, plot, false));
7968
+ if (model.axes?.category)
7969
+ out.push(axisGridlines(model, model.axes.category, xs.ticks, px3, plot, true));
7341
7970
  ys.ticks.forEach((t, i2) => {
7342
- out.push(line(plot.x, py(t), plot.x + plot.w, py(t), grid.color, grid.width));
7343
7971
  if (valueLabels)
7344
7972
  out.push(
7345
7973
  text2(plot.x - 4, py(t) + valueSize * 0.3, yLabels[i2] ?? "", {
@@ -7349,19 +7977,30 @@ function scatter(model, area, out) {
7349
7977
  );
7350
7978
  });
7351
7979
  for (const t of xs.ticks) {
7352
- out.push(line(px3(t), plot.y + plot.h, px3(t), plot.y + plot.h + 3, xAxis.color, xAxis.width));
7980
+ if (!model.axes?.category?.source.deleted)
7981
+ out.push(line(px3(t), plot.y + plot.h, px3(t), plot.y + plot.h + 3, xAxis.color, xAxis.width));
7353
7982
  if (categoryLabels)
7354
7983
  out.push(
7355
- text2(px3(t), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
7984
+ text2(px3(t), plot.y + plot.h + categorySize + 3, axisTickText(t, model.axes?.category), {
7356
7985
  anchor: "middle",
7357
7986
  ...categoryAttrs
7358
7987
  })
7359
7988
  );
7360
7989
  }
7361
7990
  out.push(
7362
- line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
7991
+ axisLine(
7992
+ model,
7993
+ model.axes?.category,
7994
+ "categoryAxis",
7995
+ plot.x,
7996
+ plot.y + plot.h,
7997
+ plot.x + plot.w,
7998
+ plot.y + plot.h
7999
+ )
8000
+ );
8001
+ out.push(
8002
+ axisLine(model, model.axes?.value, "valueAxis", plot.x, plot.y, plot.x, plot.y + plot.h)
7363
8003
  );
7364
- out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
7365
8004
  const marks = [];
7366
8005
  for (const [si, s2] of model.series.entries())
7367
8006
  s2.values.forEach((v, i2) => {
@@ -7370,8 +8009,8 @@ function scatter(model, area, out) {
7370
8009
  const filter = s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : "";
7371
8010
  const fill = s2.pointColors?.[i2] ?? s2.color;
7372
8011
  if (!bubble) {
7373
- out.push(`<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter}/>`);
7374
- marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: 3 });
8012
+ out.push(chartSeriesMarkerSvg(s2, i2, px3(x), py(v)));
8013
+ marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: chartMarkerRadius(s2, i2) });
7375
8014
  return;
7376
8015
  }
7377
8016
  const r = radiusOf(s2.sizes?.[i2] ?? void 0);
@@ -7591,32 +8230,37 @@ function radarSvg(model, area) {
7591
8230
  const valueSize = valueAttrs.size ?? 9;
7592
8231
  const categorySize = categoryAttrs.size ?? 10;
7593
8232
  const grid = chartStroke(model, "gridlineMajor");
7594
- const axis = chartStroke(model, "categoryAxis");
7595
8233
  const cx2 = area.x + area.w / 2;
7596
8234
  const cy = area.y + area.h / 2 + 4;
7597
8235
  const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
7598
8236
  const angle = (i2) => i2 / count * Math.PI * 2;
7599
- const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
8237
+ const r = (v) => chartAxisRatio(v, scale, model.axes?.value) * radius;
7600
8238
  const labelEvery = Math.max(
7601
8239
  1,
7602
8240
  Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
7603
8241
  );
7604
8242
  for (const [k, t] of scale.ticks.entries()) {
7605
8243
  const ring = Array.from({ length: count }, (_, i2) => polar(cx2, cy, r(t), angle(i2))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7606
- out.push(
7607
- `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
7608
- );
7609
- if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
8244
+ if (!model.axes?.value || model.axes.value.source.majorGridlines)
8245
+ out.push(
8246
+ `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
8247
+ );
8248
+ if (chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
7610
8249
  out.push(
7611
- text2(cx2 + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
8250
+ text2(
8251
+ cx2 + 3,
8252
+ cy - r(t) + valueSize * 0.3,
8253
+ axisTickText(t, model.axes?.value, scale.percent),
8254
+ valueAttrs
8255
+ )
7612
8256
  );
7613
8257
  }
7614
8258
  model.categories.forEach((c2, i2) => {
7615
8259
  const [x, y] = polar(cx2, cy, radius, angle(i2));
7616
- out.push(line(cx2, cy, x, y, axis.color, axis.width));
8260
+ out.push(axisLine(model, model.axes?.category, "categoryAxis", cx2, cy, x, y));
7617
8261
  const [lx, ly] = polar(cx2, cy, radius + 10, angle(i2));
7618
8262
  const anchor = Math.abs(lx - cx2) < 2 ? "middle" : lx > cx2 ? "start" : "end";
7619
- if (model.appearance?.categoryAxis?.labelsVisible !== false)
8263
+ if (chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false)
7620
8264
  out.push(
7621
8265
  text2(lx, ly + categorySize * 0.3, fit(c2, area.w / 4, categorySize), {
7622
8266
  anchor,
@@ -7627,7 +8271,13 @@ function radarSvg(model, area) {
7627
8271
  const marks = [];
7628
8272
  for (const s2 of model.series) {
7629
8273
  const vertices = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2)));
7630
- vertices.forEach(([x, y], i2) => marks.push({ series: s2, index: i2, x, y, radius: 3 }));
8274
+ vertices.forEach(([x, y], i2) => {
8275
+ if (s2.values[i2] === null) return;
8276
+ const markerSeries = s2;
8277
+ if (markerSeries.marker || markerSeries.pointMarkers)
8278
+ out.push(chartSeriesMarkerSvg(s2, i2, x, y));
8279
+ marks.push({ series: s2, index: i2, x, y, radius: chartMarkerRadius(s2, i2) });
8280
+ });
7631
8281
  const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7632
8282
  out.push(
7633
8283
  `<polygon points="${points}" fill="none" stroke="${s2.color}" stroke-width="2"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
@@ -7724,33 +8374,33 @@ var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
7724
8374
  function cssFont(attrs) {
7725
8375
  return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
7726
8376
  }
7727
- function chartFontMetrics(attrs, options) {
7728
- const metrics = options.measureFont?.(cssFont(attrs));
8377
+ function chartFontMetrics(attrs, options2) {
8378
+ const metrics = options2.measureFont?.(cssFont(attrs));
7729
8379
  return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
7730
8380
  }
7731
- function chartTextWidth(content2, attrs, options) {
7732
- const width = options.measureText?.(content2, cssFont(attrs));
8381
+ function chartTextWidth(content2, attrs, options2) {
8382
+ const width = options2.measureText?.(content2, cssFont(attrs));
7733
8383
  return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content2, attrs.size);
7734
8384
  }
7735
- function fitChartText(content2, maxWidth, attrs, options) {
7736
- if (!options.measureText) return fit(content2, maxWidth, attrs.size);
7737
- if (chartTextWidth(content2, attrs, options) <= maxWidth) return content2;
8385
+ function fitChartText(content2, maxWidth, attrs, options2) {
8386
+ if (!options2.measureText) return fit(content2, maxWidth, attrs.size);
8387
+ if (chartTextWidth(content2, attrs, options2) <= maxWidth) return content2;
7738
8388
  const points = [...content2];
7739
8389
  let low = 0;
7740
8390
  let high = points.length;
7741
8391
  while (low < high) {
7742
8392
  const mid = Math.ceil((low + high) / 2);
7743
- if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
8393
+ if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options2) <= maxWidth) low = mid;
7744
8394
  else high = mid - 1;
7745
8395
  }
7746
8396
  return `${points.slice(0, low).join("")}\u2026`;
7747
8397
  }
7748
8398
 
7749
8399
  // chart/render/chart-svg-legend.ts
7750
- function chartLegendSvg(model, area, frame2, options) {
8400
+ function chartLegendSvg(model, area, frame2, options2) {
7751
8401
  const automatic = [];
7752
8402
  const bounds2 = {};
7753
- const reserved = automaticLegend(model, area, automatic, options, bounds2);
8403
+ const reserved = automaticLegend(model, area, automatic, options2, bounds2);
7754
8404
  const plot = model.legendOverlay ? area : reserved;
7755
8405
  const box = bounds2.box;
7756
8406
  if (!box) return { plot, markup: "", foreground: false };
@@ -7764,11 +8414,11 @@ function chartLegendSvg(model, area, frame2, options) {
7764
8414
  const entries = legendEntries(model);
7765
8415
  const attrs = chartTextAttributes(model, "legend");
7766
8416
  const size = attrs.size ?? 10;
7767
- const font = chartFontMetrics(attrs, options);
8417
+ const font = chartFontMetrics(attrs, options2);
7768
8418
  const keySize = size / 2;
7769
8419
  const keyGap = size / 4;
7770
8420
  const widths = entries.map(
7771
- (entry3) => chartTextWidth(entry3.label, attrs, options) + keySize + keyGap
8421
+ (entry3) => chartTextWidth(entry3.label, attrs, options2) + keySize + keyGap
7772
8422
  );
7773
8423
  const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
7774
8424
  const rowWidth = horizontal ? manual.width / entries.length : manual.width;
@@ -7783,8 +8433,8 @@ function chartLegendSvg(model, area, frame2, options) {
7783
8433
  ];
7784
8434
  const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
7785
8435
  entries.forEach((entry3, i2) => {
7786
- const available = horizontal ? chartTextWidth(entry3.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
7787
- const label = fitChartText(entry3.label, available, attrs, options);
8436
+ const available = horizontal ? chartTextWidth(entry3.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
8437
+ const label = fitChartText(entry3.label, available, attrs, options2);
7788
8438
  const contentWidth = Math.min(
7789
8439
  horizontal ? widths[i2] ?? 0 : Math.max(...widths),
7790
8440
  rowWidth - size / 2
@@ -7827,7 +8477,7 @@ function legendEntries(model) {
7827
8477
  color: s2.color
7828
8478
  }));
7829
8479
  }
7830
- function automaticLegend(model, area, out, options, bounds2) {
8480
+ function automaticLegend(model, area, out, options2, bounds2) {
7831
8481
  const entries = legendEntries(model);
7832
8482
  if (!model.showLegend || entries.length === 0) return area;
7833
8483
  const pos = model.legendPosition;
@@ -7836,7 +8486,7 @@ function automaticLegend(model, area, out, options, bounds2) {
7836
8486
  const rowH = Math.max(16, size * 1.4);
7837
8487
  if (pos === "t" || pos === "b") {
7838
8488
  const widths = entries.map(
7839
- (e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
8489
+ (e) => Math.min(chartTextWidth(e.label, attrs, options2) + 20, area.w / 2)
7840
8490
  );
7841
8491
  const total = widths.reduce((a2, b) => a2 + b, 0);
7842
8492
  let x2 = area.x + Math.max(0, (area.w - total) / 2);
@@ -7853,14 +8503,14 @@ function automaticLegend(model, area, out, options, bounds2) {
7853
8503
  entries.forEach((e, i2) => {
7854
8504
  const w = widths[i2] ?? 0;
7855
8505
  out.push(rect(x2, y, 8, 8, e.color));
7856
- out.push(text2(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
8506
+ out.push(text2(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options2), attrs));
7857
8507
  x2 += w;
7858
8508
  });
7859
8509
  return pos === "t" ? { x: area.x, y: area.y + rowH + 4, w: area.w, h: area.h - rowH - 4 } : { x: area.x, y: area.y, w: area.w, h: area.h - rowH - 4 };
7860
8510
  }
7861
8511
  const width = Math.min(
7862
8512
  area.w * 0.35,
7863
- Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
8513
+ Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options2))) + 22
7864
8514
  );
7865
8515
  const height = entries.length * rowH;
7866
8516
  const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
@@ -7878,14 +8528,14 @@ function automaticLegend(model, area, out, options, bounds2) {
7878
8528
  const y = y0 + i2 * rowH;
7879
8529
  if (y + rowH > area.y + area.h + 2) return;
7880
8530
  out.push(rect(x, y + 3, 8, 8, e.color));
7881
- out.push(text2(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
8531
+ out.push(text2(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options2), attrs));
7882
8532
  });
7883
8533
  return pos === "l" ? { x: area.x + width + 8, y: area.y, w: area.w - width - 8, h: area.h } : { x: area.x, y: area.y, w: area.w - width - 8, h: area.h };
7884
8534
  }
7885
8535
 
7886
8536
  // text/wrap-styled-runs.ts
7887
8537
  var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
7888
- function wrapStyledRuns(runs, maxWidth, measure4, options = {}) {
8538
+ function wrapStyledRuns(runs, maxWidth, measure4, options2 = {}) {
7889
8539
  const groups = [];
7890
8540
  for (const [source, run2] of runs.entries()) {
7891
8541
  for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
@@ -7933,7 +8583,7 @@ function wrapStyledRuns(runs, maxWidth, measure4, options = {}) {
7933
8583
  if (line3.length && width(merged(line3, [...separator, ...group2.pieces])) > maxWidth) flush();
7934
8584
  else line3 = merged(line3, separator);
7935
8585
  spaces = [];
7936
- if (options.breakWords && wordWidth > maxWidth) {
8586
+ if (options2.breakWords && wordWidth > maxWidth) {
7937
8587
  for (const piece of group2.pieces) {
7938
8588
  for (const { segment: segment2 } of graphemes.segment(piece.text)) {
7939
8589
  const next = { ...piece, text: segment2 };
@@ -7951,11 +8601,11 @@ function wrapStyledRuns(runs, maxWidth, measure4, options = {}) {
7951
8601
  function spacing2(value, naturalHeight, fallback) {
7952
8602
  return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
7953
8603
  }
7954
- function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
8604
+ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
7955
8605
  if (!model.title) return void 0;
7956
8606
  const base = chartTextAttributes(model, "title", 14);
7957
8607
  const capacity = Math.max(1, width * 0.8 - 8);
7958
- if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
8608
+ if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options2) <= capacity)
7959
8609
  return void 0;
7960
8610
  const paragraphs = model.titleText?.paragraphs ?? [
7961
8611
  {
@@ -7991,7 +8641,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7991
8641
  "title",
7992
8642
  base.size
7993
8643
  ),
7994
- options
8644
+ options2
7995
8645
  ),
7996
8646
  { breakWords: true }
7997
8647
  );
@@ -8015,10 +8665,10 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
8015
8665
  return {
8016
8666
  ...line3,
8017
8667
  runs,
8018
- width: runs.reduce((sum, run2) => sum + chartTextWidth(run2.text, run2.attrs, options), 0),
8668
+ width: runs.reduce((sum, run2) => sum + chartTextWidth(run2.text, run2.attrs, options2), 0),
8019
8669
  size: runs.length ? Math.max(...runs.map((run2) => run2.attrs.size ?? 14)) : base.size ?? 14,
8020
8670
  fontMetrics: (runs.length ? runs.map((run2) => run2.attrs) : [base]).map(
8021
- (attrs) => chartFontMetrics(attrs, options)
8671
+ (attrs) => chartFontMetrics(attrs, options2)
8022
8672
  )
8023
8673
  };
8024
8674
  });
@@ -8056,7 +8706,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
8056
8706
  anchor: "start"
8057
8707
  }).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
8058
8708
  );
8059
- x += chartTextWidth(run2.text, run2.attrs, options);
8709
+ x += chartTextWidth(run2.text, run2.attrs, options2);
8060
8710
  }
8061
8711
  }
8062
8712
  const parent = text2(0, 0, "", { ...base, underline: false }).replace(
@@ -8082,7 +8732,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
8082
8732
  }
8083
8733
 
8084
8734
  // chart/render/chart-svg.ts
8085
- function renderChartSvg(model, width, height, options = {}) {
8735
+ function renderChartSvg(model, width, height, options2 = {}) {
8086
8736
  const paint2 = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
8087
8737
  model = paint2.model;
8088
8738
  const w = Math.max(1, width);
@@ -8096,7 +8746,7 @@ function renderChartSvg(model, width, height, options = {}) {
8096
8746
  if (paint2.defs) out.push(paint2.defs);
8097
8747
  out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h: h2 }));
8098
8748
  let area = { x: 8, y: 8, w: w - 16, h: h2 - 16 };
8099
- const richTitle = chartRichTitleSvg(model, w, options, h2);
8749
+ const richTitle = chartRichTitleSvg(model, w, options2, h2);
8100
8750
  if (richTitle) {
8101
8751
  if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
8102
8752
  else out.push(richTitle.markup);
@@ -8105,9 +8755,9 @@ function renderChartSvg(model, width, height, options = {}) {
8105
8755
  } else if (model.title) {
8106
8756
  const attrs = chartTextAttributes(model, "title", 14);
8107
8757
  const size = attrs.size ?? 14;
8108
- const label = fitChartText(model.title, w - 16, attrs, options);
8109
- const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
8110
- const font = chartFontMetrics(attrs, options);
8758
+ const label = fitChartText(model.title, w - 16, attrs, options2);
8759
+ const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options2) + 8);
8760
+ const font = chartFontMetrics(attrs, options2);
8111
8761
  const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
8112
8762
  out.push(
8113
8763
  chartAreaRect(model, "title", {
@@ -8135,7 +8785,7 @@ function renderChartSvg(model, width, height, options = {}) {
8135
8785
  out.push("</svg>");
8136
8786
  return out.join("");
8137
8787
  }
8138
- const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options);
8788
+ const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options2);
8139
8789
  area = legend.plot;
8140
8790
  if (!legend.foreground) out.push(legend.markup);
8141
8791
  if (area.w > 4 && area.h > 4) {
@@ -8182,8 +8832,8 @@ function chartSpaceKind(space3) {
8182
8832
  const type = chartSummaryFromSpace(space3).chartType;
8183
8833
  return { type, drawn: DRAWN_CHART_TYPES.has(type) };
8184
8834
  }
8185
- function renderChartSpaceSvg(space3, options) {
8186
- const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
8835
+ function renderChartSpaceSvg(space3, options2) {
8836
+ const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options2;
8187
8837
  const summary = chartSummaryFromSpace(space3, {
8188
8838
  ...formatting ? { formatting } : {},
8189
8839
  ...colorPalette !== void 0 ? { colorPalette } : {},
@@ -8192,8 +8842,8 @@ function renderChartSpaceSvg(space3, options) {
8192
8842
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
8193
8843
  return renderChartSvg(view, width, height, svg);
8194
8844
  }
8195
- function renderChartSummarySvg(summary, options) {
8196
- const { width, height, theme, fonts, ...svg } = options;
8845
+ function renderChartSummarySvg(summary, options2) {
8846
+ const { width, height, theme, fonts, ...svg } = options2;
8197
8847
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
8198
8848
  return renderChartSvg(view, width, height, svg);
8199
8849
  }
@@ -8537,7 +9187,7 @@ __export(i18n_exports, {
8537
9187
  // i18n/locale.ts
8538
9188
  var SUPPORTED_OFFICE_LOCALES = ["en", "fr", "de", "es", "zh-CN"];
8539
9189
  var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
8540
- function normalizeLocale(input, supported, fallback, options = {}) {
9190
+ function normalizeLocale(input, supported, fallback, options2 = {}) {
8541
9191
  const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
8542
9192
  const language = parts[0];
8543
9193
  if (!language) return fallback;
@@ -8546,7 +9196,7 @@ function normalizeLocale(input, supported, fallback, options = {}) {
8546
9196
  if (exact) return exact;
8547
9197
  const base = find(language);
8548
9198
  if (base) return base;
8549
- const rejected = options.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
9199
+ const rejected = options2.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
8550
9200
  if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
8551
9201
  return supported.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
8552
9202
  }
@@ -8584,12 +9234,12 @@ function interpolate2(template, params, placeholder = "single") {
8584
9234
  (match, name) => Object.prototype.hasOwnProperty.call(params, name) && params[name] !== void 0 ? String(params[name]) : match
8585
9235
  );
8586
9236
  }
8587
- function createTranslator(messages, fallbacks = [], options = {}) {
8588
- const placeholder = options.placeholder ?? "single";
9237
+ function createTranslator(messages, fallbacks = [], options2 = {}) {
9238
+ const placeholder = options2.placeholder ?? "single";
8589
9239
  return (key, params) => {
8590
9240
  let text4 = messages?.[key];
8591
9241
  for (let i2 = 0; text4 === void 0 && i2 < fallbacks.length; i2++) text4 = fallbacks[i2]?.[key];
8592
- return interpolate2(text4 ?? options.missing?.(key) ?? key, params, placeholder);
9242
+ return interpolate2(text4 ?? options2.missing?.(key) ?? key, params, placeholder);
8593
9243
  };
8594
9244
  }
8595
9245
  function translateOr(translate, key, fallback, params) {
@@ -21659,9 +22309,9 @@ function evaluateCondition(condition, point, lookup) {
21659
22309
  // diagram/engine/pres-tree.ts
21660
22310
  var MAX_DEPTH = 96;
21661
22311
  var MAX_NODES = 1e5;
21662
- function lookupVariable(node, name, options) {
21663
- if (name === "dir" && options.direction) {
21664
- return options.direction;
22312
+ function lookupVariable(node, name, options2) {
22313
+ if (name === "dir" && options2.direction) {
22314
+ return options2.direction;
21665
22315
  }
21666
22316
  let current = node;
21667
22317
  while (current) {
@@ -21775,8 +22425,8 @@ function buildNode(def, point, parent, state) {
21775
22425
  state.depth--;
21776
22426
  return node;
21777
22427
  }
21778
- function buildPresentationTree(def, doc, options = {}) {
21779
- return buildNode(def.root, doc, void 0, { def, options, counter: 0, depth: 0 });
22428
+ function buildPresentationTree(def, doc, options2 = {}) {
22429
+ return buildNode(def.root, doc, void 0, { def, options: options2, counter: 0, depth: 0 });
21780
22430
  }
21781
22431
 
21782
22432
  // diagram/engine/preferred-size.ts
@@ -30246,33 +30896,33 @@ function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
30246
30896
  }
30247
30897
 
30248
30898
  // diagram/hierarchy/smartart-hierarchy-hanging.ts
30249
- function placeAssistants(hc, x, parentBottom, assistants, options, cursor) {
30899
+ function placeAssistants(hc, x, parentBottom, assistants, options2, cursor) {
30250
30900
  for (const assistant of assistants) {
30251
30901
  const y = cursor.y;
30252
- cursor.y += hc.boxH + options.vGap;
30902
+ cursor.y += hc.boxH + options2.vGap;
30253
30903
  const width = hc.boxW * 0.85;
30254
30904
  const height = hc.boxH * 0.85;
30255
30905
  pushNode(hc, assistant.node, x, y, width, height);
30256
30906
  stubConnector(hc, assistant.node.id, x + hc.boxH / 2, parentBottom, x + width / 2, y);
30257
30907
  }
30258
30908
  }
30259
- function placeHangingTree(hc, t, x, options, cursor, size, level3 = 0) {
30909
+ function placeHangingTree(hc, t, x, options2, cursor, size, level3 = 0) {
30260
30910
  const y = cursor.y;
30261
30911
  const boxW = size?.w ?? hc.boxW;
30262
30912
  const boxH = size?.h ?? hc.boxH;
30263
- const align = options.columnAlign;
30913
+ const align = options2.columnAlign;
30264
30914
  const placeX = align ? align.side === "right" ? align.edgeX - boxW : align.edgeX : x;
30265
- cursor.y += boxH + options.vGap;
30915
+ cursor.y += boxH + options2.vGap;
30266
30916
  pushNode(hc, t.node, placeX, y, boxW, boxH);
30267
- const { assistants, normal } = partitionChildren(t, options.orgChart);
30268
- placeAssistants(hc, placeX, y + boxH, assistants, options, cursor);
30917
+ const { assistants, normal } = partitionChildren(t, options2.orgChart);
30918
+ placeAssistants(hc, placeX, y + boxH, assistants, options2, cursor);
30269
30919
  if (normal.length === 0) {
30270
30920
  return;
30271
30921
  }
30272
- if (options.foldDeeperGenerations && level3 >= 1) {
30922
+ if (options2.foldDeeperGenerations && level3 >= 1) {
30273
30923
  return;
30274
30924
  }
30275
- const childX = align ? placeX : options.direction === "left" ? x - options.indent : x + options.indent;
30925
+ const childX = align ? placeX : options2.direction === "left" ? x - options2.indent : x + options2.indent;
30276
30926
  for (const child3 of normal) {
30277
30927
  const childY = cursor.y;
30278
30928
  elbowConnector(
@@ -30284,13 +30934,13 @@ function placeHangingTree(hc, t, x, options, cursor, size, level3 = 0) {
30284
30934
  childY,
30285
30935
  child3.node.id
30286
30936
  );
30287
- placeHangingTree(hc, child3, childX, options, cursor, void 0, level3 + 1);
30937
+ placeHangingTree(hc, child3, childX, options2, cursor, void 0, level3 + 1);
30288
30938
  }
30289
30939
  }
30290
- function placeHangingForest(hc, roots2, startX, startY, options, rootSize) {
30940
+ function placeHangingForest(hc, roots2, startX, startY, options2, rootSize) {
30291
30941
  const cursor = { y: startY };
30292
30942
  for (const root of roots2) {
30293
- placeHangingTree(hc, root, startX, options, cursor, rootSize);
30943
+ placeHangingTree(hc, root, startX, options2, cursor, rootSize);
30294
30944
  }
30295
30945
  }
30296
30946
 
@@ -30924,7 +31574,7 @@ function planFan(childCount, perRow, siblingCxs) {
30924
31574
  }
30925
31575
  return { columns: siblingCxs, overflow: childCount - siblingCxs.length };
30926
31576
  }
30927
- function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options, placeAtFn) {
31577
+ function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options2, placeAtFn) {
30928
31578
  const fanCy = (level3 + 1) * cellH + cellH / 2;
30929
31579
  const fanned = normal.slice(0, plan.columns.length);
30930
31580
  for (let i2 = 0; i2 < fanned.length; i2++) {
@@ -30939,9 +31589,9 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, opti
30939
31589
  fanCy - hc.boxH / 2,
30940
31590
  child3.node.id
30941
31591
  );
30942
- placeAtFn(hc, child3, childCx, fanCy, 0, 1, level3 + 1, cellW, cellH, options);
31592
+ placeAtFn(hc, child3, childCx, fanCy, 0, 1, level3 + 1, cellW, cellH, options2);
30943
31593
  }
30944
- if (plan.overflow <= 0 || !options.hangingPlacer) {
31594
+ if (plan.overflow <= 0 || !options2.hangingPlacer) {
30945
31595
  return;
30946
31596
  }
30947
31597
  const remainder = normal.slice(plan.columns.length);
@@ -30959,12 +31609,12 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, opti
30959
31609
  child3.node.id
30960
31610
  );
30961
31611
  }
30962
- options.hangingPlacer(hc, remainder, anchorX, anchorY);
31612
+ options2.hangingPlacer(hc, remainder, anchorX, anchorY);
30963
31613
  }
30964
31614
 
30965
31615
  // diagram/hierarchy/smartart-hierarchy-standard-options.ts
30966
- function spanOf(t, options) {
30967
- return options.resolveSpan ? options.resolveSpan(t) : effectiveWidth(t, options.orgChart);
31616
+ function spanOf(t, options2) {
31617
+ return options2.resolveSpan ? options2.resolveSpan(t) : effectiveWidth(t, options2.orgChart);
30968
31618
  }
30969
31619
 
30970
31620
  // diagram/hierarchy/smartart-hierarchy-standard-rows.ts
@@ -30984,20 +31634,20 @@ function placeAssistantRow(hc, parentId, cx2, cy, assistants) {
30984
31634
  x += assistW + ASSISTANT_GAP;
30985
31635
  }
30986
31636
  }
30987
- function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options, placeChild) {
31637
+ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options2, placeChild) {
30988
31638
  const siblingCxs = [];
30989
31639
  {
30990
31640
  let offset = xOffset;
30991
31641
  for (const child3 of normal) {
30992
- const childW = spanOf(child3, options);
31642
+ const childW = spanOf(child3, options2);
30993
31643
  siblingCxs.push((offset + childW / 2) * cellW);
30994
31644
  offset += childW;
30995
31645
  }
30996
31646
  }
30997
- const cascadeShift = options.cascadeOffsetX && level3 + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
31647
+ const cascadeShift = options2.cascadeOffsetX && level3 + 1 >= options2.cascadeOffsetX.fromLevel ? options2.cascadeOffsetX.offsetPx : 0;
30998
31648
  let childOffset = xOffset;
30999
31649
  for (const child3 of normal) {
31000
- const childW = spanOf(child3, options);
31650
+ const childW = spanOf(child3, options2);
31001
31651
  const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
31002
31652
  const childCy = (level3 + 1) * cellH + cellH / 2;
31003
31653
  elbowConnector(
@@ -31019,7 +31669,7 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW
31019
31669
  level3 + 1,
31020
31670
  cellW,
31021
31671
  cellH,
31022
- options,
31672
+ options2,
31023
31673
  siblingCxs
31024
31674
  );
31025
31675
  childOffset += childW;
@@ -31042,9 +31692,9 @@ function wrappedGroupSlotCount(group2, orgChart) {
31042
31692
  }
31043
31693
  return group2.members.reduce((sum, m) => sum + effectiveWidth(m, orgChart), 0);
31044
31694
  }
31045
- function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options, placeAtFn) {
31046
- const groups = planWrappedGroups(normal, options.perRow, options.orgChart);
31047
- const totalSlots = groups.reduce((sum, g2) => sum + wrappedGroupSlotCount(g2, options.orgChart), 0);
31695
+ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2, placeAtFn) {
31696
+ const groups = planWrappedGroups(normal, options2.perRow, options2.orgChart);
31697
+ const totalSlots = groups.reduce((sum, g2) => sum + wrappedGroupSlotCount(g2, options2.orgChart), 0);
31048
31698
  const totalW = spanW * cellW;
31049
31699
  const leftX = xOffset * cellW;
31050
31700
  const unitW = totalW / Math.max(1, totalSlots);
@@ -31064,7 +31714,7 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
31064
31714
  level3,
31065
31715
  cellW,
31066
31716
  cellH,
31067
- options,
31717
+ options2,
31068
31718
  placeAtFn
31069
31719
  ) : placeColumnGroup(
31070
31720
  hc,
@@ -31079,24 +31729,24 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
31079
31729
  cellW,
31080
31730
  cellH,
31081
31731
  level3,
31082
- options,
31732
+ options2,
31083
31733
  placeAtFn
31084
31734
  );
31085
31735
  }
31086
31736
  }
31087
- function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level3, cellW, cellH, options, placeAtFn) {
31737
+ function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level3, cellW, cellH, options2, placeAtFn) {
31088
31738
  let cursor = slot2;
31089
31739
  for (const child3 of group2.members) {
31090
- const childW = effectiveWidth(child3, options.orgChart);
31740
+ const childW = effectiveWidth(child3, options2.orgChart);
31091
31741
  const childCx = leftX + unitW * (cursor + childW / 2);
31092
31742
  elbowConnector(hc, parentId, cx2, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2, child3.node.id);
31093
31743
  const virtualOffset = childCx / cellW - childW / 2;
31094
- placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level3 + 1, cellW, cellH, options);
31744
+ placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level3 + 1, cellW, cellH, options2);
31095
31745
  cursor += childW;
31096
31746
  }
31097
31747
  return cursor;
31098
31748
  }
31099
- function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level3, options, placeAtFn) {
31749
+ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level3, options2, placeAtFn) {
31100
31750
  const groupCx = leftX + unitW * (slot2 + 0.5);
31101
31751
  const subRowH = cellH / group2.members.length;
31102
31752
  let fromId = parentId;
@@ -31106,9 +31756,9 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
31106
31756
  const child3 = group2.members[i2];
31107
31757
  const childCy = rowCy + subRowH * i2;
31108
31758
  elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2, child3.node.id);
31109
- const childW = effectiveWidth(child3, options.orgChart);
31759
+ const childW = effectiveWidth(child3, options2.orgChart);
31110
31760
  const virtualOffset = groupCx / cellW - childW / 2;
31111
- placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level3 + 1, cellW, cellH, options);
31761
+ placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level3 + 1, cellW, cellH, options2);
31112
31762
  fromId = child3.node.id;
31113
31763
  fromX = groupCx;
31114
31764
  fromY = childCy + hc.boxH / 2;
@@ -31117,7 +31767,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
31117
31767
  }
31118
31768
 
31119
31769
  // diagram/hierarchy/smartart-hierarchy-standard.ts
31120
- function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options) {
31770
+ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options2) {
31121
31771
  placeFlatChildren(
31122
31772
  hc,
31123
31773
  parentId,
@@ -31128,11 +31778,11 @@ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cell
31128
31778
  level3,
31129
31779
  cellW,
31130
31780
  cellH,
31131
- options,
31781
+ options2,
31132
31782
  placeAt
31133
31783
  );
31134
31784
  }
31135
- function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options) {
31785
+ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2) {
31136
31786
  placeWrappedChildren(
31137
31787
  hc,
31138
31788
  parentId,
@@ -31144,32 +31794,32 @@ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, le
31144
31794
  level3,
31145
31795
  cellW,
31146
31796
  cellH,
31147
- options,
31797
+ options2,
31148
31798
  placeAt
31149
31799
  );
31150
31800
  }
31151
- function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options, siblingCxs) {
31801
+ function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2, siblingCxs) {
31152
31802
  pushNode(hc, t.node, cx2 - hc.boxW / 2, cy - hc.boxH / 2);
31153
- const { assistants, normal } = partitionChildren(t, options.orgChart);
31803
+ const { assistants, normal } = partitionChildren(t, options2.orgChart);
31154
31804
  placeAssistantRow(hc, t.node.id, cx2, cy, assistants);
31155
31805
  if (normal.length === 0) {
31156
31806
  return;
31157
31807
  }
31158
- if (options.foldDeeperGenerations && level3 >= 1) {
31808
+ if (options2.foldDeeperGenerations && level3 >= 1) {
31159
31809
  return;
31160
31810
  }
31161
- if (options.hangingPlacer && level3 >= 1) {
31162
- const plan = planFan(normal.length, options.perRow, siblingCxs);
31811
+ if (options2.hangingPlacer && level3 >= 1) {
31812
+ const plan = planFan(normal.length, options2.perRow, siblingCxs);
31163
31813
  if (plan) {
31164
- placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options, placeAt);
31814
+ placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options2, placeAt);
31165
31815
  return;
31166
31816
  }
31167
31817
  const isSoloChainLink = !siblingCxs || siblingCxs.length === 1;
31168
31818
  if (isSoloChainLink && normal.length > 1 && spanW === normal.length) {
31169
- placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options);
31819
+ placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options2);
31170
31820
  return;
31171
31821
  }
31172
- const anchorY = cy + hc.boxH / 2 + (options.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
31822
+ const anchorY = cy + hc.boxH / 2 + (options2.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
31173
31823
  const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
31174
31824
  for (const child3 of normal) {
31175
31825
  elbowConnector(
@@ -31182,10 +31832,10 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options,
31182
31832
  child3.node.id
31183
31833
  );
31184
31834
  }
31185
- options.hangingPlacer(hc, normal, cx2 - hc.boxW / 2 + columnOffset, anchorY);
31835
+ options2.hangingPlacer(hc, normal, cx2 - hc.boxW / 2 + columnOffset, anchorY);
31186
31836
  return;
31187
31837
  }
31188
- if (Number.isFinite(options.perRow) && normal.length > options.perRow) {
31838
+ if (Number.isFinite(options2.perRow) && normal.length > options2.perRow) {
31189
31839
  placeWrappedChildren2(
31190
31840
  hc,
31191
31841
  t.node.id,
@@ -31197,18 +31847,18 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options,
31197
31847
  level3,
31198
31848
  cellW,
31199
31849
  cellH,
31200
- options
31850
+ options2
31201
31851
  );
31202
31852
  } else {
31203
- placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options);
31853
+ placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options2);
31204
31854
  }
31205
31855
  }
31206
- function placeStandardTree(hc, t, xOffset, level3, cellW, cellH, options) {
31207
- const spanW = spanOf(t, options);
31208
- const cascadeShift = options.cascadeOffsetX && level3 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
31856
+ function placeStandardTree(hc, t, xOffset, level3, cellW, cellH, options2) {
31857
+ const spanW = spanOf(t, options2);
31858
+ const cascadeShift = options2.cascadeOffsetX && level3 >= options2.cascadeOffsetX.fromLevel ? options2.cascadeOffsetX.offsetPx : 0;
31209
31859
  const cx2 = (xOffset + spanW / 2) * cellW + cascadeShift;
31210
31860
  const cy = level3 * cellH + cellH / 2;
31211
- placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options);
31861
+ placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2);
31212
31862
  }
31213
31863
 
31214
31864
  // diagram/hierarchy/smartart-hierarchy-tailed-placer.ts
@@ -32434,10 +33084,10 @@ function relativePartTarget(basePart, targetPart) {
32434
33084
  }
32435
33085
  return [...base.map(() => ".."), ...target].join("/");
32436
33086
  }
32437
- async function clonePartGraph(options) {
32438
- const { zip, sourcePart, targetPart, shouldClone } = options;
32439
- const sourceZip = options.sourceZip ?? zip;
32440
- const copies = options.copies ?? /* @__PURE__ */ new Map();
33087
+ async function clonePartGraph(options2) {
33088
+ const { zip, sourcePart, targetPart, shouldClone } = options2;
33089
+ const sourceZip = options2.sourceZip ?? zip;
33090
+ const copies = options2.copies ?? /* @__PURE__ */ new Map();
32441
33091
  copies.set(sourcePart, targetPart);
32442
33092
  const types = parseContentTypes(await sourceZip.file("[Content_Types].xml")?.async("string"));
32443
33093
  const reserved = new Set(Object.keys(zip.files));
@@ -35888,8 +36538,8 @@ function hashBytes(password, { algorithmName, saltValue, spinCount }, limits) {
35888
36538
  if (!digest || !salt || !isValidSpinCount(spinCount, limits.maxSpinCount)) return void 0;
35889
36539
  return spinPasswordHash(password, salt, spinCount ?? 0, digest);
35890
36540
  }
35891
- function hashPassword(password, options, limits = {}) {
35892
- const bytes = hashBytes(password, options, limits);
36541
+ function hashPassword(password, options2, limits = {}) {
36542
+ const bytes = hashBytes(password, options2, limits);
35893
36543
  return bytes && encodeBase64(bytes);
35894
36544
  }
35895
36545
  function verifyPasswordHash(password, hash, limits = {}) {
@@ -37309,8 +37959,8 @@ function routeCore(start, end, obstacles, padding, canvasWidth, canvasHeight) {
37309
37959
  const path2 = aStarOrthogonal(nodes, start, end, inflated);
37310
37960
  return simplifyPath(path2);
37311
37961
  }
37312
- function routeConnector(options) {
37313
- const { start, end, obstacles, canvasWidth, canvasHeight, padding = PADDING_DEFAULT } = options;
37962
+ function routeConnector(options2) {
37963
+ const { start, end, obstacles, canvasWidth, canvasHeight, padding = PADDING_DEFAULT } = options2;
37314
37964
  return routeCore(start, end, obstacles, padding, canvasWidth, canvasHeight);
37315
37965
  }
37316
37966
  function waypointsToPathData(waypoints) {
@@ -42714,18 +43364,18 @@ function snapBox(box, size) {
42714
43364
  }
42715
43365
 
42716
43366
  // geometry/align-distribute.ts
42717
- function usesSlideReference(elementCount, options) {
42718
- if (!options?.slideSize) {
43367
+ function usesSlideReference(elementCount, options2) {
43368
+ if (!options2?.slideSize) {
42719
43369
  return false;
42720
43370
  }
42721
- return options.reference === "slide" || options.reference === void 0 && elementCount === 1;
43371
+ return options2.reference === "slide" || options2.reference === void 0 && elementCount === 1;
42722
43372
  }
42723
- function resolveAlignReferenceBox(elements2, options) {
43373
+ function resolveAlignReferenceBox(elements2, options2) {
42724
43374
  if (elements2.length === 0) {
42725
43375
  return null;
42726
43376
  }
42727
- if (usesSlideReference(elements2.length, options)) {
42728
- return { minX: 0, minY: 0, maxX: options.slideSize.width, maxY: options.slideSize.height };
43377
+ if (usesSlideReference(elements2.length, options2)) {
43378
+ return { minX: 0, minY: 0, maxX: options2.slideSize.width, maxY: options2.slideSize.height };
42729
43379
  }
42730
43380
  if (elements2.length < 2) {
42731
43381
  return null;
@@ -42737,9 +43387,9 @@ function resolveAlignReferenceBox(elements2, options) {
42737
43387
  maxY: Math.max(...elements2.map((e) => e.y + e.height))
42738
43388
  };
42739
43389
  }
42740
- function alignElements(elements2, edge, options) {
43390
+ function alignElements(elements2, edge, options2) {
42741
43391
  const result = /* @__PURE__ */ new Map();
42742
- const ref = resolveAlignReferenceBox(elements2, options);
43392
+ const ref = resolveAlignReferenceBox(elements2, options2);
42743
43393
  if (!ref) {
42744
43394
  return result;
42745
43395
  }
@@ -42770,7 +43420,7 @@ function alignElements(elements2, edge, options) {
42770
43420
  }
42771
43421
  return result;
42772
43422
  }
42773
- function distributeElements(elements2, axis, options) {
43423
+ function distributeElements(elements2, axis, options2) {
42774
43424
  const result = /* @__PURE__ */ new Map();
42775
43425
  const horizontal = axis === "horizontal";
42776
43426
  const start = (e) => horizontal ? e.x : e.y;
@@ -42779,11 +43429,11 @@ function distributeElements(elements2, axis, options) {
42779
43429
  const totalSize = sorted.reduce((sum, e) => sum + size(e), 0);
42780
43430
  let cursor;
42781
43431
  let gap;
42782
- if (usesSlideReference(elements2.length, options)) {
43432
+ if (usesSlideReference(elements2.length, options2)) {
42783
43433
  if (sorted.length === 0) {
42784
43434
  return result;
42785
43435
  }
42786
- const span = horizontal ? options.slideSize.width : options.slideSize.height;
43436
+ const span = horizontal ? options2.slideSize.width : options2.slideSize.height;
42787
43437
  gap = (span - totalSize) / (sorted.length + 1);
42788
43438
  cursor = gap;
42789
43439
  } else {
@@ -42817,11 +43467,11 @@ function onlyMoved(boxes, positions) {
42817
43467
  }
42818
43468
  return result;
42819
43469
  }
42820
- function computeAlign(boxes, mode, options) {
42821
- return onlyMoved(boxes, alignElements(boxes, mode, options));
43470
+ function computeAlign(boxes, mode, options2) {
43471
+ return onlyMoved(boxes, alignElements(boxes, mode, options2));
42822
43472
  }
42823
- function computeDistribute(boxes, mode, options) {
42824
- return onlyMoved(boxes, distributeElements(boxes, mode, options));
43473
+ function computeDistribute(boxes, mode, options2) {
43474
+ return onlyMoved(boxes, distributeElements(boxes, mode, options2));
42825
43475
  }
42826
43476
 
42827
43477
  // geometry/rotation-drag.ts
@@ -42829,7 +43479,7 @@ function computeRotation(center, pointer) {
42829
43479
  const deg = Math.atan2(pointer.x - center.x, center.y - pointer.y) * (180 / Math.PI);
42830
43480
  return (deg % 360 + 360) % 360;
42831
43481
  }
42832
- function createRotationDrag(center, startPointer, startRotation, options = {}) {
43482
+ function createRotationDrag(center, startPointer, startRotation, options2 = {}) {
42833
43483
  const bearing = (pointer) => pointer.x === center.x && pointer.y === center.y ? void 0 : computeRotation(center, pointer);
42834
43484
  let startAngle = bearing(startPointer);
42835
43485
  let rotation = startRotation;
@@ -42844,7 +43494,7 @@ function createRotationDrag(center, startPointer, startRotation, options = {}) {
42844
43494
  previousAngle = angle;
42845
43495
  return rotation;
42846
43496
  }
42847
- if (options.unwrapped) {
43497
+ if (options2.unwrapped) {
42848
43498
  const delta = (angle - (previousAngle ?? angle) + 540) % 360 - 180;
42849
43499
  rotation += delta;
42850
43500
  previousAngle = angle;
@@ -43142,10 +43792,10 @@ function placeGrid(ids, size, spacing3) {
43142
43792
  height: size.get(id).height
43143
43793
  }));
43144
43794
  }
43145
- function layoutGraph(nodes, edges, style, options = {}) {
43795
+ function layoutGraph(nodes, edges, style, options2 = {}) {
43146
43796
  if (!GRAPH_LAYOUT_STYLES.includes(style)) throw new Error("Unknown graph layout style.");
43147
- const spacing3 = options.spacing ?? 0.5;
43148
- const layerSpacing = options.layerSpacing ?? spacing3;
43797
+ const spacing3 = options2.spacing ?? 0.5;
43798
+ const layerSpacing = options2.layerSpacing ?? spacing3;
43149
43799
  if (![spacing3, layerSpacing].every((value) => Number.isFinite(value) && value >= 0))
43150
43800
  throw new Error("Layout spacing must be finite and not negative.");
43151
43801
  const size = /* @__PURE__ */ new Map();
@@ -43245,7 +43895,7 @@ function space2(groups, start, size, minimumGap) {
43245
43895
  });
43246
43896
  return result;
43247
43897
  }
43248
- function autoAlignBoxes(boxes, options = {}) {
43898
+ function autoAlignBoxes(boxes, options2 = {}) {
43249
43899
  if (new Set(boxes.map((box) => box.id)).size !== boxes.length)
43250
43900
  throw new Error("Auto align box IDs must be unique.");
43251
43901
  if (!boxes.every(
@@ -43254,9 +43904,9 @@ function autoAlignBoxes(boxes, options = {}) {
43254
43904
  throw new Error("Auto align boxes must be finite.");
43255
43905
  const result = /* @__PURE__ */ new Map();
43256
43906
  if (!boxes.length) return result;
43257
- const toleranceX = options.tolerance?.x ?? median(boxes.map((box) => box.width)) / 2;
43258
- const toleranceY = options.tolerance?.y ?? median(boxes.map((box) => box.height)) / 2;
43259
- const minimumGap = options.minimumGap ?? 0;
43907
+ const toleranceX = options2.tolerance?.x ?? median(boxes.map((box) => box.width)) / 2;
43908
+ const toleranceY = options2.tolerance?.y ?? median(boxes.map((box) => box.height)) / 2;
43909
+ const minimumGap = options2.minimumGap ?? 0;
43260
43910
  const rows = clusters(boxes, (box) => box.y + box.height / 2, toleranceY);
43261
43911
  const columns = clusters(boxes, (box) => box.x + box.width / 2, toleranceX);
43262
43912
  const ys = space2(