velo-plot 1.19.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{ChartCore-DQ691eXH.js → ChartCore-BhQ4j7f5.js} +1299 -1102
  2. package/dist/ChartCore-BhQ4j7f5.js.map +1 -0
  3. package/dist/SciPlot-GJvw7GJo.js +463 -0
  4. package/dist/SciPlot-GJvw7GJo.js.map +1 -0
  5. package/dist/axisFormat-SPX-CD5s.js +200 -0
  6. package/dist/axisFormat-SPX-CD5s.js.map +1 -0
  7. package/dist/core/InteractionManager.d.ts +1 -0
  8. package/dist/core/OverlayRenderer.d.ts +11 -0
  9. package/dist/core/chart/ChartCore.d.ts +5 -0
  10. package/dist/core/chart/ChartRenderLoop.d.ts +5 -0
  11. package/dist/core/chart/ChartRenderer.d.ts +5 -0
  12. package/dist/core/chart/positionLines.d.ts +12 -0
  13. package/dist/core/chart/types.d.ts +2 -0
  14. package/dist/core/format/axisFormat.d.ts +2 -1
  15. package/dist/core/indicator/addIndicator.d.ts +1 -1
  16. package/dist/core/indicator/indicatorPresets.d.ts +10 -2
  17. package/dist/core/time/TimeScale.d.ts +2 -2
  18. package/dist/core/time/applyTimeScale.d.ts +10 -0
  19. package/dist/createStackedChart-DJSmqerD.js +706 -0
  20. package/dist/createStackedChart-DJSmqerD.js.map +1 -0
  21. package/dist/{index-DjeWClO9.js → index-CWipqOLP.js} +2 -2
  22. package/dist/{index-DjeWClO9.js.map → index-CWipqOLP.js.map} +1 -1
  23. package/dist/{index.core-BtGFYMOu.js → index.core-fpZ1dYN0.js} +3 -3
  24. package/dist/{index.core-BtGFYMOu.js.map → index.core-fpZ1dYN0.js.map} +1 -1
  25. package/dist/index.d.ts +5 -0
  26. package/dist/mockDatafeed-Cdg5hKEo.js +511 -0
  27. package/dist/mockDatafeed-Cdg5hKEo.js.map +1 -0
  28. package/dist/plugins/drawing-tools/index.d.ts +14 -1
  29. package/dist/plugins/drawing-tools/measure.d.ts +21 -0
  30. package/dist/plugins/drawing-tools/snapToCandle.d.ts +21 -0
  31. package/dist/plugins/tools.js +1 -1
  32. package/dist/react.js +5 -5
  33. package/dist/trading/datafeed.d.ts +48 -0
  34. package/dist/trading/index.d.ts +29 -0
  35. package/dist/trading/mockDatafeed.d.ts +9 -0
  36. package/dist/trading/ohlcvGenerator.d.ts +25 -0
  37. package/dist/trading.d.ts +1 -0
  38. package/dist/trading.js +95 -0
  39. package/dist/trading.js.map +1 -0
  40. package/dist/types.d.ts +1 -1
  41. package/dist/velo-plot.full.js +833 -1054
  42. package/dist/velo-plot.full.js.map +1 -1
  43. package/dist/velo-plot.js +13 -13
  44. package/package.json +13 -1
  45. package/dist/ChartCore-DQ691eXH.js.map +0 -1
  46. package/dist/axisFormat-B7o_uIEA.js +0 -127
  47. package/dist/axisFormat-B7o_uIEA.js.map +0 -1
  48. package/dist/createStackedChart-BPooTQ9z.js +0 -1164
  49. package/dist/createStackedChart-BPooTQ9z.js.map +0 -1
