@tradecanvas/core 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/ReplayManager.d.ts +56 -1
- package/dist/features/ReplayManager.d.ts.map +1 -1
- package/dist/features/SignalMarkerManager.d.ts +8 -0
- package/dist/features/SignalMarkerManager.d.ts.map +1 -1
- package/dist/features/TradeZoneManager.d.ts +8 -0
- package/dist/features/TradeZoneManager.d.ts.map +1 -1
- package/dist/features/replayReveal.d.ts +14 -0
- package/dist/features/replayReveal.d.ts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +349 -273
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17971,36 +17971,57 @@ function dm(e) {
|
|
|
17971
17971
|
}
|
|
17972
17972
|
//#endregion
|
|
17973
17973
|
//#region src/features/ReplayManager.ts
|
|
17974
|
-
var fm =
|
|
17974
|
+
var fm = 16, pm = () => typeof requestAnimationFrame == "function" && !(typeof document < "u" && document.hidden), mm = {
|
|
17975
|
+
now: () => typeof performance < "u" ? performance.now() : Date.now(),
|
|
17976
|
+
frame: (e) => pm() ? { raf: requestAnimationFrame(e) } : { timeout: setTimeout(e, fm) },
|
|
17977
|
+
cancel: (e) => {
|
|
17978
|
+
let t = e;
|
|
17979
|
+
t.raf !== void 0 && cancelAnimationFrame(t.raf), t.timeout !== void 0 && clearTimeout(t.timeout);
|
|
17980
|
+
}
|
|
17981
|
+
}, hm = class extends xf {
|
|
17975
17982
|
data = [];
|
|
17976
17983
|
cursor = -1;
|
|
17977
17984
|
timer = null;
|
|
17985
|
+
frameHandle = null;
|
|
17986
|
+
run = 0;
|
|
17978
17987
|
state = "stopped";
|
|
17979
17988
|
config = {
|
|
17980
17989
|
speed: 1,
|
|
17981
17990
|
interval: 500
|
|
17982
17991
|
};
|
|
17992
|
+
paceMs = null;
|
|
17993
|
+
constructor(e = mm) {
|
|
17994
|
+
super(), this.clock = e;
|
|
17995
|
+
}
|
|
17983
17996
|
load(e) {
|
|
17984
17997
|
this.stop(), this.data = e, this.cursor = -1;
|
|
17985
17998
|
}
|
|
17986
17999
|
play(e) {
|
|
17987
|
-
if (this.data.length
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
}
|
|
17998
|
-
if (this.isAtEnd()) {
|
|
17999
|
-
this.clearTimer(), this.setState("paused");
|
|
18000
|
+
if (this.data.length === 0) return;
|
|
18001
|
+
if (e) {
|
|
18002
|
+
let { startIndex: t, paused: n, duration: r, ...i } = e;
|
|
18003
|
+
this.config = {
|
|
18004
|
+
...this.config,
|
|
18005
|
+
...i
|
|
18006
|
+
};
|
|
18007
|
+
let a = t === void 0 ? null : this.clamp(t);
|
|
18008
|
+
if (n) {
|
|
18009
|
+
this.clearTimer(), this.seekTo(a ?? Math.max(0, this.cursor)), this.setPace(r), this.setState("paused");
|
|
18000
18010
|
return;
|
|
18001
18011
|
}
|
|
18002
|
-
|
|
18012
|
+
a !== null && (this.cursor = a - 1), this.setPace(r);
|
|
18003
18013
|
}
|
|
18014
|
+
if (this.isAtEnd()) {
|
|
18015
|
+
this.clearTimer(), this.setState("paused");
|
|
18016
|
+
return;
|
|
18017
|
+
}
|
|
18018
|
+
this.clearTimer();
|
|
18019
|
+
let t = this.paceMs ?? this.config.interval / this.config.speed;
|
|
18020
|
+
if (!(t > 0) || !Number.isFinite(t)) {
|
|
18021
|
+
this.setState("paused");
|
|
18022
|
+
return;
|
|
18023
|
+
}
|
|
18024
|
+
this.setState("playing"), t < fm || this.paceMs !== null ? this.runFrames(t) : this.timer = setInterval(() => this.advance(1), t);
|
|
18004
18025
|
}
|
|
18005
18026
|
pause() {
|
|
18006
18027
|
this.clearTimer(), this.setState("paused");
|
|
@@ -18019,7 +18040,10 @@ var fm = class extends xf {
|
|
|
18019
18040
|
}));
|
|
18020
18041
|
}
|
|
18021
18042
|
setSpeed(e) {
|
|
18022
|
-
this.config
|
|
18043
|
+
this.config = {
|
|
18044
|
+
...this.config,
|
|
18045
|
+
speed: e
|
|
18046
|
+
}, this.paceMs = null, this.state === "playing" && this.play();
|
|
18023
18047
|
}
|
|
18024
18048
|
getState() {
|
|
18025
18049
|
return this.state;
|
|
@@ -18038,41 +18062,62 @@ var fm = class extends xf {
|
|
|
18038
18062
|
dispose() {
|
|
18039
18063
|
this.stop(), this.removeAllListeners(), this.data = [];
|
|
18040
18064
|
}
|
|
18041
|
-
|
|
18065
|
+
setPace(e) {
|
|
18066
|
+
this.paceMs = e !== void 0 && e > 0 && Number.isFinite(e) ? e / Math.max(1, this.data.length - 1 - this.cursor) : null;
|
|
18067
|
+
}
|
|
18068
|
+
runFrames(e) {
|
|
18069
|
+
let t = this.run, n = this.clock.now(), r = 0, i = () => {
|
|
18070
|
+
if (t !== this.run || this.state !== "playing") return;
|
|
18071
|
+
this.frameHandle = null;
|
|
18072
|
+
let a = this.clock.now();
|
|
18073
|
+
r += Math.min(50, Math.max(0, a - n)), n = a;
|
|
18074
|
+
let o = Math.floor(r / e);
|
|
18075
|
+
try {
|
|
18076
|
+
o > 0 && (r -= o * e, this.advance(o));
|
|
18077
|
+
} finally {
|
|
18078
|
+
t === this.run && this.state === "playing" && this.frameHandle === null && (this.frameHandle = this.clock.frame(i));
|
|
18079
|
+
}
|
|
18080
|
+
};
|
|
18081
|
+
this.frameHandle = this.clock.frame(i);
|
|
18082
|
+
}
|
|
18083
|
+
advance(e) {
|
|
18042
18084
|
if (this.isAtEnd()) {
|
|
18043
|
-
this.
|
|
18085
|
+
this.finish();
|
|
18044
18086
|
return;
|
|
18045
18087
|
}
|
|
18046
|
-
this.cursor
|
|
18088
|
+
this.cursor = Math.min(this.data.length - 1, this.cursor + e), this.emit("bar", {
|
|
18047
18089
|
bar: this.data[this.cursor],
|
|
18048
18090
|
index: this.cursor,
|
|
18049
18091
|
total: this.data.length
|
|
18050
|
-
}), this.isAtEnd() &&
|
|
18092
|
+
}), this.isAtEnd() && this.finish();
|
|
18093
|
+
}
|
|
18094
|
+
finish() {
|
|
18095
|
+
this.clearTimer(), this.setState("paused"), this.emit("complete", void 0);
|
|
18051
18096
|
}
|
|
18052
18097
|
clamp(e) {
|
|
18053
18098
|
return Number.isFinite(e) ? Math.max(0, Math.min(Math.floor(e), this.data.length - 1)) : 0;
|
|
18054
18099
|
}
|
|
18055
18100
|
clearTimer() {
|
|
18056
|
-
this.timer &&= (clearInterval(this.timer), null);
|
|
18101
|
+
this.run++, this.timer &&= (clearInterval(this.timer), null), this.frameHandle !== null && (this.clock.cancel(this.frameHandle), this.frameHandle = null);
|
|
18057
18102
|
}
|
|
18058
18103
|
setState(e) {
|
|
18059
18104
|
this.state !== e && (this.state = e, this.emit("stateChange", e));
|
|
18060
18105
|
}
|
|
18061
|
-
},
|
|
18106
|
+
}, gm = 64, _m = 3, vm = 3;
|
|
18062
18107
|
function $(e) {
|
|
18063
18108
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
18064
18109
|
}
|
|
18065
|
-
function
|
|
18110
|
+
function ym(e) {
|
|
18066
18111
|
return Array.isArray(e) ? e : [];
|
|
18067
18112
|
}
|
|
18068
|
-
function
|
|
18113
|
+
function bm(e, t) {
|
|
18069
18114
|
return typeof e == "string" ? e : t;
|
|
18070
18115
|
}
|
|
18071
|
-
function
|
|
18116
|
+
function xm(e, t) {
|
|
18072
18117
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
18073
18118
|
}
|
|
18074
|
-
function
|
|
18075
|
-
if (!$(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length >
|
|
18119
|
+
function Sm(e) {
|
|
18120
|
+
if (!$(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length > Cm || !$(e.style)) return null;
|
|
18076
18121
|
let t = [];
|
|
18077
18122
|
for (let n of e.anchors) {
|
|
18078
18123
|
if (!$(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
|
|
@@ -18095,30 +18140,30 @@ function ym(e) {
|
|
|
18095
18140
|
visible: typeof e.visible == "boolean" ? e.visible : !0,
|
|
18096
18141
|
locked: typeof e.locked == "boolean" ? e.locked : !1,
|
|
18097
18142
|
options: $(e.options) ? e.options : void 0,
|
|
18098
|
-
group:
|
|
18143
|
+
group: Em(e.group),
|
|
18099
18144
|
meta: $(e.meta) ? e.meta : void 0
|
|
18100
18145
|
};
|
|
18101
18146
|
}
|
|
18102
|
-
var
|
|
18103
|
-
function
|
|
18104
|
-
if (!(!$(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length >
|
|
18147
|
+
var Cm = 5e3, wm = 64, Tm = 80;
|
|
18148
|
+
function Em(e) {
|
|
18149
|
+
if (!(!$(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length > wm)) return {
|
|
18105
18150
|
id: e.id,
|
|
18106
|
-
name: e.name.slice(0,
|
|
18151
|
+
name: e.name.slice(0, Tm)
|
|
18107
18152
|
};
|
|
18108
18153
|
}
|
|
18109
|
-
function
|
|
18154
|
+
function Dm(e) {
|
|
18110
18155
|
return !$(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
|
|
18111
18156
|
}
|
|
18112
|
-
function
|
|
18157
|
+
function Om(e) {
|
|
18113
18158
|
if (!$(e)) return;
|
|
18114
|
-
let t = {}, n =
|
|
18159
|
+
let t = {}, n = ym(e.colors).filter((e) => typeof e == "string");
|
|
18115
18160
|
n.length > 0 && (t.colors = n);
|
|
18116
|
-
let r =
|
|
18161
|
+
let r = ym(e.lineWidths).filter((e) => typeof e == "number" && Number.isFinite(e) && e > 0);
|
|
18117
18162
|
r.length > 0 && (t.lineWidths = r), typeof e.opacity == "number" && Number.isFinite(e.opacity) && (t.opacity = Math.min(1, Math.max(0, e.opacity)));
|
|
18118
18163
|
let i = Oe(e.plots);
|
|
18119
18164
|
return i && (t.plots = i), Object.keys(t).length > 0 ? t : void 0;
|
|
18120
18165
|
}
|
|
18121
|
-
var
|
|
18166
|
+
var km = [
|
|
18122
18167
|
"crossingUp",
|
|
18123
18168
|
"crossingDown",
|
|
18124
18169
|
"crossing",
|
|
@@ -18127,9 +18172,9 @@ var Em = [
|
|
|
18127
18172
|
"movesUp",
|
|
18128
18173
|
"movesDown"
|
|
18129
18174
|
];
|
|
18130
|
-
function
|
|
18175
|
+
function Am(e) {
|
|
18131
18176
|
if (!$(e) || typeof e.id != "string") return null;
|
|
18132
|
-
let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r =
|
|
18177
|
+
let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r = km.find((t) => t === e.condition) ?? "crossing", i = dm(e), a = i.target !== void 0 || r === "movesUp" || r === "movesDown";
|
|
18133
18178
|
return n === null && !t && !a ? null : {
|
|
18134
18179
|
id: e.id,
|
|
18135
18180
|
price: n ?? NaN,
|
|
@@ -18138,43 +18183,43 @@ function Dm(e) {
|
|
|
18138
18183
|
message: typeof e.message == "string" ? e.message : void 0,
|
|
18139
18184
|
triggered: e.triggered === !0,
|
|
18140
18185
|
repeating: e.repeating === !0,
|
|
18141
|
-
channel:
|
|
18186
|
+
channel: bm(e.channel, "price"),
|
|
18142
18187
|
label: typeof e.label == "string" ? e.label : void 0,
|
|
18143
18188
|
...i,
|
|
18144
18189
|
...e.expired === !0 ? { expired: !0 } : {}
|
|
18145
18190
|
};
|
|
18146
18191
|
}
|
|
18147
|
-
function
|
|
18192
|
+
function jm(e) {
|
|
18148
18193
|
return !$(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
|
|
18149
18194
|
}
|
|
18150
|
-
var
|
|
18151
|
-
function
|
|
18195
|
+
var Mm = 4e3;
|
|
18196
|
+
function Nm(e) {
|
|
18152
18197
|
if (!$(e)) return;
|
|
18153
18198
|
let t = {}, n = [];
|
|
18154
18199
|
for (let [r, i] of Object.entries(e)) {
|
|
18155
18200
|
let e = Ee(i);
|
|
18156
18201
|
n.push(...e.rejected);
|
|
18157
18202
|
let a = Object.fromEntries(Object.entries(e.overrides).filter(([, e]) => e !== null));
|
|
18158
|
-
Object.keys(a).length > 0 && (t[r.slice(0,
|
|
18203
|
+
Object.keys(a).length > 0 && (t[r.slice(0, gm)] = a);
|
|
18159
18204
|
}
|
|
18160
18205
|
return n.length > 0 && console.warn(`Saved style overrides left out: ${[...new Set(n)].join(", ")}`), t;
|
|
18161
18206
|
}
|
|
18162
|
-
function
|
|
18163
|
-
if (!$(e)) return
|
|
18164
|
-
typeof e.version == "number" && e.version >
|
|
18207
|
+
function Pm(e) {
|
|
18208
|
+
if (!$(e)) return Fm();
|
|
18209
|
+
typeof e.version == "number" && e.version > vm && console.warn(`Chart state from a newer version (${e.version}); loading what this version understands.`);
|
|
18165
18210
|
let t = $(e.viewport) ? e.viewport : {}, n = [];
|
|
18166
|
-
for (let t of
|
|
18211
|
+
for (let t of ym(e.indicators)) $(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || $(t.params) && n.push({
|
|
18167
18212
|
id: t.id,
|
|
18168
18213
|
instanceId: t.instanceId,
|
|
18169
18214
|
params: t.params,
|
|
18170
18215
|
position: typeof t.position == "string" ? t.position : void 0,
|
|
18171
|
-
style:
|
|
18216
|
+
style: Om(t.style),
|
|
18172
18217
|
visible: typeof t.visible == "boolean" ? t.visible : void 0,
|
|
18173
18218
|
levels: Array.isArray(t.levels) ? t.levels.filter((e) => typeof e == "number" && Number.isFinite(e)) : void 0,
|
|
18174
18219
|
pane: typeof t.pane == "string" ? t.pane : void 0,
|
|
18175
18220
|
scale: t.scale === "left" ? "left" : void 0,
|
|
18176
18221
|
paneStyle: ke(t.paneStyle) ?? void 0,
|
|
18177
|
-
paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize,
|
|
18222
|
+
paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize, Mm) : void 0,
|
|
18178
18223
|
paneOrder: typeof t.paneOrder == "number" && Number.isInteger(t.paneOrder) && t.paneOrder >= 0 ? t.paneOrder : void 0,
|
|
18179
18224
|
paneCollapsed: t.paneCollapsed === !0 ? !0 : void 0,
|
|
18180
18225
|
paneMaximized: t.paneMaximized === !0 ? !0 : void 0,
|
|
@@ -18183,37 +18228,37 @@ function jm(e) {
|
|
|
18183
18228
|
panePercent: t.panePercent === !0 ? !0 : void 0
|
|
18184
18229
|
}));
|
|
18185
18230
|
let r = [];
|
|
18186
|
-
for (let t of
|
|
18187
|
-
let e =
|
|
18231
|
+
for (let t of ym(e.drawings)) {
|
|
18232
|
+
let e = Sm(t);
|
|
18188
18233
|
e && r.push(e);
|
|
18189
18234
|
}
|
|
18190
18235
|
let i = [];
|
|
18191
|
-
for (let t of
|
|
18192
|
-
let e =
|
|
18236
|
+
for (let t of ym(e.orders)) {
|
|
18237
|
+
let e = Dm(t);
|
|
18193
18238
|
e && i.push(e);
|
|
18194
18239
|
}
|
|
18195
18240
|
let a = [];
|
|
18196
|
-
for (let t of
|
|
18197
|
-
let e =
|
|
18241
|
+
for (let t of ym(e.positions)) {
|
|
18242
|
+
let e = jm(t);
|
|
18198
18243
|
e && a.push(e);
|
|
18199
18244
|
}
|
|
18200
18245
|
let o = [];
|
|
18201
|
-
for (let t of
|
|
18202
|
-
let e =
|
|
18246
|
+
for (let t of ym(e.alerts)) {
|
|
18247
|
+
let e = Am(t);
|
|
18203
18248
|
e && o.push(e);
|
|
18204
18249
|
}
|
|
18205
|
-
let s =
|
|
18250
|
+
let s = Nm(e.overrides);
|
|
18206
18251
|
return {
|
|
18207
18252
|
version: typeof e.version == "number" && Array.isArray(e.indicators) ? e.version : 1,
|
|
18208
|
-
timestamp:
|
|
18253
|
+
timestamp: xm(e.timestamp, Date.now()),
|
|
18209
18254
|
symbol: typeof e.symbol == "string" ? e.symbol : void 0,
|
|
18210
18255
|
timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
|
|
18211
|
-
chartType:
|
|
18256
|
+
chartType: bm(e.chartType, "candlestick"),
|
|
18212
18257
|
...e.chartTypeOptions === void 0 ? {} : { chartTypeOptions: De(e.chartTypeOptions) },
|
|
18213
18258
|
viewport: {
|
|
18214
|
-
barWidth:
|
|
18215
|
-
barSpacing:
|
|
18216
|
-
offset:
|
|
18259
|
+
barWidth: xm(t.barWidth, 8),
|
|
18260
|
+
barSpacing: xm(t.barSpacing, 2),
|
|
18261
|
+
offset: xm(t.offset, 0)
|
|
18217
18262
|
},
|
|
18218
18263
|
theme: typeof e.theme == "string" ? e.theme : void 0,
|
|
18219
18264
|
...s ? { overrides: s } : {},
|
|
@@ -18225,7 +18270,7 @@ function jm(e) {
|
|
|
18225
18270
|
alerts: o
|
|
18226
18271
|
};
|
|
18227
18272
|
}
|
|
18228
|
-
function
|
|
18273
|
+
function Fm() {
|
|
18229
18274
|
return {
|
|
18230
18275
|
version: 1,
|
|
18231
18276
|
timestamp: Date.now(),
|
|
@@ -18242,10 +18287,10 @@ function Mm() {
|
|
|
18242
18287
|
alerts: []
|
|
18243
18288
|
};
|
|
18244
18289
|
}
|
|
18245
|
-
var
|
|
18290
|
+
var Im = class {
|
|
18246
18291
|
static capture(e, t) {
|
|
18247
18292
|
return {
|
|
18248
|
-
version: e.getIndicators ?
|
|
18293
|
+
version: e.getIndicators ? vm : 1,
|
|
18249
18294
|
timestamp: Date.now(),
|
|
18250
18295
|
chartType: t?.chartType ?? "candlestick",
|
|
18251
18296
|
...t?.chartTypeOptions && Object.keys(t.chartTypeOptions).length > 0 ? { chartTypeOptions: t.chartTypeOptions } : {},
|
|
@@ -18269,7 +18314,7 @@ var Nm = class {
|
|
|
18269
18314
|
return JSON.stringify(e);
|
|
18270
18315
|
}
|
|
18271
18316
|
static deserialize(e) {
|
|
18272
|
-
return
|
|
18317
|
+
return Pm(JSON.parse(e));
|
|
18273
18318
|
}
|
|
18274
18319
|
static saveToStorage(e, t) {
|
|
18275
18320
|
localStorage.setItem(e, this.serialize(t));
|
|
@@ -18296,7 +18341,7 @@ var Nm = class {
|
|
|
18296
18341
|
}, n.click();
|
|
18297
18342
|
});
|
|
18298
18343
|
}
|
|
18299
|
-
},
|
|
18344
|
+
}, Lm = class {
|
|
18300
18345
|
undoStack = [];
|
|
18301
18346
|
redoStack = [];
|
|
18302
18347
|
maxHistory = 50;
|
|
@@ -18345,7 +18390,7 @@ var Nm = class {
|
|
|
18345
18390
|
redoCount: this.redoStack.length
|
|
18346
18391
|
};
|
|
18347
18392
|
}
|
|
18348
|
-
},
|
|
18393
|
+
}, Rm = [
|
|
18349
18394
|
"Time",
|
|
18350
18395
|
"Open",
|
|
18351
18396
|
"High",
|
|
@@ -18353,29 +18398,29 @@ var Nm = class {
|
|
|
18353
18398
|
"Close",
|
|
18354
18399
|
"Volume"
|
|
18355
18400
|
];
|
|
18356
|
-
function
|
|
18401
|
+
function zm(e) {
|
|
18357
18402
|
return new Date(be(e)).toISOString();
|
|
18358
18403
|
}
|
|
18359
|
-
function
|
|
18404
|
+
function Bm(e) {
|
|
18360
18405
|
let t = /^[=+\-@\t\r]/.test(e) && !/^-?\d/.test(e) ? `'${e}` : e;
|
|
18361
18406
|
return /[",\r\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
18362
18407
|
}
|
|
18363
|
-
var
|
|
18408
|
+
var Vm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), Hm = class {
|
|
18364
18409
|
static toCSV(e, t = []) {
|
|
18365
|
-
return [[...
|
|
18366
|
-
|
|
18410
|
+
return [[...Rm, ...t.map((e) => Bm(e.name))].join(","), ...e.map((e, n) => [
|
|
18411
|
+
zm(e.time),
|
|
18367
18412
|
e.open,
|
|
18368
18413
|
e.high,
|
|
18369
18414
|
e.low,
|
|
18370
18415
|
e.close,
|
|
18371
18416
|
e.volume,
|
|
18372
|
-
...t.map((e) =>
|
|
18417
|
+
...t.map((e) => Vm(e.values[n]))
|
|
18373
18418
|
].join(","))].join("\n");
|
|
18374
18419
|
}
|
|
18375
18420
|
static toJSON(e, t = []) {
|
|
18376
18421
|
return JSON.stringify(e.map((e, n) => {
|
|
18377
18422
|
let r = {
|
|
18378
|
-
time:
|
|
18423
|
+
time: zm(e.time),
|
|
18379
18424
|
open: e.open,
|
|
18380
18425
|
high: e.high,
|
|
18381
18426
|
low: e.low,
|
|
@@ -18393,11 +18438,28 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18393
18438
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
18394
18439
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
18395
18440
|
}
|
|
18396
|
-
}
|
|
18441
|
+
};
|
|
18442
|
+
//#endregion
|
|
18443
|
+
//#region src/features/replayReveal.ts
|
|
18444
|
+
function Um(e, t, n = -Infinity) {
|
|
18445
|
+
return t === null ? e : e.filter((e) => e.time >= n && e.time < t);
|
|
18446
|
+
}
|
|
18447
|
+
function Wm(e, t, n = -Infinity) {
|
|
18448
|
+
return t === null ? e : e.filter((e) => e.entryTime >= n && e.entryTime < t).map((e) => {
|
|
18449
|
+
if (e.exitTime === void 0 || e.exitTime < t) return e;
|
|
18450
|
+
let { exitTime: n, exitPrice: r, pnl: i, pnlPercent: a, ...o } = e;
|
|
18451
|
+
return o;
|
|
18452
|
+
});
|
|
18453
|
+
}
|
|
18454
|
+
//#endregion
|
|
18455
|
+
//#region src/features/SignalMarkerManager.ts
|
|
18456
|
+
var Gm = 1, Km = 3, qm = class extends xf {
|
|
18397
18457
|
markers = [];
|
|
18398
18458
|
style = { ...re };
|
|
18399
18459
|
requestRender = null;
|
|
18400
18460
|
dataGetter = null;
|
|
18461
|
+
revealUntil = null;
|
|
18462
|
+
revealFrom = -Infinity;
|
|
18401
18463
|
setRequestRender(e) {
|
|
18402
18464
|
this.requestRender = e;
|
|
18403
18465
|
}
|
|
@@ -18414,7 +18476,7 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18414
18476
|
return { ...this.style };
|
|
18415
18477
|
}
|
|
18416
18478
|
addMarker(e) {
|
|
18417
|
-
let t = e.id ?? `tc_signal_${
|
|
18479
|
+
let t = e.id ?? `tc_signal_${Gm++}`, n = {
|
|
18418
18480
|
...e,
|
|
18419
18481
|
id: t
|
|
18420
18482
|
};
|
|
@@ -18432,36 +18494,42 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18432
18494
|
setMarkers(e) {
|
|
18433
18495
|
this.markers = [...e], this.requestRender?.();
|
|
18434
18496
|
}
|
|
18497
|
+
setRevealUntil(e, t = -Infinity) {
|
|
18498
|
+
e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
|
|
18499
|
+
}
|
|
18500
|
+
shownMarkers() {
|
|
18501
|
+
return [...Um(this.markers, this.revealUntil, this.revealFrom)];
|
|
18502
|
+
}
|
|
18435
18503
|
markerAt(e, t) {
|
|
18436
18504
|
let n = this.dataGetter?.();
|
|
18437
18505
|
if (!n || n.length === 0) return null;
|
|
18438
18506
|
let { chartRect: r } = t;
|
|
18439
18507
|
if (e.x < r.x || e.x > r.x + r.width || e.y < r.y || e.y > r.y + r.height) return null;
|
|
18440
|
-
let a = this.style.arrowSize ?? 12;
|
|
18441
|
-
for (let r =
|
|
18442
|
-
let
|
|
18443
|
-
if (Math.abs(e.x -
|
|
18508
|
+
let a = this.style.arrowSize ?? 12, o = Um(this.markers, this.revealUntil, this.revealFrom);
|
|
18509
|
+
for (let r = o.length - 1; r >= 0; r--) {
|
|
18510
|
+
let s = o[r], c = l(i(s.time, n), t), u = T(s.price, t), d = a * Math.max(.6, Math.min(1, s.confidence)), f = s.direction === "long" ? u - d : (s.direction, u - d * .4), p = s.direction === "long" ? u + d * .4 : s.direction === "short" ? u + d : u + d * .4;
|
|
18511
|
+
if (Math.abs(e.x - c) <= d * .6 + Km && e.y >= f - Km && e.y <= p + Km) return s;
|
|
18444
18512
|
}
|
|
18445
18513
|
return null;
|
|
18446
18514
|
}
|
|
18447
18515
|
render(e, t, n) {
|
|
18448
|
-
let r = this.dataGetter?.();
|
|
18449
|
-
if (!r || r.length === 0 ||
|
|
18450
|
-
let { chartRect:
|
|
18451
|
-
e.save(), e.beginPath(), e.rect(
|
|
18452
|
-
for (let
|
|
18453
|
-
let
|
|
18454
|
-
if (
|
|
18455
|
-
let f = this.resolveColor(
|
|
18456
|
-
if (this.renderArrow(e,
|
|
18457
|
-
e.font = `10px ${n.font.family}`, e.fillStyle = f, e.textAlign = "center", e.textBaseline =
|
|
18458
|
-
let t =
|
|
18459
|
-
e.fillText(
|
|
18516
|
+
let r = this.dataGetter?.(), a = Um(this.markers, this.revealUntil, this.revealFrom);
|
|
18517
|
+
if (!r || r.length === 0 || a.length === 0) return;
|
|
18518
|
+
let { chartRect: o } = t, s = this.style, c = s.arrowSize ?? 12;
|
|
18519
|
+
e.save(), e.beginPath(), e.rect(o.x, o.y, o.width, o.height), e.clip();
|
|
18520
|
+
for (let u of a) {
|
|
18521
|
+
let a = l(i(u.time, r), t), d = T(u.price, t);
|
|
18522
|
+
if (a < o.x - c || a > o.x + o.width + c || d < o.y - c || d > o.y + o.height + c) continue;
|
|
18523
|
+
let f = this.resolveColor(u, s), p = c * Math.max(.6, Math.min(1, u.confidence));
|
|
18524
|
+
if (this.renderArrow(e, a, d, u.direction, p, f), s.showLabel && u.label) {
|
|
18525
|
+
e.font = `10px ${n.font.family}`, e.fillStyle = f, e.textAlign = "center", e.textBaseline = u.direction === "long" ? "top" : "bottom";
|
|
18526
|
+
let t = u.direction === "long" ? d + p + 3 : d - p - 3;
|
|
18527
|
+
e.fillText(u.label, a, t);
|
|
18460
18528
|
}
|
|
18461
|
-
if (
|
|
18462
|
-
e.font = `9px ${n.font.family}`, e.fillStyle = f, e.globalAlpha = .7, e.textAlign = "center", e.textBaseline =
|
|
18463
|
-
let t =
|
|
18464
|
-
e.fillText(`${Math.round(
|
|
18529
|
+
if (s.showConfidence && u.confidence < 1) {
|
|
18530
|
+
e.font = `9px ${n.font.family}`, e.fillStyle = f, e.globalAlpha = .7, e.textAlign = "center", e.textBaseline = u.direction === "long" ? "top" : "bottom";
|
|
18531
|
+
let t = u.direction === "long" ? d + p + (u.label ? 14 : 3) : d - p - (u.label ? 14 : 3);
|
|
18532
|
+
e.fillText(`${Math.round(u.confidence * 100)}%`, a, t), e.globalAlpha = 1;
|
|
18465
18533
|
}
|
|
18466
18534
|
}
|
|
18467
18535
|
e.restore();
|
|
@@ -18478,11 +18546,13 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18478
18546
|
renderArrow(e, t, n, r, i, a) {
|
|
18479
18547
|
e.fillStyle = a, e.beginPath(), r === "long" ? (e.moveTo(t, n - i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n + i * .4), e.lineTo(t + i * .2, n + i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : r === "short" ? (e.moveTo(t, n + i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n - i * .4), e.lineTo(t + i * .2, n - i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : e.arc(t, n, i * .4, 0, Math.PI * 2), e.closePath(), e.fill();
|
|
18480
18548
|
}
|
|
18481
|
-
},
|
|
18549
|
+
}, Jm = 1, Ym = class extends xf {
|
|
18482
18550
|
zones = [];
|
|
18483
18551
|
style = { ...ae };
|
|
18484
18552
|
requestRender = null;
|
|
18485
18553
|
dataGetter = null;
|
|
18554
|
+
revealUntil = null;
|
|
18555
|
+
revealFrom = -Infinity;
|
|
18486
18556
|
pricePrecision = 2;
|
|
18487
18557
|
setRequestRender(e) {
|
|
18488
18558
|
this.requestRender = e;
|
|
@@ -18503,7 +18573,7 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18503
18573
|
return { ...this.style };
|
|
18504
18574
|
}
|
|
18505
18575
|
addZone(e) {
|
|
18506
|
-
let t = e.id ?? `tc_zone_${
|
|
18576
|
+
let t = e.id ?? `tc_zone_${Jm++}`, n = {
|
|
18507
18577
|
...e,
|
|
18508
18578
|
id: t
|
|
18509
18579
|
};
|
|
@@ -18528,12 +18598,18 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18528
18598
|
setZones(e) {
|
|
18529
18599
|
this.zones = [...e], this.requestRender?.();
|
|
18530
18600
|
}
|
|
18601
|
+
setRevealUntil(e, t = -Infinity) {
|
|
18602
|
+
e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
|
|
18603
|
+
}
|
|
18604
|
+
shownZones() {
|
|
18605
|
+
return [...Wm(this.zones, this.revealUntil, this.revealFrom)];
|
|
18606
|
+
}
|
|
18531
18607
|
render(e, t, n) {
|
|
18532
|
-
let r = this.dataGetter?.();
|
|
18533
|
-
if (!r || r.length === 0 ||
|
|
18534
|
-
let { chartRect:
|
|
18535
|
-
e.save(), e.beginPath(), e.rect(
|
|
18536
|
-
for (let
|
|
18608
|
+
let r = this.dataGetter?.(), i = Wm(this.zones, this.revealUntil, this.revealFrom);
|
|
18609
|
+
if (!r || r.length === 0 || i.length === 0) return;
|
|
18610
|
+
let { chartRect: a } = t, o = this.style;
|
|
18611
|
+
e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
|
|
18612
|
+
for (let a of i) this.renderZone(e, a, r, t, n, o);
|
|
18537
18613
|
e.restore();
|
|
18538
18614
|
}
|
|
18539
18615
|
renderZone(e, t, n, r, a, o) {
|
|
@@ -18552,7 +18628,7 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18552
18628
|
}
|
|
18553
18629
|
o.showLabel && t.label && (e.font = `9px ${a.font.family}`, e.fillStyle = x, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, p + 4, h + 3), e.globalAlpha = 1);
|
|
18554
18630
|
}
|
|
18555
|
-
},
|
|
18631
|
+
}, Xm = class {
|
|
18556
18632
|
active = !1;
|
|
18557
18633
|
startBar = 0;
|
|
18558
18634
|
startPrice = 0;
|
|
@@ -18565,35 +18641,35 @@ var Rm = (e) => e == null || !Number.isFinite(e) ? "" : String(e), zm = class {
|
|
|
18565
18641
|
}
|
|
18566
18642
|
begin(e, t, n) {
|
|
18567
18643
|
let r = Math.round(g(e.x, t)), i = h(e.y, t);
|
|
18568
|
-
this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime =
|
|
18644
|
+
this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = Zm(r, n), this.endTime = this.startTime, this.active = !0;
|
|
18569
18645
|
}
|
|
18570
18646
|
update(e, t, n) {
|
|
18571
18647
|
if (!this.active) return;
|
|
18572
18648
|
let r = Math.round(g(e.x, t));
|
|
18573
|
-
this.endBar = r, this.endPrice = h(e.y, t), this.endTime =
|
|
18649
|
+
this.endBar = r, this.endPrice = h(e.y, t), this.endTime = Zm(r, n);
|
|
18574
18650
|
}
|
|
18575
18651
|
end() {
|
|
18576
18652
|
this.active = !1;
|
|
18577
18653
|
}
|
|
18578
18654
|
render(e, t, n) {
|
|
18579
18655
|
if (!this.active) return;
|
|
18580
|
-
let r = l(this.startBar, t), i = l(this.endBar, t), a = T(this.startPrice, t), o = T(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), u = Math.min(a, o), d = Math.max(a, o), f = c - s, p = d - u, m = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, h =
|
|
18656
|
+
let r = l(this.startBar, t), i = l(this.endBar, t), a = T(this.startPrice, t), o = T(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), u = Math.min(a, o), d = Math.max(a, o), f = c - s, p = d - u, m = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, h = rh(m, .14);
|
|
18581
18657
|
e.save();
|
|
18582
18658
|
let { chartRect: g } = t;
|
|
18583
|
-
e.beginPath(), e.rect(g.x, g.y, g.width, g.height), e.clip(), e.fillStyle = h, e.fillRect(s, u, f, p), e.strokeStyle = m, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, u + .5, f, p), e.setLineDash([]), e.strokeStyle = m, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(),
|
|
18584
|
-
let _ = Math.abs(this.endBar - this.startBar), v = this.endPrice - this.startPrice, y = this.startPrice === 0 ? 0 : v / this.startPrice * 100, b = this.startTime !== null && this.endTime !== null ?
|
|
18585
|
-
x.push(`${S}${t.formatPrice?.(C) ??
|
|
18659
|
+
e.beginPath(), e.rect(g.x, g.y, g.width, g.height), e.clip(), e.fillStyle = h, e.fillRect(s, u, f, p), e.strokeStyle = m, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, u + .5, f, p), e.setLineDash([]), e.strokeStyle = m, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), eh(e, r, a, m), eh(e, i, o, m), e.restore();
|
|
18660
|
+
let _ = Math.abs(this.endBar - this.startBar), v = this.endPrice - this.startPrice, y = this.startPrice === 0 ? 0 : v / this.startPrice * 100, b = this.startTime !== null && this.endTime !== null ? $m(Math.abs(this.endTime - this.startTime)) : null, x = [], S = v > 0 ? "+" : v < 0 ? "−" : "", C = Math.abs(v);
|
|
18661
|
+
x.push(`${S}${t.formatPrice?.(C) ?? Qm(C)} (${S}${Math.abs(y).toFixed(2)}%)`), x.push(`${_} bars${b ? " · " + b : ""}`), e.save(), th(e, i, o, x, m, n), e.restore();
|
|
18586
18662
|
}
|
|
18587
18663
|
};
|
|
18588
|
-
function
|
|
18664
|
+
function Zm(e, t) {
|
|
18589
18665
|
if (e < 0 || e >= t.length) return null;
|
|
18590
18666
|
let n = t[e].time;
|
|
18591
18667
|
return n > 0xe8d4a51000 ? n : n * 1e3;
|
|
18592
18668
|
}
|
|
18593
|
-
function
|
|
18669
|
+
function Qm(e) {
|
|
18594
18670
|
return e >= 1e3 ? e.toFixed(2) : e >= 1 ? e.toFixed(4) : e.toPrecision(4);
|
|
18595
18671
|
}
|
|
18596
|
-
function
|
|
18672
|
+
function $m(e) {
|
|
18597
18673
|
let t = e / 1e3;
|
|
18598
18674
|
if (t < 60) return `${t.toFixed(0)}s`;
|
|
18599
18675
|
let n = t / 60;
|
|
@@ -18605,10 +18681,10 @@ function Jm(e) {
|
|
|
18605
18681
|
let a = i / 30;
|
|
18606
18682
|
return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
|
|
18607
18683
|
}
|
|
18608
|
-
function
|
|
18684
|
+
function eh(e, t, n, r) {
|
|
18609
18685
|
e.fillStyle = r, e.beginPath(), e.arc(t, n, 3.5, 0, Math.PI * 2), e.fill(), e.fillStyle = "#fff", e.beginPath(), e.arc(t, n, 1.5, 0, Math.PI * 2), e.fill();
|
|
18610
18686
|
}
|
|
18611
|
-
function
|
|
18687
|
+
function th(e, t, n, r, i, a) {
|
|
18612
18688
|
e.font = `600 11px ${a.font.family}`;
|
|
18613
18689
|
let o = 0;
|
|
18614
18690
|
for (let t of r) {
|
|
@@ -18616,13 +18692,13 @@ function Xm(e, t, n, r, i, a) {
|
|
|
18616
18692
|
n > o && (o = n);
|
|
18617
18693
|
}
|
|
18618
18694
|
let s = Math.ceil(o) + 16, c = r.length * 14 + 12, l = t + 8, u = n + 8, d = e.canvas.clientWidth || e.canvas.width;
|
|
18619
|
-
l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96,
|
|
18695
|
+
l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, nh(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, nh(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
|
|
18620
18696
|
for (let t = 0; t < r.length; t++) e.fillStyle = t === 0 ? i : a.textSecondary, e.fillText(r[t], l + 8, u + 6 + t * 14);
|
|
18621
18697
|
}
|
|
18622
|
-
function
|
|
18698
|
+
function nh(e, t, n, r, i, a) {
|
|
18623
18699
|
e.beginPath(), e.moveTo(t + a, n), e.arcTo(t + r, n, t + r, n + i, a), e.arcTo(t + r, n + i, t, n + i, a), e.arcTo(t, n + i, t, n, a), e.arcTo(t, n, t + r, n, a), e.closePath();
|
|
18624
18700
|
}
|
|
18625
|
-
function
|
|
18701
|
+
function rh(e, t) {
|
|
18626
18702
|
if (e.startsWith("#")) {
|
|
18627
18703
|
let n = 0, r = 0, i = 0;
|
|
18628
18704
|
return e.length === 4 ? (n = parseInt(e[1] + e[1], 16), r = parseInt(e[2] + e[2], 16), i = parseInt(e[3] + e[3], 16)) : e.length >= 7 && (n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16)), `rgba(${n},${r},${i},${t})`;
|
|
@@ -18635,7 +18711,7 @@ function Qm(e, t) {
|
|
|
18635
18711
|
}
|
|
18636
18712
|
//#endregion
|
|
18637
18713
|
//#region src/features/SelectionBoxOverlay.ts
|
|
18638
|
-
var
|
|
18714
|
+
var ih = 6, ah = class {
|
|
18639
18715
|
start = null;
|
|
18640
18716
|
current = null;
|
|
18641
18717
|
isActive() {
|
|
@@ -18667,7 +18743,7 @@ var $m = 6, eh = class {
|
|
|
18667
18743
|
let { chartRect: r } = t, i = (e) => Math.max(r.x, Math.min(r.x + r.width, e)), a = (e) => Math.max(r.y, Math.min(r.y + r.height, e)), o = i(Math.min(this.start.x, this.current.x)), s = i(Math.max(this.start.x, this.current.x)), c = a(Math.min(this.start.y, this.current.y)), l = a(Math.max(this.start.y, this.current.y));
|
|
18668
18744
|
e.save(), e.fillStyle = n.crosshair, e.globalAlpha = .1, e.fillRect(o, c, s - o, l - c), e.globalAlpha = .8, e.strokeStyle = n.crosshair, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(Math.round(o) + .5, Math.round(c) + .5, Math.round(s - o), Math.round(l - c)), e.restore();
|
|
18669
18745
|
}
|
|
18670
|
-
},
|
|
18746
|
+
}, oh = {
|
|
18671
18747
|
linear: (e) => e,
|
|
18672
18748
|
easeOutCubic: (e) => 1 - (1 - e) ** 3,
|
|
18673
18749
|
easeOutQuart: (e) => 1 - (1 - e) ** 4,
|
|
@@ -18675,7 +18751,7 @@ var $m = 6, eh = class {
|
|
|
18675
18751
|
easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
|
|
18676
18752
|
easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
|
|
18677
18753
|
spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
|
|
18678
|
-
},
|
|
18754
|
+
}, sh = class {
|
|
18679
18755
|
animations = /* @__PURE__ */ new Map();
|
|
18680
18756
|
frameId = 0;
|
|
18681
18757
|
running = !1;
|
|
@@ -18683,7 +18759,7 @@ var $m = 6, eh = class {
|
|
|
18683
18759
|
this.animations.set(e, {
|
|
18684
18760
|
startTime: -1,
|
|
18685
18761
|
duration: t.duration,
|
|
18686
|
-
easing: t.easing ??
|
|
18762
|
+
easing: t.easing ?? oh.easeOutCubic,
|
|
18687
18763
|
onUpdate: t.onUpdate,
|
|
18688
18764
|
onComplete: t.onComplete
|
|
18689
18765
|
}), this.running || (this.running = !0, this.tick());
|
|
@@ -18718,10 +18794,10 @@ var $m = 6, eh = class {
|
|
|
18718
18794
|
};
|
|
18719
18795
|
//#endregion
|
|
18720
18796
|
//#region src/finance/BaseFinanceChart.ts
|
|
18721
|
-
function
|
|
18797
|
+
function ch(e) {
|
|
18722
18798
|
return !e || e === "dark" ? O : e === "light" ? se : e;
|
|
18723
18799
|
}
|
|
18724
|
-
var
|
|
18800
|
+
var lh = class {
|
|
18725
18801
|
canvas;
|
|
18726
18802
|
ctx;
|
|
18727
18803
|
container;
|
|
@@ -18732,7 +18808,7 @@ var ih = class {
|
|
|
18732
18808
|
frameId = null;
|
|
18733
18809
|
resizeObserver;
|
|
18734
18810
|
constructor(e, t) {
|
|
18735
|
-
this.container = e, this.theme =
|
|
18811
|
+
this.container = e, this.theme = ch(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
|
|
18736
18812
|
this.updateSize(), this.requestRender();
|
|
18737
18813
|
}), this.resizeObserver.observe(e);
|
|
18738
18814
|
}
|
|
@@ -18747,12 +18823,12 @@ var ih = class {
|
|
|
18747
18823
|
}));
|
|
18748
18824
|
}
|
|
18749
18825
|
setTheme(e) {
|
|
18750
|
-
this.theme =
|
|
18826
|
+
this.theme = ch(e), this.requestRender();
|
|
18751
18827
|
}
|
|
18752
18828
|
destroy() {
|
|
18753
18829
|
this.frameId !== null && cancelAnimationFrame(this.frameId), this.resizeObserver.disconnect(), this.canvas.remove();
|
|
18754
18830
|
}
|
|
18755
|
-
},
|
|
18831
|
+
}, uh = class {
|
|
18756
18832
|
pos = null;
|
|
18757
18833
|
canvas;
|
|
18758
18834
|
onUpdate;
|
|
@@ -18784,7 +18860,7 @@ var ih = class {
|
|
|
18784
18860
|
};
|
|
18785
18861
|
//#endregion
|
|
18786
18862
|
//#region src/finance/SparklineRenderer.ts
|
|
18787
|
-
function
|
|
18863
|
+
function dh(e, t, n, r, i) {
|
|
18788
18864
|
let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
|
|
18789
18865
|
if (a.length < 2 || t <= 0 || n <= 0) return;
|
|
18790
18866
|
let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
|
|
@@ -18809,8 +18885,8 @@ function oh(e, t, n, r, i) {
|
|
|
18809
18885
|
}
|
|
18810
18886
|
//#endregion
|
|
18811
18887
|
//#region src/finance/DepthChartRenderer.ts
|
|
18812
|
-
var
|
|
18813
|
-
function
|
|
18888
|
+
var fh = 50, ph = 60, mh = 20, hh = .2;
|
|
18889
|
+
function gh(e) {
|
|
18814
18890
|
let t = [...e].sort((e, t) => t.price - e.price), n = [], r = 0;
|
|
18815
18891
|
for (let e of t) r += e.volume, n.push({
|
|
18816
18892
|
price: e.price,
|
|
@@ -18818,7 +18894,7 @@ function dh(e) {
|
|
|
18818
18894
|
});
|
|
18819
18895
|
return n;
|
|
18820
18896
|
}
|
|
18821
|
-
function
|
|
18897
|
+
function _h(e) {
|
|
18822
18898
|
let t = [...e].sort((e, t) => e.price - t.price), n = [], r = 0;
|
|
18823
18899
|
for (let e of t) r += e.volume, n.push({
|
|
18824
18900
|
price: e.price,
|
|
@@ -18826,20 +18902,20 @@ function fh(e) {
|
|
|
18826
18902
|
});
|
|
18827
18903
|
return n;
|
|
18828
18904
|
}
|
|
18829
|
-
function
|
|
18905
|
+
function vh(e, t) {
|
|
18830
18906
|
return {
|
|
18831
|
-
left:
|
|
18832
|
-
right: e -
|
|
18833
|
-
top:
|
|
18834
|
-
bottom: t -
|
|
18835
|
-
plotWidth: e -
|
|
18836
|
-
plotHeight: t -
|
|
18907
|
+
left: fh,
|
|
18908
|
+
right: e - ph,
|
|
18909
|
+
top: mh,
|
|
18910
|
+
bottom: t - mh,
|
|
18911
|
+
plotWidth: e - fh - ph,
|
|
18912
|
+
plotHeight: t - mh * 2
|
|
18837
18913
|
};
|
|
18838
18914
|
}
|
|
18839
|
-
function
|
|
18915
|
+
function yh(e, t, n, r) {
|
|
18840
18916
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
18841
18917
|
}
|
|
18842
|
-
function
|
|
18918
|
+
function bh(e, t, n, r, i, a, o, s) {
|
|
18843
18919
|
let { left: c, right: l, top: u, bottom: d, plotWidth: f, plotHeight: p } = t;
|
|
18844
18920
|
e.save(), e.strokeStyle = a.grid, e.lineWidth = .5, e.fillStyle = a.axisLabel, e.font = `${a.font.sizeSmall}px ${a.font.family}`;
|
|
18845
18921
|
let m = he(0, i, 5);
|
|
@@ -18854,7 +18930,7 @@ function hh(e, t, n, r, i, a, o, s) {
|
|
|
18854
18930
|
}
|
|
18855
18931
|
e.restore();
|
|
18856
18932
|
}
|
|
18857
|
-
function
|
|
18933
|
+
function xh(e, t, n, r, i, a, o, s, c) {
|
|
18858
18934
|
if (t.length === 0) return;
|
|
18859
18935
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - e / a * f;
|
|
18860
18936
|
if (e.beginPath(), c === "bid") {
|
|
@@ -18887,14 +18963,14 @@ function gh(e, t, n, r, i, a, o, s, c) {
|
|
|
18887
18963
|
}
|
|
18888
18964
|
e.strokeStyle = s, e.lineWidth = 1.5, e.stroke();
|
|
18889
18965
|
}
|
|
18890
|
-
function
|
|
18966
|
+
function Sh(e, t, n, r, i, a, o, s, c) {
|
|
18891
18967
|
let { left: l, top: u, bottom: d, plotWidth: f } = r, p = l + (t - i) / a * f;
|
|
18892
18968
|
if (e.save(), e.strokeStyle = o.textSecondary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(p, u), e.lineTo(p, d), e.stroke(), e.restore(), s) {
|
|
18893
18969
|
let t = `Spread: ${c(n)}`;
|
|
18894
18970
|
e.save(), e.font = `${o.font.sizeSmall}px ${o.font.family}`, e.fillStyle = o.textSecondary, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t, p, u - 2), e.restore();
|
|
18895
18971
|
}
|
|
18896
18972
|
}
|
|
18897
|
-
function
|
|
18973
|
+
function Ch(e, t, n, r, i, a, o, s, c, l, u) {
|
|
18898
18974
|
let { left: d, top: f, bottom: p, plotWidth: m, plotHeight: h } = i, g = t.x;
|
|
18899
18975
|
if (g < d || g > i.right) return;
|
|
18900
18976
|
let _ = a + (g - d) / m * o, v = 0, y = "";
|
|
@@ -18920,47 +18996,47 @@ function vh(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
18920
18996
|
for (let t = 0; t < b.length; t++) e.fillText(b[t], C + 8, w + 6 + t * (c.font.sizeSmall + 4));
|
|
18921
18997
|
e.restore();
|
|
18922
18998
|
}
|
|
18923
|
-
function
|
|
18999
|
+
function wh(e) {
|
|
18924
19000
|
return e.toFixed(2);
|
|
18925
19001
|
}
|
|
18926
|
-
function
|
|
19002
|
+
function Th(e) {
|
|
18927
19003
|
return e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(0);
|
|
18928
19004
|
}
|
|
18929
|
-
function
|
|
19005
|
+
function Eh(e, t, n, r, i, a) {
|
|
18930
19006
|
let { data: o } = r;
|
|
18931
19007
|
if (o.bids.length === 0 && o.asks.length === 0 || t <= 0 || n <= 0) return;
|
|
18932
|
-
let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ??
|
|
18933
|
-
|
|
19008
|
+
let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ?? wh, m = r.volumeFormat ?? Th, h = gh(o.bids), g = _h(o.asks), _ = h.length > 0 ? h[0].price : 0, v = g.length > 0 ? g[0].price : 0, y = h.length > 0 && g.length > 0 ? (_ + v) / 2 : _ || v, b = g.length > 0 && h.length > 0 ? v - _ : 0, x = h.length > 0 ? h[h.length - 1].price : y, S = g.length > 0 ? g[g.length - 1].price : y, C = Math.max(y - x, S - y) * (1 + hh), w = y - C, T = y + C, E = T - w, D = h.length > 0 ? h[h.length - 1].cumulativeVolume : 0, O = g.length > 0 ? g[g.length - 1].cumulativeVolume : 0, k = Math.max(D, O) || 1, ee = vh(t, n);
|
|
19009
|
+
yh(e, t, n, i.background), bh(e, ee, w, T, k, i, p, m), xh(e, h, ee, w, E, k, l, s, "bid"), xh(e, g, ee, w, E, k, u, c, "ask"), d && Sh(e, y, b, ee, w, E, i, f, p), a && Ch(e, a, h, g, ee, w, E, k, i, p, m);
|
|
18934
19010
|
}
|
|
18935
19011
|
//#endregion
|
|
18936
19012
|
//#region src/finance/EquityCurveRenderer.ts
|
|
18937
|
-
var
|
|
18938
|
-
function
|
|
19013
|
+
var Dh = 70, Oh = 30, kh = 20, Ah = 20, jh = .05;
|
|
19014
|
+
function Mh(e, t) {
|
|
18939
19015
|
return {
|
|
18940
|
-
left:
|
|
18941
|
-
right: e -
|
|
18942
|
-
top:
|
|
18943
|
-
bottom: t -
|
|
18944
|
-
plotWidth: e -
|
|
18945
|
-
plotHeight: t -
|
|
19016
|
+
left: Dh,
|
|
19017
|
+
right: e - kh,
|
|
19018
|
+
top: Ah,
|
|
19019
|
+
bottom: t - Oh,
|
|
19020
|
+
plotWidth: e - Dh - kh,
|
|
19021
|
+
plotHeight: t - Ah - Oh
|
|
18946
19022
|
};
|
|
18947
19023
|
}
|
|
18948
|
-
function
|
|
19024
|
+
function Nh(e, t) {
|
|
18949
19025
|
let n = Infinity, r = -Infinity;
|
|
18950
19026
|
for (let t of e) t.value < n && (n = t.value), t.value > r && (r = t.value);
|
|
18951
19027
|
if (t) for (let e of t) e.value < n && (n = e.value), e.value > r && (r = e.value);
|
|
18952
|
-
let i = (r - n) *
|
|
19028
|
+
let i = (r - n) * jh;
|
|
18953
19029
|
return {
|
|
18954
19030
|
valMin: n - i,
|
|
18955
19031
|
valMax: r + i
|
|
18956
19032
|
};
|
|
18957
19033
|
}
|
|
18958
|
-
function
|
|
19034
|
+
function Ph(e) {
|
|
18959
19035
|
let t = [], n = -Infinity;
|
|
18960
19036
|
for (let r of e) r.value > n && (n = r.value), t.push(n);
|
|
18961
19037
|
return t;
|
|
18962
19038
|
}
|
|
18963
|
-
function
|
|
19039
|
+
function Fh(e) {
|
|
18964
19040
|
let t = 864e5;
|
|
18965
19041
|
if (365.25 * t, e < 7 * t) {
|
|
18966
19042
|
let e = new Intl.DateTimeFormat(void 0, {
|
|
@@ -18982,13 +19058,13 @@ function Ah(e) {
|
|
|
18982
19058
|
});
|
|
18983
19059
|
return (e) => n.format(new Date(e));
|
|
18984
19060
|
}
|
|
18985
|
-
function
|
|
19061
|
+
function Ih(e) {
|
|
18986
19062
|
return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
|
|
18987
19063
|
}
|
|
18988
|
-
function
|
|
19064
|
+
function Lh(e, t, n, r) {
|
|
18989
19065
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
18990
19066
|
}
|
|
18991
|
-
function
|
|
19067
|
+
function Rh(e, t, n, r, i, a, o, s, c) {
|
|
18992
19068
|
let { left: l, right: u, top: d, bottom: f, plotWidth: p, plotHeight: m } = t;
|
|
18993
19069
|
e.save(), e.strokeStyle = o.grid, e.lineWidth = .5, e.fillStyle = o.axisLabel, e.font = `${o.font.sizeSmall}px ${o.font.family}`;
|
|
18994
19070
|
let h = he(n, r, 6), g = Math.ceil(n / h) * h;
|
|
@@ -19003,21 +19079,21 @@ function Nh(e, t, n, r, i, a, o, s, c) {
|
|
|
19003
19079
|
}
|
|
19004
19080
|
e.restore();
|
|
19005
19081
|
}
|
|
19006
|
-
function
|
|
19082
|
+
function zh(e, t, n, r, i, a, o, s, c) {
|
|
19007
19083
|
if (t.length < 2) return;
|
|
19008
19084
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - (e - a) / o * f;
|
|
19009
19085
|
e.save(), e.beginPath(), e.moveTo(p(t[0].time), m(t[0].value));
|
|
19010
19086
|
for (let n = 1; n < t.length; n++) e.lineTo(p(t[n].time), m(t[n].value));
|
|
19011
19087
|
e.strokeStyle = s, e.lineWidth = c, e.lineJoin = "round", e.stroke(), e.restore();
|
|
19012
19088
|
}
|
|
19013
|
-
function
|
|
19089
|
+
function Bh(e, t, n, r, i, a, o, s) {
|
|
19014
19090
|
if (t.length < 2) return;
|
|
19015
19091
|
let { left: c, bottom: l, plotWidth: u, plotHeight: d } = n, f = (e) => c + (e - r) / i * u, p = (e) => l - (e - a) / o * d, m = e.createLinearGradient(0, n.top, 0, l);
|
|
19016
19092
|
m.addColorStop(0, s + "40"), m.addColorStop(1, "transparent"), e.save(), e.beginPath(), e.moveTo(f(t[0].time), p(t[0].value));
|
|
19017
19093
|
for (let n = 1; n < t.length; n++) e.lineTo(f(t[n].time), p(t[n].value));
|
|
19018
19094
|
e.lineTo(f(t[t.length - 1].time), l), e.lineTo(f(t[0].time), l), e.closePath(), e.fillStyle = m, e.fill(), e.restore();
|
|
19019
19095
|
}
|
|
19020
|
-
function
|
|
19096
|
+
function Vh(e, t, n, r, i, a, o, s, c) {
|
|
19021
19097
|
if (t.length < 2) return;
|
|
19022
19098
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = r, p = (e) => l + (e - i) / a * d, m = (e) => u - (e - o) / s * f;
|
|
19023
19099
|
e.save(), e.fillStyle = c, e.beginPath(), e.moveTo(p(t[0].time), m(n[0]));
|
|
@@ -19025,12 +19101,12 @@ function Ih(e, t, n, r, i, a, o, s, c) {
|
|
|
19025
19101
|
for (let n = t.length - 1; n >= 0; n--) e.lineTo(p(t[n].time), m(t[n].value));
|
|
19026
19102
|
e.closePath(), e.fill(), e.restore();
|
|
19027
19103
|
}
|
|
19028
|
-
function
|
|
19104
|
+
function Hh(e, t, n, r, i, a, o, s, c, l) {
|
|
19029
19105
|
if (t.length === 0) return;
|
|
19030
19106
|
let { left: u, bottom: d, plotWidth: f, plotHeight: p } = n, m = t[t.length - 1], h = u + (m.time - r) / i * f, g = d - (m.value - a) / o * p;
|
|
19031
19107
|
e.save(), e.font = `${l.font.sizeSmall}px ${l.font.family}`, e.fillStyle = c, e.textAlign = "left", e.textBaseline = "middle", e.fillText(s, h + 4, g), e.restore();
|
|
19032
19108
|
}
|
|
19033
|
-
function
|
|
19109
|
+
function Uh(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
19034
19110
|
let { left: f, top: p, bottom: m, plotWidth: h, plotHeight: g } = i, _ = t.x;
|
|
19035
19111
|
if (_ < f || _ > i.right) return;
|
|
19036
19112
|
e.save(), e.strokeStyle = l.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(_, p), e.lineTo(_, m), e.stroke(), e.restore();
|
|
@@ -19048,15 +19124,15 @@ function Rh(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
19048
19124
|
for (let t = 0; t < S.length; t++) e.fillText(S[t], D + 8, O + 6 + t * (l.font.sizeSmall + 4));
|
|
19049
19125
|
e.restore();
|
|
19050
19126
|
}
|
|
19051
|
-
function
|
|
19127
|
+
function Wh(e, t, n, r, i, a) {
|
|
19052
19128
|
let { data: o } = r;
|
|
19053
19129
|
if (o.length < 2 || t <= 0 || n <= 0) return;
|
|
19054
|
-
let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ??
|
|
19055
|
-
|
|
19130
|
+
let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ?? Ih, { valMin: g, valMax: _ } = Nh(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? Fh(x), C = Mh(t, n);
|
|
19131
|
+
Lh(e, t, n, i.background), Rh(e, C, g, _, y, b, i, h, S), l && Vh(e, o, Ph(o), C, y, x, g, v, u), d && Bh(e, o, C, y, x, g, v, s), zh(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (zh(e, f, C, y, x, g, v, p, 1), Hh(e, f, C, y, x, g, v, m, p, i)), a && Uh(e, a, o, f, C, y, x, g, v, i, S, h);
|
|
19056
19132
|
}
|
|
19057
19133
|
//#endregion
|
|
19058
19134
|
//#region src/finance/HeatmapLayout.ts
|
|
19059
|
-
function
|
|
19135
|
+
function Gh(e, t, n) {
|
|
19060
19136
|
if (e.length === 0) return [];
|
|
19061
19137
|
let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
|
|
19062
19138
|
for (let a = 0; a < r; a++) {
|
|
@@ -19073,7 +19149,7 @@ function Bh(e, t, n) {
|
|
|
19073
19149
|
}
|
|
19074
19150
|
return c;
|
|
19075
19151
|
}
|
|
19076
|
-
function
|
|
19152
|
+
function Kh(e, t) {
|
|
19077
19153
|
let n = e.reduce((e, t) => e + t, 0);
|
|
19078
19154
|
if (n === 0 || t === 0) return Infinity;
|
|
19079
19155
|
let r = 0;
|
|
@@ -19083,7 +19159,7 @@ function Vh(e, t) {
|
|
|
19083
19159
|
}
|
|
19084
19160
|
return r;
|
|
19085
19161
|
}
|
|
19086
|
-
function
|
|
19162
|
+
function qh(e, t, n, r, i, a) {
|
|
19087
19163
|
let o = r ? n.height : n.width, s = e.reduce((e, t) => e + t, 0), c = o > 0 ? s / o : 0, l = 0;
|
|
19088
19164
|
for (let o = 0; o < e.length; o++) {
|
|
19089
19165
|
let s = c > 0 ? e[o] / c : 0, u;
|
|
@@ -19103,19 +19179,19 @@ function Hh(e, t, n, r, i, a) {
|
|
|
19103
19179
|
}), l += s;
|
|
19104
19180
|
}
|
|
19105
19181
|
}
|
|
19106
|
-
function
|
|
19182
|
+
function Jh(e, t, n, r, i) {
|
|
19107
19183
|
if (e.length === 0) return;
|
|
19108
19184
|
let a = n.width >= n.height, o = a ? n.height : n.width;
|
|
19109
19185
|
if (e.length === 1) {
|
|
19110
|
-
|
|
19186
|
+
qh(e, t, n, a, r, i);
|
|
19111
19187
|
return;
|
|
19112
19188
|
}
|
|
19113
19189
|
let s = [], c = [], l = 0;
|
|
19114
19190
|
for (; l < e.length;) {
|
|
19115
19191
|
let u = [...s, e[l]];
|
|
19116
|
-
if (s.length === 0 ||
|
|
19192
|
+
if (s.length === 0 || Kh(u, o) <= Kh(s, o)) s.push(e[l]), c.push(t[l]), l++;
|
|
19117
19193
|
else {
|
|
19118
|
-
|
|
19194
|
+
qh(s, c, n, a, r, i);
|
|
19119
19195
|
let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
|
|
19120
19196
|
n = a ? {
|
|
19121
19197
|
x: n.x + d,
|
|
@@ -19127,28 +19203,28 @@ function Uh(e, t, n, r, i) {
|
|
|
19127
19203
|
y: n.y + d,
|
|
19128
19204
|
width: n.width,
|
|
19129
19205
|
height: n.height - d
|
|
19130
|
-
},
|
|
19206
|
+
}, Jh(e.slice(l), t.slice(l), n, r, i);
|
|
19131
19207
|
return;
|
|
19132
19208
|
}
|
|
19133
19209
|
}
|
|
19134
|
-
s.length > 0 &&
|
|
19210
|
+
s.length > 0 && qh(s, c, n, a, r, i);
|
|
19135
19211
|
}
|
|
19136
|
-
function
|
|
19212
|
+
function Yh(e, t, n) {
|
|
19137
19213
|
if (e.length === 0) return [];
|
|
19138
19214
|
let r = [...e].sort((e, t) => t.weight - e.weight), i = r.reduce((e, t) => e + Math.max(0, t.weight), 0);
|
|
19139
19215
|
if (i === 0) return [];
|
|
19140
19216
|
let a = t.width * t.height, o = r.map((e) => Math.max(0, e.weight) / i * a), s = r.map((e) => e.id), c = [];
|
|
19141
|
-
return
|
|
19217
|
+
return Jh(o, s, { ...t }, n, c), c;
|
|
19142
19218
|
}
|
|
19143
19219
|
//#endregion
|
|
19144
19220
|
//#region src/finance/HeatmapRenderer.ts
|
|
19145
|
-
function
|
|
19221
|
+
function Xh(e) {
|
|
19146
19222
|
return (e >= 0 ? "+" : "") + e.toFixed(2) + "%";
|
|
19147
19223
|
}
|
|
19148
|
-
function
|
|
19224
|
+
function Zh(e) {
|
|
19149
19225
|
return e.label;
|
|
19150
19226
|
}
|
|
19151
|
-
function
|
|
19227
|
+
function Qh(e, t) {
|
|
19152
19228
|
let n = t.min ?? -5, r = t.max ?? 5;
|
|
19153
19229
|
if (e <= n) return t.negative;
|
|
19154
19230
|
if (e >= r) return t.positive;
|
|
@@ -19159,11 +19235,11 @@ function qh(e, t) {
|
|
|
19159
19235
|
let i = e / r;
|
|
19160
19236
|
return ye(t.zero, t.positive, i);
|
|
19161
19237
|
}
|
|
19162
|
-
function
|
|
19238
|
+
function $h(e, t, n, r, i, a) {
|
|
19163
19239
|
let o = Math.min(a, r / 2, i / 2);
|
|
19164
19240
|
e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.arcTo(t + r, n, t + r, n + o, o), e.lineTo(t + r, n + i - o), e.arcTo(t + r, n + i, t + r - o, n + i, o), e.lineTo(t + o, n + i), e.arcTo(t, n + i, t, n + i - o, o), e.lineTo(t, n + o), e.arcTo(t, n, t + o, n, o), e.closePath();
|
|
19165
19241
|
}
|
|
19166
|
-
function
|
|
19242
|
+
function eg(e, t, n, r, i, a, o, s, c, l, u) {
|
|
19167
19243
|
if (i < 40 || a < 30) return;
|
|
19168
19244
|
let d = n + i / 2, f = r + a / 2;
|
|
19169
19245
|
if (e.save(), e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 2, e.fillStyle = "#FFFFFF", e.textAlign = "center", s) {
|
|
@@ -19176,22 +19252,22 @@ function Yh(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
19176
19252
|
}
|
|
19177
19253
|
e.restore();
|
|
19178
19254
|
}
|
|
19179
|
-
function
|
|
19255
|
+
function tg(e, t, n, r, i, a, o, s) {
|
|
19180
19256
|
let c = [o(t), s(t.value)];
|
|
19181
19257
|
if (t.meta) for (let [e, n] of Object.entries(t.meta)) c.push(e + ": " + String(n));
|
|
19182
19258
|
e.save(), e.font = a.font.sizeSmall + "px " + a.font.family;
|
|
19183
19259
|
let l = Math.max(...c.map((t) => e.measureText(t).width)) + 16, u = a.font.sizeSmall + 4, d = c.length * u + 12, f = n.x + 14, p = n.y - d / 2;
|
|
19184
|
-
f + l > r && (f = n.x - l - 14), p < 0 && (p = 0), p + d > i && (p = i - d), e.fillStyle = a.axisLabelBackground, e.globalAlpha = .92,
|
|
19260
|
+
f + l > r && (f = n.x - l - 14), p < 0 && (p = 0), p + d > i && (p = i - d), e.fillStyle = a.axisLabelBackground, e.globalAlpha = .92, $h(e, f, p, l, d, 4), e.fill(), e.globalAlpha = 1, e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
|
|
19185
19261
|
for (let t = 0; t < c.length; t++) e.fillText(c[t], f + 8, p + 6 + t * u);
|
|
19186
19262
|
e.restore();
|
|
19187
19263
|
}
|
|
19188
|
-
function
|
|
19264
|
+
function ng(e, t, n, r, i, a, o, s) {
|
|
19189
19265
|
if (r.length === 0 || i.length === 0 || t <= 0 || n <= 0) return null;
|
|
19190
19266
|
let c = a.colorScale ?? {
|
|
19191
19267
|
negative: "#e8505b",
|
|
19192
19268
|
zero: "#424242",
|
|
19193
19269
|
positive: "#1fa874"
|
|
19194
|
-
}, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ??
|
|
19270
|
+
}, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ?? Xh, p = a.labelFormat ?? Zh, m = /* @__PURE__ */ new Map();
|
|
19195
19271
|
for (let e of r) m.set(e.id, e);
|
|
19196
19272
|
let h = null, g = null;
|
|
19197
19273
|
if (s) for (let e of i) {
|
|
@@ -19212,37 +19288,37 @@ function Zh(e, t, n, r, i, a, o, s) {
|
|
|
19212
19288
|
if (!n) continue;
|
|
19213
19289
|
let { x: r, y: i, width: a, height: s } = t.rect;
|
|
19214
19290
|
if (a <= 0 || s <= 0) continue;
|
|
19215
|
-
let g =
|
|
19216
|
-
|
|
19291
|
+
let g = Qh(n.value, c);
|
|
19292
|
+
$h(e, r, i, a, s, l), e.fillStyle = g, e.fill(), eg(e, n, r, i, a, s, o, u, d, p, f), t.id === h && ($h(e, r, i, a, s, l), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
|
|
19217
19293
|
}
|
|
19218
|
-
return g && s &&
|
|
19294
|
+
return g && s && tg(e, g.cell, s, t, n, o, p, f), g;
|
|
19219
19295
|
}
|
|
19220
19296
|
//#endregion
|
|
19221
19297
|
//#region src/finance/WaterfallRenderer.ts
|
|
19222
|
-
var
|
|
19223
|
-
function
|
|
19298
|
+
var rg = 60, ig = 12, ag = 24, og = 40, sg = .7, cg = 1;
|
|
19299
|
+
function lg(e) {
|
|
19224
19300
|
return e.type ? e.type : e.value > 0 ? "positive" : e.value < 0 ? "negative" : "subtotal";
|
|
19225
19301
|
}
|
|
19226
|
-
function
|
|
19302
|
+
function ug(e) {
|
|
19227
19303
|
let t = Math.abs(e);
|
|
19228
19304
|
return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
|
|
19229
19305
|
}
|
|
19230
|
-
function
|
|
19306
|
+
function dg(e, t) {
|
|
19231
19307
|
return {
|
|
19232
|
-
left:
|
|
19233
|
-
right: e -
|
|
19234
|
-
top:
|
|
19235
|
-
bottom: t -
|
|
19236
|
-
plotWidth: e -
|
|
19237
|
-
plotHeight: t -
|
|
19308
|
+
left: rg,
|
|
19309
|
+
right: e - ig,
|
|
19310
|
+
top: ag,
|
|
19311
|
+
bottom: t - og,
|
|
19312
|
+
plotWidth: e - rg - ig,
|
|
19313
|
+
plotHeight: t - ag - og
|
|
19238
19314
|
};
|
|
19239
19315
|
}
|
|
19240
|
-
function
|
|
19316
|
+
function fg(e, t, n, r, i) {
|
|
19241
19317
|
let a = Array(e.length), o = Array(e.length), s = t.plotWidth / e.length, c = s * n, l = (s - c) / 2, { left: u, bottom: d, plotHeight: f } = t, p = 0;
|
|
19242
19318
|
for (let t = 0; t < e.length; t++) {
|
|
19243
|
-
let n = e[t], m =
|
|
19319
|
+
let n = e[t], m = lg(n), h, g;
|
|
19244
19320
|
m === "total" || m === "subtotal" ? (h = 0, g = n.value, p = n.value) : (h = p, g = p + n.value, p = g);
|
|
19245
|
-
let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y),
|
|
19321
|
+
let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y), cg), C = u + t * s, w = C + l;
|
|
19246
19322
|
a[t] = {
|
|
19247
19323
|
label: n.label,
|
|
19248
19324
|
value: n.value,
|
|
@@ -19262,14 +19338,14 @@ function sg(e, t, n, r, i) {
|
|
|
19262
19338
|
cumulatives: o
|
|
19263
19339
|
};
|
|
19264
19340
|
}
|
|
19265
|
-
function
|
|
19341
|
+
function pg(e) {
|
|
19266
19342
|
if (e.length === 0) return {
|
|
19267
19343
|
valMin: 0,
|
|
19268
19344
|
valMax: 1
|
|
19269
19345
|
};
|
|
19270
19346
|
let t = 0, n = 0, r = 0;
|
|
19271
19347
|
for (let i = 0; i < e.length; i++) {
|
|
19272
|
-
let a = e[i], o =
|
|
19348
|
+
let a = e[i], o = lg(a), s, c;
|
|
19273
19349
|
o === "total" || o === "subtotal" ? (s = 0, c = a.value, r = a.value) : (s = r, c = r + a.value, r = c), s < t && (t = s), c < t && (t = c), s > n && (n = s), c > n && (n = c);
|
|
19274
19350
|
}
|
|
19275
19351
|
let i = (n - t || 1) * .1;
|
|
@@ -19278,10 +19354,10 @@ function cg(e) {
|
|
|
19278
19354
|
valMax: n + i
|
|
19279
19355
|
};
|
|
19280
19356
|
}
|
|
19281
|
-
function
|
|
19357
|
+
function mg(e, t, n, r) {
|
|
19282
19358
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
19283
19359
|
}
|
|
19284
|
-
function
|
|
19360
|
+
function hg(e, t, n, r, i, a) {
|
|
19285
19361
|
let { left: o, right: s, top: c, bottom: l, plotHeight: u } = t, d = r - n || 1;
|
|
19286
19362
|
e.strokeStyle = i.grid, e.lineWidth = .5, e.fillStyle = i.axisLabel, e.font = `${i.font.sizeSmall}px ${i.font.family}`, e.textAlign = "right", e.textBaseline = "middle";
|
|
19287
19363
|
let f = he(n, r, 5), p = Math.ceil(n / f) * f;
|
|
@@ -19300,7 +19376,7 @@ function ug(e, t, n, r, i, a) {
|
|
|
19300
19376
|
e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(o, t), e.lineTo(s, t), e.stroke();
|
|
19301
19377
|
}
|
|
19302
19378
|
}
|
|
19303
|
-
function
|
|
19379
|
+
function gg(e, t, n) {
|
|
19304
19380
|
let r = [
|
|
19305
19381
|
"positive",
|
|
19306
19382
|
"negative",
|
|
@@ -19319,7 +19395,7 @@ function dg(e, t, n) {
|
|
|
19319
19395
|
s && (e.fillStyle = o, e.fill());
|
|
19320
19396
|
}
|
|
19321
19397
|
}
|
|
19322
|
-
function
|
|
19398
|
+
function _g(e, t, n, r, i, a, o) {
|
|
19323
19399
|
if (o === "none" || t.length < 2) return;
|
|
19324
19400
|
let { bottom: s, plotHeight: c } = n;
|
|
19325
19401
|
e.strokeStyle = a, e.lineWidth = 1, o === "dashed" ? e.setLineDash([4, 4]) : e.setLineDash([]), e.beginPath();
|
|
@@ -19329,7 +19405,7 @@ function fg(e, t, n, r, i, a, o) {
|
|
|
19329
19405
|
}
|
|
19330
19406
|
e.stroke(), e.setLineDash([]);
|
|
19331
19407
|
}
|
|
19332
|
-
function
|
|
19408
|
+
function vg(e, t, n, r, i, a) {
|
|
19333
19409
|
e.fillStyle = r.text, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center";
|
|
19334
19410
|
for (let r = 0; r < t.length; r++) {
|
|
19335
19411
|
let o = t[r], s;
|
|
@@ -19338,7 +19414,7 @@ function pg(e, t, n, r, i, a) {
|
|
|
19338
19414
|
o.end < o.start ? (e.textBaseline = "top", e.fillText(s, c, o.rectY + o.rectH + 4)) : (e.textBaseline = "bottom", e.fillText(s, c, o.rectY - 4));
|
|
19339
19415
|
}
|
|
19340
19416
|
}
|
|
19341
|
-
function
|
|
19417
|
+
function yg(e, t, n, r, i) {
|
|
19342
19418
|
e.fillStyle = r.axisLabel, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "top";
|
|
19343
19419
|
let a = n.bottom + 6, o = t.length > 0 ? t[0].slotW - 4 : 0, s = !1;
|
|
19344
19420
|
for (let n = 0; n < t.length; n++) if (e.measureText(i(t[n].label)).width > o) {
|
|
@@ -19359,7 +19435,7 @@ function mg(e, t, n, r, i) {
|
|
|
19359
19435
|
}
|
|
19360
19436
|
e.setTransform(1, 0, 0, 1, 0, 0), e.restore();
|
|
19361
19437
|
}
|
|
19362
|
-
function
|
|
19438
|
+
function bg(e, t, n) {
|
|
19363
19439
|
if (t < n.left || t > n.right) return null;
|
|
19364
19440
|
for (let n = 0; n < e.length; n++) {
|
|
19365
19441
|
let r = e[n];
|
|
@@ -19367,7 +19443,7 @@ function hg(e, t, n) {
|
|
|
19367
19443
|
}
|
|
19368
19444
|
return null;
|
|
19369
19445
|
}
|
|
19370
|
-
function
|
|
19446
|
+
function xg(e, t, n, r, i, a, o, s) {
|
|
19371
19447
|
let c = t[r], l = n[r], u = Math.round(c.slotX + c.slotW / 2) + .5;
|
|
19372
19448
|
e.strokeStyle = o.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(u, a.top), e.lineTo(u, a.bottom), e.stroke(), e.setLineDash([]);
|
|
19373
19449
|
let d = [
|
|
@@ -19386,37 +19462,37 @@ function gg(e, t, n, r, i, a, o, s) {
|
|
|
19386
19462
|
let _ = o.font.sizeSmall + 4;
|
|
19387
19463
|
for (let t = 0; t < d.length; t++) e.fillText(d[t], h + 8, g + 6 + t * _);
|
|
19388
19464
|
}
|
|
19389
|
-
function
|
|
19465
|
+
function Sg(e, t, n, r, i, a) {
|
|
19390
19466
|
let { data: o } = r;
|
|
19391
19467
|
if (!o || o.length === 0 || t <= 0 || n <= 0) return { hitBar: null };
|
|
19392
|
-
let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ??
|
|
19393
|
-
|
|
19468
|
+
let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ?? sg, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? ug, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = pg(o), b = y - v || 1, x = dg(t, n), { bars: S, cumulatives: C } = fg(o, x, p, v, b);
|
|
19469
|
+
mg(e, t, n, i.background), hg(e, x, v, y, i, g), _g(e, S, x, v, b, d, f), gg(e, S, {
|
|
19394
19470
|
positive: s,
|
|
19395
19471
|
negative: c,
|
|
19396
19472
|
total: l,
|
|
19397
19473
|
subtotal: u
|
|
19398
|
-
}), m &&
|
|
19399
|
-
let w = a ?
|
|
19400
|
-
return a && w !== null &&
|
|
19474
|
+
}), m && vg(e, S, C, i, g, h), yg(e, S, x, i, _);
|
|
19475
|
+
let w = a ? bg(S, a.x, x) : null;
|
|
19476
|
+
return a && w !== null && xg(e, S, C, w, a, x, i, g), { hitBar: w };
|
|
19401
19477
|
}
|
|
19402
19478
|
//#endregion
|
|
19403
19479
|
//#region src/finance/GaugeRenderer.ts
|
|
19404
|
-
var
|
|
19405
|
-
function
|
|
19480
|
+
var Cg = Math.PI / 180, wg = 150, Tg = 240, Eg = 90, Dg = .14, Og = 1.6 * Cg, kg = .22, Ag = 8, jg = 18, Mg = 16, Ng = 6.5, Pg = 20, Fg = 5, Ig = 28;
|
|
19481
|
+
function Lg(e, t, n) {
|
|
19406
19482
|
return e < t ? t : e > n ? n : e;
|
|
19407
19483
|
}
|
|
19408
|
-
function
|
|
19484
|
+
function Rg(e) {
|
|
19409
19485
|
let t = Math.abs(e);
|
|
19410
19486
|
return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
|
|
19411
19487
|
}
|
|
19412
|
-
function
|
|
19413
|
-
let t = Number.isFinite(e.startAngle) ? e.startAngle :
|
|
19414
|
-
return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n =
|
|
19415
|
-
start: (t % 360 + 360) % 360 *
|
|
19416
|
-
sweep: n *
|
|
19488
|
+
function zg(e) {
|
|
19489
|
+
let t = Number.isFinite(e.startAngle) ? e.startAngle : wg, n = (Number.isFinite(e.endAngle) ? e.endAngle : t + Tg) - t;
|
|
19490
|
+
return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n = Lg(n, Eg, 360), {
|
|
19491
|
+
start: (t % 360 + 360) % 360 * Cg,
|
|
19492
|
+
sweep: n * Cg
|
|
19417
19493
|
};
|
|
19418
19494
|
}
|
|
19419
|
-
function
|
|
19495
|
+
function Bg(e, t) {
|
|
19420
19496
|
let n = Math.min(Math.cos(e), Math.cos(t)), r = Math.max(Math.cos(e), Math.cos(t)), i = Math.min(Math.sin(e), Math.sin(t)), a = Math.max(Math.sin(e), Math.sin(t));
|
|
19421
19497
|
for (let o = Math.ceil(e / (Math.PI / 2)); Math.PI / 2 * o <= t; o++) {
|
|
19422
19498
|
let e = Math.PI / 2 * o;
|
|
@@ -19429,15 +19505,15 @@ function Fg(e, t) {
|
|
|
19429
19505
|
maxY: a
|
|
19430
19506
|
};
|
|
19431
19507
|
}
|
|
19432
|
-
function
|
|
19508
|
+
function Vg(e) {
|
|
19433
19509
|
if (e.showZoneLabels !== !0 || !e.zones) return 0;
|
|
19434
19510
|
let t = e.zones.reduce((e, t) => Math.max(e, t.label?.length ?? 0), 0);
|
|
19435
|
-
return t > 0 ? t *
|
|
19511
|
+
return t > 0 ? t * Ng + 12 : 0;
|
|
19436
19512
|
}
|
|
19437
|
-
function
|
|
19513
|
+
function Hg(e, t, n) {
|
|
19438
19514
|
let r = Number.isFinite(n.min) ? n.min : 0, i = Number.isFinite(n.max) ? n.max : 100;
|
|
19439
19515
|
i - r > Math.abs(r) * 1e-9 || (i = r + Math.max(1, Math.abs(r) * 1e-6));
|
|
19440
|
-
let { start: a, sweep: o } =
|
|
19516
|
+
let { start: a, sweep: o } = zg(n), s = a, c = a + o, l = Lg(n.thickness ?? Dg, .04, .5), u = Bg(s, c), d = Math.max(u.maxY, .18), f = Vg(n), p = f > 0 ? Mg : 0, m = Math.max(1, e - 2 * Ag - 2 * f), h = Math.max(1, t - 2 * Ag - jg - p), g = 1 + l / 2, _ = Math.max(8, Math.min(m / ((u.maxX - u.minX) * g), h / ((d - u.minY) * g))), v = _ * l, y = (d - u.minY) * _ * g + jg + p, b = e / 2 - (u.maxX + u.minX) / 2 * _, x = (t - y) / 2 + p - u.minY * _ * g, S = _ - v / 2, C = Math.max(11, Math.round(S * .46)), w = u.maxY > .3 ? x - C * .12 : x - C * .55, T = Math.max(Math.sin(s), Math.sin(c)), E = T > .2 ? x + T * _ + v / 2 + 2 : Infinity, D = Math.min(t - Ag, E);
|
|
19441
19517
|
return {
|
|
19442
19518
|
cx: b,
|
|
19443
19519
|
cy: x,
|
|
@@ -19452,20 +19528,20 @@ function Lg(e, t, n) {
|
|
|
19452
19528
|
textBottom: D
|
|
19453
19529
|
};
|
|
19454
19530
|
}
|
|
19455
|
-
function
|
|
19456
|
-
let n = Number.isFinite(e) ?
|
|
19531
|
+
function Ug(e, t) {
|
|
19532
|
+
let n = Number.isFinite(e) ? Lg((e - t.min) / (t.max - t.min), 0, 1) : 0;
|
|
19457
19533
|
return t.startAngle + (t.endAngle - t.startAngle) * n;
|
|
19458
19534
|
}
|
|
19459
|
-
function
|
|
19535
|
+
function Wg(e, t) {
|
|
19460
19536
|
if (!t || !Number.isFinite(e)) return;
|
|
19461
19537
|
let n;
|
|
19462
19538
|
for (let r of t) e >= r.from && e <= r.to && (n = r);
|
|
19463
19539
|
return n;
|
|
19464
19540
|
}
|
|
19465
|
-
function
|
|
19541
|
+
function Gg(e, t, n) {
|
|
19466
19542
|
let r = (t ?? []).map((t) => ({
|
|
19467
|
-
a0:
|
|
19468
|
-
a1:
|
|
19543
|
+
a0: Ug(t.from, e),
|
|
19544
|
+
a1: Ug(t.to, e),
|
|
19469
19545
|
color: t.color,
|
|
19470
19546
|
track: !1
|
|
19471
19547
|
})).filter((e) => e.a1 > e.a0).sort((e, t) => e.a0 - t.a0), i = [], a = e.startAngle;
|
|
@@ -19485,70 +19561,70 @@ function Bg(e, t, n) {
|
|
|
19485
19561
|
track: !0
|
|
19486
19562
|
}), i;
|
|
19487
19563
|
}
|
|
19488
|
-
function
|
|
19564
|
+
function Kg(e, t, n, r, i) {
|
|
19489
19565
|
r <= n || (e.beginPath(), e.arc(t.cx, t.cy, t.radius, n, r, !1), e.lineWidth = t.thickness, e.lineCap = "butt", e.strokeStyle = i, e.stroke());
|
|
19490
19566
|
}
|
|
19491
|
-
function
|
|
19567
|
+
function qg(e, t, n, r, i, a) {
|
|
19492
19568
|
let o = t.cx + Math.cos(n) * t.radius, s = t.cy + Math.sin(n) * t.radius, c = a === "start" ? n - Math.PI : n;
|
|
19493
19569
|
e.globalAlpha = i, e.beginPath(), e.arc(o, s, t.thickness / 2, c, c + (i >= 1 ? Math.PI * 2 : Math.PI), !1), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1;
|
|
19494
19570
|
}
|
|
19495
|
-
function
|
|
19496
|
-
let o =
|
|
19571
|
+
function Jg(e, t, n, r, i, a) {
|
|
19572
|
+
let o = Gg(t, n, i), s = o.some((e) => !e.track);
|
|
19497
19573
|
o.forEach((n, i) => {
|
|
19498
|
-
let a = i > 0 && !n.track && !o[i - 1].track ?
|
|
19574
|
+
let a = i > 0 && !n.track && !o[i - 1].track ? Og / 2 : 0, s = i < o.length - 1 && !n.track && !o[i + 1].track ? Og / 2 : 0, c = n.a0 + a, l = n.a1 - s;
|
|
19499
19575
|
if (n.track) {
|
|
19500
|
-
|
|
19576
|
+
Kg(e, t, c, l, n.color);
|
|
19501
19577
|
return;
|
|
19502
19578
|
}
|
|
19503
|
-
e.globalAlpha =
|
|
19504
|
-
}), s ||
|
|
19505
|
-
let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 :
|
|
19506
|
-
|
|
19579
|
+
e.globalAlpha = kg, Kg(e, t, c, l, n.color), e.globalAlpha = 1, Kg(e, t, c, Math.min(l, r), n.color);
|
|
19580
|
+
}), s || Kg(e, t, t.startAngle, r, a);
|
|
19581
|
+
let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 : kg], [d, f] = u(o[0], c), [p, m] = u(o[o.length - 1], l);
|
|
19582
|
+
qg(e, t, t.startAngle, d, f, "start"), qg(e, t, t.endAngle, p, m, "end");
|
|
19507
19583
|
}
|
|
19508
|
-
function
|
|
19584
|
+
function Yg(e, t, n) {
|
|
19509
19585
|
let r = t.radius - t.thickness / 2;
|
|
19510
|
-
if (r <
|
|
19586
|
+
if (r < Ig) return;
|
|
19511
19587
|
let i = Math.max(4, t.thickness * .45);
|
|
19512
19588
|
e.strokeStyle = n, e.lineCap = "butt";
|
|
19513
|
-
for (let n = 0; n <=
|
|
19514
|
-
let a = n %
|
|
19589
|
+
for (let n = 0; n <= Pg; n++) {
|
|
19590
|
+
let a = n % Fg === 0, o = t.startAngle + (t.endAngle - t.startAngle) * n / Pg, s = r - i, c = s - (a ? Math.max(6, t.thickness * .55) : Math.max(3, t.thickness * .3));
|
|
19515
19591
|
e.globalAlpha = a ? .55 : .3, e.lineWidth = a ? 1.5 : 1, e.beginPath(), e.moveTo(t.cx + Math.cos(o) * s, t.cy + Math.sin(o) * s), e.lineTo(t.cx + Math.cos(o) * c, t.cy + Math.sin(o) * c), e.stroke();
|
|
19516
19592
|
}
|
|
19517
19593
|
e.globalAlpha = 1;
|
|
19518
19594
|
}
|
|
19519
|
-
function
|
|
19595
|
+
function Xg(e, t, n, r, i) {
|
|
19520
19596
|
let a = t.cx + Math.cos(n) * t.radius, o = t.cy + Math.sin(n) * t.radius;
|
|
19521
19597
|
e.beginPath(), e.arc(a, o, t.thickness * .78, 0, Math.PI * 2), e.fillStyle = r, e.fill(), e.lineWidth = Math.max(2, t.thickness * .32), e.strokeStyle = i, e.stroke();
|
|
19522
19598
|
}
|
|
19523
|
-
function
|
|
19599
|
+
function Zg(e, t, n, r, i) {
|
|
19524
19600
|
let a = Math.cos(n), o = Math.sin(n), s = t.radius - t.thickness * .9, c = Math.max(6, t.thickness * .6), l = Math.max(1.5, t.thickness * .14);
|
|
19525
19601
|
e.beginPath(), e.moveTo(t.cx + a * s, t.cy + o * s), e.lineTo(t.cx - o * l - a * c, t.cy + a * l - o * c), e.lineTo(t.cx + o * l - a * c, t.cy - a * l - o * c), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.thickness * .42), 0, Math.PI * 2), e.fill(), e.lineWidth = 2, e.strokeStyle = i, e.stroke();
|
|
19526
19602
|
}
|
|
19527
|
-
function
|
|
19603
|
+
function Qg(e, t, n, r, i, a, o) {
|
|
19528
19604
|
e.font = `${n} ${r}px ${i}`;
|
|
19529
19605
|
let s = e.measureText(t).width;
|
|
19530
19606
|
if (s <= a) return r;
|
|
19531
19607
|
let c = Math.floor(r * a / s);
|
|
19532
19608
|
return c < o ? 0 : (e.font = `${n} ${c}px ${i}`, c);
|
|
19533
19609
|
}
|
|
19534
|
-
function
|
|
19610
|
+
function $g(e, t, n, r, i, a, o) {
|
|
19535
19611
|
let s = a.font.family, c = (t.radius - t.thickness / 2) * 1.3, l = a.font.sizeSmall;
|
|
19536
19612
|
e.textAlign = "center", e.textBaseline = "middle";
|
|
19537
|
-
let u =
|
|
19613
|
+
let u = Qg(e, n, "600", t.valueSize, s, c, l);
|
|
19538
19614
|
if (u === 0) return;
|
|
19539
19615
|
let d = o ? Math.min(t.cy + u * .8, t.textBottom - u / 2) : t.valueY;
|
|
19540
19616
|
e.fillStyle = a.text, e.fillText(n, t.cx, d);
|
|
19541
19617
|
let f = Math.max(l, Math.round(u * .26));
|
|
19542
19618
|
if (i?.label && !o) {
|
|
19543
19619
|
let n = i.label.toUpperCase();
|
|
19544
|
-
|
|
19620
|
+
Qg(e, n, "600", f, s, c * .9, l) > 0 && (e.fillStyle = i.color, e.fillText(n, t.cx, d - u * .78));
|
|
19545
19621
|
}
|
|
19546
19622
|
if (r) {
|
|
19547
19623
|
let n = d + u * .72;
|
|
19548
|
-
n + f / 2 <= t.textBottom &&
|
|
19624
|
+
n + f / 2 <= t.textBottom && Qg(e, r, "400", f, s, c, l) > 0 && (e.fillStyle = a.textSecondary, e.fillText(r, t.cx, n));
|
|
19549
19625
|
}
|
|
19550
19626
|
}
|
|
19551
|
-
function
|
|
19627
|
+
function e_(e, t, n, r) {
|
|
19552
19628
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall + 1}px ${r.font.family}`;
|
|
19553
19629
|
let i = t.thickness / 2 + 6;
|
|
19554
19630
|
for (let [r, a] of [[t.startAngle, t.min], [t.endAngle, t.max]]) {
|
|
@@ -19556,21 +19632,21 @@ function Yg(e, t, n, r) {
|
|
|
19556
19632
|
s > .2 ? (e.textAlign = "center", e.textBaseline = "top", e.fillText(n(a), c, l + i)) : (e.textAlign = o < -.2 ? "right" : o > .2 ? "left" : "center", e.textBaseline = s < -.2 ? "bottom" : "middle", e.fillText(n(a), c + o * i, l + s * i));
|
|
19557
19633
|
}
|
|
19558
19634
|
}
|
|
19559
|
-
function
|
|
19635
|
+
function t_(e, t, n, r) {
|
|
19560
19636
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textBaseline = "middle";
|
|
19561
19637
|
let i = t.radius + t.thickness / 2 + 8;
|
|
19562
19638
|
for (let r of n) {
|
|
19563
19639
|
if (!r.label) continue;
|
|
19564
|
-
let n =
|
|
19640
|
+
let n = Ug((Lg(r.from, t.min, t.max) + Lg(r.to, t.min, t.max)) / 2, t), a = Math.cos(n);
|
|
19565
19641
|
e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(r.label, t.cx + a * i, t.cy + Math.sin(n) * i);
|
|
19566
19642
|
}
|
|
19567
19643
|
}
|
|
19568
|
-
function
|
|
19644
|
+
function n_(e, t, n, r, i, a) {
|
|
19569
19645
|
if (t <= 0 || n <= 0) return;
|
|
19570
|
-
let o =
|
|
19571
|
-
e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n),
|
|
19646
|
+
let o = Hg(t, n, r), s = Number.isFinite(a), c = s ? Lg(a, o.min, o.max) : o.min, l = Ug(c, o), u = s ? Wg(c, r.zones) : void 0, d = r.pointer === "needle", f = r.valueFormat ?? Rg, p = u?.color ?? r.needleColor ?? i.lineColor;
|
|
19647
|
+
e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), Jg(e, o, r.zones, l, r.trackColor ?? i.grid, p), Yg(e, o, i.textSecondary), s && (d ? Zg(e, o, l, r.needleColor ?? i.text, i.background) : Xg(e, o, l, p, i.background)), r.showValue !== !1 && $g(e, o, s ? f(c) : "—", r.label, u, i, d), e_(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && t_(e, o, r.zones, i), e.restore();
|
|
19572
19648
|
}
|
|
19573
19649
|
//#endregion
|
|
19574
|
-
export { Bl as ABCDPatternTool, Vr as ADXIndicator, na as ALMAIndicator, Br as ATRIndicator, rt as AXIS_LABEL_HEIGHT, ki as AcceleratorOscillatorIndicator, Li as AccumulationDistributionIndicator, Za as AccumulativeSwingIndexIndicator, $a as AdvanceDeclineIndicator, Bo as AlertDragHandler, lm as AlertManager, Er as AlligatorIndicator, _r as AnchoredVWAPIndicator, pl as AnchoredVWAPTool,
|
|
19650
|
+
export { Bl as ABCDPatternTool, Vr as ADXIndicator, na as ALMAIndicator, Br as ATRIndicator, rt as AXIS_LABEL_HEIGHT, ki as AcceleratorOscillatorIndicator, Li as AccumulationDistributionIndicator, Za as AccumulativeSwingIndexIndicator, $a as AdvanceDeclineIndicator, Bo as AlertDragHandler, lm as AlertManager, Er as AlligatorIndicator, _r as AnchoredVWAPIndicator, pl as AnchoredVWAPTool, sh as Animator, td as ArcTool, Pt as AreaRenderer, Kr as AroonIndicator, Iu as ArrowMarkTool, cl as ArrowTool, Oa as AverageDayRangeIndicator, Ia as AveragePriceIndicator, Fr as AwesomeOscillatorIndicator, zo as AxisDragHandler, mi as BalanceOfPowerIndicator, Lp as BarCountdown, Ft as BarRenderer, kd as BarsPatternTool, lh as BaseFinanceChart, Rt as BaselineRenderer, sp as BinanceAdapter, ha as BollingerBandWidthIndicator, or as BollingerBandsIndicator, ma as BollingerPercentBIndicator, ef as BracketTool, Ju as BrushTool, xp as BybitAdapter, Wr as CCIIndicator, Yr as CMFIndicator, Ou as CalloutTool, ft as CandlestickRenderer, qe as CanvasLayer, Ir as ChaikinOscillatorIndicator, Si as ChaikinVolatilityIndicator, da as ChandeKrollStopIndicator, gi as ChandeMomentumIndicator, Tr as ChandelierExitIndicator, Pp as ChartLegend, Im as ChartStateManager, ro as ChopZoneIndicator, Qr as ChoppinessIndexIndicator, Wl as CircleTool, hp as CoinbaseAdapter, bn as CompareRenderer, go as CompareSymbolIndicator, ni as ConnorsRSIIndicator, ii as CoppockIndicator, xo as CorrelationCoefficientIndicator, So as CorrelationLogIndicator, Cl as CrossLineTool, Uo as CrosshairHandler, as as CrosshairTooltip, wf as CurrentPriceLine, ed as CurveTool, eu as CyclicLinesTool, Ul as CypherPatternTool, Np as DEFAULT_LEGEND_CONFIG, S as DEFAULT_MAX_WEBGL_CHARTS, Jp as DEFAULT_SESSION_HOURS, ea as DEMAIndicator, C as DENSE_BAR_WIDTH, Xe as DPRManager, Hm as DataExporter, Xl as DateAndPriceRangeTool, il as DateRangeTool, gn as DepthHeatmapBuffer, _n as DepthHeatmapRenderer, Jd as DepthOverlay, pi as DetrendedPriceOscillatorIndicator, Mi as DisparityIndexIndicator, fr as DonchianChannelIndicator, K as DrawingBase, qs as DrawingManager, yc as DrawingRenderer, ar as EMAIndicator, yi as EaseOfMovementIndicator, oh as Easing, ci as ElderRayIndicator, $c as ElliottCorrectionTool, tl as ElliottDoubleComboTool, Qc as ElliottImpulseTool, el as ElliottTriangleTool, nl as ElliottTripleComboTool, Zc as ElliottWaveTool, Hc as EllipseTool, xf as Emitter, Ar as EnvelopeIndicator, Ut as EquivolumeRenderer, ms as EventBus, jc as ExtendedLineTool, pd as FibArcsTool, Nl as FibChannelTool, fd as FibCirclesTool, Bc as FibExtensionTool, Rc as FibRetracementTool, Ll as FibSpeedResistanceFanTool, gd as FibSpiralTool, gl as FibTimeZonesTool, md as FibWedgeTool, uh as FinanceCrosshair, fi as FisherTransformIndicator, Nu as FlagTool, ti as ForceIndexIndicator, Dd as ForecastTool, fl as GannBoxTool, ul as GannFanTool, _d as GannSquareTool, v as GridRenderer, Na as GuppyMMAIndicator, Gt as HLCAreaRenderer, Wa as HammingMAIndicator, Vl as HeadAndShouldersTool, Xt as HiLoRenderer, Yu as HighlighterTool, _a as HistoricalVolatilityIndicator, It as HollowCandleRenderer, Dc as HorizontalLineTool, Oc as HorizontalRayTool, br as HullMAIndicator, Lu as ICON_GLYPHS, cr as IchimokuIndicator, zu as IconTool, R as IndicatorBase, Qn as IndicatorEngine, z as IndicatorValueMap, mo as IndicatorWorkerHost, kl as InfoLineTool, Oo as InteractionManager, ra as KAMAIndicator, ai as KSTIndicator, Bt as KagiRenderer, dr as KeltnerChannelIndicator, Yo as KeyboardHandler, di as KlingerIndicator, Op as KrakenAdapter, ia as LSMAIndicator, Je as LayerManager, Nt as LineRenderer, qt as LineWithMarkersRenderer, yr as LinearRegressionChannelIndicator, Ea as LinearRegressionSlopeIndicator, Rr as MACDIndicator, Ba as MAChannelIndicator, ca as MACrossIndicator, Ja as MADoubleIndicator, Pa as MARibbonIndicator, Ya as MATripleIndicator, em as MAX_ALERT_BARS, Df as MAX_BASE_RATIO, Ef as MAX_BASE_REQUESTS, Gr as MFIIndicator, tm as MIN_ALERT_BARS, xt as MIN_BAR_UNIT, Cr as MTFMovingAverageIndicator, eo as MajorityRuleIndicator, an as MarketProfileRenderer, hi as MassIndexIndicator, aa as McGinleyDynamicIndicator, Xm as MeasureOverlay, al as MeasureTool, La as MedianPriceIndicator, cp as MockAdapter, Kc as ModifiedSchiffPitchforkTool, ga as MomentumIndicator, ka as NetVolumeIndicator, Du as NoteTool, Hr as OBVIndicator, sf as OrderDraftTool, Rd as OrderRenderer, Lo as PanHandler, Vo as PaneResizeHandler, vf as PaperExecutionAdapter, lr as ParabolicSARIndicator, Mc as ParallelChannelTool, Xu as PathTool, Di as PercentagePriceOscillatorIndicator, un as PeriodLevelsRenderer, ls as PinnedTooltip, hd as PitchfanTool, Wc as PitchforkTool, mn as PivotMarkersRenderer, hr as PivotPointsIndicator, Vt as PointAndFigureRenderer, dp as PollingAdapter, Zu as PolylineTool, qd as PositionRenderer, Pi as PrettyGoodOscillatorIndicator, tt as PriceAxis, jo as PriceAxisAddButton, au as PriceLabelTool, Qp as PriceLines, oo as PriceOscillatorIndicator, rl as PriceRangeTool, bi as PriceVolumeTrendIndicator, Od as ProjectionTool, Ni as QstickIndicator, wt as RANGE_PRESETS, qr as ROCIndicator, Lr as RSIIndicator, Ac as RayTool, Cf as ReconnectManager, Vc as RectangleTool, Nc as RegressionChannelTool, ji as RelativeMomentumIndexIndicator, Ci as RelativeVigorIndicator, wa as RelativeVolatilityIndexIndicator, vt as RenderEngine, Ye as RenderLoop, zt as RenkoRenderer, Kf as ReplayController, hm as ReplayManager, Ff as ResamplingAdapter, Sl as RiskRewardTool, ih as SELECTION_BOX_MIN_SIZE, ir as SMAIndicator, ao as SMIErgodicIndicator, ta as SMMAIndicator, _m as SNAPSHOT_VERSION, li as SchaffTrendCycleIndicator, Gc as SchiffPitchforkTool, Fp as Screenshot, ah as SelectionBoxOverlay, zp as SessionBreaks, Yp as SessionShading, wr as SessionVWAPIndicator, qm as SignalMarkerManager, Sd as SineLineTool, _o as SpreadIndicator, Aa as StandardErrorBandsIndicator, Da as StandardErrorIndicator, Fi as StdDevIndicator, Kt as StepLineRenderer, zr as StochasticIndicator, Ca as StochasticMomentumIndexIndicator, wi as StochasticRSIIndicator, Gf as StreamManager, ur as SupertrendIndicator, yn as SymbolSeriesStore, Pr as TEMAIndicator, _i as TRIXIndicator, Jr as TSIIndicator, sl as TextAnnotationTool, Hl as ThreeDrivesTool, Sf as TickAggregator, Bf as TickBarAdapter, zf as TickBarBuilder, wo as TimeAxis, xd as TimeCyclesTool, Ym as TradeZoneManager, Xd as TradingContextMenu, Yd as TradingDragHandler, gf as TradingManager, _f as TradingRenderer, Dl as TrendAngleTool, Ec as TrendLineTool, Ta as TrendStrengthIndexIndicator, Uc as TriangleTool, Ra as TypicalPriceIndicator, ba as UlcerIndexIndicator, $r as UltimateOscillatorIndicator, Lm as UndoRedoManager, Ri as VROCIndicator, sr as VWAPIndicator, Or as VWMAIndicator, kc as VerticalLineTool, St as Viewport, Xa as VolatilityIndexIndicator, lo as VolatilityOHLCIndicator, uo as VolatilityZeroTrendIndicator, Ht as VolumeCandleRenderer, Xr as VolumeDeltaIndicator, va as VolumeOscillatorIndicator, Ii as VolumeProfileIndicator, ml as VolumeProfileRangeTool, Qt as VolumeProfileRenderer, Zt as VolumeRenderer, Zr as VortexIndicator, kr as WMAIndicator, Ip as Watermark, up as WebSocketAdapter, xi as WilliamsADIndicator, ua as WilliamsFractalsIndicator, Ur as WilliamsRIndicator, zl as XABCDPatternTool, vr as ZigZagIndicator, Ro as ZoomHandler, Yn as alignOutput, $u as arcPoints, nn as assignSessionLetters, D as barIndexToTime, l as barIndexToX, E as barTimeStep, a as barTimeStepMs, Qd as bracketRiskReward, _ as claimGpuContext, fn as classifyPivots, Zd as computeBracketDefaults, en as computeMarketProfile, ln as computePeriodLevels, rn as computeSessionProfiles, Qu as curvePoints, ct as drawAxisValueLabels, jn as drawnKeys, P as fillTag, bc as findDominantSwing, pn as findPivots, u as forEachPixelColumn, Ed as forecastOutcome, rs as formatTooltipTime, V as getIntParam, B as getNumberParam, Ct as getVisibleData, b as gpuContextsLeft, zn as hasHistogram, Uf as hasTrades, nt as indicatorValuePrecision, af as inferOrderType, Kn as inputSource, d as isDense, Kp as isInWindow, rm as isPriceLevelAlert, qp as isRegularSession, Mn as isUpTone, po as isWorkerResponse, at as labelTextColor, st as layoutAxisValueLabels, Yh as layoutSquarifiedTreemap, Gh as layoutUniformGrid, Jn as lineSourceBars, gs as lineSpace, yt as loadWebGL, bt as loadWebGLRenderer, At as lttbDownsample, Mt as lttbVisibleIndices, Wp as mergeSessionHours, Gp as minuteOfDay, Ln as paneLogRange, In as paneValueRange, Fn as plotColor, L as plotLook, Nn as plotShown, t as priceBucketRow, qn as priceSourceBars, T as priceToY, o as priceToYMapper, kt as rangePresetStart, dm as readAlertOptions, Ad as registerBuiltInDrawingTools, fo as registerBuiltInIndicators, lt as renderAxisValueLabels, y as renderDenseBars, Eh as renderDepthChart, Wh as renderEquityCurve, n_ as renderGauge, ng as renderHeatmap, Bn as renderPlots, dh as renderSparkline, Sg as renderWaterfall, r as resolveBarIndex, Mf as servesTimeframe, m as setMaxWebGLCharts, Gn as sourceParam, it as spreadLabels, n as timeToX, i as timestampToBarIndex, xn as toHeikinAshi, Tn as toKagi, wn as toLineBreak, En as toPointAndFigure, Dn as toRangeBars, Sn as toRenko, tn as tpoLetter, Jc as waveLabel, c as whenGpuContextFree, Af as withResampling, Hf as withTickBars, g as xToBarIndex, e as xToTime, h as yToPrice };
|
|
19575
19651
|
|
|
19576
19652
|
//# sourceMappingURL=index.js.map
|