charts-core 1.1.32 → 1.1.35

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.
@@ -1,12 +1,12 @@
1
1
  var Ns = Object.defineProperty;
2
2
  var Fs = (i, e, t) => e in i ? Ns(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
4
- import * as L from "d3";
4
+ import * as E from "d3";
5
5
  const Hs = (i) => {
6
6
  const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks: d, isShow: g } = r;
7
7
  if (!g) return null;
8
8
  e.append("g").attr("transform", `translate(${n - a.right},0)`).call((p) => {
9
- let _ = L.axisRight(s);
9
+ let _ = E.axisRight(s);
10
10
  o && c ? _ = _.tickFormat(c) : _ = _.tickFormat((v) => {
11
11
  const b = Number(v), w = (x) => x.toString().replace(/\.0+$/, "");
12
12
  return Math.abs(b) >= 1e12 ? w(b / 1e12) + "T" : Math.abs(b) >= 1e9 ? w(b / 1e9) + "B" : Math.abs(b) >= 1e6 ? w(b / 1e6) + "M" : Math.abs(b) >= 1e3 ? w(b / 1e3) + "K" : w(b);
@@ -20,7 +20,7 @@ const Hs = (i) => {
20
20
  const v = _.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
21
21
  p.selectAll(".tick").each(function(w, x) {
22
22
  var $;
23
- const y = L.select(this), C = y.select("text"), S = v[x], T = b - S, N = y.append("g").attr("transform", "translate(10, 0)");
23
+ const y = E.select(this), C = y.select("text"), M = v[x], T = b - M, N = y.append("g").attr("transform", "translate(10, 0)");
24
24
  C.attr("x", T), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
25
25
  });
26
26
  }).attr("font-family", "inherit");
@@ -28,7 +28,7 @@ const Hs = (i) => {
28
28
  const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: d, ticks: g } = r;
29
29
  if (!o) return null;
30
30
  e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((p) => {
31
- let _ = L.axisBottom(s);
31
+ let _ = E.axisBottom(s);
32
32
  d ? (h && (_ = _.tickFormat(h)), g && (_ = Array.isArray(g) ? _.ticks(...g) : _.ticks(g)), c && (_ = _.tickValues(c))) : _.ticks(5), p.call(_);
33
33
  }).call((p) => p.select(".domain").remove()).call((p) => {
34
34
  let _ = [];
@@ -84,12 +84,12 @@ const Hs = (i) => {
84
84
  return r.append("circle").attr("cx", t).attr("cy", s).attr("r", n).classed("sc-charts__hovered-circles", !0), r.append("circle").attr("cx", t).attr("cy", s).attr("r", n + a).classed("sc-charts__hovered-circles_add", !0), r;
85
85
  }
86
86
  };
87
- function Ps(i, e, t, s) {
87
+ function Os(i, e, t, s) {
88
88
  if (!i) return null;
89
89
  const n = i.width / 2, a = e - n, r = e + n;
90
90
  return a < t ? t : r > s ? s - i.width : e - n;
91
91
  }
92
- const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e).attr("x2", t).attr("y1", s).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), Os = (i) => {
92
+ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e).attr("x2", t).attr("y1", s).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), Ps = (i) => {
93
93
  const { svg: e, config: t, x: s, y: n, height: a, data: r, wrapperNode: o } = i, {
94
94
  margin: c,
95
95
  grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea: p }
@@ -103,22 +103,22 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
103
103
  const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o), C = (T) => {
104
104
  if (!d) return;
105
105
  _i(x), w.style.display = "block", x.append(d({ date: T.date, value: T.value }));
106
- const N = x.getBoundingClientRect(), $ = Ps(
106
+ const N = x.getBoundingClientRect(), $ = Os(
107
107
  N,
108
108
  s(T.date),
109
109
  i.config.margin.left - i.config.grid.tooltipArrowSize,
110
110
  i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
111
111
  );
112
112
  $ !== null && (x.style.left = $ + "px"), y.style.left = s(T.date) + "px";
113
- }, S = () => {
113
+ }, M = () => {
114
114
  w.style.display = "none";
115
115
  };
116
116
  i.gridHoverTooltip = d ? {
117
117
  show: (T) => C(T),
118
- hide: S
118
+ hide: M
119
119
  } : null, r.forEach((T, N) => {
120
- const $ = s(T.date), X = n(T.value), U = r[N - 1], te = N > 0 && U && T.value === U.value;
121
- te || qt(e, { x1: $, x2: $, y1: X, y2: _ });
120
+ const $ = s(T.date), G = n(T.value), Z = r[N - 1], te = N > 0 && Z && T.value === Z.value;
121
+ te || qt(e, { x1: $, x2: $, y1: G, y2: _ });
122
122
  const K = $s(e, te, {
123
123
  x: $,
124
124
  y: _,
@@ -128,23 +128,23 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
128
128
  d && K.on("mouseover", function() {
129
129
  C({ date: T.date, value: te ? null : T.value });
130
130
  }).on("mouseout", function() {
131
- S();
131
+ M();
132
132
  });
133
133
  });
134
134
  }
135
135
  }, zs = (i) => {
136
- Is(i), Os(i);
136
+ Is(i), Ps(i);
137
137
  }, Vs = (i) => {
138
138
  const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
139
139
  Bs(i), Hs(i), r && e.append("image").attr("xlink:href", t.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (s - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", r.y ?? (n - a.top - a.bottom) / 2 - r.height / 2 + a.top), zs(i);
140
- }, Ee = (i, e, t) => {
140
+ }, Le = (i, e, t) => {
141
141
  let s = i.select(`#${e}`);
142
142
  return s.empty() && (s = i.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", e)), s.attr("x1", t.x1).attr("y1", t.x2).attr("x2", t.y1).attr("y2", t.y2), t.stops.forEach(({ offset: n, stopColor: a }) => {
143
143
  s.append("stop").attr("offset", n).attr("stop-color", a);
144
144
  }), s;
145
145
  }, ve = (i) => {
146
- const e = L.select(i).select("defs");
147
- return e.empty() ? L.select(i).append("defs") : e;
146
+ const e = E.select(i).select("defs");
147
+ return e.empty() ? E.select(i).append("defs") : e;
148
148
  }, Tt = (i) => {
149
149
  const {
150
150
  y: e,
@@ -187,7 +187,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
187
187
  ...e == null ? void 0 : e.selection
188
188
  }
189
189
  }), Qt = (i, e = {}) => {
190
- const t = i.node(), s = ve(t), n = (o, c) => Ee(s, o, {
190
+ const t = i.node(), s = ve(t), n = (o, c) => Le(s, o, {
191
191
  x1: "0%",
192
192
  y1: "0%",
193
193
  x2: "0%",
@@ -227,7 +227,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
227
227
  };
228
228
  }, Ws = (i, e = {}) => {
229
229
  const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = ve(n);
230
- return ((o, c) => Ee(a, o, {
230
+ return ((o, c) => Le(a, o, {
231
231
  x1: "0%",
232
232
  y1: "0%",
233
233
  x2: "0%",
@@ -249,8 +249,8 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
249
249
  s.remove();
250
250
  }
251
251
  };
252
- }, ge = "sc-charts__range-tooltip", Kt = L.timeFormat("%b %e, %I:%M %p"), Ys = (i) => {
253
- const e = L.format(",.2f");
252
+ }, ge = "sc-charts__range-tooltip", Kt = E.timeFormat("%b %e, %I:%M %p"), Ys = (i) => {
253
+ const e = E.format(",.2f");
254
254
  return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
255
255
  };
256
256
  function js(i) {
@@ -291,10 +291,10 @@ const Xs = (i) => {
291
291
  b = `${Ys(d)} (${x}%)`;
292
292
  }
293
293
  p ? w = p({ left: n.date, right: a.date, direction: v }) : w = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
294
- const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), S = i.x(a.date);
295
- let N = (C + S) / 2 - x.width / 2;
296
- const $ = 0, X = y.width - x.width;
297
- N < $ && (N = $), N > X && (N = X), e.style.left = `${N}px`, e.style.top = `${o}px`;
294
+ const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), M = i.x(a.date);
295
+ let N = (C + M) / 2 - x.width / 2;
296
+ const $ = 0, G = y.width - x.width;
297
+ N < $ && (N = $), N > G && (N = G), e.style.left = `${N}px`, e.style.top = `${o}px`;
298
298
  });
299
299
  }
300
300
  c !== void 0 && (e.style.display = c ? "none" : "block");
@@ -303,17 +303,17 @@ const Xs = (i) => {
303
303
  e.remove();
304
304
  }
305
305
  };
306
- }, Le = "sc-charts__hover-tooltip", _t = 16, Us = L.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
307
- const e = L.format(",.2f");
306
+ }, Ee = "sc-charts__hover-tooltip", _t = 16, Us = E.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
307
+ const e = E.format(",.2f");
308
308
  return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
309
309
  };
310
310
  function Zs(i) {
311
311
  const e = document.createElement("div");
312
- e.className = `${Le}-container`, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.appendChild(e);
312
+ e.className = `${Ee}-container`, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.appendChild(e);
313
313
  const t = document.createElement("div");
314
- t.className = `${Le}-sum`;
314
+ t.className = `${Ee}-sum`;
315
315
  const s = document.createElement("div");
316
- return s.className = `${Le}-time`, { wrapper: e, sumNode: t, timeNode: s };
316
+ return s.className = `${Ee}-time`, { wrapper: e, sumNode: t, timeNode: s };
317
317
  }
318
318
  function qs(i, e, t) {
319
319
  return i ? e + _t + i.width < t ? e + _t : e - _t - i.width : null;
@@ -324,7 +324,7 @@ const Js = (i) => {
324
324
  };
325
325
  return {
326
326
  className(a, r) {
327
- a === "remove" ? e.classList.remove(`${Le}${r}`) : e.classList.add(`${Le}${r}`);
327
+ a === "remove" ? e.classList.remove(`${Ee}${r}`) : e.classList.add(`${Ee}${r}`);
328
328
  },
329
329
  update({ hidden: a, dataItem: r }) {
330
330
  if (!i.config.hover.showDefaultTooltip) {
@@ -402,9 +402,9 @@ const Js = (i) => {
402
402
  },
403
403
  enableBelowZeroLine: !1,
404
404
  curveTension: 1
405
- }, tt = () => L.curveMonotoneX, Ks = (i) => {
405
+ }, tt = () => E.curveMonotoneX, Ks = (i) => {
406
406
  const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = ve(r);
407
- Ee(o, "main-line-area-gradient", {
407
+ Le(o, "main-line-area-gradient", {
408
408
  x1: "0%",
409
409
  y1: "0%",
410
410
  x2: "0%",
@@ -414,7 +414,7 @@ const Js = (i) => {
414
414
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
415
415
  ]
416
416
  });
417
- const h = L.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
417
+ const h = E.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
418
418
  return {
419
419
  className(p, _) {
420
420
  p === "remove" ? g.classed(`${d}${_}`, !1) : g.classed(`${d}${_}`, !0);
@@ -431,7 +431,7 @@ const Js = (i) => {
431
431
  };
432
432
  }, en = (i, e = {}) => {
433
433
  const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e, d = s.node(), g = ve(d), p = "range-line-area-gradient";
434
- Ee(g, p + "_up", {
434
+ Le(g, p + "_up", {
435
435
  x1: "0%",
436
436
  y1: "0%",
437
437
  x2: "0%",
@@ -440,7 +440,7 @@ const Js = (i) => {
440
440
  { offset: "0%", stopColor: "var(--sc-color-selection-up)" },
441
441
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
442
442
  ]
443
- }), Ee(g, p + "_down", {
443
+ }), Le(g, p + "_down", {
444
444
  x1: "0%",
445
445
  y1: "0%",
446
446
  x2: "0%",
@@ -450,20 +450,20 @@ const Js = (i) => {
450
450
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
451
451
  ]
452
452
  });
453
- const _ = L.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt()), v = `${c}-clip-${t}`, w = g.append("clipPath").attr("id", v).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), x = s.append("path").datum(o).attr("d", _).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
453
+ const _ = E.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt()), v = `${c}-clip-${t}`, w = g.append("clipPath").attr("id", v).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), x = s.append("path").datum(o).attr("d", _).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
454
454
  return {
455
455
  className(y, C) {
456
456
  y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
457
457
  },
458
- update({ data: y, hidden: C, clip: S }) {
459
- y !== void 0 && x.datum(y).attr("d", _), C !== void 0 && x.classed(`${t}_hidden`, C), S !== void 0 && w.attr("x", S.x).attr("y", S.y).attr("width", S.width).attr("height", S.height);
458
+ update({ data: y, hidden: C, clip: M }) {
459
+ y !== void 0 && x.datum(y).attr("d", _), C !== void 0 && x.classed(`${t}_hidden`, C), M !== void 0 && w.attr("x", M.x).attr("y", M.y).attr("width", M.width).attr("height", M.height);
460
460
  },
461
461
  destroy() {
462
462
  x.remove();
463
463
  }
464
464
  };
465
465
  }, vt = (i, e) => {
466
- const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = ve(d), p = L.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), _ = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", _).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), w = t.append("path").classed(o, !0).datum(s).attr("d", p).attr("id", c).attr("clip-path", `url(#${_})`);
466
+ const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = ve(d), p = E.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), _ = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", _).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), w = t.append("path").classed(o, !0).datum(s).attr("d", p).attr("id", c).attr("clip-path", `url(#${_})`);
467
467
  return {
468
468
  className(x, y) {
469
469
  x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
@@ -476,13 +476,13 @@ const Js = (i) => {
476
476
  }
477
477
  };
478
478
  }, tn = (i, e) => {
479
- const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), p = ve(g), _ = L.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = p.append("clipPath").attr("id", v).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", _).attr("id", h).attr("clip-path", `url(#${v})`);
479
+ const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), p = ve(g), _ = E.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = p.append("clipPath").attr("id", v).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", _).attr("id", h).attr("clip-path", `url(#${v})`);
480
480
  return {
481
481
  className(y, C) {
482
482
  y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
483
483
  },
484
- update({ data: y, clip: C, hidden: S }) {
485
- y !== void 0 && x.datum(y).attr("d", _), S !== void 0 && x.classed(`${c}_hidden`, S), C !== void 0 && (o.hover.transitionName === "default" ? w.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(L.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
484
+ update({ data: y, clip: C, hidden: M }) {
485
+ y !== void 0 && x.datum(y).attr("d", _), M !== void 0 && x.classed(`${c}_hidden`, M), C !== void 0 && (o.hover.transitionName === "default" ? w.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(E.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
486
486
  },
487
487
  destroy() {
488
488
  x.remove();
@@ -768,28 +768,28 @@ const Js = (i) => {
768
768
  (b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
769
769
  );
770
770
  e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(v) {
771
- const [b] = L.pointer(v, this), w = p(b);
771
+ const [b] = E.pointer(v, this), w = p(b);
772
772
  !g && c.enable ? (i.action = "hover", ei(i, w)) : (i.action = g ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, w));
773
773
  }).on("mouseleave", () => {
774
774
  i.action = "none", g = !1, d = null, ti(i), ii(i);
775
775
  }).on("mousedown", function(v) {
776
776
  if (h.enable) {
777
777
  g = !0, i.action = "selection";
778
- const [b] = L.pointer(v, this);
778
+ const [b] = E.pointer(v, this);
779
779
  d = p(b);
780
780
  }
781
781
  }).on("mouseup", function(v) {
782
- const [b] = L.pointer(v, this), w = p(b);
782
+ const [b] = E.pointer(v, this), w = p(b);
783
783
  g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
784
784
  });
785
785
  }, hn = (i, e, t) => {
786
- const { margin: s } = e, n = L.scaleTime(), a = L.extent(i, (r) => new Date(r.date));
786
+ const { margin: s } = e, n = E.scaleTime(), a = E.extent(i, (r) => new Date(r.date));
787
787
  return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([s.left, t - s.right]);
788
788
  }, dn = (i, e, t) => {
789
- const { margin: s } = e, n = L.max(i, (r) => r.value) ?? 0, a = L.min(i, (r) => r.value) ?? 0;
790
- return L.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
789
+ const { margin: s } = e, n = E.max(i, (r) => r.value) ?? 0, a = E.min(i, (r) => r.value) ?? 0;
790
+ return E.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
791
791
  }, pr = (i, e) => {
792
- const t = L.select(i);
792
+ const t = E.select(i);
793
793
  if (t.empty())
794
794
  return console.error(`Element with selector ${i} not found!`), null;
795
795
  if (!e.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.chartId))
@@ -803,7 +803,7 @@ const Js = (i) => {
803
803
  e.disabledResize || window.addEventListener("resize", d);
804
804
  const g = (p, _ = !1) => {
805
805
  _ && p.config && (c = Jt(c, p.config)), _ && p.data && (h = p.data);
806
- const v = h.map((C) => ({ date: new Date(C.date), value: C.value })).sort((C, S) => C.date.getTime() - S.date.getTime()), b = hn(v, c, r), w = dn(v, c, o);
806
+ const v = h.map((C) => ({ date: new Date(C.date), value: C.value })).sort((C, M) => C.date.getTime() - M.date.getTime()), b = hn(v, c, r), w = dn(v, c, o);
807
807
  s.attr("class", `sc-charts sc-charts__${c.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${r} ${o}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
808
808
  const x = {
809
809
  chartId: e.chartId,
@@ -841,16 +841,16 @@ De.exports;
841
841
  var si;
842
842
  function fn() {
843
843
  return si || (si = 1, function(i, e) {
844
- var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", p = "[object Error]", _ = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", S = "[object RegExp]", T = "[object Set]", N = "[object String]", $ = "[object Undefined]", X = "[object WeakMap]", U = "[object ArrayBuffer]", te = "[object DataView]", K = "[object Float32Array]", z = "[object Float64Array]", V = "[object Int8Array]", P = "[object Int16Array]", oe = "[object Int32Array]", st = "[object Uint8Array]", le = "[object Uint8ClampedArray]", be = "[object Uint16Array]", ye = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
845
- F[K] = F[z] = F[V] = F[P] = F[oe] = F[st] = F[le] = F[be] = F[ye] = !0, F[o] = F[c] = F[U] = F[d] = F[te] = F[g] = F[p] = F[_] = F[b] = F[w] = F[y] = F[S] = F[T] = F[N] = F[X] = !1;
846
- var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, O = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, G = ee && !0 && i && !i.nodeType && i, Z = G && G.exports === ee, me = Z && Re.process, we = function() {
844
+ var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", p = "[object Error]", _ = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", M = "[object RegExp]", T = "[object Set]", N = "[object String]", $ = "[object Undefined]", G = "[object WeakMap]", Z = "[object ArrayBuffer]", te = "[object DataView]", K = "[object Float32Array]", z = "[object Float64Array]", W = "[object Int8Array]", O = "[object Int16Array]", oe = "[object Int32Array]", st = "[object Uint8Array]", le = "[object Uint8ClampedArray]", be = "[object Uint16Array]", ye = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
845
+ F[K] = F[z] = F[W] = F[O] = F[oe] = F[st] = F[le] = F[be] = F[ye] = !0, F[o] = F[c] = F[Z] = F[d] = F[te] = F[g] = F[p] = F[_] = F[b] = F[w] = F[y] = F[M] = F[T] = F[N] = F[G] = !1;
846
+ var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, P = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, V = ee && !0 && i && !i.nodeType && i, Y = V && V.exports === ee, me = Y && Re.process, we = function() {
847
847
  try {
848
- var l = G && G.require && G.require("util").types;
848
+ var l = V && V.require && V.require("util").types;
849
849
  return l || me && me.binding && me.binding("util");
850
850
  } catch {
851
851
  }
852
852
  }(), xe = we && we.isTypedArray;
853
- function Pe(l, u, m) {
853
+ function Oe(l, u, m) {
854
854
  switch (m.length) {
855
855
  case 0:
856
856
  return l.call(u);
@@ -863,10 +863,10 @@ function fn() {
863
863
  }
864
864
  return l.apply(u, m);
865
865
  }
866
- function Oe(l, u) {
867
- for (var m = -1, A = Array(l); ++m < l; )
868
- A[m] = u(m);
869
- return A;
866
+ function Pe(l, u) {
867
+ for (var m = -1, S = Array(l); ++m < l; )
868
+ S[m] = u(m);
869
+ return S;
870
870
  }
871
871
  function ce(l) {
872
872
  return function(u) {
@@ -881,12 +881,12 @@ function fn() {
881
881
  return l(u(m));
882
882
  };
883
883
  }
884
- var Ce = Array.prototype, Mi = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Mi.toString, ae = ze.hasOwnProperty, Nt = function() {
884
+ var Ce = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at = P["__core-js_shared__"], Ve = Ai.toString, ae = ze.hasOwnProperty, Nt = function() {
885
885
  var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
886
886
  return l ? "Symbol(src)_1." + l : "";
887
- }(), Ft = ze.toString, Si = Ve.call(Object), Ti = RegExp(
887
+ }(), Ft = ze.toString, Mi = Ve.call(Object), Ti = RegExp(
888
888
  "^" + Ve.call(ae).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
889
- ), We = Z ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
889
+ ), We = Y ? P.Buffer : void 0, Ht = P.Symbol, Bt = P.Uint8Array;
890
890
  We && We.allocUnsafe;
891
891
  var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0, Ye = function() {
892
892
  try {
@@ -894,7 +894,7 @@ function fn() {
894
894
  return l({}, "", {}), l;
895
895
  } catch {
896
896
  }
897
- }(), Li = We ? We.isBuffer : void 0, $t = Math.max, Ei = Date.now, Pt = lt(O, "Map"), Ae = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
897
+ }(), Ei = We ? We.isBuffer : void 0, $t = Math.max, Li = Date.now, Ot = lt(P, "Map"), Se = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
898
898
  function l() {
899
899
  }
900
900
  return function(u) {
@@ -910,12 +910,12 @@ function fn() {
910
910
  function ue(l) {
911
911
  var u = -1, m = l == null ? 0 : l.length;
912
912
  for (this.clear(); ++u < m; ) {
913
- var A = l[u];
914
- this.set(A[0], A[1]);
913
+ var S = l[u];
914
+ this.set(S[0], S[1]);
915
915
  }
916
916
  }
917
917
  function Fi() {
918
- this.__data__ = Ae ? Ae(null) : {}, this.size = 0;
918
+ this.__data__ = Se ? Se(null) : {}, this.size = 0;
919
919
  }
920
920
  function Hi(l) {
921
921
  var u = this.has(l) && delete this.__data__[l];
@@ -923,7 +923,7 @@ function fn() {
923
923
  }
924
924
  function Bi(l) {
925
925
  var u = this.__data__;
926
- if (Ae) {
926
+ if (Se) {
927
927
  var m = u[l];
928
928
  return m === s ? void 0 : m;
929
929
  }
@@ -931,31 +931,31 @@ function fn() {
931
931
  }
932
932
  function Ii(l) {
933
933
  var u = this.__data__;
934
- return Ae ? u[l] !== void 0 : ae.call(u, l);
934
+ return Se ? u[l] !== void 0 : ae.call(u, l);
935
935
  }
936
936
  function Ri(l, u) {
937
937
  var m = this.__data__;
938
- return this.size += this.has(l) ? 0 : 1, m[l] = Ae && u === void 0 ? s : u, this;
938
+ return this.size += this.has(l) ? 0 : 1, m[l] = Se && u === void 0 ? s : u, this;
939
939
  }
940
940
  ue.prototype.clear = Fi, ue.prototype.delete = Hi, ue.prototype.get = Bi, ue.prototype.has = Ii, ue.prototype.set = Ri;
941
941
  function ie(l) {
942
942
  var u = -1, m = l == null ? 0 : l.length;
943
943
  for (this.clear(); ++u < m; ) {
944
- var A = l[u];
945
- this.set(A[0], A[1]);
944
+ var S = l[u];
945
+ this.set(S[0], S[1]);
946
946
  }
947
947
  }
948
948
  function $i() {
949
949
  this.__data__ = [], this.size = 0;
950
950
  }
951
- function Pi(l) {
951
+ function Oi(l) {
952
952
  var u = this.__data__, m = je(u, l);
953
953
  if (m < 0)
954
954
  return !1;
955
- var A = u.length - 1;
956
- return m == A ? u.pop() : ki.call(u, m, 1), --this.size, !0;
955
+ var S = u.length - 1;
956
+ return m == S ? u.pop() : ki.call(u, m, 1), --this.size, !0;
957
957
  }
958
- function Oi(l) {
958
+ function Pi(l) {
959
959
  var u = this.__data__, m = je(u, l);
960
960
  return m < 0 ? void 0 : u[m][1];
961
961
  }
@@ -963,21 +963,21 @@ function fn() {
963
963
  return je(this.__data__, l) > -1;
964
964
  }
965
965
  function Vi(l, u) {
966
- var m = this.__data__, A = je(m, l);
967
- return A < 0 ? (++this.size, m.push([l, u])) : m[A][1] = u, this;
966
+ var m = this.__data__, S = je(m, l);
967
+ return S < 0 ? (++this.size, m.push([l, u])) : m[S][1] = u, this;
968
968
  }
969
- ie.prototype.clear = $i, ie.prototype.delete = Pi, ie.prototype.get = Oi, ie.prototype.has = zi, ie.prototype.set = Vi;
969
+ ie.prototype.clear = $i, ie.prototype.delete = Oi, ie.prototype.get = Pi, ie.prototype.has = zi, ie.prototype.set = Vi;
970
970
  function pe(l) {
971
971
  var u = -1, m = l == null ? 0 : l.length;
972
972
  for (this.clear(); ++u < m; ) {
973
- var A = l[u];
974
- this.set(A[0], A[1]);
973
+ var S = l[u];
974
+ this.set(S[0], S[1]);
975
975
  }
976
976
  }
977
977
  function Wi() {
978
978
  this.size = 0, this.__data__ = {
979
979
  hash: new ue(),
980
- map: new (Pt || ie)(),
980
+ map: new (Ot || ie)(),
981
981
  string: new ue()
982
982
  };
983
983
  }
@@ -992,8 +992,8 @@ function fn() {
992
992
  return Ue(this, l).has(l);
993
993
  }
994
994
  function Ui(l, u) {
995
- var m = Ue(this, l), A = m.size;
996
- return m.set(l, u), this.size += m.size == A ? 0 : 1, this;
995
+ var m = Ue(this, l), S = m.size;
996
+ return m.set(l, u), this.size += m.size == S ? 0 : 1, this;
997
997
  }
998
998
  pe.prototype.clear = Wi, pe.prototype.delete = Yi, pe.prototype.get = ji, pe.prototype.has = Xi, pe.prototype.set = Ui;
999
999
  function _e(l) {
@@ -1016,30 +1016,30 @@ function fn() {
1016
1016
  function Qi(l, u) {
1017
1017
  var m = this.__data__;
1018
1018
  if (m instanceof ie) {
1019
- var A = m.__data__;
1020
- if (!Pt || A.length < t - 1)
1021
- return A.push([l, u]), this.size = ++m.size, this;
1022
- m = this.__data__ = new pe(A);
1019
+ var S = m.__data__;
1020
+ if (!Ot || S.length < t - 1)
1021
+ return S.push([l, u]), this.size = ++m.size, this;
1022
+ m = this.__data__ = new pe(S);
1023
1023
  }
1024
1024
  return m.set(l, u), this.size = m.size, this;
1025
1025
  }
1026
1026
  _e.prototype.clear = Gi, _e.prototype.delete = Zi, _e.prototype.get = qi, _e.prototype.has = Ji, _e.prototype.set = Qi;
1027
1027
  function Ki(l, u) {
1028
- var m = dt(l), A = !m && ht(l), D = !m && !A && Yt(l), H = !m && !A && !D && Xt(l), B = m || A || D || H, E = B ? Oe(l.length, String) : [], I = E.length;
1028
+ var m = dt(l), S = !m && ht(l), D = !m && !S && Yt(l), H = !m && !S && !D && Xt(l), B = m || S || D || H, L = B ? Pe(l.length, String) : [], I = L.length;
1029
1029
  for (var q in l)
1030
1030
  B && // Safari 9 has enumerable `arguments.length` in strict mode.
1031
1031
  (q == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1032
1032
  D && (q == "offset" || q == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1033
1033
  H && (q == "buffer" || q == "byteLength" || q == "byteOffset") || // Skip index properties.
1034
- Vt(q, I)) || E.push(q);
1035
- return E;
1034
+ Vt(q, I)) || L.push(q);
1035
+ return L;
1036
1036
  }
1037
1037
  function rt(l, u, m) {
1038
1038
  (m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
1039
1039
  }
1040
1040
  function es(l, u, m) {
1041
- var A = l[u];
1042
- (!(ae.call(l, u) && Ge(A, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
1041
+ var S = l[u];
1042
+ (!(ae.call(l, u) && Ge(S, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
1043
1043
  }
1044
1044
  function je(l, u) {
1045
1045
  for (var m = l.length; m--; )
@@ -1059,48 +1059,48 @@ function fn() {
1059
1059
  function Xe(l) {
1060
1060
  return l == null ? l === void 0 ? $ : x : de && de in Object(l) ? ms(l) : ws(l);
1061
1061
  }
1062
- function Ot(l) {
1063
- return Me(l) && Xe(l) == o;
1062
+ function Pt(l) {
1063
+ return Ae(l) && Xe(l) == o;
1064
1064
  }
1065
1065
  function is(l) {
1066
1066
  if (!fe(l) || bs(l))
1067
1067
  return !1;
1068
1068
  var u = ft(l) ? Ti : Be;
1069
- return u.test(Ms(l));
1069
+ return u.test(As(l));
1070
1070
  }
1071
1071
  function ss(l) {
1072
- return Me(l) && jt(l.length) && !!F[Xe(l)];
1072
+ return Ae(l) && jt(l.length) && !!F[Xe(l)];
1073
1073
  }
1074
1074
  function ns(l) {
1075
1075
  if (!fe(l))
1076
1076
  return ys(l);
1077
1077
  var u = Wt(l), m = [];
1078
- for (var A in l)
1079
- A == "constructor" && (u || !ae.call(l, A)) || m.push(A);
1078
+ for (var S in l)
1079
+ S == "constructor" && (u || !ae.call(l, S)) || m.push(S);
1080
1080
  return m;
1081
1081
  }
1082
- function zt(l, u, m, A, D) {
1082
+ function zt(l, u, m, S, D) {
1083
1083
  l !== u && ts(u, function(H, B) {
1084
1084
  if (D || (D = new _e()), fe(H))
1085
- as(l, u, B, m, zt, A, D);
1085
+ as(l, u, B, m, zt, S, D);
1086
1086
  else {
1087
- var E = A ? A(ct(l, B), H, B + "", l, u, D) : void 0;
1088
- E === void 0 && (E = H), rt(l, B, E);
1087
+ var L = S ? S(ct(l, B), H, B + "", l, u, D) : void 0;
1088
+ L === void 0 && (L = H), rt(l, B, L);
1089
1089
  }
1090
1090
  }, Ut);
1091
1091
  }
1092
- function as(l, u, m, A, D, H, B) {
1093
- var E = ct(l, m), I = ct(u, m), q = B.get(I);
1092
+ function as(l, u, m, S, D, H, B) {
1093
+ var L = ct(l, m), I = ct(u, m), q = B.get(I);
1094
1094
  if (q) {
1095
1095
  rt(l, m, q);
1096
1096
  return;
1097
1097
  }
1098
- var W = H ? H(E, I, m + "", l, u, B) : void 0, Se = W === void 0;
1099
- if (Se) {
1098
+ var j = H ? H(L, I, m + "", l, u, B) : void 0, Me = j === void 0;
1099
+ if (Me) {
1100
1100
  var gt = dt(I), mt = !gt && Yt(I), Zt = !gt && !mt && Xt(I);
1101
- W = I, gt || mt || Zt ? dt(E) ? W = E : Ss(E) ? W = ds(E) : mt ? (Se = !1, W = ls(I)) : Zt ? (Se = !1, W = hs(I)) : W = [] : Ts(I) || ht(I) ? (W = E, ht(E) ? W = Ds(E) : (!fe(E) || ft(E)) && (W = ps(I))) : Se = !1;
1101
+ j = I, gt || mt || Zt ? dt(L) ? j = L : Ms(L) ? j = ds(L) : mt ? (Me = !1, j = ls(I)) : Zt ? (Me = !1, j = hs(I)) : j = [] : Ts(I) || ht(I) ? (j = L, ht(L) ? j = Ds(L) : (!fe(L) || ft(L)) && (j = ps(I))) : Me = !1;
1102
1102
  }
1103
- Se && (B.set(I, W), D(W, I, A, H, B), B.delete(I)), rt(l, m, W);
1103
+ Me && (B.set(I, j), D(j, I, S, H, B), B.delete(I)), rt(l, m, j);
1104
1104
  }
1105
1105
  function rs(l, u) {
1106
1106
  return Cs(xs(l, u, Gt), l + "");
@@ -1109,7 +1109,7 @@ function fn() {
1109
1109
  return Ye(l, "toString", {
1110
1110
  configurable: !0,
1111
1111
  enumerable: !1,
1112
- value: Ls(u),
1112
+ value: Es(u),
1113
1113
  writable: !0
1114
1114
  });
1115
1115
  } : Gt;
@@ -1125,33 +1125,33 @@ function fn() {
1125
1125
  return new l.constructor(m, l.byteOffset, l.length);
1126
1126
  }
1127
1127
  function ds(l, u) {
1128
- var m = -1, A = l.length;
1129
- for (u || (u = Array(A)); ++m < A; )
1128
+ var m = -1, S = l.length;
1129
+ for (u || (u = Array(S)); ++m < S; )
1130
1130
  u[m] = l[m];
1131
1131
  return u;
1132
1132
  }
1133
- function us(l, u, m, A) {
1133
+ function us(l, u, m, S) {
1134
1134
  var D = !m;
1135
1135
  m || (m = {});
1136
1136
  for (var H = -1, B = u.length; ++H < B; ) {
1137
- var E = u[H], I = void 0;
1138
- I === void 0 && (I = l[E]), D ? ot(m, E, I) : es(m, E, I);
1137
+ var L = u[H], I = void 0;
1138
+ I === void 0 && (I = l[L]), D ? ot(m, L, I) : es(m, L, I);
1139
1139
  }
1140
1140
  return m;
1141
1141
  }
1142
1142
  function fs(l) {
1143
1143
  return rs(function(u, m) {
1144
- var A = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
1145
- for (H = l.length > 3 && typeof H == "function" ? (D--, H) : void 0, B && _s(m[0], m[1], B) && (H = D < 3 ? void 0 : H, D = 1), u = Object(u); ++A < D; ) {
1146
- var E = m[A];
1147
- E && l(u, E, A, H);
1144
+ var S = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
1145
+ for (H = l.length > 3 && typeof H == "function" ? (D--, H) : void 0, B && _s(m[0], m[1], B) && (H = D < 3 ? void 0 : H, D = 1), u = Object(u); ++S < D; ) {
1146
+ var L = m[S];
1147
+ L && l(u, L, S, H);
1148
1148
  }
1149
1149
  return u;
1150
1150
  });
1151
1151
  }
1152
1152
  function gs(l) {
1153
- return function(u, m, A) {
1154
- for (var D = -1, H = Object(u), B = A(u), E = B.length; E--; ) {
1153
+ return function(u, m, S) {
1154
+ for (var D = -1, H = Object(u), B = S(u), L = B.length; L--; ) {
1155
1155
  var I = B[++D];
1156
1156
  if (m(H[I], I, H) === !1)
1157
1157
  break;
@@ -1171,11 +1171,11 @@ function fn() {
1171
1171
  var u = ae.call(l, de), m = l[de];
1172
1172
  try {
1173
1173
  l[de] = void 0;
1174
- var A = !0;
1174
+ var S = !0;
1175
1175
  } catch {
1176
1176
  }
1177
1177
  var D = Ft.call(l);
1178
- return A && (u ? l[de] = m : delete l[de]), D;
1178
+ return S && (u ? l[de] = m : delete l[de]), D;
1179
1179
  }
1180
1180
  function ps(l) {
1181
1181
  return typeof l.constructor == "function" && !Wt(l) ? Ni(It(l)) : {};
@@ -1187,8 +1187,8 @@ function fn() {
1187
1187
  function _s(l, u, m) {
1188
1188
  if (!fe(m))
1189
1189
  return !1;
1190
- var A = typeof u;
1191
- return (A == "number" ? ut(m) && Vt(u, m.length) : A == "string" && u in m) ? Ge(m[u], l) : !1;
1190
+ var S = typeof u;
1191
+ return (S == "number" ? ut(m) && Vt(u, m.length) : S == "string" && u in m) ? Ge(m[u], l) : !1;
1192
1192
  }
1193
1193
  function vs(l) {
1194
1194
  var u = typeof l;
@@ -1213,24 +1213,24 @@ function fn() {
1213
1213
  }
1214
1214
  function xs(l, u, m) {
1215
1215
  return u = $t(u === void 0 ? l.length - 1 : u, 0), function() {
1216
- for (var A = arguments, D = -1, H = $t(A.length - u, 0), B = Array(H); ++D < H; )
1217
- B[D] = A[u + D];
1216
+ for (var S = arguments, D = -1, H = $t(S.length - u, 0), B = Array(H); ++D < H; )
1217
+ B[D] = S[u + D];
1218
1218
  D = -1;
1219
- for (var E = Array(u + 1); ++D < u; )
1220
- E[D] = A[D];
1221
- return E[u] = m(B), Pe(l, this, E);
1219
+ for (var L = Array(u + 1); ++D < u; )
1220
+ L[D] = S[D];
1221
+ return L[u] = m(B), Oe(l, this, L);
1222
1222
  };
1223
1223
  }
1224
1224
  function ct(l, u) {
1225
1225
  if (!(u === "constructor" && typeof l[u] == "function") && u != "__proto__")
1226
1226
  return l[u];
1227
1227
  }
1228
- var Cs = As(os);
1229
- function As(l) {
1228
+ var Cs = Ss(os);
1229
+ function Ss(l) {
1230
1230
  var u = 0, m = 0;
1231
1231
  return function() {
1232
- var A = Ei(), D = a - (A - m);
1233
- if (m = A, D > 0) {
1232
+ var S = Li(), D = a - (S - m);
1233
+ if (m = S, D > 0) {
1234
1234
  if (++u >= n)
1235
1235
  return arguments[0];
1236
1236
  } else
@@ -1238,7 +1238,7 @@ function fn() {
1238
1238
  return l.apply(void 0, arguments);
1239
1239
  };
1240
1240
  }
1241
- function Ms(l) {
1241
+ function As(l) {
1242
1242
  if (l != null) {
1243
1243
  try {
1244
1244
  return Ve.call(l);
@@ -1254,18 +1254,18 @@ function fn() {
1254
1254
  function Ge(l, u) {
1255
1255
  return l === u || l !== l && u !== u;
1256
1256
  }
1257
- var ht = Ot(/* @__PURE__ */ function() {
1257
+ var ht = Pt(/* @__PURE__ */ function() {
1258
1258
  return arguments;
1259
- }()) ? Ot : function(l) {
1260
- return Me(l) && ae.call(l, "callee") && !Di.call(l, "callee");
1259
+ }()) ? Pt : function(l) {
1260
+ return Ae(l) && ae.call(l, "callee") && !Di.call(l, "callee");
1261
1261
  }, dt = Array.isArray;
1262
1262
  function ut(l) {
1263
1263
  return l != null && jt(l.length) && !ft(l);
1264
1264
  }
1265
- function Ss(l) {
1266
- return Me(l) && ut(l);
1265
+ function Ms(l) {
1266
+ return Ae(l) && ut(l);
1267
1267
  }
1268
- var Yt = Li || Es;
1268
+ var Yt = Ei || Ls;
1269
1269
  function ft(l) {
1270
1270
  if (!fe(l))
1271
1271
  return !1;
@@ -1279,17 +1279,17 @@ function fn() {
1279
1279
  var u = typeof l;
1280
1280
  return l != null && (u == "object" || u == "function");
1281
1281
  }
1282
- function Me(l) {
1282
+ function Ae(l) {
1283
1283
  return l != null && typeof l == "object";
1284
1284
  }
1285
1285
  function Ts(l) {
1286
- if (!Me(l) || Xe(l) != y)
1286
+ if (!Ae(l) || Xe(l) != y)
1287
1287
  return !1;
1288
1288
  var u = It(l);
1289
1289
  if (u === null)
1290
1290
  return !0;
1291
1291
  var m = ae.call(u, "constructor") && u.constructor;
1292
- return typeof m == "function" && m instanceof m && Ve.call(m) == Si;
1292
+ return typeof m == "function" && m instanceof m && Ve.call(m) == Mi;
1293
1293
  }
1294
1294
  var Xt = xe ? ce(xe) : ss;
1295
1295
  function Ds(l) {
@@ -1301,7 +1301,7 @@ function fn() {
1301
1301
  var ks = fs(function(l, u, m) {
1302
1302
  zt(l, u, m);
1303
1303
  });
1304
- function Ls(l) {
1304
+ function Es(l) {
1305
1305
  return function() {
1306
1306
  return l;
1307
1307
  };
@@ -1309,7 +1309,7 @@ function fn() {
1309
1309
  function Gt(l) {
1310
1310
  return l;
1311
1311
  }
1312
- function Es() {
1312
+ function Ls() {
1313
1313
  return !1;
1314
1314
  }
1315
1315
  i.exports = ks;
@@ -1387,6 +1387,15 @@ class pn {
1387
1387
  );
1388
1388
  this._candles = t.candles, this._xAxis = t.xAxis, this._yAxis = t.yAxis, this._guides = t.guides, this._trade = t.trade;
1389
1389
  }
1390
+ getSnapshot() {
1391
+ return {
1392
+ candles: this._candles,
1393
+ xAxis: this._xAxis,
1394
+ yAxis: this._yAxis,
1395
+ guides: this._guides,
1396
+ trade: this._trade
1397
+ };
1398
+ }
1390
1399
  get candles() {
1391
1400
  return this._candles;
1392
1401
  }
@@ -1403,7 +1412,7 @@ class pn {
1403
1412
  return this._trade;
1404
1413
  }
1405
1414
  }
1406
- class j {
1415
+ class U {
1407
1416
  constructor(e) {
1408
1417
  f(this, "x");
1409
1418
  f(this, "y");
@@ -1446,32 +1455,32 @@ class j {
1446
1455
  }
1447
1456
  class _n {
1448
1457
  constructor(e, t) {
1449
- f(this, "_chart", new j());
1450
- f(this, "_area", new j());
1451
- f(this, "_xAxis", new j());
1452
- f(this, "_yAxis", new j());
1453
- f(this, "_axisIntersection", new j());
1458
+ f(this, "_chart", new U());
1459
+ f(this, "_area", new U());
1460
+ f(this, "_xAxis", new U());
1461
+ f(this, "_yAxis", new U());
1462
+ f(this, "_axisIntersection", new U());
1454
1463
  const { xAxis: s, yAxis: n } = t;
1455
- this._chart = new j(e), this._calc(s, n);
1464
+ this._chart = new U(e), this._calc(s, n);
1456
1465
  }
1457
1466
  _calc(e, t) {
1458
1467
  const s = e.isShow ? e.height : 0, n = t.isShow ? t.width : 0, a = this._chart.height - s, r = this._chart.width - n;
1459
- this._area = new j({
1468
+ this._area = new U({
1460
1469
  x: t.position === "left" ? n : 0,
1461
1470
  y: e.position === "top" ? s : 0,
1462
1471
  width: r,
1463
1472
  height: a
1464
- }), this._xAxis = new j({
1473
+ }), this._xAxis = new U({
1465
1474
  y: e.position === "top" ? 0 : a,
1466
1475
  x: t.position === "left" ? n : 0,
1467
1476
  height: s,
1468
1477
  width: r
1469
- }), this._yAxis = new j({
1478
+ }), this._yAxis = new U({
1470
1479
  y: e.position === "top" ? s : 0,
1471
1480
  x: t.position === "left" ? 0 : r,
1472
1481
  width: n,
1473
1482
  height: a
1474
- }), this._axisIntersection = new j({
1483
+ }), this._axisIntersection = new U({
1475
1484
  y: e.position === "top" ? 0 : a,
1476
1485
  x: t.position === "left" ? 0 : r,
1477
1486
  width: n,
@@ -1484,7 +1493,7 @@ class _n {
1484
1493
  }
1485
1494
  update(e) {
1486
1495
  const { xAxis: t, yAxis: s } = e.config;
1487
- this._chart = new j(e.container), this._calc(t, s);
1496
+ this._chart = new U(e.container), this._calc(t, s);
1488
1497
  }
1489
1498
  get area() {
1490
1499
  return this._area;
@@ -1534,11 +1543,11 @@ function ai(i, e) {
1534
1543
  const w = Math.abs(v - b);
1535
1544
  let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
1536
1545
  if (e.trade) {
1537
- const S = [...e.trade.entries, ...e.trade.exits].find((T) => {
1546
+ const M = [...e.trade.entries, ...e.trade.exits].find((T) => {
1538
1547
  const N = T.time.getTime();
1539
1548
  return N >= g && N < g + t;
1540
1549
  });
1541
- S && (S.type === "buy" ? (y = S.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, d = v) : S.type === "sell" && (x = S.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, d = v));
1550
+ M && (M.type === "buy" ? (y = M.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, d = v) : M.type === "sell" && (x = M.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, d = v));
1542
1551
  }
1543
1552
  const C = {
1544
1553
  open_time: new Date(g),
@@ -1650,12 +1659,12 @@ class vi {
1650
1659
  }
1651
1660
  class bi extends vi {
1652
1661
  constructor() {
1653
- super(), this._scale = L.scaleTime();
1662
+ super(), this._scale = E.scaleTime();
1654
1663
  }
1655
1664
  }
1656
1665
  class wn extends vi {
1657
1666
  constructor() {
1658
- super(), this._scale = L.scaleLinear();
1667
+ super(), this._scale = E.scaleLinear();
1659
1668
  }
1660
1669
  }
1661
1670
  const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
@@ -1668,25 +1677,25 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
1668
1677
  const e = i.match(/^(\d+)([a-zA-Z]+)$/);
1669
1678
  if (!e) throw new Error(`Invalid offset format: "${i}"`);
1670
1679
  return [parseInt(e[1]), e[2]];
1671
- }, An = (i, e) => {
1680
+ }, Sn = (i, e) => {
1672
1681
  const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
1673
1682
  const c = o.open_time.getTime();
1674
1683
  return c >= t && c <= s;
1675
- }), a = L.min(n, (o) => o.low), r = L.max(n, (o) => o.high);
1684
+ }), a = E.min(n, (o) => o.low), r = E.max(n, (o) => o.high);
1676
1685
  if (a == null || r == null) throw new Error("Invalid Y data");
1677
1686
  return [a, r];
1678
1687
  };
1679
- class Mn {
1688
+ class An {
1680
1689
  constructor(e) {
1681
1690
  this.model = e;
1682
1691
  }
1683
1692
  initX(e) {
1684
- const t = this.model.candles.preparedData, s = L.extent(t, (n) => new Date(n.open_time));
1693
+ const t = this.model.candles.preparedData, s = E.extent(t, (n) => new Date(n.open_time));
1685
1694
  if (!s[0] || !s[1]) throw new Error("Invalid x data");
1686
1695
  e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
1687
1696
  }
1688
1697
  initY(e, t) {
1689
- const s = An(this.model.candles.preparedData, t);
1698
+ const s = Sn(this.model.candles.preparedData, t);
1690
1699
  e.setDomain(s), this.setRange(e, this.model.layout.yAxis);
1691
1700
  }
1692
1701
  init(e) {
@@ -1715,7 +1724,7 @@ class Mn {
1715
1724
  e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
1716
1725
  }
1717
1726
  }
1718
- class Sn {
1727
+ class Mn {
1719
1728
  constructor(e) {
1720
1729
  f(this, "_model");
1721
1730
  f(this, "_scaleX");
@@ -1727,7 +1736,7 @@ class Sn {
1727
1736
  });
1728
1737
  f(this, "scaleFactor", { x: 1, y: 1 });
1729
1738
  f(this, "panOffset", { x: 0, y: 0 });
1730
- this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new Mn(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
1739
+ this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new An(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
1731
1740
  x: this._scaleX.domain(),
1732
1741
  y: this._scaleY.domain()
1733
1742
  };
@@ -1738,6 +1747,22 @@ class Sn {
1738
1747
  y: this._scaleY.domain()
1739
1748
  };
1740
1749
  }
1750
+ getViewState() {
1751
+ return {
1752
+ baseDomain: {
1753
+ x: [this._baseDomain.x[0], this._baseDomain.x[1]],
1754
+ y: [this._baseDomain.y[0], this._baseDomain.y[1]]
1755
+ },
1756
+ scaleFactor: { ...this.scaleFactor },
1757
+ panOffset: { ...this.panOffset }
1758
+ };
1759
+ }
1760
+ applyViewState(e) {
1761
+ this._baseDomain = {
1762
+ x: [e.baseDomain.x[0], e.baseDomain.x[1]],
1763
+ y: [e.baseDomain.y[0], e.baseDomain.y[1]]
1764
+ }, this.scaleFactor = { ...e.scaleFactor }, this.panOffset = { ...e.panOffset }, this._updateDomain("x"), this._updateDomain("y");
1765
+ }
1741
1766
  get x() {
1742
1767
  return this._scaleX;
1743
1768
  }
@@ -1999,7 +2024,7 @@ const kn = {
1999
2024
  }
2000
2025
  }
2001
2026
  };
2002
- class Ln {
2027
+ class En {
2003
2028
  constructor(e) {
2004
2029
  f(this, "_scheme");
2005
2030
  this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
@@ -2013,7 +2038,7 @@ class Ln {
2013
2038
  this._scheme = Qe({}, this._scheme, e);
2014
2039
  }
2015
2040
  }
2016
- class En {
2041
+ class Ln {
2017
2042
  constructor(e, t) {
2018
2043
  f(this, "_data");
2019
2044
  f(this, "_callbacks", {
@@ -2078,11 +2103,20 @@ class Nn {
2078
2103
  f(this, "trade");
2079
2104
  f(this, "userMarkers");
2080
2105
  f(this, "comments");
2081
- this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new Ln(o), this.layout = new _n(t, this.config), this.scales = new Sn(this), this.trade = new Tn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new En(c, this);
2106
+ this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new En(o), this.layout = new _n(t, this.config), this.scales = new Mn(this), this.trade = new Tn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new Ln(c, this);
2082
2107
  }
2083
2108
  init() {
2084
2109
  this.eventBus.emit("init_model");
2085
2110
  }
2111
+ getViewState() {
2112
+ return this.scales.getViewState();
2113
+ }
2114
+ applyViewState(e) {
2115
+ this.scales.applyViewState(e);
2116
+ }
2117
+ getConfigSnapshot() {
2118
+ return this.config.getSnapshot();
2119
+ }
2086
2120
  subscribe(e, t) {
2087
2121
  return this.eventBus.subscribe(e, t);
2088
2122
  }
@@ -2186,7 +2220,7 @@ function Hn(i, e) {
2186
2220
  colorScheme: { xAxis: s },
2187
2221
  config: { xAxis: n },
2188
2222
  scales: a
2189
- } = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = L.timeFormat("%d %b"), h = L.timeFormat("%H:%M");
2223
+ } = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = E.timeFormat("%d %b"), h = E.timeFormat("%H:%M");
2190
2224
  i.save(), i.fillStyle = s.bg, i.fillRect(t.x, t.y, t.width, t.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", r.forEach((d) => {
2191
2225
  const g = a.x.convert(d), p = o(d) ? c(d) : h(d);
2192
2226
  i.fillText(p, g, t.y + t.height / 2);
@@ -2262,7 +2296,7 @@ const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fon
2262
2296
  i.save(), i.translate(_, v), i.scale(g, g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "top", i.textAlign = "center", i.textBaseline = "middle";
2263
2297
  const b = a + g * 3 + 0.5, w = g * 16, x = b + w / 2;
2264
2298
  i.fillStyle = t, i.fillText(s, n, x), i.restore();
2265
- }, Pn = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
2299
+ }, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
2266
2300
  const g = r / 16, p = 16 * g, _ = n - p / 2, v = a;
2267
2301
  i.save(), i.translate(_, v), i.scale(g, -g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle";
2268
2302
  const b = g * 16, w = a - g * 19 + b / 2;
@@ -2276,16 +2310,16 @@ function et(i) {
2276
2310
  return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2277
2311
  }, et(i);
2278
2312
  }
2279
- var On = /^\s+/, zn = /\s+$/;
2280
- function M(i, e) {
2281
- if (i = i || "", e = e || {}, i instanceof M)
2313
+ var Pn = /^\s+/, zn = /\s+$/;
2314
+ function A(i, e) {
2315
+ if (i = i || "", e = e || {}, i instanceof A)
2282
2316
  return i;
2283
- if (!(this instanceof M))
2284
- return new M(i, e);
2317
+ if (!(this instanceof A))
2318
+ return new A(i, e);
2285
2319
  var t = Vn(i);
2286
2320
  this._originalInput = i, this._r = t.r, this._g = t.g, this._b = t.b, this._a = t.a, this._roundA = Math.round(100 * this._a) / 100, this._format = e.format || t.format, this._gradientType = e.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = t.ok;
2287
2321
  }
2288
- M.prototype = {
2322
+ A.prototype = {
2289
2323
  isDark: function() {
2290
2324
  return this.getBrightness() < 128;
2291
2325
  },
@@ -2381,7 +2415,7 @@ M.prototype = {
2381
2415
  toFilter: function(e) {
2382
2416
  var t = "#" + di(this._r, this._g, this._b, this._a), s = t, n = this._gradientType ? "GradientType = 1, " : "";
2383
2417
  if (e) {
2384
- var a = M(e);
2418
+ var a = A(e);
2385
2419
  s = "#" + di(a._r, a._g, a._b, a._a);
2386
2420
  }
2387
2421
  return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + t + ",endColorstr=" + s + ")";
@@ -2393,7 +2427,7 @@ M.prototype = {
2393
2427
  return a ? e === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (s = this.toRgbString()), e === "prgb" && (s = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (s = this.toHexString()), e === "hex3" && (s = this.toHexString(!0)), e === "hex4" && (s = this.toHex8String(!0)), e === "hex8" && (s = this.toHex8String()), e === "name" && (s = this.toName()), e === "hsl" && (s = this.toHslString()), e === "hsv" && (s = this.toHsvString()), s || this.toHexString());
2394
2428
  },
2395
2429
  clone: function() {
2396
- return M(this.toString());
2430
+ return A(this.toString());
2397
2431
  },
2398
2432
  _applyModification: function(e, t) {
2399
2433
  var s = e.apply(null, [this].concat([].slice.call(t)));
@@ -2446,14 +2480,14 @@ M.prototype = {
2446
2480
  return this._applyCombination(ui, [4]);
2447
2481
  }
2448
2482
  };
2449
- M.fromRatio = function(i, e) {
2483
+ A.fromRatio = function(i, e) {
2450
2484
  if (et(i) == "object") {
2451
2485
  var t = {};
2452
2486
  for (var s in i)
2453
2487
  i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] = ke(i[s]));
2454
2488
  i = t;
2455
2489
  }
2456
- return M(i, e);
2490
+ return A(i, e);
2457
2491
  };
2458
2492
  function Vn(i) {
2459
2493
  var e = {
@@ -2567,11 +2601,11 @@ function di(i, e, t, s) {
2567
2601
  var n = [Q(wi(s)), Q(Math.round(i).toString(16)), Q(Math.round(e).toString(16)), Q(Math.round(t).toString(16))];
2568
2602
  return n.join("");
2569
2603
  }
2570
- M.equals = function(i, e) {
2571
- return !i || !e ? !1 : M(i).toRgbString() == M(e).toRgbString();
2604
+ A.equals = function(i, e) {
2605
+ return !i || !e ? !1 : A(i).toRgbString() == A(e).toRgbString();
2572
2606
  };
2573
- M.random = function() {
2574
- return M.fromRatio({
2607
+ A.random = function() {
2608
+ return A.fromRatio({
2575
2609
  r: Math.random(),
2576
2610
  g: Math.random(),
2577
2611
  b: Math.random()
@@ -2579,45 +2613,45 @@ M.random = function() {
2579
2613
  };
2580
2614
  function Un(i, e) {
2581
2615
  e = e === 0 ? 0 : e || 10;
2582
- var t = M(i).toHsl();
2583
- return t.s -= e / 100, t.s = it(t.s), M(t);
2616
+ var t = A(i).toHsl();
2617
+ return t.s -= e / 100, t.s = it(t.s), A(t);
2584
2618
  }
2585
2619
  function Gn(i, e) {
2586
2620
  e = e === 0 ? 0 : e || 10;
2587
- var t = M(i).toHsl();
2588
- return t.s += e / 100, t.s = it(t.s), M(t);
2621
+ var t = A(i).toHsl();
2622
+ return t.s += e / 100, t.s = it(t.s), A(t);
2589
2623
  }
2590
2624
  function Zn(i) {
2591
- return M(i).desaturate(100);
2625
+ return A(i).desaturate(100);
2592
2626
  }
2593
2627
  function qn(i, e) {
2594
2628
  e = e === 0 ? 0 : e || 10;
2595
- var t = M(i).toHsl();
2596
- return t.l += e / 100, t.l = it(t.l), M(t);
2629
+ var t = A(i).toHsl();
2630
+ return t.l += e / 100, t.l = it(t.l), A(t);
2597
2631
  }
2598
2632
  function Jn(i, e) {
2599
2633
  e = e === 0 ? 0 : e || 10;
2600
- var t = M(i).toRgb();
2601
- return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), M(t);
2634
+ var t = A(i).toRgb();
2635
+ return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), A(t);
2602
2636
  }
2603
2637
  function Qn(i, e) {
2604
2638
  e = e === 0 ? 0 : e || 10;
2605
- var t = M(i).toHsl();
2606
- return t.l -= e / 100, t.l = it(t.l), M(t);
2639
+ var t = A(i).toHsl();
2640
+ return t.l -= e / 100, t.l = it(t.l), A(t);
2607
2641
  }
2608
2642
  function Kn(i, e) {
2609
- var t = M(i).toHsl(), s = (t.h + e) % 360;
2610
- return t.h = s < 0 ? 360 + s : s, M(t);
2643
+ var t = A(i).toHsl(), s = (t.h + e) % 360;
2644
+ return t.h = s < 0 ? 360 + s : s, A(t);
2611
2645
  }
2612
2646
  function ea(i) {
2613
- var e = M(i).toHsl();
2614
- return e.h = (e.h + 180) % 360, M(e);
2647
+ var e = A(i).toHsl();
2648
+ return e.h = (e.h + 180) % 360, A(e);
2615
2649
  }
2616
2650
  function ui(i, e) {
2617
2651
  if (isNaN(e) || e <= 0)
2618
2652
  throw new Error("Argument to polyad must be a positive number");
2619
- for (var t = M(i).toHsl(), s = [M(i)], n = 360 / e, a = 1; a < e; a++)
2620
- s.push(M({
2653
+ for (var t = A(i).toHsl(), s = [A(i)], n = 360 / e, a = 1; a < e; a++)
2654
+ s.push(A({
2621
2655
  h: (t.h + a * n) % 360,
2622
2656
  s: t.s,
2623
2657
  l: t.l
@@ -2625,12 +2659,12 @@ function ui(i, e) {
2625
2659
  return s;
2626
2660
  }
2627
2661
  function ta(i) {
2628
- var e = M(i).toHsl(), t = e.h;
2629
- return [M(i), M({
2662
+ var e = A(i).toHsl(), t = e.h;
2663
+ return [A(i), A({
2630
2664
  h: (t + 72) % 360,
2631
2665
  s: e.s,
2632
2666
  l: e.l
2633
- }), M({
2667
+ }), A({
2634
2668
  h: (t + 216) % 360,
2635
2669
  s: e.s,
2636
2670
  l: e.l
@@ -2638,37 +2672,37 @@ function ta(i) {
2638
2672
  }
2639
2673
  function ia(i, e, t) {
2640
2674
  e = e || 6, t = t || 30;
2641
- var s = M(i).toHsl(), n = 360 / t, a = [M(i)];
2675
+ var s = A(i).toHsl(), n = 360 / t, a = [A(i)];
2642
2676
  for (s.h = (s.h - (n * e >> 1) + 720) % 360; --e; )
2643
- s.h = (s.h + n) % 360, a.push(M(s));
2677
+ s.h = (s.h + n) % 360, a.push(A(s));
2644
2678
  return a;
2645
2679
  }
2646
2680
  function sa(i, e) {
2647
2681
  e = e || 6;
2648
- for (var t = M(i).toHsv(), s = t.h, n = t.s, a = t.v, r = [], o = 1 / e; e--; )
2649
- r.push(M({
2682
+ for (var t = A(i).toHsv(), s = t.h, n = t.s, a = t.v, r = [], o = 1 / e; e--; )
2683
+ r.push(A({
2650
2684
  h: s,
2651
2685
  s: n,
2652
2686
  v: a
2653
2687
  })), a = (a + o) % 1;
2654
2688
  return r;
2655
2689
  }
2656
- M.mix = function(i, e, t) {
2690
+ A.mix = function(i, e, t) {
2657
2691
  t = t === 0 ? 0 : t || 50;
2658
- var s = M(i).toRgb(), n = M(e).toRgb(), a = t / 100, r = {
2692
+ var s = A(i).toRgb(), n = A(e).toRgb(), a = t / 100, r = {
2659
2693
  r: (n.r - s.r) * a + s.r,
2660
2694
  g: (n.g - s.g) * a + s.g,
2661
2695
  b: (n.b - s.b) * a + s.b,
2662
2696
  a: (n.a - s.a) * a + s.a
2663
2697
  };
2664
- return M(r);
2698
+ return A(r);
2665
2699
  };
2666
- M.readability = function(i, e) {
2667
- var t = M(i), s = M(e);
2700
+ A.readability = function(i, e) {
2701
+ var t = A(i), s = A(e);
2668
2702
  return (Math.max(t.getLuminance(), s.getLuminance()) + 0.05) / (Math.min(t.getLuminance(), s.getLuminance()) + 0.05);
2669
2703
  };
2670
- M.isReadable = function(i, e, t) {
2671
- var s = M.readability(i, e), n, a;
2704
+ A.isReadable = function(i, e, t) {
2705
+ var s = A.readability(i, e), n, a;
2672
2706
  switch (a = !1, n = ca(t), n.level + n.size) {
2673
2707
  case "AAsmall":
2674
2708
  case "AAAlarge":
@@ -2683,17 +2717,17 @@ M.isReadable = function(i, e, t) {
2683
2717
  }
2684
2718
  return a;
2685
2719
  };
2686
- M.mostReadable = function(i, e, t) {
2720
+ A.mostReadable = function(i, e, t) {
2687
2721
  var s = null, n = 0, a, r, o, c;
2688
2722
  t = t || {}, r = t.includeFallbackColors, o = t.level, c = t.size;
2689
2723
  for (var h = 0; h < e.length; h++)
2690
- a = M.readability(i, e[h]), a > n && (n = a, s = M(e[h]));
2691
- return M.isReadable(i, s, {
2724
+ a = A.readability(i, e[h]), a > n && (n = a, s = A(e[h]));
2725
+ return A.isReadable(i, s, {
2692
2726
  level: o,
2693
2727
  size: c
2694
- }) || !r ? s : (t.includeFallbackColors = !1, M.mostReadable(i, ["#fff", "#000"], t));
2728
+ }) || !r ? s : (t.includeFallbackColors = !1, A.mostReadable(i, ["#fff", "#000"], t));
2695
2729
  };
2696
- var At = M.names = {
2730
+ var St = A.names = {
2697
2731
  aliceblue: "f0f8ff",
2698
2732
  antiquewhite: "faebd7",
2699
2733
  aqua: "0ff",
@@ -2843,7 +2877,7 @@ var At = M.names = {
2843
2877
  whitesmoke: "f5f5f5",
2844
2878
  yellow: "ff0",
2845
2879
  yellowgreen: "9acd32"
2846
- }, na = M.hexNames = aa(At);
2880
+ }, na = A.hexNames = aa(St);
2847
2881
  function aa(i) {
2848
2882
  var e = {};
2849
2883
  for (var t in i)
@@ -2861,7 +2895,7 @@ function R(i, e) {
2861
2895
  function it(i) {
2862
2896
  return Math.min(1, Math.max(0, i));
2863
2897
  }
2864
- function Y(i) {
2898
+ function X(i) {
2865
2899
  return parseInt(i, 16);
2866
2900
  }
2867
2901
  function ra(i) {
@@ -2880,7 +2914,7 @@ function wi(i) {
2880
2914
  return Math.round(parseFloat(i) * 255).toString(16);
2881
2915
  }
2882
2916
  function fi(i) {
2883
- return Y(i) / 255;
2917
+ return X(i) / 255;
2884
2918
  }
2885
2919
  var J = function() {
2886
2920
  var i = "[-\\+]?\\d+%?", e = "[-\\+]?\\d*\\.\\d+%?", t = "(?:" + e + ")|(?:" + i + ")", s = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?", n = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?";
@@ -2902,10 +2936,10 @@ function se(i) {
2902
2936
  return !!J.CSS_UNIT.exec(i);
2903
2937
  }
2904
2938
  function la(i) {
2905
- i = i.replace(On, "").replace(zn, "").toLowerCase();
2939
+ i = i.replace(Pn, "").replace(zn, "").toLowerCase();
2906
2940
  var e = !1;
2907
- if (At[i])
2908
- i = At[i], e = !0;
2941
+ if (St[i])
2942
+ i = St[i], e = !0;
2909
2943
  else if (i == "transparent")
2910
2944
  return {
2911
2945
  r: 0,
@@ -2943,26 +2977,26 @@ function la(i) {
2943
2977
  v: t[3],
2944
2978
  a: t[4]
2945
2979
  } : (t = J.hex8.exec(i)) ? {
2946
- r: Y(t[1]),
2947
- g: Y(t[2]),
2948
- b: Y(t[3]),
2980
+ r: X(t[1]),
2981
+ g: X(t[2]),
2982
+ b: X(t[3]),
2949
2983
  a: fi(t[4]),
2950
2984
  format: e ? "name" : "hex8"
2951
2985
  } : (t = J.hex6.exec(i)) ? {
2952
- r: Y(t[1]),
2953
- g: Y(t[2]),
2954
- b: Y(t[3]),
2986
+ r: X(t[1]),
2987
+ g: X(t[2]),
2988
+ b: X(t[3]),
2955
2989
  format: e ? "name" : "hex"
2956
2990
  } : (t = J.hex4.exec(i)) ? {
2957
- r: Y(t[1] + "" + t[1]),
2958
- g: Y(t[2] + "" + t[2]),
2959
- b: Y(t[3] + "" + t[3]),
2991
+ r: X(t[1] + "" + t[1]),
2992
+ g: X(t[2] + "" + t[2]),
2993
+ b: X(t[3] + "" + t[3]),
2960
2994
  a: fi(t[4] + "" + t[4]),
2961
2995
  format: e ? "name" : "hex8"
2962
2996
  } : (t = J.hex3.exec(i)) ? {
2963
- r: Y(t[1] + "" + t[1]),
2964
- g: Y(t[2] + "" + t[2]),
2965
- b: Y(t[3] + "" + t[3]),
2997
+ r: X(t[1] + "" + t[1]),
2998
+ g: X(t[2] + "" + t[2]),
2999
+ b: X(t[3] + "" + t[3]),
2966
3000
  format: e ? "name" : "hex"
2967
3001
  } : !1;
2968
3002
  }
@@ -2990,13 +3024,13 @@ function ha(i, e) {
2990
3024
  t.forEach(({ isHovered: h, isActive: d, candle: g, trades: p }) => {
2991
3025
  const _ = s.convert(g.open_time);
2992
3026
  p.forEach((v) => {
2993
- const b = v.type === "buy", w = b ? o.buyLabel.text : o.sellLabel.text, x = b ? "B" : "S", y = b ? n.convert(g.low) + c : n.convert(g.high) - c, C = b ? $n : Pn;
2994
- let S = b ? o.buyLabel.main : o.sellLabel.main;
2995
- h && h[1] && h[0] === v.type && (S = M.mix(S, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (S = o.activeLabel), C(i, {
3027
+ const b = v.type === "buy", w = b ? o.buyLabel.text : o.sellLabel.text, x = b ? "B" : "S", y = b ? n.convert(g.low) + c : n.convert(g.high) - c, C = b ? $n : On;
3028
+ let M = b ? o.buyLabel.main : o.sellLabel.main;
3029
+ h && h[1] && h[0] === v.type && (M = A.mix(M, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (M = o.activeLabel), C(i, {
2996
3030
  x: _,
2997
3031
  y,
2998
3032
  symbol: x,
2999
- mainColor: S,
3033
+ mainColor: M,
3000
3034
  textColor: w,
3001
3035
  size: 16,
3002
3036
  fontSize: 12
@@ -3094,7 +3128,7 @@ function ga(i) {
3094
3128
  return s.length ? s.join(" ") : "0s";
3095
3129
  }
3096
3130
  const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
3097
- var V;
3131
+ var W;
3098
3132
  const {
3099
3133
  scales: { x: t, y: s },
3100
3134
  trade: { entries: n, exits: a, holdTime: r },
@@ -3108,14 +3142,14 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
3108
3142
  if (!c) return;
3109
3143
  const p = n.at(0), _ = a.at(-1);
3110
3144
  if (!p || !_) return;
3111
- const v = (P) => P ? P instanceof Date ? P : new Date(P) : null, b = v(d == null ? void 0 : d[0]) || p.candle.open_time, w = v(d == null ? void 0 : d[1]) || _.candle.close_time, x = t.convert(v(d == null ? void 0 : d[0]) || p.candle.open_time), y = t.convert(v(d == null ? void 0 : d[1]) || _.candle.open_time), C = e.candles.allData.filter(
3112
- (P) => P.open_time <= w && P.close_time >= b
3113
- ), S = C.length > 0 ? C.reduce((P, oe) => oe.low < P ? oe.low : P, C[0].low) : ((V = n.at(0)) == null ? void 0 : V.price) ?? 0, T = s.convert(g || S);
3145
+ const v = (O) => O ? O instanceof Date ? O : new Date(O) : null, b = v(d == null ? void 0 : d[0]) || p.candle.open_time, w = v(d == null ? void 0 : d[1]) || _.candle.close_time, x = t.convert(v(d == null ? void 0 : d[0]) || p.candle.open_time), y = t.convert(v(d == null ? void 0 : d[1]) || _.candle.open_time), C = e.candles.allData.filter(
3146
+ (O) => O.open_time <= w && O.close_time >= b
3147
+ ), M = C.length > 0 ? C.reduce((O, oe) => oe.low < O ? oe.low : O, C[0].low) : ((W = n.at(0)) == null ? void 0 : W.price) ?? 0, T = s.convert(g || M);
3114
3148
  i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(x, T), i.lineTo(y, T), i.stroke(), i.setLineDash([]);
3115
- const N = (x + y) / 2, $ = h || `Hold: ${ga(r)}`, U = getComputedStyle(
3149
+ const N = (x + y) / 2, $ = h || `Hold: ${ga(r)}`, Z = getComputedStyle(
3116
3150
  document.querySelector(".sc-charts-cs") || document.body
3117
3151
  ).font.replace(/^\s*\S+/, "").trim();
3118
- i.font = `600 ${ma}px ${U}`;
3152
+ i.font = `600 ${ma}px ${Z}`;
3119
3153
  const K = i.measureText($).width + pa * 2, z = va + _a * 2;
3120
3154
  xi(i, {
3121
3155
  radius: 4,
@@ -3160,18 +3194,18 @@ const ya = {
3160
3194
  offset: n = 8
3161
3195
  }) => {
3162
3196
  const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
3163
- const { dx: C, dy: S } = ya[y], T = t.x + (C === 1 ? n : -a - n), N = t.y + (S === 1 ? n : -r - n);
3197
+ const { dx: C, dy: M } = ya[y], T = t.x + (C === 1 ? n : -a - n), N = t.y + (M === 1 ? n : -r - n);
3164
3198
  return { x: T, y: N, side: y };
3165
3199
  }, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
3166
- const y = t.y < 0, C = t.y + r > c, S = t.x < 0, T = t.x + a > o;
3167
- return S && y ? "right-bottom" : S && C ? "right-top" : T && y ? "left-bottom" : T && C ? "left-top" : S ? "right-bottom" : T ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
3200
+ const y = t.y < 0, C = t.y + r > c, M = t.x < 0, T = t.x + a > o;
3201
+ return M && y ? "right-bottom" : M && C ? "right-top" : T && y ? "left-bottom" : T && C ? "left-top" : M ? "right-bottom" : T ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
3168
3202
  }, _ = [
3169
3203
  s,
3170
3204
  "right-bottom",
3171
3205
  "right-top",
3172
3206
  "left-bottom",
3173
3207
  "left-top"
3174
- ].filter((y, C, S) => S.indexOf(y) === C), v = g();
3208
+ ].filter((y, C, M) => M.indexOf(y) === C), v = g();
3175
3209
  let b = null;
3176
3210
  for (const y of [v, ..._]) {
3177
3211
  const C = h(y);
@@ -3240,7 +3274,7 @@ class wa extends ne {
3240
3274
  }), this.oneBox = new k({
3241
3275
  tag: "div",
3242
3276
  className: this.clsx("box_one")
3243
- }), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: j.empty() };
3277
+ }), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: U.empty() };
3244
3278
  }
3245
3279
  _createLineNodes(t, s) {
3246
3280
  const n = [];
@@ -3318,7 +3352,7 @@ class xa extends Fe {
3318
3352
  function Ca(i, { color: e = "#000000", lineWidth: t = 1, dashed: s, coords: n }) {
3319
3353
  i.strokeStyle = e, i.lineWidth = t, s && i.setLineDash(s), i.beginPath(), i.moveTo(n.x1, n.y1), i.lineTo(n.x2, n.y2), i.stroke();
3320
3354
  }
3321
- const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3355
+ const Sa = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
3322
3356
  const {
3323
3357
  coords: t,
3324
3358
  text: s,
@@ -3329,7 +3363,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3329
3363
  borderRadius: c = 0,
3330
3364
  colors: h,
3331
3365
  align: d = { x: "left", y: "top" }
3332
- } = e, g = { ...Aa, ...h }, _ = getComputedStyle(
3366
+ } = e, g = { ...Sa, ...h }, _ = getComputedStyle(
3333
3367
  document.querySelector(".sc-charts-cs") || document.body
3334
3368
  ).font.replace(/^\s*\S+/, "").trim();
3335
3369
  i.font = `${a} ${n}px ${_}`;
@@ -3360,7 +3394,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3360
3394
  x2: r.x,
3361
3395
  y2: r.y
3362
3396
  }
3363
- }), Ma(i, {
3397
+ }), Aa(i, {
3364
3398
  text: e,
3365
3399
  coords: r,
3366
3400
  padding: { x: 6, y: 4 },
@@ -3377,7 +3411,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3377
3411
  }
3378
3412
  }), i.restore();
3379
3413
  };
3380
- class Sa extends Ne {
3414
+ class Ma extends Ne {
3381
3415
  constructor(e) {
3382
3416
  super(e);
3383
3417
  }
@@ -3387,7 +3421,7 @@ class Sa extends Ne {
3387
3421
  }
3388
3422
  class Ta extends Fe {
3389
3423
  constructor(e) {
3390
- if (super("user-markers", e, { CanvasClass: Sa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
3424
+ if (super("user-markers", e, { CanvasClass: Ma, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
3391
3425
  }
3392
3426
  render(e) {
3393
3427
  this.canvas.clear();
@@ -3441,7 +3475,7 @@ class ka extends k {
3441
3475
  }), this.append(s.node, n.node);
3442
3476
  }
3443
3477
  }
3444
- function Lt(i, e) {
3478
+ function Et(i, e) {
3445
3479
  var n;
3446
3480
  const t = (a) => {
3447
3481
  if (!document.contains(i.node)) return;
@@ -3458,7 +3492,7 @@ function Lt(i, e) {
3458
3492
  document.removeEventListener("mousedown", t), s == null || s();
3459
3493
  }, i;
3460
3494
  }
3461
- class La {
3495
+ class Ea {
3462
3496
  constructor() {
3463
3497
  f(this, "node");
3464
3498
  const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
@@ -3497,7 +3531,7 @@ class La {
3497
3531
  }
3498
3532
  }
3499
3533
  const Te = new re("comment-list");
3500
- class Ea extends k {
3534
+ class La extends k {
3501
3535
  constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
3502
3536
  super({ className: Te.gen("item") });
3503
3537
  f(this, "actionTooltip");
@@ -3514,13 +3548,13 @@ class Ea extends k {
3514
3548
  onDelete: t,
3515
3549
  onUpdate: s
3516
3550
  });
3517
- this.actionTooltip = Lt(c, () => {
3551
+ this.actionTooltip = Et(c, () => {
3518
3552
  this.actionTooltip.setVisible(!1);
3519
3553
  }), this.actionsTrigger.node.addEventListener("click", () => {
3520
3554
  this.actionsTrigger.updateAbsolutePosition(), this.actionTooltip.updateAbsolutePosition(), this.actionTooltip.node.style.top = this.actionsTrigger.absolutePosition.top - a.chart.top + 20 + "px", this.actionTooltip.node.style.left = this.actionsTrigger.absolutePosition.left - a.chart.left - this.actionTooltip.absolutePosition.width + 10 + "px", this.actionTooltip.setVisible(!0);
3521
3555
  });
3522
3556
  const h = new k({ className: Te.gen("text-wrap") });
3523
- this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new La().node), this.append(h.node, o.node);
3557
+ this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new Ea().node), this.append(h.node, o.node);
3524
3558
  }
3525
3559
  }
3526
3560
  class Na {
@@ -3605,7 +3639,7 @@ class Ia extends ne {
3605
3639
  },
3606
3640
  initialValue: t.text
3607
3641
  });
3608
- const s = new Ea({
3642
+ const s = new La({
3609
3643
  onDelete: () => {
3610
3644
  this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
3611
3645
  },
@@ -3634,7 +3668,7 @@ class Ra {
3634
3668
  }
3635
3669
  }
3636
3670
  const Je = new re(""), wt = new re("add-field");
3637
- class Ai extends ne {
3671
+ class Si extends ne {
3638
3672
  constructor({ onAdd: t, blockName: s }) {
3639
3673
  Je.block = s;
3640
3674
  super({ className: Je.gen() + " " + wt.gen() });
@@ -3667,7 +3701,7 @@ class Ai extends ne {
3667
3701
  }
3668
3702
  }
3669
3703
  const $a = new re("list-tooltip"), xt = 8;
3670
- class Pa extends ne {
3704
+ class Oa extends ne {
3671
3705
  constructor(t, s, n) {
3672
3706
  super({ className: $a.gen() });
3673
3707
  f(this, "_list");
@@ -3675,7 +3709,7 @@ class Pa extends ne {
3675
3709
  f(this, "_size", null);
3676
3710
  f(this, "_model");
3677
3711
  f(this, "_prevIsShow", !1);
3678
- this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Ai({
3712
+ this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Si({
3679
3713
  blockName: "list-tooltip-add",
3680
3714
  onAdd: (a) => {
3681
3715
  const r = t[0].date, o = t[0].price, c = {
@@ -3699,7 +3733,7 @@ class Pa extends ne {
3699
3733
  return this._list;
3700
3734
  }
3701
3735
  }
3702
- class Oa {
3736
+ class Pa {
3703
3737
  constructor() {
3704
3738
  f(this, "node");
3705
3739
  const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
@@ -3719,7 +3753,7 @@ class za extends ne {
3719
3753
  x: t,
3720
3754
  y: n.layout.xAxis.top,
3721
3755
  isActive: !1
3722
- }, this.node.append(new Oa().node), this.render();
3756
+ }, this.node.append(new Pa().node), this.render();
3723
3757
  }
3724
3758
  render() {
3725
3759
  const { x: t, y: s, isActive: n } = this.state;
@@ -3745,7 +3779,7 @@ class Va extends ne {
3745
3779
  }, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
3746
3780
  const h = !this.state.isActive;
3747
3781
  h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
3748
- }), this.tooltip = Lt(new Pa(a, s, n), (h) => {
3782
+ }), this.tooltip = Et(new Oa(a, s, n), (h) => {
3749
3783
  this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
3750
3784
  }), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
3751
3785
  }
@@ -3777,9 +3811,9 @@ class Ya extends ne {
3777
3811
  f(this, "_size", null);
3778
3812
  f(this, "_model", null);
3779
3813
  f(this, "_candle", null);
3780
- this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Lt(this.menu, () => {
3814
+ this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Et(this.menu, () => {
3781
3815
  this.setState({ isShow: !1 });
3782
- }), this.addField = new Ai({
3816
+ }), this.addField = new Si({
3783
3817
  blockName: "context-add",
3784
3818
  onAdd: (t) => {
3785
3819
  !this._model || !this._candle || (this._model.comments.add({
@@ -3888,7 +3922,7 @@ class Ua extends Fe {
3888
3922
  if (e.config.guides.isShowX) {
3889
3923
  const n = e.config.xAxis.position;
3890
3924
  this.canvas.drawMarker({
3891
- text: L.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
3925
+ text: E.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
3892
3926
  startLineCoords: { x: t, y: 0 },
3893
3927
  endMarkerCoords: { x: t, y: e.layout.xAxis[n] },
3894
3928
  side: n,
@@ -3903,7 +3937,7 @@ class Ga extends ne {
3903
3937
  super({ className: t });
3904
3938
  f(this, "_isFirstShow", !1);
3905
3939
  const s = new k({ tag: "p" });
3906
- s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: j.empty() }, this.render();
3940
+ s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: U.empty() }, this.render();
3907
3941
  }
3908
3942
  render() {
3909
3943
  const { isShow: t, x: s, y: n, parent: a } = this.state;
@@ -3956,7 +3990,7 @@ class Za extends Ne {
3956
3990
  });
3957
3991
  }
3958
3992
  _mix(t, s, n) {
3959
- return n ? M.mix(t, s).toString() : t;
3993
+ return n ? A.mix(t, s).toString() : t;
3960
3994
  }
3961
3995
  _getBasicCandleProps(t, s) {
3962
3996
  return {
@@ -4448,14 +4482,14 @@ function cr(i, e) {
4448
4482
  }));
4449
4483
  };
4450
4484
  }
4451
- function Mt(i, e) {
4485
+ function At(i, e) {
4452
4486
  const { width: t } = e.candles.limiter.absolutePosition, s = i.config.candles.baseWidth, n = i.config.candles.limiterOffset.left + i.config.candles.limiterOffset.right, r = i.scales.x.convert(i.candles.allData[0].open_time) - t - s / 2 - n;
4453
4487
  r > 0 && i.scales.pan("x", -r);
4454
4488
  }
4455
- function St(i) {
4489
+ function Mt(i) {
4456
4490
  return i.candles.limiter.absolutePosition.width > 0;
4457
4491
  }
4458
- class Et {
4492
+ class Lt {
4459
4493
  constructor(e, t, s) {
4460
4494
  f(this, "_model");
4461
4495
  f(this, "_hitManager");
@@ -4463,7 +4497,7 @@ class Et {
4463
4497
  this._model = e, this._hitManager = t, this._hit = s, t.register(s);
4464
4498
  }
4465
4499
  }
4466
- class hr extends Et {
4500
+ class hr extends Lt {
4467
4501
  constructor(t, s, n) {
4468
4502
  super(t, s, new ar(t));
4469
4503
  f(this, "_view");
@@ -4472,13 +4506,13 @@ class hr extends Et {
4472
4506
  register() {
4473
4507
  this._hitManager.on(this._hit, "drag", (t) => {
4474
4508
  const s = t.x - (t.prevX ?? t.x);
4475
- this._model.scales.scale("x", -s), this._view && St(this._view) && Mt(this._model, this._view);
4509
+ this._model.scales.scale("x", -s), this._view && Mt(this._view) && At(this._model, this._view);
4476
4510
  }), this._hitManager.on(this._hit, "dblclick", () => {
4477
4511
  this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
4478
4512
  });
4479
4513
  }
4480
4514
  }
4481
- class dr extends Et {
4515
+ class dr extends Lt {
4482
4516
  constructor(e, t) {
4483
4517
  super(e, t, new or(e));
4484
4518
  }
@@ -4491,7 +4525,7 @@ class dr extends Et {
4491
4525
  });
4492
4526
  }
4493
4527
  }
4494
- class ur extends Et {
4528
+ class ur extends Lt {
4495
4529
  constructor(t, s, n) {
4496
4530
  super(t, n, new rr(t));
4497
4531
  f(this, "_view");
@@ -4510,7 +4544,7 @@ class ur extends Et {
4510
4544
  this._hit,
4511
4545
  "drag",
4512
4546
  cr(1, (t) => {
4513
- this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), St(this._view) && Mt(this._model, this._view), this._model.scales.pan("y", t.y - (t.prevY ?? t.y)), this._view.guideMarkers.render(this._model, { x: t.x, y: t.y });
4547
+ this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), Mt(this._view) && At(this._model, this._view), this._model.scales.pan("y", t.y - (t.prevY ?? t.y)), this._view.guideMarkers.render(this._model, { x: t.x, y: t.y });
4514
4548
  })
4515
4549
  ), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
4516
4550
  const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
@@ -4519,7 +4553,7 @@ class ur extends Et {
4519
4553
  var a, r;
4520
4554
  if (!t.deltaY) return;
4521
4555
  const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
4522
- ["x", "both"].includes(n) && (this._model.scales.scale("x", s), St(this._view) && Mt(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
4556
+ ["x", "both"].includes(n) && (this._model.scales.scale("x", s), Mt(this._view) && At(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
4523
4557
  });
4524
4558
  }
4525
4559
  }
@@ -4696,7 +4730,11 @@ class _r {
4696
4730
  const _ = [];
4697
4731
  if (t.pair && _.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
4698
4732
  const C = t.net_pnl.startsWith("+");
4699
- _.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
4733
+ _.push({
4734
+ label: "Net P&L",
4735
+ value: t.net_pnl,
4736
+ valueColor: C ? "#56B683" : "#F18169"
4737
+ });
4700
4738
  }
4701
4739
  t.type && _.push({ label: "Type", value: t.type }), t.entry_price && _.push({ label: "Entry", value: t.entry_price }), t.exit_price && _.push({ label: "Exit", value: t.exit_price }), t.open_date && _.push({ label: "Open date", value: t.open_date }), t.close_date && _.push({ label: "Close date", value: t.close_date }), t.holdtime && _.push({ label: "Holdtime", value: t.holdtime }), t.rr && _.push({ label: "RR", value: t.rr }), t.volume && _.push({ label: "Volume", value: t.volume });
4702
4740
  const v = p + c / 2, b = 24 * r;
@@ -4705,12 +4743,21 @@ class _r {
4705
4743
  const w = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
4706
4744
  let y = h;
4707
4745
  _.forEach((C) => {
4708
- const S = e.measureText(C.label).width, T = e.measureText(C.value).width, N = S + g + T;
4746
+ const M = e.measureText(C.label).width, T = e.measureText(C.value).width, N = M + g + T;
4709
4747
  e.fillStyle = w, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.label, y, v);
4710
- const $ = y + S + g;
4748
+ const $ = y + M + g;
4711
4749
  e.fillStyle = C.valueColor || x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.value, $, v), y += N + b;
4712
4750
  });
4713
4751
  }
4752
+ getChartState() {
4753
+ return {
4754
+ config: this._model.getConfigSnapshot(),
4755
+ view: this._model.getViewState()
4756
+ };
4757
+ }
4758
+ applyChartState(e) {
4759
+ this._model.updateConfig(e.config), this._model.applyViewState(e.view);
4760
+ }
4714
4761
  async captureScreenshot(e = {}) {
4715
4762
  const t = typeof e == "string" ? e : e.filename || "candlestick-chart.png", n = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
4716
4763
  month: "short",
@@ -4719,79 +4766,96 @@ class _r {
4719
4766
  hour: "2-digit",
4720
4767
  minute: "2-digit",
4721
4768
  timeZoneName: "short"
4722
- }), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: p, height: _ } = this._view, v = Array.from(
4769
+ });
4770
+ console.log(this.getChartState());
4771
+ const a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: p, height: _ } = this._view, v = Array.from(
4723
4772
  g.node.querySelectorAll("canvas")
4724
4773
  );
4725
4774
  if (v.length === 0) {
4726
4775
  console.warn("No canvas elements found for screenshot");
4727
4776
  return;
4728
4777
  }
4729
- const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, S = w - x - y - C, T = b, N = p / _, $ = T / S;
4730
- let X, U, te = 0, K = 0;
4731
- N > $ ? (U = S, X = U * N, te = 0, K = 0) : (X = T, U = X / N, K = (S - U) / 2);
4732
- const z = window.devicePixelRatio || 1, V = document.createElement("canvas");
4733
- V.width = b * z, V.height = w * z;
4734
- const P = V.getContext("2d");
4735
- if (!P) {
4778
+ const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, M = w - x - y - C, T = b, N = p / _, $ = T / M;
4779
+ let G, Z, te = 0, K = 0;
4780
+ N > $ ? (Z = M, G = Z * N, te = 0, K = 0) : (G = T, Z = G / N, K = (M - Z) / 2);
4781
+ const z = window.devicePixelRatio || 1, W = document.createElement("canvas");
4782
+ W.width = b * z, W.height = w * z;
4783
+ const O = W.getContext("2d");
4784
+ if (!O) {
4736
4785
  console.error("Failed to get 2D context for merged canvas");
4737
4786
  return;
4738
4787
  }
4739
- P.fillStyle = h ? "#101011" : "#ffffff", P.fillRect(0, 0, V.width, V.height);
4740
- const oe = x * z, st = y * z, le = S * z, be = T * z, ye = oe + st;
4741
- await this._drawHeader(P, V.width, z, h), this._drawHeaderSecondLine(P, r, o, V.width, oe, z, h);
4788
+ O.fillStyle = h ? "#101011" : "#ffffff", O.fillRect(0, 0, W.width, W.height);
4789
+ const oe = x * z, st = y * z, le = M * z, be = T * z, ye = oe + st;
4790
+ await this._drawHeader(O, W.width, z, h), this._drawHeaderSecondLine(
4791
+ O,
4792
+ r,
4793
+ o,
4794
+ W.width,
4795
+ oe,
4796
+ z,
4797
+ h
4798
+ );
4742
4799
  const He = this._view.mainCanvas;
4743
- He.background && (P.fillStyle = He.background, P.fillRect(0, ye, V.width, le));
4744
- const Be = X * z, Ie = U * z, F = te * z, Re = K * z;
4745
- v.forEach((O) => {
4746
- let ee = 0, G = 0, Z = O.width, me = O.height, we = Be, xe = Ie, Pe = F, Oe = Re;
4800
+ He.background && (O.fillStyle = He.background, O.fillRect(0, ye, W.width, le));
4801
+ const Be = G * z, Ie = Z * z, F = te * z, Re = K * z;
4802
+ v.forEach((P) => {
4803
+ let ee = 0, V = 0, Y = P.width, me = P.height, we = Be, xe = Ie, Oe = F, Pe = Re;
4747
4804
  if (N > $) {
4748
- const ce = Ie / O.height, he = O.width * ce;
4749
- he > be && (ee = (he - be) / ce, Z = O.width - ee, we = be, Pe = 0);
4805
+ const ce = Ie / P.height, he = P.width * ce;
4806
+ he > be && (ee = (he - be) / ce, Y = P.width - ee, we = be, Oe = 0);
4750
4807
  } else {
4751
- const ce = Be / O.width, he = O.height * ce;
4808
+ const ce = Be / P.width, he = P.height * ce;
4752
4809
  if (he > le) {
4753
4810
  const Ce = (he - le) / ce;
4754
- G = Ce / 2, me = O.height - Ce, xe = le, Oe = 0;
4811
+ V = Ce / 2, me = P.height - Ce, xe = le, Pe = 0;
4755
4812
  }
4756
4813
  }
4757
- P.drawImage(
4758
- O,
4814
+ O.drawImage(
4815
+ P,
4759
4816
  ee,
4760
- G,
4761
- Z,
4817
+ V,
4818
+ Y,
4762
4819
  me,
4763
- Pe,
4764
- ye + Oe,
4820
+ Oe,
4821
+ ye + Pe,
4765
4822
  we,
4766
4823
  xe
4767
4824
  );
4768
- }), c && this._drawFooter(P, c, V.width, ye, le, z, h);
4769
- const $e = (O, ee) => {
4770
- const G = URL.createObjectURL(O), Z = document.createElement("a");
4771
- Z.href = G, Z.download = ee, document.body.appendChild(Z), Z.click(), document.body.removeChild(Z), URL.revokeObjectURL(G);
4825
+ }), c && this._drawFooter(
4826
+ O,
4827
+ c,
4828
+ W.width,
4829
+ ye,
4830
+ le,
4831
+ z,
4832
+ h
4833
+ );
4834
+ const $e = (P, ee) => {
4835
+ const V = URL.createObjectURL(P), Y = document.createElement("a");
4836
+ Y.href = V, Y.download = ee, document.body.appendChild(Y), Y.click(), document.body.removeChild(Y), URL.revokeObjectURL(V);
4772
4837
  };
4773
- V.toBlob(
4774
- async (O) => {
4775
- if (!O) {
4776
- console.error("Failed to create blob from canvas");
4777
- return;
4778
- }
4779
- if (d)
4780
- $e(O, t);
4781
- else
4782
- try {
4783
- await navigator.clipboard.write([
4784
- new ClipboardItem({
4785
- "image/png": O
4786
- })
4787
- ]);
4788
- } catch (ee) {
4789
- console.error("Failed to copy to clipboard:", ee), $e(O, t);
4838
+ return new Promise((P, ee) => {
4839
+ W.toBlob(
4840
+ async (V) => {
4841
+ if (!V) {
4842
+ ee(new Error("Failed to create blob from canvas"));
4843
+ return;
4790
4844
  }
4791
- },
4792
- "image/png",
4793
- 1
4794
- );
4845
+ if (d)
4846
+ $e(V, t);
4847
+ else
4848
+ try {
4849
+ await navigator.clipboard.write([new ClipboardItem({ "image/png": V })]);
4850
+ } catch (Y) {
4851
+ console.error("Failed to copy to clipboard:", Y), $e(V, t);
4852
+ }
4853
+ a.returnBlob ? P(V) : P();
4854
+ },
4855
+ "image/png",
4856
+ 1
4857
+ );
4858
+ });
4795
4859
  }
4796
4860
  }
4797
4861
  export {