@@ -1,17 +1,17 @@
1
- var lt = Object.defineProperty;
2
- var ht = (i, e, t) => e in i ? lt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var p = (i, e, t) => ht(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { b as qe, c as Ge, E as ct } from "./axisFormat-B7o_uIEA.js";
5
- import { G as ut } from "./gpuRenderer-BpaMYz-k.js";
1
+ var ct = Object.defineProperty;
2
+ var ut = (i, e, t) => e in i ? ct(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var m = (i, e, t) => ut(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { g as qe, h as Ge, a as je, c as Ze, E as dt } from "./axisFormat-SPX-CD5s.js";
5
+ import { G as ft } from "./gpuRenderer-BpaMYz-k.js";
6
6
  import "./index-x4stH3jD.js";
7
- import { P as dt } from "./index-qhscKTDy.js";
8
- import { f as ft, m as gt, e as yt, s as mt, r as pt } from "./indicators--eJGmVox.js";
9
- import { n as xt, W as bt } from "./pool-15HMCNv8.js";
7
+ import { P as gt } from "./index-qhscKTDy.js";
8
+ import { f as yt, m as mt, e as pt, s as xt, r as bt, a as vt } from "./indicators--eJGmVox.js";
9
+ import { n as wt, W as St } from "./pool-15HMCNv8.js";
10
10
  const ae = { top: 20, right: 30, bottom: 55, left: 75 };
11
- class vt {
11
+ class Mt {
12
12
  constructor(e) {
13
- p(this, "buffers", /* @__PURE__ */ new Map());
14
- p(this, "bufferSizes", /* @__PURE__ */ new Map());
13
+ m(this, "buffers", /* @__PURE__ */ new Map());
14
+ m(this, "bufferSizes", /* @__PURE__ */ new Map());
15
15
  this.gl = e;
16
16
  }
17
17
  createBuffer(e, t) {
@@ -40,7 +40,7 @@ class vt {
40
40
  this.buffers.forEach((e) => this.gl.deleteBuffer(e)), this.buffers.clear(), this.bufferSizes.clear();
41
41
  }
42
42
  }
43
- const St = `
43
+ const Ct = `
44
44
  precision highp float;
45
45
  attribute vec2 position;
46
46
  uniform vec2 uScale;
@@ -50,14 +50,14 @@ void main() {
50
50
  vec2 pos = position * uScale + uTranslate;
51
51
  gl_Position = vec4(pos, 0.0, 1.0);
52
52
  }
53
- `, wt = `
53
+ `, At = `
54
54
  precision highp float;
55
55
  uniform vec4 uColor;
56
56
 
57
57
  void main() {
58
58
  gl_FragColor = uColor;
59
59
  }
60
- `, Mt = `
60
+ `, Pt = `
61
61
  precision highp float;
62
62
  attribute vec2 position;
63
63
  uniform vec2 uScale;
@@ -69,7 +69,7 @@ void main() {
69
69
  gl_Position = vec4(pos, 0.0, 1.0);
70
70
  gl_PointSize = uPointSize;
71
71
  }
72
- `, Ct = `
72
+ `, kt = `
73
73
  precision highp float;
74
74
  uniform vec4 uColor;
75
75
  uniform int uSymbol;
@@ -150,7 +150,7 @@ void main() {
150
150
  float alpha = 1.0 - smoothstep(0.0, 0.02, d);
151
151
  gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);
152
152
  }
153
- `, At = `
153
+ `, Bt = `
154
154
  precision highp float;
155
155
  attribute vec2 aPosition;
156
156
  attribute float aValue;
@@ -162,7 +162,7 @@ void main() {
162
162
  gl_Position = vec4(aPosition * uScale + uTranslate, 0.0, 1.0);
163
163
  vValue = aValue;
164
164
  }
165
- `, Pt = `
165
+ `, Tt = `
166
166
  precision highp float;
167
167
  varying float vValue;
168
168
  uniform float uMinValue;
@@ -213,11 +213,11 @@ function Ce(i, e, t, n) {
213
213
  }
214
214
  };
215
215
  }
216
- function kt(i) {
216
+ function It(i) {
217
217
  return {
218
- lineProgram: Ce(i, St, wt, "line"),
219
- pointProgram: Ce(i, Mt, Ct, "point"),
220
- heatmapProgram: Ce(i, At, Pt, "heatmap")
218
+ lineProgram: Ce(i, Ct, At, "line"),
219
+ pointProgram: Ce(i, Pt, kt, "point"),
220
+ heatmapProgram: Ce(i, Bt, Tt, "heatmap")
221
221
  };
222
222
  }
223
223
  function _(i) {
@@ -244,14 +244,14 @@ function _(i) {
244
244
  }
245
245
  return [1, 0, 1, 1];
246
246
  }
247
- function Bt(i, e = !0) {
248
- const [t, n, s, o] = _(i), [r, a, l] = Tt(t, n, s), h = (r + 0.12) % 1, d = Math.min(1, a + 0.4);
247
+ function Et(i, e = !0) {
248
+ const [t, n, s, o] = _(i), [r, a, l] = Rt(t, n, s), h = (r + 0.12) % 1, d = Math.min(1, a + 0.4);
249
249
  let c;
250
250
  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));
251
- const [f, u, g] = It(h, d, c), y = Math.round(f * 255), m = Math.round(u * 255), b = Math.round(g * 255);
252
- return o < 1 ? `rgba(${y}, ${m}, ${b}, ${o})` : `rgb(${y}, ${m}, ${b})`;
251
+ const [f, u, g] = Ft(h, d, c), y = Math.round(f * 255), x = Math.round(u * 255), b = Math.round(g * 255);
252
+ return o < 1 ? `rgba(${y}, ${x}, ${b}, ${o})` : `rgb(${y}, ${x}, ${b})`;
253
253
  }
254
- function Tt(i, e, t) {
254
+ function Rt(i, e, t) {
255
255
  const n = Math.max(i, e, t), s = Math.min(i, e, t);
256
256
  let o = 0, r = 0, a = (n + s) / 2;
257
257
  if (n !== s) {
@@ -271,7 +271,7 @@ function Tt(i, e, t) {
271
271
  }
272
272
  return [o, r, a];
273
273
  }
274
- function It(i, e, t) {
274
+ function Ft(i, e, t) {
275
275
  let n, s, o;
276
276
  if (e === 0)
277
277
  n = s = o = t;
@@ -281,16 +281,16 @@ function It(i, e, t) {
281
281
  }
282
282
  return [n, s, o];
283
283
  }
284
- function je(i, e) {
284
+ function Qe(i, e) {
285
285
  const t = Math.min(i.length, e.length), n = new Float32Array(t * 2);
286
286
  for (let s = 0; s < t; s++)
287
287
  n[s * 2] = i[s], n[s * 2 + 1] = e[s];
288
288
  return n;
289
289
  }
290
- function Et(i, e, t = "after") {
290
+ function Dt(i, e, t = "after") {
291
291
  const n = Math.min(i.length, e.length);
292
292
  if (n < 2)
293
- return je(i, e);
293
+ return Qe(i, e);
294
294
  const s = t === "center" ? 1 + (n - 1) * 3 : n * 2 - 1, o = new Float32Array(s * 2);
295
295
  let r = 0;
296
296
  for (let a = 0; a < n; a++)
@@ -309,7 +309,7 @@ function Et(i, e, t = "after") {
309
309
  }
310
310
  return o.subarray(0, r);
311
311
  }
312
- function Qe(i, e, t) {
312
+ function Je(i, e, t) {
313
313
  const n = Math.min(i.length, e.length, t.length), s = new Float32Array(n * 2 * 2);
314
314
  for (let o = 0; o < n; o++) {
315
315
  const r = o * 4, a = i[o];
@@ -317,7 +317,7 @@ function Qe(i, e, t) {
317
317
  }
318
318
  return s;
319
319
  }
320
- function Rt(i, e, t, n) {
320
+ function Lt(i, e, t, n) {
321
321
  const s = i.length;
322
322
  let o = 0;
323
323
  t && o++, n && o++;
@@ -336,24 +336,24 @@ function Rt(i, e, t, n) {
336
336
  }
337
337
  return r.subarray(0, a);
338
338
  }
339
- function Ft(i, e, t, n, s, o, r) {
339
+ function zt(i, e, t, n, s, o, r) {
340
340
  const a = i.length, l = r / 2, h = new Float32Array(a * 20), d = new Float32Array(a * 12);
341
341
  let c = 0, f = 0;
342
342
  for (let u = 0; u < a; u++) {
343
- const g = i[u], y = e[u], m = t[u], b = n[u], v = s[u], x = o[u];
344
- h[c++] = g, h[c++] = y, h[c++] = g, h[c++] = m, h[c++] = g, h[c++] = v, h[c++] = g, h[c++] = x, h[c++] = g - l, h[c++] = b, h[c++] = g + l, h[c++] = b, h[c++] = g - l, h[c++] = m, h[c++] = g + l, h[c++] = m, h[c++] = g - l, h[c++] = v, h[c++] = g + l, h[c++] = v, d[f++] = g - l, d[f++] = m, d[f++] = g + l, d[f++] = m, d[f++] = g + l, d[f++] = v, d[f++] = g - l, d[f++] = m, d[f++] = g + l, d[f++] = v, d[f++] = g - l, d[f++] = v;
343
+ const g = i[u], y = e[u], x = t[u], b = n[u], w = s[u], p = o[u];
344
+ h[c++] = g, h[c++] = y, h[c++] = g, h[c++] = x, h[c++] = g, h[c++] = w, h[c++] = g, h[c++] = p, h[c++] = g - l, h[c++] = b, h[c++] = g + l, h[c++] = b, h[c++] = g - l, h[c++] = x, h[c++] = g + l, h[c++] = x, h[c++] = g - l, h[c++] = w, h[c++] = g + l, h[c++] = w, d[f++] = g - l, d[f++] = x, d[f++] = g + l, d[f++] = x, d[f++] = g + l, d[f++] = w, d[f++] = g - l, d[f++] = x, d[f++] = g + l, d[f++] = w, d[f++] = g - l, d[f++] = w;
345
345
  }
346
346
  return { lines: h, boxes: d };
347
347
  }
348
- function Dt(i, e, t, n) {
348
+ function Ot(i, e, t, n) {
349
349
  const s = i.length, o = t / 2, r = new Float32Array(s * 12), a = new Float32Array(s * 12), l = new Float32Array(s * 12), h = new Float32Array((s - 1) * 4);
350
350
  let d = 0, c = 0, f = 0, u = 0, g = 0;
351
351
  for (let y = 0; y < s; y++) {
352
- const m = i[y], b = e[y], v = (n == null ? void 0 : n[y]) ?? !1;
353
- let x, S;
354
- if (v ? (x = 0, S = g, l[f++] = m - o, l[f++] = x, l[f++] = m + o, l[f++] = x, l[f++] = m + o, l[f++] = S, l[f++] = m - o, l[f++] = x, l[f++] = m + o, l[f++] = S, l[f++] = m - o, l[f++] = S) : (x = g, S = g + b, g = S, b >= 0 ? (r[d++] = m - o, r[d++] = x, r[d++] = m + o, r[d++] = x, r[d++] = m + o, r[d++] = S, r[d++] = m - o, r[d++] = x, r[d++] = m + o, r[d++] = S, r[d++] = m - o, r[d++] = S) : (a[c++] = m - o, a[c++] = S, a[c++] = m + o, a[c++] = S, a[c++] = m + o, a[c++] = x, a[c++] = m - o, a[c++] = S, a[c++] = m + o, a[c++] = x, a[c++] = m - o, a[c++] = x)), y < s - 1) {
355
- const w = i[y + 1];
356
- h[u++] = m + o, h[u++] = S, h[u++] = w - o, h[u++] = S;
352
+ const x = i[y], b = e[y], w = (n == null ? void 0 : n[y]) ?? !1;
353
+ let p, v;
354
+ if (w ? (p = 0, v = g, l[f++] = x - o, l[f++] = p, l[f++] = x + o, l[f++] = p, l[f++] = x + o, l[f++] = v, l[f++] = x - o, l[f++] = p, l[f++] = x + o, l[f++] = v, l[f++] = x - o, l[f++] = v) : (p = g, v = g + b, g = v, b >= 0 ? (r[d++] = x - o, r[d++] = p, r[d++] = x + o, r[d++] = p, r[d++] = x + o, r[d++] = v, r[d++] = x - o, r[d++] = p, r[d++] = x + o, r[d++] = v, r[d++] = x - o, r[d++] = v) : (a[c++] = x - o, a[c++] = v, a[c++] = x + o, a[c++] = v, a[c++] = x + o, a[c++] = p, a[c++] = x - o, a[c++] = v, a[c++] = x + o, a[c++] = p, a[c++] = x - o, a[c++] = p)), y < s - 1) {
355
+ const S = i[y + 1];
356
+ h[u++] = x + o, h[u++] = v, h[u++] = S - o, h[u++] = v;
357
357
  }
358
358
  }
359
359
  return {
@@ -366,21 +366,21 @@ function Dt(i, e, t, n) {
366
366
  subtotalCount: f / 2
367
367
  };
368
368
  }
369
- function Lt(i, e = !1) {
369
+ function $t(i, e = !1) {
370
370
  const t = i.xMax - i.xMin, n = i.yMax - i.yMin, s = t > 0 ? (e ? -2 : 2) / t : 1, o = n > 0 ? 2 / n : 1, r = e ? 1 - i.xMin * s : -1 - i.xMin * s, a = -1 - i.yMin * o;
371
371
  return {
372
372
  scale: [s, o],
373
373
  translate: [r, a]
374
374
  };
375
375
  }
376
- function ge(i, e, t, n, s, o, r = 1) {
376
+ function ye(i, e, t, n, s, o, r = 1) {
377
377
  i.useProgram(e.program), i.lineWidth(r), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
378
378
  e.uniforms.uTranslate,
379
379
  s.translate[0],
380
380
  s.translate[1]
381
381
  ), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.LINE_STRIP, 0, n), i.disableVertexAttribArray(e.attributes.position);
382
382
  }
383
- function zt(i, e, t, n, s, o) {
383
+ function Yt(i, e, t, n, s, o) {
384
384
  i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
385
385
  e.uniforms.uTranslate,
386
386
  s.translate[0],
@@ -409,28 +409,28 @@ function Ae(i, e, t, n, s, o, r, a = "circle") {
409
409
  }
410
410
  i.drawArrays(i.POINTS, 0, n), i.disableVertexAttribArray(e.attributes.position);
411
411
  }
412
- function Ot(i, e, t, n, s, o = { min: 0, max: 1 }, r) {
412
+ function _t(i, e, t, n, s, o = { min: 0, max: 1 }, r) {
413
413
  i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 12, 0), e.attributes.value !== void 0 && e.attributes.value !== -1 && (i.enableVertexAttribArray(e.attributes.value), i.vertexAttribPointer(e.attributes.value, 1, i.FLOAT, !1, 12, 8)), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
414
414
  e.uniforms.uTranslate,
415
415
  s.translate[0],
416
416
  s.translate[1]
417
417
  ), e.uniforms.uMinValue && i.uniform1f(e.uniforms.uMinValue, o.min), e.uniforms.uMaxValue && i.uniform1f(e.uniforms.uMaxValue, o.max), r && e.uniforms.uColormap ? (i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, r), i.uniform1i(e.uniforms.uColormap, 0)) : e.uniforms.uColormap && (i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, null)), i.drawArrays(i.TRIANGLES, 0, n), i.disableVertexAttribArray(e.attributes.position), e.attributes.value !== void 0 && e.attributes.value !== -1 && i.disableVertexAttribArray(e.attributes.value);
418
418
  }
419
- function $t(i, e, t, n, s, o) {
419
+ function Vt(i, e, t, n, s, o) {
420
420
  i.useProgram(e.program), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
421
421
  e.uniforms.uTranslate,
422
422
  s.translate[0],
423
423
  s.translate[1]
424
424
  ), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.TRIANGLES, 0, n), i.disableVertexAttribArray(e.attributes.position);
425
425
  }
426
- function Yt(i, e, t, n, s, o, r = 1) {
426
+ function Wt(i, e, t, n, s, o, r = 1) {
427
427
  i.useProgram(e.program), i.lineWidth(r), i.bindBuffer(i.ARRAY_BUFFER, t), i.enableVertexAttribArray(e.attributes.position), i.vertexAttribPointer(e.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.uniforms.uScale, s.scale[0], s.scale[1]), i.uniform2f(
428
428
  e.uniforms.uTranslate,
429
429
  s.translate[0],
430
430
  s.translate[1]
431
431
  ), i.uniform4f(e.uniforms.uColor, o[0], o[1], o[2], o[3]), i.drawArrays(i.LINES, 0, n), i.disableVertexAttribArray(e.attributes.position);
432
432
  }
433
- function _t(i, e, t, n, s) {
433
+ function Xt(i, e, t, n, s) {
434
434
  const o = Be(s);
435
435
  i.useProgram(e.line.program), i.bindBuffer(i.ARRAY_BUFFER, t.boxBuffer), i.enableVertexAttribArray(e.line.attributes.position), i.vertexAttribPointer(e.line.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(e.line.uniforms.uScale, n.scale[0], n.scale[1]), i.uniform2f(
436
436
  e.line.uniforms.uTranslate,
@@ -444,7 +444,7 @@ function Be(i) {
444
444
  const e = _(i.color ?? "#ff0055");
445
445
  return e[3] = i.opacity ?? 1, e;
446
446
  }
447
- function Vt(i, e, t, n, s, o) {
447
+ function Nt(i, e, t, n, s, o) {
448
448
  const { bounds: r, backgroundColor: a = [0.1, 0.1, 0.18, 1], plotArea: l } = o, h = e.height, d = e.width, c = l ? {
449
449
  x: l.x * t,
450
450
  y: h - (l.y + l.height) * t,
@@ -467,110 +467,110 @@ function Vt(i, e, t, n, s, o) {
467
467
  o.plotAreaBackground[2],
468
468
  o.plotAreaBackground[3]
469
469
  ), i.clear(i.COLOR_BUFFER_BIT));
470
- const f = Lt(r, o.invertX);
470
+ const f = $t(r, o.invertX);
471
471
  for (const u of s) {
472
472
  if (!u.visible || u.count === 0 && u.type !== "boxplot" && u.type !== "waterfall") continue;
473
- const g = u.yBounds ? u.yBounds.min : r.yMin, m = (u.yBounds ? u.yBounds.max : r.yMax) - g, b = m > 0 ? 2 / m : 1, v = -1 - g * b, x = {
473
+ const g = u.yBounds ? u.yBounds.min : r.yMin, x = (u.yBounds ? u.yBounds.max : r.yMax) - g, b = x > 0 ? 2 / x : 1, w = -1 - g * b, p = {
474
474
  scale: [f.scale[0], b],
475
- translate: [f.translate[0], v]
476
- }, S = Be(u.style);
475
+ translate: [f.translate[0], w]
476
+ }, v = Be(u.style);
477
477
  if (u.type === "scatter")
478
478
  Ae(
479
479
  i,
480
480
  n.pointProgram,
481
481
  u.buffer,
482
482
  u.count,
483
- x,
484
- S,
483
+ p,
484
+ v,
485
485
  (u.style.pointSize ?? 4) * t,
486
486
  u.style.symbol
487
487
  );
488
488
  else if (u.type === "line")
489
- ge(
489
+ ye(
490
490
  i,
491
491
  n.lineProgram,
492
492
  u.buffer,
493
493
  u.count,
494
- x,
495
- S,
494
+ p,
495
+ v,
496
496
  (u.style.width ?? 1) * t
497
497
  );
498
498
  else if (u.type === "line+scatter")
499
- ge(
499
+ ye(
500
500
  i,
501
501
  n.lineProgram,
502
502
  u.buffer,
503
503
  u.count,
504
- x,
505
- S,
504
+ p,
505
+ v,
506
506
  (u.style.width ?? 1) * t
507
507
  ), Ae(
508
508
  i,
509
509
  n.pointProgram,
510
510
  u.buffer,
511
511
  u.count,
512
- x,
513
- S,
512
+ p,
513
+ v,
514
514
  (u.style.pointSize ?? 4) * t,
515
515
  u.style.symbol
516
516
  );
517
517
  else if (u.type === "step" || u.type === "step+scatter")
518
- u.stepBuffer && u.stepCount ? ge(
518
+ u.stepBuffer && u.stepCount ? ye(
519
519
  i,
520
520
  n.lineProgram,
521
521
  u.stepBuffer,
522
522
  u.stepCount,
523
- x,
524
- S,
523
+ p,
524
+ v,
525
525
  (u.style.width ?? 1) * t
526
- ) : ge(
526
+ ) : ye(
527
527
  i,
528
528
  n.lineProgram,
529
529
  u.buffer,
530
530
  u.count,
531
- x,
532
- S,
531
+ p,
532
+ v,
533
533
  (u.style.width ?? 1) * t
534
534
  ), u.type === "step+scatter" && Ae(
535
535
  i,
536
536
  n.pointProgram,
537
537
  u.buffer,
538
538
  u.count,
539
- x,
540
- S,
539
+ p,
540
+ v,
541
541
  (u.style.pointSize ?? 4) * t,
542
542
  u.style.symbol
543
543
  );
544
544
  else if (u.type === "band")
545
- zt(
545
+ Yt(
546
546
  i,
547
547
  n.lineProgram,
548
548
  u.buffer,
549
549
  u.count,
550
- x,
551
- S
550
+ p,
551
+ v
552
552
  );
553
553
  else if (u.type === "heatmap")
554
- Ot(
554
+ _t(
555
555
  i,
556
556
  n.heatmapProgram,
557
557
  u.buffer,
558
558
  u.count,
559
- x,
559
+ p,
560
560
  u.zBounds,
561
561
  u.colormapTexture
562
562
  );
563
563
  else if (u.type === "bar")
564
- $t(
564
+ Vt(
565
565
  i,
566
566
  n.lineProgram,
567
567
  u.buffer,
568
568
  u.count,
569
- x,
570
- S
569
+ p,
570
+ v
571
571
  );
572
572
  else if (u.type === "boxplot")
573
- u.boxBuffer && u.boxLinesBuffer && _t(
573
+ u.boxBuffer && u.boxLinesBuffer && Xt(
574
574
  i,
575
575
  { line: n.lineProgram, point: n.pointProgram },
576
576
  {
@@ -579,30 +579,30 @@ function Vt(i, e, t, n, s, o) {
579
579
  linesBuffer: u.boxLinesBuffer,
580
580
  linesCount: u.boxLinesCount || 0
581
581
  },
582
- x,
582
+ p,
583
583
  u.style
584
584
  );
585
585
  else if (u.type === "waterfall") {
586
- const w = _(u.style.positiveColor || "#22c55e"), M = _(u.style.negativeColor || "#ef4444"), A = _(u.style.subtotalColor || "#3b82f6"), k = _(u.style.connectorColor || "#64748b");
587
- u.wfPositiveBuffer && u.wfPositiveCount && u.wfPositiveCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfPositiveBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, x.scale[0], x.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, x.translate[0], x.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, w[0], w[1], w[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfPositiveCount)), u.wfNegativeBuffer && u.wfNegativeCount && u.wfNegativeCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfNegativeBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, x.scale[0], x.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, x.translate[0], x.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, M[0], M[1], M[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfNegativeCount)), u.wfSubtotalBuffer && u.wfSubtotalCount && u.wfSubtotalCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfSubtotalBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, x.scale[0], x.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, x.translate[0], x.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, A[0], A[1], A[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfSubtotalCount)), u.style.showConnectors !== !1 && u.wfConnectorBuffer && u.wfConnectorCount && u.wfConnectorCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfConnectorBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, x.scale[0], x.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, x.translate[0], x.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, k[0], k[1], k[2], 0.6), i.lineWidth(1), i.drawArrays(i.LINES, 0, u.wfConnectorCount)), i.disableVertexAttribArray(n.lineProgram.attributes.position);
586
+ const S = _(u.style.positiveColor || "#22c55e"), M = _(u.style.negativeColor || "#ef4444"), A = _(u.style.subtotalColor || "#3b82f6"), k = _(u.style.connectorColor || "#64748b");
587
+ u.wfPositiveBuffer && u.wfPositiveCount && u.wfPositiveCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfPositiveBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, S[0], S[1], S[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfPositiveCount)), u.wfNegativeBuffer && u.wfNegativeCount && u.wfNegativeCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfNegativeBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, M[0], M[1], M[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfNegativeCount)), u.wfSubtotalBuffer && u.wfSubtotalCount && u.wfSubtotalCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfSubtotalBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, A[0], A[1], A[2], 0.9), i.drawArrays(i.TRIANGLES, 0, u.wfSubtotalCount)), u.style.showConnectors !== !1 && u.wfConnectorBuffer && u.wfConnectorCount && u.wfConnectorCount > 0 && (i.useProgram(n.lineProgram.program), i.bindBuffer(i.ARRAY_BUFFER, u.wfConnectorBuffer), i.enableVertexAttribArray(n.lineProgram.attributes.position), i.vertexAttribPointer(n.lineProgram.attributes.position, 2, i.FLOAT, !1, 0, 0), i.uniform2f(n.lineProgram.uniforms.uScale, p.scale[0], p.scale[1]), i.uniform2f(n.lineProgram.uniforms.uTranslate, p.translate[0], p.translate[1]), i.uniform4f(n.lineProgram.uniforms.uColor, k[0], k[1], k[2], 0.6), i.lineWidth(1), i.drawArrays(i.LINES, 0, u.wfConnectorCount)), i.disableVertexAttribArray(n.lineProgram.attributes.position);
588
588
  }
589
589
  if (u.errorBuffer && u.errorCount) {
590
- const w = u.style.errorBars || {}, M = w.color ? Be({ color: w.color, opacity: w.opacity ?? 0.7 }) : S;
591
- Yt(
590
+ const S = u.style.errorBars || {}, M = S.color ? Be({ color: S.color, opacity: S.opacity ?? 0.7 }) : v;
591
+ Wt(
592
592
  i,
593
593
  n.lineProgram,
594
594
  u.errorBuffer,
595
595
  u.errorCount,
596
- x,
596
+ p,
597
597
  M,
598
- w.width ?? 1
598
+ S.width ?? 1
599
599
  );
600
600
  }
601
601
  }
602
602
  }
603
- class Wt {
603
+ class Ht {
604
604
  constructor(e) {
605
- p(this, "textures", /* @__PURE__ */ new Map());
605
+ m(this, "textures", /* @__PURE__ */ new Map());
606
606
  this.gl = e;
607
607
  }
608
608
  createColormapTexture(e, t) {
@@ -629,13 +629,13 @@ class Wt {
629
629
  }
630
630
  class Pe {
631
631
  constructor(e) {
632
- p(this, "canvas");
633
- p(this, "gl");
634
- p(this, "dpr");
635
- p(this, "programs");
636
- p(this, "buffers");
637
- p(this, "textures");
638
- p(this, "isInitialized", !1);
632
+ m(this, "canvas");
633
+ m(this, "gl");
634
+ m(this, "dpr");
635
+ m(this, "programs");
636
+ m(this, "buffers");
637
+ m(this, "textures");
638
+ m(this, "isInitialized", !1);
639
639
  this.canvas = e, this.dpr = window.devicePixelRatio || 1;
640
640
  const t = e.getContext("webgl", {
641
641
  alpha: !0,
@@ -644,7 +644,7 @@ class Pe {
644
644
  powerPreference: "high-performance"
645
645
  });
646
646
  if (!t) throw new Error("WebGL not supported");
647
- this.gl = t, this.programs = kt(t), this.buffers = new vt(t), this.textures = new Wt(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
647
+ this.gl = t, this.programs = It(t), this.buffers = new Mt(t), this.textures = new Ht(t), t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), this.isInitialized = !0;
648
648
  }
649
649
  setDPR(e) {
650
650
  this.dpr = e, this.resize();
@@ -674,7 +674,7 @@ class Pe {
674
674
  return this.textures.getTexture(e);
675
675
  }
676
676
  render(e, t) {
677
- this.isInitialized && Vt(this.gl, this.canvas, this.dpr, this.programs, e, t);
677
+ this.isInitialized && Nt(this.gl, this.canvas, this.dpr, this.programs, e, t);
678
678
  }
679
679
  resize() {
680
680
  const e = this.canvas.getBoundingClientRect(), t = Math.round(e.width * this.dpr), n = Math.round(e.height * this.dpr);
@@ -695,11 +695,11 @@ class Pe {
695
695
  }
696
696
  }
697
697
  const ze = {};
698
- class Xt {
698
+ class Ut {
699
699
  constructor(e, t) {
700
- p(this, "gpu");
701
- p(this, "dpr");
702
- p(this, "canvas");
700
+ m(this, "gpu");
701
+ m(this, "dpr");
702
+ m(this, "canvas");
703
703
  this.gpu = e, this.canvas = t, this.dpr = window.devicePixelRatio || 1;
704
704
  }
705
705
  get available() {
@@ -756,9 +756,9 @@ class Xt {
756
756
  this.gpu.destroy();
757
757
  }
758
758
  }
759
- async function Nt(i, e = {}) {
760
- const t = new ut(i, e);
761
- return await t.init() ? new Xt(t, i) : null;
759
+ async function qt(i, e = {}) {
760
+ const t = new ft(i, e);
761
+ return await t.init() ? new Ut(t, i) : null;
762
762
  }
763
763
  const Ee = {
764
764
  name: "vibrant",
@@ -807,7 +807,7 @@ const Ee = {
807
807
  ],
808
808
  highlightColor: "#FFFFFF"
809
809
  // Pure White
810
- }, Ze = {
810
+ }, Ke = {
811
811
  name: "pastel",
812
812
  isDark: !1,
813
813
  colors: [
@@ -854,7 +854,7 @@ const Ee = {
854
854
  ],
855
855
  highlightColor: "#1A1A1A"
856
856
  // Near Black
857
- }, Ut = {
857
+ }, Gt = {
858
858
  name: "neon",
859
859
  isDark: !0,
860
860
  colors: [
@@ -901,7 +901,7 @@ const Ee = {
901
901
  ],
902
902
  highlightColor: "#FFFFFF"
903
903
  // Pure White
904
- }, Ht = {
904
+ }, jt = {
905
905
  name: "earth",
906
906
  isDark: !1,
907
907
  colors: [
@@ -948,7 +948,7 @@ const Ee = {
948
948
  ],
949
949
  highlightColor: "#000000"
950
950
  // Pure Black
951
- }, qt = {
951
+ }, Zt = {
952
952
  name: "ocean",
953
953
  isDark: !0,
954
954
  colors: [
@@ -995,21 +995,21 @@ const Ee = {
995
995
  ],
996
996
  highlightColor: "#FFD700"
997
997
  // Gold
998
- }, Gt = [
998
+ }, Qt = [
999
999
  Ee,
1000
- Ze,
1001
- Ut,
1002
- Ht,
1003
- qt
1000
+ Ke,
1001
+ Gt,
1002
+ jt,
1003
+ Zt
1004
1004
  ];
1005
1005
  function Oe(i) {
1006
- const e = Gt.find((t) => t.name === i);
1006
+ const e = Qt.find((t) => t.name === i);
1007
1007
  return e || (console.warn(`[ColorScheme] Unknown scheme "${i}", using vibrant`), Ee);
1008
1008
  }
1009
1009
  function $e(i) {
1010
- return i ? Ee : Ze;
1010
+ return i ? Ee : Ke;
1011
1011
  }
1012
- const U = {
1012
+ const H = {
1013
1013
  lineColor: "#666666",
1014
1014
  // Brighter
1015
1015
  lineWidth: 1,
@@ -1073,14 +1073,14 @@ const U = {
1073
1073
  minorColor: "rgba(255, 255, 255, 0.04)"
1074
1074
  },
1075
1075
  xAxis: {
1076
- ...U,
1076
+ ...H,
1077
1077
  labelColor: "#adbac7",
1078
1078
  titleColor: "#cdd9e5",
1079
1079
  lineColor: "#444c56",
1080
1080
  tickColor: "#444c56"
1081
1081
  },
1082
1082
  yAxis: {
1083
- ...U,
1083
+ ...H,
1084
1084
  labelColor: "#adbac7",
1085
1085
  titleColor: "#cdd9e5",
1086
1086
  lineColor: "#444c56",
@@ -1089,7 +1089,7 @@ const U = {
1089
1089
  legend: be,
1090
1090
  cursor: ve,
1091
1091
  toolbar: Re
1092
- }, jt = {
1092
+ }, Jt = {
1093
1093
  name: "midnight",
1094
1094
  isDark: !0,
1095
1095
  backgroundColor: "#05050a",
@@ -1101,14 +1101,14 @@ const U = {
1101
1101
  minorColor: "rgba(150, 150, 255, 0.08)"
1102
1102
  },
1103
1103
  xAxis: {
1104
- ...U,
1104
+ ...H,
1105
1105
  lineColor: "#5a5a8a",
1106
1106
  labelColor: "#b0b0e0",
1107
1107
  titleColor: "#d0d0f0",
1108
1108
  tickColor: "#5a5a8a"
1109
1109
  },
1110
1110
  yAxis: {
1111
- ...U,
1111
+ ...H,
1112
1112
  lineColor: "#5a5a8a",
1113
1113
  labelColor: "#b0b0e0",
1114
1114
  titleColor: "#d0d0f0",
@@ -1128,7 +1128,7 @@ const U = {
1128
1128
  ...ve,
1129
1129
  lineColor: "rgba(150, 150, 255, 0.7)"
1130
1130
  }
1131
- }, Qt = {
1131
+ }, Kt = {
1132
1132
  name: "light",
1133
1133
  isDark: !1,
1134
1134
  backgroundColor: "#ffffff",
@@ -1140,14 +1140,14 @@ const U = {
1140
1140
  minorColor: "rgba(0, 0, 0, 0.04)"
1141
1141
  },
1142
1142
  xAxis: {
1143
- ...U,
1143
+ ...H,
1144
1144
  lineColor: "#888888",
1145
1145
  tickColor: "#888888",
1146
1146
  labelColor: "#444444",
1147
1147
  titleColor: "#222222"
1148
1148
  },
1149
1149
  yAxis: {
1150
- ...U,
1150
+ ...H,
1151
1151
  lineColor: "#888888",
1152
1152
  tickColor: "#888888",
1153
1153
  labelColor: "#444444",
@@ -1169,7 +1169,7 @@ const U = {
1169
1169
  lineColor: "rgba(0, 0, 0, 0.4)",
1170
1170
  tooltipBackground: "rgba(50, 50, 60, 0.95)"
1171
1171
  }
1172
- }, Zt = {
1172
+ }, ei = {
1173
1173
  name: "electrochemistry",
1174
1174
  isDark: !0,
1175
1175
  backgroundColor: "#0a1628",
@@ -1183,14 +1183,14 @@ const U = {
1183
1183
  minorDivisions: 2
1184
1184
  },
1185
1185
  xAxis: {
1186
- ...U,
1186
+ ...H,
1187
1187
  lineColor: "#1e88e5",
1188
1188
  tickColor: "#42a5f5",
1189
1189
  labelColor: "#90caf9",
1190
1190
  titleColor: "#bbdefb"
1191
1191
  },
1192
1192
  yAxis: {
1193
- ...U,
1193
+ ...H,
1194
1194
  lineColor: "#1e88e5",
1195
1195
  tickColor: "#42a5f5",
1196
1196
  labelColor: "#90caf9",
@@ -1211,7 +1211,7 @@ const U = {
1211
1211
  lineColor: "rgba(100, 180, 255, 0.6)"
1212
1212
  }
1213
1213
  };
1214
- function Gn(i, e) {
1214
+ function ns(i, e) {
1215
1215
  return {
1216
1216
  ...i,
1217
1217
  ...e,
@@ -1223,35 +1223,56 @@ function Gn(i, e) {
1223
1223
  toolbar: { ...i.toolbar, ...e.toolbar }
1224
1224
  };
1225
1225
  }
1226
- function Je(i) {
1226
+ function et(i) {
1227
1227
  switch (i) {
1228
1228
  case "dark":
1229
1229
  return Te;
1230
1230
  case "midnight":
1231
- return jt;
1231
+ return Jt;
1232
1232
  case "light":
1233
- return Qt;
1233
+ return Kt;
1234
1234
  case "electrochemistry":
1235
1235
  case "electrochem":
1236
- return Zt;
1236
+ return ei;
1237
1237
  default:
1238
1238
  return console.warn(`[Theme] Unknown theme "${i}", using dark`), Te;
1239
1239
  }
1240
1240
  }
1241
- const Jt = Te;
1241
+ const ti = Te;
1242
1242
  function Y(i) {
1243
1243
  return Math.floor(i) + 0.5;
1244
1244
  }
1245
- function me(i) {
1245
+ function he(i) {
1246
1246
  return Math.round(i);
1247
1247
  }
1248
- class Kt {
1248
+ class ii {
1249
1249
  constructor(e, t) {
1250
- p(this, "ctx");
1251
- p(this, "theme");
1252
- p(this, "latexAPI", null);
1250
+ m(this, "ctx");
1251
+ m(this, "theme");
1252
+ m(this, "latexAPI", null);
1253
+ m(this, "businessDayMapping", null);
1253
1254
  this.ctx = e, this.theme = t;
1254
1255
  }
1256
+ setBusinessDayMapping(e) {
1257
+ this.businessDayMapping = e;
1258
+ }
1259
+ /** Filter X ticks to valid business-day indices (unique integers in range). */
1260
+ filterBusinessDayXTicks(e) {
1261
+ const t = this.businessDayMapping;
1262
+ if (!t) return e;
1263
+ const n = t.timeByIndex.length - 1;
1264
+ if (n < 0) return [];
1265
+ const s = /* @__PURE__ */ new Set(), o = [];
1266
+ for (const r of e) {
1267
+ const a = Math.round(r);
1268
+ a >= 0 && a <= n && !s.has(a) && (s.add(a), o.push(a));
1269
+ }
1270
+ return o;
1271
+ }
1272
+ resolveXTicks(e, t) {
1273
+ const n = e.ticks(t);
1274
+ return this.filterBusinessDayXTicks(n);
1275
+ }
1255
1276
  /**
1256
1277
  * Set LaTeX API for rendering mathematical expressions
1257
1278
  */
@@ -1300,7 +1321,7 @@ class Kt {
1300
1321
  */
1301
1322
  drawGrid(e, t, n, s, o) {
1302
1323
  if (!this.theme.grid.visible) return;
1303
- const { ctx: r } = this, a = this.theme.grid, l = (s == null ? void 0 : s.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d = t.ticks(l), c = n.ticks(h);
1324
+ const { ctx: r } = this, a = this.theme.grid, l = (s == null ? void 0 : s.tickCount) ?? 8, h = (o == null ? void 0 : o.tickCount) ?? 6, d = this.resolveXTicks(t, l), c = n.ticks(h);
1304
1325
  if (r.strokeStyle = a.majorColor, r.lineWidth = a.majorWidth, r.setLineDash(a.majorDash), r.beginPath(), d.forEach((f) => {
1305
1326
  const u = Y(t.transform(f));
1306
1327
  u >= e.x && u <= e.x + e.width && (r.moveTo(u, e.y), r.lineTo(u, e.y + e.height));
@@ -1356,22 +1377,44 @@ class Kt {
1356
1377
  * Draw X axis with ticks and labels
1357
1378
  */
1358
1379
  drawXAxis(e, t, n, s) {
1359
- const { ctx: o } = this, r = this.theme.xAxis, a = (n == null ? void 0 : n.tickCount) ?? 8, l = t.ticks(a), h = Y(e.y + e.height), d = n == null ? void 0 : n.label, c = (n == null ? void 0 : n.showLine) !== !1, f = (n == null ? void 0 : n.showTicks) !== !1, u = (n == null ? void 0 : n.showLabels) !== !1, g = t.domain[1] - t.domain[0];
1360
- 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()), (f || u) && (o.fillStyle = r.labelColor, o.font = `${r.labelSize}px ${r.fontFamily}`, o.textAlign = "center", o.textBaseline = "top", l.forEach((y) => {
1361
- const m = me(t.transform(y));
1362
- m >= e.x && m <= e.x + e.width && (f && (o.strokeStyle = r.tickColor, o.beginPath(), o.moveTo(m, h), o.lineTo(m, h + r.tickLength), o.stroke()), u && this.drawLatexOrText(
1363
- this.formatXTick(y, n, g),
1364
- m,
1365
- h + r.tickLength + 3,
1366
- {
1367
- fontSize: r.labelSize,
1368
- fontFamily: r.fontFamily,
1369
- color: r.labelColor,
1370
- align: "center",
1371
- baseline: "top"
1380
+ const { ctx: o } = this, r = this.theme.xAxis, a = (n == null ? void 0 : n.tickCount) ?? 8, l = this.resolveXTicks(t, a), h = Y(e.y + e.height), d = n == null ? void 0 : n.label, c = (n == null ? void 0 : n.showLine) !== !1, f = (n == null ? void 0 : n.showTicks) !== !1, u = (n == null ? void 0 : n.showLabels) !== !1, g = t.domain[1] - t.domain[0];
1381
+ 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()), f || u) {
1382
+ o.fillStyle = r.labelColor, o.font = `${r.labelSize}px ${r.fontFamily}`;
1383
+ const y = [];
1384
+ for (const p of l) {
1385
+ const v = he(t.transform(p));
1386
+ if (v >= e.x && v <= e.x + e.width) {
1387
+ const S = u ? this.formatXTick(p, n, g) : "";
1388
+ (!u || S) && y.push({ tick: p, x: v, label: S });
1372
1389
  }
1373
- ));
1374
- })), d) {
1390
+ }
1391
+ let x = !1;
1392
+ if (u && y.length > 1) {
1393
+ let p = 0;
1394
+ for (const S of y)
1395
+ p = Math.max(p, o.measureText(S.label).width);
1396
+ let v = 1 / 0;
1397
+ for (let S = 1; S < y.length; S++)
1398
+ v = Math.min(v, y[S].x - y[S - 1].x);
1399
+ x = p + 8 > v;
1400
+ }
1401
+ const b = h + r.tickLength + (x ? 6 : 3), w = x ? -Math.PI / 4 : void 0;
1402
+ for (const p of y)
1403
+ f && (o.strokeStyle = r.tickColor, o.beginPath(), o.moveTo(p.x, h), o.lineTo(p.x, h + r.tickLength), o.stroke()), u && p.label && this.drawLatexOrText(
1404
+ p.label,
1405
+ p.x,
1406
+ b,
1407
+ {
1408
+ fontSize: r.labelSize,
1409
+ fontFamily: r.fontFamily,
1410
+ color: r.labelColor,
1411
+ align: x ? "right" : "center",
1412
+ baseline: x ? "middle" : "top",
1413
+ rotation: w
1414
+ }
1415
+ );
1416
+ }
1417
+ if (d) {
1375
1418
  const y = (s == null ? void 0 : s.titleGap) ?? 45;
1376
1419
  this.drawLatexOrText(d, e.x + e.width / 2, e.y + e.height + y, {
1377
1420
  fontSize: r.titleSize,
@@ -1386,12 +1429,12 @@ class Kt {
1386
1429
  * Draw Y axis with ticks and labels
1387
1430
  */
1388
1431
  drawYAxis(e, t, n, s = "left", o = 0, r) {
1389
- const { ctx: a } = this, l = this.theme.yAxis, h = (n == null ? void 0 : n.tickCount) ?? 6, d = t.ticks(h), c = n == null ? void 0 : n.label, f = (n == null ? void 0 : n.showLine) !== !1, u = (n == null ? void 0 : n.showTicks) !== !1, g = (n == null ? void 0 : n.showLabels) !== !1, y = Y(s === "left" ? e.x - o : e.x + e.width + o), m = s === "left" ? -1 : 1;
1432
+ const { ctx: a } = this, l = this.theme.yAxis, h = (n == null ? void 0 : n.tickCount) ?? 6, d = t.ticks(h), c = n == null ? void 0 : n.label, f = (n == null ? void 0 : n.showLine) !== !1, u = (n == null ? void 0 : n.showTicks) !== !1, g = (n == null ? void 0 : n.showLabels) !== !1, y = Y(s === "left" ? e.x - o : e.x + e.width + o), x = s === "left" ? -1 : 1;
1390
1433
  if (f && (a.strokeStyle = l.lineColor, a.lineWidth = l.lineWidth, a.beginPath(), a.moveTo(y, e.y), a.lineTo(y, e.y + e.height), a.stroke()), (u || g) && (a.fillStyle = l.labelColor, a.font = `${l.labelSize}px ${l.fontFamily}`, a.textAlign = s === "left" ? "right" : "left", a.textBaseline = "middle", d.forEach((b) => {
1391
- const v = me(t.transform(b));
1392
- if (v >= e.y && v <= e.y + e.height && (u && (a.strokeStyle = l.tickColor, a.beginPath(), a.moveTo(y, v), a.lineTo(y + l.tickLength * m, v), a.stroke()), g)) {
1393
- const x = y + (l.tickLength + 3) * m;
1394
- this.drawLatexOrText(this.formatYTick(b, n), x, v, {
1434
+ const w = he(t.transform(b));
1435
+ if (w >= e.y && w <= e.y + e.height && (u && (a.strokeStyle = l.tickColor, a.beginPath(), a.moveTo(y, w), a.lineTo(y + l.tickLength * x, w), a.stroke()), g)) {
1436
+ const p = y + (l.tickLength + 3) * x;
1437
+ this.drawLatexOrText(this.formatYTick(b, n), p, w, {
1395
1438
  fontSize: l.labelSize,
1396
1439
  fontFamily: l.fontFamily,
1397
1440
  color: l.labelColor,
@@ -1400,8 +1443,8 @@ class Kt {
1400
1443
  });
1401
1444
  }
1402
1445
  })), c) {
1403
- const b = (r == null ? void 0 : r.titleGap) ?? 50, v = s === "left" ? y - b : y + b, x = e.y + e.height / 2;
1404
- this.drawLatexOrText(c, v, x, {
1446
+ const b = (r == null ? void 0 : r.titleGap) ?? 50, w = s === "left" ? y - b : y + b, p = e.y + e.height / 2;
1447
+ this.drawLatexOrText(c, w, p, {
1405
1448
  fontSize: l.titleSize,
1406
1449
  fontFamily: l.fontFamily,
1407
1450
  color: l.titleColor,
@@ -1448,8 +1491,8 @@ class Kt {
1448
1491
  let o = 0;
1449
1492
  const r = t.map((f) => {
1450
1493
  const u = f.getId(), g = f.getStyle(), y = this.latexAPI && (u.includes("\\") || u.includes("^") || u.includes("_"));
1451
- let m = 0;
1452
- return y ? m = this.latexAPI.measure(u, { fontSize: s.fontSize }).width : m = n.measureText(u).width, o = Math.max(o, m), {
1494
+ let x = 0;
1495
+ return y ? x = this.latexAPI.measure(u, { fontSize: s.fontSize }).width : x = n.measureText(u).width, o = Math.max(o, x), {
1453
1496
  id: f.getId(),
1454
1497
  color: g.color ?? "#ff0055",
1455
1498
  label: u,
@@ -1477,10 +1520,10 @@ class Kt {
1477
1520
  n.fillStyle = s.backgroundColor, n.strokeStyle = s.borderColor, n.lineWidth = 1, n.beginPath();
1478
1521
  const c = s.borderRadius;
1479
1522
  n.moveTo(h + c, d), n.lineTo(h + a - c, d), n.arcTo(h + a, d, h + a, d + c, c), n.lineTo(h + a, d + l - c), n.arcTo(h + a, d + l, h + a - c, d + l, c), n.lineTo(h + c, d + l), n.arcTo(h, d + l, h, d + l - c, c), n.lineTo(h, d + c), n.arcTo(h, d, h + c, d, c), n.closePath(), n.fill(), n.stroke(), n.textAlign = "left", n.textBaseline = "middle", r.forEach((f, u) => {
1480
- const g = d + s.padding + u * (s.swatchSize + s.itemGap), y = h + s.padding, m = g + s.swatchSize / 2, b = y + s.swatchSize / 2;
1523
+ const g = d + s.padding + u * (s.swatchSize + s.itemGap), y = h + s.padding, x = g + s.swatchSize / 2, b = y + s.swatchSize / 2;
1481
1524
  n.save(), n.globalAlpha = f.opacity, n.fillStyle = f.color, n.strokeStyle = f.color, n.lineWidth = 2;
1482
- const v = s.swatchSize, x = String(f.type).toLowerCase(), S = !!f.symbol && f.symbol !== "circle", w = x === "scatter" || x === "1" || x === "line" && S, M = x.includes("scatter") || x === "2";
1483
- w ? this.drawLegendSymbol(n, f.symbol ?? "circle", b, m, v * 0.9) : M ? (n.beginPath(), n.moveTo(y, m), n.lineTo(y + v, m), n.stroke(), this.drawLegendSymbol(n, f.symbol ?? "circle", b, m, v * 0.6)) : (n.beginPath(), n.moveTo(y, m), n.lineTo(y + v, m), n.stroke()), n.restore(), this.drawLatexOrText(f.label, h + s.padding + s.swatchSize + 8, m, {
1525
+ const w = s.swatchSize, p = String(f.type).toLowerCase(), v = !!f.symbol && f.symbol !== "circle", S = p === "scatter" || p === "1" || p === "line" && v, M = p.includes("scatter") || p === "2";
1526
+ S ? this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, w * 0.9) : M ? (n.beginPath(), n.moveTo(y, x), n.lineTo(y + w, x), n.stroke(), this.drawLegendSymbol(n, f.symbol ?? "circle", b, x, w * 0.6)) : (n.beginPath(), n.moveTo(y, x), n.lineTo(y + w, x), n.stroke()), n.restore(), this.drawLatexOrText(f.label, h + s.padding + s.swatchSize + 8, x, {
1484
1527
  fontSize: s.fontSize,
1485
1528
  fontFamily: s.fontFamily,
1486
1529
  color: s.textColor,
@@ -1554,29 +1597,29 @@ class Kt {
1554
1597
  let d = 0;
1555
1598
  const c = [];
1556
1599
  let f = 0;
1557
- a.forEach((x) => {
1558
- if (!!this.latexAPI && (x.includes("\\") || x.includes("^") || x.includes("_") || x.includes("{") && x.includes("}"))) {
1559
- const w = this.latexAPI.measure(x, { fontSize: r.tooltipSize });
1560
- d = Math.max(d, w.width);
1561
- const M = Math.max(l, w.height);
1600
+ a.forEach((p) => {
1601
+ if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
1602
+ const S = this.latexAPI.measure(p, { fontSize: r.tooltipSize });
1603
+ d = Math.max(d, S.width);
1604
+ const M = Math.max(l, S.height);
1562
1605
  c.push(M), f += M;
1563
1606
  } else
1564
- d = Math.max(d, o.measureText(x).width), c.push(l), f += l;
1607
+ d = Math.max(d, o.measureText(p).width), c.push(l), f += l;
1565
1608
  });
1566
1609
  const u = d + h * 2, g = f + h * 2 - 4;
1567
- let y = e + 15, m = t - g - 10;
1568
- y + u > s.x + s.width && (y = e - u - 15), m < s.y && (m = t + 15), o.fillStyle = r.tooltipBackground, o.strokeStyle = r.tooltipBorder, o.lineWidth = 1, o.beginPath();
1610
+ let y = e + 15, x = t - g - 10;
1611
+ y + u > s.x + s.width && (y = e - u - 15), x < s.y && (x = t + 15), o.fillStyle = r.tooltipBackground, o.strokeStyle = r.tooltipBorder, o.lineWidth = 1, o.beginPath();
1569
1612
  const b = 4;
1570
- o.moveTo(y + b, m), o.lineTo(y + u - b, m), o.arcTo(y + u, m, y + u, m + b, b), o.lineTo(y + u, m + g - b), o.arcTo(y + u, m + g, y + u - b, m + g, b), o.lineTo(y + b, m + g), o.arcTo(y, m + g, y, m + g - b, b), o.lineTo(y, m + b), o.arcTo(y, m, y + b, m, b), o.closePath(), o.fill(), o.stroke();
1571
- let v = m + h;
1572
- a.forEach((x, S) => {
1573
- this.drawLatexOrText(x, y + h, v, {
1613
+ o.moveTo(y + b, x), o.lineTo(y + u - b, x), o.arcTo(y + u, x, y + u, x + b, b), o.lineTo(y + u, x + g - b), o.arcTo(y + u, x + g, y + u - b, x + g, b), o.lineTo(y + b, x + g), o.arcTo(y, x + g, y, x + g - b, b), o.lineTo(y, x + b), o.arcTo(y, x, y + b, x, b), o.closePath(), o.fill(), o.stroke();
1614
+ let w = x + h;
1615
+ a.forEach((p, v) => {
1616
+ this.drawLatexOrText(p, y + h, w, {
1574
1617
  fontSize: r.tooltipSize,
1575
1618
  fontFamily: this.theme.xAxis.fontFamily,
1576
1619
  color: r.tooltipColor,
1577
1620
  align: "left",
1578
1621
  baseline: "top"
1579
- }), v += c[S];
1622
+ }), w += c[v];
1580
1623
  });
1581
1624
  }
1582
1625
  /**
@@ -1588,43 +1631,43 @@ class Kt {
1588
1631
  let d = 0;
1589
1632
  const c = [];
1590
1633
  let f = 0;
1591
- r.forEach((x) => {
1592
- if (!!this.latexAPI && (x.includes("\\") || x.includes("^") || x.includes("_") || x.includes("{") && x.includes("}"))) {
1593
- const w = this.latexAPI.measure(x, { fontSize: o.tooltipSize });
1594
- d = Math.max(d, w.width);
1595
- const M = Math.max(a, w.height);
1634
+ r.forEach((p) => {
1635
+ if (!!this.latexAPI && (p.includes("\\") || p.includes("^") || p.includes("_") || p.includes("{") && p.includes("}"))) {
1636
+ const S = this.latexAPI.measure(p, { fontSize: o.tooltipSize });
1637
+ d = Math.max(d, S.width);
1638
+ const M = Math.max(a, S.height);
1596
1639
  c.push(M), f += M;
1597
1640
  } else
1598
- d = Math.max(d, s.measureText(x).width), c.push(a), f += a;
1641
+ d = Math.max(d, s.measureText(p).width), c.push(a), f += a;
1599
1642
  });
1600
1643
  const u = d + l * 2, g = f + l * 2 - 4;
1601
- let y, m;
1644
+ let y, x;
1602
1645
  switch (n) {
1603
1646
  case "top-left":
1604
- y = t.x + h, m = t.y + h;
1647
+ y = t.x + h, x = t.y + h;
1605
1648
  break;
1606
1649
  case "top-right":
1607
- y = t.x + t.width - u - h, m = t.y + h;
1650
+ y = t.x + t.width - u - h, x = t.y + h;
1608
1651
  break;
1609
1652
  case "bottom-left":
1610
- y = t.x + h, m = t.y + t.height - g - h;
1653
+ y = t.x + h, x = t.y + t.height - g - h;
1611
1654
  break;
1612
1655
  case "bottom-right":
1613
- y = t.x + t.width - u - h, m = t.y + t.height - g - h;
1656
+ y = t.x + t.width - u - h, x = t.y + t.height - g - h;
1614
1657
  break;
1615
1658
  }
1616
1659
  s.fillStyle = o.tooltipBackground, s.strokeStyle = o.tooltipBorder, s.lineWidth = 1, s.beginPath();
1617
1660
  const b = 4;
1618
- s.moveTo(y + b, m), s.lineTo(y + u - b, m), s.arcTo(y + u, m, y + u, m + b, b), s.lineTo(y + u, m + g - b), s.arcTo(y + u, m + g, y + u - b, m + g, b), s.lineTo(y + b, m + g), s.arcTo(y, m + g, y, m + g - b, b), s.lineTo(y, m + b), s.arcTo(y, m, y + b, m, b), s.closePath(), s.fill(), s.stroke();
1619
- let v = m + l;
1620
- r.forEach((x, S) => {
1621
- this.drawLatexOrText(x, y + l, v, {
1661
+ s.moveTo(y + b, x), s.lineTo(y + u - b, x), s.arcTo(y + u, x, y + u, x + b, b), s.lineTo(y + u, x + g - b), s.arcTo(y + u, x + g, y + u - b, x + g, b), s.lineTo(y + b, x + g), s.arcTo(y, x + g, y, x + g - b, b), s.lineTo(y, x + b), s.arcTo(y, x, y + b, x, b), s.closePath(), s.fill(), s.stroke();
1662
+ let w = x + l;
1663
+ r.forEach((p, v) => {
1664
+ this.drawLatexOrText(p, y + l, w, {
1622
1665
  fontSize: o.tooltipSize,
1623
1666
  fontFamily: this.theme.xAxis.fontFamily,
1624
1667
  color: o.tooltipColor,
1625
1668
  align: "left",
1626
1669
  baseline: "top"
1627
- }), v += c[S];
1670
+ }), w += c[v];
1628
1671
  });
1629
1672
  }
1630
1673
  /**
@@ -1644,17 +1687,17 @@ class Kt {
1644
1687
  const h = l.color ?? a.color ?? "#ff0055", d = l.width ?? 1, c = l.capWidth ?? 6, f = l.showCaps !== !1, u = l.opacity ?? 0.7, g = l.direction ?? "both";
1645
1688
  o.save(), o.beginPath(), o.rect(e.x, e.y, e.width, e.height), o.clip(), o.strokeStyle = h, o.lineWidth = d, o.globalAlpha = u;
1646
1689
  for (let y = 0; y < r.x.length; y++) {
1647
- const m = n.transform(r.x[y]), b = s.transform(r.y[y]);
1648
- if (m < e.x || m > e.x + e.width || b < e.y || b > e.y + e.height) continue;
1649
- const v = t.getYError(y);
1650
- if (v) {
1651
- const [S, w] = v, M = r.y[y], A = s.transform(M + w), k = s.transform(M - S);
1652
- o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(m, b), o.lineTo(m, A), f && (o.moveTo(m - c / 2, A), o.lineTo(m + c / 2, A))), (g === "both" || g === "negative") && (o.moveTo(m, b), o.lineTo(m, k), f && (o.moveTo(m - c / 2, k), o.lineTo(m + c / 2, k))), o.stroke();
1690
+ const x = n.transform(r.x[y]), b = s.transform(r.y[y]);
1691
+ if (x < e.x || x > e.x + e.width || b < e.y || b > e.y + e.height) continue;
1692
+ const w = t.getYError(y);
1693
+ if (w) {
1694
+ const [v, S] = w, M = r.y[y], A = s.transform(M + S), k = s.transform(M - v);
1695
+ o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(x, A), f && (o.moveTo(x - c / 2, A), o.lineTo(x + c / 2, A))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(x, k), f && (o.moveTo(x - c / 2, k), o.lineTo(x + c / 2, k))), o.stroke();
1653
1696
  }
1654
- const x = t.getXError(y);
1655
- if (x) {
1656
- const [S, w] = x, M = r.x[y], A = n.transform(M + w), k = n.transform(M - S);
1657
- o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(m, b), o.lineTo(A, b), f && (o.moveTo(A, b - c / 2), o.lineTo(A, b + c / 2))), (g === "both" || g === "negative") && (o.moveTo(m, b), o.lineTo(k, b), f && (o.moveTo(k, b - c / 2), o.lineTo(k, b + c / 2))), o.stroke();
1697
+ const p = t.getXError(y);
1698
+ if (p) {
1699
+ const [v, S] = p, M = r.x[y], A = n.transform(M + S), k = n.transform(M - v);
1700
+ o.beginPath(), (g === "both" || g === "positive") && (o.moveTo(x, b), o.lineTo(A, b), f && (o.moveTo(A, b - c / 2), o.lineTo(A, b + c / 2))), (g === "both" || g === "negative") && (o.moveTo(x, b), o.lineTo(k, b), f && (o.moveTo(k, b - c / 2), o.lineTo(k, b + c / 2))), o.stroke();
1658
1701
  }
1659
1702
  }
1660
1703
  o.restore();
@@ -1673,7 +1716,7 @@ class Kt {
1673
1716
  return n;
1674
1717
  }
1675
1718
  formatXTick(e, t, n) {
1676
- return qe(e, t, n);
1719
+ return qe(e, t, n, this.businessDayMapping);
1677
1720
  }
1678
1721
  formatYTick(e, t) {
1679
1722
  return Ge(e, t);
@@ -1686,40 +1729,52 @@ class Kt {
1686
1729
  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;
1687
1730
  for (const u of o) {
1688
1731
  const g = (() => {
1689
- let w = 0, M = Math.abs(l[0] - u.time);
1732
+ let S = 0, M = Math.abs(l[0] - u.time);
1690
1733
  for (let A = 1; A < l.length; A++) {
1691
1734
  const k = Math.abs(l[A] - u.time);
1692
- k < M && (M = k, w = A);
1735
+ k < M && (M = k, S = A);
1693
1736
  }
1694
- return w;
1695
- })(), y = u.position ?? "aboveBar", m = y === "belowBar" ? d[g] : y === "inBar" ? c[g] : h[g], b = e.x + n.transform(l[g]), v = e.y + s.transform(m), x = u.color ?? "#22c55e", S = y === "belowBar" ? 10 : -10;
1696
- a.save(), a.fillStyle = x, a.strokeStyle = x, a.lineWidth = 1.5, u.shape === "arrowDown" ? (a.beginPath(), a.moveTo(b, v - S), a.lineTo(b - 5, v - S - 8), a.lineTo(b + 5, v - S - 8), a.closePath(), a.fill()) : u.shape === "circle" ? (a.beginPath(), a.arc(b, v + S, 4, 0, Math.PI * 2), a.fill()) : (a.beginPath(), a.moveTo(b, v + S), a.lineTo(b - 5, v + S + 8), a.lineTo(b + 5, v + S + 8), a.closePath(), a.fill()), u.text && (a.font = "10px sans-serif", a.textAlign = "center", a.fillText(u.text, b, v + S + (y === "belowBar" ? 20 : -14))), a.restore();
1737
+ return S;
1738
+ })(), y = u.position ?? "aboveBar", x = y === "belowBar" ? d[g] : y === "inBar" ? c[g] : h[g], b = e.x + n.transform(l[g]), w = e.y + s.transform(x), p = u.color ?? "#22c55e", v = y === "belowBar" ? 10 : -10;
1739
+ a.save(), a.fillStyle = p, a.strokeStyle = p, a.lineWidth = 1.5, u.shape === "arrowDown" ? (a.beginPath(), a.moveTo(b, w - v), a.lineTo(b - 5, w - v - 8), a.lineTo(b + 5, w - v - 8), a.closePath(), a.fill()) : u.shape === "circle" ? (a.beginPath(), a.arc(b, w + v, 4, 0, Math.PI * 2), a.fill()) : (a.beginPath(), a.moveTo(b, w + v), a.lineTo(b - 5, w + v + 8), a.lineTo(b + 5, w + v + 8), a.closePath(), a.fill()), u.text && (a.font = "10px sans-serif", a.textAlign = "center", a.fillText(u.text, b, w + v + (y === "belowBar" ? 20 : -14))), a.restore();
1740
+ }
1741
+ }
1742
+ /** Horizontal dashed lines for active price alerts (Stage 2.19). */
1743
+ drawPriceAlertLines(e, t, n) {
1744
+ if (!t.length) return;
1745
+ const { ctx: s } = this;
1746
+ s.save();
1747
+ for (const o of t) {
1748
+ const r = he(n.transform(o.price));
1749
+ r < e.y || r > e.y + e.height || (s.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)", s.lineWidth = 1, s.setLineDash([5, 4]), s.beginPath(), s.moveTo(e.x, r), s.lineTo(e.x + e.width, r), s.stroke());
1697
1750
  }
1751
+ s.setLineDash([]), s.restore();
1698
1752
  }
1699
1753
  }
1700
- class ei {
1754
+ class ni {
1701
1755
  constructor(e, t, n, s, o) {
1702
- p(this, "container");
1703
- p(this, "callbacks");
1704
- p(this, "getPlotArea");
1705
- p(this, "getBounds");
1706
- p(this, "getAxesLayout");
1707
- p(this, "isDragging", !1);
1708
- p(this, "panningAxisId");
1709
- p(this, "isBoxSelecting", !1);
1710
- p(this, "isBoxZooming", !1);
1711
- p(this, "selectionStart", { x: 0, y: 0 });
1712
- p(this, "lastMousePos", { x: 0, y: 0 });
1713
- p(this, "mode", "pan");
1756
+ m(this, "container");
1757
+ m(this, "callbacks");
1758
+ m(this, "getPlotArea");
1759
+ m(this, "getBounds");
1760
+ m(this, "getAxesLayout");
1761
+ m(this, "isDragging", !1);
1762
+ m(this, "panningAxisId");
1763
+ m(this, "isBoxSelecting", !1);
1764
+ m(this, "isBoxZooming", !1);
1765
+ m(this, "selectionStart", { x: 0, y: 0 });
1766
+ m(this, "lastMousePos", { x: 0, y: 0 });
1767
+ m(this, "mouseDownPos", { x: 0, y: 0 });
1768
+ m(this, "mode", "pan");
1714
1769
  // Bound handlers for cleanup
1715
- p(this, "boundWheel");
1716
- p(this, "boundMouseDown");
1717
- p(this, "boundMouseMove");
1718
- p(this, "boundMouseUp");
1719
- p(this, "boundMouseLeave");
1720
- p(this, "boundTouchStart");
1721
- p(this, "boundTouchMove");
1722
- p(this, "boundTouchEnd");
1770
+ m(this, "boundWheel");
1771
+ m(this, "boundMouseDown");
1772
+ m(this, "boundMouseMove");
1773
+ m(this, "boundMouseUp");
1774
+ m(this, "boundMouseLeave");
1775
+ m(this, "boundTouchStart");
1776
+ m(this, "boundTouchMove");
1777
+ m(this, "boundTouchEnd");
1723
1778
  this.container = e, this.callbacks = t, this.getPlotArea = n, this.getBounds = s, this.getAxesLayout = o, this.boundWheel = this.handleWheel.bind(this), this.boundMouseDown = this.handleMouseDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseUp = this.handleMouseUp.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.attachListeners();
1724
1779
  }
1725
1780
  attachListeners() {
@@ -1772,23 +1827,25 @@ class ei {
1772
1827
  a = !0, l = !0;
1773
1828
  else
1774
1829
  return;
1775
- const d = this.getBounds(h), c = e.deltaY > 0 ? 1.1 : 0.9, f = (s - t.x) / t.width, u = 1 - (o - t.y) / t.height, g = d.xMin + f * (d.xMax - d.xMin), y = d.yMin + u * (d.yMax - d.yMin), m = 1e-12, b = 1e15;
1776
- let v = a ? g - (g - d.xMin) * c : d.xMin, x = a ? g + (d.xMax - g) * c : d.xMax, S = l ? y - (y - d.yMin) * c : d.yMin, w = l ? y + (d.yMax - y) * c : d.yMax;
1777
- const M = x - v, A = w - S;
1778
- (M < m || M > b) && (v = d.xMin, x = d.xMax), (A < m || A > b) && (S = d.yMin, w = d.yMax);
1830
+ const d = this.getBounds(h), c = e.deltaY > 0 ? 1.1 : 0.9, f = (s - t.x) / t.width, u = 1 - (o - t.y) / t.height, g = d.xMin + f * (d.xMax - d.xMin), y = d.yMin + u * (d.yMax - d.yMin), x = 1e-12, b = 1e15;
1831
+ let w = a ? g - (g - d.xMin) * c : d.xMin, p = a ? g + (d.xMax - g) * c : d.xMax, v = l ? y - (y - d.yMin) * c : d.yMin, S = l ? y + (d.yMax - y) * c : d.yMax;
1832
+ const M = p - w, A = S - v;
1833
+ (M < x || M > b) && (w = d.xMin, p = d.xMax), (A < x || A > b) && (v = d.yMin, S = d.yMax);
1779
1834
  const k = {
1780
- xMin: v,
1781
- xMax: x,
1782
- yMin: S,
1783
- yMax: w
1835
+ xMin: w,
1836
+ xMax: p,
1837
+ yMin: v,
1838
+ yMax: S
1784
1839
  };
1785
1840
  this.callbacks.onZoom(k, h);
1786
1841
  }
1787
1842
  handleMouseDown(e) {
1788
- var l, h, d, c, f, u, g, y, m, b;
1843
+ var l, h, d, c, f, u, g, y, x, b;
1789
1844
  const t = this.getPlotArea();
1790
1845
  if (t.width <= 1 || t.height <= 1) return;
1791
- const n = this.container.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top, r = s >= t.x && s <= t.x + t.width && o >= t.y && o <= t.y + t.height;
1846
+ const n = this.container.getBoundingClientRect(), s = e.clientX - n.left, o = e.clientY - n.top;
1847
+ this.mouseDownPos = { x: s, y: o };
1848
+ const r = s >= t.x && s <= t.x + t.width && o >= t.y && o <= t.y + t.height;
1792
1849
  if ((h = (l = this.callbacks).onInteraction) == null || h.call(l, {
1793
1850
  type: "mousedown",
1794
1851
  pixelX: s,
@@ -1799,10 +1856,10 @@ class ei {
1799
1856
  defaultPrevented: e.defaultPrevented
1800
1857
  }), e.defaultPrevented) return;
1801
1858
  const a = this.getAxesLayout();
1802
- for (const v of a) {
1803
- let S;
1804
- if (v.position === "left" ? S = t.x - 65 - v.offset : S = t.x + t.width + v.offset, s >= S && s <= S + 65 && o >= t.y && o <= t.y + t.height) {
1805
- 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);
1859
+ for (const w of a) {
1860
+ let v;
1861
+ if (w.position === "left" ? v = t.x - 65 - w.offset : v = t.x + t.width + w.offset, s >= v && s <= v + 65 && o >= t.y && o <= t.y + t.height) {
1862
+ this.isDragging = !0, this.panningAxisId = w.id, this.lastMousePos = { x: e.clientX, y: e.clientY }, this.container.style.cursor = "ns-resize", (c = (d = this.callbacks).onDragStart) == null || c.call(d);
1806
1863
  return;
1807
1864
  }
1808
1865
  }
@@ -1815,7 +1872,7 @@ class ei {
1815
1872
  this.isBoxZooming = !0, this.selectionStart = { x: s, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxZoom({ x: s, y: o, width: 0, height: 0 }), (y = (g = this.callbacks).onDragStart) == null || y.call(g);
1816
1873
  break;
1817
1874
  case "select":
1818
- this.isBoxSelecting = !0, this.selectionStart = { x: s, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxSelectStart && this.callbacks.onBoxSelectStart(s, o), (b = (m = this.callbacks).onDragStart) == null || b.call(m);
1875
+ this.isBoxSelecting = !0, this.selectionStart = { x: s, y: o }, this.container.style.cursor = "crosshair", this.callbacks.onBoxSelectStart && this.callbacks.onBoxSelectStart(s, o), (b = (x = this.callbacks).onDragStart) == null || b.call(x);
1819
1876
  break;
1820
1877
  case "delta":
1821
1878
  case "peak":
@@ -1845,9 +1902,9 @@ class ei {
1845
1902
  } else this.isBoxSelecting && this.callbacks.onBoxSelectUpdate && this.callbacks.onBoxSelectUpdate(n, s);
1846
1903
  }
1847
1904
  handleMouseUp(e) {
1848
- var r, a, l, h;
1905
+ var h, d, c, f, u, g;
1849
1906
  const t = this.container.getBoundingClientRect(), n = e.clientX - t.left, s = e.clientY - t.top;
1850
- if ((a = (r = this.callbacks).onInteraction) == null || a.call(r, {
1907
+ if ((d = (h = this.callbacks).onInteraction) == null || d.call(h, {
1851
1908
  type: "mouseup",
1852
1909
  pixelX: n,
1853
1910
  pixelY: s,
@@ -1861,14 +1918,17 @@ class ei {
1861
1918
  return;
1862
1919
  }
1863
1920
  if (this.isBoxZooming) {
1864
- const d = Math.min(this.selectionStart.x, n), c = Math.min(this.selectionStart.y, s), f = Math.abs(n - this.selectionStart.x), u = Math.abs(s - this.selectionStart.y);
1865
- f > 5 && u > 5 && this.callbacks.onBoxZoom({ x: d, y: c, width: f, height: u }), this.callbacks.onBoxZoom(null);
1921
+ const y = Math.min(this.selectionStart.x, n), x = Math.min(this.selectionStart.y, s), b = Math.abs(n - this.selectionStart.x), w = Math.abs(s - this.selectionStart.y);
1922
+ b > 5 && w > 5 && this.callbacks.onBoxZoom({ x: y, y: x, width: b, height: w }), this.callbacks.onBoxZoom(null);
1866
1923
  } else if (this.isBoxSelecting) {
1867
- const d = Math.min(this.selectionStart.x, n), c = Math.min(this.selectionStart.y, s), f = Math.abs(n - this.selectionStart.x), u = Math.abs(s - this.selectionStart.y);
1868
- this.callbacks.onBoxSelect && this.callbacks.onBoxSelect({ x: d, y: c, width: f, height: u }, e.shiftKey);
1924
+ const y = Math.min(this.selectionStart.x, n), x = Math.min(this.selectionStart.y, s), b = Math.abs(n - this.selectionStart.x), w = Math.abs(s - this.selectionStart.y);
1925
+ this.callbacks.onBoxSelect && this.callbacks.onBoxSelect({ x: y, y: x, width: b, height: w }, e.shiftKey);
1869
1926
  }
1870
- const o = this.isDragging || this.isBoxSelecting || this.isBoxZooming;
1871
- this.isDragging = !1, this.panningAxisId = void 0, this.isBoxSelecting = !1, this.isBoxZooming = !1, this.container.style.cursor = "", o && ((h = (l = this.callbacks).onDragEnd) == null || h.call(l));
1927
+ const o = this.isDragging || this.isBoxSelecting || this.isBoxZooming, r = Math.hypot(
1928
+ n - this.mouseDownPos.x,
1929
+ s - this.mouseDownPos.y
1930
+ ), a = this.getPlotArea(), l = n >= a.x && n <= a.x + a.width && s >= a.y && s <= a.y + a.height;
1931
+ r < 4 && l && !this.isBoxZooming && ((f = (c = this.callbacks).onPointClick) == null || f.call(c, n, s, e.ctrlKey, e.shiftKey)), this.isDragging = !1, this.panningAxisId = void 0, this.isBoxSelecting = !1, this.isBoxZooming = !1, this.container.style.cursor = "", o && ((g = (u = this.callbacks).onDragEnd) == null || g.call(u));
1872
1932
  }
1873
1933
  handleMouseLeave() {
1874
1934
  this.isDragging = !1, this.panningAxisId = void 0, this.container.style.cursor = "", this.callbacks.onCursorLeave();
@@ -1898,7 +1958,7 @@ class ei {
1898
1958
  this.detachListeners();
1899
1959
  }
1900
1960
  }
1901
- const ti = {
1961
+ const si = {
1902
1962
  enabled: !0,
1903
1963
  hitRadius: 20,
1904
1964
  multiSelect: !0,
@@ -1909,16 +1969,16 @@ const ti = {
1909
1969
  ringWidth: 3
1910
1970
  }
1911
1971
  };
1912
- class ii {
1972
+ class oi {
1913
1973
  constructor(e, t) {
1914
- p(this, "ctx");
1915
- p(this, "config");
1916
- p(this, "selected", /* @__PURE__ */ new Map());
1974
+ m(this, "ctx");
1975
+ m(this, "config");
1976
+ m(this, "selected", /* @__PURE__ */ new Map());
1917
1977
  // seriesId -> Set of indices
1918
- p(this, "isBoxSelecting", !1);
1919
- p(this, "boxStart", null);
1920
- p(this, "boxEnd", null);
1921
- this.ctx = e, this.config = { ...ti, ...t };
1978
+ m(this, "isBoxSelecting", !1);
1979
+ m(this, "boxStart", null);
1980
+ m(this, "boxEnd", null);
1981
+ this.ctx = e, this.config = { ...si, ...t };
1922
1982
  }
1923
1983
  // ============================================
1924
1984
  // Configuration
@@ -1952,11 +2012,11 @@ class ii {
1952
2012
  if (!f.isVisible()) return;
1953
2013
  const g = f.getData();
1954
2014
  if (g.x.length === 0) return;
1955
- const y = f.getYAxisId() || this.ctx.getPrimaryYAxisId(), m = r.get(y);
1956
- if (!m) return;
1957
- const b = o.invert(e), v = this.findNearestIndex(g.x, b), x = 50, S = Math.max(0, v - x), w = Math.min(g.x.length, v + x);
1958
- for (let M = S; M < w; M++) {
1959
- const A = o.transform(g.x[M]), k = m.transform(g.y[M]), B = A - e, F = k - t, I = B * B + F * F;
2015
+ const y = f.getYAxisId() || this.ctx.getPrimaryYAxisId(), x = r.get(y);
2016
+ if (!x) return;
2017
+ const b = o.invert(e), w = this.findNearestIndex(g.x, b), p = 50, v = Math.max(0, w - p), S = Math.min(g.x.length, w + p);
2018
+ for (let M = v; M < S; M++) {
2019
+ const A = o.transform(g.x[M]), k = x.transform(g.y[M]), B = A - e, F = k - t, I = B * B + F * F;
1960
2020
  I < c && I <= h && (c = I, d = {
1961
2021
  seriesId: u,
1962
2022
  index: M,
@@ -2144,20 +2204,20 @@ class ii {
2144
2204
  yMax: o.invert(f)
2145
2205
  }, y = this.hitTestRegion(g);
2146
2206
  if (y.length > 0) {
2147
- const m = /* @__PURE__ */ new Map();
2148
- y.forEach((x) => {
2149
- let S = m.get(x.seriesId);
2150
- S || (S = [], m.set(x.seriesId, S)), S.push(x.index);
2207
+ const x = /* @__PURE__ */ new Map();
2208
+ y.forEach((p) => {
2209
+ let v = x.get(p.seriesId);
2210
+ v || (v = [], x.set(p.seriesId, v)), v.push(p.index);
2151
2211
  });
2152
- const b = Array.from(m.entries()).map(([x, S]) => ({
2153
- seriesId: x,
2154
- indices: S
2212
+ const b = Array.from(x.entries()).map(([p, v]) => ({
2213
+ seriesId: p,
2214
+ indices: v
2155
2215
  }));
2156
2216
  this.selectPoints(b, e ? "add" : "single");
2157
- const v = this.getSelectedPoints();
2217
+ const w = this.getSelectedPoints();
2158
2218
  this.ctx.events.emit("regionSelect", {
2159
2219
  bounds: g,
2160
- containedPoints: v
2220
+ containedPoints: w
2161
2221
  });
2162
2222
  } else e || this.clearSelection();
2163
2223
  this.cancelBoxSelection();
@@ -2202,8 +2262,8 @@ class ii {
2202
2262
  const g = d.getStyle().color || "#ff0055";
2203
2263
  l.forEach((y) => {
2204
2264
  if (y >= c.x.length) return;
2205
- const m = n.transform(c.x[y]), b = u.transform(c.y[y]);
2206
- m < t.x || m > t.x + t.width || b < t.y || b > t.y + t.height || (e.beginPath(), e.arc(m, b, r.size / 2, 0, Math.PI * 2), e.strokeStyle = r.color, e.lineWidth = r.ringWidth, e.stroke(), e.beginPath(), e.arc(m, b, r.size / 2 - r.ringWidth, 0, Math.PI * 2), e.fillStyle = g, e.fill());
2265
+ const x = n.transform(c.x[y]), b = u.transform(c.y[y]);
2266
+ 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 = g, e.fill());
2207
2267
  });
2208
2268
  });
2209
2269
  const a = this.getBoxSelectionRect();
@@ -2285,15 +2345,15 @@ const ee = {
2285
2345
  reducedMotion: "auto",
2286
2346
  resizeDebounce: 100
2287
2347
  };
2288
- class ni {
2348
+ class ri {
2289
2349
  constructor(e, t) {
2290
- p(this, "ctx");
2291
- p(this, "config");
2292
- p(this, "state");
2293
- p(this, "resizeObserver", null);
2294
- p(this, "debounceTimer", null);
2295
- p(this, "destroyed", !1);
2296
- p(this, "handleResize", () => {
2350
+ m(this, "ctx");
2351
+ m(this, "config");
2352
+ m(this, "state");
2353
+ m(this, "resizeObserver", null);
2354
+ m(this, "debounceTimer", null);
2355
+ m(this, "destroyed", !1);
2356
+ m(this, "handleResize", () => {
2297
2357
  this.destroyed || (this.debounceTimer !== null && window.clearTimeout(this.debounceTimer), this.debounceTimer = window.setTimeout(() => {
2298
2358
  this.update(), this.debounceTimer = null;
2299
2359
  }, this.config.resizeDebounce));
@@ -2466,7 +2526,7 @@ class ni {
2466
2526
  this.destroyed = !0, this.debounceTimer !== null && window.clearTimeout(this.debounceTimer), this.resizeObserver ? (this.resizeObserver.disconnect(), this.resizeObserver = null) : window.removeEventListener("resize", this.handleResize);
2467
2527
  }
2468
2528
  }
2469
- function si(i, e) {
2529
+ function ai(i, e) {
2470
2530
  const {
2471
2531
  seriesIds: t,
2472
2532
  includeHeaders: n = !0,
@@ -2492,7 +2552,7 @@ function si(i, e) {
2492
2552
  return a.join(`
2493
2553
  `);
2494
2554
  }
2495
- function oi(i, e, t) {
2555
+ function li(i, e, t) {
2496
2556
  const { seriesIds: n, precision: s = 6 } = t ?? {}, o = n ? i.filter((a) => n.includes(a.getId())) : i, r = {};
2497
2557
  return o.forEach((a) => {
2498
2558
  const l = a.getData();
@@ -2512,7 +2572,7 @@ function oi(i, e, t) {
2512
2572
  series: r
2513
2573
  }, null, 2);
2514
2574
  }
2515
- function ri(i, e, t, n, s, o, r = "png") {
2575
+ function hi(i, e, t, n, s, o, r = "png") {
2516
2576
  const a = document.createElement("canvas");
2517
2577
  a.width = e.width, a.height = e.height;
2518
2578
  const l = a.getContext("2d");
@@ -2525,11 +2585,11 @@ function ri(i, e, t, n, s, o, r = "png") {
2525
2585
  function Ye(i) {
2526
2586
  return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2527
2587
  }
2528
- function Ke(i, e) {
2588
+ function tt(i, e) {
2529
2589
  return e && i.has(e) ? i.get(e) : i.get("default") ?? i.values().next().value;
2530
2590
  }
2531
- function ai(i, e, t, n, s, o, r, a, l = {}) {
2532
- const h = Ke(s, l.primaryYAxisId);
2591
+ function ci(i, e, t, n, s, o, r, a, l = {}) {
2592
+ const h = tt(s, l.primaryYAxisId);
2533
2593
  if (!h)
2534
2594
  throw new Error("SVG export requires at least one Y scale");
2535
2595
  const d = [
@@ -2537,13 +2597,13 @@ function ai(i, e, t, n, s, o, r, a, l = {}) {
2537
2597
  `<rect width="100%" height="100%" fill="${o.backgroundColor}" />`,
2538
2598
  '<g transform="translate(0,0)">'
2539
2599
  ];
2540
- return ui(d, t, n, h, o), li(d, i, t, n, s, l.primaryYAxisId), hi(d, t, n, h, o), ci(d, t, n, h, o, l), d.push("</g>"), d.push("</svg>"), d.join(`
2600
+ return gi(d, t, n, h, o), ui(d, i, t, n, s, l.primaryYAxisId), di(d, t, n, h, o), fi(d, t, n, h, o, l), d.push("</g>"), d.push("</svg>"), d.join(`
2541
2601
  `);
2542
2602
  }
2543
- function li(i, e, t, n, s, o) {
2603
+ function ui(i, e, t, n, s, o) {
2544
2604
  for (const r of e) {
2545
2605
  if (!r.isVisible()) continue;
2546
- const a = s.get(r.getYAxisId() || o || "default") ?? Ke(s, o);
2606
+ const a = s.get(r.getYAxisId() || o || "default") ?? tt(s, o);
2547
2607
  if (!a) continue;
2548
2608
  const l = r.getData();
2549
2609
  if (!l || l.x.length === 0) continue;
@@ -2553,12 +2613,12 @@ function li(i, e, t, n, s, o) {
2553
2613
  for (let u = 0; u < l.x.length; u++) {
2554
2614
  const g = n.transform(l.x[u]), y = a.transform(l.y[u]);
2555
2615
  if (u > 0 && d === "step") {
2556
- const m = n.transform(l.x[u - 1]), b = a.transform(l.y[u - 1]);
2616
+ const x = n.transform(l.x[u - 1]), b = a.transform(l.y[u - 1]);
2557
2617
  if (f === "after") c.push(`${g.toFixed(1)},${b.toFixed(1)}`);
2558
- else if (f === "before") c.push(`${m.toFixed(1)},${y.toFixed(1)}`);
2618
+ else if (f === "before") c.push(`${x.toFixed(1)},${y.toFixed(1)}`);
2559
2619
  else if (f === "center") {
2560
- const v = (m + g) / 2;
2561
- c.push(`${v.toFixed(1)},${b.toFixed(1)}`), c.push(`${v.toFixed(1)},${y.toFixed(1)}`);
2620
+ const w = (x + g) / 2;
2621
+ c.push(`${w.toFixed(1)},${b.toFixed(1)}`), c.push(`${w.toFixed(1)},${y.toFixed(1)}`);
2562
2622
  }
2563
2623
  }
2564
2624
  c.push(`${g.toFixed(1)},${y.toFixed(1)}`);
@@ -2576,9 +2636,9 @@ function li(i, e, t, n, s, o) {
2576
2636
  else if (d === "bar") {
2577
2637
  const c = (h.barWidth || 5) * (t.width / (n.domain[1] - n.domain[0]));
2578
2638
  for (let f = 0; f < l.x.length; f++) {
2579
- const u = n.transform(l.x[f]), g = a.transform(l.y[f]), y = a.transform(0), m = Math.min(g, y), b = Math.abs(g - y);
2639
+ const u = n.transform(l.x[f]), g = a.transform(l.y[f]), y = a.transform(0), x = Math.min(g, y), b = Math.abs(g - y);
2580
2640
  i.push(
2581
- `<rect x="${(u - c / 2).toFixed(1)}" y="${m.toFixed(1)}" width="${c.toFixed(1)}" height="${b.toFixed(1)}" fill="${h.color}" fill-opacity="${h.opacity || 1}" />`
2641
+ `<rect x="${(u - c / 2).toFixed(1)}" y="${x.toFixed(1)}" width="${c.toFixed(1)}" height="${b.toFixed(1)}" fill="${h.color}" fill-opacity="${h.opacity || 1}" />`
2582
2642
  );
2583
2643
  }
2584
2644
  } else if (d === "band" || d === "area") {
@@ -2598,19 +2658,19 @@ function li(i, e, t, n, s, o) {
2598
2658
  const c = (h.barWidth || 5) * (t.width / (n.domain[1] - n.domain[0])), f = h.bullishColor || "#26a69a", u = h.bearishColor || "#ef5350";
2599
2659
  if (l.open && l.high && l.low && l.close)
2600
2660
  for (let g = 0; g < l.x.length; g++) {
2601
- const y = l.close[g] >= l.open[g], m = n.transform(l.x[g]), b = a.transform(l.open[g]), v = a.transform(l.close[g]), x = a.transform(l.high[g]), S = a.transform(l.low[g]), w = y ? f : u;
2661
+ const y = l.close[g] >= l.open[g], x = n.transform(l.x[g]), b = a.transform(l.open[g]), w = a.transform(l.close[g]), p = a.transform(l.high[g]), v = a.transform(l.low[g]), S = y ? f : u;
2602
2662
  i.push(
2603
- `<line x1="${m.toFixed(1)}" y1="${x.toFixed(1)}" x2="${m.toFixed(1)}" y2="${S.toFixed(1)}" stroke="${w}" stroke-width="1" />`
2663
+ `<line x1="${x.toFixed(1)}" y1="${p.toFixed(1)}" x2="${x.toFixed(1)}" y2="${v.toFixed(1)}" stroke="${S}" stroke-width="1" />`
2604
2664
  );
2605
- const M = Math.min(b, v), A = Math.max(1, Math.abs(b - v));
2665
+ const M = Math.min(b, w), A = Math.max(1, Math.abs(b - w));
2606
2666
  i.push(
2607
- `<rect x="${(m - c / 2).toFixed(1)}" y="${M.toFixed(1)}" width="${c.toFixed(1)}" height="${A.toFixed(1)}" fill="${w}" />`
2667
+ `<rect x="${(x - c / 2).toFixed(1)}" y="${M.toFixed(1)}" width="${c.toFixed(1)}" height="${A.toFixed(1)}" fill="${S}" />`
2608
2668
  );
2609
2669
  }
2610
2670
  }
2611
2671
  }
2612
2672
  }
2613
- function hi(i, e, t, n, s) {
2673
+ function di(i, e, t, n, s) {
2614
2674
  const o = Y(e.y + e.height), r = Y(e.x);
2615
2675
  i.push(
2616
2676
  `<line x1="${e.x}" y1="${o}" x2="${e.x + e.width}" y2="${o}" stroke="${s.xAxis.lineColor}" stroke-width="${s.xAxis.lineWidth || 2}" />`
@@ -2618,25 +2678,25 @@ function hi(i, e, t, n, s) {
2618
2678
  `<line x1="${r}" y1="${e.y}" x2="${r}" y2="${e.y + e.height}" stroke="${s.yAxis.lineColor}" stroke-width="${s.yAxis.lineWidth || 2}" />`
2619
2679
  );
2620
2680
  }
2621
- function ci(i, e, t, n, s, o) {
2681
+ function fi(i, e, t, n, s, o) {
2622
2682
  const r = o.xAxis, a = o.yAxis, l = (r == null ? void 0 : r.tickCount) ?? 8, h = (a == null ? void 0 : a.tickCount) ?? 6, d = t.domain[1] - t.domain[0], c = e.y + e.height, f = e.x, u = s.xAxis, g = s.yAxis;
2623
2683
  (r == null ? void 0 : r.showLabels) !== !1 && t.ticks(l).forEach((y) => {
2624
- const m = me(t.transform(y));
2625
- if (m < e.x || m > e.x + e.width) return;
2626
- const b = qe(y, r, d), v = c + (u.tickLength ?? 4) + u.labelSize * 0.75;
2684
+ const x = he(t.transform(y));
2685
+ if (x < e.x || x > e.x + e.width) return;
2686
+ const b = qe(y, r, d), w = c + (u.tickLength ?? 4) + u.labelSize * 0.75;
2627
2687
  i.push(
2628
- `<text x="${m.toFixed(1)}" y="${v.toFixed(1)}" fill="${u.labelColor}" font-size="${u.labelSize}" text-anchor="middle">${Ye(b)}</text>`
2688
+ `<text x="${x.toFixed(1)}" y="${w.toFixed(1)}" fill="${u.labelColor}" font-size="${u.labelSize}" text-anchor="middle">${Ye(b)}</text>`
2629
2689
  );
2630
2690
  }), (a == null ? void 0 : a.showLabels) !== !1 && n.ticks(h).forEach((y) => {
2631
- const m = me(n.transform(y));
2632
- if (m < e.y || m > e.y + e.height) return;
2633
- const b = Ge(y, a), v = f - (g.tickLength ?? 4) - 4;
2691
+ const x = he(n.transform(y));
2692
+ if (x < e.y || x > e.y + e.height) return;
2693
+ const b = Ge(y, a), w = f - (g.tickLength ?? 4) - 4;
2634
2694
  i.push(
2635
- `<text x="${v.toFixed(1)}" y="${(m + g.labelSize * 0.35).toFixed(1)}" fill="${g.labelColor}" font-size="${g.labelSize}" text-anchor="end">${Ye(b)}</text>`
2695
+ `<text x="${w.toFixed(1)}" y="${(x + g.labelSize * 0.35).toFixed(1)}" fill="${g.labelColor}" font-size="${g.labelSize}" text-anchor="end">${Ye(b)}</text>`
2636
2696
  );
2637
2697
  });
2638
2698
  }
2639
- function ui(i, e, t, n, s) {
2699
+ function gi(i, e, t, n, s) {
2640
2700
  s.grid.visible && (t.ticks(10).forEach((o) => {
2641
2701
  const r = Y(t.transform(o));
2642
2702
  r >= e.x && r <= e.x + e.width && i.push(
@@ -2649,7 +2709,7 @@ function ui(i, e, t, n, s) {
2649
2709
  );
2650
2710
  }));
2651
2711
  }
2652
- const di = /* @__PURE__ */ new Set([
2712
+ const yi = /* @__PURE__ */ new Set([
2653
2713
  "line",
2654
2714
  "band",
2655
2715
  "scatter",
@@ -2660,9 +2720,9 @@ const di = /* @__PURE__ */ new Set([
2660
2720
  ]);
2661
2721
  function pe(i) {
2662
2722
  const e = Array.from(i).filter((n) => n.isVisible());
2663
- return e.some((n) => n.getType() === "bar") ? !e.some((n) => di.has(n.getType())) : !1;
2723
+ return e.some((n) => n.getType() === "bar") ? !e.some((n) => yi.has(n.getType())) : !1;
2664
2724
  }
2665
- function fi(i, e) {
2725
+ function mi(i, e) {
2666
2726
  e.x && (i.viewBounds.xMin = e.x[0], i.viewBounds.xMax = e.x[1]);
2667
2727
  const t = pe(i.series.values()), n = e.y ? [...e.y] : null;
2668
2728
  if (n && t && (n[0] = 0), n)
@@ -2682,7 +2742,7 @@ function fi(i, e) {
2682
2742
  y: [i.viewBounds.yMin, i.viewBounds.yMax]
2683
2743
  }), i.requestRender();
2684
2744
  }
2685
- function gi(i, e, t, n) {
2745
+ function pi(i, e, t, n) {
2686
2746
  const s = i.getPlotArea(), o = e / s.width * (i.viewBounds.xMax - i.viewBounds.xMin);
2687
2747
  if (i.viewBounds.xMin -= o, i.viewBounds.xMax -= o, n) {
2688
2748
  const a = i.yScales.get(n);
@@ -2702,7 +2762,7 @@ function gi(i, e, t, n) {
2702
2762
  const r = t / s.height * (i.viewBounds.yMax - i.viewBounds.yMin);
2703
2763
  i.events.emit("pan", { deltaX: o, deltaY: r }), i.requestRender();
2704
2764
  }
2705
- function yi(i) {
2765
+ function xi(i) {
2706
2766
  if (i.series.size === 0) return;
2707
2767
  let e = 1 / 0, t = -1 / 0;
2708
2768
  const n = /* @__PURE__ */ new Map();
@@ -2739,7 +2799,7 @@ function yi(i) {
2739
2799
  }
2740
2800
  }), i.requestRender();
2741
2801
  }
2742
- function mi(i, e = {}) {
2802
+ function bi(i, e = {}) {
2743
2803
  var l, h;
2744
2804
  const t = typeof e.padding == "object" ? e.padding.x ?? 0.02 : e.padding ?? 0.02, n = typeof e.padding == "object" ? e.padding.y ?? 0.05 : e.padding ?? 0.05;
2745
2805
  let s = (l = e.x) == null ? void 0 : l[0], o = (h = e.x) == null ? void 0 : h[1], r = s !== void 0 && o !== void 0;
@@ -2767,12 +2827,12 @@ function mi(i, e = {}) {
2767
2827
  if (a.forEach((u, g) => {
2768
2828
  if (u.min === 1 / 0) return;
2769
2829
  f = !0;
2770
- const y = i.yAxisOptionsMap.get(g), m = i.yScales.get(g);
2771
- if (!y || !m) return;
2830
+ const y = i.yAxisOptionsMap.get(g), x = i.yScales.get(g);
2831
+ if (!y || !x) return;
2772
2832
  let b = u.max - u.min;
2773
2833
  (b <= 0 || !isFinite(b)) && (b = Math.abs(u.min) * 0.1 || 1);
2774
- const v = b * n, x = Math.max(-1e15, u.min - v), S = Math.min(1e15, u.max + v);
2775
- m.setDomain(x, S), g === i.primaryYAxisId && (i.viewBounds.yMin = x, i.viewBounds.yMax = S);
2834
+ const w = b * n, p = Math.max(-1e15, u.min - w), v = Math.min(1e15, u.max + w);
2835
+ x.setDomain(p, v), g === i.primaryYAxisId && (i.viewBounds.yMin = p, i.viewBounds.yMax = v);
2776
2836
  }), !e.y && !f && !r) return !1;
2777
2837
  }
2778
2838
  if (r && s !== void 0 && o !== void 0) {
@@ -2783,7 +2843,7 @@ function mi(i, e = {}) {
2783
2843
  }
2784
2844
  return i.requestRender(), !0;
2785
2845
  }
2786
- function pi(i) {
2846
+ function vi(i) {
2787
2847
  if (i.series.size === 0) return;
2788
2848
  const e = /* @__PURE__ */ new Map();
2789
2849
  i.yScales.forEach((o, r) => {
@@ -2812,7 +2872,7 @@ function pi(i) {
2812
2872
  }
2813
2873
  }), i.requestRender();
2814
2874
  }
2815
- function xi(i, e, t, n) {
2875
+ function wi(i, e, t, n) {
2816
2876
  if (e === null) {
2817
2877
  if (t && t.width > 5 && t.height > 5) {
2818
2878
  const s = i.getPlotArea(), o = i.viewBounds, r = (t.x - s.x) / s.width, a = (t.x + t.width - s.x) / s.width, l = 1 - (t.y - s.y) / s.height, h = 1 - (t.y + t.height - s.y) / s.height, d = o.xMin + r * (o.xMax - o.xMin), c = o.xMin + a * (o.xMax - o.xMin), f = o.yMin + h * (o.yMax - o.yMin), u = o.yMin + l * (o.yMax - o.yMin);
@@ -2822,7 +2882,7 @@ function xi(i, e, t, n) {
2822
2882
  }
2823
2883
  return e;
2824
2884
  }
2825
- const bi = {
2885
+ const Si = {
2826
2886
  /** Linear easing - constant speed */
2827
2887
  linear: (i) => i,
2828
2888
  /** Ease in - starts slow, accelerates */
@@ -2848,18 +2908,18 @@ const bi = {
2848
2908
  /** Bounce effect */
2849
2909
  bounce: (i) => i < 1 / 2.75 ? 7.5625 * i * i : i < 2 / 2.75 ? 7.5625 * (i -= 1.5 / 2.75) * i + 0.75 : i < 2.5 / 2.75 ? 7.5625 * (i -= 2.25 / 2.75) * i + 0.9375 : 7.5625 * (i -= 2.625 / 2.75) * i + 0.984375
2850
2910
  };
2851
- class et {
2911
+ class it {
2852
2912
  constructor() {
2853
- p(this, "animations", /* @__PURE__ */ new Map());
2854
- p(this, "frameId", null);
2855
- p(this, "idCounter", 0);
2856
- p(this, "isDestroyed", !1);
2913
+ m(this, "animations", /* @__PURE__ */ new Map());
2914
+ m(this, "frameId", null);
2915
+ m(this, "idCounter", 0);
2916
+ m(this, "isDestroyed", !1);
2857
2917
  }
2858
2918
  /**
2859
2919
  * Start a new animation
2860
2920
  */
2861
2921
  animate(e) {
2862
- const t = `anim_${++this.idCounter}`, n = typeof e.easing == "function" ? e.easing : bi[e.easing || "easeOutCubic"];
2922
+ const t = `anim_${++this.idCounter}`, n = typeof e.easing == "function" ? e.easing : Si[e.easing || "easeOutCubic"];
2863
2923
  let s, o;
2864
2924
  const r = new Promise((a, l) => {
2865
2925
  s = a, o = l;
@@ -3035,11 +3095,11 @@ function _e(i) {
3035
3095
  } : { ...X };
3036
3096
  }
3037
3097
  let ke = null;
3038
- function jn() {
3039
- return ke || (ke = new et()), ke;
3098
+ function ss() {
3099
+ return ke || (ke = new it()), ke;
3040
3100
  }
3041
3101
  let G = null, j = null;
3042
- function vi(i, e) {
3102
+ function Mi(i, e) {
3043
3103
  const t = e.animate !== !1 && i.animationConfig.enabled && i.animationConfig.zoom.enabled;
3044
3104
  G != null && G.isRunning() && G.cancel();
3045
3105
  const n = pe(i.series.values()), s = e.x ? e.x[0] : i.viewBounds.xMin, o = e.x ? e.x[1] : i.viewBounds.xMax;
@@ -3053,10 +3113,10 @@ function vi(i, e) {
3053
3113
  c && (c.setDomain(r, a), l === i.primaryYAxisId && (i.viewBounds.yMin = r, i.viewBounds.yMax = a));
3054
3114
  } else {
3055
3115
  const c = i.viewBounds.yMax - i.viewBounds.yMin, f = a - r, u = c > 0 ? f / c : 1, g = c > 0 ? (r - i.viewBounds.yMin) / c : 0;
3056
- i.yScales.forEach((m, b) => {
3116
+ i.yScales.forEach((x, b) => {
3057
3117
  if (b === i.primaryYAxisId) return;
3058
- const v = m.domain[1] - m.domain[0], x = n ? 0 : m.domain[0] + g * v, S = n ? m.domain[0] + u * v : x + u * v;
3059
- m.setDomain(x, S);
3118
+ const w = x.domain[1] - x.domain[0], p = n ? 0 : x.domain[0] + g * w, v = n ? x.domain[0] + u * w : p + u * w;
3119
+ x.setDomain(p, v);
3060
3120
  }), i.viewBounds.yMin = r, i.viewBounds.yMax = a;
3061
3121
  const y = i.yScales.get(i.primaryYAxisId);
3062
3122
  y && y.setDomain(r, a);
@@ -3085,8 +3145,8 @@ function vi(i, e) {
3085
3145
  if (u === i.primaryYAxisId)
3086
3146
  f.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
3087
3147
  else {
3088
- const g = d.get(u), y = h.yMax - h.yMin, m = i.viewBounds.yMax - i.viewBounds.yMin, b = y > 0 ? m / y : 1, v = y > 0 ? (i.viewBounds.yMin - h.yMin) / y : 0, x = g[1] - g[0], S = g[0] + v * x, w = S + b * x;
3089
- f.setDomain(S, w);
3148
+ const g = d.get(u), y = h.yMax - h.yMin, x = i.viewBounds.yMax - i.viewBounds.yMin, b = y > 0 ? x / y : 1, w = y > 0 ? (i.viewBounds.yMin - h.yMin) / y : 0, p = g[1] - g[0], v = g[0] + w * p, S = v + b * p;
3149
+ f.setDomain(v, S);
3090
3150
  }
3091
3151
  });
3092
3152
  i.requestRender();
@@ -3099,78 +3159,78 @@ function vi(i, e) {
3099
3159
  }
3100
3160
  }), G;
3101
3161
  }
3102
- function Si(i, e = !0) {
3162
+ function Ci(i, e = !0) {
3103
3163
  if (i.series.size === 0) return null;
3104
3164
  let t = 1 / 0, n = -1 / 0;
3105
3165
  const s = /* @__PURE__ */ new Map();
3106
- i.yScales.forEach((v, x) => {
3107
- s.set(x, { min: 1 / 0, max: -1 / 0 });
3166
+ i.yScales.forEach((w, p) => {
3167
+ s.set(p, { min: 1 / 0, max: -1 / 0 });
3108
3168
  });
3109
3169
  let o = !1;
3110
- if (i.series.forEach((v) => {
3111
- if (!v.isVisible()) return;
3112
- const x = v.getBounds();
3113
- if (x && isFinite(x.xMin) && isFinite(x.xMax) && isFinite(x.yMin) && isFinite(x.yMax)) {
3114
- t = Math.min(t, x.xMin), n = Math.max(n, x.xMax);
3115
- const S = v.getYAxisId() || i.primaryYAxisId, w = s.get(S);
3116
- w && (w.min = Math.min(w.min, x.yMin), w.max = Math.max(w.max, x.yMax)), o = !0;
3170
+ if (i.series.forEach((w) => {
3171
+ if (!w.isVisible()) return;
3172
+ const p = w.getBounds();
3173
+ if (p && isFinite(p.xMin) && isFinite(p.xMax) && isFinite(p.yMin) && isFinite(p.yMax)) {
3174
+ t = Math.min(t, p.xMin), n = Math.max(n, p.xMax);
3175
+ const v = w.getYAxisId() || i.primaryYAxisId, S = s.get(v);
3176
+ S && (S.min = Math.min(S.min, p.yMin), S.max = Math.max(S.max, p.yMax)), o = !0;
3117
3177
  }
3118
3178
  }), !o) return null;
3119
3179
  const r = 1e15, a = -1e15;
3120
3180
  let l = i.viewBounds.xMin, h = i.viewBounds.xMax, d = i.viewBounds.yMin, c = i.viewBounds.yMax;
3121
3181
  if (i.xAxisOptions.auto) {
3122
- let v = n - t;
3123
- (v <= 0 || !isFinite(v)) && (v = Math.abs(t) * 0.1 || 1);
3124
- const x = Math.min(v * 5e-3, 1e10);
3125
- l = Math.max(a, t - x), h = Math.min(r, n + x);
3182
+ let w = n - t;
3183
+ (w <= 0 || !isFinite(w)) && (w = Math.abs(t) * 0.1 || 1);
3184
+ const p = Math.min(w * 5e-3, 1e10);
3185
+ l = Math.max(a, t - p), h = Math.min(r, n + p);
3126
3186
  }
3127
3187
  const f = s.get(i.primaryYAxisId), u = i.yAxisOptionsMap.get(i.primaryYAxisId);
3128
3188
  if (f && (u != null && u.auto) && f.min !== 1 / 0) {
3129
- let v = f.max - f.min;
3130
- (v <= 0 || !isFinite(v)) && (v = Math.abs(f.min) * 0.1 || 1);
3131
- const x = Math.min(v * 5e-3, 1e10);
3132
- d = Math.max(a, f.min - x), c = Math.min(r, f.max + x);
3189
+ let w = f.max - f.min;
3190
+ (w <= 0 || !isFinite(w)) && (w = Math.abs(f.min) * 0.1 || 1);
3191
+ const p = Math.min(w * 5e-3, 1e10);
3192
+ d = Math.max(a, f.min - p), c = Math.min(r, f.max + p);
3133
3193
  }
3134
3194
  const g = e && i.animationConfig.enabled && i.animationConfig.autoScale.enabled;
3135
3195
  if (j != null && j.isRunning() && j.cancel(), !g)
3136
- return i.viewBounds.xMin = l, i.viewBounds.xMax = h, i.viewBounds.yMin = d, i.viewBounds.yMax = c, i.yScales.forEach((v, x) => {
3137
- const S = s.get(x), w = i.yAxisOptionsMap.get(x);
3138
- if (S && (w != null && w.auto) && S.min !== 1 / 0) {
3139
- let M = S.max - S.min;
3140
- (M <= 0 || !isFinite(M)) && (M = Math.abs(S.min) * 0.1 || 1);
3196
+ return i.viewBounds.xMin = l, i.viewBounds.xMax = h, i.viewBounds.yMin = d, i.viewBounds.yMax = c, i.yScales.forEach((w, p) => {
3197
+ const v = s.get(p), S = i.yAxisOptionsMap.get(p);
3198
+ if (v && (S != null && S.auto) && v.min !== 1 / 0) {
3199
+ let M = v.max - v.min;
3200
+ (M <= 0 || !isFinite(M)) && (M = Math.abs(v.min) * 0.1 || 1);
3141
3201
  const A = Math.min(M * 5e-3, 1e10);
3142
- v.setDomain(
3143
- Math.max(a, S.min - A),
3144
- Math.min(r, S.max + A)
3202
+ w.setDomain(
3203
+ Math.max(a, v.min - A),
3204
+ Math.min(r, v.max + A)
3145
3205
  );
3146
3206
  }
3147
3207
  }), i.events.emit("autoScale", void 0), i.requestRender(), null;
3148
- const y = { ...i.viewBounds }, m = /* @__PURE__ */ new Map();
3149
- i.yScales.forEach((v, x) => {
3150
- m.set(x, [...v.domain]);
3208
+ const y = { ...i.viewBounds }, x = /* @__PURE__ */ new Map();
3209
+ i.yScales.forEach((w, p) => {
3210
+ x.set(p, [...w.domain]);
3151
3211
  });
3152
3212
  const b = /* @__PURE__ */ new Map();
3153
- return i.yScales.forEach((v, x) => {
3154
- const S = s.get(x), w = i.yAxisOptionsMap.get(x);
3155
- if (S && (w != null && w.auto) && S.min !== 1 / 0) {
3156
- let M = S.max - S.min;
3157
- (M <= 0 || !isFinite(M)) && (M = Math.abs(S.min) * 0.1 || 1);
3213
+ return i.yScales.forEach((w, p) => {
3214
+ const v = s.get(p), S = i.yAxisOptionsMap.get(p);
3215
+ if (v && (S != null && S.auto) && v.min !== 1 / 0) {
3216
+ let M = v.max - v.min;
3217
+ (M <= 0 || !isFinite(M)) && (M = Math.abs(v.min) * 0.1 || 1);
3158
3218
  const A = Math.min(M * 5e-3, 1e10);
3159
- b.set(x, [
3160
- Math.max(a, S.min - A),
3161
- Math.min(r, S.max + A)
3219
+ b.set(p, [
3220
+ Math.max(a, v.min - A),
3221
+ Math.min(r, v.max + A)
3162
3222
  ]);
3163
3223
  } else
3164
- b.set(x, [...v.domain]);
3224
+ b.set(p, [...w.domain]);
3165
3225
  }), j = i.animationEngine.animate({
3166
3226
  duration: i.animationConfig.autoScale.duration,
3167
3227
  easing: i.animationConfig.autoScale.easing,
3168
- onUpdate: (v) => {
3169
- i.viewBounds.xMin = y.xMin + (l - y.xMin) * v, i.viewBounds.xMax = y.xMax + (h - y.xMax) * v, i.viewBounds.yMin = y.yMin + (d - y.yMin) * v, i.viewBounds.yMax = y.yMax + (c - y.yMax) * v, i.yScales.forEach((x, S) => {
3170
- const w = m.get(S), M = b.get(S);
3171
- x.setDomain(
3172
- w[0] + (M[0] - w[0]) * v,
3173
- w[1] + (M[1] - w[1]) * v
3228
+ onUpdate: (w) => {
3229
+ i.viewBounds.xMin = y.xMin + (l - y.xMin) * w, i.viewBounds.xMax = y.xMax + (h - y.xMax) * w, i.viewBounds.yMin = y.yMin + (d - y.yMin) * w, i.viewBounds.yMax = y.yMax + (c - y.yMax) * w, i.yScales.forEach((p, v) => {
3230
+ const S = x.get(v), M = b.get(v);
3231
+ p.setDomain(
3232
+ S[0] + (M[0] - S[0]) * w,
3233
+ S[1] + (M[1] - S[1]) * w
3174
3234
  );
3175
3235
  }), i.requestRender();
3176
3236
  },
@@ -3179,7 +3239,7 @@ function Si(i, e = !0) {
3179
3239
  }
3180
3240
  }), j;
3181
3241
  }
3182
- function wi(i, e, t) {
3242
+ function Ai(i, e, t) {
3183
3243
  const n = { ...i.viewBounds }, s = {
3184
3244
  xMin: e.xMin ?? i.viewBounds.xMin,
3185
3245
  xMax: e.xMax ?? i.viewBounds.xMax,
@@ -3202,7 +3262,7 @@ function wi(i, e, t) {
3202
3262
  }
3203
3263
  });
3204
3264
  }
3205
- function tt(i, e, t = "degrees") {
3265
+ function nt(i, e, t = "degrees") {
3206
3266
  const n = Math.min(i.length, e.length), s = new Float32Array(n * 2), o = t === "degrees" ? Math.PI / 180 : 1;
3207
3267
  for (let r = 0; r < n; r++) {
3208
3268
  const a = i[r], l = e[r] * o;
@@ -3210,22 +3270,22 @@ function tt(i, e, t = "degrees") {
3210
3270
  }
3211
3271
  return s;
3212
3272
  }
3213
- function Mi(i, e = "degrees", t = !1) {
3214
- const n = tt(i.r, i.theta, e);
3273
+ function Pi(i, e = "degrees", t = !1) {
3274
+ const n = nt(i.r, i.theta, e);
3215
3275
  if (!t)
3216
3276
  return n;
3217
3277
  const s = n.length / 2, o = new Float32Array((s + 1) * 2);
3218
3278
  return o.set(n), o[s * 2] = n[0], o[s * 2 + 1] = n[1], o;
3219
3279
  }
3220
- function Ci(i, e = "degrees", t = !0) {
3221
- const n = tt(i.r, i.theta, e), s = n.length / 2, o = t ? s : s - 1, r = new Float32Array(o * 3 * 2);
3280
+ function ki(i, e = "degrees", t = !0) {
3281
+ const n = nt(i.r, i.theta, e), s = n.length / 2, o = t ? s : s - 1, r = new Float32Array(o * 3 * 2);
3222
3282
  for (let a = 0; a < o; a++) {
3223
3283
  const l = a * 6, h = a, d = (a + 1) % s;
3224
3284
  r[l + 0] = 0, r[l + 1] = 0, r[l + 2] = n[h * 2], r[l + 3] = n[h * 2 + 1], r[l + 4] = n[d * 2], r[l + 5] = n[d * 2 + 1];
3225
3285
  }
3226
3286
  return r;
3227
3287
  }
3228
- function Ai(i) {
3288
+ function Bi(i) {
3229
3289
  const e = Math.min(i.r.length, i.theta.length);
3230
3290
  let t = 0;
3231
3291
  for (let n = 0; n < e; n++)
@@ -3238,33 +3298,33 @@ function Ai(i) {
3238
3298
  maxRadius: t
3239
3299
  };
3240
3300
  }
3241
- function Pi(i, e, t, n) {
3301
+ function Ti(i, e, t, n) {
3242
3302
  if (i === "heatmap" && t) {
3243
- const { xValues: y, yValues: m } = t;
3244
- let b = 1 / 0, v = -1 / 0, x = 1 / 0, S = -1 / 0;
3245
- for (let w = 0; w < y.length; w++) {
3246
- const M = y[w];
3247
- M < b && (b = M), M > v && (v = M);
3303
+ const { xValues: y, yValues: x } = t;
3304
+ let b = 1 / 0, w = -1 / 0, p = 1 / 0, v = -1 / 0;
3305
+ for (let S = 0; S < y.length; S++) {
3306
+ const M = y[S];
3307
+ M < b && (b = M), M > w && (w = M);
3248
3308
  }
3249
- for (let w = 0; w < m.length; w++) {
3250
- const M = m[w];
3251
- M < x && (x = M), M > S && (S = M);
3309
+ for (let S = 0; S < x.length; S++) {
3310
+ const M = x[S];
3311
+ M < p && (p = M), M > v && (v = M);
3252
3312
  }
3253
- return b === 1 / 0 || x === 1 / 0 ? null : { xMin: b, xMax: v, yMin: x, yMax: S };
3313
+ return b === 1 / 0 || p === 1 / 0 ? null : { xMin: b, xMax: w, yMin: p, yMax: v };
3254
3314
  }
3255
3315
  if (i === "polar" && n)
3256
- return Ai(n);
3316
+ return Bi(n);
3257
3317
  const { x: s, y: o, y2: r, open: a, high: l, low: h, close: d } = e;
3258
3318
  if (s.length === 0) return null;
3259
3319
  let c = 1 / 0, f = -1 / 0, u = 1 / 0, g = -1 / 0;
3260
3320
  for (let y = 0; y < s.length; y++) {
3261
- const m = s[y];
3262
- if (!isFinite(m)) continue;
3263
- m < c && (c = m), m > f && (f = m);
3321
+ const x = s[y];
3322
+ if (!isFinite(x)) continue;
3323
+ x < c && (c = x), x > f && (f = x);
3264
3324
  const b = [];
3265
3325
  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]);
3266
- for (const v of b)
3267
- v < u && (u = v), v > g && (g = v);
3326
+ for (const w of b)
3327
+ w < u && (u = w), w > g && (g = w);
3268
3328
  }
3269
3329
  return c === 1 / 0 || u === 1 / 0 ? null : { xMin: c, xMax: f, yMin: u, yMax: g };
3270
3330
  }
@@ -3275,7 +3335,7 @@ function W(i, e) {
3275
3335
  const t = new i.constructor(i.length + e.length);
3276
3336
  return t.set(i, 0), t.set(e, i.length), t;
3277
3337
  }
3278
- function ki(i, e) {
3338
+ function Ii(i, e) {
3279
3339
  const { x: t, y: n } = i, s = t.length;
3280
3340
  if (s < e) return { ...i };
3281
3341
  const o = new Float32Array(s), r = Math.floor(e / 2);
@@ -3287,7 +3347,7 @@ function ki(i, e) {
3287
3347
  }
3288
3348
  return { x: t, y: o };
3289
3349
  }
3290
- function Bi(i, e) {
3350
+ function Ei(i, e) {
3291
3351
  var s, o;
3292
3352
  if (e < 0 || e >= i.x.length) return null;
3293
3353
  if (i.yError && e < i.yError.length) {
@@ -3297,7 +3357,7 @@ function Bi(i, e) {
3297
3357
  const t = ((s = i.yErrorMinus) == null ? void 0 : s[e]) ?? 0, n = ((o = i.yErrorPlus) == null ? void 0 : o[e]) ?? 0;
3298
3358
  return t > 0 || n > 0 ? [t, n] : null;
3299
3359
  }
3300
- function Ti(i, e) {
3360
+ function Ri(i, e) {
3301
3361
  var s, o;
3302
3362
  if (e < 0 || e >= i.x.length) return null;
3303
3363
  if (i.xError && e < i.xError.length) {
@@ -3307,72 +3367,72 @@ function Ti(i, e) {
3307
3367
  const t = ((s = i.xErrorMinus) == null ? void 0 : s[e]) ?? 0, n = ((o = i.xErrorPlus) == null ? void 0 : o[e]) ?? 0;
3308
3368
  return t > 0 || n > 0 ? [t, n] : null;
3309
3369
  }
3310
- const Ii = {
3370
+ const Fi = {
3311
3371
  color: "#ff0055",
3312
3372
  width: 1.5,
3313
3373
  opacity: 1,
3314
3374
  pointSize: 4
3315
3375
  };
3316
- class Ei {
3376
+ class Di {
3317
3377
  constructor(e) {
3318
- p(this, "id");
3319
- p(this, "type");
3320
- p(this, "yAxisId");
3321
- p(this, "data");
3322
- p(this, "style");
3323
- p(this, "visible");
3324
- p(this, "name");
3325
- p(this, "stackId");
3326
- p(this, "cycle");
3327
- p(this, "maxPoints");
3328
- p(this, "markers", []);
3329
- p(this, "bullishCount", 0);
3330
- p(this, "bearishCount", 0);
3331
- p(this, "waterfallCounts");
3332
- p(this, "heatmapData");
3333
- p(this, "heatmapStyle");
3334
- p(this, "polarData");
3335
- p(this, "gaugeData");
3336
- p(this, "gaugeStyle");
3337
- p(this, "sankeyData");
3338
- p(this, "sankeyStyle");
3339
- p(this, "lastAppendCount", 0);
3340
- p(this, "cachedBounds", null);
3341
- p(this, "boundsNeedsUpdate", !0);
3342
- p(this, "_needsBufferUpdate", !0);
3343
- p(this, "smoothedData", null);
3344
- p(this, "smoothingNeedsUpdate", !0);
3345
- p(this, "getId", () => this.id);
3346
- p(this, "getName", () => this.name || this.id);
3347
- p(this, "getType", () => this.type);
3348
- p(this, "getYAxisId", () => this.yAxisId);
3349
- p(this, "setYAxisId", (e) => {
3378
+ m(this, "id");
3379
+ m(this, "type");
3380
+ m(this, "yAxisId");
3381
+ m(this, "data");
3382
+ m(this, "style");
3383
+ m(this, "visible");
3384
+ m(this, "name");
3385
+ m(this, "stackId");
3386
+ m(this, "cycle");
3387
+ m(this, "maxPoints");
3388
+ m(this, "markers", []);
3389
+ m(this, "bullishCount", 0);
3390
+ m(this, "bearishCount", 0);
3391
+ m(this, "waterfallCounts");
3392
+ m(this, "heatmapData");
3393
+ m(this, "heatmapStyle");
3394
+ m(this, "polarData");
3395
+ m(this, "gaugeData");
3396
+ m(this, "gaugeStyle");
3397
+ m(this, "sankeyData");
3398
+ m(this, "sankeyStyle");
3399
+ m(this, "lastAppendCount", 0);
3400
+ m(this, "cachedBounds", null);
3401
+ m(this, "boundsNeedsUpdate", !0);
3402
+ m(this, "_needsBufferUpdate", !0);
3403
+ m(this, "smoothedData", null);
3404
+ m(this, "smoothingNeedsUpdate", !0);
3405
+ m(this, "getId", () => this.id);
3406
+ m(this, "getName", () => this.name || this.id);
3407
+ m(this, "getType", () => this.type);
3408
+ m(this, "getYAxisId", () => this.yAxisId);
3409
+ m(this, "setYAxisId", (e) => {
3350
3410
  this.yAxisId = e;
3351
3411
  });
3352
- p(this, "getStackId", () => this.stackId);
3353
- p(this, "getVisible", () => this.visible);
3354
- p(this, "isVisible", () => this.visible);
3355
- p(this, "getStyle", () => this.style);
3356
- p(this, "getMarkers", () => this.markers);
3357
- p(this, "setMarkers", (e) => {
3412
+ m(this, "getStackId", () => this.stackId);
3413
+ m(this, "getVisible", () => this.visible);
3414
+ m(this, "isVisible", () => this.visible);
3415
+ m(this, "getStyle", () => this.style);
3416
+ m(this, "getMarkers", () => this.markers);
3417
+ m(this, "setMarkers", (e) => {
3358
3418
  this.markers = e, this._needsBufferUpdate = !0;
3359
3419
  });
3360
- p(this, "getHeatmapData", () => this.heatmapData);
3361
- p(this, "getHeatmapStyle", () => this.heatmapStyle);
3362
- p(this, "getPolarData", () => this.polarData);
3363
- p(this, "getGaugeData", () => this.gaugeData);
3364
- p(this, "getGaugeStyle", () => this.gaugeStyle);
3365
- p(this, "getSankeyData", () => this.sankeyData);
3366
- p(this, "getSankeyStyle", () => this.sankeyStyle);
3367
- p(this, "getCycle", () => this.cycle);
3368
- p(this, "getPointCount", () => this.type === "heatmap" ? this.heatmapData.xValues.length * this.heatmapData.yValues.length : this.type === "polar" ? this.polarData ? this.polarData.r.length : 0 : this.type === "gauge" ? 1 : this.type === "sankey" ? this.sankeyData ? this.sankeyData.links.length : 0 : this.data.x.length);
3369
- p(this, "getLastAppendCount", () => this.lastAppendCount);
3370
- p(this, "resetLastAppendCount", () => {
3420
+ m(this, "getHeatmapData", () => this.heatmapData);
3421
+ m(this, "getHeatmapStyle", () => this.heatmapStyle);
3422
+ m(this, "getPolarData", () => this.polarData);
3423
+ m(this, "getGaugeData", () => this.gaugeData);
3424
+ m(this, "getGaugeStyle", () => this.gaugeStyle);
3425
+ m(this, "getSankeyData", () => this.sankeyData);
3426
+ m(this, "getSankeyStyle", () => this.sankeyStyle);
3427
+ m(this, "getCycle", () => this.cycle);
3428
+ m(this, "getPointCount", () => this.type === "heatmap" ? this.heatmapData.xValues.length * this.heatmapData.yValues.length : this.type === "polar" ? this.polarData ? this.polarData.r.length : 0 : this.type === "gauge" ? 1 : this.type === "sankey" ? this.sankeyData ? this.sankeyData.links.length : 0 : this.data.x.length);
3429
+ m(this, "getLastAppendCount", () => this.lastAppendCount);
3430
+ m(this, "resetLastAppendCount", () => {
3371
3431
  this.lastAppendCount = 0;
3372
3432
  });
3373
- p(this, "hasErrorData", () => !!(this.data.yError || this.data.yErrorPlus || this.data.yErrorMinus || this.data.xError || this.data.xErrorPlus || this.data.xErrorMinus));
3374
- p(this, "getYError", (e) => Bi(this.data, e));
3375
- p(this, "getXError", (e) => Ti(this.data, e));
3433
+ m(this, "hasErrorData", () => !!(this.data.yError || this.data.yErrorPlus || this.data.yErrorMinus || this.data.xError || this.data.xErrorPlus || this.data.xErrorMinus));
3434
+ m(this, "getYError", (e) => Ei(this.data, e));
3435
+ m(this, "getXError", (e) => Ri(this.data, e));
3376
3436
  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") {
3377
3437
  const t = e;
3378
3438
  this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.heatmapData = {
@@ -3411,13 +3471,13 @@ class Ei {
3411
3471
  median: t != null && t.median ? P(t.median) : void 0
3412
3472
  }, this.type === "candlestick" && this.data.close && this.data.y.length !== this.data.x.length && (this.data.y = this.data.close);
3413
3473
  }
3414
- this.style = { ...Ii, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
3474
+ this.style = { ...Fi, ...e.style }, e.color && (this.style.color = e.color), e.width && (this.style.width = e.width), e.pointSize && (this.style.pointSize = e.pointSize);
3415
3475
  }
3416
3476
  getData() {
3417
- return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = ki(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
3477
+ return this.style.smoothing && this.style.smoothing > 0 ? ((this.smoothingNeedsUpdate || !this.smoothedData) && (this.smoothedData = Ii(this.data, 5), this.smoothingNeedsUpdate = !1), this.smoothedData) : this.data;
3418
3478
  }
3419
3479
  getBounds() {
3420
- return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = Pi(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
3480
+ return this.data.x.length === 0 && this.type !== "heatmap" && this.type !== "polar" && this.type !== "gauge" && this.type !== "sankey" ? null : (this.boundsNeedsUpdate && (this.cachedBounds = Ti(this.type, this.data, this.heatmapData, this.polarData), this.boundsNeedsUpdate = !1), this.cachedBounds);
3421
3481
  }
3422
3482
  updateData(e) {
3423
3483
  if (e) {
@@ -3464,7 +3524,7 @@ class Ei {
3464
3524
  this.data = { x: new Float32Array(0), y: new Float32Array(0) }, this.cachedBounds = null;
3465
3525
  }
3466
3526
  }
3467
- function Ri(i, e, t) {
3527
+ function Li(i, e, t) {
3468
3528
  const n = Math.min(i.length, e.length), s = new Float32Array(n * 6 * 2), o = t * 0.5;
3469
3529
  for (let r = 0; r < n; r++) {
3470
3530
  const a = i[r], l = e[r], h = r * 12, d = a - o, c = a + o, f = 0, u = l;
@@ -3472,7 +3532,7 @@ function Ri(i, e, t) {
3472
3532
  }
3473
3533
  return s;
3474
3534
  }
3475
- function ye(i) {
3535
+ function me(i) {
3476
3536
  if (i.length < 2) return 1;
3477
3537
  let e = 1 / 0;
3478
3538
  for (let t = 1; t < i.length; t++) {
@@ -3481,19 +3541,19 @@ function ye(i) {
3481
3541
  }
3482
3542
  return e === 1 / 0 ? 1 : e * 0.8;
3483
3543
  }
3484
- function Fi(i, e, t) {
3544
+ function zi(i, e, t) {
3485
3545
  const n = i.length, s = e.length;
3486
3546
  n * s > t.length && console.warn("[Heatmap] Z array is too small for the specified grid dimensions");
3487
3547
  const o = (n - 1) * (s - 1), r = new Float32Array(o * 6 * 3);
3488
3548
  let a = 0;
3489
3549
  for (let l = 0; l < s - 1; l++)
3490
3550
  for (let h = 0; h < n - 1; h++) {
3491
- const d = i[h], c = i[h + 1], f = e[l], u = e[l + 1], g = t[l * n + h], y = t[l * n + (h + 1)], m = t[(l + 1) * n + h], b = t[(l + 1) * n + (h + 1)];
3492
- r[a++] = d, r[a++] = f, r[a++] = g, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = d, r[a++] = u, r[a++] = m, r[a++] = d, r[a++] = u, r[a++] = m, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = c, r[a++] = u, r[a++] = b;
3551
+ const d = i[h], c = i[h + 1], f = e[l], u = e[l + 1], g = t[l * n + h], y = t[l * n + (h + 1)], x = t[(l + 1) * n + h], b = t[(l + 1) * n + (h + 1)];
3552
+ r[a++] = d, r[a++] = f, r[a++] = g, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = d, r[a++] = u, r[a++] = x, r[a++] = d, r[a++] = u, r[a++] = x, r[a++] = c, r[a++] = f, r[a++] = y, r[a++] = c, r[a++] = u, r[a++] = b;
3493
3553
  }
3494
3554
  return r;
3495
3555
  }
3496
- function Di(i = "viridis") {
3556
+ function Oi(i = "viridis") {
3497
3557
  const t = new Uint8Array(1024);
3498
3558
  for (let n = 0; n < 256; n++) {
3499
3559
  const s = n / 255;
@@ -3502,11 +3562,12 @@ function Di(i = "viridis") {
3502
3562
  }
3503
3563
  return t;
3504
3564
  }
3505
- function Li(i, e, t, n, s, o, r = !1) {
3565
+ function $i(i, e, t, n, s, o, r = !1) {
3506
3566
  const a = i.length, l = [], h = [], d = o / 2, f = o / 10 / 2;
3507
3567
  for (let u = 0; u < a; u++) {
3508
- const g = s[u] >= e[u], y = g ? l : h, m = Math.max(e[u], s[u]), b = Math.min(e[u], s[u]);
3509
- r && g || Ve(y, i[u] - d, b, i[u] + d, m), Ve(y, i[u] - f, n[u], i[u] + f, t[u]);
3568
+ if (!Number.isFinite(i[u])) continue;
3569
+ const g = s[u] >= e[u], y = g ? l : h, x = Math.max(e[u], s[u]), b = Math.min(e[u], s[u]);
3570
+ r && g || Ve(y, i[u] - d, b, i[u] + d, x), Ve(y, i[u] - f, n[u], i[u] + f, t[u]);
3510
3571
  }
3511
3572
  return {
3512
3573
  bullish: new Float32Array(l),
@@ -3516,11 +3577,11 @@ function Li(i, e, t, n, s, o, r = !1) {
3516
3577
  function Ve(i, e, t, n, s) {
3517
3578
  i.push(e, t, n, t, e, s), i.push(n, t, n, s, e, s);
3518
3579
  }
3519
- function he(i, e) {
3580
+ function ce(i, e) {
3520
3581
  if (!i.renderer) return;
3521
3582
  const t = e.getStackId();
3522
3583
  if (t) {
3523
- $i(i, t);
3584
+ Vi(i, t);
3524
3585
  return;
3525
3586
  }
3526
3587
  const n = e.getData(), s = e.getType();
@@ -3528,16 +3589,16 @@ function he(i, e) {
3528
3589
  const o = e.getId();
3529
3590
  if (s === "band" || s === "area") {
3530
3591
  const r = s === "area" ? new Float32Array(n.x.length).fill(0) : n.y2 || new Float32Array(n.x.length).fill(0);
3531
- i.renderer.createBuffer(o, Qe(n.x, n.y, r));
3592
+ i.renderer.createBuffer(o, Je(n.x, n.y, r));
3532
3593
  } else if (s === "bar") {
3533
- const r = e.getStyle().barWidth ?? ye(n.x);
3534
- i.renderer.createBuffer(o, Ri(n.x, n.y, r));
3594
+ const r = e.getStyle().barWidth ?? me(n.x);
3595
+ i.renderer.createBuffer(o, Li(n.x, n.y, r));
3535
3596
  } else if (s === "heatmap")
3536
- Oi(i, e);
3597
+ _i(i, e);
3537
3598
  else if (s === "candlestick") {
3538
3599
  const r = e.getData();
3539
3600
  if (r.open && r.high && r.low && r.close) {
3540
- const a = e.getStyle().barWidth ?? ye(r.x), l = !!e.getStyle().hollow, { bullish: h, bearish: d } = Li(
3601
+ const a = e.getStyle().barWidth ?? me(r.x), l = !!e.getStyle().hollow, { bullish: h, bearish: d } = $i(
3541
3602
  r.x,
3542
3603
  r.open,
3543
3604
  r.high,
@@ -3551,20 +3612,20 @@ function he(i, e) {
3551
3612
  } else if (s === "boxplot") {
3552
3613
  const r = e.getData();
3553
3614
  if (r.low && r.open && r.median && r.close && r.high) {
3554
- const a = e.getStyle().barWidth ?? ye(r.x), { lines: l, boxes: h } = Ft(r.x, r.low, r.open, r.median, r.close, r.high, a);
3615
+ const a = e.getStyle().barWidth ?? me(r.x), { lines: l, boxes: h } = zt(r.x, r.low, r.open, r.median, r.close, r.high, a);
3555
3616
  i.renderer.createBuffer(`${o}_box_lines`, l), i.renderer.createBuffer(`${o}_box_faces`, h);
3556
3617
  }
3557
3618
  } else if (s === "waterfall") {
3558
- const r = e.getData(), a = e.getStyle().barWidth ?? ye(r.x), l = e.getStyle().isSubtotal, h = Dt(r.x, r.y, a, l);
3619
+ const r = e.getData(), a = e.getStyle().barWidth ?? me(r.x), l = e.getStyle().isSubtotal, h = Ot(r.x, r.y, a, l);
3559
3620
  i.renderer.createBuffer(`${o}_wf_positive`, h.positiveData), i.renderer.createBuffer(`${o}_wf_negative`, h.negativeData), i.renderer.createBuffer(`${o}_wf_subtotal`, h.subtotalData), i.renderer.createBuffer(`${o}_wf_connectors`, h.connectorData), e.waterfallCounts = {
3560
3621
  positive: h.positiveCount,
3561
3622
  negative: h.negativeCount,
3562
3623
  subtotal: h.subtotalCount,
3563
3624
  connectors: h.connectorData.length / 2
3564
3625
  };
3565
- } else s === "polar" ? zi(i, e) : i.renderer.createBuffer(o, je(n.x, n.y));
3626
+ } else s === "polar" ? Yi(i, e) : i.renderer.createBuffer(o, Qe(n.x, n.y));
3566
3627
  if (e.hasErrorData()) {
3567
- const r = e.getData(), a = Rt(
3628
+ const r = e.getData(), a = Lt(
3568
3629
  r.x,
3569
3630
  r.y,
3570
3631
  { yError: r.yError, yErrorMinus: r.yErrorMinus, yErrorPlus: r.yErrorPlus },
@@ -3574,31 +3635,31 @@ function he(i, e) {
3574
3635
  }
3575
3636
  if (s === "step" || s === "step+scatter") {
3576
3637
  const r = e.getStyle().stepMode ?? "after";
3577
- i.renderer.createBuffer(`${o}_step`, Et(n.x, n.y, r));
3638
+ i.renderer.createBuffer(`${o}_step`, Dt(n.x, n.y, r));
3578
3639
  }
3579
3640
  e.resetLastAppendCount();
3580
3641
  }
3581
- function zi(i, e) {
3642
+ function Yi(i, e) {
3582
3643
  const t = e.getPolarData();
3583
3644
  if (!t || t.r.length === 0) return;
3584
3645
  const n = e.getStyle(), s = n.angleMode || "degrees", o = n.closePath !== !1;
3585
3646
  if (n.fill || !1) {
3586
- const a = Ci(t, s, o);
3647
+ const a = ki(t, s, o);
3587
3648
  i.renderer.createBuffer(e.getId(), a);
3588
3649
  } else {
3589
- const a = Mi(t, s, o);
3650
+ const a = Pi(t, s, o);
3590
3651
  i.renderer.createBuffer(e.getId(), a);
3591
3652
  }
3592
3653
  }
3593
- function Oi(i, e) {
3654
+ function _i(i, e) {
3594
3655
  var o;
3595
3656
  const t = e.getHeatmapData(), n = e.getHeatmapStyle();
3596
3657
  if (!t || t.xValues.length < 2) return;
3597
- i.renderer.createBuffer(e.getId(), Fi(t.xValues, t.yValues, t.zValues));
3658
+ i.renderer.createBuffer(e.getId(), zi(t.xValues, t.yValues, t.zValues));
3598
3659
  const s = ((o = n == null ? void 0 : n.colorScale) == null ? void 0 : o.name) || "viridis";
3599
- i.renderer.createColormapTexture(`${e.getId()}_colormap`, Di(s));
3660
+ i.renderer.createColormapTexture(`${e.getId()}_colormap`, Oi(s));
3600
3661
  }
3601
- function $i(i, e) {
3662
+ function Vi(i, e) {
3602
3663
  const t = Array.from(i.series.values()).filter((s) => s.getStackId() === e);
3603
3664
  let n = null;
3604
3665
  for (const s of t) {
@@ -3607,13 +3668,13 @@ function $i(i, e) {
3607
3668
  n || (n = new Float32Array(o.y.length).fill(0));
3608
3669
  const r = new Float32Array(n);
3609
3670
  for (let a = 0; a < o.y.length; a++) n[a] += o.y[a];
3610
- i.renderer.createBuffer(s.getId(), Qe(o.x, n, r)), s.resetLastAppendCount();
3671
+ i.renderer.createBuffer(s.getId(), Je(o.x, n, r)), s.resetLastAppendCount();
3611
3672
  }
3612
3673
  }
3613
3674
  function N(i) {
3614
3675
  return i instanceof Float32Array || i instanceof Float64Array ? i : Float32Array.from(i);
3615
3676
  }
3616
- function Yi(i) {
3677
+ function Wi(i) {
3617
3678
  const e = new Float32Array(i.length), t = new Float32Array(i.length);
3618
3679
  for (let n = 0; n < i.length; n++) {
3619
3680
  const s = i[n];
@@ -3621,13 +3682,13 @@ function Yi(i) {
3621
3682
  }
3622
3683
  return { positive: e, negative: t };
3623
3684
  }
3624
- function _i(i, e, t) {
3685
+ function Xi(i, e, t) {
3625
3686
  if (i === void 0 || i === "zero") return 0;
3626
3687
  if (typeof i == "number") return i;
3627
3688
  const n = t.find((o) => o.id === i);
3628
3689
  return n ? N(n.y)[e] ?? 0 : 0;
3629
3690
  }
3630
- function Vi(i, e, t, n, s) {
3691
+ function Ni(i, e, t, n, s) {
3631
3692
  const o = i.length;
3632
3693
  if (o === 0) return [];
3633
3694
  if (o === 1) {
@@ -3643,26 +3704,26 @@ function Vi(i, e, t, n, s) {
3643
3704
  };
3644
3705
  h(i[0], e[0], l(0));
3645
3706
  for (let c = 1; c < o; c++) {
3646
- const f = e[c - 1], u = e[c], g = t(c - 1), y = t(c), m = f >= g, b = u >= y;
3647
- if (m === b) {
3707
+ const f = e[c - 1], u = e[c], g = t(c - 1), y = t(c), x = f >= g, b = u >= y;
3708
+ if (x === b) {
3648
3709
  h(i[c], e[c], l(c));
3649
3710
  continue;
3650
3711
  }
3651
- const v = u - f - (y - g);
3652
- let x = v !== 0 ? (g - f) / v : 0.5;
3653
- x = Math.max(0, Math.min(1, x));
3654
- const S = i[c - 1] + x * (i[c] - i[c - 1]), w = f + x * (u - f), M = m ? n : s, A = b ? n : s;
3655
- h(S, w, M), d(), h(S, w, A), h(i[c], e[c], l(c));
3712
+ const w = u - f - (y - g);
3713
+ let p = w !== 0 ? (g - f) / w : 0.5;
3714
+ p = Math.max(0, Math.min(1, p));
3715
+ const v = i[c - 1] + p * (i[c] - i[c - 1]), S = f + p * (u - f), M = x ? n : s, A = b ? n : s;
3716
+ h(v, S, M), d(), h(v, S, A), h(i[c], e[c], l(c));
3656
3717
  }
3657
3718
  return d(), r;
3658
3719
  }
3659
- function Wi(i, e, t, n, s, o, r, a) {
3720
+ function Hi(i, e, t, n, s, o, r, a) {
3660
3721
  const l = s.colorZones;
3661
3722
  if (!l) return;
3662
- const d = Vi(
3723
+ const d = Ni(
3663
3724
  t,
3664
3725
  n,
3665
- (c) => _i(l.ref, c, o),
3726
+ (c) => Xi(l.ref, c, o),
3666
3727
  l.aboveColor,
3667
3728
  l.belowColor
3668
3729
  );
@@ -3684,7 +3745,7 @@ function Wi(i, e, t, n, s, o, r, a) {
3684
3745
  });
3685
3746
  }
3686
3747
  }
3687
- const Xi = {
3748
+ const Ui = {
3688
3749
  baselineColor: "rgba(255,255,255,0.35)",
3689
3750
  baselineWidth: 1,
3690
3751
  baselineDash: [4, 4],
@@ -3693,126 +3754,129 @@ const Xi = {
3693
3754
  peakSize: 6,
3694
3755
  troughSize: 6
3695
3756
  };
3696
- function Se(i) {
3697
- var d, c, f, u;
3698
- const { id: e, data: t, style: n = {}, visible: s = !0 } = i, o = { ...Xi, ...n }, r = N(t.x), a = r.length, l = [];
3699
- if ((d = t.fills) != null && d.length)
3700
- for (let g = 0; g < t.fills.length; g++) {
3701
- const y = t.fills[g], m = y.id ?? `${e}-fill-${g}`;
3757
+ function we(i) {
3758
+ var h, d, c, f;
3759
+ const { id: e, data: t, style: n = {}, visible: s = !0 } = i, o = { ...Ui, ...n }, r = N(t.x), a = r.length, l = [];
3760
+ if ((h = t.fills) != null && h.length)
3761
+ for (let u = 0; u < t.fills.length; u++) {
3762
+ const g = t.fills[u], y = g.id ?? `${e}-fill-${u}`;
3702
3763
  l.push({
3703
- id: m,
3764
+ id: y,
3704
3765
  type: "band",
3705
3766
  visible: s,
3706
3767
  data: {
3707
3768
  x: r,
3708
- y: N(y.upper),
3709
- y2: N(y.lower)
3769
+ y: N(g.upper),
3770
+ y2: N(g.lower)
3710
3771
  },
3711
3772
  style: {
3712
- color: y.color ?? "rgba(100, 80, 180, 0.25)",
3713
- opacity: y.opacity ?? 0.35
3773
+ color: g.color ?? "rgba(100, 80, 180, 0.25)",
3774
+ opacity: g.opacity ?? 0.35
3714
3775
  }
3715
3776
  });
3716
3777
  }
3717
3778
  if (t.histogram) {
3718
- const g = N(t.histogram.y), { positive: y, negative: m } = Yi(g), b = t.histogram.barWidth, v = b !== void 0 ? { barWidth: b } : {};
3779
+ const u = N(t.histogram.y), { positive: g, negative: y } = Wi(u), x = t.histogram.barWidth, b = x !== void 0 ? { barWidth: x } : {};
3719
3780
  l.push({
3720
3781
  id: `${e}-hist-pos`,
3721
3782
  type: "bar",
3722
3783
  visible: s,
3723
- data: { x: r, y },
3784
+ data: { x: r, y: g },
3724
3785
  style: {
3725
3786
  color: t.histogram.positiveColor ?? "#26a69a",
3726
3787
  opacity: t.histogram.opacity ?? 0.85,
3727
- ...v
3788
+ ...b
3728
3789
  }
3729
3790
  }), l.push({
3730
3791
  id: `${e}-hist-neg`,
3731
3792
  type: "bar",
3732
3793
  visible: s,
3733
- data: { x: r, y: m },
3794
+ data: { x: r, y },
3734
3795
  style: {
3735
3796
  color: t.histogram.negativeColor ?? "#ef5350",
3736
3797
  opacity: t.histogram.opacity ?? 0.85,
3737
- ...v
3798
+ ...b
3738
3799
  }
3739
3800
  });
3740
3801
  }
3741
- if ((c = t.lines) != null && c.length)
3742
- for (let g = 0; g < t.lines.length; g++) {
3743
- const y = t.lines[g], m = y.id ?? `${e}-line-${g}`, b = N(y.y);
3744
- if (y.colorZones) {
3745
- Wi(l, m, r, b, y, t.lines, s, "zone");
3802
+ if ((d = t.lines) != null && d.length)
3803
+ for (let u = 0; u < t.lines.length; u++) {
3804
+ const g = t.lines[u], y = g.id ?? `${e}-line-${u}`, x = N(g.y);
3805
+ if (g.colorZones) {
3806
+ Hi(l, y, r, x, g, t.lines, s, "zone");
3746
3807
  continue;
3747
3808
  }
3748
3809
  l.push({
3749
- id: m,
3810
+ id: y,
3750
3811
  type: "line",
3751
3812
  visible: s,
3752
- data: { x: r, y: b },
3813
+ data: { x: r, y: x },
3753
3814
  style: {
3754
- color: y.color ?? (g === 0 ? "#00e5ff" : "#e040fb"),
3755
- width: y.width ?? 2,
3756
- opacity: y.opacity ?? 1
3815
+ color: g.color ?? (u === 0 ? "#00e5ff" : "#e040fb"),
3816
+ width: g.width ?? 2,
3817
+ opacity: g.opacity ?? 1
3757
3818
  }
3758
3819
  });
3759
3820
  }
3760
- const h = t.baseline ?? 0;
3761
- if (a >= 2 && l.push({
3762
- id: `${e}-baseline`,
3763
- type: "line",
3764
- visible: s,
3765
- data: {
3766
- x: Float32Array.from([r[0], r[a - 1]]),
3767
- y: Float32Array.from([h, h])
3768
- },
3769
- style: {
3770
- color: o.baselineColor,
3771
- width: o.baselineWidth,
3772
- lineDash: o.baselineDash,
3773
- opacity: 1
3774
- }
3775
- }), (f = t.referenceLines) != null && f.length)
3776
- for (let g = 0; g < t.referenceLines.length; g++) {
3777
- const y = t.referenceLines[g];
3821
+ if (t.baseline !== void 0 && a >= 2) {
3822
+ const u = t.baseline;
3823
+ l.push({
3824
+ id: `${e}-baseline`,
3825
+ type: "line",
3826
+ visible: s,
3827
+ data: {
3828
+ x: Float32Array.from([r[0], r[a - 1]]),
3829
+ y: Float32Array.from([u, u])
3830
+ },
3831
+ style: {
3832
+ color: o.baselineColor,
3833
+ width: o.baselineWidth,
3834
+ lineDash: o.baselineDash,
3835
+ opacity: 1
3836
+ }
3837
+ });
3838
+ }
3839
+ if ((c = t.referenceLines) != null && c.length)
3840
+ for (let u = 0; u < t.referenceLines.length; u++) {
3841
+ const g = t.referenceLines[u];
3778
3842
  l.push({
3779
- id: `${e}-ref-${g}`,
3843
+ id: `${e}-ref-${u}`,
3780
3844
  type: "line",
3781
3845
  visible: s,
3782
3846
  data: {
3783
3847
  x: Float32Array.from([r[0], r[a - 1]]),
3784
- y: Float32Array.from([y.y, y.y])
3848
+ y: Float32Array.from([g.y, g.y])
3785
3849
  },
3786
3850
  style: {
3787
- color: y.color ?? "rgba(255,255,255,0.2)",
3788
- width: y.width ?? 1,
3789
- lineDash: y.dash ?? [2, 4],
3851
+ color: g.color ?? "rgba(255,255,255,0.2)",
3852
+ width: g.width ?? 1,
3853
+ lineDash: g.dash ?? [2, 4],
3790
3854
  opacity: 0.8
3791
3855
  }
3792
3856
  });
3793
3857
  }
3794
- if ((u = t.markers) != null && u.length) {
3795
- const g = t.markers.filter((m) => m.kind === "peak"), y = t.markers.filter((m) => m.kind === "trough");
3796
- g.length && l.push({
3858
+ if ((f = t.markers) != null && f.length) {
3859
+ const u = t.markers.filter((y) => y.kind === "peak"), g = t.markers.filter((y) => y.kind === "trough");
3860
+ u.length && l.push({
3797
3861
  id: `${e}-peaks`,
3798
3862
  type: "scatter",
3799
3863
  visible: s,
3800
3864
  data: {
3801
- x: Float32Array.from(g.map((m) => m.x)),
3802
- y: Float32Array.from(g.map((m) => m.y))
3865
+ x: Float32Array.from(u.map((y) => y.x)),
3866
+ y: Float32Array.from(u.map((y) => y.y))
3803
3867
  },
3804
3868
  style: {
3805
3869
  color: o.peakColor,
3806
3870
  pointSize: o.peakSize,
3807
3871
  opacity: 1
3808
3872
  }
3809
- }), y.length && l.push({
3873
+ }), g.length && l.push({
3810
3874
  id: `${e}-troughs`,
3811
3875
  type: "scatter",
3812
3876
  visible: s,
3813
3877
  data: {
3814
- x: Float32Array.from(y.map((m) => m.x)),
3815
- y: Float32Array.from(y.map((m) => m.y))
3878
+ x: Float32Array.from(g.map((y) => y.x)),
3879
+ y: Float32Array.from(g.map((y) => y.y))
3816
3880
  },
3817
3881
  style: {
3818
3882
  color: o.troughColor,
@@ -3823,10 +3887,10 @@ function Se(i) {
3823
3887
  }
3824
3888
  return l;
3825
3889
  }
3826
- function Qn(i) {
3827
- return Se(i);
3890
+ function os(i) {
3891
+ return we(i);
3828
3892
  }
3829
- function Zn(i, e, t = 3) {
3893
+ function rs(i, e, t = 3) {
3830
3894
  const n = N(i), s = N(e), o = [], r = Math.max(1, t);
3831
3895
  for (let a = r; a < s.length - r; a++) {
3832
3896
  let l = !0, h = !0;
@@ -3836,37 +3900,83 @@ function Zn(i, e, t = 3) {
3836
3900
  }
3837
3901
  return o;
3838
3902
  }
3839
- function Ni(i) {
3840
- return i.type === "indicator" ? Se(i) : [i];
3841
- }
3842
- function Ui(i, e) {
3843
- for (const t of Ni(e))
3844
- Hi(i, t);
3903
+ function qi(i) {
3904
+ const e = i.close.length, t = new Float32Array(e), n = new Float32Array(e), s = new Float32Array(e), o = new Float32Array(e);
3905
+ for (let r = 0; r < e; r++) {
3906
+ const a = i.open[r], l = i.high[r], h = i.low[r], d = i.close[r];
3907
+ o[r] = (a + l + h + d) / 4, t[r] = r === 0 ? (a + d) / 2 : (t[r - 1] + o[r - 1]) / 2, n[r] = Math.max(l, t[r], o[r]), s[r] = Math.min(h, t[r], o[r]);
3908
+ }
3909
+ return { open: t, high: n, low: s, close: o };
3845
3910
  }
3846
- function Hi(i, e) {
3911
+ function Gi(i, e) {
3847
3912
  var n, s;
3848
- if (e.type !== "heatmap" && !((n = e.style) != null && n.color) && !e.color && i.colorScheme) {
3849
- const o = i.series.size, r = i.colorScheme.colors[o % i.colorScheme.colors.length];
3850
- e.style || (e.style = {}), e.style.color = r;
3913
+ if (e.type === "heatmap" || e.type === "indicator")
3914
+ return e;
3915
+ let t = { ...e };
3916
+ if (t.type === "heikin-ashi") {
3917
+ const o = t.data;
3918
+ if (o != null && o.open && o.high && o.low && o.close) {
3919
+ const r = qi({
3920
+ open: o.open,
3921
+ high: o.high,
3922
+ low: o.low,
3923
+ close: o.close
3924
+ });
3925
+ t = {
3926
+ ...t,
3927
+ type: "candlestick",
3928
+ data: { ...o, ...r }
3929
+ };
3930
+ }
3931
+ }
3932
+ if (je(i.xAxisOptions) && ((s = (n = t.data) == null ? void 0 : n.x) != null && s.length)) {
3933
+ const { displayX: o, mapping: r } = Ze(t.data.x, i.xAxisOptions);
3934
+ i.timeScaleMapping = r, t = {
3935
+ ...t,
3936
+ data: { ...t.data, x: o }
3937
+ };
3851
3938
  }
3852
- const t = new Ei(e);
3853
- i.series.set(t.getId(), t), he(i, t), (i.xAxisOptions.auto || Array.from(i.yAxisOptionsMap.values()).some((o) => o.auto)) && i.autoScale(!1), (s = i.updateLegend) == null || s.call(i), i.requestRender();
3939
+ return t;
3940
+ }
3941
+ function ji(i) {
3942
+ return i.type === "indicator" ? we(i) : [i];
3854
3943
  }
3855
- function qi(i, e) {
3944
+ function Zi(i, e) {
3945
+ for (const t of ji(e))
3946
+ Qi(i, t);
3947
+ }
3948
+ function Qi(i, e) {
3949
+ var s, o;
3950
+ const t = Gi(i, e);
3951
+ if (t.type !== "heatmap" && !((s = t.style) != null && s.color) && !t.color && i.colorScheme) {
3952
+ const r = i.series.size, a = i.colorScheme.colors[r % i.colorScheme.colors.length];
3953
+ t.style || (t.style = {}), t.style.color = a;
3954
+ }
3955
+ const n = new Di(t);
3956
+ i.series.set(n.getId(), n), ce(i, n), (i.xAxisOptions.auto || Array.from(i.yAxisOptionsMap.values()).some((r) => r.auto)) && i.autoScale(!1), (o = i.updateLegend) == null || o.call(i), i.requestRender();
3957
+ }
3958
+ function Ji(i, e) {
3856
3959
  var n;
3857
3960
  const t = i.series.get(e);
3858
3961
  t && (i.renderer.deleteBuffer(e), i.renderer.deleteBuffer(`${e}_step`), t.destroy(), i.series.delete(e), (n = i.updateLegend) == null || n.call(i), i.requestRender());
3859
3962
  }
3860
- function Gi(i, e, t) {
3963
+ function Ki(i, e, t) {
3861
3964
  const n = i.series.get(e);
3862
- n && (n.updateData(t), he(i, n), i.requestRender());
3965
+ if (n) {
3966
+ let s = t;
3967
+ if (t.x && je(i.xAxisOptions)) {
3968
+ const { displayX: o, mapping: r } = Ze(t.x, i.xAxisOptions);
3969
+ i.timeScaleMapping = r, s = { ...t, x: o };
3970
+ }
3971
+ n.updateData(s), ce(i, n), i.requestRender();
3972
+ }
3863
3973
  }
3864
- function ji(i, e, t, n) {
3974
+ function en(i, e, t, n) {
3865
3975
  var r;
3866
3976
  const s = i.series.get(e);
3867
3977
  if (!s) return;
3868
3978
  const o = ((r = s.getBounds()) == null ? void 0 : r.xMax) ?? -1 / 0;
3869
- if (s.updateData({ x: t, y: n, append: !0 }), he(i, s), i.autoScrollEnabled) {
3979
+ if (s.updateData({ x: t, y: n, append: !0 }), ce(i, s), i.autoScrollEnabled) {
3870
3980
  const a = s.getBounds();
3871
3981
  if (a) {
3872
3982
  const l = i.viewBounds.xMax - i.viewBounds.xMin;
@@ -3885,15 +3995,15 @@ function ji(i, e, t, n) {
3885
3995
  }
3886
3996
  i.requestRender();
3887
3997
  }
3888
- function Qi(i, e, t) {
3998
+ function tn(i, e, t) {
3889
3999
  const n = i.series.get(e);
3890
4000
  n && (n.setMaxPoints(t), i.requestRender());
3891
4001
  }
3892
4002
  class te {
3893
4003
  constructor() {
3894
- p(this, "domain", [0, 1]);
3895
- p(this, "range", [0, 100]);
3896
- p(this, "type", "linear");
4004
+ m(this, "domain", [0, 1]);
4005
+ m(this, "range", [0, 100]);
4006
+ m(this, "type", "linear");
3897
4007
  }
3898
4008
  setDomain(e, t) {
3899
4009
  if (!isFinite(e) || !isFinite(t)) {
@@ -3920,7 +4030,7 @@ class te {
3920
4030
  ticks(e = 10) {
3921
4031
  const [t, n] = this.domain;
3922
4032
  if (!isFinite(t) || !isFinite(n) || t === n) return [];
3923
- const s = Zi(t, n, e), o = Math.ceil(t / s) * s, r = [], a = 100;
4033
+ const s = nn(t, n, e), o = Math.ceil(t / s) * s, r = [], a = 100;
3924
4034
  let l = o;
3925
4035
  for (; l <= n + s * 0.5 && r.length < a; )
3926
4036
  r.push(Math.round(l * 1e12) / 1e12), l += s;
@@ -3929,10 +4039,10 @@ class te {
3929
4039
  }
3930
4040
  class ie {
3931
4041
  constructor() {
3932
- p(this, "domain", [1, 1e3]);
3933
- p(this, "range", [0, 100]);
3934
- p(this, "type", "log");
3935
- p(this, "base", 10);
4042
+ m(this, "domain", [1, 1e3]);
4043
+ m(this, "range", [0, 100]);
4044
+ m(this, "type", "log");
4045
+ m(this, "base", 10);
3936
4046
  }
3937
4047
  setDomain(e, t) {
3938
4048
  const n = Math.max(e, 1e-12), s = Math.max(t, 1e-12 * 10);
@@ -3964,14 +4074,14 @@ class ie {
3964
4074
  return r;
3965
4075
  }
3966
4076
  }
3967
- function Zi(i, e, t) {
4077
+ function nn(i, e, t) {
3968
4078
  const n = e - i;
3969
4079
  if (n <= 0 || !isFinite(n)) return 1;
3970
4080
  const s = n / t, o = Math.pow(10, Math.floor(Math.log10(s))), r = s / o;
3971
4081
  let a;
3972
4082
  return r < 1.5 ? a = 1 : r < 3 ? a = 2 : r < 7 ? a = 5 : a = 10, a * o;
3973
4083
  }
3974
- function Jn(i) {
4084
+ function as(i) {
3975
4085
  return i === "log" ? new ie() : new te();
3976
4086
  }
3977
4087
  const O = {
@@ -4040,7 +4150,7 @@ const O = {
4040
4150
  },
4041
4151
  autoMargins: !0
4042
4152
  };
4043
- function it(i) {
4153
+ function st(i) {
4044
4154
  var e;
4045
4155
  return i ? {
4046
4156
  title: { ...O.title, ...i.title },
@@ -4061,23 +4171,23 @@ function it(i) {
4061
4171
  autoMargins: i.autoMargins ?? O.autoMargins
4062
4172
  } : { ...O };
4063
4173
  }
4064
- function Ji(i, e) {
4174
+ function sn(i, e) {
4065
4175
  var M;
4066
4176
  if (!i) throw new Error("[SciPlot] Container element is required");
4067
- const t = e.devicePixelRatio ?? window.devicePixelRatio, n = it(e.layout), s = typeof e.theme == "string" ? Je(e.theme) : e.theme ?? Jt, o = _(e.background ?? s.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = _(s.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], h = e.showLegend ?? s.legend.visible, d = ((M = e.toolbar) == null ? void 0 : M.show) ?? e.showControls ?? !1, c = e.autoScroll ?? !1, f = e.showStatistics ?? !1, u = { scale: "linear", auto: !0, ...e.xAxis }, g = u.scale === "log" ? new ie() : new te(), y = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
4177
+ const t = e.devicePixelRatio ?? window.devicePixelRatio, n = st(e.layout), s = typeof e.theme == "string" ? et(e.theme) : e.theme ?? ti, o = _(e.background ?? s.backgroundColor), r = [o[0], o[1], o[2], o[3]], a = _(s.plotAreaBackground), l = [a[0], a[1], a[2], a[3]], h = e.showLegend ?? s.legend.visible, d = ((M = e.toolbar) == null ? void 0 : M.show) ?? e.showControls ?? !1, c = e.autoScroll ?? !1, f = e.showStatistics ?? !1, u = { scale: "linear", auto: !0, ...e.xAxis }, g = u.scale === "log" ? new ie() : new te(), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
4068
4178
  let b = "default";
4069
4179
  (e.yAxis ? Array.isArray(e.yAxis) ? e.yAxis : [e.yAxis] : [{}]).forEach((A, k) => {
4070
4180
  const B = k === 0, F = B ? "default" : `y${k}`, I = A.id || F;
4071
4181
  B && (b = I);
4072
- const H = { scale: "linear", auto: !0, position: A.position || (B ? "left" : "right"), ...A, id: I };
4073
- y.set(I, H), m.set(I, H.scale === "log" ? new ie() : new te());
4182
+ const U = { scale: "linear", auto: !0, position: A.position || (B ? "left" : "right"), ...A, id: I };
4183
+ y.set(I, U), x.set(I, U.scale === "log" ? new ie() : new te());
4074
4184
  }), i.style.position = "relative", i.style.overflow = "hidden", i.style.backgroundColor = e.background ?? s.backgroundColor;
4075
- const x = We("webgl"), S = We("overlay");
4185
+ const p = We("webgl"), v = We("overlay");
4076
4186
  for (; i.firstChild; )
4077
4187
  i.removeChild(i.firstChild);
4078
- i.appendChild(x), i.appendChild(S);
4079
- const w = S.getContext("2d");
4080
- if (!w) throw new Error("Failed to get 2D context");
4188
+ i.appendChild(p), i.appendChild(v);
4189
+ const S = v.getContext("2d");
4190
+ if (!S) throw new Error("Failed to get 2D context");
4081
4191
  return {
4082
4192
  theme: s,
4083
4193
  backgroundColor: r,
@@ -4090,11 +4200,11 @@ function Ji(i, e) {
4090
4200
  xAxisOptions: u,
4091
4201
  xScale: g,
4092
4202
  yAxisOptionsMap: y,
4093
- yScales: m,
4203
+ yScales: x,
4094
4204
  primaryYAxisId: b,
4095
- webglCanvas: x,
4096
- overlayCanvas: S,
4097
- overlayCtx: w,
4205
+ webglCanvas: p,
4206
+ overlayCanvas: v,
4207
+ overlayCtx: S,
4098
4208
  layout: n
4099
4209
  };
4100
4210
  }
@@ -4102,7 +4212,7 @@ function We(i) {
4102
4212
  const e = document.createElement("canvas");
4103
4213
  return e.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;", i === "overlay" && (e.style.pointerEvents = "none"), e;
4104
4214
  }
4105
- function Ki(i, e, t) {
4215
+ function on(i, e, t) {
4106
4216
  const n = i.getBoundingClientRect(), s = 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) || ae, a = (r.left ?? ae.left) + Math.max(0, s - 1) * 65, l = (r.right ?? ae.right) + o * 65, h = r.top ?? ae.top, d = r.bottom ?? ae.bottom;
4107
4217
  return {
4108
4218
  x: a,
@@ -4111,7 +4221,7 @@ function Ki(i, e, t) {
4111
4221
  height: Math.max(1, n.height - h - d)
4112
4222
  };
4113
4223
  }
4114
- function en(i) {
4224
+ function rn(i) {
4115
4225
  const e = [];
4116
4226
  let t = 0, n = 0;
4117
4227
  return i.forEach((s, o) => {
@@ -4119,7 +4229,7 @@ function en(i) {
4119
4229
  r === "left" ? t++ : n++, e.push({ id: o, position: r, offset: a });
4120
4230
  }), e;
4121
4231
  }
4122
- function tn(i, e, t, n, s) {
4232
+ function an(i, e, t, n, s) {
4123
4233
  const o = i.getBoundingClientRect();
4124
4234
  if (o.width === 0 || o.height === 0) return !1;
4125
4235
  const r = Math.max(1, Math.round(o.width * s)), a = Math.max(1, Math.round(o.height * s)), l = `${Math.round(o.width)}px`, h = `${Math.round(o.height)}px`;
@@ -4127,10 +4237,10 @@ function tn(i, e, t, n, s) {
4127
4237
  c.width = r, c.height = a, c.style.width = l, c.style.height = h;
4128
4238
  }), n.setTransform(s, 0, 0, s, 0, 0), n.imageSmoothingEnabled = !0, "imageSmoothingQuality" in n && (n.imageSmoothingQuality = "high"), !0);
4129
4239
  }
4130
- class nn {
4240
+ class ln {
4131
4241
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4132
4242
  constructor(e) {
4133
- p(this, "data", /* @__PURE__ */ new Map());
4243
+ m(this, "data", /* @__PURE__ */ new Map());
4134
4244
  }
4135
4245
  get(e) {
4136
4246
  return this.data.get(e);
@@ -4161,10 +4271,10 @@ class nn {
4161
4271
  });
4162
4272
  }
4163
4273
  }
4164
- class sn {
4274
+ class hn {
4165
4275
  constructor(e, t = !0) {
4166
- p(this, "prefix");
4167
- p(this, "enabled");
4276
+ m(this, "prefix");
4277
+ m(this, "enabled");
4168
4278
  this.prefix = `[SciPlot:${e}]`, this.enabled = t;
4169
4279
  }
4170
4280
  debug(e, ...t) {
@@ -4180,11 +4290,11 @@ class sn {
4180
4290
  console.error(this.prefix, e, ...t);
4181
4291
  }
4182
4292
  }
4183
- class on {
4293
+ class cn {
4184
4294
  constructor(e) {
4185
- p(this, "chart");
4186
- p(this, "subscriptions", []);
4187
- p(this, "customListeners", /* @__PURE__ */ new Map());
4295
+ m(this, "chart");
4296
+ m(this, "subscriptions", []);
4297
+ m(this, "customListeners", /* @__PURE__ */ new Map());
4188
4298
  this.chart = e;
4189
4299
  }
4190
4300
  on(e, t) {
@@ -4219,12 +4329,12 @@ class on {
4219
4329
  this.subscriptions.forEach((e) => e()), this.subscriptions = [], this.customListeners.clear();
4220
4330
  }
4221
4331
  }
4222
- class rn {
4332
+ class un {
4223
4333
  constructor(e, t) {
4224
- p(this, "_container");
4225
- p(this, "_theme");
4226
- p(this, "overlays", /* @__PURE__ */ new Map());
4227
- p(this, "notifications", null);
4334
+ m(this, "_container");
4335
+ m(this, "_theme");
4336
+ m(this, "overlays", /* @__PURE__ */ new Map());
4337
+ m(this, "notifications", null);
4228
4338
  this._container = e, this._theme = t;
4229
4339
  }
4230
4340
  get container() {
@@ -4306,8 +4416,8 @@ class rn {
4306
4416
  this.overlays.forEach((t) => t.remove()), this.overlays.clear(), (e = this.notifications) == null || e.remove(), this.notifications = null;
4307
4417
  }
4308
4418
  }
4309
- function an(i, e) {
4310
- const t = new nn(i), n = new sn(i), s = new on(e.chart), o = new rn(e.container, e.theme), r = {
4419
+ function dn(i, e) {
4420
+ const t = new ln(i), n = new hn(i), s = new cn(e.chart), o = new un(e.container, e.theme), r = {
4311
4421
  get gl() {
4312
4422
  var c;
4313
4423
  return (c = e.getGL) == null ? void 0 : c.call(e);
@@ -4378,26 +4488,26 @@ function an(i, e) {
4378
4488
  }
4379
4489
  };
4380
4490
  }
4381
- class ln {
4491
+ class fn {
4382
4492
  constructor(e) {
4383
- p(this, "plugins", /* @__PURE__ */ new Map());
4384
- p(this, "deps");
4385
- p(this, "destroyed", !1);
4493
+ m(this, "plugins", /* @__PURE__ */ new Map());
4494
+ m(this, "deps");
4495
+ m(this, "destroyed", !1);
4386
4496
  // Hook caches for performance
4387
- p(this, "hooksBeforeRender", []);
4388
- p(this, "hooksAfterRender", []);
4389
- p(this, "hooksRenderWebGL", []);
4390
- p(this, "hooksRenderOverlay", []);
4391
- p(this, "hooksInteraction", []);
4392
- p(this, "hooksViewChange", []);
4393
- p(this, "hooksDataUpdate", []);
4394
- p(this, "hooksSeriesAdd", []);
4395
- p(this, "hooksSeriesRemove", []);
4396
- p(this, "hooksSeriesChange", []);
4397
- p(this, "hooksResize", []);
4398
- p(this, "hooksThemeChange", []);
4399
- p(this, "hooksSelectionChange", []);
4400
- p(this, "hooksSerialize", []);
4497
+ m(this, "hooksBeforeRender", []);
4498
+ m(this, "hooksAfterRender", []);
4499
+ m(this, "hooksRenderWebGL", []);
4500
+ m(this, "hooksRenderOverlay", []);
4501
+ m(this, "hooksInteraction", []);
4502
+ m(this, "hooksViewChange", []);
4503
+ m(this, "hooksDataUpdate", []);
4504
+ m(this, "hooksSeriesAdd", []);
4505
+ m(this, "hooksSeriesRemove", []);
4506
+ m(this, "hooksSeriesChange", []);
4507
+ m(this, "hooksResize", []);
4508
+ m(this, "hooksThemeChange", []);
4509
+ m(this, "hooksSelectionChange", []);
4510
+ m(this, "hooksSerialize", []);
4401
4511
  this.deps = e;
4402
4512
  }
4403
4513
  /**
@@ -4421,7 +4531,7 @@ class ln {
4421
4531
  );
4422
4532
  return;
4423
4533
  }
4424
- const r = an(s, {
4534
+ const r = dn(s, {
4425
4535
  ...this.deps,
4426
4536
  getPlugin: (h) => this.get(h)
4427
4537
  }), a = {
@@ -4817,20 +4927,20 @@ const E = {
4817
4927
  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>',
4818
4928
  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>'
4819
4929
  };
4820
- class hn {
4930
+ class gn {
4821
4931
  constructor(e, t, n, s) {
4822
- p(this, "container");
4823
- p(this, "toolbar");
4824
- p(this, "buttonsWrapper");
4825
- p(this, "callbacks");
4826
- p(this, "theme");
4827
- p(this, "options");
4828
- p(this, "isSmoothing", !1);
4829
- p(this, "currentMode", "pan");
4830
- p(this, "isLegendVisible", !0);
4831
- p(this, "currentType", "line");
4832
- p(this, "isPinned", !1);
4833
- p(this, "isExpanded", !1);
4932
+ m(this, "container");
4933
+ m(this, "toolbar");
4934
+ m(this, "buttonsWrapper");
4935
+ m(this, "callbacks");
4936
+ m(this, "theme");
4937
+ m(this, "options");
4938
+ m(this, "isSmoothing", !1);
4939
+ m(this, "currentMode", "pan");
4940
+ m(this, "isLegendVisible", !0);
4941
+ m(this, "currentType", "line");
4942
+ m(this, "isPinned", !1);
4943
+ m(this, "isExpanded", !1);
4834
4944
  this.callbacks = n, this.theme = t, this.options = s || {}, this.isPinned = this.options.pinnable === !1, this.isExpanded = this.isPinned, this.callbacks = n, this.theme = t, this.container = document.createElement("div"), this.container.style.cssText = `
4835
4945
  position: absolute;
4836
4946
  top: 2px;
@@ -5032,21 +5142,21 @@ class hn {
5032
5142
  this.container.remove();
5033
5143
  }
5034
5144
  }
5035
- class cn {
5145
+ class yn {
5036
5146
  constructor(e, t, n, s) {
5037
- p(this, "container");
5038
- p(this, "visualContainer");
5039
- p(this, "header");
5040
- p(this, "content");
5041
- p(this, "theme");
5042
- p(this, "series", []);
5043
- p(this, "callbacks");
5044
- p(this, "swatchCanvases", /* @__PURE__ */ new Map());
5045
- p(this, "options");
5046
- p(this, "isDragging", !1);
5047
- p(this, "isResizing", !1);
5048
- p(this, "dragOffsetX", 0);
5049
- p(this, "dragOffsetY", 0);
5147
+ m(this, "container");
5148
+ m(this, "visualContainer");
5149
+ m(this, "header");
5150
+ m(this, "content");
5151
+ m(this, "theme");
5152
+ m(this, "series", []);
5153
+ m(this, "callbacks");
5154
+ m(this, "swatchCanvases", /* @__PURE__ */ new Map());
5155
+ m(this, "options");
5156
+ m(this, "isDragging", !1);
5157
+ m(this, "isResizing", !1);
5158
+ m(this, "dragOffsetX", 0);
5159
+ m(this, "dragOffsetY", 0);
5050
5160
  this.theme = t, this.callbacks = s, this.options = {
5051
5161
  x: n.x ?? e.clientWidth - 150,
5052
5162
  y: n.y ?? 55,
@@ -5203,16 +5313,16 @@ class cn {
5203
5313
  r.clearRect(0, 0, e.width, e.height), r.scale(s, s);
5204
5314
  const a = t.getStyle(), l = t.isVisible(), h = l ? a.color || "#ff0055" : "#888888", d = t.getType(), c = a.symbol || "circle";
5205
5315
  r.fillStyle = h, r.strokeStyle = h, r.globalAlpha = l ? 1 : 0.6, r.lineWidth = 2;
5206
- const f = o / 2, u = o / 2, g = String(d).toLowerCase(), y = g === "scatter" || g === "1" || g === "line" && !!a.symbol, m = g.includes("scatter") || g === "2", b = g === "area" || g === "band";
5316
+ const f = o / 2, u = o / 2, g = String(d).toLowerCase(), y = g === "scatter" || g === "1" || g === "line" && !!a.symbol, x = g.includes("scatter") || g === "2", b = g === "area" || g === "band";
5207
5317
  if (y)
5208
5318
  this.drawSymbol(r, c, f, u, o * 0.8);
5209
- else if (m)
5319
+ else if (x)
5210
5320
  r.beginPath(), r.moveTo(0, u), r.lineTo(o, u), r.stroke(), this.drawSymbol(r, c, f, u, o * 0.6);
5211
5321
  else if (b)
5212
5322
  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);
5213
5323
  else if (g === "candlestick") {
5214
- const v = a.bullishColor || "#26a69a";
5215
- 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();
5324
+ const w = a.bullishColor || "#26a69a";
5325
+ r.fillStyle = w, 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 = w, r.stroke();
5216
5326
  } else
5217
5327
  r.beginPath(), r.moveTo(0, u), r.lineTo(o, u), r.stroke();
5218
5328
  }
@@ -5265,10 +5375,10 @@ class cn {
5265
5375
  e.fillStyle = f ? n.backgroundColor : "rgba(255, 255, 255, 0.85)", e.strokeStyle = n.borderColor, e.lineWidth = 1 * t;
5266
5376
  const u = n.borderRadius * t;
5267
5377
  e.beginPath(), e.moveTo(l + u, h), e.lineTo(l + d - u, h), e.arcTo(l + d, h, l + d, h + u, u), e.lineTo(l + d, h + c - u), e.arcTo(l + d, h + c, l + d - u, h + c, u), e.lineTo(l + u, h + c), e.arcTo(l, h + c, l, h + c - u, u), e.lineTo(l, h + u), e.arcTo(l, h, l + u, h, u), e.closePath(), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "middle", e.font = `${n.fontSize * t}px ${n.fontFamily}`, this.series.forEach((g, y) => {
5268
- const m = h + a + s + y * (r + o) + r / 2, b = l + s + r / 2, v = m, x = g.getStyle(), S = g.getType(), w = x.symbol || "circle";
5269
- e.fillStyle = x.color || "#ff0055", e.strokeStyle = x.color || "#ff0055", e.lineWidth = 2 * t;
5270
- const M = String(S).toLowerCase(), A = M === "scatter" || M === "1" || M === "line" && !!x.symbol, k = M.includes("scatter") || M === "2";
5271
- A ? this.drawSymbol(e, w, b, v, r * 0.9) : k ? (e.beginPath(), e.moveTo(l + s, v), e.lineTo(l + s + r, v), e.stroke(), this.drawSymbol(e, w, b, v, r * 0.6)) : (e.beginPath(), e.moveTo(l + s, v), e.lineTo(l + s + r, v), e.stroke()), e.fillStyle = n.textColor, e.fillText(g.getName(), l + s + r + 8 * t, m);
5378
+ const x = h + a + s + y * (r + o) + r / 2, b = l + s + r / 2, w = x, p = g.getStyle(), v = g.getType(), S = p.symbol || "circle";
5379
+ e.fillStyle = p.color || "#ff0055", e.strokeStyle = p.color || "#ff0055", e.lineWidth = 2 * t;
5380
+ const M = String(v).toLowerCase(), A = M === "scatter" || M === "1" || M === "line" && !!p.symbol, k = M.includes("scatter") || M === "2";
5381
+ A ? this.drawSymbol(e, S, b, w, r * 0.9) : k ? (e.beginPath(), e.moveTo(l + s, w), e.lineTo(l + s + r, w), e.stroke(), this.drawSymbol(e, S, b, w, r * 0.6)) : (e.beginPath(), e.moveTo(l + s, w), e.lineTo(l + s + r, w), e.stroke()), e.fillStyle = n.textColor, e.fillText(g.getName(), l + s + r + 8 * t, x);
5272
5382
  }), e.restore();
5273
5383
  }
5274
5384
  updateTheme(e) {
@@ -5284,8 +5394,8 @@ class cn {
5284
5394
  this.container.remove();
5285
5395
  }
5286
5396
  }
5287
- function un(i) {
5288
- return i.showControls ? new hn(i.container, i.theme, {
5397
+ function mn(i) {
5398
+ return i.showControls ? new gn(i.container, i.theme, {
5289
5399
  onResetZoom: () => i.resetZoom(),
5290
5400
  onSetType: (e) => {
5291
5401
  i.series.forEach((t) => {
@@ -5324,14 +5434,14 @@ function un(i) {
5324
5434
  }
5325
5435
  }, i.toolbar) : null;
5326
5436
  }
5327
- function dn(i, e) {
5437
+ function pn(i, e) {
5328
5438
  var s, o, r, a, l, h;
5329
5439
  if (!i.showLegend) return null;
5330
5440
  const t = {
5331
5441
  ...e.legendPosition,
5332
5442
  highlightOnHover: ((s = i.legendOptions) == null ? void 0 : s.highlightOnHover) ?? ((r = (o = e.layout) == null ? void 0 : o.legend) == null ? void 0 : r.highlightOnHover) ?? !1,
5333
5443
  bringToFrontOnHover: ((a = i.legendOptions) == null ? void 0 : a.bringToFrontOnHover) ?? ((h = (l = e.layout) == null ? void 0 : l.legend) == null ? void 0 : h.bringToFrontOnHover) ?? !0
5334
- }, n = new cn(
5444
+ }, n = new yn(
5335
5445
  i.container,
5336
5446
  i.theme,
5337
5447
  t,
@@ -5369,15 +5479,15 @@ function dn(i, e) {
5369
5479
  );
5370
5480
  return n.update(Array.from(i.series.values())), n;
5371
5481
  }
5372
- class fn {
5482
+ class xn {
5373
5483
  constructor() {
5374
- p(this, "queue", []);
5375
- p(this, "isProcessing", !1);
5376
- p(this, "completedCount", 0);
5377
- p(this, "currentChartId", null);
5378
- p(this, "idCounter", 0);
5484
+ m(this, "queue", []);
5485
+ m(this, "isProcessing", !1);
5486
+ m(this, "completedCount", 0);
5487
+ m(this, "currentChartId", null);
5488
+ m(this, "idCounter", 0);
5379
5489
  // Delay between chart initializations (ms)
5380
- p(this, "INIT_DELAY", 30);
5490
+ m(this, "INIT_DELAY", 30);
5381
5491
  }
5382
5492
  /**
5383
5493
  * Generate a unique chart ID
@@ -5441,17 +5551,17 @@ class fn {
5441
5551
  this.clear(), this.completedCount = 0, this.idCounter = 0;
5442
5552
  }
5443
5553
  }
5444
- const Z = new fn();
5445
- function gn() {
5446
- return Z.enqueue();
5554
+ const Q = new xn();
5555
+ function bn() {
5556
+ return Q.enqueue();
5447
5557
  }
5448
5558
  function Ie(i) {
5449
- Z.markComplete(i);
5559
+ Q.markComplete(i);
5450
5560
  }
5451
- function Kn() {
5452
- return Z.getStatus();
5561
+ function ls() {
5562
+ return Q.getStatus();
5453
5563
  }
5454
- class yn {
5564
+ class vn {
5455
5565
  static getStatus() {
5456
5566
  return this.instance.getStatus();
5457
5567
  }
@@ -5459,23 +5569,23 @@ class yn {
5459
5569
  this.instance.reset();
5460
5570
  }
5461
5571
  }
5462
- p(yn, "instance", Z);
5463
- function es() {
5572
+ m(vn, "instance", Q);
5573
+ function hs() {
5464
5574
  return {
5465
- getStatus: () => Z.getStatus(),
5466
- reset: () => Z.reset()
5575
+ getStatus: () => Q.getStatus(),
5576
+ reset: () => Q.reset()
5467
5577
  };
5468
5578
  }
5469
- async function ts(i, e) {
5579
+ async function cs(i, e) {
5470
5580
  await e();
5471
5581
  }
5472
- function is(i = 200) {
5582
+ function us(i = 200) {
5473
5583
  return new Promise((e) => setTimeout(e, i));
5474
5584
  }
5475
- function ns() {
5476
- Z.reset();
5585
+ function ds() {
5586
+ Q.reset();
5477
5587
  }
5478
- class mn {
5588
+ class wn {
5479
5589
  constructor(e) {
5480
5590
  this.pluginManager = e;
5481
5591
  }
@@ -5606,7 +5716,7 @@ class mn {
5606
5716
  return this.pluginManager.getNames();
5607
5717
  }
5608
5718
  }
5609
- class pn {
5719
+ class Sn {
5610
5720
  constructor(e) {
5611
5721
  this.ctx = e;
5612
5722
  }
@@ -5707,7 +5817,7 @@ class pn {
5707
5817
  return this.ctx.yScales;
5708
5818
  }
5709
5819
  }
5710
- const nt = 1;
5820
+ const ot = 1;
5711
5821
  function Xe(i) {
5712
5822
  const e = i instanceof Float32Array ? i : new Float32Array(i), t = new Uint8Array(e.buffer);
5713
5823
  let n = "";
@@ -5721,7 +5831,7 @@ function Ne(i) {
5721
5831
  t[n] = e.charCodeAt(n);
5722
5832
  return new Float32Array(t.buffer);
5723
5833
  }
5724
- function xn(i) {
5834
+ function Mn(i) {
5725
5835
  try {
5726
5836
  new TextEncoder().encode(i);
5727
5837
  let t = "";
@@ -5736,7 +5846,7 @@ function xn(i) {
5736
5846
  return btoa(i);
5737
5847
  }
5738
5848
  }
5739
- function bn(i) {
5849
+ function Cn(i) {
5740
5850
  try {
5741
5851
  const e = atob(i);
5742
5852
  let t = "";
@@ -5751,28 +5861,28 @@ function bn(i) {
5751
5861
  return atob(i);
5752
5862
  }
5753
5863
  }
5754
- function vn(i, e = !0) {
5864
+ function An(i, e = !0) {
5755
5865
  const t = JSON.stringify(i);
5756
- return e ? xn(t) : btoa(t);
5866
+ return e ? Mn(t) : btoa(t);
5757
5867
  }
5758
- function Sn(i, e = !0) {
5868
+ function Pn(i, e = !0) {
5759
5869
  try {
5760
- const t = e ? bn(i) : atob(i), n = JSON.parse(t);
5761
- return typeof n.version != "number" ? (console.warn("[SciPlot] Invalid state: missing version"), null) : (n.version > nt && console.warn("[SciPlot] State version is newer than supported"), n);
5870
+ const t = e ? Cn(i) : atob(i), n = JSON.parse(t);
5871
+ return typeof n.version != "number" ? (console.warn("[SciPlot] Invalid state: missing version"), null) : (n.version > ot && console.warn("[SciPlot] State version is newer than supported"), n);
5762
5872
  } catch (t) {
5763
5873
  return console.error("[SciPlot] Failed to parse URL hash:", t), null;
5764
5874
  }
5765
5875
  }
5766
- function ss(i) {
5876
+ function fs(i) {
5767
5877
  if (!i || typeof i != "object") return !1;
5768
5878
  const e = i;
5769
5879
  return !(typeof e.version != "number" || !e.viewBounds || typeof e.viewBounds != "object" || !Array.isArray(e.series));
5770
5880
  }
5771
- class os {
5881
+ class gs {
5772
5882
  constructor(e = 50) {
5773
- p(this, "history", []);
5774
- p(this, "currentIndex", -1);
5775
- p(this, "maxSize");
5883
+ m(this, "history", []);
5884
+ m(this, "currentIndex", -1);
5885
+ m(this, "maxSize");
5776
5886
  this.maxSize = e;
5777
5887
  }
5778
5888
  /**
@@ -5824,7 +5934,7 @@ class os {
5824
5934
  return this.history.length;
5825
5935
  }
5826
5936
  }
5827
- class wn {
5937
+ class kn {
5828
5938
  constructor(e) {
5829
5939
  this.ctx = e;
5830
5940
  }
@@ -5834,7 +5944,7 @@ class wn {
5834
5944
  serialize(e = {}) {
5835
5945
  const { includeData: t = !0, includeAnnotations: n = !0 } = e;
5836
5946
  return {
5837
- version: nt,
5947
+ version: ot,
5838
5948
  timestamp: Date.now(),
5839
5949
  viewBounds: { ...this.ctx.viewBounds },
5840
5950
  xAxis: {
@@ -5924,17 +6034,17 @@ class wn {
5924
6034
  * Convert current state to URL-safe hash
5925
6035
  */
5926
6036
  toUrlHash(e = !0) {
5927
- return vn(this.serialize({ includeData: !0 }), e);
6037
+ return An(this.serialize({ includeData: !0 }), e);
5928
6038
  }
5929
6039
  /**
5930
6040
  * Load state from URL hash
5931
6041
  */
5932
6042
  fromUrlHash(e, t = !0) {
5933
- const n = Sn(e, t);
6043
+ const n = Pn(e, t);
5934
6044
  n && this.deserialize(n);
5935
6045
  }
5936
6046
  }
5937
- function Mn(i, e, t, n) {
6047
+ function Bn(i, e, t, n) {
5938
6048
  const { value: s, min: o, max: r } = e, {
5939
6049
  needleColor: a = "#333",
5940
6050
  needleWidth: l = 3,
@@ -5945,27 +6055,27 @@ function Mn(i, e, t, n) {
5945
6055
  showValue: u = !0,
5946
6056
  valueColor: g = "#fff",
5947
6057
  valueSize: y = 24,
5948
- label: m
5949
- } = t, b = n.x + n.width / 2, v = n.y + n.height / 2, x = Math.min(n.width, n.height) / 2 * d, S = f - c, w = Math.max(0, Math.min(1, (s - o) / (r - o))), M = (c + w * S) * (Math.PI / 180);
5950
- i.save(), i.beginPath(), i.arc(b, v, x, c * (Math.PI / 180), f * (Math.PI / 180)), i.strokeStyle = "rgba(255, 255, 255, 0.1)", i.lineWidth = x * 0.2, i.lineCap = "round", i.stroke();
6058
+ label: x
6059
+ } = t, b = n.x + n.width / 2, w = n.y + n.height / 2, p = Math.min(n.width, n.height) / 2 * d, v = f - c, S = Math.max(0, Math.min(1, (s - o) / (r - o))), M = (c + S * v) * (Math.PI / 180);
6060
+ i.save(), i.beginPath(), i.arc(b, w, p, c * (Math.PI / 180), f * (Math.PI / 180)), i.strokeStyle = "rgba(255, 255, 255, 0.1)", i.lineWidth = p * 0.2, i.lineCap = "round", i.stroke();
5951
6061
  for (const k of h) {
5952
6062
  const B = Math.max(0, Math.min(1, (k.from - o) / (r - o))), F = Math.max(0, Math.min(1, (k.to - o) / (r - o)));
5953
6063
  i.beginPath(), i.arc(
5954
6064
  b,
5955
- v,
5956
- x,
5957
- (c + B * S) * (Math.PI / 180),
5958
- (c + F * S) * (Math.PI / 180)
5959
- ), i.strokeStyle = k.color, i.lineWidth = x * 0.2, i.stroke();
6065
+ w,
6066
+ p,
6067
+ (c + B * v) * (Math.PI / 180),
6068
+ (c + F * v) * (Math.PI / 180)
6069
+ ), i.strokeStyle = k.color, i.lineWidth = p * 0.2, i.stroke();
5960
6070
  }
5961
6071
  const A = 11;
5962
6072
  for (let k = 0; k < A; k++) {
5963
- const B = (c + k / (A - 1) * S) * (Math.PI / 180), F = x * 0.85, I = x * 0.95;
5964
- i.beginPath(), i.moveTo(b + F * Math.cos(B), v + F * Math.sin(B)), i.lineTo(b + I * Math.cos(B), v + I * Math.sin(B)), i.strokeStyle = "rgba(255, 255, 255, 0.5)", i.lineWidth = 2, i.stroke();
6073
+ const B = (c + k / (A - 1) * v) * (Math.PI / 180), F = p * 0.85, I = p * 0.95;
6074
+ i.beginPath(), i.moveTo(b + F * Math.cos(B), w + F * Math.sin(B)), i.lineTo(b + I * Math.cos(B), w + I * Math.sin(B)), i.strokeStyle = "rgba(255, 255, 255, 0.5)", i.lineWidth = 2, i.stroke();
5965
6075
  }
5966
- i.beginPath(), i.moveTo(b, v), i.lineTo(b + x * 0.9 * Math.cos(M), v + x * 0.9 * Math.sin(M)), i.strokeStyle = a, i.lineWidth = l, i.lineCap = "round", i.shadowColor = a, i.shadowBlur = 10, i.stroke(), i.shadowBlur = 0, i.beginPath(), i.arc(b, v, 8, 0, Math.PI * 2), i.fillStyle = a, i.fill(), i.strokeStyle = "#fff", i.lineWidth = 2, i.stroke(), u && (i.textAlign = "center", i.textBaseline = "middle", i.font = `bold ${y}px Inter, sans-serif`, i.fillStyle = g, i.fillText(s.toFixed(1), b, v + x * 0.4), m && (i.font = `${y * 0.5}px Inter, sans-serif`, i.fillStyle = "rgba(255, 255, 255, 0.6)", i.fillText(m, b, v + x * 0.6))), i.restore();
6076
+ i.beginPath(), i.moveTo(b, w), i.lineTo(b + p * 0.9 * Math.cos(M), w + p * 0.9 * Math.sin(M)), i.strokeStyle = a, i.lineWidth = l, i.lineCap = "round", i.shadowColor = a, i.shadowBlur = 10, i.stroke(), i.shadowBlur = 0, i.beginPath(), i.arc(b, w, 8, 0, Math.PI * 2), i.fillStyle = a, i.fill(), i.strokeStyle = "#fff", i.lineWidth = 2, i.stroke(), u && (i.textAlign = "center", i.textBaseline = "middle", i.font = `bold ${y}px Inter, sans-serif`, i.fillStyle = g, i.fillText(s.toFixed(1), b, w + p * 0.4), x && (i.font = `${y * 0.5}px Inter, sans-serif`, i.fillStyle = "rgba(255, 255, 255, 0.6)", i.fillText(x, b, w + p * 0.6))), i.restore();
5967
6077
  }
5968
- function Cn(i, e, t, n) {
6078
+ function Tn(i, e, t, n) {
5969
6079
  const { nodes: s, links: o } = e, {
5970
6080
  nodeWidth: r = 18,
5971
6081
  nodePadding: a = 12,
@@ -5979,42 +6089,42 @@ function Cn(i, e, t, n) {
5979
6089
  y: n.y + y,
5980
6090
  width: f,
5981
6091
  height: u
5982
- }, v = /* @__PURE__ */ new Set();
6092
+ }, w = /* @__PURE__ */ new Set();
5983
6093
  o.forEach((C) => {
5984
- v.add(C.source), v.add(C.target);
6094
+ w.add(C.source), w.add(C.target);
5985
6095
  });
5986
- const x = Array.from(v), S = /* @__PURE__ */ new Map(), w = new Set(o.map((C) => C.target));
5987
- x.filter((C) => !w.has(C)).forEach((C) => S.set(C, 0));
6096
+ const p = Array.from(w), v = /* @__PURE__ */ new Map(), S = new Set(o.map((C) => C.target));
6097
+ p.filter((C) => !S.has(C)).forEach((C) => v.set(C, 0));
5988
6098
  let A = !0;
5989
6099
  for (; A; )
5990
6100
  A = !1, o.forEach((C) => {
5991
- const T = S.get(C.source);
6101
+ const T = v.get(C.source);
5992
6102
  if (T !== void 0) {
5993
- const R = S.get(C.target), D = T + 1;
5994
- (R === void 0 || D > R) && (S.set(C.target, D), A = !0);
6103
+ const R = v.get(C.target), D = T + 1;
6104
+ (R === void 0 || D > R) && (v.set(C.target, D), A = !0);
5995
6105
  }
5996
6106
  });
5997
- x.forEach((C) => {
5998
- S.get(C) === void 0 && S.set(C, 0);
6107
+ p.forEach((C) => {
6108
+ v.get(C) === void 0 && v.set(C, 0);
5999
6109
  });
6000
- const k = Math.max(...Array.from(S.values())), B = Array.from({ length: k + 1 }, () => []);
6001
- x.forEach((C) => B[S.get(C)].push(C));
6110
+ const k = Math.max(...Array.from(v.values())), B = Array.from({ length: k + 1 }, () => []);
6111
+ p.forEach((C) => B[v.get(C)].push(C));
6002
6112
  const F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
6003
6113
  o.forEach((C) => {
6004
6114
  I.set(C.source, (I.get(C.source) || 0) + C.value), F.set(C.target, (F.get(C.target) || 0) + C.value);
6005
6115
  });
6006
- const de = (C) => Math.max(F.get(C) || 0, I.get(C) || 0);
6007
- let H = 0;
6116
+ const fe = (C) => Math.max(F.get(C) || 0, I.get(C) || 0);
6117
+ let U = 0;
6008
6118
  B.forEach((C) => {
6009
6119
  let T = 0;
6010
- C.forEach((R) => T += de(R)), T > H && (H = T);
6120
+ C.forEach((R) => T += fe(R)), T > U && (U = T);
6011
6121
  });
6012
- const ne = /* @__PURE__ */ new Map(), rt = B.length, at = (b.width - r) / Math.max(1, rt - 1);
6122
+ const ne = /* @__PURE__ */ new Map(), lt = B.length, ht = (b.width - r) / Math.max(1, lt - 1);
6013
6123
  B.forEach((C, T) => {
6014
- const R = b.x + T * at, D = [];
6124
+ const R = b.x + T * ht, D = [];
6015
6125
  let q = 0;
6016
6126
  C.forEach((V) => {
6017
- const L = de(V), $ = H > 0 ? L / H * (b.height * 0.9) : 20;
6127
+ const L = fe(V), $ = U > 0 ? L / U * (b.height * 0.9) : 20;
6018
6128
  D.push($), q += $;
6019
6129
  });
6020
6130
  const se = (C.length - 1) * a, oe = q + se;
@@ -6026,15 +6136,15 @@ function Cn(i, e, t, n) {
6026
6136
  const z = s.find((K) => K.id === V);
6027
6137
  z != null && z.color && (J = z.color);
6028
6138
  }
6029
- ne.set(V, { x: R, y: re, width: r, height: $, color: J, value: de(V) }), re += $ + a;
6139
+ ne.set(V, { x: R, y: re, width: r, height: $, color: J, value: fe(V) }), re += $ + a;
6030
6140
  });
6031
6141
  }), i.save();
6032
6142
  const Fe = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ new Map();
6033
6143
  o.forEach((C) => {
6034
6144
  const T = ne.get(C.source), R = ne.get(C.target);
6035
6145
  if (!T || !R) return;
6036
- const D = Fe.get(C.source) || 0, q = De.get(C.target) || 0, se = I.get(C.source) || 1, oe = F.get(C.target) || 1, re = C.value / se * T.height, V = C.value / oe * R.height, L = T.x + T.width, $ = T.y + D, J = $ + re, z = R.x, K = R.y + q, we = K + V, fe = (z - L) * 0.5, Me = i.createLinearGradient(L, ($ + J) / 2, z, (K + we) / 2);
6037
- Me.addColorStop(0, T.color), Me.addColorStop(1, R.color), i.beginPath(), i.moveTo(L, $), i.bezierCurveTo(L + fe, $, z - fe, K, z, K), i.lineTo(z, we), i.bezierCurveTo(z - fe, we, L + fe, J, L, J), i.closePath(), i.fillStyle = Me, i.globalAlpha = h, i.fill(), i.strokeStyle = T.color, i.globalAlpha = h * 0.3, i.lineWidth = 0.5, i.stroke(), Fe.set(C.source, D + re), De.set(C.target, q + V);
6146
+ const D = Fe.get(C.source) || 0, q = De.get(C.target) || 0, se = I.get(C.source) || 1, oe = F.get(C.target) || 1, re = C.value / se * T.height, V = C.value / oe * R.height, L = T.x + T.width, $ = T.y + D, J = $ + re, z = R.x, K = R.y + q, Se = K + V, ge = (z - L) * 0.5, Me = i.createLinearGradient(L, ($ + J) / 2, z, (K + Se) / 2);
6147
+ Me.addColorStop(0, T.color), Me.addColorStop(1, R.color), i.beginPath(), i.moveTo(L, $), i.bezierCurveTo(L + ge, $, z - ge, K, z, K), i.lineTo(z, Se), i.bezierCurveTo(z - ge, Se, L + ge, J, L, J), i.closePath(), i.fillStyle = Me, i.globalAlpha = h, i.fill(), i.strokeStyle = T.color, i.globalAlpha = h * 0.3, i.lineWidth = 0.5, i.stroke(), Fe.set(C.source, D + re), De.set(C.target, q + V);
6038
6148
  }), i.restore(), i.save(), i.globalAlpha = 1, ne.forEach((C) => {
6039
6149
  i.fillStyle = C.color, i.fillRect(C.x, C.y, C.width, C.height);
6040
6150
  const T = i.createLinearGradient(C.x, C.y, C.x + C.width, C.y);
@@ -6047,7 +6157,7 @@ function Cn(i, e, t, n) {
6047
6157
  i.shadowBlur = 3, i.shadowColor = "rgba(0, 0, 0, 0.7)", i.fillStyle = "#ffffff", q ? (i.textAlign = "right", i.fillText(R, C.x - 10, C.y + C.height / 2)) : se ? (i.textAlign = "left", i.fillText(R, C.x + C.width + 10, C.y + C.height / 2)) : (i.textAlign = "center", i.fillText(R, C.x + C.width / 2, C.y - 10));
6048
6158
  }), i.restore());
6049
6159
  }
6050
- function Ue(i, e, t, n, s) {
6160
+ function He(i, e, t, n, s) {
6051
6161
  const o = (s == null ? void 0 : s.left) ?? 0, r = (s == null ? void 0 : s.right) ?? 0, a = (s == null ? void 0 : s.top) ?? 0, l = (s == null ? void 0 : s.bottom) ?? 0;
6052
6162
  if (n === "x") {
6053
6163
  const f = e.x + o, u = e.x + e.width - r, g = (t == null ? void 0 : t.invertAxis) ?? !1;
@@ -6057,9 +6167,9 @@ function Ue(i, e, t, n, s) {
6057
6167
  const h = e.y + a, d = e.y + e.height - l, c = (t == null ? void 0 : t.invertAxis) ?? !1;
6058
6168
  i.setRange(c ? h : d, c ? d : h);
6059
6169
  }
6060
- function An(i, e) {
6170
+ function In(i, e) {
6061
6171
  const t = [], n = i.layout.plotPadding;
6062
- if (Ue(
6172
+ if (He(
6063
6173
  i.xScale,
6064
6174
  e,
6065
6175
  i.xAxisOptions,
@@ -6067,7 +6177,7 @@ function An(i, e) {
6067
6177
  n
6068
6178
  ), i.xScale.setDomain(i.viewBounds.xMin, i.viewBounds.xMax), i.yScales.forEach((s, o) => {
6069
6179
  const r = i.yAxisOptionsMap.get(o);
6070
- Ue(s, e, r, "y", n), o === i.primaryYAxisId && s.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
6180
+ He(s, e, r, "y", n), o === i.primaryYAxisId && s.setDomain(i.viewBounds.yMin, i.viewBounds.yMax);
6071
6181
  }), i.series.forEach((s) => {
6072
6182
  var a, l;
6073
6183
  s.needsBufferUpdate && (i.updateSeriesBuffer(s), s.needsBufferUpdate = !1);
@@ -6108,8 +6218,8 @@ function An(i, e) {
6108
6218
  const g = i.renderer.getBuffer(`${s.getId()}_step`);
6109
6219
  if (g) {
6110
6220
  u.stepBuffer = g;
6111
- const y = s.getStyle().stepMode ?? "after", m = s.getPointCount();
6112
- y === "center" ? u.stepCount = 1 + (m - 1) * 3 : u.stepCount = m * 2 - 1;
6221
+ const y = s.getStyle().stepMode ?? "after", x = s.getPointCount();
6222
+ y === "center" ? u.stepCount = 1 + (x - 1) * 3 : u.stepCount = x * 2 - 1;
6113
6223
  }
6114
6224
  }
6115
6225
  if (r === "boxplot") {
@@ -6120,9 +6230,9 @@ function An(i, e) {
6120
6230
  if (r === "boxplot" && !u) {
6121
6231
  const g = i.renderer.getBuffer(`${s.getId()}_box_lines`), y = i.renderer.getBuffer(`${s.getId()}_box_faces`);
6122
6232
  if (g && y) {
6123
- const m = s.getYAxisId() || i.primaryYAxisId, b = i.yScales.get(m);
6124
- let v;
6125
- b && (v = { min: b.domain[0], max: b.domain[1] }), u = {
6233
+ const x = s.getYAxisId() || i.primaryYAxisId, b = i.yScales.get(x);
6234
+ let w;
6235
+ b && (w = { min: b.domain[0], max: b.domain[1] }), u = {
6126
6236
  id: s.getId(),
6127
6237
  buffer: g,
6128
6238
  // Use lines buffer as main buffer for reference
@@ -6131,7 +6241,7 @@ function An(i, e) {
6131
6241
  style: s.getStyle(),
6132
6242
  visible: s.isVisible(),
6133
6243
  type: "boxplot",
6134
- yBounds: v,
6244
+ yBounds: w,
6135
6245
  boxLinesBuffer: g,
6136
6246
  boxLinesCount: s.getPointCount() * 10,
6137
6247
  boxBuffer: y,
@@ -6140,30 +6250,30 @@ function An(i, e) {
6140
6250
  }
6141
6251
  }
6142
6252
  if (r === "waterfall" && !u) {
6143
- const g = i.renderer.getBuffer(`${s.getId()}_wf_positive`), y = i.renderer.getBuffer(`${s.getId()}_wf_negative`), m = i.renderer.getBuffer(`${s.getId()}_wf_subtotal`), b = i.renderer.getBuffer(`${s.getId()}_wf_connectors`);
6144
- if (g || y || m) {
6145
- const v = s.getYAxisId() || i.primaryYAxisId, x = i.yScales.get(v);
6146
- let S;
6147
- x && (S = { min: x.domain[0], max: x.domain[1] });
6148
- const w = s.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
6253
+ const g = i.renderer.getBuffer(`${s.getId()}_wf_positive`), y = i.renderer.getBuffer(`${s.getId()}_wf_negative`), x = i.renderer.getBuffer(`${s.getId()}_wf_subtotal`), b = i.renderer.getBuffer(`${s.getId()}_wf_connectors`);
6254
+ if (g || y || x) {
6255
+ const w = s.getYAxisId() || i.primaryYAxisId, p = i.yScales.get(w);
6256
+ let v;
6257
+ p && (v = { min: p.domain[0], max: p.domain[1] });
6258
+ const S = s.waterfallCounts || { positive: 0, negative: 0, subtotal: 0, connectors: 0 };
6149
6259
  u = {
6150
6260
  id: s.getId(),
6151
- buffer: g || y || m,
6261
+ buffer: g || y || x,
6152
6262
  // Use any available buffer as reference
6153
6263
  count: 0,
6154
6264
  // No main buffer rendering
6155
6265
  style: s.getStyle(),
6156
6266
  visible: s.isVisible(),
6157
6267
  type: "waterfall",
6158
- yBounds: S,
6268
+ yBounds: v,
6159
6269
  wfPositiveBuffer: g,
6160
- wfPositiveCount: w.positive,
6270
+ wfPositiveCount: S.positive,
6161
6271
  wfNegativeBuffer: y,
6162
- wfNegativeCount: w.negative,
6163
- wfSubtotalBuffer: m,
6164
- wfSubtotalCount: w.subtotal,
6272
+ wfNegativeCount: S.negative,
6273
+ wfSubtotalBuffer: x,
6274
+ wfSubtotalCount: S.subtotal,
6165
6275
  wfConnectorBuffer: b,
6166
- wfConnectorCount: w.connectors
6276
+ wfConnectorCount: S.connectors
6167
6277
  };
6168
6278
  }
6169
6279
  }
@@ -6172,25 +6282,25 @@ function An(i, e) {
6172
6282
  if (g) {
6173
6283
  u.errorBuffer = g;
6174
6284
  const y = s.getData();
6175
- let m = 0;
6176
- (y.yError || y.yErrorMinus || y.yErrorPlus) && m++, (y.xError || y.xErrorMinus || y.xErrorPlus) && m++, u.errorCount = s.getPointCount() * m * 2;
6285
+ let x = 0;
6286
+ (y.yError || y.yErrorMinus || y.yErrorPlus) && x++, (y.xError || y.xErrorMinus || y.xErrorPlus) && x++, u.errorCount = s.getPointCount() * x * 2;
6177
6287
  }
6178
6288
  if (r === "heatmap") {
6179
- const y = s.getHeatmapData(), m = s.getHeatmapStyle();
6289
+ const y = s.getHeatmapData(), x = s.getHeatmapStyle();
6180
6290
  if (y) {
6181
- const b = y.xValues.length, v = y.yValues.length;
6182
- u.count = (b - 1) * (v - 1) * 6;
6183
- let x = 1 / 0, S = -1 / 0;
6291
+ const b = y.xValues.length, w = y.yValues.length;
6292
+ u.count = (b - 1) * (w - 1) * 6;
6293
+ let p = 1 / 0, v = -1 / 0;
6184
6294
  for (let M = 0; M < y.zValues.length; M++) {
6185
6295
  const A = y.zValues[M];
6186
- A < x && (x = A), A > S && (S = A);
6296
+ A < p && (p = A), A > v && (v = A);
6187
6297
  }
6188
- x === S && (x -= 1, S += 1), u.zBounds = {
6189
- min: ((a = m == null ? void 0 : m.colorScale) == null ? void 0 : a.min) ?? (x === 1 / 0 ? 0 : x),
6190
- max: ((l = m == null ? void 0 : m.colorScale) == null ? void 0 : l.max) ?? (S === -1 / 0 ? 1 : S)
6298
+ p === v && (p -= 1, v += 1), u.zBounds = {
6299
+ min: ((a = x == null ? void 0 : x.colorScale) == null ? void 0 : a.min) ?? (p === 1 / 0 ? 0 : p),
6300
+ max: ((l = x == null ? void 0 : x.colorScale) == null ? void 0 : l.max) ?? (v === -1 / 0 ? 1 : v)
6191
6301
  }, u.zBounds.min === u.zBounds.max && (u.zBounds.max = u.zBounds.min + 1);
6192
- const w = `${s.getId()}_colormap`;
6193
- u.colormapTexture = i.renderer.getTexture(w);
6302
+ const S = `${s.getId()}_colormap`;
6303
+ u.colormapTexture = i.renderer.getTexture(S);
6194
6304
  }
6195
6305
  }
6196
6306
  }
@@ -6235,8 +6345,8 @@ function An(i, e) {
6235
6345
  }
6236
6346
  return t;
6237
6347
  }
6238
- function He(i, e, t) {
6239
- var g, y;
6348
+ function Ue(i, e, t) {
6349
+ var y, x, b, w;
6240
6350
  const n = i.container.getBoundingClientRect();
6241
6351
  if (n.width === 0 || n.height === 0) {
6242
6352
  console.warn(
@@ -6244,24 +6354,24 @@ function He(i, e, t) {
6244
6354
  );
6245
6355
  return;
6246
6356
  }
6247
- i.overlay.clear(), i.overlay.setLatexAPI(i.latexAPI), (g = i.layout.title) != null && g.visible && i.layout.title.text && i.overlay.drawChartTitle(e, i.layout.title);
6357
+ i.overlay.clear(), i.overlay.setLatexAPI(i.latexAPI), (y = i.layout.title) != null && y.visible && i.layout.title.text && i.overlay.drawChartTitle(e, i.layout.title);
6248
6358
  let s = !1, o = !1, r = !1, a = 0, l = "degrees", h = 5, d = 12;
6249
- i.series.forEach((m) => {
6250
- const b = m.getType();
6251
- if (m.isVisible())
6252
- if (b === "polar") {
6359
+ i.series.forEach((p) => {
6360
+ const v = p.getType();
6361
+ if (p.isVisible())
6362
+ if (v === "polar") {
6253
6363
  s = !0;
6254
- const v = m.getPolarData();
6255
- if (v) {
6256
- for (let S = 0; S < v.r.length; S++)
6257
- a = Math.max(a, Math.abs(v.r[S]));
6258
- const x = m.getStyle();
6259
- x.angleMode && (l = x.angleMode), x.radialDivisions && (h = x.radialDivisions), x.angularDivisions && (d = x.angularDivisions);
6364
+ const S = p.getPolarData();
6365
+ if (S) {
6366
+ for (let A = 0; A < S.r.length; A++)
6367
+ a = Math.max(a, Math.abs(S.r[A]));
6368
+ const M = p.getStyle();
6369
+ M.angleMode && (l = M.angleMode), M.radialDivisions && (h = M.radialDivisions), M.angularDivisions && (d = M.angularDivisions);
6260
6370
  }
6261
- } else b === "gauge" ? o = !0 : b === "sankey" && (r = !0);
6371
+ } else v === "gauge" ? o = !0 : v === "sankey" && (r = !0);
6262
6372
  });
6263
6373
  const c = s || o || r;
6264
- if (s && a > 0)
6374
+ if (i.overlay.setBusinessDayMapping(((x = i.getBusinessDayMapping) == null ? void 0 : x.call(i)) ?? null), s && a > 0)
6265
6375
  i.overlay.drawPolarGrid(
6266
6376
  e,
6267
6377
  i.xScale,
@@ -6271,79 +6381,81 @@ function He(i, e, t) {
6271
6381
  l
6272
6382
  );
6273
6383
  else if (!o && !r) {
6274
- const m = i.yAxisOptionsMap.get(i.primaryYAxisId);
6384
+ const p = i.yAxisOptionsMap.get(i.primaryYAxisId);
6275
6385
  i.overlay.drawGrid(
6276
6386
  e,
6277
6387
  i.xScale,
6278
6388
  t,
6279
6389
  i.xAxisOptions,
6280
- m
6390
+ p
6281
6391
  );
6282
6392
  }
6283
- i.series.forEach((m) => {
6284
- if (!m.isVisible()) return;
6285
- const b = m.getType();
6286
- if (b === "gauge") {
6287
- const v = m.getGaugeData(), x = m.getGaugeStyle();
6288
- v && x && Mn(i.overlayCtx, v, x, e);
6289
- } else if (b === "sankey") {
6290
- const v = m.getSankeyData(), x = m.getSankeyStyle();
6291
- v && x && Cn(i.overlayCtx, v, x, e);
6393
+ i.series.forEach((p) => {
6394
+ if (!p.isVisible()) return;
6395
+ const v = p.getType();
6396
+ if (v === "gauge") {
6397
+ const S = p.getGaugeData(), M = p.getGaugeStyle();
6398
+ S && M && Bn(i.overlayCtx, S, M, e);
6399
+ } else if (v === "sankey") {
6400
+ const S = p.getSankeyData(), M = p.getSankeyStyle();
6401
+ S && M && Tn(i.overlayCtx, S, M, e);
6292
6402
  }
6293
6403
  }), c || i.overlay.drawXAxis(e, i.xScale, i.xAxisOptions, i.layout.xAxisLayout);
6294
6404
  const f = [], u = [];
6295
- if (i.yAxisOptionsMap.forEach((m, b) => {
6296
- m.position === "right" ? u.push(b) : f.push(b);
6297
- }), c || (f.forEach((m, b) => {
6298
- const v = i.yScales.get(m), x = i.yAxisOptionsMap.get(m);
6299
- if (v && x) {
6300
- const S = b * 65;
6301
- i.overlay.drawYAxis(e, v, x, "left", S, i.layout.yAxisLayout);
6405
+ i.yAxisOptionsMap.forEach((p, v) => {
6406
+ p.position === "right" ? u.push(v) : f.push(v);
6407
+ }), c || (f.forEach((p, v) => {
6408
+ const S = i.yScales.get(p), M = i.yAxisOptionsMap.get(p);
6409
+ if (S && M) {
6410
+ const A = v * 65;
6411
+ i.overlay.drawYAxis(e, S, M, "left", A, i.layout.yAxisLayout);
6302
6412
  }
6303
- }), u.forEach((m, b) => {
6304
- const v = i.yScales.get(m), x = i.yAxisOptionsMap.get(m);
6305
- if (v && x) {
6306
- const S = b * 65;
6307
- i.overlay.drawYAxis(e, v, x, "right", S, i.layout.yAxisLayout);
6413
+ }), u.forEach((p, v) => {
6414
+ const S = i.yScales.get(p), M = i.yAxisOptionsMap.get(p);
6415
+ if (S && M) {
6416
+ const A = v * 65;
6417
+ i.overlay.drawYAxis(e, S, M, "right", A, i.layout.yAxisLayout);
6308
6418
  }
6309
- })), i.overlay.drawPlotBorder(e), i.series.forEach((m) => {
6310
- if (m.isVisible() && m.hasErrorData()) {
6311
- const b = m.getYAxisId() || i.primaryYAxisId, x = i.yScales.get(b) || t;
6312
- i.overlay.drawErrorBars(e, m, i.xScale, x);
6419
+ })), i.overlay.drawPlotBorder(e), i.series.forEach((p) => {
6420
+ if (p.isVisible() && p.hasErrorData()) {
6421
+ const v = p.getYAxisId() || i.primaryYAxisId, M = i.yScales.get(v) || t;
6422
+ i.overlay.drawErrorBars(e, p, i.xScale, M);
6313
6423
  }
6314
- }), i.series.forEach((m) => {
6315
- if (!m.isVisible() || m.getType() !== "candlestick") return;
6316
- const b = m.getYAxisId() || i.primaryYAxisId, v = i.yScales.get(b) || t;
6317
- i.overlay.drawCandlestickMarkers(e, m, i.xScale, v);
6318
- }), i.selectionRect && i.overlay.drawSelectionRect(i.selectionRect), i.selectionManager.render(i.overlayCtx, e), (y = i.cursorOptions) != null && y.enabled && i.cursorPosition) {
6319
- const m = i.cursorOptions.valueDisplayMode ?? "floating";
6320
- let b;
6321
- m !== "disabled" && (b = i.cursorOptions.formatter ? i.cursorOptions.formatter(
6424
+ }), i.series.forEach((p) => {
6425
+ if (!p.isVisible() || p.getType() !== "candlestick") return;
6426
+ const v = p.getYAxisId() || i.primaryYAxisId, S = i.yScales.get(v) || t;
6427
+ i.overlay.drawCandlestickMarkers(e, p, i.xScale, S);
6428
+ });
6429
+ const g = ((b = i.getAlerts) == null ? void 0 : b.call(i)) ?? [];
6430
+ if (g.length && i.overlay.drawPriceAlertLines(e, g, t), i.selectionRect && i.overlay.drawSelectionRect(i.selectionRect), i.selectionManager.render(i.overlayCtx, e), (w = i.cursorOptions) != null && w.enabled && i.cursorPosition) {
6431
+ const p = i.cursorOptions.valueDisplayMode ?? "floating";
6432
+ let v;
6433
+ p !== "disabled" && (v = i.cursorOptions.formatter ? i.cursorOptions.formatter(
6322
6434
  i.pixelToDataX(i.cursorPosition.x),
6323
6435
  i.pixelToDataY(i.cursorPosition.y),
6324
6436
  ""
6325
6437
  ) : `X: ${i.pixelToDataX(i.cursorPosition.x).toFixed(3)}
6326
6438
  Y: ${i.pixelToDataY(i.cursorPosition.y).toExponential(2)}`);
6327
- const v = {
6439
+ const S = {
6328
6440
  enabled: !0,
6329
6441
  x: i.cursorPosition.x,
6330
6442
  y: i.cursorPosition.y,
6331
6443
  crosshair: i.cursorOptions.crosshair ?? !1,
6332
- tooltipText: b,
6333
- valueDisplayMode: m,
6444
+ tooltipText: v,
6445
+ valueDisplayMode: p,
6334
6446
  cornerPosition: i.cursorOptions.cornerPosition ?? "top-left"
6335
6447
  };
6336
- i.overlay.drawCursor(e, v, i.cursorOptions.lineStyle);
6448
+ i.overlay.drawCursor(e, S, i.cursorOptions.lineStyle);
6337
6449
  }
6338
6450
  }
6339
- class Pn {
6451
+ class En {
6340
6452
  constructor(e) {
6341
- p(this, "animationFrameId", null);
6342
- p(this, "needsFullRender", !1);
6343
- p(this, "needsOverlayRender", !1);
6344
- p(this, "frameCount", 0);
6345
- p(this, "lastRenderTime", performance.now());
6346
- p(this, "initStarted", !1);
6453
+ m(this, "animationFrameId", null);
6454
+ m(this, "needsFullRender", !1);
6455
+ m(this, "needsOverlayRender", !1);
6456
+ m(this, "frameCount", 0);
6457
+ m(this, "lastRenderTime", performance.now());
6458
+ m(this, "initStarted", !1);
6347
6459
  this.ctx = e;
6348
6460
  }
6349
6461
  /**
@@ -6425,6 +6537,8 @@ class Pn {
6425
6537
  getPlotArea: () => n,
6426
6538
  pixelToDataX: this.ctx.pixelToDataX,
6427
6539
  pixelToDataY: this.ctx.pixelToDataY,
6540
+ getBusinessDayMapping: this.ctx.getBusinessDayMapping,
6541
+ getAlerts: this.ctx.getAlerts,
6428
6542
  selectionManager: this.ctx.selectionManager,
6429
6543
  hoveredSeriesId: this.ctx.getHoveredSeriesId(),
6430
6544
  layout: this.ctx.getLayout(),
@@ -6439,7 +6553,7 @@ class Pn {
6439
6553
  if (this.lastRenderTime = o, !this.ctx.pluginManager.notifyBeforeRender(r))
6440
6554
  return;
6441
6555
  if (e) {
6442
- const h = An(s, n);
6556
+ const h = In(s, n);
6443
6557
  this.ctx.renderer.render(h, {
6444
6558
  bounds: this.ctx.viewBounds,
6445
6559
  invertX: !!this.ctx.xAxisOptions.invertAxis,
@@ -6451,9 +6565,9 @@ class Pn {
6451
6565
  ...r,
6452
6566
  renderTime: performance.now() - t
6453
6567
  };
6454
- this.ctx.pluginManager.notifyRenderWebGL(d), He(s, n, this.ctx.yScale);
6568
+ this.ctx.pluginManager.notifyRenderWebGL(d), Ue(s, n, this.ctx.yScale);
6455
6569
  } else
6456
- He(s, n, this.ctx.yScale);
6570
+ Ue(s, n, this.ctx.yScale);
6457
6571
  const a = performance.now() - t, l = { ...r, renderTime: a };
6458
6572
  this.ctx.pluginManager.notifyRenderOverlay(l), this.ctx.pluginManager.notifyAfterRender(l), this.ctx.events.emit("render", {
6459
6573
  fps: 1e3 / a,
@@ -6479,13 +6593,13 @@ class Pn {
6479
6593
  this.frameCount = 0;
6480
6594
  }
6481
6595
  }
6482
- function kn(i) {
6596
+ function Rn(i) {
6483
6597
  const t = {
6484
6598
  id: i.seriesId ?? `${i.id}-indicator`,
6485
6599
  data: i.data,
6486
6600
  style: i.style,
6487
6601
  name: i.label
6488
- }, n = Se(t);
6602
+ }, n = we(t);
6489
6603
  return {
6490
6604
  id: i.id,
6491
6605
  height: i.height ?? 0.25,
@@ -6506,9 +6620,9 @@ function kn(i) {
6506
6620
  series: n
6507
6621
  };
6508
6622
  }
6509
- let Q = null;
6510
- function Bn() {
6511
- return Q || (Q = new bt(
6623
+ let Z = null;
6624
+ function Fn() {
6625
+ return Z || (Z = new St(
6512
6626
  () => new Worker(new URL(
6513
6627
  /* @vite-ignore */
6514
6628
  "/assets/indicator.worker-bv0zC4EX.js",
@@ -6525,7 +6639,7 @@ function Bn() {
6525
6639
  id: i.id,
6526
6640
  type: "indicator-result",
6527
6641
  indicator: "rsi",
6528
- values: pt(i.data, i.period ?? 14),
6642
+ values: bt(i.data, i.period ?? 14),
6529
6643
  duration: performance.now() - e
6530
6644
  };
6531
6645
  case "sma":
@@ -6533,7 +6647,7 @@ function Bn() {
6533
6647
  id: i.id,
6534
6648
  type: "indicator-result",
6535
6649
  indicator: "sma",
6536
- values: mt(i.data, i.period ?? 14),
6650
+ values: xt(i.data, i.period ?? 14),
6537
6651
  duration: performance.now() - e
6538
6652
  };
6539
6653
  case "ema":
@@ -6541,11 +6655,11 @@ function Bn() {
6541
6655
  id: i.id,
6542
6656
  type: "indicator-result",
6543
6657
  indicator: "ema",
6544
- values: yt(i.data, i.period ?? 14),
6658
+ values: pt(i.data, i.period ?? 14),
6545
6659
  duration: performance.now() - e
6546
6660
  };
6547
6661
  case "macd": {
6548
- const t = gt(
6662
+ const t = mt(
6549
6663
  i.data,
6550
6664
  i.fastPeriod ?? 12,
6551
6665
  i.slowPeriod ?? 26,
@@ -6560,7 +6674,7 @@ function Bn() {
6560
6674
  };
6561
6675
  }
6562
6676
  case "bollingerBands": {
6563
- const t = ft(i.data, i.period ?? 20, i.stdDev ?? 2);
6677
+ const t = yt(i.data, i.period ?? 20, i.stdDev ?? 2);
6564
6678
  return {
6565
6679
  id: i.id,
6566
6680
  type: "indicator-result",
@@ -6574,13 +6688,13 @@ function Bn() {
6574
6688
  }
6575
6689
  }
6576
6690
  }
6577
- )), Q;
6691
+ )), Z;
6578
6692
  }
6579
- function ce(i) {
6693
+ function ue(i) {
6580
6694
  return i instanceof Float32Array || i instanceof Float64Array ? i : Float32Array.from(i);
6581
6695
  }
6582
- async function ue(i) {
6583
- const e = xt(i.indicator), t = await Bn().run({ id: e, type: "indicator", ...i });
6696
+ async function de(i) {
6697
+ const e = wt(i.indicator), t = await Fn().run({ id: e, type: "indicator", ...i });
6584
6698
  return {
6585
6699
  values: t.values,
6586
6700
  signal: t.signal,
@@ -6590,34 +6704,34 @@ async function ue(i) {
6590
6704
  duration: t.duration
6591
6705
  };
6592
6706
  }
6593
- async function Tn(i, e = 14) {
6594
- return ue({ indicator: "rsi", data: ce(i), period: e });
6707
+ async function Dn(i, e = 14) {
6708
+ return de({ indicator: "rsi", data: ue(i), period: e });
6595
6709
  }
6596
- async function In(i, e = 14) {
6597
- return ue({ indicator: "sma", data: ce(i), period: e });
6710
+ async function Ln(i, e = 14) {
6711
+ return de({ indicator: "sma", data: ue(i), period: e });
6598
6712
  }
6599
- async function En(i, e = 14) {
6600
- return ue({ indicator: "ema", data: ce(i), period: e });
6713
+ async function zn(i, e = 14) {
6714
+ return de({ indicator: "ema", data: ue(i), period: e });
6601
6715
  }
6602
- async function Rn(i, e = 12, t = 26, n = 9) {
6603
- return ue({
6716
+ async function On(i, e = 12, t = 26, n = 9) {
6717
+ return de({
6604
6718
  indicator: "macd",
6605
- data: ce(i),
6719
+ data: ue(i),
6606
6720
  fastPeriod: e,
6607
6721
  slowPeriod: t,
6608
6722
  signalPeriod: n
6609
6723
  });
6610
6724
  }
6611
- async function Fn(i, e = 20, t = 2) {
6612
- return ue({ indicator: "bollingerBands", data: ce(i), period: e, stdDev: t });
6725
+ async function $n(i, e = 20, t = 2) {
6726
+ return de({ indicator: "bollingerBands", data: ue(i), period: e, stdDev: t });
6613
6727
  }
6614
- function rs() {
6615
- Q == null || Q.destroy(), Q = null;
6728
+ function ys() {
6729
+ Z == null || Z.destroy(), Z = null;
6616
6730
  }
6617
- function Dn(i) {
6731
+ function Yn(i) {
6618
6732
  return i === "bollingerBands" ? "bollinger" : i;
6619
6733
  }
6620
- function Ln(i) {
6734
+ function _n(i) {
6621
6735
  const e = i.getData(), t = e.x;
6622
6736
  if (!(t != null && t.length))
6623
6737
  throw new Error("[addIndicator] Source series has no X data");
@@ -6627,7 +6741,16 @@ function Ln(i) {
6627
6741
  throw new Error("[addIndicator] Source series has no price/Y data");
6628
6742
  return { x: t, prices: s };
6629
6743
  }
6630
- function st(i, e) {
6744
+ function Vn(i) {
6745
+ const e = i.getData(), t = e.x;
6746
+ if (!(t != null && t.length))
6747
+ throw new Error("[addIndicator] Source series has no X data");
6748
+ const n = e.open ?? e.y, s = e.high ?? e.y, o = e.low ?? e.y, r = e.close ?? e.y;
6749
+ if (!(n != null && n.length) || !(s != null && s.length) || !(o != null && o.length) || !(r != null && r.length))
6750
+ throw new Error("[addIndicator] Source series has no OHLC data — use candlestick");
6751
+ return { x: t, open: n, high: s, low: o, close: r };
6752
+ }
6753
+ function rt(i, e) {
6631
6754
  if (e) {
6632
6755
  const s = i.getSeries(e);
6633
6756
  if (!s) throw new Error(`[addIndicator] Source series "${e}" not found`);
@@ -6641,19 +6764,19 @@ function st(i, e) {
6641
6764
  throw new Error("[addIndicator] No line/candlestick/bar series found — pass sourceSeriesId");
6642
6765
  return n;
6643
6766
  }
6644
- async function ot(i, e, t, n = {}) {
6645
- const s = Dn(i), o = n.id ?? s, r = e instanceof Float32Array || e instanceof Float64Array ? e : Float32Array.from(e);
6646
- switch (s) {
6767
+ async function at(i, e, t, n = {}, s) {
6768
+ const o = Yn(i), r = n.id ?? o, a = e instanceof Float32Array || e instanceof Float64Array ? e : Float32Array.from(e);
6769
+ switch (o) {
6647
6770
  case "rsi": {
6648
- const a = n.period ?? 14, { values: l } = await Tn(t, a);
6771
+ const l = n.period ?? 14, { values: h } = await Dn(t, l);
6649
6772
  return {
6650
- id: o,
6773
+ id: r,
6651
6774
  preset: "rsi",
6652
6775
  placement: "oscillator",
6653
6776
  yRange: [0, 100],
6654
6777
  data: {
6655
- x: r,
6656
- lines: [{ id: "rsi", y: l, color: "#ab47bc", width: 1.5 }],
6778
+ x: a,
6779
+ lines: [{ id: "rsi", y: h, color: "#ab47bc", width: 1.5 }],
6657
6780
  referenceLines: [
6658
6781
  { y: 70, color: "rgba(239, 83, 80, 0.5)", dash: [4, 4] },
6659
6782
  { y: 30, color: "rgba(38, 166, 154, 0.5)", dash: [4, 4] }
@@ -6662,40 +6785,40 @@ async function ot(i, e, t, n = {}) {
6662
6785
  };
6663
6786
  }
6664
6787
  case "macd": {
6665
- const a = n.fastPeriod ?? 12, l = n.slowPeriod ?? 26, h = n.signalPeriod ?? 9, d = await Rn(t, a, l, h);
6788
+ const l = n.fastPeriod ?? 12, h = n.slowPeriod ?? 26, d = n.signalPeriod ?? 9, c = await On(t, l, h, d);
6666
6789
  return {
6667
- id: o,
6790
+ id: r,
6668
6791
  preset: "macd",
6669
6792
  placement: "oscillator",
6670
6793
  data: {
6671
- x: r,
6794
+ x: a,
6672
6795
  histogram: {
6673
- y: d.histogram ?? new Float32Array(t.length),
6796
+ y: c.histogram ?? new Float32Array(t.length),
6674
6797
  positiveColor: "#26a69a",
6675
6798
  negativeColor: "#ef5350"
6676
6799
  },
6677
6800
  lines: [
6678
- { id: "macd", y: d.values, color: "#42a5f5", width: 1.5 },
6679
- { id: "signal", y: d.signal ?? d.values, color: "#ff9800", width: 1 }
6801
+ { id: "macd", y: c.values, color: "#42a5f5", width: 1.5 },
6802
+ { id: "signal", y: c.signal ?? c.values, color: "#ff9800", width: 1 }
6680
6803
  ],
6681
6804
  baseline: 0
6682
6805
  }
6683
6806
  };
6684
6807
  }
6685
6808
  case "bollinger": {
6686
- const a = n.period ?? 20, l = n.stdDev ?? 2, h = await Fn(t, a, l), d = h.upper ?? h.values, c = h.lower ?? h.values;
6809
+ const l = n.period ?? 20, h = n.stdDev ?? 2, d = await $n(t, l, h), c = d.upper ?? d.values, f = d.lower ?? d.values;
6687
6810
  return {
6688
- id: o,
6811
+ id: r,
6689
6812
  preset: "bollinger",
6690
6813
  placement: "overlay",
6691
6814
  data: {
6692
- x: r,
6693
- lines: [{ id: "mid", y: h.values, color: "rgba(99, 102, 241, 0.9)", width: 1 }],
6815
+ x: a,
6816
+ lines: [{ id: "mid", y: d.values, color: "rgba(99, 102, 241, 0.9)", width: 1 }],
6694
6817
  fills: [
6695
6818
  {
6696
6819
  id: "band",
6697
- upper: d,
6698
- lower: c,
6820
+ upper: c,
6821
+ lower: f,
6699
6822
  color: "rgba(99, 102, 241, 0.15)"
6700
6823
  }
6701
6824
  ]
@@ -6703,26 +6826,48 @@ async function ot(i, e, t, n = {}) {
6703
6826
  };
6704
6827
  }
6705
6828
  case "ema": {
6706
- const a = n.period ?? 14, { values: l } = await En(t, a);
6829
+ const l = n.period ?? 14, { values: h } = await zn(t, l);
6707
6830
  return {
6708
- id: o,
6831
+ id: r,
6709
6832
  preset: "ema",
6710
6833
  placement: "overlay",
6711
6834
  data: {
6712
- x: r,
6713
- lines: [{ id: "ema", y: l, color: "#ffd54f", width: 1.5 }]
6835
+ x: a,
6836
+ lines: [{ id: "ema", y: h, color: "#ffd54f", width: 1.5 }]
6714
6837
  }
6715
6838
  };
6716
6839
  }
6717
6840
  case "sma": {
6718
- const a = n.period ?? 14, { values: l } = await In(t, a);
6841
+ const l = n.period ?? 14, { values: h } = await Ln(t, l);
6719
6842
  return {
6720
- id: o,
6843
+ id: r,
6721
6844
  preset: "sma",
6722
6845
  placement: "overlay",
6723
6846
  data: {
6724
- x: r,
6725
- lines: [{ id: "sma", y: l, color: "#4fc3f7", width: 1.5 }]
6847
+ x: a,
6848
+ lines: [{ id: "sma", y: h, color: "#4fc3f7", width: 1.5 }]
6849
+ }
6850
+ };
6851
+ }
6852
+ case "stochastic": {
6853
+ if (!s)
6854
+ throw new Error("[addIndicator] stochastic requires a candlestick source series");
6855
+ const l = Vn(s), h = n.period ?? 14, d = n.signalPeriod ?? 3, c = vt(l, h, d);
6856
+ return {
6857
+ id: r,
6858
+ preset: "stochastic",
6859
+ placement: "oscillator",
6860
+ yRange: [0, 100],
6861
+ data: {
6862
+ x: a,
6863
+ lines: [
6864
+ { id: "k", y: c.values, color: "#42a5f5", width: 1.5 },
6865
+ { id: "d", y: c.signal ?? c.values, color: "#ff9800", width: 1 }
6866
+ ],
6867
+ referenceLines: [
6868
+ { y: 80, color: "rgba(239, 83, 80, 0.5)", dash: [4, 4] },
6869
+ { y: 20, color: "rgba(38, 166, 154, 0.5)", dash: [4, 4] }
6870
+ ]
6726
6871
  }
6727
6872
  };
6728
6873
  }
@@ -6730,25 +6875,25 @@ async function ot(i, e, t, n = {}) {
6730
6875
  throw new Error(`[addIndicator] Unknown preset: ${i}`);
6731
6876
  }
6732
6877
  }
6733
- function zn(i, e) {
6878
+ function Wn(i, e) {
6734
6879
  for (const t of [...i.getAllSeries()]) {
6735
6880
  const n = t.getId();
6736
6881
  (n === e || n.startsWith(`${e}-`)) && i.removeSeries(n);
6737
6882
  }
6738
6883
  }
6739
- async function On(i, e, t = {}) {
6740
- const n = st(i, t.sourceSeriesId), { x: s, prices: o } = Ln(n);
6741
- return ot(e, s, o, t);
6884
+ async function Xn(i, e, t = {}) {
6885
+ const n = rt(i, t.sourceSeriesId), { x: s, prices: o } = _n(n);
6886
+ return at(e, s, o, t, n);
6742
6887
  }
6743
- async function $n(i, e, t = {}) {
6888
+ async function Nn(i, e, t = {}) {
6744
6889
  var l;
6745
6890
  if (t.pane === "new")
6746
6891
  throw new Error(
6747
6892
  "[addIndicator] pane: 'new' requires createStackedChart — use buildIndicatorPaneFromPreset() instead"
6748
6893
  );
6749
- const n = st(i, t.sourceSeriesId), s = t.yAxisId ?? ((l = n.getYAxisId) == null ? void 0 : l.call(n)), o = await On(i, e, t);
6750
- zn(i, o.id);
6751
- const r = Se({
6894
+ const n = rt(i, t.sourceSeriesId), s = t.yAxisId ?? ((l = n.getYAxisId) == null ? void 0 : l.call(n)), o = await Xn(i, e, t);
6895
+ Wn(i, o.id);
6896
+ const r = we({
6752
6897
  id: o.id,
6753
6898
  data: o.data,
6754
6899
  name: t.label ?? o.id.toUpperCase()
@@ -6765,24 +6910,24 @@ async function $n(i, e, t = {}) {
6765
6910
  seriesIds: a
6766
6911
  };
6767
6912
  }
6768
- async function as(i, e, t, n) {
6769
- const s = await ot(i, e, t, n);
6770
- return kn({
6771
- id: n.id ?? s.id,
6913
+ async function ms(i, e, t, n, s) {
6914
+ const o = await at(i, e, t, n, s);
6915
+ return Rn({
6916
+ id: n.id ?? o.id,
6772
6917
  height: n.height ?? 0.25,
6773
- label: n.label ?? s.id.toUpperCase(),
6774
- yRange: n.yRange ?? s.yRange ?? "auto",
6918
+ label: n.label ?? o.id.toUpperCase(),
6919
+ yRange: n.yRange ?? o.yRange ?? "auto",
6775
6920
  tickCount: n.tickCount,
6776
6921
  showXAxis: n.showXAxis,
6777
6922
  seriesId: n.seriesId,
6778
6923
  style: n.style,
6779
- data: s.data
6924
+ data: o.data
6780
6925
  });
6781
6926
  }
6782
- class Yn {
6927
+ class Hn {
6783
6928
  constructor(e, t) {
6784
- p(this, "alerts", /* @__PURE__ */ new Map());
6785
- p(this, "idCounter", 0);
6929
+ m(this, "alerts", /* @__PURE__ */ new Map());
6930
+ m(this, "idCounter", 0);
6786
6931
  this.events = e, this.getSeries = t;
6787
6932
  }
6788
6933
  addAlert(e) {
@@ -6837,81 +6982,105 @@ class Yn {
6837
6982
  this.alerts.clear();
6838
6983
  }
6839
6984
  }
6840
- class _n {
6985
+ const Un = {
6986
+ entry: "#38bdf8",
6987
+ sl: "#ef4444",
6988
+ tp: "#22c55e"
6989
+ }, qn = {
6990
+ entry: "Entry",
6991
+ sl: "SL",
6992
+ tp: "TP"
6993
+ };
6994
+ function Gn(i, e) {
6995
+ const t = i.style ?? "entry";
6996
+ return {
6997
+ id: e,
6998
+ type: "horizontal-line",
6999
+ y: i.price,
7000
+ color: i.color ?? Un[t],
7001
+ label: i.label ?? qn[t],
7002
+ labelPosition: "right",
7003
+ lineDash: t === "sl" ? [6, 4] : t === "tp" ? [4, 4] : void 0,
7004
+ interactive: i.interactive ?? !1
7005
+ };
7006
+ }
7007
+ class jn {
6841
7008
  constructor(e) {
6842
- p(this, "container");
6843
- p(this, "webglCanvas");
6844
- p(this, "overlayCanvas");
6845
- p(this, "overlayCtx");
6846
- p(this, "series", /* @__PURE__ */ new Map());
6847
- p(this, "events", new ct());
6848
- p(this, "viewBounds", {
7009
+ m(this, "container");
7010
+ m(this, "webglCanvas");
7011
+ m(this, "overlayCanvas");
7012
+ m(this, "overlayCtx");
7013
+ m(this, "series", /* @__PURE__ */ new Map());
7014
+ m(this, "events", new dt());
7015
+ m(this, "viewBounds", {
6849
7016
  xMin: -0.5,
6850
7017
  xMax: 0.5,
6851
7018
  yMin: -1e-5,
6852
7019
  yMax: 1e-5
6853
7020
  });
6854
- p(this, "xAxisOptions");
6855
- p(this, "yAxisOptionsMap");
6856
- p(this, "primaryYAxisId");
6857
- p(this, "dpr");
6858
- p(this, "backgroundColor");
6859
- p(this, "plotAreaBackground");
6860
- p(this, "renderer");
6861
- p(this, "activeRendererType", "webgl");
6862
- p(this, "rendererInitPromise", null);
6863
- p(this, "overlay");
6864
- p(this, "interaction");
6865
- p(this, "xScale");
6866
- p(this, "yScales");
6867
- p(this, "theme");
6868
- p(this, "baseTheme");
6869
- p(this, "colorScheme");
6870
- p(this, "cursorOptions", null);
6871
- p(this, "cursorPosition", null);
6872
- p(this, "showLegend");
6873
- p(this, "legend", null);
6874
- p(this, "originalSeriesStyles", /* @__PURE__ */ new Map());
6875
- p(this, "hoveredSeriesId", null);
6876
- p(this, "showControls");
6877
- p(this, "toolbarOptions");
6878
- p(this, "controls", null);
6879
- p(this, "layout");
6880
- p(this, "_isDestroyed", !1);
7021
+ m(this, "xAxisOptions");
7022
+ m(this, "yAxisOptionsMap");
7023
+ m(this, "primaryYAxisId");
7024
+ m(this, "dpr");
7025
+ m(this, "backgroundColor");
7026
+ m(this, "plotAreaBackground");
7027
+ m(this, "renderer");
7028
+ m(this, "activeRendererType", "webgl");
7029
+ m(this, "rendererInitPromise", null);
7030
+ m(this, "overlay");
7031
+ m(this, "interaction");
7032
+ m(this, "xScale");
7033
+ m(this, "yScales");
7034
+ m(this, "theme");
7035
+ m(this, "baseTheme");
7036
+ m(this, "colorScheme");
7037
+ m(this, "cursorOptions", null);
7038
+ m(this, "cursorPosition", null);
7039
+ m(this, "showLegend");
7040
+ m(this, "legend", null);
7041
+ m(this, "originalSeriesStyles", /* @__PURE__ */ new Map());
7042
+ m(this, "hoveredSeriesId", null);
7043
+ m(this, "showControls");
7044
+ m(this, "toolbarOptions");
7045
+ m(this, "controls", null);
7046
+ m(this, "layout");
7047
+ m(this, "_isDestroyed", !1);
6881
7048
  /** When true, skip resize (stacked pane drag uses CSS scaling instead). */
6882
- p(this, "resizeSuspended", !1);
6883
- p(this, "autoScroll", !1);
6884
- p(this, "showStatistics", !1);
6885
- p(this, "initQueueId", null);
6886
- p(this, "chartId");
6887
- p(this, "commandQueue", []);
6888
- p(this, "annotationQueue", []);
6889
- p(this, "annotationIdCounter", 0);
6890
- p(this, "tooltipConfigQueue", []);
6891
- p(this, "fitLineQueue", []);
6892
- p(this, "selectionRect", null);
6893
- p(this, "pluginManager");
6894
- p(this, "initialOptions");
7049
+ m(this, "resizeSuspended", !1);
7050
+ m(this, "autoScroll", !1);
7051
+ m(this, "showStatistics", !1);
7052
+ m(this, "initQueueId", null);
7053
+ m(this, "chartId");
7054
+ m(this, "commandQueue", []);
7055
+ m(this, "annotationQueue", []);
7056
+ m(this, "annotationIdCounter", 0);
7057
+ m(this, "tooltipConfigQueue", []);
7058
+ m(this, "fitLineQueue", []);
7059
+ m(this, "selectionRect", null);
7060
+ m(this, "pluginManager");
7061
+ m(this, "initialOptions");
6895
7062
  // Composed modules
6896
- p(this, "pluginBridge");
6897
- p(this, "axisManager");
6898
- p(this, "stateManager");
6899
- p(this, "renderLoop");
6900
- p(this, "resizeObserver", null);
6901
- p(this, "animationEngine");
6902
- p(this, "animationConfig");
6903
- p(this, "selectionManager");
6904
- p(this, "responsiveManager");
6905
- p(this, "alertManager");
7063
+ m(this, "pluginBridge");
7064
+ m(this, "axisManager");
7065
+ m(this, "stateManager");
7066
+ m(this, "renderLoop");
7067
+ m(this, "resizeObserver", null);
7068
+ m(this, "animationEngine");
7069
+ m(this, "animationConfig");
7070
+ m(this, "selectionManager");
7071
+ m(this, "responsiveManager");
7072
+ m(this, "alertManager");
7073
+ m(this, "timeScaleMapping", null);
7074
+ m(this, "positionLineCounter", 0);
6906
7075
  this.initialOptions = e, this.container = e.container, this.chartId = e.id ?? `chart_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
6907
- const t = Ji(this.container, e);
7076
+ const t = sn(this.container, e);
6908
7077
  if (this.baseTheme = t.theme, this.theme = t.theme, this.colorScheme = e.colorScheme ? Oe(e.colorScheme) : $e(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({
6909
7078
  enabled: this.layout.crosshair.enabled !== !1,
6910
7079
  crosshair: !0,
6911
7080
  snap: this.layout.crosshair.snapToData,
6912
7081
  valueDisplayMode: this.layout.crosshair.valueDisplayMode,
6913
7082
  cornerPosition: this.layout.crosshair.cornerPosition
6914
- }), this.pluginManager = new ln({
7083
+ }), this.pluginManager = new fn({
6915
7084
  chart: this,
6916
7085
  container: this.container,
6917
7086
  theme: this.theme,
@@ -6950,18 +7119,18 @@ class _n {
6950
7119
  var r;
6951
7120
  return (r = this.pluginManager) == null ? void 0 : r.get(o);
6952
7121
  }
6953
- }), this.pluginBridge = new mn(this.pluginManager), e.loading !== !1) {
7122
+ }), this.pluginBridge = new wn(this.pluginManager), e.loading !== !1) {
6954
7123
  const o = typeof e.loading == "object" ? e.loading : {
6955
7124
  message: "Loading SciPlot...",
6956
7125
  overlayOpacity: 0.1
6957
7126
  };
6958
- this.use(dt({
7127
+ this.use(gt({
6959
7128
  ...o,
6960
7129
  autoShow: !0
6961
7130
  // Ensure it shows immediately
6962
7131
  }));
6963
7132
  }
6964
- e.plugins && e.plugins.forEach((o) => this.use(o)), (e.renderer ?? "webgl") === "webgpu" ? this.rendererInitPromise = this.initGpuRenderer() : (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.overlay = new Kt(this.overlayCtx, this.theme), this.selectionManager = new ii({
7133
+ e.plugins && e.plugins.forEach((o) => this.use(o)), (e.renderer ?? "webgl") === "webgpu" ? this.rendererInitPromise = this.initGpuRenderer() : (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.overlay = new ii(this.overlayCtx, this.theme), this.selectionManager = new oi({
6965
7134
  getSeries: () => this.series,
6966
7135
  getPlotArea: () => this.getPlotArea(),
6967
7136
  getXScale: () => this.xScale,
@@ -6972,18 +7141,18 @@ class _n {
6972
7141
  requestRender: () => this.requestRender()
6973
7142
  }), this.events.on("selectionChange", (o) => {
6974
7143
  this.pluginManager.notifySelectionChange(o.selected);
6975
- }), this.animationEngine = new et(), this.animationConfig = typeof e.animations == "boolean" ? { ...X, enabled: e.animations } : _e(e.animations);
7144
+ }), this.animationEngine = new it(), this.animationConfig = typeof e.animations == "boolean" ? { ...X, enabled: e.animations } : _e(e.animations);
6976
7145
  const s = typeof e.responsive == "boolean" ? { enabled: e.responsive } : e.responsive;
6977
- this.responsiveManager = new ni(
7146
+ this.responsiveManager = new ri(
6978
7147
  {
6979
7148
  container: this.container,
6980
7149
  onStateChange: (o) => this.handleResponsiveChange(o)
6981
7150
  },
6982
7151
  s
6983
- ), this.alertManager = new Yn(this.events, (o) => {
7152
+ ), this.alertManager = new Hn(this.events, (o) => {
6984
7153
  const r = o ? this.series.get(o) : void 0;
6985
7154
  return r || this.series.values().next().value;
6986
- }), this.axisManager = new pn({
7155
+ }), this.axisManager = new Sn({
6987
7156
  xAxisOptions: this.xAxisOptions,
6988
7157
  xScale: this.xScale,
6989
7158
  yAxisOptionsMap: this.yAxisOptionsMap,
@@ -6991,7 +7160,7 @@ class _n {
6991
7160
  primaryYAxisId: this.primaryYAxisId,
6992
7161
  series: this.series,
6993
7162
  requestRender: () => this.requestRender()
6994
- }), this.stateManager = new wn({
7163
+ }), this.stateManager = new kn({
6995
7164
  viewBounds: this.viewBounds,
6996
7165
  xAxisOptions: this.xAxisOptions,
6997
7166
  xScale: this.xScale,
@@ -7012,7 +7181,7 @@ class _n {
7012
7181
  removeSeries: (o) => this.removeSeries(o),
7013
7182
  addSeries: (o) => this.addSeries(o),
7014
7183
  requestRender: () => this.requestRender()
7015
- }), this.renderLoop = new Pn({
7184
+ }), this.renderLoop = new En({
7016
7185
  webglCanvas: this.webglCanvas,
7017
7186
  overlayCanvas: this.overlayCanvas,
7018
7187
  overlayCtx: this.overlayCtx,
@@ -7037,14 +7206,16 @@ class _n {
7037
7206
  pluginManager: this.pluginManager,
7038
7207
  getLayout: () => this.layout,
7039
7208
  getLatex: () => this.latex,
7040
- updateSeriesBuffer: (o) => he(this.getSeriesContext(), o),
7209
+ updateSeriesBuffer: (o) => ce(this.getSeriesContext(), o),
7041
7210
  getPlotArea: () => this.getPlotArea(),
7042
7211
  pixelToDataX: (o) => this.pixelToDataX(o),
7043
7212
  pixelToDataY: (o, r) => this.pixelToDataY(o, r),
7213
+ getBusinessDayMapping: () => this.timeScaleMapping,
7214
+ getAlerts: () => this.alertManager.getAlerts(),
7044
7215
  get yScale() {
7045
7216
  return this.yScales.get(this.primaryYAxisId) || this.yScales.values().next().value;
7046
7217
  }
7047
- }), this.interaction = new ei(
7218
+ }), this.interaction = new ni(
7048
7219
  this.container,
7049
7220
  {
7050
7221
  onZoom: (o, r) => {
@@ -7126,11 +7297,21 @@ class _n {
7126
7297
  },
7127
7298
  onInteraction: (o) => {
7128
7299
  this.pluginManager.notifyInteraction(o);
7300
+ },
7301
+ onPointClick: (o, r, a, l) => {
7302
+ const h = this.pixelToDataX(o), d = this.pixelToDataY(r);
7303
+ this.events.emit("click", {
7304
+ point: { x: h, y: d },
7305
+ pixelX: o,
7306
+ pixelY: r,
7307
+ ctrlKey: a,
7308
+ shiftKey: l
7309
+ });
7129
7310
  }
7130
7311
  },
7131
7312
  () => this.getPlotArea(),
7132
7313
  (o) => this.getInteractedBounds(o),
7133
- () => en(this.yAxisOptionsMap)
7314
+ () => rn(this.yAxisOptionsMap)
7134
7315
  ), this.resizeObserver = new ResizeObserver(() => {
7135
7316
  !this.isDestroyed && !this.resizeSuspended && this.resize();
7136
7317
  }), this.resizeObserver.observe(this.container), this.initControls(), this.initLegend(e);
@@ -7218,7 +7399,7 @@ class _n {
7218
7399
  if (!(this.renderLoop.isInitStarted() || this._isDestroyed)) {
7219
7400
  this.rendererInitPromise && (await this.rendererInitPromise, this.rendererInitPromise = null), this.renderer || (this.renderer = new Pe(this.webglCanvas), this.activeRendererType = "webgl", this.renderer.setDPR(this.dpr)), this.renderLoop.setRenderer(this.renderer);
7220
7401
  for (const e of this.series.values())
7221
- he(this.getSeriesContext(), e);
7402
+ ce(this.getSeriesContext(), e);
7222
7403
  this.renderLoop.startInit(), this.resize(), this.startRenderLoop(), this.commandQueue.length > 0 && (this.commandQueue.forEach((e) => {
7223
7404
  try {
7224
7405
  e.fn();
@@ -7247,7 +7428,7 @@ class _n {
7247
7428
  this.initQueueId = e;
7248
7429
  }
7249
7430
  initControls() {
7250
- this.controls = un({
7431
+ this.controls = mn({
7251
7432
  container: this.container,
7252
7433
  theme: this.theme,
7253
7434
  showControls: this.showControls,
@@ -7283,7 +7464,7 @@ class _n {
7283
7464
  initLegend(e) {
7284
7465
  var n;
7285
7466
  const t = (n = e.layout) == null ? void 0 : n.legend;
7286
- this.legend = dn(
7467
+ this.legend = pn(
7287
7468
  {
7288
7469
  container: this.container,
7289
7470
  theme: this.theme,
@@ -7320,7 +7501,7 @@ class _n {
7320
7501
  if (this.hoveredSeriesId = s.getId(), o) {
7321
7502
  const l = s.getStyle();
7322
7503
  this.originalSeriesStyles.set(s.getId(), { ...l });
7323
- const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || Bt(l.color || "#ff0055", this.theme.isDark);
7504
+ const h = ((r = this.colorScheme) == null ? void 0 : r.highlightColor) || Et(l.color || "#ff0055", this.theme.isDark);
7324
7505
  s.setStyle({
7325
7506
  color: h
7326
7507
  }), (a = this.legend) == null || a.updateSeriesStyle(s);
@@ -7344,7 +7525,7 @@ class _n {
7344
7525
  );
7345
7526
  }
7346
7527
  setTheme(e) {
7347
- this.baseTheme = typeof e == "string" ? Je(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = _(this.theme.backgroundColor), this.plotAreaBackground = _(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 = $e(this.theme.isDark)), this.requestRender();
7528
+ this.baseTheme = typeof e == "string" ? et(e) : e, this.theme = this.responsiveManager.scaleTheme(this.baseTheme), this.backgroundColor = _(this.theme.backgroundColor), this.plotAreaBackground = _(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 = $e(this.theme.isDark)), this.requestRender();
7348
7529
  }
7349
7530
  /**
7350
7531
  * Set the color scheme for multi-series charts
@@ -7360,7 +7541,7 @@ class _n {
7360
7541
  return this.colorScheme;
7361
7542
  }
7362
7543
  getPlotArea() {
7363
- return Ki(this.container, this.yAxisOptionsMap, this.layout);
7544
+ return on(this.container, this.yAxisOptionsMap, this.layout);
7364
7545
  }
7365
7546
  getInteractedBounds(e) {
7366
7547
  if (e) {
@@ -7375,7 +7556,7 @@ class _n {
7375
7556
  return this.viewBounds;
7376
7557
  }
7377
7558
  exportImage(e = "png") {
7378
- return ri(
7559
+ return hi(
7379
7560
  this.webglCanvas,
7380
7561
  this.overlayCanvas,
7381
7562
  this.backgroundColor,
@@ -7387,7 +7568,7 @@ class _n {
7387
7568
  }
7388
7569
  exportSVG() {
7389
7570
  const e = this.container.getBoundingClientRect();
7390
- return ai(
7571
+ return ci(
7391
7572
  this.getAllSeries(),
7392
7573
  this.viewBounds,
7393
7574
  this.getPlotArea(),
@@ -7405,6 +7586,7 @@ class _n {
7405
7586
  }
7406
7587
  // Series Management (delegates to ChartSeries)
7407
7588
  getSeriesContext() {
7589
+ const e = this;
7408
7590
  return {
7409
7591
  series: this.series,
7410
7592
  renderer: this.renderer,
@@ -7412,18 +7594,24 @@ class _n {
7412
7594
  autoScale: () => this.autoScale(),
7413
7595
  autoScaleYOnly: () => this.autoScaleYOnly(),
7414
7596
  requestRender: () => this.requestRender(),
7415
- addAnnotation: (e) => this.addAnnotation(e),
7597
+ addAnnotation: (t) => this.addAnnotation(t),
7416
7598
  xAxisOptions: this.xAxisOptions,
7417
7599
  yAxisOptionsMap: this.yAxisOptionsMap,
7418
7600
  autoScrollEnabled: this.autoScroll,
7419
- addSeries: (e) => this.addSeries(e),
7601
+ addSeries: (t) => this.addSeries(t),
7420
7602
  updateLegend: () => {
7421
7603
  this.legend && this.legend.update(this.getAllSeries());
7604
+ },
7605
+ get timeScaleMapping() {
7606
+ return e.timeScaleMapping;
7607
+ },
7608
+ set timeScaleMapping(t) {
7609
+ e.timeScaleMapping = t;
7422
7610
  }
7423
7611
  };
7424
7612
  }
7425
7613
  addSeries(e) {
7426
- Ui(this.getSeriesContext(), e);
7614
+ Zi(this.getSeriesContext(), e);
7427
7615
  const t = this.series.get(e.id);
7428
7616
  t && this.pluginManager.notifySeriesAdd({ series: t, changeType: "add" });
7429
7617
  }
@@ -7435,11 +7623,11 @@ class _n {
7435
7623
  }
7436
7624
  removeSeries(e) {
7437
7625
  const t = this.series.get(e);
7438
- qi(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
7626
+ Ji(this.getSeriesContext(), e), t && this.pluginManager.notifySeriesRemove({ series: t, changeType: "remove" });
7439
7627
  }
7440
7628
  updateSeries(e, t) {
7441
7629
  var s, o;
7442
- Gi(this.getSeriesContext(), e, t), this.recalculateTools();
7630
+ Ki(this.getSeriesContext(), e, t), this.recalculateTools();
7443
7631
  const n = this.series.get(e);
7444
7632
  n && this.pluginManager.notifyDataUpdate({
7445
7633
  seriesId: e,
@@ -7449,7 +7637,7 @@ class _n {
7449
7637
  }), this.alertManager.evaluate();
7450
7638
  }
7451
7639
  appendData(e, t, n) {
7452
- ji(this.getSeriesContext(), e, t, n), this.recalculateTools();
7640
+ en(this.getSeriesContext(), e, t, n), this.recalculateTools();
7453
7641
  const s = this.series.get(e);
7454
7642
  s && this.pluginManager.notifyDataUpdate({
7455
7643
  seriesId: e,
@@ -7462,7 +7650,7 @@ class _n {
7462
7650
  this.autoScroll = e;
7463
7651
  }
7464
7652
  setMaxPoints(e, t) {
7465
- Qi(this.getSeriesContext(), e, t);
7653
+ tn(this.getSeriesContext(), e, t);
7466
7654
  }
7467
7655
  /**
7468
7656
  * Add a line of best fit to a series
@@ -7479,7 +7667,7 @@ class _n {
7479
7667
  * For stacked layouts use buildIndicatorPaneFromPreset() when creating panes.
7480
7668
  */
7481
7669
  async addIndicator(e, t) {
7482
- return $n(this, e, t);
7670
+ return Nn(this, e, t);
7483
7671
  }
7484
7672
  addAlert(e) {
7485
7673
  return this.alertManager.addAlert(e);
@@ -7490,6 +7678,13 @@ class _n {
7490
7678
  clearAlerts() {
7491
7679
  this.alertManager.clearAlerts();
7492
7680
  }
7681
+ getAlerts() {
7682
+ return this.alertManager.getAlerts();
7683
+ }
7684
+ addPositionLine(e) {
7685
+ const t = e.id ?? `position-${++this.positionLineCounter}`;
7686
+ return this.addAnnotation(Gn(e, t)), t;
7687
+ }
7493
7688
  setDrawingMode(e) {
7494
7689
  var n;
7495
7690
  const t = this.getPluginAPI("velo-plot-drawing-tools");
@@ -7525,7 +7720,7 @@ class _n {
7525
7720
  zoom(e) {
7526
7721
  const t = { ...this.viewBounds };
7527
7722
  if (this.animationConfig.enabled && e.animate !== !1) {
7528
- const n = vi(
7723
+ const n = Mi(
7529
7724
  this.getAnimatedNavContext(),
7530
7725
  e
7531
7726
  );
@@ -7533,7 +7728,7 @@ class _n {
7533
7728
  s.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", s);
7534
7729
  });
7535
7730
  } else
7536
- fi(this.getNavContext(), e);
7731
+ mi(this.getNavContext(), e);
7537
7732
  this.pluginManager.notifyViewChange({
7538
7733
  previous: t,
7539
7734
  current: { ...this.viewBounds },
@@ -7543,7 +7738,7 @@ class _n {
7543
7738
  }
7544
7739
  pan(e, t, n) {
7545
7740
  const s = { ...this.viewBounds };
7546
- gi(this.getNavContext(), e, t, n), this.pluginManager.notifyViewChange({
7741
+ pi(this.getNavContext(), e, t, n), this.pluginManager.notifyViewChange({
7547
7742
  previous: s,
7548
7743
  current: { ...this.viewBounds },
7549
7744
  trigger: "pan",
@@ -7556,7 +7751,7 @@ class _n {
7556
7751
  fit(e) {
7557
7752
  this.executeOrQueue("fit", () => {
7558
7753
  const t = { ...this.viewBounds }, n = e == null ? void 0 : e.padding;
7559
- mi(this.getNavContext(), {
7754
+ bi(this.getNavContext(), {
7560
7755
  x: e == null ? void 0 : e.x,
7561
7756
  y: e == null ? void 0 : e.y,
7562
7757
  padding: n
@@ -7578,7 +7773,7 @@ class _n {
7578
7773
  this.executeOrQueue("autoScale", () => {
7579
7774
  const t = { ...this.viewBounds };
7580
7775
  if (this.animationConfig.enabled && e) {
7581
- const n = Si(
7776
+ const n = Ci(
7582
7777
  this.getAnimatedNavContext(),
7583
7778
  !0
7584
7779
  );
@@ -7586,7 +7781,7 @@ class _n {
7586
7781
  s.message !== "Animation cancelled" && console.error("[SciPlot] Animation error:", s);
7587
7782
  });
7588
7783
  } else
7589
- yi(this.getNavContext());
7784
+ xi(this.getNavContext());
7590
7785
  this.pluginManager.notifyViewChange({
7591
7786
  previous: t,
7592
7787
  current: { ...this.viewBounds },
@@ -7600,14 +7795,14 @@ class _n {
7600
7795
  * Used during streaming to prevent X-axis shifting
7601
7796
  */
7602
7797
  autoScaleYOnly() {
7603
- pi(this.getNavContext()), this.requestRender();
7798
+ vi(this.getNavContext()), this.requestRender();
7604
7799
  }
7605
7800
  /**
7606
7801
  * Animate view bounds to specific target
7607
7802
  */
7608
7803
  animateTo(e) {
7609
7804
  var n, s, o, r;
7610
- const t = wi(
7805
+ const t = Ai(
7611
7806
  this.getAnimatedNavContext(),
7612
7807
  {
7613
7808
  xMin: (n = e.xRange) == null ? void 0 : n[0],
@@ -7647,7 +7842,7 @@ class _n {
7647
7842
  }
7648
7843
  handleBoxZoom(e) {
7649
7844
  const t = e === null;
7650
- this.selectionRect = xi(
7845
+ this.selectionRect = wi(
7651
7846
  this.getNavContext(),
7652
7847
  e,
7653
7848
  this.selectionRect,
@@ -7706,10 +7901,10 @@ class _n {
7706
7901
  }
7707
7902
  // Export
7708
7903
  exportCSV(e) {
7709
- return si(this.getAllSeries(), e);
7904
+ return ai(this.getAllSeries(), e);
7710
7905
  }
7711
7906
  exportJSON(e) {
7712
- return oi(this.getAllSeries(), this.viewBounds, e);
7907
+ return li(this.getAllSeries(), this.viewBounds, e);
7713
7908
  }
7714
7909
  // ============================================
7715
7910
  // Axis Management
@@ -7744,7 +7939,7 @@ class _n {
7744
7939
  }
7745
7940
  async initGpuRenderer() {
7746
7941
  var t, n;
7747
- const e = await Nt(this.webglCanvas, {
7942
+ const e = await qt(this.webglCanvas, {
7748
7943
  backend: "webgpu",
7749
7944
  powerPreference: "high-performance"
7750
7945
  });
@@ -7769,7 +7964,7 @@ class _n {
7769
7964
  this.axisManager.updateXAxis(e), this.requestRender();
7770
7965
  }
7771
7966
  updateLayout(e) {
7772
- this.layout = it({
7967
+ this.layout = st({
7773
7968
  ...this.layout,
7774
7969
  ...e
7775
7970
  }), this.requestRender();
@@ -7992,7 +8187,7 @@ class _n {
7992
8187
  resize() {
7993
8188
  if (this.isDestroyed || this.resizeSuspended || !this.renderer) return;
7994
8189
  const e = this.initialOptions.devicePixelRatio ?? window.devicePixelRatio;
7995
- Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), tn(
8190
+ Math.abs(e - this.dpr) > 1e-3 && (this.dpr = e, this.renderer.setDPR(this.dpr)), an(
7996
8191
  this.container,
7997
8192
  this.webglCanvas,
7998
8193
  this.overlayCanvas,
@@ -8052,9 +8247,9 @@ class _n {
8052
8247
  this.selectionManager.clearSelection(), await new Promise((e) => requestAnimationFrame(() => requestAnimationFrame(e))), this.animationEngine.isAnimating() && await this.animationEngine.waitForIdle(), this.deltaTool && this.deltaTool.recalculate(), this.peakTool && this.peakTool.recalculate(), this.requestOverlayRender();
8053
8248
  }
8054
8249
  }
8055
- function ls(i) {
8056
- const e = new _n(i);
8057
- return gn().then((t) => {
8250
+ function ps(i) {
8251
+ const e = new jn(i);
8252
+ return bn().then((t) => {
8058
8253
  if (e.setInitQueueId(t), e.isDestroyed) {
8059
8254
  Ie(t);
8060
8255
  return;
@@ -8065,63 +8260,65 @@ function ls(i) {
8065
8260
  }), e;
8066
8261
  }
8067
8262
  export {
8068
- On as $,
8069
- et as A,
8070
- O as B,
8071
- yn as C,
8263
+ os as $,
8264
+ it as A,
8265
+ ns as B,
8266
+ vn as C,
8072
8267
  Te as D,
8073
- Zt as E,
8074
- nt as F,
8075
- Xe as G,
8076
- Ne as H,
8077
- xn as I,
8078
- bn as J,
8079
- vn as K,
8080
- te as L,
8268
+ ei as E,
8269
+ et as F,
8270
+ O as G,
8271
+ ot as H,
8272
+ Xe as I,
8273
+ Ne as J,
8274
+ Mn as K,
8275
+ Kt as L,
8081
8276
  ae as M,
8082
8277
  Pe as N,
8083
- Kt as O,
8084
- Sn as P,
8085
- ss as Q,
8086
- os as R,
8087
- Ei as S,
8088
- Tn as T,
8089
- In as U,
8090
- En as V,
8091
- Rn as W,
8092
- Fn as X,
8093
- rs as Y,
8094
- Qn as Z,
8095
- kn as _,
8096
- $n as a,
8097
- ot as a0,
8098
- Zn as a1,
8099
- an as a2,
8100
- ln as a3,
8101
- Se as b,
8102
- ls as c,
8103
- as as d,
8104
- Ln as e,
8105
- bi as f,
8106
- Kn as g,
8107
- X as h,
8108
- _e as i,
8109
- jn as j,
8110
- es as k,
8111
- ns as l,
8112
- it as m,
8113
- ie as n,
8114
- Jn as o,
8115
- je as p,
8116
- ts as q,
8117
- st as r,
8278
+ ii as O,
8279
+ Cn as P,
8280
+ An as Q,
8281
+ Pn as R,
8282
+ Di as S,
8283
+ fs as T,
8284
+ gs as U,
8285
+ Dn as V,
8286
+ Ln as W,
8287
+ zn as X,
8288
+ On as Y,
8289
+ $n as Z,
8290
+ ys as _,
8291
+ Nn as a,
8292
+ Rn as a0,
8293
+ at as a1,
8294
+ rs as a2,
8295
+ Gn as a3,
8296
+ dn as a4,
8297
+ fn as a5,
8298
+ ms as b,
8299
+ ps as c,
8300
+ Xn as d,
8301
+ qi as e,
8302
+ ti as f,
8303
+ we as g,
8304
+ _n as h,
8305
+ ls as i,
8306
+ te as j,
8307
+ Si as k,
8308
+ X as l,
8309
+ st as m,
8310
+ _e as n,
8311
+ ss as o,
8312
+ hs as p,
8313
+ cs as q,
8314
+ rt as r,
8118
8315
  Y as s,
8119
- _ as t,
8120
- Qt as u,
8121
- jt as v,
8122
- is as w,
8123
- Jt as x,
8124
- Gn as y,
8125
- Je as z
8316
+ ds as t,
8317
+ ie as u,
8318
+ as as v,
8319
+ us as w,
8320
+ Qe as x,
8321
+ _ as y,
8322
+ Jt as z
8126
8323
  };
8127
- //# sourceMappingURL=ChartCore-DQ691eXH.js.map
8324
+ //# sourceMappingURL=ChartCore-BhQ4j7f5.js.map