apexcharts 7.3.0 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/LICENSE +39 -11
  2. package/dist/apexcharts.common.js +2 -2
  3. package/dist/apexcharts.core.js +579 -467
  4. package/dist/apexcharts.core.min.js +2 -2
  5. package/dist/apexcharts.esm.js +1347 -810
  6. package/dist/apexcharts.js +896 -267
  7. package/dist/apexcharts.min.js +2 -2
  8. package/dist/apexcharts.ssr.common.js +2 -2
  9. package/dist/apexcharts.ssr.esm.js +896 -267
  10. package/dist/area.common.js +1 -1
  11. package/dist/area.esm.js +1 -1
  12. package/dist/bar.common.js +2 -2
  13. package/dist/bar.esm.js +20 -10
  14. package/dist/bar.js +2 -2
  15. package/dist/boxPlot.common.js +2 -2
  16. package/dist/boxPlot.esm.js +20 -10
  17. package/dist/bubble.common.js +1 -1
  18. package/dist/bubble.esm.js +1 -1
  19. package/dist/candlestick.common.js +2 -2
  20. package/dist/candlestick.esm.js +20 -10
  21. package/dist/candlestick.js +2 -2
  22. package/dist/column.common.js +2 -2
  23. package/dist/column.esm.js +20 -10
  24. package/dist/core.common.js +2 -2
  25. package/dist/core.esm.js +579 -467
  26. package/dist/donut.common.js +1 -1
  27. package/dist/donut.esm.js +1 -1
  28. package/dist/dumbbell.common.js +2 -2
  29. package/dist/dumbbell.esm.js +20 -10
  30. package/dist/features/all.common.js +2 -2
  31. package/dist/features/all.esm.js +536 -34
  32. package/dist/features/annotations.common.js +1 -1
  33. package/dist/features/annotations.esm.js +1 -1
  34. package/dist/features/annotations.js +1 -1
  35. package/dist/features/context-menu.common.js +1 -1
  36. package/dist/features/context-menu.esm.js +1 -1
  37. package/dist/features/context-menu.js +1 -1
  38. package/dist/features/drilldown.common.js +1 -1
  39. package/dist/features/drilldown.esm.js +1 -1
  40. package/dist/features/drilldown.js +1 -1
  41. package/dist/features/dumbbell.common.js +1 -1
  42. package/dist/features/dumbbell.esm.js +1 -1
  43. package/dist/features/dumbbell.js +1 -1
  44. package/dist/features/exports.common.js +2 -2
  45. package/dist/features/exports.esm.js +12 -14
  46. package/dist/features/exports.js +2 -2
  47. package/dist/features/facet.common.js +1 -1
  48. package/dist/features/facet.esm.js +1 -1
  49. package/dist/features/facet.js +1 -1
  50. package/dist/features/history.common.js +1 -1
  51. package/dist/features/history.esm.js +1 -1
  52. package/dist/features/history.js +1 -1
  53. package/dist/features/ink.common.js +1 -1
  54. package/dist/features/ink.esm.js +1 -1
  55. package/dist/features/ink.js +1 -1
  56. package/dist/features/keyboard.common.js +2 -2
  57. package/dist/features/keyboard.esm.js +14 -1
  58. package/dist/features/keyboard.js +2 -2
  59. package/dist/features/legend.common.js +1 -1
  60. package/dist/features/legend.esm.js +1 -1
  61. package/dist/features/legend.js +1 -1
  62. package/dist/features/link.common.js +1 -1
  63. package/dist/features/link.esm.js +38 -38
  64. package/dist/features/link.js +1 -1
  65. package/dist/features/marks.common.js +1 -1
  66. package/dist/features/marks.esm.js +1 -1
  67. package/dist/features/marks.js +1 -1
  68. package/dist/features/measure.common.js +1 -1
  69. package/dist/features/measure.esm.js +1 -1
  70. package/dist/features/measure.js +1 -1
  71. package/dist/features/morph.common.js +1 -1
  72. package/dist/features/morph.esm.js +1 -1
  73. package/dist/features/morph.js +1 -1
  74. package/dist/features/perspectives.common.js +1 -1
  75. package/dist/features/perspectives.esm.js +11 -11
  76. package/dist/features/perspectives.js +1 -1
  77. package/dist/features/raincloud.common.js +1 -1
  78. package/dist/features/raincloud.esm.js +1 -1
  79. package/dist/features/raincloud.js +1 -1
  80. package/dist/features/renderer-canvas.common.js +1 -1
  81. package/dist/features/renderer-canvas.esm.js +1 -1
  82. package/dist/features/renderer-canvas.js +1 -1
  83. package/dist/features/stats.common.js +1 -1
  84. package/dist/features/stats.esm.js +1 -1
  85. package/dist/features/stats.js +1 -1
  86. package/dist/features/storyboard.common.js +1 -1
  87. package/dist/features/storyboard.esm.js +11 -11
  88. package/dist/features/storyboard.js +1 -1
  89. package/dist/features/streamgraph.common.js +1 -1
  90. package/dist/features/streamgraph.esm.js +1 -1
  91. package/dist/features/streamgraph.js +1 -1
  92. package/dist/features/toolbar.common.js +2 -2
  93. package/dist/features/toolbar.esm.js +172 -25
  94. package/dist/features/toolbar.js +2 -2
  95. package/dist/features/trellis.common.js +1 -1
  96. package/dist/features/trellis.esm.js +1 -1
  97. package/dist/features/trellis.js +1 -1
  98. package/dist/features/waterfall.common.js +1 -1
  99. package/dist/features/waterfall.esm.js +1 -1
  100. package/dist/features/waterfall.js +1 -1
  101. package/dist/features/weave.common.js +2 -2
  102. package/dist/features/weave.esm.js +352 -10
  103. package/dist/features/weave.js +2 -2
  104. package/dist/heatmap.common.js +1 -1
  105. package/dist/heatmap.esm.js +1 -1
  106. package/dist/heatmap.js +1 -1
  107. package/dist/histogram.common.js +2 -2
  108. package/dist/histogram.esm.js +20 -10
  109. package/dist/line.common.js +1 -1
  110. package/dist/line.esm.js +1 -1
  111. package/dist/line.js +1 -1
  112. package/dist/pictograms.common.js +1 -1
  113. package/dist/pictograms.esm.js +1 -1
  114. package/dist/pictograms.js +1 -1
  115. package/dist/pie.common.js +1 -1
  116. package/dist/pie.esm.js +1 -1
  117. package/dist/pie.js +1 -1
  118. package/dist/polarArea.common.js +1 -1
  119. package/dist/polarArea.esm.js +1 -1
  120. package/dist/radar.common.js +1 -1
  121. package/dist/radar.esm.js +1 -1
  122. package/dist/radar.js +1 -1
  123. package/dist/radialBar.common.js +2 -2
  124. package/dist/radialBar.esm.js +27 -2
  125. package/dist/radialBar.js +2 -2
  126. package/dist/raincloud.common.js +2 -2
  127. package/dist/raincloud.esm.js +20 -10
  128. package/dist/rangeArea.common.js +1 -1
  129. package/dist/rangeArea.esm.js +1 -1
  130. package/dist/rangeBar.common.js +2 -2
  131. package/dist/rangeBar.esm.js +20 -10
  132. package/dist/scatter.common.js +1 -1
  133. package/dist/scatter.esm.js +1 -1
  134. package/dist/streamgraph.common.js +1 -1
  135. package/dist/streamgraph.esm.js +1 -1
  136. package/dist/sunburst.common.js +1 -1
  137. package/dist/sunburst.esm.js +1 -1
  138. package/dist/sunburst.js +1 -1
  139. package/dist/treemap.common.js +1 -1
  140. package/dist/treemap.esm.js +1 -1
  141. package/dist/treemap.js +1 -1
  142. package/dist/unit-shapes.common.js +1 -1
  143. package/dist/unit-shapes.esm.js +1 -1
  144. package/dist/unit-shapes.js +1 -1
  145. package/dist/unit.common.js +1 -1
  146. package/dist/unit.esm.js +79 -79
  147. package/dist/unit.js +1 -1
  148. package/dist/violin.common.js +2 -2
  149. package/dist/violin.esm.js +20 -10
  150. package/dist/violin.js +2 -2
  151. package/dist/waterfall.common.js +2 -2
  152. package/dist/waterfall.esm.js +20 -10
  153. package/package.json +2 -2
  154. package/src/apexcharts.js +39 -15
  155. package/src/charts/Radial.js +12 -3
  156. package/src/charts/common/bar/Helpers.js +31 -12
  157. package/src/modules/Data.js +8 -2
  158. package/src/modules/DataLabels.js +14 -4
  159. package/src/modules/Exports.js +14 -12
  160. package/src/modules/Formatters.js +24 -1
  161. package/src/modules/Graphics.js +10 -0
  162. package/src/modules/Range.js +28 -1
  163. package/src/modules/Toolbar.js +112 -2
  164. package/src/modules/ZoomPanSelection.js +85 -7
  165. package/src/modules/accessibility/KeyboardNavigation.js +14 -0
  166. package/src/modules/axes/YAxis.js +12 -15
  167. package/src/modules/helpers/UpdateHelpers.js +25 -8
  168. package/src/modules/settings/Globals.js +5 -10
  169. package/src/modules/settings/Options.js +15 -0
  170. package/src/modules/weave/Claims.js +231 -0
  171. package/src/modules/weave/Drawn.js +169 -0
  172. package/src/modules/weave/PluginAPI.js +195 -4
  173. package/src/modules/weave/WeaveHost.js +76 -3
  174. package/src/ssr/DOMShim.js +50 -0
  175. package/src/types/internal.d.ts +1 -1
  176. package/src/utils/Utils.js +6 -9
  177. package/types/apexcharts.d.ts +92 -0
@@ -42,7 +42,7 @@ var __async = (__this, __arguments, generator) => {
42
42
  });
43
43
  };
44
44
  /*!
45
- * ApexCharts v7.3.0
45
+ * ApexCharts v7.5.0
46
46
  * (c) 2018-2026 ApexCharts
47
47
  */
48
48
 
@@ -82,6 +82,11 @@ var __async = (__this, __arguments, generator) => {
82
82
  return {};
83
83
  }
84
84
  }
