velo-plot 2.0.0 → 2.20.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 (65) hide show
  1. package/dist/{ChartCore-BhQ4j7f5.js → ChartCore-ivzLqxVb.js} +419 -393
  2. package/dist/ChartCore-ivzLqxVb.js.map +1 -0
  3. package/dist/{SciPlot-GJvw7GJo.js → SciPlot-CEU4ApgD.js} +2 -2
  4. package/dist/{SciPlot-GJvw7GJo.js.map → SciPlot-CEU4ApgD.js.map} +1 -1
  5. package/dist/{axisFormat-SPX-CD5s.js → axisFormat-CzumxpCL.js} +3 -3
  6. package/dist/axisFormat-CzumxpCL.js.map +1 -0
  7. package/dist/core/chart/ChartAxisManager.d.ts +2 -0
  8. package/dist/core/chart/ChartCore.d.ts +15 -0
  9. package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
  10. package/dist/core/chart/ChartRenderLoop.d.ts +2 -0
  11. package/dist/core/chart/ChartStateManager.d.ts +2 -0
  12. package/dist/core/chart/types.d.ts +5 -0
  13. package/dist/core/sync/index.d.ts +0 -1
  14. package/dist/{createStackedChart-DJSmqerD.js → createStackedChart-DxNW0VkF.js} +178 -179
  15. package/dist/createStackedChart-DxNW0VkF.js.map +1 -0
  16. package/dist/{index-D7dTq6VB.js → index-BBpJwOct.js} +17 -19
  17. package/dist/index-BBpJwOct.js.map +1 -0
  18. package/dist/{index-CUGS98p4.js → index-CaXWSOTk.js} +3 -6
  19. package/dist/index-CaXWSOTk.js.map +1 -0
  20. package/dist/{index-CWipqOLP.js → index-qunX30Xu.js} +2 -2
  21. package/dist/{index-CWipqOLP.js.map → index-qunX30Xu.js.map} +1 -1
  22. package/dist/{index.core-fpZ1dYN0.js → index.core-COREBDNq.js} +25 -24
  23. package/dist/{index.core-fpZ1dYN0.js.map → index.core-COREBDNq.js.map} +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/{mockDatafeed-Cdg5hKEo.js → mockDatafeed-927foCM4.js} +2 -2
  26. package/dist/mockDatafeed-927foCM4.js.map +1 -0
  27. package/dist/plugins/analysis/contours.d.ts +31 -0
  28. package/dist/plugins/analysis.js +494 -407
  29. package/dist/plugins/analysis.js.map +1 -1
  30. package/dist/plugins/broken-axis.js +170 -181
  31. package/dist/plugins/broken-axis.js.map +1 -1
  32. package/dist/plugins/forecasting/algorithms.d.ts +7 -2
  33. package/dist/plugins/forecasting/types.d.ts +13 -3
  34. package/dist/plugins/forecasting.js +355 -175
  35. package/dist/plugins/forecasting.js.map +1 -1
  36. package/dist/plugins/latex/symbols.d.ts +50 -0
  37. package/dist/plugins/latex/types.d.ts +13 -1
  38. package/dist/plugins/latex.js +351 -331
  39. package/dist/plugins/latex.js.map +1 -1
  40. package/dist/plugins/ml-integration/native-algorithms.d.ts +24 -4
  41. package/dist/plugins/ml-integration/types.d.ts +19 -0
  42. package/dist/plugins/ml-integration.js +191 -140
  43. package/dist/plugins/ml-integration.js.map +1 -1
  44. package/dist/plugins/pattern-recognition/types.d.ts +28 -1
  45. package/dist/plugins/pattern-recognition.js +416 -343
  46. package/dist/plugins/pattern-recognition.js.map +1 -1
  47. package/dist/plugins/snapshot.js +36 -36
  48. package/dist/plugins/snapshot.js.map +1 -1
  49. package/dist/plugins/sync.js +1 -1
  50. package/dist/plugins/tools.js +1 -1
  51. package/dist/plugins/virtualization.js +1 -1
  52. package/dist/react.js +2 -2
  53. package/dist/symbols-DT0eLlpW.js +568 -0
  54. package/dist/symbols-DT0eLlpW.js.map +1 -0
  55. package/dist/trading.js +5 -5
  56. package/dist/velo-plot.full.js +184 -182
  57. package/dist/velo-plot.js +3 -3
  58. package/dist/workers/indicatorsAsync.d.ts +24 -0
  59. package/package.json +1 -1
  60. package/dist/ChartCore-BhQ4j7f5.js.map +0 -1
  61. package/dist/axisFormat-SPX-CD5s.js.map +0 -1
  62. package/dist/createStackedChart-DJSmqerD.js.map +0 -1
  63. package/dist/index-CUGS98p4.js.map +0 -1
  64. package/dist/index-D7dTq6VB.js.map +0 -1
  65. package/dist/mockDatafeed-Cdg5hKEo.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { m as Lt, M as G, c as St, g as Yt, a as Bt, r as _t, h as Ot, b as jt, i as Nt } from "./ChartCore-BhQ4j7f5.js";
