velo-plot 3.1.0 → 4.0.0-alpha.1

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 (116) hide show
  1. package/dist/{ChartCore-AnR_3Xkb.js → ChartCore-KYG2HTcK.js} +1349 -1213
  2. package/dist/ChartCore-KYG2HTcK.js.map +1 -0
  3. package/dist/{PluginRegistry-CzMHebYP.js → PluginRegistry-CDf_jcnp.js} +2 -2
  4. package/dist/{PluginRegistry-CzMHebYP.js.map → PluginRegistry-CDf_jcnp.js.map} +1 -1
  5. package/dist/SVGDocumentBuilder-C-uLkcFW.js +83 -0
  6. package/dist/SVGDocumentBuilder-C-uLkcFW.js.map +1 -0
  7. package/dist/angular-hooks.js +1 -1
  8. package/dist/angular.js +4 -4
  9. package/dist/{chartSyncBridge-D_rCtbFq.js → chartSyncBridge-C1uRy0ZS.js} +3 -3
  10. package/dist/{chartSyncBridge-D_rCtbFq.js.map → chartSyncBridge-C1uRy0ZS.js.map} +1 -1
  11. package/dist/core/chart/ChartCore.d.ts +7 -3
  12. package/dist/core/chart/ChartRenderLoop.d.ts +5 -0
  13. package/dist/core/chart/ChartRenderer.d.ts +9 -0
  14. package/dist/core/chart/ChartSetup.d.ts +1 -0
  15. package/dist/core/chart/exporter/SVGExporter.d.ts +9 -7
  16. package/dist/core/chart/exporter/svg/SVGDocumentBuilder.d.ts +27 -0
  17. package/dist/core/chart/exporter/svg/SVGExportContext.d.ts +147 -0
  18. package/dist/core/chart/exporter/svg/SVGOrchestrator.d.ts +3 -0
  19. package/dist/core/chart/exporter/svg/SVGThemeAdapter.d.ts +22 -0
  20. package/dist/core/chart/exporter/svg/__tests__/testFixtures.d.ts +46 -0
  21. package/dist/core/chart/exporter/svg/__tests__/visualTestUtils.d.ts +12 -0
  22. package/dist/core/chart/exporter/svg/overlay/axes.d.ts +4 -0
  23. package/dist/core/chart/exporter/svg/overlay/border.d.ts +4 -0
  24. package/dist/core/chart/exporter/svg/overlay/errorBars.d.ts +7 -0
  25. package/dist/core/chart/exporter/svg/overlay/grid.d.ts +4 -0
  26. package/dist/core/chart/exporter/svg/overlay/index.d.ts +12 -0
  27. package/dist/core/chart/exporter/svg/overlay/legend.d.ts +4 -0
  28. package/dist/core/chart/exporter/svg/overlay/pluginCharts.d.ts +6 -0
  29. package/dist/core/chart/exporter/svg/overlay/polarGrid.d.ts +4 -0
  30. package/dist/core/chart/exporter/svg/overlay/specialChart.d.ts +15 -0
  31. package/dist/core/chart/exporter/svg/overlay/title.d.ts +4 -0
  32. package/dist/core/chart/exporter/svg/plugins/annotations.d.ts +5 -0
  33. package/dist/core/chart/exporter/svg/plugins/brokenAxis.d.ts +20 -0
  34. package/dist/core/chart/exporter/svg/plugins/latex.d.ts +9 -0
  35. package/dist/core/chart/exporter/svg/plugins/register.d.ts +8 -0
  36. package/dist/core/chart/exporter/svg/plugins/regression.d.ts +33 -0
  37. package/dist/core/chart/exporter/svg/plugins/roi.d.ts +12 -0
  38. package/dist/core/chart/exporter/svg/plugins/tradeMarkers.d.ts +3 -0
  39. package/dist/core/chart/exporter/svg/plugins/types.d.ts +28 -0
  40. package/dist/core/chart/exporter/svg/plugins/watermark.d.ts +13 -0
  41. package/dist/core/chart/exporter/svg/series/band.d.ts +6 -0
  42. package/dist/core/chart/exporter/svg/series/bar.d.ts +6 -0
  43. package/dist/core/chart/exporter/svg/series/boxplot.d.ts +6 -0
  44. package/dist/core/chart/exporter/svg/series/candlestick.d.ts +6 -0
  45. package/dist/core/chart/exporter/svg/series/finitePoints.d.ts +6 -0
  46. package/dist/core/chart/exporter/svg/series/gauge.d.ts +5 -0
  47. package/dist/core/chart/exporter/svg/series/heatmap.d.ts +6 -0
  48. package/dist/core/chart/exporter/svg/series/indicator.d.ts +6 -0
  49. package/dist/core/chart/exporter/svg/series/line.d.ts +12 -0
  50. package/dist/core/chart/exporter/svg/series/polar.d.ts +6 -0
  51. package/dist/core/chart/exporter/svg/series/radar.d.ts +5 -0
  52. package/dist/core/chart/exporter/svg/series/registry.d.ts +10 -0
  53. package/dist/core/chart/exporter/svg/series/sankey.d.ts +5 -0
  54. package/dist/core/chart/exporter/svg/series/scatter.d.ts +1 -0
  55. package/dist/core/chart/exporter/svg/series/ternary.d.ts +7 -0
  56. package/dist/core/chart/exporter/svg/series/waterfall.d.ts +6 -0
  57. package/dist/core/chart/exporter/svg/seriesAtTimestamp.d.ts +4 -0
  58. package/dist/core/chart/exporter/svg/seriesUtils.d.ts +3 -0
  59. package/dist/core/chart/exporter/svg/symbols.d.ts +5 -0
  60. package/dist/core/chart/exporter/svg/tickUtils.d.ts +9 -0
  61. package/dist/core/chart/mountSVGString.d.ts +5 -0
  62. package/dist/core/chart/types.d.ts +2 -2
  63. package/dist/core/stacked/StackSVGComposer.d.ts +14 -0
  64. package/dist/core/stacked/index.d.ts +3 -2
  65. package/dist/core/stacked/types.d.ts +12 -4
  66. package/dist/createStackedChart-DjA3aJAu.js +2761 -0
  67. package/dist/createStackedChart-DjA3aJAu.js.map +1 -0
  68. package/dist/{hooks-DH-3bewj.js → hooks-4wQH27r9.js} +3 -3
  69. package/dist/{hooks-DH-3bewj.js.map → hooks-4wQH27r9.js.map} +1 -1
  70. package/dist/index-Bj-xyXY6.js +582 -0
  71. package/dist/index-Bj-xyXY6.js.map +1 -0
  72. package/dist/plugins/PluginManager.d.ts +5 -0
  73. package/dist/plugins/annotations.js +8 -7
  74. package/dist/plugins/annotations.js.map +1 -1
  75. package/dist/plugins/broken-axis.js +198 -152
  76. package/dist/plugins/broken-axis.js.map +1 -1
  77. package/dist/plugins/forecasting.js +273 -258
  78. package/dist/plugins/forecasting.js.map +1 -1
  79. package/dist/plugins/ml-integration.js +107 -93
  80. package/dist/plugins/ml-integration.js.map +1 -1
  81. package/dist/plugins/radar/types.d.ts +11 -0
  82. package/dist/plugins/radar.js +64 -53
  83. package/dist/plugins/radar.js.map +1 -1
  84. package/dist/plugins/roi/index.d.ts +2 -0
  85. package/dist/plugins/roi.js +184 -145
  86. package/dist/plugins/roi.js.map +1 -1
  87. package/dist/plugins/snapshot.js +20 -15
  88. package/dist/plugins/snapshot.js.map +1 -1
  89. package/dist/plugins/types.d.ts +4 -0
  90. package/dist/react.js +2 -2
  91. package/dist/regression-HNdyk1Dm.js +28 -0
  92. package/dist/regression-HNdyk1Dm.js.map +1 -0
  93. package/dist/renderer/ChartSeriesRenderer.d.ts +3 -2
  94. package/dist/renderer/SVGChartRenderer.d.ts +15 -0
  95. package/dist/renderer/SankeyRenderer.d.ts +1 -0
  96. package/dist/renderer/registerSVG.d.ts +5 -0
  97. package/dist/renderer/sankeyLayout.d.ts +29 -0
  98. package/dist/scientific.js +2 -2
  99. package/dist/solid.js +2 -2
  100. package/dist/svelte.js +2 -2
  101. package/dist/tickUtils-B_X-ha13.js +41 -0
  102. package/dist/tickUtils-B_X-ha13.js.map +1 -0
  103. package/dist/trading.js +3 -3
  104. package/dist/types.d.ts +2 -1
  105. package/dist/velo-plot.full.js +1107 -1292
  106. package/dist/velo-plot.full.js.map +1 -1
  107. package/dist/velo-plot.js +2 -2
  108. package/dist/vue/VeloPlot.vue.d.ts +1 -1
  109. package/dist/vue/index.d.ts +33 -33
  110. package/dist/vue.js +2 -2
  111. package/package.json +6 -1
  112. package/dist/ChartCore-AnR_3Xkb.js.map +0 -1
  113. package/dist/createStackedChart-DqcLCFGS.js +0 -1338
  114. package/dist/createStackedChart-DqcLCFGS.js.map +0 -1
  115. package/dist/index-Cv6ZDLWf.js +0 -521
  116. package/dist/index-Cv6ZDLWf.js.map +0 -1