85
+ const CHAR_WIDTH_EM = 0.55;
86
+ const ASCENT_EM = 0.917;
87
+ const DESCENT_EM = 0.25;
88
+ const LINE_HEIGHT_EM = 1.1;
89
+ const DEFAULT_FONT_SIZE = 11;
85
90
  class SSRElement {
86
91
  /**
87
92
  * @param {string} nodeName
@@ -202,6 +207,43 @@ var __async = (__this, __arguments, generator) => {
202
207
  y: 0
203
208
  };
204
209
  }
210
+ getBBox() {
211
+ if (this.nodeName !== "text" && this.nodeName !== "tspan") {
212
+ return { x: 0, y: 0, width: 0, height: 0 };
213
+ }
214
+ const lines = this._textLines();
215
+ const longest = lines.reduce((acc, line) => Math.max(acc, line.length), 0);
216
+ if (!longest) {
217
+ return { x: 0, y: 0, width: 0, height: 0 };
218
+ }
219
+ const fontSize = parseFloat(this.attributes.get("font-size")) || DEFAULT_FONT_SIZE;
220
+ const width = longest * fontSize * CHAR_WIDTH_EM;
221
+ const height = fontSize * (ASCENT_EM + DESCENT_EM) + (lines.length - 1) * fontSize * LINE_HEIGHT_EM;
222
+ const anchor = this.attributes.get("text-anchor");
223
+ const x = parseFloat(this.attributes.get("x")) || 0;
224
+ const y = parseFloat(this.attributes.get("y")) || 0;
225
+ return {
226
+ x: anchor === "middle" ? x - width / 2 : anchor === "end" ? x - width : x,
227
+ y: y - fontSize * ASCENT_EM,
228
+ width,
229
+ height
230
+ };
231
+ }
232
+ /**
233
+ * Text of this element, one entry per rendered line
234
+ * @returns {string[]}
235
+ */
236
+ _textLines() {
237
+ var _a;
238
+ const tspans = this.children.filter((child) => child.nodeName === "tspan");
239
+ if (tspans.length) {
240
+ return tspans.map((tspan) => {
241
+ var _a2;
242
+ return String((_a2 = tspan.textContent) != null ? _a2 : "");
243
+ });
244
+ }
245
+ return [String((_a = this.textContent) != null ? _a : "")];
246
+ }
205
247
  getRootNode() {
206
248
  let root = this;
207
249
  while (root.parentNode) {
@@ -691,15 +733,12 @@ var __async = (__this, __arguments, generator) => {
691
733
  return output;
692
734
  }
693
735
  // A per-series shallow copy: the series OBJECTS are copied, their data arrays
694
- // are shared. Almost every internal "mutation" of a series' data is a
695
- // property REPLACEMENT (`series[i].data = []` on legend collapse,
696
- // `series[i] = 0` for non-axis charts), and those cannot reach a copy made
697
- // this way because the series object was copied at capture time. The
698
- // exception is appendData(), whose push loop grows the shared data array in
699
- // place, so a copy taken before it does see the appended points; see the
700
- // note above defineLazyInitialSeries(). This is the same cheap shape
701
- // `globals.initialSeries` captures, so snapshotting a config stays O(n)
702
- // instead of deep-cloning every point.
736
+ // are shared. Every internal "mutation" of a series' data is a property
737
+ // REPLACEMENT (`series[i].data = []` on legend collapse, `series[i] = 0` for
738
+ // non-axis charts, appendData's concat), and those cannot reach a copy made
739
+ // this way because the series object was copied at capture time. This is the
740
+ // same cheap shape `globals.initialSeries` captures, so snapshotting a config
741
+ // stays O(n) instead of deep-cloning every point.
703
742
  /**
704
743
  * @param {any} series
705
744
  */
@@ -1042,16 +1081,16 @@ var __async = (__this, __arguments, generator) => {
1042
1081
  * @param {string} color
1043
1082
  */
1044
1083
  shadeRGBColor(percent, color) {
1045
- const f = color.split(","), t2 = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent, R2 = parseInt(f[0].slice(4), 10), G = parseInt(f[1], 10), B = parseInt(f[2], 10);
1046
- return "rgb(" + (Math.round((t2 - R2) * p) + R2) + "," + (Math.round((t2 - G) * p) + G) + "," + (Math.round((t2 - B) * p) + B) + ")";
1084
+ const f = color.split(","), t2 = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent, R = parseInt(f[0].slice(4), 10), G = parseInt(f[1], 10), B = parseInt(f[2], 10);
1085
+ return "rgb(" + (Math.round((t2 - R) * p) + R) + "," + (Math.round((t2 - G) * p) + G) + "," + (Math.round((t2 - B) * p) + B) + ")";
1047
1086
  }
1048
1087
  /**
1049
1088
  * @param {number} percent
1050
1089
  * @param {string} color
1051
1090
  */
1052
1091
  shadeHexColor(percent, color) {
1053
- const f = parseInt(color.slice(1), 16), t2 = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent, R2 = f >> 16, G = f >> 8 & 255, B = f & 255;
1054
- return "#" + (16777216 + (Math.round((t2 - R2) * p) + R2) * 65536 + (Math.round((t2 - G) * p) + G) * 256 + (Math.round((t2 - B) * p) + B)).toString(16).slice(1);
1092
+ const f = parseInt(color.slice(1), 16), t2 = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent, R = f >> 16, G = f >> 8 & 255, B = f & 255;
1093
+ return "#" + (16777216 + (Math.round((t2 - R) * p) + R) * 65536 + (Math.round((t2 - G) * p) + G) * 256 + (Math.round((t2 - B) * p) + B)).toString(16).slice(1);
1055
1094
  }
1056
1095
  // beautiful color shading blending code
1057
1096
  // http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
@@ -1355,11 +1394,11 @@ var __async = (__this, __arguments, generator) => {
1355
1394
  format = format.replace(/(^|[^\\])yyyy+/g, "$1" + y);
1356
1395
  format = format.replace(/(^|[^\\])yy/g, "$1" + y.toString().substr(2, 2));
1357
1396
  format = format.replace(/(^|[^\\])y/g, "$1" + y);
1358
- const M2 = (utc ? date.getUTCMonth() : date.getMonth()) + 1;
1397
+ const M = (utc ? date.getUTCMonth() : date.getMonth()) + 1;
1359
1398
  format = format.replace(/(^|[^\\])MMMM+/g, "$1" + MMMM[0]);
1360
1399
  format = format.replace(/(^|[^\\])MMM/g, "$1" + MMM[0]);
1361
- format = format.replace(/(^|[^\\])MM/g, "$1" + ii(M2));
1362
- format = format.replace(/(^|[^\\])M/g, "$1" + M2);
1400
+ format = format.replace(/(^|[^\\])MM/g, "$1" + ii(M));
1401
+ format = format.replace(/(^|[^\\])M/g, "$1" + M);
1363
1402
  const d = utc ? date.getUTCDate() : date.getDate();
1364
1403
  format = format.replace(/(^|[^\\])dddd+/g, "$1" + dddd[0]);
1365
1404
  format = format.replace(/(^|[^\\])ddd/g, "$1" + ddd[0]);
@@ -1383,26 +1422,26 @@ var __async = (__this, __arguments, generator) => {
1383
1422
  format = format.replace(/(^|[^\\])ff/g, "$1" + ii(f));
1384
1423
  f = Math.round(f / 10);
1385
1424
  format = format.replace(/(^|[^\\])f/g, "$1" + f);
1386
- const T2 = H < 12 ? "AM" : "PM";
1387
- format = format.replace(/(^|[^\\])TT+/g, "$1" + T2);
1388
- format = format.replace(/(^|[^\\])T/g, "$1" + T2.charAt(0));
1389
- const t2 = T2.toLowerCase();
1425
+ const T = H < 12 ? "AM" : "PM";
1426
+ format = format.replace(/(^|[^\\])TT+/g, "$1" + T);
1427
+ format = format.replace(/(^|[^\\])T/g, "$1" + T.charAt(0));
1428
+ const t2 = T.toLowerCase();
1390
1429
  format = format.replace(/(^|[^\\])tt+/g, "$1" + t2);
1391
1430
  format = format.replace(/(^|[^\\])t/g, "$1" + t2.charAt(0));
1392
1431
  let tz = -date.getTimezoneOffset();
1393
- let K = utc || !tz ? "Z" : tz > 0 ? "+" : "-";
1432
+ let K2 = utc || !tz ? "Z" : tz > 0 ? "+" : "-";
1394
1433
  if (!utc) {
1395
1434
  tz = Math.abs(tz);
1396
1435
  const tzHrs = Math.floor(tz / 60);
1397
1436
  const tzMin = tz % 60;
1398
- K += ii(tzHrs) + ":" + ii(tzMin);
1437
+ K2 += ii(tzHrs) + ":" + ii(tzMin);
1399
1438
  }
1400
- format = format.replace(/(^|[^\\])K/g, "$1" + K);
1439
+ format = format.replace(/(^|[^\\])K/g, "$1" + K2);
1401
1440
  const day = (utc ? date.getUTCDay() : date.getDay()) + 1;
1402
1441
  format = format.replace(new RegExp(dddd[0], "g"), dddd[day]);
1403
1442
  format = format.replace(new RegExp(ddd[0], "g"), ddd[day]);
1404
- format = format.replace(new RegExp(MMMM[0], "g"), MMMM[M2]);
1405
- format = format.replace(new RegExp(MMM[0], "g"), MMM[M2]);
1443
+ format = format.replace(new RegExp(MMMM[0], "g"), MMMM[M]);
1444
+ format = format.replace(new RegExp(MMM[0], "g"), MMM[M]);
1406
1445
  format = format.replace(/\\(.)/g, "$1");
1407
1446
  return format;
1408
1447
  }
@@ -1870,6 +1909,7 @@ var __async = (__this, __arguments, generator) => {
1870
1909
  setLabelFormatters() {
1871
1910
  const w = this.w;
1872
1911
  const fmt = w.formatters;
1912
+ const inferredNumericX = w.axisFlags.isXNumeric && w.axisFlags.dataFormatXNumeric && w.config.xaxis.type !== "datetime" && !w.config.xaxis.convertedCatToNumeric && !w.globals.isBarHorizontal;
1873
1913
  fmt.xaxisTooltipFormatter = (val) => {
1874
1914
  return this.defaultGeneralFormatter(val);
1875
1915
  };
@@ -1886,8 +1926,13 @@ var __async = (__this, __arguments, generator) => {
1886
1926
  fmt.xLabelFormatter = w.config.xaxis.labels.formatter;
1887
1927
  } else {
1888
1928
  fmt.xLabelFormatter = (val) => {
1929
+ var _a;
1889
1930
  if (Utils$1.isNumber(val)) {
1890
- if (!w.config.xaxis.convertedCatToNumeric && w.config.xaxis.type === "numeric") {
1931
+ if (!w.config.xaxis.convertedCatToNumeric && (w.config.xaxis.type === "numeric" || inferredNumericX)) {
1932
+ const ticks = (_a = w.globals.xAxisScale) == null ? void 0 : _a.result;
1933
+ if (inferredNumericX && Array.isArray(ticks) && ticks.every(Number.isInteger)) {
1934
+ return val.toFixed(0);
1935
+ }
1891
1936
  if (Utils$1.isNumber(w.config.xaxis.decimalsInFloat)) {
1892
1937
  return val.toFixed(w.config.xaxis.decimalsInFloat);
1893
1938
  } else {
@@ -1913,6 +1958,12 @@ var __async = (__this, __arguments, generator) => {
1913
1958
  }
1914
1959
  if (typeof w.config.tooltip.x.formatter === "function") {
1915
1960
  fmt.ttKeyFormatter = w.config.tooltip.x.formatter;
1961
+ } else if (w.config.xaxis.labels.formatter === void 0 && inferredNumericX) {
1962
+ const xLabelFormatter = (
1963
+ /** @type {(val: any) => any} */
1964
+ fmt.xLabelFormatter
1965
+ );
1966
+ fmt.ttKeyFormatter = (val) => Number.isInteger(val) ? val.toFixed(0) : xLabelFormatter(val);
1916
1967
  } else {
1917
1968
  fmt.ttKeyFormatter = fmt.xLabelFormatter;
1918
1969
  }
@@ -2771,6 +2822,17 @@ var __async = (__this, __arguments, generator) => {
2771
2822
  // around the pinch centroid (matching the x-only wheel/toolbar zoom),
2772
2823
  // frame-by-frame rather than the 400ms wheel throttle.
2773
2824
  pinch: "auto",
2825
+ // Drag-to-zoom is deliberate, so it is not gated the way those two
2826
+ // are: it stays on with the toolbar hidden. The reset button that
2827
+ // undoes it does not, which leaves the viewer in a window with no
2828
+ // exit. So while the chart IS zoomed and nothing else on screen can
2829
+ // reset it, one reset control is drawn where the toolbar would have
2830
+ // been, and it goes when the range does. A chart nobody zooms is
2831
+ // untouched. Set false for a page that supplies its own reset (which
2832
+ // also turns off the Escape shortcut), or true to force the control
2833
+ // on whenever the chart is zoomed, even where `toolbar.tools.reset`
2834
+ // is off.
2835
+ resetControl: "auto",
2774
2836
  zoomedArea: {
2775
2837
  fill: {
2776
2838
  color: "#90CAF9",
@@ -2837,6 +2899,11 @@ var __async = (__this, __arguments, generator) => {
2837
2899
  borderRadius: 0,
2838
2900
  borderRadiusApplication: "around",
2839
2901
  // [around, end]
2902
+ // Which segments of a stack round. 'all' caps both ends of the
2903
+ // stack (baseline and far end); 'last' caps only the far end, so
2904
+ // the stack sits square on the baseline. Stacked charts only.
2905
+ borderRadiusWhenStacked: "all",
2906
+ // [all, last]
2840
2907
  rangeBarOverlap: true,
2841
2908
  rangeBarGroupRows: false,
2842
2909
  hideZeroBarsWhenGrouped: false,
@@ -7625,16 +7692,11 @@ var __async = (__this, __arguments, generator) => {
7625
7692
  * which cannot reach the captured copies because each series object was
7626
7693
  * copied at capture time.
7627
7694
  *
7628
- * The one in-place mutator is appendData(), whose push loop grows the shared
7629
- * data array. Re-capturing after it does not undo that: the pushed points
7630
- * are already in the array both snapshots point at, so a snapshot taken
7631
- * before the append reads back as appended. That is the documented
7632
- * behaviour of appendData(overwriteInitialSeries = true), and the `false`
7633
- * case is not honoured for a separate, older reason: Data.parseData()
7634
- * re-captures initialSeries unconditionally on the re-render appendData
7635
- * triggers. Detaching would mean copying the data arrays, which is exactly
7636
- * the per-point cost this snapshot exists to avoid. The same exception
7637
- * applies to `initialConfig.series`, which is captured with the same shape.
7695
+ * appendData() used to be the exception, growing the shared data array in
7696
+ * place. It now replaces the array instead (`data = data.concat(newData)`):
7697
+ * one array copy per call, against the per-point cost this snapshot exists
7698
+ * to avoid. With that, no internal edit can reach a captured copy. The same
7699
+ * holds for `initialConfig.series`, which is captured with the same shape.
7638
7700
  *
7639
7701
  * @param {Record<string, any>} globals
7640
7702
  */
@@ -8211,7 +8273,7 @@ var __async = (__this, __arguments, generator) => {
8211
8273
  includedIndexes.push(si);
8212
8274
  }
8213
8275
  });
8214
- const excludedIndices = w.seriesData.series.map((_, fi) => includedIndexes.indexOf(fi) === -1 ? fi : -1).filter((f) => f !== -1);
8276
+ const excludedIndices = w.seriesData.series.map((_2, fi) => includedIndexes.indexOf(fi) === -1 ? fi : -1).filter((f) => f !== -1);
8215
8277
  total.push(this.getStackedSeriesTotals(excludedIndices));
8216
8278
  });
8217
8279
  return total;
@@ -8616,7 +8678,7 @@ var __async = (__this, __arguments, generator) => {
8616
8678
  _gl.yLogRatio = yRatio.slice();
8617
8679
  _gl.logYRange = /** @type {any[]} */
8618
8680
  gl.yRange.map(
8619
- (_, i2) => {
8681
+ (_2, i2) => {
8620
8682
  const yAxisIndex = w.globals.seriesYAxisReverseMap[i2];
8621
8683
  if (w.config.yaxis[yAxisIndex] && this.w.config.yaxis[yAxisIndex].logarithmic) {
8622
8684
  const range = 1;
@@ -8982,11 +9044,11 @@ var __async = (__this, __arguments, generator) => {
8982
9044
  return false;
8983
9045
  }
8984
9046
  function arcToBezier(pos, val) {
8985
- var rx = Math.abs(val[1]), ry = Math.abs(val[2]), xAxisRotation = val[3] % 360, largeArcFlag = val[4], sweepFlag = val[5], x = val[6], y = val[7], A2 = new Point(pos[0], pos[1]), B = new Point(x, y), primedCoord, lambda, mat, k, c, cSquare, t2, O2, OA, OB, tetaStart, tetaEnd, deltaTeta, nbSectors, f, arcSegPoints, angle, sinAngle, cosAngle, pt, i2, il, retVal = [], x1, y1, x2, y2;
8986
- if (rx === 0 || ry === 0 || A2.x === B.x && A2.y === B.y) {
8987
- return [["C", A2.x, A2.y, B.x, B.y, B.x, B.y]];
9047
+ var rx = Math.abs(val[1]), ry = Math.abs(val[2]), xAxisRotation = val[3] % 360, largeArcFlag = val[4], sweepFlag = val[5], x = val[6], y = val[7], A = new Point(pos[0], pos[1]), B = new Point(x, y), primedCoord, lambda, mat, k, c, cSquare, t2, O2, OA, OB, tetaStart, tetaEnd, deltaTeta, nbSectors, f, arcSegPoints, angle, sinAngle, cosAngle, pt, i2, il, retVal = [], x1, y1, x2, y2;
9048
+ if (rx === 0 || ry === 0 || A.x === B.x && A.y === B.y) {
9049
+ return [["C", A.x, A.y, B.x, B.y, B.x, B.y]];
8988
9050
  }
8989
- primedCoord = new Point((A2.x - B.x) / 2, (A2.y - B.y) / 2).transform(
9051
+ primedCoord = new Point((A.x - B.x) / 2, (A.y - B.y) / 2).transform(
8990
9052
  // Start with the identity matrix (no args → Matrix defaults a=d=1, others 0).
8991
9053
  // Passing all-zero args here would produce a degenerate zero matrix, since
8992
9054
  // `0 ?? 1` is `0`, not `1` — every subsequent transform then yields (0,0)
@@ -9002,9 +9064,9 @@ var __async = (__this, __arguments, generator) => {
9002
9064
  }
9003
9065
  mat = /** @type {any} */
9004
9066
  new Matrix().rotate(xAxisRotation).scale(1 / rx, 1 / ry).rotate(-xAxisRotation);
9005
- A2 = A2.transform(mat);
9067
+ A = A.transform(mat);
9006
9068
  B = B.transform(mat);
9007
- k = [B.x - A2.x, B.y - A2.y];
9069
+ k = [B.x - A.x, B.y - A.y];
9008
9070
  cSquare = k[0] * k[0] + k[1] * k[1];
9009
9071
  c = Math.sqrt(cSquare);
9010
9072
  k[0] /= c;
@@ -9013,8 +9075,8 @@ var __async = (__this, __arguments, generator) => {
9013
9075
  if (largeArcFlag === sweepFlag) {
9014
9076
  t2 *= -1;
9015
9077
  }
9016
- O2 = new Point((B.x + A2.x) / 2 + t2 * -k[1], (B.y + A2.y) / 2 + t2 * k[0]);
9017
- OA = new Point(A2.x - O2.x, A2.y - O2.y);
9078
+ O2 = new Point((B.x + A.x) / 2 + t2 * -k[1], (B.y + A.y) / 2 + t2 * k[0]);
9079
+ OA = new Point(A.x - O2.x, A.y - O2.y);
9018
9080
  OB = new Point(B.x - O2.x, B.y - O2.y);
9019
9081
  tetaStart = Math.acos(OA.x / Math.sqrt(OA.x * OA.x + OA.y * OA.y));
9020
9082
  if (OA.y < 0) tetaStart *= -1;
@@ -9645,7 +9707,7 @@ var __async = (__this, __arguments, generator) => {
9645
9707
  _reducedMotionMql = window.matchMedia("(prefers-reduced-motion: reduce)");
9646
9708
  }
9647
9709
  return !!_reducedMotionMql.matches;
9648
- } catch (_) {
9710
+ } catch (_2) {
9649
9711
  return false;
9650
9712
  }
9651
9713
  }
@@ -10008,7 +10070,7 @@ var __async = (__this, __arguments, generator) => {
10008
10070
  if (typeof node.getTotalLength === "function") {
10009
10071
  len = node.getTotalLength();
10010
10072
  }
10011
- } catch (_) {
10073
+ } catch (_2) {
10012
10074
  len = 0;
10013
10075
  }
10014
10076
  if (!len) {
@@ -10319,6 +10381,91 @@ var __async = (__this, __arguments, generator) => {
10319
10381
  });
10320
10382
  }
10321
10383
  }
10384
+ const CLAIMABLE = Object.freeze({
10385
+ "stroke.dashArray": Object.freeze({ type: "number" }),
10386
+ "dataLabels.enabledOnSeries": Object.freeze({ type: "boolean" })
10387
+ });
10388
+ function store(w) {
10389
+ if (!w.weaveClaims) w.weaveClaims = { byOption: /* @__PURE__ */ new Map() };
10390
+ return w.weaveClaims;
10391
+ }
10392
+ function claimsFor(w, option) {
10393
+ const s2 = store(w);
10394
+ if (!s2.byOption.has(option)) s2.byOption.set(option, []);
10395
+ return s2.byOption.get(option);
10396
+ }
10397
+ function normaliseEntries(option, entries) {
10398
+ const spec = (
10399
+ /** @type {Record<string, {type: string}>} */
10400
+ CLAIMABLE[option]
10401
+ );
10402
+ const out = [];
10403
+ for (const entry of Array.isArray(entries) ? entries : []) {
10404
+ if (!entry || typeof entry.series !== "string" && typeof entry.series !== "number") {
10405
+ console.warn(
10406
+ `[apexcharts] claim on "${option}": each entry needs a series name or index.`
10407
+ );
10408
+ continue;
10409
+ }
10410
+ if (typeof entry.value !== spec.type) {
10411
+ console.warn(
10412
+ `[apexcharts] claim on "${option}": expected a ${spec.type} for series ${String(
10413
+ entry.series
10414
+ )}, got ${typeof entry.value}.`
10415
+ );
10416
+ continue;
10417
+ }
10418
+ out.push({ series: entry.series, value: entry.value });
10419
+ }
10420
+ return out;
10421
+ }
10422
+ function addClaim(w, owner, option, entries) {
10423
+ if (!Object.prototype.hasOwnProperty.call(CLAIMABLE, option)) {
10424
+ console.warn(
10425
+ `[apexcharts] "${option}" is not a claimable option. Claimable: ${Object.keys(
10426
+ CLAIMABLE
10427
+ ).join(", ")}.`
10428
+ );
10429
+ return null;
10430
+ }
10431
+ const record = { owner, option, entries: normaliseEntries(option, entries) };
10432
+ claimsFor(w, option).push(record);
10433
+ return record;
10434
+ }
10435
+ function releaseClaim(w, record) {
10436
+ if (!w.weaveClaims || !record) return;
10437
+ const list = w.weaveClaims.byOption.get(record.option);
10438
+ if (!list) return;
10439
+ const at = list.indexOf(record);
10440
+ if (at > -1) list.splice(at, 1);
10441
+ }
10442
+ function releaseOwner(w, owner) {
10443
+ if (!w.weaveClaims) return;
10444
+ for (const [option, list] of w.weaveClaims.byOption) {
10445
+ const kept = list.filter((c) => c.owner !== owner);
10446
+ if (kept.length !== list.length) w.weaveClaims.byOption.set(option, kept);
10447
+ }
10448
+ }
10449
+ function indexOfSeries(w, series) {
10450
+ if (typeof series === "number") return series;
10451
+ const list = w.config && w.config.series || [];
10452
+ for (let i2 = 0; i2 < list.length; i2++) {
10453
+ if (list[i2] && list[i2].name === series) return i2;
10454
+ }
10455
+ return -1;
10456
+ }
10457
+ function resolveClaimed(w, option, seriesIndex, fallback) {
10458
+ if (!w || !w.weaveClaims) return fallback;
10459
+ const list = w.weaveClaims.byOption.get(option);
10460
+ if (!list || !list.length) return fallback;
10461
+ let resolved = fallback;
10462
+ for (const claim of list) {
10463
+ for (const entry of claim.entries) {
10464
+ if (indexOfSeries(w, entry.series) === seriesIndex) resolved = entry.value;
10465
+ }
10466
+ }
10467
+ return resolved;
10468
+ }
10322
10469
  class Graphics {
10323
10470
  /**
10324
10471
  * @param {import('../types/internal').ChartStateW} w
@@ -10716,6 +10863,12 @@ var __async = (__this, __arguments, generator) => {
10716
10863
  } else {
10717
10864
  strokeDashArray = w.config.stroke.dashArray;
10718
10865
  }
10866
+ strokeDashArray = resolveClaimed(
10867
+ w,
10868
+ "stroke.dashArray",
10869
+ realIndex,
10870
+ strokeDashArray
10871
+ );
10719
10872
  const el = this.drawPath({
10720
10873
  d,
10721
10874
  stroke,
@@ -12851,10 +13004,14 @@ var __async = (__this, __arguments, generator) => {
12851
13004
  dataPointIndex = j2
12852
13005
  } = opts;
12853
13006
  let dataLabelText = null;
12854
- if (Array.isArray(w.config.dataLabels.enabledOnSeries)) {
12855
- if (w.config.dataLabels.enabledOnSeries.indexOf(i2) < 0) {
12856
- return dataLabelText;
12857
- }
13007
+ const labelsOn = resolveClaimed(
13008
+ w,
13009
+ "dataLabels.enabledOnSeries",
13010
+ i2,
13011
+ Array.isArray(w.config.dataLabels.enabledOnSeries) ? w.config.dataLabels.enabledOnSeries.indexOf(i2) >= 0 : true
13012
+ );
13013
+ if (!labelsOn) {
13014
+ return dataLabelText;
12858
13015
  }
12859
13016
  let correctedLabels = {
12860
13017
  x,
@@ -15531,7 +15688,17 @@ var __async = (__this, __arguments, generator) => {
15531
15688
  let ticks = 10;
15532
15689
  if (cnf.xaxis.tickAmount === void 0) {
15533
15690
  ticks = Math.round(gl.svgWidth / 150);
15534
- if (cnf.xaxis.type === "numeric" && gl.dataPoints < 30) {
15691
+ const inferredNumericX = this.w.axisFlags.isXNumeric && this.w.axisFlags.dataFormatXNumeric && cnf.xaxis.type !== "datetime" && !cnf.xaxis.convertedCatToNumeric && !gl.isBarHorizontal;
15692
+ const fontSize = parseFloat(cnf.xaxis.labels.style.fontSize) || 12;
15693
+ const widestLabelLength = this.w.labelData.labels.reduce(
15694
+ (widest, seriesLabels) => Array.isArray(seriesLabels) ? seriesLabels.reduce(
15695
+ (seriesWidest, label) => Math.max(seriesWidest, String(label).length),
15696
+ widest
15697
+ ) : widest,
15698
+ 0
15699
+ );
15700
+ const allPointLabelsFit = gl.dataPoints * widestLabelLength * fontSize * 0.6 <= gl.svgWidth;
15701
+ if ((cnf.xaxis.type === "numeric" || inferredNumericX && allPointLabelsFit) && gl.dataPoints < 30) {
15535
15702
  ticks = gl.dataPoints - 1;
15536
15703
  }
15537
15704
  if (ticks > gl.dataPoints && gl.dataPoints !== 0) {
@@ -15755,7 +15922,7 @@ var __async = (__this, __arguments, generator) => {
15755
15922
  });
15756
15923
  Object.entries(stackedPoss).forEach(([key]) => {
15757
15924
  stackedPoss[key].forEach(
15758
- (_, stgi) => {
15925
+ (_2, stgi) => {
15759
15926
  gl.maxY = Math.max(gl.maxY, stackedPoss[key][stgi]);
15760
15927
  gl.minY = Math.min(gl.minY, stackedNegs[key][stgi]);
15761
15928
  }
@@ -16226,42 +16393,30 @@ var __async = (__this, __arguments, generator) => {
16226
16393
  }
16227
16394
  setYAxisTextAlignments() {
16228
16395
  const w = this.w;
16229
- const yaxis = Array.from(
16230
- w.dom.baseEl.getElementsByClassName("apexcharts-yaxis")
16231
- );
16232
- yaxis.forEach((y, index) => {
16233
- const yaxe = w.config.yaxis[index];
16396
+ w.config.yaxis.forEach((yaxe, index) => {
16234
16397
  if (yaxe && !yaxe.floating && yaxe.labels.align !== void 0) {
16235
16398
  const yAxisInner = w.dom.baseEl.querySelector(
16236
16399
  `.apexcharts-yaxis[rel='${index}'] .apexcharts-yaxis-texts-g`
16237
16400
  );
16401
+ if (!yAxisInner) return;
16238
16402
  const yAxisTexts = Array.from(
16239
16403
  w.dom.baseEl.querySelectorAll(
16240
16404
  `.apexcharts-yaxis[rel='${index}'] .apexcharts-yaxis-label`
16241
16405
  )
16242
16406
  );
16243
- const rect = (
16244
- /** @type {Element} */
16245
- yAxisInner.getBoundingClientRect()
16246
- );
16407
+ const rect = yAxisInner.getBoundingClientRect();
16247
16408
  yAxisTexts.forEach((label) => {
16248
16409
  label.setAttribute("text-anchor", yaxe.labels.align);
16249
16410
  });
16250
16411
  if (yaxe.labels.align === "left" && !yaxe.opposite) {
16251
- yAxisInner.setAttribute(
16252
- "transform",
16253
- `translate(-${rect.width}, 0)`
16254
- );
16412
+ yAxisInner.setAttribute("transform", `translate(-${rect.width}, 0)`);
16255
16413
  } else if (yaxe.labels.align === "center") {
16256
16414
  yAxisInner.setAttribute(
16257
16415
  "transform",
16258
16416
  `translate(${rect.width / 2 * (!yaxe.opposite ? -1 : 1)}, 0)`
16259
16417
  );
16260
16418
  } else if (yaxe.labels.align === "right" && yaxe.opposite) {
16261
- yAxisInner.setAttribute(
16262
- "transform",
16263
- `translate(${rect.width}, 0)`
16264
- );
16419
+ yAxisInner.setAttribute("transform", `translate(${rect.width}, 0)`);
16265
16420
  }
16266
16421
  }
16267
16422
  });
@@ -17121,9 +17276,9 @@ var __async = (__this, __arguments, generator) => {
17121
17276
  if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
17122
17277
  if (!oldY.length || !newY.length) return null;
17123
17278
  const oldKeys = uniquifyKeys(
17124
- oldY.map((_, j2) => frameDatumKey(frame, realIndex, j2))
17279
+ oldY.map((_2, j2) => frameDatumKey(frame, realIndex, j2))
17125
17280
  );
17126
- const newKeys = uniquifyKeys(newY.map((_, j2) => datumKey(w, realIndex, j2)));
17281
+ const newKeys = uniquifyKeys(newY.map((_2, j2) => datumKey(w, realIndex, j2)));
17127
17282
  const join = joinKeys(oldKeys, newKeys);
17128
17283
  if (!join.ordered && !allowReorder) return null;
17129
17284
  if (!join.changed && !includeIdentity) return null;
@@ -17313,7 +17468,7 @@ var __async = (__this, __arguments, generator) => {
17313
17468
  origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
17314
17469
  }
17315
17470
  }
17316
- } catch (_) {
17471
+ } catch (_2) {
17317
17472
  }
17318
17473
  const style = node.style;
17319
17474
  style.transformBox = "fill-box";
@@ -17430,7 +17585,7 @@ var __async = (__this, __arguments, generator) => {
17430
17585
  xScale: currentXScale(w),
17431
17586
  yAnchors: currentYAnchors(w, yLabels)
17432
17587
  };
17433
- } catch (_) {
17588
+ } catch (_2) {
17434
17589
  gl.prevChromeFrame = null;
17435
17590
  }
17436
17591
  }
@@ -17622,7 +17777,7 @@ var __async = (__this, __arguments, generator) => {
17622
17777
  if (!chrome || !gl.axisCharts || !Environment.isBrowser()) return;
17623
17778
  if (!lengthTransitionEnabled(w)) return;
17624
17779
  const anyMotion = (w.seriesData.series || []).some(
17625
- (_, i2) => seriesJoin(w, i2, true, true) !== null
17780
+ (_2, i2) => seriesJoin(w, i2, true, true) !== null
17626
17781
  );
17627
17782
  if (!anyMotion) return;
17628
17783
  const root = w.dom.baseEl;
@@ -17663,7 +17818,7 @@ var __async = (__this, __arguments, generator) => {
17663
17818
  ease,
17664
17819
  project: projY
17665
17820
  });
17666
- } catch (_) {
17821
+ } catch (_2) {
17667
17822
  }
17668
17823
  }
17669
17824
  const DL_GROUP_SEL = ".apexcharts-data-labels[data\\:dlKey]";
@@ -17723,7 +17878,7 @@ var __async = (__this, __arguments, generator) => {
17723
17878
  });
17724
17879
  });
17725
17880
  gl.prevDataLabels = map.size ? map : null;
17726
- } catch (_) {
17881
+ } catch (_2) {
17727
17882
  gl.prevDataLabels = null;
17728
17883
  }
17729
17884
  }
@@ -17786,7 +17941,7 @@ var __async = (__this, __arguments, generator) => {
17786
17941
  if (typeof formatter === "function") {
17787
17942
  try {
17788
17943
  out = formatter(rounded, fmtOpts);
17789
- } catch (_) {
17944
+ } catch (_2) {
17790
17945
  out = rounded;
17791
17946
  }
17792
17947
  }
@@ -17900,7 +18055,7 @@ var __async = (__this, __arguments, generator) => {
17900
18055
  });
17901
18056
  }
17902
18057
  });
17903
- } catch (_) {
18058
+ } catch (_2) {
17904
18059
  }
17905
18060
  }
17906
18061
  class Series {
@@ -21929,7 +22084,7 @@ var __async = (__this, __arguments, generator) => {
21929
22084
  const point = data[j2];
21930
22085
  const x = point[0];
21931
22086
  const y = point[1];
21932
- const z = point[2];
22087
+ const z2 = point[2];
21933
22088
  if (typeof y !== "undefined") {
21934
22089
  if (Array.isArray(y) && y.length === 4 && !isBoxPlot) {
21935
22090
  this.twoDSeries.push(Utils$1.parseNumber(y[3]));
@@ -21946,8 +22101,8 @@ var __async = (__this, __arguments, generator) => {
21946
22101
  } else {
21947
22102
  this.twoDSeriesX.push(x);
21948
22103
  }
21949
- if (typeof z !== "undefined") {
21950
- this.threeDSeries.push(z);
22104
+ if (typeof z2 !== "undefined") {
22105
+ this.threeDSeries.push(z2);
21951
22106
  this.w.axisFlags.isDataXYZ = true;
21952
22107
  }
21953
22108
  }
@@ -22829,7 +22984,7 @@ var __async = (__this, __arguments, generator) => {
22829
22984
  }
22830
22985
  const x = this.getNestedValue(item, effectiveParsing.x);
22831
22986
  let y;
22832
- let z = void 0;
22987
+ let z2 = void 0;
22833
22988
  if (Array.isArray(effectiveParsing.y)) {
22834
22989
  const yValues = effectiveParsing.y.map(
22835
22990
  (fieldName) => this.getNestedValue(item, fieldName)
@@ -22848,7 +23003,7 @@ var __async = (__this, __arguments, generator) => {
22848
23003
  y = this.getNestedValue(item, effectiveParsing.y);
22849
23004
  }
22850
23005
  if (effectiveParsing.z) {
22851
- z = this.getNestedValue(item, effectiveParsing.z);
23006
+ z2 = this.getNestedValue(item, effectiveParsing.z);
22852
23007
  }
22853
23008
  if (x === void 0) {
22854
23009
  console.warn(
@@ -22867,8 +23022,8 @@ var __async = (__this, __arguments, generator) => {
22867
23022
  result.z = zValue;
22868
23023
  }
22869
23024
  }
22870
- if (z !== void 0) {
22871
- result.z = z;
23025
+ if (z2 !== void 0) {
23026
+ result.z = z2;
22872
23027
  }
22873
23028
  return result;
22874
23029
  }
@@ -23140,8 +23295,11 @@ var __async = (__this, __arguments, generator) => {
23140
23295
  // Segregate user provided data into appropriate vars
23141
23296
  /**
23142
23297
  * @param {any[]} ser
23298
+ * @param {boolean} [overwriteInitialSeries=true] false when the caller hands
23299
+ * back the series the chart already has (an internal re-render), so the
23300
+ * baseline resetSeries() restores must not move.
23143
23301
  */
23144
- parseData(ser) {
23302
+ parseData(ser, overwriteInitialSeries = true) {
23145
23303
  var _a, _b, _c, _d, _e, _f, _g;
23146
23304
  const w = this.w;
23147
23305
  const cnf = w.config;
@@ -23174,7 +23332,8 @@ var __async = (__this, __arguments, generator) => {
23174
23332
  ser = ser.map((s2) => __spreadValues({}, s2));
23175
23333
  }
23176
23334
  cnf.series = ser;
23177
- if (gl.dataReducerRawSeries && ((_g = cnf.chart.dataReducer) == null ? void 0 : _g.enabled)) {
23335
+ if (!overwriteInitialSeries) ;
23336
+ else if (gl.dataReducerRawSeries && ((_g = cnf.chart.dataReducer) == null ? void 0 : _g.enabled)) {
23178
23337
  const stash = gl.dataReducerRawSeries;
23179
23338
  gl.initialSeries = ser.map((s2, i2) => {
23180
23339
  var _a2, _b2, _c2;
@@ -23614,7 +23773,9 @@ var __async = (__this, __arguments, generator) => {
23614
23773
  );
23615
23774
  initialConfig.series = !options2.series && prevInitialSeries ? prevInitialSeries : Utils$1.copySeriesShallow(w.config.series);
23616
23775
  w.globals.initialConfig = initialConfig;
23617
- w.globals.initialSeries = w.config.series;
23776
+ if (options2.series) {
23777
+ w.globals.initialSeries = w.config.series;
23778
+ }
23618
23779
  }
23619
23780
  if (options2.series && (w.globals.collapsedSeriesIndices.length > 0 || w.globals.ancillaryCollapsedSeriesIndices.length > 0)) {
23620
23781
  ch.series.reconcileCollapsedByName();
@@ -23663,14 +23824,20 @@ var __async = (__this, __arguments, generator) => {
23663
23824
  w.globals.streamgraphRawSeries = null;
23664
23825
  w.globals.treemapRawSeries = null;
23665
23826
  }
23827
+ const definedSeries = newSeries;
23828
+ let reconciledCollapses = false;
23666
23829
  if (w.globals.axisCharts && (w.globals.collapsedSeriesIndices.length > 0 || w.globals.ancillaryCollapsedSeriesIndices.length > 0)) {
23667
23830
  newSeries = newSeries.map(
23668
23831
  (s2) => s2 && typeof s2 === "object" ? __spreadValues({}, s2) : s2
23669
23832
  );
23670
23833
  this.ctx.series.reconcileCollapsedByName(newSeries);
23834
+ reconciledCollapses = true;
23671
23835
  }
23672
23836
  this.ctx.data.resetParsingFlags();
23673
- const parsedState = this.ctx.data.parseData(newSeries);
23837
+ const parsedState = this.ctx.data.parseData(
23838
+ newSeries,
23839
+ overwriteInitialSeries
23840
+ );
23674
23841
  this.ctx._writeParsedSeriesData(parsedState.seriesData);
23675
23842
  this.ctx._writeParsedRangeData(parsedState.rangeData);
23676
23843
  this.ctx._writeParsedCandleData(parsedState.candleData);
@@ -23679,10 +23846,12 @@ var __async = (__this, __arguments, generator) => {
23679
23846
  if (overwriteInitialSeries) {
23680
23847
  if (w.globals.initialConfig) {
23681
23848
  w.globals.initialConfig.series = Utils$1.copySeriesShallow(
23682
- w.config.series
23849
+ reconciledCollapses ? definedSeries : w.config.series
23683
23850
  );
23684
23851
  }
23685
- w.globals.initialSeries = w.config.series;
23852
+ if (reconciledCollapses) {
23853
+ w.globals.initialSeries = definedSeries;
23854
+ }
23686
23855
  }
23687
23856
  if (this._canUseFastPath(newSeries, prevSeriesCount, prevDataLengths, w)) {
23688
23857
  return this.ctx.fastUpdate(animate, prevAxisScaleSig).then(() => {
@@ -29323,14 +29492,14 @@ var __async = (__this, __arguments, generator) => {
29323
29492
  const t2 = __spreadProps(__spreadValues({}, n2), { signatureVerified: true });
29324
29493
  return void (this.licenseKey === e2 ? this.publish(t2) : this.notify(t2));
29325
29494
  }
29326
- const h = "Invalid license key. The license signature does not verify.", d = { data: i2.data, expired: false, message: h, signatureVerified: true, valid: false };
29327
- this.licenseKey === e2 ? this.publish(d) : this.notify(d), t(`[Apex] ${h}`);
29495
+ const u = "Invalid license key. The license signature does not verify.", h = { data: i2.data, expired: false, message: u, signatureVerified: true, valid: false };
29496
+ this.licenseKey === e2 ? this.publish(h) : this.notify(h), t(`[Apex] ${u}`);
29328
29497
  });
29329
29498
  }
29330
29499
  };
29331
29500
  l.publicKeysSpki = ["MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQIaK9UMD6n0oR/FIy8QdL0uSzKMQlf1BB+tOrji4/WuHsyRNxeDhVykoSsNURozMi1xhmqWvBH1L//xIfugTPA=="], l.verdicts = /* @__PURE__ */ new Map(), l.verifying = /* @__PURE__ */ new Set(), l.warnedUnverifiable = false, l.epoch = 0;
29332
29501
  let o = l;
29333
- const A = class {
29502
+ const j = class {
29334
29503
  static applyStyles(e2) {
29335
29504
  Object.assign(e2.style, this.CRITICAL_STYLES, { backgroundImage: this.createWatermarkPattern(), backgroundRepeat: "repeat" });
29336
29505
  }
@@ -29388,34 +29557,34 @@ var __async = (__this, __arguments, generator) => {
29388
29557
  })));
29389
29558
  }
29390
29559
  };
29391
- A.WATERMARK_ATTR = "data-apexcharts-watermark", A.WATERMARK_TEXT = "APEXCHARTS", A.ATTR = "data-apexcharts-watermark", A.CRITICAL_STYLES = { bottom: "0", display: "block", left: "0", msUserSelect: "none", opacity: "1", pointerEvents: "none", position: "absolute", right: "0", top: "0", userSelect: "none", visibility: "visible", webkitUserSelect: "none", zIndex: "10000" }, A.managed = /* @__PURE__ */ new Set(), A.subscribed = false;
29392
- let M = A;
29393
- const L = 0.05, T = 0.05, j = 1 / 45;
29394
- function E(e2, t2, s2, i2) {
29560
+ j.WATERMARK_ATTR = "data-apexcharts-watermark", j.WATERMARK_TEXT = "APEXCHARTS", j.ATTR = "data-apexcharts-watermark", j.CRITICAL_STYLES = { bottom: "0", display: "block", left: "0", msUserSelect: "none", opacity: "1", pointerEvents: "none", position: "absolute", right: "0", top: "0", userSelect: "none", visibility: "visible", webkitUserSelect: "none", zIndex: "10000" }, j.managed = /* @__PURE__ */ new Set(), j.subscribed = false;
29561
+ let C = j;
29562
+ const D = 0.05, K = 0.05, O = 1 / 45;
29563
+ function $(e2, t2, s2, i2) {
29395
29564
  const n2 = { value: e2, velocity: 0, target: e2, stiffness: t2, damping: s2 };
29396
29565
  return n2;
29397
29566
  }
29398
- function R(e2, t2) {
29399
- if (t2 <= 0) return O(e2);
29567
+ function q(e2, t2) {
29568
+ if (t2 <= 0) return W(e2);
29400
29569
  let s2 = t2;
29401
29570
  for (; s2 > 0; ) {
29402
- const t3 = Math.min(s2, j), i2 = -e2.stiffness * (e2.value - e2.target) - e2.damping * e2.velocity;
29571
+ const t3 = Math.min(s2, O), i2 = -e2.stiffness * (e2.value - e2.target) - e2.damping * e2.velocity;
29403
29572
  e2.velocity += i2 * t3, e2.value += e2.velocity * t3, s2 -= t3;
29404
29573
  }
29405
- return !!O(e2) && (e2.value = e2.target, e2.velocity = 0, true);
29574
+ return !!W(e2) && (e2.value = e2.target, e2.velocity = 0, true);
29406
29575
  }
29407
- function D(e2, t2) {
29576
+ function _(e2, t2) {
29408
29577
  e2.target = t2;
29409
29578
  }
29410
- function O(e2) {
29579
+ function W(e2) {
29411
29580
  var _a, _b;
29412
- const t2 = (_a = e2.restVelocity) != null ? _a : L, s2 = (_b = e2.restDisplacement) != null ? _b : T;
29581
+ const t2 = (_a = e2.restVelocity) != null ? _a : D, s2 = (_b = e2.restDisplacement) != null ? _b : K;
29413
29582
  return Math.abs(e2.velocity) < t2 && Math.abs(e2.value - e2.target) < s2;
29414
29583
  }
29415
- const $ = { crisp: [210, 26], gentle: [120, 20], snappy: [320, 30] };
29416
- function q(e2) {
29584
+ const V = { crisp: [210, 26], gentle: [120, 20], snappy: [320, 30] };
29585
+ function z(e2) {
29417
29586
  var _a;
29418
- return (_a = $[e2 != null ? e2 : "crisp"]) != null ? _a : $.crisp;
29587
+ return (_a = V[e2 != null ? e2 : "crisp"]) != null ? _a : V.crisp;
29419
29588
  }
29420
29589
  const PRICING_URL = "https://apexcharts.com/pricing";
29421
29590
  let _perspectivesTokenDecoded = false;
@@ -29469,15 +29638,15 @@ var __async = (__this, __arguments, generator) => {
29469
29638
  return typeof plan === "string" && PREMIUM_PLANS.has(plan.toLowerCase());
29470
29639
  }
29471
29640
  function reinstateWatermark(ctx, elWrap) {
29472
- const node = M.add(elWrap, { manage: false });
29641
+ const node = C.add(elWrap, { manage: false });
29473
29642
  if (!node || typeof MutationObserver === "undefined") return;
29474
29643
  if (ctx._wmNodeObserver && ctx._wmObservedNode === node) return;
29475
29644
  if (ctx._wmNodeObserver) ctx._wmNodeObserver.disconnect();
29476
29645
  const nodeObs = new MutationObserver(() => {
29477
- const n2 = M.node(elWrap);
29646
+ const n2 = C.node(elWrap);
29478
29647
  if (!n2) return;
29479
29648
  nodeObs.disconnect();
29480
- M.applyStyles(n2);
29649
+ C.applyStyles(n2);
29481
29650
  nodeObs.takeRecords();
29482
29651
  nodeObs.observe(n2, { attributes: true, attributeFilter: ["style"] });
29483
29652
  });
@@ -29489,7 +29658,7 @@ var __async = (__this, __arguments, generator) => {
29489
29658
  reinstateWatermark(ctx, elWrap);
29490
29659
  if (typeof MutationObserver === "undefined" || ctx._wmWrapObserver) return;
29491
29660
  const wrapObs = new MutationObserver(() => {
29492
- if (!M.node(elWrap)) reinstateWatermark(ctx, elWrap);
29661
+ if (!C.node(elWrap)) reinstateWatermark(ctx, elWrap);
29493
29662
  });
29494
29663
  wrapObs.observe(elWrap, { childList: true });
29495
29664
  ctx._wmWrapObserver = wrapObs;
@@ -29505,7 +29674,7 @@ var __async = (__this, __arguments, generator) => {
29505
29674
  }
29506
29675
  ctx._wmObservedNode = null;
29507
29676
  const wrap = elWrap || ctx.w && ctx.w.dom && ctx.w.dom.elWrap;
29508
- if (wrap) M.remove(wrap, { manage: false });
29677
+ if (wrap) C.remove(wrap, { manage: false });
29509
29678
  }
29510
29679
  function notifyTrial(ctx, key, features) {
29511
29680
  if (ctx._premiumLicenseNotified) return;
@@ -29882,8 +30051,9 @@ var __async = (__this, __arguments, generator) => {
29882
30051
  /**
29883
30052
  * @param {any[]} ser
29884
30053
  * @param {object} opts
30054
+ * @param {boolean} [overwriteInitialSeries=true]
29885
30055
  */
29886
- create(ser, opts) {
30056
+ create(ser, opts, overwriteInitialSeries = true) {
29887
30057
  var _a, _b, _c, _d, _e, _f;
29888
30058
  const w = this.w;
29889
30059
  if (!this.core) {
@@ -29930,7 +30100,7 @@ var __async = (__this, __arguments, generator) => {
29930
30100
  if (Environment.isBrowser()) {
29931
30101
  this.events.setupEventHandlers();
29932
30102
  }
29933
- const parsedState = this.data.parseData(series);
30103
+ const parsedState = this.data.parseData(series, overwriteInitialSeries);
29934
30104
  this._writeParsedSeriesData(parsedState.seriesData);
29935
30105
  this._writeParsedRangeData(parsedState.rangeData);
29936
30106
  this._writeParsedCandleData(parsedState.candleData);
@@ -29997,7 +30167,7 @@ var __async = (__this, __arguments, generator) => {
29997
30167
  const me = this;
29998
30168
  const w = me.w;
29999
30169
  return new Promise((resolve, reject) => {
30000
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
30170
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
30001
30171
  if (me.el === null) {
30002
30172
  return reject(
30003
30173
  new Error("Not enough data to display or target element not found")
@@ -30095,9 +30265,11 @@ var __async = (__this, __arguments, generator) => {
30095
30265
  }
30096
30266
  if (w.config.chart.toolbar.show && !w.globals.allSeriesCollapsed) {
30097
30267
  (_k = me.toolbar) == null ? void 0 : _k.createToolbar();
30268
+ } else if (!w.globals.allSeriesCollapsed && ((_l = me.toolbar) == null ? void 0 : _l.resetControlDue())) {
30269
+ me.toolbar.createToolbar({ resetOnly: true });
30098
30270
  }
30099
30271
  }
30100
- (_l = me.weave) == null ? void 0 : _l.dispatch("draw", {
30272
+ (_m = me.weave) == null ? void 0 : _m.dispatch("draw", {
30101
30273
  pass: "full",
30102
30274
  xyRatios: graphData == null ? void 0 : graphData.xyRatios
30103
30275
  });
@@ -30286,6 +30458,7 @@ var __async = (__this, __arguments, generator) => {
30286
30458
  * @returns {Promise<ApexCharts>} Resolves with the chart instance after re-render.
30287
30459
  */
30288
30460
  appendData(newData, overwriteInitialSeries = true) {
30461
+ var _a;
30289
30462
  const me = this;
30290
30463
  me.data.resetParsingFlags();
30291
30464
  me.w.globals.dataChanged = true;
@@ -30300,14 +30473,13 @@ var __async = (__this, __arguments, generator) => {
30300
30473
  newData[i2]
30301
30474
  );
30302
30475
  if (src && Array.isArray(src.data) && Array.isArray(derivedRaw[i2].data)) {
30303
- for (let j2 = 0; j2 < src.data.length; j2++) {
30304
- derivedRaw[i2].data.push(src.data[j2]);
30305
- }
30476
+ derivedRaw[i2].data = derivedRaw[i2].data.concat(src.data);
30306
30477
  }
30307
30478
  }
30308
- return this.update();
30479
+ return this.update(void 0, overwriteInitialSeries);
30309
30480
  }
30310
30481
  const newSeries = me.w.config.series.slice();
30482
+ const reducerRaw = me.w.globals.dataReducerRawSeries;
30311
30483
  for (let i2 = 0; i2 < newSeries.length; i2++) {
30312
30484
  if (newData[i2] !== null && typeof newData[i2] !== "undefined") {
30313
30485
  const srcSerie = (
@@ -30318,17 +30490,15 @@ var __async = (__this, __arguments, generator) => {
30318
30490
  /** @type {any} */
30319
30491
  newSeries[i2]
30320
30492
  );
30321
- for (let j2 = 0; j2 < srcSerie.data.length; j2++) {
30322
- dstSerie.data.push(srcSerie.data[j2]);
30493
+ dstSerie.data = dstSerie.data.concat(srcSerie.data);
30494
+ if (reducerRaw && Array.isArray((_a = reducerRaw[i2]) == null ? void 0 : _a.data)) {
30495
+ reducerRaw[i2].data = reducerRaw[i2].data.concat(srcSerie.data);
30323
30496
  }
30324
30497
  }
30325
30498
  }
30326
30499
  trimStreamingSeries(newSeries, me.w);
30327
30500
  me.w.config.series = newSeries;
30328
- if (overwriteInitialSeries) {
30329
- me.w.globals.initialSeries = me.w.config.series;
30330
- }
30331
- return this.update();
30501
+ return this.update(void 0, overwriteInitialSeries);
30332
30502
  }
30333
30503
  /**
30334
30504
  * True when an options object carries enough series data that a
@@ -30350,15 +30520,22 @@ var __async = (__this, __arguments, generator) => {
30350
30520
  }
30351
30521
  /**
30352
30522
  * @param {object} [options]
30523
+ * @param {boolean} [overwriteInitialSeries=false] true only when the caller
30524
+ * redefined the series before triggering this re-render, so the parse it
30525
+ * runs is the one that captures the new baseline.
30353
30526
  */
30354
- update(options2) {
30527
+ update(options2, overwriteInitialSeries = false) {
30355
30528
  return new Promise((resolve, reject) => {
30356
30529
  if (options2 && this.lastUpdateOptions && !_ApexCharts._optionsTooBigToCompare(options2) && Utils$1.stringifyForCompare(this.lastUpdateOptions) === Utils$1.stringifyForCompare(options2)) {
30357
30530
  return resolve(this);
30358
30531
  }
30359
30532
  this.lastUpdateOptions = options2 && !_ApexCharts._optionsTooBigToCompare(options2) ? Utils$1.clone(options2) : null;
30360
30533
  new Destroy(this.ctx).clear({ isUpdating: true });
30361
- const graphData = this.create(this.w.config.series, options2 != null ? options2 : {});
30534
+ const graphData = this.create(
30535
+ this.w.config.series,
30536
+ options2 != null ? options2 : {},
30537
+ overwriteInitialSeries
30538
+ );
30362
30539
  if (!graphData) return resolve(this);
30363
30540
  this.mount(graphData).then(() => {
30364
30541
  var _a;
@@ -32668,8 +32845,7 @@ var __async = (__this, __arguments, generator) => {
32668
32845
  }
32669
32846
  };
32670
32847
  const handleUnequalXValues = () => {
32671
- const categories = /* @__PURE__ */ new Set();
32672
- const data = {};
32848
+ const byCategory = /* @__PURE__ */ new Map();
32673
32849
  series.forEach((s2, sI) => {
32674
32850
  s2 == null ? void 0 : s2.data.forEach((dataItem) => {
32675
32851
  let cat, value;
@@ -32682,23 +32858,22 @@ var __async = (__this, __arguments, generator) => {
32682
32858
  } else {
32683
32859
  return;
32684
32860
  }
32685
- if (!/** @type {Record<string,any>} */
32686
- data[cat]) {
32687
- data[cat] = Array(
32688
- series.length
32689
- ).fill("");
32861
+ const key = String(cat);
32862
+ let row = byCategory.get(key);
32863
+ if (!row) {
32864
+ row = { cat, values: Array(series.length).fill("") };
32865
+ byCategory.set(key, row);
32690
32866
  }
32691
- data[cat][sI] = getFormattedValue(value);
32692
- categories.add(cat);
32867
+ row.values[sI] = getFormattedValue(value);
32693
32868
  });
32694
32869
  });
32695
32870
  if (columns.length) {
32696
32871
  rows.push(columns.join(columnDelimiter));
32697
32872
  }
32698
- Array.from(categories).sort().forEach((cat) => {
32699
- const values = (
32700
- /** @type {Record<string,any>} */
32701
- data[cat]
32873
+ Array.from(byCategory.keys()).sort().forEach((key) => {
32874
+ const { cat, values } = (
32875
+ /** @type {{cat: any, values: string[]}} */
32876
+ byCategory.get(key)
32702
32877
  );
32703
32878
  rows.push([getFormattedCategory(cat), ...values].join(columnDelimiter));
32704
32879
  });
@@ -33714,7 +33889,7 @@ var __async = (__this, __arguments, generator) => {
33714
33889
  "dataPointMouseLeave",
33715
33890
  this._onCellLeave
33716
33891
  );
33717
- } catch (_) {
33892
+ } catch (_2) {
33718
33893
  }
33719
33894
  }
33720
33895
  /** Wire mousemove/mouseout on each per-band hit-region (ranges mode). */
@@ -34133,7 +34308,7 @@ var __async = (__this, __arguments, generator) => {
34133
34308
  const isLegendInversed = w.config.legend.inverseOrder;
34134
34309
  const legendGroups = [];
34135
34310
  if (w.labelData.seriesGroups.length > 1 && w.config.legend.clusterGroupedSeries) {
34136
- w.labelData.seriesGroups.forEach((_, gi) => {
34311
+ w.labelData.seriesGroups.forEach((_2, gi) => {
34137
34312
  legendGroups[gi] = BrowserAPIs.createElement("div");
34138
34313
  legendGroups[gi].classList.add(
34139
34314
  "apexcharts-legend-group",
@@ -34458,10 +34633,49 @@ var __async = (__this, __arguments, generator) => {
34458
34633
  this.elMenu = null;
34459
34634
  this.elMenuItems = [];
34460
34635
  this.t = null;
34636
+ this._drawnForZoom = null;
34461
34637
  }
34462
- createToolbar() {
34463
- var _a, _b;
34638
+ /**
34639
+ * Whether this chart's built-in ways back out of a zoom are switched on.
34640
+ *
34641
+ * The gate `chart.zoom.resetControl` opens, and the one the Escape shortcut
34642
+ * reads too, so a page that says it supplies its own reset gets neither.
34643
+ * 'auto' means "supply one when nothing else on screen can": a toolbar
34644
+ * showing its reset tool is a way back, and anything else is not.
34645
+ *
34646
+ * @returns {boolean}
34647
+ */
34648
+ resetControlAllowed() {
34649
+ const c = this.w.config.chart;
34650
+ if (!c.zoom || !c.zoom.enabled) return false;
34651
+ const setting = c.zoom.resetControl === void 0 ? "auto" : c.zoom.resetControl;
34652
+ if (setting !== "auto") return !!setting;
34653
+ const onScreen = c.toolbar && c.toolbar.show && c.toolbar.tools && c.toolbar.tools.reset;
34654
+ return !onScreen;
34655
+ }
34656
+ /**
34657
+ * Whether a reset control has to be drawn for the state the chart is in now.
34658
+ *
34659
+ * Only while the chart is actually zoomed, which is the whole idea: the
34660
+ * control appears at the moment the viewer changed the view, where they are
34661
+ * already looking, and goes again when the range does. A page that never
34662
+ * zooms never sees it, so `toolbar: { show: false }` still means an empty
34663
+ * chart for everyone who does not zoom.
34664
+ *
34665
+ * @returns {boolean}
34666
+ */
34667
+ resetControlDue() {
34668
+ return !!this.w.interact.zoomed && this.resetControlAllowed();
34669
+ }
34670
+ /**
34671
+ * @param {{ resetOnly?: boolean }} [opts] `resetOnly` draws the on-demand
34672
+ * reset control and nothing else, for a chart whose page asked for no
34673
+ * toolbar at all. See {@link Toolbar#resetControlDue}.
34674
+ */
34675
+ createToolbar(opts = {}) {
34676
+ var _a, _b, _c;
34464
34677
  const w = this.w;
34678
+ const resetOnly = !!opts.resetOnly;
34465
34679
  const createDiv = () => {
34466
34680
  return BrowserAPIs.createElementNS("http://www.w3.org/1999/xhtml", "div");
34467
34681
  };
@@ -34489,6 +34703,24 @@ var __async = (__this, __arguments, generator) => {
34489
34703
  this.elMenu = createDiv();
34490
34704
  this.elCustomIcons = [];
34491
34705
  this.t = w.config.chart.toolbar.tools;
34706
+ this._drawnForZoom = null;
34707
+ if (resetOnly) {
34708
+ this.t = {
34709
+ zoom: false,
34710
+ zoomin: false,
34711
+ zoomout: false,
34712
+ selection: false,
34713
+ pan: false,
34714
+ measure: false,
34715
+ download: false,
34716
+ customIcons: [],
34717
+ reset: true
34718
+ };
34719
+ this._drawnForZoom = "wrap";
34720
+ } else if (!this.t.reset && this.resetControlDue()) {
34721
+ this.t = __spreadProps(__spreadValues({}, this.t), { reset: true });
34722
+ this._drawnForZoom = "control";
34723
+ }
34492
34724
  if (Array.isArray(this.t.customIcons)) {
34493
34725
  for (let i2 = 0; i2 < this.t.customIcons.length; i2++) {
34494
34726
  this.elCustomIcons.push(createBtn());
@@ -34511,16 +34743,16 @@ var __async = (__this, __arguments, generator) => {
34511
34743
  };
34512
34744
  appendZoomControl("zoomIn", this.elZoomIn, icoZoomIn);
34513
34745
  appendZoomControl("zoomOut", this.elZoomOut, icoZoomOut);
34514
- const zoomSelectionCtrls = (z) => {
34515
- if (this.t[z] && w.config.chart[z].enabled) {
34746
+ const zoomSelectionCtrls = (z2) => {
34747
+ if (this.t[z2] && w.config.chart[z2].enabled) {
34516
34748
  toolbarControls.push({
34517
- el: z === "zoom" ? this.elZoom : this.elSelection,
34518
- icon: typeof this.t[z] === "string" ? this.t[z] : z === "zoom" ? icoZoom : icoSelect,
34749
+ el: z2 === "zoom" ? this.elZoom : this.elSelection,
34750
+ icon: typeof this.t[z2] === "string" ? this.t[z2] : z2 === "zoom" ? icoZoom : icoSelect,
34519
34751
  title: (
34520
34752
  /** @type {any} */
34521
- this.localeValues[z === "zoom" ? "selectionZoom" : "selection"]
34753
+ this.localeValues[z2 === "zoom" ? "selectionZoom" : "selection"]
34522
34754
  ),
34523
- class: `apexcharts-${z}-icon`
34755
+ class: `apexcharts-${z2}-icon`
34524
34756
  });
34525
34757
  }
34526
34758
  };
@@ -34599,7 +34831,14 @@ var __async = (__this, __arguments, generator) => {
34599
34831
  this.elMenuIcon.setAttribute("aria-haspopup", "true");
34600
34832
  this.elMenuIcon.setAttribute("aria-expanded", "false");
34601
34833
  }
34602
- this._createHamburgerMenu(elToolbarWrap);
34834
+ if (!resetOnly) this._createHamburgerMenu(elToolbarWrap);
34835
+ if (resetOnly) {
34836
+ (_a = this.elZoomReset) == null ? void 0 : _a.addEventListener(
34837
+ "click",
34838
+ this.handleZoomReset.bind(this)
34839
+ );
34840
+ return;
34841
+ }
34603
34842
  if (w.interact.zoomEnabled) {
34604
34843
  this.elZoom.classList.add(this.selectedClass);
34605
34844
  } else if (w.interact.panEnabled) {
@@ -34608,7 +34847,7 @@ var __async = (__this, __arguments, generator) => {
34608
34847
  this.elSelection.classList.add(this.selectedClass);
34609
34848
  } else if (w.interact.measureEnabled && this.elMeasure) {
34610
34849
  this.elMeasure.classList.add(this.selectedClass);
34611
- (_b = (_a = this.ctx.measure) == null ? void 0 : _a.startMeasure) == null ? void 0 : _b.call(_a);
34850
+ (_c = (_b = this.ctx.measure) == null ? void 0 : _b.startMeasure) == null ? void 0 : _c.call(_b);
34612
34851
  }
34613
34852
  this.addToolbarEventListeners();
34614
34853
  }
@@ -35014,9 +35253,28 @@ var __async = (__this, __arguments, generator) => {
35014
35253
  break;
35015
35254
  }
35016
35255
  }
35256
+ /**
35257
+ * Take down whatever the zoom alone put on screen.
35258
+ *
35259
+ * By hand, and not left to the next render, because of the order in
35260
+ * {@link Toolbar#handleZoomReset}: the re-render happens while
35261
+ * `interact.zoomed` is still true, so the control is drawn once more and then
35262
+ * the flag clears with no further pass to notice. Reversing that order would
35263
+ * change what every listener downstream of the update sees, which is a much
35264
+ * larger promise than this control is worth.
35265
+ */
35266
+ clearZoomAffordance() {
35267
+ const drawn = this._drawnForZoom;
35268
+ this._drawnForZoom = null;
35269
+ if (!drawn || !this.elZoomReset) return;
35270
+ const parent = this.elZoomReset.parentNode;
35271
+ const gone = drawn === "wrap" ? parent : this.elZoomReset;
35272
+ if (gone && gone.parentNode) gone.parentNode.removeChild(gone);
35273
+ }
35017
35274
  handleZoomReset() {
35018
35275
  const charts = this.ctx.getSyncedCharts();
35019
35276
  charts.forEach((ch) => {
35277
+ var _a;
35020
35278
  const w = ch.w;
35021
35279
  if (!w.interact.zoomed) return;
35022
35280
  w.globals.lastXAxis.min = w.globals.initialConfig.xaxis.min;
@@ -35042,6 +35300,7 @@ var __async = (__this, __arguments, generator) => {
35042
35300
  w.config.chart.animations.dynamicAnimation.enabled
35043
35301
  );
35044
35302
  w.interact.zoomed = false;
35303
+ (_a = ch.ctx.toolbar) == null ? void 0 : _a.clearZoomAffordance();
35045
35304
  });
35046
35305
  }
35047
35306
  destroy() {
@@ -35141,6 +35400,10 @@ var __async = (__this, __arguments, generator) => {
35141
35400
  passive: false
35142
35401
  });
35143
35402
  }
35403
+ this.hoverArea.addEventListener("keydown", me.escapeResetEvent.bind(me), {
35404
+ capture: false,
35405
+ passive: true
35406
+ });
35144
35407
  if (this._momentumEnabled()) {
35145
35408
  ["touchstart", "touchmove", "touchend", "touchcancel"].forEach(
35146
35409
  (event) => {
@@ -35273,12 +35536,16 @@ var __async = (__this, __arguments, generator) => {
35273
35536
  /**
35274
35537
  * A wheel or pinch zoom is an incidental gesture: the viewer can land in a
35275
35538
  * zoomed window without meaning to (a page scroll over the chart, a two-finger
35276
- * swipe), so it is only offered when there is a way back out of it. The only
35277
- * built-in way back is the toolbar's reset button, hence 'auto' (the default
35278
- * for both allowMouseWheelZoom and pinch) resolves against that button being
35279
- * present. A page that builds its own reset control sets the option to true
35280
- * and gets the gesture with no toolbar. Drag-to-zoom is deliberate, so it is
35281
- * not gated this way.
35539
+ * swipe), so it is only offered when there is a way back out of it. 'auto'
35540
+ * (the default for both allowMouseWheelZoom and pinch) resolves against a
35541
+ * reset button that is already on screen. A page that builds its own reset
35542
+ * control sets the option to true and gets the gesture with no toolbar.
35543
+ * Drag-to-zoom is deliberate, so it is not gated this way.
35544
+ *
35545
+ * `chart.zoom.resetControl` supplies a reset of its own once a chart IS
35546
+ * zoomed, and deliberately does NOT open this gate. It arrives after the
35547
+ * fact, and what an incidental wheel zoom takes from the viewer first is the
35548
+ * page scroll it swallowed, which no button hands back.
35282
35549
  *
35283
35550
  * @param {boolean|'auto'} setting
35284
35551
  */
@@ -35293,6 +35560,58 @@ var __async = (__this, __arguments, generator) => {
35293
35560
  const { zoom } = this.w.config.chart;
35294
35561
  return this._incidentalZoomEnabled(zoom && zoom.allowMouseWheelZoom);
35295
35562
  }
35563
+ /**
35564
+ * Put keyboard focus on the chart, where the chart is focusable at all.
35565
+ *
35566
+ * A drag is swallowed by the zoom handlers before the browser can move focus,
35567
+ * so a viewer who has just zoomed by hand leaves nothing focused, and every
35568
+ * key the chart offers is out of reach: Escape to reset (see
35569
+ * {@link ZoomPanSelection#escapeResetEvent}) and the +, - and 0 the keyboard
35570
+ * module already binds. Focusing what they just acted on puts those in reach.
35571
+ *
35572
+ * Pointer-driven focus, which keyboard navigation expects and does not read
35573
+ * as a request to start navigating, and which the stylesheet draws no ring
35574
+ * around (`svg:focus:not(:focus-visible)`).
35575
+ *
35576
+ * Only where the accessibility module has made the SVG focusable, which is
35577
+ * the default: a page that turned keyboard support off is not handed a tab
35578
+ * stop it never asked for, and still has the reset control as its way back.
35579
+ */
35580
+ _focusForKeyboard() {
35581
+ var _a, _b;
35582
+ const node = this.w.dom.Paper && this.w.dom.Paper.node;
35583
+ if (!node || typeof node.focus !== "function") return;
35584
+ if (node.getAttribute("tabindex") === null) return;
35585
+ (_b = (_a = this.ctx.keyboardNavigation) == null ? void 0 : _a.notePointerFocus) == null ? void 0 : _b.call(_a);
35586
+ try {
35587
+ node.focus({ preventScroll: true });
35588
+ } catch (e2) {
35589
+ node.focus();
35590
+ }
35591
+ }
35592
+ /**
35593
+ * Escape, on a zoomed chart, puts the range back.
35594
+ *
35595
+ * The quiet half of the same answer the on-demand reset control gives, and
35596
+ * gated on it, so a page that says it supplies its own way back gets neither.
35597
+ *
35598
+ * It defers to keyboard navigation, whose Escape dismisses the tooltip and
35599
+ * which offers `0` for this, so the key means one thing at a time. It does
35600
+ * not stop the event either, so a page listening for Escape still hears it.
35601
+ *
35602
+ * Reachable because a completed drag-zoom puts focus on the chart; see
35603
+ * {@link ZoomPanSelection#_focusForKeyboard}.
35604
+ *
35605
+ * @param {any} e
35606
+ */
35607
+ escapeResetEvent(e2) {
35608
+ if (e2.key !== "Escape" && e2.key !== "Esc") return;
35609
+ if (!this.w.interact.zoomed) return;
35610
+ const nav = this.ctx.keyboardNavigation;
35611
+ if (nav && nav.active) return;
35612
+ if (!this.resetControlAllowed()) return;
35613
+ this.handleZoomReset();
35614
+ }
35296
35615
  /** Lazily-created, re-render-surviving wheel-gesture state. */
35297
35616
  _wheel() {
35298
35617
  const it = this.w.interact;
@@ -35775,11 +36094,16 @@ var __async = (__this, __arguments, generator) => {
35775
36094
  if (!w.config.chart.group) {
35776
36095
  options2.yaxis = yaxis;
35777
36096
  }
35778
- me.ctx.updateHelpers._updateOptions(
36097
+ const applied = me.ctx.updateHelpers._updateOptions(
35779
36098
  options2,
35780
36099
  false,
35781
36100
  me.w.config.chart.animations.dynamicAnimation.enabled
35782
36101
  );
36102
+ if (applied && typeof applied.then === "function") {
36103
+ applied.then(() => me._focusForKeyboard());
36104
+ } else {
36105
+ me._focusForKeyboard();
36106
+ }
35783
36107
  if (typeof w.config.chart.events.zoomed === "function") {
35784
36108
  toolbar.zoomCallback(xaxis, yaxis);
35785
36109
  }
@@ -37532,6 +37856,19 @@ var __async = (__this, __arguments, generator) => {
37532
37856
  _onPointerDown() {
37533
37857
  this._lastPointerDownAt = Date.now();
37534
37858
  }
37859
+ /**
37860
+ * Note that a pointer gesture is about to move focus into the chart.
37861
+ *
37862
+ * The 100 ms window above catches the browser's own click-to-focus, which
37863
+ * lands immediately. A drag-zoom moves focus deliberately, and only once its
37864
+ * re-render is done (ZoomPanSelection#_focusForKeyboard), which is far
37865
+ * outside that window. Without this it reads as a viewer asking to navigate
37866
+ * by keyboard, which activates nav and flashes a tooltip at the first visible
37867
+ * point after every zoom.
37868
+ */
37869
+ notePointerFocus() {
37870
+ this._lastPointerDownAt = Date.now();
37871
+ }
37535
37872
  /**
37536
37873
  * Called from Events.js keydown handler. Navigation keys are already handled
37537
37874
  * by the direct SVG listener (which can call preventDefault). This entry
@@ -41076,7 +41413,97 @@ var __async = (__this, __arguments, generator) => {
41076
41413
  }
41077
41414
  }
41078
41415
  ApexCharts.registerFeatures({ drilldown: Drilldown });
41079
- const WEAVE_API_VERSION = 4;
41416
+ const ANNOTATION_TYPES = ["xaxis", "yaxis", "points", "texts", "images"];
41417
+ function seriesVisible(w, index) {
41418
+ const gl = w.globals;
41419
+ return (gl.collapsedSeriesIndices || []).indexOf(index) < 0 && (gl.ancillaryCollapsedSeriesIndices || []).indexOf(index) < 0;
41420
+ }
41421
+ function seriesItems(w, host) {
41422
+ const derived = host && host._derived;
41423
+ const ownerOf = (name2) => {
41424
+ if (!derived) return "core";
41425
+ for (const [plugin, names] of derived) {
41426
+ if (names.indexOf(name2) > -1) return plugin;
41427
+ }
41428
+ return "core";
41429
+ };
41430
+ return (w.config.series || []).map((s2, i2) => {
41431
+ const label = s2 && s2.name ? String(s2.name) : `Series ${i2 + 1}`;
41432
+ return {
41433
+ id: `series:${i2}`,
41434
+ kind: (
41435
+ /** @type {const} */
41436
+ "series"
41437
+ ),
41438
+ label,
41439
+ owner: ownerOf(label),
41440
+ visible: seriesVisible(w, i2)
41441
+ };
41442
+ });
41443
+ }
41444
+ function annotationItems(w) {
41445
+ const config = w.config.annotations || {};
41446
+ const out = [];
41447
+ for (const type of ANNOTATION_TYPES) {
41448
+ const list = Array.isArray(config[type]) ? config[type] : [];
41449
+ list.forEach((anno, i2) => {
41450
+ if (!anno) return;
41451
+ out.push({
41452
+ // An annotation carries an id only when someone gave it one, so the
41453
+ // synthesised form is what most config-declared annotations get. It is
41454
+ // stable for as long as the list is, which is what a reader needs.
41455
+ id: anno.id ? String(anno.id) : `annotation:${type}:${i2}`,
41456
+ kind: (
41457
+ /** @type {const} */
41458
+ "annotation"
41459
+ ),
41460
+ label: labelOfAnnotation(anno, type, i2),
41461
+ owner: anno.owner ? String(anno.owner) : "core",
41462
+ // An annotation is drawn whenever it is in the config: there is no
41463
+ // hidden state for one, unlike a series.
41464
+ visible: true
41465
+ });
41466
+ });
41467
+ }
41468
+ return out;
41469
+ }
41470
+ function labelOfAnnotation(anno, type, i2) {
41471
+ const text = anno.label && anno.label.text;
41472
+ if (text) return String(text);
41473
+ if (anno.text) return String(anno.text);
41474
+ if (anno.id) return String(anno.id);
41475
+ return `${type} annotation ${i2 + 1}`;
41476
+ }
41477
+ function collectDrawn(w, host) {
41478
+ const declared = [];
41479
+ if (host && host._declared) {
41480
+ for (const [plugin, items] of host._declared) {
41481
+ for (const item of items) {
41482
+ declared.push({
41483
+ id: `overlay:${plugin}:${item.id}`,
41484
+ kind: (
41485
+ /** @type {const} */
41486
+ "overlay"
41487
+ ),
41488
+ label: item.label,
41489
+ owner: plugin,
41490
+ visible: item.visible !== false
41491
+ });
41492
+ }
41493
+ }
41494
+ }
41495
+ return [...seriesItems(w, host), ...annotationItems(w), ...declared];
41496
+ }
41497
+ const WEAVE_API_VERSION = 6;
41498
+ const WEAVE_CAPABILITIES = Object.freeze([
41499
+ "layer",
41500
+ "derived",
41501
+ "reserve",
41502
+ "pointer",
41503
+ "stroke-info",
41504
+ "claim",
41505
+ "drawn"
41506
+ ]);
41080
41507
  const PLUGIN_CHART_METHODS = [
41081
41508
  "updateOptions",
41082
41509
  "updateSeries",
@@ -41307,7 +41734,30 @@ var __async = (__this, __arguments, generator) => {
41307
41734
  enabledOnSeries: Array.isArray(
41308
41735
  w.config.dataLabels && w.config.dataLabels.enabledOnSeries
41309
41736
  ) ? w.config.dataLabels.enabledOnSeries.slice() : null
41310
- })
41737
+ }),
41738
+ // The caller's own dashing, reported for the same reason and against
41739
+ // the same trap (v5). `stroke.dashArray` is indexed by series position
41740
+ // with no per-series escape hatch, so a plugin that wants ITS OWN
41741
+ // computed series dashed has to write the whole array, and writing one
41742
+ // without knowing what was there discards the caller's dashed lines
41743
+ // with nothing to restore them from.
41744
+ //
41745
+ // A scalar applies to every series and an array is per series. There is
41746
+ // no "unset" to report: the option defaults to 0, and 0 already means
41747
+ // no dashing, so restoring it restores exactly what was there.
41748
+ stroke: Object.freeze({
41749
+ dashArray: Array.isArray(w.config.stroke && w.config.stroke.dashArray) ? w.config.stroke.dashArray.slice() : w.config.stroke && w.config.stroke.dashArray || 0
41750
+ }),
41751
+ // What the chart calls itself, where the caller titled it (v6).
41752
+ //
41753
+ // For a plugin that has to NAME this chart to somebody: a page-level
41754
+ // readout listing several charts otherwise has only the container's id
41755
+ // to head each row with, which is a string written for a stylesheet.
41756
+ // The title is the name the page already chose and put on screen.
41757
+ //
41758
+ // Empty string rather than undefined for an untitled chart, so a
41759
+ // caller can use it directly in a template; falsy either way.
41760
+ title: String(w.config.title && w.config.title.text || "")
41311
41761
  });
41312
41762
  },
41313
41763
  // Display labels per x position (v2).
@@ -41374,6 +41824,85 @@ var __async = (__this, __arguments, generator) => {
41374
41824
  host._reserve(record.def.name, box);
41375
41825
  return api;
41376
41826
  },
41827
+ /**
41828
+ * Set a positional option for your own series, without writing the
41829
+ * caller's config.
41830
+ *
41831
+ * Some options are indexed by series position with no per-series escape
41832
+ * hatch, so setting one for a single series has always meant writing the
41833
+ * array that covers all of them, then putting the caller's value back. A
41834
+ * claim says what this plugin wants instead, and the host answers with it
41835
+ * where the option is READ. Nothing is written, so releasing is a deletion
41836
+ * rather than a restore, and a caller's own `updateOptions` composes with
41837
+ * the claim instead of being reverted by it.
41838
+ *
41839
+ * const claim = api.claim('stroke.dashArray', [
41840
+ * { series: 'Revenue (forecast)', value: 6 },
41841
+ * ])
41842
+ * claim.release()
41843
+ *
41844
+ * Name the series rather than its position where you can: a name is
41845
+ * resolved each time the option is read, so the claim follows the series
41846
+ * through the caller adding, removing or reordering others.
41847
+ *
41848
+ * Claimable options are an allowlist (see `CLAIMABLE`). An option that is
41849
+ * not on it returns null rather than throwing, so a plugin written against
41850
+ * a newer host degrades. Every claim is released on teardown, on destroy,
41851
+ * and if the host disables this plugin after repeated failures.
41852
+ *
41853
+ * @param {string} option
41854
+ * @param {Array<{series: string|number, value: any}>} entries
41855
+ * @returns {{release: () => void, update: (entries: Array<{series: string|number, value: any}>) => void}|null}
41856
+ * @since Weave v6
41857
+ */
41858
+ claim(option, entries) {
41859
+ const claim = addClaim(w, record.def.name, option, entries);
41860
+ if (!claim) return null;
41861
+ return Object.freeze({
41862
+ release() {
41863
+ releaseClaim(w, claim);
41864
+ },
41865
+ update(next) {
41866
+ claim.entries = normaliseEntries(option, next);
41867
+ }
41868
+ });
41869
+ },
41870
+ /**
41871
+ * Everything drawn on this chart, including what other features drew.
41872
+ *
41873
+ * The chart's series, the caller's annotations (ink strokes among them,
41874
+ * since an ink stroke is an annotation), and whatever plugins have
41875
+ * declared. Each entry names its `owner`, because the list is only as
41876
+ * complete as the features that opted into it: a reader can say what it
41877
+ * covers instead of assuming it is everything.
41878
+ *
41879
+ * Read only. Removing or hiding another feature's output is a much larger
41880
+ * promise than this platform makes, and is deliberately not here.
41881
+ *
41882
+ * Rebuilt per call: it is a projection of live state, and a remembered
41883
+ * inventory is a list of what WAS drawn.
41884
+ *
41885
+ * @returns {ReadonlyArray<{id: string, kind: 'series'|'annotation'|'overlay', label: string, owner: string, visible: boolean}>}
41886
+ * @since Weave v6
41887
+ */
41888
+ drawn() {
41889
+ return Object.freeze(collectDrawn(w, host).map((i2) => Object.freeze(i2)));
41890
+ },
41891
+ /**
41892
+ * Say what this plugin has drawn, so it appears in `api.drawn()`.
41893
+ *
41894
+ * Declare from your draw handler, on the same terms as the drawing itself:
41895
+ * declarations are cleared with the layers at the start of every draw, so
41896
+ * an inventory cannot outlive what it describes. Declaring the same id
41897
+ * twice replaces it rather than adding a second row.
41898
+ *
41899
+ * @param {{id: string, label?: string, visible?: boolean}} item
41900
+ * @since Weave v6
41901
+ */
41902
+ declare(item) {
41903
+ host._declare(record.def.name, item);
41904
+ return api;
41905
+ },
41377
41906
  /**
41378
41907
  * Subscribe to the data point a viewer is pointing at.
41379
41908
  *
@@ -41397,7 +41926,12 @@ var __async = (__this, __arguments, generator) => {
41397
41926
  * and a handler that throws is contained rather than allowed to break the
41398
41927
  * interaction it was watching.
41399
41928
  *
41400
- * @param {(e: {type: 'enter'|'leave'|'select', seriesIndex: number, dataPointIndex: number, category: string|undefined, seriesName: string|undefined, selected: boolean|undefined}) => void} fn
41929
+ * `modifiers` (v6) reports the keys held during the interaction, for the
41930
+ * gestures that need them: shift-click to add to a selection is the one
41931
+ * page-level coordination wants. All four are false when the interaction
41932
+ * came from somewhere with no DOM event, such as the keyboard.
41933
+ *
41934
+ * @param {(e: {type: 'enter'|'leave'|'select', seriesIndex: number, dataPointIndex: number, category: string|undefined, seriesName: string|undefined, selected: boolean|undefined, modifiers: {shift: boolean, ctrl: boolean, alt: boolean, meta: boolean}}) => void} fn
41401
41935
  * @returns {() => void} unsubscribe
41402
41936
  * @since Weave v4
41403
41937
  */
@@ -41422,8 +41956,29 @@ var __async = (__this, __arguments, generator) => {
41422
41956
  return w.dom.baseEl;
41423
41957
  }
41424
41958
  };
41959
+ const probes = (
41960
+ /** @type {Record<string, (a: any) => boolean>} */
41961
+ WIRED
41962
+ );
41963
+ const granted = WEAVE_CAPABILITIES.filter((name2) => probes[name2](api));
41964
+ const grantedSet = new Set(granted);
41965
+ const extras = (
41966
+ /** @type {any} */
41967
+ api
41968
+ );
41969
+ extras.capabilities = Object.freeze(granted);
41970
+ extras.can = (name2) => grantedSet.has(name2);
41425
41971
  return Object.freeze(api);
41426
41972
  }
41973
+ const WIRED = {
41974
+ layer: (a2) => typeof a2.layer === "function",
41975
+ derived: (a2) => typeof a2.markDerived === "function",
41976
+ reserve: (a2) => typeof a2.reserve === "function",
41977
+ pointer: (a2) => typeof a2.pointer === "function",
41978
+ "stroke-info": (a2) => !!(a2.info && a2.info.stroke),
41979
+ claim: (a2) => typeof a2.claim === "function",
41980
+ drawn: (a2) => typeof a2.drawn === "function" && typeof a2.declare === "function"
41981
+ };
41427
41982
  const _WeaveHost = class _WeaveHost {
41428
41983
  /**
41429
41984
  * @param {import('../../types/internal').ChartStateW} w
@@ -41442,6 +41997,7 @@ var __async = (__this, __arguments, generator) => {
41442
41997
  this._reserved = null;
41443
41998
  this._reserveTimer = null;
41444
41999
  this._pointerSubs = null;
42000
+ this._declared = null;
41445
42001
  this._pointerWired = null;
41446
42002
  this._onUpdated = this._onUpdated.bind(this);
41447
42003
  this._init();
@@ -41547,6 +42103,7 @@ var __async = (__this, __arguments, generator) => {
41547
42103
  record.failures = (record.failures || 0) + 1;
41548
42104
  if (record.failures >= 3) {
41549
42105
  record.disabled = true;
42106
+ releaseOwner(this.w, record.def.name);
41550
42107
  console.error(
41551
42108
  `[apexcharts] plugin "${record.def.name}" disabled after repeated errors.`
41552
42109
  );
@@ -41570,7 +42127,7 @@ var __async = (__this, __arguments, generator) => {
41570
42127
  _setScales(xyRatios) {
41571
42128
  const w = this.w;
41572
42129
  const gl = w.globals;
41573
- const L2 = w.layout;
42130
+ const L = w.layout;
41574
42131
  if (!xyRatios || !gl.axisCharts) {
41575
42132
  this._currentScales = null;
41576
42133
  return;
@@ -41581,7 +42138,7 @@ var __async = (__this, __arguments, generator) => {
41581
42138
  const maxY = (axis) => gl.maxYArr[axis] != null ? gl.maxYArr[axis] : gl.maxY;
41582
42139
  const minY = (axis) => gl.minYArr[axis] != null ? gl.minYArr[axis] : gl.minY;
41583
42140
  const banded = !w.axisFlags.isXNumeric && !gl.isBarHorizontal && gl.dataPoints > 0;
41584
- const band = banded ? L2.gridWidth / gl.dataPoints : 0;
42141
+ const band = banded ? L.gridWidth / gl.dataPoints : 0;
41585
42142
  this._currentScales = {
41586
42143
  x: banded ? (v) => band * (v + 0.5) : (v) => (v - gl.minX) / xRatio,
41587
42144
  /**
@@ -41592,8 +42149,8 @@ var __async = (__this, __arguments, generator) => {
41592
42149
  domainX: banded ? [-0.5, gl.dataPoints - 0.5] : [gl.minX, gl.maxX],
41593
42150
  /** @param {number} [axis] */
41594
42151
  domainY: (axis = 0) => [minY(axis), maxY(axis)],
41595
- gridWidth: L2.gridWidth,
41596
- gridHeight: L2.gridHeight,
42152
+ gridWidth: L.gridWidth,
42153
+ gridHeight: L.gridHeight,
41597
42154
  ratios: xyRatios
41598
42155
  };
41599
42156
  }
@@ -41726,8 +42283,8 @@ var __async = (__this, __arguments, generator) => {
41726
42283
  ];
41727
42284
  this._pointerWired = [];
41728
42285
  for (const [type, name2] of map) {
41729
- const handler = (_e, _ctx, opts) => {
41730
- this._emitPointer(type, opts);
42286
+ const handler = (e2, _ctx, opts) => {
42287
+ this._emitPointer(type, opts, e2);
41731
42288
  };
41732
42289
  this.ctx.addEventListener(name2, handler);
41733
42290
  this._pointerWired.push([name2, handler]);
@@ -41743,8 +42300,9 @@ var __async = (__this, __arguments, generator) => {
41743
42300
  *
41744
42301
  * @param {'enter'|'leave'|'select'} type
41745
42302
  * @param {any} opts
42303
+ * @param {any} [e] the DOM event, where the interaction came from one
41746
42304
  */
41747
- _emitPointer(type, opts) {
42305
+ _emitPointer(type, opts, e2) {
41748
42306
  if (!this._pointerSubs || !this._pointerSubs.size) return;
41749
42307
  const seriesIndex = opts && typeof opts.seriesIndex === "number" ? opts.seriesIndex : -1;
41750
42308
  const dataPointIndex = opts && typeof opts.dataPointIndex === "number" ? opts.dataPointIndex : -1;
@@ -41762,16 +42320,24 @@ var __async = (__this, __arguments, generator) => {
41762
42320
  // Only meaningful on a select: the chart hands back its whole selection
41763
42321
  // set, and what a plugin wants to know is whether THIS point is now in
41764
42322
  // it, so a second click reads as a deselect rather than another select.
41765
- selected: type === "select" ? _WeaveHost._isSelected(opts, seriesIndex, dataPointIndex) : void 0
42323
+ selected: type === "select" ? _WeaveHost._isSelected(opts, seriesIndex, dataPointIndex) : void 0,
42324
+ // The modifier keys held during the interaction (v6), for the gestures
42325
+ // that need them: shift-click to add to a selection is the one page mode
42326
+ // wants, and a plugin cannot invent it from anything else here.
42327
+ //
42328
+ // All false when the interaction came from somewhere with no DOM event
42329
+ // (the keyboard, a programmatic selection), which is the honest answer:
42330
+ // no key was held.
42331
+ modifiers: _WeaveHost._modifiers(e2)
41766
42332
  };
41767
42333
  for (const [name2, handlers] of this._pointerSubs) {
41768
42334
  for (const fn of handlers.slice()) {
41769
42335
  try {
41770
42336
  fn(payload);
41771
- } catch (e2) {
42337
+ } catch (e3) {
41772
42338
  console.warn(
41773
42339
  '[apexcharts] plugin "' + name2 + '" threw in a pointer handler',
41774
- e2
42340
+ e3
41775
42341
  );
41776
42342
  }
41777
42343
  }
@@ -41811,6 +42377,23 @@ var __async = (__this, __arguments, generator) => {
41811
42377
  if (!Array.isArray(mine)) return false;
41812
42378
  return mine.indexOf(dataPointIndex) > -1;
41813
42379
  }
42380
+ /**
42381
+ * Which modifier keys were held, read off the DOM event.
42382
+ *
42383
+ * Always the same four booleans, never undefined and never a partial object:
42384
+ * a plugin writes `if (e.modifiers.shift)` without a guard, and a shape that
42385
+ * sometimes lacks a key is how that becomes a crash inside a viewer's click.
42386
+ *
42387
+ * @param {any} e
42388
+ */
42389
+ static _modifiers(e2) {
42390
+ return Object.freeze({
42391
+ shift: !!(e2 && e2.shiftKey),
42392
+ ctrl: !!(e2 && e2.ctrlKey),
42393
+ alt: !!(e2 && e2.altKey),
42394
+ meta: !!(e2 && e2.metaKey)
42395
+ });
42396
+ }
41814
42397
  /**
41815
42398
  * Record a plugin's container reservation and re-render if it changed.
41816
42399
  *
@@ -41958,14 +42541,14 @@ var __async = (__this, __arguments, generator) => {
41958
42541
  * @param {string} name
41959
42542
  * @param {{ z?: 'front'|'behind', className?: string }} opts
41960
42543
  */
41961
- _layer(name2, { z = "front", className = "" } = {}) {
42544
+ _layer(name2, { z: z2 = "front", className = "" } = {}) {
41962
42545
  let g = this._layers.get(name2);
41963
42546
  if (!g) {
41964
42547
  g = this.ctx.graphics.group({
41965
42548
  class: `apexcharts-plugin-${name2} ${className}`.trim()
41966
42549
  });
41967
42550
  const parent = this.w.dom.elGraphical.node;
41968
- if (z === "behind") parent.insertBefore(g.node, parent.firstChild);
42551
+ if (z2 === "behind") parent.insertBefore(g.node, parent.firstChild);
41969
42552
  else parent.appendChild(g.node);
41970
42553
  g.node.setAttribute("aria-hidden", "true");
41971
42554
  this._layers.set(name2, g);
@@ -41985,6 +42568,35 @@ var __async = (__this, __arguments, generator) => {
41985
42568
  Array.prototype.forEach.call(groups, (n2) => n2.remove());
41986
42569
  }
41987
42570
  this._layers.clear();
42571
+ this._declared = null;
42572
+ }
42573
+ /**
42574
+ * Record one thing a plugin has drawn, for `api.drawn()`.
42575
+ *
42576
+ * Replaced by id rather than appended, so a plugin declaring the same overlay
42577
+ * on every draw (which is the pattern this expects) produces one entry.
42578
+ *
42579
+ * @param {string} name plugin
42580
+ * @param {{id: string, label?: string, visible?: boolean}} item
42581
+ */
42582
+ _declare(name2, item) {
42583
+ if (!item || typeof item.id !== "string" || !item.id) {
42584
+ console.warn(
42585
+ `[apexcharts] plugin "${name2}" declared something with no id; ignored.`
42586
+ );
42587
+ return;
42588
+ }
42589
+ if (!this._declared) this._declared = /* @__PURE__ */ new Map();
42590
+ const mine = this._declared.get(name2) || [];
42591
+ const entry = {
42592
+ id: item.id,
42593
+ label: item.label ? String(item.label) : item.id,
42594
+ visible: item.visible !== false
42595
+ };
42596
+ const at = mine.findIndex((d) => d.id === entry.id);
42597
+ if (at > -1) mine[at] = entry;
42598
+ else mine.push(entry);
42599
+ this._declared.set(name2, mine);
41988
42600
  }
41989
42601
  // ─── Config-change reconciliation ───────────────────────────────────────
41990
42602
  /**
@@ -42032,10 +42644,12 @@ var __async = (__this, __arguments, generator) => {
42032
42644
  for (const record of this.active) {
42033
42645
  this._guard(record, "destroy", () => record.def.destroy && record.def.destroy(record.api));
42034
42646
  }
42647
+ for (const record of this.active) releaseOwner(this.w, record.def.name);
42035
42648
  this.active = [];
42036
42649
  this._derived = null;
42037
42650
  this._reserved = null;
42038
42651
  this._pointerSubs = null;
42652
+ this._declared = null;
42039
42653
  if (this._pointerWired) {
42040
42654
  for (const [name2, handler] of this._pointerWired) {
42041
42655
  this.ctx.removeEventListener && this.ctx.removeEventListener(name2, handler);
@@ -42609,8 +43223,8 @@ var __async = (__this, __arguments, generator) => {
42609
43223
  const x = lo + g * step;
42610
43224
  let sum = 0;
42611
43225
  for (let i2 = 0; i2 < n2; i2++) {
42612
- const z = (x - sorted[i2]) / h;
42613
- sum += Math.exp(-0.5 * z * z);
43226
+ const z2 = (x - sorted[i2]) / h;
43227
+ sum += Math.exp(-0.5 * z2 * z2);
42614
43228
  }
42615
43229
  density.push([x, sum * norm]);
42616
43230
  }
@@ -43268,7 +43882,7 @@ var __async = (__this, __arguments, generator) => {
43268
43882
  values,
43269
43883
  order,
43270
43884
  carrier: visible.length ? visible[0] : 0,
43271
- hidden: raw.map((_, k) => k).filter((k) => collapsed.indexOf(k) !== -1)
43885
+ hidden: raw.map((_2, k) => k).filter((k) => collapsed.indexOf(k) !== -1)
43272
43886
  };
43273
43887
  const carrier = w.dumbbellData.carrier;
43274
43888
  return raw.map((s2, k) => __spreadProps(__spreadValues({}, s2), {
@@ -44073,7 +44687,7 @@ var __async = (__this, __arguments, generator) => {
44073
44687
  highs,
44074
44688
  order: bandOrder,
44075
44689
  offset,
44076
- hidden: raw.map((_, k) => k).filter((k) => collapsed.indexOf(k) !== -1)
44690
+ hidden: raw.map((_2, k) => k).filter((k) => collapsed.indexOf(k) !== -1)
44077
44691
  };
44078
44692
  return raw.map((s2, k) => {
44079
44693
  const lo = lows[k];
@@ -44822,7 +45436,7 @@ var __async = (__this, __arguments, generator) => {
44822
45436
  /**
44823
45437
  * @param {any} _
44824
45438
  */
44825
- brArr.map((_) => "none")
45439
+ brArr.map((_2) => "none")
44826
45440
  )
44827
45441
  );
44828
45442
  }
@@ -45163,7 +45777,7 @@ var __async = (__this, __arguments, generator) => {
45163
45777
  ) : null;
45164
45778
  const isBar = (i2) => !barIndices || barIndices.has(i2);
45165
45779
  if (!groups || groups.length < 2) {
45166
- const bucket = Array.from({ length: numSeries }, (_, i2) => i2).filter(isBar);
45780
+ const bucket = Array.from({ length: numSeries }, (_2, i2) => i2).filter(isBar);
45167
45781
  return bucket.length ? [bucket] : [];
45168
45782
  }
45169
45783
  const buckets = Array.from({ length: groups.length }, () => []);
@@ -45194,6 +45808,14 @@ var __async = (__this, __arguments, generator) => {
45194
45808
  * second at the top, and nothing else touched. Stacked totals already resolve
45195
45809
  * per group (see drawsStackedTotal, #4173); corners never got the same fix.
45196
45810
  *
45811
+ * plotOptions.bar.borderRadiusWhenStacked picks which ends round: 'all'
45812
+ * caps both the baseline and the far end, 'last' only the far end (#4845).
45813
+ *
45814
+ * A single-data-point chart used to hand its baseline segment 'top' (and a
45815
+ * solo segment 'top' instead of 'both'), which on a horizontal stack rounded
45816
+ * the first segment on its INNER edge and left a pill in the middle of the
45817
+ * bar (#4845). One data point is resolved like any other now.
45818
+ *
45197
45819
  * @param {any[]} series
45198
45820
  * @returns {string[][]}
45199
45821
  */
@@ -45208,9 +45830,11 @@ var __async = (__this, __arguments, generator) => {
45208
45830
  () => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
45209
45831
  );
45210
45832
  if (alwaysApplyRadius) return output;
45211
- const isSoloHorizontal = this.w.config.chart.type === "bar" && numColumns === 1;
45212
- const soloCorner = isSoloHorizontal ? "top" : "both";
45213
- const baseCorner = isSoloHorizontal ? "top" : "bottom";
45833
+ const lastOnly = w.config.plotOptions.bar.borderRadiusWhenStacked === "last";
45834
+ const soloPositive = lastOnly ? "top" : "both";
45835
+ const soloNegative = lastOnly ? "bottom" : "both";
45836
+ const positiveBase = lastOnly ? "none" : "bottom";
45837
+ const negativeBase = lastOnly ? "none" : "top";
45214
45838
  for (const stack of this.getStackedSeriesIndices(numSeries)) {
45215
45839
  for (let j2 = 0; j2 < numColumns; j2++) {
45216
45840
  const positiveIndices = [];
@@ -45222,22 +45846,22 @@ var __async = (__this, __arguments, generator) => {
45222
45846
  }
45223
45847
  if (positiveIndices.length > 0 && negativeIndices.length === 0) {
45224
45848
  if (positiveIndices.length === 1) {
45225
- output[positiveIndices[0]][j2] = soloCorner;
45849
+ output[positiveIndices[0]][j2] = soloPositive;
45226
45850
  } else {
45227
45851
  const first = positiveIndices[0];
45228
45852
  const last = positiveIndices[positiveIndices.length - 1];
45229
45853
  for (const i2 of positiveIndices) {
45230
- output[i2][j2] = i2 === first ? baseCorner : i2 === last ? "top" : "none";
45854
+ output[i2][j2] = i2 === first ? positiveBase : i2 === last ? "top" : "none";
45231
45855
  }
45232
45856
  }
45233
45857
  } else if (negativeIndices.length > 0 && positiveIndices.length === 0) {
45234
45858
  if (negativeIndices.length === 1) {
45235
- output[negativeIndices[0]][j2] = "both";
45859
+ output[negativeIndices[0]][j2] = soloNegative;
45236
45860
  } else {
45237
- const highest = Math.max(...negativeIndices);
45238
- const lowest = Math.min(...negativeIndices);
45861
+ const nearest = Math.min(...negativeIndices);
45862
+ const farthest = Math.max(...negativeIndices);
45239
45863
  for (const i2 of negativeIndices) {
45240
- output[i2][j2] = i2 === highest ? "bottom" : i2 === lowest ? "top" : "none";
45864
+ output[i2][j2] = i2 === nearest ? negativeBase : i2 === farthest ? "bottom" : "none";
45241
45865
  }
45242
45866
  }
45243
45867
  } else if (positiveIndices.length > 0 && negativeIndices.length > 0) {
@@ -45873,7 +46497,7 @@ var __async = (__this, __arguments, generator) => {
45873
46497
  const w = this.w;
45874
46498
  let nonZeroColumns = 0;
45875
46499
  let zeroEncounters = 0;
45876
- const seriesIndices = w.config.plotOptions.bar.horizontal ? w.seriesData.series.map((_, _i) => _i) : ((_a = w.globals.columnSeries) == null ? void 0 : _a.i.map((_i) => _i)) || [];
46500
+ const seriesIndices = w.config.plotOptions.bar.horizontal ? w.seriesData.series.map((_2, _i) => _i) : ((_a = w.globals.columnSeries) == null ? void 0 : _a.i.map((_i) => _i)) || [];
45877
46501
  seriesIndices.forEach((_si) => {
45878
46502
  const val = w.globals.seriesPercent[_si][j2];
45879
46503
  if (val) {
@@ -46960,7 +47584,7 @@ var __async = (__this, __arguments, generator) => {
46960
47584
  series = w.globals.comboCharts ? (
46961
47585
  /** @type {any} */
46962
47586
  seriesIndex.map(
46963
- (_) => w.globals.seriesPercent[_]
47587
+ (_2) => w.globals.seriesPercent[_2]
46964
47588
  )
46965
47589
  ) : w.globals.seriesPercent.slice();
46966
47590
  }
@@ -47759,17 +48383,17 @@ var __async = (__this, __arguments, generator) => {
47759
48383
  if (this.isHorizontal) {
47760
48384
  const yRatio = this.invertedYRatio;
47761
48385
  const bh = barHeight != null ? barHeight : 0;
47762
- const z = zeroW != null ? zeroW : 0;
48386
+ const z2 = zeroW != null ? zeroW : 0;
47763
48387
  center = paths.barYPosition + bh / 2;
47764
48388
  halfExtent = bh / 2;
47765
- alongFn = (v) => z + logVal(v) / yRatio;
48389
+ alongFn = (v) => z2 + logVal(v) / yRatio;
47766
48390
  } else {
47767
48391
  const yRatio = this.yRatio[translationsIndex];
47768
48392
  const bw = barWidth != null ? barWidth : 0;
47769
- const z = zeroH != null ? zeroH : 0;
48393
+ const z2 = zeroH != null ? zeroH : 0;
47770
48394
  center = paths.barXPosition + bw / 2;
47771
48395
  halfExtent = bw / 2;
47772
- alongFn = (v) => z - logVal(v) / yRatio;
48396
+ alongFn = (v) => z2 - logVal(v) / yRatio;
47773
48397
  }
47774
48398
  const groups = buildJitterGroups({
47775
48399
  w,
@@ -48503,7 +49127,7 @@ var __async = (__this, __arguments, generator) => {
48503
49127
  return { nodes: [], maxWeight: 0 };
48504
49128
  }
48505
49129
  const order = d.values.map(
48506
- (_, k) => k
49130
+ (_2, k) => k
48507
49131
  );
48508
49132
  order.sort(
48509
49133
  (a2, b) => d.values[a2] - d.values[b]
@@ -50466,15 +51090,15 @@ var __async = (__this, __arguments, generator) => {
50466
51090
  case "monotoneCubic": {
50467
51091
  const yAj = isRangeStart ? yArrj : y2Arrj;
50468
51092
  const getSmoothInputs = (xArr, yArr) => {
50469
- return xArr.map((_, i3) => {
50470
- return [_, yArr[i3]];
50471
- }).filter((_) => _[1] !== null);
51093
+ return xArr.map((_2, i3) => {
51094
+ return [_2, yArr[i3]];
51095
+ }).filter((_2) => _2[1] !== null);
50472
51096
  };
50473
51097
  const getSegmentLengths = (yArr) => {
50474
51098
  const segLens = [];
50475
51099
  let count = 0;
50476
- yArr.forEach((_) => {
50477
- if (_ !== null) {
51100
+ yArr.forEach((_2) => {
51101
+ if (_2 !== null) {
50478
51102
  count++;
50479
51103
  } else if (count > 0) {
50480
51104
  segLens.push(count);
@@ -50521,11 +51145,11 @@ var __async = (__this, __arguments, generator) => {
50521
51145
  }
50522
51146
  let segmentCount = 0;
50523
51147
  let smoothInputsIndex = 0;
50524
- getSegments(_yAj, points).forEach((_) => {
51148
+ getSegments(_yAj, points).forEach((_2) => {
50525
51149
  segmentCount++;
50526
- const svgPoints = svgPath(_);
51150
+ const svgPoints = svgPath(_2);
50527
51151
  const _start = smoothInputsIndex;
50528
- smoothInputsIndex += _.length;
51152
+ smoothInputsIndex += _2.length;
50529
51153
  const _end = smoothInputsIndex - 1;
50530
51154
  if (isLowerRangeAreaPath) {
50531
51155
  linePath = graphics.move(
@@ -51008,13 +51632,13 @@ var __async = (__this, __arguments, generator) => {
51008
51632
  function sharpDonutSegmentPath({ cx, cy, rIn, rOut, a0, a1, spanDeg }) {
51009
51633
  const ptAt = (radius, deg) => arcPoint(cx, cy, radius, deg);
51010
51634
  const largeArc = spanDeg > 180 ? 1 : 0;
51011
- const A2 = ptAt(rOut, a0);
51635
+ const A = ptAt(rOut, a0);
51012
51636
  const B = ptAt(rOut, a1);
51013
- const C = ptAt(rIn, a1);
51637
+ const C2 = ptAt(rIn, a1);
51014
51638
  const Din = ptAt(rIn, a0);
51015
51639
  return [
51016
51640
  "M",
51017
- xy(A2),
51641
+ xy(A),
51018
51642
  "A",
51019
51643
  rOut,
51020
51644
  rOut,
@@ -51023,7 +51647,7 @@ var __async = (__this, __arguments, generator) => {
51023
51647
  1,
51024
51648
  xy(B),
51025
51649
  "L",
51026
- xy(C),
51650
+ xy(C2),
51027
51651
  "A",
51028
51652
  rIn,
51029
51653
  rIn,
@@ -51143,7 +51767,7 @@ var __async = (__this, __arguments, generator) => {
51143
51767
  const w = this.w;
51144
51768
  const helpers = new CircularChartsHelpers(w);
51145
51769
  const lineSets = (w.seriesData.seriesNames || []).map(
51146
- (_, i2) => this.getExternalLabelLines(i2)
51770
+ (_2, i2) => this.getExternalLabelLines(i2)
51147
51771
  );
51148
51772
  const maxLabelWidth = helpers.getMaxLabelWidth(lineSets.flat(), {
51149
51773
  fontSize: this.externalLabelStyle.fontSize,
@@ -53127,7 +53751,12 @@ var __async = (__this, __arguments, generator) => {
53127
53751
  prevEndAngle = prevEndAngle - 0.01;
53128
53752
  }
53129
53753
  const angle = endAngle - startAngle;
53130
- const dashArray = Array.isArray(w.config.stroke.dashArray) ? w.config.stroke.dashArray[i2] : w.config.stroke.dashArray;
53754
+ const dashArray = resolveClaimed(
53755
+ w,
53756
+ "stroke.dashArray",
53757
+ i2,
53758
+ Array.isArray(w.config.stroke.dashArray) ? w.config.stroke.dashArray[i2] : w.config.stroke.dashArray
53759
+ );
53131
53760
  const morphFrom = morphActive ? this.ctx.morphTypeChange.getInitialPathFor(i2, 0) : null;
53132
53761
  const morphFromType = morphActive ? this.ctx.morphTypeChange.getFromType() : null;
53133
53762
  const morphFromFilled = !!morphFrom && (morphFromType === "bar" || morphFromType === "funnel" || morphFromType === "pyramid" || morphFromType === "pie" || morphFromType === "donut" || morphFromType === "polarArea");
@@ -53836,7 +54465,7 @@ var __async = (__this, __arguments, generator) => {
53836
54465
  (_d = (_c = w.config.series[i2].data) == null ? void 0 : _c[j2]) == null ? void 0 : _d.x
53837
54466
  );
53838
54467
  const labelX = Array.isArray(x) ? x.join(" ") : x;
53839
- const rowIndex = w.labelData.labels.map((_) => Array.isArray(_) ? _.join(" ") : _).indexOf(labelX);
54468
+ const rowIndex = w.labelData.labels.map((_2) => Array.isArray(_2) ? _2.join(" ") : _2).indexOf(labelX);
53840
54469
  const overlappedIndex = w.rangeData.seriesRange[i2].findIndex(
53841
54470
  (tx) => {
53842
54471
  var _a2;
@@ -55034,8 +55663,8 @@ var __async = (__this, __arguments, generator) => {
55034
55663
  */
55035
55664
  _zoomEnabled() {
55036
55665
  const w = this.w;
55037
- const z = w.config.plotOptions.treemap.zoom;
55038
- if (!z || !z.enabled || !this.showParents) return false;
55666
+ const z2 = w.config.plotOptions.treemap.zoom;
55667
+ if (!z2 || !z2.enabled || !this.showParents) return false;
55039
55668
  const dd = w.config.drilldown;
55040
55669
  if (dd && dd.enabled && Array.isArray(dd.series) && dd.series.length) {
55041
55670
  if (!this._warnedZoomConflict) {
@@ -55127,8 +55756,8 @@ var __async = (__this, __arguments, generator) => {
55127
55756
  }
55128
55757
  /** The breadcrumb config: a treemap-local override on the shared block. */
55129
55758
  _breadcrumbCfg() {
55130
- const z = this.w.config.plotOptions.treemap.zoom;
55131
- return breadcrumbConfig(this.w, z && z.breadcrumb);
55759
+ const z2 = this.w.config.plotOptions.treemap.zoom;
55760
+ return breadcrumbConfig(this.w, z2 && z2.breadcrumb);
55132
55761
  }
55133
55762
  /**
55134
55763
  * Breadcrumb back out of a zoom. Markup, config and accessible semantics are
@@ -55327,7 +55956,7 @@ var __async = (__this, __arguments, generator) => {
55327
55956
  if (typeof fmt === "function") {
55328
55957
  try {
55329
55958
  return String(fmt(v, { seriesIndex: 0, dataPointIndex: 0, w }));
55330
- } catch (_) {
55959
+ } catch (_2) {
55331
55960
  }
55332
55961
  }
55333
55962
  return String(v);
@@ -55572,7 +56201,7 @@ var __async = (__this, __arguments, generator) => {
55572
56201
  const PK_CORNER = 1;
55573
56202
  const PK_GLYPH = 2;
55574
56203
  function springParams(preset, speed) {
55575
- const [stiffness, damping] = q(
56204
+ const [stiffness, damping] = z(
55576
56205
  /** @type {import('apex-commons').SpringPreset|undefined} */
55577
56206
  preset
55578
56207
  );
@@ -55816,7 +56445,7 @@ var __async = (__this, __arguments, generator) => {
55816
56445
  r: typeof p.r === "number" && p.r > 0 ? p.r : void 0
55817
56446
  });
55818
56447
  });
55819
- const clusters = counts.map((_, i2) => ({
56448
+ const clusters = counts.map((_2, i2) => ({
55820
56449
  i: i2,
55821
56450
  cx: gw / 2,
55822
56451
  cy: gh / 2,
@@ -55923,7 +56552,7 @@ var __async = (__this, __arguments, generator) => {
55923
56552
  const gw = w.layout.gridWidth;
55924
56553
  const gh = w.layout.gridHeight;
55925
56554
  const labelSpace = opts.clusterLabels && opts.clusterLabels.show ? 30 : 6;
55926
- const visible = counts.map((_, i2) => i2).filter((i2) => counts[i2] > 0);
56555
+ const visible = counts.map((_2, i2) => i2).filter((i2) => counts[i2] > 0);
55927
56556
  const Kv = Math.max(1, visible.length);
55928
56557
  const slotOf = new Array(counts.length).fill(-1);
55929
56558
  visible.forEach((i2, s2) => slotOf[i2] = s2);
@@ -55938,7 +56567,7 @@ var __async = (__this, __arguments, generator) => {
55938
56567
  const cy = labelSpace + availH / 2;
55939
56568
  const outerRs = counts.map((n2) => step * Math.sqrt(Math.max(1, n2)) + dotR);
55940
56569
  const cellCentre = (i2) => slotOf[i2] >= 0 ? cellW * (slotOf[i2] + 0.5) : gw / 2;
55941
- let centers = counts.map((_, i2) => cellCentre(i2));
56570
+ let centers = counts.map((_2, i2) => cellCentre(i2));
55942
56571
  const visOuter = visible.map((i2) => outerRs[i2]);
55943
56572
  let overlap = false;
55944
56573
  for (let s2 = 1; s2 < Kv; s2++) {
@@ -55963,10 +56592,10 @@ var __async = (__this, __arguments, generator) => {
55963
56592
  } else {
55964
56593
  const lo = visOuter[0];
55965
56594
  const hi = gw - visOuter[Kv - 1];
55966
- visCenters = visOuter.map((_, s2) => lo + (hi - lo) * s2 / (Kv - 1));
56595
+ visCenters = visOuter.map((_2, s2) => lo + (hi - lo) * s2 / (Kv - 1));
55967
56596
  }
55968
56597
  centers = counts.map(
55969
- (_, i2) => slotOf[i2] >= 0 ? visCenters[slotOf[i2]] : gw / 2
56598
+ (_2, i2) => slotOf[i2] >= 0 ? visCenters[slotOf[i2]] : gw / 2
55970
56599
  );
55971
56600
  }
55972
56601
  return counts.map((n2, i2) => ({
@@ -55998,11 +56627,11 @@ var __async = (__this, __arguments, generator) => {
55998
56627
  this._lastDotR = this._dotRadiusFromStep(step, opts);
55999
56628
  const cx = gw / 2;
56000
56629
  const cy = labelSpace + (gh - labelSpace) / 2;
56001
- const order = counts.map((_, i2) => i2);
56630
+ const order = counts.map((_2, i2) => i2);
56002
56631
  if (opts.sortByGroup !== false) {
56003
56632
  order.sort((a2, b) => counts[a2] - counts[b]);
56004
56633
  }
56005
- const clusters = counts.map((_, i2) => ({
56634
+ const clusters = counts.map((_2, i2) => ({
56006
56635
  i: i2,
56007
56636
  cx,
56008
56637
  cy,
@@ -56074,7 +56703,7 @@ var __async = (__this, __arguments, generator) => {
56074
56703
  }
56075
56704
  }
56076
56705
  seats.sort((s1, s2) => s1.a - s2.a);
56077
- const clusters = counts.map((_, i2) => ({
56706
+ const clusters = counts.map((_2, i2) => ({
56078
56707
  i: i2,
56079
56708
  cx,
56080
56709
  cy,
@@ -56135,11 +56764,11 @@ var __async = (__this, __arguments, generator) => {
56135
56764
  const spacing = opts.spacing > 0 ? opts.spacing : 1.05;
56136
56765
  const absSpan = Math.abs(span) || Math.PI;
56137
56766
  const fixed = this._fixedRadius(opts);
56138
- const evalR = (R2) => {
56139
- R2 = Math.max(1, Math.round(R2));
56767
+ const evalR = (R) => {
56768
+ R = Math.max(1, Math.round(R));
56140
56769
  const radii = [];
56141
- for (let r2 = 0; r2 < R2; r2++) {
56142
- radii.push(R2 === 1 ? (r0 + r1) / 2 : r0 + (r1 - r0) * (r2 / (R2 - 1)));
56770
+ for (let r2 = 0; r2 < R; r2++) {
56771
+ radii.push(R === 1 ? (r0 + r1) / 2 : r0 + (r1 - r0) * (r2 / (R - 1)));
56143
56772
  }
56144
56773
  const weightSum = radii.reduce((a2, x) => a2 + x, 0) || 1;
56145
56774
  const raw = radii.map((rho) => total * rho / weightSum);
@@ -56152,19 +56781,19 @@ var __async = (__this, __arguments, generator) => {
56152
56781
  }
56153
56782
  });
56154
56783
  while (left > 0) {
56155
- seatsPerRow[R2 - 1]++;
56784
+ seatsPerRow[R - 1]++;
56156
56785
  left--;
56157
56786
  }
56158
- const radialPitch = R2 === 1 ? r1 - r0 || r1 : (r1 - r0) / (R2 - 1);
56787
+ const radialPitch = R === 1 ? r1 - r0 || r1 : (r1 - r0) / (R - 1);
56159
56788
  let minArcPitch = Infinity;
56160
- for (let r2 = 0; r2 < R2; r2++) {
56789
+ for (let r2 = 0; r2 < R; r2++) {
56161
56790
  const n2 = seatsPerRow[r2];
56162
56791
  if (n2 <= 0) continue;
56163
56792
  const arcPitch = radii[r2] * absSpan / n2;
56164
56793
  if (arcPitch < minArcPitch) minArcPitch = arcPitch;
56165
56794
  }
56166
56795
  const pitch = Math.min(radialPitch, minArcPitch);
56167
- return { R: R2, radii, seatsPerRow, dotR: Math.max(1, pitch / (2 * spacing)) };
56796
+ return { R, radii, seatsPerRow, dotR: Math.max(1, pitch / (2 * spacing)) };
56168
56797
  };
56169
56798
  const arcRows = opts.arc && opts.arc.rows;
56170
56799
  let res;
@@ -56176,8 +56805,8 @@ var __async = (__this, __arguments, generator) => {
56176
56805
  } else {
56177
56806
  const maxR = Math.max(1, Math.min(40, Math.ceil(Math.sqrt(total)) + 6));
56178
56807
  res = evalR(1);
56179
- for (let R2 = 2; R2 <= maxR; R2++) {
56180
- const cand = evalR(R2);
56808
+ for (let R = 2; R <= maxR; R++) {
56809
+ const cand = evalR(R);
56181
56810
  if (cand.dotR > res.dotR) res = cand;
56182
56811
  }
56183
56812
  }
@@ -56201,7 +56830,7 @@ var __async = (__this, __arguments, generator) => {
56201
56830
  const labelsOn = !!(opts.clusterLabels && opts.clusterLabels.show);
56202
56831
  const labelsBelow = labelsOn && opts.clusterLabels.position === "bottom";
56203
56832
  const topPad = labelsOn && !labelsBelow ? 30 : 6;
56204
- const visible = counts.map((_, i2) => i2).filter((i2) => counts[i2] > 0);
56833
+ const visible = counts.map((_2, i2) => i2).filter((i2) => counts[i2] > 0);
56205
56834
  const Kv = Math.max(1, visible.length);
56206
56835
  const slotOf = new Array(counts.length).fill(-1);
56207
56836
  visible.forEach((i2, s2) => slotOf[i2] = s2);
@@ -56316,7 +56945,7 @@ var __async = (__this, __arguments, generator) => {
56316
56945
  const originX = (gw - blockW) / 2 + pitch / 2;
56317
56946
  const topY = labelSpace + (availH - blockH) / 2;
56318
56947
  const rowY = (rowIdx) => fillFrom === "bottom" ? topY + blockH - pitch / 2 - rowIdx * pitch : topY + pitch / 2 + rowIdx * pitch;
56319
- const clusters = counts.map((_, i2) => ({
56948
+ const clusters = counts.map((_2, i2) => ({
56320
56949
  i: i2,
56321
56950
  cx: gw / 2,
56322
56951
  cy: labelSpace + availH / 2,
@@ -56362,14 +56991,14 @@ var __async = (__this, __arguments, generator) => {
56362
56991
  const fillFrom = gcfg.fillFrom === "top" ? "top" : "bottom";
56363
56992
  const cellsPerTile = Math.max(1, Math.round(gcfg.total > 0 ? gcfg.total : 100));
56364
56993
  const rowsPerTile = Math.max(1, Math.ceil(cellsPerTile / cols));
56365
- const visible = counts.map((_, i2) => i2).filter((i2) => counts[i2] > 0);
56366
- const K = Math.max(1, visible.length);
56994
+ const visible = counts.map((_2, i2) => i2).filter((i2) => counts[i2] > 0);
56995
+ const K2 = Math.max(1, visible.length);
56367
56996
  const denom = gcfg.max > 0 ? gcfg.max : Math.max(1, ...counts);
56368
56997
  const tileCols = Math.max(
56369
56998
  1,
56370
- Math.round(gcfg.tileColumns > 0 ? gcfg.tileColumns : Math.ceil(Math.sqrt(K)))
56999
+ Math.round(gcfg.tileColumns > 0 ? gcfg.tileColumns : Math.ceil(Math.sqrt(K2)))
56371
57000
  );
56372
- const tileRows = Math.max(1, Math.ceil(K / tileCols));
57001
+ const tileRows = Math.max(1, Math.ceil(K2 / tileCols));
56373
57002
  const labelsOn = !(opts.clusterLabels && opts.clusterLabels.show === false);
56374
57003
  const labelsBelow = labelsOn && opts.clusterLabels && opts.clusterLabels.position === "bottom";
56375
57004
  const topBand = labelsOn && !labelsBelow ? 22 : 4;
@@ -56489,7 +57118,7 @@ var __async = (__this, __arguments, generator) => {
56489
57118
  (cat) => Array.isArray(cat) ? cat.map(valueOf) : []
56490
57119
  );
56491
57120
  const isNum = (v) => v != null && isFinite(v);
56492
- const visible = catVals.map((_, i2) => i2).filter((i2) => catVals[i2].some(isNum));
57121
+ const visible = catVals.map((_2, i2) => i2).filter((i2) => catVals[i2].some(isNum));
56493
57122
  const Kv = Math.max(1, visible.length);
56494
57123
  let vmin = Infinity;
56495
57124
  let vmax = -Infinity;
@@ -56608,7 +57237,7 @@ var __async = (__this, __arguments, generator) => {
56608
57237
  (cat) => Array.isArray(cat) ? cat.map(valueOf) : []
56609
57238
  );
56610
57239
  const isNum = (v) => v != null && isFinite(v);
56611
- const visible = catVals.map((_, i2) => i2).filter((i2) => catVals[i2].some(isNum));
57240
+ const visible = catVals.map((_2, i2) => i2).filter((i2) => catVals[i2].some(isNum));
56612
57241
  const Kv = Math.max(1, visible.length);
56613
57242
  let vmin = Infinity;
56614
57243
  let vmax = -Infinity;
@@ -56725,7 +57354,7 @@ var __async = (__this, __arguments, generator) => {
56725
57354
  const isNum = (v) => typeof v === "number" && isFinite(v);
56726
57355
  const xOf = (d) => d && typeof d === "object" ? d.x : null;
56727
57356
  const yOf = (d) => d && typeof d === "object" ? d.y != null ? d.y : d.value : null;
56728
- const visible = unitData.map((_, i2) => i2).filter(
57357
+ const visible = unitData.map((_2, i2) => i2).filter(
56729
57358
  (i2) => (unitData[i2] || []).some((d) => isNum(xOf(d)) && isNum(yOf(d)))
56730
57359
  );
56731
57360
  let xmn = Infinity;
@@ -56863,10 +57492,10 @@ var __async = (__this, __arguments, generator) => {
56863
57492
  let zmax = -Infinity;
56864
57493
  unitData.forEach(
56865
57494
  (cat) => (cat || []).forEach((d) => {
56866
- const z = d && typeof d === "object" ? d[field] : null;
56867
- if (typeof z === "number" && isFinite(z)) {
56868
- if (z < zmin) zmin = z;
56869
- if (z > zmax) zmax = z;
57495
+ const z2 = d && typeof d === "object" ? d[field] : null;
57496
+ if (typeof z2 === "number" && isFinite(z2)) {
57497
+ if (z2 < zmin) zmin = z2;
57498
+ if (z2 > zmax) zmax = z2;
56870
57499
  }
56871
57500
  })
56872
57501
  );
@@ -56883,9 +57512,9 @@ var __async = (__this, __arguments, generator) => {
56883
57512
  */
56884
57513
  _scatterRadius(d, st, fallback) {
56885
57514
  if (!st) return fallback;
56886
- const z = d && typeof d === "object" ? d[st.field] : null;
56887
- if (typeof z !== "number" || !isFinite(z)) return st.rMin;
56888
- const t2 = st.zmax > st.zmin ? (z - st.zmin) / (st.zmax - st.zmin) : 1;
57515
+ const z2 = d && typeof d === "object" ? d[st.field] : null;
57516
+ if (typeof z2 !== "number" || !isFinite(z2)) return st.rMin;
57517
+ const t2 = st.zmax > st.zmin ? (z2 - st.zmin) / (st.zmax - st.zmin) : 1;
56889
57518
  const tc = Math.max(0, Math.min(1, t2));
56890
57519
  const aMin = st.rMin * st.rMin;
56891
57520
  const aMax = st.rMax * st.rMax;
@@ -57681,8 +58310,8 @@ var __async = (__this, __arguments, generator) => {
57681
58310
  for (let k = 0; k < dots.length; k++) {
57682
58311
  const d = dots[k];
57683
58312
  const carried = live && !d.isEnter && d.key != null ? live.get(d.key) : null;
57684
- const sx = carried ? carried.x : E(d.cx0, stiffness, damping);
57685
- const sy = carried ? carried.y : E(d.cy0, stiffness, damping);
58313
+ const sx = carried ? carried.x : $(d.cx0, stiffness, damping);
58314
+ const sy = carried ? carried.y : $(d.cy0, stiffness, damping);
57686
58315
  if (carried) {
57687
58316
  sx.stiffness = stiffness;
57688
58317
  sy.stiffness = stiffness;
@@ -57766,12 +58395,12 @@ var __async = (__this, __arguments, generator) => {
57766
58395
  let cx, cy;
57767
58396
  if (d.sx && d.sy) {
57768
58397
  if (elapsed >= 0 && !d.released) {
57769
- D(d.sx, d.x);
57770
- D(d.sy, d.y);
58398
+ _(d.sx, d.x);
58399
+ _(d.sy, d.y);
57771
58400
  d.released = true;
57772
58401
  }
57773
- const restX = R(d.sx, dt);
57774
- const restY = R(d.sy, dt);
58402
+ const restX = q(d.sx, dt);
58403
+ const restY = q(d.sy, dt);
57775
58404
  if (!d.released || !restX || !restY) done = false;
57776
58405
  cx = d.sx.value;
57777
58406
  cy = d.sy.value;
@@ -58103,14 +58732,14 @@ ${percent.toFixed(1)}%`;
58103
58732
  textEl.setAttribute("font-weight", String(cfg.fontWeight || 600));
58104
58733
  textEl.setAttribute("fill", cfg.color || color);
58105
58734
  const bottom = cfg.position === "bottom";
58106
- const R2 = cluster.outerR + fontSize * 0.6 + 3 + (cfg.offsetY || 0);
58735
+ const R = cluster.outerR + fontSize * 0.6 + 3 + (cfg.offsetY || 0);
58107
58736
  const estWidth = str.length * fontSize * 0.55;
58108
- const curved = !bottom && !cluster.flat && cfg.curved !== false && estWidth <= Math.PI * R2 * 0.95;
58737
+ const curved = !bottom && !cluster.flat && cfg.curved !== false && estWidth <= Math.PI * R * 0.95;
58109
58738
  if (curved) {
58110
58739
  const yMid = cluster.cy;
58111
- const x1 = cluster.cx - R2;
58112
- const x2 = cluster.cx + R2;
58113
- const d = `M ${x1} ${yMid} A ${R2} ${R2} 0 0 1 ${x2} ${yMid}`;
58740
+ const x1 = cluster.cx - R;
58741
+ const x2 = cluster.cx + R;
58742
+ const d = `M ${x1} ${yMid} A ${R} ${R} 0 0 1 ${x2} ${yMid}`;
58114
58743
  const arcId = `apexcharts-unit-label-${w.globals.chartID}-${cluster.i}`;
58115
58744
  const pathEl = BrowserAPIs.createElementNS(NS, "path");
58116
58745
  pathEl.setAttribute("id", arcId);