2
- import { c as Wt } from "./index-CUGS98p4.js";
3
- const ot = 5, rt = 1 / 6, qt = { top: 4, bottom: 8, left: 4 }, Dt = { bottom: 55 };
4
- function Gt(t) {
1
+ import { m as Mt, M as W, c as St, g as Ot, a as Yt, r as Bt, h as _t, b as jt, i as Nt } from "./ChartCore-ivzLqxVb.js";
2
+ import { c as qt } from "./index-CaXWSOTk.js";
3
+ const ot = 5, rt = 1 / 6, Gt = { top: 4, bottom: 8, left: 4 }, Lt = { bottom: 55 };
4
+ function Wt(t) {
5
5
  if (typeof t == "number") return t;
6
6
  switch (t) {
7
7
  case "8k":
@@ -30,7 +30,7 @@ function Pt(t, n) {
30
30
  };
31
31
  }
32
32
  async function Kt(t, n, o, r, a, d = {}) {
33
- var h;
33
+ var f;
34
34
  const {
35
35
  format: b = "png",
36
36
  quality: k = 0.92,
@@ -38,57 +38,57 @@ async function Kt(t, n, o, r, a, d = {}) {
38
38
  includeBackground: R = !0,
39
39
  includeDividers: X = !0,
40
40
  transparent: H = !1
41
- } = d, E = Gt(y), $ = (((h = o[0]) == null ? void 0 : h.getDPR()) ?? (typeof window < "u" ? window.devicePixelRatio : 1)) * E, _ = o.map((l) => l.getDPR());
41
+ } = d, E = Wt(y), C = (((f = o[0]) == null ? void 0 : f.getDPR()) ?? (typeof window < "u" ? window.devicePixelRatio : 1)) * E, B = o.map((l) => l.getDPR());
42
42
  try {
43
43
  if (E > 1) {
44
- for (const m of o)
45
- m.setDPR($), m.render();
46
- await new Promise((m) => requestAnimationFrame(m)), await new Promise((m) => setTimeout(m, 50));
44
+ for (const u of o)
45
+ typeof u.setDevicePixelRatioOverride == "function" ? u.setDevicePixelRatioOverride(C) : u.setDPR(C), u.render();
46
+ await new Promise((u) => requestAnimationFrame(u)), await new Promise((u) => requestAnimationFrame(u)), await new Promise((u) => setTimeout(u, 50));
47
47
  }
48
- const l = t.getBoundingClientRect(), T = Math.max(1, Math.round(l.width * $)), S = Math.max(1, Math.round(l.height * $)), u = document.createElement("canvas");
49
- u.width = T, u.height = S;
50
- const f = u.getContext("2d");
51
- if (!f) throw new Error("Failed to create export canvas");
52
- !H && R && (f.fillStyle = a || "#ffffff", f.fillRect(0, 0, T, S));
48
+ const l = t.getBoundingClientRect(), T = Math.max(1, Math.round(l.width * C)), S = Math.max(1, Math.round(l.height * C)), h = document.createElement("canvas");
49
+ h.width = T, h.height = S;
50
+ const m = h.getContext("2d");
51
+ if (!m) throw new Error("Failed to create export canvas");
52
+ !H && R && (m.fillStyle = a || "#ffffff", m.fillRect(0, 0, T, S));
53
53
  const g = b === "jpeg" ? "jpeg" : "png";
54
- for (let m = 0; m < n.length; m++) {
55
- const w = Pt(n[m], l), M = o[m].exportImage(g), A = await Ut(M);
56
- f.drawImage(
54
+ for (let u = 0; u < n.length; u++) {
55
+ const w = Pt(n[u], l), D = o[u].exportImage(g), A = await Ut(D);
56
+ m.drawImage(
57
57
  A,
58
- Math.round(w.x * $),
59
- Math.round(w.y * $),
60
- Math.round(w.width * $),
61
- Math.round(w.height * $)
58
+ Math.round(w.x * C),
59
+ Math.round(w.y * C),
60
+ Math.round(w.width * C),
61
+ Math.round(w.height * C)
62
62
  );
63
63
  }
64
64
  if (X && r.length) {
65
- f.fillStyle = "rgba(128, 128, 128, 0.35)";
66
- for (const m of r) {
67
- const w = Pt(m, l);
68
- f.fillRect(
69
- Math.round(w.x * $),
70
- Math.round(w.y * $),
71
- Math.max(1, Math.round(w.width * $)),
72
- Math.max(1, Math.round(w.height * $))
65
+ m.fillStyle = "rgba(128, 128, 128, 0.35)";
66
+ for (const u of r) {
67
+ const w = Pt(u, l);
68
+ m.fillRect(
69
+ Math.round(w.x * C),
70
+ Math.round(w.y * C),
71
+ Math.max(1, Math.round(w.width * C)),
72
+ Math.max(1, Math.round(w.height * C))
73
73
  );
74
74
  }
75
75
  }
76
76
  const v = b === "jpeg" ? "image/jpeg" : b === "webp" ? "image/webp" : "image/png";
77
- return u.toDataURL(v, k);
77
+ return h.toDataURL(v, k);
78
78
  } finally {
79
79
  if (E > 1)
80
80
  for (let l = 0; l < o.length; l++)
81
- o[l].setDPR(_[l]), o[l].render();
81
+ typeof o[l].setDevicePixelRatioOverride == "function" ? o[l].setDevicePixelRatioOverride(null) : o[l].setDPR(B[l]), o[l].render();
82
82
  }
83
83
  }
84
- const D = "velo-pane-divider", F = "velo-pane-resizing";
84
+ const L = "velo-pane-divider", F = "velo-pane-resizing";
85
85
  function Qt(t) {
86
86
  if (typeof document > "u") return;
87
87
  let n = document.getElementById("velo-pane-divider-styles");
88
88
  n || (n = document.createElement("style"), n.id = "velo-pane-divider-styles", document.head.appendChild(n));
89
89
  const r = t === "horizontal" ? "ew-resize" : "ns-resize";
90
90
  n.textContent = `
91
- .${D} {
91
+ .${L} {
92
92
  flex: 0 0 var(--velo-divider-size, 6px);
93
93
  position: relative;
94
94
  cursor: ${r};
@@ -97,39 +97,39 @@ function Qt(t) {
97
97
  background: transparent;
98
98
  user-select: none;
99
99
  }
100
- .${D}::after {
100
+ .${L}::after {
101
101
  content: "";
102
102
  position: absolute;
103
103
  background: rgba(128, 128, 128, 0.35);
104
104
  transition: background 0.15s;
105
105
  }
106
- .${D}[data-direction="vertical"]::after {
106
+ .${L}[data-direction="vertical"]::after {
107
107
  left: 0;
108
108
  right: 0;
109
109
  top: 50%;
110
110
  transform: translateY(-50%);
111
111
  height: 1px;
112
112
  }
113
- .${D}[data-direction="horizontal"]::after {
113
+ .${L}[data-direction="horizontal"]::after {
114
114
  top: 0;
115
115
  bottom: 0;
116
116
  left: 50%;
117
117
  transform: translateX(-50%);
118
118
  width: 1px;
119
119
  }
120
- .${D}:hover::after,
121
- .${F} .${D}::after {
120
+ .${L}:hover::after,
121
+ .${F} .${L}::after {
122
122
  background: rgba(0, 242, 255, 0.65);
123
123
  }
124
- .${D}[data-direction="vertical"]:hover::after,
125
- .${F} .${D}[data-direction="vertical"]::after {
124
+ .${L}[data-direction="vertical"]:hover::after,
125
+ .${F} .${L}[data-direction="vertical"]::after {
126
126
  height: 2px;
127
127
  }
128
- .${D}[data-direction="horizontal"]:hover::after,
129
- .${F} .${D}[data-direction="horizontal"]::after {
128
+ .${L}[data-direction="horizontal"]:hover::after,
129
+ .${F} .${L}[data-direction="horizontal"]::after {
130
130
  width: 2px;
131
131
  }
132
- .${D}-handle {
132
+ .${L}-handle {
133
133
  position: absolute;
134
134
  left: 50%;
135
135
  top: 50%;
@@ -146,8 +146,8 @@ function Qt(t) {
146
146
  font-size: 10px;
147
147
  line-height: 1;
148
148
  }
149
- .${D}:hover .${D}-handle,
150
- .${F} .${D}-handle {
149
+ .${L}:hover .${L}-handle,
150
+ .${F} .${L}-handle {
151
151
  opacity: 1;
152
152
  }
153
153
  .${F} {
@@ -164,9 +164,9 @@ function Qt(t) {
164
164
  }
165
165
  function Zt(t, n, o) {
166
166
  const r = document.createElement("div");
167
- r.className = D, r.dataset.dividerIndex = String(t), r.dataset.direction = o, r.style.setProperty("--velo-divider-size", `${n}px`);
167
+ r.className = L, r.dataset.dividerIndex = String(t), r.dataset.direction = o, r.style.setProperty("--velo-divider-size", `${n}px`);
168
168
  const a = document.createElement("div");
169
- return a.className = `${D}-handle`, a.textContent = o === "horizontal" ? "⇔" : "⇕", r.appendChild(a), r;
169
+ return a.className = `${L}-handle`, a.textContent = o === "horizontal" ? "⇔" : "⇕", r.appendChild(a), r;
170
170
  }
171
171
  function Vt(t, n) {
172
172
  const o = n === "horizontal" ? "min-width:0;" : "min-height:0;";
@@ -197,58 +197,58 @@ function te(t, n) {
197
197
  function ee(t, n, o, r, a = {}) {
198
198
  const d = a.direction ?? "vertical", b = d === "horizontal";
199
199
  Qt(d);
200
- const k = a.minPaneRatio ?? rt, y = a.minPanePx ?? 0, R = a.dividerSize ?? 6, X = n.length, H = (h) => b ? Jt(h, X, k, y) : kt(h, X, k, y), E = [], W = [];
200
+ const k = a.minPaneRatio ?? rt, y = a.minPanePx ?? 0, R = a.dividerSize ?? 6, X = n.length, H = (f) => b ? Jt(f, X, k, y) : kt(f, X, k, y), E = [], q = [];
201
201
  if (n.length < 2)
202
202
  return { dividers: E, destroy: () => {
203
203
  } };
204
- const $ = () => {
205
- const h = E.length * R, l = b ? t.clientWidth : t.clientHeight;
206
- return Math.max(1, l - h);
207
- }, _ = (h, l, T, S) => {
204
+ const C = () => {
205
+ const f = E.length * R, l = b ? t.clientWidth : t.clientHeight;
206
+ return Math.max(1, l - f);
207
+ }, B = (f, l, T, S) => {
208
208
  var A;
209
- const u = $(), f = H(u), g = S.reduce(
210
- (x, z, I) => I === h || I === l ? x : x + z,
209
+ const h = C(), m = H(h), g = S.reduce(
210
+ (x, z, I) => I === f || I === l ? x : x + z,
211
211
  0
212
- ), v = u - g;
213
- let m = S[h] + T;
214
- m = Math.max(f, Math.min(v - f, m));
215
- const w = v - m;
216
- S[h] = m, S[l] = w;
217
- const M = r.reduce((x, z) => x + z, 0);
218
- if (r[h] = m / u * M, r[l] = w / u * M, (A = a.onDragMove) == null || A.call(a, S, h, l), a.onResize) {
212
+ ), v = h - g;
213
+ let u = S[f] + T;
214
+ u = Math.max(m, Math.min(v - m, u));
215
+ const w = v - u;
216
+ S[f] = u, S[l] = w;
217
+ const D = r.reduce((x, z) => x + z, 0);
218
+ if (r[f] = u / h * D, r[l] = w / h * D, (A = a.onDragMove) == null || A.call(a, S, f, l), a.onResize) {
219
219
  const x = {};
220
220
  for (let z = 0; z < o.length; z++)
221
221
  x[o[z]] = r[z];
222
222
  a.onResize(x);
223
223
  }
224
224
  };
225
- for (let h = 0; h < n.length - 1; h++) {
226
- const l = Zt(h, R, d);
227
- n[h].after(l), E.push(l);
228
- const S = (u) => {
229
- var w, M;
230
- u.preventDefault(), l.setPointerCapture(u.pointerId), t.classList.add(F);
231
- const f = ((w = a.onDragStart) == null ? void 0 : w.call(a, h, h + 1)) ?? n.map(
225
+ for (let f = 0; f < n.length - 1; f++) {
226
+ const l = Zt(f, R, d);
227
+ n[f].after(l), E.push(l);
228
+ const S = (h) => {
229
+ var w, D;
230
+ h.preventDefault(), l.setPointerCapture(h.pointerId), t.classList.add(F);
231
+ const m = ((w = a.onDragStart) == null ? void 0 : w.call(a, f, f + 1)) ?? n.map(
232
232
  (A) => b ? A.getBoundingClientRect().width : A.getBoundingClientRect().height
233
233
  );
234
- (M = a.onDragMove) == null || M.call(a, f, h, h + 1);
235
- let g = b ? u.clientX : u.clientY;
234
+ (D = a.onDragMove) == null || D.call(a, m, f, f + 1);
235
+ let g = b ? h.clientX : h.clientY;
236
236
  const v = (A) => {
237
237
  const x = b ? A.clientX : A.clientY, z = x - g;
238
- g = x, z !== 0 && _(h, h + 1, z, f);
239
- }, m = (A) => {
238
+ g = x, z !== 0 && B(f, f + 1, z, m);
239
+ }, u = (A) => {
240
240
  var x;
241
- l.releasePointerCapture(A.pointerId), t.classList.remove(F), l.removeEventListener("pointermove", v), l.removeEventListener("pointerup", m), l.removeEventListener("pointercancel", m), (x = a.onDragEnd) == null || x.call(a, f);
241
+ l.releasePointerCapture(A.pointerId), t.classList.remove(F), l.removeEventListener("pointermove", v), l.removeEventListener("pointerup", u), l.removeEventListener("pointercancel", u), (x = a.onDragEnd) == null || x.call(a, m);
242
242
  };
243
- l.addEventListener("pointermove", v), l.addEventListener("pointerup", m), l.addEventListener("pointercancel", m);
243
+ l.addEventListener("pointermove", v), l.addEventListener("pointerup", u), l.addEventListener("pointercancel", u);
244
244
  };
245
- l.addEventListener("pointerdown", S), W.push(() => l.removeEventListener("pointerdown", S));
245
+ l.addEventListener("pointerdown", S), q.push(() => l.removeEventListener("pointerdown", S));
246
246
  }
247
247
  return {
248
248
  dividers: E,
249
249
  destroy: () => {
250
- for (const h of W) h();
251
- for (const h of E) h.remove();
250
+ for (const f of q) f();
251
+ for (const f of E) f.remove();
252
252
  t.classList.remove(F);
253
253
  }
254
254
  };
@@ -310,39 +310,38 @@ function se(t, n) {
310
310
  return n + o;
311
311
  }
312
312
  function ce(t, n) {
313
- const o = n === "horizontal" ? "min-width:0;" : "min-height:0;";
314
- return typeof t == "number" ? `flex:${t} 1 0;${o}` : `flex:1 1 ${t};${o}`;
313
+ return `flex:${t} 1 0;${n === "horizontal" ? "min-width:0;" : "min-height:0;"}`;
315
314
  }
316
315
  function $t(t) {
317
316
  if (!(t != null && t.length)) return [];
318
317
  const n = [];
319
318
  for (const o of t)
320
- o.type === "indicator" ? n.push(...Yt(o)) : n.push(o);
319
+ o.type === "indicator" ? n.push(...Ot(o)) : n.push(o);
321
320
  return n;
322
321
  }
323
- function Mt(t, n, o, r, a, d, b, k, y) {
324
- var M, A, x, z, I, V, U, K, Q, J, tt, et, nt;
325
- const R = r === 0, X = r === a - 1, H = y === "horizontal", W = !H && o.sharedXAxis !== "none" && !b, _ = H && (o.sharedYAxis ?? "left") !== "none" && !k, l = (o.gap ?? 0) > 0 ? qt : { top: 0, bottom: 0, left: 0 }, T = H ? {
322
+ function Dt(t, n, o, r, a, d, b, k, y) {
323
+ var D, A, x, z, I, V, U, K, Q, J, tt, et, nt;
324
+ const R = r === 0, X = r === a - 1, H = y === "horizontal", q = !H && o.sharedXAxis !== "none" && !b, B = H && (o.sharedYAxis ?? "left") !== "none" && !k, l = (o.gap ?? 0) > 0 ? Gt : { top: 0, bottom: 0, left: 0 }, T = H ? {
326
325
  top: d.top,
327
- right: X ? d.right : l.left ?? 0,
328
- left: _ ? l.left ?? 4 : d.left,
326
+ right: X ? d.right : l.left,
327
+ left: B ? l.left : d.left,
329
328
  bottom: d.bottom
330
329
  } : {
331
330
  top: R ? d.top : l.top,
332
331
  right: d.right,
333
332
  left: d.left,
334
- bottom: W ? l.bottom : X ? ((A = (M = o.layout) == null ? void 0 : M.margins) == null ? void 0 : A.bottom) ?? Dt.bottom : d.bottom
335
- }, S = ((x = t.chart) == null ? void 0 : x.xAxis) ?? {}, u = {
333
+ bottom: q ? l.bottom : X ? ((A = (D = o.layout) == null ? void 0 : D.margins) == null ? void 0 : A.bottom) ?? Lt.bottom : d.bottom
334
+ }, S = ((x = t.chart) == null ? void 0 : x.xAxis) ?? {}, h = {
336
335
  ...S,
337
336
  showLine: b ? S.showLine ?? !0 : !1,
338
337
  showTicks: b ? S.showTicks ?? !0 : !1,
339
338
  showLabels: b ? S.showLabels ?? !0 : !1
340
- }, f = ((z = t.chart) == null ? void 0 : z.yAxis) ?? {}, v = (Array.isArray(f) ? f : [f]).map((q) => ({
341
- ...q,
342
- showLine: k ? q.showLine ?? !0 : !1,
343
- showTicks: k ? q.showTicks ?? !0 : !1,
344
- showLabels: k ? q.showLabels ?? !0 : !1
345
- })), m = Array.isArray((I = t.chart) == null ? void 0 : I.yAxis) ? v : v[0];
339
+ }, m = ((z = t.chart) == null ? void 0 : z.yAxis) ?? {}, v = (Array.isArray(m) ? m : [m]).map((G) => ({
340
+ ...G,
341
+ showLine: k ? G.showLine ?? !0 : !1,
342
+ showTicks: k ? G.showTicks ?? !0 : !1,
343
+ showLabels: k ? G.showLabels ?? !0 : !1
344
+ })), u = Array.isArray((I = t.chart) == null ? void 0 : I.yAxis) ? v : v[0];
346
345
  return (t.interactive ?? !0) || (n.style.pointerEvents = "none"), {
347
346
  ...t.chart,
348
347
  id: t.id,
@@ -351,9 +350,9 @@ function Mt(t, n, o, r, a, d, b, k, y) {
351
350
  theme: ((U = t.chart) == null ? void 0 : U.theme) ?? o.theme,
352
351
  devicePixelRatio: o.devicePixelRatio ?? ((K = t.chart) == null ? void 0 : K.devicePixelRatio),
353
352
  loading: ((Q = t.chart) == null ? void 0 : Q.loading) ?? !1,
354
- xAxis: u,
355
- yAxis: m,
356
- layout: Lt({
353
+ xAxis: h,
354
+ yAxis: u,
355
+ layout: Mt({
357
356
  ...o.layout,
358
357
  ...(J = t.chart) == null ? void 0 : J.layout,
359
358
  margins: { ...T, ...(tt = o.layout) == null ? void 0 : tt.margins, ...(nt = (et = t.chart) == null ? void 0 : et.layout) == null ? void 0 : nt.margins }
@@ -388,32 +387,32 @@ function fe(t) {
388
387
  if (!n) throw new Error("[StackedChart] container is required");
389
388
  if (o.length < 1 || o.length > ot)
390
389
  throw new Error(`[StackedChart] panes must be 1–${ot}`);
391
- const r = t.masterPaneId ?? o[0].id, a = t.direction ?? "vertical", d = a === "horizontal", b = t.sharedXAxis ?? "bottom", k = t.sharedYAxis ?? "left", y = t.gap ?? 0, R = t.resizable, X = !!R, H = typeof R == "object" ? R.dividerSize ?? 6 : 6, E = Lt(t.layout), W = ((ut = E.margins) == null ? void 0 : ut.left) ?? G.left, $ = ((ht = E.margins) == null ? void 0 : ht.right) ?? G.right, _ = ((ft = E.margins) == null ? void 0 : ft.top) ?? G.top, h = ae(o, W), l = se(o, $);
390
+ const r = t.masterPaneId ?? o[0].id, a = t.direction ?? "vertical", d = a === "horizontal", b = t.sharedXAxis ?? "bottom", k = t.sharedYAxis ?? "left", y = t.gap ?? 0, R = t.resizable, X = !!R, H = typeof R == "object" ? R.dividerSize ?? 6 : 6, E = Mt(t.layout), q = ((ut = E.margins) == null ? void 0 : ut.left) ?? W.left, C = ((ht = E.margins) == null ? void 0 : ht.right) ?? W.right, B = ((ft = E.margins) == null ? void 0 : ft.top) ?? W.top, f = ae(o, q), l = se(o, C);
392
391
  n.replaceChildren(), n.style.display = "flex", n.style.flexDirection = d ? "row" : "column", n.style.width = "100%";
393
392
  const T = n.offsetHeight || parseInt(getComputedStyle(n).height, 10), S = n.offsetWidth || parseInt(getComputedStyle(n).width, 10);
394
- d ? (S > 0 ? (n.style.width = `${S}px`, n.style.minWidth = `${S}px`) : n.style.width || (n.style.minWidth = "480px"), n.style.height = T > 0 ? `${T}px` : "320px", n.style.minHeight = n.style.height) : T > 0 ? (n.style.height = `${T}px`, n.style.minHeight = `${T}px`) : n.style.height || (n.style.minHeight = "320px"), n.style.overflow = "hidden", n.style.position = "relative";
395
- const u = o.map((e) => e.id), f = o.map((e) => Rt(e.height)), g = /* @__PURE__ */ new Map(), v = [], m = [];
396
- let w = null, M = !1, A = 0, x = 0, z = null;
393
+ d ? (S > 0 && (n.style.width = `${S}px`, n.style.minWidth = `${S}px`), n.style.height = T > 0 ? `${T}px` : "320px", n.style.minHeight = n.style.height) : T > 0 ? (n.style.height = `${T}px`, n.style.minHeight = `${T}px`) : n.style.height || (n.style.minHeight = "320px"), n.style.overflow = "hidden", n.style.position = "relative";
394
+ const h = o.map((e) => e.id), m = o.map((e) => Rt(e.height)), g = /* @__PURE__ */ new Map(), v = [], u = [];
395
+ let w = null, D = !1, A = 0, x = 0, z = null;
397
396
  const I = (e) => {
398
397
  const i = Array.from({ length: v.length }, (s, c) => c);
399
398
  for (const s of i) {
400
- const c = g.get(u[s]);
399
+ const c = g.get(h[s]);
401
400
  c && c.resize();
402
401
  }
403
402
  Ct(
404
- i.map((s) => m[s]).filter(Boolean)
403
+ i.map((s) => u[s]).filter(Boolean)
405
404
  );
406
405
  }, V = () => {
407
406
  A || (A = requestAnimationFrame(() => {
408
- A = 0, !M && I();
407
+ A = 0, !D && I();
409
408
  }));
410
409
  }, U = new ResizeObserver(() => {
411
- M || V();
410
+ D || V();
412
411
  });
413
412
  U.observe(n);
414
413
  const K = () => {
415
414
  for (let e = 0; e < v.length; e++)
416
- v[e].style.cssText = it(f[e], y, e, a);
415
+ v[e].style.cssText = it(m[e], y, e, a);
417
416
  }, Q = () => {
418
417
  const e = (v.length - 1) * H;
419
418
  return d ? Math.max(1, n.clientWidth - e) : Math.max(1, n.clientHeight - e);
@@ -433,58 +432,58 @@ function fe(t) {
433
432
  v[i].style.cssText = `${p}:${s}px;flex:0 0 auto;min-height:0;min-width:0;position:relative;overflow:hidden;${c}`;
434
433
  }
435
434
  }, nt = () => {
436
- if (x = 0, !M || !z) return;
435
+ if (x = 0, !D || !z) return;
437
436
  const { sizes: e, leadingIdx: i, trailingIdx: s } = z;
438
437
  et(e);
439
438
  for (const c of [i, s]) {
440
- const p = g.get(u[c]);
441
- p && (p.resize(), Ct([m[c]]));
439
+ const p = g.get(h[c]);
440
+ p && (p.resize(), Ct([u[c]]));
442
441
  }
443
- }, q = (e, i, s) => {
442
+ }, G = (e, i, s) => {
444
443
  z = { sizes: e, leadingIdx: i, trailingIdx: s }, !x && (x = requestAnimationFrame(nt));
445
444
  }, Tt = (e) => {
446
445
  const i = e.reduce((c, p) => c + p, 0);
447
446
  if (i <= 0) return;
448
- const s = f.reduce((c, p) => c + p, 0);
449
- for (let c = 0; c < f.length; c++)
450
- f[c] = e[c] / i * s;
447
+ const s = m.reduce((c, p) => c + p, 0);
448
+ for (let c = 0; c < m.length; c++)
449
+ m[c] = e[c] / i * s;
451
450
  }, at = (e) => {
452
451
  var i;
453
452
  for (const s of g.values())
454
453
  (i = s.setResizeSuspended) == null || i.call(s, e);
455
454
  }, It = (e, i) => {
456
- var s, c, p, C, P, Y;
457
- for (let L = 0; L < u.length; L++)
458
- L === e || L === i || (c = (s = g.get(u[L])) == null ? void 0 : s.setResizeSuspended) == null || c.call(s, !0);
459
- (C = (p = g.get(u[e])) == null ? void 0 : p.setResizeSuspended) == null || C.call(p, !1), (Y = (P = g.get(u[i])) == null ? void 0 : P.setResizeSuspended) == null || Y.call(P, !1);
460
- }, st = d ? ((gt = (mt = t.layout) == null ? void 0 : mt.margins) == null ? void 0 : gt.bottom) ?? Dt.bottom : G.bottom;
455
+ var s, c, p, $, P, O;
456
+ for (let M = 0; M < h.length; M++)
457
+ M === e || M === i || (c = (s = g.get(h[M])) == null ? void 0 : s.setResizeSuspended) == null || c.call(s, !0);
458
+ ($ = (p = g.get(h[e])) == null ? void 0 : p.setResizeSuspended) == null || $.call(p, !1), (O = (P = g.get(h[i])) == null ? void 0 : P.setResizeSuspended) == null || O.call(P, !1);
459
+ }, st = d ? ((gt = (mt = t.layout) == null ? void 0 : mt.margins) == null ? void 0 : gt.bottom) ?? Lt.bottom : W.bottom;
461
460
  for (let e = 0; e < o.length; e++) {
462
- const i = o[e], s = e === 0, c = e === o.length - 1, p = d ? i.showXAxis ?? !0 : i.showXAxis ?? (b === "bottom" ? c : !0), C = d ? i.showYAxis ?? (k === "left" ? s : !0) : i.showYAxis ?? !0, P = document.createElement("div");
463
- P.dataset.paneId = i.id, P.style.cssText = it(f[e], y, e, a);
464
- const Y = document.createElement("div");
465
- Y.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", P.appendChild(Y), n.appendChild(P), v.push(P);
466
- const L = St(
467
- Mt(
461
+ const i = o[e], s = e === 0, c = e === o.length - 1, p = d ? i.showXAxis ?? !0 : i.showXAxis ?? (b === "bottom" ? c : !0), $ = d ? i.showYAxis ?? (k === "left" ? s : !0) : i.showYAxis ?? !0, P = document.createElement("div");
462
+ P.dataset.paneId = i.id, P.style.cssText = it(m[e], y, e, a);
463
+ const O = document.createElement("div");
464
+ O.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", P.appendChild(O), n.appendChild(P), v.push(P);
465
+ const M = St(
466
+ Dt(
468
467
  i,
469
- Y,
468
+ O,
470
469
  t,
471
470
  e,
472
471
  o.length,
473
472
  {
474
- left: d && !C ? G.left : h,
473
+ left: d && !$ ? W.left : f,
475
474
  right: l,
476
- top: _,
475
+ top: B,
477
476
  bottom: st
478
477
  },
479
478
  p,
480
- C,
479
+ $,
481
480
  a
482
481
  )
483
482
  ), j = $t(i.series);
484
483
  if (j.length)
485
- for (const N of j) L.addSeries(N);
486
- i.yRange && i.yRange !== "auto" && L.zoom({ y: i.yRange, animate: !1 }), g.set(i.id, L), m.push({
487
- chart: L,
484
+ for (const N of j) M.addSeries(N);
485
+ i.yRange && i.yRange !== "auto" && M.zoom({ y: i.yRange, animate: !1 }), g.set(i.id, M), u.push({
486
+ chart: M,
488
487
  wrapper: P,
489
488
  baseYTickCount: zt((pt = i.chart) == null ? void 0 : pt.yAxis),
490
489
  baseXTickCount: ((xt = (yt = i.chart) == null ? void 0 : yt.xAxis) == null ? void 0 : xt.tickCount) ?? 8,
@@ -500,17 +499,17 @@ function fe(t) {
500
499
  w = ee(
501
500
  n,
502
501
  v,
503
- u,
504
- f,
502
+ h,
503
+ m,
505
504
  {
506
505
  direction: a,
507
506
  ...e,
508
- onDragStart: (i, s) => (M = !0, at(!0), It(i, s), tt()),
507
+ onDragStart: (i, s) => (D = !0, at(!0), It(i, s), tt()),
509
508
  onDragMove: (i, s, c) => {
510
- q(i, s, c);
509
+ G(i, s, c);
511
510
  },
512
511
  onDragEnd: (i) => {
513
- x && (cancelAnimationFrame(x), x = 0), z = null, M = !1;
512
+ x && (cancelAnimationFrame(x), x = 0), z = null, D = !1;
514
513
  const s = te(i, Q());
515
514
  Tt(s), J(), K(), at(!1), I();
516
515
  }
@@ -520,7 +519,7 @@ function fe(t) {
520
519
  const Z = g.get(r);
521
520
  if (!Z)
522
521
  throw new Error(`[StackedChart] masterPaneId "${r}" not found in panes`);
523
- const O = Wt(
522
+ const _ = qt(
524
523
  Array.from(g.values()),
525
524
  le(t.sync, r, a)
526
525
  ), Ft = () => {
@@ -530,8 +529,8 @@ function fe(t) {
530
529
  const i = Date.now();
531
530
  return new Promise((c) => {
532
531
  const p = () => {
533
- const C = Nt();
534
- if (C.pending === 0 && !C.isProcessing || Date.now() - i > 8e3) {
532
+ const $ = Nt();
533
+ if ($.pending === 0 && !$.isProcessing || Date.now() - i > 8e3) {
535
534
  c();
536
535
  return;
537
536
  }
@@ -566,48 +565,48 @@ function fe(t) {
566
565
  throw new Error(`[StackedChart] Cannot exceed ${ot} panes`);
567
566
  if (g.has(e.id))
568
567
  throw new Error(`[StackedChart] Pane "${e.id}" already exists`);
569
- if (!d && b === "bottom" && u.length > 0) {
570
- const B = u[u.length - 1];
571
- (vt = g.get(B)) == null || vt.updateXAxis({
568
+ if (!d && b === "bottom" && h.length > 0) {
569
+ const Y = h[h.length - 1];
570
+ (vt = g.get(Y)) == null || vt.updateXAxis({
572
571
  showLabels: !1,
573
572
  showTicks: !1,
574
573
  showLine: !1
575
574
  });
576
575
  }
577
- const i = Rt(e.height ?? 0.25), s = f.reduce((B, Ht) => B + Ht, 0), c = s > 0 ? (1 - i) / s : 1;
578
- for (let B = 0; B < f.length; B++) f[B] *= c;
579
- const p = u.length;
580
- u.push(e.id), f.push(i);
581
- const C = document.createElement("div");
582
- C.dataset.paneId = e.id, C.style.cssText = it(f[p], y, p, a);
576
+ const i = Rt(e.height ?? 0.25), s = m.reduce((Y, Ht) => Y + Ht, 0), c = s > 0 ? (1 - i) / s : 1;
577
+ for (let Y = 0; Y < m.length; Y++) m[Y] *= c;
578
+ const p = h.length;
579
+ h.push(e.id), m.push(i);
580
+ const $ = document.createElement("div");
581
+ $.dataset.paneId = e.id, $.style.cssText = it(m[p], y, p, a);
583
582
  const P = document.createElement("div");
584
- P.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", C.appendChild(P), n.appendChild(C), v.push(C);
585
- const L = d ? e.showXAxis ?? !0 : e.showXAxis ?? (b === "bottom" ? !0 : !0), j = d ? e.showYAxis ?? (k === "left" ? p === 0 : !0) : e.showYAxis ?? !0, N = St(
586
- Mt(
583
+ P.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", $.appendChild(P), n.appendChild($), v.push($);
584
+ const M = d ? e.showXAxis ?? !0 : e.showXAxis ?? (b === "bottom" ? !0 : !0), j = d ? e.showYAxis ?? (k === "left" ? p === 0 : !0) : e.showYAxis ?? !0, N = St(
585
+ Dt(
587
586
  e,
588
587
  P,
589
588
  t,
590
589
  p,
591
- u.length,
590
+ h.length,
592
591
  {
593
- left: d && !j ? G.left : h,
592
+ left: d && !j ? W.left : f,
594
593
  right: l,
595
- top: _,
594
+ top: B,
596
595
  bottom: st
597
596
  },
598
- L,
597
+ M,
599
598
  j,
600
599
  a
601
600
  )
602
601
  ), Xt = $t(e.series);
603
- for (const B of Xt) N.addSeries(B);
604
- return e.yRange && e.yRange !== "auto" && N.zoom({ y: e.yRange, animate: !1 }), g.set(e.id, N), m.push({
602
+ for (const Y of Xt) N.addSeries(Y);
603
+ return e.yRange && e.yRange !== "auto" && N.zoom({ y: e.yRange, animate: !1 }), g.set(e.id, N), u.push({
605
604
  chart: N,
606
- wrapper: C,
605
+ wrapper: $,
607
606
  baseYTickCount: zt((wt = e.chart) == null ? void 0 : wt.yAxis),
608
607
  baseXTickCount: ((At = (bt = e.chart) == null ? void 0 : bt.xAxis) == null ? void 0 : At.tickCount) ?? 8,
609
- showXAxis: L
610
- }), O.add(N), K(), I(), N;
608
+ showXAxis: M
609
+ }), _.add(N), K(), I(), N;
611
610
  };
612
611
  return {
613
612
  container: n,
@@ -621,38 +620,38 @@ function fe(t) {
621
620
  return Z;
622
621
  },
623
622
  getGroup() {
624
- return O;
623
+ return _;
625
624
  },
626
625
  fitAll(e) {
627
- O.fitAll(e);
626
+ _.fitAll(e);
628
627
  },
629
628
  resetAll() {
630
- O.resetAll();
629
+ _.resetAll();
631
630
  },
632
631
  resize() {
633
632
  I();
634
633
  },
635
634
  getPaneRatios() {
636
635
  const e = {};
637
- for (let i = 0; i < u.length; i++)
638
- e[u[i]] = f[i];
636
+ for (let i = 0; i < h.length; i++)
637
+ e[h[i]] = m[i];
639
638
  return e;
640
639
  },
641
640
  setPaneRatios(e) {
642
- for (let i = 0; i < u.length; i++) {
643
- const s = u[i];
644
- e[s] !== void 0 && (f[i] = e[s]);
641
+ for (let i = 0; i < h.length; i++) {
642
+ const s = h[i];
643
+ e[s] !== void 0 && (m[i] = e[s]);
645
644
  }
646
- ne(v, f, a), I();
645
+ ne(v, m, a), I();
647
646
  },
648
647
  setSyncAxis(e) {
649
- O.syncAxis(e);
648
+ _.syncAxis(e);
650
649
  },
651
650
  getSyncAxis() {
652
- return O.getOptions().axis ?? "x";
651
+ return _.getOptions().axis ?? "x";
653
652
  },
654
653
  setSyncOptions(e) {
655
- O.updateOptions(e);
654
+ _.updateOptions(e);
656
655
  },
657
656
  whenReady() {
658
657
  return ct();
@@ -667,11 +666,11 @@ function fe(t) {
667
666
  return dt(e);
668
667
  },
669
668
  async addIndicator(e, i = {}) {
670
- var L;
669
+ var M;
671
670
  const s = g.get(r) ?? Z;
672
671
  if (i.pane !== "new")
673
- return { ...await Bt(s, e, i), chart: s };
674
- const c = _t(s, i.sourceSeriesId), { x: p, prices: C } = Ot(c), P = await jt(e, p, C, {
672
+ return { ...await Yt(s, e, i), chart: s };
673
+ const c = Bt(s, i.sourceSeriesId), { x: p, prices: $ } = _t(c), P = await jt(e, p, $, {
675
674
  id: i.id ?? e,
676
675
  label: i.label ?? e.toUpperCase(),
677
676
  height: i.paneHeight ?? 0.25,
@@ -681,18 +680,18 @@ function fe(t) {
681
680
  slowPeriod: i.slowPeriod,
682
681
  signalPeriod: i.signalPeriod,
683
682
  stdDev: i.stdDev
684
- }, c), Y = dt(P);
683
+ }, c), O = dt(P);
685
684
  return {
686
685
  id: P.id,
687
686
  preset: e,
688
687
  placement: "oscillator",
689
- seriesIds: ((L = P.series) == null ? void 0 : L.map((j) => j.id)) ?? [],
688
+ seriesIds: ((M = P.series) == null ? void 0 : M.map((j) => j.id)) ?? [],
690
689
  paneId: P.id,
691
- chart: Y
690
+ chart: O
692
691
  };
693
692
  },
694
693
  destroy() {
695
- A && cancelAnimationFrame(A), x && cancelAnimationFrame(x), U.disconnect(), w == null || w.destroy(), O.destroy();
694
+ A && cancelAnimationFrame(A), x && cancelAnimationFrame(x), U.disconnect(), w == null || w.destroy(), _.destroy();
696
695
  for (const e of g.values()) e.destroy();
697
696
  g.clear(), n.replaceChildren();
698
697
  }
@@ -703,4 +702,4 @@ export {
703
702
  rt as a,
704
703
  fe as c
705
704
  };
706
- //# sourceMappingURL=createStackedChart-DJSmqerD.js.map
705
+ //# sourceMappingURL=createStackedChart-DxNW0VkF.js.map