@@ -1,9 +1,9 @@
1
- var Oe = Object.defineProperty;
2
- var Ye = (s, e, t) => e in s ? Oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var g = (s, e, t) => Ye(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { g as _e, h as Ve, E as Xe } from "./axisFormat-Sz4WIJfQ.js";
1
+ var _e = Object.defineProperty;
2
+ var Xe = (s, e, t) => e in s ? _e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var g = (s, e, t) => Xe(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { g as $e, h as He, E as Ne } from "./axisFormat-Sz4WIJfQ.js";
5
5
  const U = { top: 20, right: 30, bottom: 55, left: 75 };
6
- class $e {
6
+ class Ue {
7
7
  constructor(e) {
8
8
  g(this, "buffers", /* @__PURE__ */ new Map());
9
9
  g(this, "bufferSizes", /* @__PURE__ */ new Map());
@@ -35,7 +35,7 @@ class $e {
35
35
  this.buffers.forEach((e) => this.gl.deleteBuffer(e)), this.buffers.clear(), this.bufferSizes.clear();
36
36
  }
37
37
  }
38
- const ue = `
38
+ const ge = `
39
39
  precision highp float;
40
40
  attribute vec2 position;
41
41
  uniform vec2 uScale;
@@ -45,14 +45,14 @@ void main() {
45
45
  vec2 pos = position * uScale + uTranslate;
46
46
  gl_Position = vec4(pos, 0.0, 1.0);
47
47
  }
48
- `, de = `
48
+ `, fe = `
49
49
  precision highp float;
50
50
  uniform vec4 uColor;
51
51
 
52
52
  void main() {
53
53
  gl_FragColor = uColor;
54
54
  }
55
- `, He = `
55
+ `, qe = `
56
56
  precision highp float;
57
57
  attribute vec2 position;
58
58
  uniform vec2 uScale;
@@ -64,7 +64,7 @@ void main() {
64
64
  gl_Position = vec4(pos, 0.0, 1.0);
65
65
  gl_PointSize = uPointSize;
66
66
  }
67
- `, Ne = `
67
+ `, We = `
68
68
  precision highp float;
69
69
  uniform vec4 uColor;
70
70
  uniform int uSymbol;
@@ -145,7 +145,7 @@ void main() {
145
145
  float alpha = 1.0 - smoothstep(0.0, 0.02, d);
146
146
  gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);
147
147
  }
148
- `, Ii = `
148
+ `, Yi = `
149
149
  precision highp float;
150
150
  attribute vec2 aPosition;
151
151
  attribute float aValue;
@@ -157,7 +157,7 @@ void main() {
157
157
  gl_Position = vec4(aPosition * uScale + uTranslate, 0.0, 1.0);
158
158
  vValue = aValue;
159
159
  }
160
- `, Ei = `
160
+ `, Vi = `
161
161
  precision highp float;
162
162
  varying float vValue;
163
163
  uniform float uMinValue;
@@ -171,7 +171,7 @@ void main() {
171
171
  gl_FragColor = texture2D(uColormap, vec2(t, 0.5));
172
172
  }
173
173
  `;
174
- function ge(s, e, t) {
174
+ function me(s, e, t) {
175
175
  const i = s.createShader(t);
176
176
  if (!i) throw new Error("Failed to create shader");
177
177
  if (s.shaderSource(i, e), s.compileShader(i), !s.getShaderParameter(i, s.COMPILE_STATUS)) {
@@ -180,8 +180,8 @@ function ge(s, e, t) {
180
180
  }
181
181
  return i;
182
182
  }
183
- function te(s, e, t, i) {
184
- const n = ge(s, e, s.VERTEX_SHADER), o = ge(s, t, s.FRAGMENT_SHADER), r = s.createProgram();
183
+ function ie(s, e, t, i) {
184
+ const n = me(s, e, s.VERTEX_SHADER), o = me(s, t, s.FRAGMENT_SHADER), r = s.createProgram();
185
185
  if (!r) throw new Error("Failed to create program");
186
186
  if (s.attachShader(r, n), s.attachShader(r, o), s.linkProgram(r), !s.getProgramParameter(r, s.LINK_STATUS)) {
187
187
  const a = s.getProgramInfoLog(r);
@@ -208,17 +208,17 @@ function te(s, e, t, i) {
208
208
  }
209
209
  };
210
210
  }
211
- function Ue(s) {
211
+ function Ge(s) {
212
212
  return {
213
- lineProgram: te(s, ue, de, "line"),
214
- pointProgram: te(s, He, Ne, "point"),
215
- heatmapProgram: te(s, ue, de, "line")
213
+ lineProgram: ie(s, ge, fe, "line"),
214
+ pointProgram: ie(s, qe, We, "point"),
215
+ heatmapProgram: ie(s, ge, fe, "line")
216
216
  };
217
217
  }
218
- function qe(s) {
219
- return Ue(s);
218
+ function je(s) {
219
+ return Ge(s);
220
220
  }
221
- function H(s) {
221
+ function N(s) {
222
222
  if (!s) return [1, 0, 1, 1];
223
223
  if (s.startsWith("#")) {
224
224
  const e = s.slice(1);
@@ -242,16 +242,17 @@ function H(s) {
242
242
  }
243
243
  return [1, 0, 1, 1];
244
244
  }
245
- function We(s, e = !0) {
246
- const [t, i, n, o] = H(s), [r, a, l] = Ge(t, i, n), c = (r + 0.12) % 1, u = Math.min(1, a + 0.4);
247
- let h;
248
- e ? h = l < 0.4 ? 0.8 : Math.min(0.95, l + 0.2) : h = l > 0.6 ? 0.25 : Math.max(0.1, l - 0.2), h = Math.max(0.15, Math.min(0.9, h));
249
- const [d, y, f] = je(c, u, h), m = Math.round(d * 255), x = Math.round(y * 255), b = Math.round(f * 255);
250
- return o < 1 ? `rgba(${m}, ${x}, ${b}, ${o})` : `rgb(${m}, ${x}, ${b})`;
245
+ function Qe(s, e = !0) {
246
+ const [t, i, n, o] = N(s), [r, a, l] = Ze(t, i, n), h = (r + 0.12) % 1, d = Math.min(1, a + 0.4);
247
+ let c;
248
+ e ? c = l < 0.4 ? 0.8 : Math.min(0.95, l + 0.2) : c = l > 0.6 ? 0.25 : Math.max(0.1, l - 0.2), c = Math.max(0.15, Math.min(0.9, c));
249
+ const [u, m, f] = Je(h, d, c), y = Math.round(u * 255), p = Math.round(m * 255), b = Math.round(f * 255);
250
+ return o < 1 ? `rgba(${y}, ${p}, ${b}, ${o})` : `rgb(${y}, ${p}, ${b})`;
251
251
  }
252
- function Ge(s, e, t) {
252
+ function Ze(s, e, t) {
253
253
  const i = Math.max(s, e, t), n = Math.min(s, e, t);
254
- let o = 0, r = 0, a = (i + n) / 2;
254
+ let o = 0, r = 0;
255
+ const a = (i + n) / 2;
255
256
  if (i !== n) {
256
257
  const l = i - n;
257
258
  switch (r = a > 0.5 ? l / (2 - i - n) : l / (i + n), i) {
@@ -269,45 +270,45 @@ function Ge(s, e, t) {
269
270
  }
270
271
  return [o, r, a];
271
272
  }
272
- function je(s, e, t) {
273
+ function Je(s, e, t) {
273
274
  let i, n, o;
274
275
  if (e === 0)
275
276
  i = n = o = t;
276
277
  else {
277
- const r = (c, u, h) => (h < 0 && (h += 1), h > 1 && (h -= 1), h < 0.16666666666666666 ? c + (u - c) * 6 * h : h < 0.5 ? u : h < 0.6666666666666666 ? c + (u - c) * (0.6666666666666666 - h) * 6 : c), a = t < 0.5 ? t * (1 + e) : t + e - t * e, l = 2 * t - a;
278
+ const r = (h, d, c) => (c < 0 && (c += 1), c > 1 && (c -= 1), c < 0.16666666666666666 ? h + (d - h) * 6 * c : c < 0.5 ? d : c < 0.6666666666666666 ? h + (d - h) * (0.6666666666666666 - c) * 6 : h), a = t < 0.5 ? t * (1 + e) : t + e - t * e, l = 2 * t - a;
278
279
  i = r(l, a, s + 1 / 3), n = r(l, a, s), o = r(l, a, s - 1 / 3);
279
280
  }
280
281
  return [i, n, o];
281
282
  }
282
- function we(s, e) {
283
+ function Ce(s, e) {
283
284
  const t = Math.min(s.length, e.length), i = new Float32Array(t * 2);
284
285
  for (let n = 0; n < t; n++)
285
286
  i[n * 2] = s[n], i[n * 2 + 1] = e[n];
286
287
  return i;
287
288
  }
288
- function Qe(s, e, t = "after") {
289
+ function Ke(s, e, t = "after") {
289
290
  const i = Math.min(s.length, e.length);
290
291
  if (i < 2)
291
- return we(s, e);
292
+ return Ce(s, e);
292
293
  const n = t === "center" ? 1 + (i - 1) * 3 : i * 2 - 1, o = new Float32Array(n * 2);
293
294
  let r = 0;
294
295
  for (let a = 0; a < i; a++)
295
296
  if (a === 0)
296
297
  o[r++] = s[0], o[r++] = e[0];
297
298
  else {
298
- const l = s[a - 1], c = e[a - 1], u = s[a], h = e[a];
299
+ const l = s[a - 1], h = e[a - 1], d = s[a], c = e[a];
299
300
  if (t === "after")
300
- o[r++] = u, o[r++] = c, o[r++] = u, o[r++] = h;
301
+ o[r++] = d, o[r++] = h, o[r++] = d, o[r++] = c;
301
302
  else if (t === "before")
302
- o[r++] = l, o[r++] = h, o[r++] = u, o[r++] = h;
303
+ o[r++] = l, o[r++] = c, o[r++] = d, o[r++] = c;
303
304
  else {
304
- const d = (l + u) / 2;
305
- o[r++] = d, o[r++] = c, o[r++] = d, o[r++] = h, o[r++] = u, o[r++] = h;
305
+ const u = (l + d) / 2;
306
+ o[r++] = u, o[r++] = h, o[r++] = u, o[r++] = c, o[r++] = d, o[r++] = c;
306
307
  }
307
308
  }
308
309
  return o.subarray(0, r);
309
310
  }
310
- function Ce(s, e, t) {
311
+ function Ae(s, e, t) {
311
312
  const i = Math.min(s.length, e.length, t.length), n = new Float32Array(i * 2 * 2);
312
313
  for (let o = 0; o < i; o++) {
313
314
  const r = o * 4, a = s[o];
@@ -315,40 +316,40 @@ function Ce(s, e, t) {
315
316
  }
316
317
  return n;
317
318
  }
318
- function Ze(s, e, t, i) {
319
+ function et(s, e, t, i) {
319
320
  const n = s.length;
320
321
  let o = 0;
321
322
  t && o++, i && o++;
322
323
  const r = new Float32Array(n * o * 2 * 2);
323
324
  let a = 0;
324
325
  for (let l = 0; l < n; l++) {
325
- const c = s[l], u = e[l];
326
+ const h = s[l], d = e[l];
326
327
  if (t) {
327
- let h = 0, d = 0;
328
- t.yError && l < t.yError.length ? h = d = t.yError[l] : (h = t.yErrorMinus ? t.yErrorMinus[l] : 0, d = t.yErrorPlus ? t.yErrorPlus[l] : 0), r[a++] = c, r[a++] = u - h, r[a++] = c, r[a++] = u + d;
328
+ let c = 0, u = 0;
329
+ t.yError && l < t.yError.length ? c = u = t.yError[l] : (c = t.yErrorMinus ? t.yErrorMinus[l] : 0, u = t.yErrorPlus ? t.yErrorPlus[l] : 0), r[a++] = h, r[a++] = d - c, r[a++] = h, r[a++] = d + u;
329
330
  }
330
331
  if (i) {
331
- let h = 0, d = 0;
332
- i.xError && l < i.xError.length ? h = d = i.xError[l] : (h = i.xErrorMinus ? i.xErrorMinus[l] : 0, d = i.xErrorPlus ? i.xErrorPlus[l] : 0), r[a++] = c - h, r[a++] = u, r[a++] = c + d, r[a++] = u;
332
+ let c = 0, u = 0;
333
+ i.xError && l < i.xError.length ? c = u = i.xError[l] : (c = i.xErrorMinus ? i.xErrorMinus[l] : 0, u = i.xErrorPlus ? i.xErrorPlus[l] : 0), r[a++] = h - c, r[a++] = d, r[a++] = h + u, r[a++] = d;
333
334
  }
334
335
  }
335
336
  return r.subarray(0, a);
336
337
  }
337
- function Je(s, e = !1) {
338
+ function tt(s, e = !1) {
338
339
  const t = s.xMax - s.xMin, i = s.yMax - s.yMin, n = t > 0 ? (e ? -2 : 2) / t : 1, o = i > 0 ? 2 / i : 1, r = e ? 1 - s.xMin * n : -1 - s.xMin * n, a = -1 - s.yMin * o;
339
340
  return {
340
341
  scale: [n, o],
341
342
  translate: [r, a]
342
343
  };
343
344
  }
344
- function Z(s, e, t, i, n, o, r = 1) {
345
+ function J(s, e, t, i, n, o, r = 1) {
345
346
  s.useProgram(e.program), s.lineWidth(r), s.bindBuffer(s.ARRAY_BUFFER, t), s.enableVertexAttribArray(e.attributes.position), s.vertexAttribPointer(e.attributes.position, 2, s.FLOAT, !1, 0, 0), s.uniform2f(e.uniforms.uScale, n.scale[0], n.scale[1]), s.uniform2f(
346
347
  e.uniforms.uTranslate,
347
348
  n.translate[0],
348
349
  n.translate[1]
349
350
  ), s.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), s.drawArrays(s.LINE_STRIP, 0, i), s.disableVertexAttribArray(e.attributes.position);
350
351
  }
351
- function Ke(s, e, t, i, n, o) {
352
+ function it(s, e, t, i, n, o) {
352
353
  s.useProgram(e.program), s.bindBuffer(s.ARRAY_BUFFER, t), s.enableVertexAttribArray(e.attributes.position), s.vertexAttribPointer(e.attributes.position, 2, s.FLOAT, !1, 0, 0), s.uniform2f(e.uniforms.uScale, n.scale[0], n.scale[1]), s.uniform2f(
353
354
  e.uniforms.uTranslate,
354
355
  n.translate[0],
@@ -357,7 +358,7 @@ function Ke(s, e, t, i, n, o) {
357
358
  const r = o[3] * 0.4;
358
359
  s.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], r), s.drawArrays(s.TRIANGLE_STRIP, 0, i), s.disableVertexAttribArray(e.attributes.position);
359
360
  }
360
- function ie(s, e, t, i, n, o, r, a = "circle") {
361
+ function se(s, e, t, i, n, o, r, a = "circle") {
361
362
  if (s.useProgram(e.program), s.bindBuffer(s.ARRAY_BUFFER, t), s.enableVertexAttribArray(e.attributes.position), s.vertexAttribPointer(e.attributes.position, 2, s.FLOAT, !1, 0, 0), s.uniform2f(e.uniforms.uScale, n.scale[0], n.scale[1]), s.uniform2f(
362
363
  e.uniforms.uTranslate,
363
364
  n.translate[0],
@@ -377,63 +378,63 @@ function ie(s, e, t, i, n, o, r, a = "circle") {
377
378
  }
378
379
  s.drawArrays(s.POINTS, 0, i), s.disableVertexAttribArray(e.attributes.position);
379
380
  }
380
- function et(s, e, t, i, n, o, r = 1) {
381
+ function st(s, e, t, i, n, o, r = 1) {
381
382
  s.useProgram(e.program), s.lineWidth(r), s.bindBuffer(s.ARRAY_BUFFER, t), s.enableVertexAttribArray(e.attributes.position), s.vertexAttribPointer(e.attributes.position, 2, s.FLOAT, !1, 0, 0), s.uniform2f(e.uniforms.uScale, n.scale[0], n.scale[1]), s.uniform2f(
382
383
  e.uniforms.uTranslate,
383
384
  n.translate[0],
384
385
  n.translate[1]
385
386
  ), s.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), s.drawArrays(s.LINES, 0, i), s.disableVertexAttribArray(e.attributes.position);
386
387
  }
387
- function fe(s) {
388
- const e = H(s.color ?? "#ff0055");
388
+ function ye(s) {
389
+ const e = N(s.color ?? "#ff0055");
389
390
  return e[3] = s.opacity ?? 1, e;
390
391
  }
391
- const Ae = /* @__PURE__ */ new Map();
392
- function Ri(s, e) {
393
- Ae.set(s, e);
392
+ const ke = /* @__PURE__ */ new Map();
393
+ function _i(s, e) {
394
+ ke.set(s, e);
394
395
  }
395
- function tt(s) {
396
- return Ae.get(s);
396
+ function nt(s) {
397
+ return ke.get(s);
397
398
  }
398
- function it(s, e, t, i, n, o) {
399
- const { bounds: r, backgroundColor: a = [0.1, 0.1, 0.18, 1], plotArea: l } = o, c = e.height, u = e.width, h = l ? {
399
+ function ot(s, e, t, i, n, o) {
400
+ const { bounds: r, backgroundColor: a = [0.1, 0.1, 0.18, 1], plotArea: l } = o, h = e.height, d = e.width, c = l ? {
400
401
  x: l.x * t,
401
- y: c - (l.y + l.height) * t,
402
+ y: h - (l.y + l.height) * t,
402
403
  width: l.width * t,
403
404
  height: l.height * t
404
405
  } : {
405
406
  x: 0,
406
407
  y: 0,
407
- width: u,
408
- height: c
408
+ width: d,
409
+ height: h
409
410
  };
410
- s.viewport(0, 0, u, c), s.disable(s.SCISSOR_TEST), s.clearColor(
411
+ s.viewport(0, 0, d, h), s.disable(s.SCISSOR_TEST), s.clearColor(
411
412
  a[0],
412
413
  a[1],
413
414
  a[2],
414
415
  a[3]
415
- ), s.clear(s.COLOR_BUFFER_BIT), s.viewport(h.x, h.y, h.width, h.height), s.enable(s.SCISSOR_TEST), s.scissor(h.x, h.y, h.width, h.height), o.plotAreaBackground && (s.clearColor(
416
+ ), s.clear(s.COLOR_BUFFER_BIT), s.viewport(c.x, c.y, c.width, c.height), s.enable(s.SCISSOR_TEST), s.scissor(c.x, c.y, c.width, c.height), o.plotAreaBackground && (s.clearColor(
416
417
  o.plotAreaBackground[0],
417
418
  o.plotAreaBackground[1],
418
419
  o.plotAreaBackground[2],
419
420
  o.plotAreaBackground[3]
420
421
  ), s.clear(s.COLOR_BUFFER_BIT));
421
- const d = Je(r, o.invertX), y = {
422
+ const u = tt(r, o.invertX), m = {
422
423
  gl: s,
423
424
  canvas: e,
424
425
  dpr: t,
425
426
  programs: i,
426
427
  options: o,
427
428
  bounds: r,
428
- pa: h
429
+ pa: c
429
430
  };
430
431
  for (const f of n) {
431
432
  if (!f.visible || f.count === 0 && f.type !== "boxplot" && f.type !== "waterfall") continue;
432
- const m = f.yBounds ? f.yBounds.min : r.yMin, b = (f.yBounds ? f.yBounds.max : r.yMax) - m, v = b > 0 ? 2 / b : 1, p = -1 - m * v, M = {
433
- scale: [d.scale[0], v],
434
- translate: [d.translate[0], p]
435
- }, S = fe(f.style), w = tt(f.type);
436
- if (w ? w(y, f, M, S) : f.type === "scatter" ? ie(
433
+ const y = f.yBounds ? f.yBounds.min : r.yMin, b = (f.yBounds ? f.yBounds.max : r.yMax) - y, v = b > 0 ? 2 / b : 1, x = -1 - y * v, M = {
434
+ scale: [u.scale[0], v],
435
+ translate: [u.translate[0], x]
436
+ }, S = ye(f.style), w = nt(f.type);
437
+ if (w ? w(m, f, M, S) : f.type === "scatter" ? se(
437
438
  s,
438
439
  i.pointProgram,
439
440
  f.buffer,
@@ -442,7 +443,7 @@ function it(s, e, t, i, n, o) {
442
443
  S,
443
444
  (f.style.pointSize ?? 4) * t,
444
445
  f.style.symbol
445
- ) : f.type === "line" ? Z(
446
+ ) : f.type === "line" ? J(
446
447
  s,
447
448
  i.lineProgram,
448
449
  f.buffer,
@@ -450,7 +451,7 @@ function it(s, e, t, i, n, o) {
450
451
  M,
451
452
  S,
452
453
  (f.style.width ?? 1) * t
453
- ) : f.type === "line+scatter" ? (Z(
454
+ ) : f.type === "line+scatter" ? (J(
454
455
  s,
455
456
  i.lineProgram,
456
457
  f.buffer,
@@ -458,7 +459,7 @@ function it(s, e, t, i, n, o) {
458
459
  M,
459
460
  S,
460
461
  (f.style.width ?? 1) * t
461
- ), ie(
462
+ ), se(
462
463
  s,
463
464
  i.pointProgram,
464
465
  f.buffer,
@@ -467,7 +468,7 @@ function it(s, e, t, i, n, o) {
467
468
  S,
468
469
  (f.style.pointSize ?? 4) * t,
469
470
  f.style.symbol
470
- )) : f.type === "step" || f.type === "step+scatter" ? (f.stepBuffer && f.stepCount ? Z(
471
+ )) : f.type === "step" || f.type === "step+scatter" ? (f.stepBuffer && f.stepCount ? J(
471
472
  s,
472
473
  i.lineProgram,
473
474
  f.stepBuffer,
@@ -475,7 +476,7 @@ function it(s, e, t, i, n, o) {
475
476
  M,
476
477
  S,
477
478
  (f.style.width ?? 1) * t
478
- ) : Z(
479
+ ) : J(
479
480
  s,
480
481
  i.lineProgram,
481
482
  f.buffer,
@@ -483,7 +484,7 @@ function it(s, e, t, i, n, o) {
483
484
  M,
484
485
  S,
485
486
  (f.style.width ?? 1) * t
486
- ), f.type === "step+scatter" && ie(
487
+ ), f.type === "step+scatter" && se(
487
488
  s,
488
489
  i.pointProgram,
489
490
  f.buffer,
@@ -492,7 +493,7 @@ function it(s, e, t, i, n, o) {
492
493
  S,
493
494
  (f.style.pointSize ?? 4) * t,
494
495
  f.style.symbol
495
- )) : f.type === "band" && Ke(
496
+ )) : f.type === "band" && it(
496
497
  s,
497
498
  i.lineProgram,
498
499
  f.buffer,
@@ -500,8 +501,8 @@ function it(s, e, t, i, n, o) {
500
501
  M,
501
502
  S
502
503
  ), f.errorBuffer && f.errorCount) {
503
- const C = f.style.errorBars || {}, k = C.color ? fe({ color: C.color, opacity: C.opacity ?? 0.7 }) : S;
504
- et(
504
+ const C = f.style.errorBars || {}, k = C.color ? ye({ color: C.color, opacity: C.opacity ?? 0.7 }) : S;
505
+ st(
505
506
  s,
506
507
  i.lineProgram,
507
508
  f.errorBuffer,
@@ -513,7 +514,7 @@ function it(s, e, t, i, n, o) {
513
514
  }
514
515
  }
515
516
  }
516
- class st {
517
+ class rt {
517
518
  constructor(e) {
518
519
  g(this, "textures", /* @__PURE__ */ new Map());
519
520
  this.gl = e;
@@ -558,7 +559,7 @@ const _ = class _ {
558
559
  powerPreference: "high-performance"
559
560
  });
560
561
  if (!t) throw new Error("WebGL not supported");
561
- this.gl = t, this.programs = qe(t), this.buffers = new $e(t), this.textures = new st(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
562
+ this.gl = t, this.programs = je(t), this.buffers = new Ue(t), this.textures = new rt(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
562
563
  }
563
564
  installHeatmapProgram() {
564
565
  var e;
@@ -592,7 +593,7 @@ const _ = class _ {
592
593
  return this.textures.getTexture(e);
593
594
  }
594
595
  render(e, t) {
595
- this.isInitialized && it(this.gl, this.canvas, this.dpr, this.programs, e, t);
596
+ this.isInitialized && ot(this.gl, this.canvas, this.dpr, this.programs, e, t);
596
597
  }
597
598
  resize() {
598
599
  const e = this.canvas.getBoundingClientRect(), t = Math.round(e.width * this.dpr), i = Math.round(e.height * this.dpr);
@@ -614,8 +615,32 @@ const _ = class _ {
614
615
  };
615
616
  /** Optional hook for extended bundles to install the heatmap shader program. */
616
617
  g(_, "heatmapProgramInstaller", null);
617
- let J = _;
618
- const he = {
618
+ let K = _;
619
+ class at {
620
+ constructor() {
621
+ g(this, "backend", "svg");
622
+ }
623
+ setDPR(e) {
624
+ }
625
+ resize() {
626
+ }
627
+ render() {
628
+ }
629
+ createBuffer(e, t) {
630
+ }
631
+ updateBuffer(e, t, i) {
632
+ return !1;
633
+ }
634
+ getBuffer(e) {
635
+ }
636
+ getTexture(e) {
637
+ }
638
+ deleteBuffer(e) {
639
+ }
640
+ destroy() {
641
+ }
642
+ }
643
+ const ue = {
619
644
  name: "vibrant",
620
645
  isDark: !0,
621
646
  colors: [
@@ -662,7 +687,7 @@ const he = {
662
687
  ],
663
688
  highlightColor: "#FFFFFF"
664
689
  // Pure White
665
- }, ke = {
690
+ }, Te = {
666
691
  name: "pastel",
667
692
  isDark: !1,
668
693
  colors: [
@@ -709,7 +734,7 @@ const he = {
709
734
  ],
710
735
  highlightColor: "#1A1A1A"
711
736
  // Near Black
712
- }, nt = {
737
+ }, lt = {
713
738
  name: "neon",
714
739
  isDark: !0,
715
740
  colors: [
@@ -756,7 +781,7 @@ const he = {
756
781
  ],
757
782
  highlightColor: "#FFFFFF"
758
783
  // Pure White
759
- }, ot = {
784
+ }, ht = {
760
785
  name: "earth",
761
786
  isDark: !1,
762
787
  colors: [
@@ -803,7 +828,7 @@ const he = {
803
828
  ],
804
829
  highlightColor: "#000000"
805
830
  // Pure Black
806
- }, rt = {
831
+ }, ct = {
807
832
  name: "ocean",
808
833
  isDark: !0,
809
834
  colors: [
@@ -850,21 +875,21 @@ const he = {
850
875
  ],
851
876
  highlightColor: "#FFD700"
852
877
  // Gold
853
- }, at = [
854
- he,
855
- ke,
856
- nt,
857
- ot,
858
- rt
878
+ }, ut = [
879
+ ue,
880
+ Te,
881
+ lt,
882
+ ht,
883
+ ct
859
884
  ];
860
- function me(s) {
861
- const e = at.find((t) => t.name === s);
862
- return e || (console.warn(`[ColorScheme] Unknown scheme "${s}", using vibrant`), he);
885
+ function pe(s) {
886
+ const e = ut.find((t) => t.name === s);
887
+ return e || (console.warn(`[ColorScheme] Unknown scheme "${s}", using vibrant`), ue);
863
888
  }
864
- function ye(s) {
865
- return s ? he : ke;
889
+ function xe(s) {
890
+ return s ? ue : Te;
866
891
  }
867
- const E = {
892
+ const I = {
868
893
  lineColor: "#666666",
869
894
  // Brighter
870
895
  lineWidth: 1,
@@ -904,7 +929,7 @@ const E = {
904
929
  padding: 5,
905
930
  itemGap: 3,
906
931
  swatchSize: 12
907
- }, ee = {
932
+ }, te = {
908
933
  backgroundColor: "rgba(15, 23, 42, 0.2)",
909
934
  borderColor: "rgba(255, 255, 255, 0.08)",
910
935
  borderRadius: 8
@@ -916,7 +941,7 @@ const E = {
916
941
  tooltipBorder: "rgba(255, 255, 255, 0.2)",
917
942
  tooltipColor: "#ffffff",
918
943
  tooltipSize: 11
919
- }, oe = {
944
+ }, ae = {
920
945
  name: "dark",
921
946
  isDark: !0,
922
947
  backgroundColor: "#0b0e14",
@@ -930,14 +955,14 @@ const E = {
930
955
  majorDash: []
931
956
  },
932
957
  xAxis: {
933
- ...E,
958
+ ...I,
934
959
  labelColor: "#adbac7",
935
960
  titleColor: "#cdd9e5",
936
961
  lineColor: "#444c56",
937
962
  tickColor: "#444c56"
938
963
  },
939
964
  yAxis: {
940
- ...E,
965
+ ...I,
941
966
  labelColor: "#adbac7",
942
967
  titleColor: "#cdd9e5",
943
968
  lineColor: "#444c56",
@@ -945,8 +970,8 @@ const E = {
945
970
  },
946
971
  legend: j,
947
972
  cursor: Q,
948
- toolbar: ee
949
- }, lt = {
973
+ toolbar: te
974
+ }, dt = {
950
975
  name: "midnight",
951
976
  isDark: !0,
952
977
  backgroundColor: "#05050a",
@@ -960,14 +985,14 @@ const E = {
960
985
  majorDash: []
961
986
  },
962
987
  xAxis: {
963
- ...E,
988
+ ...I,
964
989
  lineColor: "#5a5a8a",
965
990
  labelColor: "#b0b0e0",
966
991
  titleColor: "#d0d0f0",
967
992
  tickColor: "#5a5a8a"
968
993
  },
969
994
  yAxis: {
970
- ...E,
995
+ ...I,
971
996
  lineColor: "#5a5a8a",
972
997
  labelColor: "#b0b0e0",
973
998
  titleColor: "#d0d0f0",
@@ -979,7 +1004,7 @@ const E = {
979
1004
  borderColor: "rgba(100, 100, 255, 0.4)"
980
1005
  },
981
1006
  toolbar: {
982
- ...ee,
1007
+ ...te,
983
1008
  backgroundColor: "rgba(5, 5, 15, 0.2)",
984
1009
  borderColor: "rgba(100, 100, 255, 0.2)"
985
1010
  },
@@ -987,7 +1012,7 @@ const E = {
987
1012
  ...Q,
988
1013
  lineColor: "rgba(150, 150, 255, 0.7)"
989
1014
  }
990
- }, ht = {
1015
+ }, gt = {
991
1016
  name: "light",
992
1017
  isDark: !1,
993
1018
  backgroundColor: "#ffffff",
@@ -1001,14 +1026,14 @@ const E = {
1001
1026
  majorDash: []
1002
1027
  },
1003
1028
  xAxis: {
1004
- ...E,
1029
+ ...I,
1005
1030
  lineColor: "#888888",
1006
1031
  tickColor: "#888888",
1007
1032
  labelColor: "#444444",
1008
1033
  titleColor: "#222222"
1009
1034
  },
1010
1035
  yAxis: {
1011
- ...E,
1036
+ ...I,
1012
1037
  lineColor: "#888888",
1013
1038
  tickColor: "#888888",
1014
1039
  labelColor: "#444444",
@@ -1030,7 +1055,7 @@ const E = {
1030
1055
  lineColor: "rgba(0, 0, 0, 0.4)",
1031
1056
  tooltipBackground: "rgba(50, 50, 60, 0.95)"
1032
1057
  }
1033
- }, ct = {
1058
+ }, ft = {
1034
1059
  name: "high-contrast",
1035
1060
  isDark: !0,
1036
1061
  backgroundColor: "#000000",
@@ -1044,14 +1069,14 @@ const E = {
1044
1069
  majorDash: []
1045
1070
  },
1046
1071
  xAxis: {
1047
- ...E,
1072
+ ...I,
1048
1073
  lineColor: "#ffffff",
1049
1074
  tickColor: "#ffffff",
1050
1075
  labelColor: "#ffffff",
1051
1076
  titleColor: "#ffffff"
1052
1077
  },
1053
1078
  yAxis: {
1054
- ...E,
1079
+ ...I,
1055
1080
  lineColor: "#ffffff",
1056
1081
  tickColor: "#ffffff",
1057
1082
  labelColor: "#ffffff",
@@ -1064,7 +1089,7 @@ const E = {
1064
1089
  textColor: "#ffffff"
1065
1090
  },
1066
1091
  toolbar: {
1067
- ...ee,
1092
+ ...te,
1068
1093
  backgroundColor: "#000000",
1069
1094
  borderColor: "#ffffff"
1070
1095
  },
@@ -1074,7 +1099,7 @@ const E = {
1074
1099
  tooltipBackground: "#ffff00",
1075
1100
  tooltipColor: "#000000"
1076
1101
  }
1077
- }, ut = {
1102
+ }, mt = {
1078
1103
  name: "electrochemistry",
1079
1104
  isDark: !0,
1080
1105
  backgroundColor: "#0a1628",
@@ -1088,14 +1113,14 @@ const E = {
1088
1113
  minorDivisions: 2
1089
1114
  },
1090
1115
  xAxis: {
1091
- ...E,
1116
+ ...I,
1092
1117
  lineColor: "#1e88e5",
1093
1118
  tickColor: "#42a5f5",
1094
1119
  labelColor: "#90caf9",
1095
1120
  titleColor: "#bbdefb"
1096
1121
  },
1097
1122
  yAxis: {
1098
- ...E,
1123
+ ...I,
1099
1124
  lineColor: "#1e88e5",
1100
1125
  tickColor: "#42a5f5",
1101
1126
  labelColor: "#90caf9",
@@ -1107,7 +1132,7 @@ const E = {
1107
1132
  borderColor: "rgba(30, 136, 229, 0.3)"
1108
1133
  },
1109
1134
  toolbar: {
1110
- ...ee,
1135
+ ...te,
1111
1136
  backgroundColor: "rgba(10, 22, 40, 0.2)",
1112
1137
  borderColor: "rgba(30, 136, 229, 0.15)"
1113
1138
  },
@@ -1116,7 +1141,7 @@ const E = {
1116
1141
  lineColor: "rgba(100, 180, 255, 0.6)"
1117
1142
  }
1118
1143
  };
1119
- function Di(s, e) {
1144
+ function Xi(s, e) {
1120
1145
  return {
1121
1146
  ...s,
1122
1147
  ...e,
@@ -1128,32 +1153,32 @@ function Di(s, e) {
1128
1153
  toolbar: { ...s.toolbar, ...e.toolbar }
1129
1154
  };
1130
1155
  }
1131
- function Te(s) {
1156
+ function Be(s) {
1132
1157
  switch (s) {
1133
1158
  case "dark":
1134
- return oe;
1159
+ return ae;
1135
1160
  case "midnight":
1136
- return lt;
1161
+ return dt;
1137
1162
  case "light":
1138
- return ht;
1163
+ return gt;
1139
1164
  case "electrochemistry":
1140
1165
  case "electrochem":
1141
- return ut;
1166
+ return mt;
1142
1167
  case "high-contrast":
1143
1168
  case "highContrast":
1144
- return ct;
1169
+ return ft;
1145
1170
  default:
1146
- return console.warn(`[Theme] Unknown theme "${s}", using dark`), oe;
1171
+ return console.warn(`[Theme] Unknown theme "${s}", using dark`), ae;
1147
1172
  }
1148
1173
  }
1149
- const dt = oe;
1150
- function O(s) {
1174
+ const yt = ae;
1175
+ function Y(s) {
1151
1176
  return Math.floor(s) + 0.5;
1152
1177
  }
1153
- function se(s) {
1178
+ function ne(s) {
1154
1179
  return Math.round(s);
1155
1180
  }
1156
- class gt {
1181
+ class pt {
1157
1182
  constructor(e, t) {
1158
1183
  g(this, "ctx");
1159
1184
  g(this, "theme");
@@ -1206,11 +1231,11 @@ class gt {
1206
1231
  fontFamily: n.fontFamily,
1207
1232
  color: n.color
1208
1233
  });
1209
- let c = 0, u = 0;
1210
- const h = n.align ?? "left";
1211
- h === "center" ? c = -l.width / 2 : h === "right" && (c = -l.width);
1212
- const d = n.baseline ?? "alphabetic";
1213
- d === "middle" ? u = -l.height / 2 + l.baseline : d === "top" || d === "hanging" ? u = l.baseline : d === "bottom" || d === "ideographic" ? u = -(l.height - l.baseline) : u = 0, r.render(e, o, c, u, {
1234
+ let h = 0, d = 0;
1235
+ const c = n.align ?? "left";
1236
+ c === "center" ? h = -l.width / 2 : c === "right" && (h = -l.width);
1237
+ const u = n.baseline ?? "alphabetic";
1238
+ u === "middle" ? d = -l.height / 2 + l.baseline : u === "top" || u === "hanging" ? d = l.baseline : u === "bottom" || u === "ideographic" ? d = -(l.height - l.baseline) : d = 0, r.render(e, o, h, d, {
1214
1239
  fontSize: n.fontSize,
1215
1240
  fontFamily: n.fontFamily,
1216
1241
  color: n.color
@@ -1236,22 +1261,22 @@ class gt {
1236
1261
  */
1237
1262
  drawGrid(e, t, i, n, o) {
1238
1263
  if (!this.theme.grid.visible) return;
1239
- const { ctx: r } = this, a = this.theme.grid, l = (n == null ? void 0 : n.tickCount) ?? 8, c = (o == null ? void 0 : o.tickCount) ?? 6, u = this.resolveGridXTicks(t, l), h = i.ticks(c);
1240
- if (r.strokeStyle = a.majorColor, r.lineWidth = a.majorWidth, r.setLineDash(a.majorDash), r.beginPath(), u.forEach((d) => {
1241
- const y = O(t.transform(d));
1242
- y >= e.x && y <= e.x + e.width && (r.moveTo(y, e.y), r.lineTo(y, e.y + e.height));
1243
- }), r.stroke(), r.beginPath(), h.forEach((d) => {
1244
- const y = O(i.transform(d));
1245
- y >= e.y && y <= e.y + e.height && (r.moveTo(e.x, y), r.lineTo(e.x + e.width, y));
1264
+ const { ctx: r } = this, a = this.theme.grid, l = (n == null ? void 0 : n.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d = this.resolveGridXTicks(t, l), c = i.ticks(h);
1265
+ if (r.strokeStyle = a.majorColor, r.lineWidth = a.majorWidth, r.setLineDash(a.majorDash), r.beginPath(), d.forEach((u) => {
1266
+ const m = Y(t.transform(u));
1267
+ m >= e.x && m <= e.x + e.width && (r.moveTo(m, e.y), r.lineTo(m, e.y + e.height));
1268
+ }), r.stroke(), r.beginPath(), c.forEach((u) => {
1269
+ const m = Y(i.transform(u));
1270
+ m >= e.y && m <= e.y + e.height && (r.moveTo(e.x, m), r.lineTo(e.x + e.width, m));
1246
1271
  }), r.stroke(), a.showMinor) {
1247
1272
  r.strokeStyle = a.minorColor, r.lineWidth = a.minorWidth, r.setLineDash(a.minorDash);
1248
- const d = this.generateMinorTicks(u, a.minorDivisions), y = this.generateMinorTicks(h, a.minorDivisions);
1249
- r.beginPath(), d.forEach((f) => {
1250
- const m = O(t.transform(f));
1251
- m >= e.x && m <= e.x + e.width && (r.moveTo(m, e.y), r.lineTo(m, e.y + e.height));
1252
- }), r.stroke(), r.beginPath(), y.forEach((f) => {
1253
- const m = O(i.transform(f));
1254
- m >= e.y && m <= e.y + e.height && (r.moveTo(e.x, m), r.lineTo(e.x + e.width, m));
1273
+ const u = this.generateMinorTicks(d, a.minorDivisions), m = this.generateMinorTicks(c, a.minorDivisions);
1274
+ r.beginPath(), u.forEach((f) => {
1275
+ const y = Y(t.transform(f));
1276
+ y >= e.x && y <= e.x + e.width && (r.moveTo(y, e.y), r.lineTo(y, e.y + e.height));
1277
+ }), r.stroke(), r.beginPath(), m.forEach((f) => {
1278
+ const y = Y(i.transform(f));
1279
+ y >= e.y && y <= e.y + e.height && (r.moveTo(e.x, y), r.lineTo(e.x + e.width, y));
1255
1280
  }), r.stroke();
1256
1281
  }
1257
1282
  r.setLineDash([]);
@@ -1261,28 +1286,28 @@ class gt {
1261
1286
  */
1262
1287
  drawPolarGrid(e, t, i, n = 5, o = 12, r = "degrees") {
1263
1288
  if (!this.theme.grid.visible) return;
1264
- const { ctx: a } = this, l = this.theme.grid, c = t.transform(0), u = i.transform(0), h = [
1289
+ const { ctx: a } = this, l = this.theme.grid, h = t.transform(0), d = i.transform(0), c = [
1265
1290
  { x: e.x, y: e.y },
1266
1291
  { x: e.x + e.width, y: e.y },
1267
1292
  { x: e.x, y: e.y + e.height },
1268
1293
  { x: e.x + e.width, y: e.y + e.height }
1269
1294
  ];
1270
- let d = 0;
1271
- for (const f of h) {
1272
- const m = Math.sqrt(Math.pow(f.x - c, 2) + Math.pow(f.y - u, 2));
1273
- d = Math.max(d, m);
1295
+ let u = 0;
1296
+ for (const f of c) {
1297
+ const y = Math.sqrt(Math.pow(f.x - h, 2) + Math.pow(f.y - d, 2));
1298
+ u = Math.max(u, y);
1274
1299
  }
1275
1300
  a.save(), a.beginPath(), a.rect(e.x, e.y, e.width, e.height), a.clip(), a.strokeStyle = l.majorColor, a.lineWidth = l.majorWidth, a.setLineDash(l.majorDash);
1276
1301
  for (let f = 1; f <= n; f++) {
1277
- const m = f / n * d;
1278
- a.beginPath(), a.arc(c, u, m, 0, 2 * Math.PI), a.stroke();
1302
+ const y = f / n * u;
1303
+ a.beginPath(), a.arc(h, d, y, 0, 2 * Math.PI), a.stroke();
1279
1304
  }
1280
- const y = r === "degrees" ? 360 / o * (Math.PI / 180) : 2 * Math.PI / o;
1305
+ const m = r === "degrees" ? 360 / o * (Math.PI / 180) : 2 * Math.PI / o;
1281
1306
  for (let f = 0; f < o; f++) {
1282
- const m = f * y;
1283
- a.beginPath(), a.moveTo(c, u), a.lineTo(
1284
- c + d * Math.cos(m),
1285
- u - d * Math.sin(m)
1307
+ const y = f * m;
1308
+ a.beginPath(), a.moveTo(h, d), a.lineTo(
1309
+ h + u * Math.cos(y),
1310
+ d - u * Math.sin(y)
1286
1311
  // Subtract because Canvas Y is inverted
1287
1312
  ), a.stroke();
1288
1313
  }
@@ -1292,46 +1317,46 @@ class gt {
1292
1317
  * Draw X axis with ticks and labels
1293
1318
  */
1294
1319
  drawXAxis(e, t, i, n) {
1295
- const { ctx: o } = this, r = this.theme.xAxis, a = (i == null ? void 0 : i.tickCount) ?? 8, l = this.resolveXTicks(t, a), c = O(e.y + e.height), u = i == null ? void 0 : i.label, h = (i == null ? void 0 : i.showLine) !== !1, d = (i == null ? void 0 : i.showTicks) !== !1, y = (i == null ? void 0 : i.showLabels) !== !1, f = t.domain[1] - t.domain[0];
1296
- if (h && (o.strokeStyle = r.lineColor, o.lineWidth = r.lineWidth, o.beginPath(), o.moveTo(e.x, c), o.lineTo(e.x + e.width, c), o.stroke()), d || y) {
1320
+ const { ctx: o } = this, r = this.theme.xAxis, a = (i == null ? void 0 : i.tickCount) ?? 8, l = this.resolveXTicks(t, a), h = Y(e.y + e.height), d = i == null ? void 0 : i.label, c = (i == null ? void 0 : i.showLine) !== !1, u = (i == null ? void 0 : i.showTicks) !== !1, m = (i == null ? void 0 : i.showLabels) !== !1, f = t.domain[1] - t.domain[0];
1321
+ if (c && (o.strokeStyle = r.lineColor, o.lineWidth = r.lineWidth, o.beginPath(), o.moveTo(e.x, h), o.lineTo(e.x + e.width, h), o.stroke()), u || m) {
1297
1322
  o.fillStyle = r.labelColor, o.font = `${r.labelSize}px ${r.fontFamily}`;
1298
- const m = [];
1299
- for (const p of l) {
1300
- const M = se(t.transform(p));
1323
+ const y = [];
1324
+ for (const x of l) {
1325
+ const M = ne(t.transform(x));
1301
1326
  if (M >= e.x && M <= e.x + e.width) {
1302
- const S = y ? this.formatXTick(p, i, f) : "";
1303
- (!y || S) && m.push({ tick: p, x: M, label: S });
1327
+ const S = m ? this.formatXTick(x, i, f) : "";
1328
+ (!m || S) && y.push({ tick: x, x: M, label: S });
1304
1329
  }
1305
1330
  }
1306
- let x = !1;
1307
- if (y && m.length > 1) {
1308
- let p = 0;
1309
- for (const S of m)
1310
- p = Math.max(p, o.measureText(S.label).width);
1331
+ let p = !1;
1332
+ if (m && y.length > 1) {
1333
+ let x = 0;
1334
+ for (const S of y)
1335
+ x = Math.max(x, o.measureText(S.label).width);
1311
1336
  let M = 1 / 0;
1312
- for (let S = 1; S < m.length; S++)
1313
- M = Math.min(M, m[S].x - m[S - 1].x);
1314
- x = p + 8 > M;
1337
+ for (let S = 1; S < y.length; S++)
1338
+ M = Math.min(M, y[S].x - y[S - 1].x);
1339
+ p = x + 8 > M;
1315
1340
  }
1316
- const b = c + r.tickLength + (x ? 6 : 3), v = x ? -Math.PI / 4 : void 0;
1317
- for (const p of m)
1318
- d && (o.strokeStyle = r.tickColor, o.beginPath(), o.moveTo(p.x, c), o.lineTo(p.x, c + r.tickLength), o.stroke()), y && p.label && this.drawLatexOrText(
1319
- p.label,
1320
- p.x,
1341
+ const b = h + r.tickLength + (p ? 6 : 3), v = p ? -Math.PI / 4 : void 0;
1342
+ for (const x of y)
1343
+ u && (o.strokeStyle = r.tickColor, o.beginPath(), o.moveTo(x.x, h), o.lineTo(x.x, h + r.tickLength), o.stroke()), m && x.label && this.drawLatexOrText(
1344
+ x.label,
1345
+ x.x,
1321
1346
  b,
1322
1347
  {
1323
1348
  fontSize: r.labelSize,
1324
1349
  fontFamily: r.fontFamily,
1325
1350
  color: r.labelColor,
1326
- align: x ? "right" : "center",
1327
- baseline: x ? "middle" : "top",
1351
+ align: p ? "right" : "center",
1352
+ baseline: p ? "middle" : "top",
1328
1353
  rotation: v
1329
1354
  }
1330
1355
  );
1331
1356
  }
1332
- if (u) {
1333
- const m = (n == null ? void 0 : n.titleGap) ?? 45;
1334
- this.drawLatexOrText(u, e.x + e.width / 2, e.y + e.height + m, {
1357
+ if (d) {
1358
+ const y = (n == null ? void 0 : n.titleGap) ?? 45;
1359
+ this.drawLatexOrText(d, e.x + e.width / 2, e.y + e.height + y, {
1335
1360
  fontSize: r.titleSize,
1336
1361
  fontFamily: r.fontFamily,
1337
1362
  color: r.titleColor,
@@ -1344,12 +1369,12 @@ class gt {
1344
1369
  * Draw Y axis with ticks and labels
1345
1370
  */
1346
1371
  drawYAxis(e, t, i, n = "left", o = 0, r) {
1347
- const { ctx: a } = this, l = this.theme.yAxis, c = (i == null ? void 0 : i.tickCount) ?? 6, u = t.ticks(c), h = i == null ? void 0 : i.label, d = (i == null ? void 0 : i.showLine) !== !1, y = (i == null ? void 0 : i.showTicks) !== !1, f = (i == null ? void 0 : i.showLabels) !== !1, m = O(n === "left" ? e.x - o : e.x + e.width + o), x = n === "left" ? -1 : 1;
1348
- if (d && (a.strokeStyle = l.lineColor, a.lineWidth = l.lineWidth, a.beginPath(), a.moveTo(m, e.y), a.lineTo(m, e.y + e.height), a.stroke()), (y || f) && (a.fillStyle = l.labelColor, a.font = `${l.labelSize}px ${l.fontFamily}`, a.textAlign = n === "left" ? "right" : "left", a.textBaseline = "middle", u.forEach((b) => {
1349
- const v = se(t.transform(b));
1350
- if (v >= e.y && v <= e.y + e.height && (y && (a.strokeStyle = l.tickColor, a.beginPath(), a.moveTo(m, v), a.lineTo(m + l.tickLength * x, v), a.stroke()), f)) {
1351
- const p = m + (l.tickLength + 3) * x;
1352
- this.drawLatexOrText(this.formatYTick(b, i), p, v, {
1372
+ const { ctx: a } = this, l = this.theme.yAxis, h = (i == null ? void 0 : i.tickCount) ?? 6, d = t.ticks(h), c = i == null ? void 0 : i.label, u = (i == null ? void 0 : i.showLine) !== !1, m = (i == null ? void 0 : i.showTicks) !== !1, f = (i == null ? void 0 : i.showLabels) !== !1, y = Y(n === "left" ? e.x - o : e.x + e.width + o), p = n === "left" ? -1 : 1;
1373
+ if (u && (a.strokeStyle = l.lineColor, a.lineWidth = l.lineWidth, a.beginPath(), a.moveTo(y, e.y), a.lineTo(y, e.y + e.height), a.stroke()), (m || f) && (a.fillStyle = l.labelColor, a.font = `${l.labelSize}px ${l.fontFamily}`, a.textAlign = n === "left" ? "right" : "left", a.textBaseline = "middle", d.forEach((b) => {
1374
+ const v = ne(t.transform(b));
1375
+ if (v >= e.y && v <= e.y + e.height && (m && (a.strokeStyle = l.tickColor, a.beginPath(), a.moveTo(y, v), a.lineTo(y + l.tickLength * p, v), a.stroke()), f)) {
1376
+ const x = y + (l.tickLength + 3) * p;
1377
+ this.drawLatexOrText(this.formatYTick(b, i), x, v, {
1353
1378
  fontSize: l.labelSize,
1354
1379
  fontFamily: l.fontFamily,
1355
1380
  color: l.labelColor,
@@ -1357,9 +1382,9 @@ class gt {
1357
1382
  baseline: "middle"
1358
1383
  });
1359
1384
  }
1360
- })), h) {
1361
- const b = (r == null ? void 0 : r.titleGap) ?? 50, v = n === "left" ? m - b : m + b, p = e.y + e.height / 2;
1362
- this.drawLatexOrText(h, v, p, {
1385
+ })), c) {
1386
+ const b = (r == null ? void 0 : r.titleGap) ?? 50, v = n === "left" ? y - b : y + b, x = e.y + e.height / 2;
1387
+ this.drawLatexOrText(c, v, x, {
1363
1388
  fontSize: l.titleSize,
1364
1389
  fontFamily: l.fontFamily,
1365
1390
  color: l.titleColor,
@@ -1380,14 +1405,14 @@ class gt {
1380
1405
  * Draw chart title
1381
1406
  */
1382
1407
  drawChartTitle(e, t) {
1383
- var y, f;
1408
+ var m, f;
1384
1409
  if (!t.visible || !t.text) return;
1385
1410
  const { ctx: i } = this, n = t.fontSize ?? 16, o = t.fontFamily ?? "Inter, system-ui, sans-serif", r = t.fontWeight ?? 600, a = t.color ?? "#ffffff";
1386
1411
  i.save(), i.font = `${r} ${n}px ${o}`, i.fillStyle = a, i.textAlign = t.align ?? "center", i.textBaseline = t.position === "bottom" ? "top" : "bottom";
1387
- let l, c;
1412
+ let l, h;
1388
1413
  t.align === "left" ? l = e.x : t.align === "right" ? l = e.x + e.width : l = e.x + e.width / 2;
1389
- const u = typeof t.padding == "number" ? t.padding : 10, h = ((y = t.padding) == null ? void 0 : y.top) ?? u, d = ((f = t.padding) == null ? void 0 : f.bottom) ?? u;
1390
- t.position === "bottom" ? c = e.y + e.height + 45 + h : c = e.y - d, this.drawLatexOrText(t.text, l, c, {
1414
+ const d = typeof t.padding == "number" ? t.padding : 10, c = ((m = t.padding) == null ? void 0 : m.top) ?? d, u = ((f = t.padding) == null ? void 0 : f.bottom) ?? d;
1415
+ t.position === "bottom" ? h = e.y + e.height + 45 + c : h = e.y - u, this.drawLatexOrText(t.text, l, h, {
1391
1416
  fontSize: n,
1392
1417
  fontFamily: o,
1393
1418
  fontWeight: r,
@@ -1404,41 +1429,41 @@ class gt {
1404
1429
  const { ctx: i } = this, n = this.theme.legend;
1405
1430
  i.font = `${n.fontSize}px ${n.fontFamily}`;
1406
1431
  let o = 0;
1407
- const r = t.map((d) => {
1408
- const y = d.getId(), f = d.getStyle(), m = this.latexAPI && (y.includes("\\") || y.includes("^") || y.includes("_"));
1409
- let x = 0;
1410
- return m ? x = this.latexAPI.measure(y, { fontSize: n.fontSize }).width : x = i.measureText(y).width, o = Math.max(o, x), {
1411
- id: d.getId(),
1432
+ const r = t.map((u) => {
1433
+ const m = u.getId(), f = u.getStyle(), y = this.latexAPI && (m.includes("\\") || m.includes("^") || m.includes("_"));
1434
+ let p = 0;
1435
+ return y ? p = this.latexAPI.measure(m, { fontSize: n.fontSize }).width : p = i.measureText(m).width, o = Math.max(o, p), {
1436
+ id: u.getId(),
1412
1437
  color: f.color ?? "#ff0055",
1413
- label: y,
1414
- type: d.getType(),
1438
+ label: m,
1439
+ type: u.getType(),
1415
1440
  symbol: f.symbol,
1416
1441
  opacity: f.opacity ?? 1
1417
1442
  };
1418
1443
  }), a = n.swatchSize + 8 + o + n.padding * 2, l = r.length * (n.swatchSize + n.itemGap) - n.itemGap + n.padding * 2;
1419
- let c, u;
1444
+ let h, d;
1420
1445
  switch (n.position) {
1421
1446
  case "top-left":
1422
- c = e.x + 10, u = e.y + 10;
1447
+ h = e.x + 10, d = e.y + 10;
1423
1448
  break;
1424
1449
  case "bottom-left":
1425
- c = e.x + 10, u = e.y + 10;
1450
+ h = e.x + 10, d = e.y + 10;
1426
1451
  break;
1427
1452
  case "bottom-right":
1428
- c = e.x + e.width - a - 10, u = e.y + e.height - l - 10;
1453
+ h = e.x + e.width - a - 10, d = e.y + e.height - l - 10;
1429
1454
  break;
1430
1455
  case "top-right":
1431
1456
  default:
1432
- c = e.x + e.width - a - 10, u = e.y + 10;
1457
+ h = e.x + e.width - a - 10, d = e.y + 10;
1433
1458
  break;
1434
1459
  }
1435
1460
  i.fillStyle = n.backgroundColor, i.strokeStyle = n.borderColor, i.lineWidth = 1, i.beginPath();
1436
- const h = n.borderRadius;
1437
- i.moveTo(c + h, u), i.lineTo(c + a - h, u), i.arcTo(c + a, u, c + a, u + h, h), i.lineTo(c + a, u + l - h), i.arcTo(c + a, u + l, c + a - h, u + l, h), i.lineTo(c + h, u + l), i.arcTo(c, u + l, c, u + l - h, h), i.lineTo(c, u + h), i.arcTo(c, u, c + h, u, h), i.closePath(), i.fill(), i.stroke(), i.textAlign = "left", i.textBaseline = "middle", r.forEach((d, y) => {
1438
- const f = u + n.padding + y * (n.swatchSize + n.itemGap), m = c + n.padding, x = f + n.swatchSize / 2, b = m + n.swatchSize / 2;
1439
- i.save(), i.globalAlpha = d.opacity, i.fillStyle = d.color, i.strokeStyle = d.color, i.lineWidth = 2;
1440
- const v = n.swatchSize, p = String(d.type).toLowerCase(), M = !!d.symbol && d.symbol !== "circle", S = p === "scatter" || p === "1" || p === "line" && M, w = p.includes("scatter") || p === "2";
1441
- S ? this.drawLegendSymbol(i, d.symbol ?? "circle", b, x, v * 0.9) : w ? (i.beginPath(), i.moveTo(m, x), i.lineTo(m + v, x), i.stroke(), this.drawLegendSymbol(i, d.symbol ?? "circle", b, x, v * 0.6)) : (i.beginPath(), i.moveTo(m, x), i.lineTo(m + v, x), i.stroke()), i.restore(), this.drawLatexOrText(d.label, c + n.padding + n.swatchSize + 8, x, {
1461
+ const c = n.borderRadius;
1462
+ i.moveTo(h + c, d), i.lineTo(h + a - c, d), i.arcTo(h + a, d, h + a, d + c, c), i.lineTo(h + a, d + l - c), i.arcTo(h + a, d + l, h + a - c, d + l, c), i.lineTo(h + c, d + l), i.arcTo(h, d + l, h, d + l - c, c), i.lineTo(h, d + c), i.arcTo(h, d, h + c, d, c), i.closePath(), i.fill(), i.stroke(), i.textAlign = "left", i.textBaseline = "middle", r.forEach((u, m) => {
1463
+ const f = d + n.padding + m * (n.swatchSize + n.itemGap), y = h + n.padding, p = f + n.swatchSize / 2, b = y + n.swatchSize / 2;
1464
+ i.save(), i.globalAlpha = u.opacity, i.fillStyle = u.color, i.strokeStyle = u.color, i.lineWidth = 2;
1465
+ const v = n.swatchSize, x = String(u.type).toLowerCase(), M = !!u.symbol && u.symbol !== "circle", S = x === "scatter" || x === "1" || x === "line" && M, w = x.includes("scatter") || x === "2";
1466
+ S ? this.drawLegendSymbol(i, u.symbol ?? "circle", b, p, v * 0.9) : w ? (i.beginPath(), i.moveTo(y, p), i.lineTo(y + v, p), i.stroke(), this.drawLegendSymbol(i, u.symbol ?? "circle", b, p, v * 0.6)) : (i.beginPath(), i.moveTo(y, p), i.lineTo(y + v, p), i.stroke()), i.restore(), this.drawLatexOrText(u.label, h + n.padding + n.swatchSize + 8, p, {
1442
1467
  fontSize: n.fontSize,
1443
1468
  fontFamily: n.fontFamily,
1444
1469
  color: n.textColor,
@@ -1508,33 +1533,33 @@ class gt {
1508
1533
  */
1509
1534
  drawTooltip(e, t, i, n) {
1510
1535
  const { ctx: o } = this, r = this.theme.cursor, a = i.split(`
1511
- `), l = r.tooltipSize + 5, c = 8;
1512
- let u = 0;
1513
- const h = [];
1536
+ `), l = r.tooltipSize + 5, h = 8;
1514
1537
  let d = 0;
1515
- a.forEach((p) => {
1516
- if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
1517
- const S = this.latexAPI.measure(p, { fontSize: r.tooltipSize });
1518
- u = Math.max(u, S.width);
1538
+ const c = [];
1539
+ let u = 0;
1540
+ a.forEach((x) => {
1541
+ if (!!this.latexAPI && (x.includes("\\") || x.includes("^") || x.includes("_") || x.includes("{") && x.includes("}"))) {
1542
+ const S = this.latexAPI.measure(x, { fontSize: r.tooltipSize });
1543
+ d = Math.max(d, S.width);
1519
1544
  const w = Math.max(l, S.height);
1520
- h.push(w), d += w;
1545
+ c.push(w), u += w;
1521
1546
  } else
1522
- u = Math.max(u, o.measureText(p).width), h.push(l), d += l;
1547
+ d = Math.max(d, o.measureText(x).width), c.push(l), u += l;
1523
1548
  });
1524
- const y = u + c * 2, f = d + c * 2 - 4;
1525
- let m = e + 15, x = t - f - 10;
1526
- m + y > n.x + n.width && (m = e - y - 15), x < n.y && (x = t + 15), o.fillStyle = r.tooltipBackground, o.strokeStyle = r.tooltipBorder, o.lineWidth = 1, o.beginPath();
1549
+ const m = d + h * 2, f = u + h * 2 - 4;
1550
+ let y = e + 15, p = t - f - 10;
1551
+ y + m > n.x + n.width && (y = e - m - 15), p < n.y && (p = t + 15), o.fillStyle = r.tooltipBackground, o.strokeStyle = r.tooltipBorder, o.lineWidth = 1, o.beginPath();
1527
1552
  const b = 4;
1528
- o.moveTo(m + b, x), o.lineTo(m + y - b, x), o.arcTo(m + y, x, m + y, x + b, b), o.lineTo(m + y, x + f - b), o.arcTo(m + y, x + f, m + y - b, x + f, b), o.lineTo(m + b, x + f), o.arcTo(m, x + f, m, x + f - b, b), o.lineTo(m, x + b), o.arcTo(m, x, m + b, x, b), o.closePath(), o.fill(), o.stroke();
1529
- let v = x + c;
1530
- a.forEach((p, M) => {
1531
- this.drawLatexOrText(p, m + c, v, {
1553
+ o.moveTo(y + b, p), o.lineTo(y + m - b, p), o.arcTo(y + m, p, y + m, p + b, b), o.lineTo(y + m, p + f - b), o.arcTo(y + m, p + f, y + m - b, p + f, b), o.lineTo(y + b, p + f), o.arcTo(y, p + f, y, p + f - b, b), o.lineTo(y, p + b), o.arcTo(y, p, y + b, p, b), o.closePath(), o.fill(), o.stroke();
1554
+ let v = p + h;
1555
+ a.forEach((x, M) => {
1556
+ this.drawLatexOrText(x, y + h, v, {
1532
1557
  fontSize: r.tooltipSize,
1533
1558
  fontFamily: this.theme.xAxis.fontFamily,
1534
1559
  color: r.tooltipColor,
1535
1560
  align: "left",
1536
1561
  baseline: "top"
1537
- }), v += h[M];
1562
+ }), v += c[M];
1538
1563
  });
1539
1564
  }
1540
1565
  /**
@@ -1542,47 +1567,47 @@ class gt {
1542
1567
  */
1543
1568
  drawCornerTooltip(e, t, i) {
1544
1569
  const { ctx: n } = this, o = this.theme.cursor, r = e.split(`
1545
- `), a = o.tooltipSize + 5, l = 8, c = 10;
1546
- let u = 0;
1547
- const h = [];
1570
+ `), a = o.tooltipSize + 5, l = 8, h = 10;
1548
1571
  let d = 0;
1549
- r.forEach((p) => {
1550
- if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
1551
- const S = this.latexAPI.measure(p, { fontSize: o.tooltipSize });
1552
- u = Math.max(u, S.width);
1572
+ const c = [];
1573
+ let u = 0;
1574
+ r.forEach((x) => {
1575
+ if (!!this.latexAPI && (x.includes("\\") || x.includes("^") || x.includes("_") || x.includes("{") && x.includes("}"))) {
1576
+ const S = this.latexAPI.measure(x, { fontSize: o.tooltipSize });
1577
+ d = Math.max(d, S.width);
1553
1578
  const w = Math.max(a, S.height);
1554
- h.push(w), d += w;
1579
+ c.push(w), u += w;
1555
1580
  } else
1556
- u = Math.max(u, n.measureText(p).width), h.push(a), d += a;
1581
+ d = Math.max(d, n.measureText(x).width), c.push(a), u += a;
1557
1582
  });
1558
- const y = u + l * 2, f = d + l * 2 - 4;
1559
- let m, x;
1583
+ const m = d + l * 2, f = u + l * 2 - 4;
1584
+ let y, p;
1560
1585
  switch (i) {
1561
1586
  case "top-left":
1562
- m = t.x + c, x = t.y + c;
1587
+ y = t.x + h, p = t.y + h;
1563
1588
  break;
1564
1589
  case "top-right":
1565
- m = t.x + t.width - y - c, x = t.y + c;
1590
+ y = t.x + t.width - m - h, p = t.y + h;
1566
1591
  break;
1567
1592
  case "bottom-left":
1568
- m = t.x + c, x = t.y + t.height - f - c;
1593
+ y = t.x + h, p = t.y + t.height - f - h;
1569
1594
  break;
1570
1595
  case "bottom-right":
1571
- m = t.x + t.width - y - c, x = t.y + t.height - f - c;
1596
+ y = t.x + t.width - m - h, p = t.y + t.height - f - h;
1572
1597
  break;
1573
1598
  }
1574
1599
  n.fillStyle = o.tooltipBackground, n.strokeStyle = o.tooltipBorder, n.lineWidth = 1, n.beginPath();
1575
1600
  const b = 4;
1576
- n.moveTo(m + b, x), n.lineTo(m + y - b, x), n.arcTo(m + y, x, m + y, x + b, b), n.lineTo(m + y, x + f - b), n.arcTo(m + y, x + f, m + y - b, x + f, b), n.lineTo(m + b, x + f), n.arcTo(m, x + f, m, x + f - b, b), n.lineTo(m, x + b), n.arcTo(m, x, m + b, x, b), n.closePath(), n.fill(), n.stroke();
1577
- let v = x + l;
1578
- r.forEach((p, M) => {
1579
- this.drawLatexOrText(p, m + l, v, {
1601
+ n.moveTo(y + b, p), n.lineTo(y + m - b, p), n.arcTo(y + m, p, y + m, p + b, b), n.lineTo(y + m, p + f - b), n.arcTo(y + m, p + f, y + m - b, p + f, b), n.lineTo(y + b, p + f), n.arcTo(y, p + f, y, p + f - b, b), n.lineTo(y, p + b), n.arcTo(y, p, y + b, p, b), n.closePath(), n.fill(), n.stroke();
1602
+ let v = p + l;
1603
+ r.forEach((x, M) => {
1604
+ this.drawLatexOrText(x, y + l, v, {
1580
1605
  fontSize: o.tooltipSize,
1581
1606
  fontFamily: this.theme.xAxis.fontFamily,
1582
1607
  color: o.tooltipColor,
1583
1608
  align: "left",
1584
1609
  baseline: "top"
1585
- }), v += h[M];
1610
+ }), v += c[M];
1586
1611
  });
1587
1612
  }
1588
1613
  /**
@@ -1599,20 +1624,20 @@ class gt {
1599
1624
  if (!t.hasErrorData()) return;
1600
1625
  const { ctx: o } = this, r = t.getData(), a = t.getStyle(), l = a.errorBars ?? {};
1601
1626
  if (l.visible === !1) return;
1602
- const c = l.color ?? a.color ?? "#ff0055", u = l.width ?? 1, h = l.capWidth ?? 6, d = l.showCaps !== !1, y = l.opacity ?? 0.7, f = l.direction ?? "both";
1603
- o.save(), o.beginPath(), o.rect(e.x, e.y, e.width, e.height), o.clip(), o.strokeStyle = c, o.lineWidth = u, o.globalAlpha = y;
1604
- for (let m = 0; m < r.x.length; m++) {
1605
- const x = i.transform(r.x[m]), b = n.transform(r.y[m]);
1606
- if (x < e.x || x > e.x + e.width || b < e.y || b > e.y + e.height) continue;
1607
- const v = t.getYError(m);
1627
+ const h = l.color ?? a.color ?? "#ff0055", d = l.width ?? 1, c = l.capWidth ?? 6, u = l.showCaps !== !1, m = l.opacity ?? 0.7, f = l.direction ?? "both";
1628
+ o.save(), o.beginPath(), o.rect(e.x, e.y, e.width, e.height), o.clip(), o.strokeStyle = h, o.lineWidth = d, o.globalAlpha = m;
1629
+ for (let y = 0; y < r.x.length; y++) {
1630
+ const p = i.transform(r.x[y]), b = n.transform(r.y[y]);
1631
+ if (p < e.x || p > e.x + e.width || b < e.y || b > e.y + e.height) continue;
1632
+ const v = t.getYError(y);
1608
1633
  if (v) {
1609
- const [M, S] = v, w = r.y[m], C = n.transform(w + S), k = n.transform(w - M);
1610
- o.beginPath(), (f === "both" || f === "positive") && (o.moveTo(x, b), o.lineTo(x, C), d && (o.moveTo(x - h / 2, C), o.lineTo(x + h / 2, C))), (f === "both" || f === "negative") && (o.moveTo(x, b), o.lineTo(x, k), d && (o.moveTo(x - h / 2, k), o.lineTo(x + h / 2, k))), o.stroke();
1634
+ const [M, S] = v, w = r.y[y], C = n.transform(w + S), k = n.transform(w - M);
1635
+ o.beginPath(), (f === "both" || f === "positive") && (o.moveTo(p, b), o.lineTo(p, C), u && (o.moveTo(p - c / 2, C), o.lineTo(p + c / 2, C))), (f === "both" || f === "negative") && (o.moveTo(p, b), o.lineTo(p, k), u && (o.moveTo(p - c / 2, k), o.lineTo(p + c / 2, k))), o.stroke();
1611
1636
  }
1612
- const p = t.getXError(m);
1613
- if (p) {
1614
- const [M, S] = p, w = r.x[m], C = i.transform(w + S), k = i.transform(w - M);
1615
- o.beginPath(), (f === "both" || f === "positive") && (o.moveTo(x, b), o.lineTo(C, b), d && (o.moveTo(C, b - h / 2), o.lineTo(C, b + h / 2))), (f === "both" || f === "negative") && (o.moveTo(x, b), o.lineTo(k, b), d && (o.moveTo(k, b - h / 2), o.lineTo(k, b + h / 2))), o.stroke();
1637
+ const x = t.getXError(y);
1638
+ if (x) {
1639
+ const [M, S] = x, w = r.x[y], C = i.transform(w + S), k = i.transform(w - M);
1640
+ o.beginPath(), (f === "both" || f === "positive") && (o.moveTo(p, b), o.lineTo(C, b), u && (o.moveTo(C, b - c / 2), o.lineTo(C, b + c / 2))), (f === "both" || f === "negative") && (o.moveTo(p, b), o.lineTo(k, b), u && (o.moveTo(k, b - c / 2), o.lineTo(k, b + c / 2))), o.stroke();
1616
1641
  }
1617
1642
  }
1618
1643
  o.restore();
@@ -1631,27 +1656,27 @@ class gt {
1631
1656
  return i;
1632
1657
  }
1633
1658
  formatXTick(e, t, i) {
1634
- return _e(e, t, i, this.businessDayMapping);
1659
+ return $e(e, t, i, this.businessDayMapping);
1635
1660
  }
1636
1661
  formatYTick(e, t) {
1637
- return Ve(e, t);
1662
+ return He(e, t);
1638
1663
  }
1639
1664
  /** Draw buy/sell markers on candlestick series (Stage 2.14). */
1640
1665
  drawCandlestickMarkers(e, t, i, n) {
1641
- var d;
1642
- const o = ((d = t.getMarkers) == null ? void 0 : d.call(t)) ?? [];
1666
+ var u;
1667
+ const o = ((u = t.getMarkers) == null ? void 0 : u.call(t)) ?? [];
1643
1668
  if (!o.length || t.getType() !== "candlestick") return;
1644
- const r = t.getData(), a = this.ctx, l = r.x, c = r.high ?? r.y, u = r.low ?? r.y, h = r.close ?? r.y;
1645
- for (const y of o) {
1669
+ const r = t.getData(), a = this.ctx, l = r.x, h = r.high ?? r.y, d = r.low ?? r.y, c = r.close ?? r.y;
1670
+ for (const m of o) {
1646
1671
  const f = (() => {
1647
- let S = 0, w = Math.abs(l[0] - y.time);
1672
+ let S = 0, w = Math.abs(l[0] - m.time);
1648
1673
  for (let C = 1; C < l.length; C++) {
1649
- const k = Math.abs(l[C] - y.time);
1674
+ const k = Math.abs(l[C] - m.time);
1650
1675
  k < w && (w = k, S = C);
1651
1676
  }
1652
1677
  return S;
1653
- })(), m = y.position ?? "aboveBar", x = m === "belowBar" ? u[f] : m === "inBar" ? h[f] : c[f], b = e.x + i.transform(l[f]), v = e.y + n.transform(x), p = y.color ?? "#22c55e", M = m === "belowBar" ? 10 : -10;
1654
- a.save(), a.fillStyle = p, a.strokeStyle = p, a.lineWidth = 1.5, y.shape === "arrowDown" ? (a.beginPath(), a.moveTo(b, v - M), a.lineTo(b - 5, v - M - 8), a.lineTo(b + 5, v - M - 8), a.closePath(), a.fill()) : y.shape === "circle" ? (a.beginPath(), a.arc(b, v + M, 4, 0, Math.PI * 2), a.fill()) : (a.beginPath(), a.moveTo(b, v + M), a.lineTo(b - 5, v + M + 8), a.lineTo(b + 5, v + M + 8), a.closePath(), a.fill()), y.text && (a.font = "10px sans-serif", a.textAlign = "center", a.fillText(y.text, b, v + M + (m === "belowBar" ? 20 : -14))), a.restore();
1678
+ })(), y = m.position ?? "aboveBar", p = y === "belowBar" ? d[f] : y === "inBar" ? c[f] : h[f], b = e.x + i.transform(l[f]), v = e.y + n.transform(p), x = m.color ?? "#22c55e", M = y === "belowBar" ? 10 : -10;
1679
+ a.save(), a.fillStyle = x, a.strokeStyle = x, a.lineWidth = 1.5, m.shape === "arrowDown" ? (a.beginPath(), a.moveTo(b, v - M), a.lineTo(b - 5, v - M - 8), a.lineTo(b + 5, v - M - 8), a.closePath(), a.fill()) : m.shape === "circle" ? (a.beginPath(), a.arc(b, v + M, 4, 0, Math.PI * 2), a.fill()) : (a.beginPath(), a.moveTo(b, v + M), a.lineTo(b - 5, v + M + 8), a.lineTo(b + 5, v + M + 8), a.closePath(), a.fill()), m.text && (a.font = "10px sans-serif", a.textAlign = "center", a.fillText(m.text, b, v + M + (y === "belowBar" ? 20 : -14))), a.restore();
1655
1680
  }
1656
1681
  }
1657
1682
  /** Horizontal dashed lines for active price alerts (Stage 2.19). */
@@ -1660,13 +1685,13 @@ class gt {
1660
1685
  const { ctx: n } = this;
1661
1686
  n.save();
1662
1687
  for (const o of t) {
1663
- const r = se(i.transform(o.price));
1688
+ const r = ne(i.transform(o.price));
1664
1689
  r < e.y || r > e.y + e.height || (n.strokeStyle = o.direction === "below" ? "rgba(239, 68, 68, 0.7)" : o.direction === "above" ? "rgba(34, 197, 94, 0.7)" : "rgba(250, 204, 21, 0.8)", n.lineWidth = 1, n.setLineDash([5, 4]), n.beginPath(), n.moveTo(e.x, r), n.lineTo(e.x + e.width, r), n.stroke());
1665
1690
  }
1666
1691
  n.setLineDash([]), n.restore();
1667
1692
  }
1668
1693
  }
1669
- class ft {
1694
+ class xt {
1670
1695
  constructor(e, t, i, n, o) {
1671
1696
  g(this, "container");
1672
1697
  g(this, "callbacks");
@@ -1731,41 +1756,41 @@ class ft {
1731
1756
  if (t.width <= 1 || t.height <= 1) return;
1732
1757
  e.preventDefault();
1733
1758
  const i = this.container.getBoundingClientRect(), n = e.clientX - i.left, o = e.clientY - i.top, r = this.getAxesLayout();
1734
- let a = !1, l = !1, c;
1735
- for (const P of r) {
1736
- let B;
1737
- if (P.position === "left" ? B = t.x - 65 - P.offset : B = t.x + t.width + P.offset, n >= B && n <= B + 65 && o >= t.y && o <= t.y + t.height) {
1738
- c = P.id, l = !0, a = !1;
1759
+ let a = !1, l = !1, h;
1760
+ for (const B of r) {
1761
+ let P;
1762
+ if (B.position === "left" ? P = t.x - 65 - B.offset : P = t.x + t.width + B.offset, n >= P && n <= P + 65 && o >= t.y && o <= t.y + t.height) {
1763
+ h = B.id, l = !0, a = !1;
1739
1764
  break;
1740
1765
  }
1741
1766
  }
1742
- if (!c)
1767
+ if (!h)
1743
1768
  if (o > t.y + t.height && n >= t.x && n <= t.x + t.width)
1744
1769
  a = !0;
1745
1770
  else if (n >= t.x && n <= t.x + t.width && o >= t.y && o <= t.y + t.height)
1746
1771
  a = !0, l = !0;
1747
1772
  else
1748
1773
  return;
1749
- const u = this.getBounds(c), h = e.deltaY > 0 ? 1.1 : 0.9, d = (n - t.x) / t.width, y = 1 - (o - t.y) / t.height, f = u.xMin + d * (u.xMax - u.xMin), m = u.yMin + y * (u.yMax - u.yMin), x = 1e-12, b = 1e15;
1750
- let v = a ? f - (f - u.xMin) * h : u.xMin, p = a ? f + (u.xMax - f) * h : u.xMax, M = l ? m - (m - u.yMin) * h : u.yMin, S = l ? m + (u.yMax - m) * h : u.yMax;
1751
- const w = p - v, C = S - M;
1752
- (w < x || w > b) && (v = u.xMin, p = u.xMax), (C < x || C > b) && (M = u.yMin, S = u.yMax);
1774
+ const d = this.getBounds(h), c = e.deltaY > 0 ? 1.1 : 0.9, u = (n - t.x) / t.width, m = 1 - (o - t.y) / t.height, f = d.xMin + u * (d.xMax - d.xMin), y = d.yMin + m * (d.yMax - d.yMin), p = 1e-12, b = 1e15;
1775
+ let v = a ? f - (f - d.xMin) * c : d.xMin, x = a ? f + (d.xMax - f) * c : d.xMax, M = l ? y - (y - d.yMin) * c : d.yMin, S = l ? y + (d.yMax - y) * c : d.yMax;
1776
+ const w = x - v, C = S - M;
1777
+ (w < p || w > b) && (v = d.xMin, x = d.xMax), (C < p || C > b) && (M = d.yMin, S = d.yMax);
1753
1778
  const k = {
1754
1779
  xMin: v,
1755
- xMax: p,
1780
+ xMax: x,
1756
1781
  yMin: M,
1757
1782
  yMax: S
1758
1783
  };
1759
- this.callbacks.onZoom(k, c);
1784
+ this.callbacks.onZoom(k, h);
1760
1785
  }
1761
1786
  handleMouseDown(e) {
1762
- var l, c, u, h, d, y, f, m, x, b;
1787
+ var l, h, d, c, u, m, f, y, p, b;
1763
1788
  const t = this.getPlotArea();
1764
1789
  if (t.width <= 1 || t.height <= 1) return;
1765
1790
  const i = this.container.getBoundingClientRect(), n = e.clientX - i.left, o = e.clientY - i.top;
1766
1791
  this.mouseDownPos = { x: n, y: o };
1767
1792
  const r = n >= t.x && n <= t.x + t.width && o >= t.y && o <= t.y + t.height;
1768
- if ((c = (l = this.callbacks).onInteraction) == null || c.call(l, {
1793
+ if ((h = (l = this.callbacks).onInteraction) == null || h.call(l, {
1769
1794
  type: "mousedown",
1770
1795
  pixelX: n,
1771
1796
  pixelY: o,
@@ -1778,20 +1803,20 @@ class ft {
1778
1803
  for (const v of a) {
1779
1804
  let M;
1780
1805
  if (v.position === "left" ? M = t.x - 65 - v.offset : M = t.x + t.width + v.offset, n >= M && n <= M + 65 && o >= t.y && o <= t.y + t.height) {
1781
- this.isDragging = !0, this.panningAxisId = v.id, this.lastMousePos = { x: e.clientX, y: e.clientY }, this.container.style.cursor = "ns-resize", (h = (u = this.callbacks).onDragStart) == null || h.call(u);
1806
+ this.isDragging = !0, this.panningAxisId = v.id, this.lastMousePos = { x: e.clientX, y: e.clientY }, this.container.style.cursor = "ns-resize", (c = (d = this.callbacks).onDragStart) == null || c.call(d);
1782
1807
  return;
1783
1808
  }
1784
1809
  }
1785
1810
  if (r)
1786
1811
  switch (this.mode) {
1787
1812
  case "pan":
1788
- this.isDragging = !0, this.panningAxisId = void 0, this.lastMousePos = { x: e.clientX, y: e.clientY }, this.container.style.cursor = "grabbing", (y = (d = this.callbacks).onDragStart) == null || y.call(d);
1813
+ this.isDragging = !0, this.panningAxisId = void 0, this.lastMousePos = { x: e.clientX, y: e.clientY }, this.container.style.cursor = "grabbing", (m = (u = this.callbacks).onDragStart) == null || m.call(u);
1789
1814
  break;
1790
1815
  case "boxZoom":
1791
- this.isBoxZooming = !0, this.selectionStart = { x: n, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxZoom({ x: n, y: o, width: 0, height: 0 }), (m = (f = this.callbacks).onDragStart) == null || m.call(f);
1816
+ this.isBoxZooming = !0, this.selectionStart = { x: n, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxZoom({ x: n, y: o, width: 0, height: 0 }), (y = (f = this.callbacks).onDragStart) == null || y.call(f);
1792
1817
  break;
1793
1818
  case "select":
1794
- this.isBoxSelecting = !0, this.selectionStart = { x: n, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxSelectStart && this.callbacks.onBoxSelectStart(n, o), (b = (x = this.callbacks).onDragStart) == null || b.call(x);
1819
+ this.isBoxSelecting = !0, this.selectionStart = { x: n, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxSelectStart && this.callbacks.onBoxSelectStart(n, o), (b = (p = this.callbacks).onDragStart) == null || b.call(p);
1795
1820
  break;
1796
1821
  case "delta":
1797
1822
  case "peak":
@@ -1816,14 +1841,14 @@ class ft {
1816
1841
  const a = e.clientX - this.lastMousePos.x, l = e.clientY - this.lastMousePos.y;
1817
1842
  this.callbacks.onPan(a, l, this.panningAxisId), this.lastMousePos = { x: e.clientX, y: e.clientY };
1818
1843
  } else if (this.isBoxZooming) {
1819
- const a = Math.min(this.selectionStart.x, i), l = Math.min(this.selectionStart.y, n), c = Math.abs(i - this.selectionStart.x), u = Math.abs(n - this.selectionStart.y);
1820
- this.callbacks.onBoxZoom({ x: a, y: l, width: c, height: u });
1844
+ const a = Math.min(this.selectionStart.x, i), l = Math.min(this.selectionStart.y, n), h = Math.abs(i - this.selectionStart.x), d = Math.abs(n - this.selectionStart.y);
1845
+ this.callbacks.onBoxZoom({ x: a, y: l, width: h, height: d });
1821
1846
  } else this.isBoxSelecting && this.callbacks.onBoxSelectUpdate && this.callbacks.onBoxSelectUpdate(i, n);
1822
1847
  }
1823
1848
  handleMouseUp(e) {
1824
- var c, u, h, d, y, f;
1849
+ var h, d, c, u, m, f;
1825
1850
  const t = this.container.getBoundingClientRect(), i = e.clientX - t.left, n = e.clientY - t.top;
1826
- if ((u = (c = this.callbacks).onInteraction) == null || u.call(c, {
1851
+ if ((d = (h = this.callbacks).onInteraction) == null || d.call(h, {
1827
1852
  type: "mouseup",
1828
1853
  pixelX: i,
1829
1854
  pixelY: n,
@@ -1837,17 +1862,17 @@ class ft {
1837
1862
  return;
1838
1863
  }
1839
1864
  if (this.isBoxZooming) {
1840
- const m = Math.min(this.selectionStart.x, i), x = Math.min(this.selectionStart.y, n), b = Math.abs(i - this.selectionStart.x), v = Math.abs(n - this.selectionStart.y);
1841
- b > 5 && v > 5 && this.callbacks.onBoxZoom({ x: m, y: x, width: b, height: v }), this.callbacks.onBoxZoom(null);
1865
+ const y = Math.min(this.selectionStart.x, i), p = Math.min(this.selectionStart.y, n), b = Math.abs(i - this.selectionStart.x), v = Math.abs(n - this.selectionStart.y);
1866
+ b > 5 && v > 5 && this.callbacks.onBoxZoom({ x: y, y: p, width: b, height: v }), this.callbacks.onBoxZoom(null);
1842
1867
  } else if (this.isBoxSelecting) {
1843
- const m = Math.min(this.selectionStart.x, i), x = Math.min(this.selectionStart.y, n), b = Math.abs(i - this.selectionStart.x), v = Math.abs(n - this.selectionStart.y);
1844
- this.callbacks.onBoxSelect && this.callbacks.onBoxSelect({ x: m, y: x, width: b, height: v }, e.shiftKey);
1868
+ const y = Math.min(this.selectionStart.x, i), p = Math.min(this.selectionStart.y, n), b = Math.abs(i - this.selectionStart.x), v = Math.abs(n - this.selectionStart.y);
1869
+ this.callbacks.onBoxSelect && this.callbacks.onBoxSelect({ x: y, y: p, width: b, height: v }, e.shiftKey);
1845
1870
  }
1846
1871
  const o = this.isDragging || this.isBoxSelecting || this.isBoxZooming, r = Math.hypot(
1847
1872
  i - this.mouseDownPos.x,
1848
1873
  n - this.mouseDownPos.y
1849
1874
  ), a = this.getPlotArea(), l = i >= a.x && i <= a.x + a.width && n >= a.y && n <= a.y + a.height;
1850
- r < 4 && l && !this.isBoxZooming && ((d = (h = this.callbacks).onPointClick) == null || d.call(h, i, n, e.ctrlKey, e.shiftKey)), this.isDragging = !1, this.panningAxisId = void 0, this.isBoxSelecting = !1, this.isBoxZooming = !1, this.container.style.cursor = "", o && ((f = (y = this.callbacks).onDragEnd) == null || f.call(y));
1875
+ r < 4 && l && !this.isBoxZooming && ((u = (c = this.callbacks).onPointClick) == null || u.call(c, i, n, e.ctrlKey, e.shiftKey)), this.isDragging = !1, this.panningAxisId = void 0, this.isBoxSelecting = !1, this.isBoxZooming = !1, this.container.style.cursor = "", o && ((f = (m = this.callbacks).onDragEnd) == null || f.call(m));
1851
1876
  }
1852
1877
  handleMouseLeave() {
1853
1878
  this.isDragging = !1, this.panningAxisId = void 0, this.container.style.cursor = "", this.callbacks.onCursorLeave();
@@ -1876,13 +1901,13 @@ class ft {
1876
1901
  const [o, r] = [e.touches[0], e.touches[1]], a = Math.hypot(
1877
1902
  r.clientX - o.clientX,
1878
1903
  r.clientY - o.clientY
1879
- ), l = this.pinchStartDistance / a, c = this.pinchStartBounds, u = (c.xMin + c.xMax) / 2, h = (c.yMin + c.yMax) / 2, d = (c.xMax - c.xMin) / 2 * l, y = (c.yMax - c.yMin) / 2 * l;
1904
+ ), l = this.pinchStartDistance / a, h = this.pinchStartBounds, d = (h.xMin + h.xMax) / 2, c = (h.yMin + h.yMax) / 2, u = (h.xMax - h.xMin) / 2 * l, m = (h.yMax - h.yMin) / 2 * l;
1880
1905
  this.callbacks.onZoom(
1881
1906
  {
1882
- xMin: u - d,
1883
- xMax: u + d,
1884
- yMin: h - y,
1885
- yMax: h + y
1907
+ xMin: d - u,
1908
+ xMax: d + u,
1909
+ yMin: c - m,
1910
+ yMax: c + m
1886
1911
  },
1887
1912
  this.panningAxisId
1888
1913
  );
@@ -1907,7 +1932,7 @@ class ft {
1907
1932
  this.detachListeners();
1908
1933
  }
1909
1934
  }
1910
- const mt = {
1935
+ const bt = {
1911
1936
  enabled: !0,
1912
1937
  hitRadius: 20,
1913
1938
  multiSelect: !0,
@@ -1918,7 +1943,7 @@ const mt = {
1918
1943
  ringWidth: 3
1919
1944
  }
1920
1945
  };
1921
- class yt {
1946
+ class vt {
1922
1947
  constructor(e, t) {
1923
1948
  g(this, "ctx");
1924
1949
  g(this, "config");
@@ -1927,7 +1952,7 @@ class yt {
1927
1952
  g(this, "isBoxSelecting", !1);
1928
1953
  g(this, "boxStart", null);
1929
1954
  g(this, "boxEnd", null);
1930
- this.ctx = e, this.config = { ...mt, ...t };
1955
+ this.ctx = e, this.config = { ...bt, ...t };
1931
1956
  }
1932
1957
  // ============================================
1933
1958
  // Configuration
@@ -1955,28 +1980,28 @@ class yt {
1955
1980
  const n = this.ctx.getPlotArea();
1956
1981
  if (e < n.x || e > n.x + n.width || t < n.y || t > n.y + n.height)
1957
1982
  return null;
1958
- const o = this.ctx.getXScale(), r = this.ctx.getYScales(), a = this.ctx.getSeries(), l = i ?? this.config.hitRadius, c = l * l;
1959
- let u = null, h = 1 / 0;
1960
- return a.forEach((d, y) => {
1961
- if (!d.isVisible()) return;
1962
- const f = d.getData();
1983
+ const o = this.ctx.getXScale(), r = this.ctx.getYScales(), a = this.ctx.getSeries(), l = i ?? this.config.hitRadius, h = l * l;
1984
+ let d = null, c = 1 / 0;
1985
+ return a.forEach((u, m) => {
1986
+ if (!u.isVisible()) return;
1987
+ const f = u.getData();
1963
1988
  if (f.x.length === 0) return;
1964
- const m = d.getYAxisId() || this.ctx.getPrimaryYAxisId(), x = r.get(m);
1965
- if (!x) return;
1966
- const b = o.invert(e), v = this.findNearestIndex(f.x, b), p = 50, M = Math.max(0, v - p), S = Math.min(f.x.length, v + p);
1989
+ const y = u.getYAxisId() || this.ctx.getPrimaryYAxisId(), p = r.get(y);
1990
+ if (!p) return;
1991
+ const b = o.invert(e), v = this.findNearestIndex(f.x, b), x = 50, M = Math.max(0, v - x), S = Math.min(f.x.length, v + x);
1967
1992
  for (let w = M; w < S; w++) {
1968
- const C = o.transform(f.x[w]), k = x.transform(f.y[w]), P = C - e, N = k - t, B = P * P + N * N;
1969
- B < h && B <= c && (h = B, u = {
1970
- seriesId: y,
1993
+ const C = o.transform(f.x[w]), k = p.transform(f.y[w]), B = C - e, z = k - t, P = B * B + z * z;
1994
+ P < c && P <= h && (c = P, d = {
1995
+ seriesId: m,
1971
1996
  index: w,
1972
1997
  x: f.x[w],
1973
1998
  y: f.y[w],
1974
- distance: Math.sqrt(B),
1999
+ distance: Math.sqrt(P),
1975
2000
  pixelX: C,
1976
2001
  pixelY: k
1977
2002
  });
1978
2003
  }
1979
- }), u;
2004
+ }), d;
1980
2005
  }
1981
2006
  /**
1982
2007
  * Hit-test all points within a rectangular region
@@ -1989,18 +2014,18 @@ class yt {
1989
2014
  if (!r.isVisible()) return;
1990
2015
  const l = r.getData();
1991
2016
  if (l.x.length === 0) return;
1992
- const c = r.getYAxisId() || this.ctx.getPrimaryYAxisId(), u = n.get(c);
1993
- if (u)
1994
- for (let h = 0; h < l.x.length; h++) {
1995
- const d = l.x[h], y = l.y[h];
1996
- d >= e.xMin && d <= e.xMax && y >= e.yMin && y <= e.yMax && t.push({
2017
+ const h = r.getYAxisId() || this.ctx.getPrimaryYAxisId(), d = n.get(h);
2018
+ if (d)
2019
+ for (let c = 0; c < l.x.length; c++) {
2020
+ const u = l.x[c], m = l.y[c];
2021
+ u >= e.xMin && u <= e.xMax && m >= e.yMin && m <= e.yMax && t.push({
1997
2022
  seriesId: a,
1998
- index: h,
1999
- x: d,
2000
- y,
2023
+ index: c,
2024
+ x: u,
2025
+ y: m,
2001
2026
  distance: 0,
2002
- pixelX: i.transform(d),
2003
- pixelY: u.transform(y)
2027
+ pixelX: i.transform(u),
2028
+ pixelY: d.transform(m)
2004
2029
  });
2005
2030
  }
2006
2031
  }), t;
@@ -2017,23 +2042,23 @@ class yt {
2017
2042
  t === "single" && this.selected.clear();
2018
2043
  const n = this.ctx.getSeries(), o = [];
2019
2044
  e.forEach(({ seriesId: a, indices: l }) => {
2020
- const c = n.get(a);
2021
- if (!c) return;
2022
- const u = c.getData();
2023
- let h = this.selected.get(a);
2024
- h || (h = /* @__PURE__ */ new Set(), this.selected.set(a, h)), l.forEach((d) => {
2025
- d < 0 || d >= u.x.length || (t === "remove" ? h.delete(d) : t === "toggle" ? h.has(d) ? h.delete(d) : (h.add(d), o.push({
2045
+ const h = n.get(a);
2046
+ if (!h) return;
2047
+ const d = h.getData();
2048
+ let c = this.selected.get(a);
2049
+ c || (c = /* @__PURE__ */ new Set(), this.selected.set(a, c)), l.forEach((u) => {
2050
+ u < 0 || u >= d.x.length || (t === "remove" ? c.delete(u) : t === "toggle" ? c.has(u) ? c.delete(u) : (c.add(u), o.push({
2026
2051
  seriesId: a,
2027
- index: d,
2028
- x: u.x[d],
2029
- y: u.y[d]
2030
- })) : (h.add(d), o.push({
2052
+ index: u,
2053
+ x: d.x[u],
2054
+ y: d.y[u]
2055
+ })) : (c.add(u), o.push({
2031
2056
  seriesId: a,
2032
- index: d,
2033
- x: u.x[d],
2034
- y: u.y[d]
2057
+ index: u,
2058
+ x: d.x[u],
2059
+ y: d.y[u]
2035
2060
  })));
2036
- }), h.size === 0 && this.selected.delete(a);
2061
+ }), c.size === 0 && this.selected.delete(a);
2037
2062
  });
2038
2063
  const r = this.getSelectedPoints();
2039
2064
  this.ctx.events.emit("pointSelect", {
@@ -2145,21 +2170,21 @@ class yt {
2145
2170
  this.cancelBoxSelection();
2146
2171
  return;
2147
2172
  }
2148
- const r = Math.min(this.boxStart.x, this.boxEnd.x), a = Math.max(this.boxStart.x, this.boxEnd.x), l = Math.min(this.boxStart.y, this.boxEnd.y), c = Math.max(this.boxStart.y, this.boxEnd.y), u = Math.max(r, t.x), h = Math.min(a, t.x + t.width), d = Math.max(l, t.y), y = Math.min(c, t.y + t.height), f = {
2149
- xMin: i.invert(u),
2150
- xMax: i.invert(h),
2151
- yMin: o.invert(y),
2173
+ const r = Math.min(this.boxStart.x, this.boxEnd.x), a = Math.max(this.boxStart.x, this.boxEnd.x), l = Math.min(this.boxStart.y, this.boxEnd.y), h = Math.max(this.boxStart.y, this.boxEnd.y), d = Math.max(r, t.x), c = Math.min(a, t.x + t.width), u = Math.max(l, t.y), m = Math.min(h, t.y + t.height), f = {
2174
+ xMin: i.invert(d),
2175
+ xMax: i.invert(c),
2176
+ yMin: o.invert(m),
2152
2177
  // Y is inverted
2153
- yMax: o.invert(d)
2154
- }, m = this.hitTestRegion(f);
2155
- if (m.length > 0) {
2156
- const x = /* @__PURE__ */ new Map();
2157
- m.forEach((p) => {
2158
- let M = x.get(p.seriesId);
2159
- M || (M = [], x.set(p.seriesId, M)), M.push(p.index);
2178
+ yMax: o.invert(u)
2179
+ }, y = this.hitTestRegion(f);
2180
+ if (y.length > 0) {
2181
+ const p = /* @__PURE__ */ new Map();
2182
+ y.forEach((x) => {
2183
+ let M = p.get(x.seriesId);
2184
+ M || (M = [], p.set(x.seriesId, M)), M.push(x.index);
2160
2185
  });
2161
- const b = Array.from(x.entries()).map(([p, M]) => ({
2162
- seriesId: p,
2186
+ const b = Array.from(p.entries()).map(([x, M]) => ({
2187
+ seriesId: x,
2163
2188
  indices: M
2164
2189
  }));
2165
2190
  this.selectPoints(b, e ? "add" : "single");
@@ -2203,16 +2228,16 @@ class yt {
2203
2228
  render(e, t) {
2204
2229
  if (this.selected.size === 0 && !this.isBoxSelecting) return;
2205
2230
  const i = this.ctx.getXScale(), n = this.ctx.getYScales(), o = this.ctx.getSeries(), r = this.config.highlightStyle;
2206
- e.save(), e.beginPath(), e.rect(t.x, t.y, t.width, t.height), e.clip(), this.selected.forEach((l, c) => {
2207
- const u = o.get(c);
2208
- if (!u || !u.isVisible()) return;
2209
- const h = u.getData(), d = u.getYAxisId() || this.ctx.getPrimaryYAxisId(), y = n.get(d);
2210
- if (!y) return;
2211
- const f = u.getStyle().color || "#ff0055";
2212
- l.forEach((m) => {
2213
- if (m >= h.x.length) return;
2214
- const x = i.transform(h.x[m]), b = y.transform(h.y[m]);
2215
- x < t.x || x > t.x + t.width || b < t.y || b > t.y + t.height || (e.beginPath(), e.arc(x, b, r.size / 2, 0, Math.PI * 2), e.strokeStyle = r.color, e.lineWidth = r.ringWidth, e.stroke(), e.beginPath(), e.arc(x, b, r.size / 2 - r.ringWidth, 0, Math.PI * 2), e.fillStyle = f, e.fill());
2231
+ e.save(), e.beginPath(), e.rect(t.x, t.y, t.width, t.height), e.clip(), this.selected.forEach((l, h) => {
2232
+ const d = o.get(h);
2233
+ if (!d || !d.isVisible()) return;
2234
+ const c = d.getData(), u = d.getYAxisId() || this.ctx.getPrimaryYAxisId(), m = n.get(u);
2235
+ if (!m) return;
2236
+ const f = d.getStyle().color || "#ff0055";
2237
+ l.forEach((y) => {
2238
+ if (y >= c.x.length) return;
2239
+ const p = i.transform(c.x[y]), b = m.transform(c.y[y]);
2240
+ p < t.x || p > t.x + t.width || b < t.y || b > t.y + t.height || (e.beginPath(), e.arc(p, b, r.size / 2, 0, Math.PI * 2), e.strokeStyle = r.color, e.lineWidth = r.ringWidth, e.stroke(), e.beginPath(), e.arc(p, b, r.size / 2 - r.ringWidth, 0, Math.PI * 2), e.fillStyle = f, e.fill());
2216
2241
  });
2217
2242
  });
2218
2243
  const a = this.getBoxSelectionRect();
@@ -2240,7 +2265,7 @@ class yt {
2240
2265
  this.selected.clear(), this.cancelBoxSelection();
2241
2266
  }
2242
2267
  }
2243
- const Y = {
2268
+ const V = {
2244
2269
  smallMobile: {
2245
2270
  maxWidth: 360,
2246
2271
  fontScale: 0.7,
@@ -2289,12 +2314,12 @@ const Y = {
2289
2314
  }
2290
2315
  }, q = {
2291
2316
  enabled: !0,
2292
- breakpoints: Y,
2317
+ breakpoints: V,
2293
2318
  touchOptimized: "auto",
2294
2319
  reducedMotion: "auto",
2295
2320
  resizeDebounce: 100
2296
2321
  };
2297
- class pt {
2322
+ class Mt {
2298
2323
  constructor(e, t) {
2299
2324
  g(this, "ctx");
2300
2325
  g(this, "config");
@@ -2317,10 +2342,10 @@ class pt {
2317
2342
  return e ? {
2318
2343
  enabled: e.enabled ?? q.enabled,
2319
2344
  breakpoints: {
2320
- smallMobile: { ...Y.smallMobile, ...(t = e.breakpoints) == null ? void 0 : t.smallMobile },
2321
- mobile: { ...Y.mobile, ...(i = e.breakpoints) == null ? void 0 : i.mobile },
2322
- tablet: { ...Y.tablet, ...(n = e.breakpoints) == null ? void 0 : n.tablet },
2323
- desktop: { ...Y.desktop, ...(o = e.breakpoints) == null ? void 0 : o.desktop }
2345
+ smallMobile: { ...V.smallMobile, ...(t = e.breakpoints) == null ? void 0 : t.smallMobile },
2346
+ mobile: { ...V.mobile, ...(i = e.breakpoints) == null ? void 0 : i.mobile },
2347
+ tablet: { ...V.tablet, ...(n = e.breakpoints) == null ? void 0 : n.tablet },
2348
+ desktop: { ...V.desktop, ...(o = e.breakpoints) == null ? void 0 : o.desktop }
2324
2349
  },
2325
2350
  touchOptimized: e.touchOptimized ?? q.touchOptimized,
2326
2351
  reducedMotion: e.reducedMotion ?? q.reducedMotion,
@@ -2353,7 +2378,7 @@ class pt {
2353
2378
  this.hasStateChanged(e) && (this.state = e, this.ctx.onStateChange(this.state));
2354
2379
  }
2355
2380
  computeState() {
2356
- const e = this.ctx.container.getBoundingClientRect(), t = e.width || 800, i = e.height || 600, n = this.getActiveBreakpoint(t), o = this.config.breakpoints[n] || Y.desktop, r = this.detectTouchOptimization(), a = this.detectReducedMotion(), l = r ? 1.2 : 1;
2381
+ const e = this.ctx.container.getBoundingClientRect(), t = e.width || 800, i = e.height || 600, n = this.getActiveBreakpoint(t), o = this.config.breakpoints[n] || V.desktop, r = this.detectTouchOptimization(), a = this.detectReducedMotion(), l = r ? 1.2 : 1;
2357
2382
  return {
2358
2383
  width: t,
2359
2384
  height: i,
@@ -2475,33 +2500,33 @@ class pt {
2475
2500
  this.destroyed = !0, this.debounceTimer !== null && window.clearTimeout(this.debounceTimer), this.resizeObserver ? (this.resizeObserver.disconnect(), this.resizeObserver = null) : window.removeEventListener("resize", this.handleResize);
2476
2501
  }
2477
2502
  }
2478
- function xt(s, e) {
2503
+ function St(s, e) {
2479
2504
  const {
2480
2505
  seriesIds: t,
2481
2506
  includeHeaders: i = !0,
2482
2507
  precision: n = 6,
2483
2508
  delimiter: o = ","
2484
- } = e ?? {}, r = t ? s.filter((c) => t.includes(c.getId())) : s;
2509
+ } = e ?? {}, r = t ? s.filter((h) => t.includes(h.getId())) : s;
2485
2510
  if (r.length === 0) return "";
2486
2511
  const a = [];
2487
2512
  if (i) {
2488
- const c = [];
2489
- r.forEach((u) => {
2490
- c.push(`${u.getId()}_x`, `${u.getId()}_y`);
2491
- }), a.push(c.join(o));
2492
- }
2493
- const l = Math.max(...r.map((c) => c.getPointCount()));
2494
- for (let c = 0; c < l; c++) {
2495
- const u = [];
2496
- r.forEach((h) => {
2497
- const d = h.getData();
2498
- d && c < d.x.length ? u.push(d.x[c].toFixed(n), d.y[c].toFixed(n)) : u.push("", "");
2499
- }), a.push(u.join(o));
2513
+ const h = [];
2514
+ r.forEach((d) => {
2515
+ h.push(`${d.getId()}_x`, `${d.getId()}_y`);
2516
+ }), a.push(h.join(o));
2517
+ }
2518
+ const l = Math.max(...r.map((h) => h.getPointCount()));
2519
+ for (let h = 0; h < l; h++) {
2520
+ const d = [];
2521
+ r.forEach((c) => {
2522
+ const u = c.getData();
2523
+ u && h < u.x.length ? d.push(u.x[h].toFixed(n), u.y[h].toFixed(n)) : d.push("", "");
2524
+ }), a.push(d.join(o));
2500
2525
  }
2501
2526
  return a.join(`
2502
2527
  `);
2503
2528
  }
2504
- function bt(s, e, t) {
2529
+ function wt(s, e, t) {
2505
2530
  const { seriesIds: i, precision: n = 6 } = t ?? {}, o = i ? s.filter((a) => i.includes(a.getId())) : s, r = {};
2506
2531
  return o.forEach((a) => {
2507
2532
  const l = a.getData();
@@ -2510,8 +2535,8 @@ function bt(s, e, t) {
2510
2535
  type: a.getType(),
2511
2536
  style: a.getStyle(),
2512
2537
  data: {
2513
- x: l ? Array.from(l.x).map((c) => parseFloat(c.toFixed(n))) : [],
2514
- y: l ? Array.from(l.y).map((c) => parseFloat(c.toFixed(n))) : []
2538
+ x: l ? Array.from(l.x).map((h) => parseFloat(h.toFixed(n))) : [],
2539
+ y: l ? Array.from(l.y).map((h) => parseFloat(h.toFixed(n))) : []
2515
2540
  },
2516
2541
  pointCount: a.getPointCount()
2517
2542
  };
@@ -2521,17 +2546,17 @@ function bt(s, e, t) {
2521
2546
  series: r
2522
2547
  }, null, 2);
2523
2548
  }
2524
- function vt(s, e, t, i, n, o, r = "png") {
2549
+ function Ct(s, e, t, i, n, o, r = "png") {
2525
2550
  const a = document.createElement("canvas");
2526
2551
  a.width = e.width, a.height = e.height;
2527
2552
  const l = a.getContext("2d");
2528
2553
  if (!l) return "";
2529
- const c = t;
2530
- return l.fillStyle = `rgba(${Math.round(c[0] * 255)}, ${Math.round(
2531
- c[1] * 255
2532
- )}, ${Math.round(c[2] * 255)}, ${c[3]})`, l.fillRect(0, 0, a.width, a.height), l.drawImage(s, 0, 0), l.drawImage(e, 0, 0), i && n && i.draw(l, o), a.toDataURL(`image/${r}`);
2554
+ const h = t;
2555
+ return l.fillStyle = `rgba(${Math.round(h[0] * 255)}, ${Math.round(
2556
+ h[1] * 255
2557
+ )}, ${Math.round(h[2] * 255)}, ${h[3]})`, l.fillRect(0, 0, a.width, a.height), l.drawImage(s, 0, 0), l.drawImage(e, 0, 0), i && n && i.draw(l, o), a.toDataURL(`image/${r}`);
2533
2558
  }
2534
- const Mt = /* @__PURE__ */ new Set([
2559
+ const At = /* @__PURE__ */ new Set([
2535
2560
  "line",
2536
2561
  "band",
2537
2562
  "scatter",
@@ -2540,23 +2565,23 @@ const Mt = /* @__PURE__ */ new Set([
2540
2565
  "candlestick",
2541
2566
  "ohlc"
2542
2567
  ]);
2543
- function K(s) {
2568
+ function ee(s) {
2544
2569
  const e = Array.from(s).filter((i) => i.isVisible());
2545
- return e.some((i) => i.getType() === "bar") ? !e.some((i) => Mt.has(i.getType())) : !1;
2570
+ return e.some((i) => i.getType() === "bar") ? !e.some((i) => At.has(i.getType())) : !1;
2546
2571
  }
2547
- function St(s, e) {
2572
+ function kt(s, e) {
2548
2573
  e.x && (s.viewBounds.xMin = e.x[0], s.viewBounds.xMax = e.x[1]);
2549
- const t = K(s.series.values()), i = e.y ? [...e.y] : null;
2574
+ const t = ee(s.series.values()), i = e.y ? [...e.y] : null;
2550
2575
  if (i && t && (i[0] = 0), i)
2551
2576
  if (e.axisId) {
2552
2577
  const n = s.yScales.get(e.axisId);
2553
2578
  n && (n.setDomain(i[0], i[1]), e.axisId === s.primaryYAxisId && (s.viewBounds.yMin = i[0], s.viewBounds.yMax = i[1]));
2554
2579
  } else {
2555
2580
  const n = s.viewBounds.yMax - s.viewBounds.yMin, o = i[1] - i[0], r = n > 0 ? o / n : 1, a = n > 0 ? (i[0] - s.viewBounds.yMin) / n : 0;
2556
- s.yScales.forEach((l, c) => {
2557
- if (c === s.primaryYAxisId) return;
2558
- const u = l.domain[1] - l.domain[0], h = t ? 0 : l.domain[0] + a * u, d = t ? l.domain[0] + i[1] / (s.viewBounds.yMax || 1) * u : h + r * u;
2559
- l.setDomain(h, d);
2581
+ s.yScales.forEach((l, h) => {
2582
+ if (h === s.primaryYAxisId) return;
2583
+ const d = l.domain[1] - l.domain[0], c = t ? 0 : l.domain[0] + a * d, u = t ? l.domain[0] + i[1] / (s.viewBounds.yMax || 1) * d : c + r * d;
2584
+ l.setDomain(c, u);
2560
2585
  }), s.viewBounds.yMin = i[0], s.viewBounds.yMax = i[1];
2561
2586
  }
2562
2587
  s.events.emit("zoom", {
@@ -2564,28 +2589,28 @@ function St(s, e) {
2564
2589
  y: [s.viewBounds.yMin, s.viewBounds.yMax]
2565
2590
  }), s.requestRender();
2566
2591
  }
2567
- function wt(s, e, t, i) {
2592
+ function Tt(s, e, t, i) {
2568
2593
  const n = s.getPlotArea(), o = e / n.width * (s.viewBounds.xMax - s.viewBounds.xMin);
2569
2594
  if (s.viewBounds.xMin -= o, s.viewBounds.xMax -= o, i) {
2570
2595
  const a = s.yScales.get(i);
2571
2596
  if (a) {
2572
- const l = K(s.series.values()), c = a.domain[1] - a.domain[0], u = t / n.height * c;
2573
- let h = a.domain[0] + u, d = a.domain[1] + u;
2574
- l && (h = 0, d = a.domain[1] + u), a.setDomain(h, d), i === s.primaryYAxisId && (s.viewBounds.yMin = h, s.viewBounds.yMax = d);
2597
+ const l = ee(s.series.values()), h = a.domain[1] - a.domain[0], d = t / n.height * h;
2598
+ let c = a.domain[0] + d, u = a.domain[1] + d;
2599
+ l && (c = 0, u = a.domain[1] + d), a.setDomain(c, u), i === s.primaryYAxisId && (s.viewBounds.yMin = c, s.viewBounds.yMax = u);
2575
2600
  }
2576
2601
  } else {
2577
- const a = K(s.series.values());
2578
- s.yScales.forEach((l, c) => {
2579
- const u = l.domain[1] - l.domain[0], h = t / n.height * u;
2580
- let d = l.domain[0] + h;
2581
- const y = l.domain[1] + h;
2582
- a && (d = 0), l.setDomain(d, y), c === s.primaryYAxisId && (s.viewBounds.yMin = d, s.viewBounds.yMax = y);
2602
+ const a = ee(s.series.values());
2603
+ s.yScales.forEach((l, h) => {
2604
+ const d = l.domain[1] - l.domain[0], c = t / n.height * d;
2605
+ let u = l.domain[0] + c;
2606
+ const m = l.domain[1] + c;
2607
+ a && (u = 0), l.setDomain(u, m), h === s.primaryYAxisId && (s.viewBounds.yMin = u, s.viewBounds.yMax = m);
2583
2608
  });
2584
2609
  }
2585
2610
  const r = t / n.height * (s.viewBounds.yMax - s.viewBounds.yMin);
2586
2611
  s.events.emit("pan", { deltaX: o, deltaY: r }), s.requestRender();
2587
2612
  }
2588
- function Ct(s) {
2613
+ function Bt(s) {
2589
2614
  if (s.series.size === 0) return;
2590
2615
  let e = 1 / 0, t = -1 / 0;
2591
2616
  const i = /* @__PURE__ */ new Map();
@@ -2598,8 +2623,8 @@ function Ct(s) {
2598
2623
  const l = a.getBounds();
2599
2624
  if (l && isFinite(l.xMin) && isFinite(l.xMax) && isFinite(l.yMin) && isFinite(l.yMax)) {
2600
2625
  e = Math.min(e, l.xMin), t = Math.max(t, l.xMax);
2601
- const c = a.getYAxisId() || s.primaryYAxisId, u = i.get(c);
2602
- u && (u.min = Math.min(u.min, l.yMin), u.max = Math.max(u.max, l.yMax)), n = !0;
2626
+ const h = a.getYAxisId() || s.primaryYAxisId, d = i.get(h);
2627
+ d && (d.min = Math.min(d.min, l.yMin), d.max = Math.max(d.max, l.yMax)), n = !0;
2603
2628
  }
2604
2629
  }), !n) return;
2605
2630
  const o = 1e15, r = -1e15;
@@ -2611,57 +2636,57 @@ function Ct(s) {
2611
2636
  }
2612
2637
  i.forEach((a, l) => {
2613
2638
  if (a.min === 1 / 0) return;
2614
- const c = s.yAxisOptionsMap.get(l), u = s.yScales.get(l);
2615
- if (c && c.auto && u) {
2616
- let h = a.max - a.min;
2617
- (h <= 0 || !isFinite(h)) && (h = Math.abs(a.min) * 0.1 || 1);
2618
- const d = Math.min(h * 5e-3, 1e10), y = Math.max(r, a.min - d), f = Math.min(o, a.max + d);
2619
- u.setDomain(y, f), l === s.primaryYAxisId && (s.viewBounds.yMin = y, s.viewBounds.yMax = f);
2639
+ const h = s.yAxisOptionsMap.get(l), d = s.yScales.get(l);
2640
+ if (h && h.auto && d) {
2641
+ let c = a.max - a.min;
2642
+ (c <= 0 || !isFinite(c)) && (c = Math.abs(a.min) * 0.1 || 1);
2643
+ const u = Math.min(c * 5e-3, 1e10), m = Math.max(r, a.min - u), f = Math.min(o, a.max + u);
2644
+ d.setDomain(m, f), l === s.primaryYAxisId && (s.viewBounds.yMin = m, s.viewBounds.yMax = f);
2620
2645
  }
2621
2646
  }), s.requestRender();
2622
2647
  }
2623
- function At(s, e = {}) {
2624
- var l, c;
2648
+ function Pt(s, e = {}) {
2649
+ var l, h;
2625
2650
  const t = typeof e.padding == "object" ? e.padding.x ?? 0.02 : e.padding ?? 0.02, i = typeof e.padding == "object" ? e.padding.y ?? 0.05 : e.padding ?? 0.05;
2626
- let n = (l = e.x) == null ? void 0 : l[0], o = (c = e.x) == null ? void 0 : c[1], r = n !== void 0 && o !== void 0;
2651
+ let n = (l = e.x) == null ? void 0 : l[0], o = (h = e.x) == null ? void 0 : h[1], r = n !== void 0 && o !== void 0;
2627
2652
  const a = /* @__PURE__ */ new Map();
2628
- if (s.yScales.forEach((u, h) => {
2629
- a.set(h, { min: 1 / 0, max: -1 / 0 });
2653
+ if (s.yScales.forEach((d, c) => {
2654
+ a.set(c, { min: 1 / 0, max: -1 / 0 });
2630
2655
  }), !r || e.y === void 0) {
2631
- let u = !1;
2632
- if (s.series.forEach((h) => {
2633
- if (!h.isVisible()) return;
2634
- const d = h.getBounds();
2635
- if (!d || !isFinite(d.xMin) || !isFinite(d.xMax) || !isFinite(d.yMin) || !isFinite(d.yMax))
2656
+ let d = !1;
2657
+ if (s.series.forEach((c) => {
2658
+ if (!c.isVisible()) return;
2659
+ const u = c.getBounds();
2660
+ if (!u || !isFinite(u.xMin) || !isFinite(u.xMax) || !isFinite(u.yMin) || !isFinite(u.yMax))
2636
2661
  return;
2637
- r || (n = n === void 0 ? d.xMin : Math.min(n, d.xMin), o = o === void 0 ? d.xMax : Math.max(o, d.xMax));
2638
- const y = h.getYAxisId() || s.primaryYAxisId, f = a.get(y);
2639
- f && (f.min = Math.min(f.min, d.yMin), f.max = Math.max(f.max, d.yMax)), u = !0;
2640
- }), !r && !u) return !1;
2662
+ r || (n = n === void 0 ? u.xMin : Math.min(n, u.xMin), o = o === void 0 ? u.xMax : Math.max(o, u.xMax));
2663
+ const m = c.getYAxisId() || s.primaryYAxisId, f = a.get(m);
2664
+ f && (f.min = Math.min(f.min, u.yMin), f.max = Math.max(f.max, u.yMax)), d = !0;
2665
+ }), !r && !d) return !1;
2641
2666
  r = n !== void 0 && o !== void 0;
2642
2667
  }
2643
2668
  if (e.y) {
2644
- const u = s.yScales.get(s.primaryYAxisId);
2645
- u && u.setDomain(e.y[0], e.y[1]), s.viewBounds.yMin = e.y[0], s.viewBounds.yMax = e.y[1];
2669
+ const d = s.yScales.get(s.primaryYAxisId);
2670
+ d && d.setDomain(e.y[0], e.y[1]), s.viewBounds.yMin = e.y[0], s.viewBounds.yMax = e.y[1];
2646
2671
  } else
2647
- a.forEach((d, y) => {
2648
- if (d.min === 1 / 0) return;
2649
- const f = s.yAxisOptionsMap.get(y), m = s.yScales.get(y);
2650
- if (!f || !m) return;
2651
- let x = d.max - d.min;
2652
- (x <= 0 || !isFinite(x)) && (x = Math.abs(d.min) * 0.1 || 1);
2653
- const b = x * i, v = Math.max(-1e15, d.min - b), p = Math.min(1e15, d.max + b);
2654
- m.setDomain(v, p), y === s.primaryYAxisId && (s.viewBounds.yMin = v, s.viewBounds.yMax = p);
2672
+ a.forEach((u, m) => {
2673
+ if (u.min === 1 / 0) return;
2674
+ const f = s.yAxisOptionsMap.get(m), y = s.yScales.get(m);
2675
+ if (!f || !y) return;
2676
+ let p = u.max - u.min;
2677
+ (p <= 0 || !isFinite(p)) && (p = Math.abs(u.min) * 0.1 || 1);
2678
+ const b = p * i, v = Math.max(-1e15, u.min - b), x = Math.min(1e15, u.max + b);
2679
+ y.setDomain(v, x), m === s.primaryYAxisId && (s.viewBounds.yMin = v, s.viewBounds.yMax = x);
2655
2680
  });
2656
2681
  if (r && n !== void 0 && o !== void 0) {
2657
- let d = o - n;
2658
- (d <= 0 || !isFinite(d)) && (d = Math.abs(n) * 0.1 || 1);
2659
- const y = d * t;
2660
- s.viewBounds.xMin = Math.max(-1e15, n - y), s.viewBounds.xMax = Math.min(1e15, o + y);
2682
+ let u = o - n;
2683
+ (u <= 0 || !isFinite(u)) && (u = Math.abs(n) * 0.1 || 1);
2684
+ const m = u * t;
2685
+ s.viewBounds.xMin = Math.max(-1e15, n - m), s.viewBounds.xMax = Math.min(1e15, o + m);
2661
2686
  }
2662
2687
  return s.requestRender(), !0;
2663
2688
  }
2664
- function kt(s) {
2689
+ function Et(s) {
2665
2690
  if (s.series.size === 0) return;
2666
2691
  const e = /* @__PURE__ */ new Map();
2667
2692
  s.yScales.forEach((o, r) => {
@@ -2681,24 +2706,24 @@ function kt(s) {
2681
2706
  if (o.min === 1 / 0) return;
2682
2707
  const a = s.yAxisOptionsMap.get(r), l = s.yScales.get(r);
2683
2708
  if (a && a.auto && l) {
2684
- let c = o.max - o.min;
2685
- (c <= 0 || !isFinite(c)) && (c = Math.abs(o.min) * 0.1 || 1);
2686
- const u = Math.min(c * 5e-3, 1e10), h = Math.max(n, o.min - u), d = Math.min(i, o.max + u);
2687
- l.setDomain(h, d), r === s.primaryYAxisId && (s.viewBounds.yMin = h, s.viewBounds.yMax = d);
2709
+ let h = o.max - o.min;
2710
+ (h <= 0 || !isFinite(h)) && (h = Math.abs(o.min) * 0.1 || 1);
2711
+ const d = Math.min(h * 5e-3, 1e10), c = Math.max(n, o.min - d), u = Math.min(i, o.max + d);
2712
+ l.setDomain(c, u), r === s.primaryYAxisId && (s.viewBounds.yMin = c, s.viewBounds.yMax = u);
2688
2713
  }
2689
2714
  }), s.requestRender();
2690
2715
  }
2691
- function Tt(s, e, t, i) {
2716
+ function It(s, e, t, i) {
2692
2717
  if (e === null) {
2693
2718
  if (t && t.width > 5 && t.height > 5) {
2694
- const n = s.getPlotArea(), o = s.viewBounds, r = (t.x - n.x) / n.width, a = (t.x + t.width - n.x) / n.width, l = 1 - (t.y - n.y) / n.height, c = 1 - (t.y + t.height - n.y) / n.height, u = o.xMin + r * (o.xMax - o.xMin), h = o.xMin + a * (o.xMax - o.xMin), d = o.yMin + c * (o.yMax - o.yMin), y = o.yMin + l * (o.yMax - o.yMin);
2695
- i({ x: [u, h], y: [d, y] });
2719
+ const n = s.getPlotArea(), o = s.viewBounds, r = (t.x - n.x) / n.width, a = (t.x + t.width - n.x) / n.width, l = 1 - (t.y - n.y) / n.height, h = 1 - (t.y + t.height - n.y) / n.height, d = o.xMin + r * (o.xMax - o.xMin), c = o.xMin + a * (o.xMax - o.xMin), u = o.yMin + h * (o.yMax - o.yMin), m = o.yMin + l * (o.yMax - o.yMin);
2720
+ i({ x: [d, c], y: [u, m] });
2696
2721
  }
2697
2722
  return null;
2698
2723
  }
2699
2724
  return e;
2700
2725
  }
2701
- const Bt = {
2726
+ const Rt = {
2702
2727
  /** Linear easing - constant speed */
2703
2728
  linear: (s) => s,
2704
2729
  /** Ease in - starts slow, accelerates */
@@ -2724,7 +2749,7 @@ const Bt = {
2724
2749
  /** Bounce effect */
2725
2750
  bounce: (s) => s < 1 / 2.75 ? 7.5625 * s * s : s < 2 / 2.75 ? 7.5625 * (s -= 1.5 / 2.75) * s + 0.75 : s < 2.5 / 2.75 ? 7.5625 * (s -= 2.25 / 2.75) * s + 0.9375 : 7.5625 * (s -= 2.625 / 2.75) * s + 0.984375
2726
2751
  };
2727
- class Be {
2752
+ class Pe {
2728
2753
  constructor() {
2729
2754
  g(this, "animations", /* @__PURE__ */ new Map());
2730
2755
  g(this, "frameId", null);
@@ -2735,7 +2760,7 @@ class Be {
2735
2760
  * Start a new animation
2736
2761
  */
2737
2762
  animate(e) {
2738
- const t = `anim_${++this.idCounter}`, i = typeof e.easing == "function" ? e.easing : Bt[e.easing || "easeOutCubic"];
2763
+ const t = `anim_${++this.idCounter}`, i = typeof e.easing == "function" ? e.easing : Rt[e.easing || "easeOutCubic"];
2739
2764
  let n, o;
2740
2765
  const r = new Promise((a, l) => {
2741
2766
  n = a, o = l;
@@ -2900,7 +2925,7 @@ const D = {
2900
2925
  easing: "easeOutCubic"
2901
2926
  }
2902
2927
  };
2903
- function pe(s) {
2928
+ function be(s) {
2904
2929
  return s ? {
2905
2930
  enabled: s.enabled ?? D.enabled,
2906
2931
  zoom: { ...D.zoom, ...s.zoom },
@@ -2910,15 +2935,15 @@ function pe(s) {
2910
2935
  autoScale: { ...D.autoScale, ...s.autoScale }
2911
2936
  } : { ...D };
2912
2937
  }
2913
- let ne = null;
2914
- function Fi() {
2915
- return ne || (ne = new Be()), ne;
2938
+ let oe = null;
2939
+ function $i() {
2940
+ return oe || (oe = new Pe()), oe;
2916
2941
  }
2917
2942
  let F = null, L = null;
2918
- function Pt(s, e) {
2943
+ function Dt(s, e) {
2919
2944
  const t = e.animate !== !1 && s.animationConfig.enabled && s.animationConfig.zoom.enabled;
2920
2945
  F != null && F.isRunning() && F.cancel();
2921
- const i = K(s.series.values()), n = e.x ? e.x[0] : s.viewBounds.xMin, o = e.x ? e.x[1] : s.viewBounds.xMax;
2946
+ const i = ee(s.series.values()), n = e.x ? e.x[0] : s.viewBounds.xMin, o = e.x ? e.x[1] : s.viewBounds.xMax;
2922
2947
  let r = e.y ? e.y[0] : s.viewBounds.yMin;
2923
2948
  const a = e.y ? e.y[1] : s.viewBounds.yMax;
2924
2949
  i && e.y && (r = 0);
@@ -2926,44 +2951,44 @@ function Pt(s, e) {
2926
2951
  if (!t) {
2927
2952
  if (e.x && (s.viewBounds.xMin = n, s.viewBounds.xMax = o), e.y)
2928
2953
  if (l) {
2929
- const h = s.yScales.get(l);
2930
- h && (h.setDomain(r, a), l === s.primaryYAxisId && (s.viewBounds.yMin = r, s.viewBounds.yMax = a));
2954
+ const c = s.yScales.get(l);
2955
+ c && (c.setDomain(r, a), l === s.primaryYAxisId && (s.viewBounds.yMin = r, s.viewBounds.yMax = a));
2931
2956
  } else {
2932
- const h = s.viewBounds.yMax - s.viewBounds.yMin, d = a - r, y = h > 0 ? d / h : 1, f = h > 0 ? (r - s.viewBounds.yMin) / h : 0;
2933
- s.yScales.forEach((x, b) => {
2957
+ const c = s.viewBounds.yMax - s.viewBounds.yMin, u = a - r, m = c > 0 ? u / c : 1, f = c > 0 ? (r - s.viewBounds.yMin) / c : 0;
2958
+ s.yScales.forEach((p, b) => {
2934
2959
  if (b === s.primaryYAxisId) return;
2935
- const v = x.domain[1] - x.domain[0], p = i ? 0 : x.domain[0] + f * v, M = i ? x.domain[0] + y * v : p + y * v;
2936
- x.setDomain(p, M);
2960
+ const v = p.domain[1] - p.domain[0], x = i ? 0 : p.domain[0] + f * v, M = i ? p.domain[0] + m * v : x + m * v;
2961
+ p.setDomain(x, M);
2937
2962
  }), s.viewBounds.yMin = r, s.viewBounds.yMax = a;
2938
- const m = s.yScales.get(s.primaryYAxisId);
2939
- m && m.setDomain(r, a);
2963
+ const y = s.yScales.get(s.primaryYAxisId);
2964
+ y && y.setDomain(r, a);
2940
2965
  }
2941
2966
  return s.events.emit("zoom", {
2942
2967
  x: [s.viewBounds.xMin, s.viewBounds.xMax],
2943
2968
  y: [s.viewBounds.yMin, s.viewBounds.yMax]
2944
2969
  }), s.requestRender(), null;
2945
2970
  }
2946
- const c = { ...s.viewBounds }, u = /* @__PURE__ */ new Map();
2947
- return s.yScales.forEach((h, d) => {
2948
- u.set(d, [...h.domain]);
2971
+ const h = { ...s.viewBounds }, d = /* @__PURE__ */ new Map();
2972
+ return s.yScales.forEach((c, u) => {
2973
+ d.set(u, [...c.domain]);
2949
2974
  }), F = s.animationEngine.animate({
2950
2975
  duration: s.animationConfig.zoom.duration,
2951
2976
  easing: s.animationConfig.zoom.easing,
2952
- onUpdate: (h) => {
2953
- if (e.x && (s.viewBounds.xMin = c.xMin + (n - c.xMin) * h, s.viewBounds.xMax = c.xMax + (o - c.xMax) * h), e.y)
2977
+ onUpdate: (c) => {
2978
+ if (e.x && (s.viewBounds.xMin = h.xMin + (n - h.xMin) * c, s.viewBounds.xMax = h.xMax + (o - h.xMax) * c), e.y)
2954
2979
  if (l) {
2955
- const d = s.yScales.get(l), y = u.get(l);
2956
- if (d && y) {
2957
- const f = y[0] + (r - y[0]) * h, m = y[1] + (a - y[1]) * h;
2958
- d.setDomain(f, m), l === s.primaryYAxisId && (s.viewBounds.yMin = f, s.viewBounds.yMax = m);
2980
+ const u = s.yScales.get(l), m = d.get(l);
2981
+ if (u && m) {
2982
+ const f = m[0] + (r - m[0]) * c, y = m[1] + (a - m[1]) * c;
2983
+ u.setDomain(f, y), l === s.primaryYAxisId && (s.viewBounds.yMin = f, s.viewBounds.yMax = y);
2959
2984
  }
2960
2985
  } else
2961
- s.viewBounds.yMin = c.yMin + (r - c.yMin) * h, s.viewBounds.yMax = c.yMax + (a - c.yMax) * h, s.yScales.forEach((d, y) => {
2962
- if (y === s.primaryYAxisId)
2963
- d.setDomain(s.viewBounds.yMin, s.viewBounds.yMax);
2986
+ s.viewBounds.yMin = h.yMin + (r - h.yMin) * c, s.viewBounds.yMax = h.yMax + (a - h.yMax) * c, s.yScales.forEach((u, m) => {
2987
+ if (m === s.primaryYAxisId)
2988
+ u.setDomain(s.viewBounds.yMin, s.viewBounds.yMax);
2964
2989
  else {
2965
- const f = u.get(y), m = c.yMax - c.yMin, x = s.viewBounds.yMax - s.viewBounds.yMin, b = m > 0 ? x / m : 1, v = m > 0 ? (s.viewBounds.yMin - c.yMin) / m : 0, p = f[1] - f[0], M = f[0] + v * p, S = M + b * p;
2966
- d.setDomain(M, S);
2990
+ const f = d.get(m), y = h.yMax - h.yMin, p = s.viewBounds.yMax - s.viewBounds.yMin, b = y > 0 ? p / y : 1, v = y > 0 ? (s.viewBounds.yMin - h.yMin) / y : 0, x = f[1] - f[0], M = f[0] + v * x, S = M + b * x;
2991
+ u.setDomain(M, S);
2967
2992
  }
2968
2993
  });
2969
2994
  s.requestRender();
@@ -2976,42 +3001,42 @@ function Pt(s, e) {
2976
3001
  }
2977
3002
  }), F;
2978
3003
  }
2979
- function It(s, e = !0) {
3004
+ function Ft(s, e = !0) {
2980
3005
  if (s.series.size === 0) return null;
2981
3006
  let t = 1 / 0, i = -1 / 0;
2982
3007
  const n = /* @__PURE__ */ new Map();
2983
- s.yScales.forEach((v, p) => {
2984
- n.set(p, { min: 1 / 0, max: -1 / 0 });
3008
+ s.yScales.forEach((v, x) => {
3009
+ n.set(x, { min: 1 / 0, max: -1 / 0 });
2985
3010
  });
2986
3011
  let o = !1;
2987
3012
  if (s.series.forEach((v) => {
2988
3013
  if (!v.isVisible()) return;
2989
- const p = v.getBounds();
2990
- if (p && isFinite(p.xMin) && isFinite(p.xMax) && isFinite(p.yMin) && isFinite(p.yMax)) {
2991
- t = Math.min(t, p.xMin), i = Math.max(i, p.xMax);
3014
+ const x = v.getBounds();
3015
+ if (x && isFinite(x.xMin) && isFinite(x.xMax) && isFinite(x.yMin) && isFinite(x.yMax)) {
3016
+ t = Math.min(t, x.xMin), i = Math.max(i, x.xMax);
2992
3017
  const M = v.getYAxisId() || s.primaryYAxisId, S = n.get(M);
2993
- S && (S.min = Math.min(S.min, p.yMin), S.max = Math.max(S.max, p.yMax)), o = !0;
3018
+ S && (S.min = Math.min(S.min, x.yMin), S.max = Math.max(S.max, x.yMax)), o = !0;
2994
3019
  }
2995
3020
  }), !o) return null;
2996
3021
  const r = 1e15, a = -1e15;
2997
- let l = s.viewBounds.xMin, c = s.viewBounds.xMax, u = s.viewBounds.yMin, h = s.viewBounds.yMax;
3022
+ let l = s.viewBounds.xMin, h = s.viewBounds.xMax, d = s.viewBounds.yMin, c = s.viewBounds.yMax;
2998
3023
  if (s.xAxisOptions.auto) {
2999
3024
  let v = i - t;
3000
3025
  (v <= 0 || !isFinite(v)) && (v = Math.abs(t) * 0.1 || 1);
3001
- const p = Math.min(v * 5e-3, 1e10);
3002
- l = Math.max(a, t - p), c = Math.min(r, i + p);
3026
+ const x = Math.min(v * 5e-3, 1e10);
3027
+ l = Math.max(a, t - x), h = Math.min(r, i + x);
3003
3028
  }
3004
- const d = n.get(s.primaryYAxisId), y = s.yAxisOptionsMap.get(s.primaryYAxisId);
3005
- if (d && (y != null && y.auto) && d.min !== 1 / 0) {
3006
- let v = d.max - d.min;
3007
- (v <= 0 || !isFinite(v)) && (v = Math.abs(d.min) * 0.1 || 1);
3008
- const p = Math.min(v * 5e-3, 1e10);
3009
- u = Math.max(a, d.min - p), h = Math.min(r, d.max + p);
3029
+ const u = n.get(s.primaryYAxisId), m = s.yAxisOptionsMap.get(s.primaryYAxisId);
3030
+ if (u && (m != null && m.auto) && u.min !== 1 / 0) {
3031
+ let v = u.max - u.min;
3032
+ (v <= 0 || !isFinite(v)) && (v = Math.abs(u.min) * 0.1 || 1);
3033
+ const x = Math.min(v * 5e-3, 1e10);
3034
+ d = Math.max(a, u.min - x), c = Math.min(r, u.max + x);
3010
3035
  }
3011
3036
  const f = e && s.animationConfig.enabled && s.animationConfig.autoScale.enabled;
3012
3037
  if (L != null && L.isRunning() && L.cancel(), !f)
3013
- return s.viewBounds.xMin = l, s.viewBounds.xMax = c, s.viewBounds.yMin = u, s.viewBounds.yMax = h, s.yScales.forEach((v, p) => {
3014
- const M = n.get(p), S = s.yAxisOptionsMap.get(p);
3038
+ return s.viewBounds.xMin = l, s.viewBounds.xMax = h, s.viewBounds.yMin = d, s.viewBounds.yMax = c, s.yScales.forEach((v, x) => {
3039
+ const M = n.get(x), S = s.yAxisOptionsMap.get(x);
3015
3040
  if (M && (S != null && S.auto) && M.min !== 1 / 0) {
3016
3041
  let w = M.max - M.min;
3017
3042
  (w <= 0 || !isFinite(w)) && (w = Math.abs(M.min) * 0.1 || 1);
@@ -3022,30 +3047,30 @@ function It(s, e = !0) {
3022
3047
  );
3023
3048
  }
3024
3049
  }), s.events.emit("autoScale", void 0), s.requestRender(), null;
3025
- const m = { ...s.viewBounds }, x = /* @__PURE__ */ new Map();
3026
- s.yScales.forEach((v, p) => {
3027
- x.set(p, [...v.domain]);
3050
+ const y = { ...s.viewBounds }, p = /* @__PURE__ */ new Map();
3051
+ s.yScales.forEach((v, x) => {
3052
+ p.set(x, [...v.domain]);
3028
3053
  });
3029
3054
  const b = /* @__PURE__ */ new Map();
3030
- return s.yScales.forEach((v, p) => {
3031
- const M = n.get(p), S = s.yAxisOptionsMap.get(p);
3055
+ return s.yScales.forEach((v, x) => {
3056
+ const M = n.get(x), S = s.yAxisOptionsMap.get(x);
3032
3057
  if (M && (S != null && S.auto) && M.min !== 1 / 0) {
3033
3058
  let w = M.max - M.min;
3034
3059
  (w <= 0 || !isFinite(w)) && (w = Math.abs(M.min) * 0.1 || 1);
3035
3060
  const C = Math.min(w * 5e-3, 1e10);
3036
- b.set(p, [
3061
+ b.set(x, [
3037
3062
  Math.max(a, M.min - C),
3038
3063
  Math.min(r, M.max + C)
3039
3064
  ]);
3040
3065
  } else
3041
- b.set(p, [...v.domain]);
3066
+ b.set(x, [...v.domain]);
3042
3067
  }), L = s.animationEngine.animate({
3043
3068
  duration: s.animationConfig.autoScale.duration,
3044
3069
  easing: s.animationConfig.autoScale.easing,
3045
3070
  onUpdate: (v) => {
3046
- s.viewBounds.xMin = m.xMin + (l - m.xMin) * v, s.viewBounds.xMax = m.xMax + (c - m.xMax) * v, s.viewBounds.yMin = m.yMin + (u - m.yMin) * v, s.viewBounds.yMax = m.yMax + (h - m.yMax) * v, s.yScales.forEach((p, M) => {
3047
- const S = x.get(M), w = b.get(M);
3048
- p.setDomain(
3071
+ s.viewBounds.xMin = y.xMin + (l - y.xMin) * v, s.viewBounds.xMax = y.xMax + (h - y.xMax) * v, s.viewBounds.yMin = y.yMin + (d - y.yMin) * v, s.viewBounds.yMax = y.yMax + (c - y.yMax) * v, s.yScales.forEach((x, M) => {
3072
+ const S = p.get(M), w = b.get(M);
3073
+ x.setDomain(
3049
3074
  S[0] + (w[0] - S[0]) * v,
3050
3075
  S[1] + (w[1] - S[1]) * v
3051
3076
  );
@@ -3056,7 +3081,7 @@ function It(s, e = !0) {
3056
3081
  }
3057
3082
  }), L;
3058
3083
  }
3059
- function Et(s, e, t) {
3084
+ function Lt(s, e, t) {
3060
3085
  const i = { ...s.viewBounds }, n = {
3061
3086
  xMin: e.xMin ?? s.viewBounds.xMin,
3062
3087
  xMax: e.xMax ?? s.viewBounds.xMax,
@@ -3079,7 +3104,7 @@ function Et(s, e, t) {
3079
3104
  }
3080
3105
  });
3081
3106
  }
3082
- function Pe(s, e, t = "degrees") {
3107
+ function Ee(s, e, t = "degrees") {
3083
3108
  const i = Math.min(s.length, e.length), n = new Float32Array(i * 2), o = t === "degrees" ? Math.PI / 180 : 1;
3084
3109
  for (let r = 0; r < i; r++) {
3085
3110
  const a = s[r], l = e[r] * o;
@@ -3087,22 +3112,22 @@ function Pe(s, e, t = "degrees") {
3087
3112
  }
3088
3113
  return n;
3089
3114
  }
3090
- function Li(s, e = "degrees", t = !1) {
3091
- const i = Pe(s.r, s.theta, e);
3115
+ function Hi(s, e = "degrees", t = !1) {
3116
+ const i = Ee(s.r, s.theta, e);
3092
3117
  if (!t)
3093
3118
  return i;
3094
3119
  const n = i.length / 2, o = new Float32Array((n + 1) * 2);
3095
3120
  return o.set(i), o[n * 2] = i[0], o[n * 2 + 1] = i[1], o;
3096
3121
  }
3097
- function zi(s, e = "degrees", t = !0) {
3098
- const i = Pe(s.r, s.theta, e), n = i.length / 2, o = t ? n : n - 1, r = new Float32Array(o * 3 * 2);
3122
+ function Ni(s, e = "degrees", t = !0) {
3123
+ const i = Ee(s.r, s.theta, e), n = i.length / 2, o = t ? n : n - 1, r = new Float32Array(o * 3 * 2);
3099
3124
  for (let a = 0; a < o; a++) {
3100
- const l = a * 6, c = a, u = (a + 1) % n;
3101
- r[l + 0] = 0, r[l + 1] = 0, r[l + 2] = i[c * 2], r[l + 3] = i[c * 2 + 1], r[l + 4] = i[u * 2], r[l + 5] = i[u * 2 + 1];
3125
+ const l = a * 6, h = a, d = (a + 1) % n;
3126
+ r[l + 0] = 0, r[l + 1] = 0, r[l + 2] = i[h * 2], r[l + 3] = i[h * 2 + 1], r[l + 4] = i[d * 2], r[l + 5] = i[d * 2 + 1];
3102
3127
  }
3103
3128
  return r;
3104
3129
  }
3105
- function Rt(s) {
3130
+ function Ot(s) {
3106
3131
  const e = Math.min(s.r.length, s.theta.length);
3107
3132
  let t = 0;
3108
3133
  for (let i = 0; i < e; i++)
@@ -3115,35 +3140,35 @@ function Rt(s) {
3115
3140
  maxRadius: t
3116
3141
  };
3117
3142
  }
3118
- function Dt(s, e, t, i) {
3143
+ function zt(s, e, t, i) {
3119
3144
  if (s === "heatmap" && t) {
3120
- const { xValues: m, yValues: x } = t;
3121
- let b = 1 / 0, v = -1 / 0, p = 1 / 0, M = -1 / 0;
3122
- for (let S = 0; S < m.length; S++) {
3123
- const w = m[S];
3145
+ const { xValues: y, yValues: p } = t;
3146
+ let b = 1 / 0, v = -1 / 0, x = 1 / 0, M = -1 / 0;
3147
+ for (let S = 0; S < y.length; S++) {
3148
+ const w = y[S];
3124
3149
  w < b && (b = w), w > v && (v = w);
3125
3150
  }
3126
- for (let S = 0; S < x.length; S++) {
3127
- const w = x[S];
3128
- w < p && (p = w), w > M && (M = w);
3151
+ for (let S = 0; S < p.length; S++) {
3152
+ const w = p[S];
3153
+ w < x && (x = w), w > M && (M = w);
3129
3154
  }
3130
- return b === 1 / 0 || p === 1 / 0 ? null : { xMin: b, xMax: v, yMin: p, yMax: M };
3155
+ return b === 1 / 0 || x === 1 / 0 ? null : { xMin: b, xMax: v, yMin: x, yMax: M };
3131
3156
  }
3132
3157
  if (s === "polar" && i)
3133
- return Rt(i);
3134
- const { x: n, y: o, y2: r, open: a, high: l, low: c, close: u } = e;
3158
+ return Ot(i);
3159
+ const { x: n, y: o, y2: r, open: a, high: l, low: h, close: d } = e;
3135
3160
  if (n.length === 0) return null;
3136
- let h = 1 / 0, d = -1 / 0, y = 1 / 0, f = -1 / 0;
3137
- for (let m = 0; m < n.length; m++) {
3138
- const x = n[m];
3139
- if (!isFinite(x)) continue;
3140
- x < h && (h = x), x > d && (d = x);
3161
+ let c = 1 / 0, u = -1 / 0, m = 1 / 0, f = -1 / 0;
3162
+ for (let y = 0; y < n.length; y++) {
3163
+ const p = n[y];
3164
+ if (!isFinite(p)) continue;
3165
+ p < c && (c = p), p > u && (u = p);
3141
3166
  const b = [];
3142
- o.length > m && isFinite(o[m]) && b.push(o[m]), r && isFinite(r[m]) && b.push(r[m]), a && isFinite(a[m]) && b.push(a[m]), l && isFinite(l[m]) && b.push(l[m]), c && isFinite(c[m]) && b.push(c[m]), u && isFinite(u[m]) && b.push(u[m]);
3167
+ o.length > y && isFinite(o[y]) && b.push(o[y]), r && isFinite(r[y]) && b.push(r[y]), a && isFinite(a[y]) && b.push(a[y]), l && isFinite(l[y]) && b.push(l[y]), h && isFinite(h[y]) && b.push(h[y]), d && isFinite(d[y]) && b.push(d[y]);
3143
3168
  for (const v of b)
3144
- v < y && (y = v), v > f && (f = v);
3169
+ v < m && (m = v), v > f && (f = v);
3145
3170
  }
3146
- return h === 1 / 0 || y === 1 / 0 ? null : { xMin: h, xMax: d, yMin: y, yMax: f };
3171
+ return c === 1 / 0 || m === 1 / 0 ? null : { xMin: c, xMax: u, yMin: m, yMax: f };
3147
3172
  }
3148
3173
  function A(s) {
3149
3174
  return s ? s instanceof Float32Array || s instanceof Float64Array ? s : new Float32Array(s) : new Float32Array(0);
@@ -3152,19 +3177,19 @@ function R(s, e) {
3152
3177
  const t = new s.constructor(s.length + e.length);
3153
3178
  return t.set(s, 0), t.set(e, s.length), t;
3154
3179
  }
3155
- function Ft(s, e) {
3180
+ function Yt(s, e) {
3156
3181
  const { x: t, y: i } = s, n = t.length;
3157
3182
  if (n < e) return { ...s };
3158
3183
  const o = new Float32Array(n), r = Math.floor(e / 2);
3159
3184
  for (let a = 0; a < n; a++) {
3160
- let l = 0, c = 0;
3161
- for (let u = a - r; u <= a + r; u++)
3162
- u >= 0 && u < n && (l += i[u], c++);
3163
- o[a] = l / c;
3185
+ let l = 0, h = 0;
3186
+ for (let d = a - r; d <= a + r; d++)
3187
+ d >= 0 && d < n && (l += i[d], h++);
3188
+ o[a] = l / h;
3164
3189
  }
3165
3190
  return { x: t, y: o };
3166
3191
  }
3167
- function Lt(s, e) {
3192
+ function Vt(s, e) {
3168
3193
  var n, o;
3169
3194
  if (e < 0 || e >= s.x.length) return null;
3170
3195
  if (s.yError && e < s.yError.length) {
@@ -3174,7 +3199,7 @@ function Lt(s, e) {
3174
3199
  const t = ((n = s.yErrorMinus) == null ? void 0 : n[e]) ?? 0, i = ((o = s.yErrorPlus) == null ? void 0 : o[e]) ?? 0;
3175
3200
  return t > 0 || i > 0 ? [t, i] : null;
3176
3201
  }
3177
- function zt(s, e) {
3202
+ function _t(s, e) {
3178
3203
  var n, o;
3179
3204
  if (e < 0 || e >= s.x.length) return null;
3180
3205
  if (s.xError && e < s.xError.length) {
@@ -3184,13 +3209,13 @@ function zt(s, e) {
3184
3209
  const t = ((n = s.xErrorMinus) == null ? void 0 : n[e]) ?? 0, i = ((o = s.xErrorPlus) == null ? void 0 : o[e]) ?? 0;
3185
3210
  return t > 0 || i > 0 ? [t, i] : null;
3186
3211
  }
3187
- const Ot = {
3212
+ const Xt = {
3188
3213
  color: "#ff0055",
3189
3214
  width: 1.5,
3190
3215
  opacity: 1,
3191
3216
  pointSize: 4
3192
3217
  };
3193
- class Yt {
3218
+ class $t {
3194
3219
  constructor(e) {
3195
3220
  g(this, "id");
3196
3221
  g(this, "type");
@@ -3248,8 +3273,8 @@ class Yt {
3248
3273
  this.lastAppendCount = 0;
3249
3274
  });
3250
3275
  g(this, "hasErrorData", () => !!(this.data.yError || this.data.yErrorPlus || this.data.yErrorMinus || this.data.xError || this.data.xErrorPlus || this.data.xErrorMinus));
3251
- g(this, "getYError", (e) => Lt(this.data, e));
3252
- g(this, "getXError", (e) => zt(this.data, e));
3276
+ g(this, "getYError", (e) => Vt(this.data, e));
3277
+ g(this, "getXError", (e) => _t(this.data, e));
3253
3278
  if (this.id = e.id, this.name = e.name, this.type = e.type, this.yAxisId = e.yAxisId, this.visible = e.visible ?? !0, this.stackId = e.stackId, this.cycle = e.cycle, this.maxPoints = e.maxPoints, this.markers = e.markers ?? [], this.type === "heatmap") {
3254
3279
  const t = e;
3255
3280
  this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.heatmapData = {
@@ -3288,13 +3313,13 @@ class Yt {
3288
3313
  median: t != null && t.median ? A(t.median) : void 0
3289
3314
  }, this.type === "candlestick" && this.data.close && this.data.y.length !== this.data.x.length && (this.data.y = this.data.close);
3290
3315
  }
3291
- this.style = { ...Ot, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
3316
+ this.style = { ...Xt, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
3292
3317
  }
3293
3318
  getData() {
3294
- return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = Ft(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
3319
+ return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = Yt(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
3295
3320
  }
3296
3321
  getBounds() {
3297
- return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = Dt(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
3322
+ return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = zt(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
3298
3323
  }
3299
3324
  updateData(e) {
3300
3325
  if (e) {
@@ -3342,24 +3367,24 @@ class Yt {
3342
3367
  }
3343
3368
  }
3344
3369
  const Ie = /* @__PURE__ */ new Map();
3345
- function Oi(s, e) {
3370
+ function Ui(s, e) {
3346
3371
  Ie.set(s, e);
3347
3372
  }
3348
- function _t(s) {
3373
+ function Ht(s) {
3349
3374
  return Ie.get(s);
3350
3375
  }
3351
- function Vt(s, e) {
3376
+ function Nt(s, e) {
3352
3377
  if (!s.renderer) return;
3353
3378
  const t = e.getData(), i = e.getType();
3354
3379
  if (!t || t.x.length === 0) return;
3355
3380
  const n = e.getId();
3356
3381
  if (i === "band" || i === "area") {
3357
3382
  const o = i === "area" ? new Float32Array(t.x.length).fill(0) : t.y2 || new Float32Array(t.x.length).fill(0);
3358
- s.renderer.createBuffer(n, Ce(t.x, t.y, o));
3383
+ s.renderer.createBuffer(n, Ae(t.x, t.y, o));
3359
3384
  } else
3360
- s.renderer.createBuffer(n, we(t.x, t.y));
3385
+ s.renderer.createBuffer(n, Ce(t.x, t.y));
3361
3386
  if (e.hasErrorData()) {
3362
- const o = Ze(
3387
+ const o = et(
3363
3388
  t.x,
3364
3389
  t.y,
3365
3390
  {
@@ -3379,12 +3404,12 @@ function Vt(s, e) {
3379
3404
  const o = e.getStyle().stepMode ?? "after";
3380
3405
  s.renderer.createBuffer(
3381
3406
  `${n}_step`,
3382
- Qe(t.x, t.y, o)
3407
+ Ke(t.x, t.y, o)
3383
3408
  );
3384
3409
  }
3385
3410
  e.resetLastAppendCount();
3386
3411
  }
3387
- function Xt(s, e) {
3412
+ function Ut(s, e) {
3388
3413
  var n;
3389
3414
  const t = Array.from(s.series.values()).filter(
3390
3415
  (o) => o.getStackId() === e
@@ -3398,11 +3423,11 @@ function Xt(s, e) {
3398
3423
  for (let l = 0; l < r.y.length; l++) i[l] += r.y[l];
3399
3424
  (n = s.renderer) == null || n.createBuffer(
3400
3425
  o.getId(),
3401
- Ce(r.x, i, a)
3426
+ Ae(r.x, i, a)
3402
3427
  ), o.resetLastAppendCount();
3403
3428
  }
3404
3429
  }
3405
- const $t = /* @__PURE__ */ new Set([
3430
+ const qt = /* @__PURE__ */ new Set([
3406
3431
  "line",
3407
3432
  "scatter",
3408
3433
  "line+scatter",
@@ -3415,82 +3440,82 @@ function W(s, e) {
3415
3440
  if (!s.renderer) return;
3416
3441
  const t = e.getStackId();
3417
3442
  if (t) {
3418
- Ht(s, t);
3443
+ Wt(s, t);
3419
3444
  return;
3420
3445
  }
3421
3446
  const i = e.getType();
3422
3447
  if (i !== "heatmap" && i !== "polar" && (!e.getData() || e.getData().x.length === 0))
3423
3448
  return;
3424
- const n = _t(i);
3449
+ const n = Ht(i);
3425
3450
  if (n) {
3426
3451
  n(s, e);
3427
3452
  return;
3428
3453
  }
3429
- if ($t.has(i)) {
3430
- Vt(s, e);
3454
+ if (qt.has(i)) {
3455
+ Nt(s, e);
3431
3456
  return;
3432
3457
  }
3433
3458
  throw new Error(
3434
3459
  `[VeloPlot] Series type "${i}" requires an extended bundle. Import from 'velo-plot/trading', 'velo-plot/scientific', or 'velo-plot/full'.`
3435
3460
  );
3436
3461
  }
3437
- function Ht(s, e) {
3438
- Xt(s, e);
3462
+ function Wt(s, e) {
3463
+ Ut(s, e);
3439
3464
  }
3440
- const Ee = [];
3441
- let re = null;
3442
- function Yi(s) {
3443
- Ee.push(s);
3465
+ const Re = [];
3466
+ let le = null;
3467
+ function qi(s) {
3468
+ Re.push(s);
3444
3469
  }
3445
- function _i(s) {
3446
- re = s;
3470
+ function Wi(s) {
3471
+ le = s;
3447
3472
  }
3448
- function Nt(s, e) {
3473
+ function Gt(s, e) {
3449
3474
  let t = e;
3450
- for (const i of Ee)
3475
+ for (const i of Re)
3451
3476
  t = i(s, t);
3452
3477
  return t;
3453
3478
  }
3454
- function Ut(s) {
3455
- return re ? re(s) : [s];
3479
+ function jt(s) {
3480
+ return le ? le(s) : [s];
3456
3481
  }
3457
- function qt(s, e) {
3458
- for (const t of Ut(e))
3459
- Wt(s, t);
3482
+ function Qt(s, e) {
3483
+ for (const t of jt(e))
3484
+ Zt(s, t);
3460
3485
  }
3461
- function Wt(s, e) {
3486
+ function Zt(s, e) {
3462
3487
  var n, o;
3463
- const t = Nt(s, e);
3488
+ const t = Gt(s, e);
3464
3489
  if (t.type !== "heatmap" && !((n = t.style) != null && n.color) && !t.color && s.colorScheme) {
3465
3490
  const r = s.series.size, a = s.colorScheme.colors[r % s.colorScheme.colors.length];
3466
3491
  t.style || (t.style = {}), t.style.color = a;
3467
3492
  }
3468
- const i = new Yt(t);
3493
+ const i = new $t(t);
3469
3494
  s.series.set(i.getId(), i), W(s, i), (s.xAxisOptions.auto || Array.from(s.yAxisOptionsMap.values()).some((r) => r.auto)) && s.autoScale(!1), (o = s.updateLegend) == null || o.call(s), s.requestRender();
3470
3495
  }
3471
- function Gt(s, e) {
3496
+ function Jt(s, e) {
3472
3497
  var i;
3473
3498
  const t = s.series.get(e);
3474
3499
  t && (s.renderer.deleteBuffer(e), s.renderer.deleteBuffer(`${e}_step`), t.destroy(), s.series.delete(e), (i = s.updateLegend) == null || i.call(s), s.requestRender());
3475
3500
  }
3476
- const Re = [];
3477
- function Vi(s) {
3478
- Re.push(s);
3501
+ const De = [];
3502
+ function Gi(s) {
3503
+ De.push(s);
3479
3504
  }
3480
- function jt(s, e) {
3505
+ function Kt(s, e) {
3481
3506
  let t = e;
3482
- for (const i of Re)
3507
+ for (const i of De)
3483
3508
  t = i(s, t);
3484
3509
  return t;
3485
3510
  }
3486
- function Qt(s, e, t) {
3511
+ function ei(s, e, t) {
3487
3512
  var a;
3488
3513
  const i = s.series.get(e);
3489
3514
  if (!i) return;
3490
- const n = !!t.append, o = n ? ((a = i.getBounds()) == null ? void 0 : a.xMax) ?? -1 / 0 : -1 / 0, r = jt(s, t);
3491
- i.updateData(r), W(s, i), n && De(s, i, o), s.requestRender();
3515
+ const n = !!t.append, o = n ? ((a = i.getBounds()) == null ? void 0 : a.xMax) ?? -1 / 0 : -1 / 0, r = Kt(s, t);
3516
+ i.updateData(r), W(s, i), n && Fe(s, i, o), s.requestRender();
3492
3517
  }
3493
- function De(s, e, t) {
3518
+ function Fe(s, e, t) {
3494
3519
  if (s.autoScrollEnabled) {
3495
3520
  const i = e.getBounds();
3496
3521
  if (i) {
@@ -3514,18 +3539,18 @@ function De(s, e, t) {
3514
3539
  }
3515
3540
  }
3516
3541
  }
3517
- function Zt(s, e, t, i) {
3542
+ function ti(s, e, t, i) {
3518
3543
  var r;
3519
3544
  const n = s.series.get(e);
3520
3545
  if (!n) return;
3521
3546
  const o = ((r = n.getBounds()) == null ? void 0 : r.xMax) ?? -1 / 0;
3522
- n.updateData({ x: t, y: i, append: !0 }), W(s, n), De(s, n, o), s.requestRender();
3547
+ n.updateData({ x: t, y: i, append: !0 }), W(s, n), Fe(s, n, o), s.requestRender();
3523
3548
  }
3524
- function Jt(s, e, t) {
3549
+ function ii(s, e, t) {
3525
3550
  const i = s.series.get(e);
3526
3551
  i && (i.setMaxPoints(t), s.requestRender());
3527
3552
  }
3528
- class X {
3553
+ class $ {
3529
3554
  constructor() {
3530
3555
  g(this, "domain", [0, 1]);
3531
3556
  g(this, "range", [0, 100]);
@@ -3556,14 +3581,14 @@ class X {
3556
3581
  ticks(e = 10) {
3557
3582
  const [t, i] = this.domain;
3558
3583
  if (!isFinite(t) || !isFinite(i) || t === i) return [];
3559
- const n = Kt(t, i, e), o = Math.ceil(t / n) * n, r = [], a = 100;
3584
+ const n = si(t, i, e), o = Math.ceil(t / n) * n, r = [], a = 100;
3560
3585
  let l = o;
3561
3586
  for (; l <= i + n * 0.5 && r.length < a; )
3562
3587
  r.push(Math.round(l * 1e12) / 1e12), l += n;
3563
3588
  return r;
3564
3589
  }
3565
3590
  }
3566
- class $ {
3591
+ class H {
3567
3592
  constructor() {
3568
3593
  g(this, "domain", [1, 1e3]);
3569
3594
  g(this, "range", [0, 100]);
@@ -3584,12 +3609,12 @@ class $ {
3584
3609
  transform(e) {
3585
3610
  const [t, i] = this.domain, [n, o] = this.range;
3586
3611
  if (e <= 0) return n;
3587
- const r = Math.log(t) / Math.log(this.base), a = Math.log(i) / Math.log(this.base), c = (Math.log(e) / Math.log(this.base) - r) / (a - r);
3588
- return n + c * (o - n);
3612
+ const r = Math.log(t) / Math.log(this.base), a = Math.log(i) / Math.log(this.base), h = (Math.log(e) / Math.log(this.base) - r) / (a - r);
3613
+ return n + h * (o - n);
3589
3614
  }
3590
3615
  invert(e) {
3591
- const [t, i] = this.domain, [n, o] = this.range, r = Math.log(t) / Math.log(this.base), a = Math.log(i) / Math.log(this.base), l = (e - n) / (o - n), c = r + l * (a - r);
3592
- return Math.pow(this.base, c);
3616
+ const [t, i] = this.domain, [n, o] = this.range, r = Math.log(t) / Math.log(this.base), a = Math.log(i) / Math.log(this.base), l = (e - n) / (o - n), h = r + l * (a - r);
3617
+ return Math.pow(this.base, h);
3593
3618
  }
3594
3619
  ticks(e = 10) {
3595
3620
  const [t, i] = this.domain, n = Math.floor(Math.log10(t)), o = Math.ceil(Math.log10(i)), r = [];
@@ -3600,17 +3625,17 @@ class $ {
3600
3625
  return r;
3601
3626
  }
3602
3627
  }
3603
- function Kt(s, e, t) {
3628
+ function si(s, e, t) {
3604
3629
  const i = e - s;
3605
3630
  if (i <= 0 || !isFinite(i)) return 1;
3606
3631
  const n = i / t, o = Math.pow(10, Math.floor(Math.log10(n))), r = n / o;
3607
3632
  let a;
3608
3633
  return r < 1.5 ? a = 1 : r < 3 ? a = 2 : r < 7 ? a = 5 : a = 10, a * o;
3609
3634
  }
3610
- function Xi(s) {
3611
- return s === "log" ? new $() : new X();
3635
+ function ji(s) {
3636
+ return s === "log" ? new H() : new $();
3612
3637
  }
3613
- const I = {
3638
+ const E = {
3614
3639
  title: {
3615
3640
  text: "",
3616
3641
  visible: !1,
@@ -3676,78 +3701,83 @@ const I = {
3676
3701
  },
3677
3702
  autoMargins: !0
3678
3703
  };
3679
- function Fe(s) {
3704
+ function Le(s) {
3680
3705
  var e;
3681
3706
  return s ? {
3682
- title: { ...I.title, ...s.title },
3683
- legend: { ...I.legend, ...s.legend },
3684
- toolbarPosition: s.toolbarPosition ?? I.toolbarPosition,
3707
+ title: { ...E.title, ...s.title },
3708
+ legend: { ...E.legend, ...s.legend },
3709
+ toolbarPosition: s.toolbarPosition ?? E.toolbarPosition,
3685
3710
  crosshair: {
3686
- ...I.crosshair,
3711
+ ...E.crosshair,
3687
3712
  ...s.crosshair,
3688
3713
  valueFormat: {
3689
- ...I.crosshair.valueFormat,
3714
+ ...E.crosshair.valueFormat,
3690
3715
  ...(e = s.crosshair) == null ? void 0 : e.valueFormat
3691
3716
  }
3692
3717
  },
3693
- margins: { ...I.margins, ...s.margins },
3694
- plotPadding: { ...I.plotPadding, ...s.plotPadding },
3695
- xAxisLayout: { ...I.xAxisLayout, ...s.xAxisLayout },
3696
- yAxisLayout: { ...I.yAxisLayout, ...s.yAxisLayout },
3697
- autoMargins: s.autoMargins ?? I.autoMargins
3698
- } : { ...I };
3699
- }
3700
- function ei(s, e) {
3701
- var w;
3718
+ margins: { ...E.margins, ...s.margins },
3719
+ plotPadding: { ...E.plotPadding, ...s.plotPadding },
3720
+ xAxisLayout: { ...E.xAxisLayout, ...s.xAxisLayout },
3721
+ yAxisLayout: { ...E.yAxisLayout, ...s.yAxisLayout },
3722
+ autoMargins: s.autoMargins ?? E.autoMargins
3723
+ } : { ...E };
3724
+ }
3725
+ function ni(s, e) {
3726
+ var k;
3702
3727
  if (!s) throw new Error("[VeloPlot] Container element is required");
3703
- const t = e.devicePixelRatio ?? window.devicePixelRatio, i = Fe(e.layout), n = typeof e.theme == "string" ? Te(e.theme) : e.theme ?? dt, o = H(e.background ?? n.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = H(n.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], c = e.showLegend ?? n.legend.visible, u = ((w = e.toolbar) == null ? void 0 : w.show) ?? e.showControls ?? !1, h = e.autoScroll ?? !1, d = e.showStatistics ?? !1, y = { scale: "linear", auto: !0, ...e.xAxis }, f = y.scale === "log" ? new $() : new X(), m = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
3704
- let b = "default";
3705
- (e.yAxis ? Array.isArray(e.yAxis) ? e.yAxis : [e.yAxis] : [{}]).forEach((C, k) => {
3706
- const P = k === 0, N = P ? "default" : `y${k}`, B = C.id || N;
3707
- P && (b = B);
3708
- const ce = { scale: "linear", auto: !0, position: C.position || (P ? "left" : "right"), ...C, id: B };
3709
- m.set(B, ce), x.set(B, ce.scale === "log" ? new $() : new X());
3728
+ const t = e.devicePixelRatio ?? window.devicePixelRatio, i = Le(e.layout), n = typeof e.theme == "string" ? Be(e.theme) : e.theme ?? yt, o = N(e.background ?? n.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = N(n.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], h = e.renderer === "svg", d = e.showLegend ?? (h ? !1 : n.legend.visible), c = ((k = e.toolbar) == null ? void 0 : k.show) ?? e.showControls ?? !1, u = e.autoScroll ?? !1, m = e.showStatistics ?? !1, f = { scale: "linear", auto: !0, ...e.xAxis }, y = f.scale === "log" ? new H() : new $(), p = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
3729
+ let v = "default";
3730
+ (e.yAxis ? Array.isArray(e.yAxis) ? e.yAxis : [e.yAxis] : [{}]).forEach((B, z) => {
3731
+ const P = z === 0, Ve = P ? "default" : `y${z}`, Z = B.id || Ve;
3732
+ P && (v = Z);
3733
+ const de = { scale: "linear", auto: !0, position: B.position || (P ? "left" : "right"), ...B, id: Z };
3734
+ p.set(Z, de), b.set(Z, de.scale === "log" ? new H() : new $());
3710
3735
  }), s.style.position !== "absolute" && (s.style.position = "relative"), s.style.overflow = "hidden", s.style.backgroundColor = e.background ?? n.backgroundColor;
3711
- const p = xe("webgl"), M = xe("overlay");
3736
+ const M = ve("webgl"), S = ve("overlay"), w = h ? oi() : null;
3712
3737
  for (; s.firstChild; )
3713
3738
  s.removeChild(s.firstChild);
3714
- s.appendChild(p), s.appendChild(M);
3715
- const S = M.getContext("2d");
3716
- if (!S) throw new Error("Failed to get 2D context");
3717
- return {
3739
+ s.appendChild(M), s.appendChild(S);
3740
+ const C = S.getContext("2d");
3741
+ if (!C) throw new Error("Failed to get 2D context");
3742
+ return h && w && (s.insertBefore(w, M), M.style.display = "none", S.style.display = "block", S.style.pointerEvents = "none", w.style.zIndex = "1", S.style.zIndex = "2"), {
3718
3743
  theme: n,
3719
3744
  backgroundColor: r,
3720
3745
  plotAreaColor: l,
3721
- showLegend: c,
3722
- showControls: u,
3723
- autoScroll: h,
3724
- showStatistics: d,
3746
+ showLegend: d,
3747
+ showControls: c,
3748
+ autoScroll: u,
3749
+ showStatistics: m,
3725
3750
  dpr: t,
3726
- xAxisOptions: y,
3727
- xScale: f,
3728
- yAxisOptionsMap: m,
3729
- yScales: x,
3730
- primaryYAxisId: b,
3731
- webglCanvas: p,
3732
- overlayCanvas: M,
3733
- overlayCtx: S,
3751
+ xAxisOptions: f,
3752
+ xScale: y,
3753
+ yAxisOptionsMap: p,
3754
+ yScales: b,
3755
+ primaryYAxisId: v,
3756
+ webglCanvas: M,
3757
+ overlayCanvas: S,
3758
+ overlayCtx: C,
3759
+ svgRoot: w,
3734
3760
  layout: i
3735
3761
  };
3736
3762
  }
3737
- function xe(s) {
3763
+ function oi() {
3764
+ const s = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3765
+ return s.setAttribute("class", "velo-plot-svg-layer"), s.setAttribute("xmlns", "http://www.w3.org/2000/svg"), s.style.position = "absolute", s.style.inset = "0", s.style.width = "100%", s.style.height = "100%", s.style.pointerEvents = "none", s;
3766
+ }
3767
+ function ve(s) {
3738
3768
  const e = document.createElement("canvas");
3739
3769
  return e.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;", s === "overlay" && (e.style.pointerEvents = "none"), e;
3740
3770
  }
3741
- function ti(s, e, t) {
3742
- const i = s.getBoundingClientRect(), n = Array.from(e.values()).filter((h) => h.position !== "right").length, o = Array.from(e.values()).filter((h) => h.position === "right").length, r = (t == null ? void 0 : t.margins) || U, a = (r.left ?? U.left) + Math.max(0, n - 1) * 65, l = (r.right ?? U.right) + o * 65, c = r.top ?? U.top, u = r.bottom ?? U.bottom;
3771
+ function ri(s, e, t) {
3772
+ const i = s.getBoundingClientRect(), n = Array.from(e.values()).filter((c) => c.position !== "right").length, o = Array.from(e.values()).filter((c) => c.position === "right").length, r = (t == null ? void 0 : t.margins) || U, a = (r.left ?? U.left) + Math.max(0, n - 1) * 65, l = (r.right ?? U.right) + o * 65, h = r.top ?? U.top, d = r.bottom ?? U.bottom;
3743
3773
  return {
3744
3774
  x: a,
3745
- y: c,
3775
+ y: h,
3746
3776
  width: Math.max(1, i.width - a - l),
3747
- height: Math.max(1, i.height - c - u)
3777
+ height: Math.max(1, i.height - h - d)
3748
3778
  };
3749
3779
  }
3750
- function ii(s) {
3780
+ function ai(s) {
3751
3781
  const e = [];
3752
3782
  let t = 0, i = 0;
3753
3783
  return s.forEach((n, o) => {
@@ -3755,13 +3785,13 @@ function ii(s) {
3755
3785
  r === "left" ? t++ : i++, e.push({ id: o, position: r, offset: a });
3756
3786
  }), e;
3757
3787
  }
3758
- function si(s, e, t, i, n) {
3788
+ function li(s, e, t, i, n) {
3759
3789
  const o = s.getBoundingClientRect();
3760
3790
  if (o.width === 0 || o.height === 0) return !1;
3761
- const r = Math.max(1, Math.round(o.width * n)), a = Math.max(1, Math.round(o.height * n)), l = `${Math.round(o.width)}px`, c = `${Math.round(o.height)}px`, u = e.width !== r || e.height !== a || e.style.width !== l || e.style.height !== c, h = t.width !== r || t.height !== a;
3762
- return !u && !h ? (i.setTransform(n, 0, 0, n, 0, 0), i.imageSmoothingEnabled = !0, "imageSmoothingQuality" in i && (i.imageSmoothingQuality = "high"), !1) : (u && (e.width = r, e.height = a, e.style.width = l, e.style.height = c), h && (t.width = r, t.height = a), t.style.width = l, t.style.height = c, i.setTransform(n, 0, 0, n, 0, 0), i.imageSmoothingEnabled = !0, "imageSmoothingQuality" in i && (i.imageSmoothingQuality = "high"), !0);
3791
+ const r = Math.max(1, Math.round(o.width * n)), a = Math.max(1, Math.round(o.height * n)), l = `${Math.round(o.width)}px`, h = `${Math.round(o.height)}px`, d = e.width !== r || e.height !== a || e.style.width !== l || e.style.height !== h, c = t.width !== r || t.height !== a;
3792
+ return !d && !c ? (i.setTransform(n, 0, 0, n, 0, 0), i.imageSmoothingEnabled = !0, "imageSmoothingQuality" in i && (i.imageSmoothingQuality = "high"), !1) : (d && (e.width = r, e.height = a, e.style.width = l, e.style.height = h), c && (t.width = r, t.height = a), t.style.width = l, t.style.height = h, i.setTransform(n, 0, 0, n, 0, 0), i.imageSmoothingEnabled = !0, "imageSmoothingQuality" in i && (i.imageSmoothingQuality = "high"), !0);
3763
3793
  }
3764
- class ni {
3794
+ class hi {
3765
3795
  constructor(e) {
3766
3796
  g(this, "data", /* @__PURE__ */ new Map());
3767
3797
  }
@@ -3794,7 +3824,7 @@ class ni {
3794
3824
  });
3795
3825
  }
3796
3826
  }
3797
- class oi {
3827
+ class ci {
3798
3828
  constructor(e, t = !0) {
3799
3829
  g(this, "prefix");
3800
3830
  g(this, "enabled");
@@ -3813,7 +3843,7 @@ class oi {
3813
3843
  console.error(this.prefix, e, ...t);
3814
3844
  }
3815
3845
  }
3816
- class ri {
3846
+ class ui {
3817
3847
  constructor(e) {
3818
3848
  g(this, "chart");
3819
3849
  g(this, "subscriptions", []);
@@ -3852,7 +3882,7 @@ class ri {
3852
3882
  this.subscriptions.forEach((e) => e()), this.subscriptions = [], this.customListeners.clear();
3853
3883
  }
3854
3884
  }
3855
- class ai {
3885
+ class di {
3856
3886
  constructor(e, t) {
3857
3887
  g(this, "_container");
3858
3888
  g(this, "_theme");
@@ -3939,15 +3969,15 @@ class ai {
3939
3969
  this.overlays.forEach((t) => t.remove()), this.overlays.clear(), (e = this.notifications) == null || e.remove(), this.notifications = null;
3940
3970
  }
3941
3971
  }
3942
- function li(s, e) {
3943
- const t = new ni(s), i = new oi(s), n = new ri(e.chart), o = new ai(e.container, e.theme), r = {
3972
+ function gi(s, e) {
3973
+ const t = new hi(s), i = new ci(s), n = new ui(e.chart), o = new di(e.container, e.theme), r = {
3944
3974
  get gl() {
3945
- var h;
3946
- return (h = e.getGL) == null ? void 0 : h.call(e);
3975
+ var c;
3976
+ return (c = e.getGL) == null ? void 0 : c.call(e);
3947
3977
  },
3948
3978
  get ctx2d() {
3949
- var h;
3950
- return (h = e.get2DContext) == null ? void 0 : h.call(e);
3979
+ var c;
3980
+ return (c = e.get2DContext) == null ? void 0 : c.call(e);
3951
3981
  },
3952
3982
  get pixelRatio() {
3953
3983
  return e.getPixelRatio();
@@ -3963,23 +3993,23 @@ function li(s, e) {
3963
3993
  dataToPixelY: e.dataToPixelY,
3964
3994
  pixelToDataX: e.pixelToDataX,
3965
3995
  pixelToDataY: e.pixelToDataY,
3966
- pickPoint: (h, d, y = 20) => {
3996
+ pickPoint: (c, u, m = 20) => {
3967
3997
  var f;
3968
- return ((f = e.findNearestPoint) == null ? void 0 : f.call(e, h, d, y)) ?? null;
3998
+ return ((f = e.findNearestPoint) == null ? void 0 : f.call(e, c, u, m)) ?? null;
3969
3999
  }
3970
4000
  }, l = {
3971
4001
  getAllSeries: () => e.chart.getAllSeries(),
3972
- getSeries: (h) => e.chart.getSeries(h),
3973
- getSeriesData: (h) => {
3974
- const d = e.chart.getSeries(h);
3975
- if (d)
3976
- return d.getData();
4002
+ getSeries: (c) => e.chart.getSeries(c),
4003
+ getSeriesData: (c) => {
4004
+ const u = e.chart.getSeries(c);
4005
+ if (u)
4006
+ return u.getData();
3977
4007
  },
3978
4008
  getViewBounds: () => e.getViewBounds(),
3979
- getYAxisBounds: (h) => e.getYAxisBounds(h),
4009
+ getYAxisBounds: (c) => e.getYAxisBounds(c),
3980
4010
  getAnnotations: () => e.chart.getAnnotations(),
3981
4011
  getSelectedPoints: () => e.chart.getSelectedPoints()
3982
- }, c = /* @__PURE__ */ new Set();
4012
+ }, h = /* @__PURE__ */ new Set();
3983
4013
  return {
3984
4014
  chart: e.chart,
3985
4015
  render: r,
@@ -3989,28 +4019,28 @@ function li(s, e) {
3989
4019
  events: n,
3990
4020
  storage: t,
3991
4021
  log: i,
3992
- getPlugin(h) {
3993
- return e.getPlugin(h);
4022
+ getPlugin(c) {
4023
+ return e.getPlugin(c);
3994
4024
  },
3995
4025
  requestRender() {
3996
4026
  e.chart.render();
3997
4027
  },
3998
- requestAnimationFrame(h) {
3999
- const d = window.requestAnimationFrame(h);
4000
- return c.add(d), d;
4028
+ requestAnimationFrame(c) {
4029
+ const u = window.requestAnimationFrame(c);
4030
+ return h.add(u), u;
4001
4031
  },
4002
- cancelAnimationFrame(h) {
4003
- window.cancelAnimationFrame(h), c.delete(h);
4032
+ cancelAnimationFrame(c) {
4033
+ window.cancelAnimationFrame(c), h.delete(c);
4004
4034
  },
4005
4035
  _cleanup() {
4006
- n._cleanup(), o._cleanup(), c.forEach((h) => window.cancelAnimationFrame(h)), c.clear();
4036
+ n._cleanup(), o._cleanup(), h.forEach((c) => window.cancelAnimationFrame(c)), h.clear();
4007
4037
  },
4008
4038
  _getStorage() {
4009
4039
  return t;
4010
4040
  }
4011
4041
  };
4012
4042
  }
4013
- class hi {
4043
+ class fi {
4014
4044
  constructor(e) {
4015
4045
  g(this, "plugins", /* @__PURE__ */ new Map());
4016
4046
  g(this, "deps");
@@ -4020,6 +4050,7 @@ class hi {
4020
4050
  g(this, "hooksAfterRender", []);
4021
4051
  g(this, "hooksRenderWebGL", []);
4022
4052
  g(this, "hooksRenderOverlay", []);
4053
+ g(this, "hooksExportSVG", []);
4023
4054
  g(this, "hooksInteraction", []);
4024
4055
  g(this, "hooksViewChange", []);
4025
4056
  g(this, "hooksDataUpdate", []);
@@ -4053,9 +4084,9 @@ class hi {
4053
4084
  );
4054
4085
  return;
4055
4086
  }
4056
- const r = li(n, {
4087
+ const r = gi(n, {
4057
4088
  ...this.deps,
4058
- getPlugin: (c) => this.get(c)
4089
+ getPlugin: (h) => this.get(h)
4059
4090
  }), a = {
4060
4091
  plugin: i,
4061
4092
  context: r,
@@ -4064,10 +4095,10 @@ class hi {
4064
4095
  };
4065
4096
  this.plugins.set(n, a);
4066
4097
  try {
4067
- const c = (l = i.onInit) == null ? void 0 : l.call(i, r, t);
4068
- c instanceof Promise && await c, a.initialized = !0;
4069
- } catch (c) {
4070
- console.error(`[VeloPlot] Failed to initialize plugin "${n}":`, c), this.plugins.delete(n), r._cleanup();
4098
+ const h = (l = i.onInit) == null ? void 0 : l.call(i, r, t);
4099
+ h instanceof Promise && await h, a.initialized = !0;
4100
+ } catch (h) {
4101
+ console.error(`[VeloPlot] Failed to initialize plugin "${n}":`, h), this.plugins.delete(n), r._cleanup();
4071
4102
  return;
4072
4103
  }
4073
4104
  this.rebuildHookCaches();
@@ -4219,6 +4250,20 @@ class hi {
4219
4250
  );
4220
4251
  }
4221
4252
  }
4253
+ /**
4254
+ * Notify SVG export hooks
4255
+ */
4256
+ notifyExportSVG(e) {
4257
+ for (const t of this.hooksExportSVG)
4258
+ try {
4259
+ t.plugin.onExportSVG(e);
4260
+ } catch (i) {
4261
+ console.error(
4262
+ `[VeloPlot] Error in plugin "${t.plugin.manifest.name}" onExportSVG:`,
4263
+ i
4264
+ );
4265
+ }
4266
+ }
4222
4267
  /**
4223
4268
  * Notify interaction hooks
4224
4269
  * Returns false if any plugin prevents default
@@ -4426,10 +4471,10 @@ class hi {
4426
4471
  }
4427
4472
  rebuildHookCaches() {
4428
4473
  const e = Array.from(this.plugins.values()).filter((t) => t.initialized);
4429
- this.hooksBeforeRender = e.filter((t) => t.plugin.onBeforeRender), this.hooksAfterRender = e.filter((t) => t.plugin.onAfterRender), this.hooksRenderWebGL = e.filter((t) => t.plugin.onRenderWebGL), this.hooksRenderOverlay = e.filter((t) => t.plugin.onRenderOverlay), this.hooksInteraction = e.filter((t) => t.plugin.onInteraction), this.hooksViewChange = e.filter((t) => t.plugin.onViewChange), this.hooksDataUpdate = e.filter((t) => t.plugin.onDataUpdate), this.hooksSeriesAdd = e.filter((t) => t.plugin.onSeriesAdd), this.hooksSeriesRemove = e.filter((t) => t.plugin.onSeriesRemove), this.hooksSeriesChange = e.filter((t) => t.plugin.onSeriesChange), this.hooksResize = e.filter((t) => t.plugin.onResize), this.hooksThemeChange = e.filter((t) => t.plugin.onThemeChange), this.hooksSelectionChange = e.filter((t) => t.plugin.onSelectionChange), this.hooksSerialize = e.filter((t) => t.plugin.onSerialize);
4474
+ this.hooksBeforeRender = e.filter((t) => t.plugin.onBeforeRender), this.hooksAfterRender = e.filter((t) => t.plugin.onAfterRender), this.hooksRenderWebGL = e.filter((t) => t.plugin.onRenderWebGL), this.hooksRenderOverlay = e.filter((t) => t.plugin.onRenderOverlay), this.hooksExportSVG = e.filter((t) => t.plugin.onExportSVG), this.hooksInteraction = e.filter((t) => t.plugin.onInteraction), this.hooksViewChange = e.filter((t) => t.plugin.onViewChange), this.hooksDataUpdate = e.filter((t) => t.plugin.onDataUpdate), this.hooksSeriesAdd = e.filter((t) => t.plugin.onSeriesAdd), this.hooksSeriesRemove = e.filter((t) => t.plugin.onSeriesRemove), this.hooksSeriesChange = e.filter((t) => t.plugin.onSeriesChange), this.hooksResize = e.filter((t) => t.plugin.onResize), this.hooksThemeChange = e.filter((t) => t.plugin.onThemeChange), this.hooksSelectionChange = e.filter((t) => t.plugin.onSelectionChange), this.hooksSerialize = e.filter((t) => t.plugin.onSerialize);
4430
4475
  }
4431
4476
  clearHookCaches() {
4432
- this.hooksBeforeRender = [], this.hooksAfterRender = [], this.hooksRenderWebGL = [], this.hooksRenderOverlay = [], this.hooksInteraction = [], this.hooksViewChange = [], this.hooksDataUpdate = [], this.hooksSeriesAdd = [], this.hooksSeriesRemove = [], this.hooksSeriesChange = [], this.hooksResize = [], this.hooksThemeChange = [], this.hooksSelectionChange = [], this.hooksSerialize = [];
4477
+ this.hooksBeforeRender = [], this.hooksAfterRender = [], this.hooksRenderWebGL = [], this.hooksRenderOverlay = [], this.hooksExportSVG = [], this.hooksInteraction = [], this.hooksViewChange = [], this.hooksDataUpdate = [], this.hooksSeriesAdd = [], this.hooksSeriesRemove = [], this.hooksSeriesChange = [], this.hooksResize = [], this.hooksThemeChange = [], this.hooksSelectionChange = [], this.hooksSerialize = [];
4433
4478
  }
4434
4479
  }
4435
4480
  const T = {
@@ -4449,7 +4494,7 @@ const T = {
4449
4494
  PIN: '<svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"></line><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6a3 3 0 0 0-6 0v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17z"></path></svg>',
4450
4495
  PIN_OFF: '<svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="2" y1="2" x2="22" y2="22"></line><line x1="12" y1="17" x2="12" y2="22"></line><path d="M9 10.76V6a3 3 0 0 1 1.43-2.54m2.68.74A3 3 0 0 1 15 6v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V17h-2"></path><path d="M5 17h8"></path></svg>'
4451
4496
  };
4452
- class ci {
4497
+ class mi {
4453
4498
  constructor(e, t, i, n) {
4454
4499
  g(this, "container");
4455
4500
  g(this, "toolbar");
@@ -4637,24 +4682,24 @@ class ci {
4637
4682
  }
4638
4683
  updateButtonStates() {
4639
4684
  const e = this.toolbar.querySelectorAll("button"), t = this.isDarkTheme(), i = "#38bdf8", n = "#f59e0b", o = "#a855f7", r = "#fb7185", a = "#4ade80", l = t ? "#f1f5f9" : "#334155";
4640
- e.forEach((c) => {
4641
- const u = c.dataset.id, h = c.matches(":hover");
4642
- if (u === "pan") {
4643
- const d = this.currentMode === "pan";
4644
- c.style.color = d ? i : l, c.style.opacity = h || d ? "1" : "0.8", c.style.background = d ? t ? "rgba(56, 189, 248, 0.15)" : "rgba(56, 189, 248, 0.1)" : "transparent";
4645
- } else if (u === "boxZoom") {
4646
- const d = this.currentMode === "boxZoom";
4647
- c.style.color = d ? n : l, c.style.opacity = h || d ? "1" : "0.8", c.style.background = d ? t ? "rgba(245, 158, 11, 0.15)" : "rgba(245, 158, 11, 0.1)" : "transparent";
4648
- } else if (u === "select") {
4649
- const d = this.currentMode === "select";
4650
- c.style.color = d ? o : l, c.style.opacity = h || d ? "1" : "0.8", c.style.background = d ? t ? "rgba(168, 85, 247, 0.15)" : "rgba(168, 85, 247, 0.1)" : "transparent";
4651
- } else if (u === "delta") {
4652
- const d = this.currentMode === "delta", y = "#ef4444";
4653
- c.style.color = d ? y : l, c.style.opacity = h || d ? "1" : "0.8", c.style.background = d ? t ? "rgba(239, 68, 68, 0.15)" : "rgba(239, 68, 68, 0.1)" : "transparent";
4654
- } else if (u === "peak") {
4655
- const d = this.currentMode === "peak", y = "#10b981";
4656
- c.style.color = d ? y : l, c.style.opacity = h || d ? "1" : "0.8", c.style.background = d ? t ? "rgba(16, 185, 129, 0.15)" : "rgba(16, 185, 129, 0.1)" : "transparent";
4657
- } else u === "smooth" ? (c.style.color = this.isSmoothing ? r : l, c.style.opacity = h || this.isSmoothing ? "1" : "0.8", this.isSmoothing ? c.style.background = t ? "rgba(251, 113, 133, 0.15)" : "rgba(251, 113, 133, 0.1)" : h || (c.style.background = "transparent")) : u === "legend" ? (c.style.color = this.isLegendVisible ? a : l, c.style.opacity = h || this.isLegendVisible ? "1" : "0.8", this.isLegendVisible ? c.style.background = t ? "rgba(74, 222, 128, 0.15)" : "rgba(74, 222, 128, 0.1)" : h || (c.style.background = "transparent")) : u === "type" ? (c.innerHTML = this.currentType === "line" ? T.LINE : this.currentType === "scatter" ? T.SCATTER : T.BOTH, this.enforceSVGVisibility(c), c.style.color = l, c.style.opacity = h ? "1" : "0.8", h || (c.style.background = "transparent")) : (u === "reset" || u === "autoscale" || u === "export") && (c.style.color = l, c.style.opacity = h ? "1" : "0.8", h || (c.style.background = "transparent"));
4685
+ e.forEach((h) => {
4686
+ const d = h.dataset.id, c = h.matches(":hover");
4687
+ if (d === "pan") {
4688
+ const u = this.currentMode === "pan";
4689
+ h.style.color = u ? i : l, h.style.opacity = c || u ? "1" : "0.8", h.style.background = u ? t ? "rgba(56, 189, 248, 0.15)" : "rgba(56, 189, 248, 0.1)" : "transparent";
4690
+ } else if (d === "boxZoom") {
4691
+ const u = this.currentMode === "boxZoom";
4692
+ h.style.color = u ? n : l, h.style.opacity = c || u ? "1" : "0.8", h.style.background = u ? t ? "rgba(245, 158, 11, 0.15)" : "rgba(245, 158, 11, 0.1)" : "transparent";
4693
+ } else if (d === "select") {
4694
+ const u = this.currentMode === "select";
4695
+ h.style.color = u ? o : l, h.style.opacity = c || u ? "1" : "0.8", h.style.background = u ? t ? "rgba(168, 85, 247, 0.15)" : "rgba(168, 85, 247, 0.1)" : "transparent";
4696
+ } else if (d === "delta") {
4697
+ const u = this.currentMode === "delta", m = "#ef4444";
4698
+ h.style.color = u ? m : l, h.style.opacity = c || u ? "1" : "0.8", h.style.background = u ? t ? "rgba(239, 68, 68, 0.15)" : "rgba(239, 68, 68, 0.1)" : "transparent";
4699
+ } else if (d === "peak") {
4700
+ const u = this.currentMode === "peak", m = "#10b981";
4701
+ h.style.color = u ? m : l, h.style.opacity = c || u ? "1" : "0.8", h.style.background = u ? t ? "rgba(16, 185, 129, 0.15)" : "rgba(16, 185, 129, 0.1)" : "transparent";
4702
+ } else d === "smooth" ? (h.style.color = this.isSmoothing ? r : l, h.style.opacity = c || this.isSmoothing ? "1" : "0.8", this.isSmoothing ? h.style.background = t ? "rgba(251, 113, 133, 0.15)" : "rgba(251, 113, 133, 0.1)" : c || (h.style.background = "transparent")) : d === "legend" ? (h.style.color = this.isLegendVisible ? a : l, h.style.opacity = c || this.isLegendVisible ? "1" : "0.8", this.isLegendVisible ? h.style.background = t ? "rgba(74, 222, 128, 0.15)" : "rgba(74, 222, 128, 0.1)" : c || (h.style.background = "transparent")) : d === "type" ? (h.innerHTML = this.currentType === "line" ? T.LINE : this.currentType === "scatter" ? T.SCATTER : T.BOTH, this.enforceSVGVisibility(h), h.style.color = l, h.style.opacity = c ? "1" : "0.8", c || (h.style.background = "transparent")) : (d === "reset" || d === "autoscale" || d === "export") && (h.style.color = l, h.style.opacity = c ? "1" : "0.8", c || (h.style.background = "transparent"));
4658
4703
  });
4659
4704
  }
4660
4705
  updateTheme(e) {
@@ -4664,7 +4709,7 @@ class ci {
4664
4709
  this.container.remove();
4665
4710
  }
4666
4711
  }
4667
- class ui {
4712
+ class yi {
4668
4713
  constructor(e, t, i, n) {
4669
4714
  g(this, "container");
4670
4715
  g(this, "visualContainer");
@@ -4698,9 +4743,9 @@ class ui {
4698
4743
  padding: 4px;
4699
4744
  user-select: none;
4700
4745
  `;
4701
- const l = (u) => u.stopPropagation();
4746
+ const l = (d) => d.stopPropagation();
4702
4747
  ["mousedown", "mousemove", "pointerdown", "pointermove", "wheel", "touchstart", "touchmove"].forEach(
4703
- (u) => this.container.addEventListener(u, l)
4748
+ (d) => this.container.addEventListener(d, l)
4704
4749
  ), this.visualContainer = document.createElement("div"), this.visualContainer.style.cssText = `
4705
4750
  width: ${o}px;
4706
4751
  border-radius: ${t.legend.borderRadius}px;
@@ -4714,8 +4759,8 @@ class ui {
4714
4759
  background: rgba(255,255,255,0.05);
4715
4760
  border-bottom: 1px solid rgba(255,255,255,0.05);
4716
4761
  `, this.content = document.createElement("div"), this.content.style.padding = `${t.legend.padding}px`, this.visualContainer.appendChild(this.header), this.visualContainer.appendChild(this.content);
4717
- const c = document.createElement("div");
4718
- c.style.cssText = `
4762
+ const h = document.createElement("div");
4763
+ h.style.cssText = `
4719
4764
  position: absolute;
4720
4765
  right: 0;
4721
4766
  top: 0;
@@ -4724,7 +4769,7 @@ class ui {
4724
4769
  cursor: ew-resize;
4725
4770
  background: transparent;
4726
4771
  z-index: 10;
4727
- `, this.visualContainer.appendChild(c), e.appendChild(this.container), this.initDragging(c);
4772
+ `, this.visualContainer.appendChild(h), e.appendChild(this.container), this.initDragging(h);
4728
4773
  }
4729
4774
  updateStyle() {
4730
4775
  const e = this.theme.name.toLowerCase().includes("dark") || this.theme.name.toLowerCase().includes("midnight") || this.theme.name.toLowerCase().includes("electro"), t = this.theme.legend.backgroundColor, i = `1px solid ${this.theme.legend.borderColor}`;
@@ -4736,44 +4781,44 @@ class ui {
4736
4781
  }
4737
4782
  initDragging(e) {
4738
4783
  let t = null, i = 0, n = 0;
4739
- const o = (h) => {
4740
- if (h.button !== 0) return;
4741
- h.stopPropagation(), h.preventDefault();
4742
- const d = this.container.getBoundingClientRect();
4743
- this.dragOffsetX = h.clientX - d.left, this.dragOffsetY = h.clientY - d.top, this.isDragging = !0, this.callbacks.onInteractionStart && this.callbacks.onInteractionStart(), this.container.style.transition = "none", this.container.style.willChange = "left, top", this.visualContainer.style.boxShadow = "0 8px 24px rgba(0,0,0,0.3)", this.container.style.cursor = "grabbing", document.addEventListener("mousemove", l, { capture: !0 }), document.addEventListener("mouseup", c, { capture: !0 });
4744
- }, r = (h) => {
4745
- h.button === 0 && (h.stopPropagation(), h.preventDefault(), this.isResizing = !0, this.dragOffsetX = h.clientX, this.dragOffsetY = this.visualContainer.clientWidth, this.callbacks.onInteractionStart && this.callbacks.onInteractionStart(), this.container.style.transition = "none", this.container.style.cursor = "ew-resize", document.body.style.cursor = "ew-resize", document.addEventListener("mousemove", l, { capture: !0 }), document.addEventListener("mouseup", c, { capture: !0 }));
4784
+ const o = (c) => {
4785
+ if (c.button !== 0) return;
4786
+ c.stopPropagation(), c.preventDefault();
4787
+ const u = this.container.getBoundingClientRect();
4788
+ this.dragOffsetX = c.clientX - u.left, this.dragOffsetY = c.clientY - u.top, this.isDragging = !0, this.callbacks.onInteractionStart && this.callbacks.onInteractionStart(), this.container.style.transition = "none", this.container.style.willChange = "left, top", this.visualContainer.style.boxShadow = "0 8px 24px rgba(0,0,0,0.3)", this.container.style.cursor = "grabbing", document.addEventListener("mousemove", l, { capture: !0 }), document.addEventListener("mouseup", h, { capture: !0 });
4789
+ }, r = (c) => {
4790
+ c.button === 0 && (c.stopPropagation(), c.preventDefault(), this.isResizing = !0, this.dragOffsetX = c.clientX, this.dragOffsetY = this.visualContainer.clientWidth, this.callbacks.onInteractionStart && this.callbacks.onInteractionStart(), this.container.style.transition = "none", this.container.style.cursor = "ew-resize", document.body.style.cursor = "ew-resize", document.addEventListener("mousemove", l, { capture: !0 }), document.addEventListener("mouseup", h, { capture: !0 }));
4746
4791
  }, a = () => {
4747
- var d;
4748
- const h = (d = this.container.parentElement) == null ? void 0 : d.getBoundingClientRect();
4749
- if (h) {
4792
+ var u;
4793
+ const c = (u = this.container.parentElement) == null ? void 0 : u.getBoundingClientRect();
4794
+ if (c) {
4750
4795
  if (this.isDragging) {
4751
- let y = i - h.left - this.dragOffsetX, f = n - h.top - this.dragOffsetY;
4752
- y = Math.max(0, Math.min(y, h.width - this.container.clientWidth)), f = Math.max(0, Math.min(f, h.height - this.container.clientHeight)), this.container.style.left = `${y}px`, this.container.style.top = `${f}px`;
4796
+ let m = i - c.left - this.dragOffsetX, f = n - c.top - this.dragOffsetY;
4797
+ m = Math.max(0, Math.min(m, c.width - this.container.clientWidth)), f = Math.max(0, Math.min(f, c.height - this.container.clientHeight)), this.container.style.left = `${m}px`, this.container.style.top = `${f}px`;
4753
4798
  } else if (this.isResizing) {
4754
- const y = i - this.dragOffsetX, f = Math.max(80, Math.min(600, this.dragOffsetY + y));
4799
+ const m = i - this.dragOffsetX, f = Math.max(80, Math.min(600, this.dragOffsetY + m));
4755
4800
  this.visualContainer.style.width = `${f}px`, this.callbacks.onResize && this.callbacks.onResize(f);
4756
4801
  }
4757
4802
  t = null;
4758
4803
  }
4759
- }, l = (h) => {
4760
- !this.isDragging && !this.isResizing || (i = h.clientX, n = h.clientY, t || (t = requestAnimationFrame(a)));
4761
- }, c = () => {
4762
- var h;
4804
+ }, l = (c) => {
4805
+ !this.isDragging && !this.isResizing || (i = c.clientX, n = c.clientY, t || (t = requestAnimationFrame(a)));
4806
+ }, h = () => {
4807
+ var c;
4763
4808
  if (this.isDragging || this.isResizing) {
4764
4809
  if (t && cancelAnimationFrame(t), t = null, this.isDragging) {
4765
- const d = this.container.getBoundingClientRect(), y = (h = this.container.parentElement) == null ? void 0 : h.getBoundingClientRect();
4766
- y && this.callbacks.onMove(d.left - y.left, d.top - y.top);
4810
+ const u = this.container.getBoundingClientRect(), m = (c = this.container.parentElement) == null ? void 0 : c.getBoundingClientRect();
4811
+ m && this.callbacks.onMove(u.left - m.left, u.top - m.top);
4767
4812
  }
4768
4813
  this.isDragging = !1, this.isResizing = !1, this.callbacks.onInteractionEnd && this.callbacks.onInteractionEnd(), this.container.style.willChange = "auto", this.container.style.transition = "box-shadow 0.2s ease", this.visualContainer.style.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", this.container.style.cursor = "auto", document.body.style.cursor = "auto";
4769
4814
  }
4770
- document.removeEventListener("mousemove", l, { capture: !0 }), document.removeEventListener("mouseup", c, { capture: !0 });
4815
+ document.removeEventListener("mousemove", l, { capture: !0 }), document.removeEventListener("mouseup", h, { capture: !0 });
4771
4816
  };
4772
- this.header.addEventListener("mousedown", o), e.addEventListener("mousedown", r), this.container.addEventListener("wheel", (h) => h.stopPropagation()), this.container.addEventListener("click", (h) => h.stopPropagation()), this.container.addEventListener("dblclick", (h) => h.stopPropagation());
4773
- const u = (h) => {
4774
- !this.isDragging && !this.isResizing && h.stopPropagation();
4817
+ this.header.addEventListener("mousedown", o), e.addEventListener("mousedown", r), this.container.addEventListener("wheel", (c) => c.stopPropagation()), this.container.addEventListener("click", (c) => c.stopPropagation()), this.container.addEventListener("dblclick", (c) => c.stopPropagation());
4818
+ const d = (c) => {
4819
+ !this.isDragging && !this.isResizing && c.stopPropagation();
4775
4820
  };
4776
- this.container.addEventListener("mousemove", u), this.container.addEventListener("pointermove", u), this.container.addEventListener("pointerdown", u);
4821
+ this.container.addEventListener("mousemove", d), this.container.addEventListener("pointermove", d), this.container.addEventListener("pointerdown", d);
4777
4822
  }
4778
4823
  update(e) {
4779
4824
  this.series = e, this.render();
@@ -4833,20 +4878,20 @@ class ui {
4833
4878
  const r = e.getContext("2d");
4834
4879
  if (!r) return;
4835
4880
  r.clearRect(0, 0, e.width, e.height), r.scale(n, n);
4836
- const a = t.getStyle(), l = t.isVisible(), c = l ? a.color || "#ff0055" : "#888888", u = t.getType(), h = a.symbol || "circle";
4837
- r.fillStyle = c, r.strokeStyle = c, r.globalAlpha = l ? 1 : 0.6, r.lineWidth = 2;
4838
- const d = o / 2, y = o / 2, f = String(u).toLowerCase(), m = f === "scatter" || f === "1" || f === "line" && !!a.symbol, x = f.includes("scatter") || f === "2", b = f === "area" || f === "band";
4839
- if (m)
4840
- this.drawSymbol(r, h, d, y, o * 0.8);
4841
- else if (x)
4842
- r.beginPath(), r.moveTo(0, y), r.lineTo(o, y), r.stroke(), this.drawSymbol(r, h, d, y, o * 0.6);
4881
+ const a = t.getStyle(), l = t.isVisible(), h = l ? a.color || "#ff0055" : "#888888", d = t.getType(), c = a.symbol || "circle";
4882
+ r.fillStyle = h, r.strokeStyle = h, r.globalAlpha = l ? 1 : 0.6, r.lineWidth = 2;
4883
+ const u = o / 2, m = o / 2, f = String(d).toLowerCase(), y = f === "scatter" || f === "1" || f === "line" && !!a.symbol, p = f.includes("scatter") || f === "2", b = f === "area" || f === "band";
4884
+ if (y)
4885
+ this.drawSymbol(r, c, u, m, o * 0.8);
4886
+ else if (p)
4887
+ r.beginPath(), r.moveTo(0, m), r.lineTo(o, m), r.stroke(), this.drawSymbol(r, c, u, m, o * 0.6);
4843
4888
  else if (b)
4844
4889
  r.globalAlpha = 0.6, r.fillRect(0, o * 0.2, o, o * 0.6), r.globalAlpha = 1, r.strokeRect(0, o * 0.2, o, o * 0.6);
4845
4890
  else if (f === "candlestick") {
4846
4891
  const v = a.bullishColor || "#26a69a";
4847
4892
  r.fillStyle = v, r.fillRect(o * 0.3, o * 0.2, o * 0.4, o * 0.6), r.beginPath(), r.moveTo(o * 0.5, 0), r.lineTo(o * 0.5, o), r.strokeStyle = v, r.stroke();
4848
4893
  } else
4849
- r.beginPath(), r.moveTo(0, y), r.lineTo(o, y), r.stroke();
4894
+ r.beginPath(), r.moveTo(0, m), r.lineTo(o, m), r.stroke();
4850
4895
  }
4851
4896
  /**
4852
4897
  * Internal symbol drawing logic (shared with canvas export)
@@ -4891,16 +4936,16 @@ class ui {
4891
4936
  }
4892
4937
  draw(e, t) {
4893
4938
  if (this.series.length === 0) return;
4894
- const i = this.theme.legend, n = i.padding * t, o = i.itemGap * t, r = i.swatchSize * t, a = 8 * t, l = this.container.offsetLeft * t, c = this.container.offsetTop * t, u = this.container.clientWidth * t, h = this.container.clientHeight * t;
4939
+ const i = this.theme.legend, n = i.padding * t, o = i.itemGap * t, r = i.swatchSize * t, a = 8 * t, l = this.container.offsetLeft * t, h = this.container.offsetTop * t, d = this.container.clientWidth * t, c = this.container.clientHeight * t;
4895
4940
  e.save();
4896
- const d = this.theme.name.toLowerCase().includes("dark") || this.theme.name.toLowerCase().includes("midnight");
4897
- e.fillStyle = d ? i.backgroundColor : "rgba(255, 255, 255, 0.85)", e.strokeStyle = i.borderColor, e.lineWidth = 1 * t;
4898
- const y = i.borderRadius * t;
4899
- e.beginPath(), e.moveTo(l + y, c), e.lineTo(l + u - y, c), e.arcTo(l + u, c, l + u, c + y, y), e.lineTo(l + u, c + h - y), e.arcTo(l + u, c + h, l + u - y, c + h, y), e.lineTo(l + y, c + h), e.arcTo(l, c + h, l, c + h - y, y), e.lineTo(l, c + y), e.arcTo(l, c, l + y, c, y), e.closePath(), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "middle", e.font = `${i.fontSize * t}px ${i.fontFamily}`, this.series.forEach((f, m) => {
4900
- const x = c + a + n + m * (r + o) + r / 2, b = l + n + r / 2, v = x, p = f.getStyle(), M = f.getType(), S = p.symbol || "circle";
4901
- e.fillStyle = p.color || "#ff0055", e.strokeStyle = p.color || "#ff0055", e.lineWidth = 2 * t;
4902
- const w = String(M).toLowerCase(), C = w === "scatter" || w === "1" || w === "line" && !!p.symbol, k = w.includes("scatter") || w === "2";
4903
- C ? this.drawSymbol(e, S, b, v, r * 0.9) : k ? (e.beginPath(), e.moveTo(l + n, v), e.lineTo(l + n + r, v), e.stroke(), this.drawSymbol(e, S, b, v, r * 0.6)) : (e.beginPath(), e.moveTo(l + n, v), e.lineTo(l + n + r, v), e.stroke()), e.fillStyle = i.textColor, e.fillText(f.getName(), l + n + r + 8 * t, x);
4941
+ const u = this.theme.name.toLowerCase().includes("dark") || this.theme.name.toLowerCase().includes("midnight");
4942
+ e.fillStyle = u ? i.backgroundColor : "rgba(255, 255, 255, 0.85)", e.strokeStyle = i.borderColor, e.lineWidth = 1 * t;
4943
+ const m = i.borderRadius * t;
4944
+ e.beginPath(), e.moveTo(l + m, h), e.lineTo(l + d - m, h), e.arcTo(l + d, h, l + d, h + m, m), e.lineTo(l + d, h + c - m), e.arcTo(l + d, h + c, l + d - m, h + c, m), e.lineTo(l + m, h + c), e.arcTo(l, h + c, l, h + c - m, m), e.lineTo(l, h + m), e.arcTo(l, h, l + m, h, m), e.closePath(), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "middle", e.font = `${i.fontSize * t}px ${i.fontFamily}`, this.series.forEach((f, y) => {
4945
+ const p = h + a + n + y * (r + o) + r / 2, b = l + n + r / 2, v = p, x = f.getStyle(), M = f.getType(), S = x.symbol || "circle";
4946
+ e.fillStyle = x.color || "#ff0055", e.strokeStyle = x.color || "#ff0055", e.lineWidth = 2 * t;
4947
+ const w = String(M).toLowerCase(), C = w === "scatter" || w === "1" || w === "line" && !!x.symbol, k = w.includes("scatter") || w === "2";
4948
+ C ? this.drawSymbol(e, S, b, v, r * 0.9) : k ? (e.beginPath(), e.moveTo(l + n, v), e.lineTo(l + n + r, v), e.stroke(), this.drawSymbol(e, S, b, v, r * 0.6)) : (e.beginPath(), e.moveTo(l + n, v), e.lineTo(l + n + r, v), e.stroke()), e.fillStyle = i.textColor, e.fillText(f.getName(), l + n + r + 8 * t, p);
4904
4949
  }), e.restore();
4905
4950
  }
4906
4951
  updateTheme(e) {
@@ -4916,8 +4961,8 @@ class ui {
4916
4961
  this.container.remove();
4917
4962
  }
4918
4963
  }
4919
- function di(s) {
4920
- return s.showControls ? new ci(s.container, s.theme, {
4964
+ function pi(s) {
4965
+ return s.showControls ? new mi(s.container, s.theme, {
4921
4966
  onResetZoom: () => s.resetZoom(),
4922
4967
  onSetType: (e) => {
4923
4968
  s.series.forEach((t) => {
@@ -4956,52 +5001,52 @@ function di(s) {
4956
5001
  }
4957
5002
  }, s.toolbar) : null;
4958
5003
  }
4959
- function gi(s, e) {
4960
- var n, o, r, a, l, c;
5004
+ function xi(s, e) {
5005
+ var n, o, r, a, l, h;
4961
5006
  if (!s.showLegend) return null;
4962
5007
  const t = {
4963
5008
  ...e.legendPosition,
4964
5009
  highlightOnHover: ((n = s.legendOptions) == null ? void 0 : n.highlightOnHover) ?? ((r = (o = e.layout) == null ? void 0 : o.legend) == null ? void 0 : r.highlightOnHover) ?? !1,
4965
- bringToFrontOnHover: ((a = s.legendOptions) == null ? void 0 : a.bringToFrontOnHover) ?? ((c = (l = e.layout) == null ? void 0 : l.legend) == null ? void 0 : c.bringToFrontOnHover) ?? !0
4966
- }, i = new ui(
5010
+ bringToFrontOnHover: ((a = s.legendOptions) == null ? void 0 : a.bringToFrontOnHover) ?? ((h = (l = e.layout) == null ? void 0 : l.legend) == null ? void 0 : h.bringToFrontOnHover) ?? !0
5011
+ }, i = new yi(
4967
5012
  s.container,
4968
5013
  s.theme,
4969
5014
  t,
4970
5015
  {
4971
- onMove: (u, h) => s.onLegendMove(u, h),
5016
+ onMove: (d, c) => s.onLegendMove(d, c),
4972
5017
  onInteractionStart: () => {
4973
- var u;
4974
- return (u = s.onInteractionStart) == null ? void 0 : u.call(s);
5018
+ var d;
5019
+ return (d = s.onInteractionStart) == null ? void 0 : d.call(s);
4975
5020
  },
4976
5021
  onInteractionEnd: () => {
4977
- var u;
4978
- return (u = s.onInteractionEnd) == null ? void 0 : u.call(s);
5022
+ var d;
5023
+ return (d = s.onInteractionEnd) == null ? void 0 : d.call(s);
4979
5024
  },
4980
5025
  onHoverStart: () => {
4981
- var u;
4982
- return (u = s.onHoverStart) == null ? void 0 : u.call(s);
5026
+ var d;
5027
+ return (d = s.onHoverStart) == null ? void 0 : d.call(s);
4983
5028
  },
4984
5029
  onHoverEnd: () => {
4985
- var u;
4986
- return (u = s.onHoverEnd) == null ? void 0 : u.call(s);
4987
- },
4988
- onSeriesHoverStart: (u, h) => {
4989
5030
  var d;
4990
- return (d = s.onSeriesHoverStart) == null ? void 0 : d.call(s, u, h);
5031
+ return (d = s.onHoverEnd) == null ? void 0 : d.call(s);
4991
5032
  },
4992
- onSeriesHoverEnd: (u, h) => {
4993
- var d;
4994
- return (d = s.onSeriesHoverEnd) == null ? void 0 : d.call(s, u, h);
5033
+ onSeriesHoverStart: (d, c) => {
5034
+ var u;
5035
+ return (u = s.onSeriesHoverStart) == null ? void 0 : u.call(s, d, c);
4995
5036
  },
4996
- onToggleVisibility: (u) => {
4997
- var h;
4998
- return (h = s.onToggleVisibility) == null ? void 0 : h.call(s, u);
5037
+ onSeriesHoverEnd: (d, c) => {
5038
+ var u;
5039
+ return (u = s.onSeriesHoverEnd) == null ? void 0 : u.call(s, d, c);
5040
+ },
5041
+ onToggleVisibility: (d) => {
5042
+ var c;
5043
+ return (c = s.onToggleVisibility) == null ? void 0 : c.call(s, d);
4999
5044
  }
5000
5045
  }
5001
5046
  );
5002
5047
  return i.update(Array.from(s.series.values())), i;
5003
5048
  }
5004
- class fi {
5049
+ class bi {
5005
5050
  constructor() {
5006
5051
  g(this, "queue", []);
5007
5052
  g(this, "isProcessing", !1);
@@ -5073,17 +5118,17 @@ class fi {
5073
5118
  this.clear(), this.completedCount = 0, this.idCounter = 0;
5074
5119
  }
5075
5120
  }
5076
- const z = new fi();
5077
- function mi() {
5078
- return z.enqueue();
5121
+ const O = new bi();
5122
+ function vi() {
5123
+ return O.enqueue();
5079
5124
  }
5080
- function ae(s) {
5081
- z.markComplete(s);
5125
+ function he(s) {
5126
+ O.markComplete(s);
5082
5127
  }
5083
- function $i() {
5084
- return z.getStatus();
5128
+ function Qi() {
5129
+ return O.getStatus();
5085
5130
  }
5086
- class yi {
5131
+ class Mi {
5087
5132
  static getStatus() {
5088
5133
  return this.instance.getStatus();
5089
5134
  }
@@ -5091,23 +5136,23 @@ class yi {
5091
5136
  this.instance.reset();
5092
5137
  }
5093
5138
  }
5094
- g(yi, "instance", z);
5095
- function Hi() {
5139
+ g(Mi, "instance", O);
5140
+ function Zi() {
5096
5141
  return {
5097
- getStatus: () => z.getStatus(),
5098
- reset: () => z.reset()
5142
+ getStatus: () => O.getStatus(),
5143
+ reset: () => O.reset()
5099
5144
  };
5100
5145
  }
5101
- async function Ni(s, e) {
5146
+ async function Ji(s, e) {
5102
5147
  await e();
5103
5148
  }
5104
- function Ui(s = 200) {
5149
+ function Ki(s = 200) {
5105
5150
  return new Promise((e) => setTimeout(e, s));
5106
5151
  }
5107
- function qi() {
5108
- z.reset();
5152
+ function es() {
5153
+ O.reset();
5109
5154
  }
5110
- class pi {
5155
+ class Si {
5111
5156
  constructor(e) {
5112
5157
  this.pluginManager = e;
5113
5158
  }
@@ -5127,8 +5172,8 @@ class pi {
5127
5172
  const r = this.pluginManager.get("velo-plot-latex");
5128
5173
  if (r != null && r.api) return r.api;
5129
5174
  const a = i.find((l) => {
5130
- var c;
5131
- return (c = l.provides) == null ? void 0 : c.includes("latex");
5175
+ var h;
5176
+ return (h = l.provides) == null ? void 0 : h.includes("latex");
5132
5177
  });
5133
5178
  if (a)
5134
5179
  return ((o = this.pluginManager.get(a.name)) == null ? void 0 : o.api) || null;
@@ -5241,7 +5286,7 @@ class pi {
5241
5286
  return this.pluginManager.getNames();
5242
5287
  }
5243
5288
  }
5244
- class xi {
5289
+ class wi {
5245
5290
  constructor(e) {
5246
5291
  this.ctx = e;
5247
5292
  }
@@ -5264,7 +5309,7 @@ class xi {
5264
5309
  id: i
5265
5310
  };
5266
5311
  this.ctx.yAxisOptionsMap.set(i, o);
5267
- const r = o.scale === "log" ? new $() : new X();
5312
+ const r = o.scale === "log" ? new H() : new $();
5268
5313
  return this.ctx.yScales.set(i, r), this.ctx.requestRender(), i;
5269
5314
  }
5270
5315
  /**
@@ -5286,7 +5331,7 @@ class xi {
5286
5331
  }
5287
5332
  const n = { ...i, ...t, id: e };
5288
5333
  if (this.ctx.yAxisOptionsMap.set(e, n), t.scale && t.scale !== i.scale) {
5289
- const o = t.scale === "log" ? new $() : new X(), r = this.ctx.yScales.get(e);
5334
+ const o = t.scale === "log" ? new H() : new $(), r = this.ctx.yScales.get(e);
5290
5335
  r && o.setDomain(r.domain[0], r.domain[1]), this.ctx.yScales.set(e, o);
5291
5336
  }
5292
5337
  this.ctx.requestRender();
@@ -5297,7 +5342,7 @@ class xi {
5297
5342
  updateXAxis(e) {
5298
5343
  const t = this.ctx.xAxisOptions.scale;
5299
5344
  if (Object.assign(this.ctx.xAxisOptions, e), e.scale && e.scale !== t) {
5300
- const i = e.scale === "log" ? new $() : new X();
5345
+ const i = e.scale === "log" ? new H() : new $();
5301
5346
  i.setDomain(this.ctx.xScale.domain[0], this.ctx.xScale.domain[1]), Object.setPrototypeOf(this.ctx.xScale, Object.getPrototypeOf(i)), Object.assign(this.ctx.xScale, i);
5302
5347
  }
5303
5348
  this.ctx.requestRender();
@@ -5346,21 +5391,21 @@ class xi {
5346
5391
  return this.ctx.yScales;
5347
5392
  }
5348
5393
  }
5349
- const Le = 1;
5350
- function be(s) {
5394
+ const Oe = 1;
5395
+ function Me(s) {
5351
5396
  const e = s instanceof Float32Array ? s : new Float32Array(s), t = new Uint8Array(e.buffer);
5352
5397
  let i = "";
5353
5398
  for (let n = 0; n < t.length; n++)
5354
5399
  i += String.fromCharCode(t[n]);
5355
5400
  return btoa(i);
5356
5401
  }
5357
- function ve(s) {
5402
+ function Se(s) {
5358
5403
  const e = atob(s), t = new Uint8Array(e.length);
5359
5404
  for (let i = 0; i < e.length; i++)
5360
5405
  t[i] = e.charCodeAt(i);
5361
5406
  return new Float32Array(t.buffer);
5362
5407
  }
5363
- function bi(s) {
5408
+ function Ci(s) {
5364
5409
  try {
5365
5410
  new TextEncoder().encode(s);
5366
5411
  let t = "";
@@ -5375,7 +5420,7 @@ function bi(s) {
5375
5420
  return btoa(s);
5376
5421
  }
5377
5422
  }
5378
- function vi(s) {
5423
+ function Ai(s) {
5379
5424
  try {
5380
5425
  const e = atob(s);
5381
5426
  let t = "";
@@ -5390,24 +5435,24 @@ function vi(s) {
5390
5435
  return atob(s);
5391
5436
  }
5392
5437
  }
5393
- function Mi(s, e = !0) {
5438
+ function ki(s, e = !0) {
5394
5439
  const t = JSON.stringify(s);
5395
- return e ? bi(t) : btoa(t);
5440
+ return e ? Ci(t) : btoa(t);
5396
5441
  }
5397
- function Si(s, e = !0) {
5442
+ function Ti(s, e = !0) {
5398
5443
  try {
5399
- const t = e ? vi(s) : atob(s), i = JSON.parse(t);
5400
- return typeof i.version != "number" ? (console.warn("[VeloPlot] Invalid state: missing version"), null) : (i.version > Le && console.warn("[VeloPlot] State version is newer than supported"), i);
5444
+ const t = e ? Ai(s) : atob(s), i = JSON.parse(t);
5445
+ return typeof i.version != "number" ? (console.warn("[VeloPlot] Invalid state: missing version"), null) : (i.version > Oe && console.warn("[VeloPlot] State version is newer than supported"), i);
5401
5446
  } catch {
5402
5447
  return console.error("[VeloPlot] Failed to parse URL hash"), null;
5403
5448
  }
5404
5449
  }
5405
- function Wi(s) {
5450
+ function ts(s) {
5406
5451
  if (!s || typeof s != "object") return !1;
5407
5452
  const e = s;
5408
5453
  return !(typeof e.version != "number" || !e.viewBounds || typeof e.viewBounds != "object" || !Array.isArray(e.series));
5409
5454
  }
5410
- class Gi {
5455
+ class is {
5411
5456
  constructor(e = 50) {
5412
5457
  g(this, "history", []);
5413
5458
  g(this, "currentIndex", -1);
@@ -5463,7 +5508,7 @@ class Gi {
5463
5508
  return this.history.length;
5464
5509
  }
5465
5510
  }
5466
- class wi {
5511
+ class Bi {
5467
5512
  constructor(e) {
5468
5513
  this.ctx = e;
5469
5514
  }
@@ -5477,7 +5522,7 @@ class wi {
5477
5522
  serialize(e = {}) {
5478
5523
  const { includeData: t = !0, includeAnnotations: i = !0 } = e;
5479
5524
  return {
5480
- version: Le,
5525
+ version: Oe,
5481
5526
  timestamp: Date.now(),
5482
5527
  viewBounds: { ...this.ctx.viewBounds },
5483
5528
  xAxis: {
@@ -5512,8 +5557,8 @@ class wi {
5512
5557
  style: o.getStyle(),
5513
5558
  visible: o.isVisible(),
5514
5559
  data: t ? {
5515
- x: be(o.getData().x),
5516
- y: be(o.getData().y)
5560
+ x: Me(o.getData().x),
5561
+ y: Me(o.getData().y)
5517
5562
  } : { x: "", y: "" }
5518
5563
  })),
5519
5564
  annotations: i ? this.ctx.getAnnotations() : [],
@@ -5556,8 +5601,8 @@ class wi {
5556
5601
  type: r.type,
5557
5602
  yAxisId: r.yAxisId,
5558
5603
  data: {
5559
- x: ve(r.data.x),
5560
- y: ve(r.data.y)
5604
+ x: Se(r.data.x),
5605
+ y: Se(r.data.y)
5561
5606
  },
5562
5607
  style: r.style
5563
5608
  });
@@ -5567,291 +5612,304 @@ class wi {
5567
5612
  * Convert current state to URL-safe hash
5568
5613
  */
5569
5614
  toUrlHash(e = !0) {
5570
- return Mi(this.serialize({ includeData: !0 }), e);
5615
+ return ki(this.serialize({ includeData: !0 }), e);
5571
5616
  }
5572
5617
  /**
5573
5618
  * Load state from URL hash
5574
5619
  */
5575
5620
  fromUrlHash(e, t = !0) {
5576
- const i = Si(e, t);
5621
+ const i = Ti(e, t);
5577
5622
  i && this.deserialize(i);
5578
5623
  }
5579
5624
  }
5580
5625
  const ze = /* @__PURE__ */ new Map();
5581
- function ji(s, e) {
5626
+ function ss(s, e) {
5582
5627
  ze.set(s, e);
5583
5628
  }
5584
- function Ci(s, e, t) {
5629
+ function Pi(s, e, t) {
5585
5630
  for (const i of e) {
5586
5631
  if (!i.isVisible()) continue;
5587
5632
  const n = ze.get(i.getType());
5588
5633
  n && n(s, i, t);
5589
5634
  }
5590
5635
  }
5591
- function Me(s, e, t, i, n) {
5636
+ function Ei(s, e) {
5637
+ return s === e || s.startsWith(`${e}_`);
5638
+ }
5639
+ function Ii(s, e, t) {
5640
+ if (!e) return s;
5641
+ const i = [], n = [];
5642
+ for (const o of s)
5643
+ Ei(t(o), e) ? i.push(o) : n.push(o);
5644
+ return i.length === 0 ? s : [...n, ...i];
5645
+ }
5646
+ function we(s, e, t, i, n) {
5592
5647
  const o = (n == null ? void 0 : n.left) ?? 0, r = (n == null ? void 0 : n.right) ?? 0, a = (n == null ? void 0 : n.top) ?? 0, l = (n == null ? void 0 : n.bottom) ?? 0;
5593
5648
  if (i === "x") {
5594
- const d = e.x + o, y = e.x + e.width - r, f = (t == null ? void 0 : t.invertAxis) ?? !1;
5595
- s.setRange(f ? y : d, f ? d : y);
5649
+ const u = e.x + o, m = e.x + e.width - r, f = (t == null ? void 0 : t.invertAxis) ?? !1;
5650
+ s.setRange(f ? m : u, f ? u : m);
5596
5651
  return;
5597
5652
  }
5598
- const c = e.y + a, u = e.y + e.height - l, h = (t == null ? void 0 : t.invertAxis) ?? !1;
5599
- s.setRange(h ? c : u, h ? u : c);
5653
+ const h = e.y + a, d = e.y + e.height - l, c = (t == null ? void 0 : t.invertAxis) ?? !1;
5654
+ s.setRange(c ? h : d, c ? d : h);
5600
5655
  }
5601
- function Ai(s, e) {
5602
- const t = [], i = s.layout.plotPadding;
5603
- if (Me(
5604
- s.xScale,
5656
+ function Ye(s, e, t, i, n, o, r, a) {
5657
+ const l = a.plotPadding;
5658
+ we(t, s, o, "x", l), t.setDomain(e.xMin, e.xMax), i.forEach((h, d) => {
5659
+ const c = n.get(d);
5660
+ we(h, s, c, "y", l), d === r && h.setDomain(e.yMin, e.yMax);
5661
+ });
5662
+ }
5663
+ function Ri(s, e) {
5664
+ const t = [];
5665
+ return Ye(
5605
5666
  e,
5667
+ s.viewBounds,
5668
+ s.xScale,
5669
+ s.yScales,
5670
+ s.yAxisOptionsMap,
5606
5671
  s.xAxisOptions,
5607
- "x",
5608
- i
5609
- ), s.xScale.setDomain(s.viewBounds.xMin, s.viewBounds.xMax), s.yScales.forEach((n, o) => {
5610
- const r = s.yAxisOptionsMap.get(o);
5611
- Me(n, e, r, "y", i), o === s.primaryYAxisId && n.setDomain(s.viewBounds.yMin, s.viewBounds.yMax);
5612
- }), s.series.forEach((n) => {
5613
- var a, l;
5614
- n.needsBufferUpdate && (s.updateSeriesBuffer(n), n.needsBufferUpdate = !1);
5615
- const o = s.renderer.getBuffer(n.getId()), r = n.getType();
5616
- if (o || r === "candlestick" || r === "boxplot" || r === "waterfall") {
5617
- const c = n.getYAxisId() || s.primaryYAxisId, u = s.yScales.get(c);
5618
- let h;
5619
- u && (h = { min: u.domain[0], max: u.domain[1] });
5620
- let d = r;
5621
- if (r === "area")
5622
- d = "band";
5623
- else if (r === "polar") {
5624
- const f = n.getStyle();
5625
- d = f != null && f.fill ? "band" : "line";
5672
+ s.primaryYAxisId,
5673
+ s.layout
5674
+ ), s.series.forEach((i) => {
5675
+ var r, a;
5676
+ i.needsBufferUpdate && (s.updateSeriesBuffer(i), i.needsBufferUpdate = !1);
5677
+ const n = s.renderer.getBuffer(i.getId()), o = i.getType();
5678
+ if (n || o === "candlestick" || o === "boxplot" || o === "waterfall") {
5679
+ const l = i.getYAxisId() || s.primaryYAxisId, h = s.yScales.get(l);
5680
+ let d;
5681
+ h && (d = { min: h.domain[0], max: h.domain[1] });
5682
+ let c = o;
5683
+ if (o === "area")
5684
+ c = "band";
5685
+ else if (o === "polar") {
5686
+ const m = i.getStyle();
5687
+ c = m != null && m.fill ? "band" : "line";
5626
5688
  }
5627
- let y = null;
5628
- if (o && (y = {
5629
- id: n.getId(),
5630
- buffer: o,
5631
- count: n.getPointCount(),
5632
- style: n.getStyle(),
5633
- visible: n.isVisible(),
5634
- type: d,
5635
- yBounds: h
5636
- }), y) {
5637
- if (r === "band" || r === "area")
5638
- y.count = n.getPointCount() * 2;
5639
- else if (r === "bar")
5640
- y.count = n.getPointCount() * 6;
5641
- else if (r === "polar") {
5642
- const f = n.getStyle();
5643
- if (f != null && f.fill) {
5644
- const m = (f == null ? void 0 : f.closePath) !== !1;
5645
- y.count = m ? n.getPointCount() * 3 : (n.getPointCount() - 1) * 3;
5646
- } else f != null && f.closePath && (y.count = n.getPointCount() + 1);
5689
+ let u = null;
5690
+ if (n && (u = {
5691
+ id: i.getId(),
5692
+ buffer: n,
5693
+ count: i.getPointCount(),
5694
+ style: i.getStyle(),
5695
+ visible: i.isVisible(),
5696
+ type: c,
5697
+ yBounds: d
5698
+ }), u) {
5699
+ if (o === "band" || o === "area")
5700
+ u.count = i.getPointCount() * 2;
5701
+ else if (o === "bar")
5702
+ u.count = i.getPointCount() * 6;
5703
+ else if (o === "polar") {
5704
+ const m = i.getStyle();
5705
+ if (m != null && m.fill) {
5706
+ const f = (m == null ? void 0 : m.closePath) !== !1;
5707
+ u.count = f ? i.getPointCount() * 3 : (i.getPointCount() - 1) * 3;
5708
+ } else m != null && m.closePath && (u.count = i.getPointCount() + 1);
5647
5709
  }
5648
- if (r === "step" || r === "step+scatter") {
5649
- const f = s.renderer.getBuffer(`${n.getId()}_step`);
5650
- if (f) {
5651
- y.stepBuffer = f;
5652
- const m = n.getStyle().stepMode ?? "after", x = n.getPointCount();
5653
- m === "center" ? y.stepCount = 1 + (x - 1) * 3 : y.stepCount = x * 2 - 1;
5710
+ if (o === "step" || o === "step+scatter") {
5711
+ const m = s.renderer.getBuffer(`${i.getId()}_step`);
5712
+ if (m) {
5713
+ u.stepBuffer = m;
5714
+ const f = i.getStyle().stepMode ?? "after", y = i.getPointCount();
5715
+ f === "center" ? u.stepCount = 1 + (y - 1) * 3 : u.stepCount = y * 2 - 1;
5654
5716
  }
5655
5717
  }
5656
- if (r === "boxplot") {
5657
- const f = s.renderer.getBuffer(`${n.getId()}_box_lines`), m = s.renderer.getBuffer(`${n.getId()}_box_faces`);
5658
- f && m && (y.boxLinesBuffer = f, y.boxLinesCount = n.getPointCount() * 10, y.boxBuffer = m, y.boxCount = n.getPointCount() * 6);
5718
+ if (o === "boxplot") {
5719
+ const m = s.renderer.getBuffer(`${i.getId()}_box_lines`), f = s.renderer.getBuffer(`${i.getId()}_box_faces`);
5720
+ m && f && (u.boxLinesBuffer = m, u.boxLinesCount = i.getPointCount() * 10, u.boxBuffer = f, u.boxCount = i.getPointCount() * 6);
5659
5721
  }
5660
5722
  }
5661
- if (r === "boxplot" && !y) {
5662
- const f = s.renderer.getBuffer(`${n.getId()}_box_lines`), m = s.renderer.getBuffer(`${n.getId()}_box_faces`);
5663
- if (f && m) {
5664
- const x = n.getYAxisId() || s.primaryYAxisId, b = s.yScales.get(x);
5665
- let v;
5666
- b && (v = { min: b.domain[0], max: b.domain[1] }), y = {
5667
- id: n.getId(),
5668
- buffer: f,
5723
+ if (o === "boxplot" && !u) {
5724
+ const m = s.renderer.getBuffer(`${i.getId()}_box_lines`), f = s.renderer.getBuffer(`${i.getId()}_box_faces`);
5725
+ if (m && f) {
5726
+ const y = i.getYAxisId() || s.primaryYAxisId, p = s.yScales.get(y);
5727
+ let b;
5728
+ p && (b = { min: p.domain[0], max: p.domain[1] }), u = {
5729
+ id: i.getId(),
5730
+ buffer: m,
5669
5731
  // Use lines buffer as main buffer for reference
5670
5732
  count: 0,
5671
5733
  // No main buffer rendering
5672
- style: n.getStyle(),
5673
- visible: n.isVisible(),
5734
+ style: i.getStyle(),
5735
+ visible: i.isVisible(),
5674
5736
  type: "boxplot",
5675
- yBounds: v,
5676
- boxLinesBuffer: f,
5677
- boxLinesCount: n.getPointCount() * 10,
5678
- boxBuffer: m,
5679
- boxCount: n.getPointCount() * 6
5737
+ yBounds: b,
5738
+ boxLinesBuffer: m,
5739
+ boxLinesCount: i.getPointCount() * 10,
5740
+ boxBuffer: f,
5741
+ boxCount: i.getPointCount() * 6
5680
5742
  };
5681
5743
  }
5682
5744
  }
5683
- if (r === "waterfall" && !y) {
5684
- const f = s.renderer.getBuffer(`${n.getId()}_wf_positive`), m = s.renderer.getBuffer(`${n.getId()}_wf_negative`), x = s.renderer.getBuffer(`${n.getId()}_wf_subtotal`), b = s.renderer.getBuffer(`${n.getId()}_wf_connectors`);
5685
- if (f || m || x) {
5686
- const v = n.getYAxisId() || s.primaryYAxisId, p = s.yScales.get(v);
5687
- let M;
5688
- p && (M = { min: p.domain[0], max: p.domain[1] });
5689
- const S = n.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
5690
- y = {
5691
- id: n.getId(),
5692
- buffer: f || m || x,
5745
+ if (o === "waterfall" && !u) {
5746
+ const m = s.renderer.getBuffer(`${i.getId()}_wf_positive`), f = s.renderer.getBuffer(`${i.getId()}_wf_negative`), y = s.renderer.getBuffer(`${i.getId()}_wf_subtotal`), p = s.renderer.getBuffer(`${i.getId()}_wf_connectors`);
5747
+ if (m || f || y) {
5748
+ const b = i.getYAxisId() || s.primaryYAxisId, v = s.yScales.get(b);
5749
+ let x;
5750
+ v && (x = { min: v.domain[0], max: v.domain[1] });
5751
+ const M = i.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
5752
+ u = {
5753
+ id: i.getId(),
5754
+ buffer: m || f || y,
5693
5755
  // Use any available buffer as reference
5694
5756
  count: 0,
5695
5757
  // No main buffer rendering
5696
- style: n.getStyle(),
5697
- visible: n.isVisible(),
5758
+ style: i.getStyle(),
5759
+ visible: i.isVisible(),
5698
5760
  type: "waterfall",
5699
- yBounds: M,
5700
- wfPositiveBuffer: f,
5701
- wfPositiveCount: S.positive,
5702
- wfNegativeBuffer: m,
5703
- wfNegativeCount: S.negative,
5704
- wfSubtotalBuffer: x,
5705
- wfSubtotalCount: S.subtotal,
5706
- wfConnectorBuffer: b,
5707
- wfConnectorCount: S.connectors
5761
+ yBounds: x,
5762
+ wfPositiveBuffer: m,
5763
+ wfPositiveCount: M.positive,
5764
+ wfNegativeBuffer: f,
5765
+ wfNegativeCount: M.negative,
5766
+ wfSubtotalBuffer: y,
5767
+ wfSubtotalCount: M.subtotal,
5768
+ wfConnectorBuffer: p,
5769
+ wfConnectorCount: M.connectors
5708
5770
  };
5709
5771
  }
5710
5772
  }
5711
- if (y) {
5712
- const f = s.renderer.getBuffer(`${n.getId()}_errors`);
5713
- if (f) {
5714
- y.errorBuffer = f;
5715
- const m = n.getData();
5716
- let x = 0;
5717
- (m.yError || m.yErrorMinus || m.yErrorPlus) && x++, (m.xError || m.xErrorMinus || m.xErrorPlus) && x++, y.errorCount = n.getPointCount() * x * 2;
5773
+ if (u) {
5774
+ const m = s.renderer.getBuffer(`${i.getId()}_errors`);
5775
+ if (m) {
5776
+ u.errorBuffer = m;
5777
+ const f = i.getData();
5778
+ let y = 0;
5779
+ (f.yError || f.yErrorMinus || f.yErrorPlus) && y++, (f.xError || f.xErrorMinus || f.xErrorPlus) && y++, u.errorCount = i.getPointCount() * y * 2;
5718
5780
  }
5719
- if (r === "heatmap") {
5720
- const m = n.getHeatmapData(), x = n.getHeatmapStyle();
5721
- if (m) {
5722
- const b = m.xValues.length, v = m.yValues.length;
5723
- y.count = (b - 1) * (v - 1) * 6;
5724
- let p = 1 / 0, M = -1 / 0;
5725
- for (let w = 0; w < m.zValues.length; w++) {
5726
- const C = m.zValues[w];
5727
- C < p && (p = C), C > M && (M = C);
5781
+ if (o === "heatmap") {
5782
+ const f = i.getHeatmapData(), y = i.getHeatmapStyle();
5783
+ if (f) {
5784
+ const p = f.xValues.length, b = f.yValues.length;
5785
+ u.count = (p - 1) * (b - 1) * 6;
5786
+ let v = 1 / 0, x = -1 / 0;
5787
+ for (let S = 0; S < f.zValues.length; S++) {
5788
+ const w = f.zValues[S];
5789
+ w < v && (v = w), w > x && (x = w);
5728
5790
  }
5729
- p === M && (p -= 1, M += 1), y.zBounds = {
5730
- min: ((a = x == null ? void 0 : x.colorScale) == null ? void 0 : a.min) ?? (p === 1 / 0 ? 0 : p),
5731
- max: ((l = x == null ? void 0 : x.colorScale) == null ? void 0 : l.max) ?? (M === -1 / 0 ? 1 : M)
5732
- }, y.zBounds.min === y.zBounds.max && (y.zBounds.max = y.zBounds.min + 1);
5733
- const S = `${n.getId()}_colormap`;
5734
- y.colormapTexture = s.renderer.getTexture(S);
5791
+ v === x && (v -= 1, x += 1), u.zBounds = {
5792
+ min: ((r = y == null ? void 0 : y.colorScale) == null ? void 0 : r.min) ?? (v === 1 / 0 ? 0 : v),
5793
+ max: ((a = y == null ? void 0 : y.colorScale) == null ? void 0 : a.max) ?? (x === -1 / 0 ? 1 : x)
5794
+ }, u.zBounds.min === u.zBounds.max && (u.zBounds.max = u.zBounds.min + 1);
5795
+ const M = `${i.getId()}_colormap`;
5796
+ u.colormapTexture = s.renderer.getTexture(M);
5735
5797
  }
5736
5798
  }
5737
5799
  }
5738
- if (r === "candlestick") {
5739
- const f = s.renderer.getBuffer(`${n.getId()}_bullish`);
5740
- f && t.push({
5741
- id: `${n.getId()}_bullish`,
5742
- buffer: f,
5743
- count: n.bullishCount || 0,
5800
+ if (o === "candlestick") {
5801
+ const m = s.renderer.getBuffer(`${i.getId()}_bullish`);
5802
+ m && t.push({
5803
+ id: `${i.getId()}_bullish`,
5804
+ buffer: m,
5805
+ count: i.bullishCount || 0,
5744
5806
  style: {
5745
- ...n.getStyle(),
5746
- color: n.getStyle().bullishColor || "#26a69a"
5807
+ ...i.getStyle(),
5808
+ color: i.getStyle().bullishColor || "#26a69a"
5747
5809
  },
5748
- visible: n.isVisible(),
5810
+ visible: i.isVisible(),
5749
5811
  type: "bar",
5750
5812
  // Using bar renderer (triangles)
5751
- yBounds: h
5813
+ yBounds: d
5752
5814
  });
5753
- const m = s.renderer.getBuffer(`${n.getId()}_bearish`);
5754
- m && t.push({
5755
- id: `${n.getId()}_bearish`,
5756
- buffer: m,
5757
- count: n.bearishCount || 0,
5815
+ const f = s.renderer.getBuffer(`${i.getId()}_bearish`);
5816
+ f && t.push({
5817
+ id: `${i.getId()}_bearish`,
5818
+ buffer: f,
5819
+ count: i.bearishCount || 0,
5758
5820
  style: {
5759
- ...n.getStyle(),
5760
- color: n.getStyle().bearishColor || "#ef5350"
5821
+ ...i.getStyle(),
5822
+ color: i.getStyle().bearishColor || "#ef5350"
5761
5823
  },
5762
- visible: n.isVisible(),
5824
+ visible: i.isVisible(),
5763
5825
  type: "bar",
5764
5826
  // Using bar renderer (triangles)
5765
- yBounds: h
5827
+ yBounds: d
5766
5828
  });
5767
- } else y && t.push(y);
5768
- }
5769
- }), s.hoveredSeriesId && t.findIndex((o) => o.id === s.hoveredSeriesId || o.id.startsWith(s.hoveredSeriesId + "_")) !== -1) {
5770
- const o = [];
5771
- for (let r = t.length - 1; r >= 0; r--) {
5772
- const a = t[r];
5773
- (a.id === s.hoveredSeriesId || a.id.startsWith(s.hoveredSeriesId + "_")) && o.unshift(t.splice(r, 1)[0]);
5829
+ } else u && t.push(u);
5774
5830
  }
5775
- t.push(...o);
5776
- }
5777
- return t;
5778
- }
5779
- function Se(s, e, t) {
5780
- var m, x, b, v;
5781
- const i = s.container.getBoundingClientRect();
5782
- if (i.width === 0 || i.height === 0) {
5831
+ }), Ii(t, s.hoveredSeriesId, (i) => i.id);
5832
+ }
5833
+ function re(s, e, t) {
5834
+ var f, y, p, b, v;
5835
+ const i = s.vectorOverlayOnly === !0 || ((f = s.getActiveRenderer) == null ? void 0 : f.call(s)) === "svg";
5836
+ s.overlay.clear(), s.overlay.setLatexAPI(s.latexAPI);
5837
+ const n = s.container.getBoundingClientRect();
5838
+ if (n.width === 0 || n.height === 0) {
5783
5839
  console.warn(
5784
5840
  "[VeloPlot] Container has zero size in render, skipping overlay"
5785
5841
  );
5786
5842
  return;
5787
5843
  }
5788
- s.overlay.clear(), s.overlay.setLatexAPI(s.latexAPI), (m = s.layout.title) != null && m.visible && s.layout.title.text && s.overlay.drawChartTitle(e, s.layout.title);
5789
- let n = !1, o = !1, r = !1, a = 0, l = "degrees", c = 5, u = 12;
5790
- s.series.forEach((p) => {
5791
- const M = p.getType();
5792
- if (p.isVisible())
5844
+ !i && ((y = s.layout.title) != null && y.visible) && s.layout.title.text && s.overlay.drawChartTitle(e, s.layout.title);
5845
+ let o = !1, r = !1, a = !1, l = 0, h = "degrees", d = 5, c = 12;
5846
+ s.series.forEach((x) => {
5847
+ const M = x.getType();
5848
+ if (x.isVisible())
5793
5849
  if (M === "polar") {
5794
- n = !0;
5795
- const S = p.getPolarData();
5850
+ o = !0;
5851
+ const S = x.getPolarData();
5796
5852
  if (S) {
5797
5853
  for (let C = 0; C < S.r.length; C++)
5798
- a = Math.max(a, Math.abs(S.r[C]));
5799
- const w = p.getStyle();
5800
- w.angleMode && (l = w.angleMode), w.radialDivisions && (c = w.radialDivisions), w.angularDivisions && (u = w.angularDivisions);
5854
+ l = Math.max(l, Math.abs(S.r[C]));
5855
+ const w = x.getStyle();
5856
+ w.angleMode && (h = w.angleMode), w.radialDivisions && (d = w.radialDivisions), w.angularDivisions && (c = w.angularDivisions);
5801
5857
  }
5802
- } else M === "gauge" ? o = !0 : M === "sankey" && (r = !0);
5858
+ } else M === "gauge" ? r = !0 : M === "sankey" && (a = !0);
5803
5859
  });
5804
- const h = n || o || r;
5805
- if (s.overlay.setBusinessDayMapping(((x = s.getBusinessDayMapping) == null ? void 0 : x.call(s)) ?? null), n && a > 0)
5806
- s.overlay.drawPolarGrid(
5807
- e,
5808
- s.xScale,
5809
- t,
5810
- c,
5811
- u,
5812
- l
5813
- );
5814
- else if (!o && !r) {
5815
- const p = s.yAxisOptionsMap.get(s.primaryYAxisId);
5816
- s.overlay.drawGrid(
5817
- e,
5818
- s.xScale,
5819
- t,
5820
- s.xAxisOptions,
5821
- p
5822
- );
5823
- }
5824
- Ci(s.overlayCtx, s.series.values(), e), h || s.overlay.drawXAxis(e, s.xScale, s.xAxisOptions, s.layout.xAxisLayout);
5825
- const d = [], y = [];
5826
- s.yAxisOptionsMap.forEach((p, M) => {
5827
- p.position === "right" ? y.push(M) : d.push(M);
5828
- }), h || (d.forEach((p, M) => {
5829
- const S = s.yScales.get(p), w = s.yAxisOptionsMap.get(p);
5830
- if (S && w) {
5831
- const C = M * 65;
5832
- s.overlay.drawYAxis(e, S, w, "left", C, s.layout.yAxisLayout);
5833
- }
5834
- }), y.forEach((p, M) => {
5835
- const S = s.yScales.get(p), w = s.yAxisOptionsMap.get(p);
5836
- if (S && w) {
5837
- const C = M * 65;
5838
- s.overlay.drawYAxis(e, S, w, "right", C, s.layout.yAxisLayout);
5839
- }
5840
- })), s.overlay.drawPlotBorder(e), s.series.forEach((p) => {
5841
- if (p.isVisible() && p.hasErrorData()) {
5842
- const M = p.getYAxisId() || s.primaryYAxisId, w = s.yScales.get(M) || t;
5843
- s.overlay.drawErrorBars(e, p, s.xScale, w);
5860
+ const u = o || r || a;
5861
+ if (!i) {
5862
+ if (s.overlay.setBusinessDayMapping(((p = s.getBusinessDayMapping) == null ? void 0 : p.call(s)) ?? null), o && l > 0)
5863
+ s.overlay.drawPolarGrid(
5864
+ e,
5865
+ s.xScale,
5866
+ t,
5867
+ d,
5868
+ c,
5869
+ h
5870
+ );
5871
+ else if (!r && !a) {
5872
+ const S = s.yAxisOptionsMap.get(s.primaryYAxisId);
5873
+ s.overlay.drawGrid(
5874
+ e,
5875
+ s.xScale,
5876
+ t,
5877
+ s.xAxisOptions,
5878
+ S
5879
+ );
5844
5880
  }
5845
- }), s.series.forEach((p) => {
5846
- if (!p.isVisible() || p.getType() !== "candlestick") return;
5847
- const M = p.getYAxisId() || s.primaryYAxisId, S = s.yScales.get(M) || t;
5848
- s.overlay.drawCandlestickMarkers(e, p, s.xScale, S);
5849
- });
5850
- const f = ((b = s.getAlerts) == null ? void 0 : b.call(s)) ?? [];
5851
- if (f.length && s.overlay.drawPriceAlertLines(e, f, t), s.selectionRect && s.overlay.drawSelectionRect(s.selectionRect), s.selectionManager.render(s.overlayCtx, e), (v = s.cursorOptions) != null && v.enabled && s.cursorPosition) {
5852
- const p = s.cursorOptions.valueDisplayMode ?? "floating";
5881
+ Pi(s.overlayCtx, s.series.values(), e), u || s.overlay.drawXAxis(e, s.xScale, s.xAxisOptions, s.layout.xAxisLayout);
5882
+ const x = [], M = [];
5883
+ s.yAxisOptionsMap.forEach((S, w) => {
5884
+ S.position === "right" ? M.push(w) : x.push(w);
5885
+ }), u || (x.forEach((S, w) => {
5886
+ const C = s.yScales.get(S), k = s.yAxisOptionsMap.get(S);
5887
+ if (C && k) {
5888
+ const B = w * 65;
5889
+ s.overlay.drawYAxis(e, C, k, "left", B, s.layout.yAxisLayout);
5890
+ }
5891
+ }), M.forEach((S, w) => {
5892
+ const C = s.yScales.get(S), k = s.yAxisOptionsMap.get(S);
5893
+ if (C && k) {
5894
+ const B = w * 65;
5895
+ s.overlay.drawYAxis(e, C, k, "right", B, s.layout.yAxisLayout);
5896
+ }
5897
+ })), s.overlay.drawPlotBorder(e), s.series.forEach((S) => {
5898
+ if (S.isVisible() && S.hasErrorData()) {
5899
+ const w = S.getYAxisId() || s.primaryYAxisId, k = s.yScales.get(w) || t;
5900
+ s.overlay.drawErrorBars(e, S, s.xScale, k);
5901
+ }
5902
+ }), s.series.forEach((S) => {
5903
+ if (!S.isVisible() || S.getType() !== "candlestick") return;
5904
+ const w = S.getYAxisId() || s.primaryYAxisId, C = s.yScales.get(w) || t;
5905
+ s.overlay.drawCandlestickMarkers(e, S, s.xScale, C);
5906
+ });
5907
+ }
5908
+ const m = ((b = s.getAlerts) == null ? void 0 : b.call(s)) ?? [];
5909
+ if (m.length && s.overlay.drawPriceAlertLines(e, m, t), s.selectionRect && s.overlay.drawSelectionRect(s.selectionRect), s.selectionManager.render(s.overlayCtx, e), (v = s.cursorOptions) != null && v.enabled && s.cursorPosition) {
5910
+ const x = s.cursorOptions.valueDisplayMode ?? "floating";
5853
5911
  let M;
5854
- p !== "disabled" && (M = s.cursorOptions.formatter ? s.cursorOptions.formatter(
5912
+ x !== "disabled" && (M = s.cursorOptions.formatter ? s.cursorOptions.formatter(
5855
5913
  s.pixelToDataX(s.cursorPosition.x),
5856
5914
  s.pixelToDataY(s.cursorPosition.y),
5857
5915
  ""
@@ -5863,13 +5921,38 @@ Y: ${s.pixelToDataY(s.cursorPosition.y).toExponential(2)}`);
5863
5921
  y: s.cursorPosition.y,
5864
5922
  crosshair: s.cursorOptions.crosshair ?? !1,
5865
5923
  tooltipText: M,
5866
- valueDisplayMode: p,
5924
+ valueDisplayMode: x,
5867
5925
  cornerPosition: s.cursorOptions.cornerPosition ?? "top-left"
5868
5926
  };
5869
5927
  s.overlay.drawCursor(e, S, s.cursorOptions.lineStyle);
5870
5928
  }
5871
5929
  }
5872
- class ki {
5930
+ function Di(s, e) {
5931
+ const n = new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
5932
+ if (!n || n.nodeName.toLowerCase() !== "svg") {
5933
+ console.warn("[VeloPlot] SVG renderer: invalid SVG document");
5934
+ return;
5935
+ }
5936
+ const o = ["width", "height", "viewBox", "xmlns", "font-family"];
5937
+ for (const l of o) {
5938
+ const h = n.getAttribute(l);
5939
+ h != null && s.setAttribute(l, h);
5940
+ }
5941
+ for (; s.firstChild; )
5942
+ s.removeChild(s.firstChild);
5943
+ const r = Array.from(n.childNodes).map(
5944
+ (l) => s.ownerDocument.importNode(l, !0)
5945
+ );
5946
+ if (typeof s.replaceChildren == "function") {
5947
+ s.replaceChildren(...r);
5948
+ return;
5949
+ }
5950
+ const a = document.createDocumentFragment();
5951
+ for (const l of r)
5952
+ a.appendChild(l);
5953
+ s.appendChild(a);
5954
+ }
5955
+ class Fi {
5873
5956
  constructor(e) {
5874
5957
  g(this, "animationFrameId", null);
5875
5958
  g(this, "needsFullRender", !1);
@@ -5935,11 +6018,21 @@ class ki {
5935
6018
  * Perform the actual rendering
5936
6019
  */
5937
6020
  performRender() {
6021
+ var d, c;
5938
6022
  const e = this.needsFullRender;
5939
6023
  this.needsFullRender = !1, this.needsOverlayRender = !1;
5940
6024
  const t = performance.now(), i = this.ctx.getPlotArea();
5941
6025
  if (this.ctx.webglCanvas.width === 0 || this.ctx.webglCanvas.height === 0 || !this.ctx.renderer) return;
5942
- const n = {
6026
+ const n = performance.now(), o = {
6027
+ timestamp: n,
6028
+ deltaTime: n - this.lastRenderTime,
6029
+ frameNumber: ++this.frameCount,
6030
+ first: !this.initStarted,
6031
+ forced: e
6032
+ };
6033
+ if (this.lastRenderTime = n, !this.ctx.pluginManager.notifyBeforeRender(o))
6034
+ return;
6035
+ const r = ((c = (d = this.ctx).getActiveRenderer) == null ? void 0 : c.call(d)) === "svg", a = {
5943
6036
  webglCanvas: this.ctx.webglCanvas,
5944
6037
  overlayCanvas: this.ctx.overlayCanvas,
5945
6038
  overlayCtx: this.ctx.overlayCtx,
@@ -5967,36 +6060,53 @@ class ki {
5967
6060
  selectionManager: this.ctx.selectionManager,
5968
6061
  hoveredSeriesId: this.ctx.getHoveredSeriesId(),
5969
6062
  layout: this.ctx.getLayout(),
5970
- latexAPI: this.ctx.getLatex()
5971
- }, o = performance.now(), r = {
5972
- timestamp: o,
5973
- deltaTime: o - this.lastRenderTime,
5974
- frameNumber: ++this.frameCount,
5975
- first: !this.initStarted,
5976
- forced: e
6063
+ latexAPI: this.ctx.getLatex(),
6064
+ getActiveRenderer: this.ctx.getActiveRenderer,
6065
+ vectorOverlayOnly: r
5977
6066
  };
5978
- if (this.lastRenderTime = o, !this.ctx.pluginManager.notifyBeforeRender(r))
6067
+ if (r && this.ctx.svgRoot && this.ctx.buildSVGFrame) {
6068
+ if (e) {
6069
+ Ye(
6070
+ i,
6071
+ this.ctx.viewBounds,
6072
+ this.ctx.xScale,
6073
+ this.ctx.yScales,
6074
+ this.ctx.yAxisOptionsMap,
6075
+ this.ctx.xAxisOptions,
6076
+ this.ctx.primaryYAxisId,
6077
+ this.ctx.getLayout()
6078
+ );
6079
+ const m = this.ctx.buildSVGFrame();
6080
+ Di(this.ctx.svgRoot, m);
6081
+ }
6082
+ this.ctx.overlay.clear(), re(a, i, this.ctx.yScale);
6083
+ const u = { ...o, renderTime: performance.now() - t };
6084
+ this.ctx.pluginManager.notifyRenderOverlay(u), this.ctx.pluginManager.notifyAfterRender(u), this.ctx.events.emit("render", {
6085
+ fps: 1e3 / (u.renderTime || 1),
6086
+ frameTime: u.renderTime
6087
+ });
5979
6088
  return;
6089
+ }
5980
6090
  if (e) {
5981
- const c = Ai(n, i);
5982
- this.ctx.renderer.render(c, {
6091
+ const u = Ri(a, i);
6092
+ this.ctx.renderer.render(u, {
5983
6093
  bounds: this.ctx.viewBounds,
5984
6094
  invertX: !!this.ctx.xAxisOptions.invertAxis,
5985
6095
  backgroundColor: this.ctx.backgroundColor,
5986
6096
  plotAreaBackground: this.ctx.plotAreaBackground,
5987
6097
  plotArea: i
5988
6098
  });
5989
- const u = {
5990
- ...r,
6099
+ const m = {
6100
+ ...o,
5991
6101
  renderTime: performance.now() - t
5992
6102
  };
5993
- this.ctx.pluginManager.notifyRenderWebGL(u), Se(n, i, this.ctx.yScale);
6103
+ this.ctx.pluginManager.notifyRenderWebGL(m), re(a, i, this.ctx.yScale);
5994
6104
  } else
5995
- Se(n, i, this.ctx.yScale);
5996
- const a = performance.now() - t, l = { ...r, renderTime: a };
5997
- this.ctx.pluginManager.notifyRenderOverlay(l), this.ctx.pluginManager.notifyAfterRender(l), this.ctx.events.emit("render", {
5998
- fps: 1e3 / a,
5999
- frameTime: a
6105
+ re(a, i, this.ctx.yScale);
6106
+ const l = performance.now() - t, h = { ...o, renderTime: l };
6107
+ this.ctx.pluginManager.notifyRenderOverlay(h), this.ctx.pluginManager.notifyAfterRender(h), this.ctx.events.emit("render", {
6108
+ fps: 1e3 / l,
6109
+ frameTime: l
6000
6110
  });
6001
6111
  }
6002
6112
  /**
@@ -6018,14 +6128,15 @@ class ki {
6018
6128
  this.frameCount = 0;
6019
6129
  }
6020
6130
  }
6021
- const V = class V {
6131
+ const X = class X {
6022
6132
  constructor(e) {
6023
6133
  g(this, "container");
6024
6134
  g(this, "webglCanvas");
6025
6135
  g(this, "overlayCanvas");
6136
+ g(this, "svgRoot");
6026
6137
  g(this, "overlayCtx");
6027
6138
  g(this, "series", /* @__PURE__ */ new Map());
6028
- g(this, "events", new Xe());
6139
+ g(this, "events", new Ne());
6029
6140
  g(this, "viewBounds", {
6030
6141
  xMin: -0.5,
6031
6142
  xMax: 0.5,
@@ -6092,14 +6203,14 @@ const V = class V {
6092
6203
  g(this, "timeScaleMapping", null);
6093
6204
  var n;
6094
6205
  this.initialOptions = e, this.container = e.container, this.chartId = e.id ?? `chart_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
6095
- const t = ei(this.container, e);
6096
- if (this.baseTheme = t.theme, this.theme = t.theme, this.colorScheme = e.colorScheme ? me(e.colorScheme) : ye(t.theme.isDark), this.backgroundColor = t.backgroundColor, this.plotAreaBackground = t.plotAreaColor, this.showLegend = t.showLegend, this.showControls = t.showControls, this.toolbarOptions = e.toolbar, this.autoScroll = t.autoScroll, this.showStatistics = t.showStatistics, this.dpr = t.dpr, this.xAxisOptions = t.xAxisOptions, this.xScale = t.xScale, this.yAxisOptionsMap = t.yAxisOptionsMap, this.yScales = t.yScales, this.primaryYAxisId = t.primaryYAxisId, this.webglCanvas = t.webglCanvas, this.overlayCanvas = t.overlayCanvas, this.overlayCtx = t.overlayCtx, this.layout = t.layout, this.layout.crosshair && this.enableCursor({
6206
+ const t = ni(this.container, e);
6207
+ if (this.baseTheme = t.theme, this.theme = t.theme, this.colorScheme = e.colorScheme ? pe(e.colorScheme) : xe(t.theme.isDark), this.backgroundColor = t.backgroundColor, this.plotAreaBackground = t.plotAreaColor, this.showLegend = t.showLegend, this.showControls = t.showControls, this.toolbarOptions = e.toolbar, this.autoScroll = t.autoScroll, this.showStatistics = t.showStatistics, this.dpr = t.dpr, this.xAxisOptions = t.xAxisOptions, this.xScale = t.xScale, this.yAxisOptionsMap = t.yAxisOptionsMap, this.yScales = t.yScales, this.primaryYAxisId = t.primaryYAxisId, this.webglCanvas = t.webglCanvas, this.overlayCanvas = t.overlayCanvas, this.svgRoot = t.svgRoot, this.overlayCtx = t.overlayCtx, this.layout = t.layout, this.layout.crosshair && this.enableCursor({
6097
6208
  enabled: this.layout.crosshair.enabled !== !1,
6098
6209
  crosshair: !0,
6099
6210
  snap: this.layout.crosshair.snapToData,
6100
6211
  valueDisplayMode: this.layout.crosshair.valueDisplayMode,
6101
6212
  cornerPosition: this.layout.crosshair.cornerPosition
6102
- }), this.pluginManager = new hi({
6213
+ }), this.pluginManager = new fi({
6103
6214
  chart: this,
6104
6215
  container: this.container,
6105
6216
  theme: this.theme,
@@ -6138,7 +6249,7 @@ const V = class V {
6138
6249
  var r;
6139
6250
  return (r = this.pluginManager) == null ? void 0 : r.get(o);
6140
6251
  }
6141
- }), this.pluginBridge = new pi(this.pluginManager), e.loading === !0 || typeof e.loading == "object") {
6252
+ }), this.pluginBridge = new Si(this.pluginManager), e.loading === !0 || typeof e.loading == "object") {
6142
6253
  const o = typeof e.loading == "object" ? e.loading : {
6143
6254
  message: "Loading VeloPlot...",
6144
6255
  overlayOpacity: 0.1
@@ -6150,7 +6261,7 @@ const V = class V {
6150
6261
  }));
6151
6262
  });
6152
6263
  }
6153
- e.plugins && e.plugins.forEach((o) => this.use(o)), this.renderer = new J(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr), (n = V.afterConstruct) == null || n.call(V, this, e), this.overlay = new gt(this.overlayCtx, this.theme), this.selectionManager = new yt({
6264
+ e.plugins && e.plugins.forEach((o) => this.use(o)), e.renderer === "svg" ? (this.renderer = new at(), this.activeRendererType = "svg") : (this.renderer = new K(this.webglCanvas), this.activeRendererType = "webgl"), this.renderer.setDPR(this.dpr), (n = X.afterConstruct) == null || n.call(X, this, e), this.overlay = new pt(this.overlayCtx, this.theme), this.selectionManager = new vt({
6154
6265
  getSeries: () => this.series,
6155
6266
  getPlotArea: () => this.getPlotArea(),
6156
6267
  getXScale: () => this.xScale,
@@ -6161,15 +6272,15 @@ const V = class V {
6161
6272
  requestRender: () => this.requestRender()
6162
6273
  }), this.events.on("selectionChange", (o) => {
6163
6274
  this.pluginManager.notifySelectionChange(o.selected);
6164
- }), this.animationEngine = new Be(), this.animationConfig = typeof e.animations == "boolean" ? { ...D, enabled: e.animations } : pe(e.animations);
6275
+ }), this.animationEngine = new Pe(), this.animationConfig = typeof e.animations == "boolean" ? { ...D, enabled: e.animations } : be(e.animations);
6165
6276
  const i = typeof e.responsive == "boolean" ? { enabled: e.responsive } : e.responsive;
6166
- this.responsiveManager = new pt(
6277
+ this.responsiveManager = new Mt(
6167
6278
  {
6168
6279
  container: this.container,
6169
6280
  onStateChange: (o) => this.handleResponsiveChange(o)
6170
6281
  },
6171
6282
  i
6172
- ), this.axisManager = new xi({
6283
+ ), this.axisManager = new wi({
6173
6284
  xAxisOptions: this.xAxisOptions,
6174
6285
  xScale: this.xScale,
6175
6286
  yAxisOptionsMap: this.yAxisOptionsMap,
@@ -6177,7 +6288,7 @@ const V = class V {
6177
6288
  primaryYAxisId: this.primaryYAxisId,
6178
6289
  series: this.series,
6179
6290
  requestRender: () => this.requestRender()
6180
- }), this.stateManager = new wi({
6291
+ }), this.stateManager = new Bi({
6181
6292
  viewBounds: this.viewBounds,
6182
6293
  xAxisOptions: this.xAxisOptions,
6183
6294
  xScale: this.xScale,
@@ -6198,7 +6309,7 @@ const V = class V {
6198
6309
  removeSeries: (o) => this.removeSeries(o),
6199
6310
  addSeries: (o) => this.addSeries(o),
6200
6311
  requestRender: () => this.requestRender()
6201
- }), this.renderLoop = new ki({
6312
+ }), this.renderLoop = new Fi({
6202
6313
  webglCanvas: this.webglCanvas,
6203
6314
  overlayCanvas: this.overlayCanvas,
6204
6315
  overlayCtx: this.overlayCtx,
@@ -6234,8 +6345,11 @@ const V = class V {
6234
6345
  },
6235
6346
  get yScale() {
6236
6347
  return this.yScales.get(this.primaryYAxisId) || this.yScales.values().next().value;
6237
- }
6238
- }), this.interaction = new ft(
6348
+ },
6349
+ svgRoot: this.svgRoot,
6350
+ buildSVGFrame: () => this.buildSVGFrame(),
6351
+ getActiveRenderer: () => this.activeRendererType
6352
+ }), this.interaction = new xt(
6239
6353
  this.container,
6240
6354
  {
6241
6355
  onZoom: (o, r) => {
@@ -6258,14 +6372,14 @@ const V = class V {
6258
6372
  },
6259
6373
  onBoxZoom: (o) => this.handleBoxZoom(o),
6260
6374
  onCursorMove: (o, r) => {
6261
- var c, u;
6375
+ var h, d;
6262
6376
  this.cursorPosition = { x: o, y: r };
6263
6377
  const a = this.getPlotArea();
6264
6378
  if (o >= a.x && o <= a.x + a.width && r >= a.y && r <= a.y + a.height) {
6265
- (c = this.cursorOptions) != null && c.enabled && (this.container.style.cursor = "crosshair");
6266
- const h = this.selectionManager.hitTest(o, r), d = (h == null ? void 0 : h.seriesId) ?? null;
6267
- this.hoveredSeriesId !== d && (this.hoveredSeriesId = d, this.requestRender());
6268
- } else (u = this.cursorOptions) != null && u.enabled && (this.container.style.cursor = "default");
6379
+ (h = this.cursorOptions) != null && h.enabled && (this.container.style.cursor = "crosshair");
6380
+ const c = this.selectionManager.hitTest(o, r), u = (c == null ? void 0 : c.seriesId) ?? null;
6381
+ this.hoveredSeriesId !== u && (this.hoveredSeriesId = u, this.requestRender());
6382
+ } else (d = this.cursorOptions) != null && d.enabled && (this.container.style.cursor = "default");
6269
6383
  this.tooltip && this.tooltip.handleCursorMove(o, r), this.requestOverlayRender();
6270
6384
  },
6271
6385
  onCursorLeave: () => {
@@ -6275,28 +6389,28 @@ const V = class V {
6275
6389
  onDoubleTap: () => this.resetZoom(),
6276
6390
  onBoxSelect: (o, r) => {
6277
6391
  if (o) {
6278
- const a = this.xScale, c = this.yScales.get(this.primaryYAxisId);
6279
- if (c) {
6280
- const u = {
6392
+ const a = this.xScale, h = this.yScales.get(this.primaryYAxisId);
6393
+ if (h) {
6394
+ const d = {
6281
6395
  xMin: a.invert(o.x),
6282
6396
  xMax: a.invert(o.x + o.width),
6283
- yMin: c.invert(o.y + o.height),
6284
- yMax: c.invert(o.y)
6285
- }, h = this.selectionManager.hitTestRegion(u);
6286
- if (h.length > 0) {
6287
- const d = /* @__PURE__ */ new Map();
6288
- h.forEach((f) => {
6289
- let m = d.get(f.seriesId);
6290
- m || (m = [], d.set(f.seriesId, m)), m.push(f.index);
6397
+ yMin: h.invert(o.y + o.height),
6398
+ yMax: h.invert(o.y)
6399
+ }, c = this.selectionManager.hitTestRegion(d);
6400
+ if (c.length > 0) {
6401
+ const u = /* @__PURE__ */ new Map();
6402
+ c.forEach((f) => {
6403
+ let y = u.get(f.seriesId);
6404
+ y || (y = [], u.set(f.seriesId, y)), y.push(f.index);
6291
6405
  });
6292
- const y = Array.from(d.entries()).map(
6293
- ([f, m]) => ({
6406
+ const m = Array.from(u.entries()).map(
6407
+ ([f, y]) => ({
6294
6408
  seriesId: f,
6295
- indices: m
6409
+ indices: y
6296
6410
  })
6297
6411
  );
6298
6412
  this.selectionManager.selectPoints(
6299
- y,
6413
+ m,
6300
6414
  r ? "add" : "single"
6301
6415
  );
6302
6416
  } else r || this.selectionManager.clearSelection();
@@ -6320,9 +6434,9 @@ const V = class V {
6320
6434
  this.pluginManager.notifyInteraction(o);
6321
6435
  },
6322
6436
  onPointClick: (o, r, a, l) => {
6323
- const c = this.pixelToDataX(o), u = this.pixelToDataY(r);
6437
+ const h = this.pixelToDataX(o), d = this.pixelToDataY(r);
6324
6438
  this.events.emit("click", {
6325
- point: { x: c, y: u },
6439
+ point: { x: h, y: d },
6326
6440
  pixelX: o,
6327
6441
  pixelY: r,
6328
6442
  ctrlKey: a,
@@ -6332,7 +6446,7 @@ const V = class V {
6332
6446
  },
6333
6447
  () => this.getPlotArea(),
6334
6448
  (o) => this.getInteractedBounds(o),
6335
- () => ii(this.yAxisOptionsMap)
6449
+ () => ai(this.yAxisOptionsMap)
6336
6450
  ), this.resizeObserver = new ResizeObserver(() => {
6337
6451
  !this.isDestroyed && !this.resizeSuspended && this.resize();
6338
6452
  }), this.resizeObserver.observe(this.container), this.initControls(), this.initLegend(e);
@@ -6422,7 +6536,7 @@ const V = class V {
6422
6536
  */
6423
6537
  async startInit() {
6424
6538
  if (!(this.renderLoop.isInitStarted() || this._isDestroyed)) {
6425
- this._webgpuInitPromise && (await this._webgpuInitPromise, this._webgpuInitPromise = void 0), this.renderer || (this.renderer = new J(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.renderLoop.setRenderer(this.renderer);
6539
+ this._webgpuInitPromise && (await this._webgpuInitPromise, this._webgpuInitPromise = void 0), this.renderer || (this.renderer = new K(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.renderLoop.setRenderer(this.renderer);
6426
6540
  for (const e of this.series.values())
6427
6541
  W(this.getSeriesContext(), e);
6428
6542
  this.renderLoop.startInit(), this.resize(), this.startRenderLoop(), this.commandQueue.length > 0 && (this.commandQueue.forEach((e) => {
@@ -6441,7 +6555,7 @@ const V = class V {
6441
6555
  * Mark this chart's initialization as complete in the queue
6442
6556
  */
6443
6557
  async completeInit() {
6444
- this.initQueueId && (this._isDestroyed || (await this.animationEngine.waitForIdle(), await new Promise((e) => setTimeout(e, 60))), this.initQueueId && (ae(this.initQueueId), this.initQueueId = null));
6558
+ this.initQueueId && (this._isDestroyed || (await this.animationEngine.waitForIdle(), await new Promise((e) => setTimeout(e, 60))), this.initQueueId && (he(this.initQueueId), this.initQueueId = null));
6445
6559
  }
6446
6560
  executeOrQueue(e, t) {
6447
6561
  this.renderLoop.isInitStarted() ? t() : this.commandQueue.push({ fn: t, name: e });
@@ -6453,7 +6567,7 @@ const V = class V {
6453
6567
  this.initQueueId = e;
6454
6568
  }
6455
6569
  initControls() {
6456
- this.controls = di({
6570
+ this.controls = pi({
6457
6571
  container: this.container,
6458
6572
  theme: this.theme,
6459
6573
  showControls: this.showControls,
@@ -6488,8 +6602,10 @@ const V = class V {
6488
6602
  }
6489
6603
  initLegend(e) {
6490
6604
  var i;
6605
+ if (this.activeRendererType === "svg")
6606
+ return;
6491
6607
  const t = (i = e.layout) == null ? void 0 : i.legend;
6492
- this.legend = gi(
6608
+ this.legend = xi(
6493
6609
  {
6494
6610
  container: this.container,
6495
6611
  theme: this.theme,
@@ -6526,9 +6642,9 @@ const V = class V {
6526
6642
  if (this.hoveredSeriesId = n.getId(), o) {
6527
6643
  const l = n.getStyle();
6528
6644
  this.originalSeriesStyles.set(n.getId(), { ...l });
6529
- const c = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || We(l.color || "#ff0055", this.theme.isDark);
6645
+ const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || Qe(l.color || "#ff0055", this.theme.isDark);
6530
6646
  n.setStyle({
6531
- color: c
6647
+ color: h
6532
6648
  }), (a = this.legend) == null || a.updateSeriesStyle(n);
6533
6649
  }
6534
6650
  this.requestRender();
@@ -6550,14 +6666,14 @@ const V = class V {
6550
6666
  );
6551
6667
  }
6552
6668
  setTheme(e) {
6553
- this.baseTheme = typeof e == "string" ? Te(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = H(this.theme.backgroundColor), this.plotAreaBackground = H(this.theme.plotAreaBackground || this.theme.backgroundColor), this.container.style.backgroundColor = this.theme.backgroundColor, this.overlay.setTheme(this.theme), this.tooltip.updateChartTheme(this.theme), this.controls && this.controls.updateTheme(this.theme), this.legend && this.legend.updateTheme(this.theme), this.initialOptions.colorScheme || (this.colorScheme = ye(this.theme.isDark)), this.requestRender();
6669
+ this.baseTheme = typeof e == "string" ? Be(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = N(this.theme.backgroundColor), this.plotAreaBackground = N(this.theme.plotAreaBackground || this.theme.backgroundColor), this.container.style.backgroundColor = this.theme.backgroundColor, this.overlay.setTheme(this.theme), this.tooltip.updateChartTheme(this.theme), this.controls && this.controls.updateTheme(this.theme), this.legend && this.legend.updateTheme(this.theme), this.initialOptions.colorScheme || (this.colorScheme = xe(this.theme.isDark)), this.requestRender();
6554
6670
  }
6555
6671
  /**
6556
6672
  * Set the color scheme for multi-series charts
6557
6673
  * @param scheme - Color scheme name ('vibrant', 'pastel', 'neon', 'earth', 'ocean') or ColorScheme object
6558
6674
  */
6559
6675
  setColorScheme(e) {
6560
- this.colorScheme = typeof e == "string" ? me(e) : e, this.requestRender();
6676
+ this.colorScheme = typeof e == "string" ? pe(e) : e, this.requestRender();
6561
6677
  }
6562
6678
  /**
6563
6679
  * Get the current color scheme
@@ -6566,7 +6682,7 @@ const V = class V {
6566
6682
  return this.colorScheme;
6567
6683
  }
6568
6684
  getPlotArea() {
6569
- return ti(this.container, this.yAxisOptionsMap, this.layout);
6685
+ return ri(this.container, this.yAxisOptionsMap, this.layout);
6570
6686
  }
6571
6687
  getInteractedBounds(e) {
6572
6688
  if (e) {
@@ -6581,7 +6697,7 @@ const V = class V {
6581
6697
  return this.viewBounds;
6582
6698
  }
6583
6699
  exportImage(e = "png") {
6584
- return vt(
6700
+ return Ct(
6585
6701
  this.webglCanvas,
6586
6702
  this.overlayCanvas,
6587
6703
  this.backgroundColor,
@@ -6595,7 +6711,7 @@ const V = class V {
6595
6711
  var t, i;
6596
6712
  (i = (t = this.featureHooks) == null ? void 0 : t.destroy) == null || i.call(t), this.featureHooks = e;
6597
6713
  }
6598
- exportSVG() {
6714
+ exportSVG(e) {
6599
6715
  throw new Error(
6600
6716
  "[VeloPlot] exportSVG() is not available in the core bundle. Use exportImage() or import from 'velo-plot/trading', 'velo-plot/scientific', or 'velo-plot/full'."
6601
6717
  );
@@ -6624,7 +6740,7 @@ const V = class V {
6624
6740
  };
6625
6741
  }
6626
6742
  addSeries(e) {
6627
- qt(this.getSeriesContext(), e);
6743
+ Qt(this.getSeriesContext(), e);
6628
6744
  const t = this.series.get(e.id);
6629
6745
  t && this.pluginManager.notifySeriesAdd({ series: t, changeType: "add" });
6630
6746
  }
@@ -6636,11 +6752,11 @@ const V = class V {
6636
6752
  }
6637
6753
  removeSeries(e) {
6638
6754
  const t = this.series.get(e);
6639
- Gt(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
6755
+ Jt(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
6640
6756
  }
6641
6757
  updateSeries(e, t) {
6642
6758
  var n, o, r, a;
6643
- Qt(this.getSeriesContext(), e, t), this.recalculateTools();
6759
+ ei(this.getSeriesContext(), e, t), this.recalculateTools();
6644
6760
  const i = this.series.get(e);
6645
6761
  i && this.pluginManager.notifyDataUpdate({
6646
6762
  seriesId: e,
@@ -6651,7 +6767,7 @@ const V = class V {
6651
6767
  }
6652
6768
  appendData(e, t, i) {
6653
6769
  var o, r;
6654
- Zt(this.getSeriesContext(), e, t, i), this.recalculateTools();
6770
+ ti(this.getSeriesContext(), e, t, i), this.recalculateTools();
6655
6771
  const n = this.series.get(e);
6656
6772
  n && this.pluginManager.notifyDataUpdate({
6657
6773
  seriesId: e,
@@ -6664,7 +6780,7 @@ const V = class V {
6664
6780
  this.autoScroll = e;
6665
6781
  }
6666
6782
  setMaxPoints(e, t) {
6667
- Jt(this.getSeriesContext(), e, t);
6783
+ ii(this.getSeriesContext(), e, t);
6668
6784
  }
6669
6785
  /**
6670
6786
  * Add a line of best fit to a series
@@ -6732,7 +6848,7 @@ const V = class V {
6732
6848
  zoom(e) {
6733
6849
  const t = { ...this.viewBounds };
6734
6850
  if (this.animationConfig.enabled && e.animate !== !1) {
6735
- const i = Pt(
6851
+ const i = Dt(
6736
6852
  this.getAnimatedNavContext(),
6737
6853
  e
6738
6854
  );
@@ -6740,7 +6856,7 @@ const V = class V {
6740
6856
  n.message !== "Animation cancelled" && console.error("[VeloPlot] Animation error:", n);
6741
6857
  });
6742
6858
  } else
6743
- St(this.getNavContext(), e);
6859
+ kt(this.getNavContext(), e);
6744
6860
  this.pluginManager.notifyViewChange({
6745
6861
  previous: t,
6746
6862
  current: { ...this.viewBounds },
@@ -6750,7 +6866,7 @@ const V = class V {
6750
6866
  }
6751
6867
  pan(e, t, i) {
6752
6868
  const n = { ...this.viewBounds };
6753
- wt(this.getNavContext(), e, t, i), this.pluginManager.notifyViewChange({
6869
+ Tt(this.getNavContext(), e, t, i), this.pluginManager.notifyViewChange({
6754
6870
  previous: n,
6755
6871
  current: { ...this.viewBounds },
6756
6872
  trigger: "pan",
@@ -6763,7 +6879,7 @@ const V = class V {
6763
6879
  fit(e) {
6764
6880
  this.executeOrQueue("fit", () => {
6765
6881
  const t = { ...this.viewBounds }, i = e == null ? void 0 : e.padding;
6766
- At(this.getNavContext(), {
6882
+ Pt(this.getNavContext(), {
6767
6883
  x: e == null ? void 0 : e.x,
6768
6884
  y: e == null ? void 0 : e.y,
6769
6885
  padding: i
@@ -6785,7 +6901,7 @@ const V = class V {
6785
6901
  this.executeOrQueue("autoScale", () => {
6786
6902
  const t = { ...this.viewBounds };
6787
6903
  if (this.animationConfig.enabled && e) {
6788
- const i = It(
6904
+ const i = Ft(
6789
6905
  this.getAnimatedNavContext(),
6790
6906
  !0
6791
6907
  );
@@ -6793,7 +6909,7 @@ const V = class V {
6793
6909
  n.message !== "Animation cancelled" && console.error("[VeloPlot] Animation error:", n);
6794
6910
  });
6795
6911
  } else
6796
- Ct(this.getNavContext());
6912
+ Bt(this.getNavContext());
6797
6913
  this.pluginManager.notifyViewChange({
6798
6914
  previous: t,
6799
6915
  current: { ...this.viewBounds },
@@ -6807,14 +6923,14 @@ const V = class V {
6807
6923
  * Used during streaming to prevent X-axis shifting
6808
6924
  */
6809
6925
  autoScaleYOnly() {
6810
- kt(this.getNavContext()), this.requestRender();
6926
+ Et(this.getNavContext()), this.requestRender();
6811
6927
  }
6812
6928
  /**
6813
6929
  * Animate view bounds to specific target
6814
6930
  */
6815
6931
  animateTo(e) {
6816
6932
  var i, n, o, r;
6817
- const t = Et(
6933
+ const t = Lt(
6818
6934
  this.getAnimatedNavContext(),
6819
6935
  {
6820
6936
  xMin: (i = e.xRange) == null ? void 0 : i[0],
@@ -6841,7 +6957,7 @@ const V = class V {
6841
6957
  * Set animation configuration
6842
6958
  */
6843
6959
  setAnimationConfig(e) {
6844
- this.animationConfig = pe({
6960
+ this.animationConfig = be({
6845
6961
  ...this.animationConfig,
6846
6962
  ...e
6847
6963
  });
@@ -6854,7 +6970,7 @@ const V = class V {
6854
6970
  }
6855
6971
  handleBoxZoom(e) {
6856
6972
  const t = e === null;
6857
- this.selectionRect = Tt(
6973
+ this.selectionRect = It(
6858
6974
  this.getNavContext(),
6859
6975
  e,
6860
6976
  this.selectionRect,
@@ -6913,10 +7029,10 @@ const V = class V {
6913
7029
  }
6914
7030
  // Export
6915
7031
  exportCSV(e) {
6916
- return xt(this.getAllSeries(), e);
7032
+ return St(this.getAllSeries(), e);
6917
7033
  }
6918
7034
  exportJSON(e) {
6919
- return bt(this.getAllSeries(), this.viewBounds, e);
7035
+ return wt(this.getAllSeries(), this.viewBounds, e);
6920
7036
  }
6921
7037
  // ============================================
6922
7038
  // Axis Management
@@ -6945,10 +7061,28 @@ const V = class V {
6945
7061
  getDPR() {
6946
7062
  return this.dpr;
6947
7063
  }
6948
- /** Runtime chart renderer backend in use. */
6949
7064
  getActiveRenderer() {
6950
7065
  return this.activeRendererType;
6951
7066
  }
7067
+ /** Series id hovered from the legend — affects draw order in canvas and live SVG. */
7068
+ getHoveredSeriesId() {
7069
+ return this.hoveredSeriesId;
7070
+ }
7071
+ /** @internal Vector frame for `renderer: 'svg'` — patched on extended bundles. */
7072
+ buildSVGFrame() {
7073
+ try {
7074
+ return this.exportSVG({
7075
+ includeOverlays: !0,
7076
+ includeLegend: this.showLegend,
7077
+ includeAnnotations: !0,
7078
+ // Live SVG: cursor/tooltips render on the transparent overlay canvas.
7079
+ includeCursor: !1,
7080
+ includeSelection: !!this.selectionRect
7081
+ });
7082
+ } catch {
7083
+ return '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><text x="4" y="14">SVG unavailable</text></svg>';
7084
+ }
7085
+ }
6952
7086
  /**
6953
7087
  * Set device pixel ratio and re-render
6954
7088
  */
@@ -6972,7 +7106,7 @@ const V = class V {
6972
7106
  this.axisManager.updateXAxis(e), this.requestRender();
6973
7107
  }
6974
7108
  updateLayout(e) {
6975
- this.layout = Fe({
7109
+ this.layout = Le({
6976
7110
  ...this.layout,
6977
7111
  ...e,
6978
7112
  margins: {
@@ -7199,7 +7333,7 @@ const V = class V {
7199
7333
  resize() {
7200
7334
  if (this.isDestroyed || this.resizeSuspended || !this.renderer) return;
7201
7335
  const e = this.dprOverride ?? this.initialOptions.devicePixelRatio ?? window.devicePixelRatio;
7202
- Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), si(
7336
+ Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), li(
7203
7337
  this.container,
7204
7338
  this.webglCanvas,
7205
7339
  this.overlayCanvas,
@@ -7243,7 +7377,7 @@ const V = class V {
7243
7377
  }
7244
7378
  destroy() {
7245
7379
  var e, t, i, n;
7246
- for (this._isDestroyed = !0, this.renderLoop.cancelPendingRender(), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = null, this.initQueueId && (ae(this.initQueueId), this.initQueueId = null), this.animationEngine.destroy(), this.selectionManager.destroy(), (i = (t = this.featureHooks) == null ? void 0 : t.destroy) == null || i.call(t), this.featureHooks = null, this.responsiveManager.destroy(), this.interaction.destroy(), this.series.forEach((o) => {
7380
+ for (this._isDestroyed = !0, this.renderLoop.cancelPendingRender(), (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = null, this.initQueueId && (he(this.initQueueId), this.initQueueId = null), this.animationEngine.destroy(), this.selectionManager.destroy(), (i = (t = this.featureHooks) == null ? void 0 : t.destroy) == null || i.call(t), this.featureHooks = null, this.responsiveManager.destroy(), this.interaction.destroy(), this.series.forEach((o) => {
7247
7381
  var r;
7248
7382
  (r = this.renderer) == null || r.deleteBuffer(o.getId()), o.destroy();
7249
7383
  }), this.series.clear(), (n = this.renderer) == null || n.destroy(), this.controls && this.controls.destroy(), this.legend && this.legend.destroy(), this.pluginManager.destroy(); this.container.firstChild; )
@@ -7260,13 +7394,13 @@ const V = class V {
7260
7394
  }
7261
7395
  };
7262
7396
  /** Optional hook for extended bundles (WebGPU, etc.). */
7263
- g(V, "afterConstruct", null);
7264
- let le = V;
7265
- function Qi(s) {
7266
- const e = new le(s);
7267
- return mi().then((t) => {
7397
+ g(X, "afterConstruct", null);
7398
+ let ce = X;
7399
+ function ns(s) {
7400
+ const e = new ce(s);
7401
+ return vi().then((t) => {
7268
7402
  if (e.setInitQueueId(t), e.isDestroyed) {
7269
- ae(t);
7403
+ he(t);
7270
7404
  return;
7271
7405
  }
7272
7406
  e.startInit().then(() => {
@@ -7275,64 +7409,66 @@ function Qi(s) {
7275
7409
  }), e;
7276
7410
  }
7277
7411
  export {
7278
- bi as $,
7279
- Yi as A,
7280
- _i as B,
7281
- le as C,
7282
- oe as D,
7283
- ut as E,
7284
- Vi as F,
7285
- Be as G,
7286
- Ei as H,
7287
- Bt as I,
7288
- D as J,
7289
- pe as K,
7290
- X as L,
7291
- lt as M,
7292
- J as N,
7293
- gt as O,
7294
- hi as P,
7295
- Fi as Q,
7296
- yi as R,
7297
- Yt as S,
7298
- Hi as T,
7299
- Ni as U,
7300
- Ui as V,
7301
- qi as W,
7302
- I as X,
7303
- Le as Y,
7304
- be as Z,
7305
- ve as _,
7306
- $ as a,
7307
- vi as a0,
7308
- Mi as a1,
7309
- Si as a2,
7310
- Wi as a3,
7311
- Gi as a4,
7312
- Xi as b,
7313
- Qi as c,
7314
- ht as d,
7315
- dt as e,
7316
- Di as f,
7317
- Te as g,
7318
- li as h,
7319
- U as i,
7320
- $i as j,
7321
- we as k,
7322
- zi as l,
7323
- Fe as m,
7324
- Li as n,
7325
- Ce as o,
7326
- H as p,
7327
- Ze as q,
7328
- Oi as r,
7329
- Qe as s,
7330
- fe as t,
7331
- Ri as u,
7332
- ji as v,
7333
- te as w,
7334
- Ii as x,
7335
- O as y,
7336
- se as z
7412
+ Ti as $,
7413
+ Pe as A,
7414
+ D as B,
7415
+ ce as C,
7416
+ ae as D,
7417
+ mt as E,
7418
+ be as F,
7419
+ $i as G,
7420
+ Vi as H,
7421
+ Mi as I,
7422
+ Zi as J,
7423
+ Ji as K,
7424
+ $ as L,
7425
+ dt as M,
7426
+ K as N,
7427
+ pt as O,
7428
+ fi as P,
7429
+ Ki as Q,
7430
+ es as R,
7431
+ $t as S,
7432
+ E as T,
7433
+ Le as U,
7434
+ Oe as V,
7435
+ Me as W,
7436
+ Se as X,
7437
+ Ci as Y,
7438
+ Ai as Z,
7439
+ ki as _,
7440
+ H as a,
7441
+ ts as a0,
7442
+ is as a1,
7443
+ Ii as a2,
7444
+ Ye as a3,
7445
+ ne as a4,
7446
+ U as a5,
7447
+ Qi as a6,
7448
+ ji as b,
7449
+ ns as c,
7450
+ gt as d,
7451
+ yt as e,
7452
+ Xi as f,
7453
+ Be as g,
7454
+ gi as h,
7455
+ Ce as i,
7456
+ Ni as j,
7457
+ Hi as k,
7458
+ Ae as l,
7459
+ et as m,
7460
+ Ke as n,
7461
+ ye as o,
7462
+ N as p,
7463
+ _i as q,
7464
+ Ui as r,
7465
+ ss as s,
7466
+ ie as t,
7467
+ Yi as u,
7468
+ qi as v,
7469
+ Wi as w,
7470
+ Gi as x,
7471
+ Y as y,
7472
+ Rt as z
7337
7473
  };
7338
- //# sourceMappingURL=ChartCore-AnR_3Xkb.js.map
7474
+ //# sourceMappingURL=ChartCore-KYG2HTcK.js.map