@tradecanvas/chart 1.19.1 → 1.21.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/README.md +5 -1
- package/dist/Chart.d.ts +16 -5
- package/dist/Chart.d.ts.map +1 -1
- package/dist/LayoutSession-A6muBg9e.cjs +2 -0
- package/dist/LayoutSession-A6muBg9e.cjs.map +1 -0
- package/dist/{LayoutSession-CrkDLmvG.js → LayoutSession-CMgqwsEU.js} +306 -292
- package/dist/LayoutSession-CMgqwsEU.js.map +1 -0
- package/dist/finance/BarChart.d.ts +21 -0
- package/dist/finance/BarChart.d.ts.map +1 -0
- package/dist/finance/CalendarChart.d.ts +17 -0
- package/dist/finance/CalendarChart.d.ts.map +1 -0
- package/dist/finance/DonutChart.d.ts +17 -0
- package/dist/finance/DonutChart.d.ts.map +1 -0
- package/dist/finance/HeatmapChart.d.ts +3 -0
- package/dist/finance/HeatmapChart.d.ts.map +1 -1
- package/dist/finance/HistogramChart.d.ts +17 -0
- package/dist/finance/HistogramChart.d.ts.map +1 -0
- package/dist/finance/InteractiveChart.d.ts +40 -0
- package/dist/finance/InteractiveChart.d.ts.map +1 -0
- package/dist/finance/MatrixChart.d.ts +18 -0
- package/dist/finance/MatrixChart.d.ts.map +1 -0
- package/dist/finance/ScatterChart.d.ts +17 -0
- package/dist/finance/ScatterChart.d.ts.map +1 -0
- package/dist/finance/index.d.ts +6 -0
- package/dist/finance/index.d.ts.map +1 -1
- package/dist/i18n-CIHfGH-4.cjs +2 -0
- package/dist/i18n-CIHfGH-4.cjs.map +1 -0
- package/dist/{i18n-BH0McEvQ.js → i18n-fBzhlejv.js} +7 -1
- package/dist/i18n-fBzhlejv.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +251 -53
- package/dist/index.js.map +1 -1
- package/dist/widget/ChartWidget.d.ts +2 -0
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetOrderTicket.d.ts +5 -0
- package/dist/widget/WidgetOrderTicket.d.ts.map +1 -1
- package/dist/widget/index.cjs +14 -14
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +305 -280
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/locales/ar.d.ts.map +1 -1
- package/dist/widget/locales/cs.d.ts.map +1 -1
- package/dist/widget/locales/da.d.ts.map +1 -1
- package/dist/widget/locales/de.d.ts.map +1 -1
- package/dist/widget/locales/el.d.ts.map +1 -1
- package/dist/widget/locales/en.d.ts +3 -0
- package/dist/widget/locales/en.d.ts.map +1 -1
- package/dist/widget/locales/es.d.ts.map +1 -1
- package/dist/widget/locales/et.d.ts.map +1 -1
- package/dist/widget/locales/fa.d.ts.map +1 -1
- package/dist/widget/locales/fr.d.ts.map +1 -1
- package/dist/widget/locales/he.d.ts.map +1 -1
- package/dist/widget/locales/hu.d.ts.map +1 -1
- package/dist/widget/locales/id.d.ts.map +1 -1
- package/dist/widget/locales/index.cjs +1 -1
- package/dist/widget/locales/index.cjs.map +1 -1
- package/dist/widget/locales/index.js +85 -1
- package/dist/widget/locales/index.js.map +1 -1
- package/dist/widget/locales/it.d.ts.map +1 -1
- package/dist/widget/locales/ja.d.ts.map +1 -1
- package/dist/widget/locales/ko.d.ts.map +1 -1
- package/dist/widget/locales/ms.d.ts.map +1 -1
- package/dist/widget/locales/nb.d.ts.map +1 -1
- package/dist/widget/locales/nl.d.ts.map +1 -1
- package/dist/widget/locales/pl.d.ts.map +1 -1
- package/dist/widget/locales/pt.d.ts.map +1 -1
- package/dist/widget/locales/ro.d.ts.map +1 -1
- package/dist/widget/locales/ru.d.ts.map +1 -1
- package/dist/widget/locales/sk.d.ts.map +1 -1
- package/dist/widget/locales/sv.d.ts.map +1 -1
- package/dist/widget/locales/th.d.ts.map +1 -1
- package/dist/widget/locales/tr.d.ts.map +1 -1
- package/dist/widget/locales/vi.d.ts.map +1 -1
- package/dist/widget/locales/zh.d.ts.map +1 -1
- package/dist/widget/locales/zhHant.d.ts.map +1 -1
- package/dist/widget/orderTicket.d.ts +19 -2
- package/dist/widget/orderTicket.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-CrkDLmvG.js.map +0 -1
- package/dist/LayoutSession-FuFdrtr8.cjs +0 -2
- package/dist/LayoutSession-FuFdrtr8.cjs.map +0 -1
- package/dist/i18n-BH0McEvQ.js.map +0 -1
- package/dist/i18n-D0C88QUR.cjs +0 -2
- package/dist/i18n-D0C88QUR.cjs.map +0 -1
package/dist/widget/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as e, a as t, c as n, i as r, n as i, o as a, r as o, t as s } from "../LayoutSession-
|
|
2
|
-
import { a as c, c as l, i as u, n as d, o as f, r as p, s as m, t as h } from "../i18n-
|
|
1
|
+
import { C as e, a as t, c as n, i as r, n as i, o as a, r as o, t as s } from "../LayoutSession-CMgqwsEU.js";
|
|
2
|
+
import { a as c, c as l, i as u, n as d, o as f, r as p, s as m, t as h } from "../i18n-fBzhlejv.js";
|
|
3
3
|
import { CHART_STYLE_KEYS as g, DARK_THEME as _, DEFAULT_SIGNAL_STYLE as v, DEFAULT_TRADE_ZONE_STYLE as y, DEFAULT_TRADING_CONFIG as b, LIGHT_THEME as x, PRICE_SOURCES as ee, formatPrice as te, indicatorSource as ne, isTimeFrame as re, isValidTimeZone as ie, marketStatus as ae, offsetAt as oe, parseIndicatorSource as se, readChartTypeOptions as ce, readNews as le, readQuote as ue, sanitizeDrawingOptions as de, sanitizeDrawingStyle as fe, tickBarCount as S, timeParts as pe, timeframeBucketStart as me, timeframeToMs as C, tzLabel as he, wallToUtc as ge, zoneOffsetMinutes as _e } from "@tradecanvas/commons";
|
|
4
4
|
import { ChartStateManager as ve, MAX_ALERT_BARS as ye, MIN_ALERT_BARS as be, RANGE_PRESETS as xe, indicatorValuePrecision as Se, plotColor as Ce, plotShown as we, servesTimeframe as Te, sourceParam as Ee, withResampling as De } from "@tradecanvas/core";
|
|
5
5
|
//#region src/io/resampleOHLCV.ts
|
|
@@ -6471,26 +6471,32 @@ var Hr = class {
|
|
|
6471
6471
|
e.className = "tcw-account-summary", e.textContent = p(this.t("account.realised"), { pnl: Vr(r) }), this.content.appendChild(e);
|
|
6472
6472
|
}
|
|
6473
6473
|
}
|
|
6474
|
-
};
|
|
6475
|
-
|
|
6476
|
-
//#region src/widget/orderTicket.ts
|
|
6477
|
-
function Ur(e, t) {
|
|
6474
|
+
}, Ur = 1e-9;
|
|
6475
|
+
function Wr(e, t) {
|
|
6478
6476
|
return e.type === "market" ? t : e.price;
|
|
6479
6477
|
}
|
|
6480
|
-
function
|
|
6481
|
-
let
|
|
6482
|
-
(!(e.quantity > 0) || !Number.isFinite(e.quantity)) &&
|
|
6483
|
-
let
|
|
6478
|
+
function Gr(e, t, n = {}) {
|
|
6479
|
+
let r = [];
|
|
6480
|
+
(!(e.quantity > 0) || !Number.isFinite(e.quantity)) && r.push("quantity"), e.type !== "market" && (!(e.price > 0) || !Number.isFinite(e.price)) && r.push("price"), e.type === "market" && !((t ?? e.price) > 0) && r.push("market");
|
|
6481
|
+
let i = e.side === "buy";
|
|
6484
6482
|
if (t !== null && e.type !== "market" && e.price > 0) {
|
|
6485
|
-
let
|
|
6486
|
-
e.type === "limit" &&
|
|
6483
|
+
let n = e.price < t;
|
|
6484
|
+
e.type === "limit" && n !== i && e.price !== t && r.push("limitSide"), e.type === "stop" && n === i && e.price !== t && r.push("stopSide");
|
|
6487
6485
|
}
|
|
6488
|
-
let
|
|
6489
|
-
|
|
6490
|
-
let
|
|
6491
|
-
return
|
|
6486
|
+
let a = (e) => e === null || Number.isFinite(e) && e > 0;
|
|
6487
|
+
a(e.stopLoss) || r.push("stopLoss"), a(e.takeProfit) || r.push("takeProfit");
|
|
6488
|
+
let o = Wr(e, t);
|
|
6489
|
+
return o !== null && o > 0 && (e.stopLoss !== null && a(e.stopLoss) && (i ? e.stopLoss >= o : e.stopLoss <= o) && r.push("stopLossSide"), e.takeProfit !== null && a(e.takeProfit) && (i ? e.takeProfit <= o : e.takeProfit >= o) && r.push("takeProfitSide")), [...r, ...Kr(e, n)];
|
|
6492
6490
|
}
|
|
6493
|
-
function
|
|
6491
|
+
function Kr(e, t) {
|
|
6492
|
+
let n = [], r = e.type === "market" ? null : e.price, i = [
|
|
6493
|
+
r,
|
|
6494
|
+
e.stopLoss,
|
|
6495
|
+
e.takeProfit
|
|
6496
|
+
].filter((e) => e !== null && Number.isFinite(e) && e > 0), { roundPrice: a, limits: o, lot: s } = t;
|
|
6497
|
+
return a && i.some((e) => Math.abs(a(e) - e) > Ur) && n.push("priceStep"), o && r !== null && r > 0 && (r > o.ceiling + Ur || r < o.floor - Ur) && n.push("priceLimits"), s !== void 0 && s > 1 && e.quantity > s && e.quantity % s !== 0 && n.push("lot"), n;
|
|
6498
|
+
}
|
|
6499
|
+
function qr(e, t) {
|
|
6494
6500
|
let n = {
|
|
6495
6501
|
side: e.side,
|
|
6496
6502
|
type: e.type,
|
|
@@ -6499,15 +6505,15 @@ function Gr(e, t) {
|
|
|
6499
6505
|
};
|
|
6500
6506
|
return e.type === "stop" && (n.stopPrice = e.price), e.type !== "market" && (n.timeInForce = e.timeInForce), e.stopLoss !== null && (n.stopLoss = e.stopLoss), e.takeProfit !== null && (n.takeProfit = e.takeProfit), n;
|
|
6501
6507
|
}
|
|
6502
|
-
function
|
|
6503
|
-
let n =
|
|
6508
|
+
function Jr(e, t) {
|
|
6509
|
+
let n = Wr(e, t);
|
|
6504
6510
|
if (n === null || e.stopLoss === null || e.takeProfit === null) return null;
|
|
6505
6511
|
let r = Math.abs(n - e.stopLoss);
|
|
6506
6512
|
return r > 0 ? Math.abs(e.takeProfit - n) / r : null;
|
|
6507
6513
|
}
|
|
6508
6514
|
//#endregion
|
|
6509
6515
|
//#region src/widget/WidgetOrderTicket.ts
|
|
6510
|
-
var
|
|
6516
|
+
var Yr = 0, Xr = class {
|
|
6511
6517
|
backdrop;
|
|
6512
6518
|
modal;
|
|
6513
6519
|
body;
|
|
@@ -6515,8 +6521,9 @@ var qr = 0, Jr = class {
|
|
|
6515
6521
|
submit;
|
|
6516
6522
|
draft = null;
|
|
6517
6523
|
lastPrice = null;
|
|
6524
|
+
rules = {};
|
|
6518
6525
|
returnFocus = null;
|
|
6519
|
-
uid = ++
|
|
6526
|
+
uid = ++Yr;
|
|
6520
6527
|
constructor(e, t, n = h) {
|
|
6521
6528
|
this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
6522
6529
|
let r = !1;
|
|
@@ -6543,12 +6550,14 @@ var qr = 0, Jr = class {
|
|
|
6543
6550
|
c.type = "button", c.className = "tcw-reset-link", c.textContent = this.t("common.cancel"), c.addEventListener("click", () => this.close()), this.submit = document.createElement("button"), this.submit.type = "button", this.submit.className = "tcw-done-btn", this.submit.addEventListener("click", () => this.place()), s.append(c, this.submit), this.modal.append(i, this.body, this.problemsEl, s), this.backdrop.appendChild(this.modal), e.appendChild(this.backdrop);
|
|
6544
6551
|
}
|
|
6545
6552
|
open(e) {
|
|
6546
|
-
this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice;
|
|
6553
|
+
this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {};
|
|
6547
6554
|
let t = e.price ?? e.lastPrice ?? 0, n = e.side ?? "buy", r = "market";
|
|
6548
|
-
e.price !== void 0 && e.lastPrice !== null && e.price !== e.lastPrice && (r = e.price < e.lastPrice == (n === "buy") ? "limit" : "stop")
|
|
6555
|
+
e.price !== void 0 && e.lastPrice !== null && e.price !== e.lastPrice && (r = e.price < e.lastPrice == (n === "buy") ? "limit" : "stop");
|
|
6556
|
+
let i = this.rules.lot !== void 0 && this.rules.lot > 1 ? this.rules.lot : 1;
|
|
6557
|
+
this.draft = {
|
|
6549
6558
|
side: n,
|
|
6550
6559
|
type: r,
|
|
6551
|
-
quantity:
|
|
6560
|
+
quantity: i,
|
|
6552
6561
|
price: t,
|
|
6553
6562
|
stopLoss: null,
|
|
6554
6563
|
takeProfit: null,
|
|
@@ -6569,7 +6578,7 @@ var qr = 0, Jr = class {
|
|
|
6569
6578
|
}
|
|
6570
6579
|
place() {
|
|
6571
6580
|
let e = this.draft;
|
|
6572
|
-
!e ||
|
|
6581
|
+
!e || Gr(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(qr(e, this.lastPrice)), this.close());
|
|
6573
6582
|
}
|
|
6574
6583
|
set(e, t = !1) {
|
|
6575
6584
|
this.draft && (this.draft = {
|
|
@@ -6581,18 +6590,18 @@ var qr = 0, Jr = class {
|
|
|
6581
6590
|
let e = this.draft;
|
|
6582
6591
|
if (!e) return;
|
|
6583
6592
|
let t = document.activeElement, n = t instanceof HTMLElement && this.body.contains(t) ? t.dataset.ticketField : void 0;
|
|
6584
|
-
this.body.replaceChildren(this.sideToggle(e.side), N(this.t("ticket.type"),
|
|
6593
|
+
this.body.replaceChildren(this.sideToggle(e.side), N(this.t("ticket.type"), Zr("type", P([
|
|
6585
6594
|
"market",
|
|
6586
6595
|
"limit",
|
|
6587
6596
|
"stop"
|
|
6588
6597
|
].map((e) => ({
|
|
6589
6598
|
value: e,
|
|
6590
6599
|
label: this.t(`ticket.type.${e}`)
|
|
6591
|
-
})), e.type, (e) => this.set({ type: e }, !0)))), N(this.t("ticket.quantity"),
|
|
6600
|
+
})), e.type, (e) => this.set({ type: e }, !0)))), N(this.t("ticket.quantity"), Zr("quantity", this.number(e.quantity, (e) => this.set({ quantity: e }))))), e.type !== "market" && this.body.append(N(this.t("ticket.price"), Zr("price", this.number(e.price, (e) => this.set({ price: e })))), N(this.t("ticket.timeInForce"), Zr("timeInForce", P(["gtc", "day"].map((e) => ({
|
|
6592
6601
|
value: e,
|
|
6593
6602
|
label: this.t(`ticket.tif.${e}`)
|
|
6594
6603
|
})), e.timeInForce, (e) => this.set({ timeInForce: e })))));
|
|
6595
|
-
let r = e.type === "market" ? this.lastPrice ?? e.price : e.price, i = (t) =>
|
|
6604
|
+
let r = e.type === "market" ? this.lastPrice ?? e.price : e.price, i = (t) => Qr(r * (1 + (e.side === "buy" ? t : -t) / 100), r);
|
|
6596
6605
|
this.body.append(this.optionalPrice("ticket.stopLoss", e.stopLoss, i(-1), (t) => this.set({ stopLoss: t }, t === null || e.stopLoss === null)), this.optionalPrice("ticket.takeProfit", e.takeProfit, i(2), (t) => this.set({ takeProfit: t }, t === null || e.takeProfit === null))), n && this.body.querySelector(`[data-ticket-field="${n}"]`)?.focus(), this.check();
|
|
6597
6606
|
}
|
|
6598
6607
|
sideToggle(e) {
|
|
@@ -6623,23 +6632,30 @@ var qr = 0, Jr = class {
|
|
|
6623
6632
|
check() {
|
|
6624
6633
|
let e = this.draft;
|
|
6625
6634
|
if (!e) return;
|
|
6626
|
-
let t =
|
|
6635
|
+
let t = Gr(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e)), r = Jr(e, this.lastPrice);
|
|
6627
6636
|
t.length === 0 && r !== null && n.push(p(this.t("ticket.riskReward"), { rr: r.toFixed(2) })), this.problemsEl.replaceChildren(...n.map((e) => {
|
|
6628
6637
|
let t = document.createElement("p");
|
|
6629
6638
|
return t.textContent = e, t;
|
|
6630
6639
|
})), this.problemsEl.classList.toggle("tcw-ticket-bad", t.length > 0), this.submit.disabled = t.length > 0, this.submit.classList.toggle("tcw-ticket-sell", e.side === "sell"), this.submit.textContent = this.t(e.side === "buy" ? "ticket.placeBuy" : "ticket.placeSell");
|
|
6631
6640
|
}
|
|
6641
|
+
problemText(e) {
|
|
6642
|
+
let t = this.t(`ticket.problem.${e}`), { limits: n, lot: r } = this.rules;
|
|
6643
|
+
return e === "priceLimits" && n ? p(t, {
|
|
6644
|
+
floor: this.callbacks.formatPrice(n.floor),
|
|
6645
|
+
ceiling: this.callbacks.formatPrice(n.ceiling)
|
|
6646
|
+
}) : e === "lot" ? p(t, { lot: r ?? 1 }) : t;
|
|
6647
|
+
}
|
|
6632
6648
|
};
|
|
6633
|
-
function
|
|
6649
|
+
function Zr(e, t) {
|
|
6634
6650
|
return t.dataset.ticketField = e, t;
|
|
6635
6651
|
}
|
|
6636
|
-
function
|
|
6652
|
+
function Qr(e, t) {
|
|
6637
6653
|
let n = Math.abs(t), r = n >= 10 || n === 0 ? 2 : n >= 1 ? 4 : Math.min(10, Math.ceil(-Math.log10(n)) + 3);
|
|
6638
6654
|
return Number(e.toFixed(r));
|
|
6639
6655
|
}
|
|
6640
6656
|
//#endregion
|
|
6641
6657
|
//#region src/widget/WidgetNamePrompt.ts
|
|
6642
|
-
var
|
|
6658
|
+
var $r = 0, ei = class {
|
|
6643
6659
|
backdrop;
|
|
6644
6660
|
titleEl;
|
|
6645
6661
|
input;
|
|
@@ -6647,7 +6663,7 @@ var Zr = 0, Qr = class {
|
|
|
6647
6663
|
request = null;
|
|
6648
6664
|
returnFocus = null;
|
|
6649
6665
|
busy = !1;
|
|
6650
|
-
uid =
|
|
6666
|
+
uid = ++$r;
|
|
6651
6667
|
constructor(e, t = h) {
|
|
6652
6668
|
this.t = t, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
6653
6669
|
let n = !1;
|
|
@@ -6707,7 +6723,7 @@ var Zr = 0, Qr = class {
|
|
|
6707
6723
|
}
|
|
6708
6724
|
}
|
|
6709
6725
|
}
|
|
6710
|
-
},
|
|
6726
|
+
}, ti = 0, ni = class {
|
|
6711
6727
|
backdrop;
|
|
6712
6728
|
search;
|
|
6713
6729
|
listEl;
|
|
@@ -6715,7 +6731,7 @@ var Zr = 0, Qr = class {
|
|
|
6715
6731
|
confirming = null;
|
|
6716
6732
|
returnFocus = null;
|
|
6717
6733
|
loadSeq = 0;
|
|
6718
|
-
uid =
|
|
6734
|
+
uid = ++ti;
|
|
6719
6735
|
constructor(e, t, n = h) {
|
|
6720
6736
|
this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
6721
6737
|
let r = !1;
|
|
@@ -6817,7 +6833,7 @@ var Zr = 0, Qr = class {
|
|
|
6817
6833
|
this.confirming = null, await this.refresh(), this.isOpen() && this.search.focus();
|
|
6818
6834
|
}
|
|
6819
6835
|
}
|
|
6820
|
-
},
|
|
6836
|
+
}, ri = 5, ii = class {
|
|
6821
6837
|
menu;
|
|
6822
6838
|
prompt;
|
|
6823
6839
|
dialog;
|
|
@@ -6825,7 +6841,7 @@ var Zr = 0, Qr = class {
|
|
|
6825
6841
|
constructor(e, t) {
|
|
6826
6842
|
this.session = e, this.host = t;
|
|
6827
6843
|
let { root: n, t: r } = t;
|
|
6828
|
-
this.menu = new U(n, r("toolbar.layouts")), this.prompt = new
|
|
6844
|
+
this.menu = new U(n, r("toolbar.layouts")), this.prompt = new ei(n, r), this.dialog = new ni(n, {
|
|
6829
6845
|
list: () => e.list(),
|
|
6830
6846
|
currentId: () => e.current()?.id ?? null,
|
|
6831
6847
|
onOpen: (e) => void this.open(e),
|
|
@@ -6903,7 +6919,7 @@ var Zr = 0, Qr = class {
|
|
|
6903
6919
|
}
|
|
6904
6920
|
let { session: t } = this, { t: n, root: r } = this.host, i = [];
|
|
6905
6921
|
try {
|
|
6906
|
-
i = (await t.list()).slice(0,
|
|
6922
|
+
i = (await t.list()).slice(0, ri);
|
|
6907
6923
|
} catch {}
|
|
6908
6924
|
if (this.destroyed) return;
|
|
6909
6925
|
let a = t.current(), o = [{
|
|
@@ -6940,7 +6956,7 @@ var Zr = 0, Qr = class {
|
|
|
6940
6956
|
destroy() {
|
|
6941
6957
|
this.destroyed = !0, this.menu.destroy(), this.prompt.destroy(), this.dialog.destroy();
|
|
6942
6958
|
}
|
|
6943
|
-
},
|
|
6959
|
+
}, ai = [
|
|
6944
6960
|
"1m",
|
|
6945
6961
|
"3m",
|
|
6946
6962
|
"5m",
|
|
@@ -6952,33 +6968,33 @@ var Zr = 0, Qr = class {
|
|
|
6952
6968
|
"1d",
|
|
6953
6969
|
"1w",
|
|
6954
6970
|
"1M"
|
|
6955
|
-
],
|
|
6971
|
+
], oi = [
|
|
6956
6972
|
"1m",
|
|
6957
6973
|
"5m",
|
|
6958
6974
|
"15m",
|
|
6959
6975
|
"1h",
|
|
6960
6976
|
"4h",
|
|
6961
6977
|
"1d"
|
|
6962
|
-
],
|
|
6963
|
-
function
|
|
6978
|
+
], si = 6;
|
|
6979
|
+
function ci(e) {
|
|
6964
6980
|
let t = e.slice(-1);
|
|
6965
6981
|
return t === "h" || t === "d" || t === "w" ? e.slice(0, -1) + t.toUpperCase() : e;
|
|
6966
6982
|
}
|
|
6967
|
-
var
|
|
6983
|
+
var li = (e) => Number.isFinite(C(e)) || S(e) !== null, ui = (e, t) => {
|
|
6968
6984
|
let n = S(e), r = S(t);
|
|
6969
6985
|
return n !== null || r !== null ? n === null ? 1 : r === null ? -1 : n - r : C(e) - C(t);
|
|
6970
6986
|
};
|
|
6971
|
-
function
|
|
6972
|
-
let n = t?.length ? t : null, r = e?.length ? e : n ??
|
|
6973
|
-
return [...new Set(r)].filter((e) =>
|
|
6987
|
+
function di(e, t) {
|
|
6988
|
+
let n = t?.length ? t : null, r = e?.length ? e : n ?? ai;
|
|
6989
|
+
return [...new Set(r)].filter((e) => li(e) && (!n || n.includes(e))).sort(ui);
|
|
6974
6990
|
}
|
|
6975
|
-
function
|
|
6991
|
+
function fi(e, t, n = !1) {
|
|
6976
6992
|
if (t?.length) return e.filter((e) => t.includes(e));
|
|
6977
6993
|
if (n) return [...e];
|
|
6978
|
-
let r = e.filter((e) =>
|
|
6979
|
-
return r.length > 0 ? r : e.slice(0,
|
|
6994
|
+
let r = e.filter((e) => oi.includes(e));
|
|
6995
|
+
return r.length > 0 ? r : e.slice(0, si);
|
|
6980
6996
|
}
|
|
6981
|
-
var
|
|
6997
|
+
var pi = 9999, mi = {
|
|
6982
6998
|
"": "m",
|
|
6983
6999
|
s: "s",
|
|
6984
7000
|
S: "s",
|
|
@@ -6990,38 +7006,38 @@ var di = 9999, fi = {
|
|
|
6990
7006
|
w: "w",
|
|
6991
7007
|
W: "w",
|
|
6992
7008
|
M: "M"
|
|
6993
|
-
},
|
|
7009
|
+
}, hi = {
|
|
6994
7010
|
s: ["m", 60],
|
|
6995
7011
|
m: ["h", 60],
|
|
6996
7012
|
h: ["d", 24]
|
|
6997
7013
|
};
|
|
6998
|
-
function
|
|
7014
|
+
function gi(e) {
|
|
6999
7015
|
let t = /^(\d+)([a-zA-Z]?)$/.exec(e.trim());
|
|
7000
7016
|
if (!t) return null;
|
|
7001
7017
|
if (t[2] === "T" || t[2] === "t") {
|
|
7002
7018
|
let e = `${Number(t[1])}T`;
|
|
7003
|
-
return Number(t[1]) <=
|
|
7019
|
+
return Number(t[1]) <= pi && S(e) !== null ? e : null;
|
|
7004
7020
|
}
|
|
7005
|
-
let n = Number(t[1]), r =
|
|
7021
|
+
let n = Number(t[1]), r = mi[t[2]];
|
|
7006
7022
|
if (!r || !Number.isSafeInteger(n) || n < 1) return null;
|
|
7007
|
-
for (let e =
|
|
7008
|
-
if (n >
|
|
7023
|
+
for (let e = hi[r]; e && n % e[1] === 0; e = hi[r]) n /= e[1], r = e[0];
|
|
7024
|
+
if (n > pi) return null;
|
|
7009
7025
|
let i = `${n}${r}`;
|
|
7010
7026
|
return re(i) ? i : null;
|
|
7011
7027
|
}
|
|
7012
|
-
function
|
|
7013
|
-
let r = n?.length ? n : null, i = t.filter((e) =>
|
|
7014
|
-
return [...new Set([...e, ...i])].sort(
|
|
7028
|
+
function _i(e, t, n) {
|
|
7029
|
+
let r = n?.length ? n : null, i = t.filter((e) => li(e) && (!r || r.includes(e)));
|
|
7030
|
+
return [...new Set([...e, ...i])].sort(ui);
|
|
7015
7031
|
}
|
|
7016
7032
|
//#endregion
|
|
7017
7033
|
//#region src/widget/WidgetIntervalInput.ts
|
|
7018
|
-
var
|
|
7034
|
+
var vi = 0, yi = class {
|
|
7019
7035
|
el;
|
|
7020
7036
|
input;
|
|
7021
7037
|
hint;
|
|
7022
7038
|
returnFocus = null;
|
|
7023
7039
|
constructor(e, t, n) {
|
|
7024
|
-
this.labels = t, this.onApply = n, this.el = document.createElement("div"), this.el.className = "tcw-interval-input", this.el.hidden = !0, this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "tcw-interval-field", this.input.autocomplete = "off", this.input.spellcheck = !1, this.input.maxLength = 6, this.input.setAttribute("aria-label", t.title), this.hint = document.createElement("div"), this.hint.className = "tcw-interval-hint", this.hint.setAttribute("role", "status"), this.hint.id = `tcw-interval-hint-${++
|
|
7040
|
+
this.labels = t, this.onApply = n, this.el = document.createElement("div"), this.el.className = "tcw-interval-input", this.el.hidden = !0, this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "tcw-interval-field", this.input.autocomplete = "off", this.input.spellcheck = !1, this.input.maxLength = 6, this.input.setAttribute("aria-label", t.title), this.hint = document.createElement("div"), this.hint.className = "tcw-interval-hint", this.hint.setAttribute("role", "status"), this.hint.id = `tcw-interval-hint-${++vi}`, this.input.setAttribute("aria-describedby", this.hint.id), this.el.append(this.input, this.hint), e.appendChild(this.el), this.input.addEventListener("input", () => this.check()), this.input.addEventListener("keydown", (e) => {
|
|
7025
7041
|
e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), this.apply()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close());
|
|
7026
7042
|
}), this.input.addEventListener("blur", () => this.close(!1));
|
|
7027
7043
|
}
|
|
@@ -7041,18 +7057,18 @@ var gi = 0, _i = class {
|
|
|
7041
7057
|
this.el.remove();
|
|
7042
7058
|
}
|
|
7043
7059
|
check() {
|
|
7044
|
-
let e =
|
|
7060
|
+
let e = gi(this.input.value) !== null;
|
|
7045
7061
|
!e && this.input.value.trim() !== "" ? this.input.setAttribute("aria-invalid", "true") : this.input.removeAttribute("aria-invalid"), this.hint.textContent = e || this.input.value.trim() === "" ? this.labels.hint : this.labels.invalid;
|
|
7046
7062
|
}
|
|
7047
7063
|
apply() {
|
|
7048
|
-
let e =
|
|
7064
|
+
let e = gi(this.input.value);
|
|
7049
7065
|
if (e && this.onApply(e)) {
|
|
7050
7066
|
this.close();
|
|
7051
7067
|
return;
|
|
7052
7068
|
}
|
|
7053
7069
|
this.input.setAttribute("aria-invalid", "true"), this.hint.textContent = this.labels.invalid;
|
|
7054
7070
|
}
|
|
7055
|
-
},
|
|
7071
|
+
}, bi = class {
|
|
7056
7072
|
constructor(e = "tcw:indicator-templates") {
|
|
7057
7073
|
this.key = e;
|
|
7058
7074
|
}
|
|
@@ -7098,7 +7114,7 @@ var gi = 0, _i = class {
|
|
|
7098
7114
|
} catch {}
|
|
7099
7115
|
}
|
|
7100
7116
|
}, G = [], K = null;
|
|
7101
|
-
function
|
|
7117
|
+
function xi(e) {
|
|
7102
7118
|
let t = () => {
|
|
7103
7119
|
K = e;
|
|
7104
7120
|
};
|
|
@@ -7122,27 +7138,27 @@ function J() {
|
|
|
7122
7138
|
}
|
|
7123
7139
|
//#endregion
|
|
7124
7140
|
//#region src/widget/widgetLayout.ts
|
|
7125
|
-
var
|
|
7141
|
+
var Si = [
|
|
7126
7142
|
"regular",
|
|
7127
7143
|
"logarithmic",
|
|
7128
7144
|
"percentage",
|
|
7129
7145
|
"indexedTo100"
|
|
7130
|
-
],
|
|
7131
|
-
function
|
|
7146
|
+
], Ci = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
7147
|
+
function wi(e) {
|
|
7132
7148
|
let { theme: t, timestamp: n, ...r } = e;
|
|
7133
7149
|
return r;
|
|
7134
7150
|
}
|
|
7135
|
-
function
|
|
7136
|
-
return !
|
|
7151
|
+
function Ti(e) {
|
|
7152
|
+
return !Ci(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(re(e.timeframe) || S(e.timeframe) !== null) ? null : {
|
|
7137
7153
|
v: 1,
|
|
7138
7154
|
symbol: e.symbol,
|
|
7139
7155
|
timeframe: e.timeframe,
|
|
7140
|
-
scaleMode:
|
|
7156
|
+
scaleMode: Si.find((t) => t === e.scaleMode) ?? "regular",
|
|
7141
7157
|
invertScale: e.invertScale === !0,
|
|
7142
|
-
chart:
|
|
7158
|
+
chart: Ci(e.chart) ? wi(e.chart) : null
|
|
7143
7159
|
};
|
|
7144
7160
|
}
|
|
7145
|
-
function
|
|
7161
|
+
function Ei(e) {
|
|
7146
7162
|
try {
|
|
7147
7163
|
return JSON.parse(e);
|
|
7148
7164
|
} catch {
|
|
@@ -7151,16 +7167,16 @@ function wi(e) {
|
|
|
7151
7167
|
}
|
|
7152
7168
|
//#endregion
|
|
7153
7169
|
//#region src/widget/DrawingFavoritesStore.ts
|
|
7154
|
-
function
|
|
7170
|
+
function Di() {
|
|
7155
7171
|
try {
|
|
7156
7172
|
return typeof localStorage < "u" ? localStorage : null;
|
|
7157
7173
|
} catch {
|
|
7158
7174
|
return null;
|
|
7159
7175
|
}
|
|
7160
7176
|
}
|
|
7161
|
-
var
|
|
7177
|
+
var Oi = class {
|
|
7162
7178
|
favorites = [];
|
|
7163
|
-
constructor(e = "tcw:draw-favorites", t =
|
|
7179
|
+
constructor(e = "tcw:draw-favorites", t = Di()) {
|
|
7164
7180
|
this.storageKey = e, this.storage = t, this.load();
|
|
7165
7181
|
}
|
|
7166
7182
|
list() {
|
|
@@ -7194,9 +7210,9 @@ var Ei = class {
|
|
|
7194
7210
|
this.storage.setItem(this.storageKey, JSON.stringify(this.favorites));
|
|
7195
7211
|
} catch {}
|
|
7196
7212
|
}
|
|
7197
|
-
},
|
|
7198
|
-
function
|
|
7199
|
-
let r =
|
|
7213
|
+
}, ki = /^(\d{4})-(\d{2})-(\d{2})$/, Ai = /^(\d{2}):(\d{2})$/;
|
|
7214
|
+
function ji(e, t, n) {
|
|
7215
|
+
let r = ki.exec(e), i = t ? Ai.exec(t) : [
|
|
7200
7216
|
"",
|
|
7201
7217
|
"00",
|
|
7202
7218
|
"00"
|
|
@@ -7220,7 +7236,7 @@ function Y(e, t) {
|
|
|
7220
7236
|
time: `${n(r.hours)}:${n(r.minutes)}`
|
|
7221
7237
|
};
|
|
7222
7238
|
}
|
|
7223
|
-
var
|
|
7239
|
+
var Mi = class {
|
|
7224
7240
|
form = null;
|
|
7225
7241
|
returnFocus = null;
|
|
7226
7242
|
opener = null;
|
|
@@ -7275,7 +7291,7 @@ var Ai = class {
|
|
|
7275
7291
|
let o = document.createElement("input");
|
|
7276
7292
|
return o.type = n, o.value = r, o.className = "tcw-goto-input", i.append(a, o), e.appendChild(i), o;
|
|
7277
7293
|
}
|
|
7278
|
-
}, X = 8,
|
|
7294
|
+
}, X = 8, Ni = 4, Pi = 3, Fi = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", Ii = class {
|
|
7279
7295
|
el;
|
|
7280
7296
|
target = null;
|
|
7281
7297
|
source = null;
|
|
@@ -7286,9 +7302,9 @@ var Ai = class {
|
|
|
7286
7302
|
observer;
|
|
7287
7303
|
constructor(e) {
|
|
7288
7304
|
this.root = e, this.el = document.createElement("div"), this.el.className = "tcw-tooltip", this.el.setAttribute("aria-hidden", "true"), e.appendChild(this.el), e.addEventListener("pointerover", this.onOver), e.addEventListener("pointerout", this.onOut), e.addEventListener("pointerdown", this.onPress, !0), e.addEventListener("keydown", this.onPress, !0), e.addEventListener("focusin", this.onFocus), e.addEventListener("focusout", this.onBlur), e.addEventListener("wheel", this.hide, { passive: !0 }), this.observer = new MutationObserver(() => {
|
|
7289
|
-
this.pressed?.hasAttribute("title") &&
|
|
7305
|
+
this.pressed?.hasAttribute("title") && Li(this.pressed);
|
|
7290
7306
|
let e = this.target;
|
|
7291
|
-
!e || this.source !== "pointer" || !e.hasAttribute("title") || (
|
|
7307
|
+
!e || this.source !== "pointer" || !e.hasAttribute("title") || (Li(e), this.isVisible() && this.show(e));
|
|
7292
7308
|
}), this.observer.observe(e, {
|
|
7293
7309
|
subtree: !0,
|
|
7294
7310
|
attributes: !0,
|
|
@@ -7301,7 +7317,7 @@ var Ai = class {
|
|
|
7301
7317
|
onOver = (e) => {
|
|
7302
7318
|
if (e.pointerType === "touch") return;
|
|
7303
7319
|
let t = this.tipTarget(e.target);
|
|
7304
|
-
!t || t === this.pressed || t === this.target && this.source === "pointer" || (
|
|
7320
|
+
!t || t === this.pressed || t === this.target && this.source === "pointer" || (Li(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
|
|
7305
7321
|
};
|
|
7306
7322
|
onOut = (e) => {
|
|
7307
7323
|
let t = e.relatedTarget, n = (e) => !!e && !!t && e.contains(t);
|
|
@@ -7313,7 +7329,7 @@ var Ai = class {
|
|
|
7313
7329
|
};
|
|
7314
7330
|
onFocus = (e) => {
|
|
7315
7331
|
let t = this.tipTarget(e.target);
|
|
7316
|
-
!t || !
|
|
7332
|
+
!t || !Bi(t) || t === this.pressed || this.schedule(t, "focus", !0);
|
|
7317
7333
|
};
|
|
7318
7334
|
onBlur = (e) => {
|
|
7319
7335
|
if (this.source !== "focus") return;
|
|
@@ -7325,7 +7341,7 @@ var Ai = class {
|
|
|
7325
7341
|
};
|
|
7326
7342
|
tipTarget(e) {
|
|
7327
7343
|
if (!(e instanceof Element)) return null;
|
|
7328
|
-
let t = e.closest(
|
|
7344
|
+
let t = e.closest(Fi);
|
|
7329
7345
|
return t && t !== this.el && this.root.contains(t) ? t : null;
|
|
7330
7346
|
}
|
|
7331
7347
|
schedule(e, t, n) {
|
|
@@ -7339,27 +7355,27 @@ var Ai = class {
|
|
|
7339
7355
|
}, 300);
|
|
7340
7356
|
}
|
|
7341
7357
|
show(e) {
|
|
7342
|
-
if (!
|
|
7358
|
+
if (!zi(e)) {
|
|
7343
7359
|
this.hide();
|
|
7344
7360
|
return;
|
|
7345
7361
|
}
|
|
7346
|
-
this.el.textContent =
|
|
7362
|
+
this.el.textContent = Ri(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
|
|
7347
7363
|
}
|
|
7348
7364
|
watch(e) {
|
|
7349
7365
|
cancelAnimationFrame(this.watchFrame), this.watchFrame = requestAnimationFrame(() => {
|
|
7350
|
-
this.target === e && (
|
|
7366
|
+
this.target === e && (zi(e) ? this.watch(e) : this.hide());
|
|
7351
7367
|
});
|
|
7352
7368
|
}
|
|
7353
7369
|
place(e) {
|
|
7354
|
-
let t = this.root.getBoundingClientRect(), n = e.getBoundingClientRect(), r = this.el.offsetWidth, i = this.el.offsetHeight, a = n.left - t.left, o = n.top - t.top, s =
|
|
7370
|
+
let t = this.root.getBoundingClientRect(), n = e.getBoundingClientRect(), r = this.el.offsetWidth, i = this.el.offsetHeight, a = n.left - t.left, o = n.top - t.top, s = Vi(e);
|
|
7355
7371
|
s === "bottom" && o + n.height + X + i > t.height ? s = "top" : s === "top" && o - X - i < 0 ? s = "bottom" : s === "right" && a + n.width + X + r > t.width && (s = "left");
|
|
7356
7372
|
let c, l;
|
|
7357
|
-
s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + X : o - X - i) : (c = s === "right" ? a + n.width + X : a - X - r, l = o + n.height / 2 - i / 2), c = Math.max(
|
|
7373
|
+
s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + X : o - X - i) : (c = s === "right" ? a + n.width + X : a - X - r, l = o + n.height / 2 - i / 2), c = Math.max(Ni, Math.min(t.width - r - Ni, c)), l = Math.max(Ni, Math.min(t.height - i - Ni, l)), this.el.style.left = `${Math.round(c)}px`, this.el.style.top = `${Math.round(l)}px`;
|
|
7358
7374
|
let u = {
|
|
7359
|
-
top: [0,
|
|
7360
|
-
bottom: [0, -
|
|
7361
|
-
left: [
|
|
7362
|
-
right: [-
|
|
7375
|
+
top: [0, Pi],
|
|
7376
|
+
bottom: [0, -Pi],
|
|
7377
|
+
left: [Pi, 0],
|
|
7378
|
+
right: [-Pi, 0]
|
|
7363
7379
|
}[s];
|
|
7364
7380
|
this.el.style.setProperty("--tcw-tip-dx", `${u[0]}px`), this.el.style.setProperty("--tcw-tip-dy", `${u[1]}px`), this.el.dataset.side = s;
|
|
7365
7381
|
}
|
|
@@ -7370,32 +7386,32 @@ var Ai = class {
|
|
|
7370
7386
|
this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
|
|
7371
7387
|
}
|
|
7372
7388
|
};
|
|
7373
|
-
function
|
|
7389
|
+
function Li(e) {
|
|
7374
7390
|
let t = e.getAttribute("title");
|
|
7375
7391
|
t !== null && (e.dataset.tip = t, e.removeAttribute("title"));
|
|
7376
7392
|
}
|
|
7377
7393
|
function Z(e) {
|
|
7378
7394
|
e.dataset.tip !== void 0 && !e.hasAttribute("title") && (e.setAttribute("title", e.dataset.tip), delete e.dataset.tip);
|
|
7379
7395
|
}
|
|
7380
|
-
function
|
|
7396
|
+
function Ri(e) {
|
|
7381
7397
|
return e.dataset.tip ?? e.getAttribute("title") ?? "";
|
|
7382
7398
|
}
|
|
7383
|
-
function
|
|
7399
|
+
function zi(e) {
|
|
7384
7400
|
return e.isConnected && e.getClientRects().length > 0 && !e.disabled;
|
|
7385
7401
|
}
|
|
7386
|
-
function
|
|
7402
|
+
function Bi(e) {
|
|
7387
7403
|
try {
|
|
7388
7404
|
return e.matches(":focus-visible");
|
|
7389
7405
|
} catch {
|
|
7390
7406
|
return !1;
|
|
7391
7407
|
}
|
|
7392
7408
|
}
|
|
7393
|
-
function
|
|
7409
|
+
function Vi(e) {
|
|
7394
7410
|
return e.dataset.tipSide || (e.closest(".tcw-sidebar") ? "right" : e.closest(".tcw-statusbar, .tcw-replay-bar") ? "top" : "bottom");
|
|
7395
7411
|
}
|
|
7396
7412
|
//#endregion
|
|
7397
7413
|
//#region src/widget/WidgetIndicatorLegend.ts
|
|
7398
|
-
var
|
|
7414
|
+
var Hi = 2, Ui = class {
|
|
7399
7415
|
stack;
|
|
7400
7416
|
toggle;
|
|
7401
7417
|
rows = /* @__PURE__ */ new Map();
|
|
@@ -7520,7 +7536,7 @@ var Bi = 2, Vi = class {
|
|
|
7520
7536
|
return this.stack.querySelectorAll(":scope > .tcw-ind-legend-row").length;
|
|
7521
7537
|
}
|
|
7522
7538
|
renderToggle(e) {
|
|
7523
|
-
let t = e >=
|
|
7539
|
+
let t = e >= Hi;
|
|
7524
7540
|
!t && this.collapsed && this.setCollapsed(!1);
|
|
7525
7541
|
let n = `${t}|${this.collapsed}|${e}`;
|
|
7526
7542
|
if (n === this.toggleKey || (this.toggleKey = n, this.toggle.hidden = !t, !t)) return;
|
|
@@ -7535,7 +7551,7 @@ function Q(e, t, n) {
|
|
|
7535
7551
|
}
|
|
7536
7552
|
//#endregion
|
|
7537
7553
|
//#region src/widget/legendValues.ts
|
|
7538
|
-
function
|
|
7554
|
+
function Wi(e, t, n, r) {
|
|
7539
7555
|
if (!t) return [];
|
|
7540
7556
|
let i = e.plots;
|
|
7541
7557
|
if (!i) {
|
|
@@ -7565,20 +7581,20 @@ function Hi(e, t, n, r) {
|
|
|
7565
7581
|
}
|
|
7566
7582
|
return o;
|
|
7567
7583
|
}
|
|
7568
|
-
var
|
|
7569
|
-
function
|
|
7570
|
-
let t =
|
|
7584
|
+
var Gi = /* @__PURE__ */ new Map();
|
|
7585
|
+
function Ki(e) {
|
|
7586
|
+
let t = Gi.get(e);
|
|
7571
7587
|
return t || (t = new Intl.NumberFormat(e, {
|
|
7572
7588
|
notation: "compact",
|
|
7573
7589
|
maximumFractionDigits: 2
|
|
7574
|
-
}),
|
|
7590
|
+
}), Gi.set(e, t)), t;
|
|
7575
7591
|
}
|
|
7576
|
-
function
|
|
7577
|
-
return Math.abs(e) >= 1e6 ?
|
|
7592
|
+
function qi(e, t = "en-US") {
|
|
7593
|
+
return Math.abs(e) >= 1e6 ? Ki(t).format(e) : te(e, Se(e), t);
|
|
7578
7594
|
}
|
|
7579
7595
|
//#endregion
|
|
7580
7596
|
//#region src/widget/WidgetBracketBar.ts
|
|
7581
|
-
var
|
|
7597
|
+
var Ji = class {
|
|
7582
7598
|
el;
|
|
7583
7599
|
labelEl;
|
|
7584
7600
|
callbacks;
|
|
@@ -7604,7 +7620,7 @@ var Ki = class {
|
|
|
7604
7620
|
destroy() {
|
|
7605
7621
|
this.el.remove();
|
|
7606
7622
|
}
|
|
7607
|
-
},
|
|
7623
|
+
}, Yi = class {
|
|
7608
7624
|
options;
|
|
7609
7625
|
audioCtx = null;
|
|
7610
7626
|
audioEl = null;
|
|
@@ -7667,7 +7683,7 @@ var Ki = class {
|
|
|
7667
7683
|
};
|
|
7668
7684
|
//#endregion
|
|
7669
7685
|
//#region src/widget/ladderRows.ts
|
|
7670
|
-
function
|
|
7686
|
+
function Xi(e, t = 12) {
|
|
7671
7687
|
let n = [...e.asks].sort((e, t) => e.price - t.price).slice(0, t), r = [...e.bids].sort((e, t) => t.price - e.price).slice(0, t), i = n.length > 0 ? n[0].price : null, a = r.length > 0 ? r[0].price : null, o = i !== null && a !== null ? (i + a) / 2 : null, s = /* @__PURE__ */ new Map(), c = (e) => {
|
|
7672
7688
|
let t = s.get(e);
|
|
7673
7689
|
return t || (t = {
|
|
@@ -7688,7 +7704,7 @@ function Ji(e, t = 12) {
|
|
|
7688
7704
|
}
|
|
7689
7705
|
//#endregion
|
|
7690
7706
|
//#region src/widget/WidgetDepthLadder.ts
|
|
7691
|
-
var
|
|
7707
|
+
var Zi = class {
|
|
7692
7708
|
el;
|
|
7693
7709
|
bodyEl;
|
|
7694
7710
|
callbacks;
|
|
@@ -7726,7 +7742,7 @@ var Yi = class {
|
|
|
7726
7742
|
this.renderEmpty();
|
|
7727
7743
|
return;
|
|
7728
7744
|
}
|
|
7729
|
-
this.render(
|
|
7745
|
+
this.render(Xi(e, this.levels));
|
|
7730
7746
|
}
|
|
7731
7747
|
destroy() {
|
|
7732
7748
|
this.el.remove();
|
|
@@ -7746,20 +7762,20 @@ var Yi = class {
|
|
|
7746
7762
|
let e = n.askVolume > 0, r = document.createElement("div");
|
|
7747
7763
|
r.className = "tcw-ladder-row";
|
|
7748
7764
|
let i = document.createElement("button");
|
|
7749
|
-
i.type = "button", i.className = "tcw-ladder-cell tcw-ladder-bid", n.bidVolume > 0 ? (i.textContent =
|
|
7765
|
+
i.type = "button", i.className = "tcw-ladder-cell tcw-ladder-bid", n.bidVolume > 0 ? (i.textContent = Qi(n.bidVolume), i.style.setProperty("--w", `${(n.bidVolume * t * 100).toFixed(1)}%`), i.title = p(this.t("ladder.sellAt"), { price: this.callbacks.formatPrice(n.price) }), i.addEventListener("click", () => this.callbacks.onTrade("sell", n.price))) : i.disabled = !0;
|
|
7750
7766
|
let a = document.createElement("div");
|
|
7751
7767
|
a.className = `tcw-ladder-price ${e ? "tcw-ask" : "tcw-bid"}`, a.textContent = this.callbacks.formatPrice(n.price);
|
|
7752
7768
|
let o = document.createElement("button");
|
|
7753
|
-
o.type = "button", o.className = "tcw-ladder-cell tcw-ladder-ask", n.askVolume > 0 ? (o.textContent =
|
|
7769
|
+
o.type = "button", o.className = "tcw-ladder-cell tcw-ladder-ask", n.askVolume > 0 ? (o.textContent = Qi(n.askVolume), o.style.setProperty("--w", `${(n.askVolume * t * 100).toFixed(1)}%`), o.title = p(this.t("ladder.buyAt"), { price: this.callbacks.formatPrice(n.price) }), o.addEventListener("click", () => this.callbacks.onTrade("buy", n.price))) : o.disabled = !0, r.appendChild(i), r.appendChild(a), r.appendChild(o), this.bodyEl.appendChild(r);
|
|
7754
7770
|
}
|
|
7755
7771
|
}
|
|
7756
7772
|
};
|
|
7757
|
-
function
|
|
7773
|
+
function Qi(e) {
|
|
7758
7774
|
return e >= 1e3 ? (e / 1e3).toFixed(1) + "k" : e >= 1 ? e.toFixed(2).replace(/\.00$/, "") : e.toPrecision(2);
|
|
7759
7775
|
}
|
|
7760
7776
|
//#endregion
|
|
7761
7777
|
//#region src/widget/WidgetDataWindow.ts
|
|
7762
|
-
var
|
|
7778
|
+
var $i = class {
|
|
7763
7779
|
el;
|
|
7764
7780
|
bodyEl;
|
|
7765
7781
|
callbacks;
|
|
@@ -7798,11 +7814,11 @@ var Zi = class {
|
|
|
7798
7814
|
let t = this.callbacks.formatPrice, n = e.ohlc;
|
|
7799
7815
|
this.bodyEl.appendChild(this.row(this.t("dataWindow.open"), t(n.open))), this.bodyEl.appendChild(this.row(this.t("dataWindow.high"), t(n.high))), this.bodyEl.appendChild(this.row(this.t("dataWindow.low"), t(n.low))), this.bodyEl.appendChild(this.row(this.t("dataWindow.close"), t(n.close)));
|
|
7800
7816
|
let r = e.change > 0 ? "up" : e.change < 0 ? "down" : "", i = e.change > 0 ? "+" : "";
|
|
7801
|
-
this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${t(e.change)} (${i}${e.changePct.toFixed(2)}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"),
|
|
7817
|
+
this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${t(e.change)} (${i}${e.changePct.toFixed(2)}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), ta(n.volume)));
|
|
7802
7818
|
for (let t of e.indicators) {
|
|
7803
7819
|
let e = document.createElement("div");
|
|
7804
7820
|
e.className = "tcw-datawin-sub", e.textContent = t.name, this.bodyEl.appendChild(e);
|
|
7805
|
-
for (let e of t.values) this.bodyEl.appendChild(this.row(e.key,
|
|
7821
|
+
for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, ea(e.value)));
|
|
7806
7822
|
}
|
|
7807
7823
|
}
|
|
7808
7824
|
row(e, t, n = "") {
|
|
@@ -7814,43 +7830,43 @@ var Zi = class {
|
|
|
7814
7830
|
return a.className = `tcw-datawin-value${n ? ` tcw-${n}` : ""}`, a.textContent = t, r.appendChild(i), r.appendChild(a), r;
|
|
7815
7831
|
}
|
|
7816
7832
|
};
|
|
7817
|
-
function
|
|
7833
|
+
function ea(e) {
|
|
7818
7834
|
if (!Number.isFinite(e)) return "—";
|
|
7819
7835
|
let t = Math.abs(e);
|
|
7820
7836
|
return t >= 1e3 ? e.toFixed(2) : t >= 1 ? e.toFixed(4) : e.toPrecision(4);
|
|
7821
7837
|
}
|
|
7822
|
-
function
|
|
7838
|
+
function ta(e) {
|
|
7823
7839
|
return e >= 1e9 ? (e / 1e9).toFixed(2) + "B" : e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(2) + "K" : e.toFixed(0);
|
|
7824
7840
|
}
|
|
7825
7841
|
//#endregion
|
|
7826
7842
|
//#region src/widget/widgetShareState.ts
|
|
7827
|
-
var
|
|
7828
|
-
function
|
|
7829
|
-
if (
|
|
7843
|
+
var na = globalThis.Buffer;
|
|
7844
|
+
function ra(e) {
|
|
7845
|
+
if (na) return na.from(e, "utf8").toString("base64");
|
|
7830
7846
|
let t = new TextEncoder().encode(e), n = "";
|
|
7831
7847
|
for (let e of t) n += String.fromCharCode(e);
|
|
7832
7848
|
return btoa(n);
|
|
7833
7849
|
}
|
|
7834
|
-
function
|
|
7835
|
-
if (
|
|
7850
|
+
function ia(e) {
|
|
7851
|
+
if (na) return na.from(e, "base64").toString("utf8");
|
|
7836
7852
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
7837
7853
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
7838
7854
|
return new TextDecoder().decode(n);
|
|
7839
7855
|
}
|
|
7840
|
-
function
|
|
7856
|
+
function aa(e) {
|
|
7841
7857
|
return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
7842
7858
|
}
|
|
7843
|
-
function
|
|
7859
|
+
function oa(e) {
|
|
7844
7860
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
7845
7861
|
return t + (t.length % 4 == 0 ? "" : "=".repeat(4 - t.length % 4));
|
|
7846
7862
|
}
|
|
7847
|
-
function
|
|
7848
|
-
return ra(
|
|
7863
|
+
function sa(e) {
|
|
7864
|
+
return aa(ra(JSON.stringify(e)));
|
|
7849
7865
|
}
|
|
7850
|
-
function
|
|
7866
|
+
function ca(e) {
|
|
7851
7867
|
if (!e) return null;
|
|
7852
7868
|
try {
|
|
7853
|
-
let t =
|
|
7869
|
+
let t = ia(oa(e)), n = JSON.parse(t);
|
|
7854
7870
|
return !n || n.v !== 1 || typeof n.symbol != "string" ? null : {
|
|
7855
7871
|
v: 1,
|
|
7856
7872
|
symbol: n.symbol,
|
|
@@ -7864,20 +7880,20 @@ function oa(e) {
|
|
|
7864
7880
|
return null;
|
|
7865
7881
|
}
|
|
7866
7882
|
}
|
|
7867
|
-
var
|
|
7868
|
-
function
|
|
7883
|
+
var la = "tcw";
|
|
7884
|
+
function ua(e) {
|
|
7869
7885
|
let t = e.startsWith("#") ? e.slice(1) : e;
|
|
7870
7886
|
for (let e of t.split("&")) {
|
|
7871
7887
|
let t = e.indexOf("=");
|
|
7872
|
-
if (t > 0 && e.slice(0, t) ===
|
|
7888
|
+
if (t > 0 && e.slice(0, t) === la) return decodeURIComponent(e.slice(t + 1));
|
|
7873
7889
|
}
|
|
7874
7890
|
return null;
|
|
7875
7891
|
}
|
|
7876
|
-
function
|
|
7892
|
+
function da(e, t) {
|
|
7877
7893
|
let [n] = e.split("#");
|
|
7878
|
-
return `${n}#${
|
|
7894
|
+
return `${n}#${la}=${t}`;
|
|
7879
7895
|
}
|
|
7880
|
-
var
|
|
7896
|
+
var fa = [
|
|
7881
7897
|
[
|
|
7882
7898
|
34,
|
|
7883
7899
|
16,
|
|
@@ -7934,7 +7950,7 @@ var ua = [
|
|
|
7934
7950
|
30,
|
|
7935
7951
|
!0
|
|
7936
7952
|
]
|
|
7937
|
-
],
|
|
7953
|
+
], pa = class {
|
|
7938
7954
|
el;
|
|
7939
7955
|
label;
|
|
7940
7956
|
showTimer = null;
|
|
@@ -7944,7 +7960,7 @@ var ua = [
|
|
|
7944
7960
|
let n = document.createElement("div");
|
|
7945
7961
|
n.className = "tcw-loading-card";
|
|
7946
7962
|
let r = document.createElement("div");
|
|
7947
|
-
r.className = "tcw-loading-candles", r.setAttribute("aria-hidden", "true"),
|
|
7963
|
+
r.className = "tcw-loading-candles", r.setAttribute("aria-hidden", "true"), fa.forEach(([e, t, n, i, a], o) => {
|
|
7948
7964
|
let s = document.createElement("span");
|
|
7949
7965
|
s.className = a ? "tcw-loading-candle tcw-loading-candle--up" : "tcw-loading-candle", s.style.setProperty("--tcw-body-top", `${e}px`), s.style.setProperty("--tcw-body-h", `${t}px`), s.style.setProperty("--tcw-wick-top", `${n}px`), s.style.setProperty("--tcw-wick-h", `${i}px`), s.style.setProperty("--tcw-delay", `${o * 110}ms`), r.appendChild(s);
|
|
7950
7966
|
}), n.appendChild(r);
|
|
@@ -7981,7 +7997,7 @@ var ua = [
|
|
|
7981
7997
|
clearTimer() {
|
|
7982
7998
|
this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
|
|
7983
7999
|
}
|
|
7984
|
-
},
|
|
8000
|
+
}, ma = 4e3, ha = class {
|
|
7985
8001
|
el;
|
|
7986
8002
|
text;
|
|
7987
8003
|
hideTimer = null;
|
|
@@ -7991,7 +8007,7 @@ var ua = [
|
|
|
7991
8007
|
n.className = "tcw-history-spinner", n.setAttribute("aria-hidden", "true"), this.text = document.createElement("span"), this.el.append(n, this.text), e.appendChild(this.el);
|
|
7992
8008
|
}
|
|
7993
8009
|
update(e) {
|
|
7994
|
-
this.clearTimer(), e.state === "loading" ? this.show(this.texts.loading, !1) : e.state === "error" ? (this.show(this.texts.failed, !0), this.hideTimer = setTimeout(() => this.hide(),
|
|
8010
|
+
this.clearTimer(), e.state === "loading" ? this.show(this.texts.loading, !1) : e.state === "error" ? (this.show(this.texts.failed, !0), this.hideTimer = setTimeout(() => this.hide(), ma)) : this.hide();
|
|
7995
8011
|
}
|
|
7996
8012
|
destroy() {
|
|
7997
8013
|
this.clearTimer(), this.el.remove();
|
|
@@ -8005,13 +8021,13 @@ var ua = [
|
|
|
8005
8021
|
clearTimer() {
|
|
8006
8022
|
this.hideTimer !== null && clearTimeout(this.hideTimer), this.hideTimer = null;
|
|
8007
8023
|
}
|
|
8008
|
-
},
|
|
8009
|
-
function
|
|
8024
|
+
}, ga = "host:";
|
|
8025
|
+
function _a(e, t) {
|
|
8010
8026
|
return [
|
|
8011
8027
|
...e,
|
|
8012
8028
|
...e.length > 0 && t.length > 0 ? ["separator"] : [],
|
|
8013
8029
|
...t.map((e, t) => ({
|
|
8014
|
-
id: `${
|
|
8030
|
+
id: `${ga}${t}`,
|
|
8015
8031
|
label: e.label,
|
|
8016
8032
|
icon: e.icon,
|
|
8017
8033
|
danger: e.danger,
|
|
@@ -8019,12 +8035,12 @@ function ha(e, t) {
|
|
|
8019
8035
|
}))
|
|
8020
8036
|
];
|
|
8021
8037
|
}
|
|
8022
|
-
function
|
|
8023
|
-
return e.startsWith(
|
|
8038
|
+
function va(e, t) {
|
|
8039
|
+
return e.startsWith(ga) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
|
|
8024
8040
|
}
|
|
8025
8041
|
//#endregion
|
|
8026
8042
|
//#region src/widget/hostHotkeys.ts
|
|
8027
|
-
var
|
|
8043
|
+
var ya = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), ba = {
|
|
8028
8044
|
ctrl: "ctrl",
|
|
8029
8045
|
control: "ctrl",
|
|
8030
8046
|
cmd: "ctrl",
|
|
@@ -8035,7 +8051,7 @@ var _a = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
|
|
|
8035
8051
|
option: "alt",
|
|
8036
8052
|
opt: "alt",
|
|
8037
8053
|
shift: "shift"
|
|
8038
|
-
},
|
|
8054
|
+
}, xa = {
|
|
8039
8055
|
esc: "escape",
|
|
8040
8056
|
space: " ",
|
|
8041
8057
|
spacebar: " ",
|
|
@@ -8047,7 +8063,7 @@ var _a = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
|
|
|
8047
8063
|
return: "enter",
|
|
8048
8064
|
plus: "+"
|
|
8049
8065
|
};
|
|
8050
|
-
function
|
|
8066
|
+
function Sa(e) {
|
|
8051
8067
|
let t = e.split("+").map((e) => e.trim()), n = t.pop();
|
|
8052
8068
|
if (!n) return null;
|
|
8053
8069
|
let r = {
|
|
@@ -8057,23 +8073,23 @@ function ba(e) {
|
|
|
8057
8073
|
display: []
|
|
8058
8074
|
};
|
|
8059
8075
|
for (let e of t) {
|
|
8060
|
-
let t =
|
|
8076
|
+
let t = ba[e.toLowerCase()];
|
|
8061
8077
|
if (!t) return null;
|
|
8062
8078
|
r[t] = !0;
|
|
8063
8079
|
}
|
|
8064
8080
|
let i = n.toLowerCase();
|
|
8065
|
-
if (
|
|
8081
|
+
if (ba[i]) return null;
|
|
8066
8082
|
if (/^[a-z]$/.test(i)) r.code = `Key${i.toUpperCase()}`, r.char = i;
|
|
8067
8083
|
else if (/^[0-9]$/.test(i)) r.code = `Digit${i}`, r.char = i;
|
|
8068
|
-
else if (r.key =
|
|
8084
|
+
else if (r.key = xa[i] ?? i, r.shift && r.key.length === 1) return null;
|
|
8069
8085
|
return r.display = [
|
|
8070
|
-
...r.ctrl ? [
|
|
8086
|
+
...r.ctrl ? [ya ? "⌘" : "Ctrl"] : [],
|
|
8071
8087
|
...r.alt ? ["Alt"] : [],
|
|
8072
8088
|
...r.shift ? ["Shift"] : [],
|
|
8073
8089
|
r.key === " " ? "Space" : n.length === 1 ? n.toUpperCase() : n
|
|
8074
8090
|
], r;
|
|
8075
8091
|
}
|
|
8076
|
-
function
|
|
8092
|
+
function Ca(e, t) {
|
|
8077
8093
|
if ((e.ctrlKey || e.metaKey) !== t.ctrl || e.altKey !== t.alt) return !1;
|
|
8078
8094
|
if (t.code !== void 0) {
|
|
8079
8095
|
if (e.shiftKey !== t.shift) return !1;
|
|
@@ -8083,38 +8099,38 @@ function xa(e, t) {
|
|
|
8083
8099
|
}
|
|
8084
8100
|
return t.shift && !e.shiftKey ? !1 : e.key.toLowerCase() === t.key;
|
|
8085
8101
|
}
|
|
8086
|
-
var
|
|
8087
|
-
function
|
|
8102
|
+
var wa = new Set(/* @__PURE__ */ "escape(enter(delete(backspace(arrowleft(arrowright(arrowup(arrowdown(home(end(+(-(=( (,(.(ctrl+z(ctrl+shift+z(ctrl+y(ctrl+c(ctrl+v(ctrl+d(ctrl+g(ctrl+shift+g(ctrl+[(ctrl+]".split("("));
|
|
8103
|
+
function Ta(e) {
|
|
8088
8104
|
let t = `${e.ctrl ? "ctrl+" : ""}${e.alt ? "alt+" : ""}${e.shift ? "shift+" : ""}${e.char ?? e.key}`;
|
|
8089
|
-
return
|
|
8105
|
+
return wa.has(t);
|
|
8090
8106
|
}
|
|
8091
|
-
function
|
|
8107
|
+
function Ea(e) {
|
|
8092
8108
|
let t = typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
|
|
8093
8109
|
return t instanceof HTMLElement ? t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) : !1;
|
|
8094
8110
|
}
|
|
8095
8111
|
//#endregion
|
|
8096
8112
|
//#region src/widget/ChartWidget.ts
|
|
8097
|
-
var
|
|
8098
|
-
function
|
|
8113
|
+
var Da = 48, Oa = 5e4, ka = 100;
|
|
8114
|
+
function Aa() {
|
|
8099
8115
|
return new Promise((e) => {
|
|
8100
8116
|
if (typeof requestAnimationFrame != "function" || document.hidden) {
|
|
8101
8117
|
setTimeout(e, 0);
|
|
8102
8118
|
return;
|
|
8103
8119
|
}
|
|
8104
|
-
let t = setTimeout(e,
|
|
8120
|
+
let t = setTimeout(e, ka);
|
|
8105
8121
|
requestAnimationFrame(() => setTimeout(() => {
|
|
8106
8122
|
clearTimeout(t), e();
|
|
8107
8123
|
}, 0));
|
|
8108
8124
|
});
|
|
8109
8125
|
}
|
|
8110
|
-
var
|
|
8126
|
+
var ja = [
|
|
8111
8127
|
"#4c8dff",
|
|
8112
8128
|
"#a57cff",
|
|
8113
8129
|
"#1398a8",
|
|
8114
8130
|
"#e25592",
|
|
8115
8131
|
"#8a93a3",
|
|
8116
8132
|
"#62c895"
|
|
8117
|
-
],
|
|
8133
|
+
], Ma = 4, Na = 7, Pa = 17, Fa = 3, Ia = [
|
|
8118
8134
|
"1m",
|
|
8119
8135
|
"3m",
|
|
8120
8136
|
"5m",
|
|
@@ -8124,17 +8140,17 @@ var ka = [
|
|
|
8124
8140
|
"2h",
|
|
8125
8141
|
"4h",
|
|
8126
8142
|
"1d"
|
|
8127
|
-
],
|
|
8143
|
+
], La = 5e3, Ra = () => {
|
|
8128
8144
|
let e = document.activeElement;
|
|
8129
8145
|
return e instanceof Element && e.closest("[role=\"dialog\"], [aria-modal=\"true\"], [role=\"menu\"]") !== null;
|
|
8130
|
-
},
|
|
8146
|
+
}, za = {
|
|
8131
8147
|
KeyT: "trendLine",
|
|
8132
8148
|
KeyH: "horizontalLine",
|
|
8133
8149
|
KeyJ: "horizontalRay",
|
|
8134
8150
|
KeyV: "verticalLine",
|
|
8135
8151
|
KeyC: "crossLine",
|
|
8136
8152
|
KeyF: "fibRetracement"
|
|
8137
|
-
},
|
|
8153
|
+
}, Ba = 229, Va = Ke.filter((e) => g[e] !== "color"), Ha = (e) => (e[e.length - 1]?.time ?? 0) > 0xe8d4a51000 ? 1 : 1e3, Ua = class {
|
|
8138
8154
|
chart;
|
|
8139
8155
|
state;
|
|
8140
8156
|
themeOf = {
|
|
@@ -8175,7 +8191,7 @@ var ka = [
|
|
|
8175
8191
|
symbolLoads = /* @__PURE__ */ new Map();
|
|
8176
8192
|
ui;
|
|
8177
8193
|
legendMenu = null;
|
|
8178
|
-
templates = new
|
|
8194
|
+
templates = new bi();
|
|
8179
8195
|
templatePrompt = null;
|
|
8180
8196
|
intervalInput = null;
|
|
8181
8197
|
markerTip = null;
|
|
@@ -8190,9 +8206,9 @@ var ka = [
|
|
|
8190
8206
|
dataWindow = null;
|
|
8191
8207
|
lastHoverIndex = null;
|
|
8192
8208
|
legendHoverIndex = null;
|
|
8193
|
-
favoritesStore = new
|
|
8194
|
-
timeframeFavorites = new
|
|
8195
|
-
customTimeframes = new
|
|
8209
|
+
favoritesStore = new Oi();
|
|
8210
|
+
timeframeFavorites = new Oi("tcw:tf-favorites");
|
|
8211
|
+
customTimeframes = new Oi("tcw:tf-custom");
|
|
8196
8212
|
timeframes = [];
|
|
8197
8213
|
watchlist = null;
|
|
8198
8214
|
watchlistSparkBuffer = /* @__PURE__ */ new Map();
|
|
@@ -8293,8 +8309,8 @@ var ka = [
|
|
|
8293
8309
|
legendVisible: s.legend !== !1,
|
|
8294
8310
|
barCountdown: s.barCountdown !== !1,
|
|
8295
8311
|
indicatorValueLabels: s.indicatorValueLabels !== !1
|
|
8296
|
-
}, this.settingsState = { ...this.settingsDefaults }, this.timeframes =
|
|
8297
|
-
let e =
|
|
8312
|
+
}, this.settingsState = { ...this.settingsDefaults }, this.timeframes = _i(di(t.timeframes, s.timeframes), this.customTimeframes.list(), s.timeframes), !this.timeframes.some((e) => this.timeframeFavorites.has(e))) {
|
|
8313
|
+
let e = fi(this.timeframes, s.defaultTimeframeFavorites, !!t.timeframes?.length);
|
|
8298
8314
|
for (let t of e) this.timeframeFavorites.add(t);
|
|
8299
8315
|
}
|
|
8300
8316
|
let l = t.timeframe ?? "5m", u = !s.timeframes?.length || s.timeframes.includes(l) ? l : this.timeframes[0] ?? l;
|
|
@@ -8313,8 +8329,8 @@ var ka = [
|
|
|
8313
8329
|
connectionState: t.adapter ? "connecting" : "disconnected",
|
|
8314
8330
|
connectionMessage: t.adapter ? this.t("status.connecting") : ""
|
|
8315
8331
|
}, ut(), this.root = document.createElement("div"), this.root.className = "tcw-root", this.root.dataset.tcwTheme = i ? "dark" : "light";
|
|
8316
|
-
let m = t.dir === "ltr" || t.dir === "rtl" ? t.dir :
|
|
8317
|
-
this.root.dir = m, this.portal.dir = m, e.appendChild(this.root), this.tooltip = new
|
|
8332
|
+
let m = t.dir === "ltr" || t.dir === "rtl" ? t.dir : $a(t.locale) ? "rtl" : "ltr";
|
|
8333
|
+
this.root.dir = m, this.portal.dir = m, e.appendChild(this.root), this.tooltip = new Ii(this.root), this.portal.className = "tcw-root tcw-portal", this.portal.dataset.tcwTheme = this.root.dataset.tcwTheme, this.ui = B(t.ui);
|
|
8318
8334
|
let h = t.ui !== void 0;
|
|
8319
8335
|
V(this.root, this.ui, { variables: h }), V(this.portal, this.ui, { variables: h }), this.markSwitchedOff(), this.toolbar = new jt(this.root, {
|
|
8320
8336
|
symbols: this.symbols,
|
|
@@ -8370,7 +8386,7 @@ var ka = [
|
|
|
8370
8386
|
},
|
|
8371
8387
|
onToggleStyle: () => this.drawingStyle?.toggle(),
|
|
8372
8388
|
onToggleStayInDrawing: () => this.handleToggleStayInDrawing()
|
|
8373
|
-
}, this.t), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", g.appendChild(this.chartContainer), this.loading = new
|
|
8389
|
+
}, this.t), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", g.appendChild(this.chartContainer), this.loading = new pa(this.chartContainer, this.t("status.loading")), this.historyPill = new ha(this.chartContainer, {
|
|
8374
8390
|
loading: this.t("history.loading"),
|
|
8375
8391
|
failed: this.t("history.failed")
|
|
8376
8392
|
}), t.watchlist && this.createWatchlist(g, t.watchlist === !0 ? {} : t.watchlist), this.root.appendChild(g);
|
|
@@ -8429,7 +8445,7 @@ var ka = [
|
|
|
8429
8445
|
goToLabel: this.t("range.goTo"),
|
|
8430
8446
|
onPreset: (e) => this.chart.setVisibleRangePreset(e),
|
|
8431
8447
|
onGoTo: () => this.toggleGoToDate()
|
|
8432
|
-
}), this.goToDate = new
|
|
8448
|
+
}), this.goToDate = new Mi(this.root, {
|
|
8433
8449
|
title: this.t("range.goTo"),
|
|
8434
8450
|
date: this.t("range.date"),
|
|
8435
8451
|
time: this.t("range.time"),
|
|
@@ -8464,7 +8480,7 @@ var ka = [
|
|
|
8464
8480
|
eraser: t ?? this.state.eraser,
|
|
8465
8481
|
zoomArea: n ?? this.state.zoomArea
|
|
8466
8482
|
}, this.updateUI();
|
|
8467
|
-
}), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new
|
|
8483
|
+
}), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new Ui(this.chartContainer, {
|
|
8468
8484
|
onToggleVisible: (e, t) => {
|
|
8469
8485
|
this.chart.setIndicatorVisible(e, t), this.scheduleLegend(), this.objectTree?.isOpen() && this.refreshObjects();
|
|
8470
8486
|
},
|
|
@@ -8517,7 +8533,7 @@ var ka = [
|
|
|
8517
8533
|
if (this.replayBar?.getMode() !== "select" || !this.replayBar.isMounted()) return;
|
|
8518
8534
|
let t = e.payload.point;
|
|
8519
8535
|
this.positionReplayShade(t?.x ?? null);
|
|
8520
|
-
}), this.dataWindow = new
|
|
8536
|
+
}), this.dataWindow = new $i(this.root, { formatPrice: (e) => this.formatAlertPrice(e) }, this.t), this.chart.on("crosshairMove", (e) => {
|
|
8521
8537
|
let t = e.payload;
|
|
8522
8538
|
this.lastHoverIndex = typeof t.barIndex == "number" ? t.barIndex : null, this.dataWindow?.isOpen() && this.dataWindow.render(this.buildDataWindowModel());
|
|
8523
8539
|
});
|
|
@@ -8529,10 +8545,10 @@ var ka = [
|
|
|
8529
8545
|
onEnd: (e, t) => {
|
|
8530
8546
|
this.chart.endDrawingEdit(e, { cancel: t }), this.refreshObjects();
|
|
8531
8547
|
},
|
|
8532
|
-
toWallTime: (e) => Y(e *
|
|
8548
|
+
toWallTime: (e) => Y(e * Ha(this.chart.getData()), this.displayTimezone()),
|
|
8533
8549
|
fromWallTime: (e, t) => {
|
|
8534
|
-
let n =
|
|
8535
|
-
return n === null ? null : n /
|
|
8550
|
+
let n = ji(e, t, this.displayTimezone());
|
|
8551
|
+
return n === null ? null : n / Ha(this.chart.getData());
|
|
8536
8552
|
},
|
|
8537
8553
|
roundPrice: (e) => this.chart.roundPrice(e),
|
|
8538
8554
|
priceStep: () => this.chart.getPriceStep(),
|
|
@@ -8567,12 +8583,12 @@ var ka = [
|
|
|
8567
8583
|
area: "priceAxisAdd",
|
|
8568
8584
|
price: i
|
|
8569
8585
|
});
|
|
8570
|
-
}), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervalInput = new
|
|
8586
|
+
}), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervalInput = new yi(this.chartContainer, {
|
|
8571
8587
|
title: this.t("interval.title"),
|
|
8572
8588
|
hint: this.t("interval.hint"),
|
|
8573
8589
|
invalid: this.t("interval.invalid")
|
|
8574
8590
|
}, (e) => this.selectTypedTimeframe(e)), this.toolbar?.setIndicatorTemplates(this.templates.list().map((e) => e.name)), t.layouts !== !1 && this.setupLayouts(t.layouts === !0 || t.layouts === void 0 ? {} : t.layouts), t.trading !== !1) {
|
|
8575
|
-
this.orderTicket = new
|
|
8591
|
+
this.orderTicket = new Xr(this.root, {
|
|
8576
8592
|
onSubmit: (e) => {
|
|
8577
8593
|
this.chart.placeOrderIntent(e), this.say(p(this.t("ticket.sent"), {
|
|
8578
8594
|
side: this.t(e.side === "buy" ? "ticket.buy" : "ticket.sell"),
|
|
@@ -8603,7 +8619,7 @@ var ka = [
|
|
|
8603
8619
|
"indicatorUpdate"
|
|
8604
8620
|
]) this.chart.on(e, () => this.refreshAccountSoon());
|
|
8605
8621
|
}
|
|
8606
|
-
t.trading !== !1 && (this.bracketBar = new
|
|
8622
|
+
t.trading !== !1 && (this.bracketBar = new Ji(this.root, {
|
|
8607
8623
|
onConfirm: () => this.chart.confirmBracket(),
|
|
8608
8624
|
onCancel: () => {
|
|
8609
8625
|
this.chart.cancelBracket(), this.bracketBar?.hide();
|
|
@@ -8611,7 +8627,7 @@ var ka = [
|
|
|
8611
8627
|
}, this.t), this.chart.on("bracketPlace", (e) => {
|
|
8612
8628
|
let t = e.payload;
|
|
8613
8629
|
this.bracketBar?.hide(), this.say(p(this.t(t.side === "buy" ? "bracket.longPlaced" : "bracket.shortPlaced"), { rr: t.riskReward.toFixed(2) }));
|
|
8614
|
-
}), t.depthLadder && (this.depthLadder = new
|
|
8630
|
+
}), t.depthLadder && (this.depthLadder = new Zi(this.root, {
|
|
8615
8631
|
onTrade: (e, t) => {
|
|
8616
8632
|
this.chart.placeOrderIntent({
|
|
8617
8633
|
side: e,
|
|
@@ -8642,7 +8658,7 @@ var ka = [
|
|
|
8642
8658
|
}, this.t), this.chart.on("alertAdd", () => this.refreshAlerts()), this.chart.on("alertRemove", () => this.refreshAlerts()), this.chart.on("alertUpdate", () => this.refreshAlerts()), this.chart.on("alertExpired", (e) => {
|
|
8643
8659
|
let t = e.payload;
|
|
8644
8660
|
this.refreshAlerts(), this.featureState.alerts && this.say(p(this.t("alerts.expiredToast"), { text: t.message ?? this.alertText(t) }));
|
|
8645
|
-
}), t.alertNotifications && (this.alertNotifier = new
|
|
8661
|
+
}), t.alertNotifications && (this.alertNotifier = new Yi(t.alertNotifications)), this.chart.on("alertTriggered", (e) => {
|
|
8646
8662
|
let t = e.payload;
|
|
8647
8663
|
if (this.refreshAlerts(), !this.featureState.alerts) return;
|
|
8648
8664
|
let n = `${this.alertText(t)}${t.message ? ` — ${t.message}` : ""}`;
|
|
@@ -8712,11 +8728,11 @@ var ka = [
|
|
|
8712
8728
|
} else if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === "s" || e.key === "S")) {
|
|
8713
8729
|
if (!this.layoutSession || !n("hotkeys.save") || !this.featureState.layouts || J() || !q(this.root, !0)) return;
|
|
8714
8730
|
e.preventDefault(), this.saveLayout();
|
|
8715
|
-
} else if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey &&
|
|
8716
|
-
if (e.defaultPrevented || J() || !t ||
|
|
8717
|
-
e.preventDefault(), this.handleDrawingTool(
|
|
8731
|
+
} else if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey && za[e.code]) {
|
|
8732
|
+
if (e.defaultPrevented || J() || !t || Ra() || !n("hotkeys.tools")) return;
|
|
8733
|
+
e.preventDefault(), this.handleDrawingTool(za[e.code]);
|
|
8718
8734
|
} else if (/^[0-9]$/.test(e.key) && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
8719
|
-
if (e.defaultPrevented || !this.intervalInput || !n("intervalTyping") || J() ||
|
|
8735
|
+
if (e.defaultPrevented || !this.intervalInput || !n("intervalTyping") || J() || Ra() || !q(this.root, !0)) return;
|
|
8720
8736
|
let t = document.activeElement;
|
|
8721
8737
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
8722
8738
|
e.preventDefault(), this.intervalInput.open(e.key);
|
|
@@ -8736,10 +8752,10 @@ var ka = [
|
|
|
8736
8752
|
}))
|
|
8737
8753
|
});
|
|
8738
8754
|
}
|
|
8739
|
-
}, document.addEventListener("keydown", this.boundGlobalKeydown), document.addEventListener("fullscreenchange", this.onFullscreenChange), this.unregisterKeys =
|
|
8755
|
+
}, document.addEventListener("keydown", this.boundGlobalKeydown), document.addEventListener("fullscreenchange", this.onFullscreenChange), this.unregisterKeys = xi(this.root), t.adapter && (this.adapter = t.adapter, this.connectStream()), this.watchlist && (this.watchlistInterval = setInterval(() => this.tickWatchlist(), 1e3)), this.markSwitchedOff(), requestAnimationFrame(() => {
|
|
8740
8756
|
this.destroyed || (this.toolbar?.tidy(), this.sidebar?.tidy());
|
|
8741
8757
|
}), this.refreshMarket(), this.updateUI(), t.onReady?.(this.chart), t.shareUrl && typeof location < "u") {
|
|
8742
|
-
let e =
|
|
8758
|
+
let e = ua(location.hash);
|
|
8743
8759
|
e && this.importState(e);
|
|
8744
8760
|
}
|
|
8745
8761
|
}
|
|
@@ -8792,9 +8808,9 @@ var ka = [
|
|
|
8792
8808
|
!e?.isOpen() || this.destroyed || e.render(this.symbolInfoView());
|
|
8793
8809
|
}
|
|
8794
8810
|
symbolInfoView() {
|
|
8795
|
-
let e = this.chart.getSymbolInfo(), t = this.state.symbol, n = this.quotes.get(t), r =
|
|
8811
|
+
let e = this.chart.getSymbolInfo(), t = this.state.symbol, n = this.quotes.get(t), r = Ya(this.chart.getData(), e?.timezone), i = (e) => this.formatAlertPrice(e), a = this.textLocale(), o = n?.last ?? r?.close, s = n?.prevClose ?? r?.prevClose, c = n?.change ?? (o !== void 0 && s !== void 0 ? o - s : void 0), l = o !== void 0 && c !== void 0 ? o - c : void 0, u = n?.changePercent ?? (c !== void 0 && l ? c / l * 100 : void 0), d = ae(e, Date.now()), f = this.t(d.state === "open" ? "symbolInfo.open" : d.state === "closed" ? "symbolInfo.closed" : "symbolInfo.always");
|
|
8796
8812
|
if (d.state !== "always" && d.next !== null) {
|
|
8797
|
-
let e =
|
|
8813
|
+
let e = Xa(d.next - Date.now(), a);
|
|
8798
8814
|
f += ` · ${p(this.t(d.state === "open" ? "symbolInfo.closesIn" : "symbolInfo.opensIn"), { when: e })}`;
|
|
8799
8815
|
}
|
|
8800
8816
|
let m = [], h = (e, t) => {
|
|
@@ -8805,7 +8821,7 @@ var ka = [
|
|
|
8805
8821
|
}, g = (e) => e === void 0 ? void 0 : i(e);
|
|
8806
8822
|
h(this.t("dataWindow.open"), g(n?.open ?? r?.open)), h(this.t("dataWindow.high"), g(n?.high ?? r?.high)), h(this.t("dataWindow.low"), g(n?.low ?? r?.low)), h(this.t("symbolInfo.prevClose"), g(s));
|
|
8807
8823
|
let _ = n?.volume ?? r?.volume;
|
|
8808
|
-
h(this.t("dataWindow.volume"), _ === void 0 ? void 0 :
|
|
8824
|
+
h(this.t("dataWindow.volume"), _ === void 0 ? void 0 : Za(_, this.intlLocale())), h(this.t("symbolInfo.bid"), g(n?.bid)), h(this.t("symbolInfo.ask"), g(n?.ask)), h(this.t("symbolInfo.tick"), e?.minTick === void 0 ? void 0 : String(e.minTick)), h(this.t("symbolInfo.currency"), e?.currency), h(this.t("symbolInfo.timezone"), e?.timezone), h(this.t("symbolInfo.hours"), Qa(e, a));
|
|
8809
8825
|
let v = (c ?? 0) >= 0 ? "+" : "-";
|
|
8810
8826
|
return {
|
|
8811
8827
|
symbol: t,
|
|
@@ -8838,17 +8854,17 @@ var ka = [
|
|
|
8838
8854
|
items: t.map((e) => ({
|
|
8839
8855
|
title: e.title,
|
|
8840
8856
|
url: e.url,
|
|
8841
|
-
meta: [e.source,
|
|
8857
|
+
meta: [e.source, Xa(e.time - Date.now(), n)].filter(Boolean).join(" · ")
|
|
8842
8858
|
}))
|
|
8843
8859
|
});
|
|
8844
8860
|
}, o = this.newsCache.get(r);
|
|
8845
|
-
if (o && Date.now() - o.at <
|
|
8861
|
+
if (o && Date.now() - o.at < qa) {
|
|
8846
8862
|
a(o.items);
|
|
8847
8863
|
return;
|
|
8848
8864
|
}
|
|
8849
|
-
e.renderNews({ kind: "loading" }), Promise.resolve().then(() => n(r,
|
|
8865
|
+
e.renderNews({ kind: "loading" }), Promise.resolve().then(() => n(r, Ka)).then((e) => {
|
|
8850
8866
|
if (i !== this.newsRequest || this.destroyed) return;
|
|
8851
|
-
let t = le(e,
|
|
8867
|
+
let t = le(e, Ka);
|
|
8852
8868
|
this.newsCache.set(r, {
|
|
8853
8869
|
at: Date.now(),
|
|
8854
8870
|
items: t
|
|
@@ -8864,7 +8880,7 @@ var ka = [
|
|
|
8864
8880
|
return this.options.locale || "en";
|
|
8865
8881
|
}
|
|
8866
8882
|
createWatchlist(e, t) {
|
|
8867
|
-
let n = t.persist ?
|
|
8883
|
+
let n = t.persist ? Ga() : null, r = new An({
|
|
8868
8884
|
lists: t.lists,
|
|
8869
8885
|
activeList: t.activeList,
|
|
8870
8886
|
symbols: this.symbols,
|
|
@@ -9070,11 +9086,11 @@ var ka = [
|
|
|
9070
9086
|
id: e,
|
|
9071
9087
|
type: s.type,
|
|
9072
9088
|
selected: o
|
|
9073
|
-
}) ?? [] : [], l =
|
|
9089
|
+
}) ?? [] : [], l = _a(a, c);
|
|
9074
9090
|
if (l.length === 0) return;
|
|
9075
9091
|
let u = this.chartContainer.getBoundingClientRect(), d = this.root.getBoundingClientRect();
|
|
9076
9092
|
this.drawingMenu.open(l, u.left - d.left + t, u.top - d.top + n, (t) => {
|
|
9077
|
-
|
|
9093
|
+
va(t, c) || this.runDrawingMenuAction(e, o, t);
|
|
9078
9094
|
});
|
|
9079
9095
|
}
|
|
9080
9096
|
runDrawingMenuAction(e, t, n) {
|
|
@@ -9138,11 +9154,11 @@ var ka = [
|
|
|
9138
9154
|
}
|
|
9139
9155
|
openChartMenu(e, t, n, r) {
|
|
9140
9156
|
if (!this.chartMenu) return;
|
|
9141
|
-
let i = this.options.chartMenuItems?.(r) ?? [], a =
|
|
9157
|
+
let i = this.options.chartMenuItems?.(r) ?? [], a = _a(e, i);
|
|
9142
9158
|
if (a.length === 0) return;
|
|
9143
9159
|
let o = this.chartContainer.getBoundingClientRect(), s = this.root.getBoundingClientRect();
|
|
9144
9160
|
this.chartMenu.open(a, o.left - s.left + t, o.top - s.top + n, (e) => {
|
|
9145
|
-
|
|
9161
|
+
va(e, i) || this.runChartMenuAction(e, r.price);
|
|
9146
9162
|
});
|
|
9147
9163
|
}
|
|
9148
9164
|
setFeatures(e) {
|
|
@@ -9192,9 +9208,9 @@ var ka = [
|
|
|
9192
9208
|
for (let [n, r] of t) e(n) && r();
|
|
9193
9209
|
}
|
|
9194
9210
|
addHotkey(e) {
|
|
9195
|
-
let t =
|
|
9211
|
+
let t = Sa(e.keys);
|
|
9196
9212
|
if (!t) return console.warn(`[ChartWidget] Can't read the shortcut "${e.keys}": modifiers (Ctrl, Alt, Shift) and a key, joined by +.`), null;
|
|
9197
|
-
|
|
9213
|
+
Ta(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
|
|
9198
9214
|
let n = {
|
|
9199
9215
|
spec: e,
|
|
9200
9216
|
parsed: t
|
|
@@ -9204,8 +9220,8 @@ var ka = [
|
|
|
9204
9220
|
} };
|
|
9205
9221
|
}
|
|
9206
9222
|
handleHostHotkey(e) {
|
|
9207
|
-
if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode ===
|
|
9208
|
-
let t = this.hostHotkeys.find((t) =>
|
|
9223
|
+
if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === Ba || e.getModifierState?.("AltGraph") || e.defaultPrevented || J() || Ea(e) || Ra()) return !1;
|
|
9224
|
+
let t = this.hostHotkeys.find((t) => Ca(e, t.parsed));
|
|
9209
9225
|
if (!t) return !1;
|
|
9210
9226
|
let n = !t.parsed.ctrl && !t.parsed.alt;
|
|
9211
9227
|
if (!q(this.root, n)) return !1;
|
|
@@ -9213,7 +9229,7 @@ var ka = [
|
|
|
9213
9229
|
return n && r && r !== document.body && !this.root.contains(r) ? !1 : (e.preventDefault(), t.spec.onPress(e), !0);
|
|
9214
9230
|
}
|
|
9215
9231
|
keepingLook(e) {
|
|
9216
|
-
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(
|
|
9232
|
+
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(Va.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
|
|
9217
9233
|
e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
|
|
9218
9234
|
}
|
|
9219
9235
|
sheetKeyOn(e) {
|
|
@@ -9265,7 +9281,7 @@ var ka = [
|
|
|
9265
9281
|
let r = e.items();
|
|
9266
9282
|
if (r.length === 0) return;
|
|
9267
9283
|
let i = t.getBoundingClientRect(), a = this.root.getBoundingClientRect();
|
|
9268
|
-
n.open(
|
|
9284
|
+
n.open(_a([], r), i.left - a.left, i.bottom - a.top + 2, (e) => va(e, r), t);
|
|
9269
9285
|
}
|
|
9270
9286
|
});
|
|
9271
9287
|
return r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), t.tidy(), {
|
|
@@ -9390,9 +9406,18 @@ var ka = [
|
|
|
9390
9406
|
let t = this.chart.getData();
|
|
9391
9407
|
this.orderTicket?.open({
|
|
9392
9408
|
price: e,
|
|
9393
|
-
lastPrice: t.length > 0 ? t[t.length - 1].close : null
|
|
9409
|
+
lastPrice: t.length > 0 ? t[t.length - 1].close : null,
|
|
9410
|
+
rules: this.orderRules()
|
|
9394
9411
|
});
|
|
9395
9412
|
}
|
|
9413
|
+
orderRules() {
|
|
9414
|
+
let e = this.chart.getMarket();
|
|
9415
|
+
return e ? {
|
|
9416
|
+
roundPrice: e.priceStep !== void 0 || (e.priceSteps?.length ?? 0) > 0 ? (e) => this.chart.roundPrice(e) : void 0,
|
|
9417
|
+
limits: this.chart.getPriceLimits(),
|
|
9418
|
+
lot: e.volumeUnit
|
|
9419
|
+
} : {};
|
|
9420
|
+
}
|
|
9396
9421
|
refreshAccountSoon() {
|
|
9397
9422
|
this.accountFrame || !this.accountPanel || (this.accountFrame = requestAnimationFrame(() => {
|
|
9398
9423
|
this.accountFrame = 0, this.destroyed || this.refreshAccount();
|
|
@@ -9435,12 +9460,12 @@ var ka = [
|
|
|
9435
9460
|
return;
|
|
9436
9461
|
}
|
|
9437
9462
|
let e = this.chart.getData();
|
|
9438
|
-
e.length !== 0 && this.goToDate.open(Y(e[e.length - 1].time *
|
|
9463
|
+
e.length !== 0 && this.goToDate.open(Y(e[e.length - 1].time * Ha(e), this.displayTimezone()), this.root.querySelector("[data-role=\"goto\"]"));
|
|
9439
9464
|
}
|
|
9440
9465
|
goToWallTime(e, t) {
|
|
9441
|
-
let n =
|
|
9466
|
+
let n = ji(e, t, this.displayTimezone()), r = this.chart.getData();
|
|
9442
9467
|
if (n === null || r.length === 0) return;
|
|
9443
|
-
let i = n /
|
|
9468
|
+
let i = n / Ha(r);
|
|
9444
9469
|
this.chart.goToTime(i), i < r[0].time && this.say(this.t("range.beforeData"));
|
|
9445
9470
|
}
|
|
9446
9471
|
pinnedTimeframes() {
|
|
@@ -9450,14 +9475,14 @@ var ka = [
|
|
|
9450
9475
|
timeframeMenu() {
|
|
9451
9476
|
return this.timeframes.map((e) => ({
|
|
9452
9477
|
value: e,
|
|
9453
|
-
label:
|
|
9478
|
+
label: ci(e),
|
|
9454
9479
|
custom: this.customTimeframes.has(e)
|
|
9455
9480
|
}));
|
|
9456
9481
|
}
|
|
9457
9482
|
handleAddTimeframe(e) {
|
|
9458
9483
|
if (!this.featureState.customTimeframes) return !1;
|
|
9459
|
-
let t =
|
|
9460
|
-
return !t || !this.chart.isTimeframeAllowed(t) || this.adapter && !Te(this.adapter, t) || !this.adapter && S(t) !== null ? !1 : (this.timeframes.includes(t) || (this.customTimeframes.add(t), this.timeframeFavorites.add(t), this.timeframes =
|
|
9484
|
+
let t = gi(e);
|
|
9485
|
+
return !t || !this.chart.isTimeframeAllowed(t) || this.adapter && !Te(this.adapter, t) || !this.adapter && S(t) !== null ? !1 : (this.timeframes.includes(t) || (this.customTimeframes.add(t), this.timeframeFavorites.add(t), this.timeframes = _i(this.timeframes, [t]), this.toolbar?.setTimeframes(this.timeframeMenu(), this.pinnedTimeframes())), this.handleTimeframe(t), !0);
|
|
9461
9486
|
}
|
|
9462
9487
|
showMarkerTip(e) {
|
|
9463
9488
|
let { marker: t } = e;
|
|
@@ -9476,7 +9501,7 @@ var ka = [
|
|
|
9476
9501
|
this.markerTip.style.left = `${l}px`, this.markerTip.style.top = `${u}px`;
|
|
9477
9502
|
}
|
|
9478
9503
|
selectTypedTimeframe(e) {
|
|
9479
|
-
return !this.chart.isTimeframeAllowed(e) || !this.timeframes.includes(e) && !this.featureState.customTimeframes || this.adapter && !Te(this.adapter, e) ? !1 : (this.timeframes.includes(e) || (this.customTimeframes.add(e), this.timeframes =
|
|
9504
|
+
return !this.chart.isTimeframeAllowed(e) || !this.timeframes.includes(e) && !this.featureState.customTimeframes || this.adapter && !Te(this.adapter, e) ? !1 : (this.timeframes.includes(e) || (this.customTimeframes.add(e), this.timeframes = _i(this.timeframes, [e]), this.toolbar?.setTimeframes(this.timeframeMenu(), this.pinnedTimeframes())), this.handleTimeframe(e), !0);
|
|
9480
9505
|
}
|
|
9481
9506
|
applyIndicatorTemplate(e) {
|
|
9482
9507
|
if (!this.featureState.indicatorTemplates) return;
|
|
@@ -9489,7 +9514,7 @@ var ka = [
|
|
|
9489
9514
|
this.say(this.t("templates.nothing"), "error");
|
|
9490
9515
|
return;
|
|
9491
9516
|
}
|
|
9492
|
-
this.templatePrompt ??= new
|
|
9517
|
+
this.templatePrompt ??= new ei(this.root, this.t), this.templatePrompt.open({
|
|
9493
9518
|
title: this.t("templates.saveTitle"),
|
|
9494
9519
|
submitLabel: this.t("common.save"),
|
|
9495
9520
|
placeholder: this.t("templates.namePlaceholder"),
|
|
@@ -9515,9 +9540,9 @@ var ka = [
|
|
|
9515
9540
|
}
|
|
9516
9541
|
async switchLocalTimeframe() {
|
|
9517
9542
|
if (!this.baseSeries) return;
|
|
9518
|
-
let e = ++this.localSeq, t = this.lastLocalSwitchMs >=
|
|
9543
|
+
let e = ++this.localSeq, t = this.lastLocalSwitchMs >= Da || this.baseSeries.length >= Oa;
|
|
9519
9544
|
try {
|
|
9520
|
-
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await
|
|
9545
|
+
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await Aa(), e !== this.localSeq || this.destroyed)) return;
|
|
9521
9546
|
this.applyTimeframeData();
|
|
9522
9547
|
} finally {
|
|
9523
9548
|
e === this.localSeq && this.loading.end();
|
|
@@ -9574,7 +9599,7 @@ var ka = [
|
|
|
9574
9599
|
id: e.id,
|
|
9575
9600
|
params: e.params
|
|
9576
9601
|
}));
|
|
9577
|
-
return
|
|
9602
|
+
return sa({
|
|
9578
9603
|
v: 1,
|
|
9579
9604
|
symbol: this.state.symbol,
|
|
9580
9605
|
timeframe: this.state.timeframe,
|
|
@@ -9585,7 +9610,7 @@ var ka = [
|
|
|
9585
9610
|
});
|
|
9586
9611
|
}
|
|
9587
9612
|
async importState(e) {
|
|
9588
|
-
let t =
|
|
9613
|
+
let t = ca(e);
|
|
9589
9614
|
return t ? (t.symbol && t.symbol !== this.state.symbol && await this.setSymbol(t.symbol), t.timeframe && t.timeframe !== this.state.timeframe && await this.setTimeframe(t.timeframe), t.chartType && this.applyChartType(t.chartType), this.chart.setScaleMode(t.scaleMode), this.chart.applyIndicatorSetup(t.indicators.map((e, t) => ({
|
|
9590
9615
|
id: e.id,
|
|
9591
9616
|
instanceId: `shared_${t}`,
|
|
@@ -9597,7 +9622,7 @@ var ka = [
|
|
|
9597
9622
|
this.say(e ? this.t("toast.imageCopied") : this.t("toast.imageCopyFailed"), e ? "info" : "error");
|
|
9598
9623
|
}
|
|
9599
9624
|
async copyShareLink() {
|
|
9600
|
-
let e =
|
|
9625
|
+
let e = da(typeof location < "u" ? location.href : "", this.exportState());
|
|
9601
9626
|
try {
|
|
9602
9627
|
await navigator.clipboard.writeText(e), this.say(this.t("toast.linkCopied"));
|
|
9603
9628
|
} catch {
|
|
@@ -9658,7 +9683,7 @@ var ka = [
|
|
|
9658
9683
|
defaults: n.descriptor.defaultConfig,
|
|
9659
9684
|
params: n.params,
|
|
9660
9685
|
inputs: n.descriptor.inputs,
|
|
9661
|
-
lineSources:
|
|
9686
|
+
lineSources: Wa(e, t),
|
|
9662
9687
|
plots: n.descriptor.plots,
|
|
9663
9688
|
colors: r?.colors,
|
|
9664
9689
|
lineWidth: r?.lineWidths[0],
|
|
@@ -9756,7 +9781,7 @@ var ka = [
|
|
|
9756
9781
|
return;
|
|
9757
9782
|
}
|
|
9758
9783
|
if (this.compares.some((t) => t.symbol === e)) return;
|
|
9759
|
-
let n =
|
|
9784
|
+
let n = ja[this.compares.length % ja.length], r = `cmp_${e}`;
|
|
9760
9785
|
try {
|
|
9761
9786
|
let t = await De(this.adapter).fetchHistory(e, this.state.timeframe, this.options.historyLimit ?? 500);
|
|
9762
9787
|
this.compares.length === 0 && this.chart.setCompareMode("percent"), this.chart.addCompareSymbol(r, e, t, n), this.compares = [...this.compares, {
|
|
@@ -9908,7 +9933,7 @@ var ka = [
|
|
|
9908
9933
|
});
|
|
9909
9934
|
for (let t of this.timeframes) e.push({
|
|
9910
9935
|
id: t,
|
|
9911
|
-
label:
|
|
9936
|
+
label: ci(t),
|
|
9912
9937
|
category: "timeframe",
|
|
9913
9938
|
active: this.state.timeframe === t
|
|
9914
9939
|
});
|
|
@@ -10054,7 +10079,7 @@ var ka = [
|
|
|
10054
10079
|
return this.state.timeframe;
|
|
10055
10080
|
}
|
|
10056
10081
|
captureLayout() {
|
|
10057
|
-
let e = this.chart.saveState(), t = e ?
|
|
10082
|
+
let e = this.chart.saveState(), t = e ? Ei(e) : null, n = t && typeof t == "object" ? wi(t) : null;
|
|
10058
10083
|
return {
|
|
10059
10084
|
v: 1,
|
|
10060
10085
|
symbol: this.state.symbol,
|
|
@@ -10067,7 +10092,7 @@ var ka = [
|
|
|
10067
10092
|
async restoreLayout(e) {
|
|
10068
10093
|
if (e.symbol !== this.state.symbol && await this.setSymbol(e.symbol), e.timeframe !== this.state.timeframe && await this.setTimeframe(e.timeframe), !this.destroyed) {
|
|
10069
10094
|
if (e.chart) {
|
|
10070
|
-
this.chart.loadState(JSON.stringify(
|
|
10095
|
+
this.chart.loadState(JSON.stringify(wi(e.chart)));
|
|
10071
10096
|
let t = e.chart.chartType;
|
|
10072
10097
|
typeof t == "string" && (this.state = {
|
|
10073
10098
|
...this.state,
|
|
@@ -10084,7 +10109,7 @@ var ka = [
|
|
|
10084
10109
|
return JSON.stringify(this.captureLayout());
|
|
10085
10110
|
}
|
|
10086
10111
|
async applyLayoutContent(e) {
|
|
10087
|
-
let t =
|
|
10112
|
+
let t = Ti(Ei(e));
|
|
10088
10113
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
10089
10114
|
}
|
|
10090
10115
|
setupLayouts(e) {
|
|
@@ -10103,7 +10128,7 @@ var ka = [
|
|
|
10103
10128
|
onChange: () => this.toolbar?.setLayout(t.current()?.name ?? null, t.isDirty()),
|
|
10104
10129
|
onError: () => this.say(this.t("layouts.saveFailed"), "error")
|
|
10105
10130
|
});
|
|
10106
|
-
this.layoutSession = t, this.layoutsUI = new
|
|
10131
|
+
this.layoutSession = t, this.layoutsUI = new ii(t, {
|
|
10107
10132
|
root: this.root,
|
|
10108
10133
|
t: this.t,
|
|
10109
10134
|
toast: (e, t) => this.say(e, t),
|
|
@@ -10247,7 +10272,7 @@ var ka = [
|
|
|
10247
10272
|
}
|
|
10248
10273
|
replayStepOptions() {
|
|
10249
10274
|
let e = C(this.state.timeframe);
|
|
10250
|
-
return
|
|
10275
|
+
return Ia.filter((t) => {
|
|
10251
10276
|
let n = C(t);
|
|
10252
10277
|
return !(n < e) || e % n !== 0 ? !1 : this.adapter ? Te(this.adapter, t) : this.baseSeries !== null && this.baseTimeframeMs > 0 && n >= this.baseTimeframeMs && n % this.baseTimeframeMs === 0;
|
|
10253
10278
|
});
|
|
@@ -10257,7 +10282,7 @@ var ka = [
|
|
|
10257
10282
|
if (this.replayStepsCache?.key === t) return this.replayStepsCache.steps;
|
|
10258
10283
|
let n = null;
|
|
10259
10284
|
if (this.adapter) {
|
|
10260
|
-
let t = Math.max(1, Math.round(C(this.state.timeframe) / C(e))), r = Math.min(
|
|
10285
|
+
let t = Math.max(1, Math.round(C(this.state.timeframe) / C(e))), r = Math.min(La, Math.max(this.chart.getData().length, 100) * t);
|
|
10261
10286
|
try {
|
|
10262
10287
|
n = await De(this.adapter).fetchHistory(this.state.symbol, e, r);
|
|
10263
10288
|
} catch {
|
|
@@ -10424,25 +10449,25 @@ var ka = [
|
|
|
10424
10449
|
row: n
|
|
10425
10450
|
}));
|
|
10426
10451
|
let a = this.settingsState.numberLocale || "en-US", o = this.chart.getActiveIndicators().map((t) => {
|
|
10427
|
-
let n = i.get(t.instanceId) ?? null, o = r >= 0 ? this.chart.getIndicatorOutput(t.instanceId)?.series?.[r] : null, s = this.chart.getIndicatorStyle(t.instanceId), c =
|
|
10452
|
+
let n = i.get(t.instanceId) ?? null, o = r >= 0 ? this.chart.getIndicatorOutput(t.instanceId)?.series?.[r] : null, s = this.chart.getIndicatorStyle(t.instanceId), c = Wi(t.descriptor, o, s?.colors ?? [], s?.plots);
|
|
10428
10453
|
return {
|
|
10429
10454
|
instanceId: t.instanceId,
|
|
10430
10455
|
label: e(t.id, t.params, t.descriptor.defaultConfig, t.descriptor.shortName),
|
|
10431
10456
|
visible: t.visible,
|
|
10432
10457
|
values: c.map((e) => ({
|
|
10433
|
-
text: n ?
|
|
10458
|
+
text: n ? qi(e.value, a) : this.chart.formatPrice(e.value),
|
|
10434
10459
|
color: e.color
|
|
10435
10460
|
})),
|
|
10436
10461
|
pane: n ? {
|
|
10437
|
-
x: n.x +
|
|
10438
|
-
y: n.y + Math.min(
|
|
10439
|
-
width: n.width - 2 *
|
|
10462
|
+
x: n.x + Ma,
|
|
10463
|
+
y: n.y + Math.min(Na + n.row * Pa, Math.max(Na, n.height - Pa)),
|
|
10464
|
+
width: n.width - 2 * Ma
|
|
10440
10465
|
} : null
|
|
10441
10466
|
};
|
|
10442
10467
|
}), s = this.chart.getPlotRect(), c = this.chart.getMaximizedPane(), l = (e) => o.find((t) => t.instanceId === e)?.label ?? "", u = this.chart.getIndicatorPanes().map((e) => ({
|
|
10443
10468
|
instanceId: e.instanceId,
|
|
10444
|
-
x: e.rect.x + e.rect.width -
|
|
10445
|
-
y: e.rect.y +
|
|
10469
|
+
x: e.rect.x + e.rect.width - Ma,
|
|
10470
|
+
y: e.rect.y + Fa,
|
|
10446
10471
|
label: l(e.instanceId),
|
|
10447
10472
|
collapsed: this.chart.isPaneCollapsed(e.instanceId),
|
|
10448
10473
|
maximized: c === e.instanceId,
|
|
@@ -10450,7 +10475,7 @@ var ka = [
|
|
|
10450
10475
|
canMoveDown: this.chart.canMovePane(e.instanceId, 1)
|
|
10451
10476
|
}));
|
|
10452
10477
|
this.indicatorLegend.update(o, {
|
|
10453
|
-
left: s.x +
|
|
10478
|
+
left: s.x + Ma,
|
|
10454
10479
|
top: this.chart.getLegendBottom() + 1
|
|
10455
10480
|
}, u);
|
|
10456
10481
|
}
|
|
@@ -10496,11 +10521,11 @@ var ka = [
|
|
|
10496
10521
|
let u = this.chart.getActiveIndicators().find((t) => t.instanceId === e)?.id ?? "", d = this.options.indicatorMenuItems?.({
|
|
10497
10522
|
instanceId: e,
|
|
10498
10523
|
indicatorId: u
|
|
10499
|
-
}) ?? [], f =
|
|
10524
|
+
}) ?? [], f = _a(c, d);
|
|
10500
10525
|
if (f.length === 0) return;
|
|
10501
10526
|
let p = t.getBoundingClientRect(), m = this.root.getBoundingClientRect();
|
|
10502
10527
|
n.open(f, p.left - m.left, p.bottom - m.top + 2, (t) => {
|
|
10503
|
-
|
|
10528
|
+
va(t, d) || (t === "settings" ? this.openIndicatorSettings(e) : t === "remove" ? this.handleRemoveIndicator(e) : t.startsWith("move:") && this.chart.moveIndicatorToPane(e, t.slice(5)), this.scheduleLegend());
|
|
10504
10529
|
}, t);
|
|
10505
10530
|
}
|
|
10506
10531
|
updateUI() {
|
|
@@ -10525,7 +10550,7 @@ var ka = [
|
|
|
10525
10550
|
return !0;
|
|
10526
10551
|
}
|
|
10527
10552
|
};
|
|
10528
|
-
function
|
|
10553
|
+
function Wa(t, n) {
|
|
10529
10554
|
let r = (e) => {
|
|
10530
10555
|
let t = Ee(e.descriptor);
|
|
10531
10556
|
return t && se(e.params[t])?.instanceId || null;
|
|
@@ -10548,19 +10573,19 @@ function Ha(t, n) {
|
|
|
10548
10573
|
}
|
|
10549
10574
|
return a;
|
|
10550
10575
|
}
|
|
10551
|
-
function
|
|
10576
|
+
function Ga() {
|
|
10552
10577
|
try {
|
|
10553
10578
|
return typeof localStorage < "u" ? localStorage : null;
|
|
10554
10579
|
} catch {
|
|
10555
10580
|
return null;
|
|
10556
10581
|
}
|
|
10557
10582
|
}
|
|
10558
|
-
var
|
|
10559
|
-
function
|
|
10583
|
+
var Ka = 10, qa = 5 * 6e4, Ja = 864e5;
|
|
10584
|
+
function Ya(e, t) {
|
|
10560
10585
|
if (e.length === 0) return null;
|
|
10561
10586
|
let n = t && ie(t) ? t : null, r = (e) => {
|
|
10562
10587
|
let t = e < 1e11 ? e * 1e3 : e;
|
|
10563
|
-
return Math.floor((t + (n ? _e(n, t) * 6e4 : 0)) /
|
|
10588
|
+
return Math.floor((t + (n ? _e(n, t) * 6e4 : 0)) / Ja);
|
|
10564
10589
|
}, i = e[e.length - 1], a = r(i.time), o = e.length - 1;
|
|
10565
10590
|
for (; o > 0 && r(e[o - 1].time) === a;) o--;
|
|
10566
10591
|
let s = -Infinity, c = Infinity, l = 0;
|
|
@@ -10574,7 +10599,7 @@ function qa(e, t) {
|
|
|
10574
10599
|
prevClose: o > 0 ? e[o - 1].close : void 0
|
|
10575
10600
|
};
|
|
10576
10601
|
}
|
|
10577
|
-
function
|
|
10602
|
+
function Xa(e, t) {
|
|
10578
10603
|
let n = e / 6e4, [r, i] = Math.abs(n) < 60 ? [Math.round(n) || Math.sign(n) || 1, "minute"] : Math.abs(n) < 1440 ? [Math.round(n / 60), "hour"] : [Math.round(n / 1440), "day"];
|
|
10579
10604
|
try {
|
|
10580
10605
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(r, i);
|
|
@@ -10582,7 +10607,7 @@ function Ja(e, t) {
|
|
|
10582
10607
|
return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(r, i);
|
|
10583
10608
|
}
|
|
10584
10609
|
}
|
|
10585
|
-
function
|
|
10610
|
+
function Za(e, t) {
|
|
10586
10611
|
try {
|
|
10587
10612
|
return new Intl.NumberFormat(t, {
|
|
10588
10613
|
notation: "compact",
|
|
@@ -10592,7 +10617,7 @@ function Ya(e, t) {
|
|
|
10592
10617
|
return String(e);
|
|
10593
10618
|
}
|
|
10594
10619
|
}
|
|
10595
|
-
function
|
|
10620
|
+
function Qa(e, t) {
|
|
10596
10621
|
let n = e?.sessions ?? [];
|
|
10597
10622
|
if (n.length === 0) return;
|
|
10598
10623
|
let r;
|
|
@@ -10619,19 +10644,19 @@ function Xa(e, t) {
|
|
|
10619
10644
|
};
|
|
10620
10645
|
return n.map((e) => [`${e.start}–${e.end}`, i(e.days)].filter(Boolean).join(" ")).join(", ");
|
|
10621
10646
|
}
|
|
10622
|
-
function
|
|
10647
|
+
function $a(e) {
|
|
10623
10648
|
return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
|
|
10624
10649
|
}
|
|
10625
10650
|
//#endregion
|
|
10626
10651
|
//#region src/widget/ChartWidgetGrid.ts
|
|
10627
|
-
var
|
|
10652
|
+
var eo = {
|
|
10628
10653
|
symbol: !1,
|
|
10629
10654
|
interval: !1,
|
|
10630
10655
|
crosshair: !0,
|
|
10631
10656
|
time: !1,
|
|
10632
10657
|
drawings: !1,
|
|
10633
10658
|
replay: !1
|
|
10634
|
-
},
|
|
10659
|
+
}, to = [
|
|
10635
10660
|
"symbol",
|
|
10636
10661
|
"interval",
|
|
10637
10662
|
"crosshair",
|
|
@@ -10672,25 +10697,25 @@ var Qa = {
|
|
|
10672
10697
|
rows: 3
|
|
10673
10698
|
}
|
|
10674
10699
|
};
|
|
10675
|
-
function
|
|
10700
|
+
function no(e) {
|
|
10676
10701
|
return typeof e == "string" && Object.prototype.hasOwnProperty.call($, e);
|
|
10677
10702
|
}
|
|
10678
|
-
function
|
|
10703
|
+
function ro(e) {
|
|
10679
10704
|
return JSON.parse(JSON.stringify(e));
|
|
10680
10705
|
}
|
|
10681
|
-
function
|
|
10706
|
+
function io(e, t, n = 16) {
|
|
10682
10707
|
let r = (20 - 2 * (e - 1)) / e, i = (20 - 2 * (t - 1)) / t, a = "";
|
|
10683
10708
|
for (let n = 0; n < t; n++) for (let t = 0; t < e; t++) a += `<rect x="${2 + t * (r + 2)}" y="${2 + n * (i + 2)}" width="${r}" height="${i}" rx="1"/>`;
|
|
10684
10709
|
return `<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${a}</svg>`;
|
|
10685
10710
|
}
|
|
10686
|
-
function
|
|
10711
|
+
function ao(e) {
|
|
10687
10712
|
if (typeof e != "object" || !e) return null;
|
|
10688
10713
|
let t = e;
|
|
10689
|
-
if (t.v !== 1 || t.kind !== "grid" || !
|
|
10690
|
-
let n = t.cells.map(
|
|
10714
|
+
if (t.v !== 1 || t.kind !== "grid" || !no(t.layout) || !Array.isArray(t.cells)) return null;
|
|
10715
|
+
let n = t.cells.map(Ti);
|
|
10691
10716
|
if (n.some((e) => e === null)) return null;
|
|
10692
|
-
let r = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, i = { ...
|
|
10693
|
-
for (let e of
|
|
10717
|
+
let r = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, i = { ...eo };
|
|
10718
|
+
for (let e of to) typeof r[e] == "boolean" && (i[e] = r[e]);
|
|
10694
10719
|
let a = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
|
|
10695
10720
|
return {
|
|
10696
10721
|
v: 1,
|
|
@@ -10701,7 +10726,7 @@ function ro(e) {
|
|
|
10701
10726
|
cells: n
|
|
10702
10727
|
};
|
|
10703
10728
|
}
|
|
10704
|
-
var
|
|
10729
|
+
var oo = class {
|
|
10705
10730
|
root;
|
|
10706
10731
|
cellsEl;
|
|
10707
10732
|
cells = [];
|
|
@@ -10728,14 +10753,14 @@ var io = class {
|
|
|
10728
10753
|
!(e.ctrlKey || e.metaKey) || e.altKey || e.shiftKey || e.key !== "s" && e.key !== "S" || !this.layoutsUI || J() || !q(this.root, !0) || (e.preventDefault(), this.layoutsUI.save());
|
|
10729
10754
|
};
|
|
10730
10755
|
constructor(e, t = {}) {
|
|
10731
|
-
this.options = t, this.layout =
|
|
10732
|
-
...
|
|
10756
|
+
this.options = t, this.layout = no(t.layout) ? t.layout : "1x2", this.sync = {
|
|
10757
|
+
...eo,
|
|
10733
10758
|
...t.sync
|
|
10734
10759
|
}, this.t = d(f(t.widget?.locale, t.widget?.messages)), ut(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", V(this.root, B(t.widget?.ui), { variables: t.widget?.ui !== void 0 }), t.bar !== !1 && this.root.appendChild(this.buildBar()), this.cellsEl = document.createElement("div"), this.cellsEl.className = "tcw-grid-cells", this.root.appendChild(this.cellsEl), e.appendChild(this.root), this.applyShape();
|
|
10735
10760
|
for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
|
|
10736
10761
|
this.markActive();
|
|
10737
10762
|
let n = this.cells[0]?.el.querySelector(".tcw-root")?.dataset.tcwTheme;
|
|
10738
|
-
n && (this.root.dataset.tcwTheme = n), t.layouts !== !1 && this.setupLayouts(t.layouts === !0 || t.layouts === void 0 ? {} : t.layouts), this.unregisterKeys =
|
|
10763
|
+
n && (this.root.dataset.tcwTheme = n), t.layouts !== !1 && this.setupLayouts(t.layouts === !0 || t.layouts === void 0 ? {} : t.layouts), this.unregisterKeys = xi(this.root), document.addEventListener("keydown", this.onKeyDown);
|
|
10739
10764
|
}
|
|
10740
10765
|
get relaying() {
|
|
10741
10766
|
return this.relayDepth > 0;
|
|
@@ -10767,7 +10792,7 @@ var io = class {
|
|
|
10767
10792
|
return this.layout;
|
|
10768
10793
|
}
|
|
10769
10794
|
setLayout(e) {
|
|
10770
|
-
if (e === this.layout || !
|
|
10795
|
+
if (e === this.layout || !no(e)) return;
|
|
10771
10796
|
this.layout = e;
|
|
10772
10797
|
let t = this.shapeCount();
|
|
10773
10798
|
for (; this.cells.length > t;) {
|
|
@@ -10857,7 +10882,7 @@ var io = class {
|
|
|
10857
10882
|
return JSON.stringify(this.captureLayout());
|
|
10858
10883
|
}
|
|
10859
10884
|
async applyLayoutContent(e) {
|
|
10860
|
-
let t =
|
|
10885
|
+
let t = ao(Ei(e));
|
|
10861
10886
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
10862
10887
|
}
|
|
10863
10888
|
destroy() {
|
|
@@ -10878,7 +10903,7 @@ var io = class {
|
|
|
10878
10903
|
createCell(e) {
|
|
10879
10904
|
let t = document.createElement("div");
|
|
10880
10905
|
t.className = "tcw-grid-cell", t.setAttribute("role", "region"), t.setAttribute("aria-label", p(this.t("grid.chart"), { n: e + 1 })), this.cellsEl.appendChild(t);
|
|
10881
|
-
let n = this.options.widget ?? {}, r = this.options.cells?.[e] ?? {}, i = this.cells[this.active]?.widget, a = {}, o = new
|
|
10906
|
+
let n = this.options.widget ?? {}, r = this.options.cells?.[e] ?? {}, i = this.cells[this.active]?.widget, a = {}, o = new Ua(t, {
|
|
10882
10907
|
...n,
|
|
10883
10908
|
...r,
|
|
10884
10909
|
...i && this.sync.symbol ? { symbol: i.getSymbol() } : {},
|
|
@@ -10927,7 +10952,7 @@ var io = class {
|
|
|
10927
10952
|
t.replaySeekToTime(n);
|
|
10928
10953
|
return;
|
|
10929
10954
|
}
|
|
10930
|
-
let r =
|
|
10955
|
+
let r = so(t.getData(), n);
|
|
10931
10956
|
r >= 0 && t.replayStart({
|
|
10932
10957
|
startIndex: r,
|
|
10933
10958
|
paused: !0
|
|
@@ -10972,7 +10997,7 @@ var io = class {
|
|
|
10972
10997
|
copyDrawings(e) {
|
|
10973
10998
|
let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
|
|
10974
10999
|
this.quietly(() => {
|
|
10975
|
-
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(
|
|
11000
|
+
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(ro(n));
|
|
10976
11001
|
});
|
|
10977
11002
|
}
|
|
10978
11003
|
mergeDrawings() {
|
|
@@ -10984,7 +11009,7 @@ var io = class {
|
|
|
10984
11009
|
let e = /* @__PURE__ */ new Map();
|
|
10985
11010
|
for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
|
|
10986
11011
|
let n = [...e.values()];
|
|
10987
|
-
for (let e of t) e.widget.getChart().setDrawings(
|
|
11012
|
+
for (let e of t) e.widget.getChart().setDrawings(ro(n));
|
|
10988
11013
|
}
|
|
10989
11014
|
});
|
|
10990
11015
|
}
|
|
@@ -11002,20 +11027,20 @@ var io = class {
|
|
|
11002
11027
|
e.className = "tcw-grid-bar", e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", this.t("grid.bar"));
|
|
11003
11028
|
let t = document.createElement("div");
|
|
11004
11029
|
t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
|
|
11005
|
-
let n = this.options.layoutChoices?.filter(
|
|
11030
|
+
let n = this.options.layoutChoices?.filter(no) ?? Object.keys($);
|
|
11006
11031
|
for (let e of n) {
|
|
11007
11032
|
let { cols: n, rows: r } = $[e], i = n * r === 1 ? this.t("grid.single") : p(this.t("grid.layoutOption"), {
|
|
11008
11033
|
count: n * r,
|
|
11009
11034
|
cols: n,
|
|
11010
11035
|
rows: r
|
|
11011
11036
|
}), a = document.createElement("button");
|
|
11012
|
-
a.type = "button", a.className = "tcw-btn-icon", a.title = i, a.setAttribute("aria-label", i), a.innerHTML =
|
|
11037
|
+
a.type = "button", a.className = "tcw-btn-icon", a.title = i, a.setAttribute("aria-label", i), a.innerHTML = io(n, r), a.addEventListener("click", () => this.setLayout(e)), this.layoutButtons.set(e, a), t.appendChild(a);
|
|
11013
11038
|
}
|
|
11014
11039
|
let r = document.createElement("div");
|
|
11015
11040
|
r.className = "tcw-grid-group", r.setAttribute("role", "group"), r.setAttribute("aria-label", this.t("grid.sync"));
|
|
11016
11041
|
let i = document.createElement("span");
|
|
11017
11042
|
i.className = "tcw-grid-label", i.innerHTML = `${A("link", 13)}<span>${M(this.t("grid.sync"))}</span>`, r.appendChild(i);
|
|
11018
|
-
for (let e of
|
|
11043
|
+
for (let e of to) {
|
|
11019
11044
|
let t = document.createElement("button");
|
|
11020
11045
|
t.type = "button", t.className = "tcw-btn tcw-grid-sync", t.textContent = this.t(`grid.sync.${e}`), t.title = this.t(`grid.sync.${e}.hint`), t.addEventListener("click", () => this.setSync({ [e]: !this.sync[e] })), this.syncButtons.set(e, t), r.appendChild(t);
|
|
11021
11046
|
}
|
|
@@ -11062,7 +11087,7 @@ var io = class {
|
|
|
11062
11087
|
onChange: () => this.renderLayoutsButton(),
|
|
11063
11088
|
onError: () => this.toast(this.t("layouts.saveFailed"), "error")
|
|
11064
11089
|
});
|
|
11065
|
-
this.session = t, this.layoutsUI = new
|
|
11090
|
+
this.session = t, this.layoutsUI = new ii(t, {
|
|
11066
11091
|
root: this.root,
|
|
11067
11092
|
t: this.t,
|
|
11068
11093
|
toast: (e, t) => this.toast(e, t),
|
|
@@ -11076,12 +11101,12 @@ var io = class {
|
|
|
11076
11101
|
this.cells[this.active]?.widget.toast(e, t);
|
|
11077
11102
|
}
|
|
11078
11103
|
};
|
|
11079
|
-
function
|
|
11104
|
+
function so(e, t) {
|
|
11080
11105
|
let n = -1;
|
|
11081
11106
|
for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
|
|
11082
11107
|
return n;
|
|
11083
11108
|
}
|
|
11084
11109
|
//#endregion
|
|
11085
|
-
export { mt as CHART_TYPE_ICONS,
|
|
11110
|
+
export { mt as CHART_TYPE_ICONS, Ua as ChartWidget, oo as ChartWidgetGrid, eo as DEFAULT_GRID_SYNC, pt as DRAWING_TOOL_ICONS, l as EN_MESSAGES, $ as GRID_SHAPES, s as LayoutSession, i as MAX_LAYOUT_NAME, ft as UI_ICONS, m as VI_MESSAGES, D as WIDGET_FEATURES, Yn as WIDGET_UI_PRESETS, V as applyWidgetUI, o as cleanLayoutName, xt as createChartTypeIcon, A as createIcon, j as createToolIcon, u as findWidgetLocale, yt as iconSvg, r as localStorageLayouts, t as memoryLayouts, ao as readGridLayout, On as readWatchlists, Ti as readWidgetLayout, c as registerWidgetLocale, B as resolveWidgetUI, nr as widgetUIVariables };
|
|
11086
11111
|
|
|
11087
11112
|
//# sourceMappingURL=index.js.map
|