charts-core 1.1.17 → 1.1.19
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 +1211 -1297
- package/dist/charts-core.js.map +1 -1
- package/dist/charts-core.umd.cjs +2 -2
- package/dist/charts-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/charts-core.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (i, t, e) =>
|
|
1
|
+
var Es = Object.defineProperty;
|
|
2
|
+
var Ns = (i, t, e) => t in i ? Es(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var u = (i, t, e) => Ns(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import * as D from "d3";
|
|
5
|
-
const
|
|
6
|
-
const { svg: t, config: e, y: s, width: n } = i, { margin: r, yAxis: a } = e, { customTicks:
|
|
5
|
+
const Fs = (i) => {
|
|
6
|
+
const { svg: t, config: e, y: s, width: n } = i, { margin: r, yAxis: a } = e, { customTicks: l, tickFormat: c, tickValues: d, ticks: f, isShow: g } = a;
|
|
7
7
|
if (!g) return null;
|
|
8
8
|
t.append("g").attr("transform", `translate(${n - r.right},0)`).call((_) => {
|
|
9
9
|
let p = D.axisRight(s);
|
|
10
|
-
|
|
11
|
-
const b = Number(v),
|
|
12
|
-
return Math.abs(b) >= 1e12 ?
|
|
13
|
-
}),
|
|
10
|
+
l && c ? p = p.tickFormat(c) : p = p.tickFormat((v) => {
|
|
11
|
+
const b = Number(v), x = (w) => w.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
|
+
}), l && f && (p = Array.isArray(f) ? p.ticks(...f) : p.ticks(f)), l && d && (p = p.tickValues(d)), _.call(p);
|
|
14
14
|
}).call((_) => {
|
|
15
15
|
let p = [];
|
|
16
16
|
_.selectAll(".tick").each((v) => p.push(v)), i.yTicks = p;
|
|
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
|
|
24
|
-
C.attr("x", H), C.remove(), (
|
|
20
|
+
const v = p.nodes().map((x) => x.getBBox().width), b = Math.max(...v);
|
|
21
|
+
_.selectAll(".tick").each(function(x, w) {
|
|
22
|
+
var $;
|
|
23
|
+
const y = D.select(this), C = y.select("text"), T = v[w], H = b - T, R = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
C.attr("x", H), C.remove(), ($ = R.node()) == null || $.appendChild(C.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
|
-
},
|
|
28
|
-
const { svg: t, config: e, x: s, height: n } = i, { margin: r, xAxis: a } = e, { isShow:
|
|
29
|
-
if (!
|
|
27
|
+
}, Bs = (i) => {
|
|
28
|
+
const { svg: t, config: e, x: s, height: n } = i, { margin: r, xAxis: a } = e, { isShow: l, tickValues: c, tickFormat: d, customTicks: f, ticks: g } = a;
|
|
29
|
+
if (!l) return null;
|
|
30
30
|
t.append("g").attr("transform", `translate(0,${n - r.bottom})`).call((_) => {
|
|
31
31
|
let p = D.axisBottom(s);
|
|
32
|
-
f ? (
|
|
32
|
+
f ? (d && (p = p.tickFormat(d)), g && (p = Array.isArray(g) ? p.ticks(...g) : p.ticks(g)), c && (p = p.tickValues(c))) : p.ticks(5), _.call(p);
|
|
33
33
|
}).call((_) => _.select(".domain").remove()).call((_) => {
|
|
34
34
|
let p = [];
|
|
35
35
|
_.selectAll(".tick").each((v) => p.push(v)), i.xTicks = p;
|
|
36
36
|
}).call((_) => _.selectAll(".tick line").remove()).call((_) => _.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
|
|
37
|
-
},
|
|
37
|
+
}, Is = (i) => {
|
|
38
38
|
const { svg: t, config: e, y: s, width: n } = i, {
|
|
39
39
|
margin: r,
|
|
40
40
|
grid: { horizontalStyle: a }
|
|
41
41
|
} = e;
|
|
42
42
|
if (a !== "none") {
|
|
43
43
|
if (a.startsWith("zero-line")) {
|
|
44
|
-
const
|
|
45
|
-
a === "zero-line-dashed" &&
|
|
44
|
+
const l = t.append("line").attr("x1", 0 + r.left).attr("x2", n - r.right).attr("y1", s(0)).attr("y2", s(0)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
45
|
+
a === "zero-line-dashed" && l.attr("stroke-dasharray", "4 4");
|
|
46
46
|
}
|
|
47
47
|
a.startsWith("every-line") && (i.yTicks || s.ticks()).forEach((c) => {
|
|
48
|
-
const
|
|
49
|
-
a === "every-line-dashed" &&
|
|
48
|
+
const d = t.append("line").attr("x1", 0 + r.left).attr("x2", n - r.right).attr("y1", s(c)).attr("y2", s(c)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
49
|
+
a === "every-line-dashed" && d.attr("stroke-dasharray", "4 4");
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, Hs = (i) => {
|
|
53
53
|
const t = Array.from(i.childNodes);
|
|
54
54
|
for (let e = 0; e < t.length; e++)
|
|
55
55
|
i.removeChild(t[e]);
|
|
56
|
-
},
|
|
56
|
+
}, Rs = (i) => {
|
|
57
57
|
const t = "http://www.w3.org/2000/svg", e = document.createElement("div");
|
|
58
58
|
e.className = "sc-charts__hovered-circles-tooltip-container", e.style.display = "none";
|
|
59
59
|
const s = document.createElement("div");
|
|
@@ -68,7 +68,7 @@ const Ds = (i) => {
|
|
|
68
68
|
tooltip: s,
|
|
69
69
|
tooltipArrow: n
|
|
70
70
|
};
|
|
71
|
-
},
|
|
71
|
+
}, $s = (i, t, {
|
|
72
72
|
x: e,
|
|
73
73
|
y: s,
|
|
74
74
|
r: n = 3.5,
|
|
@@ -84,66 +84,66 @@ const Ds = (i) => {
|
|
|
84
84
|
return a.append("circle").attr("cx", e).attr("cy", s).attr("r", n).classed("sc-charts__hovered-circles", !0), a.append("circle").attr("cx", e).attr("cy", s).attr("r", n + r).classed("sc-charts__hovered-circles_add", !0), a;
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
function
|
|
87
|
+
function Ps(i, t, e, s) {
|
|
88
88
|
if (!i) return null;
|
|
89
89
|
const n = i.width / 2, r = t - n, a = t + n;
|
|
90
90
|
return r < e ? e : a > s ? s - i.width : t - n;
|
|
91
91
|
}
|
|
92
|
-
const
|
|
93
|
-
const { svg: t, config: e, x: s, y: n, height: r, data: a, wrapperNode:
|
|
92
|
+
const Ee = (i, { x1: t, x2: e, y1: s, y2: n }) => i.append("line").attr("x1", t).attr("x2", e).attr("y1", s).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), zs = (i) => {
|
|
93
|
+
const { svg: t, config: e, x: s, y: n, height: r, data: a, wrapperNode: l } = i, {
|
|
94
94
|
margin: c,
|
|
95
|
-
grid: { verticalStyle:
|
|
95
|
+
grid: { verticalStyle: d, tooltipNode: f, hoverCirclesRadius: g, hoverCirclesAdditionalArea: _ }
|
|
96
96
|
} = e;
|
|
97
|
-
if (
|
|
97
|
+
if (d !== "none" && (d.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
|
|
98
98
|
const b = t.append("line").attr("x1", s(v)).attr("x2", s(v)).attr("y1", c.top).attr("y2", r - c.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
99
|
-
|
|
100
|
-
}),
|
|
99
|
+
d === "every-line-dashed" && b.attr("stroke-dasharray", "4 4");
|
|
100
|
+
}), d === "hovered-circles")) {
|
|
101
101
|
const p = n.range()[0], v = s(a[0].date), b = s(a[a.length - 1].date);
|
|
102
|
-
|
|
103
|
-
const { tooltipContainer:
|
|
102
|
+
Ee(t, { x1: v, x2: b, y1: p, y2: p });
|
|
103
|
+
const { tooltipContainer: x, tooltip: w, tooltipArrow: y } = Rs(l);
|
|
104
104
|
a.forEach((C, T) => {
|
|
105
|
-
const H = s(C.date),
|
|
106
|
-
Y ||
|
|
107
|
-
const
|
|
105
|
+
const H = s(C.date), R = n(C.value), $ = a[T - 1], Y = T > 0 && $ && C.value === $.value;
|
|
106
|
+
Y || Ee(t, { x1: H, x2: H, y1: R, y2: p });
|
|
107
|
+
const it = $s(t, Y, {
|
|
108
108
|
x: H,
|
|
109
109
|
y: p,
|
|
110
110
|
r: g,
|
|
111
111
|
hr: _
|
|
112
112
|
});
|
|
113
|
-
f &&
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
113
|
+
f && it.on("mouseover", function() {
|
|
114
|
+
Hs(w), x.style.display = "block", w.append(f({ date: C.date, value: Y ? null : C.value }));
|
|
115
|
+
const Z = w.getBoundingClientRect(), Bt = Ps(
|
|
116
|
+
Z,
|
|
117
117
|
s(C.date),
|
|
118
118
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
119
119
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
120
120
|
);
|
|
121
|
-
w.style.left = Bt + "px",
|
|
121
|
+
w.style.left = Bt + "px", y.style.left = s(C.date) + "px";
|
|
122
122
|
}).on("mouseout", function() {
|
|
123
|
-
|
|
123
|
+
x.style.display = "none";
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
},
|
|
127
|
+
}, Os = (i) => {
|
|
128
|
+
Is(i), zs(i);
|
|
129
|
+
}, Ys = (i) => {
|
|
130
130
|
const { svg: t, config: e, width: s, height: n } = i, { margin: r, logo: a } = e;
|
|
131
|
-
|
|
132
|
-
},
|
|
131
|
+
Bs(i), Fs(i), a && t.append("image").attr("xlink:href", e.theme === "dark" ? a.picDarkTheme : a.picLightTheme).attr("width", a.width).attr("height", a.height).attr("x", a.x ?? (s - r.left - r.right) / 2 - a.width / 2 + r.left).attr("y", a.y ?? (n - r.top - r.bottom) / 2 - a.height / 2 + r.top), Os(i);
|
|
132
|
+
}, mt = (i, t, e) => {
|
|
133
133
|
let s = i.select(`#${t}`);
|
|
134
134
|
return s.empty() && (s = i.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", t)), s.attr("x1", e.x1).attr("y1", e.x2).attr("x2", e.y1).attr("y2", e.y2), e.stops.forEach(({ offset: n, stopColor: r }) => {
|
|
135
135
|
s.append("stop").attr("offset", n).attr("stop-color", r);
|
|
136
136
|
}), s;
|
|
137
|
-
},
|
|
137
|
+
}, rt = (i) => {
|
|
138
138
|
const t = D.select(i).select("defs");
|
|
139
139
|
return t.empty() ? D.select(i).append("defs") : t;
|
|
140
|
-
},
|
|
140
|
+
}, Qe = (i) => {
|
|
141
141
|
const {
|
|
142
142
|
y: t,
|
|
143
143
|
config: { margin: e }
|
|
144
144
|
} = i, s = t.range()[0] - t(0), n = t.range()[0] - s >= 0 ? t.range()[0] - s : 0, r = s + e.bottom >= 0 ? s + e.bottom : 0;
|
|
145
145
|
return { x: 0, y: n, width: "100%", height: r };
|
|
146
|
-
},
|
|
146
|
+
}, Ne = (i, t) => ({
|
|
147
147
|
...i,
|
|
148
148
|
...t,
|
|
149
149
|
margin: {
|
|
@@ -178,8 +178,8 @@ const De = (i, { x1: t, x2: e, y1: s, y2: n }) => i.append("line").attr("x1", t)
|
|
|
178
178
|
...i.selection,
|
|
179
179
|
...t == null ? void 0 : t.selection
|
|
180
180
|
}
|
|
181
|
-
}),
|
|
182
|
-
const e = i.node(), s =
|
|
181
|
+
}), Fe = (i, t = {}) => {
|
|
182
|
+
const e = i.node(), s = rt(e), n = (l, c) => mt(s, l, {
|
|
183
183
|
x1: "0%",
|
|
184
184
|
y1: "0%",
|
|
185
185
|
x2: "0%",
|
|
@@ -194,32 +194,32 @@ const De = (i, { x1: t, x2: e, y1: s, y2: n }) => i.append("line").attr("x1", t)
|
|
|
194
194
|
n("gradient-range-borders-up", "var(--sc-color-selection-up)"), n("gradient-range-borders-down", "var(--sc-color-selection-down)");
|
|
195
195
|
const r = "sc-charts__border-range-line", a = i.append("line").classed(r, !0).style("display", t.hidden ? "none" : "block");
|
|
196
196
|
return {
|
|
197
|
-
className(
|
|
198
|
-
|
|
197
|
+
className(l, c) {
|
|
198
|
+
l === "remove" ? a.classed(`${r}${c}`, !1) : a.classed(`${r}${c}`, !0);
|
|
199
199
|
},
|
|
200
|
-
update({ x1:
|
|
201
|
-
|
|
200
|
+
update({ x1: l, x2: c, y1: d, y2: f, hidden: g }) {
|
|
201
|
+
l !== void 0 && a.attr("x1", l), c !== void 0 && a.attr("x2", c), d !== void 0 && a.attr("y1", d), f !== void 0 && a.attr("y2", f), g !== void 0 && a.style("display", g ? "none" : "block");
|
|
202
202
|
},
|
|
203
203
|
destroy() {
|
|
204
204
|
a.remove();
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
|
-
},
|
|
207
|
+
}, Ut = (i, t = {}) => {
|
|
208
208
|
const e = i.append("circle").attr("r", t.radius || 4).style("display", t.hidden ? "none" : "block"), s = t.className || "";
|
|
209
209
|
return s && e.classed(s, !0), {
|
|
210
210
|
className(n, r) {
|
|
211
211
|
n === "remove" ? e.classed(`${s}${r}`, !1) : e.classed(`${s}${r}`, !0);
|
|
212
212
|
},
|
|
213
|
-
update({ cx: n, cy: r, hidden: a, fill:
|
|
214
|
-
n !== void 0 && e.attr("cx", n), r !== void 0 && e.attr("cy", r),
|
|
213
|
+
update({ cx: n, cy: r, hidden: a, fill: l }) {
|
|
214
|
+
n !== void 0 && e.attr("cx", n), r !== void 0 && e.attr("cy", r), l !== void 0 && e.attr("fill", l), a !== void 0 && e.style("display", a ? "none" : "block");
|
|
215
215
|
},
|
|
216
216
|
destroy() {
|
|
217
217
|
e.remove();
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
-
},
|
|
221
|
-
const e = "sc-charts__hover-line", s = i.append("line").style("display", t.hidden ? "none" : "block").classed(e, !0), n = i.node(), r =
|
|
222
|
-
return ((
|
|
220
|
+
}, js = (i, t = {}) => {
|
|
221
|
+
const e = "sc-charts__hover-line", s = i.append("line").style("display", t.hidden ? "none" : "block").classed(e, !0), n = i.node(), r = rt(n);
|
|
222
|
+
return ((l, c) => mt(r, l, {
|
|
223
223
|
x1: "0%",
|
|
224
224
|
y1: "0%",
|
|
225
225
|
x2: "0%",
|
|
@@ -231,62 +231,62 @@ const De = (i, { x1: t, x2: e, y1: s, y2: n }) => i.append("line").attr("x1", t)
|
|
|
231
231
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
232
232
|
]
|
|
233
233
|
}))("hover-line-gradient", "var(--sc-color-hover-line)"), {
|
|
234
|
-
className(
|
|
235
|
-
|
|
234
|
+
className(l, c) {
|
|
235
|
+
l === "remove" ? s.classed(`${e}${c}`, !1) : s.classed(`${e}${c}`, !0);
|
|
236
236
|
},
|
|
237
|
-
update({ x1:
|
|
238
|
-
|
|
237
|
+
update({ x1: l, x2: c, y1: d, y2: f, hidden: g }) {
|
|
238
|
+
l !== void 0 && s.attr("x1", l), c !== void 0 && s.attr("x2", c), d !== void 0 && s.attr("y1", d), f !== void 0 && s.attr("y2", f), g !== void 0 && s.style("display", g ? "none" : "block");
|
|
239
239
|
},
|
|
240
240
|
destroy() {
|
|
241
241
|
s.remove();
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
|
-
},
|
|
244
|
+
}, et = "sc-charts__range-tooltip", Be = D.timeFormat("%b %e, %I:%M %p"), Vs = (i) => {
|
|
245
245
|
const t = D.format(",.2f");
|
|
246
246
|
return `${i < 0 ? "-" : ""}$${t(Math.abs(i))}`;
|
|
247
247
|
};
|
|
248
|
-
function
|
|
248
|
+
function Ws(i) {
|
|
249
249
|
const t = "http://www.w3.org/2000/svg", e = document.createElement("div");
|
|
250
|
-
e.className =
|
|
250
|
+
e.className = et, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.append(e);
|
|
251
251
|
const s = document.createElement("div");
|
|
252
|
-
s.className = `${
|
|
252
|
+
s.className = `${et}-container`, e.append(s);
|
|
253
253
|
const n = document.createElement("div");
|
|
254
|
-
n.className = `${
|
|
254
|
+
n.className = `${et}-sum`, s.append(n);
|
|
255
255
|
const r = document.createElement("div");
|
|
256
|
-
r.className = `${
|
|
256
|
+
r.className = `${et}-sum-icon`;
|
|
257
257
|
const a = document.createElementNS(t, "svg");
|
|
258
258
|
a.setAttribute("width", "14"), a.setAttribute("height", "14"), a.setAttribute("viewBox", "0 0 14 14"), a.setAttribute("fill", "none"), a.setAttribute("xmlns", t);
|
|
259
|
-
const
|
|
260
|
-
|
|
259
|
+
const l = document.createElementNS(t, "path");
|
|
260
|
+
l.setAttribute(
|
|
261
261
|
"d",
|
|
262
262
|
"M7 0.5C5.71442 0.5 4.45772 0.881218 3.3888 1.59545C2.31988 2.30968 1.48676 3.32484 0.994786 4.51256C0.502816 5.70028 0.374095 7.00721 0.624899 8.26809C0.875703 9.52896 1.49477 10.6872 2.40381 11.5962C3.31285 12.5052 4.47104 13.1243 5.73192 13.3751C6.99279 13.6259 8.29973 13.4972 9.48744 13.0052C10.6752 12.5132 11.6903 11.6801 12.4046 10.6112C13.1188 9.54229 13.5 8.28558 13.5 7C13.4982 5.27665 12.8128 3.62441 11.5942 2.40582C10.3756 1.18722 8.72335 0.50182 7 0.5ZM9.35375 6.85375C9.30732 6.90024 9.25217 6.93712 9.19147 6.96228C9.13077 6.98744 9.06571 7.00039 9 7.00039C8.93429 7.00039 8.86923 6.98744 8.80853 6.96228C8.74783 6.93712 8.69269 6.90024 8.64625 6.85375L7.5 5.70687V9.5C7.5 9.63261 7.44732 9.75979 7.35356 9.85355C7.25979 9.94732 7.13261 10 7 10C6.86739 10 6.74022 9.94732 6.64645 9.85355C6.55268 9.75979 6.5 9.63261 6.5 9.5V5.70687L5.35375 6.85375C5.25993 6.94757 5.13268 7.00028 5 7.00028C4.86732 7.00028 4.74007 6.94757 4.64625 6.85375C4.55243 6.75993 4.49972 6.63268 4.49972 6.5C4.49972 6.36732 4.55243 6.24007 4.64625 6.14625L6.64625 4.14625C6.69269 4.09976 6.74783 4.06288 6.80853 4.03772C6.86923 4.01256 6.9343 3.99961 7 3.99961C7.06571 3.99961 7.13077 4.01256 7.19147 4.03772C7.25217 4.06288 7.30732 4.09976 7.35375 4.14625L9.35375 6.14625C9.40024 6.19269 9.43712 6.24783 9.46228 6.30853C9.48744 6.36923 9.5004 6.43429 9.5004 6.5C9.5004 6.56571 9.48744 6.63077 9.46228 6.69147C9.43712 6.75217 9.40024 6.80731 9.35375 6.85375Z"
|
|
263
|
-
),
|
|
263
|
+
), l.setAttribute("fill", "currentColor"), a.appendChild(l), r.appendChild(a), n.append(r);
|
|
264
264
|
const c = document.createElement("div");
|
|
265
265
|
n.append(c);
|
|
266
|
-
const
|
|
267
|
-
return
|
|
266
|
+
const d = document.createElement("div");
|
|
267
|
+
return d.className = `${et}-time`, s.append(d), { wrapper: e, sumNode: c, timeNode: d };
|
|
268
268
|
}
|
|
269
|
-
const
|
|
270
|
-
const { wrapper: t, sumNode: e, timeNode: s } =
|
|
269
|
+
const Xs = (i) => {
|
|
270
|
+
const { wrapper: t, sumNode: e, timeNode: s } = Ws(i.wrapperNode);
|
|
271
271
|
return {
|
|
272
272
|
className(n, r) {
|
|
273
|
-
n === "remove" ? t.classList.remove(`${
|
|
273
|
+
n === "remove" ? t.classList.remove(`${et}${r}`) : t.classList.add(`${et}${r}`);
|
|
274
274
|
},
|
|
275
|
-
update({ leftPoint: n, rightPoint: r, x: a, y:
|
|
276
|
-
if (n && r &&
|
|
277
|
-
const f = r.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(r.date) + i.x(n.date)) / 2, v = i.x(
|
|
278
|
-
let b = "",
|
|
275
|
+
update({ leftPoint: n, rightPoint: r, x: a, y: l, hidden: c, closest: d }) {
|
|
276
|
+
if (n && r && d && a !== void 0) {
|
|
277
|
+
const f = r.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(r.date) + i.x(n.date)) / 2, v = i.x(d.date) < p ? "left" : "right";
|
|
278
|
+
let b = "", x = "";
|
|
279
279
|
if (g)
|
|
280
280
|
b = g({ left: n.value, right: r.value, direction: v });
|
|
281
281
|
else {
|
|
282
282
|
const w = (f / Math.abs(n.value) * 100).toFixed(2);
|
|
283
|
-
b = `${
|
|
283
|
+
b = `${Vs(f)} (${w}%)`;
|
|
284
284
|
}
|
|
285
|
-
_ ?
|
|
286
|
-
const w = t.getBoundingClientRect(),
|
|
287
|
-
let
|
|
288
|
-
const
|
|
289
|
-
|
|
285
|
+
_ ? x = _({ left: n.date, right: r.date, direction: v }) : x = `${Be(n.date)} to ${Be(r.date)}`, e.textContent = b, s.textContent = x, requestAnimationFrame(() => {
|
|
286
|
+
const w = t.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), T = i.x(r.date);
|
|
287
|
+
let R = (C + T) / 2 - w.width / 2;
|
|
288
|
+
const $ = 0, Y = y.width - w.width;
|
|
289
|
+
R < $ && (R = $), R > Y && (R = Y), t.style.left = `${R}px`, t.style.top = `${l}px`;
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
c !== void 0 && (t.style.display = c ? "none" : "block");
|
|
@@ -295,37 +295,37 @@ const Ys = (i) => {
|
|
|
295
295
|
t.remove();
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
-
},
|
|
298
|
+
}, gt = "sc-charts__hover-tooltip", Gt = 16, Us = D.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
|
|
299
299
|
const t = D.format(",.2f");
|
|
300
300
|
return `${i < 0 ? "-" : ""}$${t(Math.abs(i))}`;
|
|
301
301
|
};
|
|
302
|
-
function
|
|
302
|
+
function Zs(i) {
|
|
303
303
|
const t = document.createElement("div");
|
|
304
|
-
t.className = `${
|
|
304
|
+
t.className = `${gt}-container`, t.style.position = "absolute", t.style.top = "0", t.style.pointerEvents = "none", t.style.display = "none", i.appendChild(t);
|
|
305
305
|
const e = document.createElement("div");
|
|
306
|
-
e.className = `${
|
|
306
|
+
e.className = `${gt}-sum`, t.appendChild(e);
|
|
307
307
|
const s = document.createElement("div");
|
|
308
|
-
return s.className = `${
|
|
308
|
+
return s.className = `${gt}-time`, t.appendChild(s), { wrapper: t, sumNode: e, timeNode: s };
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
return i ? t +
|
|
310
|
+
function qs(i, t, e) {
|
|
311
|
+
return i ? t + Gt + i.width < e ? t + Gt : t - Gt - i.width : null;
|
|
312
312
|
}
|
|
313
|
-
const
|
|
314
|
-
const { wrapper: t, sumNode: e, timeNode: s } =
|
|
313
|
+
const Js = (i) => {
|
|
314
|
+
const { wrapper: t, sumNode: e, timeNode: s } = Zs(i.wrapperNode);
|
|
315
315
|
return {
|
|
316
316
|
className(n, r) {
|
|
317
|
-
n === "remove" ? t.classList.remove(`${
|
|
317
|
+
n === "remove" ? t.classList.remove(`${gt}${r}`) : t.classList.add(`${gt}${r}`);
|
|
318
318
|
},
|
|
319
319
|
update({ hidden: n, dataItem: r }) {
|
|
320
320
|
if (r) {
|
|
321
|
-
const { sumFormatter: a, timeFormatter:
|
|
322
|
-
e.textContent = a ? a(r.value) :
|
|
323
|
-
const c = t.getBoundingClientRect(),
|
|
321
|
+
const { sumFormatter: a, timeFormatter: l } = i.config.hover;
|
|
322
|
+
e.textContent = a ? a(r.value) : Gs(r.value), s.textContent = l ? l(r.date) : Us(r.date), requestAnimationFrame(() => {
|
|
323
|
+
const c = t.getBoundingClientRect(), d = qs(
|
|
324
324
|
c,
|
|
325
325
|
i.x(r.date),
|
|
326
326
|
i.width - i.config.margin.right
|
|
327
327
|
);
|
|
328
|
-
|
|
328
|
+
d && (t.style.left = d + "px");
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
n !== void 0 && (t.style.display = n ? "none" : "block");
|
|
@@ -334,7 +334,7 @@ const Us = (i) => {
|
|
|
334
334
|
t.remove();
|
|
335
335
|
}
|
|
336
336
|
};
|
|
337
|
-
},
|
|
337
|
+
}, Qs = {
|
|
338
338
|
margin: { top: 10, right: 30, bottom: 20, left: 10 },
|
|
339
339
|
theme: "light",
|
|
340
340
|
logo: {
|
|
@@ -385,9 +385,9 @@ const Us = (i) => {
|
|
|
385
385
|
},
|
|
386
386
|
enableBelowZeroLine: !1,
|
|
387
387
|
curveTension: 1
|
|
388
|
-
}, Nt = (i) => D.curveCardinal.tension(i.config.curveTension),
|
|
389
|
-
const { svg: t, data: e, x: s, y: n, config: r } = i, a = t.node(),
|
|
390
|
-
|
|
388
|
+
}, Nt = (i) => D.curveCardinal.tension(i.config.curveTension), Ks = (i) => {
|
|
389
|
+
const { svg: t, data: e, x: s, y: n, config: r } = i, a = t.node(), l = rt(a);
|
|
390
|
+
mt(l, "main-line-area-gradient", {
|
|
391
391
|
x1: "0%",
|
|
392
392
|
y1: "0%",
|
|
393
393
|
x2: "0%",
|
|
@@ -397,13 +397,13 @@ const Us = (i) => {
|
|
|
397
397
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
398
398
|
]
|
|
399
399
|
});
|
|
400
|
-
const
|
|
400
|
+
const d = D.area().x((_) => s(_.date)).y0(n.range()[0]).y1((_) => n(_.value)).curve(Nt(i)), f = "sc-charts__main-line-area", g = t.append("path").datum(e).attr("d", d).attr("class", f).classed(`${f}_hidden`, !r.hasMainLineArea);
|
|
401
401
|
return {
|
|
402
402
|
className(_, p) {
|
|
403
403
|
_ === "remove" ? g.classed(`${f}${p}`, !1) : g.classed(`${f}${p}`, !0);
|
|
404
404
|
},
|
|
405
405
|
update({ data: _, hidden: p }) {
|
|
406
|
-
if (_ !== void 0 && g.datum(_).attr("d",
|
|
406
|
+
if (_ !== void 0 && g.datum(_).attr("d", d), p !== void 0) {
|
|
407
407
|
if (!r.hasMainLineArea) return null;
|
|
408
408
|
g.classed(`${f}_hidden`, p);
|
|
409
409
|
}
|
|
@@ -412,9 +412,9 @@ const Us = (i) => {
|
|
|
412
412
|
g.remove();
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
|
-
},
|
|
416
|
-
const e = "sc-charts__range-line-area", { svg: s, x: n, y: r, config: a, data:
|
|
417
|
-
|
|
415
|
+
}, tn = (i, t = {}) => {
|
|
416
|
+
const e = "sc-charts__range-line-area", { svg: s, x: n, y: r, config: a, data: l, chartId: c } = i, { clip: d } = t, f = s.node(), g = rt(f), _ = "range-line-area-gradient";
|
|
417
|
+
mt(g, _ + "_up", {
|
|
418
418
|
x1: "0%",
|
|
419
419
|
y1: "0%",
|
|
420
420
|
x2: "0%",
|
|
@@ -423,7 +423,7 @@ const Us = (i) => {
|
|
|
423
423
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
424
424
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
425
425
|
]
|
|
426
|
-
}),
|
|
426
|
+
}), mt(g, _ + "_down", {
|
|
427
427
|
x1: "0%",
|
|
428
428
|
y1: "0%",
|
|
429
429
|
x2: "0%",
|
|
@@ -433,106 +433,106 @@ const Us = (i) => {
|
|
|
433
433
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
434
434
|
]
|
|
435
435
|
});
|
|
436
|
-
const p = D.area().x((
|
|
436
|
+
const p = D.area().x((y) => n(y.date)).y0(r.range()[0]).y1((y) => r(y.value)).curve(Nt(i)), v = `${c}-clip-${e}`, x = g.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%"), w = s.append("path").datum(l).attr("d", p).attr("class", e).classed(`${e}_hidden`, !a.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
437
437
|
return {
|
|
438
|
-
className(
|
|
439
|
-
|
|
438
|
+
className(y, C) {
|
|
439
|
+
y === "remove" ? w.classed(`${e}${C}`, !1) : w.classed(`${e}${C}`, !0);
|
|
440
440
|
},
|
|
441
|
-
update({ data:
|
|
442
|
-
|
|
441
|
+
update({ data: y, hidden: C, clip: T }) {
|
|
442
|
+
y !== void 0 && w.datum(y).attr("d", p), C !== void 0 && w.classed(`${e}_hidden`, C), T !== void 0 && x.attr("x", T.x).attr("y", T.y).attr("width", T.width).attr("height", T.height);
|
|
443
443
|
},
|
|
444
444
|
destroy() {
|
|
445
445
|
w.remove();
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
|
-
},
|
|
449
|
-
const { svg: e, data: s, x: n, y: r, chartId: a } = i, { baseClassName:
|
|
448
|
+
}, Zt = (i, t) => {
|
|
449
|
+
const { svg: e, data: s, x: n, y: r, chartId: a } = i, { baseClassName: l, id: c, clip: d } = t, f = e.node(), g = rt(f), _ = D.line().x((w) => n(w.date)).y((w) => r(w.value)).curve(Nt(i)), p = `${a}-clip-${l}`, b = g.append("clipPath").attr("id", p).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = e.append("path").classed(l, !0).datum(s).attr("d", _).attr("id", c).attr("clip-path", `url(#${p})`);
|
|
450
450
|
return {
|
|
451
|
-
className(w,
|
|
452
|
-
w === "remove" ?
|
|
451
|
+
className(w, y) {
|
|
452
|
+
w === "remove" ? x.classed(`${l}${y}`, !1) : x.classed(`${l}${y}`, !0);
|
|
453
453
|
},
|
|
454
|
-
update({ data: w, clip:
|
|
455
|
-
w !== void 0 &&
|
|
454
|
+
update({ data: w, clip: y, hidden: C }) {
|
|
455
|
+
w !== void 0 && x.datum(w).attr("d", _), C !== void 0 && x.classed(`${l}_hidden`, C), y !== void 0 && b.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height);
|
|
456
456
|
},
|
|
457
457
|
destroy() {
|
|
458
|
-
|
|
458
|
+
x.remove();
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
|
-
},
|
|
462
|
-
const { svg: e, data: s, x: n, y: r, chartId: a, config:
|
|
461
|
+
}, en = (i, t) => {
|
|
462
|
+
const { svg: e, data: s, x: n, y: r, chartId: a, config: l } = i, { baseClassName: c, id: d, clip: f } = t, g = e.node(), _ = rt(g), p = D.line().x((y) => n(y.date)).y((y) => r(y.value)).curve(Nt(i)), v = `${a}-clip-${c}`, x = _.append("clipPath").attr("id", v).append("rect").attr("x", (f == null ? void 0 : f.x) || 0).attr("y", (f == null ? void 0 : f.y) || 0).attr("width", (f == null ? void 0 : f.width) || "100%").attr("height", (f == null ? void 0 : f.height) || "100%"), w = e.append("path").classed(c, !0).datum(s).attr("d", p).attr("id", d).attr("clip-path", `url(#${v})`);
|
|
463
463
|
return {
|
|
464
|
-
className(
|
|
465
|
-
|
|
464
|
+
className(y, C) {
|
|
465
|
+
y === "remove" ? w.classed(`${c}${C}`, !1) : w.classed(`${c}${C}`, !0);
|
|
466
466
|
},
|
|
467
|
-
update({ data:
|
|
468
|
-
|
|
467
|
+
update({ data: y, clip: C, hidden: T }) {
|
|
468
|
+
y !== void 0 && w.datum(y).attr("d", p), T !== void 0 && w.classed(`${c}_hidden`, T), C !== void 0 && (l.hover.transitionName === "default" ? x.transition().duration(l.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(D.easeLinear) : x.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
469
469
|
},
|
|
470
470
|
destroy() {
|
|
471
471
|
w.remove();
|
|
472
472
|
}
|
|
473
473
|
};
|
|
474
|
-
},
|
|
474
|
+
}, sn = (i) => {
|
|
475
475
|
const t = Math.abs(i);
|
|
476
476
|
let e;
|
|
477
477
|
return t >= 1e9 ? e = (i / 1e9).toFixed(1) + "B" : t >= 1e6 ? e = (i / 1e6).toFixed(1) + "M" : t >= 1e3 ? e = (i / 1e3).toFixed(1) + "K" : e = i.toFixed(1), e;
|
|
478
|
-
},
|
|
479
|
-
const { svg: e, data: s, x: n, y: r } = i, { baseClassName: a } = t,
|
|
478
|
+
}, nn = (i, t) => {
|
|
479
|
+
const { svg: e, data: s, x: n, y: r } = i, { baseClassName: a } = t, l = e.append("g").classed(a, !0), c = l.append("circle").attr("r", 5).classed(`${a}-circle`, !0), d = l.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${a}-label`, !0);
|
|
480
480
|
return ((g) => {
|
|
481
481
|
if (!g || g.length === 0) return;
|
|
482
482
|
const _ = g[g.length - 1], p = n(_.date), v = r(_.value);
|
|
483
483
|
c.attr("cx", p).attr("cy", v);
|
|
484
|
-
const b = i.config.extremePointFormatter ||
|
|
485
|
-
|
|
484
|
+
const b = i.config.extremePointFormatter || sn;
|
|
485
|
+
d.attr("x", p).attr("y", v).text(b(_.value));
|
|
486
486
|
})(s), {
|
|
487
487
|
className(g, _) {
|
|
488
|
-
g === "remove" ?
|
|
488
|
+
g === "remove" ? l.classed(`${a}${_}`, !1) : l.classed(`${a}${_}`, !0);
|
|
489
489
|
},
|
|
490
490
|
update({ hidden: g }) {
|
|
491
|
-
g !== void 0 &&
|
|
491
|
+
g !== void 0 && l.classed(`${a}_hidden`, g);
|
|
492
492
|
},
|
|
493
493
|
destroy() {
|
|
494
|
-
|
|
494
|
+
l.remove();
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
|
-
},
|
|
498
|
-
const t =
|
|
497
|
+
}, rn = (i) => {
|
|
498
|
+
const t = Zt(i, {
|
|
499
499
|
baseClassName: "sc-charts__main-line",
|
|
500
500
|
id: `${i.chartId}-sc-charts__main-line`
|
|
501
|
-
}), e =
|
|
501
|
+
}), e = Ks(i);
|
|
502
502
|
let s = null;
|
|
503
|
-
i.config.hasExtremePoint && (s =
|
|
503
|
+
i.config.hasExtremePoint && (s = nn(i, {
|
|
504
504
|
baseClassName: "sc-charts__extreme-point"
|
|
505
505
|
}));
|
|
506
|
-
const n =
|
|
506
|
+
const n = js(i.svg), r = en(i, {
|
|
507
507
|
baseClassName: "sc-charts__highlight-line",
|
|
508
508
|
id: `${i.chartId}-sc-charts__highlight-line`,
|
|
509
509
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
510
510
|
});
|
|
511
511
|
let a = null;
|
|
512
|
-
i.config.enableBelowZeroLine && (a =
|
|
512
|
+
i.config.enableBelowZeroLine && (a = Zt(i, {
|
|
513
513
|
baseClassName: "sc-charts__below-zero-line",
|
|
514
514
|
id: `${i.chartId}-sc-charts__below-zero-line`,
|
|
515
|
-
clip:
|
|
515
|
+
clip: Qe(i)
|
|
516
516
|
}));
|
|
517
|
-
const
|
|
517
|
+
const l = Ut(i.svg, {
|
|
518
518
|
className: "sc-charts__hover-circle",
|
|
519
519
|
hidden: !0
|
|
520
|
-
}), c =
|
|
520
|
+
}), c = Fe(i.svg), d = Fe(i.svg), f = Zt(i, {
|
|
521
521
|
baseClassName: "sc-charts__range-line",
|
|
522
522
|
id: `${i.chartId}-sc-charts__range-line`,
|
|
523
523
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
524
|
-
}), g =
|
|
524
|
+
}), g = Ut(i.svg, {
|
|
525
525
|
className: "sc-charts__range-circle-left",
|
|
526
526
|
hidden: !0
|
|
527
|
-
}), _ =
|
|
527
|
+
}), _ = Ut(i.svg, {
|
|
528
528
|
className: "sc-charts__range-circle-right",
|
|
529
529
|
hidden: !0
|
|
530
|
-
}), p =
|
|
530
|
+
}), p = Xs(i), v = Js(i), b = tn(i);
|
|
531
531
|
return {
|
|
532
532
|
hoverLine: n,
|
|
533
|
-
hoverCircle:
|
|
533
|
+
hoverCircle: l,
|
|
534
534
|
rangeBorderLeft: c,
|
|
535
|
-
rangeBorderRight:
|
|
535
|
+
rangeBorderRight: d,
|
|
536
536
|
rangeLine: f,
|
|
537
537
|
rangeLineArea: b,
|
|
538
538
|
rangeCircleLeft: g,
|
|
@@ -545,7 +545,7 @@ const Us = (i) => {
|
|
|
545
545
|
belowZeroLine: a,
|
|
546
546
|
extremePoint: s
|
|
547
547
|
};
|
|
548
|
-
},
|
|
548
|
+
}, an = (i, t, e) => {
|
|
549
549
|
const s = i.match(/^(\d+)([dMhmw])$/);
|
|
550
550
|
if (!s)
|
|
551
551
|
return console.warn("Invalid hoverRange:", i), {
|
|
@@ -554,10 +554,10 @@ const Us = (i) => {
|
|
|
554
554
|
width: "100%",
|
|
555
555
|
height: "100%"
|
|
556
556
|
};
|
|
557
|
-
const [, n, r] = s, a = parseInt(n, 10), [
|
|
558
|
-
let
|
|
559
|
-
for (;
|
|
560
|
-
let f = new Date(
|
|
557
|
+
const [, n, r] = s, a = parseInt(n, 10), [l, c] = e.domain();
|
|
558
|
+
let d = new Date(l);
|
|
559
|
+
for (; d < c; ) {
|
|
560
|
+
let f = new Date(d);
|
|
561
561
|
switch (r) {
|
|
562
562
|
case "M":
|
|
563
563
|
f.setMinutes(f.getMinutes() + a);
|
|
@@ -572,7 +572,7 @@ const Us = (i) => {
|
|
|
572
572
|
f.setDate(f.getDate() + a * 7);
|
|
573
573
|
break;
|
|
574
574
|
case "m":
|
|
575
|
-
f = new Date(
|
|
575
|
+
f = new Date(d.getFullYear(), d.getMonth() + a, 1);
|
|
576
576
|
break;
|
|
577
577
|
default:
|
|
578
578
|
return {
|
|
@@ -582,8 +582,8 @@ const Us = (i) => {
|
|
|
582
582
|
height: "100%"
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
if (t >=
|
|
586
|
-
const g = e(
|
|
585
|
+
if (t >= d && t < f) {
|
|
586
|
+
const g = e(d), _ = e(f);
|
|
587
587
|
return {
|
|
588
588
|
x: g,
|
|
589
589
|
y: 0,
|
|
@@ -591,7 +591,7 @@ const Us = (i) => {
|
|
|
591
591
|
height: "100%"
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
|
-
|
|
594
|
+
d = new Date(f);
|
|
595
595
|
}
|
|
596
596
|
if (t.getTime() === c.getTime()) {
|
|
597
597
|
let f = new Date(c);
|
|
@@ -626,8 +626,8 @@ const Us = (i) => {
|
|
|
626
626
|
width: "100%",
|
|
627
627
|
height: "100%"
|
|
628
628
|
};
|
|
629
|
-
},
|
|
630
|
-
var
|
|
629
|
+
}, Ie = (i, t) => {
|
|
630
|
+
var d;
|
|
631
631
|
const {
|
|
632
632
|
x: e,
|
|
633
633
|
y: s,
|
|
@@ -649,26 +649,26 @@ const Us = (i) => {
|
|
|
649
649
|
dataItem: t,
|
|
650
650
|
hidden: !1
|
|
651
651
|
});
|
|
652
|
-
const
|
|
652
|
+
const l = an(i.config.hover.range, t.date, e);
|
|
653
653
|
n.highlightLine.update({
|
|
654
|
-
clip:
|
|
654
|
+
clip: l,
|
|
655
655
|
hidden: !1
|
|
656
656
|
});
|
|
657
657
|
const c = s.range()[0] - s(0) + r.bottom;
|
|
658
|
-
c >= 0 && ((
|
|
658
|
+
c >= 0 && ((d = n.belowZeroLine) == null || d.update({
|
|
659
659
|
clip: {
|
|
660
|
-
...
|
|
660
|
+
...l,
|
|
661
661
|
y: s(0),
|
|
662
662
|
height: c
|
|
663
663
|
}
|
|
664
664
|
})), n.mainLine.className("add", "_muted");
|
|
665
|
-
},
|
|
665
|
+
}, He = (i) => {
|
|
666
666
|
var e;
|
|
667
667
|
const { elements: t } = i;
|
|
668
668
|
t.hoverLine.update({ hidden: !0 }), t.hoverCircle.update({ hidden: !0 }), t.highlightLine.update({ hidden: !0 }), t.mainLine.className("remove", "_muted"), t.hoverTooltip.update({ hidden: !0 }), i.action !== "selection" && ((e = t.belowZeroLine) == null || e.update({
|
|
669
|
-
clip:
|
|
669
|
+
clip: Qe(i)
|
|
670
670
|
}));
|
|
671
|
-
},
|
|
671
|
+
}, on = (i, t) => {
|
|
672
672
|
[
|
|
673
673
|
"rangeBorderLeft",
|
|
674
674
|
"rangeBorderRight",
|
|
@@ -680,36 +680,36 @@ const Us = (i) => {
|
|
|
680
680
|
].forEach((s) => {
|
|
681
681
|
t ? (i[s].className("remove", "_down"), i[s].className("add", "_up")) : (i[s].className("remove", "_up"), i[s].className("add", "_down"));
|
|
682
682
|
});
|
|
683
|
-
},
|
|
683
|
+
}, ln = (i, t, e) => {
|
|
684
684
|
var v;
|
|
685
685
|
const {
|
|
686
686
|
x: s,
|
|
687
687
|
y: n,
|
|
688
688
|
config: { margin: r },
|
|
689
689
|
height: a,
|
|
690
|
-
elements:
|
|
691
|
-
} = i, c = s(t.date) < s(e.date) ? t : e,
|
|
692
|
-
|
|
690
|
+
elements: l
|
|
691
|
+
} = i, c = s(t.date) < s(e.date) ? t : e, d = s(t.date) >= s(e.date) ? t : e, f = d.value - c.value >= 0, g = s(c.date), _ = s(d.date), p = _ - g;
|
|
692
|
+
l.rangeBorderLeft.update({
|
|
693
693
|
x1: g,
|
|
694
694
|
x2: g,
|
|
695
695
|
y1: r.top,
|
|
696
696
|
y2: a - r.bottom,
|
|
697
697
|
hidden: !1
|
|
698
|
-
}),
|
|
698
|
+
}), l.rangeBorderRight.update({
|
|
699
699
|
x1: _,
|
|
700
700
|
x2: _,
|
|
701
701
|
y1: r.top,
|
|
702
702
|
y2: a - r.bottom,
|
|
703
703
|
hidden: !1
|
|
704
|
-
}),
|
|
704
|
+
}), l.rangeCircleLeft.update({
|
|
705
705
|
cx: g,
|
|
706
706
|
cy: n(c.value),
|
|
707
707
|
hidden: !1
|
|
708
|
-
}),
|
|
708
|
+
}), l.rangeCircleRight.update({
|
|
709
709
|
cx: _,
|
|
710
|
-
cy: n(
|
|
710
|
+
cy: n(d.value),
|
|
711
711
|
hidden: !1
|
|
712
|
-
}),
|
|
712
|
+
}), l.rangeLine.update({
|
|
713
713
|
clip: {
|
|
714
714
|
x: g,
|
|
715
715
|
y: 0,
|
|
@@ -717,7 +717,7 @@ const Us = (i) => {
|
|
|
717
717
|
height: n.range()[0]
|
|
718
718
|
},
|
|
719
719
|
hidden: !1
|
|
720
|
-
}),
|
|
720
|
+
}), l.rangeLineArea.update({
|
|
721
721
|
clip: {
|
|
722
722
|
x: g,
|
|
723
723
|
y: 0,
|
|
@@ -725,48 +725,48 @@ const Us = (i) => {
|
|
|
725
725
|
height: n.range()[0]
|
|
726
726
|
},
|
|
727
727
|
hidden: !1
|
|
728
|
-
}),
|
|
729
|
-
rightPoint:
|
|
728
|
+
}), l.rangeTooltip.update({
|
|
729
|
+
rightPoint: d,
|
|
730
730
|
leftPoint: c,
|
|
731
731
|
closest: e,
|
|
732
732
|
x: g + p / 2,
|
|
733
733
|
y: 0,
|
|
734
734
|
hidden: !1
|
|
735
|
-
}), (v =
|
|
735
|
+
}), (v = l.belowZeroLine) == null || v.update({
|
|
736
736
|
hidden: !0
|
|
737
|
-
}),
|
|
738
|
-
},
|
|
737
|
+
}), l.mainLineArea.update({ hidden: !0 }), on(l, f), l.mainLine.className("add", "_selected-muted");
|
|
738
|
+
}, Re = (i) => {
|
|
739
739
|
var e;
|
|
740
740
|
const { elements: t } = i;
|
|
741
741
|
t.rangeLine.update({ hidden: !0 }), t.rangeLineArea.update({ hidden: !0 }), t.rangeBorderLeft.update({ hidden: !0 }), t.rangeBorderRight.update({ hidden: !0 }), t.rangeCircleLeft.update({ hidden: !0 }), t.rangeCircleRight.update({ hidden: !0 }), t.rangeTooltip.update({ hidden: !0 }), t.mainLine.className("remove", "_selected-muted"), t.mainLineArea.update({ hidden: !1 }), (e = t.belowZeroLine) == null || e.update({ hidden: !1 });
|
|
742
|
-
},
|
|
743
|
-
const { svg: t, data: e, x: s, config: n, width: r, height: a } = i, { margin:
|
|
742
|
+
}, cn = (i) => {
|
|
743
|
+
const { svg: t, data: e, x: s, config: n, width: r, height: a } = i, { margin: l, hover: c, selection: d } = n;
|
|
744
744
|
let f = null, g = !1;
|
|
745
745
|
const _ = (v) => e.reduce(
|
|
746
|
-
(b,
|
|
746
|
+
(b, x) => Math.abs(s(b.date) - v) < Math.abs(s(x.date) - v) ? b : x
|
|
747
747
|
);
|
|
748
|
-
t.append("rect").attr("width", r -
|
|
749
|
-
const [b] = D.pointer(v, this),
|
|
750
|
-
!g && c.enable ? (i.action = "hover",
|
|
748
|
+
t.append("rect").attr("width", r - l.left - l.right).attr("height", a - l.top - l.bottom).attr("x", l.left).attr("y", l.top).attr("fill", "transparent").on("mousemove", function(v) {
|
|
749
|
+
const [b] = D.pointer(v, this), x = _(b);
|
|
750
|
+
!g && c.enable ? (i.action = "hover", Ie(i, x)) : (i.action = g ? "selection" : "none", He(i)), f && d.enable && (i.action = "selection", ln(i, f, x));
|
|
751
751
|
}).on("mouseleave", () => {
|
|
752
|
-
i.action = "none", g = !1, f = null,
|
|
752
|
+
i.action = "none", g = !1, f = null, He(i), Re(i);
|
|
753
753
|
}).on("mousedown", function(v) {
|
|
754
|
-
if (
|
|
754
|
+
if (d.enable) {
|
|
755
755
|
g = !0, i.action = "selection";
|
|
756
756
|
const [b] = D.pointer(v, this);
|
|
757
757
|
f = _(b);
|
|
758
758
|
}
|
|
759
759
|
}).on("mouseup", function(v) {
|
|
760
|
-
const [b] = D.pointer(v, this),
|
|
761
|
-
g = !1, f = null, i.action = "hover",
|
|
760
|
+
const [b] = D.pointer(v, this), x = _(b);
|
|
761
|
+
g = !1, f = null, i.action = "hover", d.enable && Re(i), c.enable && Ie(i, x);
|
|
762
762
|
});
|
|
763
|
-
},
|
|
763
|
+
}, hn = (i, t, e) => {
|
|
764
764
|
const { margin: s } = t, n = D.scaleTime(), r = D.extent(i, (a) => new Date(a.date));
|
|
765
765
|
return r[0] == null || r[1] == null ? n : n.domain([r[0], r[1]]).range([s.left, e - s.right]);
|
|
766
|
-
},
|
|
766
|
+
}, dn = (i, t, e) => {
|
|
767
767
|
const { margin: s } = t, n = D.max(i, (a) => a.value) ?? 0, r = D.min(i, (a) => a.value) ?? 0;
|
|
768
768
|
return D.scaleLinear().domain([r, n]).range([e - s.bottom, s.top]);
|
|
769
|
-
},
|
|
769
|
+
}, _a = (i, t) => {
|
|
770
770
|
const e = D.select(i);
|
|
771
771
|
if (e.empty())
|
|
772
772
|
return console.error(`Element with selector ${i} not found!`), null;
|
|
@@ -774,33 +774,33 @@ const Us = (i) => {
|
|
|
774
774
|
return console.error(`chartId is required and must be a valid id
|
|
775
775
|
(only letters, numbers or underscores. The first character must be a letter)`), null;
|
|
776
776
|
const s = e.append("div"), n = s.append("svg"), r = e.node();
|
|
777
|
-
let a = r.getBoundingClientRect(),
|
|
777
|
+
let a = r.getBoundingClientRect(), l = a.width, c = a.height, d = Ne({ ...Qs }, t.config), f = t.data;
|
|
778
778
|
const g = () => {
|
|
779
|
-
a = r.getBoundingClientRect(),
|
|
779
|
+
a = r.getBoundingClientRect(), l = a.width, c = a.height, _({ data: f, config: d });
|
|
780
780
|
};
|
|
781
781
|
window.addEventListener("resize", g);
|
|
782
782
|
const _ = (p, v = !1) => {
|
|
783
|
-
v && p.config && (
|
|
784
|
-
const b = f.map((T) => ({ date: new Date(T.date), value: T.value })).sort((T, H) => T.date.getTime() - H.date.getTime()),
|
|
785
|
-
s.attr("class", `sc-charts sc-charts__${
|
|
786
|
-
const
|
|
783
|
+
v && p.config && (d = Ne(d, p.config)), v && p.data && (f = p.data);
|
|
784
|
+
const b = f.map((T) => ({ date: new Date(T.date), value: T.value })).sort((T, H) => T.date.getTime() - H.date.getTime()), x = hn(b, d, l), w = dn(b, d, c);
|
|
785
|
+
s.attr("class", `sc-charts sc-charts__${d.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${l} ${c}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
786
|
+
const y = {
|
|
787
787
|
chartId: t.chartId,
|
|
788
788
|
svg: n,
|
|
789
789
|
wrapperNode: s.node(),
|
|
790
790
|
data: b,
|
|
791
|
-
x
|
|
791
|
+
x,
|
|
792
792
|
y: w,
|
|
793
|
-
config:
|
|
793
|
+
config: d,
|
|
794
794
|
action: "none",
|
|
795
|
-
width:
|
|
795
|
+
width: l,
|
|
796
796
|
height: c
|
|
797
797
|
};
|
|
798
|
-
|
|
798
|
+
Ys(y);
|
|
799
799
|
const C = {
|
|
800
|
-
...
|
|
801
|
-
elements:
|
|
800
|
+
...y,
|
|
801
|
+
elements: rn(y)
|
|
802
802
|
};
|
|
803
|
-
|
|
803
|
+
cn(C);
|
|
804
804
|
};
|
|
805
805
|
return _(t), {
|
|
806
806
|
update: (p) => _(p, !0),
|
|
@@ -810,500 +810,501 @@ const Us = (i) => {
|
|
|
810
810
|
};
|
|
811
811
|
};
|
|
812
812
|
var Tt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
813
|
-
function
|
|
813
|
+
function un(i) {
|
|
814
814
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
815
815
|
}
|
|
816
|
-
var
|
|
817
|
-
|
|
818
|
-
var
|
|
819
|
-
function
|
|
820
|
-
return
|
|
821
|
-
var e = 200, s = "__lodash_hash_undefined__", n = 800, r = 16, a = 9007199254740991,
|
|
822
|
-
N[Bt] = N[
|
|
823
|
-
var
|
|
816
|
+
var ut = { exports: {} };
|
|
817
|
+
ut.exports;
|
|
818
|
+
var $e;
|
|
819
|
+
function fn() {
|
|
820
|
+
return $e || ($e = 1, function(i, t) {
|
|
821
|
+
var e = 200, s = "__lodash_hash_undefined__", n = 800, r = 16, a = 9007199254740991, l = "[object Arguments]", c = "[object Array]", d = "[object AsyncFunction]", f = "[object Boolean]", g = "[object Date]", _ = "[object Error]", p = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", x = "[object Number]", w = "[object Null]", y = "[object Object]", C = "[object Proxy]", T = "[object RegExp]", H = "[object Set]", R = "[object String]", $ = "[object Undefined]", Y = "[object WeakMap]", it = "[object ArrayBuffer]", Z = "[object DataView]", Bt = "[object Float32Array]", ai = "[object Float64Array]", oi = "[object Int8Array]", li = "[object Int16Array]", ci = "[object Int32Array]", hi = "[object Uint8Array]", di = "[object Uint8ClampedArray]", ui = "[object Uint16Array]", fi = "[object Uint32Array]", gi = /[\\^$.*+?()[\]{}|]/g, mi = /^\[object .+?Constructor\]$/, _i = /^(?:0|[1-9]\d*)$/, N = {};
|
|
822
|
+
N[Bt] = N[ai] = N[oi] = N[li] = N[ci] = N[hi] = N[di] = N[ui] = N[fi] = !0, N[l] = N[c] = N[it] = N[f] = N[Z] = N[g] = N[_] = N[p] = N[b] = N[x] = N[y] = N[T] = N[H] = N[R] = N[Y] = !1;
|
|
823
|
+
var le = typeof Tt == "object" && Tt && Tt.Object === Object && Tt, pi = typeof self == "object" && self && self.Object === Object && self, at = le || pi || Function("return this")(), ce = t && !t.nodeType && t, ot = ce && !0 && i && !i.nodeType && i, he = ot && ot.exports === ce, It = he && le.process, de = function() {
|
|
824
824
|
try {
|
|
825
|
-
var
|
|
826
|
-
return
|
|
825
|
+
var o = ot && ot.require && ot.require("util").types;
|
|
826
|
+
return o || It && It.binding && It.binding("util");
|
|
827
827
|
} catch {
|
|
828
828
|
}
|
|
829
|
-
}(),
|
|
830
|
-
function
|
|
829
|
+
}(), ue = de && de.isTypedArray;
|
|
830
|
+
function vi(o, h, m) {
|
|
831
831
|
switch (m.length) {
|
|
832
832
|
case 0:
|
|
833
|
-
return
|
|
833
|
+
return o.call(h);
|
|
834
834
|
case 1:
|
|
835
|
-
return
|
|
835
|
+
return o.call(h, m[0]);
|
|
836
836
|
case 2:
|
|
837
|
-
return
|
|
837
|
+
return o.call(h, m[0], m[1]);
|
|
838
838
|
case 3:
|
|
839
|
-
return
|
|
839
|
+
return o.call(h, m[0], m[1], m[2]);
|
|
840
840
|
}
|
|
841
|
-
return
|
|
841
|
+
return o.apply(h, m);
|
|
842
842
|
}
|
|
843
|
-
function
|
|
844
|
-
for (var m = -1,
|
|
845
|
-
|
|
846
|
-
return
|
|
843
|
+
function bi(o, h) {
|
|
844
|
+
for (var m = -1, A = Array(o); ++m < o; )
|
|
845
|
+
A[m] = h(m);
|
|
846
|
+
return A;
|
|
847
847
|
}
|
|
848
|
-
function
|
|
849
|
-
return function(
|
|
850
|
-
return
|
|
848
|
+
function yi(o) {
|
|
849
|
+
return function(h) {
|
|
850
|
+
return o(h);
|
|
851
851
|
};
|
|
852
852
|
}
|
|
853
|
-
function
|
|
854
|
-
return
|
|
853
|
+
function xi(o, h) {
|
|
854
|
+
return o == null ? void 0 : o[h];
|
|
855
855
|
}
|
|
856
|
-
function
|
|
856
|
+
function wi(o, h) {
|
|
857
857
|
return function(m) {
|
|
858
|
-
return
|
|
858
|
+
return o(h(m));
|
|
859
859
|
};
|
|
860
860
|
}
|
|
861
|
-
var
|
|
862
|
-
var
|
|
863
|
-
return
|
|
864
|
-
}(),
|
|
865
|
-
"^" + bt.call(
|
|
866
|
-
), yt =
|
|
861
|
+
var Ci = Array.prototype, Ai = Function.prototype, vt = Object.prototype, Ht = at["__core-js_shared__"], bt = Ai.toString, q = vt.hasOwnProperty, fe = function() {
|
|
862
|
+
var o = /[^.]+$/.exec(Ht && Ht.keys && Ht.keys.IE_PROTO || "");
|
|
863
|
+
return o ? "Symbol(src)_1." + o : "";
|
|
864
|
+
}(), ge = vt.toString, Mi = bt.call(Object), Ti = RegExp(
|
|
865
|
+
"^" + bt.call(q).replace(gi, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
866
|
+
), yt = he ? at.Buffer : void 0, me = at.Symbol, _e = at.Uint8Array;
|
|
867
867
|
yt && yt.allocUnsafe;
|
|
868
|
-
var
|
|
868
|
+
var pe = wi(Object.getPrototypeOf, Object), ve = Object.create, Si = vt.propertyIsEnumerable, ki = Ci.splice, Q = me ? me.toStringTag : void 0, xt = function() {
|
|
869
869
|
try {
|
|
870
|
-
var
|
|
871
|
-
return
|
|
870
|
+
var o = Pt(Object, "defineProperty");
|
|
871
|
+
return o({}, "", {}), o;
|
|
872
872
|
} catch {
|
|
873
873
|
}
|
|
874
|
-
}(),
|
|
875
|
-
function
|
|
874
|
+
}(), Di = yt ? yt.isBuffer : void 0, be = Math.max, Li = Date.now, ye = Pt(at, "Map"), lt = Pt(Object, "create"), Ei = /* @__PURE__ */ function() {
|
|
875
|
+
function o() {
|
|
876
876
|
}
|
|
877
|
-
return function(
|
|
878
|
-
if (!
|
|
877
|
+
return function(h) {
|
|
878
|
+
if (!tt(h))
|
|
879
879
|
return {};
|
|
880
|
-
if (
|
|
881
|
-
return
|
|
882
|
-
|
|
883
|
-
var m = new
|
|
884
|
-
return
|
|
880
|
+
if (ve)
|
|
881
|
+
return ve(h);
|
|
882
|
+
o.prototype = h;
|
|
883
|
+
var m = new o();
|
|
884
|
+
return o.prototype = void 0, m;
|
|
885
885
|
};
|
|
886
886
|
}();
|
|
887
|
-
function
|
|
888
|
-
var
|
|
889
|
-
for (this.clear(); ++
|
|
890
|
-
var
|
|
891
|
-
this.set(
|
|
887
|
+
function K(o) {
|
|
888
|
+
var h = -1, m = o == null ? 0 : o.length;
|
|
889
|
+
for (this.clear(); ++h < m; ) {
|
|
890
|
+
var A = o[h];
|
|
891
|
+
this.set(A[0], A[1]);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
this.__data__ =
|
|
894
|
+
function Ni() {
|
|
895
|
+
this.__data__ = lt ? lt(null) : {}, this.size = 0;
|
|
896
896
|
}
|
|
897
|
-
function
|
|
898
|
-
var
|
|
899
|
-
return this.size -=
|
|
897
|
+
function Fi(o) {
|
|
898
|
+
var h = this.has(o) && delete this.__data__[o];
|
|
899
|
+
return this.size -= h ? 1 : 0, h;
|
|
900
900
|
}
|
|
901
|
-
function
|
|
902
|
-
var
|
|
903
|
-
if (
|
|
904
|
-
var m =
|
|
901
|
+
function Bi(o) {
|
|
902
|
+
var h = this.__data__;
|
|
903
|
+
if (lt) {
|
|
904
|
+
var m = h[o];
|
|
905
905
|
return m === s ? void 0 : m;
|
|
906
906
|
}
|
|
907
|
-
return
|
|
907
|
+
return q.call(h, o) ? h[o] : void 0;
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
var
|
|
911
|
-
return
|
|
909
|
+
function Ii(o) {
|
|
910
|
+
var h = this.__data__;
|
|
911
|
+
return lt ? h[o] !== void 0 : q.call(h, o);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function Hi(o, h) {
|
|
914
914
|
var m = this.__data__;
|
|
915
|
-
return this.size += this.has(
|
|
915
|
+
return this.size += this.has(o) ? 0 : 1, m[o] = lt && h === void 0 ? s : h, this;
|
|
916
916
|
}
|
|
917
|
-
|
|
918
|
-
function
|
|
919
|
-
var
|
|
920
|
-
for (this.clear(); ++
|
|
921
|
-
var
|
|
922
|
-
this.set(
|
|
917
|
+
K.prototype.clear = Ni, K.prototype.delete = Fi, K.prototype.get = Bi, K.prototype.has = Ii, K.prototype.set = Hi;
|
|
918
|
+
function X(o) {
|
|
919
|
+
var h = -1, m = o == null ? 0 : o.length;
|
|
920
|
+
for (this.clear(); ++h < m; ) {
|
|
921
|
+
var A = o[h];
|
|
922
|
+
this.set(A[0], A[1]);
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Ri() {
|
|
926
926
|
this.__data__ = [], this.size = 0;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
929
|
-
var
|
|
928
|
+
function $i(o) {
|
|
929
|
+
var h = this.__data__, m = wt(h, o);
|
|
930
930
|
if (m < 0)
|
|
931
931
|
return !1;
|
|
932
|
-
var
|
|
933
|
-
return m ==
|
|
932
|
+
var A = h.length - 1;
|
|
933
|
+
return m == A ? h.pop() : ki.call(h, m, 1), --this.size, !0;
|
|
934
934
|
}
|
|
935
|
-
function
|
|
936
|
-
var
|
|
937
|
-
return m < 0 ? void 0 :
|
|
935
|
+
function Pi(o) {
|
|
936
|
+
var h = this.__data__, m = wt(h, o);
|
|
937
|
+
return m < 0 ? void 0 : h[m][1];
|
|
938
938
|
}
|
|
939
|
-
function
|
|
940
|
-
return wt(this.__data__,
|
|
939
|
+
function zi(o) {
|
|
940
|
+
return wt(this.__data__, o) > -1;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
943
|
-
var m = this.__data__,
|
|
944
|
-
return
|
|
942
|
+
function Oi(o, h) {
|
|
943
|
+
var m = this.__data__, A = wt(m, o);
|
|
944
|
+
return A < 0 ? (++this.size, m.push([o, h])) : m[A][1] = h, this;
|
|
945
945
|
}
|
|
946
|
-
|
|
947
|
-
function
|
|
948
|
-
var
|
|
949
|
-
for (this.clear(); ++
|
|
950
|
-
var
|
|
951
|
-
this.set(
|
|
946
|
+
X.prototype.clear = Ri, X.prototype.delete = $i, X.prototype.get = Pi, X.prototype.has = zi, X.prototype.set = Oi;
|
|
947
|
+
function st(o) {
|
|
948
|
+
var h = -1, m = o == null ? 0 : o.length;
|
|
949
|
+
for (this.clear(); ++h < m; ) {
|
|
950
|
+
var A = o[h];
|
|
951
|
+
this.set(A[0], A[1]);
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
|
-
function
|
|
954
|
+
function Yi() {
|
|
955
955
|
this.size = 0, this.__data__ = {
|
|
956
|
-
hash: new
|
|
957
|
-
map: new (
|
|
958
|
-
string: new
|
|
956
|
+
hash: new K(),
|
|
957
|
+
map: new (ye || X)(),
|
|
958
|
+
string: new K()
|
|
959
959
|
};
|
|
960
960
|
}
|
|
961
|
-
function
|
|
962
|
-
var
|
|
963
|
-
return this.size -=
|
|
961
|
+
function ji(o) {
|
|
962
|
+
var h = At(this, o).delete(o);
|
|
963
|
+
return this.size -= h ? 1 : 0, h;
|
|
964
964
|
}
|
|
965
|
-
function
|
|
966
|
-
return
|
|
965
|
+
function Vi(o) {
|
|
966
|
+
return At(this, o).get(o);
|
|
967
967
|
}
|
|
968
|
-
function
|
|
969
|
-
return
|
|
968
|
+
function Wi(o) {
|
|
969
|
+
return At(this, o).has(o);
|
|
970
970
|
}
|
|
971
|
-
function
|
|
972
|
-
var m =
|
|
973
|
-
return m.set(
|
|
971
|
+
function Xi(o, h) {
|
|
972
|
+
var m = At(this, o), A = m.size;
|
|
973
|
+
return m.set(o, h), this.size += m.size == A ? 0 : 1, this;
|
|
974
974
|
}
|
|
975
|
-
|
|
976
|
-
function
|
|
977
|
-
var
|
|
978
|
-
this.size =
|
|
975
|
+
st.prototype.clear = Yi, st.prototype.delete = ji, st.prototype.get = Vi, st.prototype.has = Wi, st.prototype.set = Xi;
|
|
976
|
+
function nt(o) {
|
|
977
|
+
var h = this.__data__ = new X(o);
|
|
978
|
+
this.size = h.size;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
981
|
-
this.__data__ = new
|
|
980
|
+
function Ui() {
|
|
981
|
+
this.__data__ = new X(), this.size = 0;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
984
|
-
var
|
|
985
|
-
return this.size =
|
|
983
|
+
function Gi(o) {
|
|
984
|
+
var h = this.__data__, m = h.delete(o);
|
|
985
|
+
return this.size = h.size, m;
|
|
986
986
|
}
|
|
987
|
-
function
|
|
988
|
-
return this.__data__.get(
|
|
987
|
+
function Zi(o) {
|
|
988
|
+
return this.__data__.get(o);
|
|
989
989
|
}
|
|
990
|
-
function
|
|
991
|
-
return this.__data__.has(
|
|
990
|
+
function qi(o) {
|
|
991
|
+
return this.__data__.has(o);
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function Ji(o, h) {
|
|
994
994
|
var m = this.__data__;
|
|
995
|
-
if (m instanceof
|
|
996
|
-
var
|
|
997
|
-
if (!
|
|
998
|
-
return
|
|
999
|
-
m = this.__data__ = new
|
|
995
|
+
if (m instanceof X) {
|
|
996
|
+
var A = m.__data__;
|
|
997
|
+
if (!ye || A.length < e - 1)
|
|
998
|
+
return A.push([o, h]), this.size = ++m.size, this;
|
|
999
|
+
m = this.__data__ = new st(A);
|
|
1000
1000
|
}
|
|
1001
|
-
return m.set(
|
|
1001
|
+
return m.set(o, h), this.size = m.size, this;
|
|
1002
1002
|
}
|
|
1003
|
-
|
|
1004
|
-
function
|
|
1005
|
-
var m =
|
|
1006
|
-
for (var
|
|
1003
|
+
nt.prototype.clear = Ui, nt.prototype.delete = Gi, nt.prototype.get = Zi, nt.prototype.has = qi, nt.prototype.set = Ji;
|
|
1004
|
+
function Qi(o, h) {
|
|
1005
|
+
var m = Yt(o), A = !m && Ot(o), S = !m && !A && Me(o), E = !m && !A && !S && Se(o), F = m || A || S || E, L = F ? bi(o.length, String) : [], B = L.length;
|
|
1006
|
+
for (var j in o)
|
|
1007
1007
|
F && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1008
|
-
(
|
|
1009
|
-
S && (
|
|
1010
|
-
E && (
|
|
1011
|
-
|
|
1008
|
+
(j == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1009
|
+
S && (j == "offset" || j == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1010
|
+
E && (j == "buffer" || j == "byteLength" || j == "byteOffset") || // Skip index properties.
|
|
1011
|
+
Ce(j, B)) || L.push(j);
|
|
1012
1012
|
return L;
|
|
1013
1013
|
}
|
|
1014
|
-
function Rt(
|
|
1015
|
-
(m !== void 0 && !
|
|
1014
|
+
function Rt(o, h, m) {
|
|
1015
|
+
(m !== void 0 && !Mt(o[h], m) || m === void 0 && !(h in o)) && $t(o, h, m);
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1018
|
-
var
|
|
1019
|
-
(!(
|
|
1017
|
+
function Ki(o, h, m) {
|
|
1018
|
+
var A = o[h];
|
|
1019
|
+
(!(q.call(o, h) && Mt(A, m)) || m === void 0 && !(h in o)) && $t(o, h, m);
|
|
1020
1020
|
}
|
|
1021
|
-
function wt(
|
|
1022
|
-
for (var m =
|
|
1023
|
-
if (
|
|
1021
|
+
function wt(o, h) {
|
|
1022
|
+
for (var m = o.length; m--; )
|
|
1023
|
+
if (Mt(o[m][0], h))
|
|
1024
1024
|
return m;
|
|
1025
1025
|
return -1;
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1028
|
-
|
|
1027
|
+
function $t(o, h, m) {
|
|
1028
|
+
h == "__proto__" && xt ? xt(o, h, {
|
|
1029
1029
|
configurable: !0,
|
|
1030
1030
|
enumerable: !0,
|
|
1031
1031
|
value: m,
|
|
1032
1032
|
writable: !0
|
|
1033
|
-
}) :
|
|
1033
|
+
}) : o[h] = m;
|
|
1034
1034
|
}
|
|
1035
|
-
var
|
|
1036
|
-
function Ct(
|
|
1037
|
-
return
|
|
1035
|
+
var ts = fs();
|
|
1036
|
+
function Ct(o) {
|
|
1037
|
+
return o == null ? o === void 0 ? $ : w : Q && Q in Object(o) ? gs(o) : ys(o);
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return
|
|
1039
|
+
function xe(o) {
|
|
1040
|
+
return ct(o) && Ct(o) == l;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1043
|
-
if (!
|
|
1042
|
+
function es(o) {
|
|
1043
|
+
if (!tt(o) || vs(o))
|
|
1044
1044
|
return !1;
|
|
1045
|
-
var
|
|
1046
|
-
return
|
|
1045
|
+
var h = Vt(o) ? Ti : mi;
|
|
1046
|
+
return h.test(As(o));
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return
|
|
1048
|
+
function is(o) {
|
|
1049
|
+
return ct(o) && Te(o.length) && !!N[Ct(o)];
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1052
|
-
if (!
|
|
1053
|
-
return
|
|
1054
|
-
var
|
|
1055
|
-
for (var
|
|
1056
|
-
|
|
1051
|
+
function ss(o) {
|
|
1052
|
+
if (!tt(o))
|
|
1053
|
+
return bs(o);
|
|
1054
|
+
var h = Ae(o), m = [];
|
|
1055
|
+
for (var A in o)
|
|
1056
|
+
A == "constructor" && (h || !q.call(o, A)) || m.push(A);
|
|
1057
1057
|
return m;
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1060
|
-
|
|
1061
|
-
if (S || (S = new
|
|
1062
|
-
|
|
1059
|
+
function we(o, h, m, A, S) {
|
|
1060
|
+
o !== h && ts(h, function(E, F) {
|
|
1061
|
+
if (S || (S = new nt()), tt(E))
|
|
1062
|
+
ns(o, h, F, m, we, A, S);
|
|
1063
1063
|
else {
|
|
1064
|
-
var L =
|
|
1065
|
-
L === void 0 && (L = E), Rt(
|
|
1064
|
+
var L = A ? A(zt(o, F), E, F + "", o, h, S) : void 0;
|
|
1065
|
+
L === void 0 && (L = E), Rt(o, F, L);
|
|
1066
1066
|
}
|
|
1067
|
-
},
|
|
1067
|
+
}, ke);
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
var L =
|
|
1071
|
-
if (
|
|
1072
|
-
Rt(
|
|
1069
|
+
function ns(o, h, m, A, S, E, F) {
|
|
1070
|
+
var L = zt(o, m), B = zt(h, m), j = F.get(B);
|
|
1071
|
+
if (j) {
|
|
1072
|
+
Rt(o, m, j);
|
|
1073
1073
|
return;
|
|
1074
1074
|
}
|
|
1075
|
-
var
|
|
1076
|
-
if (
|
|
1077
|
-
var Wt =
|
|
1078
|
-
|
|
1075
|
+
var P = E ? E(L, B, m + "", o, h, F) : void 0, ht = P === void 0;
|
|
1076
|
+
if (ht) {
|
|
1077
|
+
var Wt = Yt(B), Xt = !Wt && Me(B), Le = !Wt && !Xt && Se(B);
|
|
1078
|
+
P = B, Wt || Xt || Le ? Yt(L) ? P = L : Ms(L) ? P = hs(L) : Xt ? (ht = !1, P = os(B)) : Le ? (ht = !1, P = cs(B)) : P = [] : Ts(B) || Ot(B) ? (P = L, Ot(L) ? P = Ss(L) : (!tt(L) || Vt(L)) && (P = ms(B))) : ht = !1;
|
|
1079
1079
|
}
|
|
1080
|
-
|
|
1080
|
+
ht && (F.set(B, P), S(P, B, A, E, F), F.delete(B)), Rt(o, m, P);
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1082
|
+
function rs(o, h) {
|
|
1083
|
+
return ws(xs(o, h, De), o + "");
|
|
1084
1084
|
}
|
|
1085
|
-
var
|
|
1086
|
-
return xt(
|
|
1085
|
+
var as = xt ? function(o, h) {
|
|
1086
|
+
return xt(o, "toString", {
|
|
1087
1087
|
configurable: !0,
|
|
1088
1088
|
enumerable: !1,
|
|
1089
|
-
value:
|
|
1089
|
+
value: Ds(h),
|
|
1090
1090
|
writable: !0
|
|
1091
1091
|
});
|
|
1092
|
-
} :
|
|
1093
|
-
function
|
|
1094
|
-
return
|
|
1092
|
+
} : De;
|
|
1093
|
+
function os(o, h) {
|
|
1094
|
+
return o.slice();
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1097
|
-
var
|
|
1098
|
-
return new
|
|
1096
|
+
function ls(o) {
|
|
1097
|
+
var h = new o.constructor(o.byteLength);
|
|
1098
|
+
return new _e(h).set(new _e(o)), h;
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1101
|
-
var m =
|
|
1102
|
-
return new
|
|
1100
|
+
function cs(o, h) {
|
|
1101
|
+
var m = ls(o.buffer);
|
|
1102
|
+
return new o.constructor(m, o.byteOffset, o.length);
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1105
|
-
var m = -1,
|
|
1106
|
-
for (
|
|
1107
|
-
|
|
1108
|
-
return
|
|
1104
|
+
function hs(o, h) {
|
|
1105
|
+
var m = -1, A = o.length;
|
|
1106
|
+
for (h || (h = Array(A)); ++m < A; )
|
|
1107
|
+
h[m] = o[m];
|
|
1108
|
+
return h;
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function ds(o, h, m, A) {
|
|
1111
1111
|
var S = !m;
|
|
1112
1112
|
m || (m = {});
|
|
1113
|
-
for (var E = -1, F =
|
|
1114
|
-
var L =
|
|
1115
|
-
|
|
1113
|
+
for (var E = -1, F = h.length; ++E < F; ) {
|
|
1114
|
+
var L = h[E], B = void 0;
|
|
1115
|
+
B === void 0 && (B = o[L]), S ? $t(m, L, B) : Ki(m, L, B);
|
|
1116
1116
|
}
|
|
1117
1117
|
return m;
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1120
|
-
return
|
|
1121
|
-
var
|
|
1122
|
-
for (E =
|
|
1123
|
-
var L = m[
|
|
1124
|
-
L &&
|
|
1119
|
+
function us(o) {
|
|
1120
|
+
return rs(function(h, m) {
|
|
1121
|
+
var A = -1, S = m.length, E = S > 1 ? m[S - 1] : void 0, F = S > 2 ? m[2] : void 0;
|
|
1122
|
+
for (E = o.length > 3 && typeof E == "function" ? (S--, E) : void 0, F && _s(m[0], m[1], F) && (E = S < 3 ? void 0 : E, S = 1), h = Object(h); ++A < S; ) {
|
|
1123
|
+
var L = m[A];
|
|
1124
|
+
L && o(h, L, A, E);
|
|
1125
1125
|
}
|
|
1126
|
-
return
|
|
1126
|
+
return h;
|
|
1127
1127
|
});
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return function(
|
|
1131
|
-
for (var S = -1, E = Object(
|
|
1132
|
-
var
|
|
1133
|
-
if (m(E[
|
|
1129
|
+
function fs(o) {
|
|
1130
|
+
return function(h, m, A) {
|
|
1131
|
+
for (var S = -1, E = Object(h), F = A(h), L = F.length; L--; ) {
|
|
1132
|
+
var B = F[++S];
|
|
1133
|
+
if (m(E[B], B, E) === !1)
|
|
1134
1134
|
break;
|
|
1135
1135
|
}
|
|
1136
|
-
return
|
|
1136
|
+
return h;
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
|
-
function
|
|
1140
|
-
var m =
|
|
1141
|
-
return
|
|
1139
|
+
function At(o, h) {
|
|
1140
|
+
var m = o.__data__;
|
|
1141
|
+
return ps(h) ? m[typeof h == "string" ? "string" : "hash"] : m.map;
|
|
1142
1142
|
}
|
|
1143
|
-
function Pt(
|
|
1144
|
-
var m =
|
|
1145
|
-
return
|
|
1143
|
+
function Pt(o, h) {
|
|
1144
|
+
var m = xi(o, h);
|
|
1145
|
+
return es(m) ? m : void 0;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1148
|
-
var
|
|
1147
|
+
function gs(o) {
|
|
1148
|
+
var h = q.call(o, Q), m = o[Q];
|
|
1149
1149
|
try {
|
|
1150
|
-
|
|
1151
|
-
var
|
|
1150
|
+
o[Q] = void 0;
|
|
1151
|
+
var A = !0;
|
|
1152
1152
|
} catch {
|
|
1153
1153
|
}
|
|
1154
|
-
var S =
|
|
1155
|
-
return
|
|
1154
|
+
var S = ge.call(o);
|
|
1155
|
+
return A && (h ? o[Q] = m : delete o[Q]), S;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
return typeof
|
|
1157
|
+
function ms(o) {
|
|
1158
|
+
return typeof o.constructor == "function" && !Ae(o) ? Ei(pe(o)) : {};
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
var m = typeof
|
|
1162
|
-
return
|
|
1160
|
+
function Ce(o, h) {
|
|
1161
|
+
var m = typeof o;
|
|
1162
|
+
return h = h ?? a, !!h && (m == "number" || m != "symbol" && _i.test(o)) && o > -1 && o % 1 == 0 && o < h;
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1165
|
-
if (!
|
|
1164
|
+
function _s(o, h, m) {
|
|
1165
|
+
if (!tt(m))
|
|
1166
1166
|
return !1;
|
|
1167
|
-
var
|
|
1168
|
-
return (
|
|
1167
|
+
var A = typeof h;
|
|
1168
|
+
return (A == "number" ? jt(m) && Ce(h, m.length) : A == "string" && h in m) ? Mt(m[h], o) : !1;
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1171
|
-
var
|
|
1172
|
-
return
|
|
1170
|
+
function ps(o) {
|
|
1171
|
+
var h = typeof o;
|
|
1172
|
+
return h == "string" || h == "number" || h == "symbol" || h == "boolean" ? o !== "__proto__" : o === null;
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1175
|
-
return !!
|
|
1174
|
+
function vs(o) {
|
|
1175
|
+
return !!fe && fe in o;
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1178
|
-
var
|
|
1179
|
-
return
|
|
1177
|
+
function Ae(o) {
|
|
1178
|
+
var h = o && o.constructor, m = typeof h == "function" && h.prototype || vt;
|
|
1179
|
+
return o === m;
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1182
|
-
var
|
|
1183
|
-
if (
|
|
1184
|
-
for (var m in Object(
|
|
1185
|
-
|
|
1186
|
-
return
|
|
1181
|
+
function bs(o) {
|
|
1182
|
+
var h = [];
|
|
1183
|
+
if (o != null)
|
|
1184
|
+
for (var m in Object(o))
|
|
1185
|
+
h.push(m);
|
|
1186
|
+
return h;
|
|
1187
1187
|
}
|
|
1188
|
-
function
|
|
1189
|
-
return
|
|
1188
|
+
function ys(o) {
|
|
1189
|
+
return ge.call(o);
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return
|
|
1193
|
-
for (var
|
|
1194
|
-
F[S] =
|
|
1191
|
+
function xs(o, h, m) {
|
|
1192
|
+
return h = be(h === void 0 ? o.length - 1 : h, 0), function() {
|
|
1193
|
+
for (var A = arguments, S = -1, E = be(A.length - h, 0), F = Array(E); ++S < E; )
|
|
1194
|
+
F[S] = A[h + S];
|
|
1195
1195
|
S = -1;
|
|
1196
|
-
for (var L = Array(
|
|
1197
|
-
L[S] =
|
|
1198
|
-
return L[
|
|
1196
|
+
for (var L = Array(h + 1); ++S < h; )
|
|
1197
|
+
L[S] = A[S];
|
|
1198
|
+
return L[h] = m(F), vi(o, this, L);
|
|
1199
1199
|
};
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1202
|
-
if (!(
|
|
1203
|
-
return
|
|
1201
|
+
function zt(o, h) {
|
|
1202
|
+
if (!(h === "constructor" && typeof o[h] == "function") && h != "__proto__")
|
|
1203
|
+
return o[h];
|
|
1204
1204
|
}
|
|
1205
|
-
var
|
|
1206
|
-
function
|
|
1207
|
-
var
|
|
1205
|
+
var ws = Cs(as);
|
|
1206
|
+
function Cs(o) {
|
|
1207
|
+
var h = 0, m = 0;
|
|
1208
1208
|
return function() {
|
|
1209
|
-
var
|
|
1210
|
-
if (m =
|
|
1211
|
-
if (++
|
|
1209
|
+
var A = Li(), S = r - (A - m);
|
|
1210
|
+
if (m = A, S > 0) {
|
|
1211
|
+
if (++h >= n)
|
|
1212
1212
|
return arguments[0];
|
|
1213
1213
|
} else
|
|
1214
|
-
|
|
1215
|
-
return
|
|
1214
|
+
h = 0;
|
|
1215
|
+
return o.apply(void 0, arguments);
|
|
1216
1216
|
};
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1219
|
-
if (
|
|
1218
|
+
function As(o) {
|
|
1219
|
+
if (o != null) {
|
|
1220
1220
|
try {
|
|
1221
|
-
return bt.call(
|
|
1221
|
+
return bt.call(o);
|
|
1222
1222
|
} catch {
|
|
1223
1223
|
}
|
|
1224
1224
|
try {
|
|
1225
|
-
return
|
|
1225
|
+
return o + "";
|
|
1226
1226
|
} catch {
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
return "";
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1231
|
+
function Mt(o, h) {
|
|
1232
|
+
return o === h || o !== o && h !== h;
|
|
1233
1233
|
}
|
|
1234
|
-
var
|
|
1234
|
+
var Ot = xe(/* @__PURE__ */ function() {
|
|
1235
1235
|
return arguments;
|
|
1236
|
-
}()) ?
|
|
1237
|
-
return
|
|
1238
|
-
},
|
|
1239
|
-
function jt(
|
|
1240
|
-
return
|
|
1236
|
+
}()) ? xe : function(o) {
|
|
1237
|
+
return ct(o) && q.call(o, "callee") && !Si.call(o, "callee");
|
|
1238
|
+
}, Yt = Array.isArray;
|
|
1239
|
+
function jt(o) {
|
|
1240
|
+
return o != null && Te(o.length) && !Vt(o);
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return
|
|
1242
|
+
function Ms(o) {
|
|
1243
|
+
return ct(o) && jt(o);
|
|
1244
1244
|
}
|
|
1245
|
-
var
|
|
1246
|
-
function
|
|
1247
|
-
if (!
|
|
1245
|
+
var Me = Di || Ls;
|
|
1246
|
+
function Vt(o) {
|
|
1247
|
+
if (!tt(o))
|
|
1248
1248
|
return !1;
|
|
1249
|
-
var
|
|
1250
|
-
return
|
|
1249
|
+
var h = Ct(o);
|
|
1250
|
+
return h == p || h == v || h == d || h == C;
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return typeof
|
|
1252
|
+
function Te(o) {
|
|
1253
|
+
return typeof o == "number" && o > -1 && o % 1 == 0 && o <= a;
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1256
|
-
var
|
|
1257
|
-
return
|
|
1255
|
+
function tt(o) {
|
|
1256
|
+
var h = typeof o;
|
|
1257
|
+
return o != null && (h == "object" || h == "function");
|
|
1258
1258
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return
|
|
1259
|
+
function ct(o) {
|
|
1260
|
+
return o != null && typeof o == "object";
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1263
|
-
if (!
|
|
1262
|
+
function Ts(o) {
|
|
1263
|
+
if (!ct(o) || Ct(o) != y)
|
|
1264
1264
|
return !1;
|
|
1265
|
-
var
|
|
1266
|
-
if (
|
|
1265
|
+
var h = pe(o);
|
|
1266
|
+
if (h === null)
|
|
1267
1267
|
return !0;
|
|
1268
|
-
var m =
|
|
1269
|
-
return typeof m == "function" && m instanceof m && bt.call(m) ==
|
|
1268
|
+
var m = q.call(h, "constructor") && h.constructor;
|
|
1269
|
+
return typeof m == "function" && m instanceof m && bt.call(m) == Mi;
|
|
1270
1270
|
}
|
|
1271
|
-
var
|
|
1272
|
-
function
|
|
1273
|
-
return
|
|
1271
|
+
var Se = ue ? yi(ue) : is;
|
|
1272
|
+
function Ss(o) {
|
|
1273
|
+
return ds(o, ke(o));
|
|
1274
1274
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return jt(
|
|
1275
|
+
function ke(o) {
|
|
1276
|
+
return jt(o) ? Qi(o) : ss(o);
|
|
1277
1277
|
}
|
|
1278
|
-
var
|
|
1279
|
-
|
|
1278
|
+
var ks = us(function(o, h, m) {
|
|
1279
|
+
we(o, h, m);
|
|
1280
1280
|
});
|
|
1281
|
-
function
|
|
1281
|
+
function Ds(o) {
|
|
1282
1282
|
return function() {
|
|
1283
|
-
return
|
|
1283
|
+
return o;
|
|
1284
1284
|
};
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return
|
|
1286
|
+
function De(o) {
|
|
1287
|
+
return o;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function Ls() {
|
|
1290
1290
|
return !1;
|
|
1291
1291
|
}
|
|
1292
|
-
i.exports =
|
|
1293
|
-
}(
|
|
1292
|
+
i.exports = ks;
|
|
1293
|
+
}(ut, ut.exports)), ut.exports;
|
|
1294
1294
|
}
|
|
1295
|
-
var
|
|
1296
|
-
const Dt = /* @__PURE__ */
|
|
1295
|
+
var gn = fn();
|
|
1296
|
+
const Dt = /* @__PURE__ */ un(gn), Pe = 12, mn = {
|
|
1297
1297
|
candles: {
|
|
1298
1298
|
direction: "right",
|
|
1299
|
-
offset: `${Math.round(
|
|
1299
|
+
offset: `${Math.round(Pe / 2)}px`,
|
|
1300
1300
|
style: "filled",
|
|
1301
1301
|
strokeWidth: 1,
|
|
1302
|
-
baseWidth:
|
|
1302
|
+
baseWidth: Pe,
|
|
1303
1303
|
bodyRatio: 0.7,
|
|
1304
1304
|
zoomOnWheel: "both",
|
|
1305
1305
|
scaleSensitivity: 2e-3,
|
|
1306
|
-
limiterOffset:
|
|
1306
|
+
limiterOffset: { left: 0, right: 0 },
|
|
1307
|
+
hideMissingData: !1
|
|
1307
1308
|
},
|
|
1308
1309
|
xAxis: {
|
|
1309
1310
|
isShow: !0,
|
|
@@ -1339,14 +1340,14 @@ const Dt = /* @__PURE__ */ ln(hn), $e = 12, dn = {
|
|
|
1339
1340
|
showLabelButtons: !0
|
|
1340
1341
|
}
|
|
1341
1342
|
};
|
|
1342
|
-
class
|
|
1343
|
+
class _n {
|
|
1343
1344
|
constructor(t) {
|
|
1344
1345
|
u(this, "_candles");
|
|
1345
1346
|
u(this, "_xAxis");
|
|
1346
1347
|
u(this, "_yAxis");
|
|
1347
1348
|
u(this, "_guides");
|
|
1348
1349
|
u(this, "_trade");
|
|
1349
|
-
const e = Dt({},
|
|
1350
|
+
const e = Dt({}, mn, t);
|
|
1350
1351
|
this._candles = e.candles, this._xAxis = e.xAxis, this._yAxis = e.yAxis, this._guides = e.guides, this._trade = e.trade;
|
|
1351
1352
|
}
|
|
1352
1353
|
update(t) {
|
|
@@ -1420,7 +1421,7 @@ class O {
|
|
|
1420
1421
|
return this.y + this.height;
|
|
1421
1422
|
}
|
|
1422
1423
|
}
|
|
1423
|
-
class
|
|
1424
|
+
class pn {
|
|
1424
1425
|
constructor(t, e) {
|
|
1425
1426
|
u(this, "_chart", new O());
|
|
1426
1427
|
u(this, "_area", new O());
|
|
@@ -1478,43 +1479,43 @@ class fn {
|
|
|
1478
1479
|
return this._chart;
|
|
1479
1480
|
}
|
|
1480
1481
|
}
|
|
1481
|
-
const
|
|
1482
|
-
function
|
|
1482
|
+
const vn = (i) => i ? new Date(i.close_time).getTime() - new Date(i.open_time).getTime() : 0;
|
|
1483
|
+
function bn(i, t) {
|
|
1483
1484
|
if (i.length < 2) return [];
|
|
1484
1485
|
const e = [];
|
|
1485
1486
|
for (let s = 0; s < i.length - 1; s++) {
|
|
1486
|
-
const n = i[s].close_time.getTime(), r = i[s].open_time.getTime(),
|
|
1487
|
-
if (
|
|
1488
|
-
const c = Math.floor(
|
|
1487
|
+
const n = i[s].close_time.getTime(), r = i[s].open_time.getTime(), l = new Date(i[s + 1].open_time).getTime() - n;
|
|
1488
|
+
if (l >= t) {
|
|
1489
|
+
const c = Math.floor(l / t), d = [];
|
|
1489
1490
|
for (let f = 1; f <= c; f++)
|
|
1490
|
-
|
|
1491
|
-
|
|
1491
|
+
d.push(r + f * t);
|
|
1492
|
+
d.length > 0 && e.push(d);
|
|
1492
1493
|
}
|
|
1493
1494
|
}
|
|
1494
1495
|
return e;
|
|
1495
1496
|
}
|
|
1496
|
-
function
|
|
1497
|
-
const e =
|
|
1497
|
+
function ze(i, t) {
|
|
1498
|
+
const e = vn(i[0]), s = bn(i, e), n = [];
|
|
1498
1499
|
return s.forEach((r) => {
|
|
1499
1500
|
if (r.length === 0) return;
|
|
1500
|
-
const a = i.find((g) => g.close_time.getTime() === r[0]),
|
|
1501
|
+
const a = i.find((g) => g.close_time.getTime() === r[0]), l = i.find(
|
|
1501
1502
|
(g) => g.open_time.getTime() === r[r.length - 1] + e
|
|
1502
1503
|
);
|
|
1503
|
-
if (!a || !
|
|
1504
|
+
if (!a || !l)
|
|
1504
1505
|
throw new Error("[CS_Data] error while creating missing data");
|
|
1505
|
-
const c = a.close,
|
|
1506
|
+
const c = a.close, d = l.open;
|
|
1506
1507
|
let f = c;
|
|
1507
1508
|
r.forEach((g, _) => {
|
|
1508
|
-
const p = (
|
|
1509
|
+
const p = (d - f) / r.length;
|
|
1509
1510
|
let v = f + p * _, b = v + p;
|
|
1510
|
-
const
|
|
1511
|
-
let w = Math.max(v, b) +
|
|
1511
|
+
const x = Math.abs(v - b);
|
|
1512
|
+
let w = Math.max(v, b) + x / 2, y = Math.min(v, b) - x / 2;
|
|
1512
1513
|
if (t.trade) {
|
|
1513
1514
|
const T = [...t.trade.entries, ...t.trade.exits].find((H) => {
|
|
1514
|
-
const
|
|
1515
|
-
return
|
|
1515
|
+
const R = H.time.getTime();
|
|
1516
|
+
return R >= g && R < g + e;
|
|
1516
1517
|
});
|
|
1517
|
-
T && (T.type === "buy" ? (
|
|
1518
|
+
T && (T.type === "buy" ? (y = T.price, b = Math.max(y, b), v = b + x, w = Math.max(v, b) + x / 2, f = v) : T.type === "sell" && (w = T.price, b = Math.min(w, b), v = b - x, y = Math.min(v, b) - x / 2, f = v));
|
|
1518
1519
|
}
|
|
1519
1520
|
const C = {
|
|
1520
1521
|
open_time: new Date(g),
|
|
@@ -1522,13 +1523,13 @@ function Re(i, t) {
|
|
|
1522
1523
|
open: v,
|
|
1523
1524
|
close: b,
|
|
1524
1525
|
high: w,
|
|
1525
|
-
low:
|
|
1526
|
+
low: y
|
|
1526
1527
|
};
|
|
1527
1528
|
n.push(C);
|
|
1528
1529
|
});
|
|
1529
1530
|
}), n;
|
|
1530
1531
|
}
|
|
1531
|
-
class
|
|
1532
|
+
class ne {
|
|
1532
1533
|
constructor(t, e) {
|
|
1533
1534
|
u(this, "_initialData", []);
|
|
1534
1535
|
u(this, "_preparedData", []);
|
|
@@ -1542,10 +1543,10 @@ class se {
|
|
|
1542
1543
|
return t.map((e) => ({ ...e, open_time: new Date(e.open_time), close_time: new Date(e.close_time) })).sort((e, s) => e.open_time.getTime() - s.open_time.getTime());
|
|
1543
1544
|
}
|
|
1544
1545
|
update(t) {
|
|
1545
|
-
this._initialData = t, this._preparedData = this._prepare(t), this._missingData =
|
|
1546
|
+
this._initialData = t, this._preparedData = this._prepare(t), this._missingData = ze(this._preparedData, this._model), this._count = this._preparedData.length + this._missingData.length, this._interval = new Date(t[0].close_time).getTime() - new Date(t[0].open_time).getTime();
|
|
1546
1547
|
}
|
|
1547
1548
|
updateMissingCandles() {
|
|
1548
|
-
this._missingData =
|
|
1549
|
+
this._missingData = ze(this._preparedData, this._model);
|
|
1549
1550
|
}
|
|
1550
1551
|
get initialData() {
|
|
1551
1552
|
return this._initialData;
|
|
@@ -1569,7 +1570,7 @@ class se {
|
|
|
1569
1570
|
return e.find((s) => s.open_time <= t && s.close_time > t);
|
|
1570
1571
|
}
|
|
1571
1572
|
}
|
|
1572
|
-
class
|
|
1573
|
+
class yn {
|
|
1573
1574
|
constructor() {
|
|
1574
1575
|
u(this, "listeners", {});
|
|
1575
1576
|
}
|
|
@@ -1588,7 +1589,7 @@ class _n {
|
|
|
1588
1589
|
});
|
|
1589
1590
|
}
|
|
1590
1591
|
}
|
|
1591
|
-
class
|
|
1592
|
+
class Ke {
|
|
1592
1593
|
constructor() {
|
|
1593
1594
|
u(this, "_scale");
|
|
1594
1595
|
}
|
|
@@ -1624,35 +1625,35 @@ class qe {
|
|
|
1624
1625
|
return this._scale(t);
|
|
1625
1626
|
}
|
|
1626
1627
|
}
|
|
1627
|
-
class
|
|
1628
|
+
class ti extends Ke {
|
|
1628
1629
|
constructor() {
|
|
1629
1630
|
super(), this._scale = D.scaleTime();
|
|
1630
1631
|
}
|
|
1631
1632
|
}
|
|
1632
|
-
class
|
|
1633
|
+
class xn extends Ke {
|
|
1633
1634
|
constructor() {
|
|
1634
1635
|
super(), this._scale = D.scaleLinear();
|
|
1635
1636
|
}
|
|
1636
1637
|
}
|
|
1637
|
-
const
|
|
1638
|
+
const Oe = { x: 0.2, y: 0.2 }, Ye = 1e-3, wn = {
|
|
1638
1639
|
s: 1e3,
|
|
1639
1640
|
M: 1e3 * 60,
|
|
1640
1641
|
h: 1e3 * 60 * 60,
|
|
1641
1642
|
d: 1e3 * 60 * 60 * 24,
|
|
1642
1643
|
w: 1e3 * 60 * 60 * 24 * 7
|
|
1643
|
-
},
|
|
1644
|
+
}, Cn = (i) => {
|
|
1644
1645
|
const t = i.match(/^(\d+)([a-zA-Z]+)$/);
|
|
1645
1646
|
if (!t) throw new Error(`Invalid offset format: "${i}"`);
|
|
1646
1647
|
return [parseInt(t[1]), t[2]];
|
|
1647
|
-
},
|
|
1648
|
-
const [e, s] = t.domain().map((
|
|
1649
|
-
const c =
|
|
1648
|
+
}, An = (i, t) => {
|
|
1649
|
+
const [e, s] = t.domain().map((l) => l.getTime()), n = i.filter((l) => {
|
|
1650
|
+
const c = l.open_time.getTime();
|
|
1650
1651
|
return c >= e && c <= s;
|
|
1651
|
-
}), r = D.min(n, (
|
|
1652
|
+
}), r = D.min(n, (l) => l.low), a = D.max(n, (l) => l.high);
|
|
1652
1653
|
if (r == null || a == null) throw new Error("Invalid Y data");
|
|
1653
1654
|
return [r, a];
|
|
1654
1655
|
};
|
|
1655
|
-
class
|
|
1656
|
+
class Mn {
|
|
1656
1657
|
constructor(t) {
|
|
1657
1658
|
this.model = t;
|
|
1658
1659
|
}
|
|
@@ -1662,14 +1663,14 @@ class xn {
|
|
|
1662
1663
|
t.setDomain(s), this.setRange(t, this.model.layout.xAxis), this.setDefaultXDomain(t), this.applyOffset(t);
|
|
1663
1664
|
}
|
|
1664
1665
|
initY(t, e) {
|
|
1665
|
-
const s =
|
|
1666
|
+
const s = An(this.model.candles.preparedData, e);
|
|
1666
1667
|
t.setDomain(s), this.setRange(t, this.model.layout.yAxis);
|
|
1667
1668
|
}
|
|
1668
1669
|
init(t) {
|
|
1669
1670
|
this.initX(t.x), this.initY(t.y, t.x);
|
|
1670
1671
|
}
|
|
1671
1672
|
setRange(t, { x: e, y: s, width: n, height: r }) {
|
|
1672
|
-
t instanceof
|
|
1673
|
+
t instanceof ti ? t.setRange([e, e + n]) : t.setRange([s + r, s]);
|
|
1673
1674
|
}
|
|
1674
1675
|
setDefaultXDomain(t) {
|
|
1675
1676
|
const {
|
|
@@ -1678,7 +1679,7 @@ class xn {
|
|
|
1678
1679
|
config: {
|
|
1679
1680
|
candles: { baseWidth: n, bodyRatio: r, direction: a }
|
|
1680
1681
|
}
|
|
1681
|
-
} = this.model, [
|
|
1682
|
+
} = this.model, [l, c] = t.domain().map((p) => p.getTime()), d = c - l, f = n / r * e, g = d * (s.width / f), _ = a === "left" ? [new Date(l), new Date(l + g)] : [new Date(c - g), new Date(c)];
|
|
1682
1683
|
t.setDomain(_);
|
|
1683
1684
|
}
|
|
1684
1685
|
applyOffset(t) {
|
|
@@ -1687,11 +1688,11 @@ class xn {
|
|
|
1687
1688
|
candles: { offset: e, direction: s }
|
|
1688
1689
|
},
|
|
1689
1690
|
layout: { xAxis: n }
|
|
1690
|
-
} = this.model, [r, a] =
|
|
1691
|
-
t.setDomain([new Date(
|
|
1691
|
+
} = this.model, [r, a] = Cn(e), l = a === "px" ? t.invert(n.x + r).getTime() - t.invert(n.x).getTime() : wn[a] * r, c = s === "left" ? -l : l, [d, f] = t.domain();
|
|
1692
|
+
t.setDomain([new Date(d.getTime() + c), new Date(f.getTime() + c)]);
|
|
1692
1693
|
}
|
|
1693
1694
|
}
|
|
1694
|
-
class
|
|
1695
|
+
class Tn {
|
|
1695
1696
|
constructor(t) {
|
|
1696
1697
|
u(this, "_model");
|
|
1697
1698
|
u(this, "_scaleX");
|
|
@@ -1703,7 +1704,7 @@ class wn {
|
|
|
1703
1704
|
});
|
|
1704
1705
|
u(this, "scaleFactor", { x: 1, y: 1 });
|
|
1705
1706
|
u(this, "panOffset", { x: 0, y: 0 });
|
|
1706
|
-
this._model = t, this._scaleX = new
|
|
1707
|
+
this._model = t, this._scaleX = new ti(), this._scaleY = new xn(), this._initializer = new Mn(t), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
|
|
1707
1708
|
x: this._scaleX.domain(),
|
|
1708
1709
|
y: this._scaleY.domain()
|
|
1709
1710
|
};
|
|
@@ -1735,21 +1736,21 @@ class wn {
|
|
|
1735
1736
|
fitYToVisibleCandles() {
|
|
1736
1737
|
const t = this._model.candles.allData, [e, s] = this._scaleX.domain(), n = t.filter((g) => g.open_time >= e && g.open_time <= s);
|
|
1737
1738
|
if (!n.length) return;
|
|
1738
|
-
const r = Math.min(...n.map((g) => g.low)), a = Math.max(...n.map((g) => g.high)),
|
|
1739
|
-
if (
|
|
1739
|
+
const r = Math.min(...n.map((g) => g.low)), a = Math.max(...n.map((g) => g.high)), l = a - r;
|
|
1740
|
+
if (l === 0) return;
|
|
1740
1741
|
const c = this._baseDomain.y;
|
|
1741
|
-
this.scale("y", (c[1] - c[0]) /
|
|
1742
|
-
const
|
|
1743
|
-
this.pan("y", f -
|
|
1742
|
+
this.scale("y", (c[1] - c[0]) / l, "absolute");
|
|
1743
|
+
const d = this._scaleY.convert((r + a) / 2), f = this._scaleY.convert((c[0] + c[1]) / 2);
|
|
1744
|
+
this.pan("y", f - d, "absolute");
|
|
1744
1745
|
}
|
|
1745
1746
|
scale(t, e, s = "delta") {
|
|
1746
1747
|
if (s === "absolute") {
|
|
1747
|
-
const n = Math.max(
|
|
1748
|
-
if (Math.abs(n - this.scaleFactor[t]) <
|
|
1748
|
+
const n = Math.max(Oe[t], e);
|
|
1749
|
+
if (Math.abs(n - this.scaleFactor[t]) < Ye) return;
|
|
1749
1750
|
this.scaleFactor[t] = n;
|
|
1750
1751
|
} else {
|
|
1751
1752
|
const n = this.scaleFactor[t], r = n + e * this._model.config.candles.scaleSensitivity;
|
|
1752
|
-
if (r <
|
|
1753
|
+
if (r < Oe[t] || Math.abs(r - n) < Ye) return;
|
|
1753
1754
|
this.scaleFactor[t] = r;
|
|
1754
1755
|
}
|
|
1755
1756
|
this._updateDomain(t);
|
|
@@ -1760,22 +1761,22 @@ class wn {
|
|
|
1760
1761
|
_updateDomain(t) {
|
|
1761
1762
|
const e = this._baseDomain[t], s = this.scaleFactor[t], n = this.panOffset[t];
|
|
1762
1763
|
if (t === "x") {
|
|
1763
|
-
const [r, a] = e,
|
|
1764
|
+
const [r, a] = e, l = a.getTime() - r.getTime(), c = l / s, d = r.getTime() + l / 2, f = this._scaleX.invert(0 - n).getTime() - this._scaleX.invert(0).getTime();
|
|
1764
1765
|
this._scaleX.setDomain([
|
|
1765
|
-
new Date(
|
|
1766
|
-
new Date(
|
|
1766
|
+
new Date(d - c / 2 + f),
|
|
1767
|
+
new Date(d + c / 2 + f)
|
|
1767
1768
|
]);
|
|
1768
1769
|
} else {
|
|
1769
|
-
const [r, a] = e,
|
|
1770
|
+
const [r, a] = e, l = a - r, c = l / s, d = r + l / 2, f = this._scaleY.invert(0 - n) - this._scaleY.invert(0);
|
|
1770
1771
|
this._scaleY.setDomain([
|
|
1771
|
-
|
|
1772
|
-
|
|
1772
|
+
d - c / 2 + f,
|
|
1773
|
+
d + c / 2 + f
|
|
1773
1774
|
]);
|
|
1774
1775
|
}
|
|
1775
1776
|
this._model.eventBus.emit("scale_event");
|
|
1776
1777
|
}
|
|
1777
1778
|
}
|
|
1778
|
-
class
|
|
1779
|
+
class Sn {
|
|
1779
1780
|
constructor(t, { entry: e = [], exit: s = [] }) {
|
|
1780
1781
|
u(this, "_model");
|
|
1781
1782
|
u(this, "_rawEntry");
|
|
@@ -1851,8 +1852,8 @@ class Cn {
|
|
|
1851
1852
|
const { allData: t, interval: e } = this._model.candles, s = t.map((a) => a.open_time.getTime());
|
|
1852
1853
|
let n = 0, r = s.length - 1;
|
|
1853
1854
|
for (let a = 0; a < s.length; a++) {
|
|
1854
|
-
const
|
|
1855
|
-
if (n === 0 && c && (n = a), r === s.length - 1 &&
|
|
1855
|
+
const l = s[a], c = l <= this.entryMinTime && l + e >= this.entryMinTime, d = l <= this.exitMaxTime && l + e >= this.exitMaxTime;
|
|
1856
|
+
if (n === 0 && c && (n = a), r === s.length - 1 && d && (r = a), n !== 0 && r !== s.length - 1) break;
|
|
1856
1857
|
}
|
|
1857
1858
|
return s.slice(n, r + 1);
|
|
1858
1859
|
}
|
|
@@ -1863,7 +1864,7 @@ class Cn {
|
|
|
1863
1864
|
return Math.abs(this.entryMinTime - this.exitMaxTime);
|
|
1864
1865
|
}
|
|
1865
1866
|
}
|
|
1866
|
-
class
|
|
1867
|
+
class kn {
|
|
1867
1868
|
constructor(t, e) {
|
|
1868
1869
|
u(this, "_rawMarkers");
|
|
1869
1870
|
u(this, "_markers", []);
|
|
@@ -1881,45 +1882,27 @@ class Mn {
|
|
|
1881
1882
|
}
|
|
1882
1883
|
rebuild() {
|
|
1883
1884
|
const {
|
|
1884
|
-
layout: { area: t
|
|
1885
|
-
|
|
1886
|
-
scales: { x: n, y: r },
|
|
1885
|
+
layout: { area: t },
|
|
1886
|
+
scales: { y: e },
|
|
1887
1887
|
colorScheme: {
|
|
1888
|
-
userMarkers: { default:
|
|
1888
|
+
userMarkers: { default: s }
|
|
1889
1889
|
}
|
|
1890
1890
|
} = this._model;
|
|
1891
|
-
this._markers = this._rawMarkers.map((
|
|
1892
|
-
var
|
|
1893
|
-
const
|
|
1894
|
-
mainColor:
|
|
1895
|
-
textColor:
|
|
1896
|
-
lineColor:
|
|
1891
|
+
this._markers = this._rawMarkers.map((n) => {
|
|
1892
|
+
var d;
|
|
1893
|
+
const r = {
|
|
1894
|
+
mainColor: n.mainColor ?? s.main,
|
|
1895
|
+
textColor: n.textColor ?? s.text,
|
|
1896
|
+
lineColor: n.lineColor ?? s.line
|
|
1897
|
+
}, a = e.convert(n.value), c = (n.formatter ?? ((d = this._defaults.formatter) == null ? void 0 : d.horizontal) ?? ((f) => f.toString()))(n.value);
|
|
1898
|
+
return {
|
|
1899
|
+
value: n.value,
|
|
1900
|
+
text: c,
|
|
1901
|
+
x: t.x,
|
|
1902
|
+
y: a,
|
|
1903
|
+
startDate: n.startDate ? n.startDate instanceof Date ? n.startDate : new Date(n.startDate) : null,
|
|
1904
|
+
...r
|
|
1897
1905
|
};
|
|
1898
|
-
if ((o.type ?? "horizontal") === "horizontal") {
|
|
1899
|
-
const _ = o, p = r.convert(_.value), b = (_.formatter ?? ((f = this._defaults.formatter) == null ? void 0 : f.horizontal) ?? ((y) => y.toString()))(_.value);
|
|
1900
|
-
return {
|
|
1901
|
-
value: _.value,
|
|
1902
|
-
type: "horizontal",
|
|
1903
|
-
text: b,
|
|
1904
|
-
x: t.x,
|
|
1905
|
-
y: p,
|
|
1906
|
-
lineLength: e.width,
|
|
1907
|
-
position: s.yAxis.position,
|
|
1908
|
-
...c
|
|
1909
|
-
};
|
|
1910
|
-
} else {
|
|
1911
|
-
const _ = o, p = _.value instanceof Date ? _.value : new Date(_.value), v = n.convert(p), y = (_.formatter ?? ((g = this._defaults.formatter) == null ? void 0 : g.vertical) ?? ((w) => w.toLocaleString()))(p);
|
|
1912
|
-
return {
|
|
1913
|
-
value: p,
|
|
1914
|
-
type: "vertical",
|
|
1915
|
-
text: y,
|
|
1916
|
-
x: v,
|
|
1917
|
-
y: t.y,
|
|
1918
|
-
lineLength: e.height,
|
|
1919
|
-
position: s.xAxis.position,
|
|
1920
|
-
...c
|
|
1921
|
-
};
|
|
1922
|
-
}
|
|
1923
1906
|
});
|
|
1924
1907
|
}
|
|
1925
1908
|
updateMarkers(t) {
|
|
@@ -1929,7 +1912,7 @@ class Mn {
|
|
|
1929
1912
|
return this._markers;
|
|
1930
1913
|
}
|
|
1931
1914
|
}
|
|
1932
|
-
const
|
|
1915
|
+
const Dn = {
|
|
1933
1916
|
bg: "#FFFFFF",
|
|
1934
1917
|
axisIntersection: "#FFFFFF",
|
|
1935
1918
|
xAxis: {
|
|
@@ -1993,10 +1976,10 @@ const An = {
|
|
|
1993
1976
|
}
|
|
1994
1977
|
}
|
|
1995
1978
|
};
|
|
1996
|
-
class
|
|
1979
|
+
class Ln {
|
|
1997
1980
|
constructor(t) {
|
|
1998
1981
|
u(this, "_scheme");
|
|
1999
|
-
this._scheme = Dt({},
|
|
1982
|
+
this._scheme = Dt({}, Dn, t), Object.keys(this._scheme).forEach((e) => {
|
|
2000
1983
|
Object.defineProperty(this, e, {
|
|
2001
1984
|
get: () => this._scheme[e],
|
|
2002
1985
|
enumerable: !0
|
|
@@ -2007,7 +1990,7 @@ class Tn {
|
|
|
2007
1990
|
this._scheme = Dt({}, this._scheme, t);
|
|
2008
1991
|
}
|
|
2009
1992
|
}
|
|
2010
|
-
class
|
|
1993
|
+
class En {
|
|
2011
1994
|
constructor(t, e) {
|
|
2012
1995
|
u(this, "_data");
|
|
2013
1996
|
u(this, "_callbacks", {
|
|
@@ -2025,7 +2008,7 @@ class Sn {
|
|
|
2025
2008
|
_updateGroups() {
|
|
2026
2009
|
this._grouped = {};
|
|
2027
2010
|
for (const t of this._data) {
|
|
2028
|
-
const e =
|
|
2011
|
+
const e = ne.findByDate(new Date(t.date), this._model.candles.allData);
|
|
2029
2012
|
if (!e) continue;
|
|
2030
2013
|
const s = e.open_time.getTime();
|
|
2031
2014
|
this._grouped[s] || (this._grouped[s] = []), this._grouped[s].push({ ...t, candle: e });
|
|
@@ -2050,7 +2033,7 @@ class Sn {
|
|
|
2050
2033
|
this._updateGroups(), this._callbacks.onUpdate(t, e);
|
|
2051
2034
|
}
|
|
2052
2035
|
}
|
|
2053
|
-
class
|
|
2036
|
+
class Nn {
|
|
2054
2037
|
constructor({
|
|
2055
2038
|
chartId: t,
|
|
2056
2039
|
container: e,
|
|
@@ -2058,12 +2041,12 @@ class kn {
|
|
|
2058
2041
|
config: n,
|
|
2059
2042
|
trade: r = { entry: [], exit: [] },
|
|
2060
2043
|
userMarkers: a = [],
|
|
2061
|
-
colorScheme:
|
|
2044
|
+
colorScheme: l,
|
|
2062
2045
|
comments: c
|
|
2063
2046
|
}) {
|
|
2064
2047
|
u(this, "chartId");
|
|
2065
2048
|
u(this, "container");
|
|
2066
|
-
u(this, "eventBus", new
|
|
2049
|
+
u(this, "eventBus", new yn());
|
|
2067
2050
|
u(this, "candles");
|
|
2068
2051
|
u(this, "config");
|
|
2069
2052
|
u(this, "colorScheme");
|
|
@@ -2072,7 +2055,7 @@ class kn {
|
|
|
2072
2055
|
u(this, "trade");
|
|
2073
2056
|
u(this, "userMarkers");
|
|
2074
2057
|
u(this, "comments");
|
|
2075
|
-
this.chartId = t, this.container = e, this.candles = new
|
|
2058
|
+
this.chartId = t, this.container = e, this.candles = new ne(s, this), this.config = new _n(n), this.colorScheme = new Ln(l), this.layout = new pn(e, this.config), this.scales = new Tn(this), this.trade = new Sn(this, r), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new kn(this, a), this.comments = new En(c, this);
|
|
2076
2059
|
}
|
|
2077
2060
|
init() {
|
|
2078
2061
|
this.eventBus.emit("init_model");
|
|
@@ -2141,7 +2124,7 @@ class k {
|
|
|
2141
2124
|
this.node.style.opacity = t ? "1" : "0", this.node.style.visibility = t ? "visible" : "hidden";
|
|
2142
2125
|
}
|
|
2143
2126
|
}
|
|
2144
|
-
class
|
|
2127
|
+
class _t extends k {
|
|
2145
2128
|
constructor({ className: e, id: s, width: n, height: r, isMain: a }) {
|
|
2146
2129
|
super({
|
|
2147
2130
|
tag: "canvas",
|
|
@@ -2153,9 +2136,9 @@ class Ft extends k {
|
|
|
2153
2136
|
u(this, "_height");
|
|
2154
2137
|
u(this, "background", null);
|
|
2155
2138
|
this._width = n, this._height = r, this.updateSize({ width: n, height: r });
|
|
2156
|
-
const
|
|
2157
|
-
if (!
|
|
2158
|
-
|
|
2139
|
+
const l = this._node.getContext("2d");
|
|
2140
|
+
if (!l) throw new Error("Failed to get 2D context");
|
|
2141
|
+
l.scale(St, St), this._ctx = l;
|
|
2159
2142
|
}
|
|
2160
2143
|
updateSize({ width: e, height: s }) {
|
|
2161
2144
|
e && (this._node.width = e * St, this._node.style.width = `${e}px`, this._width = e), s && (this._node.height = s * St, this._node.style.height = `${s}px`, this._height = s);
|
|
@@ -2173,32 +2156,32 @@ class Ft extends k {
|
|
|
2173
2156
|
return this._height;
|
|
2174
2157
|
}
|
|
2175
2158
|
}
|
|
2176
|
-
const
|
|
2177
|
-
function
|
|
2159
|
+
const Fn = 10;
|
|
2160
|
+
function Bn(i, t) {
|
|
2178
2161
|
const {
|
|
2179
2162
|
layout: { xAxis: e },
|
|
2180
2163
|
colorScheme: { xAxis: s },
|
|
2181
2164
|
config: { xAxis: n },
|
|
2182
2165
|
scales: r
|
|
2183
|
-
} = t, a = r.x.ticks(
|
|
2166
|
+
} = t, a = r.x.ticks(Fn), l = (f) => f.getHours() === 0 && f.getMinutes() === 0, c = D.timeFormat("%d %b"), d = D.timeFormat("%H:%M");
|
|
2184
2167
|
i.save(), i.fillStyle = s.bg, i.fillRect(e.x, e.y, e.width, e.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", a.forEach((f) => {
|
|
2185
|
-
const g = r.x.convert(f), _ =
|
|
2168
|
+
const g = r.x.convert(f), _ = l(f) ? c(f) : d(f);
|
|
2186
2169
|
i.fillText(_, g, e.y + e.height / 2);
|
|
2187
2170
|
});
|
|
2188
2171
|
}
|
|
2189
|
-
function
|
|
2172
|
+
function In(i, t) {
|
|
2190
2173
|
const {
|
|
2191
2174
|
layout: { yAxis: e },
|
|
2192
2175
|
colorScheme: { yAxis: s },
|
|
2193
2176
|
config: { yAxis: n },
|
|
2194
2177
|
scales: r
|
|
2195
|
-
} = t, a = r.y.ticks(6),
|
|
2178
|
+
} = t, a = r.y.ticks(6), l = r.y.tickFormat(6);
|
|
2196
2179
|
i.save(), i.fillStyle = s.bg, i.fillRect(e.x, e.y, e.width, e.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", a.forEach((c) => {
|
|
2197
|
-
const
|
|
2198
|
-
i.fillText(f, e.x + e.width / 2,
|
|
2180
|
+
const d = r.y.convert(c), f = l(c);
|
|
2181
|
+
i.fillText(f, e.x + e.width / 2, d);
|
|
2199
2182
|
});
|
|
2200
2183
|
}
|
|
2201
|
-
const
|
|
2184
|
+
const Hn = (i, t) => {
|
|
2202
2185
|
const {
|
|
2203
2186
|
layout: { axisIntersection: e },
|
|
2204
2187
|
colorScheme: s
|
|
@@ -2210,18 +2193,18 @@ const Nn = (i, t) => {
|
|
|
2210
2193
|
e.height
|
|
2211
2194
|
), i.restore();
|
|
2212
2195
|
};
|
|
2213
|
-
class
|
|
2196
|
+
class qt {
|
|
2214
2197
|
static xAxis(t, e) {
|
|
2215
|
-
|
|
2198
|
+
Bn(t, e);
|
|
2216
2199
|
}
|
|
2217
2200
|
static yAxis(t, e) {
|
|
2218
|
-
|
|
2201
|
+
In(t, e);
|
|
2219
2202
|
}
|
|
2220
2203
|
static intersection(t, e) {
|
|
2221
|
-
|
|
2204
|
+
Hn(t, e);
|
|
2222
2205
|
}
|
|
2223
2206
|
}
|
|
2224
|
-
class
|
|
2207
|
+
class Rn {
|
|
2225
2208
|
constructor(t) {
|
|
2226
2209
|
u(this, "_target");
|
|
2227
2210
|
this._target = t;
|
|
@@ -2251,16 +2234,16 @@ class Fn {
|
|
|
2251
2234
|
function Lt(i) {
|
|
2252
2235
|
return i * 0.1875;
|
|
2253
2236
|
}
|
|
2254
|
-
const
|
|
2237
|
+
const $n = (i, { mainColor: t, textColor: e, symbol: s, x: n, y: r, size: a, fontSize: l }) => {
|
|
2255
2238
|
const g = a / 16, _ = 16 * g, p = n - _ / 2, v = r;
|
|
2256
|
-
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 = t, 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 = t, i.fill(), i.restore(), i.save(), i.font = `bold ${
|
|
2257
|
-
const b = r + g * 3 + 0.5,
|
|
2239
|
+
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 = t, 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 = t, i.fill(), i.restore(), i.save(), i.font = `bold ${l}px sans-serif`, i.textAlign = "center", i.textBaseline = "top", i.textAlign = "center", i.textBaseline = "middle";
|
|
2240
|
+
const b = r + g * 3 + 0.5, x = g * 16, w = b + x / 2;
|
|
2258
2241
|
i.fillStyle = e, i.fillText(s, n, w), i.restore();
|
|
2259
|
-
},
|
|
2242
|
+
}, Pn = (i, { mainColor: t, textColor: e, symbol: s, x: n, y: r, size: a, fontSize: l }) => {
|
|
2260
2243
|
const g = a / 16, _ = 16 * g, p = n - _ / 2, v = r;
|
|
2261
|
-
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 = t, 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 = t, i.fill(), i.restore(), i.save(), i.font = `bold ${
|
|
2262
|
-
const b = g * 16,
|
|
2263
|
-
i.fillStyle = e, i.fillText(s, n,
|
|
2244
|
+
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 = t, 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 = t, i.fill(), i.restore(), i.save(), i.font = `bold ${l}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle";
|
|
2245
|
+
const b = g * 16, x = r - g * 19 + b / 2;
|
|
2246
|
+
i.fillStyle = e, i.fillText(s, n, x), i.restore();
|
|
2264
2247
|
};
|
|
2265
2248
|
function Et(i) {
|
|
2266
2249
|
"@babel/helpers - typeof";
|
|
@@ -2270,16 +2253,16 @@ function Et(i) {
|
|
|
2270
2253
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2271
2254
|
}, Et(i);
|
|
2272
2255
|
}
|
|
2273
|
-
var
|
|
2274
|
-
function
|
|
2275
|
-
if (i = i || "", t = t || {}, i instanceof
|
|
2256
|
+
var zn = /^\s+/, On = /\s+$/;
|
|
2257
|
+
function M(i, t) {
|
|
2258
|
+
if (i = i || "", t = t || {}, i instanceof M)
|
|
2276
2259
|
return i;
|
|
2277
|
-
if (!(this instanceof
|
|
2278
|
-
return new
|
|
2279
|
-
var e =
|
|
2260
|
+
if (!(this instanceof M))
|
|
2261
|
+
return new M(i, t);
|
|
2262
|
+
var e = Yn(i);
|
|
2280
2263
|
this._originalInput = i, this._r = e.r, this._g = e.g, this._b = e.b, this._a = e.a, this._roundA = Math.round(100 * this._a) / 100, this._format = t.format || e.format, this._gradientType = t.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 = e.ok;
|
|
2281
2264
|
}
|
|
2282
|
-
|
|
2265
|
+
M.prototype = {
|
|
2283
2266
|
isDark: function() {
|
|
2284
2267
|
return this.getBrightness() < 128;
|
|
2285
2268
|
},
|
|
@@ -2303,14 +2286,14 @@ A.prototype = {
|
|
|
2303
2286
|
return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
|
|
2304
2287
|
},
|
|
2305
2288
|
getLuminance: function() {
|
|
2306
|
-
var t = this.toRgb(), e, s, n, r, a,
|
|
2307
|
-
return e = t.r / 255, s = t.g / 255, n = t.b / 255, e <= 0.03928 ? r = e / 12.92 : r = Math.pow((e + 0.055) / 1.055, 2.4), s <= 0.03928 ? a = s / 12.92 : a = Math.pow((s + 0.055) / 1.055, 2.4), n <= 0.03928 ?
|
|
2289
|
+
var t = this.toRgb(), e, s, n, r, a, l;
|
|
2290
|
+
return e = t.r / 255, s = t.g / 255, n = t.b / 255, e <= 0.03928 ? r = e / 12.92 : r = Math.pow((e + 0.055) / 1.055, 2.4), s <= 0.03928 ? a = s / 12.92 : a = Math.pow((s + 0.055) / 1.055, 2.4), n <= 0.03928 ? l = n / 12.92 : l = Math.pow((n + 0.055) / 1.055, 2.4), 0.2126 * r + 0.7152 * a + 0.0722 * l;
|
|
2308
2291
|
},
|
|
2309
2292
|
setAlpha: function(t) {
|
|
2310
|
-
return this._a =
|
|
2293
|
+
return this._a = ei(t), this._roundA = Math.round(100 * this._a) / 100, this;
|
|
2311
2294
|
},
|
|
2312
2295
|
toHsv: function() {
|
|
2313
|
-
var t =
|
|
2296
|
+
var t = Ve(this._r, this._g, this._b);
|
|
2314
2297
|
return {
|
|
2315
2298
|
h: t.h * 360,
|
|
2316
2299
|
s: t.s,
|
|
@@ -2319,11 +2302,11 @@ A.prototype = {
|
|
|
2319
2302
|
};
|
|
2320
2303
|
},
|
|
2321
2304
|
toHsvString: function() {
|
|
2322
|
-
var t =
|
|
2305
|
+
var t = Ve(this._r, this._g, this._b), e = Math.round(t.h * 360), s = Math.round(t.s * 100), n = Math.round(t.v * 100);
|
|
2323
2306
|
return this._a == 1 ? "hsv(" + e + ", " + s + "%, " + n + "%)" : "hsva(" + e + ", " + s + "%, " + n + "%, " + this._roundA + ")";
|
|
2324
2307
|
},
|
|
2325
2308
|
toHsl: function() {
|
|
2326
|
-
var t =
|
|
2309
|
+
var t = je(this._r, this._g, this._b);
|
|
2327
2310
|
return {
|
|
2328
2311
|
h: t.h * 360,
|
|
2329
2312
|
s: t.s,
|
|
@@ -2332,17 +2315,17 @@ A.prototype = {
|
|
|
2332
2315
|
};
|
|
2333
2316
|
},
|
|
2334
2317
|
toHslString: function() {
|
|
2335
|
-
var t =
|
|
2318
|
+
var t = je(this._r, this._g, this._b), e = Math.round(t.h * 360), s = Math.round(t.s * 100), n = Math.round(t.l * 100);
|
|
2336
2319
|
return this._a == 1 ? "hsl(" + e + ", " + s + "%, " + n + "%)" : "hsla(" + e + ", " + s + "%, " + n + "%, " + this._roundA + ")";
|
|
2337
2320
|
},
|
|
2338
2321
|
toHex: function(t) {
|
|
2339
|
-
return
|
|
2322
|
+
return We(this._r, this._g, this._b, t);
|
|
2340
2323
|
},
|
|
2341
2324
|
toHexString: function(t) {
|
|
2342
2325
|
return "#" + this.toHex(t);
|
|
2343
2326
|
},
|
|
2344
2327
|
toHex8: function(t) {
|
|
2345
|
-
return
|
|
2328
|
+
return Xn(this._r, this._g, this._b, this._a, t);
|
|
2346
2329
|
},
|
|
2347
2330
|
toHex8String: function(t) {
|
|
2348
2331
|
return "#" + this.toHex8(t);
|
|
@@ -2360,23 +2343,23 @@ A.prototype = {
|
|
|
2360
2343
|
},
|
|
2361
2344
|
toPercentageRgb: function() {
|
|
2362
2345
|
return {
|
|
2363
|
-
r: Math.round(
|
|
2364
|
-
g: Math.round(
|
|
2365
|
-
b: Math.round(
|
|
2346
|
+
r: Math.round(I(this._r, 255) * 100) + "%",
|
|
2347
|
+
g: Math.round(I(this._g, 255) * 100) + "%",
|
|
2348
|
+
b: Math.round(I(this._b, 255) * 100) + "%",
|
|
2366
2349
|
a: this._a
|
|
2367
2350
|
};
|
|
2368
2351
|
},
|
|
2369
2352
|
toPercentageRgbString: function() {
|
|
2370
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
2353
|
+
return this._a == 1 ? "rgb(" + Math.round(I(this._r, 255) * 100) + "%, " + Math.round(I(this._g, 255) * 100) + "%, " + Math.round(I(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(I(this._r, 255) * 100) + "%, " + Math.round(I(this._g, 255) * 100) + "%, " + Math.round(I(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2371
2354
|
},
|
|
2372
2355
|
toName: function() {
|
|
2373
|
-
return this._a === 0 ? "transparent" : this._a < 1 ? !1 :
|
|
2356
|
+
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : nr[We(this._r, this._g, this._b, !0)] || !1;
|
|
2374
2357
|
},
|
|
2375
2358
|
toFilter: function(t) {
|
|
2376
|
-
var e = "#" +
|
|
2359
|
+
var e = "#" + Xe(this._r, this._g, this._b, this._a), s = e, n = this._gradientType ? "GradientType = 1, " : "";
|
|
2377
2360
|
if (t) {
|
|
2378
|
-
var r =
|
|
2379
|
-
s = "#" +
|
|
2361
|
+
var r = M(t);
|
|
2362
|
+
s = "#" + Xe(r._r, r._g, r._b, r._a);
|
|
2380
2363
|
}
|
|
2381
2364
|
return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + e + ",endColorstr=" + s + ")";
|
|
2382
2365
|
},
|
|
@@ -2387,98 +2370,98 @@ A.prototype = {
|
|
|
2387
2370
|
return r ? t === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (s = this.toRgbString()), t === "prgb" && (s = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (s = this.toHexString()), t === "hex3" && (s = this.toHexString(!0)), t === "hex4" && (s = this.toHex8String(!0)), t === "hex8" && (s = this.toHex8String()), t === "name" && (s = this.toName()), t === "hsl" && (s = this.toHslString()), t === "hsv" && (s = this.toHsvString()), s || this.toHexString());
|
|
2388
2371
|
},
|
|
2389
2372
|
clone: function() {
|
|
2390
|
-
return
|
|
2373
|
+
return M(this.toString());
|
|
2391
2374
|
},
|
|
2392
2375
|
_applyModification: function(t, e) {
|
|
2393
2376
|
var s = t.apply(null, [this].concat([].slice.call(e)));
|
|
2394
2377
|
return this._r = s._r, this._g = s._g, this._b = s._b, this.setAlpha(s._a), this;
|
|
2395
2378
|
},
|
|
2396
2379
|
lighten: function() {
|
|
2397
|
-
return this._applyModification(
|
|
2380
|
+
return this._applyModification(qn, arguments);
|
|
2398
2381
|
},
|
|
2399
2382
|
brighten: function() {
|
|
2400
|
-
return this._applyModification(
|
|
2383
|
+
return this._applyModification(Jn, arguments);
|
|
2401
2384
|
},
|
|
2402
2385
|
darken: function() {
|
|
2403
|
-
return this._applyModification(
|
|
2386
|
+
return this._applyModification(Qn, arguments);
|
|
2404
2387
|
},
|
|
2405
2388
|
desaturate: function() {
|
|
2406
|
-
return this._applyModification(
|
|
2389
|
+
return this._applyModification(Un, arguments);
|
|
2407
2390
|
},
|
|
2408
2391
|
saturate: function() {
|
|
2409
|
-
return this._applyModification(
|
|
2392
|
+
return this._applyModification(Gn, arguments);
|
|
2410
2393
|
},
|
|
2411
2394
|
greyscale: function() {
|
|
2412
|
-
return this._applyModification(
|
|
2395
|
+
return this._applyModification(Zn, arguments);
|
|
2413
2396
|
},
|
|
2414
2397
|
spin: function() {
|
|
2415
|
-
return this._applyModification(
|
|
2398
|
+
return this._applyModification(Kn, arguments);
|
|
2416
2399
|
},
|
|
2417
2400
|
_applyCombination: function(t, e) {
|
|
2418
2401
|
return t.apply(null, [this].concat([].slice.call(e)));
|
|
2419
2402
|
},
|
|
2420
2403
|
analogous: function() {
|
|
2421
|
-
return this._applyCombination(
|
|
2404
|
+
return this._applyCombination(ir, arguments);
|
|
2422
2405
|
},
|
|
2423
2406
|
complement: function() {
|
|
2424
|
-
return this._applyCombination(
|
|
2407
|
+
return this._applyCombination(tr, arguments);
|
|
2425
2408
|
},
|
|
2426
2409
|
monochromatic: function() {
|
|
2427
|
-
return this._applyCombination(
|
|
2410
|
+
return this._applyCombination(sr, arguments);
|
|
2428
2411
|
},
|
|
2429
2412
|
splitcomplement: function() {
|
|
2430
|
-
return this._applyCombination(
|
|
2413
|
+
return this._applyCombination(er, arguments);
|
|
2431
2414
|
},
|
|
2432
2415
|
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
2433
2416
|
// polyad: function (number) {
|
|
2434
2417
|
// return this._applyCombination(polyad, [number]);
|
|
2435
2418
|
// },
|
|
2436
2419
|
triad: function() {
|
|
2437
|
-
return this._applyCombination(
|
|
2420
|
+
return this._applyCombination(Ue, [3]);
|
|
2438
2421
|
},
|
|
2439
2422
|
tetrad: function() {
|
|
2440
|
-
return this._applyCombination(
|
|
2423
|
+
return this._applyCombination(Ue, [4]);
|
|
2441
2424
|
}
|
|
2442
2425
|
};
|
|
2443
|
-
|
|
2426
|
+
M.fromRatio = function(i, t) {
|
|
2444
2427
|
if (Et(i) == "object") {
|
|
2445
2428
|
var e = {};
|
|
2446
2429
|
for (var s in i)
|
|
2447
|
-
i.hasOwnProperty(s) && (s === "a" ? e[s] = i[s] : e[s] =
|
|
2430
|
+
i.hasOwnProperty(s) && (s === "a" ? e[s] = i[s] : e[s] = ft(i[s]));
|
|
2448
2431
|
i = e;
|
|
2449
2432
|
}
|
|
2450
|
-
return
|
|
2433
|
+
return M(i, t);
|
|
2451
2434
|
};
|
|
2452
|
-
function
|
|
2435
|
+
function Yn(i) {
|
|
2453
2436
|
var t = {
|
|
2454
2437
|
r: 0,
|
|
2455
2438
|
g: 0,
|
|
2456
2439
|
b: 0
|
|
2457
|
-
}, e = 1, s = null, n = null, r = null, a = !1,
|
|
2458
|
-
return typeof i == "string" && (i =
|
|
2440
|
+
}, e = 1, s = null, n = null, r = null, a = !1, l = !1;
|
|
2441
|
+
return typeof i == "string" && (i = lr(i)), Et(i) == "object" && (U(i.r) && U(i.g) && U(i.b) ? (t = jn(i.r, i.g, i.b), a = !0, l = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : U(i.h) && U(i.s) && U(i.v) ? (s = ft(i.s), n = ft(i.v), t = Wn(i.h, s, n), a = !0, l = "hsv") : U(i.h) && U(i.s) && U(i.l) && (s = ft(i.s), r = ft(i.l), t = Vn(i.h, s, r), a = !0, l = "hsl"), i.hasOwnProperty("a") && (e = i.a)), e = ei(e), {
|
|
2459
2442
|
ok: a,
|
|
2460
|
-
format: i.format ||
|
|
2443
|
+
format: i.format || l,
|
|
2461
2444
|
r: Math.min(255, Math.max(t.r, 0)),
|
|
2462
2445
|
g: Math.min(255, Math.max(t.g, 0)),
|
|
2463
2446
|
b: Math.min(255, Math.max(t.b, 0)),
|
|
2464
2447
|
a: e
|
|
2465
2448
|
};
|
|
2466
2449
|
}
|
|
2467
|
-
function
|
|
2450
|
+
function jn(i, t, e) {
|
|
2468
2451
|
return {
|
|
2469
|
-
r:
|
|
2470
|
-
g:
|
|
2471
|
-
b:
|
|
2452
|
+
r: I(i, 255) * 255,
|
|
2453
|
+
g: I(t, 255) * 255,
|
|
2454
|
+
b: I(e, 255) * 255
|
|
2472
2455
|
};
|
|
2473
2456
|
}
|
|
2474
|
-
function
|
|
2475
|
-
i =
|
|
2476
|
-
var s = Math.max(i, t, e), n = Math.min(i, t, e), r, a,
|
|
2457
|
+
function je(i, t, e) {
|
|
2458
|
+
i = I(i, 255), t = I(t, 255), e = I(e, 255);
|
|
2459
|
+
var s = Math.max(i, t, e), n = Math.min(i, t, e), r, a, l = (s + n) / 2;
|
|
2477
2460
|
if (s == n)
|
|
2478
2461
|
r = a = 0;
|
|
2479
2462
|
else {
|
|
2480
2463
|
var c = s - n;
|
|
2481
|
-
switch (a =
|
|
2464
|
+
switch (a = l > 0.5 ? c / (2 - s - n) : c / (s + n), s) {
|
|
2482
2465
|
case i:
|
|
2483
2466
|
r = (t - e) / c + (t < e ? 6 : 0);
|
|
2484
2467
|
break;
|
|
@@ -2494,20 +2477,20 @@ function Oe(i, t, e) {
|
|
|
2494
2477
|
return {
|
|
2495
2478
|
h: r,
|
|
2496
2479
|
s: a,
|
|
2497
|
-
l
|
|
2480
|
+
l
|
|
2498
2481
|
};
|
|
2499
2482
|
}
|
|
2500
|
-
function
|
|
2483
|
+
function Vn(i, t, e) {
|
|
2501
2484
|
var s, n, r;
|
|
2502
|
-
i =
|
|
2503
|
-
function a(
|
|
2504
|
-
return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ?
|
|
2485
|
+
i = I(i, 360), t = I(t, 100), e = I(e, 100);
|
|
2486
|
+
function a(d, f, g) {
|
|
2487
|
+
return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? d + (f - d) * 6 * g : g < 1 / 2 ? f : g < 2 / 3 ? d + (f - d) * (2 / 3 - g) * 6 : d;
|
|
2505
2488
|
}
|
|
2506
2489
|
if (t === 0)
|
|
2507
2490
|
s = n = r = e;
|
|
2508
2491
|
else {
|
|
2509
|
-
var
|
|
2510
|
-
s = a(c,
|
|
2492
|
+
var l = e < 0.5 ? e * (1 + t) : e + t - e * t, c = 2 * e - l;
|
|
2493
|
+
s = a(c, l, i + 1 / 3), n = a(c, l, i), r = a(c, l, i - 1 / 3);
|
|
2511
2494
|
}
|
|
2512
2495
|
return {
|
|
2513
2496
|
r: s * 255,
|
|
@@ -2515,9 +2498,9 @@ function Pn(i, t, e) {
|
|
|
2515
2498
|
b: r * 255
|
|
2516
2499
|
};
|
|
2517
2500
|
}
|
|
2518
|
-
function
|
|
2519
|
-
i =
|
|
2520
|
-
var s = Math.max(i, t, e), n = Math.min(i, t, e), r, a,
|
|
2501
|
+
function Ve(i, t, e) {
|
|
2502
|
+
i = I(i, 255), t = I(t, 255), e = I(e, 255);
|
|
2503
|
+
var s = Math.max(i, t, e), n = Math.min(i, t, e), r, a, l = s, c = s - n;
|
|
2521
2504
|
if (a = s === 0 ? 0 : c / s, s == n)
|
|
2522
2505
|
r = 0;
|
|
2523
2506
|
else {
|
|
@@ -2537,133 +2520,133 @@ function Ye(i, t, e) {
|
|
|
2537
2520
|
return {
|
|
2538
2521
|
h: r,
|
|
2539
2522
|
s: a,
|
|
2540
|
-
v:
|
|
2523
|
+
v: l
|
|
2541
2524
|
};
|
|
2542
2525
|
}
|
|
2543
|
-
function
|
|
2544
|
-
i =
|
|
2545
|
-
var s = Math.floor(i), n = i - s, r = e * (1 - t), a = e * (1 - n * t),
|
|
2526
|
+
function Wn(i, t, e) {
|
|
2527
|
+
i = I(i, 360) * 6, t = I(t, 100), e = I(e, 100);
|
|
2528
|
+
var s = Math.floor(i), n = i - s, r = e * (1 - t), a = e * (1 - n * t), l = e * (1 - (1 - n) * t), c = s % 6, d = [e, a, r, r, l, e][c], f = [l, e, e, a, r, r][c], g = [r, r, l, e, e, a][c];
|
|
2546
2529
|
return {
|
|
2547
|
-
r:
|
|
2530
|
+
r: d * 255,
|
|
2548
2531
|
g: f * 255,
|
|
2549
2532
|
b: g * 255
|
|
2550
2533
|
};
|
|
2551
2534
|
}
|
|
2552
|
-
function
|
|
2553
|
-
var n = [
|
|
2535
|
+
function We(i, t, e, s) {
|
|
2536
|
+
var n = [W(Math.round(i).toString(16)), W(Math.round(t).toString(16)), W(Math.round(e).toString(16))];
|
|
2554
2537
|
return s && n[0].charAt(0) == n[0].charAt(1) && n[1].charAt(0) == n[1].charAt(1) && n[2].charAt(0) == n[2].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) : n.join("");
|
|
2555
2538
|
}
|
|
2556
|
-
function
|
|
2557
|
-
var r = [
|
|
2539
|
+
function Xn(i, t, e, s, n) {
|
|
2540
|
+
var r = [W(Math.round(i).toString(16)), W(Math.round(t).toString(16)), W(Math.round(e).toString(16)), W(ii(s))];
|
|
2558
2541
|
return n && r[0].charAt(0) == r[0].charAt(1) && r[1].charAt(0) == r[1].charAt(1) && r[2].charAt(0) == r[2].charAt(1) && r[3].charAt(0) == r[3].charAt(1) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) + r[3].charAt(0) : r.join("");
|
|
2559
2542
|
}
|
|
2560
|
-
function
|
|
2561
|
-
var n = [
|
|
2543
|
+
function Xe(i, t, e, s) {
|
|
2544
|
+
var n = [W(ii(s)), W(Math.round(i).toString(16)), W(Math.round(t).toString(16)), W(Math.round(e).toString(16))];
|
|
2562
2545
|
return n.join("");
|
|
2563
2546
|
}
|
|
2564
|
-
|
|
2565
|
-
return !i || !t ? !1 :
|
|
2547
|
+
M.equals = function(i, t) {
|
|
2548
|
+
return !i || !t ? !1 : M(i).toRgbString() == M(t).toRgbString();
|
|
2566
2549
|
};
|
|
2567
|
-
|
|
2568
|
-
return
|
|
2550
|
+
M.random = function() {
|
|
2551
|
+
return M.fromRatio({
|
|
2569
2552
|
r: Math.random(),
|
|
2570
2553
|
g: Math.random(),
|
|
2571
2554
|
b: Math.random()
|
|
2572
2555
|
});
|
|
2573
2556
|
};
|
|
2574
|
-
function
|
|
2557
|
+
function Un(i, t) {
|
|
2575
2558
|
t = t === 0 ? 0 : t || 10;
|
|
2576
|
-
var e =
|
|
2577
|
-
return e.s -= t / 100, e.s =
|
|
2559
|
+
var e = M(i).toHsl();
|
|
2560
|
+
return e.s -= t / 100, e.s = Ft(e.s), M(e);
|
|
2578
2561
|
}
|
|
2579
|
-
function
|
|
2562
|
+
function Gn(i, t) {
|
|
2580
2563
|
t = t === 0 ? 0 : t || 10;
|
|
2581
|
-
var e =
|
|
2582
|
-
return e.s += t / 100, e.s =
|
|
2564
|
+
var e = M(i).toHsl();
|
|
2565
|
+
return e.s += t / 100, e.s = Ft(e.s), M(e);
|
|
2583
2566
|
}
|
|
2584
|
-
function
|
|
2585
|
-
return
|
|
2567
|
+
function Zn(i) {
|
|
2568
|
+
return M(i).desaturate(100);
|
|
2586
2569
|
}
|
|
2587
|
-
function
|
|
2570
|
+
function qn(i, t) {
|
|
2588
2571
|
t = t === 0 ? 0 : t || 10;
|
|
2589
|
-
var e =
|
|
2590
|
-
return e.l += t / 100, e.l =
|
|
2572
|
+
var e = M(i).toHsl();
|
|
2573
|
+
return e.l += t / 100, e.l = Ft(e.l), M(e);
|
|
2591
2574
|
}
|
|
2592
|
-
function
|
|
2575
|
+
function Jn(i, t) {
|
|
2593
2576
|
t = t === 0 ? 0 : t || 10;
|
|
2594
|
-
var e =
|
|
2595
|
-
return e.r = Math.max(0, Math.min(255, e.r - Math.round(255 * -(t / 100)))), e.g = Math.max(0, Math.min(255, e.g - Math.round(255 * -(t / 100)))), e.b = Math.max(0, Math.min(255, e.b - Math.round(255 * -(t / 100)))),
|
|
2577
|
+
var e = M(i).toRgb();
|
|
2578
|
+
return e.r = Math.max(0, Math.min(255, e.r - Math.round(255 * -(t / 100)))), e.g = Math.max(0, Math.min(255, e.g - Math.round(255 * -(t / 100)))), e.b = Math.max(0, Math.min(255, e.b - Math.round(255 * -(t / 100)))), M(e);
|
|
2596
2579
|
}
|
|
2597
|
-
function
|
|
2580
|
+
function Qn(i, t) {
|
|
2598
2581
|
t = t === 0 ? 0 : t || 10;
|
|
2599
|
-
var e =
|
|
2600
|
-
return e.l -= t / 100, e.l =
|
|
2582
|
+
var e = M(i).toHsl();
|
|
2583
|
+
return e.l -= t / 100, e.l = Ft(e.l), M(e);
|
|
2601
2584
|
}
|
|
2602
|
-
function
|
|
2603
|
-
var e =
|
|
2604
|
-
return e.h = s < 0 ? 360 + s : s,
|
|
2585
|
+
function Kn(i, t) {
|
|
2586
|
+
var e = M(i).toHsl(), s = (e.h + t) % 360;
|
|
2587
|
+
return e.h = s < 0 ? 360 + s : s, M(e);
|
|
2605
2588
|
}
|
|
2606
|
-
function
|
|
2607
|
-
var t =
|
|
2608
|
-
return t.h = (t.h + 180) % 360,
|
|
2589
|
+
function tr(i) {
|
|
2590
|
+
var t = M(i).toHsl();
|
|
2591
|
+
return t.h = (t.h + 180) % 360, M(t);
|
|
2609
2592
|
}
|
|
2610
|
-
function
|
|
2593
|
+
function Ue(i, t) {
|
|
2611
2594
|
if (isNaN(t) || t <= 0)
|
|
2612
2595
|
throw new Error("Argument to polyad must be a positive number");
|
|
2613
|
-
for (var e =
|
|
2614
|
-
s.push(
|
|
2596
|
+
for (var e = M(i).toHsl(), s = [M(i)], n = 360 / t, r = 1; r < t; r++)
|
|
2597
|
+
s.push(M({
|
|
2615
2598
|
h: (e.h + r * n) % 360,
|
|
2616
2599
|
s: e.s,
|
|
2617
2600
|
l: e.l
|
|
2618
2601
|
}));
|
|
2619
2602
|
return s;
|
|
2620
2603
|
}
|
|
2621
|
-
function
|
|
2622
|
-
var t =
|
|
2623
|
-
return [
|
|
2604
|
+
function er(i) {
|
|
2605
|
+
var t = M(i).toHsl(), e = t.h;
|
|
2606
|
+
return [M(i), M({
|
|
2624
2607
|
h: (e + 72) % 360,
|
|
2625
2608
|
s: t.s,
|
|
2626
2609
|
l: t.l
|
|
2627
|
-
}),
|
|
2610
|
+
}), M({
|
|
2628
2611
|
h: (e + 216) % 360,
|
|
2629
2612
|
s: t.s,
|
|
2630
2613
|
l: t.l
|
|
2631
2614
|
})];
|
|
2632
2615
|
}
|
|
2633
|
-
function
|
|
2616
|
+
function ir(i, t, e) {
|
|
2634
2617
|
t = t || 6, e = e || 30;
|
|
2635
|
-
var s =
|
|
2618
|
+
var s = M(i).toHsl(), n = 360 / e, r = [M(i)];
|
|
2636
2619
|
for (s.h = (s.h - (n * t >> 1) + 720) % 360; --t; )
|
|
2637
|
-
s.h = (s.h + n) % 360, r.push(
|
|
2620
|
+
s.h = (s.h + n) % 360, r.push(M(s));
|
|
2638
2621
|
return r;
|
|
2639
2622
|
}
|
|
2640
|
-
function
|
|
2623
|
+
function sr(i, t) {
|
|
2641
2624
|
t = t || 6;
|
|
2642
|
-
for (var e =
|
|
2643
|
-
a.push(
|
|
2625
|
+
for (var e = M(i).toHsv(), s = e.h, n = e.s, r = e.v, a = [], l = 1 / t; t--; )
|
|
2626
|
+
a.push(M({
|
|
2644
2627
|
h: s,
|
|
2645
2628
|
s: n,
|
|
2646
2629
|
v: r
|
|
2647
|
-
})), r = (r +
|
|
2630
|
+
})), r = (r + l) % 1;
|
|
2648
2631
|
return a;
|
|
2649
2632
|
}
|
|
2650
|
-
|
|
2633
|
+
M.mix = function(i, t, e) {
|
|
2651
2634
|
e = e === 0 ? 0 : e || 50;
|
|
2652
|
-
var s =
|
|
2635
|
+
var s = M(i).toRgb(), n = M(t).toRgb(), r = e / 100, a = {
|
|
2653
2636
|
r: (n.r - s.r) * r + s.r,
|
|
2654
2637
|
g: (n.g - s.g) * r + s.g,
|
|
2655
2638
|
b: (n.b - s.b) * r + s.b,
|
|
2656
2639
|
a: (n.a - s.a) * r + s.a
|
|
2657
2640
|
};
|
|
2658
|
-
return
|
|
2641
|
+
return M(a);
|
|
2659
2642
|
};
|
|
2660
|
-
|
|
2661
|
-
var e =
|
|
2643
|
+
M.readability = function(i, t) {
|
|
2644
|
+
var e = M(i), s = M(t);
|
|
2662
2645
|
return (Math.max(e.getLuminance(), s.getLuminance()) + 0.05) / (Math.min(e.getLuminance(), s.getLuminance()) + 0.05);
|
|
2663
2646
|
};
|
|
2664
|
-
|
|
2665
|
-
var s =
|
|
2666
|
-
switch (r = !1, n =
|
|
2647
|
+
M.isReadable = function(i, t, e) {
|
|
2648
|
+
var s = M.readability(i, t), n, r;
|
|
2649
|
+
switch (r = !1, n = cr(e), n.level + n.size) {
|
|
2667
2650
|
case "AAsmall":
|
|
2668
2651
|
case "AAAlarge":
|
|
2669
2652
|
r = s >= 4.5;
|
|
@@ -2677,17 +2660,17 @@ A.isReadable = function(i, t, e) {
|
|
|
2677
2660
|
}
|
|
2678
2661
|
return r;
|
|
2679
2662
|
};
|
|
2680
|
-
|
|
2681
|
-
var s = null, n = 0, r, a,
|
|
2682
|
-
e = e || {}, a = e.includeFallbackColors,
|
|
2683
|
-
for (var
|
|
2684
|
-
r =
|
|
2685
|
-
return
|
|
2686
|
-
level:
|
|
2663
|
+
M.mostReadable = function(i, t, e) {
|
|
2664
|
+
var s = null, n = 0, r, a, l, c;
|
|
2665
|
+
e = e || {}, a = e.includeFallbackColors, l = e.level, c = e.size;
|
|
2666
|
+
for (var d = 0; d < t.length; d++)
|
|
2667
|
+
r = M.readability(i, t[d]), r > n && (n = r, s = M(t[d]));
|
|
2668
|
+
return M.isReadable(i, s, {
|
|
2669
|
+
level: l,
|
|
2687
2670
|
size: c
|
|
2688
|
-
}) || !a ? s : (e.includeFallbackColors = !1,
|
|
2671
|
+
}) || !a ? s : (e.includeFallbackColors = !1, M.mostReadable(i, ["#fff", "#000"], e));
|
|
2689
2672
|
};
|
|
2690
|
-
var
|
|
2673
|
+
var ee = M.names = {
|
|
2691
2674
|
aliceblue: "f0f8ff",
|
|
2692
2675
|
antiquewhite: "faebd7",
|
|
2693
2676
|
aqua: "0ff",
|
|
@@ -2837,46 +2820,46 @@ var ie = A.names = {
|
|
|
2837
2820
|
whitesmoke: "f5f5f5",
|
|
2838
2821
|
yellow: "ff0",
|
|
2839
2822
|
yellowgreen: "9acd32"
|
|
2840
|
-
},
|
|
2841
|
-
function
|
|
2823
|
+
}, nr = M.hexNames = rr(ee);
|
|
2824
|
+
function rr(i) {
|
|
2842
2825
|
var t = {};
|
|
2843
2826
|
for (var e in i)
|
|
2844
2827
|
i.hasOwnProperty(e) && (t[i[e]] = e);
|
|
2845
2828
|
return t;
|
|
2846
2829
|
}
|
|
2847
|
-
function
|
|
2830
|
+
function ei(i) {
|
|
2848
2831
|
return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
|
|
2849
2832
|
}
|
|
2850
|
-
function
|
|
2851
|
-
|
|
2852
|
-
var e =
|
|
2833
|
+
function I(i, t) {
|
|
2834
|
+
ar(i) && (i = "100%");
|
|
2835
|
+
var e = or(i);
|
|
2853
2836
|
return i = Math.min(t, Math.max(0, parseFloat(i))), e && (i = parseInt(i * t, 10) / 100), Math.abs(i - t) < 1e-6 ? 1 : i % t / parseFloat(t);
|
|
2854
2837
|
}
|
|
2855
|
-
function
|
|
2838
|
+
function Ft(i) {
|
|
2856
2839
|
return Math.min(1, Math.max(0, i));
|
|
2857
2840
|
}
|
|
2858
|
-
function
|
|
2841
|
+
function z(i) {
|
|
2859
2842
|
return parseInt(i, 16);
|
|
2860
2843
|
}
|
|
2861
|
-
function
|
|
2844
|
+
function ar(i) {
|
|
2862
2845
|
return typeof i == "string" && i.indexOf(".") != -1 && parseFloat(i) === 1;
|
|
2863
2846
|
}
|
|
2864
|
-
function
|
|
2847
|
+
function or(i) {
|
|
2865
2848
|
return typeof i == "string" && i.indexOf("%") != -1;
|
|
2866
2849
|
}
|
|
2867
|
-
function
|
|
2850
|
+
function W(i) {
|
|
2868
2851
|
return i.length == 1 ? "0" + i : "" + i;
|
|
2869
2852
|
}
|
|
2870
|
-
function
|
|
2853
|
+
function ft(i) {
|
|
2871
2854
|
return i <= 1 && (i = i * 100 + "%"), i;
|
|
2872
2855
|
}
|
|
2873
|
-
function
|
|
2856
|
+
function ii(i) {
|
|
2874
2857
|
return Math.round(parseFloat(i) * 255).toString(16);
|
|
2875
2858
|
}
|
|
2876
|
-
function
|
|
2877
|
-
return
|
|
2859
|
+
function Ge(i) {
|
|
2860
|
+
return z(i) / 255;
|
|
2878
2861
|
}
|
|
2879
|
-
var
|
|
2862
|
+
var V = function() {
|
|
2880
2863
|
var i = "[-\\+]?\\d+%?", t = "[-\\+]?\\d*\\.\\d+%?", e = "(?:" + t + ")|(?:" + i + ")", s = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?", n = "[\\s|\\(]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")[,|\\s]+(" + e + ")\\s*\\)?";
|
|
2881
2864
|
return {
|
|
2882
2865
|
CSS_UNIT: new RegExp(e),
|
|
@@ -2893,13 +2876,13 @@ var j = function() {
|
|
|
2893
2876
|
};
|
|
2894
2877
|
}();
|
|
2895
2878
|
function U(i) {
|
|
2896
|
-
return !!
|
|
2879
|
+
return !!V.CSS_UNIT.exec(i);
|
|
2897
2880
|
}
|
|
2898
|
-
function
|
|
2899
|
-
i = i.replace(
|
|
2881
|
+
function lr(i) {
|
|
2882
|
+
i = i.replace(zn, "").replace(On, "").toLowerCase();
|
|
2900
2883
|
var t = !1;
|
|
2901
|
-
if (
|
|
2902
|
-
i =
|
|
2884
|
+
if (ee[i])
|
|
2885
|
+
i = ee[i], t = !0;
|
|
2903
2886
|
else if (i == "transparent")
|
|
2904
2887
|
return {
|
|
2905
2888
|
r: 0,
|
|
@@ -2909,58 +2892,58 @@ function nr(i) {
|
|
|
2909
2892
|
format: "name"
|
|
2910
2893
|
};
|
|
2911
2894
|
var e;
|
|
2912
|
-
return (e =
|
|
2895
|
+
return (e = V.rgb.exec(i)) ? {
|
|
2913
2896
|
r: e[1],
|
|
2914
2897
|
g: e[2],
|
|
2915
2898
|
b: e[3]
|
|
2916
|
-
} : (e =
|
|
2899
|
+
} : (e = V.rgba.exec(i)) ? {
|
|
2917
2900
|
r: e[1],
|
|
2918
2901
|
g: e[2],
|
|
2919
2902
|
b: e[3],
|
|
2920
2903
|
a: e[4]
|
|
2921
|
-
} : (e =
|
|
2904
|
+
} : (e = V.hsl.exec(i)) ? {
|
|
2922
2905
|
h: e[1],
|
|
2923
2906
|
s: e[2],
|
|
2924
2907
|
l: e[3]
|
|
2925
|
-
} : (e =
|
|
2908
|
+
} : (e = V.hsla.exec(i)) ? {
|
|
2926
2909
|
h: e[1],
|
|
2927
2910
|
s: e[2],
|
|
2928
2911
|
l: e[3],
|
|
2929
2912
|
a: e[4]
|
|
2930
|
-
} : (e =
|
|
2913
|
+
} : (e = V.hsv.exec(i)) ? {
|
|
2931
2914
|
h: e[1],
|
|
2932
2915
|
s: e[2],
|
|
2933
2916
|
v: e[3]
|
|
2934
|
-
} : (e =
|
|
2917
|
+
} : (e = V.hsva.exec(i)) ? {
|
|
2935
2918
|
h: e[1],
|
|
2936
2919
|
s: e[2],
|
|
2937
2920
|
v: e[3],
|
|
2938
2921
|
a: e[4]
|
|
2939
|
-
} : (e =
|
|
2940
|
-
r:
|
|
2941
|
-
g:
|
|
2942
|
-
b:
|
|
2943
|
-
a:
|
|
2922
|
+
} : (e = V.hex8.exec(i)) ? {
|
|
2923
|
+
r: z(e[1]),
|
|
2924
|
+
g: z(e[2]),
|
|
2925
|
+
b: z(e[3]),
|
|
2926
|
+
a: Ge(e[4]),
|
|
2944
2927
|
format: t ? "name" : "hex8"
|
|
2945
|
-
} : (e =
|
|
2946
|
-
r:
|
|
2947
|
-
g:
|
|
2948
|
-
b:
|
|
2928
|
+
} : (e = V.hex6.exec(i)) ? {
|
|
2929
|
+
r: z(e[1]),
|
|
2930
|
+
g: z(e[2]),
|
|
2931
|
+
b: z(e[3]),
|
|
2949
2932
|
format: t ? "name" : "hex"
|
|
2950
|
-
} : (e =
|
|
2951
|
-
r:
|
|
2952
|
-
g:
|
|
2953
|
-
b:
|
|
2954
|
-
a:
|
|
2933
|
+
} : (e = V.hex4.exec(i)) ? {
|
|
2934
|
+
r: z(e[1] + "" + e[1]),
|
|
2935
|
+
g: z(e[2] + "" + e[2]),
|
|
2936
|
+
b: z(e[3] + "" + e[3]),
|
|
2937
|
+
a: Ge(e[4] + "" + e[4]),
|
|
2955
2938
|
format: t ? "name" : "hex8"
|
|
2956
|
-
} : (e =
|
|
2957
|
-
r:
|
|
2958
|
-
g:
|
|
2959
|
-
b:
|
|
2939
|
+
} : (e = V.hex3.exec(i)) ? {
|
|
2940
|
+
r: z(e[1] + "" + e[1]),
|
|
2941
|
+
g: z(e[2] + "" + e[2]),
|
|
2942
|
+
b: z(e[3] + "" + e[3]),
|
|
2960
2943
|
format: t ? "name" : "hex"
|
|
2961
2944
|
} : !1;
|
|
2962
2945
|
}
|
|
2963
|
-
function
|
|
2946
|
+
function cr(i) {
|
|
2964
2947
|
var t, e;
|
|
2965
2948
|
return i = i || {
|
|
2966
2949
|
level: "AA",
|
|
@@ -2970,7 +2953,7 @@ function rr(i) {
|
|
|
2970
2953
|
size: e
|
|
2971
2954
|
};
|
|
2972
2955
|
}
|
|
2973
|
-
function
|
|
2956
|
+
function hr(i, t) {
|
|
2974
2957
|
const {
|
|
2975
2958
|
trade: { tradedCandles: e },
|
|
2976
2959
|
scales: { x: s, y: n },
|
|
@@ -2980,35 +2963,35 @@ function ar(i, t) {
|
|
|
2980
2963
|
}
|
|
2981
2964
|
} = t;
|
|
2982
2965
|
if (!a) return;
|
|
2983
|
-
const { trade:
|
|
2984
|
-
e.forEach(({ isHovered:
|
|
2966
|
+
const { trade: l } = r, c = 4;
|
|
2967
|
+
e.forEach(({ isHovered: d, isActive: f, candle: g, trades: _ }) => {
|
|
2985
2968
|
const p = s.convert(g.open_time);
|
|
2986
2969
|
_.forEach((v) => {
|
|
2987
|
-
const b = v.type === "buy",
|
|
2988
|
-
let T = b ?
|
|
2989
|
-
|
|
2970
|
+
const b = v.type === "buy", x = b ? l.buyLabel.text : l.sellLabel.text, w = b ? "B" : "S", y = b ? n.convert(g.low) + c : n.convert(g.high) - c, C = b ? $n : Pn;
|
|
2971
|
+
let T = b ? l.buyLabel.main : l.sellLabel.main;
|
|
2972
|
+
d && d[1] && d[0] === v.type && (T = M.mix(T, r.bg, 20).toString()), f && f[1] && f[0] === v.type && (T = l.activeLabel), C(i, {
|
|
2990
2973
|
x: p,
|
|
2991
|
-
y
|
|
2974
|
+
y,
|
|
2992
2975
|
symbol: w,
|
|
2993
2976
|
mainColor: T,
|
|
2994
|
-
textColor:
|
|
2977
|
+
textColor: x,
|
|
2995
2978
|
size: 16,
|
|
2996
2979
|
fontSize: 12
|
|
2997
2980
|
});
|
|
2998
2981
|
});
|
|
2999
2982
|
});
|
|
3000
2983
|
}
|
|
3001
|
-
function
|
|
2984
|
+
function dr(i, t) {
|
|
3002
2985
|
const {
|
|
3003
2986
|
scales: { x: e, factorX: s },
|
|
3004
2987
|
layout: { area: n },
|
|
3005
|
-
trade: { tradedCandles: r, exits: a, entries:
|
|
2988
|
+
trade: { tradedCandles: r, exits: a, entries: l },
|
|
3006
2989
|
config: { candles: c },
|
|
3007
|
-
colorScheme: { trade:
|
|
2990
|
+
colorScheme: { trade: d }
|
|
3008
2991
|
} = t;
|
|
3009
2992
|
if (r.length === 0) return;
|
|
3010
2993
|
const f = r.map((_) => _.candle).sort((_, p) => _.open_time.getTime() - p.open_time.getTime()), g = c.baseWidth / 2 * s + c.strokeWidth / 2;
|
|
3011
|
-
if (i.save(), i.lineWidth = 1, i.strokeStyle =
|
|
2994
|
+
if (i.save(), i.lineWidth = 1, i.strokeStyle = d.tradeBorders, l.length) {
|
|
3012
2995
|
const _ = e.convert(f[0].open_time) - g;
|
|
3013
2996
|
i.beginPath(), i.moveTo(_, n.y), i.lineTo(_, n.y + n.height), i.stroke();
|
|
3014
2997
|
}
|
|
@@ -3018,27 +3001,27 @@ function or(i, t) {
|
|
|
3018
3001
|
}
|
|
3019
3002
|
i.restore();
|
|
3020
3003
|
}
|
|
3021
|
-
const
|
|
3004
|
+
const ur = (i, t) => {
|
|
3022
3005
|
const {
|
|
3023
3006
|
scales: { x: e, y: s },
|
|
3024
3007
|
trade: { tradedCandles: n, entries: r, exits: a },
|
|
3025
|
-
colorScheme: { trade:
|
|
3008
|
+
colorScheme: { trade: l },
|
|
3026
3009
|
config: {
|
|
3027
3010
|
trade: { showConnectionLine: c }
|
|
3028
3011
|
}
|
|
3029
3012
|
} = t;
|
|
3030
3013
|
if (i.save(), !c) return;
|
|
3031
|
-
const
|
|
3014
|
+
const d = (g) => {
|
|
3032
3015
|
var _;
|
|
3033
3016
|
return (_ = n.find(
|
|
3034
3017
|
(p) => g.getTime() >= p.candle.open_time.getTime() && g.getTime() < p.candle.close_time.getTime()
|
|
3035
3018
|
)) == null ? void 0 : _.candle;
|
|
3036
3019
|
}, f = (g, _) => {
|
|
3037
|
-
const p =
|
|
3020
|
+
const p = d(g.time), v = d(_.time);
|
|
3038
3021
|
if (!p || !v) return;
|
|
3039
|
-
const b = e.convert(p.open_time),
|
|
3040
|
-
let w,
|
|
3041
|
-
g.type === "buy" ? (w = s.convert(p.low),
|
|
3022
|
+
const b = e.convert(p.open_time), x = e.convert(v.open_time);
|
|
3023
|
+
let w, y;
|
|
3024
|
+
g.type === "buy" ? (w = s.convert(p.low), y = s.convert(v.high)) : (w = s.convert(p.high), y = s.convert(v.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = l.connectionLine, i.moveTo(b, w), i.lineTo(x, y), i.stroke(), i.setLineDash([]);
|
|
3042
3025
|
};
|
|
3043
3026
|
if (r.length === 1 && a.length > 1)
|
|
3044
3027
|
a.forEach((g) => f(r[0], g));
|
|
@@ -3051,16 +3034,16 @@ const lr = (i, t) => {
|
|
|
3051
3034
|
f(g, _);
|
|
3052
3035
|
}
|
|
3053
3036
|
i.restore();
|
|
3054
|
-
},
|
|
3037
|
+
}, si = (i, t) => {
|
|
3055
3038
|
const {
|
|
3056
3039
|
radius: e,
|
|
3057
3040
|
coords: { x: s, y: n },
|
|
3058
3041
|
fillColor: r,
|
|
3059
3042
|
width: a,
|
|
3060
|
-
height:
|
|
3043
|
+
height: l
|
|
3061
3044
|
} = t;
|
|
3062
|
-
i.beginPath(), i.fillStyle = r, i.lineWidth = 1, i.moveTo(s + e, n), i.lineTo(s + a - e, n), i.quadraticCurveTo(s + a, n, s + a, n + e), i.lineTo(s + a, n +
|
|
3063
|
-
},
|
|
3045
|
+
i.beginPath(), i.fillStyle = r, i.lineWidth = 1, i.moveTo(s + e, n), i.lineTo(s + a - e, n), i.quadraticCurveTo(s + a, n, s + a, n + e), i.lineTo(s + a, n + l - e), i.quadraticCurveTo(s + a, n + l, s + a - e, n + l), i.lineTo(s + e, n + l), i.quadraticCurveTo(s, n + l, s, n + l - e), i.lineTo(s, n + e), i.quadraticCurveTo(s, n, s + e, n), i.closePath(), i.fill();
|
|
3046
|
+
}, fr = (i) => {
|
|
3064
3047
|
const t = Math.floor((Date.now() - +i) / 1e3), e = [
|
|
3065
3048
|
[60, 1, "s"],
|
|
3066
3049
|
[3600, 60, "m"],
|
|
@@ -3072,7 +3055,7 @@ const lr = (i, t) => {
|
|
|
3072
3055
|
], [, s, n] = e.find(([a]) => t < a);
|
|
3073
3056
|
return `${Math.floor(t / s)}${n} ago`;
|
|
3074
3057
|
};
|
|
3075
|
-
function
|
|
3058
|
+
function gr(i) {
|
|
3076
3059
|
const t = Math.floor(i / 1e3), e = [
|
|
3077
3060
|
{ label: "d", value: 86400 },
|
|
3078
3061
|
{ label: "h", value: 3600 },
|
|
@@ -3082,55 +3065,55 @@ function hr(i) {
|
|
|
3082
3065
|
let n = t;
|
|
3083
3066
|
for (const { label: r, value: a } of e)
|
|
3084
3067
|
if (n >= a) {
|
|
3085
|
-
const
|
|
3086
|
-
if (s.push(`${
|
|
3068
|
+
const l = Math.floor(n / a);
|
|
3069
|
+
if (s.push(`${l}${r}`), n %= a, s.length === 2) break;
|
|
3087
3070
|
}
|
|
3088
3071
|
return s.length ? s.join(" ") : "0s";
|
|
3089
3072
|
}
|
|
3090
|
-
const
|
|
3091
|
-
var
|
|
3073
|
+
const mr = 10, _r = 6, pr = 4, vr = 12, br = (i, t) => {
|
|
3074
|
+
var it;
|
|
3092
3075
|
const {
|
|
3093
3076
|
scales: { x: e, y: s },
|
|
3094
3077
|
trade: { entries: n, exits: r, holdTime: a },
|
|
3095
3078
|
colorScheme: {
|
|
3096
|
-
trade: { hold:
|
|
3079
|
+
trade: { hold: l }
|
|
3097
3080
|
},
|
|
3098
3081
|
config: {
|
|
3099
|
-
trade: { showHoldTime: c, holdTimeContent:
|
|
3082
|
+
trade: { showHoldTime: c, holdTimeContent: d, holdTimeDates: f, holdTimePrice: g }
|
|
3100
3083
|
}
|
|
3101
3084
|
} = t;
|
|
3102
3085
|
if (!c) return;
|
|
3103
3086
|
const _ = n.at(0), p = r.at(-1);
|
|
3104
3087
|
if (!_ || !p) return;
|
|
3105
|
-
const v = (
|
|
3106
|
-
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle =
|
|
3107
|
-
const
|
|
3088
|
+
const v = (Z) => Z ? Z instanceof Date ? Z : new Date(Z) : null, b = e.convert(v(f == null ? void 0 : f[0]) || _.candle.open_time), x = e.convert(v(f == null ? void 0 : f[1]) || p.candle.open_time), w = s.convert(g || (((it = n.at(0)) == null ? void 0 : it.price) ?? 0));
|
|
3089
|
+
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = l.main, i.moveTo(b, w), i.lineTo(x, w), i.stroke(), i.setLineDash([]);
|
|
3090
|
+
const y = (b + x) / 2, C = d || `Hold: ${gr(a)}`, H = getComputedStyle(
|
|
3108
3091
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3109
3092
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3110
|
-
i.font = `600 ${
|
|
3111
|
-
const
|
|
3112
|
-
|
|
3093
|
+
i.font = `600 ${mr}px ${H}`;
|
|
3094
|
+
const $ = i.measureText(C).width + _r * 2, Y = vr + pr * 2;
|
|
3095
|
+
si(i, {
|
|
3113
3096
|
radius: 4,
|
|
3114
3097
|
coords: {
|
|
3115
|
-
x:
|
|
3098
|
+
x: y - $ / 2,
|
|
3116
3099
|
y: w - Y / 2
|
|
3117
3100
|
},
|
|
3118
|
-
width:
|
|
3101
|
+
width: $,
|
|
3119
3102
|
height: Y,
|
|
3120
|
-
fillColor:
|
|
3121
|
-
}), i.fillStyle =
|
|
3103
|
+
fillColor: l.main
|
|
3104
|
+
}), i.fillStyle = l.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C, y, w), i.restore();
|
|
3122
3105
|
};
|
|
3123
3106
|
class pt {
|
|
3124
3107
|
constructor(t, e, {
|
|
3125
|
-
CanvasClass: s =
|
|
3108
|
+
CanvasClass: s = _t,
|
|
3126
3109
|
noCanvas: n = !1,
|
|
3127
3110
|
noDOM: r = !1
|
|
3128
3111
|
} = {}) {
|
|
3129
3112
|
u(this, "canvas", null);
|
|
3130
3113
|
u(this, "dom", null);
|
|
3131
3114
|
u(this, "prefix");
|
|
3132
|
-
const { width: a, height:
|
|
3133
|
-
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${t}`, width: a, height:
|
|
3115
|
+
const { width: a, height: l, canvasesContainer: c, domElements: d } = e;
|
|
3116
|
+
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${t}`, width: a, height: l }), c.append(this.canvas.node)), r || (this.dom = new k({ className: `sc-charts-cs__dom-${t}` }), d.append(this.dom.node)), this.prefix = `sc-charts-cs__${t}`;
|
|
3134
3117
|
}
|
|
3135
3118
|
cx(...t) {
|
|
3136
3119
|
return t.map((e) => `${this.prefix}-${e}`).join(" ");
|
|
@@ -3139,48 +3122,48 @@ class pt {
|
|
|
3139
3122
|
return (e) => t.map((s) => `${this.prefix}-${s}-${e}`).join(" ");
|
|
3140
3123
|
}
|
|
3141
3124
|
}
|
|
3142
|
-
const
|
|
3125
|
+
const yr = {
|
|
3143
3126
|
"right-bottom": { dx: 1, dy: 1 },
|
|
3144
3127
|
"left-top": { dx: -1, dy: -1 },
|
|
3145
3128
|
"right-top": { dx: 1, dy: -1 },
|
|
3146
3129
|
"left-bottom": { dx: -1, dy: 1 }
|
|
3147
|
-
},
|
|
3130
|
+
}, re = ({
|
|
3148
3131
|
size: i,
|
|
3149
3132
|
parent: t,
|
|
3150
3133
|
coords: e,
|
|
3151
3134
|
prioritySide: s = "right-bottom",
|
|
3152
3135
|
offset: n = 8
|
|
3153
3136
|
}) => {
|
|
3154
|
-
const { width: r, height: a } = i,
|
|
3155
|
-
const { dx: C, dy: T } =
|
|
3156
|
-
return { x: H, y:
|
|
3157
|
-
}, f = ({ x, y: C }) =>
|
|
3158
|
-
const
|
|
3159
|
-
return T &&
|
|
3137
|
+
const { width: r, height: a } = i, l = t.right - t.left, c = t.bottom - t.top, d = (y) => {
|
|
3138
|
+
const { dx: C, dy: T } = yr[y], H = e.x + (C === 1 ? n : -r - n), R = e.y + (T === 1 ? n : -a - n);
|
|
3139
|
+
return { x: H, y: R, side: y };
|
|
3140
|
+
}, f = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + r <= l && C + a <= c, g = () => {
|
|
3141
|
+
const y = e.y < 0, C = e.y + a > c, T = e.x < 0, H = e.x + r > l;
|
|
3142
|
+
return T && y ? "right-bottom" : T && C ? "right-top" : H && y ? "left-bottom" : H && C ? "left-top" : T ? "right-bottom" : H ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
|
|
3160
3143
|
}, p = [
|
|
3161
3144
|
s,
|
|
3162
3145
|
"right-bottom",
|
|
3163
3146
|
"right-top",
|
|
3164
3147
|
"left-bottom",
|
|
3165
3148
|
"left-top"
|
|
3166
|
-
].filter((
|
|
3149
|
+
].filter((y, C, T) => T.indexOf(y) === C), v = g();
|
|
3167
3150
|
let b = null;
|
|
3168
|
-
for (const
|
|
3169
|
-
const C =
|
|
3151
|
+
for (const y of [v, ...p]) {
|
|
3152
|
+
const C = d(y);
|
|
3170
3153
|
if (f(C)) {
|
|
3171
3154
|
b = C;
|
|
3172
3155
|
break;
|
|
3173
3156
|
}
|
|
3174
3157
|
}
|
|
3175
|
-
b || (b =
|
|
3176
|
-
const
|
|
3158
|
+
b || (b = d(v));
|
|
3159
|
+
const x = Math.min(Math.max(b.x, n), l - r - n), w = Math.min(Math.max(b.y, n), c - a - n);
|
|
3177
3160
|
return {
|
|
3178
|
-
x
|
|
3161
|
+
x,
|
|
3179
3162
|
y: w,
|
|
3180
3163
|
side: b.side
|
|
3181
3164
|
};
|
|
3182
3165
|
};
|
|
3183
|
-
class
|
|
3166
|
+
class G extends k {
|
|
3184
3167
|
constructor(e) {
|
|
3185
3168
|
super(e);
|
|
3186
3169
|
u(this, "_state", {});
|
|
@@ -3215,7 +3198,7 @@ class Z extends k {
|
|
|
3215
3198
|
this._scheduleUpdate();
|
|
3216
3199
|
}
|
|
3217
3200
|
}
|
|
3218
|
-
class
|
|
3201
|
+
class xr extends G {
|
|
3219
3202
|
constructor(e) {
|
|
3220
3203
|
const s = "label-tooltip";
|
|
3221
3204
|
super({ className: e.cx(s) });
|
|
@@ -3242,10 +3225,10 @@ class pr extends Z {
|
|
|
3242
3225
|
tag: "div",
|
|
3243
3226
|
className: this.clsx("line")
|
|
3244
3227
|
});
|
|
3245
|
-
let
|
|
3246
|
-
r === "kind" && (
|
|
3247
|
-
const c = new k({ tag: "strong", textContent: s[r] }),
|
|
3248
|
-
a.append(c.node,
|
|
3228
|
+
let l = e[r].toString();
|
|
3229
|
+
r === "kind" && (l = this._formatDate(e.time));
|
|
3230
|
+
const c = new k({ tag: "strong", textContent: s[r] }), d = new k({ tag: "span", textContent: l });
|
|
3231
|
+
a.append(c.node, d.node), n.push(a.node);
|
|
3249
3232
|
}
|
|
3250
3233
|
return n;
|
|
3251
3234
|
}
|
|
@@ -3287,7 +3270,7 @@ class pr extends Z {
|
|
|
3287
3270
|
render() {
|
|
3288
3271
|
const { isShow: e, x: s, y: n, parent: r } = this.state;
|
|
3289
3272
|
this.setVisible(e), e && this.updateAbsolutePosition();
|
|
3290
|
-
const a =
|
|
3273
|
+
const a = re({
|
|
3291
3274
|
size: this.absolutePosition,
|
|
3292
3275
|
parent: r,
|
|
3293
3276
|
coords: { x: s, y: n }
|
|
@@ -3295,151 +3278,135 @@ class pr extends Z {
|
|
|
3295
3278
|
this.position(a.x, a.y);
|
|
3296
3279
|
}
|
|
3297
3280
|
}
|
|
3298
|
-
class
|
|
3281
|
+
class wr extends pt {
|
|
3299
3282
|
constructor(e) {
|
|
3300
3283
|
super("trade", e);
|
|
3301
3284
|
u(this, "labelTooltip");
|
|
3302
3285
|
if (!this.dom) throw new Error("[CS_V_Trade] this.dom must be defined");
|
|
3303
3286
|
if (!this.canvas) throw new Error("[CS_V_Trade] this.canvas must be defined");
|
|
3304
|
-
this.labelTooltip = new
|
|
3287
|
+
this.labelTooltip = new xr(this), this.dom.append(this.labelTooltip.node);
|
|
3305
3288
|
}
|
|
3306
3289
|
renderAll(e) {
|
|
3307
|
-
this.canvas.clear(),
|
|
3290
|
+
this.canvas.clear(), dr(this.canvas.ctx, e), hr(this.canvas.ctx, e), ur(this.canvas.ctx, e), br(this.canvas.ctx, e);
|
|
3308
3291
|
}
|
|
3309
3292
|
}
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
t.save(), t.strokeStyle = e || "#777777", t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(n, r), t.lineTo(n + (s === "h" ? a : 0), r + (s === "v" ? a : 0)), t.stroke(), t.restore();
|
|
3313
|
-
}
|
|
3314
|
-
static _basicLabel(t, {
|
|
3315
|
-
text: e,
|
|
3316
|
-
mainColor: s,
|
|
3317
|
-
textColor: n,
|
|
3318
|
-
position: r
|
|
3319
|
-
}) {
|
|
3320
|
-
t.textContent = e, t.style.backgroundColor = s ?? "#777777", t.style.color = n ?? "#ffffff", t.style[r] = "0px";
|
|
3321
|
-
}
|
|
3322
|
-
static label_h(t, { text: e, y: s, mainColor: n, textColor: r, position: a }) {
|
|
3323
|
-
G._basicLabel(t, { text: e, mainColor: n, textColor: r, position: a }), t.style.top = s + "px", t.style.transform = "translateY(-50%)";
|
|
3324
|
-
}
|
|
3325
|
-
static label_v(t, { text: e, x: s, mainColor: n, textColor: r, position: a }) {
|
|
3326
|
-
G._basicLabel(t, { text: e, mainColor: n, textColor: r, position: a }), t.style.left = s + "px", t.style.transform = "translateX(-50%)";
|
|
3327
|
-
}
|
|
3328
|
-
static horizontalMarker({
|
|
3329
|
-
node: t,
|
|
3330
|
-
ctx: e,
|
|
3331
|
-
x: s,
|
|
3332
|
-
y: n,
|
|
3333
|
-
lineLength: r,
|
|
3334
|
-
text: a,
|
|
3335
|
-
textColor: o,
|
|
3336
|
-
mainColor: c,
|
|
3337
|
-
lineColor: h,
|
|
3338
|
-
position: f
|
|
3339
|
-
}) {
|
|
3340
|
-
G.line(e, {
|
|
3341
|
-
type: "h",
|
|
3342
|
-
x: s,
|
|
3343
|
-
y: n,
|
|
3344
|
-
lineLength: r,
|
|
3345
|
-
lineColor: h
|
|
3346
|
-
}), G.label_h(t, {
|
|
3347
|
-
text: a,
|
|
3348
|
-
y: n,
|
|
3349
|
-
textColor: o,
|
|
3350
|
-
mainColor: c,
|
|
3351
|
-
position: f
|
|
3352
|
-
});
|
|
3353
|
-
}
|
|
3354
|
-
static verticalMarker({
|
|
3355
|
-
node: t,
|
|
3356
|
-
ctx: e,
|
|
3357
|
-
x: s,
|
|
3358
|
-
y: n,
|
|
3359
|
-
lineLength: r,
|
|
3360
|
-
text: a,
|
|
3361
|
-
textColor: o,
|
|
3362
|
-
mainColor: c,
|
|
3363
|
-
lineColor: h,
|
|
3364
|
-
position: f
|
|
3365
|
-
}) {
|
|
3366
|
-
G.line(e, {
|
|
3367
|
-
type: "v",
|
|
3368
|
-
x: s,
|
|
3369
|
-
y: n,
|
|
3370
|
-
lineLength: r,
|
|
3371
|
-
lineColor: h
|
|
3372
|
-
}), G.label_v(t, {
|
|
3373
|
-
text: a,
|
|
3374
|
-
x: s,
|
|
3375
|
-
textColor: o,
|
|
3376
|
-
mainColor: c,
|
|
3377
|
-
position: f
|
|
3378
|
-
});
|
|
3379
|
-
}
|
|
3293
|
+
function Cr(i, { color: t = "#000000", lineWidth: e = 1, dashed: s, coords: n }) {
|
|
3294
|
+
i.strokeStyle = t, i.lineWidth = e, s && i.setLineDash(s), i.beginPath(), i.moveTo(n.x1, n.y1), i.lineTo(n.x2, n.y2), i.stroke();
|
|
3380
3295
|
}
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3296
|
+
const Ar = { text: "#FFFFFF", bg: "#000000" }, Mr = (i, t) => {
|
|
3297
|
+
const {
|
|
3298
|
+
coords: e,
|
|
3299
|
+
text: s,
|
|
3300
|
+
fontSize: n = 14,
|
|
3301
|
+
fontWeight: r = 600,
|
|
3302
|
+
textHeight: a,
|
|
3303
|
+
padding: l = { x: 0, y: 0 },
|
|
3304
|
+
borderRadius: c = 0,
|
|
3305
|
+
colors: d,
|
|
3306
|
+
align: f = { x: "left", y: "top" }
|
|
3307
|
+
} = t, g = { ...Ar, ...d }, p = getComputedStyle(
|
|
3308
|
+
document.querySelector(".sc-charts-cs") || document.body
|
|
3309
|
+
).font.replace(/^\s*\S+/, "").trim();
|
|
3310
|
+
i.font = `${r} ${n}px ${p}`;
|
|
3311
|
+
const b = i.measureText(s).width + l.x * 2, x = a + l.y * 2;
|
|
3312
|
+
let w = e.x, y = e.y;
|
|
3313
|
+
f.x === "middle" ? w -= b / 2 : f.x === "right" && (w -= b), f.y === "middle" ? y -= x / 2 : f.y === "bottom" && (y -= x), si(i, {
|
|
3314
|
+
radius: c,
|
|
3315
|
+
coords: { x: w, y },
|
|
3316
|
+
width: b,
|
|
3317
|
+
height: x,
|
|
3318
|
+
fillColor: g.bg
|
|
3319
|
+
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, w + b / 2, y + x / 2);
|
|
3320
|
+
}, Ze = {
|
|
3321
|
+
line: "#000000",
|
|
3322
|
+
text: "#ffffff",
|
|
3323
|
+
main: "#000000"
|
|
3324
|
+
}, ni = (i, { text: t, startLineCoords: e, side: s, colors: n = Ze, dir: r = "h", endMarkerCoords: a }) => {
|
|
3325
|
+
if (r === "h" && (s === "bottom" || s === "top"))
|
|
3326
|
+
throw new Error("[drawMarker util]: Incorrect side or dir for this marker");
|
|
3327
|
+
const l = { ...Ze, ...n };
|
|
3328
|
+
i.save(), Cr(i, {
|
|
3329
|
+
color: l.line,
|
|
3330
|
+
lineWidth: 1,
|
|
3331
|
+
dashed: [4, 4],
|
|
3332
|
+
coords: {
|
|
3333
|
+
x1: e.x,
|
|
3334
|
+
y1: e.y,
|
|
3335
|
+
x2: a.x,
|
|
3336
|
+
y2: a.y
|
|
3337
|
+
}
|
|
3338
|
+
}), Mr(i, {
|
|
3339
|
+
text: t,
|
|
3340
|
+
coords: a,
|
|
3341
|
+
padding: { x: 6, y: 4 },
|
|
3342
|
+
borderRadius: 4,
|
|
3343
|
+
fontSize: 10,
|
|
3344
|
+
textHeight: 12,
|
|
3345
|
+
align: {
|
|
3346
|
+
x: r === "v" ? "middle" : s,
|
|
3347
|
+
y: r === "h" ? "middle" : s
|
|
3348
|
+
},
|
|
3349
|
+
colors: {
|
|
3350
|
+
text: l.text,
|
|
3351
|
+
bg: l.main
|
|
3394
3352
|
}
|
|
3353
|
+
}), i.restore();
|
|
3354
|
+
};
|
|
3355
|
+
class Tr extends _t {
|
|
3356
|
+
constructor(t) {
|
|
3357
|
+
super(t);
|
|
3395
3358
|
}
|
|
3396
|
-
|
|
3397
|
-
this.
|
|
3359
|
+
drawMarker(t) {
|
|
3360
|
+
ni(this.ctx, t);
|
|
3398
3361
|
}
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3362
|
+
}
|
|
3363
|
+
class Sr extends pt {
|
|
3364
|
+
constructor(t) {
|
|
3365
|
+
if (super("user-markers", t, { CanvasClass: Tr, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
|
|
3402
3366
|
}
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3367
|
+
render(t) {
|
|
3368
|
+
this.canvas.clear();
|
|
3369
|
+
for (const e of t.userMarkers.data)
|
|
3370
|
+
this.canvas.drawMarker({
|
|
3371
|
+
text: e.text,
|
|
3372
|
+
side: t.config.yAxis.position,
|
|
3373
|
+
dir: "h",
|
|
3374
|
+
startLineCoords: {
|
|
3375
|
+
x: e.startDate ? t.scales.x.convert(e.startDate) : 0,
|
|
3376
|
+
y: t.scales.y.convert(e.value)
|
|
3377
|
+
},
|
|
3378
|
+
endMarkerCoords: {
|
|
3379
|
+
x: t.layout.yAxis.right,
|
|
3380
|
+
y: t.scales.y.convert(e.value)
|
|
3381
|
+
},
|
|
3382
|
+
colors: {
|
|
3383
|
+
line: e.lineColor,
|
|
3384
|
+
main: e.mainColor,
|
|
3385
|
+
text: e.textColor
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3406
3388
|
}
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
tag: "div",
|
|
3410
|
-
className: this.cx("item")
|
|
3411
|
-
});
|
|
3412
|
-
return this.dom.append(s.node), this.items[e] = s, s;
|
|
3413
|
-
}
|
|
3414
|
-
renderMarker(e, s) {
|
|
3415
|
-
e.type === "horizontal" ? G.horizontalMarker({
|
|
3416
|
-
ctx: this.canvas.ctx,
|
|
3417
|
-
node: s,
|
|
3418
|
-
...e
|
|
3419
|
-
}) : G.verticalMarker({
|
|
3420
|
-
ctx: this.canvas.ctx,
|
|
3421
|
-
node: s,
|
|
3422
|
-
...e
|
|
3423
|
-
});
|
|
3389
|
+
clear() {
|
|
3390
|
+
this.canvas.clear();
|
|
3424
3391
|
}
|
|
3425
3392
|
}
|
|
3426
|
-
const
|
|
3427
|
-
class
|
|
3393
|
+
const kr = "sc-charts-cs";
|
|
3394
|
+
class J {
|
|
3428
3395
|
constructor(t) {
|
|
3429
3396
|
u(this, "block");
|
|
3430
3397
|
this.block = t;
|
|
3431
3398
|
}
|
|
3432
3399
|
gen(t) {
|
|
3433
|
-
return `${
|
|
3400
|
+
return `${kr}__${this.block}${t ? "-" + t : ""}`;
|
|
3434
3401
|
}
|
|
3435
3402
|
}
|
|
3436
|
-
const
|
|
3437
|
-
class
|
|
3403
|
+
const Jt = new J("comment-actions");
|
|
3404
|
+
class Dr extends k {
|
|
3438
3405
|
constructor({ onDelete: t, onUpdate: e }) {
|
|
3439
|
-
super({ className:
|
|
3440
|
-
const s = new k({ tag: "button", className:
|
|
3406
|
+
super({ className: Jt.gen() });
|
|
3407
|
+
const s = new k({ tag: "button", className: Jt.gen("edit"), textContent: "Edit" }), n = new k({
|
|
3441
3408
|
tag: "button",
|
|
3442
|
-
className:
|
|
3409
|
+
className: Jt.gen("delete"),
|
|
3443
3410
|
textContent: "Delete"
|
|
3444
3411
|
});
|
|
3445
3412
|
n.node.addEventListener("click", (r) => {
|
|
@@ -3449,14 +3416,14 @@ class xr extends k {
|
|
|
3449
3416
|
}), this.append(s.node, n.node);
|
|
3450
3417
|
}
|
|
3451
3418
|
}
|
|
3452
|
-
function
|
|
3419
|
+
function ae(i, t) {
|
|
3453
3420
|
var n;
|
|
3454
3421
|
const e = (r) => {
|
|
3455
3422
|
if (!document.contains(i.node)) return;
|
|
3456
3423
|
const a = r.target;
|
|
3457
3424
|
if (i.node.contains(a)) return;
|
|
3458
|
-
const
|
|
3459
|
-
if (
|
|
3425
|
+
const l = document.elementFromPoint(r.clientX, r.clientY);
|
|
3426
|
+
if (l && i.node.contains(l)) return;
|
|
3460
3427
|
const c = i.node.getBoundingClientRect();
|
|
3461
3428
|
r.clientX >= c.left && r.clientX <= c.right && r.clientY >= c.top && r.clientY <= c.bottom && getComputedStyle(i.node).pointerEvents !== "none" || t(r);
|
|
3462
3429
|
};
|
|
@@ -3466,7 +3433,7 @@ function re(i, t) {
|
|
|
3466
3433
|
document.removeEventListener("mousedown", e), s == null || s();
|
|
3467
3434
|
}, i;
|
|
3468
3435
|
}
|
|
3469
|
-
class
|
|
3436
|
+
class Lr {
|
|
3470
3437
|
constructor() {
|
|
3471
3438
|
u(this, "node");
|
|
3472
3439
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
@@ -3504,34 +3471,34 @@ class wr {
|
|
|
3504
3471
|
this.node = e;
|
|
3505
3472
|
}
|
|
3506
3473
|
}
|
|
3507
|
-
const
|
|
3508
|
-
class
|
|
3474
|
+
const dt = new J("comment-list");
|
|
3475
|
+
class Er extends k {
|
|
3509
3476
|
constructor({ onDelete: e, onOpenEditor: s, comment: n, layout: r }) {
|
|
3510
|
-
super({ className:
|
|
3477
|
+
super({ className: dt.gen("item") });
|
|
3511
3478
|
u(this, "actionTooltip");
|
|
3512
3479
|
u(this, "actionsTrigger");
|
|
3513
|
-
const a = new k({ className:
|
|
3514
|
-
className:
|
|
3515
|
-
textContent:
|
|
3480
|
+
const a = new k({ className: dt.gen("text"), textContent: n.text }), l = new k({
|
|
3481
|
+
className: dt.gen("created-at"),
|
|
3482
|
+
textContent: fr(new Date(n.createdAt))
|
|
3516
3483
|
});
|
|
3517
3484
|
this.actionsTrigger = new k({
|
|
3518
3485
|
tag: "button",
|
|
3519
|
-
className:
|
|
3486
|
+
className: dt.gen("action-trigger")
|
|
3520
3487
|
});
|
|
3521
|
-
const c = new
|
|
3488
|
+
const c = new Dr({
|
|
3522
3489
|
onDelete: e,
|
|
3523
3490
|
onUpdate: s
|
|
3524
3491
|
});
|
|
3525
|
-
this.actionTooltip =
|
|
3492
|
+
this.actionTooltip = ae(c, () => {
|
|
3526
3493
|
this.actionTooltip.setVisible(!1);
|
|
3527
3494
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3528
3495
|
this.actionsTrigger.updateAbsolutePosition(), this.actionTooltip.updateAbsolutePosition(), this.actionTooltip.node.style.top = this.actionsTrigger.absolutePosition.top - r.chart.top + 20 + "px", this.actionTooltip.node.style.left = this.actionsTrigger.absolutePosition.left - r.chart.left - this.actionTooltip.absolutePosition.width + 10 + "px", this.actionTooltip.setVisible(!0);
|
|
3529
3496
|
});
|
|
3530
|
-
const
|
|
3531
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`),
|
|
3497
|
+
const d = new k({ className: dt.gen("text-wrap") });
|
|
3498
|
+
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), d.append(a.node, this.actionsTrigger.node), this.actionsTrigger.append(new Lr().node), this.append(d.node, l.node);
|
|
3532
3499
|
}
|
|
3533
3500
|
}
|
|
3534
|
-
class
|
|
3501
|
+
class Nr {
|
|
3535
3502
|
constructor() {
|
|
3536
3503
|
u(this, "node");
|
|
3537
3504
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
@@ -3543,7 +3510,7 @@ class Mr {
|
|
|
3543
3510
|
), s.setAttribute("fill", "currentColor"), e.appendChild(s), this.node = e;
|
|
3544
3511
|
}
|
|
3545
3512
|
}
|
|
3546
|
-
class
|
|
3513
|
+
class Fr {
|
|
3547
3514
|
constructor() {
|
|
3548
3515
|
u(this, "node");
|
|
3549
3516
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
@@ -3555,7 +3522,7 @@ class Ar {
|
|
|
3555
3522
|
), s.setAttribute("fill", "currentColor"), e.appendChild(s), this.node = e;
|
|
3556
3523
|
}
|
|
3557
3524
|
}
|
|
3558
|
-
class
|
|
3525
|
+
class Br extends G {
|
|
3559
3526
|
constructor(e) {
|
|
3560
3527
|
super({ className: "sc-charts-cs__comments-edit" });
|
|
3561
3528
|
u(this, "input");
|
|
@@ -3566,10 +3533,10 @@ class Tr extends Z {
|
|
|
3566
3533
|
this._onSave = e.onSave, this._onCancel = e.onCancel, this.input = new k({ tag: "textarea", className: "sc-charts-cs__comments-edit-input" }), this.saveBtn = new k({
|
|
3567
3534
|
tag: "button",
|
|
3568
3535
|
className: "sc-charts-cs__comments-edit-save-btn"
|
|
3569
|
-
}), this.saveBtn.append(new
|
|
3536
|
+
}), this.saveBtn.append(new Nr().node), this.cancelBtn = new k({
|
|
3570
3537
|
tag: "button",
|
|
3571
3538
|
className: "sc-charts-cs__comments-edit-cancel-btn"
|
|
3572
|
-
}), this.cancelBtn.append(new
|
|
3539
|
+
}), this.cancelBtn.append(new Fr().node);
|
|
3573
3540
|
const s = new k({ className: "sc-charts-cs__comments-edit-btn-container" });
|
|
3574
3541
|
s.append(this.cancelBtn.node, this.saveBtn.node), this.append(this.input.node, s.node), this.state = { inputValue: e.initialValue || "", hasInitFocused: !1 }, this._setupListeners(), this.render();
|
|
3575
3542
|
}
|
|
@@ -3585,10 +3552,10 @@ class Tr extends Z {
|
|
|
3585
3552
|
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 }));
|
|
3586
3553
|
}
|
|
3587
3554
|
}
|
|
3588
|
-
const
|
|
3589
|
-
class
|
|
3555
|
+
const Ir = new J("comment-list");
|
|
3556
|
+
class Hr extends G {
|
|
3590
3557
|
constructor(e, s, n, r = {}) {
|
|
3591
|
-
super({ tag: "ul", className:
|
|
3558
|
+
super({ tag: "ul", className: Ir.gen(), ...r });
|
|
3592
3559
|
u(this, "_elements", {});
|
|
3593
3560
|
u(this, "_model");
|
|
3594
3561
|
u(this, "_view");
|
|
@@ -3604,7 +3571,7 @@ class kr extends Z {
|
|
|
3604
3571
|
}
|
|
3605
3572
|
_createItem(e) {
|
|
3606
3573
|
if (this.state.editId === e.id)
|
|
3607
|
-
return new
|
|
3574
|
+
return new Br({
|
|
3608
3575
|
onSave: (r) => {
|
|
3609
3576
|
this._model.comments.update(e.id, r), this.setState({ editId: null });
|
|
3610
3577
|
},
|
|
@@ -3613,7 +3580,7 @@ class kr extends Z {
|
|
|
3613
3580
|
},
|
|
3614
3581
|
initialValue: e.text
|
|
3615
3582
|
});
|
|
3616
|
-
const s = new
|
|
3583
|
+
const s = new Er({
|
|
3617
3584
|
onDelete: () => {
|
|
3618
3585
|
this._model.comments.remove(e.id), s.actionTooltip.setVisible(!1);
|
|
3619
3586
|
},
|
|
@@ -3629,7 +3596,7 @@ class kr extends Z {
|
|
|
3629
3596
|
return Object.values(this._elements).sort((e, s) => e.order - s.order).map((e) => e.element.node);
|
|
3630
3597
|
}
|
|
3631
3598
|
}
|
|
3632
|
-
class
|
|
3599
|
+
class Rr {
|
|
3633
3600
|
constructor() {
|
|
3634
3601
|
u(this, "node");
|
|
3635
3602
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
@@ -3641,21 +3608,21 @@ class Dr {
|
|
|
3641
3608
|
), s.setAttribute("stroke", "currentColor"), s.setAttribute("stroke-linecap", "round"), s.setAttribute("stroke-linejoin", "round"), e.appendChild(s), this.node = e;
|
|
3642
3609
|
}
|
|
3643
3610
|
}
|
|
3644
|
-
const kt = new
|
|
3645
|
-
class
|
|
3611
|
+
const kt = new J(""), Qt = new J("add-field");
|
|
3612
|
+
class ri extends G {
|
|
3646
3613
|
constructor({ onAdd: e, blockName: s }) {
|
|
3647
3614
|
kt.block = s;
|
|
3648
|
-
super({ className: kt.gen() + " " +
|
|
3615
|
+
super({ className: kt.gen() + " " + Qt.gen() });
|
|
3649
3616
|
u(this, "btn");
|
|
3650
3617
|
u(this, "input");
|
|
3651
3618
|
u(this, "_onAdd");
|
|
3652
3619
|
this._onAdd = e, this.state = { inputValue: "" }, this.input = new k({
|
|
3653
3620
|
tag: "input",
|
|
3654
|
-
className: kt.gen("input") + " " +
|
|
3621
|
+
className: kt.gen("input") + " " + Qt.gen("input")
|
|
3655
3622
|
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new k({
|
|
3656
3623
|
tag: "button",
|
|
3657
|
-
className: kt.gen("btn") + " " +
|
|
3658
|
-
}), this.btn.append(new
|
|
3624
|
+
className: kt.gen("btn") + " " + Qt.gen("btn")
|
|
3625
|
+
}), this.btn.append(new Rr().node), this.append(this.input.node, this.btn.node), this._setupListeners(), this.render();
|
|
3659
3626
|
}
|
|
3660
3627
|
_addComment() {
|
|
3661
3628
|
this._onAdd(this.input.node.value), this.setState({ inputValue: "" }), this.input.node.value = "", this.input.node.blur();
|
|
@@ -3674,23 +3641,23 @@ class ei extends Z {
|
|
|
3674
3641
|
this.btn.node.disabled = !this.state.inputValue.trim();
|
|
3675
3642
|
}
|
|
3676
3643
|
}
|
|
3677
|
-
const
|
|
3678
|
-
class
|
|
3644
|
+
const $r = new J("list-tooltip"), Kt = 8;
|
|
3645
|
+
class Pr extends G {
|
|
3679
3646
|
constructor(e, s, n) {
|
|
3680
|
-
super({ className:
|
|
3647
|
+
super({ className: $r.gen() });
|
|
3681
3648
|
u(this, "_list");
|
|
3682
3649
|
u(this, "_addField");
|
|
3683
3650
|
u(this, "_size", null);
|
|
3684
3651
|
u(this, "_model");
|
|
3685
3652
|
u(this, "_prevIsShow", !1);
|
|
3686
|
-
this._model = s, this.state = { isShow: !1, comments: e }, this._list = new
|
|
3653
|
+
this._model = s, this.state = { isShow: !1, comments: e }, this._list = new Hr(e, s, n), this._addField = new ri({
|
|
3687
3654
|
blockName: "list-tooltip-add",
|
|
3688
3655
|
onAdd: (r) => {
|
|
3689
|
-
const a = e[0].date,
|
|
3656
|
+
const a = e[0].date, l = e[0].price, c = {
|
|
3690
3657
|
id: crypto.randomUUID(),
|
|
3691
3658
|
text: r,
|
|
3692
3659
|
date: a,
|
|
3693
|
-
price:
|
|
3660
|
+
price: l,
|
|
3694
3661
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3695
3662
|
};
|
|
3696
3663
|
s.comments.add(c);
|
|
@@ -3699,7 +3666,7 @@ class Er extends Z {
|
|
|
3699
3666
|
}
|
|
3700
3667
|
render() {
|
|
3701
3668
|
const { isShow: e, comments: s } = this.state, { width: n, height: r } = this._model.layout.area;
|
|
3702
|
-
this._prevIsShow !== e && (this._list.forceUpdate(), this._prevIsShow = e), this.node.style.maxHeight = r / 2 -
|
|
3669
|
+
this._prevIsShow !== e && (this._list.forceUpdate(), this._prevIsShow = e), this.node.style.maxHeight = r / 2 - Kt + "px", this.setVisible(e), e && !this._size && (this.updateAbsolutePosition(), this._size = this.absolutePosition, this.position(n / 2 - this._size.width - Kt, r / 2 + Kt)), this._list.setState({ items: s }), requestAnimationFrame(() => {
|
|
3703
3670
|
this._list.node.scrollTop = this._list.node.scrollHeight;
|
|
3704
3671
|
});
|
|
3705
3672
|
}
|
|
@@ -3707,7 +3674,7 @@ class Er extends Z {
|
|
|
3707
3674
|
return this._list;
|
|
3708
3675
|
}
|
|
3709
3676
|
}
|
|
3710
|
-
class
|
|
3677
|
+
class zr {
|
|
3711
3678
|
constructor() {
|
|
3712
3679
|
u(this, "node");
|
|
3713
3680
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
@@ -3719,7 +3686,7 @@ class Nr {
|
|
|
3719
3686
|
), s.setAttribute("fill", "currentColor"), e.appendChild(s), this.node = e;
|
|
3720
3687
|
}
|
|
3721
3688
|
}
|
|
3722
|
-
class
|
|
3689
|
+
class Or extends G {
|
|
3723
3690
|
constructor({ x: e, ...s }, n) {
|
|
3724
3691
|
super(s);
|
|
3725
3692
|
u(this, "_colors");
|
|
@@ -3727,7 +3694,7 @@ class Fr extends Z {
|
|
|
3727
3694
|
x: e,
|
|
3728
3695
|
y: n.layout.xAxis.top,
|
|
3729
3696
|
isActive: !1
|
|
3730
|
-
}, this.node.append(new
|
|
3697
|
+
}, this.node.append(new zr().node), this.render();
|
|
3731
3698
|
}
|
|
3732
3699
|
render() {
|
|
3733
3700
|
const { x: e, y: s, isActive: n } = this.state;
|
|
@@ -3736,25 +3703,25 @@ class Fr extends Z {
|
|
|
3736
3703
|
this.node.style.backgroundColor = this._colors[`bg${r}`], this.node.style.color = this._colors[`icon${r}`];
|
|
3737
3704
|
}
|
|
3738
3705
|
}
|
|
3739
|
-
const
|
|
3740
|
-
class
|
|
3741
|
-
constructor({ boxId: e, model: s, view: n, comments: r, coords: a, onBoxActivate:
|
|
3742
|
-
super({ className:
|
|
3706
|
+
const qe = new J("comment-box");
|
|
3707
|
+
class Yr extends G {
|
|
3708
|
+
constructor({ boxId: e, model: s, view: n, comments: r, coords: a, onBoxActivate: l, onBoxDeactivate: c }) {
|
|
3709
|
+
super({ className: qe.gen() });
|
|
3743
3710
|
u(this, "pointer", new k({ className: "sc-charts-cs__comments-pointer" }));
|
|
3744
3711
|
u(this, "tooltip");
|
|
3745
3712
|
u(this, "anchor");
|
|
3746
3713
|
u(this, "_onBoxActivate");
|
|
3747
3714
|
u(this, "_onBoxDeactivate");
|
|
3748
3715
|
u(this, "_boxId");
|
|
3749
|
-
this._boxId = e, this._onBoxActivate =
|
|
3716
|
+
this._boxId = e, this._onBoxActivate = l, this._onBoxDeactivate = c, this.state = {
|
|
3750
3717
|
isActive: !1,
|
|
3751
3718
|
comments: r,
|
|
3752
3719
|
coords: a
|
|
3753
|
-
}, this.pointer.position(a), this.anchor = new
|
|
3754
|
-
const
|
|
3755
|
-
|
|
3756
|
-
}), this.tooltip =
|
|
3757
|
-
this.state.isActive && (this.anchor.node.contains(
|
|
3720
|
+
}, this.pointer.position(a), this.anchor = new Or({ x: a.x, className: qe.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3721
|
+
const d = !this.state.isActive;
|
|
3722
|
+
d ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: d });
|
|
3723
|
+
}), this.tooltip = ae(new Pr(r, s, n), (d) => {
|
|
3724
|
+
this.state.isActive && (this.anchor.node.contains(d.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3758
3725
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3759
3726
|
}
|
|
3760
3727
|
render() {
|
|
@@ -3762,11 +3729,11 @@ class Ir extends Z {
|
|
|
3762
3729
|
this.pointer.position(n), this.pointer.setVisible(e), this.anchor.setState({ x: n.x, isActive: e }), this.tooltip.setState({ comments: s, isShow: e });
|
|
3763
3730
|
}
|
|
3764
3731
|
}
|
|
3765
|
-
class
|
|
3732
|
+
class jr {
|
|
3766
3733
|
static animateTo(t, e, s, n) {
|
|
3767
|
-
const r = t.scales.panOffsetX + (t.layout.area.width / 2 - e), a = t.scales.panOffsetY + (t.layout.area.height / 2 - s),
|
|
3768
|
-
const p = _ - c, v = Math.min(p /
|
|
3769
|
-
t.scales.pan("x",
|
|
3734
|
+
const r = t.scales.panOffsetX + (t.layout.area.width / 2 - e), a = t.scales.panOffsetY + (t.layout.area.height / 2 - s), l = 300, c = performance.now(), d = t.scales.panOffsetX, f = t.scales.panOffsetY, g = (_) => {
|
|
3735
|
+
const p = _ - c, v = Math.min(p / l, 1), b = v * v * (3 - 2 * v), x = d + (r - d) * b, w = f + (a - f) * b;
|
|
3736
|
+
t.scales.pan("x", x, "absolute"), t.scales.pan("y", w, "absolute"), v < 1 ? requestAnimationFrame(g) : n == null || n();
|
|
3770
3737
|
};
|
|
3771
3738
|
requestAnimationFrame(g);
|
|
3772
3739
|
}
|
|
@@ -3775,19 +3742,19 @@ class Br {
|
|
|
3775
3742
|
this.animateTo(t, r, a, n);
|
|
3776
3743
|
}
|
|
3777
3744
|
}
|
|
3778
|
-
const
|
|
3779
|
-
class
|
|
3745
|
+
const te = new J("comments-context");
|
|
3746
|
+
class Vr extends G {
|
|
3780
3747
|
constructor() {
|
|
3781
|
-
super({ className:
|
|
3748
|
+
super({ className: te.gen() });
|
|
3782
3749
|
u(this, "pointer");
|
|
3783
3750
|
u(this, "addField");
|
|
3784
3751
|
u(this, "menu");
|
|
3785
3752
|
u(this, "_size", null);
|
|
3786
3753
|
u(this, "_model", null);
|
|
3787
3754
|
u(this, "_candle", null);
|
|
3788
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className:
|
|
3755
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: te.gen("pointer") }), this.menu = new k({ className: te.gen("menu") }), ae(this.menu, () => {
|
|
3789
3756
|
this.setState({ isShow: !1 });
|
|
3790
|
-
}), this.addField = new
|
|
3757
|
+
}), this.addField = new ri({
|
|
3791
3758
|
blockName: "context-add",
|
|
3792
3759
|
onAdd: (e) => {
|
|
3793
3760
|
!this._model || !this._candle || (this._model.comments.add({
|
|
@@ -3812,7 +3779,7 @@ class Hr extends Z {
|
|
|
3812
3779
|
y: n == null ? void 0 : n.scales.y.convert((e.open + e.close) / 2)
|
|
3813
3780
|
};
|
|
3814
3781
|
this.pointer.position(r), this._size || (this.menu.position(r), this.menu.updateAbsolutePosition());
|
|
3815
|
-
const a =
|
|
3782
|
+
const a = re({
|
|
3816
3783
|
size: this.menu.absolutePosition,
|
|
3817
3784
|
parent: n.layout.area,
|
|
3818
3785
|
offset: 9,
|
|
@@ -3821,14 +3788,14 @@ class Hr extends Z {
|
|
|
3821
3788
|
this._changeInputCorner(a.side), this.menu.position(a.x, a.y);
|
|
3822
3789
|
}
|
|
3823
3790
|
}
|
|
3824
|
-
class
|
|
3791
|
+
class Wr extends pt {
|
|
3825
3792
|
constructor(e) {
|
|
3826
3793
|
super("comments", e, { noCanvas: !0 });
|
|
3827
3794
|
u(this, "boxes", {});
|
|
3828
3795
|
u(this, "contextMenu");
|
|
3829
3796
|
u(this, "_view");
|
|
3830
3797
|
if (!this.dom) throw new Error("[CS_V_Comments] this.dom must be defined");
|
|
3831
|
-
this.contextMenu = new
|
|
3798
|
+
this.contextMenu = new Vr(), this._view = e, e.domElements.append(this.contextMenu.node);
|
|
3832
3799
|
}
|
|
3833
3800
|
_getCandleCoords(e, s) {
|
|
3834
3801
|
return {
|
|
@@ -3837,17 +3804,17 @@ class $r extends pt {
|
|
|
3837
3804
|
};
|
|
3838
3805
|
}
|
|
3839
3806
|
createBox({ boxId: e, coords: s, model: n, comments: r }) {
|
|
3840
|
-
const a = new
|
|
3807
|
+
const a = new Yr({
|
|
3841
3808
|
boxId: e,
|
|
3842
3809
|
model: n,
|
|
3843
3810
|
comments: r,
|
|
3844
3811
|
coords: s,
|
|
3845
3812
|
view: this._view,
|
|
3846
|
-
onBoxActivate: (
|
|
3813
|
+
onBoxActivate: (l) => {
|
|
3847
3814
|
const c = r[0].candle;
|
|
3848
|
-
|
|
3815
|
+
jr.animateToDataCoords(n, c.open_time, (c.open + c.close) / 2), this.boxes[l].setState({ isActive: !0 });
|
|
3849
3816
|
},
|
|
3850
|
-
onBoxDeactivate: (
|
|
3817
|
+
onBoxDeactivate: (l) => this.boxes[l].setState({ isActive: !1 })
|
|
3851
3818
|
});
|
|
3852
3819
|
this.boxes[e] = a, this.dom.append(a.node);
|
|
3853
3820
|
}
|
|
@@ -3855,111 +3822,58 @@ class $r extends pt {
|
|
|
3855
3822
|
this.contextMenu.setState({ model: e }), this.contextMenu.forceUpdate();
|
|
3856
3823
|
const s = e.comments.grouped, n = new Set(Object.keys(s));
|
|
3857
3824
|
Object.entries(s).forEach(([r, a]) => {
|
|
3858
|
-
const
|
|
3859
|
-
this.boxes[r] ? this.boxes[r].setState({ comments: a, coords:
|
|
3825
|
+
const l = this._getCandleCoords(e, a[0].candle), c = { boxId: r, coords: l, comments: a };
|
|
3826
|
+
this.boxes[r] ? this.boxes[r].setState({ comments: a, coords: l }) : this.createBox({ ...c, model: e });
|
|
3860
3827
|
}), Object.keys(this.boxes).forEach((r) => {
|
|
3861
3828
|
n.has(r) || (this.boxes[r].node.remove(), delete this.boxes[r]);
|
|
3862
3829
|
});
|
|
3863
3830
|
}
|
|
3864
3831
|
}
|
|
3865
|
-
|
|
3866
|
-
i.strokeStyle = t, i.lineWidth = e, s && i.setLineDash(s), i.beginPath(), i.moveTo(n.x1, n.y1), i.lineTo(n.x2, n.y2), i.stroke();
|
|
3867
|
-
}
|
|
3868
|
-
const zr = { text: "#FFFFFF", bg: "#000000" }, Pr = (i, t) => {
|
|
3869
|
-
const {
|
|
3870
|
-
coords: e,
|
|
3871
|
-
text: s,
|
|
3872
|
-
fontSize: n = 14,
|
|
3873
|
-
fontWeight: r = 600,
|
|
3874
|
-
textHeight: a,
|
|
3875
|
-
padding: o = { x: 0, y: 0 },
|
|
3876
|
-
borderRadius: c = 0,
|
|
3877
|
-
colors: h = zr,
|
|
3878
|
-
align: f = { x: "left", y: "top" }
|
|
3879
|
-
} = t, _ = getComputedStyle(
|
|
3880
|
-
document.querySelector(".sc-charts-cs") || document.body
|
|
3881
|
-
).font.replace(/^\s*\S+/, "").trim();
|
|
3882
|
-
i.font = `${r} ${n}px ${_}`;
|
|
3883
|
-
const v = i.measureText(s).width + o.x * 2, b = a + o.y * 2;
|
|
3884
|
-
let y = e.x, w = e.y;
|
|
3885
|
-
f.x === "middle" ? y -= v / 2 : f.x === "right" && (y -= v), f.y === "middle" ? w -= b / 2 : f.y === "bottom" && (w -= b), ti(i, {
|
|
3886
|
-
radius: c,
|
|
3887
|
-
coords: { x: y, y: w },
|
|
3888
|
-
width: v,
|
|
3889
|
-
height: b,
|
|
3890
|
-
fillColor: h.bg
|
|
3891
|
-
}), i.fillStyle = h.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, y + v / 2, w + b / 2);
|
|
3892
|
-
};
|
|
3893
|
-
class Or extends Ft {
|
|
3832
|
+
class Xr extends _t {
|
|
3894
3833
|
constructor(t) {
|
|
3895
3834
|
super(t);
|
|
3896
3835
|
}
|
|
3897
|
-
|
|
3898
|
-
this.ctx
|
|
3899
|
-
const a = (h) => e === h ? s : 0, { x: o, y: c } = r;
|
|
3900
|
-
Rr(this.ctx, {
|
|
3901
|
-
color: t,
|
|
3902
|
-
lineWidth: n,
|
|
3903
|
-
dashed: [4, 4],
|
|
3904
|
-
coords: { x1: o, y1: c, x2: o + a("h"), y2: c + a("v") }
|
|
3905
|
-
}), this.ctx.restore();
|
|
3906
|
-
}
|
|
3907
|
-
drawLabel({ text: t, coords: e, align: s, colors: n }) {
|
|
3908
|
-
this.ctx.save(), Pr(this.ctx, {
|
|
3909
|
-
text: t,
|
|
3910
|
-
coords: e,
|
|
3911
|
-
padding: { x: 6, y: 4 },
|
|
3912
|
-
borderRadius: 4,
|
|
3913
|
-
fontSize: 10,
|
|
3914
|
-
textHeight: 12,
|
|
3915
|
-
align: s,
|
|
3916
|
-
colors: n
|
|
3917
|
-
}), this.ctx.restore();
|
|
3918
|
-
}
|
|
3919
|
-
drawMarker({ text: t, coords: { x: e, y: s }, align: n, colors: r, length: a, type: o }) {
|
|
3920
|
-
this.drawLine({
|
|
3921
|
-
dir: o,
|
|
3922
|
-
coords: o === "h" ? { x: 0, y: s } : { x: e, y: 0 },
|
|
3923
|
-
length: a,
|
|
3924
|
-
color: r == null ? void 0 : r.line
|
|
3925
|
-
}), this.drawLabel({
|
|
3836
|
+
drawMarker({ text: t, startLineCoords: e, endMarkerCoords: s, colors: n, type: r, side: a }) {
|
|
3837
|
+
ni(this.ctx, {
|
|
3926
3838
|
text: t,
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3839
|
+
colors: n,
|
|
3840
|
+
startLineCoords: e,
|
|
3841
|
+
endMarkerCoords: s,
|
|
3842
|
+
dir: r,
|
|
3843
|
+
side: a
|
|
3930
3844
|
});
|
|
3931
3845
|
}
|
|
3932
3846
|
}
|
|
3933
|
-
class
|
|
3847
|
+
class Ur extends pt {
|
|
3934
3848
|
constructor(t) {
|
|
3935
|
-
if (super("guides", t, { CanvasClass:
|
|
3849
|
+
if (super("guides", t, { CanvasClass: Xr, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_Guides] Canvas must be defined");
|
|
3936
3850
|
}
|
|
3937
3851
|
render(t, { x: e, y: s }) {
|
|
3938
3852
|
if (this.canvas.clear(), t.config.guides.isShowY) {
|
|
3939
3853
|
const n = t.config.yAxis.position;
|
|
3940
3854
|
this.canvas.drawMarker({
|
|
3941
3855
|
text: t.scales.y.invert(s).toFixed(2),
|
|
3942
|
-
|
|
3943
|
-
|
|
3856
|
+
startLineCoords: { x: 0, y: s },
|
|
3857
|
+
endMarkerCoords: { x: t.layout.yAxis[n], y: s },
|
|
3858
|
+
side: n,
|
|
3944
3859
|
colors: t.colorScheme.guides.horizontalMarker,
|
|
3945
|
-
type: "h"
|
|
3946
|
-
length: t.layout.chart.width
|
|
3860
|
+
type: "h"
|
|
3947
3861
|
});
|
|
3948
3862
|
}
|
|
3949
3863
|
if (t.config.guides.isShowX) {
|
|
3950
3864
|
const n = t.config.xAxis.position;
|
|
3951
3865
|
this.canvas.drawMarker({
|
|
3952
3866
|
text: D.timeFormat("%a %d, %b %y %H:%M")(t.scales.x.invert(e)),
|
|
3953
|
-
|
|
3954
|
-
|
|
3867
|
+
startLineCoords: { x: e, y: 0 },
|
|
3868
|
+
endMarkerCoords: { x: e, y: t.layout.xAxis[n] },
|
|
3869
|
+
side: n,
|
|
3955
3870
|
colors: t.colorScheme.guides.verticalMarker,
|
|
3956
|
-
type: "v"
|
|
3957
|
-
length: t.layout.chart.height
|
|
3871
|
+
type: "v"
|
|
3958
3872
|
});
|
|
3959
3873
|
}
|
|
3960
3874
|
}
|
|
3961
3875
|
}
|
|
3962
|
-
class
|
|
3876
|
+
class Gr extends G {
|
|
3963
3877
|
constructor(e) {
|
|
3964
3878
|
super({ className: e });
|
|
3965
3879
|
u(this, "_isFirstShow", !1);
|
|
@@ -3969,7 +3883,7 @@ class Vr extends Z {
|
|
|
3969
3883
|
render() {
|
|
3970
3884
|
const { isShow: e, x: s, y: n, parent: r } = this.state;
|
|
3971
3885
|
e && !this._isFirstShow && (this.updateAbsolutePosition(), this._isFirstShow = !0), this.setVisible(e);
|
|
3972
|
-
const a =
|
|
3886
|
+
const a = re({
|
|
3973
3887
|
size: this.absolutePosition,
|
|
3974
3888
|
parent: r,
|
|
3975
3889
|
coords: { x: s, y: n }
|
|
@@ -3977,7 +3891,7 @@ class Vr extends Z {
|
|
|
3977
3891
|
this.position(a.x, a.y);
|
|
3978
3892
|
}
|
|
3979
3893
|
}
|
|
3980
|
-
class
|
|
3894
|
+
class Zr extends _t {
|
|
3981
3895
|
constructor(e) {
|
|
3982
3896
|
super(e);
|
|
3983
3897
|
u(this, "domain", null);
|
|
@@ -3987,34 +3901,37 @@ class jr extends Ft {
|
|
|
3987
3901
|
return e.filter((r) => r.open_time >= s && r.open_time <= n);
|
|
3988
3902
|
});
|
|
3989
3903
|
}
|
|
3990
|
-
drawSingleCandle({ x: e, y: s, strokeWidth: n, width: r, colors: a, isDim:
|
|
3991
|
-
this.ctx.fillStyle = this._mix(a.fill, a.bg,
|
|
3992
|
-
const c = Math.min(s.open, s.close),
|
|
3993
|
-
this.ctx.fillRect(f, c, r,
|
|
3904
|
+
drawSingleCandle({ x: e, y: s, strokeWidth: n, width: r, colors: a, isDim: l }) {
|
|
3905
|
+
this.ctx.fillStyle = this._mix(a.fill, a.bg, l), this.ctx.strokeStyle = this._mix(a.stroke, a.bg, l), this.ctx.lineWidth = n, this.ctx.beginPath(), this.ctx.moveTo(e, s.high), this.ctx.lineTo(e, s.low), this.ctx.stroke();
|
|
3906
|
+
const c = Math.min(s.open, s.close), d = Math.abs(s.close - s.open), f = e - r / 2;
|
|
3907
|
+
this.ctx.fillRect(f, c, r, d), this.ctx.strokeRect(f, c, r, d);
|
|
3994
3908
|
}
|
|
3995
3909
|
drawCandles(e) {
|
|
3996
3910
|
const {
|
|
3997
3911
|
colorScheme: { candles: s, bg: n },
|
|
3998
3912
|
trade: { timeRange: r },
|
|
3999
|
-
candles: { missingData: a, preparedData:
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
3913
|
+
candles: { missingData: a, preparedData: l },
|
|
3914
|
+
config: {
|
|
3915
|
+
candles: { hideMissingData: c }
|
|
3916
|
+
}
|
|
3917
|
+
} = e, d = e.config.candles.style === "filled";
|
|
3918
|
+
this.domain = e.scales.x.domain(), c || this._getVisible(a).forEach((f, g) => {
|
|
3919
|
+
const _ = s.noDataFill[g % s.noDataFill.length], p = d ? _ : s.noDataStroke;
|
|
4003
3920
|
this.drawSingleCandle({
|
|
4004
|
-
...this._getBasicCandleProps(e,
|
|
4005
|
-
colors: { fill:
|
|
3921
|
+
...this._getBasicCandleProps(e, f),
|
|
3922
|
+
colors: { fill: _, stroke: p, bg: n }
|
|
4006
3923
|
});
|
|
4007
|
-
}), this._getVisible(
|
|
4008
|
-
const
|
|
3924
|
+
}), this._getVisible(l).forEach((f) => {
|
|
3925
|
+
const g = f.close >= f.open ? "rising" : "falling", _ = s[`${g}Fill`], p = s[`${g}${d ? "Fill" : "Stroke"}`];
|
|
4009
3926
|
this.drawSingleCandle({
|
|
4010
|
-
...this._getBasicCandleProps(e,
|
|
4011
|
-
colors: { fill:
|
|
4012
|
-
isDim: !!(r.length && !r.includes(
|
|
3927
|
+
...this._getBasicCandleProps(e, f),
|
|
3928
|
+
colors: { fill: _, stroke: p, bg: n },
|
|
3929
|
+
isDim: !!(r.length && !r.includes(f.open_time.getTime()))
|
|
4013
3930
|
});
|
|
4014
3931
|
});
|
|
4015
3932
|
}
|
|
4016
3933
|
_mix(e, s, n) {
|
|
4017
|
-
return n ?
|
|
3934
|
+
return n ? M.mix(e, s).toString() : e;
|
|
4018
3935
|
}
|
|
4019
3936
|
_getBasicCandleProps(e, s) {
|
|
4020
3937
|
return {
|
|
@@ -4030,25 +3947,32 @@ class jr extends Ft {
|
|
|
4030
3947
|
};
|
|
4031
3948
|
}
|
|
4032
3949
|
}
|
|
4033
|
-
class
|
|
3950
|
+
class qr extends pt {
|
|
4034
3951
|
constructor(e) {
|
|
4035
|
-
super("candles", e, { CanvasClass:
|
|
4036
|
-
u(this, "
|
|
3952
|
+
super("candles", e, { CanvasClass: Zr });
|
|
3953
|
+
u(this, "_noDataTooltip", null);
|
|
4037
3954
|
u(this, "limiter");
|
|
4038
3955
|
if (!this.dom) throw new Error("[CS_V_Candles] this.dom must be defined");
|
|
4039
3956
|
if (!this.canvas) throw new Error("[CS_V_Candles] this.canvas must be defined");
|
|
4040
|
-
this.
|
|
3957
|
+
this._noDataTooltip = new Gr(this.cx("no-data")), this.limiter = new k({ className: this.cx("limiter") }), this.limiter.setVisible(!1), this.dom.append(this._noDataTooltip.node, this.limiter.node);
|
|
3958
|
+
}
|
|
3959
|
+
get noDataTooltip() {
|
|
3960
|
+
return this._noDataTooltip;
|
|
3961
|
+
}
|
|
3962
|
+
removeNoDataTooltip() {
|
|
3963
|
+
var e;
|
|
3964
|
+
(e = this._noDataTooltip) == null || e.remove(), this._noDataTooltip = null;
|
|
4041
3965
|
}
|
|
4042
3966
|
render(e) {
|
|
4043
3967
|
this.canvas.clear(), this.canvas.drawCandles(e);
|
|
4044
3968
|
const s = e.candles.allData[0];
|
|
4045
3969
|
if (s) {
|
|
4046
|
-
const { baseWidth: n, limiterOffset: r } = e.config.candles, a = e.scales.x.convert(s.open_time) - n / 2 - r,
|
|
4047
|
-
this.limiter.node.style.height = e.layout.area.height + "px", this.limiter.setVisible(!0), this.limiter.position(a,
|
|
3970
|
+
const { baseWidth: n, limiterOffset: r } = e.config.candles, a = e.scales.x.convert(s.open_time) - n / 2 - r.left - r.right, l = e.layout.area.height / 2;
|
|
3971
|
+
this.limiter.node.style.height = e.layout.area.height + "px", this.limiter.setVisible(!0), this.limiter.position(a, l);
|
|
4048
3972
|
}
|
|
4049
3973
|
}
|
|
4050
3974
|
}
|
|
4051
|
-
class
|
|
3975
|
+
class Jr {
|
|
4052
3976
|
constructor(t) {
|
|
4053
3977
|
u(this, "container");
|
|
4054
3978
|
u(this, "width");
|
|
@@ -4065,18 +3989,18 @@ class Wr {
|
|
|
4065
3989
|
u(this, "candles");
|
|
4066
3990
|
this.container = t, this.wrapper = new k({ tag: "div", className: "sc-charts-cs" }), t.append(this.wrapper.node);
|
|
4067
3991
|
const { width: e, height: s } = t.getBoundingClientRect();
|
|
4068
|
-
this.width = e, this.height = s, this.mainCanvas = new
|
|
3992
|
+
this.width = e, this.height = s, this.mainCanvas = new _t({
|
|
4069
3993
|
className: "sc-charts-cs__canvas-main",
|
|
4070
3994
|
width: e,
|
|
4071
3995
|
height: s,
|
|
4072
3996
|
isMain: !0
|
|
4073
|
-
}), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new
|
|
3997
|
+
}), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new Wr(this), this.candles = new qr(this), this.trade = new wr(this), this.guideMarkers = new Ur(this), this.userMarkers = new Sr(this);
|
|
4074
3998
|
}
|
|
4075
3999
|
renderAll(t) {
|
|
4076
|
-
this.mainCanvas.clear(), this.candles.render(t),
|
|
4000
|
+
this.mainCanvas.clear(), this.candles.render(t), qt.xAxis(this.mainCanvas.ctx, t), qt.yAxis(this.mainCanvas.ctx, t), qt.intersection(this.mainCanvas.ctx, t), this.trade.renderAll(t), this.userMarkers.render(t), this.comments.render(t);
|
|
4077
4001
|
}
|
|
4078
4002
|
}
|
|
4079
|
-
class
|
|
4003
|
+
class Qr {
|
|
4080
4004
|
constructor(t) {
|
|
4081
4005
|
u(this, "logColors", {
|
|
4082
4006
|
init_model: "color: green",
|
|
@@ -4102,13 +4026,13 @@ class Ur {
|
|
|
4102
4026
|
console.log(`%c[SUBSCRIBE] ${t}`, s, n);
|
|
4103
4027
|
}
|
|
4104
4028
|
}
|
|
4105
|
-
class
|
|
4029
|
+
class Kr {
|
|
4106
4030
|
constructor(t, e) {
|
|
4107
4031
|
u(this, "_model");
|
|
4108
4032
|
u(this, "_view");
|
|
4109
4033
|
u(this, "_enableLogging");
|
|
4110
4034
|
u(this, "_logger");
|
|
4111
|
-
this._model = t, this._view = e, this._enableLogging = !1, this._logger = new
|
|
4035
|
+
this._model = t, this._view = e, this._enableLogging = !1, this._logger = new Qr(["scale_event"]);
|
|
4112
4036
|
}
|
|
4113
4037
|
subscribeWithLogging(t, e) {
|
|
4114
4038
|
const s = (n) => {
|
|
@@ -4119,7 +4043,7 @@ class Gr {
|
|
|
4119
4043
|
// [TODO]: optimize renderers, call only the necessary ones. Get rid of this._view.renderAll
|
|
4120
4044
|
init() {
|
|
4121
4045
|
this.subscribeWithLogging("init_model", () => {
|
|
4122
|
-
this._view.mainCanvas.background = this._model.colorScheme.bg, this._view.renderAll(this._model);
|
|
4046
|
+
this._model.config.candles.hideMissingData && this._view.candles.removeNoDataTooltip(), this._view.mainCanvas.background = this._model.colorScheme.bg, this._view.renderAll(this._model);
|
|
4123
4047
|
}), this.subscribeWithLogging("scale_event", () => {
|
|
4124
4048
|
this._model.userMarkers.rebuild(), this._model.trade.recalculate(), this._view.renderAll(this._model);
|
|
4125
4049
|
}), this.subscribeWithLogging("update_config", (t) => {
|
|
@@ -4129,7 +4053,7 @@ class Gr {
|
|
|
4129
4053
|
}), this.subscribeWithLogging("update_trade", (t) => {
|
|
4130
4054
|
this._model.trade.updateTrade(t), this._view.renderAll(this._model);
|
|
4131
4055
|
}), this.subscribeWithLogging("update_user_markers", (t) => {
|
|
4132
|
-
this._model.userMarkers.updateMarkers(t), this._view.userMarkers.render(this._model
|
|
4056
|
+
this._model.userMarkers.updateMarkers(t), this._view.userMarkers.render(this._model);
|
|
4133
4057
|
}), this.subscribeWithLogging("update_color_scheme", (t) => {
|
|
4134
4058
|
this._model.colorScheme.update(t), this._view.mainCanvas.background = this._model.colorScheme.bg, this._view.renderAll(this._model);
|
|
4135
4059
|
}), this.subscribeWithLogging("open_trade_label_tooltip", ({ trade: t, x: e, y: s }) => {
|
|
@@ -4142,14 +4066,16 @@ class Gr {
|
|
|
4142
4066
|
}), this.subscribeWithLogging("close_trade_label_tooltip", () => {
|
|
4143
4067
|
this._model.trade.setActiveTrade(null), this._view.trade.renderAll(this._model), this._view.trade.labelTooltip.setState({ isShow: !1 });
|
|
4144
4068
|
}), this.subscribeWithLogging("hover_nodata_candle", ({ x: t, y: e }) => {
|
|
4145
|
-
|
|
4069
|
+
var s;
|
|
4070
|
+
(s = this._view.candles.noDataTooltip) == null || s.setState({
|
|
4146
4071
|
isShow: !0,
|
|
4147
4072
|
x: t,
|
|
4148
4073
|
y: e,
|
|
4149
4074
|
parent: this._model.layout.area
|
|
4150
4075
|
});
|
|
4151
4076
|
}), this.subscribeWithLogging("leave_nodata_candle", () => {
|
|
4152
|
-
|
|
4077
|
+
var t;
|
|
4078
|
+
(t = this._view.candles.noDataTooltip) == null || t.setState({ isShow: !1 });
|
|
4153
4079
|
}), this.subscribeWithLogging("mouseover_trade_label_tooltip", (t) => {
|
|
4154
4080
|
this._model.trade.setHoveredTrade(t.tradeType, t.candle.open_time.getTime()), this._view.trade.renderAll(this._model);
|
|
4155
4081
|
}), this.subscribeWithLogging("mouseleave_trade_label_tooltip", () => {
|
|
@@ -4159,7 +4085,7 @@ class Gr {
|
|
|
4159
4085
|
});
|
|
4160
4086
|
}
|
|
4161
4087
|
}
|
|
4162
|
-
class
|
|
4088
|
+
class Je {
|
|
4163
4089
|
constructor() {
|
|
4164
4090
|
u(this, "_map", /* @__PURE__ */ new Map());
|
|
4165
4091
|
}
|
|
@@ -4185,15 +4111,15 @@ class Ge {
|
|
|
4185
4111
|
r = !0;
|
|
4186
4112
|
}
|
|
4187
4113
|
};
|
|
4188
|
-
for (const
|
|
4189
|
-
if (
|
|
4114
|
+
for (const l of n)
|
|
4115
|
+
if (l(a), r) break;
|
|
4190
4116
|
return r;
|
|
4191
4117
|
}
|
|
4192
4118
|
}
|
|
4193
|
-
class
|
|
4119
|
+
class ta {
|
|
4194
4120
|
constructor() {
|
|
4195
4121
|
u(this, "_elements", []);
|
|
4196
|
-
u(this, "_listeners", new
|
|
4122
|
+
u(this, "_listeners", new Je());
|
|
4197
4123
|
u(this, "_lastHovered", /* @__PURE__ */ new Set());
|
|
4198
4124
|
u(this, "_dragContext", null);
|
|
4199
4125
|
}
|
|
@@ -4207,7 +4133,7 @@ class Zr {
|
|
|
4207
4133
|
this._elements = this._elements.filter((e) => e !== t), this._listeners.removeAll(t), this._lastHovered.delete(t);
|
|
4208
4134
|
}
|
|
4209
4135
|
clear() {
|
|
4210
|
-
this._elements = [], this._listeners = new
|
|
4136
|
+
this._elements = [], this._listeners = new Je(), this._lastHovered.clear();
|
|
4211
4137
|
}
|
|
4212
4138
|
on(t, e, s) {
|
|
4213
4139
|
this._listeners.add(t, e, s);
|
|
@@ -4308,12 +4234,12 @@ class Zr {
|
|
|
4308
4234
|
}
|
|
4309
4235
|
dispatchWheel(t, e, s, n, r) {
|
|
4310
4236
|
const a = this._getHitsAt(t, e);
|
|
4311
|
-
for (const
|
|
4312
|
-
if (this._emitSingle(
|
|
4237
|
+
for (const l of a)
|
|
4238
|
+
if (this._emitSingle(l.target, {
|
|
4313
4239
|
type: "wheel",
|
|
4314
|
-
target:
|
|
4315
|
-
x:
|
|
4316
|
-
y:
|
|
4240
|
+
target: l.target,
|
|
4241
|
+
x: l.x,
|
|
4242
|
+
y: l.y,
|
|
4317
4243
|
deltaX: s,
|
|
4318
4244
|
deltaY: n,
|
|
4319
4245
|
deltaZ: r
|
|
@@ -4336,7 +4262,7 @@ class Zr {
|
|
|
4336
4262
|
return this._listeners.emit(t, n), s;
|
|
4337
4263
|
}
|
|
4338
4264
|
}
|
|
4339
|
-
class
|
|
4265
|
+
class ea {
|
|
4340
4266
|
constructor(t) {
|
|
4341
4267
|
this.model = t;
|
|
4342
4268
|
}
|
|
@@ -4348,26 +4274,26 @@ class qr {
|
|
|
4348
4274
|
candles: { baseWidth: a }
|
|
4349
4275
|
}
|
|
4350
4276
|
} = this.model;
|
|
4351
|
-
for (const
|
|
4352
|
-
const c = n.convert(
|
|
4277
|
+
for (const l of s) {
|
|
4278
|
+
const c = n.convert(l.open_time), d = r.convert(l.high), f = r.convert(l.low), g = c - a / 2, _ = c + a / 2, p = Math.min(d, f), v = Math.max(d, f);
|
|
4353
4279
|
if (t >= g && t <= _ && e >= p && e <= v)
|
|
4354
4280
|
return {
|
|
4355
4281
|
target: this,
|
|
4356
4282
|
x: t,
|
|
4357
4283
|
y: e,
|
|
4358
4284
|
type: "candle",
|
|
4359
|
-
candle:
|
|
4285
|
+
candle: l
|
|
4360
4286
|
};
|
|
4361
4287
|
}
|
|
4362
4288
|
return null;
|
|
4363
4289
|
}
|
|
4364
4290
|
}
|
|
4365
|
-
class
|
|
4291
|
+
class ia {
|
|
4366
4292
|
constructor(t, e) {
|
|
4367
4293
|
u(this, "_model");
|
|
4368
4294
|
u(this, "_hitManager");
|
|
4369
4295
|
u(this, "_hit");
|
|
4370
|
-
this._model = t, this._hitManager = e, this._hit = new
|
|
4296
|
+
this._model = t, this._hitManager = e, this._hit = new ea(t), this._hitManager.register(this._hit);
|
|
4371
4297
|
}
|
|
4372
4298
|
register() {
|
|
4373
4299
|
this._hitManager.on(this._hit, "mouseover", (t) => {
|
|
@@ -4380,19 +4306,19 @@ class Jr {
|
|
|
4380
4306
|
});
|
|
4381
4307
|
}
|
|
4382
4308
|
}
|
|
4383
|
-
class
|
|
4309
|
+
class sa {
|
|
4384
4310
|
constructor(t) {
|
|
4385
4311
|
this.model = t;
|
|
4386
4312
|
}
|
|
4387
4313
|
hitTest(t, e) {
|
|
4388
|
-
const { tradedCandles: s } = this.model.trade, { x: n, y: r } = this.model.scales, a = 16,
|
|
4389
|
-
for (const { candle: c, trades:
|
|
4314
|
+
const { tradedCandles: s } = this.model.trade, { x: n, y: r } = this.model.scales, a = 16, l = 4;
|
|
4315
|
+
for (const { candle: c, trades: d } of s) {
|
|
4390
4316
|
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = a, p = a;
|
|
4391
4317
|
for (const v of ["buy", "sell"]) {
|
|
4392
|
-
const b =
|
|
4318
|
+
const b = d.filter((C) => C.type === v);
|
|
4393
4319
|
if (!b.length) continue;
|
|
4394
|
-
const
|
|
4395
|
-
if (w &&
|
|
4320
|
+
const x = v === "buy" ? r.convert(c.low) + l + Lt(a) : r.convert(c.high) - l - a - Lt(a), w = t >= g - _ / 2 && t <= g + _ / 2, y = e >= x && e <= x + p;
|
|
4321
|
+
if (w && y)
|
|
4396
4322
|
return {
|
|
4397
4323
|
target: this,
|
|
4398
4324
|
type: "trade-label",
|
|
@@ -4407,12 +4333,12 @@ class Qr {
|
|
|
4407
4333
|
return null;
|
|
4408
4334
|
}
|
|
4409
4335
|
}
|
|
4410
|
-
class
|
|
4336
|
+
class na {
|
|
4411
4337
|
constructor(t, e) {
|
|
4412
4338
|
u(this, "_model");
|
|
4413
4339
|
u(this, "_hitManager");
|
|
4414
4340
|
u(this, "_tradeLabelHit");
|
|
4415
|
-
this._model = t, this._hitManager = e, this._tradeLabelHit = new
|
|
4341
|
+
this._model = t, this._hitManager = e, this._tradeLabelHit = new sa(t), this._hitManager.register(this._tradeLabelHit);
|
|
4416
4342
|
}
|
|
4417
4343
|
register() {
|
|
4418
4344
|
this._hitManager.on(this._tradeLabelHit, "click", (t) => {
|
|
@@ -4438,7 +4364,7 @@ class Kr {
|
|
|
4438
4364
|
});
|
|
4439
4365
|
}
|
|
4440
4366
|
}
|
|
4441
|
-
class
|
|
4367
|
+
class ra {
|
|
4442
4368
|
constructor(t) {
|
|
4443
4369
|
this.model = t;
|
|
4444
4370
|
}
|
|
@@ -4452,7 +4378,7 @@ class ta {
|
|
|
4452
4378
|
} : null;
|
|
4453
4379
|
}
|
|
4454
4380
|
}
|
|
4455
|
-
class
|
|
4381
|
+
class aa {
|
|
4456
4382
|
constructor(t) {
|
|
4457
4383
|
this.model = t;
|
|
4458
4384
|
}
|
|
@@ -4466,7 +4392,7 @@ class ea {
|
|
|
4466
4392
|
} : null;
|
|
4467
4393
|
}
|
|
4468
4394
|
}
|
|
4469
|
-
class
|
|
4395
|
+
class oa {
|
|
4470
4396
|
constructor(t) {
|
|
4471
4397
|
this.model = t;
|
|
4472
4398
|
}
|
|
@@ -4480,7 +4406,7 @@ class ia {
|
|
|
4480
4406
|
} : null;
|
|
4481
4407
|
}
|
|
4482
4408
|
}
|
|
4483
|
-
function
|
|
4409
|
+
function la(i, t) {
|
|
4484
4410
|
let e = { x: 0, y: 0 }, s = null;
|
|
4485
4411
|
return (n) => {
|
|
4486
4412
|
Math.abs(n.x - e.x) < i && Math.abs(n.y - e.y) < i || (e = { x: n.x, y: n.y }, s && cancelAnimationFrame(s), s = requestAnimationFrame(() => {
|
|
@@ -4488,7 +4414,7 @@ function sa(i, t) {
|
|
|
4488
4414
|
}));
|
|
4489
4415
|
};
|
|
4490
4416
|
}
|
|
4491
|
-
function
|
|
4417
|
+
function ca(i, t) {
|
|
4492
4418
|
let e = null;
|
|
4493
4419
|
return (s) => {
|
|
4494
4420
|
const n = s.x - (s.prevX ?? s.x), r = s.y - (s.prevY ?? s.y);
|
|
@@ -4497,34 +4423,39 @@ function na(i, t) {
|
|
|
4497
4423
|
}));
|
|
4498
4424
|
};
|
|
4499
4425
|
}
|
|
4500
|
-
|
|
4426
|
+
function ie(i, t) {
|
|
4427
|
+
const { width: e } = t.candles.limiter.absolutePosition, s = i.config.candles.baseWidth, n = i.config.candles.limiterOffset.left + i.config.candles.limiterOffset.right, a = i.scales.x.convert(i.candles.allData[0].open_time) - e - s / 2 - n;
|
|
4428
|
+
a > 0 && i.scales.pan("x", -a);
|
|
4429
|
+
}
|
|
4430
|
+
function se(i) {
|
|
4431
|
+
return i.candles.limiter.absolutePosition.width > 0;
|
|
4432
|
+
}
|
|
4433
|
+
class oe {
|
|
4501
4434
|
constructor(t, e, s) {
|
|
4502
4435
|
u(this, "_model");
|
|
4503
4436
|
u(this, "_hitManager");
|
|
4504
4437
|
u(this, "_hit");
|
|
4505
|
-
|
|
4506
|
-
this._model = t, this._hitManager = e, this._hit = new ta(t), this._hitManager.register(this._hit), this._view = s;
|
|
4438
|
+
this._model = t, this._hitManager = e, this._hit = s, e.register(s);
|
|
4507
4439
|
}
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4440
|
+
}
|
|
4441
|
+
class ha extends oe {
|
|
4442
|
+
constructor(e, s, n) {
|
|
4443
|
+
super(e, s, new ra(e));
|
|
4444
|
+
u(this, "_view");
|
|
4445
|
+
this._view = n;
|
|
4512
4446
|
}
|
|
4513
4447
|
register() {
|
|
4514
|
-
this._hitManager.on(this._hit, "drag", (
|
|
4515
|
-
|
|
4516
|
-
|
|
4448
|
+
this._hitManager.on(this._hit, "drag", (e) => {
|
|
4449
|
+
const s = e.x - (e.prevX ?? e.x);
|
|
4450
|
+
this._model.scales.scale("x", -s), this._view && se(this._view) && ie(this._model, this._view);
|
|
4517
4451
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4518
4452
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4519
4453
|
});
|
|
4520
4454
|
}
|
|
4521
4455
|
}
|
|
4522
|
-
class
|
|
4456
|
+
class da extends oe {
|
|
4523
4457
|
constructor(t, e) {
|
|
4524
|
-
|
|
4525
|
-
u(this, "_hitManager");
|
|
4526
|
-
u(this, "_hit");
|
|
4527
|
-
this._model = t, this._hitManager = e, this._hit = new ia(t), this._hitManager.register(this._hit);
|
|
4458
|
+
super(t, e, new oa(t));
|
|
4528
4459
|
}
|
|
4529
4460
|
register() {
|
|
4530
4461
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
@@ -4535,56 +4466,39 @@ class aa {
|
|
|
4535
4466
|
});
|
|
4536
4467
|
}
|
|
4537
4468
|
}
|
|
4538
|
-
class
|
|
4539
|
-
constructor(
|
|
4540
|
-
|
|
4469
|
+
class ua extends oe {
|
|
4470
|
+
constructor(e, s, n) {
|
|
4471
|
+
super(e, n, new aa(e));
|
|
4541
4472
|
u(this, "_view");
|
|
4542
|
-
|
|
4543
|
-
u(this, "_hit");
|
|
4544
|
-
this._model = t, this._view = e, this._hitManager = s, this._hit = new ea(t), this._hitManager.register(this._hit);
|
|
4545
|
-
}
|
|
4546
|
-
_limitDx(t) {
|
|
4547
|
-
if (t <= 0) return t;
|
|
4548
|
-
const { width: e } = this._view.candles.limiter.absolutePosition, s = this._model.config.candles.limiterOffset, n = this._model.scales.x.convert(this._model.candles.allData[0].open_time), r = this._model.layout.chart.left, a = n - s * 2 - e;
|
|
4549
|
-
return a >= r ? 0 : a + t >= r ? r - a : t;
|
|
4473
|
+
this._view = s;
|
|
4550
4474
|
}
|
|
4551
4475
|
register() {
|
|
4552
4476
|
this._hitManager.on(
|
|
4553
4477
|
this._hit,
|
|
4554
4478
|
"mousemove",
|
|
4555
|
-
|
|
4556
|
-
this._view.guideMarkers.render(this._model, { x:
|
|
4479
|
+
la(1, (e) => {
|
|
4480
|
+
this._view.guideMarkers.render(this._model, { x: e.x, y: e.y });
|
|
4557
4481
|
})
|
|
4558
4482
|
), this._hitManager.on(this._hit, "mouseleave", () => {
|
|
4559
4483
|
this._view.guideMarkers.canvas.clear();
|
|
4560
4484
|
}), this._hitManager.on(
|
|
4561
4485
|
this._hit,
|
|
4562
4486
|
"drag",
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
const s = t.y - (t.prevY ?? t.y);
|
|
4566
|
-
e = this._limitDx(e), this._model.scales.pan("x", e), this._model.scales.pan("y", s), this._view.guideMarkers.render(this._model, { x: t.x, y: t.y });
|
|
4487
|
+
ca(1, (e) => {
|
|
4488
|
+
this._model.scales.pan("x", e.x - (e.prevX ?? e.x)), se(this._view) && ie(this._model, this._view), this._model.scales.pan("y", e.y - (e.prevY ?? e.y)), this._view.guideMarkers.render(this._model, { x: e.x, y: e.y });
|
|
4567
4489
|
})
|
|
4568
|
-
), this._hitManager.on(this._hit, "contextmenu", ({ x:
|
|
4569
|
-
const
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
if (!t.deltaY) return;
|
|
4577
|
-
const e = -t.deltaY, s = (r = (n = this._model.config) == null ? void 0 : n.candles) == null ? void 0 : r.zoomOnWheel;
|
|
4578
|
-
if (["x", "both"].includes(s)) {
|
|
4579
|
-
this._model.scales.scale("x", e);
|
|
4580
|
-
const a = this._limitDx(0);
|
|
4581
|
-
a !== 0 && this._model.scales.pan("x", a);
|
|
4582
|
-
}
|
|
4583
|
-
["y", "both"].includes(s) && this._model.scales.scale("y", e);
|
|
4490
|
+
), this._hitManager.on(this._hit, "contextmenu", ({ x: e }) => {
|
|
4491
|
+
const s = this._model.scales.x.invert(e), n = ne.findByDate(s, this._model.candles.allData);
|
|
4492
|
+
n && (this._view.comments.contextMenu.setState({ isShow: !0, candle: n }), this._view.comments.render(this._model));
|
|
4493
|
+
}), this._hitManager.on(this._hit, "wheel", (e) => {
|
|
4494
|
+
var r, a;
|
|
4495
|
+
if (!e.deltaY) return;
|
|
4496
|
+
const s = -e.deltaY, n = (a = (r = this._model.config) == null ? void 0 : r.candles) == null ? void 0 : a.zoomOnWheel;
|
|
4497
|
+
["x", "both"].includes(n) && (this._model.scales.scale("x", s), se(this._view) && ie(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
|
|
4584
4498
|
});
|
|
4585
4499
|
}
|
|
4586
4500
|
}
|
|
4587
|
-
class
|
|
4501
|
+
class fa {
|
|
4588
4502
|
constructor(t, e, s) {
|
|
4589
4503
|
u(this, "_hitManager");
|
|
4590
4504
|
u(this, "_candlesHandler");
|
|
@@ -4592,24 +4506,24 @@ class la {
|
|
|
4592
4506
|
u(this, "_xAxisHandler");
|
|
4593
4507
|
u(this, "_yAxisHandler");
|
|
4594
4508
|
u(this, "_areaHandler");
|
|
4595
|
-
this._hitManager = s, this._candlesHandler = new
|
|
4509
|
+
this._hitManager = s, this._candlesHandler = new ia(t, this._hitManager), this._tradeLabelsHandler = new na(t, this._hitManager), this._xAxisHandler = new ha(t, this._hitManager, e), this._yAxisHandler = new da(t, this._hitManager), this._areaHandler = new ua(t, e, this._hitManager);
|
|
4596
4510
|
}
|
|
4597
4511
|
register() {
|
|
4598
4512
|
this._candlesHandler.register(), this._tradeLabelsHandler.register(), this._xAxisHandler.register(), this._yAxisHandler.register(), this._areaHandler.register();
|
|
4599
4513
|
}
|
|
4600
4514
|
}
|
|
4601
|
-
class
|
|
4515
|
+
class ga {
|
|
4602
4516
|
constructor(t, e) {
|
|
4603
4517
|
u(this, "_model");
|
|
4604
4518
|
u(this, "_view");
|
|
4605
4519
|
u(this, "_subscriptionsManager");
|
|
4606
|
-
u(this, "_hitManager", new
|
|
4520
|
+
u(this, "_hitManager", new ta());
|
|
4607
4521
|
u(this, "_boundMouseMove", this.onDocumentMouseMove.bind(this));
|
|
4608
4522
|
u(this, "_boundMouseUp", this.onDocumentMouseUp.bind(this));
|
|
4609
|
-
this._model = t, this._view = e, this._subscriptionsManager = new
|
|
4523
|
+
this._model = t, this._view = e, this._subscriptionsManager = new Kr(t, e);
|
|
4610
4524
|
}
|
|
4611
4525
|
init() {
|
|
4612
|
-
this._subscriptionsManager.init(), this._model.init(), this._view.binding.mousemove(this.onMouseMove.bind(this)), this._view.binding.mousedown(this.onMouseDown.bind(this)), this._view.binding.mouseup(this.onMouseUp.bind(this)), this._view.binding.wheel(this.onWheel.bind(this)), this._view.binding.mouseleave(this.onMouseLeave.bind(this)), this._view.binding.dblclick(this.onDoubleClick.bind(this)), this._view.binding.contextmenu(this.onContextMenu.bind(this)), window.addEventListener("scroll", this.onWindowScroll.bind(this), { passive: !0 }), document.addEventListener("click", this.onDocumentClick.bind(this)), new
|
|
4526
|
+
this._subscriptionsManager.init(), this._model.init(), this._view.binding.mousemove(this.onMouseMove.bind(this)), this._view.binding.mousedown(this.onMouseDown.bind(this)), this._view.binding.mouseup(this.onMouseUp.bind(this)), this._view.binding.wheel(this.onWheel.bind(this)), this._view.binding.mouseleave(this.onMouseLeave.bind(this)), this._view.binding.dblclick(this.onDoubleClick.bind(this)), this._view.binding.contextmenu(this.onContextMenu.bind(this)), window.addEventListener("scroll", this.onWindowScroll.bind(this), { passive: !0 }), document.addEventListener("click", this.onDocumentClick.bind(this)), new fa(this._model, this._view, this._hitManager).register();
|
|
4613
4527
|
}
|
|
4614
4528
|
onContextMenu(t) {
|
|
4615
4529
|
t.preventDefault();
|
|
@@ -4655,8 +4569,8 @@ class ca {
|
|
|
4655
4569
|
onMouseMove(t) {
|
|
4656
4570
|
var r;
|
|
4657
4571
|
if (!this._hitManager.isDragging) {
|
|
4658
|
-
const { x: a, y:
|
|
4659
|
-
this._hitManager.dispatchMouseMove(a,
|
|
4572
|
+
const { x: a, y: l } = this.getMouseRelative(t);
|
|
4573
|
+
this._hitManager.dispatchMouseMove(a, l);
|
|
4660
4574
|
}
|
|
4661
4575
|
const { x: e, y: s } = this.getMouseRelative(t), n = this._hitManager.hitTestAll(e, s);
|
|
4662
4576
|
(r = n[0]) != null && r.type && (n[0].type === "area" ? this._view.mainCanvas.node.style.cursor = "crosshair" : n[0].type === "trade-label" ? this._model.config.trade.showLabelButtons && (this._view.mainCanvas.node.style.cursor = "pointer") : n[0].type === "x-axis" ? this._view.mainCanvas.node.style.cursor = "ew-resize" : n[0].type === "y-axis" ? this._view.mainCanvas.node.style.cursor = "ns-resize" : this._view.mainCanvas.node.style.cursor = "default");
|
|
@@ -4665,8 +4579,8 @@ class ca {
|
|
|
4665
4579
|
t.preventDefault(), this._hitManager.dispatchWheel(t.offsetX, t.offsetY, t.deltaX, t.deltaY, t.deltaZ);
|
|
4666
4580
|
}
|
|
4667
4581
|
}
|
|
4668
|
-
class
|
|
4669
|
-
constructor(t, { chartId: e, candles: s, config: n, trade: r, userMarkers: a, colorScheme:
|
|
4582
|
+
class pa {
|
|
4583
|
+
constructor(t, { chartId: e, candles: s, config: n, trade: r, userMarkers: a, colorScheme: l, comments: c, renderLimiter: d }) {
|
|
4670
4584
|
u(this, "_model");
|
|
4671
4585
|
u(this, "_view");
|
|
4672
4586
|
u(this, "_controller");
|
|
@@ -4677,17 +4591,17 @@ class ua {
|
|
|
4677
4591
|
throw new Error(
|
|
4678
4592
|
"chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
|
|
4679
4593
|
);
|
|
4680
|
-
if (this._model = new
|
|
4594
|
+
if (this._model = new Nn({
|
|
4681
4595
|
chartId: e,
|
|
4682
4596
|
candles: s,
|
|
4683
4597
|
config: n,
|
|
4684
4598
|
container: f,
|
|
4685
4599
|
trade: r,
|
|
4686
4600
|
userMarkers: a,
|
|
4687
|
-
colorScheme:
|
|
4601
|
+
colorScheme: l,
|
|
4688
4602
|
comments: c
|
|
4689
|
-
}), this._view = new
|
|
4690
|
-
const g =
|
|
4603
|
+
}), this._view = new Jr(f), this._controller = new ga(this._model, this._view), d) {
|
|
4604
|
+
const g = d(this._view.candles.limiter.node);
|
|
4691
4605
|
this._view.candles.limiter.updateAbsolutePosition(), typeof g == "function" && (this._candlesLimiterClean = g);
|
|
4692
4606
|
}
|
|
4693
4607
|
this._controller.init();
|
|
@@ -4716,7 +4630,7 @@ class ua {
|
|
|
4716
4630
|
}
|
|
4717
4631
|
}
|
|
4718
4632
|
export {
|
|
4719
|
-
|
|
4720
|
-
|
|
4633
|
+
pa as CandlestickChart,
|
|
4634
|
+
_a as createLineChart
|
|
4721
4635
|
};
|
|
4722
4636
|
//# sourceMappingURL=charts-core.js.map
|