@tradecanvas/chart 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{LayoutSession-Dx5up0ZJ.cjs → LayoutSession-CwpR5ScW.cjs} +2 -2
- package/dist/{LayoutSession-Dx5up0ZJ.cjs.map → LayoutSession-CwpR5ScW.cjs.map} +1 -1
- package/dist/{LayoutSession-DECsVW1x.js → LayoutSession-fJQLPSQ8.js} +2 -2
- package/dist/{LayoutSession-DECsVW1x.js.map → LayoutSession-fJQLPSQ8.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -1
- package/dist/widget/WidgetInlineText.d.ts +2 -0
- package/dist/widget/WidgetInlineText.d.ts.map +1 -1
- package/dist/widget/index.cjs +3 -3
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +475 -472
- package/dist/widget/index.js.map +1 -1
- package/package.json +3 -3
package/dist/widget/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-fJQLPSQ8.js";
|
|
2
2
|
import { _ as h, b as g, g as te, h as _, l as v, m as ne, n as re, t as ie, v as ae, y as oe } from "../widgetLocales-BX7VRdl5.js";
|
|
3
3
|
import { t as se } from "../monthView-N8yDaTqZ.js";
|
|
4
4
|
import { a as ce, c as le, d as ue, f as de, i as fe, l as pe, n as me, o as y, r as he, s as ge, t as _e, u as ve } from "../widgetFeatures-BM6u0u74.js";
|
|
@@ -4931,7 +4931,7 @@ var K = {
|
|
|
4931
4931
|
"horizontalRay",
|
|
4932
4932
|
"verticalLine",
|
|
4933
4933
|
"rectangle"
|
|
4934
|
-
]), So = { priceLabel: "#ffffff" }, Co = 8, wo = 6, To = 1.3, Eo = 120, Do =
|
|
4934
|
+
]), So = { priceLabel: "#ffffff" }, Co = 8, wo = 6, To = 1.3, Eo = 120, Do = 1, Oo = 4, ko = 229, Ao = 500, jo = 8, Mo = 400, No = class {
|
|
4935
4935
|
wrap = null;
|
|
4936
4936
|
area = null;
|
|
4937
4937
|
target = null;
|
|
@@ -4941,7 +4941,7 @@ var K = {
|
|
|
4941
4941
|
offSince = 0;
|
|
4942
4942
|
onPressAway = (e) => {
|
|
4943
4943
|
if (!(!this.area || e.target === this.area)) {
|
|
4944
|
-
if (this.area.value === this.target?.text && performance.now() - this.openedAt <
|
|
4944
|
+
if (this.area.value === this.target?.text && performance.now() - this.openedAt < Ao) {
|
|
4945
4945
|
e.preventDefault(), e.stopPropagation();
|
|
4946
4946
|
return;
|
|
4947
4947
|
}
|
|
@@ -4962,7 +4962,7 @@ var K = {
|
|
|
4962
4962
|
let n = document.createElement("div");
|
|
4963
4963
|
n.className = "tcw-inline-text";
|
|
4964
4964
|
let r = document.createElement("textarea");
|
|
4965
|
-
r.className = "tcw-inline-text-input", r.value = e.text, r.rows = 1, r.spellcheck = !1, r.setAttribute("aria-label", e.label);
|
|
4965
|
+
r.className = "tcw-inline-text-input", r.value = e.text, r.rows = 1, r.spellcheck = !1, r.setAttribute("aria-label", e.label), e.placeholder && (r.placeholder = e.placeholder);
|
|
4966
4966
|
let { size: i, bold: a, italic: o, family: s } = e.font;
|
|
4967
4967
|
return Object.assign(r.style, {
|
|
4968
4968
|
fontSize: `${i}px`,
|
|
@@ -4975,9 +4975,9 @@ var K = {
|
|
|
4975
4975
|
}), r.addEventListener("input", () => {
|
|
4976
4976
|
this.fit(), this.target?.onInput(r.value);
|
|
4977
4977
|
let e = this.target?.rect();
|
|
4978
|
-
e && this.place(e);
|
|
4978
|
+
e && this.place(e), this.fit(), e && this.place(e);
|
|
4979
4979
|
}), r.addEventListener("keydown", (e) => {
|
|
4980
|
-
e.stopPropagation(), !(e.isComposing || e.keyCode ===
|
|
4980
|
+
e.stopPropagation(), !(e.isComposing || e.keyCode === ko) && (e.key === "Escape" ? (e.preventDefault(), this.finish(!1, !0)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this.finish(!0, !0)));
|
|
4981
4981
|
}), r.addEventListener("blur", () => this.finish(!0, !1)), n.appendChild(r), this.layer().appendChild(n), this.wrap = n, this.area = r, this.place(t), this.fit(), r.focus(), r.select(), this.openedAt = performance.now(), this.offSince = 0, document.addEventListener("pointerdown", this.onPressAway, !0), document.addEventListener("mousedown", this.onPressAway, !0), this.follow(), !0;
|
|
4982
4982
|
}
|
|
4983
4983
|
commit() {
|
|
@@ -4998,10 +4998,12 @@ var K = {
|
|
|
4998
4998
|
place(e) {
|
|
4999
4999
|
let t = this.area;
|
|
5000
5000
|
if (!t) return;
|
|
5001
|
-
let n = Math.max(Eo, window.innerWidth -
|
|
5002
|
-
t.style.maxWidth = `${n}px
|
|
5003
|
-
let r =
|
|
5004
|
-
t.style.
|
|
5001
|
+
let n = Math.max(Eo, window.innerWidth - jo * 2);
|
|
5002
|
+
t.style.maxWidth = `${n}px`;
|
|
5003
|
+
let r = Math.max(Eo, e.width + Do * 2 + Oo);
|
|
5004
|
+
t.style.width = `${Math.min(n, r)}px`, t.style.minHeight = `${e.height + Do * 2}px`;
|
|
5005
|
+
let i = t.offsetWidth || r, a = t.offsetHeight || e.height + Do * 2;
|
|
5006
|
+
t.style.left = `${Math.max(jo, Math.min(e.x - Do, window.innerWidth - jo - i))}px`, t.style.top = `${Math.max(jo, Math.min(e.y - Do, window.innerHeight - jo - a))}px`;
|
|
5005
5007
|
}
|
|
5006
5008
|
offWindow(e) {
|
|
5007
5009
|
return e.x > window.innerWidth || e.x + e.width < 0 || e.y > window.innerHeight || e.y + e.height < 0;
|
|
@@ -5014,14 +5016,14 @@ var K = {
|
|
|
5014
5016
|
this.frame = requestAnimationFrame(() => {
|
|
5015
5017
|
if (!this.target || this.done) return;
|
|
5016
5018
|
let e = this.target.rect(), t = e !== null && this.offWindow(e);
|
|
5017
|
-
if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince >
|
|
5019
|
+
if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince > Mo) {
|
|
5018
5020
|
this.finish(!0, !1);
|
|
5019
5021
|
return;
|
|
5020
5022
|
}
|
|
5021
5023
|
this.place(e), this.follow();
|
|
5022
5024
|
});
|
|
5023
5025
|
}
|
|
5024
|
-
},
|
|
5026
|
+
}, Po = [
|
|
5025
5027
|
{
|
|
5026
5028
|
id: "regularScale",
|
|
5027
5029
|
mode: "regular",
|
|
@@ -5042,7 +5044,7 @@ var K = {
|
|
|
5042
5044
|
mode: "indexedTo100",
|
|
5043
5045
|
label: "settings.scale.indexedTo100"
|
|
5044
5046
|
}
|
|
5045
|
-
],
|
|
5047
|
+
], Fo = [
|
|
5046
5048
|
{
|
|
5047
5049
|
action: "resetView",
|
|
5048
5050
|
keys: "Alt+R",
|
|
@@ -5059,20 +5061,20 @@ var K = {
|
|
|
5059
5061
|
feature: "hotkeys.goToDate"
|
|
5060
5062
|
}
|
|
5061
5063
|
];
|
|
5062
|
-
function
|
|
5063
|
-
return
|
|
5064
|
+
function Io(e) {
|
|
5065
|
+
return Po.find((t) => t.id === e)?.mode;
|
|
5064
5066
|
}
|
|
5065
|
-
function
|
|
5067
|
+
function Lo(...e) {
|
|
5066
5068
|
return e.filter((e) => e.length > 0).flatMap((e, t) => t === 0 ? [...e] : ["separator", ...e]);
|
|
5067
5069
|
}
|
|
5068
|
-
function
|
|
5070
|
+
function Ro(e, t) {
|
|
5069
5071
|
let n = t.keys[e.id];
|
|
5070
5072
|
return n ? {
|
|
5071
5073
|
...e,
|
|
5072
5074
|
shortcut: n
|
|
5073
5075
|
} : e;
|
|
5074
5076
|
}
|
|
5075
|
-
function
|
|
5077
|
+
function zo(e, t) {
|
|
5076
5078
|
if (e.price === void 0 || !Number.isFinite(e.price)) return [];
|
|
5077
5079
|
let n = e.formatPrice(e.price), r = [];
|
|
5078
5080
|
if (e.canAlert && r.push({
|
|
@@ -5109,13 +5111,13 @@ function Lo(e, t) {
|
|
|
5109
5111
|
icon: "minus"
|
|
5110
5112
|
}), r;
|
|
5111
5113
|
}
|
|
5112
|
-
var
|
|
5114
|
+
var Bo = (e) => ({
|
|
5113
5115
|
id: "settings",
|
|
5114
5116
|
label: e("chartMenu.settings"),
|
|
5115
5117
|
icon: "settings"
|
|
5116
5118
|
});
|
|
5117
|
-
function
|
|
5118
|
-
let n = [
|
|
5119
|
+
function Vo(e, t) {
|
|
5120
|
+
let n = [Ro({
|
|
5119
5121
|
id: "resetView",
|
|
5120
5122
|
label: t("chartMenu.resetView")
|
|
5121
5123
|
}, e)];
|
|
@@ -5148,9 +5150,9 @@ function zo(e, t) {
|
|
|
5148
5150
|
label: t("chartMenu.exportData"),
|
|
5149
5151
|
icon: "save"
|
|
5150
5152
|
}] : [];
|
|
5151
|
-
return
|
|
5153
|
+
return Lo(zo(e, t), n, r, [...i, Bo(t)]);
|
|
5152
5154
|
}
|
|
5153
|
-
function
|
|
5155
|
+
function Ho(e, t) {
|
|
5154
5156
|
let n = [
|
|
5155
5157
|
{
|
|
5156
5158
|
id: "resetPriceScale",
|
|
@@ -5161,7 +5163,7 @@ function Bo(e, t) {
|
|
|
5161
5163
|
label: t("settings.autoScale"),
|
|
5162
5164
|
checked: e.autoScale
|
|
5163
5165
|
},
|
|
5164
|
-
|
|
5166
|
+
Ro({
|
|
5165
5167
|
id: "invertScale",
|
|
5166
5168
|
label: t("chartMenu.invertScale"),
|
|
5167
5169
|
checked: e.inverted
|
|
@@ -5171,7 +5173,7 @@ function Bo(e, t) {
|
|
|
5171
5173
|
label: t("settings.leftScale"),
|
|
5172
5174
|
checked: e.leftScale
|
|
5173
5175
|
}
|
|
5174
|
-
], r =
|
|
5176
|
+
], r = Po.filter((t) => t.mode !== "logarithmic" || e.canLog).map((n) => ({
|
|
5175
5177
|
id: n.id,
|
|
5176
5178
|
label: t(n.label),
|
|
5177
5179
|
radio: !0,
|
|
@@ -5199,7 +5201,7 @@ function Bo(e, t) {
|
|
|
5199
5201
|
label: t("chartMenu.lastPriceLine"),
|
|
5200
5202
|
checked: e.lines.lastPrice
|
|
5201
5203
|
}];
|
|
5202
|
-
return
|
|
5204
|
+
return Lo(n, r, [{
|
|
5203
5205
|
id: "labels",
|
|
5204
5206
|
label: t("chartMenu.labels"),
|
|
5205
5207
|
submenu: i
|
|
@@ -5207,18 +5209,18 @@ function Bo(e, t) {
|
|
|
5207
5209
|
id: "lines",
|
|
5208
5210
|
label: t("chartMenu.lines"),
|
|
5209
5211
|
submenu: a
|
|
5210
|
-
}],
|
|
5212
|
+
}], zo({
|
|
5211
5213
|
...e,
|
|
5212
5214
|
canTrade: !1,
|
|
5213
5215
|
canDraw: !1
|
|
5214
|
-
}, t), [
|
|
5216
|
+
}, t), [Bo(t)]);
|
|
5215
5217
|
}
|
|
5216
|
-
function
|
|
5217
|
-
let n = [
|
|
5218
|
+
function Uo(e, t) {
|
|
5219
|
+
let n = [Ro({
|
|
5218
5220
|
id: "resetView",
|
|
5219
5221
|
label: t("chartMenu.resetTimeScale")
|
|
5220
5222
|
}, e)];
|
|
5221
|
-
e.canGoToDate && n.push(
|
|
5223
|
+
e.canGoToDate && n.push(Ro({
|
|
5222
5224
|
id: "goToDate",
|
|
5223
5225
|
label: t("chartMenu.goToDate"),
|
|
5224
5226
|
icon: "calendar"
|
|
@@ -5229,13 +5231,13 @@ function Vo(e, t) {
|
|
|
5229
5231
|
radio: !0,
|
|
5230
5232
|
checked: t.value === e.timezone.current
|
|
5231
5233
|
}));
|
|
5232
|
-
return
|
|
5234
|
+
return Lo(n, r.length > 0 ? [{
|
|
5233
5235
|
id: "timezone",
|
|
5234
5236
|
label: t("settings.timezone"),
|
|
5235
5237
|
submenu: r
|
|
5236
5238
|
}] : []);
|
|
5237
5239
|
}
|
|
5238
|
-
function
|
|
5240
|
+
function Wo(e, t) {
|
|
5239
5241
|
let n = e.pane ? [
|
|
5240
5242
|
{
|
|
5241
5243
|
id: "paneLog",
|
|
@@ -5253,53 +5255,53 @@ function Ho(e, t) {
|
|
|
5253
5255
|
checked: e.pane.percent
|
|
5254
5256
|
}
|
|
5255
5257
|
] : [];
|
|
5256
|
-
return
|
|
5258
|
+
return Lo([Ro({
|
|
5257
5259
|
id: "resetView",
|
|
5258
5260
|
label: t("chartMenu.resetView")
|
|
5259
|
-
}, e)], n, [
|
|
5261
|
+
}, e)], n, [Bo(t)]);
|
|
5260
5262
|
}
|
|
5261
|
-
function
|
|
5263
|
+
function Go(e, t, n) {
|
|
5262
5264
|
switch (e) {
|
|
5263
|
-
case "priceAxis": return
|
|
5264
|
-
case "timeAxis": return
|
|
5265
|
-
case "pane": return
|
|
5266
|
-
default: return
|
|
5265
|
+
case "priceAxis": return Ho(t, n);
|
|
5266
|
+
case "timeAxis": return Uo(t, n);
|
|
5267
|
+
case "pane": return Wo(t, n);
|
|
5268
|
+
default: return Vo(t, n);
|
|
5267
5269
|
}
|
|
5268
5270
|
}
|
|
5269
5271
|
//#endregion
|
|
5270
5272
|
//#region src/widget/signedFigure.ts
|
|
5271
|
-
var
|
|
5272
|
-
function
|
|
5273
|
-
let r = e.replace(
|
|
5274
|
-
return r === n.replace(
|
|
5273
|
+
var Ko = /^[-+−]/;
|
|
5274
|
+
function qo(e, t, n) {
|
|
5275
|
+
let r = e.replace(Ko, "");
|
|
5276
|
+
return r === n.replace(Ko, "") ? r : t > 0 ? `+${r}` : t < 0 ? `-${r}` : r;
|
|
5275
5277
|
}
|
|
5276
|
-
function
|
|
5278
|
+
function Jo(e) {
|
|
5277
5279
|
return e.startsWith("+") ? "up" : e.startsWith("-") ? "down" : null;
|
|
5278
5280
|
}
|
|
5279
5281
|
//#endregion
|
|
5280
5282
|
//#region src/widget/WidgetAccountPanel.ts
|
|
5281
|
-
var
|
|
5283
|
+
var Yo = [
|
|
5282
5284
|
"positions",
|
|
5283
5285
|
"orders",
|
|
5284
5286
|
"history"
|
|
5285
|
-
],
|
|
5287
|
+
], Xo = [
|
|
5286
5288
|
"order",
|
|
5287
5289
|
"close",
|
|
5288
5290
|
"reverse",
|
|
5289
5291
|
"stopLoss",
|
|
5290
5292
|
"takeProfit"
|
|
5291
|
-
],
|
|
5293
|
+
], Zo = [
|
|
5292
5294
|
"market",
|
|
5293
5295
|
"limit",
|
|
5294
5296
|
"stop"
|
|
5295
|
-
],
|
|
5296
|
-
function
|
|
5297
|
+
], Qo = ["gtc", "day"], q = "—", $o = "{pnl}", es = 3;
|
|
5298
|
+
function ts(e, t, n) {
|
|
5297
5299
|
return e.includes(t ?? "") ? t : n;
|
|
5298
5300
|
}
|
|
5299
|
-
function
|
|
5301
|
+
function ns(e, t) {
|
|
5300
5302
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
5301
5303
|
}
|
|
5302
|
-
function
|
|
5304
|
+
function rs(e, t) {
|
|
5303
5305
|
if (t === null) return null;
|
|
5304
5306
|
let n = e.quantity - (e.closedQuantity ?? 0), r = e.side === "buy" ? 1 : -1;
|
|
5305
5307
|
return {
|
|
@@ -5307,15 +5309,15 @@ function ts(e, t) {
|
|
|
5307
5309
|
pct: e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * r
|
|
5308
5310
|
};
|
|
5309
5311
|
}
|
|
5310
|
-
function
|
|
5312
|
+
function is(e) {
|
|
5311
5313
|
let t = document.createElement("span");
|
|
5312
5314
|
return t.dir = "ltr", t.textContent = e, t;
|
|
5313
5315
|
}
|
|
5314
|
-
function
|
|
5315
|
-
let t =
|
|
5316
|
+
function as(e) {
|
|
5317
|
+
let t = Jo(e);
|
|
5316
5318
|
return t ? `tcw-account-${t}` : "";
|
|
5317
5319
|
}
|
|
5318
|
-
var
|
|
5320
|
+
var os = class {
|
|
5319
5321
|
el;
|
|
5320
5322
|
tabButtons = /* @__PURE__ */ new Map();
|
|
5321
5323
|
tabLabels = /* @__PURE__ */ new Map();
|
|
@@ -5337,7 +5339,7 @@ var is = class {
|
|
|
5337
5339
|
r.className = "tcw-account-head";
|
|
5338
5340
|
let i = document.createElement("div");
|
|
5339
5341
|
i.className = "tcw-account-tabs", i.setAttribute("role", "tablist"), i.addEventListener("keydown", (e) => this.onTabKey(e));
|
|
5340
|
-
for (let e of
|
|
5342
|
+
for (let e of Yo) {
|
|
5341
5343
|
let t = document.createElement("button");
|
|
5342
5344
|
t.type = "button", t.className = "tcw-account-tab", t.setAttribute("role", "tab"), t.id = `tcw-account-tab-${e}`;
|
|
5343
5345
|
let n = document.createElement("span");
|
|
@@ -5365,7 +5367,7 @@ var is = class {
|
|
|
5365
5367
|
}
|
|
5366
5368
|
update(e) {
|
|
5367
5369
|
let t = this.snapshot;
|
|
5368
|
-
if (this.snapshot = e,
|
|
5370
|
+
if (this.snapshot = e, ns(t.positions, e.positions) && ns(t.orders, e.orders) && ns(t.fills, e.fills) && t.realisedPnl === e.realisedPnl) {
|
|
5369
5371
|
t.price !== e.price && (this.renderTotals(), this.open && this.tab === "positions" && this.patchPrices());
|
|
5370
5372
|
return;
|
|
5371
5373
|
}
|
|
@@ -5378,10 +5380,10 @@ var is = class {
|
|
|
5378
5380
|
this.tab = e, this.renderTabs(), this.render();
|
|
5379
5381
|
}
|
|
5380
5382
|
onTabKey(e) {
|
|
5381
|
-
let t =
|
|
5383
|
+
let t = Yo.indexOf(this.tab), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : -2;
|
|
5382
5384
|
if (n === -2) return;
|
|
5383
5385
|
e.preventDefault();
|
|
5384
|
-
let r =
|
|
5386
|
+
let r = Yo[(n + Yo.length) % Yo.length];
|
|
5385
5387
|
this.selectTab(r), this.tabButtons.get(r)?.focus();
|
|
5386
5388
|
}
|
|
5387
5389
|
renderTabs() {
|
|
@@ -5398,15 +5400,15 @@ var is = class {
|
|
|
5398
5400
|
}
|
|
5399
5401
|
renderTotals() {
|
|
5400
5402
|
let { positions: e, price: t, fills: n, realisedPnl: r } = this.snapshot, i = [], a = e.reduce((e, n) => {
|
|
5401
|
-
let r =
|
|
5403
|
+
let r = rs(n, t);
|
|
5402
5404
|
return r === null ? e : (e ?? 0) + r.pnl;
|
|
5403
5405
|
}, null);
|
|
5404
5406
|
a !== null && i.push(this.total("account.openPnl", a)), (n.length > 0 || r !== void 0 && r !== 0) && i.push(this.total("account.realised", r ?? n.reduce((e, t) => e + (t.pnl ?? 0), 0))), this.totalsEl.replaceChildren(...i);
|
|
5405
5407
|
}
|
|
5406
5408
|
total(e, t) {
|
|
5407
5409
|
let n = document.createElement("span"), r = this.amount(t);
|
|
5408
|
-
n.className = `tcw-account-total ${
|
|
5409
|
-
let i = this.t(e), a = i.indexOf(
|
|
5410
|
+
n.className = `tcw-account-total ${as(r)}`.trim();
|
|
5411
|
+
let i = this.t(e), a = i.indexOf($o), o = is(r);
|
|
5410
5412
|
return a < 0 ? n.append(`${i} `, o) : n.append(i.slice(0, a), o, i.slice(a + 5)), n;
|
|
5411
5413
|
}
|
|
5412
5414
|
render() {
|
|
@@ -5415,17 +5417,17 @@ var is = class {
|
|
|
5415
5417
|
}
|
|
5416
5418
|
patchPrices() {
|
|
5417
5419
|
let { price: e } = this.snapshot;
|
|
5418
|
-
for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl,
|
|
5420
|
+
for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl, rs(t.position, e));
|
|
5419
5421
|
}
|
|
5420
5422
|
amount(e) {
|
|
5421
|
-
return
|
|
5423
|
+
return qo(this.money(Math.abs(e)), e, this.money(0));
|
|
5422
5424
|
}
|
|
5423
5425
|
money(e) {
|
|
5424
5426
|
return this.callbacks.formatAmount ? this.callbacks.formatAmount(e) : e.toFixed(2);
|
|
5425
5427
|
}
|
|
5426
5428
|
percent(e) {
|
|
5427
5429
|
let t = (e) => this.callbacks.formatNumber ? this.callbacks.formatNumber(e, 2) : e.toFixed(2);
|
|
5428
|
-
return `${
|
|
5430
|
+
return `${qo(t(Math.abs(e)), e, t(0))}%`;
|
|
5429
5431
|
}
|
|
5430
5432
|
writePnl(e, t) {
|
|
5431
5433
|
if (t === null) {
|
|
@@ -5433,7 +5435,7 @@ var is = class {
|
|
|
5433
5435
|
return;
|
|
5434
5436
|
}
|
|
5435
5437
|
let n = this.amount(t.pnl);
|
|
5436
|
-
e.className =
|
|
5438
|
+
e.className = as(n), e.textContent = `${n} · ${this.percent(t.pct)}`;
|
|
5437
5439
|
}
|
|
5438
5440
|
table(e, t, n) {
|
|
5439
5441
|
if (t.length === 0) {
|
|
@@ -5478,8 +5480,8 @@ var is = class {
|
|
|
5478
5480
|
}
|
|
5479
5481
|
renderPositions() {
|
|
5480
5482
|
let { formatPrice: e } = this.callbacks, { price: t } = this.snapshot, n = [], r = this.snapshot.positions.map((r) => {
|
|
5481
|
-
let i = r.quantity - (r.closedQuantity ?? 0), a =
|
|
5482
|
-
this.writePnl(a,
|
|
5483
|
+
let i = r.quantity - (r.closedQuantity ?? 0), a = is("");
|
|
5484
|
+
this.writePnl(a, rs(r, t)), n.push(a);
|
|
5483
5485
|
let o = `${this.sideText(r.side, "position")} ${i} @ ${e(r.entryPrice)}`;
|
|
5484
5486
|
return [
|
|
5485
5487
|
this.sideCell(r.side),
|
|
@@ -5534,13 +5536,13 @@ var is = class {
|
|
|
5534
5536
|
let a = [...i.tBodies[0].rows];
|
|
5535
5537
|
this.snapshot.positions.forEach((e, t) => this.live.push({
|
|
5536
5538
|
position: e,
|
|
5537
|
-
price: a[t].cells[
|
|
5539
|
+
price: a[t].cells[es],
|
|
5538
5540
|
pnl: n[t]
|
|
5539
5541
|
}));
|
|
5540
5542
|
}
|
|
5541
5543
|
renderOrders() {
|
|
5542
5544
|
let { formatPrice: e } = this.callbacks, t = this.snapshot.orders.map((t) => {
|
|
5543
|
-
let n =
|
|
5545
|
+
let n = ts(Zo, t.type === "stopLimit" ? "stop" : t.type, "limit"), r = `${this.sideText(t.side, "trade")} ${t.quantity} @ ${e(t.price)}`;
|
|
5544
5546
|
return [
|
|
5545
5547
|
this.sideCell(t.side, "trade"),
|
|
5546
5548
|
this.t(`ticket.type.${n}`),
|
|
@@ -5548,7 +5550,7 @@ var is = class {
|
|
|
5548
5550
|
e(t.price),
|
|
5549
5551
|
this.price(t.stopLoss),
|
|
5550
5552
|
this.price(t.takeProfit),
|
|
5551
|
-
t.timeInForce ? this.t(`ticket.tif.${
|
|
5553
|
+
t.timeInForce ? this.t(`ticket.tif.${ts(Qo, t.timeInForce, "gtc")}`) : q,
|
|
5552
5554
|
this.actions({
|
|
5553
5555
|
icon: "x",
|
|
5554
5556
|
label: `${this.t("account.cancelOrder")}: ${r}`,
|
|
@@ -5583,13 +5585,13 @@ var is = class {
|
|
|
5583
5585
|
}
|
|
5584
5586
|
renderHistory() {
|
|
5585
5587
|
let { formatPrice: e, formatTime: t } = this.callbacks, n = [...this.snapshot.fills].reverse().map((n) => {
|
|
5586
|
-
let r =
|
|
5587
|
-
return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className =
|
|
5588
|
+
let r = is("");
|
|
5589
|
+
return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className = as(r.textContent)), [
|
|
5588
5590
|
t(n.time),
|
|
5589
5591
|
this.sideCell(n.side, "trade"),
|
|
5590
5592
|
String(n.quantity),
|
|
5591
5593
|
e(n.price),
|
|
5592
|
-
this.t(`account.reason.${
|
|
5594
|
+
this.t(`account.reason.${ts(Xo, n.reason, "order")}`),
|
|
5593
5595
|
r
|
|
5594
5596
|
];
|
|
5595
5597
|
});
|
|
@@ -5611,11 +5613,11 @@ var is = class {
|
|
|
5611
5613
|
}
|
|
5612
5614
|
], n, "account.noFills");
|
|
5613
5615
|
}
|
|
5614
|
-
},
|
|
5615
|
-
function
|
|
5616
|
+
}, ss = 1e-9;
|
|
5617
|
+
function cs(e, t) {
|
|
5616
5618
|
return e.type === "market" ? t : e.price;
|
|
5617
5619
|
}
|
|
5618
|
-
function
|
|
5620
|
+
function ls(e, t, n = {}) {
|
|
5619
5621
|
let r = [];
|
|
5620
5622
|
(!(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");
|
|
5621
5623
|
let i = e.side === "buy";
|
|
@@ -5625,18 +5627,18 @@ function ss(e, t, n = {}) {
|
|
|
5625
5627
|
}
|
|
5626
5628
|
let a = (e) => e === null || Number.isFinite(e) && e > 0;
|
|
5627
5629
|
a(e.stopLoss) || r.push("stopLoss"), a(e.takeProfit) || r.push("takeProfit");
|
|
5628
|
-
let o =
|
|
5629
|
-
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, ...
|
|
5630
|
+
let o = cs(e, t);
|
|
5631
|
+
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, ...us(e, n)];
|
|
5630
5632
|
}
|
|
5631
|
-
function
|
|
5633
|
+
function us(e, t) {
|
|
5632
5634
|
let n = [], r = e.type === "market" ? null : e.price, i = [
|
|
5633
5635
|
r,
|
|
5634
5636
|
e.stopLoss,
|
|
5635
5637
|
e.takeProfit
|
|
5636
5638
|
].filter((e) => e !== null && Number.isFinite(e) && e > 0), { roundPrice: a, limits: o, lot: s } = t;
|
|
5637
|
-
return a && i.some((e) => Math.abs(a(e) - e) >
|
|
5639
|
+
return a && i.some((e) => Math.abs(a(e) - e) > ss) && n.push("priceStep"), o && r !== null && r > 0 && (r > o.ceiling + ss || r < o.floor - ss) && n.push("priceLimits"), s !== void 0 && s > 1 && e.quantity > s && e.quantity % s !== 0 && n.push("lot"), n;
|
|
5638
5640
|
}
|
|
5639
|
-
function
|
|
5641
|
+
function ds(e, t) {
|
|
5640
5642
|
let n = {
|
|
5641
5643
|
side: e.side,
|
|
5642
5644
|
type: e.type,
|
|
@@ -5645,14 +5647,14 @@ function ls(e, t) {
|
|
|
5645
5647
|
};
|
|
5646
5648
|
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;
|
|
5647
5649
|
}
|
|
5648
|
-
function
|
|
5649
|
-
let n =
|
|
5650
|
+
function fs(e, t) {
|
|
5651
|
+
let n = cs(e, t);
|
|
5650
5652
|
if (n === null || e.stopLoss === null || e.takeProfit === null) return null;
|
|
5651
5653
|
let r = Math.abs(n - e.stopLoss);
|
|
5652
5654
|
return r > 0 ? Math.abs(e.takeProfit - n) / r : null;
|
|
5653
5655
|
}
|
|
5654
|
-
function
|
|
5655
|
-
let i =
|
|
5656
|
+
function ps(e, t, n, r = 1) {
|
|
5657
|
+
let i = cs(e, t);
|
|
5656
5658
|
if (i === null || !(i > 0) || !Number.isFinite(n) || !(e.quantity > 0)) return null;
|
|
5657
5659
|
let a = e.side === "buy" ? 1 : -1;
|
|
5658
5660
|
return {
|
|
@@ -5660,18 +5662,18 @@ function ds(e, t, n, r = 1) {
|
|
|
5660
5662
|
amount: (n - i) * e.quantity * a * r
|
|
5661
5663
|
};
|
|
5662
5664
|
}
|
|
5663
|
-
function
|
|
5664
|
-
let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i =
|
|
5665
|
+
function ms(e, t, n = {}) {
|
|
5666
|
+
let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i = cs(e, t), a = i !== null && i > 0 && e.quantity > 0 ? i * e.quantity * r : null, o = ls(e, t), s = (n, i) => n === null || o.includes(i) ? null : ps(e, t, n, r)?.amount ?? null, c = s(e.stopLoss, "stopLossSide"), l = s(e.takeProfit, "takeProfitSide");
|
|
5665
5667
|
return {
|
|
5666
5668
|
value: a,
|
|
5667
5669
|
risk: c,
|
|
5668
5670
|
reward: l,
|
|
5669
|
-
ratio: c !== null && l !== null ?
|
|
5671
|
+
ratio: c !== null && l !== null ? fs(e, t) : null
|
|
5670
5672
|
};
|
|
5671
5673
|
}
|
|
5672
5674
|
//#endregion
|
|
5673
5675
|
//#region src/widget/WidgetOrderTicket.ts
|
|
5674
|
-
var
|
|
5676
|
+
var hs = 229, gs = 1, _s = 2, vs = .999999999, ys = 0, bs = class {
|
|
5675
5677
|
backdrop;
|
|
5676
5678
|
modal;
|
|
5677
5679
|
symbolEl;
|
|
@@ -5682,11 +5684,11 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5682
5684
|
draft = null;
|
|
5683
5685
|
lastPrice = null;
|
|
5684
5686
|
rules = {};
|
|
5685
|
-
step =
|
|
5686
|
-
round = (e) =>
|
|
5687
|
+
step = Ss;
|
|
5688
|
+
round = (e) => Cs(e, e);
|
|
5687
5689
|
typed = /* @__PURE__ */ new Map();
|
|
5688
5690
|
returnFocus = null;
|
|
5689
|
-
uid = ++
|
|
5691
|
+
uid = ++ys;
|
|
5690
5692
|
constructor(e, t, n = T) {
|
|
5691
5693
|
this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
5692
5694
|
let r = !1;
|
|
@@ -5695,7 +5697,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5695
5697
|
}), this.backdrop.addEventListener("click", (e) => {
|
|
5696
5698
|
e.target === this.backdrop && r && this.close(), r = !1;
|
|
5697
5699
|
}), this.modal = document.createElement("div"), this.modal.className = "tcw-modal tcw-order-ticket", this.modal.setAttribute("role", "dialog"), this.modal.setAttribute("aria-modal", "true"), this.modal.setAttribute("aria-labelledby", `tcw-ticket-title-${this.uid}`), this.modal.addEventListener("keydown", (e) => {
|
|
5698
|
-
if (e.key === "Escape" && !e.isComposing && e.keyCode !==
|
|
5700
|
+
if (e.key === "Escape" && !e.isComposing && e.keyCode !== hs) {
|
|
5699
5701
|
e.stopPropagation(), this.close();
|
|
5700
5702
|
return;
|
|
5701
5703
|
}
|
|
@@ -5717,7 +5719,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5717
5719
|
u.className = "tcw-footer-end", u.append(l, this.submit), c.append(u), this.modal.append(i, this.body, this.summaryEl, this.problemsEl, c), this.backdrop.appendChild(this.modal), e.appendChild(this.backdrop);
|
|
5718
5720
|
}
|
|
5719
5721
|
open(e) {
|
|
5720
|
-
this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ??
|
|
5722
|
+
this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ?? Ss, this.round = e.round ?? ((e) => Cs(e, e)), this.typed.clear(), this.symbolEl.textContent = e.symbol ? O(e.symbol) : "";
|
|
5721
5723
|
let t = this.round(e.price ?? e.lastPrice ?? 0), n = e.side ?? "buy", r = "market";
|
|
5722
5724
|
e.price !== void 0 && e.lastPrice !== null && t !== e.lastPrice && (r = t < e.lastPrice == (n === "buy") ? "limit" : "stop"), this.draft = {
|
|
5723
5725
|
side: n,
|
|
@@ -5753,14 +5755,14 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5753
5755
|
return t > 0 ? Number((10 ** -t).toFixed(t)) : 1;
|
|
5754
5756
|
}
|
|
5755
5757
|
priceStep(e, t) {
|
|
5756
|
-
return this.step(t > 0 ? e : e *
|
|
5758
|
+
return this.step(t > 0 ? e : e * vs);
|
|
5757
5759
|
}
|
|
5758
5760
|
writePrice(e) {
|
|
5759
|
-
return Number.isFinite(e) ? this.step ===
|
|
5761
|
+
return Number.isFinite(e) ? this.step === Ss ? String(e) : e.toFixed(gt(this.step(e))) : "";
|
|
5760
5762
|
}
|
|
5761
5763
|
place() {
|
|
5762
5764
|
let e = this.draft;
|
|
5763
|
-
!e ||
|
|
5765
|
+
!e || ls(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(ds(e, this.lastPrice)), this.close());
|
|
5764
5766
|
}
|
|
5765
5767
|
set(e, t = !1) {
|
|
5766
5768
|
this.draft && (this.draft = {
|
|
@@ -5795,7 +5797,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5795
5797
|
return r.className = "tcw-settings-label", r.textContent = this.t(e), n.append(r, t), n;
|
|
5796
5798
|
}
|
|
5797
5799
|
choices(e, t, n, r, i) {
|
|
5798
|
-
let a = e === "type" ? "ticket.type" : "ticket.tif", o =
|
|
5800
|
+
let a = e === "type" ? "ticket.type" : "ticket.tif", o = xs(e, Pe(t.map((e) => ({
|
|
5799
5801
|
value: e,
|
|
5800
5802
|
label: this.t(`${a}.${e}`)
|
|
5801
5803
|
})), n, i, this.t(r)));
|
|
@@ -5828,7 +5830,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5828
5830
|
return this.stepped(e, t, (e, t) => this.priceStep(e, t), () => this.lastPrice ?? this.draft?.price ?? 0, (e) => this.writePrice(e), n);
|
|
5829
5831
|
}
|
|
5830
5832
|
stepped(e, t, n, r, i, a) {
|
|
5831
|
-
let o =
|
|
5833
|
+
let o = xs(e, document.createElement("input"));
|
|
5832
5834
|
o.type = "number", o.className = "tcw-indi-input", o.step = "any", o.min = "0", o.value = this.typed.get(e) ?? i(t);
|
|
5833
5835
|
let s = this.t(`ticket.${e}`);
|
|
5834
5836
|
o.setAttribute("aria-label", s), o.addEventListener("input", () => {
|
|
@@ -5866,25 +5868,25 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5866
5868
|
if (!t) return NaN;
|
|
5867
5869
|
let n = t.type === "market" ? this.lastPrice ?? t.price : t.price;
|
|
5868
5870
|
if (!(n > 0)) return NaN;
|
|
5869
|
-
let r = e === "stopLoss" ? -
|
|
5871
|
+
let r = e === "stopLoss" ? -gs : _s;
|
|
5870
5872
|
return this.round(n * (1 + (t.side === "buy" ? r : -r) / 100));
|
|
5871
5873
|
}
|
|
5872
5874
|
check() {
|
|
5873
5875
|
let e = this.draft;
|
|
5874
5876
|
if (!e) return;
|
|
5875
|
-
let t =
|
|
5877
|
+
let t = ls(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e));
|
|
5876
5878
|
n.join("\n") !== [...this.problemsEl.children].map((e) => e.textContent).join("\n") && this.problemsEl.replaceChildren(...n.map((e) => {
|
|
5877
5879
|
let t = document.createElement("p");
|
|
5878
5880
|
return t.textContent = e, t;
|
|
5879
5881
|
}));
|
|
5880
5882
|
for (let t of ["stopLoss", "takeProfit"]) {
|
|
5881
|
-
let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null :
|
|
5883
|
+
let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null : ps(e, this.lastPrice, r, this.rules.multiplier);
|
|
5882
5884
|
n && (n.textContent = i ? `${this.signedNumber(i.pct, 2)}% · ${this.amount(i.amount)}` : "");
|
|
5883
5885
|
}
|
|
5884
5886
|
this.renderSummary(e), this.submit.disabled = t.length > 0, this.submit.textContent = this.t(e.side === "buy" ? "ticket.placeBuy" : "ticket.placeSell");
|
|
5885
5887
|
}
|
|
5886
5888
|
renderSummary(e) {
|
|
5887
|
-
let t =
|
|
5889
|
+
let t = ms(e, this.lastPrice, this.rules), n = t.risk === null ? null : this.amount(t.risk), r = t.reward === null ? null : this.amount(t.reward), i = [
|
|
5888
5890
|
[
|
|
5889
5891
|
"value",
|
|
5890
5892
|
"ticket.value",
|
|
@@ -5895,13 +5897,13 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5895
5897
|
"risk",
|
|
5896
5898
|
"ticket.risk",
|
|
5897
5899
|
n,
|
|
5898
|
-
n === null ? null :
|
|
5900
|
+
n === null ? null : Jo(n)
|
|
5899
5901
|
],
|
|
5900
5902
|
[
|
|
5901
5903
|
"reward",
|
|
5902
5904
|
"ticket.reward",
|
|
5903
5905
|
r,
|
|
5904
|
-
r === null ? null :
|
|
5906
|
+
r === null ? null : Jo(r)
|
|
5905
5907
|
],
|
|
5906
5908
|
[
|
|
5907
5909
|
"ratio",
|
|
@@ -5923,10 +5925,10 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5923
5925
|
return this.callbacks.formatNumber ? this.callbacks.formatNumber(e, t) : e.toFixed(t);
|
|
5924
5926
|
}
|
|
5925
5927
|
signedNumber(e, t) {
|
|
5926
|
-
return
|
|
5928
|
+
return qo(this.number(Math.abs(e), t), e, this.number(0, t));
|
|
5927
5929
|
}
|
|
5928
5930
|
amount(e) {
|
|
5929
|
-
return
|
|
5931
|
+
return qo(this.money(Math.abs(e)), e, this.money(0));
|
|
5930
5932
|
}
|
|
5931
5933
|
money(e) {
|
|
5932
5934
|
return (this.callbacks.formatAmount ?? this.callbacks.formatPrice)(e);
|
|
@@ -5939,20 +5941,20 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
|
|
|
5939
5941
|
}) : e === "lot" ? w(t, { lot: r ?? 1 }) : t;
|
|
5940
5942
|
}
|
|
5941
5943
|
};
|
|
5942
|
-
function
|
|
5944
|
+
function xs(e, t) {
|
|
5943
5945
|
return t.dataset.ticketField = e, t;
|
|
5944
5946
|
}
|
|
5945
|
-
function
|
|
5947
|
+
function Ss(e) {
|
|
5946
5948
|
let t = Math.abs(e);
|
|
5947
5949
|
return t > 0 ? 10 ** Math.floor(Math.log10(t / 100)) : 1;
|
|
5948
5950
|
}
|
|
5949
|
-
function
|
|
5951
|
+
function Cs(e, t) {
|
|
5950
5952
|
let n = Math.abs(t), r = n >= 10 || n === 0 ? 2 : n >= 1 ? 4 : Math.min(10, Math.ceil(-Math.log10(n)) + 3);
|
|
5951
5953
|
return Number(e.toFixed(r));
|
|
5952
5954
|
}
|
|
5953
5955
|
//#endregion
|
|
5954
5956
|
//#region src/widget/WidgetNamePrompt.ts
|
|
5955
|
-
var
|
|
5957
|
+
var ws = 0, Ts = class {
|
|
5956
5958
|
backdrop;
|
|
5957
5959
|
titleEl;
|
|
5958
5960
|
input;
|
|
@@ -5960,7 +5962,7 @@ var Ss = 0, Cs = class {
|
|
|
5960
5962
|
request = null;
|
|
5961
5963
|
returnFocus = null;
|
|
5962
5964
|
busy = !1;
|
|
5963
|
-
uid = ++
|
|
5965
|
+
uid = ++ws;
|
|
5964
5966
|
constructor(e, t = T) {
|
|
5965
5967
|
this.t = t, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
5966
5968
|
let n = !1;
|
|
@@ -6020,13 +6022,13 @@ var Ss = 0, Cs = class {
|
|
|
6020
6022
|
}
|
|
6021
6023
|
}
|
|
6022
6024
|
}
|
|
6023
|
-
},
|
|
6025
|
+
}, Es = 0, Ds = class {
|
|
6024
6026
|
el;
|
|
6025
6027
|
input;
|
|
6026
6028
|
hint;
|
|
6027
6029
|
returnFocus = null;
|
|
6028
6030
|
constructor(e, t, n) {
|
|
6029
|
-
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-${++
|
|
6031
|
+
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-${++Es}`, 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) => {
|
|
6030
6032
|
e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), this.apply()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close());
|
|
6031
6033
|
}), this.input.addEventListener("blur", () => this.close(!1));
|
|
6032
6034
|
}
|
|
@@ -6057,7 +6059,7 @@ var Ss = 0, Cs = class {
|
|
|
6057
6059
|
}
|
|
6058
6060
|
this.input.setAttribute("aria-invalid", "true"), this.hint.textContent = this.labels.invalid;
|
|
6059
6061
|
}
|
|
6060
|
-
},
|
|
6062
|
+
}, Os = class {
|
|
6061
6063
|
constructor(e = "tcw:indicator-templates") {
|
|
6062
6064
|
this.key = e;
|
|
6063
6065
|
}
|
|
@@ -6102,28 +6104,28 @@ var Ss = 0, Cs = class {
|
|
|
6102
6104
|
localStorage.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
|
|
6103
6105
|
} catch {}
|
|
6104
6106
|
}
|
|
6105
|
-
},
|
|
6107
|
+
}, ks = [
|
|
6106
6108
|
"regular",
|
|
6107
6109
|
"logarithmic",
|
|
6108
6110
|
"percentage",
|
|
6109
6111
|
"indexedTo100"
|
|
6110
|
-
],
|
|
6111
|
-
function
|
|
6112
|
+
], As = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
6113
|
+
function js(e) {
|
|
6112
6114
|
let { theme: t, timestamp: n, ...r } = e;
|
|
6113
6115
|
return r;
|
|
6114
6116
|
}
|
|
6115
|
-
function
|
|
6116
|
-
return !
|
|
6117
|
+
function Ms(e) {
|
|
6118
|
+
return !As(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(nt(e.timeframe) || D(e.timeframe) !== null) ? null : {
|
|
6117
6119
|
v: 1,
|
|
6118
6120
|
symbol: e.symbol,
|
|
6119
6121
|
timeframe: e.timeframe,
|
|
6120
|
-
scaleMode:
|
|
6122
|
+
scaleMode: ks.find((t) => t === e.scaleMode) ?? "regular",
|
|
6121
6123
|
invertScale: e.invertScale === !0,
|
|
6122
|
-
chart:
|
|
6123
|
-
...
|
|
6124
|
+
chart: As(e.chart) ? js(e.chart) : null,
|
|
6125
|
+
...As(e.settings) ? { settings: W(e.settings, Pa) } : {}
|
|
6124
6126
|
};
|
|
6125
6127
|
}
|
|
6126
|
-
function
|
|
6128
|
+
function Ns(e) {
|
|
6127
6129
|
try {
|
|
6128
6130
|
return JSON.parse(e);
|
|
6129
6131
|
} catch {
|
|
@@ -6132,16 +6134,16 @@ function js(e) {
|
|
|
6132
6134
|
}
|
|
6133
6135
|
//#endregion
|
|
6134
6136
|
//#region src/widget/DrawingFavoritesStore.ts
|
|
6135
|
-
function
|
|
6137
|
+
function Ps() {
|
|
6136
6138
|
try {
|
|
6137
6139
|
return typeof localStorage < "u" ? localStorage : null;
|
|
6138
6140
|
} catch {
|
|
6139
6141
|
return null;
|
|
6140
6142
|
}
|
|
6141
6143
|
}
|
|
6142
|
-
var
|
|
6144
|
+
var Fs = class {
|
|
6143
6145
|
favorites = [];
|
|
6144
|
-
constructor(e = "tcw:draw-favorites", t =
|
|
6146
|
+
constructor(e = "tcw:draw-favorites", t = Ps()) {
|
|
6145
6147
|
this.storageKey = e, this.storage = t, this.load();
|
|
6146
6148
|
}
|
|
6147
6149
|
list() {
|
|
@@ -6178,7 +6180,7 @@ var Ns = class {
|
|
|
6178
6180
|
};
|
|
6179
6181
|
//#endregion
|
|
6180
6182
|
//#region src/widget/keyboardInset.ts
|
|
6181
|
-
function
|
|
6183
|
+
function Is(e) {
|
|
6182
6184
|
let t = typeof window < "u" ? window.visualViewport : null;
|
|
6183
6185
|
if (!t) return () => {};
|
|
6184
6186
|
let n = -1, r = () => {
|
|
@@ -6192,7 +6194,7 @@ function Ps(e) {
|
|
|
6192
6194
|
t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
|
|
6193
6195
|
};
|
|
6194
6196
|
}
|
|
6195
|
-
function
|
|
6197
|
+
function Ls(e, t) {
|
|
6196
6198
|
let n = null, r = () => {
|
|
6197
6199
|
let r = e.clientWidth;
|
|
6198
6200
|
if (r === 0 && n !== null) return;
|
|
@@ -6216,7 +6218,7 @@ function J(e) {
|
|
|
6216
6218
|
}
|
|
6217
6219
|
};
|
|
6218
6220
|
}
|
|
6219
|
-
var
|
|
6221
|
+
var Rs = class {
|
|
6220
6222
|
part = null;
|
|
6221
6223
|
loading = null;
|
|
6222
6224
|
gone = !1;
|
|
@@ -6251,14 +6253,14 @@ var Is = class {
|
|
|
6251
6253
|
commandPalette: J(() => import("../WidgetCommandPalette-DpP-lG1A.js")),
|
|
6252
6254
|
symbolSearch: J(() => import("../WidgetSymbolSearch-Cxxq4SrK.js"))
|
|
6253
6255
|
};
|
|
6254
|
-
async function
|
|
6256
|
+
async function zs() {
|
|
6255
6257
|
await Promise.all(Object.values(Y).map((e) => e.load().catch(() => null)));
|
|
6256
6258
|
}
|
|
6257
6259
|
//#endregion
|
|
6258
6260
|
//#region src/widget/wallTime.ts
|
|
6259
|
-
var
|
|
6260
|
-
function
|
|
6261
|
-
let r =
|
|
6261
|
+
var Bs = /^(\d{4})-(\d{2})-(\d{2})$/, Vs = /^(\d{2}):(\d{2})$/;
|
|
6262
|
+
function Hs(e, t, n) {
|
|
6263
|
+
let r = Bs.exec(e), i = t ? Vs.exec(t) : [
|
|
6262
6264
|
"",
|
|
6263
6265
|
"00",
|
|
6264
6266
|
"00"
|
|
@@ -6288,7 +6290,7 @@ var Z = {
|
|
|
6288
6290
|
min: 233,
|
|
6289
6291
|
default: 262,
|
|
6290
6292
|
max: 377
|
|
6291
|
-
},
|
|
6293
|
+
}, Us = .382, Ws = (e) => !e.hidden && getComputedStyle(e).display !== "none", Gs = class {
|
|
6292
6294
|
element;
|
|
6293
6295
|
panel;
|
|
6294
6296
|
rail;
|
|
@@ -6335,7 +6337,7 @@ var Z = {
|
|
|
6335
6337
|
let t = this.panel.contains(document.activeElement);
|
|
6336
6338
|
if (this.hideCurrent(), this.panel.hidden = !0, t) {
|
|
6337
6339
|
let t = this.pages.get(e)?.button;
|
|
6338
|
-
(t && (this.options.railShown?.() ?? !0) &&
|
|
6340
|
+
(t && (this.options.railShown?.() ?? !0) && Ws(t) ? t : this.options.focusAfterClose?.(e))?.focus();
|
|
6339
6341
|
}
|
|
6340
6342
|
this.options.onChange?.(null);
|
|
6341
6343
|
}
|
|
@@ -6352,7 +6354,7 @@ var Z = {
|
|
|
6352
6354
|
return this.open_ === e;
|
|
6353
6355
|
}
|
|
6354
6356
|
syncRail() {
|
|
6355
|
-
let e = [...this.pages.values()].map((e) => e.button), t = e.filter(
|
|
6357
|
+
let e = [...this.pages.values()].map((e) => e.button), t = e.filter(Ws), n = e.find((e) => e.tabIndex === 0);
|
|
6356
6358
|
if (n && t.includes(n)) return;
|
|
6357
6359
|
let r = t.find((e) => e.getAttribute("aria-pressed") === "true") ?? t[0];
|
|
6358
6360
|
for (let t of e) t.tabIndex = t === r ? 0 : -1;
|
|
@@ -6376,7 +6378,7 @@ var Z = {
|
|
|
6376
6378
|
}
|
|
6377
6379
|
maxNow() {
|
|
6378
6380
|
let e = this.options.room?.() ?? 0, t = Math.round(Z.max * this.scale);
|
|
6379
|
-
return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e *
|
|
6381
|
+
return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e * Us)));
|
|
6380
6382
|
}
|
|
6381
6383
|
clamp(e, t = this.maxNow()) {
|
|
6382
6384
|
return Math.round(Math.min(t, Math.max(this.min(), e)));
|
|
@@ -6420,12 +6422,12 @@ var Z = {
|
|
|
6420
6422
|
for (let { button: t } of this.pages.values()) t.tabIndex = t === e ? 0 : -1;
|
|
6421
6423
|
}
|
|
6422
6424
|
onRailKey(e) {
|
|
6423
|
-
let t = [...this.pages.values()].map((e) => e.button).filter(
|
|
6425
|
+
let t = [...this.pages.values()].map((e) => e.button).filter(Ws), n = t.indexOf(e.target);
|
|
6424
6426
|
if (n < 0) return;
|
|
6425
6427
|
let r = e.key === "ArrowDown" ? (n + 1) % t.length : e.key === "ArrowUp" ? (n - 1 + t.length) % t.length : e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : -1;
|
|
6426
6428
|
r < 0 || (e.preventDefault(), t[r].focus());
|
|
6427
6429
|
}
|
|
6428
|
-
},
|
|
6430
|
+
}, Ks = [
|
|
6429
6431
|
"percent",
|
|
6430
6432
|
"scale",
|
|
6431
6433
|
"pane",
|
|
@@ -6433,7 +6435,7 @@ var Z = {
|
|
|
6433
6435
|
"ratio",
|
|
6434
6436
|
"correlation",
|
|
6435
6437
|
"correlationLog"
|
|
6436
|
-
],
|
|
6438
|
+
], qs = {
|
|
6437
6439
|
percent: "compare.percent",
|
|
6438
6440
|
scale: "compare.ownScale",
|
|
6439
6441
|
pane: "compare.ownPane",
|
|
@@ -6442,24 +6444,24 @@ var Z = {
|
|
|
6442
6444
|
correlation: "compare.way.correlation",
|
|
6443
6445
|
correlationLog: "compare.way.correlationLog"
|
|
6444
6446
|
};
|
|
6445
|
-
function
|
|
6446
|
-
return
|
|
6447
|
+
function Js(e) {
|
|
6448
|
+
return Ks.includes(e);
|
|
6447
6449
|
}
|
|
6448
|
-
function
|
|
6449
|
-
return
|
|
6450
|
+
function Ys(e) {
|
|
6451
|
+
return Ks.map((t) => ({
|
|
6450
6452
|
id: t,
|
|
6451
|
-
label: e(
|
|
6453
|
+
label: e(qs[t])
|
|
6452
6454
|
}));
|
|
6453
6455
|
}
|
|
6454
|
-
function
|
|
6456
|
+
function Xs(e, t) {
|
|
6455
6457
|
let n = e.findIndex((e) => e.time >= t);
|
|
6456
6458
|
return n < 0 ? e.length : n;
|
|
6457
6459
|
}
|
|
6458
|
-
function
|
|
6460
|
+
function Zs(e, t) {
|
|
6459
6461
|
let n = e[0]?.time ?? Infinity, r = t.filter((e) => e.time < n);
|
|
6460
6462
|
return r.length > 0 ? [...r, ...e] : null;
|
|
6461
6463
|
}
|
|
6462
|
-
function
|
|
6464
|
+
function Qs(e, t) {
|
|
6463
6465
|
switch (e.id) {
|
|
6464
6466
|
case "compareSymbol": return t ? "pane" : "scale";
|
|
6465
6467
|
case "compareSymbolPane": return "pane";
|
|
@@ -6469,24 +6471,24 @@ function Xs(e, t) {
|
|
|
6469
6471
|
default: return null;
|
|
6470
6472
|
}
|
|
6471
6473
|
}
|
|
6472
|
-
function
|
|
6474
|
+
function $s(e, t, n, r) {
|
|
6473
6475
|
let i = e.map((e) => ({
|
|
6474
6476
|
id: e.id,
|
|
6475
6477
|
symbol: e.symbol,
|
|
6476
|
-
way: r(
|
|
6478
|
+
way: r(qs.percent),
|
|
6477
6479
|
color: e.color
|
|
6478
6480
|
}));
|
|
6479
6481
|
for (let e of t) {
|
|
6480
|
-
let t = e.params.symbol, a =
|
|
6482
|
+
let t = e.params.symbol, a = Qs(e, n.has(e.instanceId));
|
|
6481
6483
|
!a || typeof t != "string" || !t || i.push({
|
|
6482
6484
|
id: e.instanceId,
|
|
6483
6485
|
symbol: t,
|
|
6484
|
-
way: r(
|
|
6486
|
+
way: r(qs[a])
|
|
6485
6487
|
});
|
|
6486
6488
|
}
|
|
6487
6489
|
return i;
|
|
6488
6490
|
}
|
|
6489
|
-
var Q = 8,
|
|
6491
|
+
var Q = 8, ec = 4, tc = 3, nc = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", rc = class {
|
|
6490
6492
|
el;
|
|
6491
6493
|
target = null;
|
|
6492
6494
|
source = null;
|
|
@@ -6497,9 +6499,9 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6497
6499
|
observer;
|
|
6498
6500
|
constructor(e) {
|
|
6499
6501
|
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(() => {
|
|
6500
|
-
this.pressed?.hasAttribute("title") &&
|
|
6502
|
+
this.pressed?.hasAttribute("title") && ic(this.pressed);
|
|
6501
6503
|
let e = this.target;
|
|
6502
|
-
!e || this.source !== "pointer" || !e.hasAttribute("title") || (
|
|
6504
|
+
!e || this.source !== "pointer" || !e.hasAttribute("title") || (ic(e), this.isVisible() && this.show(e));
|
|
6503
6505
|
}), this.observer.observe(e, {
|
|
6504
6506
|
subtree: !0,
|
|
6505
6507
|
attributes: !0,
|
|
@@ -6507,24 +6509,24 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6507
6509
|
});
|
|
6508
6510
|
}
|
|
6509
6511
|
destroy() {
|
|
6510
|
-
this.hide(), this.pressed &&
|
|
6512
|
+
this.hide(), this.pressed && ac(this.pressed), this.observer.disconnect(), this.root.removeEventListener("pointerover", this.onOver), this.root.removeEventListener("pointerout", this.onOut), this.root.removeEventListener("pointerdown", this.onPress, !0), this.root.removeEventListener("keydown", this.onPress, !0), this.root.removeEventListener("focusin", this.onFocus), this.root.removeEventListener("focusout", this.onBlur), this.root.removeEventListener("wheel", this.hide), this.el.remove();
|
|
6511
6513
|
}
|
|
6512
6514
|
onOver = (e) => {
|
|
6513
6515
|
if (e.pointerType === "touch") return;
|
|
6514
6516
|
let t = this.tipTarget(e.target);
|
|
6515
|
-
!t || t === this.pressed || t === this.target && this.source === "pointer" || (
|
|
6517
|
+
!t || t === this.pressed || t === this.target && this.source === "pointer" || (ic(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
|
|
6516
6518
|
};
|
|
6517
6519
|
onOut = (e) => {
|
|
6518
6520
|
let t = e.relatedTarget, n = (e) => !!e && !!t && e.contains(t);
|
|
6519
|
-
this.pressed && !n(this.pressed) && (
|
|
6521
|
+
this.pressed && !n(this.pressed) && (ac(this.pressed), this.pressed = null), this.source === "pointer" && !n(this.target) && this.hide();
|
|
6520
6522
|
};
|
|
6521
6523
|
onPress = () => {
|
|
6522
6524
|
let e = this.target, t = this.source === "pointer";
|
|
6523
|
-
this.warmUntil = 0, this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.el.classList.remove("tcw-tooltip--visible"), this.target = null, this.source = null, this.pressed && this.pressed !== e &&
|
|
6525
|
+
this.warmUntil = 0, this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.el.classList.remove("tcw-tooltip--visible"), this.target = null, this.source = null, this.pressed && this.pressed !== e && ac(this.pressed), this.pressed = t ? e : null;
|
|
6524
6526
|
};
|
|
6525
6527
|
onFocus = (e) => {
|
|
6526
6528
|
let t = this.tipTarget(e.target);
|
|
6527
|
-
!t || !
|
|
6529
|
+
!t || !cc(t) || t === this.pressed || this.schedule(t, "focus", !0);
|
|
6528
6530
|
};
|
|
6529
6531
|
onBlur = (e) => {
|
|
6530
6532
|
if (this.source !== "focus") return;
|
|
@@ -6532,16 +6534,16 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6532
6534
|
this.target && t && this.target.contains(t) || this.hide();
|
|
6533
6535
|
};
|
|
6534
6536
|
hide = () => {
|
|
6535
|
-
this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" &&
|
|
6537
|
+
this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" && ac(this.target), this.target = null, this.source = null;
|
|
6536
6538
|
};
|
|
6537
6539
|
tipTarget(e) {
|
|
6538
6540
|
if (!(e instanceof Element)) return null;
|
|
6539
|
-
let t = e.closest(
|
|
6541
|
+
let t = e.closest(nc);
|
|
6540
6542
|
return t && t !== this.el && this.root.contains(t) ? t : null;
|
|
6541
6543
|
}
|
|
6542
6544
|
schedule(e, t, n) {
|
|
6543
6545
|
let r = this.target;
|
|
6544
|
-
if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" &&
|
|
6546
|
+
if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" && ac(r), this.target = e, this.source = t, n) {
|
|
6545
6547
|
this.show(e);
|
|
6546
6548
|
return;
|
|
6547
6549
|
}
|
|
@@ -6550,27 +6552,27 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6550
6552
|
}, 300);
|
|
6551
6553
|
}
|
|
6552
6554
|
show(e) {
|
|
6553
|
-
if (!
|
|
6555
|
+
if (!sc(e)) {
|
|
6554
6556
|
this.hide();
|
|
6555
6557
|
return;
|
|
6556
6558
|
}
|
|
6557
|
-
this.el.textContent =
|
|
6559
|
+
this.el.textContent = oc(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
|
|
6558
6560
|
}
|
|
6559
6561
|
watch(e) {
|
|
6560
6562
|
cancelAnimationFrame(this.watchFrame), this.watchFrame = requestAnimationFrame(() => {
|
|
6561
|
-
this.target === e && (
|
|
6563
|
+
this.target === e && (sc(e) ? this.watch(e) : this.hide());
|
|
6562
6564
|
});
|
|
6563
6565
|
}
|
|
6564
6566
|
place(e) {
|
|
6565
|
-
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 =
|
|
6567
|
+
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 = lc(e);
|
|
6566
6568
|
s === "bottom" && o + n.height + Q + i > t.height ? s = "top" : s === "top" && o - Q - i < 0 ? s = "bottom" : s === "right" && a + n.width + Q + r > t.width && (s = "left");
|
|
6567
6569
|
let c, l;
|
|
6568
|
-
s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + Q : o - Q - i) : (c = s === "right" ? a + n.width + Q : a - Q - r, l = o + n.height / 2 - i / 2), c = Math.max(
|
|
6570
|
+
s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + Q : o - Q - i) : (c = s === "right" ? a + n.width + Q : a - Q - r, l = o + n.height / 2 - i / 2), c = Math.max(ec, Math.min(t.width - r - ec, c)), l = Math.max(ec, Math.min(t.height - i - ec, l)), this.el.style.left = `${Math.round(c)}px`, this.el.style.top = `${Math.round(l)}px`;
|
|
6569
6571
|
let u = {
|
|
6570
|
-
top: [0,
|
|
6571
|
-
bottom: [0,
|
|
6572
|
-
left: [
|
|
6573
|
-
right: [
|
|
6572
|
+
top: [0, tc],
|
|
6573
|
+
bottom: [0, -tc],
|
|
6574
|
+
left: [tc, 0],
|
|
6575
|
+
right: [-tc, 0]
|
|
6574
6576
|
}[s];
|
|
6575
6577
|
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;
|
|
6576
6578
|
}
|
|
@@ -6581,32 +6583,32 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6581
6583
|
this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
|
|
6582
6584
|
}
|
|
6583
6585
|
};
|
|
6584
|
-
function
|
|
6586
|
+
function ic(e) {
|
|
6585
6587
|
let t = e.getAttribute("title");
|
|
6586
6588
|
t !== null && (e.dataset.tip = t, e.removeAttribute("title"));
|
|
6587
6589
|
}
|
|
6588
|
-
function
|
|
6590
|
+
function ac(e) {
|
|
6589
6591
|
e.dataset.tip !== void 0 && !e.hasAttribute("title") && (e.setAttribute("title", e.dataset.tip), delete e.dataset.tip);
|
|
6590
6592
|
}
|
|
6591
|
-
function
|
|
6593
|
+
function oc(e) {
|
|
6592
6594
|
return e.dataset.tip ?? e.getAttribute("title") ?? "";
|
|
6593
6595
|
}
|
|
6594
|
-
function
|
|
6596
|
+
function sc(e) {
|
|
6595
6597
|
return e.isConnected && e.getClientRects().length > 0 && !e.disabled;
|
|
6596
6598
|
}
|
|
6597
|
-
function
|
|
6599
|
+
function cc(e) {
|
|
6598
6600
|
try {
|
|
6599
6601
|
return e.matches(":focus-visible");
|
|
6600
6602
|
} catch {
|
|
6601
6603
|
return !1;
|
|
6602
6604
|
}
|
|
6603
6605
|
}
|
|
6604
|
-
function
|
|
6606
|
+
function lc(e) {
|
|
6605
6607
|
return e.dataset.tipSide || (e.closest(".tcw-sidebar") ? "right" : e.closest(".tcw-statusbar, .tcw-replay-bar") ? "top" : "bottom");
|
|
6606
6608
|
}
|
|
6607
6609
|
//#endregion
|
|
6608
6610
|
//#region src/widget/WidgetIndicatorLegend.ts
|
|
6609
|
-
var
|
|
6611
|
+
var uc = 2, dc = 1.5, fc = "tcw-ind-legend-values--no-room", pc = 0, mc = class {
|
|
6610
6612
|
stack;
|
|
6611
6613
|
toggle;
|
|
6612
6614
|
rows = /* @__PURE__ */ new Map();
|
|
@@ -6620,7 +6622,7 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
|
|
|
6620
6622
|
this.host = e, this.callbacks = t, this.labels = n, this.stack = document.createElement("div"), this.stack.className = "tcw-ind-legend", y(this.stack, "indicatorLegend"), this.toggle = document.createElement("button"), this.toggle.type = "button", this.toggle.className = "tcw-ind-legend-toggle", this.toggle.addEventListener("click", () => {
|
|
6621
6623
|
this.setCollapsed(!this.collapsed), this.renderToggle(this.overlayCount());
|
|
6622
6624
|
}), this.stack.appendChild(this.toggle), e.appendChild(this.stack), this.stackObserver = typeof ResizeObserver > "u" || !t.onStackResize ? null : new ResizeObserver(() => this.reportStackSize()), this.stackObserver?.observe(this.stack), this.valuesObserver = typeof ResizeObserver > "u" ? null : new ResizeObserver((e) => {
|
|
6623
|
-
for (let t of e)
|
|
6625
|
+
for (let t of e) hc(t.target, t.contentRect.width);
|
|
6624
6626
|
});
|
|
6625
6627
|
}
|
|
6626
6628
|
update(e, t, n = []) {
|
|
@@ -6712,7 +6714,7 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
|
|
|
6712
6714
|
}, c = s("visible", "eye", () => {
|
|
6713
6715
|
this.callbacks.onToggleVisible(e, !m.visible, t);
|
|
6714
6716
|
}, "indicatorLegend.visibility"), l = n ? null : s("settings", "settings", () => this.callbacks.onSettings(e), "indicatorSettings", "indicatorLegend.settings"), u = this.callbacks.onMore && !n ? s("more", "more", () => this.callbacks.onMore?.(e, u), "indicatorLegend.more") : null, d = s("remove", "x", () => this.callbacks.onRemove(e, t), "indicatorLegend.remove"), f = document.createElement("span");
|
|
6715
|
-
f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++
|
|
6717
|
+
f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++pc}`;
|
|
6716
6718
|
let p = n ? document.createElement("span") : null;
|
|
6717
6719
|
p && (p.className = "tcw-ind-legend-swatch", p.setAttribute("aria-hidden", "true"), r.append(p)), r.append(i, a, o, f);
|
|
6718
6720
|
let m = {
|
|
@@ -6766,7 +6768,7 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
|
|
|
6766
6768
|
return this.stack.querySelectorAll(":scope > .tcw-ind-legend-row").length;
|
|
6767
6769
|
}
|
|
6768
6770
|
renderToggle(e) {
|
|
6769
|
-
let t = e >=
|
|
6771
|
+
let t = e >= uc;
|
|
6770
6772
|
!t && this.collapsed && this.setCollapsed(!1);
|
|
6771
6773
|
let n = `${t}|${this.collapsed}|${e}`;
|
|
6772
6774
|
if (n === this.toggleKey || (this.toggleKey = n, this.toggle.hidden = !t, !t)) return;
|
|
@@ -6776,19 +6778,19 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
|
|
|
6776
6778
|
this.toggle.innerHTML = this.collapsed ? `${i}<span>${e}</span>` : i;
|
|
6777
6779
|
}
|
|
6778
6780
|
};
|
|
6779
|
-
function
|
|
6780
|
-
let n = (parseFloat(getComputedStyle(e).fontSize) || 0) *
|
|
6781
|
-
e.classList.toggle(
|
|
6781
|
+
function hc(e, t) {
|
|
6782
|
+
let n = (parseFloat(getComputedStyle(e).fontSize) || 0) * dc;
|
|
6783
|
+
e.classList.toggle(fc, t < n);
|
|
6782
6784
|
}
|
|
6783
6785
|
function $(e, t, n) {
|
|
6784
6786
|
e.title = t, e.setAttribute("aria-label", n ? `${t} ${n}` : t);
|
|
6785
6787
|
}
|
|
6786
6788
|
//#endregion
|
|
6787
6789
|
//#region src/widget/legendValues.ts
|
|
6788
|
-
function
|
|
6790
|
+
function gc(e, t) {
|
|
6789
6791
|
return !e || e.length === 0 ? null : e[t === null ? e.length - 1 : Math.min(Math.max(t, 0), e.length - 1)] ?? null;
|
|
6790
6792
|
}
|
|
6791
|
-
function
|
|
6793
|
+
function _c(e, t, n, r) {
|
|
6792
6794
|
if (!t) return [];
|
|
6793
6795
|
let i = e.plots;
|
|
6794
6796
|
if (!i) {
|
|
@@ -6818,20 +6820,20 @@ function hc(e, t, n, r) {
|
|
|
6818
6820
|
}
|
|
6819
6821
|
return o;
|
|
6820
6822
|
}
|
|
6821
|
-
var
|
|
6822
|
-
function
|
|
6823
|
-
let t =
|
|
6823
|
+
var vc = /* @__PURE__ */ new Map();
|
|
6824
|
+
function yc(e) {
|
|
6825
|
+
let t = vc.get(e);
|
|
6824
6826
|
return t || (t = new Intl.NumberFormat(e, {
|
|
6825
6827
|
notation: "compact",
|
|
6826
6828
|
maximumFractionDigits: 2
|
|
6827
|
-
}),
|
|
6829
|
+
}), vc.set(e, t)), t;
|
|
6828
6830
|
}
|
|
6829
|
-
function
|
|
6830
|
-
return Math.abs(e) >= 1e6 ?
|
|
6831
|
+
function bc(e, t = "en-US") {
|
|
6832
|
+
return Math.abs(e) >= 1e6 ? yc(t).format(e) : $e(e, Mt(e), t);
|
|
6831
6833
|
}
|
|
6832
6834
|
//#endregion
|
|
6833
6835
|
//#region src/widget/WidgetBracketBar.ts
|
|
6834
|
-
var
|
|
6836
|
+
var xc = class {
|
|
6835
6837
|
el;
|
|
6836
6838
|
labelEl;
|
|
6837
6839
|
callbacks;
|
|
@@ -6859,7 +6861,7 @@ var yc = class {
|
|
|
6859
6861
|
destroy() {
|
|
6860
6862
|
this.el.remove();
|
|
6861
6863
|
}
|
|
6862
|
-
},
|
|
6864
|
+
}, Sc = class {
|
|
6863
6865
|
options;
|
|
6864
6866
|
audioCtx = null;
|
|
6865
6867
|
audioEl = null;
|
|
@@ -6922,7 +6924,7 @@ var yc = class {
|
|
|
6922
6924
|
};
|
|
6923
6925
|
//#endregion
|
|
6924
6926
|
//#region src/widget/ladderRows.ts
|
|
6925
|
-
function
|
|
6927
|
+
function Cc(e, t = 12) {
|
|
6926
6928
|
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) => {
|
|
6927
6929
|
let t = s.get(e);
|
|
6928
6930
|
return t || (t = {
|
|
@@ -6945,7 +6947,7 @@ function xc(e, t = 12) {
|
|
|
6945
6947
|
}
|
|
6946
6948
|
//#endregion
|
|
6947
6949
|
//#region src/widget/WidgetDepthLadder.ts
|
|
6948
|
-
var
|
|
6950
|
+
var wc = 1e-9, Tc = class {
|
|
6949
6951
|
el;
|
|
6950
6952
|
colsEl;
|
|
6951
6953
|
bodyEl;
|
|
@@ -6991,7 +6993,7 @@ var Sc = 1e-9, Cc = class {
|
|
|
6991
6993
|
this.open && (this.open = !1, this.el.hidden = !0, this.callbacks.onToggle?.(!1));
|
|
6992
6994
|
}
|
|
6993
6995
|
setData(e) {
|
|
6994
|
-
this.model = e ?
|
|
6996
|
+
this.model = e ? Cc(e, this.levels) : null, this.render();
|
|
6995
6997
|
}
|
|
6996
6998
|
setOrders(e) {
|
|
6997
6999
|
this.orders = e, this.render();
|
|
@@ -7007,7 +7009,7 @@ var Sc = 1e-9, Cc = class {
|
|
|
7007
7009
|
e.className = "tcw-ladder-empty", e.textContent = this.t("ladder.empty"), this.bodyEl.replaceChildren(e), this.drawn = [];
|
|
7008
7010
|
return;
|
|
7009
7011
|
}
|
|
7010
|
-
let t =
|
|
7012
|
+
let t = Ec(e.rows);
|
|
7011
7013
|
e.rows.length === this.drawn.length && e.rows.every((e, t) => e.price === this.drawn[t].price) || (this.drawn = e.rows.map((e) => this.newRow(e.price)), this.bodyEl.replaceChildren(...this.drawn.map((e) => e.row)));
|
|
7012
7014
|
let n = e.maxVolume > 0 ? 100 / e.maxVolume : 0;
|
|
7013
7015
|
e.rows.forEach((e, r) => this.fillRow(this.drawn[r], e, n, this.nearness(e.price, t))), this.putSpread(e, t), this.placeSpread();
|
|
@@ -7065,7 +7067,7 @@ var Sc = 1e-9, Cc = class {
|
|
|
7065
7067
|
return;
|
|
7066
7068
|
}
|
|
7067
7069
|
e.disabled = !1;
|
|
7068
|
-
let a =
|
|
7070
|
+
let a = Dc(n);
|
|
7069
7071
|
e.textContent = a, e.style.setProperty("--w", `${(n * i).toFixed(1)}%`);
|
|
7070
7072
|
let o = w(this.t(t === "sell" ? "ladder.sellAt" : "ladder.buyAt"), { price: this.callbacks.formatPrice(r) });
|
|
7071
7073
|
e.setAttribute("aria-label", `${a}, ${o}`), e.title = o;
|
|
@@ -7077,15 +7079,15 @@ var Sc = 1e-9, Cc = class {
|
|
|
7077
7079
|
e.scrollTop += r - n - (e.clientHeight - n - this.spreadEl.offsetHeight) / 2, this.placed = !0;
|
|
7078
7080
|
}
|
|
7079
7081
|
};
|
|
7080
|
-
function
|
|
7082
|
+
function Ec(e) {
|
|
7081
7083
|
let t = Infinity;
|
|
7082
7084
|
for (let n = 1; n < e.length; n++) t = Math.min(t, Math.abs(e[n - 1].price - e[n].price));
|
|
7083
|
-
return Number.isFinite(t) && t > 0 ? t / 2 :
|
|
7085
|
+
return Number.isFinite(t) && t > 0 ? t / 2 : wc;
|
|
7084
7086
|
}
|
|
7085
|
-
function
|
|
7087
|
+
function Dc(e) {
|
|
7086
7088
|
return e >= 1e3 ? `${Number((e / 1e3).toFixed(1))}k` : String(Number(e >= 1 ? e.toFixed(2) : e.toPrecision(2)));
|
|
7087
7089
|
}
|
|
7088
|
-
var
|
|
7090
|
+
var Oc = class {
|
|
7089
7091
|
el;
|
|
7090
7092
|
bodyEl;
|
|
7091
7093
|
callbacks;
|
|
@@ -7127,11 +7129,11 @@ var Ec = class {
|
|
|
7127
7129
|
let t = this.callbacks.formatPrice, n = e.ohlc;
|
|
7128
7130
|
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)));
|
|
7129
7131
|
let r = e.change > 0 ? "up" : e.change < 0 ? "down" : "", i = e.change > 0 ? "+" : "", a = this.callbacks.formatPercent?.(e.changePct) ?? e.changePct.toFixed(2), o = e.changeText ?? t(e.change);
|
|
7130
|
-
this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${o} (${i}${a}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), (this.callbacks.formatVolume ??
|
|
7132
|
+
this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${o} (${i}${a}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), (this.callbacks.formatVolume ?? Ac)(n.volume)));
|
|
7131
7133
|
for (let t of e.indicators) {
|
|
7132
7134
|
let e = document.createElement("div");
|
|
7133
7135
|
e.className = "tcw-datawin-sub", e.textContent = t.name, this.bodyEl.appendChild(e);
|
|
7134
|
-
for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ??
|
|
7136
|
+
for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ?? kc(e.value)));
|
|
7135
7137
|
}
|
|
7136
7138
|
}
|
|
7137
7139
|
row(e, t, n = "") {
|
|
@@ -7143,15 +7145,15 @@ var Ec = class {
|
|
|
7143
7145
|
return a.className = `tcw-datawin-value${n ? ` tcw-${n}` : ""}`, a.textContent = t, r.appendChild(i), r.appendChild(a), r;
|
|
7144
7146
|
}
|
|
7145
7147
|
};
|
|
7146
|
-
function
|
|
7148
|
+
function kc(e) {
|
|
7147
7149
|
if (!Number.isFinite(e)) return "—";
|
|
7148
7150
|
let t = Math.abs(e);
|
|
7149
7151
|
return t >= 1e3 ? e.toFixed(2) : t >= 1 ? e.toFixed(4) : e.toPrecision(4);
|
|
7150
7152
|
}
|
|
7151
|
-
function
|
|
7153
|
+
function Ac(e) {
|
|
7152
7154
|
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);
|
|
7153
7155
|
}
|
|
7154
|
-
var
|
|
7156
|
+
var jc = [
|
|
7155
7157
|
[
|
|
7156
7158
|
34,
|
|
7157
7159
|
16,
|
|
@@ -7208,7 +7210,7 @@ var kc = [
|
|
|
7208
7210
|
30,
|
|
7209
7211
|
!0
|
|
7210
7212
|
]
|
|
7211
|
-
],
|
|
7213
|
+
], Mc = class {
|
|
7212
7214
|
el;
|
|
7213
7215
|
label;
|
|
7214
7216
|
showTimer = null;
|
|
@@ -7216,7 +7218,7 @@ var kc = [
|
|
|
7216
7218
|
constructor(e, t) {
|
|
7217
7219
|
this.loadingText = t, this.el = document.createElement("div"), this.el.className = "tcw-loading-overlay", this.el.setAttribute("role", "status"), this.el.setAttribute("aria-live", "polite");
|
|
7218
7220
|
let n = document.createElement("div");
|
|
7219
|
-
n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"),
|
|
7221
|
+
n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"), jc.forEach(([e, t, r, i, a], o) => {
|
|
7220
7222
|
let s = document.createElement("span");
|
|
7221
7223
|
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", `${r}px`), s.style.setProperty("--tcw-wick-h", `${i}px`), s.style.setProperty("--tcw-delay", `${o * 110}ms`), n.appendChild(s);
|
|
7222
7224
|
}), this.el.appendChild(n), this.label = document.createElement("div"), this.label.className = "tcw-loading-label", this.label.textContent = t, this.el.appendChild(this.label), e.appendChild(this.el);
|
|
@@ -7251,7 +7253,7 @@ var kc = [
|
|
|
7251
7253
|
clearTimer() {
|
|
7252
7254
|
this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
|
|
7253
7255
|
}
|
|
7254
|
-
},
|
|
7256
|
+
}, Nc = 4e3, Pc = class {
|
|
7255
7257
|
el;
|
|
7256
7258
|
text;
|
|
7257
7259
|
hideTimer = null;
|
|
@@ -7261,7 +7263,7 @@ var kc = [
|
|
|
7261
7263
|
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);
|
|
7262
7264
|
}
|
|
7263
7265
|
update(e) {
|
|
7264
|
-
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(),
|
|
7266
|
+
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(), Nc)) : this.hide();
|
|
7265
7267
|
}
|
|
7266
7268
|
destroy() {
|
|
7267
7269
|
this.clearTimer(), this.el.remove();
|
|
@@ -7275,13 +7277,13 @@ var kc = [
|
|
|
7275
7277
|
clearTimer() {
|
|
7276
7278
|
this.hideTimer !== null && clearTimeout(this.hideTimer), this.hideTimer = null;
|
|
7277
7279
|
}
|
|
7278
|
-
},
|
|
7279
|
-
function
|
|
7280
|
+
}, Fc = "host:";
|
|
7281
|
+
function Ic(e, t) {
|
|
7280
7282
|
return [
|
|
7281
7283
|
...e,
|
|
7282
7284
|
...e.length > 0 && t.length > 0 ? ["separator"] : [],
|
|
7283
7285
|
...t.map((e, t) => ({
|
|
7284
|
-
id: `${
|
|
7286
|
+
id: `${Fc}${t}`,
|
|
7285
7287
|
label: e.label,
|
|
7286
7288
|
icon: e.icon,
|
|
7287
7289
|
danger: e.danger,
|
|
@@ -7289,12 +7291,12 @@ function Pc(e, t) {
|
|
|
7289
7291
|
}))
|
|
7290
7292
|
];
|
|
7291
7293
|
}
|
|
7292
|
-
function
|
|
7293
|
-
return e.startsWith(
|
|
7294
|
+
function Lc(e, t) {
|
|
7295
|
+
return e.startsWith(Fc) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
|
|
7294
7296
|
}
|
|
7295
7297
|
//#endregion
|
|
7296
7298
|
//#region src/widget/hostHotkeys.ts
|
|
7297
|
-
var
|
|
7299
|
+
var Rc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), zc = {
|
|
7298
7300
|
ctrl: "ctrl",
|
|
7299
7301
|
control: "ctrl",
|
|
7300
7302
|
cmd: "ctrl",
|
|
@@ -7305,7 +7307,7 @@ var Ic = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
|
|
|
7305
7307
|
option: "alt",
|
|
7306
7308
|
opt: "alt",
|
|
7307
7309
|
shift: "shift"
|
|
7308
|
-
},
|
|
7310
|
+
}, Bc = {
|
|
7309
7311
|
esc: "escape",
|
|
7310
7312
|
space: " ",
|
|
7311
7313
|
spacebar: " ",
|
|
@@ -7317,7 +7319,7 @@ var Ic = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
|
|
|
7317
7319
|
return: "enter",
|
|
7318
7320
|
plus: "+"
|
|
7319
7321
|
};
|
|
7320
|
-
function
|
|
7322
|
+
function Vc(e) {
|
|
7321
7323
|
let t = e.split("+").map((e) => e.trim()), n = t.pop();
|
|
7322
7324
|
if (!n) return null;
|
|
7323
7325
|
let r = {
|
|
@@ -7327,23 +7329,23 @@ function zc(e) {
|
|
|
7327
7329
|
display: []
|
|
7328
7330
|
};
|
|
7329
7331
|
for (let e of t) {
|
|
7330
|
-
let t =
|
|
7332
|
+
let t = zc[e.toLowerCase()];
|
|
7331
7333
|
if (!t) return null;
|
|
7332
7334
|
r[t] = !0;
|
|
7333
7335
|
}
|
|
7334
7336
|
let i = n.toLowerCase();
|
|
7335
|
-
if (
|
|
7337
|
+
if (zc[i]) return null;
|
|
7336
7338
|
if (/^[a-z]$/.test(i)) r.code = `Key${i.toUpperCase()}`, r.char = i;
|
|
7337
7339
|
else if (/^[0-9]$/.test(i)) r.code = `Digit${i}`, r.char = i;
|
|
7338
|
-
else if (r.key =
|
|
7340
|
+
else if (r.key = Bc[i] ?? i, r.shift && r.key.length === 1) return null;
|
|
7339
7341
|
return r.display = [
|
|
7340
|
-
...r.ctrl ? [
|
|
7342
|
+
...r.ctrl ? [Rc ? "⌘" : "Ctrl"] : [],
|
|
7341
7343
|
...r.alt ? ["Alt"] : [],
|
|
7342
7344
|
...r.shift ? ["Shift"] : [],
|
|
7343
7345
|
r.key === " " ? "Space" : n.length === 1 ? n.toUpperCase() : n
|
|
7344
7346
|
], r;
|
|
7345
7347
|
}
|
|
7346
|
-
function
|
|
7348
|
+
function Hc(e, t) {
|
|
7347
7349
|
if ((e.ctrlKey || e.metaKey) !== t.ctrl || e.altKey !== t.alt) return !1;
|
|
7348
7350
|
if (t.code !== void 0) {
|
|
7349
7351
|
if (e.shiftKey !== t.shift) return !1;
|
|
@@ -7353,25 +7355,25 @@ function Bc(e, t) {
|
|
|
7353
7355
|
}
|
|
7354
7356
|
return t.shift && !e.shiftKey ? !1 : e.key.toLowerCase() === t.key;
|
|
7355
7357
|
}
|
|
7356
|
-
var
|
|
7357
|
-
function
|
|
7358
|
+
var Uc = 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("("));
|
|
7359
|
+
function Wc(e) {
|
|
7358
7360
|
let t = `${e.ctrl ? "ctrl+" : ""}${e.alt ? "alt+" : ""}${e.shift ? "shift+" : ""}${e.char ?? e.key}`;
|
|
7359
|
-
return
|
|
7361
|
+
return Uc.has(t);
|
|
7360
7362
|
}
|
|
7361
|
-
function
|
|
7363
|
+
function Gc(e) {
|
|
7362
7364
|
let t = typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
|
|
7363
7365
|
return t instanceof HTMLElement ? t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) : !1;
|
|
7364
7366
|
}
|
|
7365
7367
|
//#endregion
|
|
7366
7368
|
//#region src/widget/WidgetCompares.ts
|
|
7367
|
-
var
|
|
7369
|
+
var Kc = [
|
|
7368
7370
|
"#b552c9",
|
|
7369
7371
|
"#1398a8",
|
|
7370
7372
|
"#d4622b",
|
|
7371
7373
|
"#e25592",
|
|
7372
7374
|
"#6f7a8c",
|
|
7373
7375
|
"#3e9a4f"
|
|
7374
|
-
],
|
|
7376
|
+
], qc = class {
|
|
7375
7377
|
constructor(e) {
|
|
7376
7378
|
this.host = e;
|
|
7377
7379
|
}
|
|
@@ -7393,11 +7395,11 @@ var Wc = [
|
|
|
7393
7395
|
symbols: this.host.symbolEntries(),
|
|
7394
7396
|
current: this.host.state.symbol,
|
|
7395
7397
|
search: this.host.symbolSearchFn(),
|
|
7396
|
-
ways:
|
|
7398
|
+
ways: Ys(this.host.t),
|
|
7397
7399
|
way: this.compareWay,
|
|
7398
7400
|
compared: this.comparedNow(),
|
|
7399
7401
|
onAdd: (e, t) => {
|
|
7400
|
-
|
|
7402
|
+
Js(t) && (this.compareWay = t, this.addCompareSymbol(e, t));
|
|
7401
7403
|
},
|
|
7402
7404
|
onRemove: (e) => this.removeCompared(e)
|
|
7403
7405
|
}));
|
|
@@ -7405,7 +7407,7 @@ var Wc = [
|
|
|
7405
7407
|
}
|
|
7406
7408
|
comparedNow() {
|
|
7407
7409
|
let e = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds));
|
|
7408
|
-
return
|
|
7410
|
+
return $s(this.compares, this.host.chart.getActiveIndicators(), e, this.host.t);
|
|
7409
7411
|
}
|
|
7410
7412
|
refreshCompareDialog() {
|
|
7411
7413
|
this.host.symbolSearch?.isComparing() && this.host.symbolSearch.setCompared(this.comparedNow());
|
|
@@ -7425,7 +7427,7 @@ var Wc = [
|
|
|
7425
7427
|
try {
|
|
7426
7428
|
let t = await this.fetchCompareBars(this.host.adapter, e);
|
|
7427
7429
|
if (!t || this.compares.some((t) => t.symbol === e)) return;
|
|
7428
|
-
let r = this.host.state.timeframe, i =
|
|
7430
|
+
let r = this.host.state.timeframe, i = Kc[this.compares.length % Kc.length];
|
|
7429
7431
|
this.compares.length === 0 && this.host.chart.setCompareMode("percent"), this.host.chart.addCompareSymbol(n, O(e), t, i), this.compares = [...this.compares, {
|
|
7430
7432
|
id: n,
|
|
7431
7433
|
symbol: e,
|
|
@@ -7553,7 +7555,7 @@ var Wc = [
|
|
|
7553
7555
|
}
|
|
7554
7556
|
let i = r.bars[0]?.time;
|
|
7555
7557
|
if (i === void 0 || r.atStart) continue;
|
|
7556
|
-
let a =
|
|
7558
|
+
let a = Xs(this.host.chart.getData(), i);
|
|
7557
7559
|
if (a !== 0) try {
|
|
7558
7560
|
if (e.fetchHistoryBefore) {
|
|
7559
7561
|
let o = await e.fetchHistoryBefore(r.symbol, n, i, a);
|
|
@@ -7576,7 +7578,7 @@ var Wc = [
|
|
|
7576
7578
|
prependCompareBars(e, t, n) {
|
|
7577
7579
|
let r = this.compares.find((t) => t.id === e);
|
|
7578
7580
|
if (!r) return;
|
|
7579
|
-
let i =
|
|
7581
|
+
let i = Zs(r.bars, t);
|
|
7580
7582
|
i ? this.setCompareBars(e, i, n) : this.compares = this.compares.map((t) => t.id === e ? {
|
|
7581
7583
|
...t,
|
|
7582
7584
|
atStart: !0
|
|
@@ -7597,7 +7599,7 @@ var Wc = [
|
|
|
7597
7599
|
failedAt: t
|
|
7598
7600
|
} : n);
|
|
7599
7601
|
}
|
|
7600
|
-
},
|
|
7602
|
+
}, Jc = class {
|
|
7601
7603
|
constructor(e) {
|
|
7602
7604
|
this.host = e;
|
|
7603
7605
|
}
|
|
@@ -7742,7 +7744,7 @@ var Wc = [
|
|
|
7742
7744
|
sparkline: r.slice()
|
|
7743
7745
|
});
|
|
7744
7746
|
}
|
|
7745
|
-
},
|
|
7747
|
+
}, Yc = class {
|
|
7746
7748
|
constructor(e) {
|
|
7747
7749
|
this.host = e;
|
|
7748
7750
|
}
|
|
@@ -7805,10 +7807,10 @@ var Wc = [
|
|
|
7805
7807
|
if (e === "price") return t.length > 0 ? this.host.chart.roundPrice(t[t.length - 1].close) : null;
|
|
7806
7808
|
let n = e.indexOf(":");
|
|
7807
7809
|
if (n < 0 || t.length === 0) return null;
|
|
7808
|
-
let r = e.slice(0, n), i = e.slice(n + 1), a =
|
|
7810
|
+
let r = e.slice(0, n), i = e.slice(n + 1), a = gc(this.host.chart.getIndicatorOutput(r)?.series, null)?.[i];
|
|
7809
7811
|
return typeof a == "number" && Number.isFinite(a) ? a : null;
|
|
7810
7812
|
}
|
|
7811
|
-
},
|
|
7813
|
+
}, Xc = class {
|
|
7812
7814
|
constructor(e) {
|
|
7813
7815
|
this.host = e;
|
|
7814
7816
|
}
|
|
@@ -7885,7 +7887,7 @@ var Wc = [
|
|
|
7885
7887
|
};
|
|
7886
7888
|
//#endregion
|
|
7887
7889
|
//#region src/widget/drawingMenu.ts
|
|
7888
|
-
function
|
|
7890
|
+
function Zc(e, t) {
|
|
7889
7891
|
let { selected: n } = e, r = n.length === 1, i = new Set(n.map((e) => e.groupId)), a = i.size === 1 && !i.has(null), o = [];
|
|
7890
7892
|
e.canConfigure && r && o.push({
|
|
7891
7893
|
id: "settings",
|
|
@@ -7942,7 +7944,7 @@ function Yc(e, t) {
|
|
|
7942
7944
|
}
|
|
7943
7945
|
//#endregion
|
|
7944
7946
|
//#region src/widget/WidgetMenus.ts
|
|
7945
|
-
var
|
|
7947
|
+
var Qc = class {
|
|
7946
7948
|
constructor(e) {
|
|
7947
7949
|
this.host = e;
|
|
7948
7950
|
}
|
|
@@ -7961,7 +7963,7 @@ var Xc = class {
|
|
|
7961
7963
|
}] : [];
|
|
7962
7964
|
});
|
|
7963
7965
|
if (i.length === 0) return;
|
|
7964
|
-
let a = ce(
|
|
7966
|
+
let a = ce(Zc({
|
|
7965
7967
|
selected: i,
|
|
7966
7968
|
canConfigure: !0,
|
|
7967
7969
|
canAlert: this.host.chart.canAddDrawingAlert(e)
|
|
@@ -7969,11 +7971,11 @@ var Xc = class {
|
|
|
7969
7971
|
id: e,
|
|
7970
7972
|
type: s.type,
|
|
7971
7973
|
selected: o
|
|
7972
|
-
}) ?? [] : [], l =
|
|
7974
|
+
}) ?? [] : [], l = Ic(a, c);
|
|
7973
7975
|
if (l.length === 0) return;
|
|
7974
7976
|
let u = this.host.chartContainer.getBoundingClientRect(), d = this.host.root.getBoundingClientRect();
|
|
7975
7977
|
this.drawingMenu.open(l, u.left - d.left + t, u.top - d.top + n, (t) => {
|
|
7976
|
-
|
|
7978
|
+
Lc(t, c) || this.runDrawingMenuAction(e, o, t);
|
|
7977
7979
|
});
|
|
7978
7980
|
}
|
|
7979
7981
|
runDrawingMenuAction(e, t, n) {
|
|
@@ -8050,7 +8052,7 @@ var Xc = class {
|
|
|
8050
8052
|
current: r.timezone,
|
|
8051
8053
|
options: this.timezoneChoices()
|
|
8052
8054
|
},
|
|
8053
|
-
keys: Object.fromEntries(
|
|
8055
|
+
keys: Object.fromEntries(Fo.filter((e) => this.host.featureState.hotkeys && this.host.featureState[e.feature]).map((e) => [e.action, e.keys]))
|
|
8054
8056
|
};
|
|
8055
8057
|
}
|
|
8056
8058
|
removableIndicators() {
|
|
@@ -8071,15 +8073,15 @@ var Xc = class {
|
|
|
8071
8073
|
}
|
|
8072
8074
|
openChartMenu(e, t, n, r) {
|
|
8073
8075
|
if (!this.chartMenu) return;
|
|
8074
|
-
let i = this.host.options.chartMenuItems?.(r) ?? [], a =
|
|
8076
|
+
let i = this.host.options.chartMenuItems?.(r) ?? [], a = Ic(e, i);
|
|
8075
8077
|
if (a.length === 0) return;
|
|
8076
8078
|
let o = this.host.chartContainer.getBoundingClientRect(), s = this.host.root.getBoundingClientRect();
|
|
8077
8079
|
this.chartMenu.open(a, o.left - s.left + t, o.top - s.top + n, (e) => {
|
|
8078
|
-
|
|
8080
|
+
Lc(e, i) || (e.startsWith("tz:") ? this.host.changeSettings({ timezone: e.slice(3) }) : this.runChartMenuAction(e, r));
|
|
8079
8081
|
});
|
|
8080
8082
|
}
|
|
8081
8083
|
runChartMenuAction(e, t) {
|
|
8082
|
-
let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a =
|
|
8084
|
+
let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a = Io(e);
|
|
8083
8085
|
if (a) {
|
|
8084
8086
|
this.host.changeSettings({ scaleMode: a });
|
|
8085
8087
|
return;
|
|
@@ -8200,46 +8202,46 @@ var Xc = class {
|
|
|
8200
8202
|
activeTool: null
|
|
8201
8203
|
}, this.host.updateUI(), this.host.refreshDrawingsState(), this.host.refreshObjects();
|
|
8202
8204
|
}
|
|
8203
|
-
},
|
|
8204
|
-
function
|
|
8205
|
-
return $e(e, Math.max(
|
|
8205
|
+
}, $c = 2, el = 2;
|
|
8206
|
+
function tl(e, t = "en-US") {
|
|
8207
|
+
return $e(e, Math.max($c, Mt(e)), t);
|
|
8206
8208
|
}
|
|
8207
|
-
function
|
|
8208
|
-
return `${
|
|
8209
|
+
function nl(e, t = "en-US") {
|
|
8210
|
+
return `${qo($e(Math.abs(e), el, t), e, $e(0, el, t))}%`;
|
|
8209
8211
|
}
|
|
8210
|
-
function
|
|
8212
|
+
function rl(e, t = "en-US", n = !0) {
|
|
8211
8213
|
return e.map((e) => ({
|
|
8212
8214
|
instanceId: e.id,
|
|
8213
8215
|
kind: "compare",
|
|
8214
8216
|
label: e.label,
|
|
8215
8217
|
swatch: e.color,
|
|
8216
8218
|
visible: e.visible,
|
|
8217
|
-
...n ? { values:
|
|
8219
|
+
...n ? { values: il(e, t) } : {
|
|
8218
8220
|
values: [],
|
|
8219
8221
|
offChartType: !0
|
|
8220
8222
|
},
|
|
8221
8223
|
pane: null
|
|
8222
8224
|
}));
|
|
8223
8225
|
}
|
|
8224
|
-
function
|
|
8226
|
+
function il(e, t) {
|
|
8225
8227
|
return [...e.close === null ? [] : [{
|
|
8226
|
-
text:
|
|
8228
|
+
text: tl(e.close, t),
|
|
8227
8229
|
color: null
|
|
8228
8230
|
}], ...e.change === null ? [] : [{
|
|
8229
|
-
text:
|
|
8231
|
+
text: nl(e.change, t),
|
|
8230
8232
|
color: null
|
|
8231
8233
|
}]];
|
|
8232
8234
|
}
|
|
8233
8235
|
//#endregion
|
|
8234
8236
|
//#region src/widget/WidgetLegendView.ts
|
|
8235
|
-
var
|
|
8236
|
-
function
|
|
8237
|
-
return Ge[e.getDensity?.() ?? "comfortable"].legendInset -
|
|
8237
|
+
var al = 7, ol = 17, sl = 3, cl = 4;
|
|
8238
|
+
function ll(e) {
|
|
8239
|
+
return Ge[e.getDensity?.() ?? "comfortable"].legendInset - cl;
|
|
8238
8240
|
}
|
|
8239
|
-
function
|
|
8241
|
+
function ul(e) {
|
|
8240
8242
|
return !kt.has(e.id) && e.scale !== "left";
|
|
8241
8243
|
}
|
|
8242
|
-
var
|
|
8244
|
+
var dl = class {
|
|
8243
8245
|
constructor(e) {
|
|
8244
8246
|
this.host = e;
|
|
8245
8247
|
}
|
|
@@ -8252,13 +8254,13 @@ var ll = class {
|
|
|
8252
8254
|
}
|
|
8253
8255
|
renderLegend() {
|
|
8254
8256
|
if (!this.host.indicatorLegend || this.host.destroyed) return;
|
|
8255
|
-
let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r =
|
|
8257
|
+
let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r = ll(this.host.chart), i = n === null ? e : Math.min(Math.max(n, 0), e), a = /* @__PURE__ */ new Map();
|
|
8256
8258
|
for (let e of this.host.chart.getIndicatorPanes()) (e.instanceIds ?? [e.instanceId]).forEach((t, n) => a.set(t, {
|
|
8257
8259
|
...e.rect,
|
|
8258
8260
|
row: n
|
|
8259
8261
|
}));
|
|
8260
|
-
let o = this.host.settingsState.numberLocale || "en-US", s =
|
|
8261
|
-
let t = a.get(e.instanceId) ?? null, i =
|
|
8262
|
+
let o = this.host.settingsState.numberLocale || "en-US", s = rl(i >= 0 ? this.host.chart.getCompareValues?.(n === null || !t ? void 0 : i) ?? [] : [], o, t), c = this.host.chart.getActiveIndicators().map((e) => {
|
|
8263
|
+
let t = a.get(e.instanceId) ?? null, i = gc(this.host.chart.getIndicatorOutput(e.instanceId, { drawn: !0 })?.series, n), s = this.host.chart.getIndicatorStyle(e.instanceId), c = e.visible && e.offChartType === !0, l = e.visible && e.shown === !1 && !c, u = l || c ? [] : _c(e.descriptor, i, s?.colors ?? [], s?.plots);
|
|
8262
8264
|
return {
|
|
8263
8265
|
instanceId: e.instanceId,
|
|
8264
8266
|
label: Ue(e, this.host.t),
|
|
@@ -8266,19 +8268,19 @@ var ll = class {
|
|
|
8266
8268
|
offInterval: l,
|
|
8267
8269
|
offChartType: c,
|
|
8268
8270
|
values: u.map((n) => ({
|
|
8269
|
-
text: this.host.indicatorValueText(n.value, t === null &&
|
|
8271
|
+
text: this.host.indicatorValueText(n.value, t === null && ul(e), o),
|
|
8270
8272
|
color: n.color
|
|
8271
8273
|
})),
|
|
8272
8274
|
pane: t ? {
|
|
8273
8275
|
x: t.x + r,
|
|
8274
|
-
y: t.y + Math.min(
|
|
8276
|
+
y: t.y + Math.min(al + t.row * ol, Math.max(al, t.height - ol)),
|
|
8275
8277
|
width: t.width - 2 * r
|
|
8276
8278
|
} : null
|
|
8277
8279
|
};
|
|
8278
8280
|
}), l = [...s, ...c], u = this.host.chart.getPlotRect(), d = this.host.chart.getMaximizedPane(), f = (e) => l.find((t) => t.instanceId === e)?.label ?? "", p = this.host.chart.getIndicatorPanes().map((e) => ({
|
|
8279
8281
|
instanceId: e.instanceId,
|
|
8280
8282
|
x: e.rect.x + e.rect.width - r,
|
|
8281
|
-
y: e.rect.y +
|
|
8283
|
+
y: e.rect.y + sl,
|
|
8282
8284
|
label: f(e.instanceId),
|
|
8283
8285
|
collapsed: this.host.chart.isPaneCollapsed(e.instanceId),
|
|
8284
8286
|
maximized: d === e.instanceId,
|
|
@@ -8332,14 +8334,14 @@ var ll = class {
|
|
|
8332
8334
|
let u = this.host.chart.getActiveIndicators().find((t) => t.instanceId === e)?.id ?? "", d = this.host.options.indicatorMenuItems?.({
|
|
8333
8335
|
instanceId: e,
|
|
8334
8336
|
indicatorId: u
|
|
8335
|
-
}) ?? [], f =
|
|
8337
|
+
}) ?? [], f = Ic(c, d);
|
|
8336
8338
|
if (f.length === 0) return;
|
|
8337
8339
|
let p = t.getBoundingClientRect(), m = this.host.root.getBoundingClientRect();
|
|
8338
8340
|
n.open(f, p.left - m.left, p.bottom - m.top + 2, (t) => {
|
|
8339
|
-
|
|
8341
|
+
Lc(t, d) || (t === "settings" ? this.host.openIndicatorSettings(e) : t === "remove" ? this.host.handleRemoveIndicator(e) : t.startsWith("move:") && this.host.chart.moveIndicatorToPane(e, t.slice(5)), this.scheduleLegend());
|
|
8340
8342
|
}, t);
|
|
8341
8343
|
}
|
|
8342
|
-
},
|
|
8344
|
+
}, fl = class {
|
|
8343
8345
|
constructor(e) {
|
|
8344
8346
|
this.host = e;
|
|
8345
8347
|
}
|
|
@@ -8544,7 +8546,7 @@ var ll = class {
|
|
|
8544
8546
|
break;
|
|
8545
8547
|
}
|
|
8546
8548
|
}
|
|
8547
|
-
},
|
|
8549
|
+
}, pl = 0, ml = class {
|
|
8548
8550
|
backdrop;
|
|
8549
8551
|
search;
|
|
8550
8552
|
listEl;
|
|
@@ -8552,7 +8554,7 @@ var ll = class {
|
|
|
8552
8554
|
confirming = null;
|
|
8553
8555
|
returnFocus = null;
|
|
8554
8556
|
loadSeq = 0;
|
|
8555
|
-
uid = ++
|
|
8557
|
+
uid = ++pl;
|
|
8556
8558
|
constructor(e, t, n = T) {
|
|
8557
8559
|
this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
8558
8560
|
let r = !1;
|
|
@@ -8658,7 +8660,7 @@ var ll = class {
|
|
|
8658
8660
|
this.confirming = null, await this.refresh(), this.isOpen() && this.search.focus();
|
|
8659
8661
|
}
|
|
8660
8662
|
}
|
|
8661
|
-
},
|
|
8663
|
+
}, hl = 5, gl = class {
|
|
8662
8664
|
menu;
|
|
8663
8665
|
prompt;
|
|
8664
8666
|
dialog;
|
|
@@ -8666,7 +8668,7 @@ var ll = class {
|
|
|
8666
8668
|
constructor(e, t) {
|
|
8667
8669
|
this.session = e, this.host = t;
|
|
8668
8670
|
let { root: n, t: r } = t;
|
|
8669
|
-
this.menu = new C(n, r("toolbar.layouts")), this.prompt = new
|
|
8671
|
+
this.menu = new C(n, r("toolbar.layouts")), this.prompt = new Ts(n, r), this.dialog = new ml(n, {
|
|
8670
8672
|
list: () => e.list(),
|
|
8671
8673
|
currentId: () => e.current()?.id ?? null,
|
|
8672
8674
|
onOpen: (e) => void this.open(e),
|
|
@@ -8744,7 +8746,7 @@ var ll = class {
|
|
|
8744
8746
|
}
|
|
8745
8747
|
let { session: t } = this, { t: n } = this.host, r = [];
|
|
8746
8748
|
try {
|
|
8747
|
-
r = (await t.list()).slice(0,
|
|
8749
|
+
r = (await t.list()).slice(0, hl);
|
|
8748
8750
|
} catch {}
|
|
8749
8751
|
if (this.destroyed) return;
|
|
8750
8752
|
let i = t.current(), a = [{
|
|
@@ -8780,53 +8782,53 @@ var ll = class {
|
|
|
8780
8782
|
destroy() {
|
|
8781
8783
|
this.destroyed = !0, this.menu.destroy(), this.prompt.destroy(), this.dialog.destroy();
|
|
8782
8784
|
}
|
|
8783
|
-
},
|
|
8784
|
-
function
|
|
8785
|
-
if (
|
|
8785
|
+
}, _l = (e) => typeof e == "object" && !!e && !Array.isArray(e), vl = globalThis.Buffer;
|
|
8786
|
+
function yl(e) {
|
|
8787
|
+
if (vl) return vl.from(e, "utf8").toString("base64");
|
|
8786
8788
|
let t = new TextEncoder().encode(e), n = "";
|
|
8787
8789
|
for (let e of t) n += String.fromCharCode(e);
|
|
8788
8790
|
return btoa(n);
|
|
8789
8791
|
}
|
|
8790
|
-
function
|
|
8791
|
-
if (
|
|
8792
|
+
function bl(e) {
|
|
8793
|
+
if (vl) return vl.from(e, "base64").toString("utf8");
|
|
8792
8794
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
8793
8795
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
8794
8796
|
return new TextDecoder().decode(n);
|
|
8795
8797
|
}
|
|
8796
|
-
function
|
|
8798
|
+
function xl(e) {
|
|
8797
8799
|
return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
8798
8800
|
}
|
|
8799
|
-
function
|
|
8801
|
+
function Sl(e) {
|
|
8800
8802
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
8801
8803
|
return t + (t.length % 4 == 0 ? "" : "=".repeat(4 - t.length % 4));
|
|
8802
8804
|
}
|
|
8803
|
-
function
|
|
8804
|
-
return yl(
|
|
8805
|
+
function Cl(e) {
|
|
8806
|
+
return xl(yl(JSON.stringify(e)));
|
|
8805
8807
|
}
|
|
8806
|
-
function
|
|
8808
|
+
function wl(e) {
|
|
8807
8809
|
if (!e) return null;
|
|
8808
8810
|
try {
|
|
8809
|
-
let t =
|
|
8811
|
+
let t = bl(Sl(e)), n = JSON.parse(t);
|
|
8810
8812
|
return !n || n.v !== 1 || typeof n.symbol != "string" ? null : {
|
|
8811
8813
|
v: 1,
|
|
8812
8814
|
symbol: n.symbol,
|
|
8813
8815
|
timeframe: n.timeframe,
|
|
8814
8816
|
chartType: n.chartType,
|
|
8815
|
-
scaleMode:
|
|
8817
|
+
scaleMode: ks.find((e) => e === n.scaleMode) ?? "regular",
|
|
8816
8818
|
indicators: Array.isArray(n.indicators) ? n.indicators : [],
|
|
8817
8819
|
drawings: Array.isArray(n.drawings) ? n.drawings : [],
|
|
8818
|
-
...
|
|
8820
|
+
..._l(n.settings) ? { settings: W(n.settings, Fa) } : {}
|
|
8819
8821
|
};
|
|
8820
8822
|
} catch {
|
|
8821
8823
|
return null;
|
|
8822
8824
|
}
|
|
8823
8825
|
}
|
|
8824
|
-
var
|
|
8825
|
-
function
|
|
8826
|
+
var Tl = "tcw";
|
|
8827
|
+
function El(e) {
|
|
8826
8828
|
let t = e.startsWith("#") ? e.slice(1) : e;
|
|
8827
8829
|
for (let e of t.split("&")) {
|
|
8828
8830
|
let t = e.indexOf("=");
|
|
8829
|
-
if (!(t <= 0 || e.slice(0, t) !==
|
|
8831
|
+
if (!(t <= 0 || e.slice(0, t) !== Tl)) try {
|
|
8830
8832
|
return decodeURIComponent(e.slice(t + 1));
|
|
8831
8833
|
} catch {
|
|
8832
8834
|
return null;
|
|
@@ -8834,19 +8836,19 @@ function wl(e) {
|
|
|
8834
8836
|
}
|
|
8835
8837
|
return null;
|
|
8836
8838
|
}
|
|
8837
|
-
function
|
|
8839
|
+
function Dl(e, t) {
|
|
8838
8840
|
let [n] = e.split("#");
|
|
8839
|
-
return `${n}#${
|
|
8841
|
+
return `${n}#${Tl}=${t}`;
|
|
8840
8842
|
}
|
|
8841
8843
|
//#endregion
|
|
8842
8844
|
//#region src/widget/WidgetLayouts.ts
|
|
8843
|
-
var
|
|
8845
|
+
var Ol = [
|
|
8844
8846
|
"legendVisible",
|
|
8845
8847
|
"volumeVisible",
|
|
8846
8848
|
"barCountdown",
|
|
8847
8849
|
"indicatorValueLabels",
|
|
8848
8850
|
"alignAxisLabels"
|
|
8849
|
-
],
|
|
8851
|
+
], kl = class {
|
|
8850
8852
|
constructor(e) {
|
|
8851
8853
|
this.host = e;
|
|
8852
8854
|
}
|
|
@@ -8857,7 +8859,7 @@ var El = [
|
|
|
8857
8859
|
activeLayoutKey = null;
|
|
8858
8860
|
restoreSharedView() {
|
|
8859
8861
|
if (!this.host.options.shareUrl || typeof location > "u") return;
|
|
8860
|
-
let e =
|
|
8862
|
+
let e = El(location.hash);
|
|
8861
8863
|
e && this.importState(e);
|
|
8862
8864
|
}
|
|
8863
8865
|
exportState() {
|
|
@@ -8866,9 +8868,9 @@ var El = [
|
|
|
8866
8868
|
params: e.params
|
|
8867
8869
|
})), t = this.host.getSettings(), n = Ya(t, {
|
|
8868
8870
|
..._,
|
|
8869
|
-
...Object.fromEntries(
|
|
8871
|
+
...Object.fromEntries(Ol.map((e) => [e, this.host.settingsDefaults[e]]))
|
|
8870
8872
|
});
|
|
8871
|
-
return
|
|
8873
|
+
return Cl({
|
|
8872
8874
|
v: 1,
|
|
8873
8875
|
symbol: this.host.state.symbol,
|
|
8874
8876
|
timeframe: this.host.state.timeframe,
|
|
@@ -8880,7 +8882,7 @@ var El = [
|
|
|
8880
8882
|
});
|
|
8881
8883
|
}
|
|
8882
8884
|
async importState(e) {
|
|
8883
|
-
let t =
|
|
8885
|
+
let t = wl(e);
|
|
8884
8886
|
if (!t) return !1;
|
|
8885
8887
|
t.symbol && t.symbol !== this.host.state.symbol && await this.host.setSymbol(t.symbol), t.timeframe && t.timeframe !== this.host.state.timeframe && await this.host.setTimeframe(t.timeframe), t.chartType && this.host.applyChartType(t.chartType);
|
|
8886
8888
|
let { chartTypeOptions: n, ...r } = this.host.allowedSettings({
|
|
@@ -8897,7 +8899,7 @@ var El = [
|
|
|
8897
8899
|
}))), this.host.chart.setDrawings(t.drawings), this.host.updateUI(), !0;
|
|
8898
8900
|
}
|
|
8899
8901
|
async copyShareLink() {
|
|
8900
|
-
let e =
|
|
8902
|
+
let e = Dl(typeof location < "u" ? location.href : "", this.exportState());
|
|
8901
8903
|
try {
|
|
8902
8904
|
await navigator.clipboard.writeText(e), this.host.say(this.host.t("toast.linkCopied"));
|
|
8903
8905
|
} catch {
|
|
@@ -8908,7 +8910,7 @@ var El = [
|
|
|
8908
8910
|
return this.layoutSession;
|
|
8909
8911
|
}
|
|
8910
8912
|
captureLayout() {
|
|
8911
|
-
let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ?
|
|
8913
|
+
let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ? Ns(t) : null, r = n && typeof n == "object" ? js(n) : null;
|
|
8912
8914
|
return {
|
|
8913
8915
|
v: 1,
|
|
8914
8916
|
symbol: this.host.state.symbol,
|
|
@@ -8922,7 +8924,7 @@ var El = [
|
|
|
8922
8924
|
async restoreLayout(e) {
|
|
8923
8925
|
if (e.symbol !== this.host.state.symbol && await this.host.setSymbol(e.symbol), e.timeframe !== this.host.state.timeframe && await this.host.setTimeframe(e.timeframe), this.host.destroyed) return;
|
|
8924
8926
|
if (e.chart) {
|
|
8925
|
-
this.host.chart.loadState(JSON.stringify(
|
|
8927
|
+
this.host.chart.loadState(JSON.stringify(js(e.chart)));
|
|
8926
8928
|
let t = e.chart.chartType;
|
|
8927
8929
|
typeof t == "string" && (this.host.state = {
|
|
8928
8930
|
...this.host.state,
|
|
@@ -8940,7 +8942,7 @@ var El = [
|
|
|
8940
8942
|
return JSON.stringify(this.captureLayout());
|
|
8941
8943
|
}
|
|
8942
8944
|
async applyLayoutContent(e) {
|
|
8943
|
-
let t =
|
|
8945
|
+
let t = Ms(Ns(e));
|
|
8944
8946
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
8945
8947
|
}
|
|
8946
8948
|
setupLayouts(e) {
|
|
@@ -8959,7 +8961,7 @@ var El = [
|
|
|
8959
8961
|
onChange: () => this.host.toolbar?.setLayout(t.current()?.name ?? null, t.isDirty()),
|
|
8960
8962
|
onError: () => this.host.say(this.host.t("layouts.saveFailed"), "error")
|
|
8961
8963
|
});
|
|
8962
|
-
this.layoutSession = t, this.layoutsUI = new
|
|
8964
|
+
this.layoutSession = t, this.layoutsUI = new gl(t, {
|
|
8963
8965
|
root: this.host.root,
|
|
8964
8966
|
t: this.host.t,
|
|
8965
8967
|
saveKeys: () => this.host.keysShown("hotkeys.save", `${We}+S`),
|
|
@@ -9000,19 +9002,19 @@ var El = [
|
|
|
9000
9002
|
this.host.chart.disableAutoSave(), this.activeLayoutKey = null;
|
|
9001
9003
|
}
|
|
9002
9004
|
}
|
|
9003
|
-
},
|
|
9005
|
+
}, Al = {
|
|
9004
9006
|
alerts: "alerts",
|
|
9005
9007
|
objectTree: "objectTree",
|
|
9006
9008
|
dataWindow: "dataWindow",
|
|
9007
9009
|
symbolInfo: "symbolInfo",
|
|
9008
9010
|
depthLadder: "depthLadder"
|
|
9009
|
-
},
|
|
9011
|
+
}, jl = {
|
|
9010
9012
|
watchlist: "watchlist",
|
|
9011
9013
|
alerts: "alerts",
|
|
9012
9014
|
objectTree: "objects",
|
|
9013
9015
|
symbolInfo: "symbolInfo",
|
|
9014
9016
|
depthLadder: "trade"
|
|
9015
|
-
},
|
|
9017
|
+
}, Ml = class {
|
|
9016
9018
|
dataWindowFrame = 0;
|
|
9017
9019
|
constructor(e) {
|
|
9018
9020
|
this.host = e;
|
|
@@ -9029,7 +9031,7 @@ var El = [
|
|
|
9029
9031
|
return !this.hasPanel(e) || !this.dock ? !1 : (this.dock.open(e), this.dock.current() === e);
|
|
9030
9032
|
}
|
|
9031
9033
|
hasPanel(e) {
|
|
9032
|
-
return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[
|
|
9034
|
+
return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[Al[e]];
|
|
9033
9035
|
}
|
|
9034
9036
|
closePanel() {
|
|
9035
9037
|
this.dock?.close();
|
|
@@ -9062,7 +9064,7 @@ var El = [
|
|
|
9062
9064
|
indicators: []
|
|
9063
9065
|
};
|
|
9064
9066
|
let { bar: n, prevClose: r } = t, i = n.close - r, a = r === 0 ? 0 : i / r * 100, o = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds ?? [e.instanceId])), s = this.host.settingsState.numberLocale || "en-US", c = this.host.chart.getActiveIndicators().map((t) => {
|
|
9065
|
-
let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) &&
|
|
9067
|
+
let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) && ul(t), i = t.descriptor.plots?.map((e) => [e.key, e.title]) ?? Object.keys(n ?? {}).map((e) => [e, e]), a = n ? i.filter(([e]) => typeof n[e] == "number" && Number.isFinite(n[e])).map(([e, t]) => {
|
|
9066
9068
|
let i = n[e];
|
|
9067
9069
|
return {
|
|
9068
9070
|
key: t,
|
|
@@ -9191,7 +9193,7 @@ var El = [
|
|
|
9191
9193
|
this.host.toolbar?.setRailed("watchlist", e && this.host.featureState["dock.watchlist"]), this.host.toolbar?.setRailed("alerts", e && this.host.featureState["dock.alerts"]), this.host.toolbar?.setRailed("objects", e && this.host.featureState["dock.objectTree"]), this.host.toolbar?.fit();
|
|
9192
9194
|
}
|
|
9193
9195
|
panelFocusTarget(e) {
|
|
9194
|
-
let t =
|
|
9196
|
+
let t = jl[e], n = t ? this.host.root.querySelector(`.tcw-toolbar [data-role="${t}"]`) : null, r = this.host.root.hasAttribute("data-tcw-narrow");
|
|
9195
9197
|
return n && !n.hidden && !(r && n.classList.contains("tcw-toolbar-overflow")) ? n : this.host.root.querySelector(".tcw-toolbar-more") ?? this.host.chartContainer;
|
|
9196
9198
|
}
|
|
9197
9199
|
closePanelByHand(e) {
|
|
@@ -9219,29 +9221,29 @@ var El = [
|
|
|
9219
9221
|
}));
|
|
9220
9222
|
this.host.objectTree.setObjects(e, t, n);
|
|
9221
9223
|
}
|
|
9222
|
-
},
|
|
9224
|
+
}, Nl = new Set([
|
|
9223
9225
|
"timezone",
|
|
9224
9226
|
"numberLocale",
|
|
9225
9227
|
"chartTypeOptions",
|
|
9226
9228
|
"logScale",
|
|
9227
9229
|
"autoScale"
|
|
9228
|
-
]),
|
|
9229
|
-
function
|
|
9230
|
-
return W(e,
|
|
9230
|
+
]), Pl = 80, Fl = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
9231
|
+
function Il(e) {
|
|
9232
|
+
return W(e, Nl);
|
|
9231
9233
|
}
|
|
9232
|
-
function
|
|
9234
|
+
function Ll(e) {
|
|
9233
9235
|
let { overrides: t } = lt(e);
|
|
9234
9236
|
return Object.fromEntries(Object.entries(t).filter(([e, t]) => t !== null && v.includes(e)));
|
|
9235
9237
|
}
|
|
9236
|
-
function
|
|
9238
|
+
function Rl() {
|
|
9237
9239
|
try {
|
|
9238
9240
|
return typeof localStorage < "u" ? localStorage : null;
|
|
9239
9241
|
} catch {
|
|
9240
9242
|
return null;
|
|
9241
9243
|
}
|
|
9242
9244
|
}
|
|
9243
|
-
var
|
|
9244
|
-
constructor(e = "tcw:chart-templates", t =
|
|
9245
|
+
var zl = class {
|
|
9246
|
+
constructor(e = "tcw:chart-templates", t = Rl()) {
|
|
9245
9247
|
this.key = e, this.storage = t;
|
|
9246
9248
|
}
|
|
9247
9249
|
list() {
|
|
@@ -9253,10 +9255,10 @@ var Ll = class {
|
|
|
9253
9255
|
}
|
|
9254
9256
|
if (!Array.isArray(e)) return [];
|
|
9255
9257
|
let t = [];
|
|
9256
|
-
for (let n of e) !
|
|
9257
|
-
name: n.name.slice(0,
|
|
9258
|
-
settings:
|
|
9259
|
-
style:
|
|
9258
|
+
for (let n of e) !Fl(n) || typeof n.name != "string" || !n.name.trim() || t.push({
|
|
9259
|
+
name: n.name.slice(0, Pl).trim(),
|
|
9260
|
+
settings: Il(n.settings),
|
|
9261
|
+
style: Ll(n.style)
|
|
9260
9262
|
});
|
|
9261
9263
|
return t.sort((e, t) => e.name.localeCompare(t.name));
|
|
9262
9264
|
}
|
|
@@ -9264,12 +9266,12 @@ var Ll = class {
|
|
|
9264
9266
|
return this.list().find((t) => t.name === e) ?? null;
|
|
9265
9267
|
}
|
|
9266
9268
|
save(e, t, n) {
|
|
9267
|
-
let r = e.replace(/\s+/g, " ").slice(0,
|
|
9269
|
+
let r = e.replace(/\s+/g, " ").slice(0, Pl).trim();
|
|
9268
9270
|
if (!r || !this.storage) return !1;
|
|
9269
9271
|
let i = [...this.list().filter((e) => e.name !== r), {
|
|
9270
9272
|
name: r,
|
|
9271
|
-
settings:
|
|
9272
|
-
style:
|
|
9273
|
+
settings: Il(t),
|
|
9274
|
+
style: Ll(n)
|
|
9273
9275
|
}];
|
|
9274
9276
|
try {
|
|
9275
9277
|
return this.storage.setItem(this.key, JSON.stringify(i)), !0;
|
|
@@ -9282,11 +9284,11 @@ var Ll = class {
|
|
|
9282
9284
|
this.storage?.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
|
|
9283
9285
|
} catch {}
|
|
9284
9286
|
}
|
|
9285
|
-
},
|
|
9287
|
+
}, Bl = new Set([...Ma, "autoScale"]), Vl = class {
|
|
9286
9288
|
constructor(e) {
|
|
9287
9289
|
this.host = e;
|
|
9288
9290
|
}
|
|
9289
|
-
chartTemplates = new
|
|
9291
|
+
chartTemplates = new zl();
|
|
9290
9292
|
chartTemplatePrompt = null;
|
|
9291
9293
|
settingsEdit = null;
|
|
9292
9294
|
state = Qn(_);
|
|
@@ -9406,7 +9408,7 @@ var Ll = class {
|
|
|
9406
9408
|
this.touchSettings(Object.keys(n), v), this.applySettings(n), this.host.chart.resetOverrides([...v], { layer: "user" }), this.host.chart.applyOverrides(t.style, { layer: "user" }), this.host.settings?.refresh(this.shownSettings()), this.host.say(w(this.host.t("templates.applied"), { name: e }));
|
|
9407
9409
|
}
|
|
9408
9410
|
promptSaveChartTemplate() {
|
|
9409
|
-
this.chartTemplatePrompt ??= new
|
|
9411
|
+
this.chartTemplatePrompt ??= new Ts(this.host.overlayHost(), this.host.t), this.chartTemplatePrompt.open({
|
|
9410
9412
|
title: this.host.t("settings.saveTemplateTitle"),
|
|
9411
9413
|
submitLabel: this.host.t("common.save"),
|
|
9412
9414
|
placeholder: this.host.t("settings.templatePlaceholder"),
|
|
@@ -9516,7 +9518,7 @@ var Ll = class {
|
|
|
9516
9518
|
this.settingsState = {
|
|
9517
9519
|
...this.settingsState,
|
|
9518
9520
|
...e
|
|
9519
|
-
}, Object.keys(e).some((e) => !
|
|
9521
|
+
}, Object.keys(e).some((e) => !Bl.has(e)) && this.host.layouts.layoutSession?.changed(), this.host.legend.scheduleLegend(), e.gridVisible !== void 0 && this.host.chart.setGridVisible(e.gridVisible), e.volumeVisible !== void 0 && this.host.chart.setVolumeVisible(e.volumeVisible), e.volumeProfileVisible !== void 0 && this.host.chart.setVolumeProfileVisible(e.volumeProfileVisible), e.marketProfileVisible !== void 0 && this.host.chart.setMarketProfileVisible(e.marketProfileVisible), e.marketProfileSplit !== void 0 && this.host.chart.setMarketProfileConfig({ splitBySession: e.marketProfileSplit }), e.marketProfileLetters !== void 0 && this.host.chart.setMarketProfileConfig({ letters: e.marketProfileLetters }), e.marketProfileBuckets !== void 0 && this.host.chart.setMarketProfileConfig({ buckets: e.marketProfileBuckets }), e.marketProfileOpacity !== void 0 && this.host.chart.setMarketProfileConfig({ opacity: e.marketProfileOpacity }), e.depthHeatmapVisible !== void 0 && this.host.chart.setDepthHeatmapVisible(e.depthHeatmapVisible), e.depthHeatmapOpacity !== void 0 && this.host.chart.setDepthHeatmapConfig({ opacity: e.depthHeatmapOpacity }), e.sessionShadingVisible !== void 0 && this.host.chart.setSessionShadingVisible(e.sessionShadingVisible), e.pivotMarkersVisible !== void 0 && this.host.chart.setPivotMarkersVisible(e.pivotMarkersVisible), e.pivotStrength !== void 0 && this.host.chart.setPivotMarkersConfig({
|
|
9520
9522
|
left: e.pivotStrength,
|
|
9521
9523
|
right: e.pivotStrength
|
|
9522
9524
|
}), e.pivotStructureLabels !== void 0 && this.host.chart.setPivotMarkersConfig({ structureLabels: e.pivotStructureLabels }), e.periodLevelsVisible !== void 0 && this.host.chart.setPeriodLevelsVisible(e.periodLevelsVisible), e.periodLevelsPeriod !== void 0 && this.host.chart.setPeriodLevelsPeriod(e.periodLevelsPeriod), e.legendVisible !== void 0 && this.host.chart.setLegend({ visible: e.legendVisible }), e.barCountdown !== void 0 && this.host.chart.setBarCountdownVisible(e.barCountdown), e.indicatorValueLabels !== void 0 && this.host.chart.setIndicatorValueLabelsVisible(e.indicatorValueLabels), e.alignAxisLabels !== void 0 && this.host.chart.setAxisLabelsAligned(e.alignAxisLabels), e.crosshairMode !== void 0 && this.host.chart.setCrosshairMode(e.crosshairMode), e.crosshairCursor !== void 0 && this.host.chart.setCrosshairCursor(e.crosshairCursor), e.autoScale !== void 0 && this.host.chart.setAutoScale(e.autoScale), e.invertScale !== void 0 && this.host.chart.setInvertScale(e.invertScale), e.leftPriceScale !== void 0 && (this.host.chart.setLeftPriceScaleVisible(e.leftPriceScale), this.host.placeDrawingButton()), (e.scaleMode !== void 0 || e.autoScale !== void 0) && queueMicrotask(() => this.refreshScaleSwitches()), e.timezone !== void 0 && queueMicrotask(() => this.host.statusBar?.tick()), e.scaleMode === void 0 ? e.logScale !== void 0 && (this.settingsState = {
|
|
@@ -9578,8 +9580,8 @@ var Ll = class {
|
|
|
9578
9580
|
restoreSettings(e, t = null, n) {
|
|
9579
9581
|
n !== void 0 && (this.host.comparing.compareScaleHeld = n && this.host.comparing.compares.length > 0), this.applySettings(e), t && t.theme === (this.host.chart.getTheme()?.name ?? "") && this.host.chart.applyOverrides(t.overrides, { layer: "user" }), this.host.settings?.refresh(this.shownSettings());
|
|
9580
9582
|
}
|
|
9581
|
-
},
|
|
9582
|
-
function
|
|
9583
|
+
}, Hl = 13;
|
|
9584
|
+
function Ul(e) {
|
|
9583
9585
|
let t = e.filter((e) => e !== null);
|
|
9584
9586
|
if (t.length === 0) return null;
|
|
9585
9587
|
let n = Math.min(...t.map((e) => e.x)), r = Math.min(...t.map((e) => e.y)), i = Math.max(...t.map((e) => e.x + e.width)), a = Math.max(...t.map((e) => e.y + e.height));
|
|
@@ -9590,7 +9592,7 @@ function Vl(e) {
|
|
|
9590
9592
|
height: a - r
|
|
9591
9593
|
};
|
|
9592
9594
|
}
|
|
9593
|
-
var
|
|
9595
|
+
var Wl = class {
|
|
9594
9596
|
constructor(e) {
|
|
9595
9597
|
this.host = e;
|
|
9596
9598
|
}
|
|
@@ -9621,7 +9623,7 @@ var Hl = class {
|
|
|
9621
9623
|
e.hide();
|
|
9622
9624
|
return;
|
|
9623
9625
|
}
|
|
9624
|
-
let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c =
|
|
9626
|
+
let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c = Ul(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
|
|
9625
9627
|
x: o.x + o.width / 2,
|
|
9626
9628
|
y: o.y,
|
|
9627
9629
|
width: 0,
|
|
@@ -9670,13 +9672,14 @@ var Hl = class {
|
|
|
9670
9672
|
},
|
|
9671
9673
|
text: o,
|
|
9672
9674
|
font: {
|
|
9673
|
-
size: a.fontSize || i?.fontSize ||
|
|
9675
|
+
size: a.fontSize || i?.fontSize || Hl,
|
|
9674
9676
|
bold: a.bold === !0,
|
|
9675
9677
|
italic: a.italic === !0,
|
|
9676
9678
|
family: this.host.chart.getFont?.()?.family ?? this.host.ui.font.family
|
|
9677
9679
|
},
|
|
9678
9680
|
color: a.textColor ?? So[n.type] ?? a.color,
|
|
9679
9681
|
label: this.host.t("drawingSettings.text"),
|
|
9682
|
+
placeholder: this.host.drawingToolName(n.type),
|
|
9680
9683
|
onInput: (n) => t ? this.host.chart.amendNewDrawing(e, { style: { text: n } }) : this.host.chart.updateDrawing(e, { style: { text: n } }),
|
|
9681
9684
|
onCommit: (n) => {
|
|
9682
9685
|
let r = n.replace(/\s+$/, "");
|
|
@@ -9709,7 +9712,7 @@ var Hl = class {
|
|
|
9709
9712
|
}, { tab: n.tab }), n.justDrawn && e.isOpen() && (this.justDrawnText = t));
|
|
9710
9713
|
}
|
|
9711
9714
|
promptSaveDrawingTemplate(e, t) {
|
|
9712
|
-
this.drawingTemplatePrompt ??= new
|
|
9715
|
+
this.drawingTemplatePrompt ??= new Ts(this.host.root, this.host.t), this.drawingTemplatePrompt.open({
|
|
9713
9716
|
title: this.host.t("drawingSettings.saveTemplateTitle"),
|
|
9714
9717
|
submitLabel: this.host.t("common.save"),
|
|
9715
9718
|
placeholder: this.host.drawingToolName(t.type),
|
|
@@ -9721,7 +9724,7 @@ var Hl = class {
|
|
|
9721
9724
|
}
|
|
9722
9725
|
});
|
|
9723
9726
|
}
|
|
9724
|
-
},
|
|
9727
|
+
}, Gl = 200, Kl = class {
|
|
9725
9728
|
constructor(e) {
|
|
9726
9729
|
this.host = e;
|
|
9727
9730
|
}
|
|
@@ -9750,7 +9753,7 @@ var Hl = class {
|
|
|
9750
9753
|
for (; o > 0 && n[o - 1].time * r >= a;) o--;
|
|
9751
9754
|
let s = this.host.displayTimezone();
|
|
9752
9755
|
return En({
|
|
9753
|
-
dayShare: n.slice(-
|
|
9756
|
+
dayShare: n.slice(-Gl).some((e) => {
|
|
9754
9757
|
let t = e.time * r, n = new Date(t + at(s, t) * 6e4).getUTCDay();
|
|
9755
9758
|
return n === 0 || n === 6;
|
|
9756
9759
|
}) ? 1 : 5 / 7,
|
|
@@ -9795,7 +9798,7 @@ var Hl = class {
|
|
|
9795
9798
|
handleToggleTimeframeFavorite(e) {
|
|
9796
9799
|
this.host.timeframeFavorites.toggle(e), this.host.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()), this.host.updateUI();
|
|
9797
9800
|
}
|
|
9798
|
-
},
|
|
9801
|
+
}, ql = 600, Jl = 24, Yl = [
|
|
9799
9802
|
"--tcw-toolbar-h",
|
|
9800
9803
|
"--tcw-control-h",
|
|
9801
9804
|
"--tcw-control-h-sm",
|
|
@@ -9813,33 +9816,33 @@ var Hl = class {
|
|
|
9813
9816
|
"--tcw-line-height",
|
|
9814
9817
|
"--tcw-line-xs",
|
|
9815
9818
|
"--tcw-label-size"
|
|
9816
|
-
],
|
|
9817
|
-
function
|
|
9819
|
+
], Xl = 48, Zl = 5e4, Ql = 100;
|
|
9820
|
+
function $l() {
|
|
9818
9821
|
return new Promise((e) => {
|
|
9819
9822
|
if (typeof requestAnimationFrame != "function" || document.hidden) {
|
|
9820
9823
|
setTimeout(e, 0);
|
|
9821
9824
|
return;
|
|
9822
9825
|
}
|
|
9823
|
-
let t = setTimeout(e,
|
|
9826
|
+
let t = setTimeout(e, Ql);
|
|
9824
9827
|
requestAnimationFrame(() => setTimeout(() => {
|
|
9825
9828
|
clearTimeout(t), e();
|
|
9826
9829
|
}, 0));
|
|
9827
9830
|
});
|
|
9828
9831
|
}
|
|
9829
|
-
var
|
|
9830
|
-
function
|
|
9832
|
+
var eu = 864e5, tu = 5e3, nu = 2e3, ru = 48, iu = "rgba(255,255,255,0.03)", au = "rgba(0,0,0,0.03)", ou = 2;
|
|
9833
|
+
function su(e) {
|
|
9831
9834
|
if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph")) return null;
|
|
9832
9835
|
if (/^[a-z]$/i.test(e.key)) return e.key;
|
|
9833
9836
|
let t = /^Key([A-Z])$/.exec(e.code ?? "");
|
|
9834
9837
|
return t && [...e.key].length === 1 && !/[\s\d]/.test(e.key) ? t[1].toLowerCase() : null;
|
|
9835
9838
|
}
|
|
9836
|
-
var
|
|
9839
|
+
var cu = 1e3, lu = [
|
|
9837
9840
|
["barCountdown", "barCountdown"],
|
|
9838
9841
|
["logScale", "logScale"],
|
|
9839
9842
|
["legendVisible", "legend"],
|
|
9840
9843
|
["volumeVisible", "volume"]
|
|
9841
|
-
],
|
|
9842
|
-
function
|
|
9844
|
+
], uu = v.filter((e) => Ke[e] !== "color");
|
|
9845
|
+
function du(e) {
|
|
9843
9846
|
if (!e.feed) return e;
|
|
9844
9847
|
if (e.adapter) throw TypeError("A widget takes an adapter or a feed, not both");
|
|
9845
9848
|
return {
|
|
@@ -9848,19 +9851,19 @@ function lu(e) {
|
|
|
9848
9851
|
feed: void 0
|
|
9849
9852
|
};
|
|
9850
9853
|
}
|
|
9851
|
-
var
|
|
9852
|
-
intervals = new
|
|
9853
|
-
drawingEdit = new
|
|
9854
|
-
chartSettings = new
|
|
9855
|
-
docking = new
|
|
9856
|
-
layouts = new
|
|
9857
|
-
commands = new
|
|
9858
|
-
legend = new
|
|
9859
|
-
menus = new
|
|
9860
|
-
trading = new
|
|
9861
|
-
alerting = new
|
|
9862
|
-
watching = new
|
|
9863
|
-
comparing = new
|
|
9854
|
+
var fu = class {
|
|
9855
|
+
intervals = new Kl(this.intervalsHost());
|
|
9856
|
+
drawingEdit = new Wl(this.drawingEditHost());
|
|
9857
|
+
chartSettings = new Vl(this.chartSettingsHost());
|
|
9858
|
+
docking = new Ml(this.dockingHost());
|
|
9859
|
+
layouts = new kl(this.layoutsHost());
|
|
9860
|
+
commands = new fl(this.commandsHost());
|
|
9861
|
+
legend = new dl(this.legendHost());
|
|
9862
|
+
menus = new Qc(this.menusHost());
|
|
9863
|
+
trading = new Xc(this.tradingHost());
|
|
9864
|
+
alerting = new Yc(this.alertingHost());
|
|
9865
|
+
watching = new Jc(this.watchingHost());
|
|
9866
|
+
comparing = new qc(this.comparingHost());
|
|
9864
9867
|
chart;
|
|
9865
9868
|
state;
|
|
9866
9869
|
themeOf = {
|
|
@@ -9929,7 +9932,7 @@ var uu = class {
|
|
|
9929
9932
|
uiVariables = !1;
|
|
9930
9933
|
chartFontBase = null;
|
|
9931
9934
|
scaleObserver = null;
|
|
9932
|
-
templates = new
|
|
9935
|
+
templates = new Os();
|
|
9933
9936
|
templatePrompt = null;
|
|
9934
9937
|
markerTip = null;
|
|
9935
9938
|
dataWindow = null;
|
|
@@ -9938,11 +9941,11 @@ var uu = class {
|
|
|
9938
9941
|
lastHoverPrevClose = null;
|
|
9939
9942
|
legendHoverIndex = null;
|
|
9940
9943
|
pointerOnChart = !1;
|
|
9941
|
-
favoritesStore = new
|
|
9942
|
-
indicatorFavorites = new
|
|
9944
|
+
favoritesStore = new Fs();
|
|
9945
|
+
indicatorFavorites = new Fs("tcw:indicator-favorites");
|
|
9943
9946
|
indicatorDefaults = new ka();
|
|
9944
|
-
timeframeFavorites = new
|
|
9945
|
-
customTimeframes = new
|
|
9947
|
+
timeframeFavorites = new Fs("tcw:tf-favorites");
|
|
9948
|
+
customTimeframes = new Fs("tcw:tf-custom");
|
|
9946
9949
|
timeframes = [];
|
|
9947
9950
|
sessionRefPrice = null;
|
|
9948
9951
|
symbolInfoPanel = null;
|
|
@@ -9981,7 +9984,7 @@ var uu = class {
|
|
|
9981
9984
|
hostLayer = null;
|
|
9982
9985
|
priceAxisAddDefault = !1;
|
|
9983
9986
|
constructor(e, t = {}) {
|
|
9984
|
-
let n =
|
|
9987
|
+
let n = du(t);
|
|
9985
9988
|
this.options = n;
|
|
9986
9989
|
let { isDark: r, resolvedTheme: i, features: a, chartFeatures: o } = this.readOptions(n);
|
|
9987
9990
|
this.buildRoot(e, n, r, i), this.buildToolbar(n, a);
|
|
@@ -10042,7 +10045,7 @@ var uu = class {
|
|
|
10042
10045
|
...o,
|
|
10043
10046
|
priceAxisAddButton: this.priceAxisAddDefault && this.featureState["menu.priceAxisAdd"]
|
|
10044
10047
|
};
|
|
10045
|
-
if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(
|
|
10048
|
+
if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(lu.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
|
|
10046
10049
|
...this.chartSettings.settingsState,
|
|
10047
10050
|
legendVisible: o.legend !== !1,
|
|
10048
10051
|
volumeVisible: o.volume !== !1,
|
|
@@ -10077,8 +10080,8 @@ var uu = class {
|
|
|
10077
10080
|
}
|
|
10078
10081
|
buildRoot(e, t, n, r) {
|
|
10079
10082
|
on(), this.root = document.createElement("div"), this.root.className = "tcw-root";
|
|
10080
|
-
let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir :
|
|
10081
|
-
this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new
|
|
10083
|
+
let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : xu(t.locale) ? "rtl" : "ltr";
|
|
10084
|
+
this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new rc(this.root), this.portal.className = "tcw-root tcw-portal", this.look = Qn({
|
|
10082
10085
|
dark: n,
|
|
10083
10086
|
theme: r
|
|
10084
10087
|
});
|
|
@@ -10086,7 +10089,7 @@ var uu = class {
|
|
|
10086
10089
|
this.scope.run(() => $n(() => {
|
|
10087
10090
|
let { dark: e, theme: t } = this.look.get();
|
|
10088
10091
|
this.root.dataset.tcwTheme = this.portal.dataset.tcwTheme = e ? "dark" : "light", a && (this.keepingLook(() => this.chart.setTheme(t)), this.paintWatermark());
|
|
10089
|
-
})), a = !0, this.stopKeyboardInset =
|
|
10092
|
+
})), a = !0, this.stopKeyboardInset = Is([this.root, this.portal]), this.stopNarrow = Ls(this.root, (e) => {
|
|
10090
10093
|
this.toolbar?.fit(), e || this.sidebar?.closeOverlay(), this.docking.syncRail();
|
|
10091
10094
|
}), this.ui = U(t.ui), this.uiVariables = t.ui !== void 0, this.uiScale = this.scaleNow(), this.applyLookTokens(), typeof ResizeObserver < "u" && (this.scaleObserver = new ResizeObserver(() => this.fitScale()), this.scaleObserver.observe(this.root)), this.markSwitchedOff(), this.stopFormControls = Qt([this.root, this.portal], {
|
|
10092
10095
|
layer: this.overlayHost,
|
|
@@ -10163,16 +10166,16 @@ var uu = class {
|
|
|
10163
10166
|
}, this.t), this.scope.run(() => $n(() => {
|
|
10164
10167
|
let e = this.chartSettings.followCrosshairCursor();
|
|
10165
10168
|
this.sidebar?.showCrosshairCursor(e);
|
|
10166
|
-
})), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new
|
|
10169
|
+
})), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new Mc(this.chartContainer, this.t("status.loading")), this.historyPill = new Pc(this.chartContainer, {
|
|
10167
10170
|
loading: this.t("history.loading"),
|
|
10168
10171
|
failed: this.t("history.failed")
|
|
10169
|
-
}), this.docking.dock = new
|
|
10172
|
+
}), this.docking.dock = new Gs(n, {
|
|
10170
10173
|
labels: {
|
|
10171
10174
|
rail: this.t("dock.rail"),
|
|
10172
10175
|
resize: this.t("dock.resize")
|
|
10173
10176
|
},
|
|
10174
|
-
savedWidth: () =>
|
|
10175
|
-
saveWidth: (e) =>
|
|
10177
|
+
savedWidth: () => yu(),
|
|
10178
|
+
saveWidth: (e) => bu(e),
|
|
10176
10179
|
railShown: () => this.docking.railShown(),
|
|
10177
10180
|
focusAfterClose: (e) => this.docking.panelFocusTarget(e),
|
|
10178
10181
|
room: () => n.clientWidth
|
|
@@ -10275,7 +10278,7 @@ var uu = class {
|
|
|
10275
10278
|
}
|
|
10276
10279
|
}), this.clockTimer = setInterval(() => {
|
|
10277
10280
|
!Kr() && this.featureState.statusBar && this.featureState["statusBar.clock"] && this.statusBar?.tick();
|
|
10278
|
-
},
|
|
10281
|
+
}, cu), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
|
|
10279
10282
|
title: this.t("goTo.title"),
|
|
10280
10283
|
date: this.t("range.date"),
|
|
10281
10284
|
range: this.t("goTo.range"),
|
|
@@ -10334,7 +10337,7 @@ var uu = class {
|
|
|
10334
10337
|
eraser: t ?? this.state.eraser,
|
|
10335
10338
|
zoomArea: n ?? this.state.zoomArea
|
|
10336
10339
|
}, this.updateUI();
|
|
10337
|
-
}), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.on("legendResize", () => this.legend.scheduleLegend()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new
|
|
10340
|
+
}), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.on("legendResize", () => this.legend.scheduleLegend()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new mc(this.chartContainer, {
|
|
10338
10341
|
onToggleVisible: (e, t, n) => {
|
|
10339
10342
|
n === "compare" ? this.chart.setCompareVisible(e, t) : this.chart.setIndicatorVisible(e, t), this.legend.scheduleLegend(), this.objectTree?.isOpen() && this.docking.refreshObjects();
|
|
10340
10343
|
},
|
|
@@ -10347,7 +10350,7 @@ var uu = class {
|
|
|
10347
10350
|
onMore: (e, t) => this.legend.openLegendMenu(e, t),
|
|
10348
10351
|
onPaneAction: (e, t) => this.legend.runPaneAction(e, t),
|
|
10349
10352
|
onStackResize: (e) => this.chart.setLegendStack?.(e ? {
|
|
10350
|
-
width:
|
|
10353
|
+
width: ll(this.chart) + e.width,
|
|
10351
10354
|
height: 1 + e.height
|
|
10352
10355
|
} : null)
|
|
10353
10356
|
}, {
|
|
@@ -10396,7 +10399,7 @@ var uu = class {
|
|
|
10396
10399
|
"dataUpdate",
|
|
10397
10400
|
"symbolInfoChange"
|
|
10398
10401
|
]) this.chart.on(e, () => this.placeDrawingButton());
|
|
10399
|
-
this.placeDrawingButton(), this.dataWindow = new
|
|
10402
|
+
this.placeDrawingButton(), this.dataWindow = new Oc(this.root, {
|
|
10400
10403
|
formatPrice: (e) => this.formatAlertPrice(e),
|
|
10401
10404
|
formatPercent: (e) => this.formatNumber(e, 2),
|
|
10402
10405
|
formatVolume: (e) => this.formatVolume(e),
|
|
@@ -10421,7 +10424,7 @@ var uu = class {
|
|
|
10421
10424
|
},
|
|
10422
10425
|
toWallTime: (e) => X(e * E(this.chart.getData()), this.displayTimezone()),
|
|
10423
10426
|
fromWallTime: (e, t) => {
|
|
10424
|
-
let n =
|
|
10427
|
+
let n = Hs(e, t, this.displayTimezone());
|
|
10425
10428
|
return n === null ? null : n / E(this.chart.getData());
|
|
10426
10429
|
},
|
|
10427
10430
|
roundPrice: (e) => this.chart.roundPrice(e),
|
|
@@ -10434,7 +10437,7 @@ var uu = class {
|
|
|
10434
10437
|
save: (t) => this.drawingEdit.promptSaveDrawingTemplate(e, t),
|
|
10435
10438
|
remove: (t, n) => e.remove(t, n)
|
|
10436
10439
|
}
|
|
10437
|
-
}, this.t)), this.drawingEdit.inlineText = new
|
|
10440
|
+
}, this.t)), this.drawingEdit.inlineText = new No(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
|
|
10438
10441
|
let t = e.payload.id, n = this.chart.getDrawings().find((e) => e.id === t)?.type;
|
|
10439
10442
|
n && K[n] && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, n && K[n] ? { tab: "text" } : {});
|
|
10440
10443
|
}), this.chart.on("drawingRemove", (e) => {
|
|
@@ -10452,7 +10455,7 @@ var uu = class {
|
|
|
10452
10455
|
justDrawn: !0
|
|
10453
10456
|
}));
|
|
10454
10457
|
}, s = () => setTimeout(o, 0);
|
|
10455
|
-
window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o,
|
|
10458
|
+
window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, ql), this.drawingEdit.cancelTextPrompt = a;
|
|
10456
10459
|
}), this.drawingStyle = new co(this.root, {
|
|
10457
10460
|
onStyleChange: (e) => {
|
|
10458
10461
|
this.chart.setDrawingStyle(e), this.chart.setSelectedDrawingStyle(e);
|
|
@@ -10530,19 +10533,19 @@ var uu = class {
|
|
|
10530
10533
|
...this.menus.chartMenuContext(s),
|
|
10531
10534
|
...o ? { pane: this.chart.getPaneScale(o) } : {}
|
|
10532
10535
|
};
|
|
10533
|
-
this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(
|
|
10536
|
+
this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(Go(t, c, this.t), _e, this.featureState), n, r, {
|
|
10534
10537
|
area: t,
|
|
10535
10538
|
price: s,
|
|
10536
10539
|
time: a
|
|
10537
10540
|
});
|
|
10538
10541
|
}), this.chart.on("priceAxisAdd", (e) => {
|
|
10539
10542
|
if (!this.featureState["menu.priceAxisAdd"]) return;
|
|
10540
|
-
let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(
|
|
10543
|
+
let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(zo(this.menus.chartMenuContext(i), this.t), _e, this.featureState);
|
|
10541
10544
|
this.menus.openChartMenu(a, n, r, {
|
|
10542
10545
|
area: "priceAxisAdd",
|
|
10543
10546
|
price: i
|
|
10544
10547
|
});
|
|
10545
|
-
}), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new
|
|
10548
|
+
}), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new Ds(this.chartContainer, {
|
|
10546
10549
|
title: this.t("interval.title"),
|
|
10547
10550
|
hint: this.t("interval.hint"),
|
|
10548
10551
|
invalid: this.t("interval.invalid")
|
|
@@ -10550,7 +10553,7 @@ var uu = class {
|
|
|
10550
10553
|
}
|
|
10551
10554
|
buildTrading(e, t) {
|
|
10552
10555
|
if (e.layouts !== !1 && this.layouts.setupLayouts(e.layouts === !0 || e.layouts === void 0 ? {} : e.layouts), e.trading !== !1) {
|
|
10553
|
-
this.trading.orderTicket = new
|
|
10556
|
+
this.trading.orderTicket = new bs(this.root, {
|
|
10554
10557
|
onSubmit: (e) => {
|
|
10555
10558
|
this.chart.placeOrderIntent(e), this.say(w(this.t("ticket.sent"), {
|
|
10556
10559
|
side: this.t(e.side === "buy" ? "ticket.buy" : "ticket.sell"),
|
|
@@ -10561,7 +10564,7 @@ var uu = class {
|
|
|
10561
10564
|
formatPrice: (e) => this.formatAlertPrice(e),
|
|
10562
10565
|
formatAmount: (e) => this.formatMoney(e),
|
|
10563
10566
|
formatNumber: (e, t) => this.formatNumber(e, t)
|
|
10564
|
-
}, this.t), this.trading.accountPanel = new
|
|
10567
|
+
}, this.t), this.trading.accountPanel = new os(t, {
|
|
10565
10568
|
onClosePosition: (e) => this.chart.closePositionIntent(e),
|
|
10566
10569
|
onReversePosition: (e) => this.chart.reversePositionIntent(e),
|
|
10567
10570
|
onCancelOrder: (e) => this.chart.cancelOrderIntent(e),
|
|
@@ -10586,7 +10589,7 @@ var uu = class {
|
|
|
10586
10589
|
]) this.chart.on(e, () => this.trading.refreshAccountSoon());
|
|
10587
10590
|
}
|
|
10588
10591
|
if (e.trading !== !1) {
|
|
10589
|
-
if (this.trading.bracketBar = new
|
|
10592
|
+
if (this.trading.bracketBar = new xc(this.chartContainer, {
|
|
10590
10593
|
onConfirm: () => this.chart.confirmBracket(),
|
|
10591
10594
|
onCancel: () => {
|
|
10592
10595
|
this.chart.cancelBracket(), this.trading.bracketBar?.hide();
|
|
@@ -10595,7 +10598,7 @@ var uu = class {
|
|
|
10595
10598
|
let t = e.payload;
|
|
10596
10599
|
this.trading.bracketBar?.hide(), this.say(w(this.t(t.side === "buy" ? "bracket.longPlaced" : "bracket.shortPlaced"), { rr: t.riskReward.toFixed(2) }));
|
|
10597
10600
|
}), e.depthLadder) {
|
|
10598
|
-
this.trading.depthLadder = new
|
|
10601
|
+
this.trading.depthLadder = new Tc(this.root, {
|
|
10599
10602
|
onTrade: (e, t) => {
|
|
10600
10603
|
this.chart.placeOrderIntent({
|
|
10601
10604
|
side: e,
|
|
@@ -10637,7 +10640,7 @@ var uu = class {
|
|
|
10637
10640
|
}, this.t), this.chart.on("alertAdd", () => this.alerting.refreshAlerts()), this.chart.on("alertRemove", () => this.alerting.refreshAlerts()), this.chart.on("alertUpdate", () => this.alerting.refreshAlerts()), this.chart.on("alertExpired", (e) => {
|
|
10638
10641
|
let t = e.payload;
|
|
10639
10642
|
this.alerting.refreshAlerts(), this.featureState.alerts && this.say(w(this.t("alerts.expiredToast"), { text: t.message ?? this.alerting.alertText(t) }));
|
|
10640
|
-
}), e.alertNotifications && (this.alerting.alertNotifier = new
|
|
10643
|
+
}), e.alertNotifications && (this.alerting.alertNotifier = new Sc(e.alertNotifications)), this.chart.on("alertTriggered", (e) => {
|
|
10641
10644
|
let t = e.payload;
|
|
10642
10645
|
if (this.alerting.refreshAlerts(), !this.featureState.alerts) return;
|
|
10643
10646
|
let n = `${this.alerting.alertText(t)}${t.message ? ` — ${t.message}` : ""}`;
|
|
@@ -10732,8 +10735,8 @@ var uu = class {
|
|
|
10732
10735
|
onAction: (e) => this.commands.handleAction(e),
|
|
10733
10736
|
onClose: () => {}
|
|
10734
10737
|
}, this.overlayHost, this.t, {
|
|
10735
|
-
list: () =>
|
|
10736
|
-
add: (e) =>
|
|
10738
|
+
list: () => gu(),
|
|
10739
|
+
add: (e) => _u([e, ...gu().filter((t) => t !== e)])
|
|
10737
10740
|
})), this.boundGlobalKeydown = (e) => {
|
|
10738
10741
|
if (this.handleHostHotkey(e) || this.featureState.hotkeys && this.replay.isOpen() && this.replay.handleReplayKey(e)) return;
|
|
10739
10742
|
let t = L(this.root), n = (e) => this.featureState.hotkeys && this.featureState[e];
|
|
@@ -10754,11 +10757,11 @@ var uu = class {
|
|
|
10754
10757
|
let t = document.activeElement;
|
|
10755
10758
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
10756
10759
|
e.preventDefault(), this.intervals.intervalInput.open(e.key);
|
|
10757
|
-
} else if (
|
|
10760
|
+
} else if (su(e) !== null) {
|
|
10758
10761
|
if (e.defaultPrevented || !n("symbolTyping") || !this.featureState.symbolSearch || R() || Ar() || !L(this.root, !0)) return;
|
|
10759
10762
|
let t = document.activeElement;
|
|
10760
10763
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
10761
|
-
e.preventDefault(), this.openSymbolSearch(
|
|
10764
|
+
e.preventDefault(), this.openSymbolSearch(su(e));
|
|
10762
10765
|
} else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyI" || e.code === "KeyG" || e.code === "KeyR")) {
|
|
10763
10766
|
if (R() || !t) return;
|
|
10764
10767
|
if (e.code === "KeyI") {
|
|
@@ -10787,13 +10790,13 @@ var uu = class {
|
|
|
10787
10790
|
}
|
|
10788
10791
|
preloadDialogsWhenIdle() {
|
|
10789
10792
|
let e = () => {
|
|
10790
|
-
this.destroyed ||
|
|
10793
|
+
this.destroyed || zs();
|
|
10791
10794
|
}, t = globalThis;
|
|
10792
10795
|
if (t.requestIdleCallback && t.cancelIdleCallback) {
|
|
10793
|
-
let n = t.requestIdleCallback(e, { timeout:
|
|
10796
|
+
let n = t.requestIdleCallback(e, { timeout: tu }), r = t.cancelIdleCallback;
|
|
10794
10797
|
this.stopPreload = () => r(n);
|
|
10795
10798
|
} else {
|
|
10796
|
-
let t = setTimeout(e,
|
|
10799
|
+
let t = setTimeout(e, nu);
|
|
10797
10800
|
this.stopPreload = () => clearTimeout(t);
|
|
10798
10801
|
}
|
|
10799
10802
|
}
|
|
@@ -10955,7 +10958,7 @@ var uu = class {
|
|
|
10955
10958
|
for (let t of [this.root, this.portal]) {
|
|
10956
10959
|
if (ba(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
|
|
10957
10960
|
let n = ya(e);
|
|
10958
|
-
for (let e of
|
|
10961
|
+
for (let e of Yl) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
|
|
10959
10962
|
}
|
|
10960
10963
|
}
|
|
10961
10964
|
fitScale() {
|
|
@@ -10964,7 +10967,7 @@ var uu = class {
|
|
|
10964
10967
|
if (e !== this.uiScale) {
|
|
10965
10968
|
if (this.ui.scale === "auto") {
|
|
10966
10969
|
let t = this.root.clientWidth;
|
|
10967
|
-
if ((e > this.uiScale ? ta(t -
|
|
10970
|
+
if ((e > this.uiScale ? ta(t - Jl) : ta(t + Jl)) === this.uiScale) return;
|
|
10968
10971
|
}
|
|
10969
10972
|
this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
|
|
10970
10973
|
}
|
|
@@ -11117,9 +11120,9 @@ var uu = class {
|
|
|
11117
11120
|
for (let [n, r] of t) e(n) && r();
|
|
11118
11121
|
}
|
|
11119
11122
|
addHotkey(e) {
|
|
11120
|
-
let t =
|
|
11123
|
+
let t = Vc(e.keys);
|
|
11121
11124
|
if (!t) return console.warn(`[ChartWidget] Can't read the shortcut "${e.keys}": modifiers (Ctrl, Alt, Shift) and a key, joined by +.`), null;
|
|
11122
|
-
|
|
11125
|
+
Wc(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
|
|
11123
11126
|
let n = {
|
|
11124
11127
|
spec: e,
|
|
11125
11128
|
parsed: t
|
|
@@ -11129,8 +11132,8 @@ var uu = class {
|
|
|
11129
11132
|
} };
|
|
11130
11133
|
}
|
|
11131
11134
|
handleHostHotkey(e) {
|
|
11132
|
-
if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() ||
|
|
11133
|
-
let t = this.hostHotkeys.find((t) =>
|
|
11135
|
+
if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() || Gc(e) || Ar()) return !1;
|
|
11136
|
+
let t = this.hostHotkeys.find((t) => Hc(e, t.parsed));
|
|
11134
11137
|
if (!t) return !1;
|
|
11135
11138
|
let n = !t.parsed.ctrl && !t.parsed.alt;
|
|
11136
11139
|
if (!L(this.root, n)) return !1;
|
|
@@ -11139,13 +11142,13 @@ var uu = class {
|
|
|
11139
11142
|
}
|
|
11140
11143
|
paintWatermark() {
|
|
11141
11144
|
this.chart.setWatermark(De(this.state.symbol).ticker.replace("USDT", " / USDT"), {
|
|
11142
|
-
fontSize:
|
|
11143
|
-
color: this.state.isDark ?
|
|
11145
|
+
fontSize: ru,
|
|
11146
|
+
color: this.state.isDark ? iu : au
|
|
11144
11147
|
});
|
|
11145
11148
|
}
|
|
11146
11149
|
keepingLook(e) {
|
|
11147
11150
|
this.chartSettings.settingsEdit && this.settings?.close();
|
|
11148
|
-
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(
|
|
11151
|
+
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(uu.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
|
|
11149
11152
|
e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
|
|
11150
11153
|
}
|
|
11151
11154
|
sheetKeyOn(e) {
|
|
@@ -11198,7 +11201,7 @@ var uu = class {
|
|
|
11198
11201
|
let i = e.items();
|
|
11199
11202
|
if (i.length === 0) return;
|
|
11200
11203
|
let a = t.menuAnchor(r);
|
|
11201
|
-
n.openUnder(
|
|
11204
|
+
n.openUnder(Ic([], i), a, (e) => Lc(e, i));
|
|
11202
11205
|
}
|
|
11203
11206
|
});
|
|
11204
11207
|
return r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), t.tidy(), {
|
|
@@ -11284,7 +11287,7 @@ var uu = class {
|
|
|
11284
11287
|
from: i(o.from),
|
|
11285
11288
|
to: i(o.to)
|
|
11286
11289
|
},
|
|
11287
|
-
withTime: !(k(this.state.timeframe) >=
|
|
11290
|
+
withTime: !(k(this.state.timeframe) >= eu),
|
|
11288
11291
|
max: s,
|
|
11289
11292
|
today: s
|
|
11290
11293
|
});
|
|
@@ -11294,12 +11297,12 @@ var uu = class {
|
|
|
11294
11297
|
if (t.length === 0) return;
|
|
11295
11298
|
let r = E(t);
|
|
11296
11299
|
if (e.kind === "date") {
|
|
11297
|
-
let i =
|
|
11300
|
+
let i = Hs(e.date, e.time, n);
|
|
11298
11301
|
if (i === null) return;
|
|
11299
11302
|
this.chart.goToTime(i / r), i / r < t[0].time && this.say(this.t("range.beforeData"));
|
|
11300
11303
|
return;
|
|
11301
11304
|
}
|
|
11302
|
-
let i =
|
|
11305
|
+
let i = Hs(e.from.date, e.from.time, n), a = Hs(e.to.date, e.to.time, n);
|
|
11303
11306
|
i === null || a === null || (this.chart.setVisibleRange(i / r, a / r), Math.min(i, a) / r < t[0].time && this.say(this.t("range.beforeData")));
|
|
11304
11307
|
}
|
|
11305
11308
|
showMarkerTip(e) {
|
|
@@ -11329,7 +11332,7 @@ var uu = class {
|
|
|
11329
11332
|
this.say(this.t("templates.nothing"), "error");
|
|
11330
11333
|
return;
|
|
11331
11334
|
}
|
|
11332
|
-
this.templatePrompt ??= new
|
|
11335
|
+
this.templatePrompt ??= new Ts(this.root, this.t), this.templatePrompt.open({
|
|
11333
11336
|
title: this.t("templates.saveTitle"),
|
|
11334
11337
|
submitLabel: this.t("common.save"),
|
|
11335
11338
|
placeholder: this.t("templates.namePlaceholder"),
|
|
@@ -11349,9 +11352,9 @@ var uu = class {
|
|
|
11349
11352
|
}
|
|
11350
11353
|
async switchLocalTimeframe() {
|
|
11351
11354
|
if (!this.baseSeries) return;
|
|
11352
|
-
let e = ++this.localSeq, t = this.lastLocalSwitchMs >=
|
|
11355
|
+
let e = ++this.localSeq, t = this.lastLocalSwitchMs >= Xl || this.baseSeries.length >= Zl;
|
|
11353
11356
|
try {
|
|
11354
|
-
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await
|
|
11357
|
+
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await $l(), e !== this.localSeq || this.destroyed)) return;
|
|
11355
11358
|
this.applyTimeframeData();
|
|
11356
11359
|
} finally {
|
|
11357
11360
|
e === this.localSeq && this.loading.end();
|
|
@@ -11465,7 +11468,7 @@ var uu = class {
|
|
|
11465
11468
|
defaults: r.descriptor.defaultConfig,
|
|
11466
11469
|
params: r.params,
|
|
11467
11470
|
inputs: r.descriptor.inputs,
|
|
11468
|
-
lineSources:
|
|
11471
|
+
lineSources: pu(t, n, this.t),
|
|
11469
11472
|
plots: r.descriptor.plots,
|
|
11470
11473
|
colors: i?.colors,
|
|
11471
11474
|
lineWidth: i?.lineWidths[0],
|
|
@@ -11484,7 +11487,7 @@ var uu = class {
|
|
|
11484
11487
|
this.alerting.refreshAlerts(), this.trading.refreshAccountSoon(), this.dataWindow?.isOpen() && this.dataWindow.render(this.docking.buildDataWindowModel());
|
|
11485
11488
|
}
|
|
11486
11489
|
formatMoney(e) {
|
|
11487
|
-
return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()),
|
|
11490
|
+
return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()), ou));
|
|
11488
11491
|
}
|
|
11489
11492
|
formatVolume(e) {
|
|
11490
11493
|
return et(e, this.chartSettings.settingsState.numberLocale || "en-US");
|
|
@@ -11505,7 +11508,7 @@ var uu = class {
|
|
|
11505
11508
|
});
|
|
11506
11509
|
}
|
|
11507
11510
|
indicatorValueText(e, t, n) {
|
|
11508
|
-
return t ? this.chart.formatPrice(e) :
|
|
11511
|
+
return t ? this.chart.formatPrice(e) : bc(e, n);
|
|
11509
11512
|
}
|
|
11510
11513
|
chartSetsDecimals() {
|
|
11511
11514
|
return this.chart.getMarket?.()?.pricePrecision != null || this.chart.getSymbolInfo?.()?.pricePrecision != null;
|
|
@@ -11590,7 +11593,7 @@ var uu = class {
|
|
|
11590
11593
|
}), this.updateUI();
|
|
11591
11594
|
}
|
|
11592
11595
|
lazyPart(e, t) {
|
|
11593
|
-
return new
|
|
11596
|
+
return new Rs(e, t, (e) => e.destroy(), () => this.say(this.t("common.partFailed"), "error"));
|
|
11594
11597
|
}
|
|
11595
11598
|
whenLoaded(e, t, n) {
|
|
11596
11599
|
if (!e || !t()) return;
|
|
@@ -12364,7 +12367,7 @@ var uu = class {
|
|
|
12364
12367
|
};
|
|
12365
12368
|
}
|
|
12366
12369
|
};
|
|
12367
|
-
function
|
|
12370
|
+
function pu(e, t, n) {
|
|
12368
12371
|
let r = (e) => {
|
|
12369
12372
|
let t = Rt(e.descriptor);
|
|
12370
12373
|
return t && st(e.params[t])?.instanceId || null;
|
|
@@ -12387,66 +12390,66 @@ function du(e, t, n) {
|
|
|
12387
12390
|
}
|
|
12388
12391
|
return a;
|
|
12389
12392
|
}
|
|
12390
|
-
var
|
|
12391
|
-
function
|
|
12393
|
+
var mu = "tcw:recentCommands", hu = 10;
|
|
12394
|
+
function gu() {
|
|
12392
12395
|
try {
|
|
12393
|
-
let e = JSON.parse(qr()?.getItem(
|
|
12394
|
-
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0,
|
|
12396
|
+
let e = JSON.parse(qr()?.getItem(mu) ?? "[]");
|
|
12397
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, hu) : [];
|
|
12395
12398
|
} catch {
|
|
12396
12399
|
return [];
|
|
12397
12400
|
}
|
|
12398
12401
|
}
|
|
12399
|
-
function
|
|
12402
|
+
function _u(e) {
|
|
12400
12403
|
try {
|
|
12401
|
-
qr()?.setItem(
|
|
12404
|
+
qr()?.setItem(mu, JSON.stringify(e.slice(0, hu)));
|
|
12402
12405
|
} catch {}
|
|
12403
12406
|
}
|
|
12404
|
-
var
|
|
12405
|
-
function
|
|
12407
|
+
var vu = "tcw:dockWidth";
|
|
12408
|
+
function yu() {
|
|
12406
12409
|
try {
|
|
12407
|
-
let e = Number(qr()?.getItem(
|
|
12410
|
+
let e = Number(qr()?.getItem(vu) ?? NaN);
|
|
12408
12411
|
return Number.isFinite(e) && e > 0 ? e : null;
|
|
12409
12412
|
} catch {
|
|
12410
12413
|
return null;
|
|
12411
12414
|
}
|
|
12412
12415
|
}
|
|
12413
|
-
function
|
|
12416
|
+
function bu(e) {
|
|
12414
12417
|
try {
|
|
12415
|
-
qr()?.setItem(
|
|
12418
|
+
qr()?.setItem(vu, String(e));
|
|
12416
12419
|
} catch {}
|
|
12417
12420
|
}
|
|
12418
|
-
function
|
|
12421
|
+
function xu(e) {
|
|
12419
12422
|
return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
|
|
12420
12423
|
}
|
|
12421
12424
|
//#endregion
|
|
12422
12425
|
//#region src/widget/GridLayoutPicker.ts
|
|
12423
|
-
var
|
|
12426
|
+
var Su = 2, Cu = 20, wu = 2, Tu = 16, Eu = 2, Du = 4, Ou = {
|
|
12424
12427
|
left: "grid.layoutBigLeft",
|
|
12425
12428
|
right: "grid.layoutBigRight",
|
|
12426
12429
|
top: "grid.layoutBigTop",
|
|
12427
12430
|
bottom: "grid.layoutBigBottom"
|
|
12428
12431
|
};
|
|
12429
|
-
function
|
|
12430
|
-
let r = (
|
|
12431
|
-
return [
|
|
12432
|
+
function ku(e, t, n) {
|
|
12433
|
+
let r = (Cu - wu * (n - 1)) / n;
|
|
12434
|
+
return [Su + e * (r + wu), t * r + (t - 1) * wu];
|
|
12432
12435
|
}
|
|
12433
|
-
function
|
|
12436
|
+
function Au(e, t = Tu) {
|
|
12434
12437
|
return `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${n(e).map(([t, n, r, i]) => {
|
|
12435
|
-
let [a, o] =
|
|
12438
|
+
let [a, o] = ku(t, r, e.cols), [s, c] = ku(n, i, e.rows);
|
|
12436
12439
|
return `<rect x="${a}" y="${s}" width="${o}" height="${c}" rx="1"/>`;
|
|
12437
12440
|
}).join("")}</svg>`;
|
|
12438
12441
|
}
|
|
12439
|
-
function
|
|
12442
|
+
function ju(e, t) {
|
|
12440
12443
|
let n = f[e], r = s(n);
|
|
12441
12444
|
if (r === 1) return t("grid.single");
|
|
12442
12445
|
let i = m(n);
|
|
12443
|
-
return i ? w(t(
|
|
12446
|
+
return i ? w(t(Ou[i]), { count: r }) : w(t("grid.layoutOption"), {
|
|
12444
12447
|
count: r,
|
|
12445
12448
|
cols: n.cols,
|
|
12446
12449
|
rows: n.rows
|
|
12447
12450
|
});
|
|
12448
12451
|
}
|
|
12449
|
-
var
|
|
12452
|
+
var Mu = class {
|
|
12450
12453
|
button;
|
|
12451
12454
|
panel = null;
|
|
12452
12455
|
choices;
|
|
@@ -12463,8 +12466,8 @@ var Au = class {
|
|
|
12463
12466
|
}), this.render();
|
|
12464
12467
|
}
|
|
12465
12468
|
render() {
|
|
12466
|
-
let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${
|
|
12467
|
-
this.button.innerHTML =
|
|
12469
|
+
let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${ju(n, e)}`;
|
|
12470
|
+
this.button.innerHTML = Au(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
|
|
12468
12471
|
for (let e of this.items()) e.setAttribute("aria-checked", String(e.dataset.layout === n));
|
|
12469
12472
|
}
|
|
12470
12473
|
isOpen() {
|
|
@@ -12505,15 +12508,15 @@ var Au = class {
|
|
|
12505
12508
|
return a.className = "tcw-grid-picker-row", a.append(...t.map((e) => this.item(e))), r.append(i, a), r;
|
|
12506
12509
|
}
|
|
12507
12510
|
item(e) {
|
|
12508
|
-
let t =
|
|
12509
|
-
return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML =
|
|
12511
|
+
let t = ju(e, this.options.t), n = document.createElement("button");
|
|
12512
|
+
return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML = Au(f[e]), n.addEventListener("click", () => this.pick(e)), n;
|
|
12510
12513
|
}
|
|
12511
12514
|
pick(e) {
|
|
12512
12515
|
this.close(), this.options.onPick(e), this.render();
|
|
12513
12516
|
}
|
|
12514
12517
|
place(e) {
|
|
12515
|
-
let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a -
|
|
12516
|
-
e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top +
|
|
12518
|
+
let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a - Du;
|
|
12519
|
+
e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + Eu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - Eu - Du)}px`;
|
|
12517
12520
|
}
|
|
12518
12521
|
items() {
|
|
12519
12522
|
return this.panel ? [...this.panel.querySelectorAll("[role=\"menuitemradio\"]")] : [];
|
|
@@ -12544,32 +12547,32 @@ var Au = class {
|
|
|
12544
12547
|
let o = this.rows(), s = o.findIndex((e) => e.includes(n[r])), c = o[s].indexOf(n[r]), l = o[(s + (t === "ArrowDown" ? 1 : -1) + o.length) % o.length];
|
|
12545
12548
|
return l[Math.min(c, l.length - 1)];
|
|
12546
12549
|
}
|
|
12547
|
-
},
|
|
12550
|
+
}, Nu = {
|
|
12548
12551
|
symbol: !1,
|
|
12549
12552
|
interval: !1,
|
|
12550
12553
|
crosshair: !0,
|
|
12551
12554
|
time: !1,
|
|
12552
12555
|
drawings: !1,
|
|
12553
12556
|
replay: !1
|
|
12554
|
-
},
|
|
12557
|
+
}, Pu = [
|
|
12555
12558
|
"symbol",
|
|
12556
12559
|
"interval",
|
|
12557
12560
|
"crosshair",
|
|
12558
12561
|
"time",
|
|
12559
12562
|
"drawings",
|
|
12560
12563
|
"replay"
|
|
12561
|
-
],
|
|
12562
|
-
function
|
|
12564
|
+
], Fu = f;
|
|
12565
|
+
function Iu(e) {
|
|
12563
12566
|
return JSON.parse(JSON.stringify(e));
|
|
12564
12567
|
}
|
|
12565
|
-
function
|
|
12568
|
+
function Lu(e) {
|
|
12566
12569
|
if (typeof e != "object" || !e) return null;
|
|
12567
12570
|
let t = e;
|
|
12568
12571
|
if (t.v !== 1 || t.kind !== "grid" || !r(t.layout) || !Array.isArray(t.cells)) return null;
|
|
12569
|
-
let n = t.cells.map(
|
|
12572
|
+
let n = t.cells.map(Ms);
|
|
12570
12573
|
if (n.some((e) => e === null)) return null;
|
|
12571
|
-
let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...
|
|
12572
|
-
for (let e of
|
|
12574
|
+
let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Nu };
|
|
12575
|
+
for (let e of Pu) typeof i[e] == "boolean" && (a[e] = i[e]);
|
|
12573
12576
|
let o = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
|
|
12574
12577
|
return {
|
|
12575
12578
|
v: 1,
|
|
@@ -12580,7 +12583,7 @@ function Fu(e) {
|
|
|
12580
12583
|
cells: n
|
|
12581
12584
|
};
|
|
12582
12585
|
}
|
|
12583
|
-
var
|
|
12586
|
+
var Ru = class {
|
|
12584
12587
|
root;
|
|
12585
12588
|
cellsEl;
|
|
12586
12589
|
cells = [];
|
|
@@ -12610,9 +12613,9 @@ var Iu = class {
|
|
|
12610
12613
|
};
|
|
12611
12614
|
constructor(e, t = {}) {
|
|
12612
12615
|
this.options = t, this.layout = r(t.layout) ? t.layout : "1x2", this.sync = {
|
|
12613
|
-
...
|
|
12616
|
+
...Nu,
|
|
12614
12617
|
...t.sync
|
|
12615
|
-
}, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), on(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ba(this.root, U(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.stopNarrow =
|
|
12618
|
+
}, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), on(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ba(this.root, U(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.stopNarrow = Ls(this.root), this.applyShape();
|
|
12616
12619
|
for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
|
|
12617
12620
|
this.markActive();
|
|
12618
12621
|
let n = this.cells[0]?.el.querySelector(".tcw-root")?.dataset.tcwTheme;
|
|
@@ -12738,7 +12741,7 @@ var Iu = class {
|
|
|
12738
12741
|
return JSON.stringify(this.captureLayout());
|
|
12739
12742
|
}
|
|
12740
12743
|
async applyLayoutContent(e) {
|
|
12741
|
-
let t =
|
|
12744
|
+
let t = Lu(Ns(e));
|
|
12742
12745
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
12743
12746
|
}
|
|
12744
12747
|
destroy() {
|
|
@@ -12760,7 +12763,7 @@ var Iu = class {
|
|
|
12760
12763
|
createCell(e) {
|
|
12761
12764
|
let t = document.createElement("div");
|
|
12762
12765
|
t.className = "tcw-grid-cell", t.setAttribute("role", "region"), t.setAttribute("aria-label", w(this.t("grid.chart"), { n: e + 1 })), i(t, n(f[this.layout])[e]), this.cellsEl.appendChild(t);
|
|
12763
|
-
let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new
|
|
12766
|
+
let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new fu(t, {
|
|
12764
12767
|
...r,
|
|
12765
12768
|
...a,
|
|
12766
12769
|
...a.adapter ? { feed: void 0 } : {},
|
|
@@ -12817,7 +12820,7 @@ var Iu = class {
|
|
|
12817
12820
|
t.replaySeekToTime(n);
|
|
12818
12821
|
return;
|
|
12819
12822
|
}
|
|
12820
|
-
let r =
|
|
12823
|
+
let r = zu(t.getData(), n);
|
|
12821
12824
|
r >= 0 && t.replayStart({
|
|
12822
12825
|
startIndex: r,
|
|
12823
12826
|
paused: !0
|
|
@@ -12862,7 +12865,7 @@ var Iu = class {
|
|
|
12862
12865
|
copyDrawings(e) {
|
|
12863
12866
|
let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
|
|
12864
12867
|
this.quietly(() => {
|
|
12865
|
-
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(
|
|
12868
|
+
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Iu(n));
|
|
12866
12869
|
});
|
|
12867
12870
|
}
|
|
12868
12871
|
mergeDrawings() {
|
|
@@ -12874,7 +12877,7 @@ var Iu = class {
|
|
|
12874
12877
|
let e = /* @__PURE__ */ new Map();
|
|
12875
12878
|
for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
|
|
12876
12879
|
let n = [...e.values()];
|
|
12877
|
-
for (let e of t) e.widget.getChart().setDrawings(
|
|
12880
|
+
for (let e of t) e.widget.getChart().setDrawings(Iu(n));
|
|
12878
12881
|
}
|
|
12879
12882
|
});
|
|
12880
12883
|
}
|
|
@@ -12911,7 +12914,7 @@ var Iu = class {
|
|
|
12911
12914
|
let t = document.createElement("div");
|
|
12912
12915
|
t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
|
|
12913
12916
|
let n = this.options.layoutChoices?.filter(r) ?? l;
|
|
12914
|
-
n.length > 0 && (this.layoutPicker = new
|
|
12917
|
+
n.length > 0 && (this.layoutPicker = new Mu({
|
|
12915
12918
|
host: this.root,
|
|
12916
12919
|
t: this.t,
|
|
12917
12920
|
choices: n,
|
|
@@ -12922,7 +12925,7 @@ var Iu = class {
|
|
|
12922
12925
|
i.className = "tcw-grid-group", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.t("grid.sync"));
|
|
12923
12926
|
let a = document.createElement("span");
|
|
12924
12927
|
a.className = "tcw-grid-label", a.innerHTML = `${x("link", 13)}<span>${S(this.t("grid.sync"))}</span>`, i.appendChild(a);
|
|
12925
|
-
for (let e of
|
|
12928
|
+
for (let e of Pu) {
|
|
12926
12929
|
let t = document.createElement("button");
|
|
12927
12930
|
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), i.appendChild(t);
|
|
12928
12931
|
}
|
|
@@ -12966,7 +12969,7 @@ var Iu = class {
|
|
|
12966
12969
|
onChange: () => this.renderLayoutsButton(),
|
|
12967
12970
|
onError: () => this.toast(this.t("layouts.saveFailed"), "error")
|
|
12968
12971
|
});
|
|
12969
|
-
this.session = t, this.layoutsUI = new
|
|
12972
|
+
this.session = t, this.layoutsUI = new gl(t, {
|
|
12970
12973
|
root: this.root,
|
|
12971
12974
|
t: this.t,
|
|
12972
12975
|
toast: (e, t) => this.toast(e, t),
|
|
@@ -12980,12 +12983,12 @@ var Iu = class {
|
|
|
12980
12983
|
this.cells[this.active]?.widget.toast(e, t);
|
|
12981
12984
|
}
|
|
12982
12985
|
};
|
|
12983
|
-
function
|
|
12986
|
+
function zu(e, t) {
|
|
12984
12987
|
let n = -1;
|
|
12985
12988
|
for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
|
|
12986
12989
|
return n;
|
|
12987
12990
|
}
|
|
12988
12991
|
//#endregion
|
|
12989
|
-
export { Se as CHART_TYPE_ICONS,
|
|
12992
|
+
export { Se as CHART_TYPE_ICONS, fu as ChartWidget, Ru as ChartWidgetGrid, Nu as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, Fu as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, fa as WIDGET_UI_PRESETS, ba as applyWidgetUI, d as cleanLayoutName, Ce as createChartTypeIcon, x as createIcon, b as createToolIcon, ze as findWidgetLocale, be as iconSvg, o as localStorageLayouts, t as memoryLayouts, Lu as readGridLayout, oi as readWatchlists, Ms as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, ya as widgetUIVariables };
|
|
12990
12993
|
|
|
12991
12994
|
//# sourceMappingURL=index.js.map
|