ooxml-core 1.17.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 (137) hide show
  1. package/dist/{PptxHandler-K7GMS2ST.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
  2. package/dist/{PptxHandler-L3JPWOBN.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
  3. package/dist/{PptxHandler-U6EFO73T.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
  4. package/dist/{PresentationBuilder-XC3F3OPY.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
  5. package/dist/{PresentationBuilder-OK526SZ4.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
  6. package/dist/{PresentationBuilder-LUR6LGHU.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
  7. package/dist/automation/index.cjs +5198 -3235
  8. package/dist/automation/index.mjs +5198 -3235
  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/data-label-text.d.ts +70 -0
  18. package/dist/chart/data-label-text.d.ts.map +1 -0
  19. package/dist/chart/formatting-nodes.d.ts +6 -0
  20. package/dist/chart/formatting-nodes.d.ts.map +1 -1
  21. package/dist/chart/index.cjs +1536 -571
  22. package/dist/chart/index.d.ts +7 -0
  23. package/dist/chart/index.d.ts.map +1 -1
  24. package/dist/chart/index.mjs +1512 -572
  25. package/dist/chart/line-dash.d.ts +2 -0
  26. package/dist/chart/line-dash.d.ts.map +1 -0
  27. package/dist/chart/marker-shape.d.ts +70 -0
  28. package/dist/chart/marker-shape.d.ts.map +1 -0
  29. package/dist/chart/read-formatting.d.ts.map +1 -1
  30. package/dist/chart/render/chart-svg-axes.d.ts +9 -0
  31. package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
  32. package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
  33. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  34. package/dist/chart/render/chart-svg-labels.d.ts +42 -0
  35. package/dist/chart/render/chart-svg-labels.d.ts.map +1 -0
  36. package/dist/chart/render/chart-svg-markers.d.ts +6 -0
  37. package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
  38. package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
  39. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
  40. package/dist/chart/render/chart-view-axes.d.ts +30 -0
  41. package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
  42. package/dist/chart/render/chart-view-labels.d.ts +16 -0
  43. package/dist/chart/render/chart-view-labels.d.ts.map +1 -0
  44. package/dist/chart/render/chart-view-markers.d.ts +27 -0
  45. package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
  46. package/dist/chart/render/chart-view-series.d.ts.map +1 -1
  47. package/dist/chart/render/chart-view.d.ts +7 -1
  48. package/dist/chart/render/chart-view.d.ts.map +1 -1
  49. package/dist/chart/render/index.d.ts +2 -0
  50. package/dist/chart/render/index.d.ts.map +1 -1
  51. package/dist/chart/render/summary-from-space.d.ts +2 -2
  52. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  53. package/dist/chart/render/summary-labels.d.ts +9 -0
  54. package/dist/chart/render/summary-labels.d.ts.map +1 -0
  55. package/dist/chart/render/summary.d.ts +29 -1
  56. package/dist/chart/render/summary.d.ts.map +1 -1
  57. package/dist/{chunk-IM5LFEA2.mjs → chunk-3XFPCZKB.mjs} +1 -1
  58. package/dist/{chunk-YS43OMM3.mjs → chunk-75GLSRZE.mjs} +4 -4
  59. package/dist/{chunk-A7S2NYAU.mjs → chunk-BIVNVDAH.mjs} +1 -1
  60. package/dist/{chunk-UFGJNXRG.mjs → chunk-QBJRB6WW.mjs} +1 -1
  61. package/dist/{chunk-HLZIALC5.mjs → chunk-RUZEMWDI.mjs} +1 -1
  62. package/dist/docx/embedded.cjs +15 -0
  63. package/dist/docx/embedded.mjs +15 -0
  64. package/dist/docx/index.cjs +1825 -693
  65. package/dist/docx/index.mjs +1825 -693
  66. package/dist/docx/layout/index.cjs +1684 -567
  67. package/dist/docx/layout/index.mjs +1684 -567
  68. package/dist/docx/load/index.cjs +15 -0
  69. package/dist/docx/load/index.mjs +15 -0
  70. package/dist/docx/ui/index.cjs +1696 -579
  71. package/dist/docx/ui/index.mjs +1696 -579
  72. package/dist/index.cjs +1623 -658
  73. package/dist/index.mjs +1623 -658
  74. package/dist/pptx/automation/index.cjs +61 -0
  75. package/dist/pptx/automation/index.mjs +5 -5
  76. package/dist/pptx/cli/index.cjs +61 -0
  77. package/dist/pptx/cli/index.mjs +4 -4
  78. package/dist/pptx/converter/index.mjs +2 -2
  79. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  80. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  81. package/dist/pptx/index.cjs +61 -0
  82. package/dist/pptx/index.mjs +5 -5
  83. package/dist/teams/index.cjs +212 -50
  84. package/dist/teams/index.mjs +212 -50
  85. package/dist/visio/edit-chart-object-commands.d.ts +36 -0
  86. package/dist/visio/edit-chart-object-commands.d.ts.map +1 -0
  87. package/dist/visio/edit-chart-object.d.ts +7 -0
  88. package/dist/visio/edit-chart-object.d.ts.map +1 -0
  89. package/dist/visio/edit-commands.d.ts +2 -1
  90. package/dist/visio/edit-commands.d.ts.map +1 -1
  91. package/dist/visio/edit-foreign-frame.d.ts +8 -0
  92. package/dist/visio/edit-foreign-frame.d.ts.map +1 -0
  93. package/dist/visio/edit-metadata-commands.d.ts +7 -0
  94. package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
  95. package/dist/visio/edit-picture.d.ts +8 -0
  96. package/dist/visio/edit-picture.d.ts.map +1 -1
  97. package/dist/visio/edit.d.ts.map +1 -1
  98. package/dist/visio/emf-bitmap.d.ts +8 -0
  99. package/dist/visio/emf-bitmap.d.ts.map +1 -0
  100. package/dist/visio/index.cjs +17505 -6279
  101. package/dist/visio/index.d.ts +2 -0
  102. package/dist/visio/index.d.ts.map +1 -1
  103. package/dist/visio/index.mjs +17503 -6280
  104. package/dist/visio/model.d.ts +18 -0
  105. package/dist/visio/model.d.ts.map +1 -1
  106. package/dist/visio/prepare-embedded.d.ts +10 -0
  107. package/dist/visio/prepare-embedded.d.ts.map +1 -0
  108. package/dist/visio/prepare-images.d.ts.map +1 -1
  109. package/dist/visio/shapes.d.ts.map +1 -1
  110. package/dist/visio/sheet.d.ts +2 -1
  111. package/dist/visio/sheet.d.ts.map +1 -1
  112. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  113. package/dist/visio/ui/index.cjs +33580 -22875
  114. package/dist/visio/ui/index.mjs +33578 -22875
  115. package/dist/visio/ui/insert.d.ts +11 -0
  116. package/dist/visio/ui/insert.d.ts.map +1 -1
  117. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  118. package/dist/xlsx/index.cjs +1965 -817
  119. package/dist/xlsx/index.mjs +1965 -817
  120. package/dist/xlsx/load/index.cjs +190 -51
  121. package/dist/xlsx/load/index.mjs +190 -51
  122. package/dist/xlsx/model.d.ts +5 -0
  123. package/dist/xlsx/model.d.ts.map +1 -1
  124. package/dist/xlsx/read/chart.d.ts.map +1 -1
  125. package/dist/xlsx/read/load.d.ts.map +1 -1
  126. package/dist/xlsx/read/workbook-part.d.ts +2 -0
  127. package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
  128. package/dist/xlsx/ui/dialogs/grid-chart.d.ts +22 -1
  129. package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
  130. package/dist/xlsx/ui/index.cjs +17482 -4364
  131. package/dist/xlsx/ui/index.mjs +17472 -4362
  132. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  133. package/package.json +1 -1
  134. package/dist/visio/edit-foreign-bitmap.d.ts +0 -7
  135. package/dist/visio/edit-foreign-bitmap.d.ts.map +0 -1
  136. /package/dist/{chunk-KU3SMBFU.mjs → chunk-H6TNNXJK.mjs} +0 -0
  137. /package/dist/{chunk-UWWS6VVJ.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;
@@ -630,6 +630,8 @@ __export(chart_exports, {
630
630
  CHART_ERROR_VALUE_TYPES: () => CHART_ERROR_VALUE_TYPES,
631
631
  CHART_GROUP_ELEMENTS: () => CHART_GROUP_ELEMENTS,
632
632
  CHART_STYLE_PARTS: () => CHART_STYLE_PARTS,
633
+ DATA_LABEL_CATEGORY_PERCENT_SEPARATOR: () => DATA_LABEL_CATEGORY_PERCENT_SEPARATOR,
634
+ DATA_LABEL_SEPARATOR: () => DATA_LABEL_SEPARATOR,
633
635
  DEFAULT_BAR_GAP_WIDTH: () => DEFAULT_BAR_GAP_WIDTH,
634
636
  DEFAULT_CHART_PALETTE: () => DEFAULT_CHART_PALETTE,
635
637
  DEFAULT_THEME_COLORS: () => DEFAULT_THEME_COLORS,
@@ -644,9 +646,11 @@ __export(chart_exports, {
644
646
  aggregateByCategory: () => aggregateByCategory,
645
647
  assertBarClusterOptions: () => assertBarClusterOptions,
646
648
  autoSeriesColor: () => autoSeriesColor,
649
+ automaticMarkerSymbol: () => automaticMarkerSymbol,
647
650
  axisTargetIntervals: () => axisTargetIntervals,
648
651
  buildChartGradientDef: () => buildChartGradientDef,
649
652
  buildHierarchyRoots: () => buildHierarchyRoots,
653
+ buildMarkerPrimitive: () => buildMarkerPrimitive,
650
654
  buildWaterfallSteps: () => buildWaterfallSteps,
651
655
  builtInChartStyleXml: () => builtInChartStyleXml,
652
656
  builtInChartTextStyle: () => builtInChartTextStyle,
@@ -658,10 +662,13 @@ __export(chart_exports, {
658
662
  chartErrorBarAmount: () => chartErrorBarAmount,
659
663
  chartExSummary: () => chartExSummary,
660
664
  chartGradientMarkup: () => chartGradientMarkup,
665
+ chartLineDashArray: () => chartLineDashArray,
666
+ chartMarkerRadius: () => chartMarkerRadius,
661
667
  chartPaletteColors: () => chartPaletteColors,
662
668
  chartPaletteSeriesColor: () => chartPaletteSeriesColor,
663
669
  chartPaletteSeriesColorChoice: () => chartPaletteSeriesColorChoice,
664
670
  chartSampleVariance: () => chartSampleVariance,
671
+ chartSeriesMarkerSvg: () => chartSeriesMarkerSvg,
665
672
  chartSourceValues: () => chartSourceValues,
666
673
  chartSpaceKind: () => chartSpaceKind,
667
674
  chartSummaryFromSpace: () => chartSummaryFromSpace,
@@ -671,18 +678,26 @@ __export(chart_exports, {
671
678
  chartTrendlineKind: () => chartTrendlineKind,
672
679
  chartTrendlineType: () => chartTrendlineType,
673
680
  clusteredBarGeometry: () => clusteredBarGeometry,
681
+ composeDataLabelText: () => composeDataLabelText,
682
+ computeAxisStackedValueRange: () => computeAxisStackedValueRange,
683
+ computeAxisValueRange: () => computeAxisValueRange,
674
684
  computeBoxStats: () => computeBoxStats,
675
685
  computeBubbleRadius: () => computeBubbleRadius,
676
686
  computeHierarchicalSunburstArcs: () => computeHierarchicalSunburstArcs,
677
687
  computeHistogramBins: () => computeHistogramBins,
678
688
  computeLinearRegression: () => computeLinearRegression,
689
+ computeLogValueRange: () => computeLogValueRange,
679
690
  computeRSquared: () => computeRSquared,
680
691
  computeRadarPoints: () => computeRadarPoints,
681
692
  computeStackedSeriesPlots: () => computeStackedSeriesPlots,
693
+ computeStackedValueRangeForAxis: () => computeStackedValueRangeForAxis,
682
694
  computeSunburstArcs: () => computeSunburstArcs,
695
+ computeValueRangeForAxis: () => computeValueRangeForAxis,
696
+ computeValueRangeForChart: () => computeValueRangeForChart,
683
697
  computeWaterfallRange: () => computeWaterfallRange,
684
698
  effectiveBuiltInChartStyle: () => effectiveBuiltInChartStyle,
685
699
  findChartColorPalette: () => findChartColorPalette,
700
+ findLogAxis: () => findLogAxis,
686
701
  fitChartTrendline: () => fitChartTrendline,
687
702
  fitPolynomial: () => fitPolynomial,
688
703
  formatChartNumber: () => formatChartNumber,
@@ -694,6 +709,9 @@ __export(chart_exports, {
694
709
  formatPolynomialEquation: () => formatPolynomialEquation,
695
710
  formatPowerEquation: () => formatPowerEquation,
696
711
  formatTrendlineCoefficient: () => formatTrendlineCoefficient,
712
+ generateAxisTicks: () => generateAxisTicks,
713
+ generateLogTicks: () => generateLogTicks,
714
+ generateMinorAxisTicks: () => generateMinorAxisTicks,
697
715
  getChartStylePalette: () => getChartStylePalette,
698
716
  groupRowsByCategory: () => groupRowsByCategory,
699
717
  hasManualLayoutFields: () => hasManualLayoutFields,
@@ -701,6 +719,8 @@ __export(chart_exports, {
701
719
  impliesAutoTitle: () => impliesAutoTitle,
702
720
  isChartexOnlyType: () => isChartexOnlyType,
703
721
  layoutTreemap: () => layoutTreemap,
722
+ markerOutline: () => markerOutline,
723
+ markerRadius: () => markerRadius,
704
724
  maxBubbleSize: () => maxBubbleSize,
705
725
  medianBubbleRadius: () => medianBubbleRadius,
706
726
  modulateLuminance: () => modulateLuminance,
@@ -725,18 +745,23 @@ __export(chart_exports, {
725
745
  resolveBlankDisplay: () => resolveBlankDisplay,
726
746
  resolveChartGradient: () => resolveChartGradient,
727
747
  resolveChartStyleDefinition: () => resolveChartStyleDefinition,
748
+ resolveDataLabelFlags: () => resolveDataLabelFlags,
728
749
  resolveManualLayoutRect: () => resolveManualLayoutRect,
729
750
  scottBinCount: () => scottBinCount,
751
+ seriesMarkerViews: () => seriesMarkerViews,
730
752
  shade: () => shade,
731
753
  sortGradientStops: () => sortGradientStops,
732
754
  squarify: () => squarify,
733
755
  stockCandle: () => stockCandle,
734
756
  stockSlots: () => stockSlots,
757
+ summaryMarkers: () => summaryMarkers,
735
758
  sunburstArcPath: () => sunburstArcPath,
736
759
  themeColor: () => themeColor,
737
760
  tint: () => tint,
738
761
  updateGradientStop: () => updateGradientStop,
762
+ valueToYLog: () => valueToYLog,
739
763
  visibleRuns: () => visibleRuns,
764
+ withAxisBounds: () => withAxisBounds,
740
765
  withChartGradientDirection: () => withChartGradientDirection,
741
766
  withinLinearTransform: () => withinLinearTransform,
742
767
  writeChartAxisFormatting: () => writeChartAxisFormatting,
@@ -1271,6 +1296,52 @@ function formatChartNumber(value, formatCode) {
1271
1296
  return formatChartNumberWithColor(value, formatCode)?.text;
1272
1297
  }
1273
1298
 
1299
+ // chart/data-label-text.ts
1300
+ var DATA_LABEL_SEPARATOR = ", ";
1301
+ var DATA_LABEL_CATEGORY_PERCENT_SEPARATOR = "\n";
1302
+ var FLAG_KEYS = [
1303
+ "showValue",
1304
+ "showCategory",
1305
+ "showSeriesName",
1306
+ "showPercent",
1307
+ "showBubbleSize"
1308
+ ];
1309
+ function resolveDataLabelFlags(levels) {
1310
+ const { point, series, chart } = levels;
1311
+ const picked = {};
1312
+ for (const key of FLAG_KEYS) picked[key] = point?.[key] ?? series?.[key] ?? chart?.[key];
1313
+ const anyDeclared = FLAG_KEYS.some((key) => picked[key] !== void 0);
1314
+ return {
1315
+ showValue: anyDeclared ? picked.showValue === true : levels.siblingOwnsLabels !== true,
1316
+ showCategory: picked.showCategory === true,
1317
+ showSeriesName: picked.showSeriesName === true,
1318
+ showPercent: picked.showPercent === true,
1319
+ showBubbleSize: picked.showBubbleSize === true,
1320
+ separator: point?.separator ?? series?.separator ?? chart?.separator ?? (picked.showCategory === true && picked.showPercent === true ? DATA_LABEL_CATEGORY_PERCENT_SEPARATOR : DATA_LABEL_SEPARATOR)
1321
+ };
1322
+ }
1323
+ function composeDataLabelText(input) {
1324
+ const { flags, value, numberFormat: numberFormat2 } = input;
1325
+ const parts = [];
1326
+ let valueColor;
1327
+ if (flags.showSeriesName && input.seriesName) parts.push(input.seriesName);
1328
+ if (flags.showCategory && input.category) parts.push(input.category);
1329
+ if (flags.showValue) {
1330
+ const formatted = formatChartNumberWithColor(value, numberFormat2);
1331
+ parts.push(formatted?.text ?? (input.formatValue ?? String)(value, numberFormat2));
1332
+ valueColor = formatted?.color;
1333
+ }
1334
+ if (flags.showPercent) {
1335
+ const base = input.percentBase;
1336
+ parts.push(base > 0 ? `${Math.round(Math.abs(value) / base * 100)}%` : "0%");
1337
+ }
1338
+ if (flags.showBubbleSize && input.bubbleSize !== void 0)
1339
+ parts.push((input.formatBubbleSize ?? String)(input.bubbleSize));
1340
+ const text4 = parts.join(flags.separator);
1341
+ if (text4.length === 0) return void 0;
1342
+ return { text: text4, color: parts.length === 1 && flags.showValue ? valueColor : void 0 };
1343
+ }
1344
+
1274
1345
  // chart/auto-title.ts
1275
1346
  var CHART_AUTO_TITLE = "Chart Title";
1276
1347
  var CHARTEX_ONLY_TYPES = /* @__PURE__ */ new Set([
@@ -1307,12 +1378,12 @@ function formatCompactAxisValue(value, formatCode) {
1307
1378
  }
1308
1379
 
1309
1380
  // chart/bubble-radius.ts
1310
- function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options) {
1311
- const scale = (options?.bubbleScale ?? 100) / 100;
1381
+ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
1382
+ const scale = (options2?.bubbleScale ?? 100) / 100;
1312
1383
  if (sizeVal === void 0) return medianRadius * scale;
1313
1384
  const denom = maxBubble > 0 ? maxBubble : 1;
1314
1385
  const magnitude = Math.abs(sizeVal);
1315
- 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;
1316
1387
  return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
1317
1388
  }
1318
1389
  function maxBubbleSize(sizes) {
@@ -1418,10 +1489,10 @@ function squarify(nodes, box) {
1418
1489
 
1419
1490
  // chart/hierarchy.ts
1420
1491
  function normalizeLevels(levels, pointCount) {
1421
- return levels.map((level2) => {
1492
+ return levels.map((level3) => {
1422
1493
  let previous = "";
1423
1494
  return Array.from({ length: pointCount }, (_, index) => {
1424
- const label = level2[index]?.trim() ?? "";
1495
+ const label = level3[index]?.trim() ?? "";
1425
1496
  if (label) previous = label;
1426
1497
  return label || previous;
1427
1498
  });
@@ -1579,12 +1650,12 @@ function computeSunburstArcs(series, cx2, cy, maxR) {
1579
1650
  });
1580
1651
  return out;
1581
1652
  }
1582
- function hierarchyKey(levels, level2, index) {
1583
- return levels.slice(level2).map((labels) => labels[index] ?? "").join("\0");
1653
+ function hierarchyKey(levels, level3, index) {
1654
+ return levels.slice(level3).map((labels) => labels[index] ?? "").join("\0");
1584
1655
  }
1585
1656
  function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR) {
1586
- const levels = categoryLevels2.filter((level2) => level2.length > 0);
1587
- const leafCount = Math.max(values.length, ...levels.map((level2) => level2.length), 0);
1657
+ const levels = categoryLevels2.filter((level3) => level3.length > 0);
1658
+ const leafCount = Math.max(values.length, ...levels.map((level3) => level3.length), 0);
1588
1659
  if (levels.length === 0 || leafCount === 0) return [];
1589
1660
  const rawWeights = Array.from({ length: leafCount }, (_, index) => Math.abs(values[index] ?? 0));
1590
1661
  const weights = rawWeights.some((value) => value !== 0) ? rawWeights : rawWeights.map(() => 1);
@@ -1595,15 +1666,15 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
1595
1666
  const rootLabels = levels[levels.length - 1] ?? [];
1596
1667
  const rootColors = /* @__PURE__ */ new Map();
1597
1668
  const out = [];
1598
- for (let level2 = levels.length - 1; level2 >= 0; level2--) {
1599
- const ringIndex = levels.length - 1 - level2;
1669
+ for (let level3 = levels.length - 1; level3 >= 0; level3--) {
1670
+ const ringIndex = levels.length - 1 - level3;
1600
1671
  const innerRadius = ringWidth * (ringIndex + 0.5);
1601
1672
  const outerRadius = ringWidth * (ringIndex + 1.5);
1602
1673
  let start = 0;
1603
1674
  while (start < leafCount) {
1604
- const key = hierarchyKey(levels, level2, start);
1675
+ const key = hierarchyKey(levels, level3, start);
1605
1676
  let end = start + 1;
1606
- while (end < leafCount && hierarchyKey(levels, level2, end) === key) end++;
1677
+ while (end < leafCount && hierarchyKey(levels, level3, end) === key) end++;
1607
1678
  const startAngle = -Math.PI / 2 + (prefix[start] ?? 0) / total * Math.PI * 2;
1608
1679
  const endAngle = -Math.PI / 2 + (prefix[end] ?? 0) / total * Math.PI * 2;
1609
1680
  const rootLabel = rootLabels[start] ?? "";
@@ -1613,8 +1684,8 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
1613
1684
  colorIndex: rootColors.get(rootLabel) ?? start,
1614
1685
  opacity: Math.max(0.1, 0.9 - ringIndex * 0.1),
1615
1686
  level: ringIndex,
1616
- label: levels[level2]?.[start] ?? "",
1617
- ...level2 === 0 && end === start + 1 ? { pointIndex: start } : {},
1687
+ label: levels[level3]?.[start] ?? "",
1688
+ ...level3 === 0 && end === start + 1 ? { pointIndex: start } : {},
1618
1689
  ...arcLabelPlacement(cx2, cy, (innerRadius + outerRadius) / 2, startAngle, endAngle)
1619
1690
  });
1620
1691
  start = end;
@@ -1713,14 +1784,14 @@ function scottBinCount(values, min, max) {
1713
1784
  const width = 3.49 * sd * values.length ** (-1 / 3);
1714
1785
  return Math.max(1, Math.ceil((max - min) / width));
1715
1786
  }
1716
- function computeHistogramBins(values, options, format = String) {
1717
- const closed = options.intervalClosed ?? "l";
1787
+ function computeHistogramBins(values, options2, format = String) {
1788
+ const closed = options2.intervalClosed ?? "l";
1718
1789
  const finite4 = values.map((value, sourceIndex) => ({ value, sourceIndex })).filter((item) => Number.isFinite(item.value));
1719
1790
  if (finite4.length === 0) {
1720
1791
  return [];
1721
1792
  }
1722
- const underflow = typeof options.underflow === "number" ? options.underflow : void 0;
1723
- 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;
1724
1795
  const under = underflow === void 0 ? [] : finite4.filter(
1725
1796
  (item) => closed === "r" ? item.value <= underflow : item.value < underflow
1726
1797
  );
@@ -1737,8 +1808,8 @@ function computeHistogramBins(values, options, format = String) {
1737
1808
  if (regular.length > 0) {
1738
1809
  const min = Math.min(...regular.map((item) => item.value));
1739
1810
  const max = Math.max(...regular.map((item) => item.value));
1740
- const requestedSize = options.binSize && options.binSize > 0 ? options.binSize : void 0;
1741
- 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;
1742
1813
  const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
1743
1814
  const count = requestedSize ? Math.max(
1744
1815
  closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
@@ -1789,9 +1860,9 @@ function aggregateByCategory(values, rawCategories) {
1789
1860
  }
1790
1861
 
1791
1862
  // chart/waterfall.ts
1792
- function buildWaterfallSteps(values, options) {
1863
+ function buildWaterfallSteps(values, options2) {
1793
1864
  const subtotalIndices = new Set(
1794
- options?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
1865
+ options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
1795
1866
  );
1796
1867
  const steps = [];
1797
1868
  let runningTotal = 0;
@@ -1867,13 +1938,13 @@ var noFit = () => ({
1867
1938
  rSquared: 0,
1868
1939
  coefficients: []
1869
1940
  });
1870
- function fitModel(options, xVals, yVals) {
1941
+ function fitModel(options2, xVals, yVals) {
1871
1942
  const xs = [...xVals];
1872
1943
  const ys = [...yVals];
1873
- switch (options.kind) {
1944
+ switch (options2.kind) {
1874
1945
  case "linear": {
1875
1946
  const reg = computeLinearRegression(xs, ys);
1876
- const fixed = options.intercept;
1947
+ const fixed = options2.intercept;
1877
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;
1878
1949
  const b = fixed ?? reg.intercept;
1879
1950
  return {
@@ -1923,7 +1994,7 @@ function fitModel(options, xVals, yVals) {
1923
1994
  };
1924
1995
  }
1925
1996
  case "polynomial": {
1926
- const order = Math.min(options.order ?? 2, 6);
1997
+ const order = Math.min(options2.order ?? 2, 6);
1927
1998
  const coeffs = fitPolynomial(xs, ys, order);
1928
1999
  const evaluate = (x) => coeffs.reduce((s2, c2, i2) => s2 + c2 * x ** i2, 0);
1929
2000
  return {
@@ -1937,11 +2008,11 @@ function fitModel(options, xVals, yVals) {
1937
2008
  return void 0;
1938
2009
  }
1939
2010
  }
1940
- function fitChartTrendline(options, xVals, yVals) {
2011
+ function fitChartTrendline(options2, xVals, yVals) {
1941
2012
  const count = yVals.length;
1942
2013
  if (count < 2) return noFit();
1943
- if (options.kind === "movingAvg") {
1944
- const period = options.period ?? 2;
2014
+ if (options2.kind === "movingAvg") {
2015
+ const period = options2.period ?? 2;
1945
2016
  const points2 = [];
1946
2017
  for (let i2 = period - 1; i2 < count; i2++) {
1947
2018
  let sum = 0;
@@ -1950,10 +2021,10 @@ function fitChartTrendline(options, xVals, yVals) {
1950
2021
  }
1951
2022
  return { points: points2, equation: `${period}-period moving average`, rSquared: 0, coefficients: [] };
1952
2023
  }
1953
- const model = fitModel(options, xVals, yVals);
2024
+ const model = fitModel(options2, xVals, yVals);
1954
2025
  if (!model) return noFit();
1955
- const startX = Math.min(...xVals) - (options.backward ?? 0);
1956
- 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);
1957
2028
  const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
1958
2029
  const points = [];
1959
2030
  for (let step = 0; step <= steps; step++) {
@@ -1976,18 +2047,18 @@ function chartSampleVariance(values) {
1976
2047
  const mean = values.reduce((sum, value) => sum + value, 0) / count;
1977
2048
  return values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / Math.max(count - 1, 1);
1978
2049
  }
1979
- function chartErrorBarAmount(options, values, displayIndex, sourceIndex, side) {
1980
- switch (options.valueType) {
2050
+ function chartErrorBarAmount(options2, values, displayIndex, sourceIndex, side) {
2051
+ switch (options2.valueType) {
1981
2052
  case "fixedVal":
1982
- return options.value ?? 0;
2053
+ return options2.value ?? 0;
1983
2054
  case "percentage":
1984
- return Math.abs(values[displayIndex] ?? 0) * ((options.value ?? 0) / 100);
2055
+ return Math.abs(values[displayIndex] ?? 0) * ((options2.value ?? 0) / 100);
1985
2056
  case "stdDev":
1986
- return Math.sqrt(chartSampleVariance(values)) * (options.value ?? 1);
2057
+ return Math.sqrt(chartSampleVariance(values)) * (options2.value ?? 1);
1987
2058
  case "stdErr":
1988
2059
  return Math.sqrt(chartSampleVariance(values) / Math.max(values.length, 1));
1989
2060
  case "cust":
1990
- return side === "plus" ? options.customPlus?.[sourceIndex] ?? 0 : options.customMinus?.[sourceIndex] ?? 0;
2061
+ return side === "plus" ? options2.customPlus?.[sourceIndex] ?? 0 : options2.customMinus?.[sourceIndex] ?? 0;
1991
2062
  }
1992
2063
  }
1993
2064
 
@@ -2258,17 +2329,17 @@ function checkXmlLimits(xml, label, limits = {}) {
2258
2329
  throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth2}`);
2259
2330
  }
2260
2331
  }
2261
- function parseXml(xml, options = {}) {
2262
- const label = options.label ?? "OOXML";
2332
+ function parseXml(xml, options2 = {}) {
2333
+ const label = options2.label ?? "OOXML";
2263
2334
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
2264
2335
  throw new Error(`${label} XML with DTD or entity declarations is not supported`);
2265
- checkXmlLimits(xml, label, options.limits);
2336
+ checkXmlLimits(xml, label, options2.limits);
2266
2337
  let parseError = "";
2267
2338
  let parsed;
2268
2339
  try {
2269
2340
  parsed = new DOMParser({
2270
- onError: (level2, message) => {
2271
- if (level2 !== "warning") parseError = message;
2341
+ onError: (level3, message) => {
2342
+ if (level3 !== "warning") parseError = message;
2272
2343
  }
2273
2344
  }).parseFromString(xml, "application/xml");
2274
2345
  } catch (error) {
@@ -2647,13 +2718,13 @@ var APPLIED = /* @__PURE__ */ new Set([
2647
2718
  "lumMod",
2648
2719
  "lumOff"
2649
2720
  ]);
2650
- function resolveDrawingColor(color, theme, options) {
2721
+ function resolveDrawingColor(color, theme, options2) {
2651
2722
  const base = baseHex(color, theme);
2652
2723
  const rgb = base ? hexToRgbChannels(base) : null;
2653
2724
  if (!rgb) return void 0;
2654
- if (options?.transformOrder === "document") {
2725
+ if (options2?.transformOrder === "document") {
2655
2726
  const value = orderedColorTransforms(rgb, color.transforms);
2656
- 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;
2657
2728
  return {
2658
2729
  hex: `#${toHex(round3(value.r))}${toHex(round3(value.g))}${toHex(round3(value.b))}`,
2659
2730
  alpha: value.alpha,
@@ -2704,7 +2775,7 @@ function resolveDrawingColor(color, theme, options) {
2704
2775
  if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
2705
2776
  const lumOff = parseDrawingFraction(find("lumOff"));
2706
2777
  if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
2707
- 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;
2708
2779
  ({ r, g: g2, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round3));
2709
2780
  }
2710
2781
  let alpha = parseDrawingPercent(find("alpha")) ?? 1;
@@ -3093,6 +3164,19 @@ function readChartStyle(xml) {
3093
3164
  }
3094
3165
 
3095
3166
  // chart/formatting-nodes.ts
3167
+ function chartDataLabelNode(root) {
3168
+ const plot = first(first(root, "chart", NS.c), "plotArea", NS.c);
3169
+ const groups = plot ? elements(plot).filter((node) => node.localName.endsWith("Chart")) : [];
3170
+ const candidates = groups.flatMap((group2) => [
3171
+ ...children(group2, "ser", NS.c).map((ser) => first(ser, "dLbls", NS.c)),
3172
+ first(group2, "dLbls", NS.c)
3173
+ ]);
3174
+ return candidates.find(
3175
+ (node) => node !== void 0 && (first(node, "txPr", NS.c) !== void 0 || elements(node).some(
3176
+ (child3) => child3.localName.startsWith("show") && child3.getAttribute("val") === "1"
3177
+ ))
3178
+ );
3179
+ }
3096
3180
  function chartFormattingNodes(root) {
3097
3181
  const chart = first(root, "chart", NS.c);
3098
3182
  const plot = first(chart, "plotArea", NS.c);
@@ -3267,6 +3351,8 @@ function readChartFormatting(root) {
3267
3351
  const entries = Object.fromEntries(
3268
3352
  Object.entries(nodes).flatMap(([name, node]) => node ? [[name, entry2(node)]] : [])
3269
3353
  );
3354
+ const labels = chartDataLabelNode(root);
3355
+ if (labels) entries["dataLabel"] = entry2(labels);
3270
3356
  const builtInStyle = readBuiltInChartStyle(root);
3271
3357
  const textBody = c(root, "txPr");
3272
3358
  const textDefaults = textBody ? {
@@ -3675,7 +3761,7 @@ function resolveInnerRect(fillToRect, focalPoint) {
3675
3761
  function lerpEdge(inner, outer, t) {
3676
3762
  return inner + (outer - inner) * t;
3677
3763
  }
3678
- function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
3764
+ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options2) {
3679
3765
  if (stops.length === 0) {
3680
3766
  return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
3681
3767
  }
@@ -3683,8 +3769,8 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
3683
3769
  const inner = resolveInnerRect(fillToRect, focalPoint);
3684
3770
  const rects = [];
3685
3771
  const alphaRects = [];
3686
- const masked = options?.independentOpacity && sorted.some((stop) => (stop.opacity ?? 1) < 1);
3687
- 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;
3688
3774
  if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
3689
3775
  for (let i2 = bands; i2 >= 0; i2 -= 1) {
3690
3776
  const t = i2 / bands;
@@ -3877,12 +3963,12 @@ function chartGradientMarkup(def) {
3877
3963
 
3878
3964
  // chart/bar-cluster-geometry.ts
3879
3965
  var DEFAULT_BAR_GAP_WIDTH = 150;
3880
- function assertBarClusterOptions(options) {
3966
+ function assertBarClusterOptions(options2) {
3881
3967
  for (const [field, min, max] of [
3882
3968
  ["barGapWidth", 0, 500],
3883
3969
  ["barOverlap", -100, 100]
3884
3970
  ]) {
3885
- const value = options[field];
3971
+ const value = options2[field];
3886
3972
  if (value !== void 0 && (!Number.isInteger(value) || value < min || value > max))
3887
3973
  throw new RangeError(`${field} must be an integer from ${min} to ${max}`);
3888
3974
  }
@@ -5135,7 +5221,7 @@ function dataSourceInner(source) {
5135
5221
  case "multiLvlStrRef": {
5136
5222
  const levels = source.levels ? elementXml(
5137
5223
  "multiLvlStrCache",
5138
- valXml("ptCount", source.levelPointCount) + source.levels.map((level2) => elementXml("lvl", cachePoints(level2))).join("")
5224
+ valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
5139
5225
  ) : "";
5140
5226
  return `<c:multiLvlStrRef>${formula}${levels}</c:multiLvlStrRef>`;
5141
5227
  }
@@ -5168,8 +5254,8 @@ function titleXml(context, title) {
5168
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)
5169
5255
  );
5170
5256
  }
5171
- function labelOptionsXml(context, options) {
5172
- 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));
5173
5259
  }
5174
5260
  function labelXml(context, label) {
5175
5261
  return elementXml(
@@ -5339,7 +5425,7 @@ function styleXml(context, space3) {
5339
5425
  );
5340
5426
  }
5341
5427
  var relationship = (local, id, content2 = "") => id === void 0 ? "" : elementXml(local, content2, ` r:id="${escapeAttribute(id)}"`);
5342
- function writeChartSpace(space3, options = {}) {
5428
+ function writeChartSpace(space3, options2 = {}) {
5343
5429
  const bindings = new Map(CHART_ROOT_BINDINGS);
5344
5430
  for (const { prefix, uri } of space3.namespaceDeclarations ?? [])
5345
5431
  if (!bindings.has(prefix) && /^[A-Za-z_][\w.-]*$/.test(prefix)) bindings.set(prefix, uri);
@@ -5354,10 +5440,204 @@ function writeChartSpace(space3, options = {}) {
5354
5440
  space3.externalDataRelId,
5355
5441
  valXml("autoUpdate", space3.externalDataAutoUpdate)
5356
5442
  ) + raw(context, space3.printSettings) + relationship("userShapes", space3.userShapesRelId) + raw(context, space3.extLst);
5357
- const breakAfter = options.declarationBreak ?? "\r\n";
5443
+ const breakAfter = options2.declarationBreak ?? "\r\n";
5358
5444
  return `${DECLARATION2}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
5359
5445
  }
5360
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
+
5361
5641
  // chart/render/summary-analysis.ts
5362
5642
  function summaryTrendline(source) {
5363
5643
  const kind = chartTrendlineKind(source.trendlineType);
@@ -5398,6 +5678,41 @@ function summaryAnalysis(series) {
5398
5678
  };
5399
5679
  }
5400
5680
 
5681
+ // chart/render/summary-labels.ts
5682
+ function level(options2, custom) {
5683
+ const out = {};
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;
5693
+ if (custom?.text !== void 0) out.text = custom.text;
5694
+ return out;
5695
+ }
5696
+ function shows(levels, point) {
5697
+ const flags = resolveDataLabelFlags({ ...levels, ...point ? { point } : {} });
5698
+ return point?.text !== void 0 || Object.values(flags).some((value) => value === true);
5699
+ }
5700
+ function summaryDataLabels(series, group2) {
5701
+ const own = series.dataLabels;
5702
+ if (!own && !group2) return void 0;
5703
+ const out = {};
5704
+ if (group2) out.chart = level(group2);
5705
+ if (own) out.series = level(own);
5706
+ const points = {};
5707
+ for (const labels of [group2, own])
5708
+ for (const label of labels?.labels ?? [])
5709
+ if (label.index !== void 0)
5710
+ points[label.index] = { ...points[label.index], ...level(label, label.tx) };
5711
+ if (Object.keys(points).length) out.points = points;
5712
+ if (!shows(out) && !Object.values(points).some((point) => shows(out, point))) return void 0;
5713
+ return out;
5714
+ }
5715
+
5401
5716
  // chart/render/summary-from-space.ts
5402
5717
  var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
5403
5718
  var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
@@ -5415,7 +5730,7 @@ var GROUP_TYPES = {
5415
5730
  surface: "surface"
5416
5731
  };
5417
5732
  var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
5418
- function chartSummarySeries(source, chartType) {
5733
+ function chartSummarySeries(source, chartType, groupLabels) {
5419
5734
  const categories = source.categories ?? source.xValues;
5420
5735
  const values = source.values ?? source.yValues;
5421
5736
  const numeric = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
@@ -5423,6 +5738,7 @@ function chartSummarySeries(source, chartType) {
5423
5738
  categories: chartSourceValues(categories),
5424
5739
  values: chartSourceValues(values).map(numeric)
5425
5740
  };
5741
+ if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
5426
5742
  if (source.bubbleSizes) {
5427
5743
  out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric);
5428
5744
  if (source.bubbleSizes.formula) out.bubbleSizesRef = source.bubbleSizes.formula;
@@ -5451,6 +5767,8 @@ function chartSummarySeries(source, chartType) {
5451
5767
  }
5452
5768
  if (Object.keys(points).length) out.pointColors = points;
5453
5769
  if (Object.keys(pointFills).length) out.pointFills = pointFills;
5770
+ const dataLabels = summaryDataLabels(source, groupLabels);
5771
+ if (dataLabels) out.dataLabels = dataLabels;
5454
5772
  Object.assign(out, summaryAnalysis(source));
5455
5773
  return out;
5456
5774
  }
@@ -5478,7 +5796,10 @@ function extraGroups(chartSpace, firstType) {
5478
5796
  const type = group2.kind === "bar" ? "column" : group2.kind;
5479
5797
  const entry3 = {
5480
5798
  chartType: type,
5481
- series: group2.series.map((source) => chartSummarySeries(source, type)),
5799
+ series: group2.series.map((source, index) => ({
5800
+ ...chartSummarySeries(source, type, group2.dataLabels),
5801
+ ...summaryMarkers(source, group2, index)
5802
+ })),
5482
5803
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
5483
5804
  };
5484
5805
  if (group2.grouping && GROUPINGS.has(group2.grouping))
@@ -5496,11 +5817,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
5496
5817
  const group2 = chartSpace.plotArea.groups[0];
5497
5818
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
5498
5819
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
5499
- const series = (group2?.series ?? []).map((source) => chartSummarySeries(source, chartType));
5820
+ const series = (group2?.series ?? []).map((source, index) => ({
5821
+ ...chartSummarySeries(source, chartType, group2?.dataLabels),
5822
+ ...group2 ? summaryMarkers(source, group2, index) : {}
5823
+ }));
5500
5824
  const summary = {
5501
5825
  chartType,
5502
5826
  series,
5503
- showLegend: chartSpace.legend !== void 0
5827
+ showLegend: chartSpace.legend !== void 0,
5828
+ axes: chartSpace.plotArea.axes,
5829
+ axisIds: group2?.axisIds ?? []
5504
5830
  };
5505
5831
  const combined = extraGroups(chartSpace, chartType);
5506
5832
  if (combined.length) summary.extraGroups = combined;
@@ -5562,9 +5888,9 @@ function dimension(data, kind, type) {
5562
5888
  const out = { points: [] };
5563
5889
  const formula = text(cx(element2, "f"));
5564
5890
  if (formula) out.formula = formula;
5565
- const level2 = cx(element2, "lvl");
5566
- const count = Number(level2?.getAttribute("ptCount") ?? 0);
5567
- for (const point of level2 ? children(level2, "pt", NS.cx) : []) {
5891
+ const level3 = cx(element2, "lvl");
5892
+ const count = Number(level3?.getAttribute("ptCount") ?? 0);
5893
+ for (const point of level3 ? children(level3, "pt", NS.cx) : []) {
5568
5894
  const index = Number(point.getAttribute("idx") ?? out.points.length);
5569
5895
  if (Number.isInteger(index) && index >= 0) out.points[index] = text(point);
5570
5896
  }
@@ -5573,10 +5899,10 @@ function dimension(data, kind, type) {
5573
5899
  }
5574
5900
  function categoryLevels(data) {
5575
5901
  const element2 = data ? children(data, "strDim", NS.cx).find((d) => (d.getAttribute("type") ?? "") === "cat") : void 0;
5576
- return (element2 ? children(element2, "lvl", NS.cx) : []).map((level2) => {
5902
+ return (element2 ? children(element2, "lvl", NS.cx) : []).map((level3) => {
5577
5903
  const points = [];
5578
- const count = Number(level2.getAttribute("ptCount") ?? 0);
5579
- for (const point of children(level2, "pt", NS.cx)) {
5904
+ const count = Number(level3.getAttribute("ptCount") ?? 0);
5905
+ for (const point of children(level3, "pt", NS.cx)) {
5580
5906
  const index = Number(point.getAttribute("idx") ?? points.length);
5581
5907
  if (Number.isInteger(index) && index >= 0) points[index] = text(point);
5582
5908
  }
@@ -5877,218 +6203,6 @@ function chartBarSpacing(chart) {
5877
6203
  };
5878
6204
  }
5879
6205
 
5880
- // chart/render/chart-svg-bars.ts
5881
- function barLayout(model, frame2) {
5882
- const count = Math.max(1, model.series.length);
5883
- const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
5884
- const barSize = geometry.singleBarWidth;
5885
- const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
5886
- return { barSize, offset };
5887
- }
5888
- function bars(model, frame2, out, values) {
5889
- const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
5890
- const { barSize, offset: barOffset } = barLayout(model, frame2);
5891
- const base = frame2.value(0);
5892
- const pos = new Array(model.categories.length).fill(0);
5893
- const neg = new Array(model.categories.length).fill(0);
5894
- model.series.forEach((s2, si) => {
5895
- values[si]?.forEach((v, i2) => {
5896
- if (v === null || i2 >= model.categories.length) return;
5897
- let from = 0;
5898
- let to = v;
5899
- if (stacked) {
5900
- const acc = v >= 0 ? pos : neg;
5901
- from = acc[i2] ?? 0;
5902
- to = from + v;
5903
- acc[i2] = to;
5904
- }
5905
- const a2 = stacked ? frame2.value(from) : base;
5906
- const b = frame2.value(to);
5907
- const offset = barOffset(si);
5908
- const center = frame2.band(i2);
5909
- const width = model.horizontal ? Math.abs(b - a2) : barSize;
5910
- const height = model.horizontal ? barSize : Math.abs(b - a2);
5911
- let color = s2.pointColors?.[i2] ?? s2.color;
5912
- const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
5913
- if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
5914
- const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
5915
- if (baseId) {
5916
- const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
5917
- const def = buildChartGradientDef(id, gradient, {
5918
- width: Number(n(width)),
5919
- height: Number(n(height)),
5920
- shape: "rect"
5921
- });
5922
- out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
5923
- color = `url(#${id})`;
5924
- }
5925
- }
5926
- out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
5927
- if (model.horizontal)
5928
- out.push(
5929
- rect(Math.min(a2, b), center + offset, Math.abs(b - a2), barSize, color, s2.shadowFilter)
5930
- );
5931
- else
5932
- out.push(
5933
- rect(center + offset, Math.min(a2, b), barSize, Math.abs(b - a2), color, s2.shadowFilter)
5934
- );
5935
- out.push("</g>");
5936
- });
5937
- });
5938
- }
5939
-
5940
- // chart/render/chart-svg-analysis.ts
5941
- var DASHES = {
5942
- dot: [1, 3],
5943
- dash: [4, 3],
5944
- lgDash: [8, 3],
5945
- dashDot: [4, 3, 1, 3],
5946
- lgDashDot: [8, 3, 1, 3],
5947
- lgDashDotDot: [8, 3, 1, 3, 1, 3],
5948
- sysDash: [3, 1],
5949
- sysDot: [1, 1],
5950
- sysDashDot: [3, 1, 1, 1],
5951
- sysDashDotDot: [3, 1, 1, 1, 1, 1]
5952
- };
5953
- var CAP = 4;
5954
- function strokeAttributes(stroke) {
5955
- const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
5956
- const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
5957
- return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
5958
- }
5959
- var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
5960
- function trendlines(series, si, xs, ys, plane, out) {
5961
- for (const trendline of series.trendlines ?? []) {
5962
- const fit2 = fitChartTrendline(trendline.fit, xs, ys);
5963
- if (fit2.points.length < 2) continue;
5964
- const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
5965
- out.push(
5966
- `<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
5967
- );
5968
- }
5969
- }
5970
- function errorBar(bars2, at2, values, plane, out) {
5971
- const stroke = strokeAttributes(bars2.stroke);
5972
- for (const side of ["plus", "minus"]) {
5973
- if (bars2.barType !== side && bars2.barType !== "both") continue;
5974
- const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
5975
- const sign = side === "plus" ? 1 : -1;
5976
- const [x1, y1] = plane(at2.x, at2.y);
5977
- const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
5978
- out.push(segment(x1, y1, x2, y2, stroke));
5979
- if (!bars2.endCap) continue;
5980
- if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
5981
- else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
5982
- }
5983
- }
5984
- function plottedPoints(series, xOf) {
5985
- return series.values.flatMap((y, index) => {
5986
- const x = xOf(index);
5987
- return y === null || x === null ? [] : [{ x, y, index }];
5988
- });
5989
- }
5990
- function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
5991
- const points = plottedPoints(series, xOf);
5992
- const xs = points.map((p) => p.x);
5993
- const ys = points.map((p) => p.y);
5994
- trendlines(series, si, xs, ys, plane, out);
5995
- for (const bars2 of series.errorBars ?? []) {
5996
- if (categoryAxis && bars2.direction === "x") continue;
5997
- const values = bars2.direction === "x" ? xs : ys;
5998
- points.forEach(
5999
- (p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
6000
- );
6001
- }
6002
- }
6003
- function categoryAnalysis(model, frame2, out) {
6004
- if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
6005
- const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
6006
- const barred = model.type === "bar" || model.type === "column";
6007
- const layout = barred ? barLayout(model, frame2) : void 0;
6008
- model.series.forEach((series, si) => {
6009
- if (!series.trendlines && !series.errorBars) return;
6010
- const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
6011
- const barPlane = (x, y) => {
6012
- const [px3, py] = plane(x, y);
6013
- return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
6014
- };
6015
- seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
6016
- });
6017
- }
6018
- function scatterAnalysis(model, px3, py, out) {
6019
- const plane = (x, y) => [px3(x), py(y)];
6020
- model.series.forEach((series, si) => {
6021
- if (!series.trendlines && !series.errorBars) return;
6022
- seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
6023
- });
6024
- }
6025
-
6026
- // chart/render/chart-scale.ts
6027
- var clean = (n2) => Number(n2.toPrecision(12));
6028
- function* units(raw2) {
6029
- let exp = Math.floor(Math.log10(raw2)) - 1;
6030
- for (; ; ) {
6031
- const base = 10 ** exp;
6032
- for (const m of [1, 2, 5]) yield clean(m * base);
6033
- exp++;
6034
- }
6035
- }
6036
- function niceScale(dataMin, dataMax, options = {}) {
6037
- const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
6038
- let lo = Number.isFinite(dataMin) ? dataMin : 0;
6039
- let hi = Number.isFinite(dataMax) ? dataMax : 0;
6040
- if (lo > hi) [lo, hi] = [hi, lo];
6041
- if (lo === hi) {
6042
- if (lo === 0) hi = 1;
6043
- else if (options.noZero) {
6044
- const pad2 = Math.abs(lo) * 0.1 || 1;
6045
- lo -= pad2;
6046
- hi += pad2;
6047
- } else if (lo > 0) lo = 0;
6048
- else hi = 0;
6049
- }
6050
- let fixedLo = false;
6051
- let fixedHi = false;
6052
- if (!options.noZero) {
6053
- if (lo >= 0 && hi - lo >= hi / 6) {
6054
- lo = 0;
6055
- fixedLo = true;
6056
- } else if (hi <= 0 && hi - lo >= -lo / 6) {
6057
- hi = 0;
6058
- fixedHi = true;
6059
- }
6060
- }
6061
- const range = hi - lo;
6062
- const top = fixedHi ? hi : hi + range * 0.05;
6063
- const bottom = fixedLo ? lo : lo - range * 0.05;
6064
- for (const unit of units(range / maxIntervals)) {
6065
- const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
6066
- const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
6067
- const intervals = Math.round((max - min) / unit);
6068
- if (intervals <= maxIntervals && intervals > 0) {
6069
- const ticks = [];
6070
- for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
6071
- return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
6072
- }
6073
- }
6074
- return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
6075
- }
6076
- var PERCENT_SCALE = {
6077
- min: 0,
6078
- max: 1,
6079
- majorUnit: 0.1,
6080
- ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
6081
- };
6082
- function formatAxisValue(value, percent = false) {
6083
- if (percent) return `${clean(value * 100)}%`;
6084
- const v = clean(value);
6085
- if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
6086
- return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
6087
- const [int2 = "0", frac] = String(Math.abs(v)).split(".");
6088
- const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6089
- return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
6090
- }
6091
-
6092
6206
  // drawingml/drawing-color-css.ts
6093
6207
  function drawingColorCss(value) {
6094
6208
  if (!value || value.alpha === 1) return value?.hex;
@@ -6106,36 +6220,6 @@ var TWIPS_PER_POINT = 20;
6106
6220
  var TWIPS_PER_INCH = 1440;
6107
6221
  var PIXELS_PER_INCH = 96;
6108
6222
 
6109
- // drawingml/drawing-shadow.ts
6110
- function resolveDrawingShadow(effects, theme) {
6111
- const node = first(effects, "outerShdw", NS.a);
6112
- if (!node) return void 0;
6113
- const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
6114
- if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
6115
- return void 0;
6116
- const color = parseDrawingColorIn(node);
6117
- const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
6118
- const blur = value("blurRad", 0) / EMU_PER_PIXEL;
6119
- const distance = value("dist", 0) / EMU_PER_PIXEL;
6120
- const angle = value("dir", 0) / 6e4 * Math.PI / 180;
6121
- if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
6122
- return void 0;
6123
- return {
6124
- color: resolved.hex,
6125
- opacity: resolved.alpha,
6126
- blur,
6127
- dx: Math.cos(angle) * distance,
6128
- dy: Math.sin(angle) * distance
6129
- };
6130
- }
6131
- function resolveDrawingShadowXml(xml, theme) {
6132
- return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
6133
- }
6134
- function svgDropShadowElement(s2, format) {
6135
- const num2 = format.number;
6136
- return `<feDropShadow dx="${num2(s2.dx)}" dy="${num2(s2.dy)}" stdDeviation="${num2(s2.blur / 2)}" flood-color="${format.color(s2.color, "#000000")}" flood-opacity="${num2(s2.opacity)}" result="shadow"/>`;
6137
- }
6138
-
6139
6223
  // chart/render/theme-palette.ts
6140
6224
  var THEME_SLOTS = [
6141
6225
  "lt1",
@@ -6197,6 +6281,36 @@ function autoSeriesColor(theme, index) {
6197
6281
  return chartPaletteSeriesColor(findChartColorPalette(10), i2, i2 + 1, chartColorScheme(theme));
6198
6282
  }
6199
6283
 
6284
+ // drawingml/drawing-shadow.ts
6285
+ function resolveDrawingShadow(effects, theme) {
6286
+ const node = first(effects, "outerShdw", NS.a);
6287
+ if (!node) return void 0;
6288
+ const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
6289
+ if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
6290
+ return void 0;
6291
+ const color = parseDrawingColorIn(node);
6292
+ const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
6293
+ const blur = value("blurRad", 0) / EMU_PER_PIXEL;
6294
+ const distance = value("dist", 0) / EMU_PER_PIXEL;
6295
+ const angle = value("dir", 0) / 6e4 * Math.PI / 180;
6296
+ if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
6297
+ return void 0;
6298
+ return {
6299
+ color: resolved.hex,
6300
+ opacity: resolved.alpha,
6301
+ blur,
6302
+ dx: Math.cos(angle) * distance,
6303
+ dy: Math.sin(angle) * distance
6304
+ };
6305
+ }
6306
+ function resolveDrawingShadowXml(xml, theme) {
6307
+ return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
6308
+ }
6309
+ function svgDropShadowElement(s2, format) {
6310
+ const num2 = format.number;
6311
+ return `<feDropShadow dx="${num2(s2.dx)}" dy="${num2(s2.dy)}" stdDeviation="${num2(s2.blur / 2)}" flood-color="${format.color(s2.color, "#000000")}" flood-opacity="${num2(s2.opacity)}" result="shadow"/>`;
6312
+ }
6313
+
6200
6314
  // chart/text-inheritance.ts
6201
6315
  var TEXT_KEYS = [
6202
6316
  "fontSize",
@@ -6285,6 +6399,821 @@ function chartAppearance(chart, theme) {
6285
6399
  return out;
6286
6400
  }
6287
6401
 
6402
+ // text/css-font-family.ts
6403
+ var FALLBACKS = {
6404
+ calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6405
+ "calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6406
+ cambria: '"Cambria", "Caladea", Georgia, serif',
6407
+ arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
6408
+ "times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
6409
+ "courier new": '"Courier New", "Liberation Mono", monospace',
6410
+ aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
6411
+ };
6412
+ function cssFontFamily(name) {
6413
+ const known = FALLBACKS[name.toLowerCase()];
6414
+ if (known) return known;
6415
+ const quoted = `"${name.replace(/["\\]/g, "")}"`;
6416
+ return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
6417
+ }
6418
+
6419
+ // chart/render/chart-svg-appearance.ts
6420
+ var nextPaintId = 0;
6421
+ function chartGradientPaint(model, width = 1024, height = 768) {
6422
+ const prefix = `xlsx-chart-${++nextPaintId}`;
6423
+ const appearance = { ...model.appearance };
6424
+ const defs = [];
6425
+ const shadowPaint = (shadow, suffix) => {
6426
+ const id = `${prefix}-${suffix}`;
6427
+ const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
6428
+ defs.push(
6429
+ `<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
6430
+ );
6431
+ return `url(#${id})`;
6432
+ };
6433
+ for (const [part, entry3] of Object.entries(appearance)) {
6434
+ if (entry3?.textShadow)
6435
+ appearance[part] = {
6436
+ ...entry3,
6437
+ textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
6438
+ };
6439
+ }
6440
+ const paint2 = (gradient, suffix, bounds2) => {
6441
+ const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
6442
+ defs.push(chartGradientMarkup(def));
6443
+ return `url(#${def.id})`;
6444
+ };
6445
+ for (const part of ["chartArea", "plotArea"]) {
6446
+ const entry3 = appearance[part];
6447
+ if (!entry3?.gradient) continue;
6448
+ if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
6449
+ appearance[part] = {
6450
+ ...entry3,
6451
+ fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
6452
+ };
6453
+ }
6454
+ const series = model.series.map((source, index) => {
6455
+ const view = { ...source };
6456
+ if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
6457
+ const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
6458
+ if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
6459
+ if (source.pointGradients) {
6460
+ view.pointColors = [...source.pointColors ?? []];
6461
+ for (const [key, gradient] of Object.entries(source.pointGradients))
6462
+ view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
6463
+ }
6464
+ return view;
6465
+ });
6466
+ return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
6467
+ }
6468
+ function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
6469
+ const entry3 = model.appearance?.[part];
6470
+ return {
6471
+ size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
6472
+ ...entry3?.color === void 0 ? {} : { fill: entry3.color },
6473
+ ...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
6474
+ ...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
6475
+ ...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
6476
+ ...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
6477
+ ...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
6478
+ };
6479
+ }
6480
+ function chartStroke(model, part) {
6481
+ const entry3 = model.appearance?.[part];
6482
+ return {
6483
+ color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part.startsWith("gridline") ? GRID_COLOR : AXIS_COLOR),
6484
+ width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
6485
+ };
6486
+ }
6487
+ function chartAreaRect(model, part, area) {
6488
+ if (area.w <= 0 || area.h <= 0) return "";
6489
+ const entry3 = model.appearance?.[part];
6490
+ let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
6491
+ let defs = "";
6492
+ if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
6493
+ const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
6494
+ width: area.w,
6495
+ height: area.h,
6496
+ shape: "rect"
6497
+ });
6498
+ defs = `<defs>${chartGradientMarkup(def)}</defs>`;
6499
+ fill = `url(#${def.id})`;
6500
+ }
6501
+ const stroke = entry3?.lineColor ?? "none";
6502
+ if (fill === "none" && stroke === "none") return "";
6503
+ const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
6504
+ return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
6505
+ }
6506
+
6507
+ // chart/render/chart-svg-labels.ts
6508
+ var GAP = 3;
6509
+ var LINE = 1.2;
6510
+ var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
6511
+ function measure(model, label) {
6512
+ const attrs = chartTextAttributes(model, "dataLabel", 10);
6513
+ const size = attrs.size ?? 10;
6514
+ const lines = label.text.split("\n");
6515
+ return {
6516
+ lines,
6517
+ size,
6518
+ w: Math.max(...lines.map((l) => textWidth(l, size))),
6519
+ h: lines.length * size * LINE,
6520
+ attrs
6521
+ };
6522
+ }
6523
+ function draw(m, label, x, y, anchor, out) {
6524
+ const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
6525
+ m.lines.forEach((line3, k) => {
6526
+ const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
6527
+ out.push(text2(x, lineY, line3, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
6528
+ });
6529
+ }
6530
+ function barLabels(model, marks, out) {
6531
+ const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
6532
+ for (const mark of marks) {
6533
+ const label = mark.series.labels?.[mark.index];
6534
+ if (!label) continue;
6535
+ const m = measure(model, label);
6536
+ let position = label.position ?? (stacked ? "ctr" : "outEnd");
6537
+ if (stacked && position === "outEnd") position = "ctr";
6538
+ const cx2 = mark.x + mark.w / 2;
6539
+ const cy = mark.y + mark.h / 2;
6540
+ if (model.horizontal) {
6541
+ const end = mark.negative ? mark.x : mark.x + mark.w;
6542
+ const base = mark.negative ? mark.x + mark.w : mark.x;
6543
+ const dir2 = mark.negative ? -1 : 1;
6544
+ const side = (at2, outward) => [
6545
+ at2 + (outward ? dir2 : -dir2) * GAP,
6546
+ (outward ? dir2 : -dir2) > 0 ? "start" : "end"
6547
+ ];
6548
+ const [x, anchor] = position === "ctr" ? [cx2, "middle"] : position === "inEnd" ? side(end, false) : position === "inBase" ? side(base, true) : side(end, true);
6549
+ draw(m, label, x, cy, anchor, out);
6550
+ continue;
6551
+ }
6552
+ const top = mark.negative ? mark.y + mark.h : mark.y;
6553
+ const bottom = mark.negative ? mark.y : mark.y + mark.h;
6554
+ const dir = mark.negative ? 1 : -1;
6555
+ const y = position === "ctr" ? cy : position === "inEnd" ? top - dir * (GAP + m.h / 2) : position === "inBase" ? bottom + dir * (GAP + m.h / 2) : top + dir * (GAP + m.h / 2);
6556
+ draw(m, label, cx2, y, "middle", out);
6557
+ }
6558
+ }
6559
+ function pointLabels(model, marks, out) {
6560
+ for (const mark of marks) {
6561
+ const label = mark.series.labels?.[mark.index];
6562
+ if (!label) continue;
6563
+ const m = measure(model, label);
6564
+ const reach = mark.radius + GAP;
6565
+ switch (model.type === "area" ? "ctr" : label.position ?? "r") {
6566
+ case "ctr":
6567
+ draw(m, label, mark.x, mark.y, "middle", out);
6568
+ break;
6569
+ case "t":
6570
+ draw(m, label, mark.x, mark.y - reach - m.h / 2, "middle", out);
6571
+ break;
6572
+ case "b":
6573
+ draw(m, label, mark.x, mark.y + reach + m.h / 2, "middle", out);
6574
+ break;
6575
+ case "l":
6576
+ draw(m, label, mark.x - reach, mark.y, "end", out);
6577
+ break;
6578
+ default:
6579
+ draw(m, label, mark.x + reach, mark.y, "start", out);
6580
+ }
6581
+ }
6582
+ }
6583
+ function sliceLabels(model, marks, out) {
6584
+ for (const mark of marks) {
6585
+ const label = mark.series.labels?.[mark.index];
6586
+ if (!label) continue;
6587
+ const m = measure(model, label);
6588
+ const mid = (mark.start + mark.end) / 2;
6589
+ const ux = Math.sin(mid);
6590
+ const uy = -Math.cos(mid);
6591
+ const place = (radius) => [
6592
+ mark.cx + radius * ux,
6593
+ mark.cy + radius * uy
6594
+ ];
6595
+ const position = model.type === "doughnut" ? "ctr" : label.position ?? "bestFit";
6596
+ let x;
6597
+ let y;
6598
+ if (position === "ctr") [x, y] = place(mark.inner + (mark.outer - mark.inner) / 2);
6599
+ else if (position === "inEnd") {
6600
+ const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
6601
+ [x, y] = place(Math.max(0, mark.outer - GAP - extent));
6602
+ } else if (position === "outEnd") {
6603
+ const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
6604
+ [x, y] = place(mark.outer + GAP + extent);
6605
+ } else {
6606
+ const placed2 = placeBestFitLabel(
6607
+ {
6608
+ cx: mark.cx,
6609
+ cy: mark.cy,
6610
+ outerR: mark.outer,
6611
+ startAngle: mark.start - Math.PI / 2,
6612
+ endAngle: mark.end - Math.PI / 2
6613
+ },
6614
+ m.w,
6615
+ m.h
6616
+ );
6617
+ x = placed2.x;
6618
+ y = placed2.y;
6619
+ }
6620
+ draw(m, label, x, y, "middle", out);
6621
+ }
6622
+ }
6623
+ function hasOutsideLabels(model) {
6624
+ return model.series.some(
6625
+ (s2) => s2.labels?.some(
6626
+ (l) => l !== void 0 && ["bestFit", "outEnd"].includes(l.position ?? "bestFit")
6627
+ )
6628
+ );
6629
+ }
6630
+
6631
+ // chart/render/chart-svg-bars.ts
6632
+ function barLayout(model, frame2) {
6633
+ const count = Math.max(1, model.series.length);
6634
+ const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
6635
+ const barSize = geometry.singleBarWidth;
6636
+ const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
6637
+ return { barSize, offset };
6638
+ }
6639
+ function bars(model, frame2, out, values) {
6640
+ const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
6641
+ const { barSize, offset: barOffset } = barLayout(model, frame2);
6642
+ const base = frame2.value(0);
6643
+ const pos = new Array(model.categories.length).fill(0);
6644
+ const neg = new Array(model.categories.length).fill(0);
6645
+ const marks = [];
6646
+ model.series.forEach((s2, si) => {
6647
+ values[si]?.forEach((v, i2) => {
6648
+ if (v === null || i2 >= model.categories.length) return;
6649
+ let from = 0;
6650
+ let to = v;
6651
+ if (stacked) {
6652
+ const acc = v >= 0 ? pos : neg;
6653
+ from = acc[i2] ?? 0;
6654
+ to = from + v;
6655
+ acc[i2] = to;
6656
+ }
6657
+ const a2 = stacked ? frame2.value(from) : base;
6658
+ const b = frame2.value(to);
6659
+ const offset = barOffset(si);
6660
+ const center = frame2.band(i2);
6661
+ const width = model.horizontal ? Math.abs(b - a2) : barSize;
6662
+ const height = model.horizontal ? barSize : Math.abs(b - a2);
6663
+ let color = s2.pointColors?.[i2] ?? s2.color;
6664
+ const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
6665
+ if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
6666
+ const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
6667
+ if (baseId) {
6668
+ const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
6669
+ const def = buildChartGradientDef(id, gradient, {
6670
+ width: Number(n(width)),
6671
+ height: Number(n(height)),
6672
+ shape: "rect"
6673
+ });
6674
+ out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
6675
+ color = `url(#${id})`;
6676
+ }
6677
+ }
6678
+ out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
6679
+ const box = model.horizontal ? { x: Math.min(a2, b), y: center + offset, w: Math.abs(b - a2), h: barSize } : { x: center + offset, y: Math.min(a2, b), w: barSize, h: Math.abs(b - a2) };
6680
+ out.push(rect(box.x, box.y, box.w, box.h, color, s2.shadowFilter));
6681
+ out.push("</g>");
6682
+ marks.push({ series: s2, index: i2, ...box, negative: v < 0 });
6683
+ });
6684
+ });
6685
+ barLabels(model, marks, out);
6686
+ }
6687
+
6688
+ // chart/render/chart-svg-analysis.ts
6689
+ var DASHES = {
6690
+ dot: [1, 3],
6691
+ dash: [4, 3],
6692
+ lgDash: [8, 3],
6693
+ dashDot: [4, 3, 1, 3],
6694
+ lgDashDot: [8, 3, 1, 3],
6695
+ lgDashDotDot: [8, 3, 1, 3, 1, 3],
6696
+ sysDash: [3, 1],
6697
+ sysDot: [1, 1],
6698
+ sysDashDot: [3, 1, 1, 1],
6699
+ sysDashDotDot: [3, 1, 1, 1, 1, 1]
6700
+ };
6701
+ var CAP = 4;
6702
+ function strokeAttributes(stroke) {
6703
+ const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
6704
+ const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
6705
+ return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
6706
+ }
6707
+ var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
6708
+ function trendlines(series, si, xs, ys, plane, out) {
6709
+ for (const trendline of series.trendlines ?? []) {
6710
+ const fit2 = fitChartTrendline(trendline.fit, xs, ys);
6711
+ if (fit2.points.length < 2) continue;
6712
+ const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
6713
+ out.push(
6714
+ `<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
6715
+ );
6716
+ }
6717
+ }
6718
+ function errorBar(bars2, at2, values, plane, out) {
6719
+ const stroke = strokeAttributes(bars2.stroke);
6720
+ for (const side of ["plus", "minus"]) {
6721
+ if (bars2.barType !== side && bars2.barType !== "both") continue;
6722
+ const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
6723
+ const sign = side === "plus" ? 1 : -1;
6724
+ const [x1, y1] = plane(at2.x, at2.y);
6725
+ const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
6726
+ out.push(segment(x1, y1, x2, y2, stroke));
6727
+ if (!bars2.endCap) continue;
6728
+ if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
6729
+ else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
6730
+ }
6731
+ }
6732
+ function plottedPoints(series, xOf) {
6733
+ return series.values.flatMap((y, index) => {
6734
+ const x = xOf(index);
6735
+ return y === null || x === null ? [] : [{ x, y, index }];
6736
+ });
6737
+ }
6738
+ function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
6739
+ const points = plottedPoints(series, xOf);
6740
+ const xs = points.map((p) => p.x);
6741
+ const ys = points.map((p) => p.y);
6742
+ trendlines(series, si, xs, ys, plane, out);
6743
+ for (const bars2 of series.errorBars ?? []) {
6744
+ if (categoryAxis && bars2.direction === "x") continue;
6745
+ const values = bars2.direction === "x" ? xs : ys;
6746
+ points.forEach(
6747
+ (p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
6748
+ );
6749
+ }
6750
+ }
6751
+ function categoryAnalysis(model, frame2, out) {
6752
+ if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
6753
+ const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
6754
+ const barred = model.type === "bar" || model.type === "column";
6755
+ const layout = barred ? barLayout(model, frame2) : void 0;
6756
+ model.series.forEach((series, si) => {
6757
+ if (!series.trendlines && !series.errorBars) return;
6758
+ const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
6759
+ const barPlane = (x, y) => {
6760
+ const [px3, py] = plane(x, y);
6761
+ return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
6762
+ };
6763
+ seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
6764
+ });
6765
+ }
6766
+ function scatterAnalysis(model, px3, py, out) {
6767
+ const plane = (x, y) => [px3(x), py(y)];
6768
+ model.series.forEach((series, si) => {
6769
+ if (!series.trendlines && !series.errorBars) return;
6770
+ seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
6771
+ });
6772
+ }
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
+
6828
+ // chart/render/chart-scale.ts
6829
+ var clean = (n2) => Number(n2.toPrecision(12));
6830
+ function* units(raw2) {
6831
+ let exp = Math.floor(Math.log10(raw2)) - 1;
6832
+ for (; ; ) {
6833
+ const base = 10 ** exp;
6834
+ for (const m of [1, 2, 5]) yield clean(m * base);
6835
+ exp++;
6836
+ }
6837
+ }
6838
+ function niceScale(dataMin, dataMax, options2 = {}) {
6839
+ const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
6840
+ let lo = Number.isFinite(dataMin) ? dataMin : 0;
6841
+ let hi = Number.isFinite(dataMax) ? dataMax : 0;
6842
+ if (lo > hi) [lo, hi] = [hi, lo];
6843
+ if (lo === hi) {
6844
+ if (lo === 0) hi = 1;
6845
+ else if (options2.noZero) {
6846
+ const pad2 = Math.abs(lo) * 0.1 || 1;
6847
+ lo -= pad2;
6848
+ hi += pad2;
6849
+ } else if (lo > 0) lo = 0;
6850
+ else hi = 0;
6851
+ }
6852
+ let fixedLo = false;
6853
+ let fixedHi = false;
6854
+ if (!options2.noZero) {
6855
+ if (lo >= 0 && hi - lo >= hi / 6) {
6856
+ lo = 0;
6857
+ fixedLo = true;
6858
+ } else if (hi <= 0 && hi - lo >= -lo / 6) {
6859
+ hi = 0;
6860
+ fixedHi = true;
6861
+ }
6862
+ }
6863
+ const range = hi - lo;
6864
+ const top = fixedHi ? hi : hi + range * 0.05;
6865
+ const bottom = fixedLo ? lo : lo - range * 0.05;
6866
+ for (const unit of units(range / maxIntervals)) {
6867
+ const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
6868
+ const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
6869
+ const intervals = Math.round((max - min) / unit);
6870
+ if (intervals <= maxIntervals && intervals > 0) {
6871
+ const ticks = [];
6872
+ for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
6873
+ return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
6874
+ }
6875
+ }
6876
+ return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
6877
+ }
6878
+ var PERCENT_SCALE = {
6879
+ min: 0,
6880
+ max: 1,
6881
+ majorUnit: 0.1,
6882
+ ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
6883
+ };
6884
+ function formatAxisValue(value, percent = false) {
6885
+ if (percent) return `${clean(value * 100)}%`;
6886
+ const v = clean(value);
6887
+ if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
6888
+ return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
6889
+ const [int2 = "0", frac] = String(Math.abs(v)).split(".");
6890
+ const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6891
+ return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
6892
+ }
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
+
6288
7217
  // chart/render/chart-view-analysis.ts
6289
7218
  function strokeOf(line3, fallback, resolve) {
6290
7219
  if (line3?.fill?.kind === "none") return void 0;
@@ -6334,15 +7263,15 @@ function seriesName(series, index, evaluateRef) {
6334
7263
  const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
6335
7264
  return fromRef || series.name || `Series${index + 1}`;
6336
7265
  }
6337
- function seriesContext(chart, theme, options) {
7266
+ function seriesContext(chart, theme, options2) {
6338
7267
  const scheme = chartColorScheme(theme);
6339
7268
  const resolver = { scheme: (name) => scheme[name] };
6340
7269
  return {
6341
7270
  theme,
6342
7271
  scheme,
6343
7272
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
6344
- evaluateRef: options.evaluateRef ?? (() => []),
6345
- seriesColor: options.seriesColor,
7273
+ evaluateRef: options2.evaluateRef ?? (() => []),
7274
+ seriesColor: options2.seriesColor,
6346
7275
  drawingColor: (color) => color && drawingColorCss(resolveDrawingColor(color, resolver, { transformOrder: "document" })),
6347
7276
  gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
6348
7277
  fill,
@@ -6368,7 +7297,11 @@ function seriesView(ctx, s2, index, total, categoriesOf) {
6368
7297
  })
6369
7298
  );
6370
7299
  if (Object.keys(points).length) view.pointGradients = points;
6371
- 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
+ );
6372
7305
  return view;
6373
7306
  }
6374
7307
 
@@ -6541,6 +7474,64 @@ function chartTitleText(chart, theme) {
6541
7474
  };
6542
7475
  }
6543
7476
 
7477
+ // chart/render/chart-view-labels.ts
7478
+ function labelsOf(source, view, categories, numberFormat2) {
7479
+ const { chart, series, points } = source;
7480
+ if ((series?.deleted ?? chart?.deleted) === true) return void 0;
7481
+ const percentBase = view.values.reduce(
7482
+ (sum, v) => sum + (v === null ? 0 : Math.abs(v)),
7483
+ 0
7484
+ );
7485
+ const out = [];
7486
+ let any = false;
7487
+ view.values.forEach((value, i2) => {
7488
+ const point = points?.[i2];
7489
+ if (value === null || point?.deleted === true) return;
7490
+ const position = point?.position ?? series?.position ?? chart?.position;
7491
+ const x = view.xValues?.[i2];
7492
+ const category = x === void 0 || x === null ? categories[i2] : formatAxisValue(x);
7493
+ let built;
7494
+ if (point?.text !== void 0) built = { text: point.text };
7495
+ else {
7496
+ const flags = resolveDataLabelFlags({
7497
+ ...point ? { point } : {},
7498
+ ...series ? { series } : {},
7499
+ ...chart ? { chart } : {}
7500
+ });
7501
+ built = composeDataLabelText({
7502
+ flags,
7503
+ seriesName: view.name,
7504
+ category,
7505
+ value,
7506
+ numberFormat: point?.numberFormat ?? series?.numberFormat ?? chart?.numberFormat ?? numberFormat2,
7507
+ percentBase,
7508
+ bubbleSize: view.sizes?.[i2] ?? void 0,
7509
+ formatValue: (v) => formatAxisValue(v),
7510
+ formatBubbleSize: (size) => formatAxisValue(size)
7511
+ });
7512
+ }
7513
+ if (!built) return;
7514
+ any = true;
7515
+ out[i2] = {
7516
+ text: built.text,
7517
+ ...position ? { position } : {},
7518
+ ...built.color ? { color: built.color } : {}
7519
+ };
7520
+ });
7521
+ return any ? out : void 0;
7522
+ }
7523
+ function applyDataLabels(model, sources, extra) {
7524
+ const apply = (source, view) => {
7525
+ if (!source?.dataLabels) return;
7526
+ const labels = labelsOf(source.dataLabels, view, model.categories, source.numberFormat);
7527
+ if (labels) view.labels = labels;
7528
+ };
7529
+ model.series.forEach((view, i2) => apply(sources[i2], view));
7530
+ model.extraGroups?.forEach(
7531
+ (group2, g2) => group2.series.forEach((view, i2) => apply(extra[g2]?.series[i2], view))
7532
+ );
7533
+ }
7534
+
6544
7535
  // chart/render/chart-view-ex.ts
6545
7536
  function groupsAxis(groups, categories) {
6546
7537
  let min = Infinity;
@@ -6610,11 +7601,11 @@ function histogramView(chart, model) {
6610
7601
  const first2 = model.series[0];
6611
7602
  if (!first2) return;
6612
7603
  const raw2 = first2.values.map((v) => v ?? Number.NaN);
6613
- const options = chart.histogram ?? {};
6614
- const bins = options.aggregateByCategory ? aggregateByCategory(
7604
+ const options2 = chart.histogram ?? {};
7605
+ const bins = options2.aggregateByCategory ? aggregateByCategory(
6615
7606
  first2.values.map((v) => v ?? 0),
6616
7607
  model.categories
6617
- ) : computeHistogramBins(raw2, options, formatAxisValue);
7608
+ ) : computeHistogramBins(raw2, options2, formatAxisValue);
6618
7609
  model.categories = bins.map((bin) => bin.label);
6619
7610
  first2.values = bins.map((bin) => bin.value);
6620
7611
  model.barGapWidth = 0;
@@ -6638,11 +7629,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
6638
7629
  "treemap",
6639
7630
  "sunburst"
6640
7631
  ]);
6641
- function chartSummaryView(chart, theme, options = {}) {
7632
+ function chartSummaryView(chart, theme, options2 = {}) {
6642
7633
  const type = chart.chartType;
6643
7634
  const radial = type === "pie" || type === "doughnut";
6644
7635
  const byPoint = radial || type === "treemap" || type === "sunburst";
6645
- const ctx = seriesContext(chart, theme, options);
7636
+ const ctx = seriesContext(chart, theme, options2);
6646
7637
  const { palette, scheme, drawingColor } = ctx;
6647
7638
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
6648
7639
  const rawCategories = [];
@@ -6726,128 +7717,23 @@ function chartSummaryView(chart, theme, options = {}) {
6726
7717
  chartExtraView(chart, model, ctx, total, collect);
6727
7718
  if (type === "waterfall") waterfallView(chart, model, ctx);
6728
7719
  else if (!byPoint) model.valueAxis = valueAxis(model);
7720
+ applyDataLabels(model, chart.series, extra);
6729
7721
  chartExtraAxes(model);
7722
+ applyChartAxes(model, chart, ctx.drawingColor);
6730
7723
  return model;
6731
7724
  }
6732
7725
 
6733
- // text/css-font-family.ts
6734
- var FALLBACKS = {
6735
- calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6736
- "calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6737
- cambria: '"Cambria", "Caladea", Georgia, serif',
6738
- arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
6739
- "times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
6740
- "courier new": '"Courier New", "Liberation Mono", monospace',
6741
- aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
6742
- };
6743
- function cssFontFamily(name) {
6744
- const known = FALLBACKS[name.toLowerCase()];
6745
- if (known) return known;
6746
- const quoted = `"${name.replace(/["\\]/g, "")}"`;
6747
- return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
6748
- }
6749
-
6750
- // chart/render/chart-svg-appearance.ts
6751
- var nextPaintId = 0;
6752
- function chartGradientPaint(model, width = 1024, height = 768) {
6753
- const prefix = `xlsx-chart-${++nextPaintId}`;
6754
- const appearance = { ...model.appearance };
6755
- const defs = [];
6756
- const shadowPaint = (shadow, suffix) => {
6757
- const id = `${prefix}-${suffix}`;
6758
- const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
6759
- defs.push(
6760
- `<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
6761
- );
6762
- return `url(#${id})`;
6763
- };
6764
- for (const [part, entry3] of Object.entries(appearance)) {
6765
- if (entry3?.textShadow)
6766
- appearance[part] = {
6767
- ...entry3,
6768
- textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
6769
- };
6770
- }
6771
- const paint2 = (gradient, suffix, bounds2) => {
6772
- const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
6773
- defs.push(chartGradientMarkup(def));
6774
- return `url(#${def.id})`;
6775
- };
6776
- for (const part of ["chartArea", "plotArea"]) {
6777
- const entry3 = appearance[part];
6778
- if (!entry3?.gradient) continue;
6779
- if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
6780
- appearance[part] = {
6781
- ...entry3,
6782
- fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
6783
- };
6784
- }
6785
- const series = model.series.map((source, index) => {
6786
- const view = { ...source };
6787
- if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
6788
- const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
6789
- if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
6790
- if (source.pointGradients) {
6791
- view.pointColors = [...source.pointColors ?? []];
6792
- for (const [key, gradient] of Object.entries(source.pointGradients))
6793
- view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
6794
- }
6795
- return view;
6796
- });
6797
- return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
6798
- }
6799
- function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
6800
- const entry3 = model.appearance?.[part];
6801
- return {
6802
- size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
6803
- ...entry3?.color === void 0 ? {} : { fill: entry3.color },
6804
- ...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
6805
- ...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
6806
- ...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
6807
- ...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
6808
- ...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
6809
- };
6810
- }
6811
- function chartStroke(model, part) {
6812
- const entry3 = model.appearance?.[part];
6813
- return {
6814
- color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
6815
- width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
6816
- };
6817
- }
6818
- function chartAreaRect(model, part, area) {
6819
- if (area.w <= 0 || area.h <= 0) return "";
6820
- const entry3 = model.appearance?.[part];
6821
- let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
6822
- let defs = "";
6823
- if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
6824
- const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
6825
- width: area.w,
6826
- height: area.h,
6827
- shape: "rect"
6828
- });
6829
- defs = `<defs>${chartGradientMarkup(def)}</defs>`;
6830
- fill = `url(#${def.id})`;
6831
- }
6832
- const stroke = entry3?.lineColor ?? "none";
6833
- if (fill === "none" && stroke === "none") return "";
6834
- const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
6835
- return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
6836
- }
6837
-
6838
7726
  // chart/render/chart-svg-cartesian.ts
6839
7727
  function cartesianAxes(model, area, out) {
6840
7728
  const scale = model.valueAxis;
6841
7729
  if (!scale) return void 0;
6842
- const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
7730
+ const labels = scale.ticks.map((t) => axisTickText(t, model.axes?.value, scale.percent));
6843
7731
  const valueAttrs = chartTextAttributes(model, "valueAxis");
6844
7732
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
6845
7733
  const valueSize = valueAttrs.size ?? 10;
6846
7734
  const categorySize = categoryAttrs.size ?? 10;
6847
- const grid = chartStroke(model, "gridlineMajor");
6848
- const axis = chartStroke(model, "categoryAxis");
6849
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
6850
- 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;
6851
7737
  const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
6852
7738
  const horizontal = model.horizontal;
6853
7739
  const cats = Math.max(1, model.categories.length);
@@ -6856,7 +7742,7 @@ function cartesianAxes(model, area, out) {
6856
7742
  Math.max(...model.categories.map((c2) => textWidth(c2, categorySize)), 8) + 6
6857
7743
  );
6858
7744
  const second = horizontal ? void 0 : model.secondaryAxis;
6859
- const secondLabels = second?.ticks.map((t) => formatAxisValue(t, second.percent)) ?? [];
7745
+ const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
6860
7746
  const secondW = second ? valueLabels ? Math.max(...secondLabels.map((l) => textWidth(l, valueSize)), 8) + 8 : 4 : 0;
6861
7747
  const plot = horizontal ? {
6862
7748
  x: area.x + catW,
@@ -6869,29 +7755,47 @@ function cartesianAxes(model, area, out) {
6869
7755
  w: Math.max(1, area.w - labelW - 4 - secondW),
6870
7756
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
6871
7757
  };
6872
- const span = scale.max - scale.min || 1;
6873
- 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;
6874
7759
  const bandSize = (horizontal ? plot.h : plot.w) / cats;
6875
- 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);
6876
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
+ );
6877
7775
  scale.ticks.forEach((t, i2) => {
6878
7776
  const p = value(t);
6879
7777
  const label = labels[i2] ?? "";
6880
7778
  if (horizontal) {
6881
- out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
6882
7779
  if (valueLabels)
6883
7780
  out.push(
6884
7781
  text2(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
6885
7782
  );
6886
7783
  } else {
6887
- out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
6888
7784
  if (valueLabels)
6889
7785
  out.push(text2(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
6890
7786
  }
6891
7787
  });
6892
- const zero = value(Math.min(Math.max(0, scale.min), scale.max));
6893
- if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
6894
- 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
+ );
6895
7799
  const step = Math.max(
6896
7800
  1,
6897
7801
  Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
@@ -6916,20 +7820,23 @@ function cartesianAxes(model, area, out) {
6916
7820
  });
6917
7821
  const frame2 = { plot, value, band, bandSize };
6918
7822
  if (second) {
6919
- const secondSpan = second.max - second.min || 1;
6920
- frame2.secondary = (v) => plot.y + plot.h - (v - second.min) / secondSpan * plot.h;
6921
- const secondAxis = chartStroke(model, "valueAxis");
7823
+ frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
6922
7824
  out.push(
6923
- line(
7825
+ axisLine(
7826
+ model,
7827
+ model.axes?.secondary,
7828
+ "valueAxis",
6924
7829
  plot.x + plot.w,
6925
7830
  plot.y,
6926
7831
  plot.x + plot.w,
6927
- plot.y + plot.h,
6928
- secondAxis.color,
6929
- secondAxis.width
7832
+ plot.y + plot.h
6930
7833
  )
6931
7834
  );
6932
- 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))
6933
7840
  second.ticks.forEach(
6934
7841
  (t, i2) => out.push(
6935
7842
  text2(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i2] ?? "", {
@@ -6953,6 +7860,7 @@ function linesAndAreas(model, frame2, out) {
6953
7860
  const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
6954
7861
  const acc = new Array(model.categories.length).fill(0);
6955
7862
  const area = model.type === "area";
7863
+ const marks = [];
6956
7864
  const layers2 = [];
6957
7865
  model.series.forEach((s2, si) => {
6958
7866
  const points = [];
@@ -6967,16 +7875,24 @@ function linesAndAreas(model, frame2, out) {
6967
7875
  const top = below2 + (v ?? 0);
6968
7876
  if (stacked) acc[i2] = top;
6969
7877
  points.push([frame2.band(i2), frame2.value(top)]);
7878
+ marks.push({
7879
+ series: s2,
7880
+ index: i2,
7881
+ x: frame2.band(i2),
7882
+ y: frame2.value(top),
7883
+ radius: area ? 0 : chartMarkerRadius(s2, i2, 2.5)
7884
+ });
6970
7885
  lower.push([frame2.band(i2), frame2.value(below2)]);
6971
7886
  });
6972
7887
  layers2.push({
7888
+ series: s2,
6973
7889
  points,
6974
7890
  lower,
6975
7891
  color: s2.color,
6976
7892
  filter: s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""
6977
7893
  });
6978
7894
  });
6979
- for (const { points, lower, color, filter } of area ? [...layers2].reverse() : layers2) {
7895
+ for (const { points, lower, color, filter, series } of area ? [...layers2].reverse() : layers2) {
6980
7896
  if (area) {
6981
7897
  const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
6982
7898
  out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
@@ -6995,10 +7911,11 @@ function linesAndAreas(model, frame2, out) {
6995
7911
  else segment2.push(`${n(x)},${n(y)}`);
6996
7912
  }
6997
7913
  flush();
6998
- for (const [x, y] of points)
6999
- if (!Number.isNaN(x))
7000
- 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
+ });
7001
7917
  }
7918
+ pointLabels(model, marks, out);
7002
7919
  }
7003
7920
 
7004
7921
  // chart/render/chart-svg-xy.ts
@@ -7006,16 +7923,14 @@ function scatter(model, area, out) {
7006
7923
  const ys = model.valueAxis;
7007
7924
  const xs = model.xAxis;
7008
7925
  if (!ys || !xs) return;
7009
- const yLabels = ys.ticks.map((t) => formatAxisValue(t));
7926
+ const yLabels = ys.ticks.map((t) => axisTickText(t, model.axes?.value));
7010
7927
  const valueAttrs = chartTextAttributes(model, "valueAxis");
7011
7928
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
7012
7929
  const valueSize = valueAttrs.size ?? 10;
7013
7930
  const categorySize = categoryAttrs.size ?? 10;
7014
- const grid = chartStroke(model, "gridlineMajor");
7015
7931
  const xAxis = chartStroke(model, "categoryAxis");
7016
- const yAxis = chartStroke(model, "valueAxis");
7017
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
7018
- 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;
7019
7934
  const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
7020
7935
  const plot = {
7021
7936
  x: area.x + labelW,
@@ -7035,17 +7950,24 @@ function scatter(model, area, out) {
7035
7950
  s2.values.forEach((_, i2) => {
7036
7951
  reach = Math.max(reach, radiusOf(s2.sizes?.[i2] ?? void 0) ?? 0);
7037
7952
  });
7038
- const widen = (s2, length) => {
7953
+ const widen = (s2, length, axis) => {
7954
+ if (axis?.range.logScale) return s2;
7039
7955
  const pad2 = reach * (s2.max - s2.min || 1) / Math.max(1, length - 2 * reach);
7040
- 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
+ };
7041
7961
  };
7042
- const xView = widen(xs, plot.w);
7043
- const yView = widen(ys, plot.h);
7044
- const px3 = (v) => plot.x + (v - xView.min) / (xView.max - xView.min || 1) * plot.w;
7045
- 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;
7046
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));
7047
7970
  ys.ticks.forEach((t, i2) => {
7048
- out.push(line(plot.x, py(t), plot.x + plot.w, py(t), grid.color, grid.width));
7049
7971
  if (valueLabels)
7050
7972
  out.push(
7051
7973
  text2(plot.x - 4, py(t) + valueSize * 0.3, yLabels[i2] ?? "", {
@@ -7055,19 +7977,31 @@ function scatter(model, area, out) {
7055
7977
  );
7056
7978
  });
7057
7979
  for (const t of xs.ticks) {
7058
- 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));
7059
7982
  if (categoryLabels)
7060
7983
  out.push(
7061
- 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), {
7062
7985
  anchor: "middle",
7063
7986
  ...categoryAttrs
7064
7987
  })
7065
7988
  );
7066
7989
  }
7067
7990
  out.push(
7068
- 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)
7069
8003
  );
7070
- out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
8004
+ const marks = [];
7071
8005
  for (const [si, s2] of model.series.entries())
7072
8006
  s2.values.forEach((v, i2) => {
7073
8007
  const x = s2.xValues?.[i2] ?? null;
@@ -7075,15 +8009,18 @@ function scatter(model, area, out) {
7075
8009
  const filter = s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : "";
7076
8010
  const fill = s2.pointColors?.[i2] ?? s2.color;
7077
8011
  if (!bubble) {
7078
- out.push(`<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter}/>`);
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) });
7079
8014
  return;
7080
8015
  }
7081
8016
  const r = radiusOf(s2.sizes?.[i2] ?? void 0);
7082
8017
  if (r === void 0) return;
8018
+ marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: r });
7083
8019
  out.push(
7084
8020
  `<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="${n(r)}" fill="${fill}" fill-opacity="0.6" data-chart-series="${si}" data-chart-point="${i2}"${filter}/>`
7085
8021
  );
7086
8022
  });
8023
+ pointLabels(model, marks, out);
7087
8024
  scatterAnalysis(model, px3, py, out);
7088
8025
  }
7089
8026
 
@@ -7248,7 +8185,9 @@ function pieSvg(model, area) {
7248
8185
  const out = [chartAreaRect(model, "plotArea", area)];
7249
8186
  const cx2 = area.x + area.w / 2;
7250
8187
  const cy = area.y + area.h / 2;
7251
- const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
8188
+ const margin = hasOutsideLabels(model) ? Math.min(area.w, area.h) * 0.12 : 0;
8189
+ const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4 - margin);
8190
+ const slices = [];
7252
8191
  const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
7253
8192
  const hole = model.type === "doughnut" ? radius * 0.5 : 0;
7254
8193
  const ringSize = (radius - hole) / Math.max(1, rings.length);
@@ -7265,9 +8204,20 @@ function pieSvg(model, area) {
7265
8204
  out.push(
7266
8205
  `<path d="${slicePath(cx2, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
7267
8206
  );
8207
+ slices.push({
8208
+ series: s2,
8209
+ index: i2,
8210
+ cx: cx2,
8211
+ cy,
8212
+ outer,
8213
+ inner,
8214
+ start: angle,
8215
+ end: angle + sweep
8216
+ });
7268
8217
  angle += sweep;
7269
8218
  });
7270
8219
  });
8220
+ sliceLabels(model, slices, out);
7271
8221
  return out.join("");
7272
8222
  }
7273
8223
  function radarSvg(model, area) {
@@ -7280,32 +8230,37 @@ function radarSvg(model, area) {
7280
8230
  const valueSize = valueAttrs.size ?? 9;
7281
8231
  const categorySize = categoryAttrs.size ?? 10;
7282
8232
  const grid = chartStroke(model, "gridlineMajor");
7283
- const axis = chartStroke(model, "categoryAxis");
7284
8233
  const cx2 = area.x + area.w / 2;
7285
8234
  const cy = area.y + area.h / 2 + 4;
7286
8235
  const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
7287
8236
  const angle = (i2) => i2 / count * Math.PI * 2;
7288
- const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
8237
+ const r = (v) => chartAxisRatio(v, scale, model.axes?.value) * radius;
7289
8238
  const labelEvery = Math.max(
7290
8239
  1,
7291
8240
  Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
7292
8241
  );
7293
8242
  for (const [k, t] of scale.ticks.entries()) {
7294
8243
  const ring = Array.from({ length: count }, (_, i2) => polar(cx2, cy, r(t), angle(i2))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7295
- out.push(
7296
- `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
7297
- );
7298
- if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
8244
+ if (!model.axes?.value || model.axes.value.source.majorGridlines)
7299
8245
  out.push(
7300
- text2(cx2 + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
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)
8249
+ out.push(
8250
+ text2(
8251
+ cx2 + 3,
8252
+ cy - r(t) + valueSize * 0.3,
8253
+ axisTickText(t, model.axes?.value, scale.percent),
8254
+ valueAttrs
8255
+ )
7301
8256
  );
7302
8257
  }
7303
8258
  model.categories.forEach((c2, i2) => {
7304
8259
  const [x, y] = polar(cx2, cy, radius, angle(i2));
7305
- out.push(line(cx2, cy, x, y, axis.color, axis.width));
8260
+ out.push(axisLine(model, model.axes?.category, "categoryAxis", cx2, cy, x, y));
7306
8261
  const [lx, ly] = polar(cx2, cy, radius + 10, angle(i2));
7307
8262
  const anchor = Math.abs(lx - cx2) < 2 ? "middle" : lx > cx2 ? "start" : "end";
7308
- if (model.appearance?.categoryAxis?.labelsVisible !== false)
8263
+ if (chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false)
7309
8264
  out.push(
7310
8265
  text2(lx, ly + categorySize * 0.3, fit(c2, area.w / 4, categorySize), {
7311
8266
  anchor,
@@ -7313,12 +8268,22 @@ function radarSvg(model, area) {
7313
8268
  })
7314
8269
  );
7315
8270
  });
8271
+ const marks = [];
7316
8272
  for (const s2 of model.series) {
7317
- const points = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
8273
+ const vertices = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2)));
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
+ });
8281
+ const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7318
8282
  out.push(
7319
8283
  `<polygon points="${points}" fill="none" stroke="${s2.color}" stroke-width="2"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
7320
8284
  );
7321
8285
  }
8286
+ pointLabels(model, marks, out);
7322
8287
  return out.join("");
7323
8288
  }
7324
8289
 
@@ -7409,33 +8374,33 @@ var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
7409
8374
  function cssFont(attrs) {
7410
8375
  return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
7411
8376
  }
7412
- function chartFontMetrics(attrs, options) {
7413
- const metrics = options.measureFont?.(cssFont(attrs));
8377
+ function chartFontMetrics(attrs, options2) {
8378
+ const metrics = options2.measureFont?.(cssFont(attrs));
7414
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;
7415
8380
  }
7416
- function chartTextWidth(content2, attrs, options) {
7417
- const width = options.measureText?.(content2, cssFont(attrs));
8381
+ function chartTextWidth(content2, attrs, options2) {
8382
+ const width = options2.measureText?.(content2, cssFont(attrs));
7418
8383
  return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content2, attrs.size);
7419
8384
  }
7420
- function fitChartText(content2, maxWidth, attrs, options) {
7421
- if (!options.measureText) return fit(content2, maxWidth, attrs.size);
7422
- 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;
7423
8388
  const points = [...content2];
7424
8389
  let low = 0;
7425
8390
  let high = points.length;
7426
8391
  while (low < high) {
7427
8392
  const mid = Math.ceil((low + high) / 2);
7428
- 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;
7429
8394
  else high = mid - 1;
7430
8395
  }
7431
8396
  return `${points.slice(0, low).join("")}\u2026`;
7432
8397
  }
7433
8398
 
7434
8399
  // chart/render/chart-svg-legend.ts
7435
- function chartLegendSvg(model, area, frame2, options) {
8400
+ function chartLegendSvg(model, area, frame2, options2) {
7436
8401
  const automatic = [];
7437
8402
  const bounds2 = {};
7438
- const reserved = automaticLegend(model, area, automatic, options, bounds2);
8403
+ const reserved = automaticLegend(model, area, automatic, options2, bounds2);
7439
8404
  const plot = model.legendOverlay ? area : reserved;
7440
8405
  const box = bounds2.box;
7441
8406
  if (!box) return { plot, markup: "", foreground: false };
@@ -7449,11 +8414,11 @@ function chartLegendSvg(model, area, frame2, options) {
7449
8414
  const entries = legendEntries(model);
7450
8415
  const attrs = chartTextAttributes(model, "legend");
7451
8416
  const size = attrs.size ?? 10;
7452
- const font = chartFontMetrics(attrs, options);
8417
+ const font = chartFontMetrics(attrs, options2);
7453
8418
  const keySize = size / 2;
7454
8419
  const keyGap = size / 4;
7455
8420
  const widths = entries.map(
7456
- (entry3) => chartTextWidth(entry3.label, attrs, options) + keySize + keyGap
8421
+ (entry3) => chartTextWidth(entry3.label, attrs, options2) + keySize + keyGap
7457
8422
  );
7458
8423
  const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
7459
8424
  const rowWidth = horizontal ? manual.width / entries.length : manual.width;
@@ -7468,8 +8433,8 @@ function chartLegendSvg(model, area, frame2, options) {
7468
8433
  ];
7469
8434
  const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
7470
8435
  entries.forEach((entry3, i2) => {
7471
- const available = horizontal ? chartTextWidth(entry3.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
7472
- 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);
7473
8438
  const contentWidth = Math.min(
7474
8439
  horizontal ? widths[i2] ?? 0 : Math.max(...widths),
7475
8440
  rowWidth - size / 2
@@ -7512,7 +8477,7 @@ function legendEntries(model) {
7512
8477
  color: s2.color
7513
8478
  }));
7514
8479
  }
7515
- function automaticLegend(model, area, out, options, bounds2) {
8480
+ function automaticLegend(model, area, out, options2, bounds2) {
7516
8481
  const entries = legendEntries(model);
7517
8482
  if (!model.showLegend || entries.length === 0) return area;
7518
8483
  const pos = model.legendPosition;
@@ -7521,7 +8486,7 @@ function automaticLegend(model, area, out, options, bounds2) {
7521
8486
  const rowH = Math.max(16, size * 1.4);
7522
8487
  if (pos === "t" || pos === "b") {
7523
8488
  const widths = entries.map(
7524
- (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)
7525
8490
  );
7526
8491
  const total = widths.reduce((a2, b) => a2 + b, 0);
7527
8492
  let x2 = area.x + Math.max(0, (area.w - total) / 2);
@@ -7538,14 +8503,14 @@ function automaticLegend(model, area, out, options, bounds2) {
7538
8503
  entries.forEach((e, i2) => {
7539
8504
  const w = widths[i2] ?? 0;
7540
8505
  out.push(rect(x2, y, 8, 8, e.color));
7541
- 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));
7542
8507
  x2 += w;
7543
8508
  });
7544
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 };
7545
8510
  }
7546
8511
  const width = Math.min(
7547
8512
  area.w * 0.35,
7548
- Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
8513
+ Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options2))) + 22
7549
8514
  );
7550
8515
  const height = entries.length * rowH;
7551
8516
  const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
@@ -7563,14 +8528,14 @@ function automaticLegend(model, area, out, options, bounds2) {
7563
8528
  const y = y0 + i2 * rowH;
7564
8529
  if (y + rowH > area.y + area.h + 2) return;
7565
8530
  out.push(rect(x, y + 3, 8, 8, e.color));
7566
- 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));
7567
8532
  });
7568
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 };
7569
8534
  }
7570
8535
 
7571
8536
  // text/wrap-styled-runs.ts
7572
8537
  var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
7573
- function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
8538
+ function wrapStyledRuns(runs, maxWidth, measure4, options2 = {}) {
7574
8539
  const groups = [];
7575
8540
  for (const [source, run2] of runs.entries()) {
7576
8541
  for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
@@ -7593,7 +8558,7 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
7593
8558
  return result2;
7594
8559
  };
7595
8560
  const width = (pieces) => pieces.reduce((sum, piece) => {
7596
- const advance = measure3(piece.text, piece.run);
8561
+ const advance = measure4(piece.text, piece.run);
7597
8562
  return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
7598
8563
  }, 0);
7599
8564
  const result = [];
@@ -7618,7 +8583,7 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
7618
8583
  if (line3.length && width(merged(line3, [...separator, ...group2.pieces])) > maxWidth) flush();
7619
8584
  else line3 = merged(line3, separator);
7620
8585
  spaces = [];
7621
- if (options.breakWords && wordWidth > maxWidth) {
8586
+ if (options2.breakWords && wordWidth > maxWidth) {
7622
8587
  for (const piece of group2.pieces) {
7623
8588
  for (const { segment: segment2 } of graphemes.segment(piece.text)) {
7624
8589
  const next = { ...piece, text: segment2 };
@@ -7636,11 +8601,11 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
7636
8601
  function spacing2(value, naturalHeight, fallback) {
7637
8602
  return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
7638
8603
  }
7639
- function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
8604
+ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
7640
8605
  if (!model.title) return void 0;
7641
8606
  const base = chartTextAttributes(model, "title", 14);
7642
8607
  const capacity = Math.max(1, width * 0.8 - 8);
7643
- 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)
7644
8609
  return void 0;
7645
8610
  const paragraphs = model.titleText?.paragraphs ?? [
7646
8611
  {
@@ -7676,7 +8641,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7676
8641
  "title",
7677
8642
  base.size
7678
8643
  ),
7679
- options
8644
+ options2
7680
8645
  ),
7681
8646
  { breakWords: true }
7682
8647
  );
@@ -7700,10 +8665,10 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7700
8665
  return {
7701
8666
  ...line3,
7702
8667
  runs,
7703
- 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),
7704
8669
  size: runs.length ? Math.max(...runs.map((run2) => run2.attrs.size ?? 14)) : base.size ?? 14,
7705
8670
  fontMetrics: (runs.length ? runs.map((run2) => run2.attrs) : [base]).map(
7706
- (attrs) => chartFontMetrics(attrs, options)
8671
+ (attrs) => chartFontMetrics(attrs, options2)
7707
8672
  )
7708
8673
  };
7709
8674
  });
@@ -7741,7 +8706,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7741
8706
  anchor: "start"
7742
8707
  }).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
7743
8708
  );
7744
- x += chartTextWidth(run2.text, run2.attrs, options);
8709
+ x += chartTextWidth(run2.text, run2.attrs, options2);
7745
8710
  }
7746
8711
  }
7747
8712
  const parent = text2(0, 0, "", { ...base, underline: false }).replace(
@@ -7767,7 +8732,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7767
8732
  }
7768
8733
 
7769
8734
  // chart/render/chart-svg.ts
7770
- function renderChartSvg(model, width, height, options = {}) {
8735
+ function renderChartSvg(model, width, height, options2 = {}) {
7771
8736
  const paint2 = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
7772
8737
  model = paint2.model;
7773
8738
  const w = Math.max(1, width);
@@ -7781,7 +8746,7 @@ function renderChartSvg(model, width, height, options = {}) {
7781
8746
  if (paint2.defs) out.push(paint2.defs);
7782
8747
  out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h: h2 }));
7783
8748
  let area = { x: 8, y: 8, w: w - 16, h: h2 - 16 };
7784
- const richTitle = chartRichTitleSvg(model, w, options, h2);
8749
+ const richTitle = chartRichTitleSvg(model, w, options2, h2);
7785
8750
  if (richTitle) {
7786
8751
  if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
7787
8752
  else out.push(richTitle.markup);
@@ -7790,9 +8755,9 @@ function renderChartSvg(model, width, height, options = {}) {
7790
8755
  } else if (model.title) {
7791
8756
  const attrs = chartTextAttributes(model, "title", 14);
7792
8757
  const size = attrs.size ?? 14;
7793
- const label = fitChartText(model.title, w - 16, attrs, options);
7794
- const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
7795
- 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);
7796
8761
  const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
7797
8762
  out.push(
7798
8763
  chartAreaRect(model, "title", {
@@ -7820,7 +8785,7 @@ function renderChartSvg(model, width, height, options = {}) {
7820
8785
  out.push("</svg>");
7821
8786
  return out.join("");
7822
8787
  }
7823
- const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options);
8788
+ const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options2);
7824
8789
  area = legend.plot;
7825
8790
  if (!legend.foreground) out.push(legend.markup);
7826
8791
  if (area.w > 4 && area.h > 4) {
@@ -7867,8 +8832,8 @@ function chartSpaceKind(space3) {
7867
8832
  const type = chartSummaryFromSpace(space3).chartType;
7868
8833
  return { type, drawn: DRAWN_CHART_TYPES.has(type) };
7869
8834
  }
7870
- function renderChartSpaceSvg(space3, options) {
7871
- 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;
7872
8837
  const summary = chartSummaryFromSpace(space3, {
7873
8838
  ...formatting ? { formatting } : {},
7874
8839
  ...colorPalette !== void 0 ? { colorPalette } : {},
@@ -7877,8 +8842,8 @@ function renderChartSpaceSvg(space3, options) {
7877
8842
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
7878
8843
  return renderChartSvg(view, width, height, svg);
7879
8844
  }
7880
- function renderChartSummarySvg(summary, options) {
7881
- const { width, height, theme, fonts, ...svg } = options;
8845
+ function renderChartSummarySvg(summary, options2) {
8846
+ const { width, height, theme, fonts, ...svg } = options2;
7882
8847
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
7883
8848
  return renderChartSvg(view, width, height, svg);
7884
8849
  }
@@ -8222,7 +9187,7 @@ __export(i18n_exports, {
8222
9187
  // i18n/locale.ts
8223
9188
  var SUPPORTED_OFFICE_LOCALES = ["en", "fr", "de", "es", "zh-CN"];
8224
9189
  var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
8225
- function normalizeLocale(input, supported, fallback, options = {}) {
9190
+ function normalizeLocale(input, supported, fallback, options2 = {}) {
8226
9191
  const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
8227
9192
  const language = parts[0];
8228
9193
  if (!language) return fallback;
@@ -8231,7 +9196,7 @@ function normalizeLocale(input, supported, fallback, options = {}) {
8231
9196
  if (exact) return exact;
8232
9197
  const base = find(language);
8233
9198
  if (base) return base;
8234
- const rejected = options.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
9199
+ const rejected = options2.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
8235
9200
  if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
8236
9201
  return supported.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
8237
9202
  }
@@ -8269,12 +9234,12 @@ function interpolate2(template, params, placeholder = "single") {
8269
9234
  (match, name) => Object.prototype.hasOwnProperty.call(params, name) && params[name] !== void 0 ? String(params[name]) : match
8270
9235
  );
8271
9236
  }
8272
- function createTranslator(messages, fallbacks = [], options = {}) {
8273
- const placeholder = options.placeholder ?? "single";
9237
+ function createTranslator(messages, fallbacks = [], options2 = {}) {
9238
+ const placeholder = options2.placeholder ?? "single";
8274
9239
  return (key, params) => {
8275
9240
  let text4 = messages?.[key];
8276
9241
  for (let i2 = 0; text4 === void 0 && i2 < fallbacks.length; i2++) text4 = fallbacks[i2]?.[key];
8277
- return interpolate2(text4 ?? options.missing?.(key) ?? key, params, placeholder);
9242
+ return interpolate2(text4 ?? options2.missing?.(key) ?? key, params, placeholder);
8278
9243
  };
8279
9244
  }
8280
9245
  function translateOr(translate, key, fallback, params) {
@@ -20784,9 +21749,9 @@ function paragraphsAt(text4, sizePt) {
20784
21749
  const afterParent = (text4.spaceAfterParent ?? DEFAULT_SPACE_AFTER_PARENT) / 100;
20785
21750
  const afterChild = (text4.spaceAfterChild ?? DEFAULT_SPACE_AFTER_CHILD) / 100;
20786
21751
  const { secondary } = paragraphSizesPt(text4, sizePt);
20787
- const paragraph2 = (value, level2) => {
20788
- const bullet = bulletLevel > 0 && level2 >= bulletLevel;
20789
- const size = bullet || level2 >= 2 ? secondary : sizePt;
21752
+ const paragraph2 = (value, level3) => {
21753
+ const bullet = bulletLevel > 0 && level3 >= bulletLevel;
21754
+ const size = bullet || level3 >= 2 ? secondary : sizePt;
20790
21755
  return {
20791
21756
  text: value,
20792
21757
  size,
@@ -21344,9 +22309,9 @@ function evaluateCondition(condition, point, lookup) {
21344
22309
  // diagram/engine/pres-tree.ts
21345
22310
  var MAX_DEPTH = 96;
21346
22311
  var MAX_NODES = 1e5;
21347
- function lookupVariable(node, name, options) {
21348
- if (name === "dir" && options.direction) {
21349
- return options.direction;
22312
+ function lookupVariable(node, name, options2) {
22313
+ if (name === "dir" && options2.direction) {
22314
+ return options2.direction;
21350
22315
  }
21351
22316
  let current = node;
21352
22317
  while (current) {
@@ -21460,8 +22425,8 @@ function buildNode(def, point, parent, state) {
21460
22425
  state.depth--;
21461
22426
  return node;
21462
22427
  }
21463
- function buildPresentationTree(def, doc, options = {}) {
21464
- 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 });
21465
22430
  }
21466
22431
 
21467
22432
  // diagram/engine/preferred-size.ts
@@ -22220,7 +23185,7 @@ function arrangeHierRoot(node) {
22220
23185
  }
22221
23186
 
22222
23187
  // diagram/engine/alg-linear.ts
22223
- function measure(node, box, horizontal, scale, uniform = false) {
23188
+ function measure2(node, box, horizontal, scale, uniform = false) {
22224
23189
  const refW = horizontal || uniform ? box.w * scale : box.w;
22225
23190
  const refH = !horizontal || uniform ? box.h * scale : box.h;
22226
23191
  evaluateWithReference(node, refW, refH);
@@ -22287,7 +23252,7 @@ function fitLinear(node, box, horizontal) {
22287
23252
  const along = horizontal ? box.w : box.h;
22288
23253
  const across = horizontal ? box.h : box.w;
22289
23254
  let scale = 1;
22290
- let current = measure(node, box, horizontal, scale);
23255
+ let current = measure2(node, box, horizontal, scale);
22291
23256
  const full = current;
22292
23257
  let crossLimited = true;
22293
23258
  for (let iteration = 0; iteration < 12; iteration++) {
@@ -22297,10 +23262,10 @@ function fitLinear(node, box, horizontal) {
22297
23262
  if (factor >= 0.99999) {
22298
23263
  break;
22299
23264
  }
22300
- const next = measure(node, box, horizontal, scale * factor);
23265
+ const next = measure2(node, box, horizontal, scale * factor);
22301
23266
  if (factor === fitAcross && next.cross >= current.cross - 1e-6) {
22302
23267
  crossLimited = false;
22303
- current = measure(node, box, horizontal, scale);
23268
+ current = measure2(node, box, horizontal, scale);
22304
23269
  continue;
22305
23270
  }
22306
23271
  scale *= factor;
@@ -22317,9 +23282,9 @@ function fitLinear(node, box, horizontal) {
22317
23282
  function fitUniform(node, box, horizontal, stuck) {
22318
23283
  const along = horizontal ? box.w : box.h;
22319
23284
  let scale = 1;
22320
- let current = measure(node, box, horizontal, 1, true);
23285
+ let current = measure2(node, box, horizontal, 1, true);
22321
23286
  for (let iteration = 0; iteration < 12 && current.total > along + 1e-3; iteration++) {
22322
- const next = measure(node, box, horizontal, scale * (along / current.total), true);
23287
+ const next = measure2(node, box, horizontal, scale * (along / current.total), true);
22323
23288
  if (next.total >= current.total - 1e-6) {
22324
23289
  break;
22325
23290
  }
@@ -22341,7 +23306,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
22341
23306
  let t1 = current.total;
22342
23307
  for (let i2 = 0; i2 < 6 && s1 < 1 && Math.abs(t1 - along) > 1e-3 && Math.abs(t0 - t1) > 1e-9; i2++) {
22343
23308
  const next = Math.min(1, Math.max(1e-6, s1 + (along - t1) * (s0 - s1) / (t0 - t1)));
22344
- const measured = measure(node, box, horizontal, next);
23309
+ const measured = measure2(node, box, horizontal, next);
22345
23310
  if (measured.total > along + 1e-3 || crossLimited && measured.cross > across + 1e-6) {
22346
23311
  break;
22347
23312
  }
@@ -22354,7 +23319,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
22354
23319
  if (best !== current) {
22355
23320
  return best;
22356
23321
  }
22357
- return measure(node, box, horizontal, scale);
23322
+ return measure2(node, box, horizontal, scale);
22358
23323
  }
22359
23324
  function alignOffset(free, align, start, end) {
22360
23325
  if (align === start) {
@@ -22539,7 +23504,7 @@ function contentHeight(cell, w, h2) {
22539
23504
  cell.values = saved;
22540
23505
  return bottom;
22541
23506
  }
22542
- function measure2(node, box, cells, spacer, row2) {
23507
+ function measure3(node, box, cells, spacer, row2) {
22543
23508
  const cellW = Math.max(...cells.map((c2) => c2.values.get("w") ?? box.w));
22544
23509
  const assignedH = Math.max(...cells.map((c2) => c2.values.get("h") ?? box.h));
22545
23510
  const cellH = Math.max(...cells.map((c2) => contentHeight(c2, cellW, assignedH)));
@@ -22574,7 +23539,7 @@ function fitSnakeByRule(node, box, cells, spacers, row2) {
22574
23539
  const floor = rule.val * POINTS_PER_MM2;
22575
23540
  const at2 = (value) => {
22576
23541
  evaluateAt(node, box, rule, targets, value);
22577
- return measure2(node, box, cells, spacers[0], row2);
23542
+ return measure3(node, box, cells, spacers[0], row2);
22578
23543
  };
22579
23544
  let best = at2(start);
22580
23545
  if (fits2(best, cells.length, box, row2) || !(start > floor)) {
@@ -22879,7 +23844,7 @@ function depthOf(point) {
22879
23844
  }
22880
23845
  return depth;
22881
23846
  }
22882
- function level(depth) {
23847
+ function level2(depth) {
22883
23848
  return Math.max(0, Math.min(MAX_LEVEL, depth));
22884
23849
  }
22885
23850
  function connectorDim(node) {
@@ -22893,11 +23858,11 @@ function derivedStyleLabel(node) {
22893
23858
  switch (point.type) {
22894
23859
  case "node":
22895
23860
  case "asst":
22896
- return `node${level(depthOf(point))}`;
23861
+ return `node${level2(depthOf(point))}`;
22897
23862
  case "sibTrans":
22898
23863
  return `sibTrans${connectorDim(node)}1`;
22899
23864
  case "parTrans":
22900
- return `parChTrans${connectorDim(node)}${level(depthOf(point))}`;
23865
+ return `parChTrans${connectorDim(node)}${level2(depthOf(point))}`;
22901
23866
  default:
22902
23867
  return void 0;
22903
23868
  }
@@ -29651,18 +30616,18 @@ function fanContinues(t, perRow, orgChart, siblingCount, normalCount) {
29651
30616
  const spanW = effectiveWidth(t, orgChart);
29652
30617
  return chPrefFanEligible || isSoloChainLink && normalCount > 1 && spanW === normalCount;
29653
30618
  }
29654
- function walk2(t, level2, perRow, orgChart, siblingCount) {
30619
+ function walk2(t, level3, perRow, orgChart, siblingCount) {
29655
30620
  const { normal } = partitionChildren(t, orgChart);
29656
30621
  if (normal.length === 0) {
29657
- return { deepestFanLevel: level2, maxHangDepth: 0, maxHangRows: 0, hangingColumns: 0 };
30622
+ return { deepestFanLevel: level3, maxHangDepth: 0, maxHangRows: 0, hangingColumns: 0 };
29658
30623
  }
29659
- if (level2 === 0) {
29660
- let deepestFan = level2;
30624
+ if (level3 === 0) {
30625
+ let deepestFan = level3;
29661
30626
  let maxHang = 0;
29662
30627
  let maxRows = 0;
29663
30628
  let hangingColumns = 0;
29664
30629
  for (const child3 of normal) {
29665
- const r = walk2(child3, level2 + 1, perRow, orgChart, normal.length);
30630
+ const r = walk2(child3, level3 + 1, perRow, orgChart, normal.length);
29666
30631
  deepestFan = Math.max(deepestFan, r.deepestFanLevel);
29667
30632
  maxHang = Math.max(maxHang, r.maxHangDepth);
29668
30633
  maxRows = Math.max(maxRows, r.maxHangRows);
@@ -29676,12 +30641,12 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
29676
30641
  };
29677
30642
  }
29678
30643
  if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
29679
- let deepestFan = level2 + 1;
30644
+ let deepestFan = level3 + 1;
29680
30645
  let maxHang = 0;
29681
30646
  let maxRows = 0;
29682
30647
  let hangingColumns = 0;
29683
30648
  for (const child3 of normal) {
29684
- const r = walk2(child3, level2 + 1, perRow, orgChart, void 0);
30649
+ const r = walk2(child3, level3 + 1, perRow, orgChart, void 0);
29685
30650
  deepestFan = Math.max(deepestFan, r.deepestFanLevel);
29686
30651
  maxHang = Math.max(maxHang, r.maxHangDepth);
29687
30652
  maxRows = Math.max(maxRows, r.maxHangRows);
@@ -29695,7 +30660,7 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
29695
30660
  };
29696
30661
  }
29697
30662
  return {
29698
- deepestFanLevel: level2,
30663
+ deepestFanLevel: level3,
29699
30664
  maxHangDepth: treeDepth(t) - 1,
29700
30665
  maxHangRows: countDescendants(t, orgChart),
29701
30666
  hangingColumns: 1
@@ -29734,20 +30699,20 @@ function computeHangShape(roots2, orgChart, perRow) {
29734
30699
  }
29735
30700
 
29736
30701
  // diagram/hierarchy/smartart-hierarchy-fan-aware-width.ts
29737
- function widthWalk(t, level2, perRow, orgChart, siblingCount, map) {
30702
+ function widthWalk(t, level3, perRow, orgChart, siblingCount, map) {
29738
30703
  const { normal } = partitionChildren(t, orgChart);
29739
30704
  let width;
29740
30705
  if (normal.length === 0) {
29741
30706
  width = 1;
29742
- } else if (level2 === 0) {
30707
+ } else if (level3 === 0) {
29743
30708
  width = 0;
29744
30709
  for (const child3 of normal) {
29745
- width += widthWalk(child3, level2 + 1, perRow, orgChart, normal.length, map);
30710
+ width += widthWalk(child3, level3 + 1, perRow, orgChart, normal.length, map);
29746
30711
  }
29747
30712
  } else if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
29748
30713
  width = 0;
29749
30714
  for (const child3 of normal) {
29750
- width += widthWalk(child3, level2 + 1, perRow, orgChart, void 0, map);
30715
+ width += widthWalk(child3, level3 + 1, perRow, orgChart, void 0, map);
29751
30716
  }
29752
30717
  } else {
29753
30718
  width = 1;
@@ -29931,33 +30896,33 @@ function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
29931
30896
  }
29932
30897
 
29933
30898
  // diagram/hierarchy/smartart-hierarchy-hanging.ts
29934
- function placeAssistants(hc, x, parentBottom, assistants, options, cursor) {
30899
+ function placeAssistants(hc, x, parentBottom, assistants, options2, cursor) {
29935
30900
  for (const assistant of assistants) {
29936
30901
  const y = cursor.y;
29937
- cursor.y += hc.boxH + options.vGap;
30902
+ cursor.y += hc.boxH + options2.vGap;
29938
30903
  const width = hc.boxW * 0.85;
29939
30904
  const height = hc.boxH * 0.85;
29940
30905
  pushNode(hc, assistant.node, x, y, width, height);
29941
30906
  stubConnector(hc, assistant.node.id, x + hc.boxH / 2, parentBottom, x + width / 2, y);
29942
30907
  }
29943
30908
  }
29944
- function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
30909
+ function placeHangingTree(hc, t, x, options2, cursor, size, level3 = 0) {
29945
30910
  const y = cursor.y;
29946
30911
  const boxW = size?.w ?? hc.boxW;
29947
30912
  const boxH = size?.h ?? hc.boxH;
29948
- const align = options.columnAlign;
30913
+ const align = options2.columnAlign;
29949
30914
  const placeX = align ? align.side === "right" ? align.edgeX - boxW : align.edgeX : x;
29950
- cursor.y += boxH + options.vGap;
30915
+ cursor.y += boxH + options2.vGap;
29951
30916
  pushNode(hc, t.node, placeX, y, boxW, boxH);
29952
- const { assistants, normal } = partitionChildren(t, options.orgChart);
29953
- 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);
29954
30919
  if (normal.length === 0) {
29955
30920
  return;
29956
30921
  }
29957
- if (options.foldDeeperGenerations && level2 >= 1) {
30922
+ if (options2.foldDeeperGenerations && level3 >= 1) {
29958
30923
  return;
29959
30924
  }
29960
- 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;
29961
30926
  for (const child3 of normal) {
29962
30927
  const childY = cursor.y;
29963
30928
  elbowConnector(
@@ -29969,13 +30934,13 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
29969
30934
  childY,
29970
30935
  child3.node.id
29971
30936
  );
29972
- placeHangingTree(hc, child3, childX, options, cursor, void 0, level2 + 1);
30937
+ placeHangingTree(hc, child3, childX, options2, cursor, void 0, level3 + 1);
29973
30938
  }
29974
30939
  }
29975
- function placeHangingForest(hc, roots2, startX, startY, options, rootSize) {
30940
+ function placeHangingForest(hc, roots2, startX, startY, options2, rootSize) {
29976
30941
  const cursor = { y: startY };
29977
30942
  for (const root of roots2) {
29978
- placeHangingTree(hc, root, startX, options, cursor, rootSize);
30943
+ placeHangingTree(hc, root, startX, options2, cursor, rootSize);
29979
30944
  }
29980
30945
  }
29981
30946
 
@@ -30042,17 +31007,17 @@ function fitHangingBox(view, algorithmNode, index, w, h2, rows, nodeCount, presL
30042
31007
  }
30043
31008
 
30044
31009
  // diagram/hierarchy/smartart-hierarchy-hanging-fold.ts
30045
- function countRows(t, level2, orgChart, fold) {
31010
+ function countRows(t, level3, orgChart, fold) {
30046
31011
  const { assistants, normal } = partitionChildren(t, orgChart);
30047
31012
  let count = 1 + assistants.length;
30048
31013
  if (normal.length === 0) {
30049
31014
  return count;
30050
31015
  }
30051
- if (fold && level2 >= 1) {
31016
+ if (fold && level3 >= 1) {
30052
31017
  return count;
30053
31018
  }
30054
31019
  for (const child3 of normal) {
30055
- count += countRows(child3, level2 + 1, orgChart, fold);
31020
+ count += countRows(child3, level3 + 1, orgChart, fold);
30056
31021
  }
30057
31022
  return count;
30058
31023
  }
@@ -30609,8 +31574,8 @@ function planFan(childCount, perRow, siblingCxs) {
30609
31574
  }
30610
31575
  return { columns: siblingCxs, overflow: childCount - siblingCxs.length };
30611
31576
  }
30612
- function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, options, placeAtFn) {
30613
- const fanCy = (level2 + 1) * cellH + cellH / 2;
31577
+ function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options2, placeAtFn) {
31578
+ const fanCy = (level3 + 1) * cellH + cellH / 2;
30614
31579
  const fanned = normal.slice(0, plan.columns.length);
30615
31580
  for (let i2 = 0; i2 < fanned.length; i2++) {
30616
31581
  const child3 = fanned[i2];
@@ -30624,15 +31589,15 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
30624
31589
  fanCy - hc.boxH / 2,
30625
31590
  child3.node.id
30626
31591
  );
30627
- placeAtFn(hc, child3, childCx, fanCy, 0, 1, level2 + 1, cellW, cellH, options);
31592
+ placeAtFn(hc, child3, childCx, fanCy, 0, 1, level3 + 1, cellW, cellH, options2);
30628
31593
  }
30629
- if (plan.overflow <= 0 || !options.hangingPlacer) {
31594
+ if (plan.overflow <= 0 || !options2.hangingPlacer) {
30630
31595
  return;
30631
31596
  }
30632
31597
  const remainder = normal.slice(plan.columns.length);
30633
31598
  const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
30634
31599
  const anchorX = plan.columns[0] - hc.boxW / 2 + columnOffset;
30635
- const anchorY = (level2 + 2) * cellH;
31600
+ const anchorY = (level3 + 2) * cellH;
30636
31601
  for (const child3 of remainder) {
30637
31602
  elbowConnector(
30638
31603
  hc,
@@ -30644,12 +31609,12 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
30644
31609
  child3.node.id
30645
31610
  );
30646
31611
  }
30647
- options.hangingPlacer(hc, remainder, anchorX, anchorY);
31612
+ options2.hangingPlacer(hc, remainder, anchorX, anchorY);
30648
31613
  }
30649
31614
 
30650
31615
  // diagram/hierarchy/smartart-hierarchy-standard-options.ts
30651
- function spanOf(t, options) {
30652
- 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);
30653
31618
  }
30654
31619
 
30655
31620
  // diagram/hierarchy/smartart-hierarchy-standard-rows.ts
@@ -30669,22 +31634,22 @@ function placeAssistantRow(hc, parentId, cx2, cy, assistants) {
30669
31634
  x += assistW + ASSISTANT_GAP;
30670
31635
  }
30671
31636
  }
30672
- function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW, cellH, options, placeChild) {
31637
+ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options2, placeChild) {
30673
31638
  const siblingCxs = [];
30674
31639
  {
30675
31640
  let offset = xOffset;
30676
31641
  for (const child3 of normal) {
30677
- const childW = spanOf(child3, options);
31642
+ const childW = spanOf(child3, options2);
30678
31643
  siblingCxs.push((offset + childW / 2) * cellW);
30679
31644
  offset += childW;
30680
31645
  }
30681
31646
  }
30682
- const cascadeShift = options.cascadeOffsetX && level2 + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
31647
+ const cascadeShift = options2.cascadeOffsetX && level3 + 1 >= options2.cascadeOffsetX.fromLevel ? options2.cascadeOffsetX.offsetPx : 0;
30683
31648
  let childOffset = xOffset;
30684
31649
  for (const child3 of normal) {
30685
- const childW = spanOf(child3, options);
31650
+ const childW = spanOf(child3, options2);
30686
31651
  const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
30687
- const childCy = (level2 + 1) * cellH + cellH / 2;
31652
+ const childCy = (level3 + 1) * cellH + cellH / 2;
30688
31653
  elbowConnector(
30689
31654
  hc,
30690
31655
  parentId,
@@ -30701,10 +31666,10 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW
30701
31666
  childCy,
30702
31667
  childOffset,
30703
31668
  childW,
30704
- level2 + 1,
31669
+ level3 + 1,
30705
31670
  cellW,
30706
31671
  cellH,
30707
- options,
31672
+ options2,
30708
31673
  siblingCxs
30709
31674
  );
30710
31675
  childOffset += childW;
@@ -30727,13 +31692,13 @@ function wrappedGroupSlotCount(group2, orgChart) {
30727
31692
  }
30728
31693
  return group2.members.reduce((sum, m) => sum + effectiveWidth(m, orgChart), 0);
30729
31694
  }
30730
- function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level2, cellW, cellH, options, placeAtFn) {
30731
- const groups = planWrappedGroups(normal, options.perRow, options.orgChart);
30732
- 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);
30733
31698
  const totalW = spanW * cellW;
30734
31699
  const leftX = xOffset * cellW;
30735
31700
  const unitW = totalW / Math.max(1, totalSlots);
30736
- const rowCy = (level2 + 1) * cellH + cellH / 2;
31701
+ const rowCy = (level3 + 1) * cellH + cellH / 2;
30737
31702
  let slot2 = 0;
30738
31703
  for (const group2 of groups) {
30739
31704
  slot2 = group2.fansAsRow ? placeRowFanGroup(
@@ -30746,10 +31711,10 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
30746
31711
  unitW,
30747
31712
  slot2,
30748
31713
  rowCy,
30749
- level2,
31714
+ level3,
30750
31715
  cellW,
30751
31716
  cellH,
30752
- options,
31717
+ options2,
30753
31718
  placeAtFn
30754
31719
  ) : placeColumnGroup(
30755
31720
  hc,
@@ -30763,25 +31728,25 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
30763
31728
  rowCy,
30764
31729
  cellW,
30765
31730
  cellH,
30766
- level2,
30767
- options,
31731
+ level3,
31732
+ options2,
30768
31733
  placeAtFn
30769
31734
  );
30770
31735
  }
30771
31736
  }
30772
- function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level2, cellW, cellH, options, placeAtFn) {
31737
+ function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level3, cellW, cellH, options2, placeAtFn) {
30773
31738
  let cursor = slot2;
30774
31739
  for (const child3 of group2.members) {
30775
- const childW = effectiveWidth(child3, options.orgChart);
31740
+ const childW = effectiveWidth(child3, options2.orgChart);
30776
31741
  const childCx = leftX + unitW * (cursor + childW / 2);
30777
31742
  elbowConnector(hc, parentId, cx2, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2, child3.node.id);
30778
31743
  const virtualOffset = childCx / cellW - childW / 2;
30779
- placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level2 + 1, cellW, cellH, options);
31744
+ placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level3 + 1, cellW, cellH, options2);
30780
31745
  cursor += childW;
30781
31746
  }
30782
31747
  return cursor;
30783
31748
  }
30784
- function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level2, options, placeAtFn) {
31749
+ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level3, options2, placeAtFn) {
30785
31750
  const groupCx = leftX + unitW * (slot2 + 0.5);
30786
31751
  const subRowH = cellH / group2.members.length;
30787
31752
  let fromId = parentId;
@@ -30791,9 +31756,9 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
30791
31756
  const child3 = group2.members[i2];
30792
31757
  const childCy = rowCy + subRowH * i2;
30793
31758
  elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2, child3.node.id);
30794
- const childW = effectiveWidth(child3, options.orgChart);
31759
+ const childW = effectiveWidth(child3, options2.orgChart);
30795
31760
  const virtualOffset = groupCx / cellW - childW / 2;
30796
- placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level2 + 1, cellW, cellH, options);
31761
+ placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level3 + 1, cellW, cellH, options2);
30797
31762
  fromId = child3.node.id;
30798
31763
  fromX = groupCx;
30799
31764
  fromY = childCy + hc.boxH / 2;
@@ -30802,7 +31767,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
30802
31767
  }
30803
31768
 
30804
31769
  // diagram/hierarchy/smartart-hierarchy-standard.ts
30805
- function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level2, cellW, cellH, options) {
31770
+ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options2) {
30806
31771
  placeFlatChildren(
30807
31772
  hc,
30808
31773
  parentId,
@@ -30810,14 +31775,14 @@ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level2, cell
30810
31775
  cx2,
30811
31776
  cy,
30812
31777
  xOffset,
30813
- level2,
31778
+ level3,
30814
31779
  cellW,
30815
31780
  cellH,
30816
- options,
31781
+ options2,
30817
31782
  placeAt
30818
31783
  );
30819
31784
  }
30820
- function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level2, cellW, cellH, options) {
31785
+ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2) {
30821
31786
  placeWrappedChildren(
30822
31787
  hc,
30823
31788
  parentId,
@@ -30826,35 +31791,35 @@ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, le
30826
31791
  cy,
30827
31792
  xOffset,
30828
31793
  spanW,
30829
- level2,
31794
+ level3,
30830
31795
  cellW,
30831
31796
  cellH,
30832
- options,
31797
+ options2,
30833
31798
  placeAt
30834
31799
  );
30835
31800
  }
30836
- function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options, siblingCxs) {
31801
+ function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2, siblingCxs) {
30837
31802
  pushNode(hc, t.node, cx2 - hc.boxW / 2, cy - hc.boxH / 2);
30838
- const { assistants, normal } = partitionChildren(t, options.orgChart);
31803
+ const { assistants, normal } = partitionChildren(t, options2.orgChart);
30839
31804
  placeAssistantRow(hc, t.node.id, cx2, cy, assistants);
30840
31805
  if (normal.length === 0) {
30841
31806
  return;
30842
31807
  }
30843
- if (options.foldDeeperGenerations && level2 >= 1) {
31808
+ if (options2.foldDeeperGenerations && level3 >= 1) {
30844
31809
  return;
30845
31810
  }
30846
- if (options.hangingPlacer && level2 >= 1) {
30847
- const plan = planFan(normal.length, options.perRow, siblingCxs);
31811
+ if (options2.hangingPlacer && level3 >= 1) {
31812
+ const plan = planFan(normal.length, options2.perRow, siblingCxs);
30848
31813
  if (plan) {
30849
- placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, options, placeAt);
31814
+ placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options2, placeAt);
30850
31815
  return;
30851
31816
  }
30852
31817
  const isSoloChainLink = !siblingCxs || siblingCxs.length === 1;
30853
31818
  if (isSoloChainLink && normal.length > 1 && spanW === normal.length) {
30854
- placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level2, cellW, cellH, options);
31819
+ placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options2);
30855
31820
  return;
30856
31821
  }
30857
- 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;
30858
31823
  const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
30859
31824
  for (const child3 of normal) {
30860
31825
  elbowConnector(
@@ -30867,10 +31832,10 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options,
30867
31832
  child3.node.id
30868
31833
  );
30869
31834
  }
30870
- options.hangingPlacer(hc, normal, cx2 - hc.boxW / 2 + columnOffset, anchorY);
31835
+ options2.hangingPlacer(hc, normal, cx2 - hc.boxW / 2 + columnOffset, anchorY);
30871
31836
  return;
30872
31837
  }
30873
- if (Number.isFinite(options.perRow) && normal.length > options.perRow) {
31838
+ if (Number.isFinite(options2.perRow) && normal.length > options2.perRow) {
30874
31839
  placeWrappedChildren2(
30875
31840
  hc,
30876
31841
  t.node.id,
@@ -30879,21 +31844,21 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options,
30879
31844
  cy,
30880
31845
  xOffset,
30881
31846
  spanW,
30882
- level2,
31847
+ level3,
30883
31848
  cellW,
30884
31849
  cellH,
30885
- options
31850
+ options2
30886
31851
  );
30887
31852
  } else {
30888
- placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level2, cellW, cellH, options);
31853
+ placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options2);
30889
31854
  }
30890
31855
  }
30891
- function placeStandardTree(hc, t, xOffset, level2, cellW, cellH, options) {
30892
- const spanW = spanOf(t, options);
30893
- const cascadeShift = options.cascadeOffsetX && level2 >= 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;
30894
31859
  const cx2 = (xOffset + spanW / 2) * cellW + cascadeShift;
30895
- const cy = level2 * cellH + cellH / 2;
30896
- placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options);
31860
+ const cy = level3 * cellH + cellH / 2;
31861
+ placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2);
30897
31862
  }
30898
31863
 
30899
31864
  // diagram/hierarchy/smartart-hierarchy-tailed-placer.ts
@@ -32119,10 +33084,10 @@ function relativePartTarget(basePart, targetPart) {
32119
33084
  }
32120
33085
  return [...base.map(() => ".."), ...target].join("/");
32121
33086
  }
32122
- async function clonePartGraph(options) {
32123
- const { zip, sourcePart, targetPart, shouldClone } = options;
32124
- const sourceZip = options.sourceZip ?? zip;
32125
- 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();
32126
33091
  copies.set(sourcePart, targetPart);
32127
33092
  const types = parseContentTypes(await sourceZip.file("[Content_Types].xml")?.async("string"));
32128
33093
  const reserved = new Set(Object.keys(zip.files));
@@ -35573,8 +36538,8 @@ function hashBytes(password, { algorithmName, saltValue, spinCount }, limits) {
35573
36538
  if (!digest || !salt || !isValidSpinCount(spinCount, limits.maxSpinCount)) return void 0;
35574
36539
  return spinPasswordHash(password, salt, spinCount ?? 0, digest);
35575
36540
  }
35576
- function hashPassword(password, options, limits = {}) {
35577
- const bytes = hashBytes(password, options, limits);
36541
+ function hashPassword(password, options2, limits = {}) {
36542
+ const bytes = hashBytes(password, options2, limits);
35578
36543
  return bytes && encodeBase64(bytes);
35579
36544
  }
35580
36545
  function verifyPasswordHash(password, hash, limits = {}) {
@@ -36994,8 +37959,8 @@ function routeCore(start, end, obstacles, padding, canvasWidth, canvasHeight) {
36994
37959
  const path2 = aStarOrthogonal(nodes, start, end, inflated);
36995
37960
  return simplifyPath(path2);
36996
37961
  }
36997
- function routeConnector(options) {
36998
- 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;
36999
37964
  return routeCore(start, end, obstacles, padding, canvasWidth, canvasHeight);
37000
37965
  }
37001
37966
  function waypointsToPathData(waypoints) {
@@ -42399,18 +43364,18 @@ function snapBox(box, size) {
42399
43364
  }
42400
43365
 
42401
43366
  // geometry/align-distribute.ts
42402
- function usesSlideReference(elementCount, options) {
42403
- if (!options?.slideSize) {
43367
+ function usesSlideReference(elementCount, options2) {
43368
+ if (!options2?.slideSize) {
42404
43369
  return false;
42405
43370
  }
42406
- return options.reference === "slide" || options.reference === void 0 && elementCount === 1;
43371
+ return options2.reference === "slide" || options2.reference === void 0 && elementCount === 1;
42407
43372
  }
42408
- function resolveAlignReferenceBox(elements2, options) {
43373
+ function resolveAlignReferenceBox(elements2, options2) {
42409
43374
  if (elements2.length === 0) {
42410
43375
  return null;
42411
43376
  }
42412
- if (usesSlideReference(elements2.length, options)) {
42413
- 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 };
42414
43379
  }
42415
43380
  if (elements2.length < 2) {
42416
43381
  return null;
@@ -42422,9 +43387,9 @@ function resolveAlignReferenceBox(elements2, options) {
42422
43387
  maxY: Math.max(...elements2.map((e) => e.y + e.height))
42423
43388
  };
42424
43389
  }
42425
- function alignElements(elements2, edge, options) {
43390
+ function alignElements(elements2, edge, options2) {
42426
43391
  const result = /* @__PURE__ */ new Map();
42427
- const ref = resolveAlignReferenceBox(elements2, options);
43392
+ const ref = resolveAlignReferenceBox(elements2, options2);
42428
43393
  if (!ref) {
42429
43394
  return result;
42430
43395
  }
@@ -42455,7 +43420,7 @@ function alignElements(elements2, edge, options) {
42455
43420
  }
42456
43421
  return result;
42457
43422
  }
42458
- function distributeElements(elements2, axis, options) {
43423
+ function distributeElements(elements2, axis, options2) {
42459
43424
  const result = /* @__PURE__ */ new Map();
42460
43425
  const horizontal = axis === "horizontal";
42461
43426
  const start = (e) => horizontal ? e.x : e.y;
@@ -42464,11 +43429,11 @@ function distributeElements(elements2, axis, options) {
42464
43429
  const totalSize = sorted.reduce((sum, e) => sum + size(e), 0);
42465
43430
  let cursor;
42466
43431
  let gap;
42467
- if (usesSlideReference(elements2.length, options)) {
43432
+ if (usesSlideReference(elements2.length, options2)) {
42468
43433
  if (sorted.length === 0) {
42469
43434
  return result;
42470
43435
  }
42471
- const span = horizontal ? options.slideSize.width : options.slideSize.height;
43436
+ const span = horizontal ? options2.slideSize.width : options2.slideSize.height;
42472
43437
  gap = (span - totalSize) / (sorted.length + 1);
42473
43438
  cursor = gap;
42474
43439
  } else {
@@ -42502,11 +43467,11 @@ function onlyMoved(boxes, positions) {
42502
43467
  }
42503
43468
  return result;
42504
43469
  }
42505
- function computeAlign(boxes, mode, options) {
42506
- return onlyMoved(boxes, alignElements(boxes, mode, options));
43470
+ function computeAlign(boxes, mode, options2) {
43471
+ return onlyMoved(boxes, alignElements(boxes, mode, options2));
42507
43472
  }
42508
- function computeDistribute(boxes, mode, options) {
42509
- return onlyMoved(boxes, distributeElements(boxes, mode, options));
43473
+ function computeDistribute(boxes, mode, options2) {
43474
+ return onlyMoved(boxes, distributeElements(boxes, mode, options2));
42510
43475
  }
42511
43476
 
42512
43477
  // geometry/rotation-drag.ts
@@ -42514,7 +43479,7 @@ function computeRotation(center, pointer) {
42514
43479
  const deg = Math.atan2(pointer.x - center.x, center.y - pointer.y) * (180 / Math.PI);
42515
43480
  return (deg % 360 + 360) % 360;
42516
43481
  }
42517
- function createRotationDrag(center, startPointer, startRotation, options = {}) {
43482
+ function createRotationDrag(center, startPointer, startRotation, options2 = {}) {
42518
43483
  const bearing = (pointer) => pointer.x === center.x && pointer.y === center.y ? void 0 : computeRotation(center, pointer);
42519
43484
  let startAngle = bearing(startPointer);
42520
43485
  let rotation = startRotation;
@@ -42529,7 +43494,7 @@ function createRotationDrag(center, startPointer, startRotation, options = {}) {
42529
43494
  previousAngle = angle;
42530
43495
  return rotation;
42531
43496
  }
42532
- if (options.unwrapped) {
43497
+ if (options2.unwrapped) {
42533
43498
  const delta = (angle - (previousAngle ?? angle) + 540) % 360 - 180;
42534
43499
  rotation += delta;
42535
43500
  previousAngle = angle;
@@ -42696,8 +43661,8 @@ function layers(ids, forward, shortest) {
42696
43661
  }
42697
43662
  const result = [];
42698
43663
  for (const id of ids) {
42699
- const level2 = rank.get(id) ?? 0;
42700
- (result[level2] ??= []).push(id);
43664
+ const level3 = rank.get(id) ?? 0;
43665
+ (result[level3] ??= []).push(id);
42701
43666
  }
42702
43667
  return result.filter((layer) => layer.length);
42703
43668
  }
@@ -42827,10 +43792,10 @@ function placeGrid(ids, size, spacing3) {
42827
43792
  height: size.get(id).height
42828
43793
  }));
42829
43794
  }
42830
- function layoutGraph(nodes, edges, style, options = {}) {
43795
+ function layoutGraph(nodes, edges, style, options2 = {}) {
42831
43796
  if (!GRAPH_LAYOUT_STYLES.includes(style)) throw new Error("Unknown graph layout style.");
42832
- const spacing3 = options.spacing ?? 0.5;
42833
- const layerSpacing = options.layerSpacing ?? spacing3;
43797
+ const spacing3 = options2.spacing ?? 0.5;
43798
+ const layerSpacing = options2.layerSpacing ?? spacing3;
42834
43799
  if (![spacing3, layerSpacing].every((value) => Number.isFinite(value) && value >= 0))
42835
43800
  throw new Error("Layout spacing must be finite and not negative.");
42836
43801
  const size = /* @__PURE__ */ new Map();
@@ -42930,7 +43895,7 @@ function space2(groups, start, size, minimumGap) {
42930
43895
  });
42931
43896
  return result;
42932
43897
  }
42933
- function autoAlignBoxes(boxes, options = {}) {
43898
+ function autoAlignBoxes(boxes, options2 = {}) {
42934
43899
  if (new Set(boxes.map((box) => box.id)).size !== boxes.length)
42935
43900
  throw new Error("Auto align box IDs must be unique.");
42936
43901
  if (!boxes.every(
@@ -42939,9 +43904,9 @@ function autoAlignBoxes(boxes, options = {}) {
42939
43904
  throw new Error("Auto align boxes must be finite.");
42940
43905
  const result = /* @__PURE__ */ new Map();
42941
43906
  if (!boxes.length) return result;
42942
- const toleranceX = options.tolerance?.x ?? median(boxes.map((box) => box.width)) / 2;
42943
- const toleranceY = options.tolerance?.y ?? median(boxes.map((box) => box.height)) / 2;
42944
- 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;
42945
43910
  const rows = clusters(boxes, (box) => box.y + box.height / 2, toleranceY);
42946
43911
  const columns = clusters(boxes, (box) => box.x + box.width / 2, toleranceX);
42947
43912
  const ys = space2(