charts-core 1.1.24 → 1.1.25

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,40 +1,40 @@
1
- var Ls = Object.defineProperty;
2
- var Ns = (i, e, t) => e in i ? Ls(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var f = (i, e, t) => Ns(i, typeof e != "symbol" ? e + "" : e, t);
4
- import * as D from "d3";
5
- const Fs = (i) => {
6
- const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks: u, isShow: g } = r;
1
+ var Ns = Object.defineProperty;
2
+ var Fs = (i, e, t) => e in i ? Ns(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import * as L from "d3";
5
+ const Hs = (i) => {
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
- e.append("g").attr("transform", `translate(${n - a.right},0)`).call((p) => {
9
- let _ = D.axisRight(s);
10
- o && c ? _ = _.tickFormat(c) : _ = _.tickFormat((v) => {
8
+ e.append("g").attr("transform", `translate(${n - a.right},0)`).call((_) => {
9
+ let p = L.axisRight(s);
10
+ o && c ? p = p.tickFormat(c) : p = p.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);
13
- }), o && u && (_ = Array.isArray(u) ? _.ticks(...u) : _.ticks(u)), o && h && (_ = _.tickValues(h)), p.call(_);
14
- }).call((p) => {
15
- let _ = [];
16
- p.selectAll(".tick").each((v) => _.push(v)), i.yTicks = _;
17
- }).call((p) => p.select(".domain").remove()).call((p) => p.selectAll(".tick line").remove()).call((p) => {
18
- const _ = p.selectAll(".tick text");
19
- _.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
20
- const v = _.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
21
- p.selectAll(".tick").each(function(w, x) {
22
- var O;
23
- const y = D.select(this), C = y.select("text"), S = v[x], F = b - S, H = y.append("g").attr("transform", "translate(10, 0)");
24
- C.attr("x", F), C.remove(), (O = H.node()) == null || O.appendChild(C.node());
13
+ }), o && d && (p = Array.isArray(d) ? p.ticks(...d) : p.ticks(d)), o && h && (p = p.tickValues(h)), _.call(p);
14
+ }).call((_) => {
15
+ let p = [];
16
+ _.selectAll(".tick").each((v) => p.push(v)), i.yTicks = p;
17
+ }).call((_) => _.select(".domain").remove()).call((_) => _.selectAll(".tick line").remove()).call((_) => {
18
+ const p = _.selectAll(".tick text");
19
+ p.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
20
+ const v = p.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
21
+ _.selectAll(".tick").each(function(w, x) {
22
+ var $;
23
+ const y = L.select(this), C = y.select("text"), M = v[x], S = b - M, N = y.append("g").attr("transform", "translate(10, 0)");
24
+ C.attr("x", S), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
25
25
  });
26
26
  }).attr("font-family", "inherit");
27
- }, Hs = (i) => {
28
- const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: u, ticks: g } = r;
29
- if (!o) return null;
30
- e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((p) => {
31
- let _ = D.axisBottom(s);
32
- u ? (h && (_ = _.tickFormat(h)), g && (_ = Array.isArray(g) ? _.ticks(...g) : _.ticks(g)), c && (_ = _.tickValues(c))) : _.ticks(5), p.call(_);
33
- }).call((p) => p.select(".domain").remove()).call((p) => {
34
- let _ = [];
35
- p.selectAll(".tick").each((v) => _.push(v)), i.xTicks = _;
36
- }).call((p) => p.selectAll(".tick line").remove()).call((p) => p.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
37
27
  }, Bs = (i) => {
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
+ if (!o) return null;
30
+ e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((_) => {
31
+ let p = L.axisBottom(s);
32
+ d ? (h && (p = p.tickFormat(h)), g && (p = Array.isArray(g) ? p.ticks(...g) : p.ticks(g)), c && (p = p.tickValues(c))) : p.ticks(5), _.call(p);
33
+ }).call((_) => _.select(".domain").remove()).call((_) => {
34
+ let p = [];
35
+ _.selectAll(".tick").each((v) => p.push(v)), i.xTicks = p;
36
+ }).call((_) => _.selectAll(".tick line").remove()).call((_) => _.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
37
+ }, Is = (i) => {
38
38
  const { svg: e, config: t, y: s, width: n } = i, {
39
39
  margin: a,
40
40
  grid: { horizontalStyle: r }
@@ -49,24 +49,27 @@ const Fs = (i) => {
49
49
  r === "every-line-dashed" && h.attr("stroke-dasharray", "4 4");
50
50
  });
51
51
  }
52
- }, Is = (i) => {
52
+ }, _i = (i) => {
53
53
  const e = Array.from(i.childNodes);
54
54
  for (let t = 0; t < e.length; t++)
55
55
  i.removeChild(e[t]);
56
- }, Rs = (i) => {
57
- const e = "http://www.w3.org/2000/svg", t = document.createElement("div");
58
- t.className = "sc-charts__hovered-circles-tooltip-container", t.style.display = "none";
59
- const s = document.createElement("div");
60
- s.className = "sc-charts__hovered-circles-tooltip";
61
- const n = document.createElement("div");
62
- n.className = "sc-charts__hovered-circles-tooltip-arrow";
63
- const a = document.createElementNS(e, "svg");
64
- a.setAttribute("width", "12"), a.setAttribute("height", "4"), a.setAttribute("viewBox", "0 0 12 4"), a.setAttribute("fill", "none"), a.setAttribute("xmlns", e);
65
- const r = document.createElementNS(e, "path");
66
- return r.setAttribute("d", "M6 4L0 0H12L6 4Z"), a.appendChild(r), n.appendChild(a), t.append(n), t.append(s), i.append(t), {
67
- tooltipContainer: t,
68
- tooltip: s,
69
- tooltipArrow: n
56
+ }, Rs = (i, e = {}) => {
57
+ const t = "http://www.w3.org/2000/svg", { showArrow: s = !0 } = e, n = document.createElement("div");
58
+ n.className = "sc-charts__hovered-circles-tooltip-container", n.style.display = "none";
59
+ const a = document.createElement("div");
60
+ a.className = "sc-charts__hovered-circles-tooltip";
61
+ let r = null;
62
+ if (s) {
63
+ r = document.createElement("div"), r.className = "sc-charts__hovered-circles-tooltip-arrow";
64
+ const o = document.createElementNS(t, "svg");
65
+ o.setAttribute("width", "12"), o.setAttribute("height", "4"), o.setAttribute("viewBox", "0 0 12 4"), o.setAttribute("fill", "none"), o.setAttribute("xmlns", t);
66
+ const c = document.createElementNS(t, "path");
67
+ c.setAttribute("d", "M6 4L0 0H12L6 4Z"), o.appendChild(c), r.appendChild(o), n.append(r);
68
+ }
69
+ return n.append(a), i.append(n), {
70
+ tooltipContainer: n,
71
+ tooltip: a,
72
+ tooltipArrow: r
70
73
  };
71
74
  }, $s = (i, e, {
72
75
  x: t,
@@ -89,61 +92,71 @@ function Os(i, e, t, s) {
89
92
  const n = i.width / 2, a = e - n, r = e + n;
90
93
  return a < t ? t : r > s ? s - i.width : e - n;
91
94
  }
92
- const Zt = (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) => {
95
+ 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
96
  const { svg: e, config: t, x: s, y: n, height: a, data: r, wrapperNode: o } = i, {
94
97
  margin: c,
95
- grid: { verticalStyle: h, tooltipNode: u, hoverCirclesRadius: g, hoverCirclesAdditionalArea: p }
98
+ grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea: _ }
96
99
  } = t;
97
- if (h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
100
+ if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
98
101
  const b = e.append("line").attr("x1", s(v)).attr("x2", s(v)).attr("y1", c.top).attr("y2", a - c.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
99
102
  h === "every-line-dashed" && b.attr("stroke-dasharray", "4 4");
100
103
  }), h === "hovered-circles")) {
101
- const _ = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
102
- Zt(e, { x1: v, x2: b, y1: _, y2: _ });
103
- const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o);
104
- r.forEach((C, S) => {
105
- const F = s(C.date), H = n(C.value), O = r[S - 1], P = S > 0 && O && C.value === O.value;
106
- P || Zt(e, { x1: F, x2: F, y1: H, y2: _ });
107
- const j = $s(e, P, {
108
- x: F,
109
- y: _,
104
+ const p = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
105
+ qt(e, { x1: v, x2: b, y1: p, y2: p });
106
+ const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o, {
107
+ showArrow: !d
108
+ }), C = (S) => {
109
+ if (!d) return;
110
+ _i(x), w.style.display = "block", x.append(d({ date: S.date, value: S.value }));
111
+ const N = x.getBoundingClientRect(), $ = Os(
112
+ N,
113
+ s(S.date),
114
+ i.config.margin.left - i.config.grid.tooltipArrowSize,
115
+ i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
116
+ );
117
+ $ !== null && (x.style.left = $ + "px"), y && (y.style.left = s(S.date) + "px");
118
+ }, M = () => {
119
+ w.style.display = "none";
120
+ };
121
+ i.gridHoverTooltip = d ? {
122
+ show: (S) => C(S),
123
+ hide: M
124
+ } : null, r.forEach((S, N) => {
125
+ const $ = s(S.date), z = n(S.value), V = r[N - 1], Y = N > 0 && V && S.value === V.value;
126
+ Y || qt(e, { x1: $, x2: $, y1: z, y2: p });
127
+ const re = $s(e, Y, {
128
+ x: $,
129
+ y: p,
110
130
  r: g,
111
- hr: p
131
+ hr: _
112
132
  });
113
- u && j.on("mouseover", function() {
114
- Is(x), w.style.display = "block", x.append(u({ date: C.date, value: P ? null : C.value }));
115
- const U = x.getBoundingClientRect(), re = Os(
116
- U,
117
- s(C.date),
118
- i.config.margin.left - i.config.grid.tooltipArrowSize,
119
- i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
120
- );
121
- x.style.left = re + "px", y.style.left = s(C.date) + "px";
133
+ d && re.on("mouseover", function() {
134
+ C({ date: S.date, value: Y ? null : S.value });
122
135
  }).on("mouseout", function() {
123
- w.style.display = "none";
136
+ M();
124
137
  });
125
138
  });
126
139
  }
127
140
  }, zs = (i) => {
128
- Bs(i), Ps(i);
141
+ Is(i), Ps(i);
129
142
  }, Vs = (i) => {
130
143
  const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
131
- Hs(i), Fs(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);
132
- }, Ee = (i, e, t) => {
144
+ 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);
145
+ }, Le = (i, e, t) => {
133
146
  let s = i.select(`#${e}`);
134
147
  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 }) => {
135
148
  s.append("stop").attr("offset", n).attr("stop-color", a);
136
149
  }), s;
137
- }, pe = (i) => {
138
- const e = D.select(i).select("defs");
139
- return e.empty() ? D.select(i).append("defs") : e;
140
- }, _i = (i) => {
150
+ }, _e = (i) => {
151
+ const e = L.select(i).select("defs");
152
+ return e.empty() ? L.select(i).append("defs") : e;
153
+ }, St = (i) => {
141
154
  const {
142
155
  y: e,
143
156
  config: { margin: t }
144
157
  } = i, s = e.range()[0] - e(0), n = e.range()[0] - s >= 0 ? e.range()[0] - s : 0, a = s + t.bottom >= 0 ? s + t.bottom : 0;
145
158
  return { x: 0, y: n, width: "100%", height: a };
146
- }, qt = (i, e) => ({
159
+ }, Jt = (i, e) => ({
147
160
  ...i,
148
161
  ...e,
149
162
  margin: {
@@ -178,8 +191,8 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
178
191
  ...i.selection,
179
192
  ...e == null ? void 0 : e.selection
180
193
  }
181
- }), Jt = (i, e = {}) => {
182
- const t = i.node(), s = pe(t), n = (o, c) => Ee(s, o, {
194
+ }), Qt = (i, e = {}) => {
195
+ const t = i.node(), s = _e(t), n = (o, c) => Le(s, o, {
183
196
  x1: "0%",
184
197
  y1: "0%",
185
198
  x2: "0%",
@@ -197,14 +210,14 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
197
210
  className(o, c) {
198
211
  o === "remove" ? r.classed(`${a}${c}`, !1) : r.classed(`${a}${c}`, !0);
199
212
  },
200
- update({ x1: o, x2: c, y1: h, y2: u, hidden: g }) {
201
- o !== void 0 && r.attr("x1", o), c !== void 0 && r.attr("x2", c), h !== void 0 && r.attr("y1", h), u !== void 0 && r.attr("y2", u), g !== void 0 && r.style("display", g ? "none" : "block");
213
+ update({ x1: o, x2: c, y1: h, y2: d, hidden: g }) {
214
+ o !== void 0 && r.attr("x1", o), c !== void 0 && r.attr("x2", c), h !== void 0 && r.attr("y1", h), d !== void 0 && r.attr("y2", d), g !== void 0 && r.style("display", g ? "none" : "block");
202
215
  },
203
216
  destroy() {
204
217
  r.remove();
205
218
  }
206
219
  };
207
- }, _t = (i, e = {}) => {
220
+ }, pt = (i, e = {}) => {
208
221
  const t = i.append("circle").attr("r", e.radius || 4).style("display", e.hidden ? "none" : "block"), s = e.className || "";
209
222
  return s && t.classed(s, !0), {
210
223
  className(n, a) {
@@ -218,8 +231,8 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
218
231
  }
219
232
  };
220
233
  }, Ys = (i, e = {}) => {
221
- const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = pe(n);
222
- return ((o, c) => Ee(a, o, {
234
+ const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = _e(n);
235
+ return ((o, c) => Le(a, o, {
223
236
  x1: "0%",
224
237
  y1: "0%",
225
238
  x2: "0%",
@@ -234,15 +247,15 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
234
247
  className(o, c) {
235
248
  o === "remove" ? s.classed(`${t}${c}`, !1) : s.classed(`${t}${c}`, !0);
236
249
  },
237
- update({ x1: o, x2: c, y1: h, y2: u, hidden: g }) {
238
- o !== void 0 && s.attr("x1", o), c !== void 0 && s.attr("x2", c), h !== void 0 && s.attr("y1", h), u !== void 0 && s.attr("y2", u), g !== void 0 && s.style("display", g ? "none" : "block");
250
+ update({ x1: o, x2: c, y1: h, y2: d, hidden: g }) {
251
+ o !== void 0 && s.attr("x1", o), c !== void 0 && s.attr("x2", c), h !== void 0 && s.attr("y1", h), d !== void 0 && s.attr("y2", d), g !== void 0 && s.style("display", g ? "none" : "block");
239
252
  },
240
253
  destroy() {
241
254
  s.remove();
242
255
  }
243
256
  };
244
- }, fe = "sc-charts__range-tooltip", Qt = D.timeFormat("%b %e, %I:%M %p"), Ws = (i) => {
245
- const e = D.format(",.2f");
257
+ }, fe = "sc-charts__range-tooltip", Kt = L.timeFormat("%b %e, %I:%M %p"), Ws = (i) => {
258
+ const e = L.format(",.2f");
246
259
  return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
247
260
  };
248
261
  function js(i) {
@@ -274,19 +287,19 @@ const Xs = (i) => {
274
287
  },
275
288
  update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
276
289
  if (n && a && h && r !== void 0) {
277
- const u = a.value - n.value, { sumFormatter: g, timeFormatter: p } = i.config.selection, _ = (i.x(a.date) + i.x(n.date)) / 2, v = i.x(h.date) < _ ? "left" : "right";
290
+ const d = a.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(a.date) + i.x(n.date)) / 2, v = i.x(h.date) < p ? "left" : "right";
278
291
  let b = "", w = "";
279
292
  if (g)
280
293
  b = g({ left: n.value, right: a.value, direction: v });
281
294
  else {
282
- const x = (u / Math.abs(n.value) * 100).toFixed(2);
283
- b = `${Ws(u)} (${x}%)`;
295
+ const x = (d / Math.abs(n.value) * 100).toFixed(2);
296
+ b = `${Ws(d)} (${x}%)`;
284
297
  }
285
- p ? w = p({ left: n.date, right: a.date, direction: v }) : w = `${Qt(n.date)} to ${Qt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
286
- const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), S = i.x(a.date);
287
- let H = (C + S) / 2 - x.width / 2;
288
- const O = 0, P = y.width - x.width;
289
- H < O && (H = O), H > P && (H = P), e.style.left = `${H}px`, e.style.top = `${o}px`;
298
+ _ ? w = _({ left: n.date, right: a.date, direction: v }) : w = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
299
+ const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), M = i.x(a.date);
300
+ let N = (C + M) / 2 - x.width / 2;
301
+ const $ = 0, z = y.width - x.width;
302
+ N < $ && (N = $), N > z && (N = z), e.style.left = `${N}px`, e.style.top = `${o}px`;
290
303
  });
291
304
  }
292
305
  c !== void 0 && (e.style.display = c ? "none" : "block");
@@ -295,40 +308,46 @@ const Xs = (i) => {
295
308
  e.remove();
296
309
  }
297
310
  };
298
- }, De = "sc-charts__hover-tooltip", pt = 16, Us = D.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
299
- const e = D.format(",.2f");
311
+ }, ke = "sc-charts__hover-tooltip", _t = 16, Us = L.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
312
+ const e = L.format(",.2f");
300
313
  return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
301
314
  };
302
315
  function Zs(i) {
303
316
  const e = document.createElement("div");
304
- e.className = `${De}-container`, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.appendChild(e);
317
+ e.className = `${ke}-container`, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.appendChild(e);
305
318
  const t = document.createElement("div");
306
- t.className = `${De}-sum`, e.appendChild(t);
319
+ t.className = `${ke}-sum`;
307
320
  const s = document.createElement("div");
308
- return s.className = `${De}-time`, e.appendChild(s), { wrapper: e, sumNode: t, timeNode: s };
321
+ return s.className = `${ke}-time`, { wrapper: e, sumNode: t, timeNode: s };
309
322
  }
310
323
  function qs(i, e, t) {
311
- return i ? e + pt + i.width < t ? e + pt : e - pt - i.width : null;
324
+ return i ? e + _t + i.width < t ? e + _t : e - _t - i.width : null;
312
325
  }
313
326
  const Js = (i) => {
314
- const { wrapper: e, sumNode: t, timeNode: s } = Zs(i.wrapperNode);
327
+ const { wrapper: e, sumNode: t, timeNode: s } = Zs(i.wrapperNode), n = () => {
328
+ t.parentNode || (e.appendChild(t), e.appendChild(s));
329
+ };
315
330
  return {
316
- className(n, a) {
317
- n === "remove" ? e.classList.remove(`${De}${a}`) : e.classList.add(`${De}${a}`);
331
+ className(a, r) {
332
+ a === "remove" ? e.classList.remove(`${ke}${r}`) : e.classList.add(`${ke}${r}`);
318
333
  },
319
- update({ hidden: n, dataItem: a }) {
320
- if (a) {
321
- const { sumFormatter: r, timeFormatter: o } = i.config.hover;
322
- t.textContent = r ? r(a.value) : Gs(a.value), s.textContent = o ? o(a.date) : Us(a.date), requestAnimationFrame(() => {
323
- const c = e.getBoundingClientRect(), h = qs(
324
- c,
325
- i.x(a.date),
334
+ update({ hidden: a, dataItem: r }) {
335
+ if (!i.config.hover.showDefaultTooltip) {
336
+ e.style.display = "none";
337
+ return;
338
+ }
339
+ if (r) {
340
+ const { sumFormatter: o, timeFormatter: c, tooltipNode: h } = i.config.hover;
341
+ h ? (_i(e), e.appendChild(h({ date: r.date, value: r.value }))) : (n(), t.textContent = o ? o(r.value) : Gs(r.value), s.textContent = c ? c(r.date) : Us(r.date)), requestAnimationFrame(() => {
342
+ const d = e.getBoundingClientRect(), g = qs(
343
+ d,
344
+ i.x(r.date),
326
345
  i.width - i.config.margin.right
327
346
  );
328
- h && (e.style.left = h + "px");
347
+ g && (e.style.left = g + "px");
329
348
  });
330
349
  }
331
- n !== void 0 && (e.style.display = n ? "none" : "block");
350
+ a !== void 0 && (e.style.display = a ? "none" : "block");
332
351
  },
333
352
  destroy() {
334
353
  e.remove();
@@ -353,8 +372,11 @@ const Js = (i) => {
353
372
  range: "1m",
354
373
  transitionDuration: 150,
355
374
  transitionName: "default",
375
+ highlightRange: !0,
376
+ showDefaultTooltip: !0,
356
377
  sumFormatter: null,
357
- timeFormatter: null
378
+ timeFormatter: null,
379
+ tooltipNode: null
358
380
  },
359
381
  selection: {
360
382
  enable: !0,
@@ -385,9 +407,9 @@ const Js = (i) => {
385
407
  },
386
408
  enableBelowZeroLine: !1,
387
409
  curveTension: 1
388
- }, tt = (i) => D.curveCardinal.tension(i.config.curveTension), Ks = (i) => {
389
- const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = pe(r);
390
- Ee(o, "main-line-area-gradient", {
410
+ }, tt = () => L.curveMonotoneX, Ks = (i) => {
411
+ const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = _e(r);
412
+ Le(o, "main-line-area-gradient", {
391
413
  x1: "0%",
392
414
  y1: "0%",
393
415
  x2: "0%",
@@ -397,15 +419,15 @@ const Js = (i) => {
397
419
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
398
420
  ]
399
421
  });
400
- const h = D.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(tt(i)), u = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", u).classed(`${u}_hidden`, !a.hasMainLineArea);
422
+ const h = L.area().x((_) => s(_.date)).y0(n.range()[0]).y1((_) => n(_.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);
401
423
  return {
402
- className(p, _) {
403
- p === "remove" ? g.classed(`${u}${_}`, !1) : g.classed(`${u}${_}`, !0);
424
+ className(_, p) {
425
+ _ === "remove" ? g.classed(`${d}${p}`, !1) : g.classed(`${d}${p}`, !0);
404
426
  },
405
- update({ data: p, hidden: _ }) {
406
- if (p !== void 0 && g.datum(p).attr("d", h), _ !== void 0) {
427
+ update({ data: _, hidden: p }) {
428
+ if (_ !== void 0 && g.datum(_).attr("d", h), p !== void 0) {
407
429
  if (!a.hasMainLineArea) return null;
408
- g.classed(`${u}_hidden`, _);
430
+ g.classed(`${d}_hidden`, p);
409
431
  }
410
432
  },
411
433
  destroy() {
@@ -413,8 +435,8 @@ const Js = (i) => {
413
435
  }
414
436
  };
415
437
  }, en = (i, e = {}) => {
416
- const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e, u = s.node(), g = pe(u), p = "range-line-area-gradient";
417
- Ee(g, p + "_up", {
438
+ 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 = _e(d), _ = "range-line-area-gradient";
439
+ Le(g, _ + "_up", {
418
440
  x1: "0%",
419
441
  y1: "0%",
420
442
  x2: "0%",
@@ -423,7 +445,7 @@ const Js = (i) => {
423
445
  { offset: "0%", stopColor: "var(--sc-color-selection-up)" },
424
446
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
425
447
  ]
426
- }), Ee(g, p + "_down", {
448
+ }), Le(g, _ + "_down", {
427
449
  x1: "0%",
428
450
  y1: "0%",
429
451
  x2: "0%",
@@ -433,39 +455,39 @@ const Js = (i) => {
433
455
  { offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
434
456
  ]
435
457
  });
436
- const _ = D.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt(i)), 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})`);
458
+ const p = 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", p).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
437
459
  return {
438
460
  className(y, C) {
439
461
  y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
440
462
  },
441
- update({ data: y, hidden: C, clip: S }) {
442
- 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);
463
+ update({ data: y, hidden: C, clip: M }) {
464
+ y !== void 0 && x.datum(y).attr("d", p), 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);
443
465
  },
444
466
  destroy() {
445
467
  x.remove();
446
468
  }
447
469
  };
448
470
  }, vt = (i, e) => {
449
- const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, u = t.node(), g = pe(u), p = D.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt(i)), _ = `${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(#${_})`);
471
+ const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = _e(d), _ = L.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), p = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", p).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", _).attr("id", c).attr("clip-path", `url(#${p})`);
450
472
  return {
451
473
  className(x, y) {
452
474
  x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
453
475
  },
454
476
  update({ data: x, clip: y, hidden: C }) {
455
- x !== void 0 && w.datum(x).attr("d", p), C !== void 0 && w.classed(`${o}_hidden`, C), y !== void 0 && b.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height);
477
+ x !== void 0 && w.datum(x).attr("d", _), C !== void 0 && w.classed(`${o}_hidden`, C), y !== void 0 && b.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height);
456
478
  },
457
479
  destroy() {
458
480
  w.remove();
459
481
  }
460
482
  };
461
483
  }, tn = (i, e) => {
462
- const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: u } = e, g = t.node(), p = pe(g), _ = D.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt(i)), v = `${r}-clip-${c}`, w = p.append("clipPath").attr("id", v).append("rect").attr("x", (u == null ? void 0 : u.x) || 0).attr("y", (u == null ? void 0 : u.y) || 0).attr("width", (u == null ? void 0 : u.width) || "100%").attr("height", (u == null ? void 0 : u.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", _).attr("id", h).attr("clip-path", `url(#${v})`);
484
+ const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), _ = _e(g), p = L.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = _.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", p).attr("id", h).attr("clip-path", `url(#${v})`);
463
485
  return {
464
486
  className(y, C) {
465
487
  y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
466
488
  },
467
- update({ data: y, clip: C, hidden: S }) {
468
- 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(D.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
489
+ update({ data: y, clip: C, hidden: M }) {
490
+ y !== void 0 && x.datum(y).attr("d", p), 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(L.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
469
491
  },
470
492
  destroy() {
471
493
  x.remove();
@@ -479,13 +501,13 @@ const Js = (i) => {
479
501
  const { svg: t, data: s, x: n, y: a } = i, { baseClassName: r } = e, o = t.append("g").classed(r, !0), c = o.append("circle").attr("r", 5).classed(`${r}-circle`, !0), h = o.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${r}-label`, !0);
480
502
  return ((g) => {
481
503
  if (!g || g.length === 0) return;
482
- const p = g[g.length - 1], _ = n(p.date), v = a(p.value);
483
- c.attr("cx", _).attr("cy", v);
504
+ const _ = g[g.length - 1], p = n(_.date), v = a(_.value);
505
+ c.attr("cx", p).attr("cy", v);
484
506
  const b = i.config.extremePointFormatter || sn;
485
- h.attr("x", _).attr("y", v).text(b(p.value));
507
+ h.attr("x", p).attr("y", v).text(b(_.value));
486
508
  })(s), {
487
- className(g, p) {
488
- g === "remove" ? o.classed(`${r}${p}`, !1) : o.classed(`${r}${p}`, !0);
509
+ className(g, _) {
510
+ g === "remove" ? o.classed(`${r}${_}`, !1) : o.classed(`${r}${_}`, !0);
489
511
  },
490
512
  update({ hidden: g }) {
491
513
  g !== void 0 && o.classed(`${r}_hidden`, g);
@@ -512,33 +534,33 @@ const Js = (i) => {
512
534
  i.config.enableBelowZeroLine && (r = vt(i, {
513
535
  baseClassName: "sc-charts__below-zero-line",
514
536
  id: `${i.chartId}-sc-charts__below-zero-line`,
515
- clip: _i(i)
537
+ clip: St(i)
516
538
  }));
517
- const o = _t(i.svg, {
539
+ const o = pt(i.svg, {
518
540
  className: "sc-charts__hover-circle",
519
541
  hidden: !0
520
- }), c = Jt(i.svg), h = Jt(i.svg), u = vt(i, {
542
+ }), c = Qt(i.svg), h = Qt(i.svg), d = vt(i, {
521
543
  baseClassName: "sc-charts__range-line",
522
544
  id: `${i.chartId}-sc-charts__range-line`,
523
545
  clip: { x: 0, y: 0, width: "0", height: "0" }
524
- }), g = _t(i.svg, {
546
+ }), g = pt(i.svg, {
525
547
  className: "sc-charts__range-circle-left",
526
548
  hidden: !0
527
- }), p = _t(i.svg, {
549
+ }), _ = pt(i.svg, {
528
550
  className: "sc-charts__range-circle-right",
529
551
  hidden: !0
530
- }), _ = Xs(i), v = Js(i), b = en(i);
552
+ }), p = Xs(i), v = Js(i), b = en(i);
531
553
  return {
532
554
  hoverLine: n,
533
555
  hoverCircle: o,
534
556
  rangeBorderLeft: c,
535
557
  rangeBorderRight: h,
536
- rangeLine: u,
558
+ rangeLine: d,
537
559
  rangeLineArea: b,
538
560
  rangeCircleLeft: g,
539
- rangeCircleRight: p,
561
+ rangeCircleRight: _,
540
562
  mainLine: e,
541
- rangeTooltip: _,
563
+ rangeTooltip: p,
542
564
  highlightLine: a,
543
565
  hoverTooltip: v,
544
566
  mainLineArea: t,
@@ -557,22 +579,22 @@ const Js = (i) => {
557
579
  const [, n, a] = s, r = parseInt(n, 10), [o, c] = t.domain();
558
580
  let h = new Date(o);
559
581
  for (; h < c; ) {
560
- let u = new Date(h);
582
+ let d = new Date(h);
561
583
  switch (a) {
562
584
  case "M":
563
- u.setMinutes(u.getMinutes() + r);
585
+ d.setMinutes(d.getMinutes() + r);
564
586
  break;
565
587
  case "h":
566
- u.setHours(u.getHours() + r);
588
+ d.setHours(d.getHours() + r);
567
589
  break;
568
590
  case "d":
569
- u.setDate(u.getDate() + r);
591
+ d.setDate(d.getDate() + r);
570
592
  break;
571
593
  case "w":
572
- u.setDate(u.getDate() + r * 7);
594
+ d.setDate(d.getDate() + r * 7);
573
595
  break;
574
596
  case "m":
575
- u = new Date(h.getFullYear(), h.getMonth() + r, 1);
597
+ d = new Date(h.getFullYear(), h.getMonth() + r, 1);
576
598
  break;
577
599
  default:
578
600
  return {
@@ -582,41 +604,41 @@ const Js = (i) => {
582
604
  height: "100%"
583
605
  };
584
606
  }
585
- if (e >= h && e < u) {
586
- const g = t(h), p = t(u);
607
+ if (e >= h && e < d) {
608
+ const g = t(h), _ = t(d);
587
609
  return {
588
610
  x: g,
589
611
  y: 0,
590
- width: p - g,
612
+ width: _ - g,
591
613
  height: "100%"
592
614
  };
593
615
  }
594
- h = new Date(u);
616
+ h = new Date(d);
595
617
  }
596
618
  if (e.getTime() === c.getTime()) {
597
- let u = new Date(c);
619
+ let d = new Date(c);
598
620
  switch (a) {
599
621
  case "M":
600
- u.setMinutes(u.getMinutes() - r);
622
+ d.setMinutes(d.getMinutes() - r);
601
623
  break;
602
624
  case "h":
603
- u.setHours(u.getHours() - r);
625
+ d.setHours(d.getHours() - r);
604
626
  break;
605
627
  case "d":
606
- u.setDate(u.getDate() - r);
628
+ d.setDate(d.getDate() - r);
607
629
  break;
608
630
  case "w":
609
- u.setDate(u.getDate() - r * 7);
631
+ d.setDate(d.getDate() - r * 7);
610
632
  break;
611
633
  case "m":
612
- u = new Date(c.getFullYear(), c.getMonth() - r, 1);
634
+ d = new Date(c.getFullYear(), c.getMonth() - r, 1);
613
635
  break;
614
636
  }
615
- const g = t(u), p = t(c);
637
+ const g = t(d), _ = t(c);
616
638
  return {
617
639
  x: g,
618
640
  y: 0,
619
- width: p - g,
641
+ width: _ - g,
620
642
  height: "100%"
621
643
  };
622
644
  }
@@ -626,20 +648,20 @@ const Js = (i) => {
626
648
  width: "100%",
627
649
  height: "100%"
628
650
  };
629
- }, Kt = (i, e) => {
630
- var h;
651
+ }, ei = (i, e) => {
652
+ var c, h, d;
631
653
  const {
632
654
  x: t,
633
655
  y: s,
634
656
  elements: n,
635
- config: { margin: a },
636
- height: r
657
+ config: { margin: a, hover: r },
658
+ height: o
637
659
  } = i;
638
- n.hoverLine.update({
660
+ if (n.hoverLine.update({
639
661
  x1: t(e.date),
640
662
  x2: t(e.date),
641
663
  y1: a.top,
642
- y2: r - a.bottom,
664
+ y2: o - a.bottom,
643
665
  hidden: !1
644
666
  }), n.hoverCircle.update({
645
667
  cx: t(e.date),
@@ -648,25 +670,30 @@ const Js = (i) => {
648
670
  }), n.hoverTooltip.update({
649
671
  dataItem: e,
650
672
  hidden: !1
651
- });
652
- const o = rn(i.config.hover.range, e.date, t);
653
- n.highlightLine.update({
654
- clip: o,
655
- hidden: !1
656
- });
657
- const c = s.range()[0] - s(0) + a.bottom;
658
- c >= 0 && ((h = n.belowZeroLine) == null || h.update({
659
- clip: {
660
- ...o,
661
- y: s(0),
662
- height: c
663
- }
664
- })), n.mainLine.className("add", "_muted");
665
- }, ei = (i) => {
666
- var t;
673
+ }), r.highlightRange) {
674
+ const g = rn(r.range, e.date, t);
675
+ n.highlightLine.update({
676
+ clip: g,
677
+ hidden: !1
678
+ });
679
+ const _ = s.range()[0] - s(0) + a.bottom;
680
+ _ >= 0 && ((c = n.belowZeroLine) == null || c.update({
681
+ clip: {
682
+ ...g,
683
+ y: s(0),
684
+ height: _
685
+ }
686
+ })), n.mainLine.className("add", "_muted");
687
+ } else
688
+ n.highlightLine.update({ hidden: !0 }), n.mainLine.className("remove", "_muted"), (h = n.belowZeroLine) == null || h.update({
689
+ clip: St(i)
690
+ });
691
+ (d = i.gridHoverTooltip) == null || d.show({ date: e.date, value: e.value });
692
+ }, ti = (i) => {
693
+ var t, s;
667
694
  const { elements: e } = i;
668
- e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted"), e.hoverTooltip.update({ hidden: !0 }), i.action !== "selection" && ((t = e.belowZeroLine) == null || t.update({
669
- clip: _i(i)
695
+ e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted"), e.hoverTooltip.update({ hidden: !0 }), (t = i.gridHoverTooltip) == null || t.hide(), i.action !== "selection" && ((s = e.belowZeroLine) == null || s.update({
696
+ clip: St(i)
670
697
  }));
671
698
  }, on = (i, e) => {
672
699
  [
@@ -688,7 +715,7 @@ const Js = (i) => {
688
715
  config: { margin: a },
689
716
  height: r,
690
717
  elements: o
691
- } = i, c = s(e.date) < s(t.date) ? e : t, h = s(e.date) >= s(t.date) ? e : t, u = h.value - c.value >= 0, g = s(c.date), p = s(h.date), _ = p - g;
718
+ } = i, c = s(e.date) < s(t.date) ? e : t, h = s(e.date) >= s(t.date) ? e : t, d = h.value - c.value >= 0, g = s(c.date), _ = s(h.date), p = _ - g;
692
719
  o.rangeBorderLeft.update({
693
720
  x1: g,
694
721
  x2: g,
@@ -696,8 +723,8 @@ const Js = (i) => {
696
723
  y2: r - a.bottom,
697
724
  hidden: !1
698
725
  }), o.rangeBorderRight.update({
699
- x1: p,
700
- x2: p,
726
+ x1: _,
727
+ x2: _,
701
728
  y1: a.top,
702
729
  y2: r - a.bottom,
703
730
  hidden: !1
@@ -706,14 +733,14 @@ const Js = (i) => {
706
733
  cy: n(c.value),
707
734
  hidden: !1
708
735
  }), o.rangeCircleRight.update({
709
- cx: p,
736
+ cx: _,
710
737
  cy: n(h.value),
711
738
  hidden: !1
712
739
  }), o.rangeLine.update({
713
740
  clip: {
714
741
  x: g,
715
742
  y: 0,
716
- width: _,
743
+ width: p,
717
744
  height: n.range()[0]
718
745
  },
719
746
  hidden: !1
@@ -721,7 +748,7 @@ const Js = (i) => {
721
748
  clip: {
722
749
  x: g,
723
750
  y: 0,
724
- width: _,
751
+ width: p,
725
752
  height: n.range()[0]
726
753
  },
727
754
  hidden: !1
@@ -729,59 +756,59 @@ const Js = (i) => {
729
756
  rightPoint: h,
730
757
  leftPoint: c,
731
758
  closest: t,
732
- x: g + _ / 2,
759
+ x: g + p / 2,
733
760
  y: 0,
734
761
  hidden: !1
735
762
  }), (v = o.belowZeroLine) == null || v.update({
736
763
  hidden: !0
737
- }), o.mainLineArea.update({ hidden: !0 }), on(o, u), o.mainLine.className("add", "_selected-muted");
738
- }, ti = (i) => {
764
+ }), o.mainLineArea.update({ hidden: !0 }), on(o, d), o.mainLine.className("add", "_selected-muted");
765
+ }, ii = (i) => {
739
766
  var t;
740
767
  const { elements: e } = i;
741
768
  e.rangeLine.update({ hidden: !0 }), e.rangeLineArea.update({ hidden: !0 }), e.rangeBorderLeft.update({ hidden: !0 }), e.rangeBorderRight.update({ hidden: !0 }), e.rangeCircleLeft.update({ hidden: !0 }), e.rangeCircleRight.update({ hidden: !0 }), e.rangeTooltip.update({ hidden: !0 }), e.mainLine.className("remove", "_selected-muted"), e.mainLineArea.update({ hidden: !1 }), (t = e.belowZeroLine) == null || t.update({ hidden: !1 });
742
769
  }, cn = (i) => {
743
770
  const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
744
- let u = null, g = !1;
745
- const p = (v) => t.reduce(
771
+ let d = null, g = !1;
772
+ const _ = (v) => t.reduce(
746
773
  (b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
747
774
  );
748
775
  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) {
749
- const [b] = D.pointer(v, this), w = p(b);
750
- !g && c.enable ? (i.action = "hover", Kt(i, w)) : (i.action = g ? "selection" : "none", ei(i)), u && h.enable && (i.action = "selection", ln(i, u, w));
776
+ const [b] = L.pointer(v, this), w = _(b);
777
+ !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));
751
778
  }).on("mouseleave", () => {
752
- i.action = "none", g = !1, u = null, ei(i), ti(i);
779
+ i.action = "none", g = !1, d = null, ti(i), ii(i);
753
780
  }).on("mousedown", function(v) {
754
781
  if (h.enable) {
755
782
  g = !0, i.action = "selection";
756
- const [b] = D.pointer(v, this);
757
- u = p(b);
783
+ const [b] = L.pointer(v, this);
784
+ d = _(b);
758
785
  }
759
786
  }).on("mouseup", function(v) {
760
- const [b] = D.pointer(v, this), w = p(b);
761
- g = !1, u = null, i.action = "hover", h.enable && ti(i), c.enable && Kt(i, w);
787
+ const [b] = L.pointer(v, this), w = _(b);
788
+ g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
762
789
  });
763
790
  }, hn = (i, e, t) => {
764
- const { margin: s } = e, n = D.scaleTime(), a = D.extent(i, (r) => new Date(r.date));
791
+ const { margin: s } = e, n = L.scaleTime(), a = L.extent(i, (r) => new Date(r.date));
765
792
  return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([s.left, t - s.right]);
766
793
  }, dn = (i, e, t) => {
767
- const { margin: s } = e, n = D.max(i, (r) => r.value) ?? 0, a = D.min(i, (r) => r.value) ?? 0;
768
- return D.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
769
- }, _r = (i, e) => {
770
- const t = D.select(i);
794
+ const { margin: s } = e, n = L.max(i, (r) => r.value) ?? 0, a = L.min(i, (r) => r.value) ?? 0;
795
+ return L.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
796
+ }, pr = (i, e) => {
797
+ const t = L.select(i);
771
798
  if (t.empty())
772
799
  return console.error(`Element with selector ${i} not found!`), null;
773
800
  if (!e.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.chartId))
774
801
  return console.error(`chartId is required and must be a valid id
775
802
  (only letters, numbers or underscores. The first character must be a letter)`), null;
776
803
  const s = t.append("div"), n = s.append("svg"), a = t.node();
777
- let r = a.getBoundingClientRect(), o = r.width, c = r.height, h = qt({ ...Qs }, e.config), u = e.data;
804
+ let r = a.getBoundingClientRect(), o = r.width, c = r.height, h = Jt({ ...Qs }, e.config), d = e.data;
778
805
  const g = () => {
779
- r = a.getBoundingClientRect(), o = r.width, c = r.height, p({ data: u, config: h });
806
+ r = a.getBoundingClientRect(), o = r.width, c = r.height, _({ data: d, config: h });
780
807
  };
781
808
  window.addEventListener("resize", g);
782
- const p = (_, v = !1) => {
783
- v && _.config && (h = qt(h, _.config)), v && _.data && (u = _.data);
784
- const b = u.map((S) => ({ date: new Date(S.date), value: S.value })).sort((S, F) => S.date.getTime() - F.date.getTime()), w = hn(b, h, o), x = dn(b, h, c);
809
+ const _ = (p, v = !1) => {
810
+ v && p.config && (h = Jt(h, p.config)), v && p.data && (d = p.data);
811
+ const b = d.map((M) => ({ date: new Date(M.date), value: M.value })).sort((M, S) => M.date.getTime() - S.date.getTime()), w = hn(b, h, o), x = dn(b, h, c);
785
812
  s.attr("class", `sc-charts sc-charts__${h.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${o} ${c}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
786
813
  const y = {
787
814
  chartId: e.chartId,
@@ -793,7 +820,8 @@ const Js = (i) => {
793
820
  config: h,
794
821
  action: "none",
795
822
  width: o,
796
- height: c
823
+ height: c,
824
+ gridHoverTooltip: null
797
825
  };
798
826
  Vs(y);
799
827
  const C = {
@@ -802,8 +830,8 @@ const Js = (i) => {
802
830
  };
803
831
  cn(C);
804
832
  };
805
- return p(e), {
806
- update: (_) => p(_, !0),
833
+ return _(e), {
834
+ update: (p) => _(p, !0),
807
835
  destroy: () => {
808
836
  window.removeEventListener("resize", g), n.remove();
809
837
  }
@@ -813,409 +841,409 @@ var Ze = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
813
841
  function un(i) {
814
842
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
815
843
  }
816
- var Te = { exports: {} };
817
- Te.exports;
818
- var ii;
844
+ var Se = { exports: {} };
845
+ Se.exports;
846
+ var si;
819
847
  function fn() {
820
- return ii || (ii = 1, function(i, e) {
821
- var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", u = "[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]", F = "[object Set]", H = "[object String]", O = "[object Undefined]", P = "[object WeakMap]", j = "[object ArrayBuffer]", U = "[object DataView]", re = "[object Float32Array]", z = "[object Float64Array]", X = "[object Int8Array]", G = "[object Int16Array]", Fe = "[object Int32Array]", st = "[object Uint8Array]", oe = "[object Uint8ClampedArray]", ve = "[object Uint16Array]", be = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, L = {};
822
- L[re] = L[z] = L[X] = L[G] = L[Fe] = L[st] = L[oe] = L[ve] = L[be] = !0, L[o] = L[c] = L[j] = L[u] = L[U] = L[g] = L[p] = L[_] = L[b] = L[w] = L[y] = L[S] = L[F] = L[H] = L[P] = !1;
823
- var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, $ = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, Z = ee && !0 && i && !i.nodeType && i, q = Z && Z.exports === ee, ge = q && Re.process, ye = function() {
848
+ return si || (si = 1, function(i, e) {
849
+ 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]", _ = "[object Error]", p = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", M = "[object RegExp]", S = "[object Set]", N = "[object String]", $ = "[object Undefined]", z = "[object WeakMap]", V = "[object ArrayBuffer]", Y = "[object DataView]", re = "[object Float32Array]", P = "[object Float64Array]", U = "[object Int8Array]", G = "[object Int16Array]", Fe = "[object Int32Array]", st = "[object Uint8Array]", oe = "[object Uint8ClampedArray]", ve = "[object Uint16Array]", be = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
850
+ F[re] = F[P] = F[U] = F[G] = F[Fe] = F[st] = F[oe] = F[ve] = F[be] = !0, F[o] = F[c] = F[V] = F[d] = F[Y] = F[g] = F[_] = F[p] = F[b] = F[w] = F[y] = F[M] = F[S] = F[N] = F[z] = !1;
851
+ 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, Z = ee && !0 && i && !i.nodeType && i, q = Z && Z.exports === ee, ge = q && Re.process, ye = function() {
824
852
  try {
825
853
  var l = Z && Z.require && Z.require("util").types;
826
854
  return l || ge && ge.binding && ge.binding("util");
827
855
  } catch {
828
856
  }
829
857
  }(), we = ye && ye.isTypedArray;
830
- function Oe(l, d, m) {
858
+ function Oe(l, u, m) {
831
859
  switch (m.length) {
832
860
  case 0:
833
- return l.call(d);
861
+ return l.call(u);
834
862
  case 1:
835
- return l.call(d, m[0]);
863
+ return l.call(u, m[0]);
836
864
  case 2:
837
- return l.call(d, m[0], m[1]);
865
+ return l.call(u, m[0], m[1]);
838
866
  case 3:
839
- return l.call(d, m[0], m[1], m[2]);
867
+ return l.call(u, m[0], m[1], m[2]);
840
868
  }
841
- return l.apply(d, m);
869
+ return l.apply(u, m);
842
870
  }
843
- function Pe(l, d) {
871
+ function Pe(l, u) {
844
872
  for (var m = -1, A = Array(l); ++m < l; )
845
- A[m] = d(m);
873
+ A[m] = u(m);
846
874
  return A;
847
875
  }
848
876
  function le(l) {
849
- return function(d) {
850
- return l(d);
877
+ return function(u) {
878
+ return l(u);
851
879
  };
852
880
  }
853
- function ce(l, d) {
854
- return l == null ? void 0 : l[d];
881
+ function ce(l, u) {
882
+ return l == null ? void 0 : l[u];
855
883
  }
856
- function nt(l, d) {
884
+ function nt(l, u) {
857
885
  return function(m) {
858
- return l(d(m));
886
+ return l(u(m));
859
887
  };
860
888
  }
861
- var xe = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at = $["__core-js_shared__"], Ve = Ai.toString, ne = ze.hasOwnProperty, Lt = function() {
889
+ var xe = Array.prototype, Ti = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Ti.toString, ne = ze.hasOwnProperty, Nt = function() {
862
890
  var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
863
891
  return l ? "Symbol(src)_1." + l : "";
864
- }(), Nt = ze.toString, Mi = Ve.call(Object), Si = RegExp(
892
+ }(), Ft = ze.toString, Mi = Ve.call(Object), Si = RegExp(
865
893
  "^" + Ve.call(ne).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
866
- ), Ye = q ? $.Buffer : void 0, Ft = $.Symbol, Ht = $.Uint8Array;
894
+ ), Ye = q ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
867
895
  Ye && Ye.allocUnsafe;
868
- var Bt = nt(Object.getPrototypeOf, Object), It = Object.create, Ti = ze.propertyIsEnumerable, ki = xe.splice, he = Ft ? Ft.toStringTag : void 0, We = function() {
896
+ var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = xe.splice, he = Ht ? Ht.toStringTag : void 0, We = function() {
869
897
  try {
870
898
  var l = lt(Object, "defineProperty");
871
899
  return l({}, "", {}), l;
872
900
  } catch {
873
901
  }
874
- }(), Di = Ye ? Ye.isBuffer : void 0, Rt = Math.max, Ei = Date.now, $t = lt($, "Map"), Ce = lt(Object, "create"), Li = /* @__PURE__ */ function() {
902
+ }(), Li = Ye ? Ye.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(O, "Map"), Ce = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
875
903
  function l() {
876
904
  }
877
- return function(d) {
878
- if (!ue(d))
905
+ return function(u) {
906
+ if (!ue(u))
879
907
  return {};
880
- if (It)
881
- return It(d);
882
- l.prototype = d;
908
+ if (Rt)
909
+ return Rt(u);
910
+ l.prototype = u;
883
911
  var m = new l();
884
912
  return l.prototype = void 0, m;
885
913
  };
886
914
  }();
887
915
  function de(l) {
888
- var d = -1, m = l == null ? 0 : l.length;
889
- for (this.clear(); ++d < m; ) {
890
- var A = l[d];
916
+ var u = -1, m = l == null ? 0 : l.length;
917
+ for (this.clear(); ++u < m; ) {
918
+ var A = l[u];
891
919
  this.set(A[0], A[1]);
892
920
  }
893
921
  }
894
- function Ni() {
922
+ function Fi() {
895
923
  this.__data__ = Ce ? Ce(null) : {}, this.size = 0;
896
924
  }
897
- function Fi(l) {
898
- var d = this.has(l) && delete this.__data__[l];
899
- return this.size -= d ? 1 : 0, d;
900
- }
901
925
  function Hi(l) {
902
- var d = this.__data__;
926
+ var u = this.has(l) && delete this.__data__[l];
927
+ return this.size -= u ? 1 : 0, u;
928
+ }
929
+ function Bi(l) {
930
+ var u = this.__data__;
903
931
  if (Ce) {
904
- var m = d[l];
932
+ var m = u[l];
905
933
  return m === s ? void 0 : m;
906
934
  }
907
- return ne.call(d, l) ? d[l] : void 0;
935
+ return ne.call(u, l) ? u[l] : void 0;
908
936
  }
909
- function Bi(l) {
910
- var d = this.__data__;
911
- return Ce ? d[l] !== void 0 : ne.call(d, l);
937
+ function Ii(l) {
938
+ var u = this.__data__;
939
+ return Ce ? u[l] !== void 0 : ne.call(u, l);
912
940
  }
913
- function Ii(l, d) {
941
+ function Ri(l, u) {
914
942
  var m = this.__data__;
915
- return this.size += this.has(l) ? 0 : 1, m[l] = Ce && d === void 0 ? s : d, this;
943
+ return this.size += this.has(l) ? 0 : 1, m[l] = Ce && u === void 0 ? s : u, this;
916
944
  }
917
- de.prototype.clear = Ni, de.prototype.delete = Fi, de.prototype.get = Hi, de.prototype.has = Bi, de.prototype.set = Ii;
945
+ de.prototype.clear = Fi, de.prototype.delete = Hi, de.prototype.get = Bi, de.prototype.has = Ii, de.prototype.set = Ri;
918
946
  function te(l) {
919
- var d = -1, m = l == null ? 0 : l.length;
920
- for (this.clear(); ++d < m; ) {
921
- var A = l[d];
947
+ var u = -1, m = l == null ? 0 : l.length;
948
+ for (this.clear(); ++u < m; ) {
949
+ var A = l[u];
922
950
  this.set(A[0], A[1]);
923
951
  }
924
952
  }
925
- function Ri() {
953
+ function $i() {
926
954
  this.__data__ = [], this.size = 0;
927
955
  }
928
- function $i(l) {
929
- var d = this.__data__, m = je(d, l);
956
+ function Oi(l) {
957
+ var u = this.__data__, m = je(u, l);
930
958
  if (m < 0)
931
959
  return !1;
932
- var A = d.length - 1;
933
- return m == A ? d.pop() : ki.call(d, m, 1), --this.size, !0;
934
- }
935
- function Oi(l) {
936
- var d = this.__data__, m = je(d, l);
937
- return m < 0 ? void 0 : d[m][1];
960
+ var A = u.length - 1;
961
+ return m == A ? u.pop() : ki.call(u, m, 1), --this.size, !0;
938
962
  }
939
963
  function Pi(l) {
964
+ var u = this.__data__, m = je(u, l);
965
+ return m < 0 ? void 0 : u[m][1];
966
+ }
967
+ function zi(l) {
940
968
  return je(this.__data__, l) > -1;
941
969
  }
942
- function zi(l, d) {
970
+ function Vi(l, u) {
943
971
  var m = this.__data__, A = je(m, l);
944
- return A < 0 ? (++this.size, m.push([l, d])) : m[A][1] = d, this;
972
+ return A < 0 ? (++this.size, m.push([l, u])) : m[A][1] = u, this;
945
973
  }
946
- te.prototype.clear = Ri, te.prototype.delete = $i, te.prototype.get = Oi, te.prototype.has = Pi, te.prototype.set = zi;
974
+ te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set = Vi;
947
975
  function me(l) {
948
- var d = -1, m = l == null ? 0 : l.length;
949
- for (this.clear(); ++d < m; ) {
950
- var A = l[d];
976
+ var u = -1, m = l == null ? 0 : l.length;
977
+ for (this.clear(); ++u < m; ) {
978
+ var A = l[u];
951
979
  this.set(A[0], A[1]);
952
980
  }
953
981
  }
954
- function Vi() {
982
+ function Yi() {
955
983
  this.size = 0, this.__data__ = {
956
984
  hash: new de(),
957
- map: new ($t || te)(),
985
+ map: new (Ot || te)(),
958
986
  string: new de()
959
987
  };
960
988
  }
961
- function Yi(l) {
962
- var d = Ue(this, l).delete(l);
963
- return this.size -= d ? 1 : 0, d;
964
- }
965
989
  function Wi(l) {
966
- return Ue(this, l).get(l);
990
+ var u = Ue(this, l).delete(l);
991
+ return this.size -= u ? 1 : 0, u;
967
992
  }
968
993
  function ji(l) {
994
+ return Ue(this, l).get(l);
995
+ }
996
+ function Xi(l) {
969
997
  return Ue(this, l).has(l);
970
998
  }
971
- function Xi(l, d) {
999
+ function Ui(l, u) {
972
1000
  var m = Ue(this, l), A = m.size;
973
- return m.set(l, d), this.size += m.size == A ? 0 : 1, this;
1001
+ return m.set(l, u), this.size += m.size == A ? 0 : 1, this;
974
1002
  }
975
- me.prototype.clear = Vi, me.prototype.delete = Yi, me.prototype.get = Wi, me.prototype.has = ji, me.prototype.set = Xi;
976
- function _e(l) {
977
- var d = this.__data__ = new te(l);
978
- this.size = d.size;
1003
+ me.prototype.clear = Yi, me.prototype.delete = Wi, me.prototype.get = ji, me.prototype.has = Xi, me.prototype.set = Ui;
1004
+ function pe(l) {
1005
+ var u = this.__data__ = new te(l);
1006
+ this.size = u.size;
979
1007
  }
980
- function Ui() {
1008
+ function Gi() {
981
1009
  this.__data__ = new te(), this.size = 0;
982
1010
  }
983
- function Gi(l) {
984
- var d = this.__data__, m = d.delete(l);
985
- return this.size = d.size, m;
986
- }
987
1011
  function Zi(l) {
988
- return this.__data__.get(l);
1012
+ var u = this.__data__, m = u.delete(l);
1013
+ return this.size = u.size, m;
989
1014
  }
990
1015
  function qi(l) {
1016
+ return this.__data__.get(l);
1017
+ }
1018
+ function Ji(l) {
991
1019
  return this.__data__.has(l);
992
1020
  }
993
- function Ji(l, d) {
1021
+ function Qi(l, u) {
994
1022
  var m = this.__data__;
995
1023
  if (m instanceof te) {
996
1024
  var A = m.__data__;
997
- if (!$t || A.length < t - 1)
998
- return A.push([l, d]), this.size = ++m.size, this;
1025
+ if (!Ot || A.length < t - 1)
1026
+ return A.push([l, u]), this.size = ++m.size, this;
999
1027
  m = this.__data__ = new me(A);
1000
1028
  }
1001
- return m.set(l, d), this.size = m.size, this;
1029
+ return m.set(l, u), this.size = m.size, this;
1002
1030
  }
1003
- _e.prototype.clear = Ui, _e.prototype.delete = Gi, _e.prototype.get = Zi, _e.prototype.has = qi, _e.prototype.set = Ji;
1004
- function Qi(l, d) {
1005
- var m = dt(l), A = !m && ht(l), T = !m && !A && Yt(l), N = !m && !A && !T && jt(l), B = m || A || T || N, E = B ? Pe(l.length, String) : [], I = E.length;
1031
+ pe.prototype.clear = Gi, pe.prototype.delete = Zi, pe.prototype.get = qi, pe.prototype.has = Ji, pe.prototype.set = Qi;
1032
+ function Ki(l, u) {
1033
+ var m = dt(l), A = !m && ht(l), D = !m && !A && Wt(l), H = !m && !A && !D && Xt(l), B = m || A || D || H, E = B ? Pe(l.length, String) : [], I = E.length;
1006
1034
  for (var J in l)
1007
1035
  B && // Safari 9 has enumerable `arguments.length` in strict mode.
1008
1036
  (J == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1009
- T && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1010
- N && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
1011
- zt(J, I)) || E.push(J);
1037
+ D && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1038
+ H && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
1039
+ Vt(J, I)) || E.push(J);
1012
1040
  return E;
1013
1041
  }
1014
- function rt(l, d, m) {
1015
- (m !== void 0 && !Ge(l[d], m) || m === void 0 && !(d in l)) && ot(l, d, m);
1042
+ function rt(l, u, m) {
1043
+ (m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
1016
1044
  }
1017
- function Ki(l, d, m) {
1018
- var A = l[d];
1019
- (!(ne.call(l, d) && Ge(A, m)) || m === void 0 && !(d in l)) && ot(l, d, m);
1045
+ function es(l, u, m) {
1046
+ var A = l[u];
1047
+ (!(ne.call(l, u) && Ge(A, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
1020
1048
  }
1021
- function je(l, d) {
1049
+ function je(l, u) {
1022
1050
  for (var m = l.length; m--; )
1023
- if (Ge(l[m][0], d))
1051
+ if (Ge(l[m][0], u))
1024
1052
  return m;
1025
1053
  return -1;
1026
1054
  }
1027
- function ot(l, d, m) {
1028
- d == "__proto__" && We ? We(l, d, {
1055
+ function ot(l, u, m) {
1056
+ u == "__proto__" && We ? We(l, u, {
1029
1057
  configurable: !0,
1030
1058
  enumerable: !0,
1031
1059
  value: m,
1032
1060
  writable: !0
1033
- }) : l[d] = m;
1061
+ }) : l[u] = m;
1034
1062
  }
1035
- var es = fs();
1063
+ var ts = gs();
1036
1064
  function Xe(l) {
1037
- return l == null ? l === void 0 ? O : x : he && he in Object(l) ? gs(l) : ys(l);
1065
+ return l == null ? l === void 0 ? $ : x : he && he in Object(l) ? ms(l) : ws(l);
1038
1066
  }
1039
- function Ot(l) {
1067
+ function Pt(l) {
1040
1068
  return Ae(l) && Xe(l) == o;
1041
1069
  }
1042
- function ts(l) {
1043
- if (!ue(l) || vs(l))
1044
- return !1;
1045
- var d = ft(l) ? Si : Be;
1046
- return d.test(As(l));
1047
- }
1048
1070
  function is(l) {
1049
- return Ae(l) && Wt(l.length) && !!L[Xe(l)];
1071
+ if (!ue(l) || bs(l))
1072
+ return !1;
1073
+ var u = ft(l) ? Si : Be;
1074
+ return u.test(Ts(l));
1050
1075
  }
1051
1076
  function ss(l) {
1077
+ return Ae(l) && jt(l.length) && !!F[Xe(l)];
1078
+ }
1079
+ function ns(l) {
1052
1080
  if (!ue(l))
1053
- return bs(l);
1054
- var d = Vt(l), m = [];
1081
+ return ys(l);
1082
+ var u = Yt(l), m = [];
1055
1083
  for (var A in l)
1056
- A == "constructor" && (d || !ne.call(l, A)) || m.push(A);
1084
+ A == "constructor" && (u || !ne.call(l, A)) || m.push(A);
1057
1085
  return m;
1058
1086
  }
1059
- function Pt(l, d, m, A, T) {
1060
- l !== d && es(d, function(N, B) {
1061
- if (T || (T = new _e()), ue(N))
1062
- ns(l, d, B, m, Pt, A, T);
1087
+ function zt(l, u, m, A, D) {
1088
+ l !== u && ts(u, function(H, B) {
1089
+ if (D || (D = new pe()), ue(H))
1090
+ as(l, u, B, m, zt, A, D);
1063
1091
  else {
1064
- var E = A ? A(ct(l, B), N, B + "", l, d, T) : void 0;
1065
- E === void 0 && (E = N), rt(l, B, E);
1092
+ var E = A ? A(ct(l, B), H, B + "", l, u, D) : void 0;
1093
+ E === void 0 && (E = H), rt(l, B, E);
1066
1094
  }
1067
- }, Xt);
1095
+ }, Ut);
1068
1096
  }
1069
- function ns(l, d, m, A, T, N, B) {
1070
- var E = ct(l, m), I = ct(d, m), J = B.get(I);
1097
+ function as(l, u, m, A, D, H, B) {
1098
+ var E = ct(l, m), I = ct(u, m), J = B.get(I);
1071
1099
  if (J) {
1072
1100
  rt(l, m, J);
1073
1101
  return;
1074
1102
  }
1075
- var V = N ? N(E, I, m + "", l, d, B) : void 0, Me = V === void 0;
1076
- if (Me) {
1077
- var gt = dt(I), mt = !gt && Yt(I), Gt = !gt && !mt && jt(I);
1078
- V = I, gt || mt || Gt ? dt(E) ? V = E : Ms(E) ? V = hs(E) : mt ? (Me = !1, V = os(I)) : Gt ? (Me = !1, V = cs(I)) : V = [] : Ss(I) || ht(I) ? (V = E, ht(E) ? V = Ts(E) : (!ue(E) || ft(E)) && (V = ms(I))) : Me = !1;
1103
+ var W = H ? H(E, I, m + "", l, u, B) : void 0, Te = W === void 0;
1104
+ if (Te) {
1105
+ var gt = dt(I), mt = !gt && Wt(I), Zt = !gt && !mt && Xt(I);
1106
+ W = I, gt || mt || Zt ? dt(E) ? W = E : Ms(E) ? W = ds(E) : mt ? (Te = !1, W = ls(I)) : Zt ? (Te = !1, W = hs(I)) : W = [] : Ss(I) || ht(I) ? (W = E, ht(E) ? W = Ds(E) : (!ue(E) || ft(E)) && (W = ps(I))) : Te = !1;
1079
1107
  }
1080
- Me && (B.set(I, V), T(V, I, A, N, B), B.delete(I)), rt(l, m, V);
1108
+ Te && (B.set(I, W), D(W, I, A, H, B), B.delete(I)), rt(l, m, W);
1081
1109
  }
1082
- function as(l, d) {
1083
- return xs(ws(l, d, Ut), l + "");
1110
+ function rs(l, u) {
1111
+ return Cs(xs(l, u, Gt), l + "");
1084
1112
  }
1085
- var rs = We ? function(l, d) {
1113
+ var os = We ? function(l, u) {
1086
1114
  return We(l, "toString", {
1087
1115
  configurable: !0,
1088
1116
  enumerable: !1,
1089
- value: Ds(d),
1117
+ value: Ls(u),
1090
1118
  writable: !0
1091
1119
  });
1092
- } : Ut;
1093
- function os(l, d) {
1120
+ } : Gt;
1121
+ function ls(l, u) {
1094
1122
  return l.slice();
1095
1123
  }
1096
- function ls(l) {
1097
- var d = new l.constructor(l.byteLength);
1098
- return new Ht(d).set(new Ht(l)), d;
1124
+ function cs(l) {
1125
+ var u = new l.constructor(l.byteLength);
1126
+ return new Bt(u).set(new Bt(l)), u;
1099
1127
  }
1100
- function cs(l, d) {
1101
- var m = ls(l.buffer);
1128
+ function hs(l, u) {
1129
+ var m = cs(l.buffer);
1102
1130
  return new l.constructor(m, l.byteOffset, l.length);
1103
1131
  }
1104
- function hs(l, d) {
1132
+ function ds(l, u) {
1105
1133
  var m = -1, A = l.length;
1106
- for (d || (d = Array(A)); ++m < A; )
1107
- d[m] = l[m];
1108
- return d;
1134
+ for (u || (u = Array(A)); ++m < A; )
1135
+ u[m] = l[m];
1136
+ return u;
1109
1137
  }
1110
- function ds(l, d, m, A) {
1111
- var T = !m;
1138
+ function us(l, u, m, A) {
1139
+ var D = !m;
1112
1140
  m || (m = {});
1113
- for (var N = -1, B = d.length; ++N < B; ) {
1114
- var E = d[N], I = void 0;
1115
- I === void 0 && (I = l[E]), T ? ot(m, E, I) : Ki(m, E, I);
1141
+ for (var H = -1, B = u.length; ++H < B; ) {
1142
+ var E = u[H], I = void 0;
1143
+ I === void 0 && (I = l[E]), D ? ot(m, E, I) : es(m, E, I);
1116
1144
  }
1117
1145
  return m;
1118
1146
  }
1119
- function us(l) {
1120
- return as(function(d, m) {
1121
- var A = -1, T = m.length, N = T > 1 ? m[T - 1] : void 0, B = T > 2 ? m[2] : void 0;
1122
- for (N = l.length > 3 && typeof N == "function" ? (T--, N) : void 0, B && _s(m[0], m[1], B) && (N = T < 3 ? void 0 : N, T = 1), d = Object(d); ++A < T; ) {
1147
+ function fs(l) {
1148
+ return rs(function(u, m) {
1149
+ var A = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
1150
+ 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; ) {
1123
1151
  var E = m[A];
1124
- E && l(d, E, A, N);
1152
+ E && l(u, E, A, H);
1125
1153
  }
1126
- return d;
1154
+ return u;
1127
1155
  });
1128
1156
  }
1129
- function fs(l) {
1130
- return function(d, m, A) {
1131
- for (var T = -1, N = Object(d), B = A(d), E = B.length; E--; ) {
1132
- var I = B[++T];
1133
- if (m(N[I], I, N) === !1)
1157
+ function gs(l) {
1158
+ return function(u, m, A) {
1159
+ for (var D = -1, H = Object(u), B = A(u), E = B.length; E--; ) {
1160
+ var I = B[++D];
1161
+ if (m(H[I], I, H) === !1)
1134
1162
  break;
1135
1163
  }
1136
- return d;
1164
+ return u;
1137
1165
  };
1138
1166
  }
1139
- function Ue(l, d) {
1167
+ function Ue(l, u) {
1140
1168
  var m = l.__data__;
1141
- return ps(d) ? m[typeof d == "string" ? "string" : "hash"] : m.map;
1169
+ return vs(u) ? m[typeof u == "string" ? "string" : "hash"] : m.map;
1142
1170
  }
1143
- function lt(l, d) {
1144
- var m = ce(l, d);
1145
- return ts(m) ? m : void 0;
1171
+ function lt(l, u) {
1172
+ var m = ce(l, u);
1173
+ return is(m) ? m : void 0;
1146
1174
  }
1147
- function gs(l) {
1148
- var d = ne.call(l, he), m = l[he];
1175
+ function ms(l) {
1176
+ var u = ne.call(l, he), m = l[he];
1149
1177
  try {
1150
1178
  l[he] = void 0;
1151
1179
  var A = !0;
1152
1180
  } catch {
1153
1181
  }
1154
- var T = Nt.call(l);
1155
- return A && (d ? l[he] = m : delete l[he]), T;
1182
+ var D = Ft.call(l);
1183
+ return A && (u ? l[he] = m : delete l[he]), D;
1156
1184
  }
1157
- function ms(l) {
1158
- return typeof l.constructor == "function" && !Vt(l) ? Li(Bt(l)) : {};
1185
+ function ps(l) {
1186
+ return typeof l.constructor == "function" && !Yt(l) ? Ni(It(l)) : {};
1159
1187
  }
1160
- function zt(l, d) {
1188
+ function Vt(l, u) {
1161
1189
  var m = typeof l;
1162
- return d = d ?? r, !!d && (m == "number" || m != "symbol" && Ie.test(l)) && l > -1 && l % 1 == 0 && l < d;
1190
+ return u = u ?? r, !!u && (m == "number" || m != "symbol" && Ie.test(l)) && l > -1 && l % 1 == 0 && l < u;
1163
1191
  }
1164
- function _s(l, d, m) {
1192
+ function _s(l, u, m) {
1165
1193
  if (!ue(m))
1166
1194
  return !1;
1167
- var A = typeof d;
1168
- return (A == "number" ? ut(m) && zt(d, m.length) : A == "string" && d in m) ? Ge(m[d], l) : !1;
1169
- }
1170
- function ps(l) {
1171
- var d = typeof l;
1172
- return d == "string" || d == "number" || d == "symbol" || d == "boolean" ? l !== "__proto__" : l === null;
1195
+ var A = typeof u;
1196
+ return (A == "number" ? ut(m) && Vt(u, m.length) : A == "string" && u in m) ? Ge(m[u], l) : !1;
1173
1197
  }
1174
1198
  function vs(l) {
1175
- return !!Lt && Lt in l;
1199
+ var u = typeof l;
1200
+ return u == "string" || u == "number" || u == "symbol" || u == "boolean" ? l !== "__proto__" : l === null;
1201
+ }
1202
+ function bs(l) {
1203
+ return !!Nt && Nt in l;
1176
1204
  }
1177
- function Vt(l) {
1178
- var d = l && l.constructor, m = typeof d == "function" && d.prototype || ze;
1205
+ function Yt(l) {
1206
+ var u = l && l.constructor, m = typeof u == "function" && u.prototype || ze;
1179
1207
  return l === m;
1180
1208
  }
1181
- function bs(l) {
1182
- var d = [];
1209
+ function ys(l) {
1210
+ var u = [];
1183
1211
  if (l != null)
1184
1212
  for (var m in Object(l))
1185
- d.push(m);
1186
- return d;
1187
- }
1188
- function ys(l) {
1189
- return Nt.call(l);
1190
- }
1191
- function ws(l, d, m) {
1192
- return d = Rt(d === void 0 ? l.length - 1 : d, 0), function() {
1193
- for (var A = arguments, T = -1, N = Rt(A.length - d, 0), B = Array(N); ++T < N; )
1194
- B[T] = A[d + T];
1195
- T = -1;
1196
- for (var E = Array(d + 1); ++T < d; )
1197
- E[T] = A[T];
1198
- return E[d] = m(B), Oe(l, this, E);
1213
+ u.push(m);
1214
+ return u;
1215
+ }
1216
+ function ws(l) {
1217
+ return Ft.call(l);
1218
+ }
1219
+ function xs(l, u, m) {
1220
+ return u = $t(u === void 0 ? l.length - 1 : u, 0), function() {
1221
+ for (var A = arguments, D = -1, H = $t(A.length - u, 0), B = Array(H); ++D < H; )
1222
+ B[D] = A[u + D];
1223
+ D = -1;
1224
+ for (var E = Array(u + 1); ++D < u; )
1225
+ E[D] = A[D];
1226
+ return E[u] = m(B), Oe(l, this, E);
1199
1227
  };
1200
1228
  }
1201
- function ct(l, d) {
1202
- if (!(d === "constructor" && typeof l[d] == "function") && d != "__proto__")
1203
- return l[d];
1229
+ function ct(l, u) {
1230
+ if (!(u === "constructor" && typeof l[u] == "function") && u != "__proto__")
1231
+ return l[u];
1204
1232
  }
1205
- var xs = Cs(rs);
1206
- function Cs(l) {
1207
- var d = 0, m = 0;
1233
+ var Cs = As(os);
1234
+ function As(l) {
1235
+ var u = 0, m = 0;
1208
1236
  return function() {
1209
- var A = Ei(), T = a - (A - m);
1210
- if (m = A, T > 0) {
1211
- if (++d >= n)
1237
+ var A = Ei(), D = a - (A - m);
1238
+ if (m = A, D > 0) {
1239
+ if (++u >= n)
1212
1240
  return arguments[0];
1213
1241
  } else
1214
- d = 0;
1242
+ u = 0;
1215
1243
  return l.apply(void 0, arguments);
1216
1244
  };
1217
1245
  }
1218
- function As(l) {
1246
+ function Ts(l) {
1219
1247
  if (l != null) {
1220
1248
  try {
1221
1249
  return Ve.call(l);
@@ -1228,33 +1256,33 @@ function fn() {
1228
1256
  }
1229
1257
  return "";
1230
1258
  }
1231
- function Ge(l, d) {
1232
- return l === d || l !== l && d !== d;
1259
+ function Ge(l, u) {
1260
+ return l === u || l !== l && u !== u;
1233
1261
  }
1234
- var ht = Ot(/* @__PURE__ */ function() {
1262
+ var ht = Pt(/* @__PURE__ */ function() {
1235
1263
  return arguments;
1236
- }()) ? Ot : function(l) {
1237
- return Ae(l) && ne.call(l, "callee") && !Ti.call(l, "callee");
1264
+ }()) ? Pt : function(l) {
1265
+ return Ae(l) && ne.call(l, "callee") && !Di.call(l, "callee");
1238
1266
  }, dt = Array.isArray;
1239
1267
  function ut(l) {
1240
- return l != null && Wt(l.length) && !ft(l);
1268
+ return l != null && jt(l.length) && !ft(l);
1241
1269
  }
1242
1270
  function Ms(l) {
1243
1271
  return Ae(l) && ut(l);
1244
1272
  }
1245
- var Yt = Di || Es;
1273
+ var Wt = Li || Es;
1246
1274
  function ft(l) {
1247
1275
  if (!ue(l))
1248
1276
  return !1;
1249
- var d = Xe(l);
1250
- return d == _ || d == v || d == h || d == C;
1277
+ var u = Xe(l);
1278
+ return u == p || u == v || u == h || u == C;
1251
1279
  }
1252
- function Wt(l) {
1280
+ function jt(l) {
1253
1281
  return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
1254
1282
  }
1255
1283
  function ue(l) {
1256
- var d = typeof l;
1257
- return l != null && (d == "object" || d == "function");
1284
+ var u = typeof l;
1285
+ return l != null && (u == "object" || u == "function");
1258
1286
  }
1259
1287
  function Ae(l) {
1260
1288
  return l != null && typeof l == "object";
@@ -1262,44 +1290,44 @@ function fn() {
1262
1290
  function Ss(l) {
1263
1291
  if (!Ae(l) || Xe(l) != y)
1264
1292
  return !1;
1265
- var d = Bt(l);
1266
- if (d === null)
1293
+ var u = It(l);
1294
+ if (u === null)
1267
1295
  return !0;
1268
- var m = ne.call(d, "constructor") && d.constructor;
1296
+ var m = ne.call(u, "constructor") && u.constructor;
1269
1297
  return typeof m == "function" && m instanceof m && Ve.call(m) == Mi;
1270
1298
  }
1271
- var jt = we ? le(we) : is;
1272
- function Ts(l) {
1273
- return ds(l, Xt(l));
1299
+ var Xt = we ? le(we) : ss;
1300
+ function Ds(l) {
1301
+ return us(l, Ut(l));
1274
1302
  }
1275
- function Xt(l) {
1276
- return ut(l) ? Qi(l) : ss(l);
1303
+ function Ut(l) {
1304
+ return ut(l) ? Ki(l) : ns(l);
1277
1305
  }
1278
- var ks = us(function(l, d, m) {
1279
- Pt(l, d, m);
1306
+ var ks = fs(function(l, u, m) {
1307
+ zt(l, u, m);
1280
1308
  });
1281
- function Ds(l) {
1309
+ function Ls(l) {
1282
1310
  return function() {
1283
1311
  return l;
1284
1312
  };
1285
1313
  }
1286
- function Ut(l) {
1314
+ function Gt(l) {
1287
1315
  return l;
1288
1316
  }
1289
1317
  function Es() {
1290
1318
  return !1;
1291
1319
  }
1292
1320
  i.exports = ks;
1293
- }(Te, Te.exports)), Te.exports;
1321
+ }(Se, Se.exports)), Se.exports;
1294
1322
  }
1295
1323
  var gn = fn();
1296
- const Qe = /* @__PURE__ */ un(gn), si = 12, mn = {
1324
+ const Qe = /* @__PURE__ */ un(gn), ni = 12, mn = {
1297
1325
  candles: {
1298
1326
  direction: "right",
1299
- offset: `${Math.round(si / 2)}px`,
1327
+ offset: `${Math.round(ni / 2)}px`,
1300
1328
  style: "filled",
1301
1329
  strokeWidth: 1,
1302
- baseWidth: si,
1330
+ baseWidth: ni,
1303
1331
  bodyRatio: 0.7,
1304
1332
  zoomOnWheel: "both",
1305
1333
  scaleSensitivity: 2e-3,
@@ -1340,7 +1368,7 @@ const Qe = /* @__PURE__ */ un(gn), si = 12, mn = {
1340
1368
  showLabelButtons: !0
1341
1369
  }
1342
1370
  };
1343
- class _n {
1371
+ class pn {
1344
1372
  constructor(e) {
1345
1373
  f(this, "_candles");
1346
1374
  f(this, "_xAxis");
@@ -1380,7 +1408,7 @@ class _n {
1380
1408
  return this._trade;
1381
1409
  }
1382
1410
  }
1383
- class W {
1411
+ class X {
1384
1412
  constructor(e) {
1385
1413
  f(this, "x");
1386
1414
  f(this, "y");
@@ -1421,34 +1449,34 @@ class W {
1421
1449
  return this.y + this.height;
1422
1450
  }
1423
1451
  }
1424
- class pn {
1452
+ class _n {
1425
1453
  constructor(e, t) {
1426
- f(this, "_chart", new W());
1427
- f(this, "_area", new W());
1428
- f(this, "_xAxis", new W());
1429
- f(this, "_yAxis", new W());
1430
- f(this, "_axisIntersection", new W());
1454
+ f(this, "_chart", new X());
1455
+ f(this, "_area", new X());
1456
+ f(this, "_xAxis", new X());
1457
+ f(this, "_yAxis", new X());
1458
+ f(this, "_axisIntersection", new X());
1431
1459
  const { xAxis: s, yAxis: n } = t;
1432
- this._chart = new W(e), this._calc(s, n);
1460
+ this._chart = new X(e), this._calc(s, n);
1433
1461
  }
1434
1462
  _calc(e, t) {
1435
1463
  const s = e.isShow ? e.height : 0, n = t.isShow ? t.width : 0, a = this._chart.height - s, r = this._chart.width - n;
1436
- this._area = new W({
1464
+ this._area = new X({
1437
1465
  x: t.position === "left" ? n : 0,
1438
1466
  y: e.position === "top" ? s : 0,
1439
1467
  width: r,
1440
1468
  height: a
1441
- }), this._xAxis = new W({
1469
+ }), this._xAxis = new X({
1442
1470
  y: e.position === "top" ? 0 : a,
1443
1471
  x: t.position === "left" ? n : 0,
1444
1472
  height: s,
1445
1473
  width: r
1446
- }), this._yAxis = new W({
1474
+ }), this._yAxis = new X({
1447
1475
  y: e.position === "top" ? s : 0,
1448
1476
  x: t.position === "left" ? 0 : r,
1449
1477
  width: n,
1450
1478
  height: a
1451
- }), this._axisIntersection = new W({
1479
+ }), this._axisIntersection = new X({
1452
1480
  y: e.position === "top" ? 0 : a,
1453
1481
  x: t.position === "left" ? 0 : r,
1454
1482
  width: n,
@@ -1461,7 +1489,7 @@ class pn {
1461
1489
  }
1462
1490
  update(e) {
1463
1491
  const { xAxis: t, yAxis: s } = e.config;
1464
- this._chart = new W(e.container), this._calc(t, s);
1492
+ this._chart = new X(e.container), this._calc(t, s);
1465
1493
  }
1466
1494
  get area() {
1467
1495
  return this._area;
@@ -1487,14 +1515,14 @@ function bn(i, e) {
1487
1515
  const n = i[s].close_time.getTime(), a = i[s].open_time.getTime(), o = new Date(i[s + 1].open_time).getTime() - n;
1488
1516
  if (o >= e) {
1489
1517
  const c = Math.floor(o / e), h = [];
1490
- for (let u = 1; u <= c; u++)
1491
- h.push(a + u * e);
1518
+ for (let d = 1; d <= c; d++)
1519
+ h.push(a + d * e);
1492
1520
  h.length > 0 && t.push(h);
1493
1521
  }
1494
1522
  }
1495
1523
  return t;
1496
1524
  }
1497
- function ni(i, e) {
1525
+ function ai(i, e) {
1498
1526
  const t = vn(i[0]), s = bn(i, t), n = [];
1499
1527
  return s.forEach((a) => {
1500
1528
  if (a.length === 0) return;
@@ -1504,18 +1532,18 @@ function ni(i, e) {
1504
1532
  if (!r || !o)
1505
1533
  throw new Error("[CS_Data] error while creating missing data");
1506
1534
  const c = r.close, h = o.open;
1507
- let u = c;
1508
- a.forEach((g, p) => {
1509
- const _ = (h - u) / a.length;
1510
- let v = u + _ * p, b = v + _;
1535
+ let d = c;
1536
+ a.forEach((g, _) => {
1537
+ const p = (h - d) / a.length;
1538
+ let v = d + p * _, b = v + p;
1511
1539
  const w = Math.abs(v - b);
1512
1540
  let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
1513
1541
  if (e.trade) {
1514
- const S = [...e.trade.entries, ...e.trade.exits].find((F) => {
1515
- const H = F.time.getTime();
1516
- return H >= g && H < g + t;
1542
+ const M = [...e.trade.entries, ...e.trade.exits].find((S) => {
1543
+ const N = S.time.getTime();
1544
+ return N >= g && N < g + t;
1517
1545
  });
1518
- S && (S.type === "buy" ? (y = S.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, u = v) : S.type === "sell" && (x = S.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, u = v));
1546
+ 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));
1519
1547
  }
1520
1548
  const C = {
1521
1549
  open_time: new Date(g),
@@ -1529,7 +1557,7 @@ function ni(i, e) {
1529
1557
  });
1530
1558
  }), n;
1531
1559
  }
1532
- class Tt {
1560
+ class Dt {
1533
1561
  constructor(e, t) {
1534
1562
  f(this, "_initialData", []);
1535
1563
  f(this, "_preparedData", []);
@@ -1543,10 +1571,10 @@ class Tt {
1543
1571
  return e.map((t) => ({ ...t, open_time: new Date(t.open_time), close_time: new Date(t.close_time) })).sort((t, s) => t.open_time.getTime() - s.open_time.getTime());
1544
1572
  }
1545
1573
  update(e) {
1546
- this._initialData = e, this._preparedData = this._prepare(e), this._missingData = ni(this._preparedData, this._model), this._count = this._preparedData.length + this._missingData.length, this._interval = new Date(e[0].close_time).getTime() - new Date(e[0].open_time).getTime();
1574
+ this._initialData = e, this._preparedData = this._prepare(e), this._missingData = ai(this._preparedData, this._model), this._count = this._preparedData.length + this._missingData.length, this._interval = new Date(e[0].close_time).getTime() - new Date(e[0].open_time).getTime();
1547
1575
  }
1548
1576
  updateMissingCandles() {
1549
- this._missingData = ni(this._preparedData, this._model);
1577
+ this._missingData = ai(this._preparedData, this._model);
1550
1578
  }
1551
1579
  get initialData() {
1552
1580
  return this._initialData;
@@ -1589,7 +1617,7 @@ class yn {
1589
1617
  });
1590
1618
  }
1591
1619
  }
1592
- class pi {
1620
+ class vi {
1593
1621
  constructor() {
1594
1622
  f(this, "_scale");
1595
1623
  }
@@ -1625,17 +1653,17 @@ class pi {
1625
1653
  return this._scale(e);
1626
1654
  }
1627
1655
  }
1628
- class vi extends pi {
1656
+ class bi extends vi {
1629
1657
  constructor() {
1630
- super(), this._scale = D.scaleTime();
1658
+ super(), this._scale = L.scaleTime();
1631
1659
  }
1632
1660
  }
1633
- class wn extends pi {
1661
+ class wn extends vi {
1634
1662
  constructor() {
1635
- super(), this._scale = D.scaleLinear();
1663
+ super(), this._scale = L.scaleLinear();
1636
1664
  }
1637
1665
  }
1638
- const ai = { x: 0.2, y: 0.2 }, ri = 1e-3, xn = {
1666
+ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
1639
1667
  s: 1e3,
1640
1668
  M: 1e3 * 60,
1641
1669
  h: 1e3 * 60 * 60,
@@ -1649,16 +1677,16 @@ const ai = { x: 0.2, y: 0.2 }, ri = 1e-3, xn = {
1649
1677
  const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
1650
1678
  const c = o.open_time.getTime();
1651
1679
  return c >= t && c <= s;
1652
- }), a = D.min(n, (o) => o.low), r = D.max(n, (o) => o.high);
1680
+ }), a = L.min(n, (o) => o.low), r = L.max(n, (o) => o.high);
1653
1681
  if (a == null || r == null) throw new Error("Invalid Y data");
1654
1682
  return [a, r];
1655
1683
  };
1656
- class Mn {
1684
+ class Tn {
1657
1685
  constructor(e) {
1658
1686
  this.model = e;
1659
1687
  }
1660
1688
  initX(e) {
1661
- const t = this.model.candles.preparedData, s = D.extent(t, (n) => new Date(n.open_time));
1689
+ const t = this.model.candles.preparedData, s = L.extent(t, (n) => new Date(n.open_time));
1662
1690
  if (!s[0] || !s[1]) throw new Error("Invalid x data");
1663
1691
  e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
1664
1692
  }
@@ -1670,7 +1698,7 @@ class Mn {
1670
1698
  this.initX(e.x), this.initY(e.y, e.x);
1671
1699
  }
1672
1700
  setRange(e, { x: t, y: s, width: n, height: a }) {
1673
- e instanceof vi ? e.setRange([t, t + n]) : e.setRange([s + a, s]);
1701
+ e instanceof bi ? e.setRange([t, t + n]) : e.setRange([s + a, s]);
1674
1702
  }
1675
1703
  setDefaultXDomain(e) {
1676
1704
  const {
@@ -1679,8 +1707,8 @@ class Mn {
1679
1707
  config: {
1680
1708
  candles: { baseWidth: n, bodyRatio: a, direction: r }
1681
1709
  }
1682
- } = this.model, [o, c] = e.domain().map((_) => _.getTime()), h = c - o, u = n / a * t, g = h * (s.width / u), p = r === "left" ? [new Date(o), new Date(o + g)] : [new Date(c - g), new Date(c)];
1683
- e.setDomain(p);
1710
+ } = this.model, [o, c] = e.domain().map((p) => p.getTime()), h = c - o, d = n / a * t, g = h * (s.width / d), _ = r === "left" ? [new Date(o), new Date(o + g)] : [new Date(c - g), new Date(c)];
1711
+ e.setDomain(_);
1684
1712
  }
1685
1713
  applyOffset(e) {
1686
1714
  const {
@@ -1688,11 +1716,11 @@ class Mn {
1688
1716
  candles: { offset: t, direction: s }
1689
1717
  },
1690
1718
  layout: { xAxis: n }
1691
- } = this.model, [a, r] = Cn(t), o = r === "px" ? e.invert(n.x + a).getTime() - e.invert(n.x).getTime() : xn[r] * a, c = s === "left" ? -o : o, [h, u] = e.domain();
1692
- e.setDomain([new Date(h.getTime() + c), new Date(u.getTime() + c)]);
1719
+ } = this.model, [a, r] = Cn(t), o = r === "px" ? e.invert(n.x + a).getTime() - e.invert(n.x).getTime() : xn[r] * a, c = s === "left" ? -o : o, [h, d] = e.domain();
1720
+ e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
1693
1721
  }
1694
1722
  }
1695
- class Sn {
1723
+ class Mn {
1696
1724
  constructor(e) {
1697
1725
  f(this, "_model");
1698
1726
  f(this, "_scaleX");
@@ -1704,7 +1732,7 @@ class Sn {
1704
1732
  });
1705
1733
  f(this, "scaleFactor", { x: 1, y: 1 });
1706
1734
  f(this, "panOffset", { x: 0, y: 0 });
1707
- this._model = e, this._scaleX = new vi(), this._scaleY = new wn(), this._initializer = new Mn(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
1735
+ this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new Tn(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
1708
1736
  x: this._scaleX.domain(),
1709
1737
  y: this._scaleY.domain()
1710
1738
  };
@@ -1740,17 +1768,17 @@ class Sn {
1740
1768
  if (o === 0) return;
1741
1769
  const c = this._baseDomain.y;
1742
1770
  this.scale("y", (c[1] - c[0]) / o, "absolute");
1743
- const h = this._scaleY.convert((a + r) / 2), u = this._scaleY.convert((c[0] + c[1]) / 2);
1744
- this.pan("y", u - h, "absolute");
1771
+ const h = this._scaleY.convert((a + r) / 2), d = this._scaleY.convert((c[0] + c[1]) / 2);
1772
+ this.pan("y", d - h, "absolute");
1745
1773
  }
1746
1774
  scale(e, t, s = "delta") {
1747
1775
  if (s === "absolute") {
1748
- const n = Math.max(ai[e], t);
1749
- if (Math.abs(n - this.scaleFactor[e]) < ri) return;
1776
+ const n = Math.max(ri[e], t);
1777
+ if (Math.abs(n - this.scaleFactor[e]) < oi) return;
1750
1778
  this.scaleFactor[e] = n;
1751
1779
  } else {
1752
1780
  const n = this.scaleFactor[e], a = n + t * this._model.config.candles.scaleSensitivity;
1753
- if (a < ai[e] || Math.abs(a - n) < ri) return;
1781
+ if (a < ri[e] || Math.abs(a - n) < oi) return;
1754
1782
  this.scaleFactor[e] = a;
1755
1783
  }
1756
1784
  this._updateDomain(e);
@@ -1761,22 +1789,22 @@ class Sn {
1761
1789
  _updateDomain(e) {
1762
1790
  const t = this._baseDomain[e], s = this.scaleFactor[e], n = this.panOffset[e];
1763
1791
  if (e === "x") {
1764
- const [a, r] = t, o = r.getTime() - a.getTime(), c = o / s, h = a.getTime() + o / 2, u = this._scaleX.invert(0 - n).getTime() - this._scaleX.invert(0).getTime();
1792
+ const [a, r] = t, o = r.getTime() - a.getTime(), c = o / s, h = a.getTime() + o / 2, d = this._scaleX.invert(0 - n).getTime() - this._scaleX.invert(0).getTime();
1765
1793
  this._scaleX.setDomain([
1766
- new Date(h - c / 2 + u),
1767
- new Date(h + c / 2 + u)
1794
+ new Date(h - c / 2 + d),
1795
+ new Date(h + c / 2 + d)
1768
1796
  ]);
1769
1797
  } else {
1770
- const [a, r] = t, o = r - a, c = o / s, h = a + o / 2, u = this._scaleY.invert(0 - n) - this._scaleY.invert(0);
1798
+ const [a, r] = t, o = r - a, c = o / s, h = a + o / 2, d = this._scaleY.invert(0 - n) - this._scaleY.invert(0);
1771
1799
  this._scaleY.setDomain([
1772
- h - c / 2 + u,
1773
- h + c / 2 + u
1800
+ h - c / 2 + d,
1801
+ h + c / 2 + d
1774
1802
  ]);
1775
1803
  }
1776
1804
  this._model.eventBus.emit("scale_event");
1777
1805
  }
1778
1806
  }
1779
- class Tn {
1807
+ class Sn {
1780
1808
  constructor(e, { entry: t = [], exit: s = [] }) {
1781
1809
  f(this, "_model");
1782
1810
  f(this, "_rawEntry");
@@ -1864,7 +1892,7 @@ class Tn {
1864
1892
  return Math.abs(this.entryMinTime - this.exitMaxTime);
1865
1893
  }
1866
1894
  }
1867
- class kn {
1895
+ class Dn {
1868
1896
  constructor(e, t) {
1869
1897
  f(this, "_rawMarkers");
1870
1898
  f(this, "_markers", []);
@@ -1894,7 +1922,7 @@ class kn {
1894
1922
  mainColor: n.mainColor ?? s.main,
1895
1923
  textColor: n.textColor ?? s.text,
1896
1924
  lineColor: n.lineColor ?? s.line
1897
- }, r = t.convert(n.value), c = (n.formatter ?? ((h = this._defaults.formatter) == null ? void 0 : h.horizontal) ?? ((u) => u.toString()))(n.value);
1925
+ }, r = t.convert(n.value), c = (n.formatter ?? ((h = this._defaults.formatter) == null ? void 0 : h.horizontal) ?? ((d) => d.toString()))(n.value);
1898
1926
  return {
1899
1927
  value: n.value,
1900
1928
  text: c,
@@ -1912,7 +1940,7 @@ class kn {
1912
1940
  return this._markers;
1913
1941
  }
1914
1942
  }
1915
- const Dn = {
1943
+ const kn = {
1916
1944
  bg: "#FFFFFF",
1917
1945
  axisIntersection: "#FFFFFF",
1918
1946
  xAxis: {
@@ -1976,10 +2004,10 @@ const Dn = {
1976
2004
  }
1977
2005
  }
1978
2006
  };
1979
- class En {
2007
+ class Ln {
1980
2008
  constructor(e) {
1981
2009
  f(this, "_scheme");
1982
- this._scheme = Qe({}, Dn, e), Object.keys(this._scheme).forEach((t) => {
2010
+ this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
1983
2011
  Object.defineProperty(this, t, {
1984
2012
  get: () => this._scheme[t],
1985
2013
  enumerable: !0
@@ -1990,7 +2018,7 @@ class En {
1990
2018
  this._scheme = Qe({}, this._scheme, e);
1991
2019
  }
1992
2020
  }
1993
- class Ln {
2021
+ class En {
1994
2022
  constructor(e, t) {
1995
2023
  f(this, "_data");
1996
2024
  f(this, "_callbacks", {
@@ -2008,7 +2036,7 @@ class Ln {
2008
2036
  _updateGroups() {
2009
2037
  this._grouped = {};
2010
2038
  for (const e of this._data) {
2011
- const t = Tt.findByDate(new Date(e.date), this._model.candles.allData);
2039
+ const t = Dt.findByDate(new Date(e.date), this._model.candles.allData);
2012
2040
  if (!t) continue;
2013
2041
  const s = t.open_time.getTime();
2014
2042
  this._grouped[s] || (this._grouped[s] = []), this._grouped[s].push({ ...e, candle: t });
@@ -2055,7 +2083,7 @@ class Nn {
2055
2083
  f(this, "trade");
2056
2084
  f(this, "userMarkers");
2057
2085
  f(this, "comments");
2058
- this.chartId = e, this.container = t, this.candles = new Tt(s, this), this.config = new _n(n), this.colorScheme = new En(o), this.layout = new pn(t, this.config), this.scales = new Sn(this), this.trade = new Tn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new kn(this, r), this.comments = new Ln(c, this);
2086
+ 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 Mn(this), this.trade = new Sn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new En(c, this);
2059
2087
  }
2060
2088
  init() {
2061
2089
  this.eventBus.emit("init_model");
@@ -2124,7 +2152,7 @@ class k {
2124
2152
  this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
2125
2153
  }
2126
2154
  }
2127
- class Le extends k {
2155
+ class Ee extends k {
2128
2156
  constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
2129
2157
  super({
2130
2158
  tag: "canvas",
@@ -2163,10 +2191,10 @@ function Hn(i, e) {
2163
2191
  colorScheme: { xAxis: s },
2164
2192
  config: { xAxis: n },
2165
2193
  scales: a
2166
- } = e, r = a.x.ticks(Fn), o = (u) => u.getHours() === 0 && u.getMinutes() === 0, c = D.timeFormat("%d %b"), h = D.timeFormat("%H:%M");
2167
- 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((u) => {
2168
- const g = a.x.convert(u), p = o(u) ? c(u) : h(u);
2169
- i.fillText(p, g, t.y + t.height / 2);
2194
+ } = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = L.timeFormat("%d %b"), h = L.timeFormat("%H:%M");
2195
+ 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) => {
2196
+ const g = a.x.convert(d), _ = o(d) ? c(d) : h(d);
2197
+ i.fillText(_, g, t.y + t.height / 2);
2170
2198
  });
2171
2199
  }
2172
2200
  function Bn(i, e) {
@@ -2177,8 +2205,8 @@ function Bn(i, e) {
2177
2205
  scales: a
2178
2206
  } = e, r = a.y.ticks(6), o = a.y.tickFormat(6);
2179
2207
  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((c) => {
2180
- const h = a.y.convert(c), u = o(c);
2181
- i.fillText(u, t.x + t.width / 2, h);
2208
+ const h = a.y.convert(c), d = o(c);
2209
+ i.fillText(d, t.x + t.width / 2, h);
2182
2210
  });
2183
2211
  }
2184
2212
  const In = (i, e) => {
@@ -2235,13 +2263,13 @@ function Ke(i) {
2235
2263
  return i * 0.1875;
2236
2264
  }
2237
2265
  const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
2238
- const g = r / 16, p = 16 * g, _ = n - p / 2, v = a;
2239
- 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";
2266
+ const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
2267
+ i.save(), i.translate(p, 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";
2240
2268
  const b = a + g * 3 + 0.5, w = g * 16, x = b + w / 2;
2241
2269
  i.fillStyle = t, i.fillText(s, n, x), i.restore();
2242
2270
  }, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
2243
- const g = r / 16, p = 16 * g, _ = n - p / 2, v = a;
2244
- 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";
2271
+ const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
2272
+ i.save(), i.translate(p, 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";
2245
2273
  const b = g * 16, w = a - g * 19 + b / 2;
2246
2274
  i.fillStyle = t, i.fillText(s, n, w), i.restore();
2247
2275
  };
@@ -2254,15 +2282,15 @@ function et(i) {
2254
2282
  }, et(i);
2255
2283
  }
2256
2284
  var Pn = /^\s+/, zn = /\s+$/;
2257
- function M(i, e) {
2258
- if (i = i || "", e = e || {}, i instanceof M)
2285
+ function T(i, e) {
2286
+ if (i = i || "", e = e || {}, i instanceof T)
2259
2287
  return i;
2260
- if (!(this instanceof M))
2261
- return new M(i, e);
2288
+ if (!(this instanceof T))
2289
+ return new T(i, e);
2262
2290
  var t = Vn(i);
2263
2291
  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;
2264
2292
  }
2265
- M.prototype = {
2293
+ T.prototype = {
2266
2294
  isDark: function() {
2267
2295
  return this.getBrightness() < 128;
2268
2296
  },
@@ -2290,10 +2318,10 @@ M.prototype = {
2290
2318
  return t = e.r / 255, s = e.g / 255, n = e.b / 255, t <= 0.03928 ? a = t / 12.92 : a = Math.pow((t + 0.055) / 1.055, 2.4), s <= 0.03928 ? r = s / 12.92 : r = Math.pow((s + 0.055) / 1.055, 2.4), n <= 0.03928 ? o = n / 12.92 : o = Math.pow((n + 0.055) / 1.055, 2.4), 0.2126 * a + 0.7152 * r + 0.0722 * o;
2291
2319
  },
2292
2320
  setAlpha: function(e) {
2293
- return this._a = bi(e), this._roundA = Math.round(100 * this._a) / 100, this;
2321
+ return this._a = yi(e), this._roundA = Math.round(100 * this._a) / 100, this;
2294
2322
  },
2295
2323
  toHsv: function() {
2296
- var e = li(this._r, this._g, this._b);
2324
+ var e = ci(this._r, this._g, this._b);
2297
2325
  return {
2298
2326
  h: e.h * 360,
2299
2327
  s: e.s,
@@ -2302,11 +2330,11 @@ M.prototype = {
2302
2330
  };
2303
2331
  },
2304
2332
  toHsvString: function() {
2305
- var e = li(this._r, this._g, this._b), t = Math.round(e.h * 360), s = Math.round(e.s * 100), n = Math.round(e.v * 100);
2333
+ var e = ci(this._r, this._g, this._b), t = Math.round(e.h * 360), s = Math.round(e.s * 100), n = Math.round(e.v * 100);
2306
2334
  return this._a == 1 ? "hsv(" + t + ", " + s + "%, " + n + "%)" : "hsva(" + t + ", " + s + "%, " + n + "%, " + this._roundA + ")";
2307
2335
  },
2308
2336
  toHsl: function() {
2309
- var e = oi(this._r, this._g, this._b);
2337
+ var e = li(this._r, this._g, this._b);
2310
2338
  return {
2311
2339
  h: e.h * 360,
2312
2340
  s: e.s,
@@ -2315,11 +2343,11 @@ M.prototype = {
2315
2343
  };
2316
2344
  },
2317
2345
  toHslString: function() {
2318
- var e = oi(this._r, this._g, this._b), t = Math.round(e.h * 360), s = Math.round(e.s * 100), n = Math.round(e.l * 100);
2346
+ var e = li(this._r, this._g, this._b), t = Math.round(e.h * 360), s = Math.round(e.s * 100), n = Math.round(e.l * 100);
2319
2347
  return this._a == 1 ? "hsl(" + t + ", " + s + "%, " + n + "%)" : "hsla(" + t + ", " + s + "%, " + n + "%, " + this._roundA + ")";
2320
2348
  },
2321
2349
  toHex: function(e) {
2322
- return ci(this._r, this._g, this._b, e);
2350
+ return hi(this._r, this._g, this._b, e);
2323
2351
  },
2324
2352
  toHexString: function(e) {
2325
2353
  return "#" + this.toHex(e);
@@ -2353,13 +2381,13 @@ M.prototype = {
2353
2381
  return this._a == 1 ? "rgb(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%, " + this._roundA + ")";
2354
2382
  },
2355
2383
  toName: function() {
2356
- return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[ci(this._r, this._g, this._b, !0)] || !1;
2384
+ return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[hi(this._r, this._g, this._b, !0)] || !1;
2357
2385
  },
2358
2386
  toFilter: function(e) {
2359
- var t = "#" + hi(this._r, this._g, this._b, this._a), s = t, n = this._gradientType ? "GradientType = 1, " : "";
2387
+ var t = "#" + di(this._r, this._g, this._b, this._a), s = t, n = this._gradientType ? "GradientType = 1, " : "";
2360
2388
  if (e) {
2361
- var a = M(e);
2362
- s = "#" + hi(a._r, a._g, a._b, a._a);
2389
+ var a = T(e);
2390
+ s = "#" + di(a._r, a._g, a._b, a._a);
2363
2391
  }
2364
2392
  return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + t + ",endColorstr=" + s + ")";
2365
2393
  },
@@ -2370,7 +2398,7 @@ M.prototype = {
2370
2398
  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());
2371
2399
  },
2372
2400
  clone: function() {
2373
- return M(this.toString());
2401
+ return T(this.toString());
2374
2402
  },
2375
2403
  _applyModification: function(e, t) {
2376
2404
  var s = e.apply(null, [this].concat([].slice.call(t)));
@@ -2417,20 +2445,20 @@ M.prototype = {
2417
2445
  // return this._applyCombination(polyad, [number]);
2418
2446
  // },
2419
2447
  triad: function() {
2420
- return this._applyCombination(di, [3]);
2448
+ return this._applyCombination(ui, [3]);
2421
2449
  },
2422
2450
  tetrad: function() {
2423
- return this._applyCombination(di, [4]);
2451
+ return this._applyCombination(ui, [4]);
2424
2452
  }
2425
2453
  };
2426
- M.fromRatio = function(i, e) {
2454
+ T.fromRatio = function(i, e) {
2427
2455
  if (et(i) == "object") {
2428
2456
  var t = {};
2429
2457
  for (var s in i)
2430
- i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] = ke(i[s]));
2458
+ i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] = De(i[s]));
2431
2459
  i = t;
2432
2460
  }
2433
- return M(i, e);
2461
+ return T(i, e);
2434
2462
  };
2435
2463
  function Vn(i) {
2436
2464
  var e = {
@@ -2438,7 +2466,7 @@ function Vn(i) {
2438
2466
  g: 0,
2439
2467
  b: 0
2440
2468
  }, t = 1, s = null, n = null, a = null, r = !1, o = !1;
2441
- return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Yn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : ie(i.h) && ie(i.s) && ie(i.v) ? (s = ke(i.s), n = ke(i.v), e = jn(i.h, s, n), r = !0, o = "hsv") : ie(i.h) && ie(i.s) && ie(i.l) && (s = ke(i.s), a = ke(i.l), e = Wn(i.h, s, a), r = !0, o = "hsl"), i.hasOwnProperty("a") && (t = i.a)), t = bi(t), {
2469
+ return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Yn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : ie(i.h) && ie(i.s) && ie(i.v) ? (s = De(i.s), n = De(i.v), e = jn(i.h, s, n), r = !0, o = "hsv") : ie(i.h) && ie(i.s) && ie(i.l) && (s = De(i.s), a = De(i.l), e = Wn(i.h, s, a), r = !0, o = "hsl"), i.hasOwnProperty("a") && (t = i.a)), t = yi(t), {
2442
2470
  ok: r,
2443
2471
  format: i.format || o,
2444
2472
  r: Math.min(255, Math.max(e.r, 0)),
@@ -2454,7 +2482,7 @@ function Yn(i, e, t) {
2454
2482
  b: R(t, 255) * 255
2455
2483
  };
2456
2484
  }
2457
- function oi(i, e, t) {
2485
+ function li(i, e, t) {
2458
2486
  i = R(i, 255), e = R(e, 255), t = R(t, 255);
2459
2487
  var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = (s + n) / 2;
2460
2488
  if (s == n)
@@ -2483,8 +2511,8 @@ function oi(i, e, t) {
2483
2511
  function Wn(i, e, t) {
2484
2512
  var s, n, a;
2485
2513
  i = R(i, 360), e = R(e, 100), t = R(t, 100);
2486
- function r(h, u, g) {
2487
- return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? h + (u - h) * 6 * g : g < 1 / 2 ? u : g < 2 / 3 ? h + (u - h) * (2 / 3 - g) * 6 : h;
2514
+ function r(h, d, g) {
2515
+ return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? h + (d - h) * 6 * g : g < 1 / 2 ? d : g < 2 / 3 ? h + (d - h) * (2 / 3 - g) * 6 : h;
2488
2516
  }
2489
2517
  if (e === 0)
2490
2518
  s = n = a = t;
@@ -2498,7 +2526,7 @@ function Wn(i, e, t) {
2498
2526
  b: a * 255
2499
2527
  };
2500
2528
  }
2501
- function li(i, e, t) {
2529
+ function ci(i, e, t) {
2502
2530
  i = R(i, 255), e = R(e, 255), t = R(t, 255);
2503
2531
  var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = s, c = s - n;
2504
2532
  if (r = s === 0 ? 0 : c / s, s == n)
@@ -2525,30 +2553,30 @@ function li(i, e, t) {
2525
2553
  }
2526
2554
  function jn(i, e, t) {
2527
2555
  i = R(i, 360) * 6, e = R(e, 100), t = R(t, 100);
2528
- var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], u = [o, t, t, r, a, a][c], g = [a, a, o, t, t, r][c];
2556
+ var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], d = [o, t, t, r, a, a][c], g = [a, a, o, t, t, r][c];
2529
2557
  return {
2530
2558
  r: h * 255,
2531
- g: u * 255,
2559
+ g: d * 255,
2532
2560
  b: g * 255
2533
2561
  };
2534
2562
  }
2535
- function ci(i, e, t, s) {
2563
+ function hi(i, e, t, s) {
2536
2564
  var n = [K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16))];
2537
2565
  return s && n[0].charAt(0) == n[0].charAt(1) && n[1].charAt(0) == n[1].charAt(1) && n[2].charAt(0) == n[2].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) : n.join("");
2538
2566
  }
2539
2567
  function Xn(i, e, t, s, n) {
2540
- var a = [K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16)), K(yi(s))];
2568
+ var a = [K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16)), K(wi(s))];
2541
2569
  return n && a[0].charAt(0) == a[0].charAt(1) && a[1].charAt(0) == a[1].charAt(1) && a[2].charAt(0) == a[2].charAt(1) && a[3].charAt(0) == a[3].charAt(1) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join("");
2542
2570
  }
2543
- function hi(i, e, t, s) {
2544
- var n = [K(yi(s)), K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16))];
2571
+ function di(i, e, t, s) {
2572
+ var n = [K(wi(s)), K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16))];
2545
2573
  return n.join("");
2546
2574
  }
2547
- M.equals = function(i, e) {
2548
- return !i || !e ? !1 : M(i).toRgbString() == M(e).toRgbString();
2575
+ T.equals = function(i, e) {
2576
+ return !i || !e ? !1 : T(i).toRgbString() == T(e).toRgbString();
2549
2577
  };
2550
- M.random = function() {
2551
- return M.fromRatio({
2578
+ T.random = function() {
2579
+ return T.fromRatio({
2552
2580
  r: Math.random(),
2553
2581
  g: Math.random(),
2554
2582
  b: Math.random()
@@ -2556,45 +2584,45 @@ M.random = function() {
2556
2584
  };
2557
2585
  function Un(i, e) {
2558
2586
  e = e === 0 ? 0 : e || 10;
2559
- var t = M(i).toHsl();
2560
- return t.s -= e / 100, t.s = it(t.s), M(t);
2587
+ var t = T(i).toHsl();
2588
+ return t.s -= e / 100, t.s = it(t.s), T(t);
2561
2589
  }
2562
2590
  function Gn(i, e) {
2563
2591
  e = e === 0 ? 0 : e || 10;
2564
- var t = M(i).toHsl();
2565
- return t.s += e / 100, t.s = it(t.s), M(t);
2592
+ var t = T(i).toHsl();
2593
+ return t.s += e / 100, t.s = it(t.s), T(t);
2566
2594
  }
2567
2595
  function Zn(i) {
2568
- return M(i).desaturate(100);
2596
+ return T(i).desaturate(100);
2569
2597
  }
2570
2598
  function qn(i, e) {
2571
2599
  e = e === 0 ? 0 : e || 10;
2572
- var t = M(i).toHsl();
2573
- return t.l += e / 100, t.l = it(t.l), M(t);
2600
+ var t = T(i).toHsl();
2601
+ return t.l += e / 100, t.l = it(t.l), T(t);
2574
2602
  }
2575
2603
  function Jn(i, e) {
2576
2604
  e = e === 0 ? 0 : e || 10;
2577
- var t = M(i).toRgb();
2578
- 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);
2605
+ var t = T(i).toRgb();
2606
+ 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)))), T(t);
2579
2607
  }
2580
2608
  function Qn(i, e) {
2581
2609
  e = e === 0 ? 0 : e || 10;
2582
- var t = M(i).toHsl();
2583
- return t.l -= e / 100, t.l = it(t.l), M(t);
2610
+ var t = T(i).toHsl();
2611
+ return t.l -= e / 100, t.l = it(t.l), T(t);
2584
2612
  }
2585
2613
  function Kn(i, e) {
2586
- var t = M(i).toHsl(), s = (t.h + e) % 360;
2587
- return t.h = s < 0 ? 360 + s : s, M(t);
2614
+ var t = T(i).toHsl(), s = (t.h + e) % 360;
2615
+ return t.h = s < 0 ? 360 + s : s, T(t);
2588
2616
  }
2589
2617
  function ea(i) {
2590
- var e = M(i).toHsl();
2591
- return e.h = (e.h + 180) % 360, M(e);
2618
+ var e = T(i).toHsl();
2619
+ return e.h = (e.h + 180) % 360, T(e);
2592
2620
  }
2593
- function di(i, e) {
2621
+ function ui(i, e) {
2594
2622
  if (isNaN(e) || e <= 0)
2595
2623
  throw new Error("Argument to polyad must be a positive number");
2596
- for (var t = M(i).toHsl(), s = [M(i)], n = 360 / e, a = 1; a < e; a++)
2597
- s.push(M({
2624
+ for (var t = T(i).toHsl(), s = [T(i)], n = 360 / e, a = 1; a < e; a++)
2625
+ s.push(T({
2598
2626
  h: (t.h + a * n) % 360,
2599
2627
  s: t.s,
2600
2628
  l: t.l
@@ -2602,12 +2630,12 @@ function di(i, e) {
2602
2630
  return s;
2603
2631
  }
2604
2632
  function ta(i) {
2605
- var e = M(i).toHsl(), t = e.h;
2606
- return [M(i), M({
2633
+ var e = T(i).toHsl(), t = e.h;
2634
+ return [T(i), T({
2607
2635
  h: (t + 72) % 360,
2608
2636
  s: e.s,
2609
2637
  l: e.l
2610
- }), M({
2638
+ }), T({
2611
2639
  h: (t + 216) % 360,
2612
2640
  s: e.s,
2613
2641
  l: e.l
@@ -2615,37 +2643,37 @@ function ta(i) {
2615
2643
  }
2616
2644
  function ia(i, e, t) {
2617
2645
  e = e || 6, t = t || 30;
2618
- var s = M(i).toHsl(), n = 360 / t, a = [M(i)];
2646
+ var s = T(i).toHsl(), n = 360 / t, a = [T(i)];
2619
2647
  for (s.h = (s.h - (n * e >> 1) + 720) % 360; --e; )
2620
- s.h = (s.h + n) % 360, a.push(M(s));
2648
+ s.h = (s.h + n) % 360, a.push(T(s));
2621
2649
  return a;
2622
2650
  }
2623
2651
  function sa(i, e) {
2624
2652
  e = e || 6;
2625
- for (var t = M(i).toHsv(), s = t.h, n = t.s, a = t.v, r = [], o = 1 / e; e--; )
2626
- r.push(M({
2653
+ for (var t = T(i).toHsv(), s = t.h, n = t.s, a = t.v, r = [], o = 1 / e; e--; )
2654
+ r.push(T({
2627
2655
  h: s,
2628
2656
  s: n,
2629
2657
  v: a
2630
2658
  })), a = (a + o) % 1;
2631
2659
  return r;
2632
2660
  }
2633
- M.mix = function(i, e, t) {
2661
+ T.mix = function(i, e, t) {
2634
2662
  t = t === 0 ? 0 : t || 50;
2635
- var s = M(i).toRgb(), n = M(e).toRgb(), a = t / 100, r = {
2663
+ var s = T(i).toRgb(), n = T(e).toRgb(), a = t / 100, r = {
2636
2664
  r: (n.r - s.r) * a + s.r,
2637
2665
  g: (n.g - s.g) * a + s.g,
2638
2666
  b: (n.b - s.b) * a + s.b,
2639
2667
  a: (n.a - s.a) * a + s.a
2640
2668
  };
2641
- return M(r);
2669
+ return T(r);
2642
2670
  };
2643
- M.readability = function(i, e) {
2644
- var t = M(i), s = M(e);
2671
+ T.readability = function(i, e) {
2672
+ var t = T(i), s = T(e);
2645
2673
  return (Math.max(t.getLuminance(), s.getLuminance()) + 0.05) / (Math.min(t.getLuminance(), s.getLuminance()) + 0.05);
2646
2674
  };
2647
- M.isReadable = function(i, e, t) {
2648
- var s = M.readability(i, e), n, a;
2675
+ T.isReadable = function(i, e, t) {
2676
+ var s = T.readability(i, e), n, a;
2649
2677
  switch (a = !1, n = ca(t), n.level + n.size) {
2650
2678
  case "AAsmall":
2651
2679
  case "AAAlarge":
@@ -2660,17 +2688,17 @@ M.isReadable = function(i, e, t) {
2660
2688
  }
2661
2689
  return a;
2662
2690
  };
2663
- M.mostReadable = function(i, e, t) {
2691
+ T.mostReadable = function(i, e, t) {
2664
2692
  var s = null, n = 0, a, r, o, c;
2665
2693
  t = t || {}, r = t.includeFallbackColors, o = t.level, c = t.size;
2666
2694
  for (var h = 0; h < e.length; h++)
2667
- a = M.readability(i, e[h]), a > n && (n = a, s = M(e[h]));
2668
- return M.isReadable(i, s, {
2695
+ a = T.readability(i, e[h]), a > n && (n = a, s = T(e[h]));
2696
+ return T.isReadable(i, s, {
2669
2697
  level: o,
2670
2698
  size: c
2671
- }) || !r ? s : (t.includeFallbackColors = !1, M.mostReadable(i, ["#fff", "#000"], t));
2699
+ }) || !r ? s : (t.includeFallbackColors = !1, T.mostReadable(i, ["#fff", "#000"], t));
2672
2700
  };
2673
- var At = M.names = {
2701
+ var At = T.names = {
2674
2702
  aliceblue: "f0f8ff",
2675
2703
  antiquewhite: "faebd7",
2676
2704
  aqua: "0ff",
@@ -2820,14 +2848,14 @@ var At = M.names = {
2820
2848
  whitesmoke: "f5f5f5",
2821
2849
  yellow: "ff0",
2822
2850
  yellowgreen: "9acd32"
2823
- }, na = M.hexNames = aa(At);
2851
+ }, na = T.hexNames = aa(At);
2824
2852
  function aa(i) {
2825
2853
  var e = {};
2826
2854
  for (var t in i)
2827
2855
  i.hasOwnProperty(t) && (e[i[t]] = t);
2828
2856
  return e;
2829
2857
  }
2830
- function bi(i) {
2858
+ function yi(i) {
2831
2859
  return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
2832
2860
  }
2833
2861
  function R(i, e) {
@@ -2838,7 +2866,7 @@ function R(i, e) {
2838
2866
  function it(i) {
2839
2867
  return Math.min(1, Math.max(0, i));
2840
2868
  }
2841
- function Y(i) {
2869
+ function j(i) {
2842
2870
  return parseInt(i, 16);
2843
2871
  }
2844
2872
  function ra(i) {
@@ -2850,14 +2878,14 @@ function oa(i) {
2850
2878
  function K(i) {
2851
2879
  return i.length == 1 ? "0" + i : "" + i;
2852
2880
  }
2853
- function ke(i) {
2881
+ function De(i) {
2854
2882
  return i <= 1 && (i = i * 100 + "%"), i;
2855
2883
  }
2856
- function yi(i) {
2884
+ function wi(i) {
2857
2885
  return Math.round(parseFloat(i) * 255).toString(16);
2858
2886
  }
2859
- function ui(i) {
2860
- return Y(i) / 255;
2887
+ function fi(i) {
2888
+ return j(i) / 255;
2861
2889
  }
2862
2890
  var Q = function() {
2863
2891
  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*\\)?";
@@ -2920,26 +2948,26 @@ function la(i) {
2920
2948
  v: t[3],
2921
2949
  a: t[4]
2922
2950
  } : (t = Q.hex8.exec(i)) ? {
2923
- r: Y(t[1]),
2924
- g: Y(t[2]),
2925
- b: Y(t[3]),
2926
- a: ui(t[4]),
2951
+ r: j(t[1]),
2952
+ g: j(t[2]),
2953
+ b: j(t[3]),
2954
+ a: fi(t[4]),
2927
2955
  format: e ? "name" : "hex8"
2928
2956
  } : (t = Q.hex6.exec(i)) ? {
2929
- r: Y(t[1]),
2930
- g: Y(t[2]),
2931
- b: Y(t[3]),
2957
+ r: j(t[1]),
2958
+ g: j(t[2]),
2959
+ b: j(t[3]),
2932
2960
  format: e ? "name" : "hex"
2933
2961
  } : (t = Q.hex4.exec(i)) ? {
2934
- r: Y(t[1] + "" + t[1]),
2935
- g: Y(t[2] + "" + t[2]),
2936
- b: Y(t[3] + "" + t[3]),
2937
- a: ui(t[4] + "" + t[4]),
2962
+ r: j(t[1] + "" + t[1]),
2963
+ g: j(t[2] + "" + t[2]),
2964
+ b: j(t[3] + "" + t[3]),
2965
+ a: fi(t[4] + "" + t[4]),
2938
2966
  format: e ? "name" : "hex8"
2939
2967
  } : (t = Q.hex3.exec(i)) ? {
2940
- r: Y(t[1] + "" + t[1]),
2941
- g: Y(t[2] + "" + t[2]),
2942
- b: Y(t[3] + "" + t[3]),
2968
+ r: j(t[1] + "" + t[1]),
2969
+ g: j(t[2] + "" + t[2]),
2970
+ b: j(t[3] + "" + t[3]),
2943
2971
  format: e ? "name" : "hex"
2944
2972
  } : !1;
2945
2973
  }
@@ -2964,16 +2992,16 @@ function ha(i, e) {
2964
2992
  } = e;
2965
2993
  if (!r) return;
2966
2994
  const { trade: o } = a, c = 4;
2967
- t.forEach(({ isHovered: h, isActive: u, candle: g, trades: p }) => {
2968
- const _ = s.convert(g.open_time);
2969
- p.forEach((v) => {
2995
+ t.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
2996
+ const p = s.convert(g.open_time);
2997
+ _.forEach((v) => {
2970
2998
  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;
2971
- let S = b ? o.buyLabel.main : o.sellLabel.main;
2972
- h && h[1] && h[0] === v.type && (S = M.mix(S, a.bg, 20).toString()), u && u[1] && u[0] === v.type && (S = o.activeLabel), C(i, {
2973
- x: _,
2999
+ let M = b ? o.buyLabel.main : o.sellLabel.main;
3000
+ h && h[1] && h[0] === v.type && (M = T.mix(M, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (M = o.activeLabel), C(i, {
3001
+ x: p,
2974
3002
  y,
2975
3003
  symbol: x,
2976
- mainColor: S,
3004
+ mainColor: M,
2977
3005
  textColor: w,
2978
3006
  size: 16,
2979
3007
  fontSize: 12
@@ -2990,14 +3018,14 @@ function da(i, e) {
2990
3018
  colorScheme: { trade: h }
2991
3019
  } = e;
2992
3020
  if (a.length === 0) return;
2993
- const u = a.map((p) => p.candle).sort((p, _) => p.open_time.getTime() - _.open_time.getTime()), g = c.baseWidth / 2 * s + c.strokeWidth / 2;
3021
+ const d = a.map((_) => _.candle).sort((_, p) => _.open_time.getTime() - p.open_time.getTime()), g = c.baseWidth / 2 * s + c.strokeWidth / 2;
2994
3022
  if (i.save(), i.lineWidth = 1, i.strokeStyle = h.tradeBorders, o.length) {
2995
- const p = t.convert(u[0].open_time) - g;
2996
- i.beginPath(), i.moveTo(p, n.y), i.lineTo(p, n.y + n.height), i.stroke();
3023
+ const _ = t.convert(d[0].open_time) - g;
3024
+ i.beginPath(), i.moveTo(_, n.y), i.lineTo(_, n.y + n.height), i.stroke();
2997
3025
  }
2998
3026
  if (r.length) {
2999
- const p = t.convert(u[u.length - 1].open_time) + g;
3000
- i.beginPath(), i.moveTo(p, n.y), i.lineTo(p, n.y + n.height), i.stroke();
3027
+ const _ = t.convert(d[d.length - 1].open_time) + g;
3028
+ i.beginPath(), i.moveTo(_, n.y), i.lineTo(_, n.y + n.height), i.stroke();
3001
3029
  }
3002
3030
  i.restore();
3003
3031
  }
@@ -3012,29 +3040,29 @@ const ua = (i, e) => {
3012
3040
  } = e;
3013
3041
  if (i.save(), !c) return;
3014
3042
  const h = (g) => {
3015
- var p;
3016
- return (p = n.find(
3017
- (_) => g.getTime() >= _.candle.open_time.getTime() && g.getTime() < _.candle.close_time.getTime()
3018
- )) == null ? void 0 : p.candle;
3019
- }, u = (g, p) => {
3020
- const _ = h(g.time), v = h(p.time);
3021
- if (!_ || !v) return;
3022
- const b = t.convert(_.open_time), w = t.convert(v.open_time);
3043
+ var _;
3044
+ return (_ = n.find(
3045
+ (p) => g.getTime() >= p.candle.open_time.getTime() && g.getTime() < p.candle.close_time.getTime()
3046
+ )) == null ? void 0 : _.candle;
3047
+ }, d = (g, _) => {
3048
+ const p = h(g.time), v = h(_.time);
3049
+ if (!p || !v) return;
3050
+ const b = t.convert(p.open_time), w = t.convert(v.open_time);
3023
3051
  let x, y;
3024
- g.type === "buy" ? (x = s.convert(_.low), y = s.convert(v.high)) : (x = s.convert(_.high), y = s.convert(v.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.connectionLine, i.moveTo(b, x), i.lineTo(w, y), i.stroke(), i.setLineDash([]);
3052
+ g.type === "buy" ? (x = s.convert(p.low), y = s.convert(v.high)) : (x = s.convert(p.high), y = s.convert(v.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.connectionLine, i.moveTo(b, x), i.lineTo(w, y), i.stroke(), i.setLineDash([]);
3025
3053
  };
3026
3054
  if (a.length === 1 && r.length > 1)
3027
- r.forEach((g) => u(a[0], g));
3055
+ r.forEach((g) => d(a[0], g));
3028
3056
  else if (r.length === 1 && a.length > 1)
3029
- a.forEach((g) => u(g, r[0]));
3057
+ a.forEach((g) => d(g, r[0]));
3030
3058
  else if (a.length === 1 && r.length === 1)
3031
- u(a[0], r[0]);
3059
+ d(a[0], r[0]);
3032
3060
  else if (a.length > 0 && r.length > 0) {
3033
- const g = a.reduce((_, v) => _.time < v.time ? _ : v), p = r.reduce((_, v) => _.time > v.time ? _ : v);
3034
- u(g, p);
3061
+ const g = a.reduce((p, v) => p.time < v.time ? p : v), _ = r.reduce((p, v) => p.time > v.time ? p : v);
3062
+ d(g, _);
3035
3063
  }
3036
3064
  i.restore();
3037
- }, wi = (i, e) => {
3065
+ }, xi = (i, e) => {
3038
3066
  const {
3039
3067
  radius: t,
3040
3068
  coords: { x: s, y: n },
@@ -3070,8 +3098,8 @@ function ga(i) {
3070
3098
  }
3071
3099
  return s.length ? s.join(" ") : "0s";
3072
3100
  }
3073
- const ma = 10, _a = 6, pa = 4, va = 12, ba = (i, e) => {
3074
- var j;
3101
+ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
3102
+ var V;
3075
3103
  const {
3076
3104
  scales: { x: t, y: s },
3077
3105
  trade: { entries: n, exits: a, holdTime: r },
@@ -3079,33 +3107,33 @@ const ma = 10, _a = 6, pa = 4, va = 12, ba = (i, e) => {
3079
3107
  trade: { hold: o }
3080
3108
  },
3081
3109
  config: {
3082
- trade: { showHoldTime: c, holdTimeContent: h, holdTimeDates: u, holdTimePrice: g }
3110
+ trade: { showHoldTime: c, holdTimeContent: h, holdTimeDates: d, holdTimePrice: g }
3083
3111
  }
3084
3112
  } = e;
3085
3113
  if (!c) return;
3086
- const p = n.at(0), _ = a.at(-1);
3087
- if (!p || !_) return;
3088
- const v = (U) => U ? U instanceof Date ? U : new Date(U) : null, b = t.convert(v(u == null ? void 0 : u[0]) || p.candle.open_time), w = t.convert(v(u == null ? void 0 : u[1]) || _.candle.open_time), x = s.convert(g || (((j = n.at(0)) == null ? void 0 : j.price) ?? 0));
3114
+ const _ = n.at(0), p = a.at(-1);
3115
+ if (!_ || !p) return;
3116
+ const v = (Y) => Y ? Y instanceof Date ? Y : new Date(Y) : null, b = t.convert(v(d == null ? void 0 : d[0]) || _.candle.open_time), w = t.convert(v(d == null ? void 0 : d[1]) || p.candle.open_time), x = s.convert(g || (((V = n.at(0)) == null ? void 0 : V.price) ?? 0));
3089
3117
  i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(b, x), i.lineTo(w, x), i.stroke(), i.setLineDash([]);
3090
- const y = (b + w) / 2, C = h || `Hold: ${ga(r)}`, F = getComputedStyle(
3118
+ const y = (b + w) / 2, C = h || `Hold: ${ga(r)}`, S = getComputedStyle(
3091
3119
  document.querySelector(".sc-charts-cs") || document.body
3092
3120
  ).font.replace(/^\s*\S+/, "").trim();
3093
- i.font = `600 ${ma}px ${F}`;
3094
- const O = i.measureText(C).width + _a * 2, P = va + pa * 2;
3095
- wi(i, {
3121
+ i.font = `600 ${ma}px ${S}`;
3122
+ const $ = i.measureText(C).width + pa * 2, z = va + _a * 2;
3123
+ xi(i, {
3096
3124
  radius: 4,
3097
3125
  coords: {
3098
- x: y - O / 2,
3099
- y: x - P / 2
3126
+ x: y - $ / 2,
3127
+ y: x - z / 2
3100
3128
  },
3101
- width: O,
3102
- height: P,
3129
+ width: $,
3130
+ height: z,
3103
3131
  fillColor: o.main
3104
3132
  }), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C, y, x), i.restore();
3105
3133
  };
3106
3134
  class Ne {
3107
3135
  constructor(e, t, {
3108
- CanvasClass: s = Le,
3136
+ CanvasClass: s = Ee,
3109
3137
  noCanvas: n = !1,
3110
3138
  noDOM: a = !1
3111
3139
  } = {}) {
@@ -3135,22 +3163,22 @@ const ya = {
3135
3163
  offset: n = 8
3136
3164
  }) => {
3137
3165
  const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
3138
- const { dx: C, dy: S } = ya[y], F = t.x + (C === 1 ? n : -a - n), H = t.y + (S === 1 ? n : -r - n);
3139
- return { x: F, y: H, side: y };
3140
- }, u = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
3141
- const y = t.y < 0, C = t.y + r > c, S = t.x < 0, F = t.x + a > o;
3142
- return S && y ? "right-bottom" : S && C ? "right-top" : F && y ? "left-bottom" : F && C ? "left-top" : S ? "right-bottom" : F ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
3143
- }, _ = [
3166
+ const { dx: C, dy: M } = ya[y], S = t.x + (C === 1 ? n : -a - n), N = t.y + (M === 1 ? n : -r - n);
3167
+ return { x: S, y: N, side: y };
3168
+ }, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
3169
+ const y = t.y < 0, C = t.y + r > c, M = t.x < 0, S = t.x + a > o;
3170
+ return M && y ? "right-bottom" : M && C ? "right-top" : S && y ? "left-bottom" : S && C ? "left-top" : M ? "right-bottom" : S ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
3171
+ }, p = [
3144
3172
  s,
3145
3173
  "right-bottom",
3146
3174
  "right-top",
3147
3175
  "left-bottom",
3148
3176
  "left-top"
3149
- ].filter((y, C, S) => S.indexOf(y) === C), v = g();
3177
+ ].filter((y, C, M) => M.indexOf(y) === C), v = g();
3150
3178
  let b = null;
3151
- for (const y of [v, ..._]) {
3179
+ for (const y of [v, ...p]) {
3152
3180
  const C = h(y);
3153
- if (u(C)) {
3181
+ if (d(C)) {
3154
3182
  b = C;
3155
3183
  break;
3156
3184
  }
@@ -3215,7 +3243,7 @@ class wa extends se {
3215
3243
  }), this.oneBox = new k({
3216
3244
  tag: "div",
3217
3245
  className: this.clsx("box_one")
3218
- }), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: W.empty() };
3246
+ }), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() };
3219
3247
  }
3220
3248
  _createLineNodes(t, s) {
3221
3249
  const n = [];
@@ -3293,7 +3321,7 @@ class xa extends Ne {
3293
3321
  function Ca(i, { color: e = "#000000", lineWidth: t = 1, dashed: s, coords: n }) {
3294
3322
  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();
3295
3323
  }
3296
- const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3324
+ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ta = (i, e) => {
3297
3325
  const {
3298
3326
  coords: t,
3299
3327
  text: s,
@@ -3303,28 +3331,28 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3303
3331
  padding: o = { x: 0, y: 0 },
3304
3332
  borderRadius: c = 0,
3305
3333
  colors: h,
3306
- align: u = { x: "left", y: "top" }
3307
- } = e, g = { ...Aa, ...h }, _ = getComputedStyle(
3334
+ align: d = { x: "left", y: "top" }
3335
+ } = e, g = { ...Aa, ...h }, p = getComputedStyle(
3308
3336
  document.querySelector(".sc-charts-cs") || document.body
3309
3337
  ).font.replace(/^\s*\S+/, "").trim();
3310
- i.font = `${a} ${n}px ${_}`;
3338
+ i.font = `${a} ${n}px ${p}`;
3311
3339
  const b = i.measureText(s).width + o.x * 2, w = r + o.y * 2;
3312
3340
  let x = t.x, y = t.y;
3313
- u.x === "middle" ? x -= b / 2 : u.x === "right" && (x -= b), u.y === "middle" ? y -= w / 2 : u.y === "bottom" && (y -= w), wi(i, {
3341
+ d.x === "middle" ? x -= b / 2 : d.x === "right" && (x -= b), d.y === "middle" ? y -= w / 2 : d.y === "bottom" && (y -= w), xi(i, {
3314
3342
  radius: c,
3315
3343
  coords: { x, y },
3316
3344
  width: b,
3317
3345
  height: w,
3318
3346
  fillColor: g.bg
3319
3347
  }), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x + b / 2, y + w / 2);
3320
- }, fi = {
3348
+ }, gi = {
3321
3349
  line: "#000000",
3322
3350
  text: "#ffffff",
3323
3351
  main: "#000000"
3324
- }, xi = (i, { text: e, startLineCoords: t, side: s, colors: n = fi, dir: a = "h", endMarkerCoords: r }) => {
3352
+ }, Ci = (i, { text: e, startLineCoords: t, side: s, colors: n = gi, dir: a = "h", endMarkerCoords: r }) => {
3325
3353
  if (a === "h" && (s === "bottom" || s === "top"))
3326
3354
  throw new Error("[drawMarker util]: Incorrect side or dir for this marker");
3327
- const o = { ...fi, ...n };
3355
+ const o = { ...gi, ...n };
3328
3356
  i.save(), Ca(i, {
3329
3357
  color: o.line,
3330
3358
  lineWidth: 1,
@@ -3335,7 +3363,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3335
3363
  x2: r.x,
3336
3364
  y2: r.y
3337
3365
  }
3338
- }), Ma(i, {
3366
+ }), Ta(i, {
3339
3367
  text: e,
3340
3368
  coords: r,
3341
3369
  padding: { x: 6, y: 4 },
@@ -3352,17 +3380,17 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
3352
3380
  }
3353
3381
  }), i.restore();
3354
3382
  };
3355
- class Sa extends Le {
3383
+ class Ma extends Ee {
3356
3384
  constructor(e) {
3357
3385
  super(e);
3358
3386
  }
3359
3387
  drawMarker(e) {
3360
- xi(this.ctx, e);
3388
+ Ci(this.ctx, e);
3361
3389
  }
3362
3390
  }
3363
- class Ta extends Ne {
3391
+ class Sa extends Ne {
3364
3392
  constructor(e) {
3365
- if (super("user-markers", e, { CanvasClass: Sa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
3393
+ if (super("user-markers", e, { CanvasClass: Ma, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
3366
3394
  }
3367
3395
  render(e) {
3368
3396
  this.canvas.clear();
@@ -3390,18 +3418,18 @@ class Ta extends Ne {
3390
3418
  this.canvas.clear();
3391
3419
  }
3392
3420
  }
3393
- const ka = "sc-charts-cs";
3421
+ const Da = "sc-charts-cs";
3394
3422
  class ae {
3395
3423
  constructor(e) {
3396
3424
  f(this, "block");
3397
3425
  this.block = e;
3398
3426
  }
3399
3427
  gen(e) {
3400
- return `${ka}__${this.block}${e ? "-" + e : ""}`;
3428
+ return `${Da}__${this.block}${e ? "-" + e : ""}`;
3401
3429
  }
3402
3430
  }
3403
3431
  const yt = new ae("comment-actions");
3404
- class Da extends k {
3432
+ class ka extends k {
3405
3433
  constructor({ onDelete: e, onUpdate: t }) {
3406
3434
  super({ className: yt.gen() });
3407
3435
  const s = new k({ tag: "button", className: yt.gen("edit"), textContent: "Edit" }), n = new k({
@@ -3416,7 +3444,7 @@ class Da extends k {
3416
3444
  }), this.append(s.node, n.node);
3417
3445
  }
3418
3446
  }
3419
- function Dt(i, e) {
3447
+ function Lt(i, e) {
3420
3448
  var n;
3421
3449
  const t = (a) => {
3422
3450
  if (!document.contains(i.node)) return;
@@ -3433,7 +3461,7 @@ function Dt(i, e) {
3433
3461
  document.removeEventListener("mousedown", t), s == null || s();
3434
3462
  }, i;
3435
3463
  }
3436
- class Ea {
3464
+ class La {
3437
3465
  constructor() {
3438
3466
  f(this, "node");
3439
3467
  const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
@@ -3471,31 +3499,31 @@ class Ea {
3471
3499
  this.node = t;
3472
3500
  }
3473
3501
  }
3474
- const Se = new ae("comment-list");
3475
- class La extends k {
3502
+ const Me = new ae("comment-list");
3503
+ class Ea extends k {
3476
3504
  constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
3477
- super({ className: Se.gen("item") });
3505
+ super({ className: Me.gen("item") });
3478
3506
  f(this, "actionTooltip");
3479
3507
  f(this, "actionsTrigger");
3480
- const r = new k({ className: Se.gen("text"), textContent: n.text }), o = new k({
3481
- className: Se.gen("created-at"),
3508
+ const r = new k({ className: Me.gen("text"), textContent: n.text }), o = new k({
3509
+ className: Me.gen("created-at"),
3482
3510
  textContent: fa(new Date(n.createdAt))
3483
3511
  });
3484
3512
  this.actionsTrigger = new k({
3485
3513
  tag: "button",
3486
- className: Se.gen("action-trigger")
3514
+ className: Me.gen("action-trigger")
3487
3515
  });
3488
- const c = new Da({
3516
+ const c = new ka({
3489
3517
  onDelete: t,
3490
3518
  onUpdate: s
3491
3519
  });
3492
- this.actionTooltip = Dt(c, () => {
3520
+ this.actionTooltip = Lt(c, () => {
3493
3521
  this.actionTooltip.setVisible(!1);
3494
3522
  }), this.actionsTrigger.node.addEventListener("click", () => {
3495
3523
  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);
3496
3524
  });
3497
- const h = new k({ className: Se.gen("text-wrap") });
3498
- 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);
3525
+ const h = new k({ className: Me.gen("text-wrap") });
3526
+ 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);
3499
3527
  }
3500
3528
  }
3501
3529
  class Na {
@@ -3580,7 +3608,7 @@ class Ia extends se {
3580
3608
  },
3581
3609
  initialValue: t.text
3582
3610
  });
3583
- const s = new La({
3611
+ const s = new Ea({
3584
3612
  onDelete: () => {
3585
3613
  this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
3586
3614
  },
@@ -3609,7 +3637,7 @@ class Ra {
3609
3637
  }
3610
3638
  }
3611
3639
  const Je = new ae(""), wt = new ae("add-field");
3612
- class Ci extends se {
3640
+ class Ai extends se {
3613
3641
  constructor({ onAdd: t, blockName: s }) {
3614
3642
  Je.block = s;
3615
3643
  super({ className: Je.gen() + " " + wt.gen() });
@@ -3650,7 +3678,7 @@ class Oa extends se {
3650
3678
  f(this, "_size", null);
3651
3679
  f(this, "_model");
3652
3680
  f(this, "_prevIsShow", !1);
3653
- this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Ci({
3681
+ this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Ai({
3654
3682
  blockName: "list-tooltip-add",
3655
3683
  onAdd: (a) => {
3656
3684
  const r = t[0].date, o = t[0].price, c = {
@@ -3703,10 +3731,10 @@ class za extends se {
3703
3731
  this.node.style.backgroundColor = this._colors[`bg${a}`], this.node.style.color = this._colors[`icon${a}`];
3704
3732
  }
3705
3733
  }
3706
- const gi = new ae("comment-box");
3734
+ const mi = new ae("comment-box");
3707
3735
  class Va extends se {
3708
3736
  constructor({ boxId: t, model: s, view: n, comments: a, coords: r, onBoxActivate: o, onBoxDeactivate: c }) {
3709
- super({ className: gi.gen() });
3737
+ super({ className: mi.gen() });
3710
3738
  f(this, "pointer", new k({ className: "sc-charts-cs__comments-pointer" }));
3711
3739
  f(this, "tooltip");
3712
3740
  f(this, "anchor");
@@ -3717,10 +3745,10 @@ class Va extends se {
3717
3745
  isActive: !1,
3718
3746
  comments: a,
3719
3747
  coords: r
3720
- }, this.pointer.position(r), this.anchor = new za({ x: r.x, className: gi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
3748
+ }, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
3721
3749
  const h = !this.state.isActive;
3722
3750
  h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
3723
- }), this.tooltip = Dt(new Oa(a, s, n), (h) => {
3751
+ }), this.tooltip = Lt(new Oa(a, s, n), (h) => {
3724
3752
  this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
3725
3753
  }), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
3726
3754
  }
@@ -3731,8 +3759,8 @@ class Va extends se {
3731
3759
  }
3732
3760
  class Ya {
3733
3761
  static animateTo(e, t, s, n) {
3734
- const a = e.scales.panOffsetX + (e.layout.area.width / 2 - t), r = e.scales.panOffsetY + (e.layout.area.height / 2 - s), o = 300, c = performance.now(), h = e.scales.panOffsetX, u = e.scales.panOffsetY, g = (p) => {
3735
- const _ = p - c, v = Math.min(_ / o, 1), b = v * v * (3 - 2 * v), w = h + (a - h) * b, x = u + (r - u) * b;
3762
+ const a = e.scales.panOffsetX + (e.layout.area.width / 2 - t), r = e.scales.panOffsetY + (e.layout.area.height / 2 - s), o = 300, c = performance.now(), h = e.scales.panOffsetX, d = e.scales.panOffsetY, g = (_) => {
3763
+ const p = _ - c, v = Math.min(p / o, 1), b = v * v * (3 - 2 * v), w = h + (a - h) * b, x = d + (r - d) * b;
3736
3764
  e.scales.pan("x", w, "absolute"), e.scales.pan("y", x, "absolute"), v < 1 ? requestAnimationFrame(g) : n == null || n();
3737
3765
  };
3738
3766
  requestAnimationFrame(g);
@@ -3752,9 +3780,9 @@ class Wa extends se {
3752
3780
  f(this, "_size", null);
3753
3781
  f(this, "_model", null);
3754
3782
  f(this, "_candle", null);
3755
- this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Dt(this.menu, () => {
3783
+ 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, () => {
3756
3784
  this.setState({ isShow: !1 });
3757
- }), this.addField = new Ci({
3785
+ }), this.addField = new Ai({
3758
3786
  blockName: "context-add",
3759
3787
  onAdd: (t) => {
3760
3788
  !this._model || !this._candle || (this._model.comments.add({
@@ -3829,12 +3857,12 @@ class ja extends Ne {
3829
3857
  });
3830
3858
  }
3831
3859
  }
3832
- class Xa extends Le {
3860
+ class Xa extends Ee {
3833
3861
  constructor(e) {
3834
3862
  super(e);
3835
3863
  }
3836
3864
  drawMarker({ text: e, startLineCoords: t, endMarkerCoords: s, colors: n, type: a, side: r }) {
3837
- xi(this.ctx, {
3865
+ Ci(this.ctx, {
3838
3866
  text: e,
3839
3867
  colors: n,
3840
3868
  startLineCoords: t,
@@ -3863,7 +3891,7 @@ class Ua extends Ne {
3863
3891
  if (e.config.guides.isShowX) {
3864
3892
  const n = e.config.xAxis.position;
3865
3893
  this.canvas.drawMarker({
3866
- text: D.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
3894
+ text: L.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
3867
3895
  startLineCoords: { x: t, y: 0 },
3868
3896
  endMarkerCoords: { x: t, y: e.layout.xAxis[n] },
3869
3897
  side: n,
@@ -3878,7 +3906,7 @@ class Ga extends se {
3878
3906
  super({ className: t });
3879
3907
  f(this, "_isFirstShow", !1);
3880
3908
  const s = new k({ tag: "p" });
3881
- s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: W.empty() }, this.render();
3909
+ s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() }, this.render();
3882
3910
  }
3883
3911
  render() {
3884
3912
  const { isShow: t, x: s, y: n, parent: a } = this.state;
@@ -3891,7 +3919,7 @@ class Ga extends se {
3891
3919
  this.position(r.x, r.y);
3892
3920
  }
3893
3921
  }
3894
- class Za extends Le {
3922
+ class Za extends Ee {
3895
3923
  constructor(t) {
3896
3924
  super(t);
3897
3925
  f(this, "domain", null);
@@ -3903,8 +3931,8 @@ class Za extends Le {
3903
3931
  }
3904
3932
  drawSingleCandle({ x: t, y: s, strokeWidth: n, width: a, colors: r, isDim: o }) {
3905
3933
  this.ctx.fillStyle = this._mix(r.fill, r.bg, o), this.ctx.strokeStyle = this._mix(r.stroke, r.bg, o), this.ctx.lineWidth = n, this.ctx.beginPath(), this.ctx.moveTo(t, s.high), this.ctx.lineTo(t, s.low), this.ctx.stroke();
3906
- const c = Math.min(s.open, s.close), h = Math.abs(s.close - s.open), u = t - a / 2;
3907
- this.ctx.fillRect(u, c, a, h), this.ctx.strokeRect(u, c, a, h);
3934
+ const c = Math.min(s.open, s.close), h = Math.abs(s.close - s.open), d = t - a / 2;
3935
+ this.ctx.fillRect(d, c, a, h), this.ctx.strokeRect(d, c, a, h);
3908
3936
  }
3909
3937
  drawCandles(t) {
3910
3938
  const {
@@ -3915,23 +3943,23 @@ class Za extends Le {
3915
3943
  candles: { hideMissingData: c }
3916
3944
  }
3917
3945
  } = t, h = t.config.candles.style === "filled";
3918
- this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((u, g) => {
3919
- const p = s.noDataFill[g % s.noDataFill.length], _ = h ? p : s.noDataStroke;
3946
+ this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((d, g) => {
3947
+ const _ = s.noDataFill[g % s.noDataFill.length], p = h ? _ : s.noDataStroke;
3920
3948
  this.drawSingleCandle({
3921
- ...this._getBasicCandleProps(t, u),
3922
- colors: { fill: p, stroke: _, bg: n }
3949
+ ...this._getBasicCandleProps(t, d),
3950
+ colors: { fill: _, stroke: p, bg: n }
3923
3951
  });
3924
- }), this._getVisible(o).forEach((u) => {
3925
- const g = u.close >= u.open ? "rising" : "falling", p = s[`${g}Fill`], _ = s[`${g}${h ? "Fill" : "Stroke"}`];
3952
+ }), this._getVisible(o).forEach((d) => {
3953
+ const g = d.close >= d.open ? "rising" : "falling", _ = s[`${g}Fill`], p = s[`${g}${h ? "Fill" : "Stroke"}`];
3926
3954
  this.drawSingleCandle({
3927
- ...this._getBasicCandleProps(t, u),
3928
- colors: { fill: p, stroke: _, bg: n },
3929
- isDim: !!(a.length && !a.includes(u.open_time.getTime()))
3955
+ ...this._getBasicCandleProps(t, d),
3956
+ colors: { fill: _, stroke: p, bg: n },
3957
+ isDim: !!(a.length && !a.includes(d.open_time.getTime()))
3930
3958
  });
3931
3959
  });
3932
3960
  }
3933
3961
  _mix(t, s, n) {
3934
- return n ? M.mix(t, s).toString() : t;
3962
+ return n ? T.mix(t, s).toString() : t;
3935
3963
  }
3936
3964
  _getBasicCandleProps(t, s) {
3937
3965
  return {
@@ -3989,12 +4017,12 @@ class Ja {
3989
4017
  f(this, "candles");
3990
4018
  this.container = e, this.wrapper = new k({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
3991
4019
  const { width: t, height: s } = e.getBoundingClientRect();
3992
- this.width = t, this.height = s, this.mainCanvas = new Le({
4020
+ this.width = t, this.height = s, this.mainCanvas = new Ee({
3993
4021
  className: "sc-charts-cs__canvas-main",
3994
4022
  width: t,
3995
4023
  height: s,
3996
4024
  isMain: !0
3997
- }), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new Ta(this);
4025
+ }), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new Sa(this);
3998
4026
  }
3999
4027
  renderAll(e) {
4000
4028
  this.mainCanvas.clear(), this.candles.render(e), bt.xAxis(this.mainCanvas.ctx, e), bt.yAxis(this.mainCanvas.ctx, e), bt.intersection(this.mainCanvas.ctx, e), this.trade.renderAll(e), this.userMarkers.render(e), this.comments.render(e);
@@ -4085,7 +4113,7 @@ class Ka {
4085
4113
  });
4086
4114
  }
4087
4115
  }
4088
- class mi {
4116
+ class pi {
4089
4117
  constructor() {
4090
4118
  f(this, "_map", /* @__PURE__ */ new Map());
4091
4119
  }
@@ -4119,7 +4147,7 @@ class mi {
4119
4147
  class er {
4120
4148
  constructor() {
4121
4149
  f(this, "_elements", []);
4122
- f(this, "_listeners", new mi());
4150
+ f(this, "_listeners", new pi());
4123
4151
  f(this, "_lastHovered", /* @__PURE__ */ new Set());
4124
4152
  f(this, "_dragContext", null);
4125
4153
  }
@@ -4133,7 +4161,7 @@ class er {
4133
4161
  this._elements = this._elements.filter((t) => t !== e), this._listeners.removeAll(e), this._lastHovered.delete(e);
4134
4162
  }
4135
4163
  clear() {
4136
- this._elements = [], this._listeners = new mi(), this._lastHovered.clear();
4164
+ this._elements = [], this._listeners = new pi(), this._lastHovered.clear();
4137
4165
  }
4138
4166
  on(e, t, s) {
4139
4167
  this._listeners.add(e, t, s);
@@ -4275,8 +4303,8 @@ class tr {
4275
4303
  }
4276
4304
  } = this.model;
4277
4305
  for (const o of s) {
4278
- const c = n.convert(o.open_time), h = a.convert(o.high), u = a.convert(o.low), g = c - r / 2, p = c + r / 2, _ = Math.min(h, u), v = Math.max(h, u);
4279
- if (e >= g && e <= p && t >= _ && t <= v)
4306
+ const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, _ = c + r / 2, p = Math.min(h, d), v = Math.max(h, d);
4307
+ if (e >= g && e <= _ && t >= p && t <= v)
4280
4308
  return {
4281
4309
  target: this,
4282
4310
  x: e,
@@ -4313,11 +4341,11 @@ class sr {
4313
4341
  hitTest(e, t) {
4314
4342
  const { tradedCandles: s } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, o = 4;
4315
4343
  for (const { candle: c, trades: h } of s) {
4316
- const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, p = r, _ = r;
4344
+ const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = r, p = r;
4317
4345
  for (const v of ["buy", "sell"]) {
4318
4346
  const b = h.filter((C) => C.type === v);
4319
4347
  if (!b.length) continue;
4320
- const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g - p / 2 && e <= g + p / 2, y = t >= w && t <= w + _;
4348
+ const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g - _ / 2 && e <= g + _ / 2, y = t >= w && t <= w + p;
4321
4349
  if (x && y)
4322
4350
  return {
4323
4351
  target: this,
@@ -4423,11 +4451,11 @@ function cr(i, e) {
4423
4451
  }));
4424
4452
  };
4425
4453
  }
4426
- function Mt(i, e) {
4454
+ function Tt(i, e) {
4427
4455
  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;
4428
4456
  r > 0 && i.scales.pan("x", -r);
4429
4457
  }
4430
- function St(i) {
4458
+ function Mt(i) {
4431
4459
  return i.candles.limiter.absolutePosition.width > 0;
4432
4460
  }
4433
4461
  class Et {
@@ -4447,7 +4475,7 @@ class hr extends Et {
4447
4475
  register() {
4448
4476
  this._hitManager.on(this._hit, "drag", (t) => {
4449
4477
  const s = t.x - (t.prevX ?? t.x);
4450
- this._model.scales.scale("x", -s), this._view && St(this._view) && Mt(this._model, this._view);
4478
+ this._model.scales.scale("x", -s), this._view && Mt(this._view) && Tt(this._model, this._view);
4451
4479
  }), this._hitManager.on(this._hit, "dblclick", () => {
4452
4480
  this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
4453
4481
  });
@@ -4485,16 +4513,16 @@ class ur extends Et {
4485
4513
  this._hit,
4486
4514
  "drag",
4487
4515
  cr(1, (t) => {
4488
- 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 });
4516
+ this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), Mt(this._view) && Tt(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 });
4489
4517
  })
4490
4518
  ), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
4491
- const s = this._model.scales.x.invert(t), n = Tt.findByDate(s, this._model.candles.allData);
4519
+ const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
4492
4520
  n && (this._view.comments.contextMenu.setState({ isShow: !0, candle: n }), this._view.comments.render(this._model));
4493
4521
  }), this._hitManager.on(this._hit, "wheel", (t) => {
4494
4522
  var a, r;
4495
4523
  if (!t.deltaY) return;
4496
4524
  const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
4497
- ["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);
4525
+ ["x", "both"].includes(n) && (this._model.scales.scale("x", s), Mt(this._view) && Tt(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
4498
4526
  });
4499
4527
  }
4500
4528
  }
@@ -4579,14 +4607,14 @@ class gr {
4579
4607
  e.preventDefault(), this._hitManager.dispatchWheel(e.offsetX, e.offsetY, e.deltaX, e.deltaY, e.deltaZ);
4580
4608
  }
4581
4609
  }
4582
- class pr {
4610
+ class _r {
4583
4611
  constructor(e, { chartId: t, candles: s, config: n, trade: a, userMarkers: r, colorScheme: o, comments: c, renderLimiter: h }) {
4584
4612
  f(this, "_model");
4585
4613
  f(this, "_view");
4586
4614
  f(this, "_controller");
4587
4615
  f(this, "_candlesLimiterClean");
4588
- const u = document.querySelector(e);
4589
- if (!u) throw new Error(`Element with selector "${e}" not found!`);
4616
+ const d = document.querySelector(e);
4617
+ if (!d) throw new Error(`Element with selector "${e}" not found!`);
4590
4618
  if (!t || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(t))
4591
4619
  throw new Error(
4592
4620
  "chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
@@ -4595,12 +4623,12 @@ class pr {
4595
4623
  chartId: t,
4596
4624
  candles: s,
4597
4625
  config: n,
4598
- container: u,
4626
+ container: d,
4599
4627
  trade: a,
4600
4628
  userMarkers: r,
4601
4629
  colorScheme: o,
4602
4630
  comments: c
4603
- }), this._view = new Ja(u), this._controller = new gr(this._model, this._view), h) {
4631
+ }), this._view = new Ja(d), this._controller = new gr(this._model, this._view), h) {
4604
4632
  const g = h(this._view.candles.limiter.node);
4605
4633
  this._view.candles.limiter.updateAbsolutePosition(), typeof g == "function" && (this._candlesLimiterClean = g);
4606
4634
  }
@@ -4631,7 +4659,7 @@ class pr {
4631
4659
  async _drawHeader(e, t, s, n = !1) {
4632
4660
  const a = 48 * s, r = 12 * s, o = 20 * s, c = 103 * s;
4633
4661
  e.fillStyle = n ? "#101011" : "#FFFFFF", e.fillRect(0, 0, t, a), e.strokeStyle = n ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * s, e.beginPath(), e.moveTo(0, a), e.lineTo(t, a), e.stroke();
4634
- const h = n ? "#FFFFFF" : "#1C2026", u = `<svg width="103" height="20" viewBox="0 0 103 20" fill="none" xmlns="http://www.w3.org/2000/svg">
4662
+ const h = n ? "#FFFFFF" : "#1C2026", d = `<svg width="103" height="20" viewBox="0 0 103 20" fill="none" xmlns="http://www.w3.org/2000/svg">
4635
4663
  <path d="M92.6267 1.50666H93.0475C93.3792 1.50666 93.6025 1.31028 93.6025 1.02537C93.6025 0.740457 93.4034 0.561783 93.0426 0.561783C92.706 0.561783 92.4827 0.759773 92.4633 1.06239H91.795C91.8209 0.423351 92.3225 0.00805664 93.075 0.00805664C93.8274 0.00805664 94.2886 0.376671 94.2886 0.928788C94.2886 1.35213 93.9973 1.65797 93.5717 1.73523V1.74972C94.0895 1.79318 94.4229 2.10385 94.4229 2.58192C94.4229 3.20164 93.8581 3.61372 93.0572 3.61372C92.2562 3.61372 91.761 3.18555 91.7271 2.54973H92.4212C92.4423 2.84108 92.6834 3.03263 93.0652 3.03263C93.4471 3.03263 93.6834 2.82981 93.6834 2.53685C93.6834 2.22135 93.4455 2.0298 93.0539 2.0298H92.6251V1.50827L92.6267 1.50666Z" fill="${h}"/>
4636
4664
  <path d="M95.1182 2.97623C94.9256 2.68488 94.8269 2.29373 94.8269 1.83498C94.8269 0.692113 95.3852 0.00317383 96.2816 0.00317383C96.9434 0.00317383 97.4596 0.392714 97.5567 0.957708H96.8431C96.7735 0.727525 96.5502 0.574607 96.2784 0.574607C95.7945 0.574607 95.5017 1.03658 95.5178 1.81566H95.5324C95.6716 1.47763 96.013 1.25389 96.4564 1.25389C97.1149 1.25389 97.6036 1.73679 97.6036 2.39192C97.6036 3.10179 97.0486 3.61205 96.2719 3.61205C95.7735 3.61205 95.3625 3.3867 95.1198 2.97623H95.1182ZM96.8949 2.41446C96.8949 2.05872 96.6279 1.79796 96.2654 1.79796C95.903 1.79796 95.6311 2.05872 95.6311 2.40802C95.6311 2.75732 95.9078 3.0374 96.2638 3.0374C96.6198 3.0374 96.8965 2.76215 96.8965 2.41607L96.8949 2.41446Z" fill="${h}"/>
4637
4665
  <path d="M97.998 1.79961C97.998 0.68411 98.5336 0 99.4026 0C100.272 0 100.804 0.6825 100.804 1.79639C100.804 2.91028 100.275 3.60727 99.4026 3.60727C98.5304 3.60727 97.998 2.91672 97.998 1.798V1.79961ZM100.066 1.79961C100.066 1.01892 99.8136 0.579481 99.4026 0.579481C98.9916 0.579481 98.7359 1.02214 98.7359 1.79961C98.7359 2.57708 98.9883 3.0294 99.4026 3.0294C99.8168 3.0294 100.066 2.58674 100.066 1.79961Z" fill="${h}"/>
@@ -4643,15 +4671,15 @@ class pr {
4643
4671
  <path d="M62.7358 0.0372542C60.1921 0.0372542 58.1743 0.925792 56.7875 2.29562C56.4283 1.16563 55.4364 0.462207 54.0917 0.462207H52.2471V3.14875H53.951V20.0004H56.9364V12.8792C58.3151 14.1782 60.273 15.0233 62.739 15.0233C67.485 15.0233 70.7536 11.9408 70.7536 7.5013C70.7536 3.06182 67.4802 0.0356445 62.7342 0.0356445L62.7358 0.0372542ZM62.3652 12.2756C59.1241 12.2756 56.9364 10.3247 56.9364 7.4691C56.9364 4.61355 59.1241 2.7753 62.3652 2.7753C65.6064 2.7753 67.7099 4.66989 67.7099 7.4691C67.7067 10.3311 65.464 12.2756 62.3652 12.2756Z" fill="${h}"/>
4644
4672
  </svg>`;
4645
4673
  try {
4646
- const g = await this._loadSvgAsImage(u);
4674
+ const g = await this._loadSvgAsImage(d);
4647
4675
  g && e.drawImage(g, r, (a - o) / 2, c, o);
4648
4676
  } catch (g) {
4649
4677
  console.warn("Failed to load logo SVG:", g);
4650
4678
  }
4651
4679
  }
4652
4680
  _drawHeaderSecondLine(e, t, s, n, a, r, o = !1) {
4653
- const c = 20 * r, h = 12 * r, u = 8 * r;
4654
- e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, a, n, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, a + c), e.lineTo(n, a + c), e.stroke(), e.fillStyle = o ? "#C3C3C5" : "#1C2026", e.font = `500 ${u}px Geist, Arial, sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
4681
+ const c = 20 * r, h = 12 * r, d = 8 * r;
4682
+ e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, a, n, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, a + c), e.lineTo(n, a + c), e.stroke(), e.fillStyle = o ? "#C3C3C5" : "#1C2026", e.font = `500 ${d}px Geist, Arial, sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
4655
4683
  const g = t ? `${t} created with Scope360, ${s}` : `Scope360, ${s}`;
4656
4684
  e.fillText(g, h, a + c / 2);
4657
4685
  }
@@ -4666,24 +4694,24 @@ class pr {
4666
4694
  });
4667
4695
  }
4668
4696
  _drawFooter(e, t, s, n, a, r, o = !1) {
4669
- const c = 32 * r, h = 12 * r, u = 12 * r, g = 4 * r, p = n + a;
4670
- e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, p, s, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, p), e.lineTo(s, p), e.stroke(), e.textBaseline = "middle", e.textAlign = "left";
4671
- const _ = [];
4672
- if (t.pair && _.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
4697
+ const c = 32 * r, h = 12 * r, d = 12 * r, g = 4 * r, _ = n + a;
4698
+ e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, _, s, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, _), e.lineTo(s, _), e.stroke(), e.textBaseline = "middle", e.textAlign = "left";
4699
+ const p = [];
4700
+ if (t.pair && p.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
4673
4701
  const C = t.net_pnl.startsWith("+");
4674
- _.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
4702
+ p.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
4675
4703
  }
4676
- 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 });
4677
- const v = p + c / 2, b = 24 * r;
4678
- if (_.length === 0) return;
4679
- e.font = `500 ${u}px Geist, Arial, sans-serif`;
4704
+ t.type && p.push({ label: "Type", value: t.type }), t.entry_price && p.push({ label: "Entry", value: t.entry_price }), t.exit_price && p.push({ label: "Exit", value: t.exit_price }), t.open_date && p.push({ label: "Open date", value: t.open_date }), t.close_date && p.push({ label: "Close date", value: t.close_date }), t.holdtime && p.push({ label: "Holdtime", value: t.holdtime }), t.rr && p.push({ label: "RR", value: t.rr }), t.volume && p.push({ label: "Volume", value: t.volume });
4705
+ const v = _ + c / 2, b = 24 * r;
4706
+ if (p.length === 0) return;
4707
+ e.font = `500 ${d}px Geist, Arial, sans-serif`;
4680
4708
  const w = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
4681
4709
  let y = h;
4682
- _.forEach((C) => {
4683
- const S = e.measureText(C.label).width, F = e.measureText(C.value).width, H = S + g + F;
4684
- e.fillStyle = w, e.font = `500 ${u}px Geist, Arial, sans-serif`, e.fillText(C.label, y, v);
4685
- const O = y + S + g;
4686
- e.fillStyle = C.valueColor || x, e.font = `500 ${u}px Geist, Arial, sans-serif`, e.fillText(C.value, O, v), y += H + b;
4710
+ p.forEach((C) => {
4711
+ const M = e.measureText(C.label).width, S = e.measureText(C.value).width, N = M + g + S;
4712
+ e.fillStyle = w, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.label, y, v);
4713
+ const $ = y + M + g;
4714
+ e.fillStyle = C.valueColor || x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.value, $, v), y += N + b;
4687
4715
  });
4688
4716
  }
4689
4717
  async captureScreenshot(e = {}) {
@@ -4694,43 +4722,43 @@ class pr {
4694
4722
  hour: "2-digit",
4695
4723
  minute: "2-digit",
4696
4724
  timeZoneName: "short"
4697
- }), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, u = a.download || !1, { canvasesContainer: g, width: p, height: _ } = this._view, v = Array.from(
4725
+ }), 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: _, height: p } = this._view, v = Array.from(
4698
4726
  g.node.querySelectorAll("canvas")
4699
4727
  );
4700
4728
  if (v.length === 0) {
4701
4729
  console.warn("No canvas elements found for screenshot");
4702
4730
  return;
4703
4731
  }
4704
- const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, S = w - x - y - C, F = b, H = p / _, O = F / S;
4705
- let P, j, U = 0, re = 0;
4706
- H > O ? (j = S, P = j * H, U = 0, re = 0) : (P = F, j = P / H, re = (S - j) / 2);
4707
- const z = window.devicePixelRatio || 1, X = document.createElement("canvas");
4708
- X.width = b * z, X.height = w * z;
4709
- const G = X.getContext("2d");
4732
+ const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, M = w - x - y - C, S = b, N = _ / p, $ = S / M;
4733
+ let z, V, Y = 0, re = 0;
4734
+ N > $ ? (V = M, z = V * N, Y = 0, re = 0) : (z = S, V = z / N, re = (M - V) / 2);
4735
+ const P = window.devicePixelRatio || 1, U = document.createElement("canvas");
4736
+ U.width = b * P, U.height = w * P;
4737
+ const G = U.getContext("2d");
4710
4738
  if (!G) {
4711
4739
  console.error("Failed to get 2D context for merged canvas");
4712
4740
  return;
4713
4741
  }
4714
- G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, X.width, X.height);
4715
- const Fe = x * z, st = y * z, oe = S * z, ve = F * z, be = Fe + st;
4716
- await this._drawHeader(G, X.width, z, h), this._drawHeaderSecondLine(G, r, o, X.width, Fe, z, h);
4742
+ G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, U.width, U.height);
4743
+ const Fe = x * P, st = y * P, oe = M * P, ve = S * P, be = Fe + st;
4744
+ await this._drawHeader(G, U.width, P, h), this._drawHeaderSecondLine(G, r, o, U.width, Fe, P, h);
4717
4745
  const He = this._view.mainCanvas;
4718
- He.background && (G.fillStyle = He.background, G.fillRect(0, be, X.width, oe));
4719
- const Be = P * z, Ie = j * z, L = U * z, Re = re * z;
4720
- v.forEach(($) => {
4721
- let ee = 0, Z = 0, q = $.width, ge = $.height, ye = Be, we = Ie, Oe = L, Pe = Re;
4722
- if (H > O) {
4723
- const le = Ie / $.height, ce = $.width * le;
4724
- ce > ve && (ee = (ce - ve) / le, q = $.width - ee, ye = ve, Oe = 0);
4746
+ He.background && (G.fillStyle = He.background, G.fillRect(0, be, U.width, oe));
4747
+ const Be = z * P, Ie = V * P, F = Y * P, Re = re * P;
4748
+ v.forEach((O) => {
4749
+ let ee = 0, Z = 0, q = O.width, ge = O.height, ye = Be, we = Ie, Oe = F, Pe = Re;
4750
+ if (N > $) {
4751
+ const le = Ie / O.height, ce = O.width * le;
4752
+ ce > ve && (ee = (ce - ve) / le, q = O.width - ee, ye = ve, Oe = 0);
4725
4753
  } else {
4726
- const le = Be / $.width, ce = $.height * le;
4754
+ const le = Be / O.width, ce = O.height * le;
4727
4755
  if (ce > oe) {
4728
4756
  const xe = (ce - oe) / le;
4729
- Z = xe / 2, ge = $.height - xe, we = oe, Pe = 0;
4757
+ Z = xe / 2, ge = O.height - xe, we = oe, Pe = 0;
4730
4758
  }
4731
4759
  }
4732
4760
  G.drawImage(
4733
- $,
4761
+ O,
4734
4762
  ee,
4735
4763
  Z,
4736
4764
  q,
@@ -4740,28 +4768,28 @@ class pr {
4740
4768
  ye,
4741
4769
  we
4742
4770
  );
4743
- }), c && this._drawFooter(G, c, X.width, be, oe, z, h);
4744
- const $e = ($, ee) => {
4745
- const Z = URL.createObjectURL($), q = document.createElement("a");
4771
+ }), c && this._drawFooter(G, c, U.width, be, oe, P, h);
4772
+ const $e = (O, ee) => {
4773
+ const Z = URL.createObjectURL(O), q = document.createElement("a");
4746
4774
  q.href = Z, q.download = ee, document.body.appendChild(q), q.click(), document.body.removeChild(q), URL.revokeObjectURL(Z);
4747
4775
  };
4748
- X.toBlob(
4749
- async ($) => {
4750
- if (!$) {
4776
+ U.toBlob(
4777
+ async (O) => {
4778
+ if (!O) {
4751
4779
  console.error("Failed to create blob from canvas");
4752
4780
  return;
4753
4781
  }
4754
- if (u)
4755
- $e($, t);
4782
+ if (d)
4783
+ $e(O, t);
4756
4784
  else
4757
4785
  try {
4758
4786
  await navigator.clipboard.write([
4759
4787
  new ClipboardItem({
4760
- "image/png": $
4788
+ "image/png": O
4761
4789
  })
4762
4790
  ]);
4763
4791
  } catch (ee) {
4764
- console.error("Failed to copy to clipboard:", ee), $e($, t);
4792
+ console.error("Failed to copy to clipboard:", ee), $e(O, t);
4765
4793
  }
4766
4794
  },
4767
4795
  "image/png",
@@ -4770,7 +4798,7 @@ class pr {
4770
4798
  }
4771
4799
  }
4772
4800
  export {
4773
- pr as CandlestickChart,
4774
- _r as createLineChart
4801
+ _r as CandlestickChart,
4802
+ pr as createLineChart
4775
4803
  };
4776
4804
  //# sourceMappingURL=charts-core.js.map