charts-core 1.1.25 → 1.1.27
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.
- package/dist/charts-core.js +524 -452
- package/dist/charts-core.js.map +1 -1
- package/dist/charts-core.umd.cjs +3 -3
- package/dist/charts-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/charts-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (i, e, t) =>
|
|
1
|
+
var Fs = Object.defineProperty;
|
|
2
|
+
var Ns = (i, e, t) => e in i ? Fs(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
4
|
import * as L from "d3";
|
|
5
5
|
const Hs = (i) => {
|
|
6
6
|
const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks: d, isShow: g } = r;
|
|
@@ -8,8 +8,8 @@ const Hs = (i) => {
|
|
|
8
8
|
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((_) => {
|
|
9
9
|
let p = L.axisRight(s);
|
|
10
10
|
o && c ? p = p.tickFormat(c) : p = p.tickFormat((v) => {
|
|
11
|
-
const b = Number(v),
|
|
12
|
-
return Math.abs(b) >= 1e12 ?
|
|
11
|
+
const b = Number(v), x = (C) => C.toString().replace(/\.0+$/, "");
|
|
12
|
+
return Math.abs(b) >= 1e12 ? x(b / 1e12) + "T" : Math.abs(b) >= 1e9 ? x(b / 1e9) + "B" : Math.abs(b) >= 1e6 ? x(b / 1e6) + "M" : Math.abs(b) >= 1e3 ? x(b / 1e3) + "K" : x(b);
|
|
13
13
|
}), o && d && (p = Array.isArray(d) ? p.ticks(...d) : p.ticks(d)), o && h && (p = p.tickValues(h)), _.call(p);
|
|
14
14
|
}).call((_) => {
|
|
15
15
|
let p = [];
|
|
@@ -17,24 +17,101 @@ const Hs = (i) => {
|
|
|
17
17
|
}).call((_) => _.select(".domain").remove()).call((_) => _.selectAll(".tick line").remove()).call((_) => {
|
|
18
18
|
const p = _.selectAll(".tick text");
|
|
19
19
|
p.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
|
|
20
|
-
const v = p.nodes().map((
|
|
21
|
-
_.selectAll(".tick").each(function(
|
|
22
|
-
var
|
|
23
|
-
const y = L.select(this),
|
|
24
|
-
|
|
20
|
+
const v = p.nodes().map((x) => x.getBBox().width), b = Math.max(...v);
|
|
21
|
+
_.selectAll(".tick").each(function(x, C) {
|
|
22
|
+
var k;
|
|
23
|
+
const y = L.select(this), w = y.select("text"), T = v[C], S = b - T, D = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
w.attr("x", S), w.remove(), (k = D.node()) == null || k.appendChild(w.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
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
27
|
}, Is = (i) => {
|
|
28
|
+
const { svg: e, config: t, x: s, height: n, data: a, width: r } = i, { margin: o, xAxis: c } = t, { isShow: h, tickValues: d, tickFormat: g, customTicks: _, ticks: p } = c;
|
|
29
|
+
if (!h) return null;
|
|
30
|
+
let v = null, b = null;
|
|
31
|
+
a.length > 0 && (v = new Date(
|
|
32
|
+
a[0].date.getFullYear(),
|
|
33
|
+
a[0].date.getMonth(),
|
|
34
|
+
a[0].date.getDate()
|
|
35
|
+
), b = new Date(
|
|
36
|
+
a[a.length - 1].date.getFullYear(),
|
|
37
|
+
a[a.length - 1].date.getMonth(),
|
|
38
|
+
a[a.length - 1].date.getDate()
|
|
39
|
+
));
|
|
40
|
+
let x = null, C = g;
|
|
41
|
+
if (a.length > 0 && a.length <= 10 && !d) {
|
|
42
|
+
const y = /* @__PURE__ */ new Set();
|
|
43
|
+
if (a.forEach((w) => {
|
|
44
|
+
const T = new Date(w.date.getFullYear(), w.date.getMonth(), w.date.getDate()).getTime();
|
|
45
|
+
y.add(T.toString());
|
|
46
|
+
}), x = Array.from(y).map((w) => new Date(parseInt(w))).sort((w, T) => w.getTime() - T.getTime()), v && b) {
|
|
47
|
+
const w = x.some(
|
|
48
|
+
(S) => S.getFullYear() === v.getFullYear() && S.getMonth() === v.getMonth() && S.getDate() === v.getDate()
|
|
49
|
+
), T = x.some(
|
|
50
|
+
(S) => S.getFullYear() === b.getFullYear() && S.getMonth() === b.getMonth() && S.getDate() === b.getDate()
|
|
51
|
+
);
|
|
52
|
+
w || (x.unshift(v), x.sort((S, D) => S.getTime() - D.getTime())), T || (x.push(b), x.sort((S, D) => S.getTime() - D.getTime()));
|
|
53
|
+
}
|
|
54
|
+
g || (C = (w) => {
|
|
55
|
+
const T = new Date(w);
|
|
56
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
57
|
+
month: "short",
|
|
58
|
+
day: "numeric"
|
|
59
|
+
}).format(T);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
e.append("g").attr("transform", `translate(0,${n - o.bottom})`).call((y) => {
|
|
63
|
+
let w = L.axisBottom(s);
|
|
64
|
+
if (_)
|
|
65
|
+
if (C && (w = w.tickFormat(C)), x)
|
|
66
|
+
w = w.tickValues(x);
|
|
67
|
+
else if (d) {
|
|
68
|
+
const T = d.map((S) => new Date(S));
|
|
69
|
+
if (v && b) {
|
|
70
|
+
const S = T.some(
|
|
71
|
+
(k) => k.getFullYear() === v.getFullYear() && k.getMonth() === v.getMonth() && k.getDate() === v.getDate()
|
|
72
|
+
), D = T.some(
|
|
73
|
+
(k) => k.getFullYear() === b.getFullYear() && k.getMonth() === b.getMonth() && k.getDate() === b.getDate()
|
|
74
|
+
);
|
|
75
|
+
S || (T.unshift(v), T.sort((k, P) => k.getTime() - P.getTime())), D || (T.push(b), T.sort((k, P) => k.getTime() - P.getTime()));
|
|
76
|
+
}
|
|
77
|
+
w = w.tickValues(T);
|
|
78
|
+
} else p && (w = Array.isArray(p) ? w.ticks(...p) : w.ticks(p));
|
|
79
|
+
else
|
|
80
|
+
w.ticks(5);
|
|
81
|
+
y.call(w);
|
|
82
|
+
}).call((y) => y.select(".domain").remove()).call((y) => {
|
|
83
|
+
let w = [];
|
|
84
|
+
y.selectAll(".tick").each((T) => w.push(T)), i.xTicks = w;
|
|
85
|
+
}).call((y) => y.selectAll(".tick line").remove()).call((y) => y.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).call((y) => {
|
|
86
|
+
v && b && requestAnimationFrame(() => {
|
|
87
|
+
const w = y.selectAll(".tick");
|
|
88
|
+
let T = null, S = null;
|
|
89
|
+
if (w.each(function(D) {
|
|
90
|
+
const k = D, P = new Date(
|
|
91
|
+
k.getFullYear(),
|
|
92
|
+
k.getMonth(),
|
|
93
|
+
k.getDate()
|
|
94
|
+
), z = new Date(
|
|
95
|
+
v.getFullYear(),
|
|
96
|
+
v.getMonth(),
|
|
97
|
+
v.getDate()
|
|
98
|
+
), Y = new Date(
|
|
99
|
+
b.getFullYear(),
|
|
100
|
+
b.getMonth(),
|
|
101
|
+
b.getDate()
|
|
102
|
+
);
|
|
103
|
+
P.getTime() === z.getTime() && (T = L.select(this)), P.getTime() === Y.getTime() && (S = L.select(this));
|
|
104
|
+
}), T) {
|
|
105
|
+
const D = T.select("text");
|
|
106
|
+
T.attr("transform", `translate(${o.left},0)`), D.attr("text-anchor", "start").attr("dx", "0");
|
|
107
|
+
}
|
|
108
|
+
if (S) {
|
|
109
|
+
const D = S.select("text");
|
|
110
|
+
S.attr("transform", `translate(${r - o.right},0)`), D.attr("text-anchor", "end").attr("dx", "0");
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}).attr("font-family", "inherit");
|
|
114
|
+
}, Bs = (i) => {
|
|
38
115
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
39
116
|
margin: a,
|
|
40
117
|
grid: { horizontalStyle: r }
|
|
@@ -53,23 +130,20 @@ const Hs = (i) => {
|
|
|
53
130
|
const e = Array.from(i.childNodes);
|
|
54
131
|
for (let t = 0; t < e.length; t++)
|
|
55
132
|
i.removeChild(e[t]);
|
|
56
|
-
}, Rs = (i
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
tooltipContainer: n,
|
|
71
|
-
tooltip: a,
|
|
72
|
-
tooltipArrow: r
|
|
133
|
+
}, Rs = (i) => {
|
|
134
|
+
const e = "http://www.w3.org/2000/svg", t = document.createElement("div");
|
|
135
|
+
t.className = "sc-charts__hovered-circles-tooltip-container", t.style.display = "none";
|
|
136
|
+
const s = document.createElement("div");
|
|
137
|
+
s.className = "sc-charts__hovered-circles-tooltip";
|
|
138
|
+
const n = document.createElement("div");
|
|
139
|
+
n.className = "sc-charts__hovered-circles-tooltip-arrow";
|
|
140
|
+
const a = document.createElementNS(e, "svg");
|
|
141
|
+
a.setAttribute("width", "12"), a.setAttribute("height", "4"), a.setAttribute("viewBox", "0 0 12 4"), a.setAttribute("fill", "none"), a.setAttribute("xmlns", e);
|
|
142
|
+
const r = document.createElementNS(e, "path");
|
|
143
|
+
return r.setAttribute("d", "M6 4L0 0H12L6 4Z"), a.appendChild(r), n.appendChild(a), t.append(n), t.append(s), i.append(t), {
|
|
144
|
+
tooltipContainer: t,
|
|
145
|
+
tooltip: s,
|
|
146
|
+
tooltipArrow: n
|
|
73
147
|
};
|
|
74
148
|
}, $s = (i, e, {
|
|
75
149
|
x: t,
|
|
@@ -103,46 +177,44 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
103
177
|
}), h === "hovered-circles")) {
|
|
104
178
|
const p = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
|
|
105
179
|
qt(e, { x1: v, x2: b, y1: p, y2: p });
|
|
106
|
-
const { tooltipContainer:
|
|
107
|
-
showArrow: !d
|
|
108
|
-
}), C = (S) => {
|
|
180
|
+
const { tooltipContainer: x, tooltip: C, tooltipArrow: y } = Rs(o), w = (S) => {
|
|
109
181
|
if (!d) return;
|
|
110
|
-
_i(
|
|
111
|
-
const
|
|
112
|
-
|
|
182
|
+
_i(C), x.style.display = "block", C.append(d({ date: S.date, value: S.value }));
|
|
183
|
+
const D = C.getBoundingClientRect(), k = Os(
|
|
184
|
+
D,
|
|
113
185
|
s(S.date),
|
|
114
186
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
115
187
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
116
188
|
);
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
|
|
189
|
+
k !== null && (C.style.left = k + "px"), y.style.left = s(S.date) + "px";
|
|
190
|
+
}, T = () => {
|
|
191
|
+
x.style.display = "none";
|
|
120
192
|
};
|
|
121
193
|
i.gridHoverTooltip = d ? {
|
|
122
|
-
show: (S) =>
|
|
123
|
-
hide:
|
|
124
|
-
} : null, r.forEach((S,
|
|
125
|
-
const
|
|
126
|
-
Y || qt(e, { x1:
|
|
194
|
+
show: (S) => w(S),
|
|
195
|
+
hide: T
|
|
196
|
+
} : null, r.forEach((S, D) => {
|
|
197
|
+
const k = s(S.date), P = n(S.value), z = r[D - 1], Y = D > 0 && z && S.value === z.value;
|
|
198
|
+
Y || qt(e, { x1: k, x2: k, y1: P, y2: p });
|
|
127
199
|
const re = $s(e, Y, {
|
|
128
|
-
x:
|
|
200
|
+
x: k,
|
|
129
201
|
y: p,
|
|
130
202
|
r: g,
|
|
131
203
|
hr: _
|
|
132
204
|
});
|
|
133
205
|
d && re.on("mouseover", function() {
|
|
134
|
-
|
|
206
|
+
w({ date: S.date, value: Y ? null : S.value });
|
|
135
207
|
}).on("mouseout", function() {
|
|
136
|
-
|
|
208
|
+
T();
|
|
137
209
|
});
|
|
138
210
|
});
|
|
139
211
|
}
|
|
140
212
|
}, zs = (i) => {
|
|
141
|
-
|
|
142
|
-
},
|
|
213
|
+
Bs(i), Ps(i);
|
|
214
|
+
}, Ys = (i) => {
|
|
143
215
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
144
|
-
|
|
145
|
-
},
|
|
216
|
+
Is(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);
|
|
217
|
+
}, Ee = (i, e, t) => {
|
|
146
218
|
let s = i.select(`#${e}`);
|
|
147
219
|
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 }) => {
|
|
148
220
|
s.append("stop").attr("offset", n).attr("stop-color", a);
|
|
@@ -192,7 +264,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
192
264
|
...e == null ? void 0 : e.selection
|
|
193
265
|
}
|
|
194
266
|
}), Qt = (i, e = {}) => {
|
|
195
|
-
const t = i.node(), s = _e(t), n = (o, c) =>
|
|
267
|
+
const t = i.node(), s = _e(t), n = (o, c) => Ee(s, o, {
|
|
196
268
|
x1: "0%",
|
|
197
269
|
y1: "0%",
|
|
198
270
|
x2: "0%",
|
|
@@ -230,9 +302,9 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
230
302
|
t.remove();
|
|
231
303
|
}
|
|
232
304
|
};
|
|
233
|
-
},
|
|
305
|
+
}, Vs = (i, e = {}) => {
|
|
234
306
|
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) =>
|
|
307
|
+
return ((o, c) => Ee(a, o, {
|
|
236
308
|
x1: "0%",
|
|
237
309
|
y1: "0%",
|
|
238
310
|
x2: "0%",
|
|
@@ -288,18 +360,18 @@ const Xs = (i) => {
|
|
|
288
360
|
update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
|
|
289
361
|
if (n && a && h && r !== void 0) {
|
|
290
362
|
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";
|
|
291
|
-
let b = "",
|
|
363
|
+
let b = "", x = "";
|
|
292
364
|
if (g)
|
|
293
365
|
b = g({ left: n.value, right: a.value, direction: v });
|
|
294
366
|
else {
|
|
295
|
-
const
|
|
296
|
-
b = `${Ws(d)} (${
|
|
367
|
+
const C = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
368
|
+
b = `${Ws(d)} (${C}%)`;
|
|
297
369
|
}
|
|
298
|
-
_ ?
|
|
299
|
-
const
|
|
300
|
-
let
|
|
301
|
-
const
|
|
302
|
-
|
|
370
|
+
_ ? x = _({ left: n.date, right: a.date, direction: v }) : x = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = x, requestAnimationFrame(() => {
|
|
371
|
+
const C = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), w = i.x(n.date), T = i.x(a.date);
|
|
372
|
+
let D = (w + T) / 2 - C.width / 2;
|
|
373
|
+
const k = 0, P = y.width - C.width;
|
|
374
|
+
D < k && (D = k), D > P && (D = P), e.style.left = `${D}px`, e.style.top = `${o}px`;
|
|
303
375
|
});
|
|
304
376
|
}
|
|
305
377
|
c !== void 0 && (e.style.display = c ? "none" : "block");
|
|
@@ -409,7 +481,7 @@ const Js = (i) => {
|
|
|
409
481
|
curveTension: 1
|
|
410
482
|
}, tt = () => L.curveMonotoneX, Ks = (i) => {
|
|
411
483
|
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = _e(r);
|
|
412
|
-
|
|
484
|
+
Ee(o, "main-line-area-gradient", {
|
|
413
485
|
x1: "0%",
|
|
414
486
|
y1: "0%",
|
|
415
487
|
x2: "0%",
|
|
@@ -436,7 +508,7 @@ const Js = (i) => {
|
|
|
436
508
|
};
|
|
437
509
|
}, en = (i, e = {}) => {
|
|
438
510
|
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
|
-
|
|
511
|
+
Ee(g, _ + "_up", {
|
|
440
512
|
x1: "0%",
|
|
441
513
|
y1: "0%",
|
|
442
514
|
x2: "0%",
|
|
@@ -445,7 +517,7 @@ const Js = (i) => {
|
|
|
445
517
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
446
518
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
447
519
|
]
|
|
448
|
-
}),
|
|
520
|
+
}), Ee(g, _ + "_down", {
|
|
449
521
|
x1: "0%",
|
|
450
522
|
y1: "0%",
|
|
451
523
|
x2: "0%",
|
|
@@ -455,42 +527,42 @@ const Js = (i) => {
|
|
|
455
527
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
456
528
|
]
|
|
457
529
|
});
|
|
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}`,
|
|
530
|
+
const p = L.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt()), v = `${c}-clip-${t}`, x = 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%"), C = s.append("path").datum(o).attr("d", p).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
459
531
|
return {
|
|
460
|
-
className(y,
|
|
461
|
-
y === "remove" ?
|
|
532
|
+
className(y, w) {
|
|
533
|
+
y === "remove" ? C.classed(`${t}${w}`, !1) : C.classed(`${t}${w}`, !0);
|
|
462
534
|
},
|
|
463
|
-
update({ data: y, hidden:
|
|
464
|
-
y !== void 0 &&
|
|
535
|
+
update({ data: y, hidden: w, clip: T }) {
|
|
536
|
+
y !== void 0 && C.datum(y).attr("d", p), w !== void 0 && C.classed(`${t}_hidden`, w), T !== void 0 && x.attr("x", T.x).attr("y", T.y).attr("width", T.width).attr("height", T.height);
|
|
465
537
|
},
|
|
466
538
|
destroy() {
|
|
467
|
-
|
|
539
|
+
C.remove();
|
|
468
540
|
}
|
|
469
541
|
};
|
|
470
542
|
}, vt = (i, e) => {
|
|
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((
|
|
543
|
+
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((C) => n(C.date)).y((C) => a(C.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%"), x = t.append("path").classed(o, !0).datum(s).attr("d", _).attr("id", c).attr("clip-path", `url(#${p})`);
|
|
472
544
|
return {
|
|
473
|
-
className(
|
|
474
|
-
|
|
545
|
+
className(C, y) {
|
|
546
|
+
C === "remove" ? x.classed(`${o}${y}`, !1) : x.classed(`${o}${y}`, !0);
|
|
475
547
|
},
|
|
476
|
-
update({ data:
|
|
477
|
-
|
|
548
|
+
update({ data: C, clip: y, hidden: w }) {
|
|
549
|
+
C !== void 0 && x.datum(C).attr("d", _), w !== void 0 && x.classed(`${o}_hidden`, w), y !== void 0 && b.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height);
|
|
478
550
|
},
|
|
479
551
|
destroy() {
|
|
480
|
-
|
|
552
|
+
x.remove();
|
|
481
553
|
}
|
|
482
554
|
};
|
|
483
555
|
}, tn = (i, e) => {
|
|
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}`,
|
|
556
|
+
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}`, x = _.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%"), C = t.append("path").classed(c, !0).datum(s).attr("d", p).attr("id", h).attr("clip-path", `url(#${v})`);
|
|
485
557
|
return {
|
|
486
|
-
className(y,
|
|
487
|
-
y === "remove" ?
|
|
558
|
+
className(y, w) {
|
|
559
|
+
y === "remove" ? C.classed(`${c}${w}`, !1) : C.classed(`${c}${w}`, !0);
|
|
488
560
|
},
|
|
489
|
-
update({ data: y, clip:
|
|
490
|
-
y !== void 0 &&
|
|
561
|
+
update({ data: y, clip: w, hidden: T }) {
|
|
562
|
+
y !== void 0 && C.datum(y).attr("d", p), T !== void 0 && C.classed(`${c}_hidden`, T), w !== void 0 && (o.hover.transitionName === "default" ? x.transition().duration(o.hover.transitionDuration).attr("x", w.x).attr("y", w.y).attr("width", w.width).attr("height", w.height).ease(L.easeLinear) : x.attr("x", w.x).attr("y", w.y).attr("width", w.width).attr("height", w.height));
|
|
491
563
|
},
|
|
492
564
|
destroy() {
|
|
493
|
-
|
|
565
|
+
C.remove();
|
|
494
566
|
}
|
|
495
567
|
};
|
|
496
568
|
}, sn = (i) => {
|
|
@@ -525,7 +597,7 @@ const Js = (i) => {
|
|
|
525
597
|
i.config.hasExtremePoint && (s = nn(i, {
|
|
526
598
|
baseClassName: "sc-charts__extreme-point"
|
|
527
599
|
}));
|
|
528
|
-
const n =
|
|
600
|
+
const n = Vs(i.svg), a = tn(i, {
|
|
529
601
|
baseClassName: "sc-charts__highlight-line",
|
|
530
602
|
id: `${i.chartId}-sc-charts__highlight-line`,
|
|
531
603
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
@@ -770,11 +842,11 @@ const Js = (i) => {
|
|
|
770
842
|
const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
|
|
771
843
|
let d = null, g = !1;
|
|
772
844
|
const _ = (v) => t.reduce(
|
|
773
|
-
(b,
|
|
845
|
+
(b, x) => Math.abs(s(b.date) - v) < Math.abs(s(x.date) - v) ? b : x
|
|
774
846
|
);
|
|
775
847
|
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) {
|
|
776
|
-
const [b] = L.pointer(v, this),
|
|
777
|
-
!g && c.enable ? (i.action = "hover", ei(i,
|
|
848
|
+
const [b] = L.pointer(v, this), x = _(b);
|
|
849
|
+
!g && c.enable ? (i.action = "hover", ei(i, x)) : (i.action = g ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, x));
|
|
778
850
|
}).on("mouseleave", () => {
|
|
779
851
|
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
780
852
|
}).on("mousedown", function(v) {
|
|
@@ -784,8 +856,8 @@ const Js = (i) => {
|
|
|
784
856
|
d = _(b);
|
|
785
857
|
}
|
|
786
858
|
}).on("mouseup", function(v) {
|
|
787
|
-
const [b] = L.pointer(v, this),
|
|
788
|
-
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i,
|
|
859
|
+
const [b] = L.pointer(v, this), x = _(b);
|
|
860
|
+
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, x);
|
|
789
861
|
});
|
|
790
862
|
}, hn = (i, e, t) => {
|
|
791
863
|
const { margin: s } = e, n = L.scaleTime(), a = L.extent(i, (r) => new Date(r.date));
|
|
@@ -808,27 +880,27 @@ const Js = (i) => {
|
|
|
808
880
|
window.addEventListener("resize", g);
|
|
809
881
|
const _ = (p, v = !1) => {
|
|
810
882
|
v && p.config && (h = Jt(h, p.config)), v && p.data && (d = p.data);
|
|
811
|
-
const b = d.map((
|
|
883
|
+
const b = d.map((T) => ({ date: new Date(T.date), value: T.value })).sort((T, S) => T.date.getTime() - S.date.getTime()), x = hn(b, h, o), C = dn(b, h, c);
|
|
812
884
|
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();
|
|
813
885
|
const y = {
|
|
814
886
|
chartId: e.chartId,
|
|
815
887
|
svg: n,
|
|
816
888
|
wrapperNode: s.node(),
|
|
817
889
|
data: b,
|
|
818
|
-
x
|
|
819
|
-
y:
|
|
890
|
+
x,
|
|
891
|
+
y: C,
|
|
820
892
|
config: h,
|
|
821
893
|
action: "none",
|
|
822
894
|
width: o,
|
|
823
895
|
height: c,
|
|
824
896
|
gridHoverTooltip: null
|
|
825
897
|
};
|
|
826
|
-
|
|
827
|
-
const
|
|
898
|
+
Ys(y);
|
|
899
|
+
const w = {
|
|
828
900
|
...y,
|
|
829
901
|
elements: an(y)
|
|
830
902
|
};
|
|
831
|
-
cn(
|
|
903
|
+
cn(w);
|
|
832
904
|
};
|
|
833
905
|
return _(e), {
|
|
834
906
|
update: (p) => _(p, !0),
|
|
@@ -846,8 +918,8 @@ Se.exports;
|
|
|
846
918
|
var si;
|
|
847
919
|
function fn() {
|
|
848
920
|
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]",
|
|
850
|
-
|
|
921
|
+
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]", x = "[object Number]", C = "[object Null]", y = "[object Object]", w = "[object Proxy]", T = "[object RegExp]", S = "[object Set]", D = "[object String]", k = "[object Undefined]", P = "[object WeakMap]", z = "[object ArrayBuffer]", Y = "[object DataView]", re = "[object Float32Array]", V = "[object Float64Array]", U = "[object Int8Array]", G = "[object Int16Array]", Ne = "[object Int32Array]", st = "[object Uint8Array]", oe = "[object Uint8ClampedArray]", ve = "[object Uint16Array]", be = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Ie = /^\[object .+?Constructor\]$/, Be = /^(?:0|[1-9]\d*)$/, H = {};
|
|
922
|
+
H[re] = H[V] = H[U] = H[G] = H[Ne] = H[st] = H[oe] = H[ve] = H[be] = !0, H[o] = H[c] = H[z] = H[d] = H[Y] = H[g] = H[_] = H[p] = H[b] = H[x] = H[y] = H[T] = H[S] = H[D] = H[P] = !1;
|
|
851
923
|
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() {
|
|
852
924
|
try {
|
|
853
925
|
var l = Z && Z.require && Z.require("util").types;
|
|
@@ -869,9 +941,9 @@ function fn() {
|
|
|
869
941
|
return l.apply(u, m);
|
|
870
942
|
}
|
|
871
943
|
function Pe(l, u) {
|
|
872
|
-
for (var m = -1,
|
|
873
|
-
|
|
874
|
-
return
|
|
944
|
+
for (var m = -1, M = Array(l); ++m < l; )
|
|
945
|
+
M[m] = u(m);
|
|
946
|
+
return M;
|
|
875
947
|
}
|
|
876
948
|
function le(l) {
|
|
877
949
|
return function(u) {
|
|
@@ -886,20 +958,20 @@ function fn() {
|
|
|
886
958
|
return l(u(m));
|
|
887
959
|
};
|
|
888
960
|
}
|
|
889
|
-
var xe = Array.prototype,
|
|
961
|
+
var xe = Array.prototype, Mi = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ye = Mi.toString, ne = ze.hasOwnProperty, Ft = function() {
|
|
890
962
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
891
963
|
return l ? "Symbol(src)_1." + l : "";
|
|
892
|
-
}(),
|
|
893
|
-
"^" +
|
|
894
|
-
),
|
|
895
|
-
|
|
896
|
-
var
|
|
964
|
+
}(), Nt = ze.toString, Ai = Ye.call(Object), Si = RegExp(
|
|
965
|
+
"^" + Ye.call(ne).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
966
|
+
), Ve = q ? O.Buffer : void 0, Ht = O.Symbol, It = O.Uint8Array;
|
|
967
|
+
Ve && Ve.allocUnsafe;
|
|
968
|
+
var Bt = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = xe.splice, he = Ht ? Ht.toStringTag : void 0, We = function() {
|
|
897
969
|
try {
|
|
898
970
|
var l = lt(Object, "defineProperty");
|
|
899
971
|
return l({}, "", {}), l;
|
|
900
972
|
} catch {
|
|
901
973
|
}
|
|
902
|
-
}(),
|
|
974
|
+
}(), Ei = Ve ? Ve.isBuffer : void 0, $t = Math.max, Li = Date.now, Ot = lt(O, "Map"), Ce = lt(Object, "create"), Fi = /* @__PURE__ */ function() {
|
|
903
975
|
function l() {
|
|
904
976
|
}
|
|
905
977
|
return function(u) {
|
|
@@ -915,18 +987,18 @@ function fn() {
|
|
|
915
987
|
function de(l) {
|
|
916
988
|
var u = -1, m = l == null ? 0 : l.length;
|
|
917
989
|
for (this.clear(); ++u < m; ) {
|
|
918
|
-
var
|
|
919
|
-
this.set(
|
|
990
|
+
var M = l[u];
|
|
991
|
+
this.set(M[0], M[1]);
|
|
920
992
|
}
|
|
921
993
|
}
|
|
922
|
-
function
|
|
994
|
+
function Ni() {
|
|
923
995
|
this.__data__ = Ce ? Ce(null) : {}, this.size = 0;
|
|
924
996
|
}
|
|
925
997
|
function Hi(l) {
|
|
926
998
|
var u = this.has(l) && delete this.__data__[l];
|
|
927
999
|
return this.size -= u ? 1 : 0, u;
|
|
928
1000
|
}
|
|
929
|
-
function
|
|
1001
|
+
function Ii(l) {
|
|
930
1002
|
var u = this.__data__;
|
|
931
1003
|
if (Ce) {
|
|
932
1004
|
var m = u[l];
|
|
@@ -934,7 +1006,7 @@ function fn() {
|
|
|
934
1006
|
}
|
|
935
1007
|
return ne.call(u, l) ? u[l] : void 0;
|
|
936
1008
|
}
|
|
937
|
-
function
|
|
1009
|
+
function Bi(l) {
|
|
938
1010
|
var u = this.__data__;
|
|
939
1011
|
return Ce ? u[l] !== void 0 : ne.call(u, l);
|
|
940
1012
|
}
|
|
@@ -942,12 +1014,12 @@ function fn() {
|
|
|
942
1014
|
var m = this.__data__;
|
|
943
1015
|
return this.size += this.has(l) ? 0 : 1, m[l] = Ce && u === void 0 ? s : u, this;
|
|
944
1016
|
}
|
|
945
|
-
de.prototype.clear =
|
|
1017
|
+
de.prototype.clear = Ni, de.prototype.delete = Hi, de.prototype.get = Ii, de.prototype.has = Bi, de.prototype.set = Ri;
|
|
946
1018
|
function te(l) {
|
|
947
1019
|
var u = -1, m = l == null ? 0 : l.length;
|
|
948
1020
|
for (this.clear(); ++u < m; ) {
|
|
949
|
-
var
|
|
950
|
-
this.set(
|
|
1021
|
+
var M = l[u];
|
|
1022
|
+
this.set(M[0], M[1]);
|
|
951
1023
|
}
|
|
952
1024
|
}
|
|
953
1025
|
function $i() {
|
|
@@ -957,8 +1029,8 @@ function fn() {
|
|
|
957
1029
|
var u = this.__data__, m = je(u, l);
|
|
958
1030
|
if (m < 0)
|
|
959
1031
|
return !1;
|
|
960
|
-
var
|
|
961
|
-
return m ==
|
|
1032
|
+
var M = u.length - 1;
|
|
1033
|
+
return m == M ? u.pop() : ki.call(u, m, 1), --this.size, !0;
|
|
962
1034
|
}
|
|
963
1035
|
function Pi(l) {
|
|
964
1036
|
var u = this.__data__, m = je(u, l);
|
|
@@ -967,19 +1039,19 @@ function fn() {
|
|
|
967
1039
|
function zi(l) {
|
|
968
1040
|
return je(this.__data__, l) > -1;
|
|
969
1041
|
}
|
|
970
|
-
function
|
|
971
|
-
var m = this.__data__,
|
|
972
|
-
return
|
|
1042
|
+
function Yi(l, u) {
|
|
1043
|
+
var m = this.__data__, M = je(m, l);
|
|
1044
|
+
return M < 0 ? (++this.size, m.push([l, u])) : m[M][1] = u, this;
|
|
973
1045
|
}
|
|
974
|
-
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set =
|
|
1046
|
+
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set = Yi;
|
|
975
1047
|
function me(l) {
|
|
976
1048
|
var u = -1, m = l == null ? 0 : l.length;
|
|
977
1049
|
for (this.clear(); ++u < m; ) {
|
|
978
|
-
var
|
|
979
|
-
this.set(
|
|
1050
|
+
var M = l[u];
|
|
1051
|
+
this.set(M[0], M[1]);
|
|
980
1052
|
}
|
|
981
1053
|
}
|
|
982
|
-
function
|
|
1054
|
+
function Vi() {
|
|
983
1055
|
this.size = 0, this.__data__ = {
|
|
984
1056
|
hash: new de(),
|
|
985
1057
|
map: new (Ot || te)(),
|
|
@@ -997,10 +1069,10 @@ function fn() {
|
|
|
997
1069
|
return Ue(this, l).has(l);
|
|
998
1070
|
}
|
|
999
1071
|
function Ui(l, u) {
|
|
1000
|
-
var m = Ue(this, l),
|
|
1001
|
-
return m.set(l, u), this.size += m.size ==
|
|
1072
|
+
var m = Ue(this, l), M = m.size;
|
|
1073
|
+
return m.set(l, u), this.size += m.size == M ? 0 : 1, this;
|
|
1002
1074
|
}
|
|
1003
|
-
me.prototype.clear =
|
|
1075
|
+
me.prototype.clear = Vi, me.prototype.delete = Wi, me.prototype.get = ji, me.prototype.has = Xi, me.prototype.set = Ui;
|
|
1004
1076
|
function pe(l) {
|
|
1005
1077
|
var u = this.__data__ = new te(l);
|
|
1006
1078
|
this.size = u.size;
|
|
@@ -1021,30 +1093,30 @@ function fn() {
|
|
|
1021
1093
|
function Qi(l, u) {
|
|
1022
1094
|
var m = this.__data__;
|
|
1023
1095
|
if (m instanceof te) {
|
|
1024
|
-
var
|
|
1025
|
-
if (!Ot ||
|
|
1026
|
-
return
|
|
1027
|
-
m = this.__data__ = new me(
|
|
1096
|
+
var M = m.__data__;
|
|
1097
|
+
if (!Ot || M.length < t - 1)
|
|
1098
|
+
return M.push([l, u]), this.size = ++m.size, this;
|
|
1099
|
+
m = this.__data__ = new me(M);
|
|
1028
1100
|
}
|
|
1029
1101
|
return m.set(l, u), this.size = m.size, this;
|
|
1030
1102
|
}
|
|
1031
1103
|
pe.prototype.clear = Gi, pe.prototype.delete = Zi, pe.prototype.get = qi, pe.prototype.has = Ji, pe.prototype.set = Qi;
|
|
1032
1104
|
function Ki(l, u) {
|
|
1033
|
-
var m = dt(l),
|
|
1105
|
+
var m = dt(l), M = !m && ht(l), E = !m && !M && Wt(l), I = !m && !M && !E && Xt(l), B = m || M || E || I, N = B ? Pe(l.length, String) : [], R = N.length;
|
|
1034
1106
|
for (var J in l)
|
|
1035
1107
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1036
1108
|
(J == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
return
|
|
1109
|
+
E && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1110
|
+
I && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
|
|
1111
|
+
Yt(J, R)) || N.push(J);
|
|
1112
|
+
return N;
|
|
1041
1113
|
}
|
|
1042
1114
|
function rt(l, u, m) {
|
|
1043
1115
|
(m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1044
1116
|
}
|
|
1045
1117
|
function es(l, u, m) {
|
|
1046
|
-
var
|
|
1047
|
-
(!(ne.call(l, u) && Ge(
|
|
1118
|
+
var M = l[u];
|
|
1119
|
+
(!(ne.call(l, u) && Ge(M, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1048
1120
|
}
|
|
1049
1121
|
function je(l, u) {
|
|
1050
1122
|
for (var m = l.length; m--; )
|
|
@@ -1062,50 +1134,50 @@ function fn() {
|
|
|
1062
1134
|
}
|
|
1063
1135
|
var ts = gs();
|
|
1064
1136
|
function Xe(l) {
|
|
1065
|
-
return l == null ? l === void 0 ?
|
|
1137
|
+
return l == null ? l === void 0 ? k : C : he && he in Object(l) ? ms(l) : ws(l);
|
|
1066
1138
|
}
|
|
1067
1139
|
function Pt(l) {
|
|
1068
|
-
return
|
|
1140
|
+
return Te(l) && Xe(l) == o;
|
|
1069
1141
|
}
|
|
1070
1142
|
function is(l) {
|
|
1071
1143
|
if (!ue(l) || bs(l))
|
|
1072
1144
|
return !1;
|
|
1073
|
-
var u = ft(l) ? Si :
|
|
1074
|
-
return u.test(
|
|
1145
|
+
var u = ft(l) ? Si : Ie;
|
|
1146
|
+
return u.test(Ms(l));
|
|
1075
1147
|
}
|
|
1076
1148
|
function ss(l) {
|
|
1077
|
-
return
|
|
1149
|
+
return Te(l) && jt(l.length) && !!H[Xe(l)];
|
|
1078
1150
|
}
|
|
1079
1151
|
function ns(l) {
|
|
1080
1152
|
if (!ue(l))
|
|
1081
1153
|
return ys(l);
|
|
1082
|
-
var u =
|
|
1083
|
-
for (var
|
|
1084
|
-
|
|
1154
|
+
var u = Vt(l), m = [];
|
|
1155
|
+
for (var M in l)
|
|
1156
|
+
M == "constructor" && (u || !ne.call(l, M)) || m.push(M);
|
|
1085
1157
|
return m;
|
|
1086
1158
|
}
|
|
1087
|
-
function zt(l, u, m,
|
|
1088
|
-
l !== u && ts(u, function(
|
|
1089
|
-
if (
|
|
1090
|
-
as(l, u, B, m, zt,
|
|
1159
|
+
function zt(l, u, m, M, E) {
|
|
1160
|
+
l !== u && ts(u, function(I, B) {
|
|
1161
|
+
if (E || (E = new pe()), ue(I))
|
|
1162
|
+
as(l, u, B, m, zt, M, E);
|
|
1091
1163
|
else {
|
|
1092
|
-
var
|
|
1093
|
-
|
|
1164
|
+
var N = M ? M(ct(l, B), I, B + "", l, u, E) : void 0;
|
|
1165
|
+
N === void 0 && (N = I), rt(l, B, N);
|
|
1094
1166
|
}
|
|
1095
1167
|
}, Ut);
|
|
1096
1168
|
}
|
|
1097
|
-
function as(l, u, m,
|
|
1098
|
-
var
|
|
1169
|
+
function as(l, u, m, M, E, I, B) {
|
|
1170
|
+
var N = ct(l, m), R = ct(u, m), J = B.get(R);
|
|
1099
1171
|
if (J) {
|
|
1100
1172
|
rt(l, m, J);
|
|
1101
1173
|
return;
|
|
1102
1174
|
}
|
|
1103
|
-
var W =
|
|
1104
|
-
if (
|
|
1105
|
-
var gt = dt(
|
|
1106
|
-
W =
|
|
1175
|
+
var W = I ? I(N, R, m + "", l, u, B) : void 0, Me = W === void 0;
|
|
1176
|
+
if (Me) {
|
|
1177
|
+
var gt = dt(R), mt = !gt && Wt(R), Zt = !gt && !mt && Xt(R);
|
|
1178
|
+
W = R, gt || mt || Zt ? dt(N) ? W = N : As(N) ? W = ds(N) : mt ? (Me = !1, W = ls(R)) : Zt ? (Me = !1, W = hs(R)) : W = [] : Ss(R) || ht(R) ? (W = N, ht(N) ? W = Ds(N) : (!ue(N) || ft(N)) && (W = ps(R))) : Me = !1;
|
|
1107
1179
|
}
|
|
1108
|
-
|
|
1180
|
+
Me && (B.set(R, W), E(W, R, M, I, B), B.delete(R)), rt(l, m, W);
|
|
1109
1181
|
}
|
|
1110
1182
|
function rs(l, u) {
|
|
1111
1183
|
return Cs(xs(l, u, Gt), l + "");
|
|
@@ -1114,7 +1186,7 @@ function fn() {
|
|
|
1114
1186
|
return We(l, "toString", {
|
|
1115
1187
|
configurable: !0,
|
|
1116
1188
|
enumerable: !1,
|
|
1117
|
-
value:
|
|
1189
|
+
value: Es(u),
|
|
1118
1190
|
writable: !0
|
|
1119
1191
|
});
|
|
1120
1192
|
} : Gt;
|
|
@@ -1123,42 +1195,42 @@ function fn() {
|
|
|
1123
1195
|
}
|
|
1124
1196
|
function cs(l) {
|
|
1125
1197
|
var u = new l.constructor(l.byteLength);
|
|
1126
|
-
return new
|
|
1198
|
+
return new It(u).set(new It(l)), u;
|
|
1127
1199
|
}
|
|
1128
1200
|
function hs(l, u) {
|
|
1129
1201
|
var m = cs(l.buffer);
|
|
1130
1202
|
return new l.constructor(m, l.byteOffset, l.length);
|
|
1131
1203
|
}
|
|
1132
1204
|
function ds(l, u) {
|
|
1133
|
-
var m = -1,
|
|
1134
|
-
for (u || (u = Array(
|
|
1205
|
+
var m = -1, M = l.length;
|
|
1206
|
+
for (u || (u = Array(M)); ++m < M; )
|
|
1135
1207
|
u[m] = l[m];
|
|
1136
1208
|
return u;
|
|
1137
1209
|
}
|
|
1138
|
-
function us(l, u, m,
|
|
1139
|
-
var
|
|
1210
|
+
function us(l, u, m, M) {
|
|
1211
|
+
var E = !m;
|
|
1140
1212
|
m || (m = {});
|
|
1141
|
-
for (var
|
|
1142
|
-
var
|
|
1143
|
-
|
|
1213
|
+
for (var I = -1, B = u.length; ++I < B; ) {
|
|
1214
|
+
var N = u[I], R = void 0;
|
|
1215
|
+
R === void 0 && (R = l[N]), E ? ot(m, N, R) : es(m, N, R);
|
|
1144
1216
|
}
|
|
1145
1217
|
return m;
|
|
1146
1218
|
}
|
|
1147
1219
|
function fs(l) {
|
|
1148
1220
|
return rs(function(u, m) {
|
|
1149
|
-
var
|
|
1150
|
-
for (
|
|
1151
|
-
var
|
|
1152
|
-
|
|
1221
|
+
var M = -1, E = m.length, I = E > 1 ? m[E - 1] : void 0, B = E > 2 ? m[2] : void 0;
|
|
1222
|
+
for (I = l.length > 3 && typeof I == "function" ? (E--, I) : void 0, B && _s(m[0], m[1], B) && (I = E < 3 ? void 0 : I, E = 1), u = Object(u); ++M < E; ) {
|
|
1223
|
+
var N = m[M];
|
|
1224
|
+
N && l(u, N, M, I);
|
|
1153
1225
|
}
|
|
1154
1226
|
return u;
|
|
1155
1227
|
});
|
|
1156
1228
|
}
|
|
1157
1229
|
function gs(l) {
|
|
1158
|
-
return function(u, m,
|
|
1159
|
-
for (var
|
|
1160
|
-
var
|
|
1161
|
-
if (m(
|
|
1230
|
+
return function(u, m, M) {
|
|
1231
|
+
for (var E = -1, I = Object(u), B = M(u), N = B.length; N--; ) {
|
|
1232
|
+
var R = B[++E];
|
|
1233
|
+
if (m(I[R], R, I) === !1)
|
|
1162
1234
|
break;
|
|
1163
1235
|
}
|
|
1164
1236
|
return u;
|
|
@@ -1176,33 +1248,33 @@ function fn() {
|
|
|
1176
1248
|
var u = ne.call(l, he), m = l[he];
|
|
1177
1249
|
try {
|
|
1178
1250
|
l[he] = void 0;
|
|
1179
|
-
var
|
|
1251
|
+
var M = !0;
|
|
1180
1252
|
} catch {
|
|
1181
1253
|
}
|
|
1182
|
-
var
|
|
1183
|
-
return
|
|
1254
|
+
var E = Nt.call(l);
|
|
1255
|
+
return M && (u ? l[he] = m : delete l[he]), E;
|
|
1184
1256
|
}
|
|
1185
1257
|
function ps(l) {
|
|
1186
|
-
return typeof l.constructor == "function" && !
|
|
1258
|
+
return typeof l.constructor == "function" && !Vt(l) ? Fi(Bt(l)) : {};
|
|
1187
1259
|
}
|
|
1188
|
-
function
|
|
1260
|
+
function Yt(l, u) {
|
|
1189
1261
|
var m = typeof l;
|
|
1190
|
-
return u = u ?? r, !!u && (m == "number" || m != "symbol" &&
|
|
1262
|
+
return u = u ?? r, !!u && (m == "number" || m != "symbol" && Be.test(l)) && l > -1 && l % 1 == 0 && l < u;
|
|
1191
1263
|
}
|
|
1192
1264
|
function _s(l, u, m) {
|
|
1193
1265
|
if (!ue(m))
|
|
1194
1266
|
return !1;
|
|
1195
|
-
var
|
|
1196
|
-
return (
|
|
1267
|
+
var M = typeof u;
|
|
1268
|
+
return (M == "number" ? ut(m) && Yt(u, m.length) : M == "string" && u in m) ? Ge(m[u], l) : !1;
|
|
1197
1269
|
}
|
|
1198
1270
|
function vs(l) {
|
|
1199
1271
|
var u = typeof l;
|
|
1200
1272
|
return u == "string" || u == "number" || u == "symbol" || u == "boolean" ? l !== "__proto__" : l === null;
|
|
1201
1273
|
}
|
|
1202
1274
|
function bs(l) {
|
|
1203
|
-
return !!
|
|
1275
|
+
return !!Ft && Ft in l;
|
|
1204
1276
|
}
|
|
1205
|
-
function
|
|
1277
|
+
function Vt(l) {
|
|
1206
1278
|
var u = l && l.constructor, m = typeof u == "function" && u.prototype || ze;
|
|
1207
1279
|
return l === m;
|
|
1208
1280
|
}
|
|
@@ -1214,28 +1286,28 @@ function fn() {
|
|
|
1214
1286
|
return u;
|
|
1215
1287
|
}
|
|
1216
1288
|
function ws(l) {
|
|
1217
|
-
return
|
|
1289
|
+
return Nt.call(l);
|
|
1218
1290
|
}
|
|
1219
1291
|
function xs(l, u, m) {
|
|
1220
1292
|
return u = $t(u === void 0 ? l.length - 1 : u, 0), function() {
|
|
1221
|
-
for (var
|
|
1222
|
-
B[
|
|
1223
|
-
|
|
1224
|
-
for (var
|
|
1225
|
-
E
|
|
1226
|
-
return
|
|
1293
|
+
for (var M = arguments, E = -1, I = $t(M.length - u, 0), B = Array(I); ++E < I; )
|
|
1294
|
+
B[E] = M[u + E];
|
|
1295
|
+
E = -1;
|
|
1296
|
+
for (var N = Array(u + 1); ++E < u; )
|
|
1297
|
+
N[E] = M[E];
|
|
1298
|
+
return N[u] = m(B), Oe(l, this, N);
|
|
1227
1299
|
};
|
|
1228
1300
|
}
|
|
1229
1301
|
function ct(l, u) {
|
|
1230
1302
|
if (!(u === "constructor" && typeof l[u] == "function") && u != "__proto__")
|
|
1231
1303
|
return l[u];
|
|
1232
1304
|
}
|
|
1233
|
-
var Cs =
|
|
1234
|
-
function
|
|
1305
|
+
var Cs = Ts(os);
|
|
1306
|
+
function Ts(l) {
|
|
1235
1307
|
var u = 0, m = 0;
|
|
1236
1308
|
return function() {
|
|
1237
|
-
var
|
|
1238
|
-
if (m =
|
|
1309
|
+
var M = Li(), E = a - (M - m);
|
|
1310
|
+
if (m = M, E > 0) {
|
|
1239
1311
|
if (++u >= n)
|
|
1240
1312
|
return arguments[0];
|
|
1241
1313
|
} else
|
|
@@ -1243,10 +1315,10 @@ function fn() {
|
|
|
1243
1315
|
return l.apply(void 0, arguments);
|
|
1244
1316
|
};
|
|
1245
1317
|
}
|
|
1246
|
-
function
|
|
1318
|
+
function Ms(l) {
|
|
1247
1319
|
if (l != null) {
|
|
1248
1320
|
try {
|
|
1249
|
-
return
|
|
1321
|
+
return Ye.call(l);
|
|
1250
1322
|
} catch {
|
|
1251
1323
|
}
|
|
1252
1324
|
try {
|
|
@@ -1262,20 +1334,20 @@ function fn() {
|
|
|
1262
1334
|
var ht = Pt(/* @__PURE__ */ function() {
|
|
1263
1335
|
return arguments;
|
|
1264
1336
|
}()) ? Pt : function(l) {
|
|
1265
|
-
return
|
|
1337
|
+
return Te(l) && ne.call(l, "callee") && !Di.call(l, "callee");
|
|
1266
1338
|
}, dt = Array.isArray;
|
|
1267
1339
|
function ut(l) {
|
|
1268
1340
|
return l != null && jt(l.length) && !ft(l);
|
|
1269
1341
|
}
|
|
1270
|
-
function
|
|
1271
|
-
return
|
|
1342
|
+
function As(l) {
|
|
1343
|
+
return Te(l) && ut(l);
|
|
1272
1344
|
}
|
|
1273
|
-
var Wt =
|
|
1345
|
+
var Wt = Ei || Ls;
|
|
1274
1346
|
function ft(l) {
|
|
1275
1347
|
if (!ue(l))
|
|
1276
1348
|
return !1;
|
|
1277
1349
|
var u = Xe(l);
|
|
1278
|
-
return u == p || u == v || u == h || u ==
|
|
1350
|
+
return u == p || u == v || u == h || u == w;
|
|
1279
1351
|
}
|
|
1280
1352
|
function jt(l) {
|
|
1281
1353
|
return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
|
|
@@ -1284,17 +1356,17 @@ function fn() {
|
|
|
1284
1356
|
var u = typeof l;
|
|
1285
1357
|
return l != null && (u == "object" || u == "function");
|
|
1286
1358
|
}
|
|
1287
|
-
function
|
|
1359
|
+
function Te(l) {
|
|
1288
1360
|
return l != null && typeof l == "object";
|
|
1289
1361
|
}
|
|
1290
1362
|
function Ss(l) {
|
|
1291
|
-
if (!
|
|
1363
|
+
if (!Te(l) || Xe(l) != y)
|
|
1292
1364
|
return !1;
|
|
1293
|
-
var u =
|
|
1365
|
+
var u = Bt(l);
|
|
1294
1366
|
if (u === null)
|
|
1295
1367
|
return !0;
|
|
1296
1368
|
var m = ne.call(u, "constructor") && u.constructor;
|
|
1297
|
-
return typeof m == "function" && m instanceof m &&
|
|
1369
|
+
return typeof m == "function" && m instanceof m && Ye.call(m) == Ai;
|
|
1298
1370
|
}
|
|
1299
1371
|
var Xt = we ? le(we) : ss;
|
|
1300
1372
|
function Ds(l) {
|
|
@@ -1306,7 +1378,7 @@ function fn() {
|
|
|
1306
1378
|
var ks = fs(function(l, u, m) {
|
|
1307
1379
|
zt(l, u, m);
|
|
1308
1380
|
});
|
|
1309
|
-
function
|
|
1381
|
+
function Es(l) {
|
|
1310
1382
|
return function() {
|
|
1311
1383
|
return l;
|
|
1312
1384
|
};
|
|
@@ -1314,7 +1386,7 @@ function fn() {
|
|
|
1314
1386
|
function Gt(l) {
|
|
1315
1387
|
return l;
|
|
1316
1388
|
}
|
|
1317
|
-
function
|
|
1389
|
+
function Ls() {
|
|
1318
1390
|
return !1;
|
|
1319
1391
|
}
|
|
1320
1392
|
i.exports = ks;
|
|
@@ -1536,24 +1608,24 @@ function ai(i, e) {
|
|
|
1536
1608
|
a.forEach((g, _) => {
|
|
1537
1609
|
const p = (h - d) / a.length;
|
|
1538
1610
|
let v = d + p * _, b = v + p;
|
|
1539
|
-
const
|
|
1540
|
-
let
|
|
1611
|
+
const x = Math.abs(v - b);
|
|
1612
|
+
let C = Math.max(v, b) + x / 2, y = Math.min(v, b) - x / 2;
|
|
1541
1613
|
if (e.trade) {
|
|
1542
|
-
const
|
|
1543
|
-
const
|
|
1544
|
-
return
|
|
1614
|
+
const T = [...e.trade.entries, ...e.trade.exits].find((S) => {
|
|
1615
|
+
const D = S.time.getTime();
|
|
1616
|
+
return D >= g && D < g + t;
|
|
1545
1617
|
});
|
|
1546
|
-
|
|
1618
|
+
T && (T.type === "buy" ? (y = T.price, b = Math.max(y, b), v = b + x, C = Math.max(v, b) + x / 2, d = v) : T.type === "sell" && (C = T.price, b = Math.min(C, b), v = b - x, y = Math.min(v, b) - x / 2, d = v));
|
|
1547
1619
|
}
|
|
1548
|
-
const
|
|
1620
|
+
const w = {
|
|
1549
1621
|
open_time: new Date(g),
|
|
1550
1622
|
close_time: new Date(g + t),
|
|
1551
1623
|
open: v,
|
|
1552
1624
|
close: b,
|
|
1553
|
-
high:
|
|
1625
|
+
high: C,
|
|
1554
1626
|
low: y
|
|
1555
1627
|
};
|
|
1556
|
-
n.push(
|
|
1628
|
+
n.push(w);
|
|
1557
1629
|
});
|
|
1558
1630
|
}), n;
|
|
1559
1631
|
}
|
|
@@ -1673,7 +1745,7 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
|
1673
1745
|
const e = i.match(/^(\d+)([a-zA-Z]+)$/);
|
|
1674
1746
|
if (!e) throw new Error(`Invalid offset format: "${i}"`);
|
|
1675
1747
|
return [parseInt(e[1]), e[2]];
|
|
1676
|
-
},
|
|
1748
|
+
}, Tn = (i, e) => {
|
|
1677
1749
|
const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
|
|
1678
1750
|
const c = o.open_time.getTime();
|
|
1679
1751
|
return c >= t && c <= s;
|
|
@@ -1681,7 +1753,7 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
|
1681
1753
|
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1682
1754
|
return [a, r];
|
|
1683
1755
|
};
|
|
1684
|
-
class
|
|
1756
|
+
class Mn {
|
|
1685
1757
|
constructor(e) {
|
|
1686
1758
|
this.model = e;
|
|
1687
1759
|
}
|
|
@@ -1691,7 +1763,7 @@ class Tn {
|
|
|
1691
1763
|
e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
|
|
1692
1764
|
}
|
|
1693
1765
|
initY(e, t) {
|
|
1694
|
-
const s =
|
|
1766
|
+
const s = Tn(this.model.candles.preparedData, t);
|
|
1695
1767
|
e.setDomain(s), this.setRange(e, this.model.layout.yAxis);
|
|
1696
1768
|
}
|
|
1697
1769
|
init(e) {
|
|
@@ -1720,7 +1792,7 @@ class Tn {
|
|
|
1720
1792
|
e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
|
|
1721
1793
|
}
|
|
1722
1794
|
}
|
|
1723
|
-
class
|
|
1795
|
+
class An {
|
|
1724
1796
|
constructor(e) {
|
|
1725
1797
|
f(this, "_model");
|
|
1726
1798
|
f(this, "_scaleX");
|
|
@@ -1732,7 +1804,7 @@ class Mn {
|
|
|
1732
1804
|
});
|
|
1733
1805
|
f(this, "scaleFactor", { x: 1, y: 1 });
|
|
1734
1806
|
f(this, "panOffset", { x: 0, y: 0 });
|
|
1735
|
-
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new
|
|
1807
|
+
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new Mn(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
|
|
1736
1808
|
x: this._scaleX.domain(),
|
|
1737
1809
|
y: this._scaleY.domain()
|
|
1738
1810
|
};
|
|
@@ -2004,7 +2076,7 @@ const kn = {
|
|
|
2004
2076
|
}
|
|
2005
2077
|
}
|
|
2006
2078
|
};
|
|
2007
|
-
class
|
|
2079
|
+
class En {
|
|
2008
2080
|
constructor(e) {
|
|
2009
2081
|
f(this, "_scheme");
|
|
2010
2082
|
this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
|
|
@@ -2018,7 +2090,7 @@ class Ln {
|
|
|
2018
2090
|
this._scheme = Qe({}, this._scheme, e);
|
|
2019
2091
|
}
|
|
2020
2092
|
}
|
|
2021
|
-
class
|
|
2093
|
+
class Ln {
|
|
2022
2094
|
constructor(e, t) {
|
|
2023
2095
|
f(this, "_data");
|
|
2024
2096
|
f(this, "_callbacks", {
|
|
@@ -2061,7 +2133,7 @@ class En {
|
|
|
2061
2133
|
this._updateGroups(), this._callbacks.onUpdate(e, t);
|
|
2062
2134
|
}
|
|
2063
2135
|
}
|
|
2064
|
-
class
|
|
2136
|
+
class Fn {
|
|
2065
2137
|
constructor({
|
|
2066
2138
|
chartId: e,
|
|
2067
2139
|
container: t,
|
|
@@ -2083,7 +2155,7 @@ class Nn {
|
|
|
2083
2155
|
f(this, "trade");
|
|
2084
2156
|
f(this, "userMarkers");
|
|
2085
2157
|
f(this, "comments");
|
|
2086
|
-
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new
|
|
2158
|
+
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new En(o), this.layout = new _n(t, this.config), this.scales = new An(this), this.trade = new Sn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new Ln(c, this);
|
|
2087
2159
|
}
|
|
2088
2160
|
init() {
|
|
2089
2161
|
this.eventBus.emit("init_model");
|
|
@@ -2114,7 +2186,7 @@ class Nn {
|
|
|
2114
2186
|
}
|
|
2115
2187
|
}
|
|
2116
2188
|
const qe = window.devicePixelRatio || 2;
|
|
2117
|
-
class
|
|
2189
|
+
class F {
|
|
2118
2190
|
constructor({ tag: e, className: t, id: s, textContent: n }) {
|
|
2119
2191
|
f(this, "_tag");
|
|
2120
2192
|
f(this, "_className");
|
|
@@ -2152,7 +2224,7 @@ class k {
|
|
|
2152
2224
|
this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
|
|
2153
2225
|
}
|
|
2154
2226
|
}
|
|
2155
|
-
class
|
|
2227
|
+
class Le extends F {
|
|
2156
2228
|
constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
|
|
2157
2229
|
super({
|
|
2158
2230
|
tag: "canvas",
|
|
@@ -2184,20 +2256,20 @@ class Ee extends k {
|
|
|
2184
2256
|
return this._height;
|
|
2185
2257
|
}
|
|
2186
2258
|
}
|
|
2187
|
-
const
|
|
2259
|
+
const Nn = 10;
|
|
2188
2260
|
function Hn(i, e) {
|
|
2189
2261
|
const {
|
|
2190
2262
|
layout: { xAxis: t },
|
|
2191
2263
|
colorScheme: { xAxis: s },
|
|
2192
2264
|
config: { xAxis: n },
|
|
2193
2265
|
scales: a
|
|
2194
|
-
} = e, r = a.x.ticks(
|
|
2266
|
+
} = e, r = a.x.ticks(Nn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = L.timeFormat("%d %b"), h = L.timeFormat("%H:%M");
|
|
2195
2267
|
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
2268
|
const g = a.x.convert(d), _ = o(d) ? c(d) : h(d);
|
|
2197
2269
|
i.fillText(_, g, t.y + t.height / 2);
|
|
2198
2270
|
});
|
|
2199
2271
|
}
|
|
2200
|
-
function
|
|
2272
|
+
function In(i, e) {
|
|
2201
2273
|
const {
|
|
2202
2274
|
layout: { yAxis: t },
|
|
2203
2275
|
colorScheme: { yAxis: s },
|
|
@@ -2209,7 +2281,7 @@ function Bn(i, e) {
|
|
|
2209
2281
|
i.fillText(d, t.x + t.width / 2, h);
|
|
2210
2282
|
});
|
|
2211
2283
|
}
|
|
2212
|
-
const
|
|
2284
|
+
const Bn = (i, e) => {
|
|
2213
2285
|
const {
|
|
2214
2286
|
layout: { axisIntersection: t },
|
|
2215
2287
|
colorScheme: s
|
|
@@ -2226,10 +2298,10 @@ class bt {
|
|
|
2226
2298
|
Hn(e, t);
|
|
2227
2299
|
}
|
|
2228
2300
|
static yAxis(e, t) {
|
|
2229
|
-
|
|
2301
|
+
In(e, t);
|
|
2230
2302
|
}
|
|
2231
2303
|
static intersection(e, t) {
|
|
2232
|
-
|
|
2304
|
+
Bn(e, t);
|
|
2233
2305
|
}
|
|
2234
2306
|
}
|
|
2235
2307
|
class Rn {
|
|
@@ -2265,13 +2337,13 @@ function Ke(i) {
|
|
|
2265
2337
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2266
2338
|
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2267
2339
|
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";
|
|
2268
|
-
const b = a + g * 3 + 0.5,
|
|
2269
|
-
i.fillStyle = t, i.fillText(s, n,
|
|
2340
|
+
const b = a + g * 3 + 0.5, x = g * 16, C = b + x / 2;
|
|
2341
|
+
i.fillStyle = t, i.fillText(s, n, C), i.restore();
|
|
2270
2342
|
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2271
2343
|
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2272
2344
|
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";
|
|
2273
|
-
const b = g * 16,
|
|
2274
|
-
i.fillStyle = t, i.fillText(s, n,
|
|
2345
|
+
const b = g * 16, x = a - g * 19 + b / 2;
|
|
2346
|
+
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2275
2347
|
};
|
|
2276
2348
|
function et(i) {
|
|
2277
2349
|
"@babel/helpers - typeof";
|
|
@@ -2282,15 +2354,15 @@ function et(i) {
|
|
|
2282
2354
|
}, et(i);
|
|
2283
2355
|
}
|
|
2284
2356
|
var Pn = /^\s+/, zn = /\s+$/;
|
|
2285
|
-
function
|
|
2286
|
-
if (i = i || "", e = e || {}, i instanceof
|
|
2357
|
+
function A(i, e) {
|
|
2358
|
+
if (i = i || "", e = e || {}, i instanceof A)
|
|
2287
2359
|
return i;
|
|
2288
|
-
if (!(this instanceof
|
|
2289
|
-
return new
|
|
2290
|
-
var t =
|
|
2360
|
+
if (!(this instanceof A))
|
|
2361
|
+
return new A(i, e);
|
|
2362
|
+
var t = Yn(i);
|
|
2291
2363
|
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;
|
|
2292
2364
|
}
|
|
2293
|
-
|
|
2365
|
+
A.prototype = {
|
|
2294
2366
|
isDark: function() {
|
|
2295
2367
|
return this.getBrightness() < 128;
|
|
2296
2368
|
},
|
|
@@ -2371,14 +2443,14 @@ T.prototype = {
|
|
|
2371
2443
|
},
|
|
2372
2444
|
toPercentageRgb: function() {
|
|
2373
2445
|
return {
|
|
2374
|
-
r: Math.round(
|
|
2375
|
-
g: Math.round(
|
|
2376
|
-
b: Math.round(
|
|
2446
|
+
r: Math.round($(this._r, 255) * 100) + "%",
|
|
2447
|
+
g: Math.round($(this._g, 255) * 100) + "%",
|
|
2448
|
+
b: Math.round($(this._b, 255) * 100) + "%",
|
|
2377
2449
|
a: this._a
|
|
2378
2450
|
};
|
|
2379
2451
|
},
|
|
2380
2452
|
toPercentageRgbString: function() {
|
|
2381
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
2453
|
+
return this._a == 1 ? "rgb(" + Math.round($(this._r, 255) * 100) + "%, " + Math.round($(this._g, 255) * 100) + "%, " + Math.round($(this._b, 255) * 100) + "%)" : "rgba(" + Math.round($(this._r, 255) * 100) + "%, " + Math.round($(this._g, 255) * 100) + "%, " + Math.round($(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2382
2454
|
},
|
|
2383
2455
|
toName: function() {
|
|
2384
2456
|
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[hi(this._r, this._g, this._b, !0)] || !1;
|
|
@@ -2386,7 +2458,7 @@ T.prototype = {
|
|
|
2386
2458
|
toFilter: function(e) {
|
|
2387
2459
|
var t = "#" + di(this._r, this._g, this._b, this._a), s = t, n = this._gradientType ? "GradientType = 1, " : "";
|
|
2388
2460
|
if (e) {
|
|
2389
|
-
var a =
|
|
2461
|
+
var a = A(e);
|
|
2390
2462
|
s = "#" + di(a._r, a._g, a._b, a._a);
|
|
2391
2463
|
}
|
|
2392
2464
|
return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + t + ",endColorstr=" + s + ")";
|
|
@@ -2398,7 +2470,7 @@ T.prototype = {
|
|
|
2398
2470
|
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());
|
|
2399
2471
|
},
|
|
2400
2472
|
clone: function() {
|
|
2401
|
-
return
|
|
2473
|
+
return A(this.toString());
|
|
2402
2474
|
},
|
|
2403
2475
|
_applyModification: function(e, t) {
|
|
2404
2476
|
var s = e.apply(null, [this].concat([].slice.call(t)));
|
|
@@ -2451,22 +2523,22 @@ T.prototype = {
|
|
|
2451
2523
|
return this._applyCombination(ui, [4]);
|
|
2452
2524
|
}
|
|
2453
2525
|
};
|
|
2454
|
-
|
|
2526
|
+
A.fromRatio = function(i, e) {
|
|
2455
2527
|
if (et(i) == "object") {
|
|
2456
2528
|
var t = {};
|
|
2457
2529
|
for (var s in i)
|
|
2458
2530
|
i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] = De(i[s]));
|
|
2459
2531
|
i = t;
|
|
2460
2532
|
}
|
|
2461
|
-
return
|
|
2533
|
+
return A(i, e);
|
|
2462
2534
|
};
|
|
2463
|
-
function
|
|
2535
|
+
function Yn(i) {
|
|
2464
2536
|
var e = {
|
|
2465
2537
|
r: 0,
|
|
2466
2538
|
g: 0,
|
|
2467
2539
|
b: 0
|
|
2468
2540
|
}, t = 1, s = null, n = null, a = null, r = !1, o = !1;
|
|
2469
|
-
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e =
|
|
2541
|
+
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Vn(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), {
|
|
2470
2542
|
ok: r,
|
|
2471
2543
|
format: i.format || o,
|
|
2472
2544
|
r: Math.min(255, Math.max(e.r, 0)),
|
|
@@ -2475,15 +2547,15 @@ function Vn(i) {
|
|
|
2475
2547
|
a: t
|
|
2476
2548
|
};
|
|
2477
2549
|
}
|
|
2478
|
-
function
|
|
2550
|
+
function Vn(i, e, t) {
|
|
2479
2551
|
return {
|
|
2480
|
-
r:
|
|
2481
|
-
g:
|
|
2482
|
-
b:
|
|
2552
|
+
r: $(i, 255) * 255,
|
|
2553
|
+
g: $(e, 255) * 255,
|
|
2554
|
+
b: $(t, 255) * 255
|
|
2483
2555
|
};
|
|
2484
2556
|
}
|
|
2485
2557
|
function li(i, e, t) {
|
|
2486
|
-
i =
|
|
2558
|
+
i = $(i, 255), e = $(e, 255), t = $(t, 255);
|
|
2487
2559
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = (s + n) / 2;
|
|
2488
2560
|
if (s == n)
|
|
2489
2561
|
a = r = 0;
|
|
@@ -2510,7 +2582,7 @@ function li(i, e, t) {
|
|
|
2510
2582
|
}
|
|
2511
2583
|
function Wn(i, e, t) {
|
|
2512
2584
|
var s, n, a;
|
|
2513
|
-
i =
|
|
2585
|
+
i = $(i, 360), e = $(e, 100), t = $(t, 100);
|
|
2514
2586
|
function r(h, d, g) {
|
|
2515
2587
|
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;
|
|
2516
2588
|
}
|
|
@@ -2527,7 +2599,7 @@ function Wn(i, e, t) {
|
|
|
2527
2599
|
};
|
|
2528
2600
|
}
|
|
2529
2601
|
function ci(i, e, t) {
|
|
2530
|
-
i =
|
|
2602
|
+
i = $(i, 255), e = $(e, 255), t = $(t, 255);
|
|
2531
2603
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = s, c = s - n;
|
|
2532
2604
|
if (r = s === 0 ? 0 : c / s, s == n)
|
|
2533
2605
|
a = 0;
|
|
@@ -2552,7 +2624,7 @@ function ci(i, e, t) {
|
|
|
2552
2624
|
};
|
|
2553
2625
|
}
|
|
2554
2626
|
function jn(i, e, t) {
|
|
2555
|
-
i =
|
|
2627
|
+
i = $(i, 360) * 6, e = $(e, 100), t = $(t, 100);
|
|
2556
2628
|
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];
|
|
2557
2629
|
return {
|
|
2558
2630
|
r: h * 255,
|
|
@@ -2572,11 +2644,11 @@ function di(i, e, t, s) {
|
|
|
2572
2644
|
var n = [K(wi(s)), K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16))];
|
|
2573
2645
|
return n.join("");
|
|
2574
2646
|
}
|
|
2575
|
-
|
|
2576
|
-
return !i || !e ? !1 :
|
|
2647
|
+
A.equals = function(i, e) {
|
|
2648
|
+
return !i || !e ? !1 : A(i).toRgbString() == A(e).toRgbString();
|
|
2577
2649
|
};
|
|
2578
|
-
|
|
2579
|
-
return
|
|
2650
|
+
A.random = function() {
|
|
2651
|
+
return A.fromRatio({
|
|
2580
2652
|
r: Math.random(),
|
|
2581
2653
|
g: Math.random(),
|
|
2582
2654
|
b: Math.random()
|
|
@@ -2584,45 +2656,45 @@ T.random = function() {
|
|
|
2584
2656
|
};
|
|
2585
2657
|
function Un(i, e) {
|
|
2586
2658
|
e = e === 0 ? 0 : e || 10;
|
|
2587
|
-
var t =
|
|
2588
|
-
return t.s -= e / 100, t.s = it(t.s),
|
|
2659
|
+
var t = A(i).toHsl();
|
|
2660
|
+
return t.s -= e / 100, t.s = it(t.s), A(t);
|
|
2589
2661
|
}
|
|
2590
2662
|
function Gn(i, e) {
|
|
2591
2663
|
e = e === 0 ? 0 : e || 10;
|
|
2592
|
-
var t =
|
|
2593
|
-
return t.s += e / 100, t.s = it(t.s),
|
|
2664
|
+
var t = A(i).toHsl();
|
|
2665
|
+
return t.s += e / 100, t.s = it(t.s), A(t);
|
|
2594
2666
|
}
|
|
2595
2667
|
function Zn(i) {
|
|
2596
|
-
return
|
|
2668
|
+
return A(i).desaturate(100);
|
|
2597
2669
|
}
|
|
2598
2670
|
function qn(i, e) {
|
|
2599
2671
|
e = e === 0 ? 0 : e || 10;
|
|
2600
|
-
var t =
|
|
2601
|
-
return t.l += e / 100, t.l = it(t.l),
|
|
2672
|
+
var t = A(i).toHsl();
|
|
2673
|
+
return t.l += e / 100, t.l = it(t.l), A(t);
|
|
2602
2674
|
}
|
|
2603
2675
|
function Jn(i, e) {
|
|
2604
2676
|
e = e === 0 ? 0 : e || 10;
|
|
2605
|
-
var t =
|
|
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)))),
|
|
2677
|
+
var t = A(i).toRgb();
|
|
2678
|
+
return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), A(t);
|
|
2607
2679
|
}
|
|
2608
2680
|
function Qn(i, e) {
|
|
2609
2681
|
e = e === 0 ? 0 : e || 10;
|
|
2610
|
-
var t =
|
|
2611
|
-
return t.l -= e / 100, t.l = it(t.l),
|
|
2682
|
+
var t = A(i).toHsl();
|
|
2683
|
+
return t.l -= e / 100, t.l = it(t.l), A(t);
|
|
2612
2684
|
}
|
|
2613
2685
|
function Kn(i, e) {
|
|
2614
|
-
var t =
|
|
2615
|
-
return t.h = s < 0 ? 360 + s : s,
|
|
2686
|
+
var t = A(i).toHsl(), s = (t.h + e) % 360;
|
|
2687
|
+
return t.h = s < 0 ? 360 + s : s, A(t);
|
|
2616
2688
|
}
|
|
2617
2689
|
function ea(i) {
|
|
2618
|
-
var e =
|
|
2619
|
-
return e.h = (e.h + 180) % 360,
|
|
2690
|
+
var e = A(i).toHsl();
|
|
2691
|
+
return e.h = (e.h + 180) % 360, A(e);
|
|
2620
2692
|
}
|
|
2621
2693
|
function ui(i, e) {
|
|
2622
2694
|
if (isNaN(e) || e <= 0)
|
|
2623
2695
|
throw new Error("Argument to polyad must be a positive number");
|
|
2624
|
-
for (var t =
|
|
2625
|
-
s.push(
|
|
2696
|
+
for (var t = A(i).toHsl(), s = [A(i)], n = 360 / e, a = 1; a < e; a++)
|
|
2697
|
+
s.push(A({
|
|
2626
2698
|
h: (t.h + a * n) % 360,
|
|
2627
2699
|
s: t.s,
|
|
2628
2700
|
l: t.l
|
|
@@ -2630,12 +2702,12 @@ function ui(i, e) {
|
|
|
2630
2702
|
return s;
|
|
2631
2703
|
}
|
|
2632
2704
|
function ta(i) {
|
|
2633
|
-
var e =
|
|
2634
|
-
return [
|
|
2705
|
+
var e = A(i).toHsl(), t = e.h;
|
|
2706
|
+
return [A(i), A({
|
|
2635
2707
|
h: (t + 72) % 360,
|
|
2636
2708
|
s: e.s,
|
|
2637
2709
|
l: e.l
|
|
2638
|
-
}),
|
|
2710
|
+
}), A({
|
|
2639
2711
|
h: (t + 216) % 360,
|
|
2640
2712
|
s: e.s,
|
|
2641
2713
|
l: e.l
|
|
@@ -2643,37 +2715,37 @@ function ta(i) {
|
|
|
2643
2715
|
}
|
|
2644
2716
|
function ia(i, e, t) {
|
|
2645
2717
|
e = e || 6, t = t || 30;
|
|
2646
|
-
var s =
|
|
2718
|
+
var s = A(i).toHsl(), n = 360 / t, a = [A(i)];
|
|
2647
2719
|
for (s.h = (s.h - (n * e >> 1) + 720) % 360; --e; )
|
|
2648
|
-
s.h = (s.h + n) % 360, a.push(
|
|
2720
|
+
s.h = (s.h + n) % 360, a.push(A(s));
|
|
2649
2721
|
return a;
|
|
2650
2722
|
}
|
|
2651
2723
|
function sa(i, e) {
|
|
2652
2724
|
e = e || 6;
|
|
2653
|
-
for (var t =
|
|
2654
|
-
r.push(
|
|
2725
|
+
for (var t = A(i).toHsv(), s = t.h, n = t.s, a = t.v, r = [], o = 1 / e; e--; )
|
|
2726
|
+
r.push(A({
|
|
2655
2727
|
h: s,
|
|
2656
2728
|
s: n,
|
|
2657
2729
|
v: a
|
|
2658
2730
|
})), a = (a + o) % 1;
|
|
2659
2731
|
return r;
|
|
2660
2732
|
}
|
|
2661
|
-
|
|
2733
|
+
A.mix = function(i, e, t) {
|
|
2662
2734
|
t = t === 0 ? 0 : t || 50;
|
|
2663
|
-
var s =
|
|
2735
|
+
var s = A(i).toRgb(), n = A(e).toRgb(), a = t / 100, r = {
|
|
2664
2736
|
r: (n.r - s.r) * a + s.r,
|
|
2665
2737
|
g: (n.g - s.g) * a + s.g,
|
|
2666
2738
|
b: (n.b - s.b) * a + s.b,
|
|
2667
2739
|
a: (n.a - s.a) * a + s.a
|
|
2668
2740
|
};
|
|
2669
|
-
return
|
|
2741
|
+
return A(r);
|
|
2670
2742
|
};
|
|
2671
|
-
|
|
2672
|
-
var t =
|
|
2743
|
+
A.readability = function(i, e) {
|
|
2744
|
+
var t = A(i), s = A(e);
|
|
2673
2745
|
return (Math.max(t.getLuminance(), s.getLuminance()) + 0.05) / (Math.min(t.getLuminance(), s.getLuminance()) + 0.05);
|
|
2674
2746
|
};
|
|
2675
|
-
|
|
2676
|
-
var s =
|
|
2747
|
+
A.isReadable = function(i, e, t) {
|
|
2748
|
+
var s = A.readability(i, e), n, a;
|
|
2677
2749
|
switch (a = !1, n = ca(t), n.level + n.size) {
|
|
2678
2750
|
case "AAsmall":
|
|
2679
2751
|
case "AAAlarge":
|
|
@@ -2688,17 +2760,17 @@ T.isReadable = function(i, e, t) {
|
|
|
2688
2760
|
}
|
|
2689
2761
|
return a;
|
|
2690
2762
|
};
|
|
2691
|
-
|
|
2763
|
+
A.mostReadable = function(i, e, t) {
|
|
2692
2764
|
var s = null, n = 0, a, r, o, c;
|
|
2693
2765
|
t = t || {}, r = t.includeFallbackColors, o = t.level, c = t.size;
|
|
2694
2766
|
for (var h = 0; h < e.length; h++)
|
|
2695
|
-
a =
|
|
2696
|
-
return
|
|
2767
|
+
a = A.readability(i, e[h]), a > n && (n = a, s = A(e[h]));
|
|
2768
|
+
return A.isReadable(i, s, {
|
|
2697
2769
|
level: o,
|
|
2698
2770
|
size: c
|
|
2699
|
-
}) || !r ? s : (t.includeFallbackColors = !1,
|
|
2771
|
+
}) || !r ? s : (t.includeFallbackColors = !1, A.mostReadable(i, ["#fff", "#000"], t));
|
|
2700
2772
|
};
|
|
2701
|
-
var
|
|
2773
|
+
var Tt = A.names = {
|
|
2702
2774
|
aliceblue: "f0f8ff",
|
|
2703
2775
|
antiquewhite: "faebd7",
|
|
2704
2776
|
aqua: "0ff",
|
|
@@ -2848,7 +2920,7 @@ var At = T.names = {
|
|
|
2848
2920
|
whitesmoke: "f5f5f5",
|
|
2849
2921
|
yellow: "ff0",
|
|
2850
2922
|
yellowgreen: "9acd32"
|
|
2851
|
-
}, na =
|
|
2923
|
+
}, na = A.hexNames = aa(Tt);
|
|
2852
2924
|
function aa(i) {
|
|
2853
2925
|
var e = {};
|
|
2854
2926
|
for (var t in i)
|
|
@@ -2858,7 +2930,7 @@ function aa(i) {
|
|
|
2858
2930
|
function yi(i) {
|
|
2859
2931
|
return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
|
|
2860
2932
|
}
|
|
2861
|
-
function
|
|
2933
|
+
function $(i, e) {
|
|
2862
2934
|
ra(i) && (i = "100%");
|
|
2863
2935
|
var t = oa(i);
|
|
2864
2936
|
return i = Math.min(e, Math.max(0, parseFloat(i))), t && (i = parseInt(i * e, 10) / 100), Math.abs(i - e) < 1e-6 ? 1 : i % e / parseFloat(e);
|
|
@@ -2909,8 +2981,8 @@ function ie(i) {
|
|
|
2909
2981
|
function la(i) {
|
|
2910
2982
|
i = i.replace(Pn, "").replace(zn, "").toLowerCase();
|
|
2911
2983
|
var e = !1;
|
|
2912
|
-
if (
|
|
2913
|
-
i =
|
|
2984
|
+
if (Tt[i])
|
|
2985
|
+
i = Tt[i], e = !0;
|
|
2914
2986
|
else if (i == "transparent")
|
|
2915
2987
|
return {
|
|
2916
2988
|
r: 0,
|
|
@@ -2995,14 +3067,14 @@ function ha(i, e) {
|
|
|
2995
3067
|
t.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
|
|
2996
3068
|
const p = s.convert(g.open_time);
|
|
2997
3069
|
_.forEach((v) => {
|
|
2998
|
-
const b = v.type === "buy",
|
|
2999
|
-
let
|
|
3000
|
-
h && h[1] && h[0] === v.type && (
|
|
3070
|
+
const b = v.type === "buy", x = b ? o.buyLabel.text : o.sellLabel.text, C = b ? "B" : "S", y = b ? n.convert(g.low) + c : n.convert(g.high) - c, w = b ? $n : On;
|
|
3071
|
+
let T = b ? o.buyLabel.main : o.sellLabel.main;
|
|
3072
|
+
h && h[1] && h[0] === v.type && (T = A.mix(T, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (T = o.activeLabel), w(i, {
|
|
3001
3073
|
x: p,
|
|
3002
3074
|
y,
|
|
3003
|
-
symbol:
|
|
3004
|
-
mainColor:
|
|
3005
|
-
textColor:
|
|
3075
|
+
symbol: C,
|
|
3076
|
+
mainColor: T,
|
|
3077
|
+
textColor: x,
|
|
3006
3078
|
size: 16,
|
|
3007
3079
|
fontSize: 12
|
|
3008
3080
|
});
|
|
@@ -3047,9 +3119,9 @@ const ua = (i, e) => {
|
|
|
3047
3119
|
}, d = (g, _) => {
|
|
3048
3120
|
const p = h(g.time), v = h(_.time);
|
|
3049
3121
|
if (!p || !v) return;
|
|
3050
|
-
const b = t.convert(p.open_time),
|
|
3051
|
-
let
|
|
3052
|
-
g.type === "buy" ? (
|
|
3122
|
+
const b = t.convert(p.open_time), x = t.convert(v.open_time);
|
|
3123
|
+
let C, y;
|
|
3124
|
+
g.type === "buy" ? (C = s.convert(p.low), y = s.convert(v.high)) : (C = s.convert(p.high), y = s.convert(v.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.connectionLine, i.moveTo(b, C), i.lineTo(x, y), i.stroke(), i.setLineDash([]);
|
|
3053
3125
|
};
|
|
3054
3126
|
if (a.length === 1 && r.length > 1)
|
|
3055
3127
|
r.forEach((g) => d(a[0], g));
|
|
@@ -3099,7 +3171,7 @@ function ga(i) {
|
|
|
3099
3171
|
return s.length ? s.join(" ") : "0s";
|
|
3100
3172
|
}
|
|
3101
3173
|
const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
3102
|
-
var
|
|
3174
|
+
var z;
|
|
3103
3175
|
const {
|
|
3104
3176
|
scales: { x: t, y: s },
|
|
3105
3177
|
trade: { entries: n, exits: a, holdTime: r },
|
|
@@ -3113,27 +3185,27 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3113
3185
|
if (!c) return;
|
|
3114
3186
|
const _ = n.at(0), p = a.at(-1);
|
|
3115
3187
|
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),
|
|
3117
|
-
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(b,
|
|
3118
|
-
const y = (b +
|
|
3188
|
+
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), x = t.convert(v(d == null ? void 0 : d[1]) || p.candle.open_time), C = s.convert(g || (((z = n.at(0)) == null ? void 0 : z.price) ?? 0));
|
|
3189
|
+
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(b, C), i.lineTo(x, C), i.stroke(), i.setLineDash([]);
|
|
3190
|
+
const y = (b + x) / 2, w = h || `Hold: ${ga(r)}`, S = getComputedStyle(
|
|
3119
3191
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3120
3192
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3121
3193
|
i.font = `600 ${ma}px ${S}`;
|
|
3122
|
-
const
|
|
3194
|
+
const k = i.measureText(w).width + pa * 2, P = va + _a * 2;
|
|
3123
3195
|
xi(i, {
|
|
3124
3196
|
radius: 4,
|
|
3125
3197
|
coords: {
|
|
3126
|
-
x: y -
|
|
3127
|
-
y:
|
|
3198
|
+
x: y - k / 2,
|
|
3199
|
+
y: C - P / 2
|
|
3128
3200
|
},
|
|
3129
|
-
width:
|
|
3130
|
-
height:
|
|
3201
|
+
width: k,
|
|
3202
|
+
height: P,
|
|
3131
3203
|
fillColor: o.main
|
|
3132
|
-
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(
|
|
3204
|
+
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(w, y, C), i.restore();
|
|
3133
3205
|
};
|
|
3134
|
-
class
|
|
3206
|
+
class Fe {
|
|
3135
3207
|
constructor(e, t, {
|
|
3136
|
-
CanvasClass: s =
|
|
3208
|
+
CanvasClass: s = Le,
|
|
3137
3209
|
noCanvas: n = !1,
|
|
3138
3210
|
noDOM: a = !1
|
|
3139
3211
|
} = {}) {
|
|
@@ -3141,7 +3213,7 @@ class Ne {
|
|
|
3141
3213
|
f(this, "dom", null);
|
|
3142
3214
|
f(this, "prefix");
|
|
3143
3215
|
const { width: r, height: o, canvasesContainer: c, domElements: h } = t;
|
|
3144
|
-
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new
|
|
3216
|
+
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new F({ className: `sc-charts-cs__dom-${e}` }), h.append(this.dom.node)), this.prefix = `sc-charts-cs__${e}`;
|
|
3145
3217
|
}
|
|
3146
3218
|
cx(...e) {
|
|
3147
3219
|
return e.map((t) => `${this.prefix}-${t}`).join(" ");
|
|
@@ -3163,35 +3235,35 @@ const ya = {
|
|
|
3163
3235
|
offset: n = 8
|
|
3164
3236
|
}) => {
|
|
3165
3237
|
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
|
|
3166
|
-
const { dx:
|
|
3167
|
-
return { x: S, y:
|
|
3168
|
-
}, d = ({ x: y, y:
|
|
3169
|
-
const y = t.y < 0,
|
|
3170
|
-
return
|
|
3238
|
+
const { dx: w, dy: T } = ya[y], S = t.x + (w === 1 ? n : -a - n), D = t.y + (T === 1 ? n : -r - n);
|
|
3239
|
+
return { x: S, y: D, side: y };
|
|
3240
|
+
}, d = ({ x: y, y: w }) => y >= 0 && w >= 0 && y + a <= o && w + r <= c, g = () => {
|
|
3241
|
+
const y = t.y < 0, w = t.y + r > c, T = t.x < 0, S = t.x + a > o;
|
|
3242
|
+
return T && y ? "right-bottom" : T && w ? "right-top" : S && y ? "left-bottom" : S && w ? "left-top" : T ? "right-bottom" : S ? "left-bottom" : y ? "right-bottom" : w ? "right-top" : s;
|
|
3171
3243
|
}, p = [
|
|
3172
3244
|
s,
|
|
3173
3245
|
"right-bottom",
|
|
3174
3246
|
"right-top",
|
|
3175
3247
|
"left-bottom",
|
|
3176
3248
|
"left-top"
|
|
3177
|
-
].filter((y,
|
|
3249
|
+
].filter((y, w, T) => T.indexOf(y) === w), v = g();
|
|
3178
3250
|
let b = null;
|
|
3179
3251
|
for (const y of [v, ...p]) {
|
|
3180
|
-
const
|
|
3181
|
-
if (d(
|
|
3182
|
-
b =
|
|
3252
|
+
const w = h(y);
|
|
3253
|
+
if (d(w)) {
|
|
3254
|
+
b = w;
|
|
3183
3255
|
break;
|
|
3184
3256
|
}
|
|
3185
3257
|
}
|
|
3186
3258
|
b || (b = h(v));
|
|
3187
|
-
const
|
|
3259
|
+
const x = Math.min(Math.max(b.x, n), o - a - n), C = Math.min(Math.max(b.y, n), c - r - n);
|
|
3188
3260
|
return {
|
|
3189
|
-
x
|
|
3190
|
-
y:
|
|
3261
|
+
x,
|
|
3262
|
+
y: C,
|
|
3191
3263
|
side: b.side
|
|
3192
3264
|
};
|
|
3193
3265
|
};
|
|
3194
|
-
class se extends
|
|
3266
|
+
class se extends F {
|
|
3195
3267
|
constructor(t) {
|
|
3196
3268
|
super(t);
|
|
3197
3269
|
f(this, "_state", {});
|
|
@@ -3234,13 +3306,13 @@ class wa extends se {
|
|
|
3234
3306
|
f(this, "manyBox");
|
|
3235
3307
|
f(this, "oneBox");
|
|
3236
3308
|
f(this, "clsx");
|
|
3237
|
-
this.clsx = t.cxFabric(s), this.title = new
|
|
3309
|
+
this.clsx = t.cxFabric(s), this.title = new F({
|
|
3238
3310
|
tag: "div",
|
|
3239
3311
|
className: this.clsx("title")
|
|
3240
|
-
}), this.manyBox = new
|
|
3312
|
+
}), this.manyBox = new F({
|
|
3241
3313
|
tag: "div",
|
|
3242
3314
|
className: this.clsx("box_many")
|
|
3243
|
-
}), this.oneBox = new
|
|
3315
|
+
}), this.oneBox = new F({
|
|
3244
3316
|
tag: "div",
|
|
3245
3317
|
className: this.clsx("box_one")
|
|
3246
3318
|
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() };
|
|
@@ -3249,13 +3321,13 @@ class wa extends se {
|
|
|
3249
3321
|
const n = [];
|
|
3250
3322
|
for (const a of Object.keys(s))
|
|
3251
3323
|
if (a in t) {
|
|
3252
|
-
const r = new
|
|
3324
|
+
const r = new F({
|
|
3253
3325
|
tag: "div",
|
|
3254
3326
|
className: this.clsx("line")
|
|
3255
3327
|
});
|
|
3256
3328
|
let o = t[a].toString();
|
|
3257
3329
|
a === "kind" && (o = this._formatDate(t.time));
|
|
3258
|
-
const c = new
|
|
3330
|
+
const c = new F({ tag: "strong", textContent: s[a] }), h = new F({ tag: "span", textContent: o });
|
|
3259
3331
|
r.append(c.node, h.node), n.push(r.node);
|
|
3260
3332
|
}
|
|
3261
3333
|
return n;
|
|
@@ -3285,7 +3357,7 @@ class wa extends se {
|
|
|
3285
3357
|
} else if (t.length > 1) {
|
|
3286
3358
|
this.manyBox.node.style.display = "flex";
|
|
3287
3359
|
const s = t.map((n) => {
|
|
3288
|
-
const a = new
|
|
3360
|
+
const a = new F({ tag: "div" }), r = this._createLineNodes(n, {
|
|
3289
3361
|
kind: n.kind === "entry" ? "Entry:" : "Exit:",
|
|
3290
3362
|
price: "Price:"
|
|
3291
3363
|
});
|
|
@@ -3306,7 +3378,7 @@ class wa extends se {
|
|
|
3306
3378
|
this.position(r.x, r.y);
|
|
3307
3379
|
}
|
|
3308
3380
|
}
|
|
3309
|
-
class xa extends
|
|
3381
|
+
class xa extends Fe {
|
|
3310
3382
|
constructor(t) {
|
|
3311
3383
|
super("trade", t);
|
|
3312
3384
|
f(this, "labelTooltip");
|
|
@@ -3321,7 +3393,7 @@ class xa extends Ne {
|
|
|
3321
3393
|
function Ca(i, { color: e = "#000000", lineWidth: t = 1, dashed: s, coords: n }) {
|
|
3322
3394
|
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();
|
|
3323
3395
|
}
|
|
3324
|
-
const
|
|
3396
|
+
const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
3325
3397
|
const {
|
|
3326
3398
|
coords: t,
|
|
3327
3399
|
text: s,
|
|
@@ -3332,19 +3404,19 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ta = (i, e) => {
|
|
|
3332
3404
|
borderRadius: c = 0,
|
|
3333
3405
|
colors: h,
|
|
3334
3406
|
align: d = { x: "left", y: "top" }
|
|
3335
|
-
} = e, g = { ...
|
|
3407
|
+
} = e, g = { ...Ta, ...h }, p = getComputedStyle(
|
|
3336
3408
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3337
3409
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3338
3410
|
i.font = `${a} ${n}px ${p}`;
|
|
3339
|
-
const b = i.measureText(s).width + o.x * 2,
|
|
3340
|
-
let
|
|
3341
|
-
d.x === "middle" ?
|
|
3411
|
+
const b = i.measureText(s).width + o.x * 2, x = r + o.y * 2;
|
|
3412
|
+
let C = t.x, y = t.y;
|
|
3413
|
+
d.x === "middle" ? C -= b / 2 : d.x === "right" && (C -= b), d.y === "middle" ? y -= x / 2 : d.y === "bottom" && (y -= x), xi(i, {
|
|
3342
3414
|
radius: c,
|
|
3343
|
-
coords: { x, y },
|
|
3415
|
+
coords: { x: C, y },
|
|
3344
3416
|
width: b,
|
|
3345
|
-
height:
|
|
3417
|
+
height: x,
|
|
3346
3418
|
fillColor: g.bg
|
|
3347
|
-
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s,
|
|
3419
|
+
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, C + b / 2, y + x / 2);
|
|
3348
3420
|
}, gi = {
|
|
3349
3421
|
line: "#000000",
|
|
3350
3422
|
text: "#ffffff",
|
|
@@ -3363,7 +3435,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ta = (i, e) => {
|
|
|
3363
3435
|
x2: r.x,
|
|
3364
3436
|
y2: r.y
|
|
3365
3437
|
}
|
|
3366
|
-
}),
|
|
3438
|
+
}), Ma(i, {
|
|
3367
3439
|
text: e,
|
|
3368
3440
|
coords: r,
|
|
3369
3441
|
padding: { x: 6, y: 4 },
|
|
@@ -3380,7 +3452,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ta = (i, e) => {
|
|
|
3380
3452
|
}
|
|
3381
3453
|
}), i.restore();
|
|
3382
3454
|
};
|
|
3383
|
-
class
|
|
3455
|
+
class Aa extends Le {
|
|
3384
3456
|
constructor(e) {
|
|
3385
3457
|
super(e);
|
|
3386
3458
|
}
|
|
@@ -3388,9 +3460,9 @@ class Ma extends Ee {
|
|
|
3388
3460
|
Ci(this.ctx, e);
|
|
3389
3461
|
}
|
|
3390
3462
|
}
|
|
3391
|
-
class Sa extends
|
|
3463
|
+
class Sa extends Fe {
|
|
3392
3464
|
constructor(e) {
|
|
3393
|
-
if (super("user-markers", e, { CanvasClass:
|
|
3465
|
+
if (super("user-markers", e, { CanvasClass: Aa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
|
|
3394
3466
|
}
|
|
3395
3467
|
render(e) {
|
|
3396
3468
|
this.canvas.clear();
|
|
@@ -3429,10 +3501,10 @@ class ae {
|
|
|
3429
3501
|
}
|
|
3430
3502
|
}
|
|
3431
3503
|
const yt = new ae("comment-actions");
|
|
3432
|
-
class ka extends
|
|
3504
|
+
class ka extends F {
|
|
3433
3505
|
constructor({ onDelete: e, onUpdate: t }) {
|
|
3434
3506
|
super({ className: yt.gen() });
|
|
3435
|
-
const s = new
|
|
3507
|
+
const s = new F({ tag: "button", className: yt.gen("edit"), textContent: "Edit" }), n = new F({
|
|
3436
3508
|
tag: "button",
|
|
3437
3509
|
className: yt.gen("delete"),
|
|
3438
3510
|
textContent: "Delete"
|
|
@@ -3444,7 +3516,7 @@ class ka extends k {
|
|
|
3444
3516
|
}), this.append(s.node, n.node);
|
|
3445
3517
|
}
|
|
3446
3518
|
}
|
|
3447
|
-
function
|
|
3519
|
+
function Et(i, e) {
|
|
3448
3520
|
var n;
|
|
3449
3521
|
const t = (a) => {
|
|
3450
3522
|
if (!document.contains(i.node)) return;
|
|
@@ -3461,7 +3533,7 @@ function Lt(i, e) {
|
|
|
3461
3533
|
document.removeEventListener("mousedown", t), s == null || s();
|
|
3462
3534
|
}, i;
|
|
3463
3535
|
}
|
|
3464
|
-
class
|
|
3536
|
+
class Ea {
|
|
3465
3537
|
constructor() {
|
|
3466
3538
|
f(this, "node");
|
|
3467
3539
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3499,34 +3571,34 @@ class La {
|
|
|
3499
3571
|
this.node = t;
|
|
3500
3572
|
}
|
|
3501
3573
|
}
|
|
3502
|
-
const
|
|
3503
|
-
class
|
|
3574
|
+
const Ae = new ae("comment-list");
|
|
3575
|
+
class La extends F {
|
|
3504
3576
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3505
|
-
super({ className:
|
|
3577
|
+
super({ className: Ae.gen("item") });
|
|
3506
3578
|
f(this, "actionTooltip");
|
|
3507
3579
|
f(this, "actionsTrigger");
|
|
3508
|
-
const r = new
|
|
3509
|
-
className:
|
|
3580
|
+
const r = new F({ className: Ae.gen("text"), textContent: n.text }), o = new F({
|
|
3581
|
+
className: Ae.gen("created-at"),
|
|
3510
3582
|
textContent: fa(new Date(n.createdAt))
|
|
3511
3583
|
});
|
|
3512
|
-
this.actionsTrigger = new
|
|
3584
|
+
this.actionsTrigger = new F({
|
|
3513
3585
|
tag: "button",
|
|
3514
|
-
className:
|
|
3586
|
+
className: Ae.gen("action-trigger")
|
|
3515
3587
|
});
|
|
3516
3588
|
const c = new ka({
|
|
3517
3589
|
onDelete: t,
|
|
3518
3590
|
onUpdate: s
|
|
3519
3591
|
});
|
|
3520
|
-
this.actionTooltip =
|
|
3592
|
+
this.actionTooltip = Et(c, () => {
|
|
3521
3593
|
this.actionTooltip.setVisible(!1);
|
|
3522
3594
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3523
3595
|
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);
|
|
3524
3596
|
});
|
|
3525
|
-
const h = new
|
|
3526
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new
|
|
3597
|
+
const h = new F({ className: Ae.gen("text-wrap") });
|
|
3598
|
+
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);
|
|
3527
3599
|
}
|
|
3528
3600
|
}
|
|
3529
|
-
class
|
|
3601
|
+
class Fa {
|
|
3530
3602
|
constructor() {
|
|
3531
3603
|
f(this, "node");
|
|
3532
3604
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3538,7 +3610,7 @@ class Na {
|
|
|
3538
3610
|
), s.setAttribute("fill", "currentColor"), t.appendChild(s), this.node = t;
|
|
3539
3611
|
}
|
|
3540
3612
|
}
|
|
3541
|
-
class
|
|
3613
|
+
class Na {
|
|
3542
3614
|
constructor() {
|
|
3543
3615
|
f(this, "node");
|
|
3544
3616
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3558,14 +3630,14 @@ class Ha extends se {
|
|
|
3558
3630
|
f(this, "cancelBtn");
|
|
3559
3631
|
f(this, "_onSave");
|
|
3560
3632
|
f(this, "_onCancel");
|
|
3561
|
-
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new
|
|
3633
|
+
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new F({ tag: "textarea", className: "sc-charts-cs__comments-edit-input" }), this.saveBtn = new F({
|
|
3562
3634
|
tag: "button",
|
|
3563
3635
|
className: "sc-charts-cs__comments-edit-save-btn"
|
|
3564
|
-
}), this.saveBtn.append(new
|
|
3636
|
+
}), this.saveBtn.append(new Fa().node), this.cancelBtn = new F({
|
|
3565
3637
|
tag: "button",
|
|
3566
3638
|
className: "sc-charts-cs__comments-edit-cancel-btn"
|
|
3567
|
-
}), this.cancelBtn.append(new
|
|
3568
|
-
const s = new
|
|
3639
|
+
}), this.cancelBtn.append(new Na().node);
|
|
3640
|
+
const s = new F({ className: "sc-charts-cs__comments-edit-btn-container" });
|
|
3569
3641
|
s.append(this.cancelBtn.node, this.saveBtn.node), this.append(this.input.node, s.node), this.state = { inputValue: t.initialValue || "", hasInitFocused: !1 }, this._setupListeners(), this.render();
|
|
3570
3642
|
}
|
|
3571
3643
|
_setupListeners() {
|
|
@@ -3580,10 +3652,10 @@ class Ha extends se {
|
|
|
3580
3652
|
this.input.node.value = this.state.inputValue, this.saveBtn.node.disabled = !this.state.inputValue.trim(), this.state.hasInitFocused || (requestAnimationFrame(() => this.input.node.focus()), this.setState({ hasInitFocused: !0 }));
|
|
3581
3653
|
}
|
|
3582
3654
|
}
|
|
3583
|
-
const
|
|
3584
|
-
class
|
|
3655
|
+
const Ia = new ae("comment-list");
|
|
3656
|
+
class Ba extends se {
|
|
3585
3657
|
constructor(t, s, n, a = {}) {
|
|
3586
|
-
super({ tag: "ul", className:
|
|
3658
|
+
super({ tag: "ul", className: Ia.gen(), ...a });
|
|
3587
3659
|
f(this, "_elements", {});
|
|
3588
3660
|
f(this, "_model");
|
|
3589
3661
|
f(this, "_view");
|
|
@@ -3608,7 +3680,7 @@ class Ia extends se {
|
|
|
3608
3680
|
},
|
|
3609
3681
|
initialValue: t.text
|
|
3610
3682
|
});
|
|
3611
|
-
const s = new
|
|
3683
|
+
const s = new La({
|
|
3612
3684
|
onDelete: () => {
|
|
3613
3685
|
this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
|
|
3614
3686
|
},
|
|
@@ -3637,17 +3709,17 @@ class Ra {
|
|
|
3637
3709
|
}
|
|
3638
3710
|
}
|
|
3639
3711
|
const Je = new ae(""), wt = new ae("add-field");
|
|
3640
|
-
class
|
|
3712
|
+
class Ti extends se {
|
|
3641
3713
|
constructor({ onAdd: t, blockName: s }) {
|
|
3642
3714
|
Je.block = s;
|
|
3643
3715
|
super({ className: Je.gen() + " " + wt.gen() });
|
|
3644
3716
|
f(this, "btn");
|
|
3645
3717
|
f(this, "input");
|
|
3646
3718
|
f(this, "_onAdd");
|
|
3647
|
-
this._onAdd = t, this.state = { inputValue: "" }, this.input = new
|
|
3719
|
+
this._onAdd = t, this.state = { inputValue: "" }, this.input = new F({
|
|
3648
3720
|
tag: "input",
|
|
3649
3721
|
className: Je.gen("input") + " " + wt.gen("input")
|
|
3650
|
-
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new
|
|
3722
|
+
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new F({
|
|
3651
3723
|
tag: "button",
|
|
3652
3724
|
className: Je.gen("btn") + " " + wt.gen("btn")
|
|
3653
3725
|
}), this.btn.append(new Ra().node), this.append(this.input.node, this.btn.node), this._setupListeners(), this.render();
|
|
@@ -3678,7 +3750,7 @@ class Oa extends se {
|
|
|
3678
3750
|
f(this, "_size", null);
|
|
3679
3751
|
f(this, "_model");
|
|
3680
3752
|
f(this, "_prevIsShow", !1);
|
|
3681
|
-
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new
|
|
3753
|
+
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ba(t, s, n), this._addField = new Ti({
|
|
3682
3754
|
blockName: "list-tooltip-add",
|
|
3683
3755
|
onAdd: (a) => {
|
|
3684
3756
|
const r = t[0].date, o = t[0].price, c = {
|
|
@@ -3732,10 +3804,10 @@ class za extends se {
|
|
|
3732
3804
|
}
|
|
3733
3805
|
}
|
|
3734
3806
|
const mi = new ae("comment-box");
|
|
3735
|
-
class
|
|
3807
|
+
class Ya extends se {
|
|
3736
3808
|
constructor({ boxId: t, model: s, view: n, comments: a, coords: r, onBoxActivate: o, onBoxDeactivate: c }) {
|
|
3737
3809
|
super({ className: mi.gen() });
|
|
3738
|
-
f(this, "pointer", new
|
|
3810
|
+
f(this, "pointer", new F({ className: "sc-charts-cs__comments-pointer" }));
|
|
3739
3811
|
f(this, "tooltip");
|
|
3740
3812
|
f(this, "anchor");
|
|
3741
3813
|
f(this, "_onBoxActivate");
|
|
@@ -3748,7 +3820,7 @@ class Va extends se {
|
|
|
3748
3820
|
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3749
3821
|
const h = !this.state.isActive;
|
|
3750
3822
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3751
|
-
}), this.tooltip =
|
|
3823
|
+
}), this.tooltip = Et(new Oa(a, s, n), (h) => {
|
|
3752
3824
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3753
3825
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3754
3826
|
}
|
|
@@ -3757,11 +3829,11 @@ class Va extends se {
|
|
|
3757
3829
|
this.pointer.position(n), this.pointer.setVisible(t), this.anchor.setState({ x: n.x, isActive: t }), this.tooltip.setState({ comments: s, isShow: t });
|
|
3758
3830
|
}
|
|
3759
3831
|
}
|
|
3760
|
-
class
|
|
3832
|
+
class Va {
|
|
3761
3833
|
static animateTo(e, t, s, n) {
|
|
3762
3834
|
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),
|
|
3764
|
-
e.scales.pan("x",
|
|
3835
|
+
const p = _ - c, v = Math.min(p / o, 1), b = v * v * (3 - 2 * v), x = h + (a - h) * b, C = d + (r - d) * b;
|
|
3836
|
+
e.scales.pan("x", x, "absolute"), e.scales.pan("y", C, "absolute"), v < 1 ? requestAnimationFrame(g) : n == null || n();
|
|
3765
3837
|
};
|
|
3766
3838
|
requestAnimationFrame(g);
|
|
3767
3839
|
}
|
|
@@ -3780,9 +3852,9 @@ class Wa extends se {
|
|
|
3780
3852
|
f(this, "_size", null);
|
|
3781
3853
|
f(this, "_model", null);
|
|
3782
3854
|
f(this, "_candle", null);
|
|
3783
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new
|
|
3855
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new F({ className: Ct.gen("pointer") }), this.menu = new F({ className: Ct.gen("menu") }), Et(this.menu, () => {
|
|
3784
3856
|
this.setState({ isShow: !1 });
|
|
3785
|
-
}), this.addField = new
|
|
3857
|
+
}), this.addField = new Ti({
|
|
3786
3858
|
blockName: "context-add",
|
|
3787
3859
|
onAdd: (t) => {
|
|
3788
3860
|
!this._model || !this._candle || (this._model.comments.add({
|
|
@@ -3816,7 +3888,7 @@ class Wa extends se {
|
|
|
3816
3888
|
this._changeInputCorner(r.side), this.menu.position(r.x, r.y);
|
|
3817
3889
|
}
|
|
3818
3890
|
}
|
|
3819
|
-
class ja extends
|
|
3891
|
+
class ja extends Fe {
|
|
3820
3892
|
constructor(t) {
|
|
3821
3893
|
super("comments", t, { noCanvas: !0 });
|
|
3822
3894
|
f(this, "boxes", {});
|
|
@@ -3832,7 +3904,7 @@ class ja extends Ne {
|
|
|
3832
3904
|
};
|
|
3833
3905
|
}
|
|
3834
3906
|
createBox({ boxId: t, coords: s, model: n, comments: a }) {
|
|
3835
|
-
const r = new
|
|
3907
|
+
const r = new Ya({
|
|
3836
3908
|
boxId: t,
|
|
3837
3909
|
model: n,
|
|
3838
3910
|
comments: a,
|
|
@@ -3840,7 +3912,7 @@ class ja extends Ne {
|
|
|
3840
3912
|
view: this._view,
|
|
3841
3913
|
onBoxActivate: (o) => {
|
|
3842
3914
|
const c = a[0].candle;
|
|
3843
|
-
|
|
3915
|
+
Va.animateToDataCoords(n, c.open_time, (c.open + c.close) / 2), this.boxes[o].setState({ isActive: !0 });
|
|
3844
3916
|
},
|
|
3845
3917
|
onBoxDeactivate: (o) => this.boxes[o].setState({ isActive: !1 })
|
|
3846
3918
|
});
|
|
@@ -3857,7 +3929,7 @@ class ja extends Ne {
|
|
|
3857
3929
|
});
|
|
3858
3930
|
}
|
|
3859
3931
|
}
|
|
3860
|
-
class Xa extends
|
|
3932
|
+
class Xa extends Le {
|
|
3861
3933
|
constructor(e) {
|
|
3862
3934
|
super(e);
|
|
3863
3935
|
}
|
|
@@ -3872,7 +3944,7 @@ class Xa extends Ee {
|
|
|
3872
3944
|
});
|
|
3873
3945
|
}
|
|
3874
3946
|
}
|
|
3875
|
-
class Ua extends
|
|
3947
|
+
class Ua extends Fe {
|
|
3876
3948
|
constructor(e) {
|
|
3877
3949
|
if (super("guides", e, { CanvasClass: Xa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_Guides] Canvas must be defined");
|
|
3878
3950
|
}
|
|
@@ -3905,7 +3977,7 @@ class Ga extends se {
|
|
|
3905
3977
|
constructor(t) {
|
|
3906
3978
|
super({ className: t });
|
|
3907
3979
|
f(this, "_isFirstShow", !1);
|
|
3908
|
-
const s = new
|
|
3980
|
+
const s = new F({ tag: "p" });
|
|
3909
3981
|
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() }, this.render();
|
|
3910
3982
|
}
|
|
3911
3983
|
render() {
|
|
@@ -3919,7 +3991,7 @@ class Ga extends se {
|
|
|
3919
3991
|
this.position(r.x, r.y);
|
|
3920
3992
|
}
|
|
3921
3993
|
}
|
|
3922
|
-
class Za extends
|
|
3994
|
+
class Za extends Le {
|
|
3923
3995
|
constructor(t) {
|
|
3924
3996
|
super(t);
|
|
3925
3997
|
f(this, "domain", null);
|
|
@@ -3959,7 +4031,7 @@ class Za extends Ee {
|
|
|
3959
4031
|
});
|
|
3960
4032
|
}
|
|
3961
4033
|
_mix(t, s, n) {
|
|
3962
|
-
return n ?
|
|
4034
|
+
return n ? A.mix(t, s).toString() : t;
|
|
3963
4035
|
}
|
|
3964
4036
|
_getBasicCandleProps(t, s) {
|
|
3965
4037
|
return {
|
|
@@ -3975,14 +4047,14 @@ class Za extends Ee {
|
|
|
3975
4047
|
};
|
|
3976
4048
|
}
|
|
3977
4049
|
}
|
|
3978
|
-
class qa extends
|
|
4050
|
+
class qa extends Fe {
|
|
3979
4051
|
constructor(t) {
|
|
3980
4052
|
super("candles", t, { CanvasClass: Za });
|
|
3981
4053
|
f(this, "_noDataTooltip", null);
|
|
3982
4054
|
f(this, "limiter");
|
|
3983
4055
|
if (!this.dom) throw new Error("[CS_V_Candles] this.dom must be defined");
|
|
3984
4056
|
if (!this.canvas) throw new Error("[CS_V_Candles] this.canvas must be defined");
|
|
3985
|
-
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new
|
|
4057
|
+
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new F({ className: this.cx("limiter") }), this.limiter.setVisible(!1), this.dom.append(this._noDataTooltip.node, this.limiter.node);
|
|
3986
4058
|
}
|
|
3987
4059
|
get noDataTooltip() {
|
|
3988
4060
|
return this._noDataTooltip;
|
|
@@ -4015,14 +4087,14 @@ class Ja {
|
|
|
4015
4087
|
f(this, "trade");
|
|
4016
4088
|
f(this, "comments");
|
|
4017
4089
|
f(this, "candles");
|
|
4018
|
-
this.container = e, this.wrapper = new
|
|
4090
|
+
this.container = e, this.wrapper = new F({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
|
|
4019
4091
|
const { width: t, height: s } = e.getBoundingClientRect();
|
|
4020
|
-
this.width = t, this.height = s, this.mainCanvas = new
|
|
4092
|
+
this.width = t, this.height = s, this.mainCanvas = new Le({
|
|
4021
4093
|
className: "sc-charts-cs__canvas-main",
|
|
4022
4094
|
width: t,
|
|
4023
4095
|
height: s,
|
|
4024
4096
|
isMain: !0
|
|
4025
|
-
}), this.domElements = new
|
|
4097
|
+
}), this.domElements = new F({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new F({ 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);
|
|
4026
4098
|
}
|
|
4027
4099
|
renderAll(e) {
|
|
4028
4100
|
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);
|
|
@@ -4343,10 +4415,10 @@ class sr {
|
|
|
4343
4415
|
for (const { candle: c, trades: h } of s) {
|
|
4344
4416
|
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = r, p = r;
|
|
4345
4417
|
for (const v of ["buy", "sell"]) {
|
|
4346
|
-
const b = h.filter((
|
|
4418
|
+
const b = h.filter((w) => w.type === v);
|
|
4347
4419
|
if (!b.length) continue;
|
|
4348
|
-
const
|
|
4349
|
-
if (
|
|
4420
|
+
const x = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), C = e >= g - _ / 2 && e <= g + _ / 2, y = t >= x && t <= x + p;
|
|
4421
|
+
if (C && y)
|
|
4350
4422
|
return {
|
|
4351
4423
|
target: this,
|
|
4352
4424
|
type: "trade-label",
|
|
@@ -4451,14 +4523,14 @@ function cr(i, e) {
|
|
|
4451
4523
|
}));
|
|
4452
4524
|
};
|
|
4453
4525
|
}
|
|
4454
|
-
function
|
|
4526
|
+
function Mt(i, e) {
|
|
4455
4527
|
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;
|
|
4456
4528
|
r > 0 && i.scales.pan("x", -r);
|
|
4457
4529
|
}
|
|
4458
|
-
function
|
|
4530
|
+
function At(i) {
|
|
4459
4531
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4460
4532
|
}
|
|
4461
|
-
class
|
|
4533
|
+
class Lt {
|
|
4462
4534
|
constructor(e, t, s) {
|
|
4463
4535
|
f(this, "_model");
|
|
4464
4536
|
f(this, "_hitManager");
|
|
@@ -4466,7 +4538,7 @@ class Et {
|
|
|
4466
4538
|
this._model = e, this._hitManager = t, this._hit = s, t.register(s);
|
|
4467
4539
|
}
|
|
4468
4540
|
}
|
|
4469
|
-
class hr extends
|
|
4541
|
+
class hr extends Lt {
|
|
4470
4542
|
constructor(t, s, n) {
|
|
4471
4543
|
super(t, s, new ar(t));
|
|
4472
4544
|
f(this, "_view");
|
|
@@ -4475,13 +4547,13 @@ class hr extends Et {
|
|
|
4475
4547
|
register() {
|
|
4476
4548
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4477
4549
|
const s = t.x - (t.prevX ?? t.x);
|
|
4478
|
-
this._model.scales.scale("x", -s), this._view &&
|
|
4550
|
+
this._model.scales.scale("x", -s), this._view && At(this._view) && Mt(this._model, this._view);
|
|
4479
4551
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4480
4552
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4481
4553
|
});
|
|
4482
4554
|
}
|
|
4483
4555
|
}
|
|
4484
|
-
class dr extends
|
|
4556
|
+
class dr extends Lt {
|
|
4485
4557
|
constructor(e, t) {
|
|
4486
4558
|
super(e, t, new or(e));
|
|
4487
4559
|
}
|
|
@@ -4494,7 +4566,7 @@ class dr extends Et {
|
|
|
4494
4566
|
});
|
|
4495
4567
|
}
|
|
4496
4568
|
}
|
|
4497
|
-
class ur extends
|
|
4569
|
+
class ur extends Lt {
|
|
4498
4570
|
constructor(t, s, n) {
|
|
4499
4571
|
super(t, n, new rr(t));
|
|
4500
4572
|
f(this, "_view");
|
|
@@ -4513,7 +4585,7 @@ class ur extends Et {
|
|
|
4513
4585
|
this._hit,
|
|
4514
4586
|
"drag",
|
|
4515
4587
|
cr(1, (t) => {
|
|
4516
|
-
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)),
|
|
4588
|
+
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), At(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 });
|
|
4517
4589
|
})
|
|
4518
4590
|
), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
|
|
4519
4591
|
const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
|
|
@@ -4522,7 +4594,7 @@ class ur extends Et {
|
|
|
4522
4594
|
var a, r;
|
|
4523
4595
|
if (!t.deltaY) return;
|
|
4524
4596
|
const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
|
|
4525
|
-
["x", "both"].includes(n) && (this._model.scales.scale("x", s),
|
|
4597
|
+
["x", "both"].includes(n) && (this._model.scales.scale("x", s), At(this._view) && Mt(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
|
|
4526
4598
|
});
|
|
4527
4599
|
}
|
|
4528
4600
|
}
|
|
@@ -4619,7 +4691,7 @@ class _r {
|
|
|
4619
4691
|
throw new Error(
|
|
4620
4692
|
"chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
|
|
4621
4693
|
);
|
|
4622
|
-
if (this._model = new
|
|
4694
|
+
if (this._model = new Fn({
|
|
4623
4695
|
chartId: t,
|
|
4624
4696
|
candles: s,
|
|
4625
4697
|
config: n,
|
|
@@ -4698,20 +4770,20 @@ class _r {
|
|
|
4698
4770
|
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
4771
|
const p = [];
|
|
4700
4772
|
if (t.pair && p.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
|
|
4701
|
-
const
|
|
4702
|
-
p.push({ label: "Net P&L", value: t.net_pnl, valueColor:
|
|
4773
|
+
const w = t.net_pnl.startsWith("+");
|
|
4774
|
+
p.push({ label: "Net P&L", value: t.net_pnl, valueColor: w ? "#56B683" : "#F18169" });
|
|
4703
4775
|
}
|
|
4704
4776
|
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
4777
|
const v = _ + c / 2, b = 24 * r;
|
|
4706
4778
|
if (p.length === 0) return;
|
|
4707
4779
|
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4708
|
-
const
|
|
4780
|
+
const x = o ? "#878788" : "#8E8E93", C = o ? "#FAFAFA" : "#1C2026";
|
|
4709
4781
|
let y = h;
|
|
4710
|
-
p.forEach((
|
|
4711
|
-
const
|
|
4712
|
-
e.fillStyle =
|
|
4713
|
-
const
|
|
4714
|
-
e.fillStyle =
|
|
4782
|
+
p.forEach((w) => {
|
|
4783
|
+
const T = e.measureText(w.label).width, S = e.measureText(w.value).width, D = T + g + S;
|
|
4784
|
+
e.fillStyle = x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(w.label, y, v);
|
|
4785
|
+
const k = y + T + g;
|
|
4786
|
+
e.fillStyle = w.valueColor || C, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(w.value, k, v), y += D + b;
|
|
4715
4787
|
});
|
|
4716
4788
|
}
|
|
4717
4789
|
async captureScreenshot(e = {}) {
|
|
@@ -4729,29 +4801,29 @@ class _r {
|
|
|
4729
4801
|
console.warn("No canvas elements found for screenshot");
|
|
4730
4802
|
return;
|
|
4731
4803
|
}
|
|
4732
|
-
const b = 1440,
|
|
4733
|
-
let
|
|
4734
|
-
|
|
4735
|
-
const
|
|
4736
|
-
U.width = b *
|
|
4804
|
+
const b = 1440, x = 900, C = 48, y = 20, w = c ? 32 : 0, T = x - C - y - w, S = b, D = _ / p, k = S / T;
|
|
4805
|
+
let P, z, Y = 0, re = 0;
|
|
4806
|
+
D > k ? (z = T, P = z * D, Y = 0, re = 0) : (P = S, z = P / D, re = (T - z) / 2);
|
|
4807
|
+
const V = window.devicePixelRatio || 1, U = document.createElement("canvas");
|
|
4808
|
+
U.width = b * V, U.height = x * V;
|
|
4737
4809
|
const G = U.getContext("2d");
|
|
4738
4810
|
if (!G) {
|
|
4739
4811
|
console.error("Failed to get 2D context for merged canvas");
|
|
4740
4812
|
return;
|
|
4741
4813
|
}
|
|
4742
4814
|
G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, U.width, U.height);
|
|
4743
|
-
const
|
|
4744
|
-
await this._drawHeader(G, U.width,
|
|
4815
|
+
const Ne = C * V, st = y * V, oe = T * V, ve = S * V, be = Ne + st;
|
|
4816
|
+
await this._drawHeader(G, U.width, V, h), this._drawHeaderSecondLine(G, r, o, U.width, Ne, V, h);
|
|
4745
4817
|
const He = this._view.mainCanvas;
|
|
4746
4818
|
He.background && (G.fillStyle = He.background, G.fillRect(0, be, U.width, oe));
|
|
4747
|
-
const
|
|
4819
|
+
const Ie = P * V, Be = z * V, H = Y * V, Re = re * V;
|
|
4748
4820
|
v.forEach((O) => {
|
|
4749
|
-
let ee = 0, Z = 0, q = O.width, ge = O.height, ye =
|
|
4750
|
-
if (
|
|
4751
|
-
const le =
|
|
4821
|
+
let ee = 0, Z = 0, q = O.width, ge = O.height, ye = Ie, we = Be, Oe = H, Pe = Re;
|
|
4822
|
+
if (D > k) {
|
|
4823
|
+
const le = Be / O.height, ce = O.width * le;
|
|
4752
4824
|
ce > ve && (ee = (ce - ve) / le, q = O.width - ee, ye = ve, Oe = 0);
|
|
4753
4825
|
} else {
|
|
4754
|
-
const le =
|
|
4826
|
+
const le = Ie / O.width, ce = O.height * le;
|
|
4755
4827
|
if (ce > oe) {
|
|
4756
4828
|
const xe = (ce - oe) / le;
|
|
4757
4829
|
Z = xe / 2, ge = O.height - xe, we = oe, Pe = 0;
|
|
@@ -4768,7 +4840,7 @@ class _r {
|
|
|
4768
4840
|
ye,
|
|
4769
4841
|
we
|
|
4770
4842
|
);
|
|
4771
|
-
}), c && this._drawFooter(G, c, U.width, be, oe,
|
|
4843
|
+
}), c && this._drawFooter(G, c, U.width, be, oe, V, h);
|
|
4772
4844
|
const $e = (O, ee) => {
|
|
4773
4845
|
const Z = URL.createObjectURL(O), q = document.createElement("a");
|
|
4774
4846
|
q.href = Z, q.download = ee, document.body.appendChild(q), q.click(), document.body.removeChild(q), URL.revokeObjectURL(Z);
|