@tradecanvas/chart 1.83.1 → 1.84.1
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/Chart.d.ts +28 -1
- package/dist/Chart.d.ts.map +1 -1
- package/dist/{LayoutSession--k_77YkA.js → LayoutSession-BhA7O3fL.js} +443 -424
- package/dist/LayoutSession-BhA7O3fL.js.map +1 -0
- package/dist/LayoutSession-Cj6jHPeY.cjs +2 -0
- package/dist/LayoutSession-Cj6jHPeY.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/model/PaneLayout.d.ts +1 -1
- package/dist/model/PaneLayout.d.ts.map +1 -1
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetDockArea.d.ts +7 -0
- package/dist/widget/WidgetDockArea.d.ts.map +1 -1
- package/dist/widget/WidgetLegendView.d.ts.map +1 -1
- package/dist/widget/index.cjs +2 -2
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +10 -4
- package/dist/widget/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession--k_77YkA.js.map +0 -1
- package/dist/LayoutSession-CEqWF-nM.cjs +0 -2
- package/dist/LayoutSession-CEqWF-nM.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./indicatorLabel-BsidWCv1.js";
|
|
2
2
|
import { DARK_THEME as t, DEFAULT_PANEL_HEIGHT as n, LIGHT_THEME as r, LayerType as i, MIN_PANEL_HEIGHT as a, PHI as o, PRICE_AXIS_WIDTH as s, TIME_AXIS_HEIGHT as c, autoPricePrecision as l, barDateZone as u, barTimeUnit as d, barsAreDaily as f, chartStyleValue as p, computePriceLimits as m, computePriceRange as h, createMarketTheme as g, formatPrice as _, fractionTick as v, indicatorSource as y, isValidTimeZone as b, mergeBar as ee, niceNumber as te, normalizeBarTime as x, parseIndicatorSource as S, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as C, readIndicatorPlotStyles as ae, readPaneStyle as oe, resolveChartTheme as se, sessionMinute as w, setLocale as ce, stepDecimals as le, symbolTimeZone as T, tickBarCount as ue, timeframeToMs as E, zonedDateFormatter as de } from "@tradecanvas/commons";
|
|
3
|
-
import { AlertDragHandler as fe, AlertManager as pe, Animator as me, AreaRenderer as he, AxisDragHandler as ge, BarCountdown as _e, BarRenderer as ve, BaselineRenderer as ye, CandlestickRenderer as be, ChartLegend as xe, ChartStateManager as D, CompareRenderer as Se, CompareSymbolIndicator as Ce, CompareSymbolPaneIndicator as we, CorrelationCoefficientIndicator as Te, CorrelationLogIndicator as Ee, CrosshairHandler as De, CrosshairTooltip as Oe, CurrentPriceLine as ke, DEFAULT_SESSION_HOURS as Ae, DataExporter as O, DepthHeatmapRenderer as je, DrawingManager as Me, DrawingRenderer as Ne, EquivolumeRenderer as Pe, EventBus as Fe, GridRenderer as Ie, HLCAreaRenderer as Le, HiLoRenderer as Re, HollowCandleRenderer as ze,
|
|
3
|
+
import { AlertDragHandler as fe, AlertManager as pe, Animator as me, AreaRenderer as he, AxisDragHandler as ge, BarCountdown as _e, BarRenderer as ve, BaselineRenderer as ye, CandlestickRenderer as be, ChartLegend as xe, ChartStateManager as D, CompareRenderer as Se, CompareSymbolIndicator as Ce, CompareSymbolPaneIndicator as we, CorrelationCoefficientIndicator as Te, CorrelationLogIndicator as Ee, CrosshairHandler as De, CrosshairTooltip as Oe, CurrentPriceLine as ke, DEFAULT_SESSION_HOURS as Ae, DataExporter as O, DepthHeatmapRenderer as je, DrawingManager as Me, DrawingRenderer as Ne, EquivolumeRenderer as Pe, EventBus as Fe, GridRenderer as Ie, HLCAreaRenderer as Le, HiLoRenderer as Re, HollowCandleRenderer as ze, INDICATOR_WORKER_MIN_BARS as Be, IndicatorEngine as Ve, InteractionManager as He, KagiRenderer as Ue, KeyboardHandler as We, LineRenderer as Ge, LineWithMarkersRenderer as Ke, MarketProfileRenderer as qe, MeasureOverlay as Je, PRICE_AXIS_ADD_STRIP as Ye, PRICE_SCALE_MARGIN as k, PanHandler as Xe, PaneResizeHandler as Ze, PeriodLevelsRenderer as Qe, PinnedTooltip as $e, PivotMarkersRenderer as et, PointAndFigureRenderer as tt, PriceAxis as nt, PriceAxisAddButton as rt, PriceLines as it, RenderEngine as at, RenkoRenderer as ot, ReplayManager as st, ResamplingAdapter as ct, ReshapeMemo as lt, SYMBOL_INDICATOR_IDS as ut, SYMBOL_ZONE_WAIT_MS as dt, Screenshot as A, SelectionBoxOverlay as ft, SessionBreaks as pt, SessionShading as mt, SignalMarkerManager as ht, SpreadIndicator as gt, StepLineRenderer as _t, StreamManager as vt, SymbolSeriesStore as yt, TimeAxis as bt, TradeZoneManager as xt, TradingManager as St, TradingRenderer as Ct, UndoRedoManager as wt, Viewport as Tt, VolumeCandleRenderer as Et, VolumeProfileRenderer as Dt, VolumeRenderer as Ot, Watermark as kt, ZoomHandler as At, axisTimes as jt, barTimeStepMs as Mt, findDominantSwing as Nt, gpuContextsLeft as Pt, idleCssCursor as Ft, indicatorWorkerPool as It, isCrosshairCursor as Lt, isPriceLevelAlert as Rt, isRegularSession as zt, loadWebGL as Bt, mergeSessionHours as Vt, pointAndFigureColumns as Ht, rangePresetStart as Ut, readAlertOptions as Wt, registerBuiltInDrawingTools as Gt, registerBuiltInIndicators as Kt, servesTimeframe as j, sourceParam as M, streamAdapterOf as qt, timestampToBarIndex as N, toHeikinAshi as Jt, toKagi as Yt, toLineBreak as Xt, toRangeBars as Zt, toRenko as Qt, whenGpuContextFree as $t, withResampling as P, xToBarIndex as en, xToTime as F, yToPrice as tn } from "@tradecanvas/core";
|
|
4
4
|
//#region src/regularHours.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var nn = 864e5, rn = 10;
|
|
6
|
+
function an(e, t) {
|
|
7
7
|
let n = T(e);
|
|
8
8
|
if (!n || !b(n) || t.length < 2) return null;
|
|
9
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
@@ -15,34 +15,34 @@ function nn(e, t) {
|
|
|
15
15
|
});
|
|
16
16
|
if (r.length === 0) return null;
|
|
17
17
|
let i = d(t), a = Infinity;
|
|
18
|
-
for (let e = Math.max(1, t.length -
|
|
18
|
+
for (let e = Math.max(1, t.length - rn); e < t.length; e++) {
|
|
19
19
|
let n = (t[e].time - t[e - 1].time) * i;
|
|
20
20
|
n > 0 && n < a && (a = n);
|
|
21
21
|
}
|
|
22
|
-
if (!(a <
|
|
22
|
+
if (!(a < nn)) return null;
|
|
23
23
|
let o = {
|
|
24
24
|
timeZone: n,
|
|
25
25
|
windows: r,
|
|
26
26
|
startMinute: r[0].startMinute,
|
|
27
27
|
endMinute: r[r.length - 1].endMinute
|
|
28
28
|
};
|
|
29
|
-
return (e) =>
|
|
29
|
+
return (e) => zt(e * i, o);
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/chartA11y.ts
|
|
33
|
-
var
|
|
33
|
+
var on = {
|
|
34
34
|
role: "chart",
|
|
35
35
|
summary: "{what}. Last price {close}.",
|
|
36
36
|
empty: "Chart, no data.",
|
|
37
37
|
view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
|
|
38
38
|
bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
|
|
39
39
|
keys: "Arrow keys scroll and zoom, Home and End go to the start and the end. Comma and period read the bars one at a time."
|
|
40
|
-
}, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e),
|
|
40
|
+
}, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), sn = [
|
|
41
41
|
"role",
|
|
42
42
|
"aria-roledescription",
|
|
43
43
|
"aria-label",
|
|
44
44
|
"aria-describedby"
|
|
45
|
-
],
|
|
45
|
+
], cn = 400, ln = 1e3, un = class {
|
|
46
46
|
live;
|
|
47
47
|
help;
|
|
48
48
|
labels;
|
|
@@ -56,20 +56,20 @@ var rn = {
|
|
|
56
56
|
};
|
|
57
57
|
constructor(e, t, n = {}) {
|
|
58
58
|
this.container = e, this.source = t, this.labels = {
|
|
59
|
-
...
|
|
59
|
+
...on,
|
|
60
60
|
...n
|
|
61
61
|
};
|
|
62
|
-
for (let t of
|
|
63
|
-
e.setAttribute("role", "application"), this.help =
|
|
62
|
+
for (let t of sn) this.before.set(t, e.getAttribute(t));
|
|
63
|
+
e.setAttribute("role", "application"), this.help = dn("div", "tc-sr-only"), this.help.id = `tc-chart-keys-${Math.random().toString(36).slice(2, 10)}`, e.setAttribute("aria-describedby", this.help.id), this.live = dn("div", "tc-sr-only tc-sr-live"), this.live.setAttribute("aria-live", "polite"), this.live.setAttribute("aria-atomic", "true"), e.append(this.help, this.live), e.addEventListener("blur", this.onBlur), this.applyLabels();
|
|
64
64
|
}
|
|
65
65
|
setLabels(e) {
|
|
66
66
|
this.labels = {
|
|
67
|
-
...
|
|
67
|
+
...on,
|
|
68
68
|
...e
|
|
69
69
|
}, this.applyLabels();
|
|
70
70
|
}
|
|
71
71
|
refresh(e = !1) {
|
|
72
|
-
let t =
|
|
72
|
+
let t = ln - (Date.now() - this.summaryAt);
|
|
73
73
|
if (e || t <= 0 || this.container.getAttribute("aria-label") === this.labels.empty) {
|
|
74
74
|
this.summaryTimer && clearTimeout(this.summaryTimer), this.summaryTimer = null, this.summaryAt = Date.now(), this.container.setAttribute("aria-label", this.summary());
|
|
75
75
|
return;
|
|
@@ -81,7 +81,7 @@ var rn = {
|
|
|
81
81
|
viewMoved() {
|
|
82
82
|
this.cursor = null, this.viewTimer && clearTimeout(this.viewTimer), this.viewTimer = setTimeout(() => {
|
|
83
83
|
this.viewTimer = null, this.say(this.viewText());
|
|
84
|
-
},
|
|
84
|
+
}, cn);
|
|
85
85
|
}
|
|
86
86
|
readBar(e) {
|
|
87
87
|
let t = this.source.bars();
|
|
@@ -100,7 +100,7 @@ var rn = {
|
|
|
100
100
|
high: a(i.high),
|
|
101
101
|
low: a(i.low),
|
|
102
102
|
close: a(i.close),
|
|
103
|
-
volume:
|
|
103
|
+
volume: fn(i.volume ?? 0)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
destroy() {
|
|
@@ -141,7 +141,7 @@ var rn = {
|
|
|
141
141
|
this.live.textContent = e;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
function
|
|
144
|
+
function dn(e, t) {
|
|
145
145
|
let n = document.createElement(e);
|
|
146
146
|
return n.className = t, Object.assign(n.style, {
|
|
147
147
|
position: "absolute",
|
|
@@ -155,57 +155,57 @@ function ln(e, t) {
|
|
|
155
155
|
border: "0"
|
|
156
156
|
}), n;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function fn(e) {
|
|
159
159
|
return Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region src/charts/ChartTypeStrategy.ts
|
|
163
|
-
function
|
|
163
|
+
function pn(e) {
|
|
164
164
|
switch (e) {
|
|
165
165
|
case "candlestick":
|
|
166
166
|
case "heikinAshi":
|
|
167
167
|
case "lineBreak":
|
|
168
168
|
case "rangeBars": return new be();
|
|
169
|
-
case "line": return new
|
|
169
|
+
case "line": return new Ge();
|
|
170
170
|
case "area": return new he();
|
|
171
171
|
case "bar": return new ve();
|
|
172
172
|
case "hollowCandle": return new ze();
|
|
173
173
|
case "baseline": return new ye();
|
|
174
|
-
case "renko": return new
|
|
175
|
-
case "kagi": return new
|
|
176
|
-
case "pointAndFigure": return new
|
|
177
|
-
case "volumeCandles": return new
|
|
174
|
+
case "renko": return new ot();
|
|
175
|
+
case "kagi": return new Ue();
|
|
176
|
+
case "pointAndFigure": return new tt();
|
|
177
|
+
case "volumeCandles": return new Et();
|
|
178
178
|
case "equivolume": return new Pe();
|
|
179
179
|
case "hlcArea": return new Le();
|
|
180
|
-
case "stepLine": return new
|
|
181
|
-
case "lineWithMarkers": return new
|
|
180
|
+
case "stepLine": return new _t();
|
|
181
|
+
case "lineWithMarkers": return new Ke();
|
|
182
182
|
case "hiLo": return new Re();
|
|
183
183
|
default: return new be();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function mn(e, t, n = {}, r, i) {
|
|
187
187
|
if (t.length === 0) return t;
|
|
188
188
|
switch (e) {
|
|
189
|
-
case "heikinAshi": return
|
|
189
|
+
case "heikinAshi": return Jt(t);
|
|
190
190
|
case "renko": {
|
|
191
191
|
let e = n.renko?.boxSize;
|
|
192
|
-
return typeof e == "number" ?
|
|
192
|
+
return typeof e == "number" ? Qt(t, { brickSize: e }, i) : Qt(t, {
|
|
193
193
|
brickSize: 0,
|
|
194
194
|
useATR: !0,
|
|
195
195
|
atrPeriod: n.renko?.atrPeriod ?? 14
|
|
196
196
|
}, i);
|
|
197
197
|
}
|
|
198
|
-
case "lineBreak": return
|
|
199
|
-
case "kagi": return
|
|
200
|
-
case "pointAndFigure": return
|
|
201
|
-
case "rangeBars": return
|
|
202
|
-
rangeSize:
|
|
198
|
+
case "lineBreak": return Xt(t, n.lineBreak?.lines ?? 3);
|
|
199
|
+
case "kagi": return Yt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
200
|
+
case "pointAndFigure": return gn(t, n, i).columns;
|
|
201
|
+
case "rangeBars": return Zt(t, {
|
|
202
|
+
rangeSize: Tn(t, n, r),
|
|
203
203
|
includeForming: !0
|
|
204
204
|
}, i);
|
|
205
205
|
default: return t;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function hn(e) {
|
|
209
209
|
switch (e) {
|
|
210
210
|
case "heikinAshi":
|
|
211
211
|
case "renko":
|
|
@@ -217,71 +217,71 @@ function pn(e) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function L(e) {
|
|
220
|
-
return e !== "heikinAshi" &&
|
|
220
|
+
return e !== "heikinAshi" && hn(e);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
222
|
+
function gn(e, t = {}, n) {
|
|
223
|
+
return Ht(e, yn(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
225
|
+
var _n = 50, vn = .01;
|
|
226
|
+
function yn(e, t = {}) {
|
|
227
227
|
let n = t.pointAndFigure?.boxSize;
|
|
228
228
|
if (typeof n == "number") return n;
|
|
229
|
-
let r =
|
|
230
|
-
return r > 0 ? R(te(r /
|
|
229
|
+
let r = bn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
230
|
+
return r > 0 ? R(te(r / _n, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * vn || 1;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function bn(e, t) {
|
|
233
233
|
let n = -Infinity, r = Infinity;
|
|
234
234
|
for (let i = 0; i < t; i++) e[i].high > n && (n = e[i].high), e[i].low < r && (r = e[i].low);
|
|
235
235
|
let i = n - r;
|
|
236
236
|
return Number.isFinite(i) ? i : 0;
|
|
237
237
|
}
|
|
238
|
-
var
|
|
239
|
-
function
|
|
238
|
+
var xn = 100, Sn = 3, Cn = .01, wn = 15, R = (e) => Number(e.toPrecision(wn));
|
|
239
|
+
function Tn(e, t = {}, n) {
|
|
240
240
|
let r = t.rangeBars?.range;
|
|
241
241
|
if (typeof r == "number") return r;
|
|
242
|
-
let i = e.length >=
|
|
243
|
-
return
|
|
242
|
+
let i = e.length >= Sn ? Dn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
243
|
+
return An(R(te(i > 0 ? i : a * Cn || 1, !0)), n);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function En(e) {
|
|
246
246
|
let t = e.length - 1;
|
|
247
247
|
return {
|
|
248
|
-
from: Math.max(0, t -
|
|
248
|
+
from: Math.max(0, t - xn),
|
|
249
249
|
end: t
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
let { from: t, end: n } =
|
|
252
|
+
function Dn(e) {
|
|
253
|
+
let { from: t, end: n } = En(e), r = 0;
|
|
254
254
|
for (let i = t; i < n; i++) {
|
|
255
255
|
let { high: t, low: n } = e[i], a = i > 0 ? e[i - 1].close : n;
|
|
256
256
|
r += Math.max(t - n, Math.abs(t - a), Math.abs(n - a));
|
|
257
257
|
}
|
|
258
258
|
return n > t ? r / (n - t) : 0;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
let { from: n, end: r } =
|
|
260
|
+
function On(e, t) {
|
|
261
|
+
let { from: n, end: r } = En(e);
|
|
262
262
|
if (r <= n) return t(e[e.length - 1]?.close ?? 0);
|
|
263
263
|
let i = -Infinity, a = Infinity;
|
|
264
264
|
for (let t = n; t < r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
265
|
-
return
|
|
265
|
+
return kn(t(i), t(a));
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function kn(e, t) {
|
|
268
268
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function An(e, t) {
|
|
271
271
|
return t === void 0 || !(t > 0) ? e : R(Math.max(1, Math.round(e / t)) * t);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function jn(e, t) {
|
|
274
274
|
let n = t?.(e);
|
|
275
|
-
return n ? n.createRenderer() :
|
|
275
|
+
return n ? n.createRenderer() : pn(e);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Mn(e, t, n, r, i, a) {
|
|
278
278
|
if (t.length === 0) return t;
|
|
279
279
|
let o = n?.(e);
|
|
280
|
-
return o?.transform ? o.transform(t) :
|
|
280
|
+
return o?.transform ? o.transform(t) : mn(e, t, r, i, a);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/state/AutoSaveScheduler.ts
|
|
284
|
-
var
|
|
284
|
+
var Nn = class {
|
|
285
285
|
timer = null;
|
|
286
286
|
delayMs = 0;
|
|
287
287
|
key = null;
|
|
@@ -316,7 +316,7 @@ function z(e) {
|
|
|
316
316
|
let { open: t, high: n, low: r, close: i } = e;
|
|
317
317
|
return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Pn(e) {
|
|
320
320
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
321
321
|
}
|
|
322
322
|
function B(e) {
|
|
@@ -330,24 +330,24 @@ function B(e) {
|
|
|
330
330
|
function V(e, t) {
|
|
331
331
|
return e === t || e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Fn(e, t) {
|
|
334
334
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
335
335
|
if (e[n].time === t) return n;
|
|
336
336
|
if (e[n].time < t) return -1;
|
|
337
337
|
}
|
|
338
338
|
return -1;
|
|
339
339
|
}
|
|
340
|
-
var
|
|
340
|
+
var In = {
|
|
341
341
|
index: -1,
|
|
342
342
|
changed: !1
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function Ln(e, t) {
|
|
345
345
|
if (e.length === 0) return t;
|
|
346
346
|
let n = x(t);
|
|
347
347
|
return d(e) === 1 ? n : n / 1e3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
let n =
|
|
349
|
+
function Rn(e, t) {
|
|
350
|
+
let n = Ln(e, t.time);
|
|
351
351
|
return n === t.time ? t : {
|
|
352
352
|
...t,
|
|
353
353
|
time: n
|
|
@@ -357,7 +357,7 @@ var H = class {
|
|
|
357
357
|
data = [];
|
|
358
358
|
changes = 0;
|
|
359
359
|
withSeriesTime(e) {
|
|
360
|
-
return
|
|
360
|
+
return Rn(this.data, e);
|
|
361
361
|
}
|
|
362
362
|
getData() {
|
|
363
363
|
return this.data;
|
|
@@ -369,7 +369,7 @@ var H = class {
|
|
|
369
369
|
let t = [];
|
|
370
370
|
for (let n = 0; n < e.length; n++) {
|
|
371
371
|
let r = e[n];
|
|
372
|
-
z(r) && t.push(
|
|
372
|
+
z(r) && t.push(Pn(r) ? r : B(r));
|
|
373
373
|
}
|
|
374
374
|
this.data = t, this.changes++;
|
|
375
375
|
}
|
|
@@ -378,7 +378,7 @@ var H = class {
|
|
|
378
378
|
for (let r = 0; r < e.length; r++) {
|
|
379
379
|
if (!z(e[r])) continue;
|
|
380
380
|
let i = this.withSeriesTime(e[r]);
|
|
381
|
-
i.time >= t || n.push(
|
|
381
|
+
i.time >= t || n.push(Pn(i) ? i : B(i));
|
|
382
382
|
}
|
|
383
383
|
if (n.length === 0) return 0;
|
|
384
384
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -399,9 +399,9 @@ var H = class {
|
|
|
399
399
|
this.data[this.data.length - 1] = t;
|
|
400
400
|
}
|
|
401
401
|
replaceBar(e) {
|
|
402
|
-
if (!z(e)) return
|
|
403
|
-
let t = this.withSeriesTime(e), n =
|
|
404
|
-
if (n < 0) return
|
|
402
|
+
if (!z(e)) return In;
|
|
403
|
+
let t = this.withSeriesTime(e), n = Fn(this.data, t.time);
|
|
404
|
+
if (n < 0) return In;
|
|
405
405
|
let r = B(t);
|
|
406
406
|
return V(this.data[n], r) ? {
|
|
407
407
|
index: n,
|
|
@@ -431,7 +431,7 @@ function W(e, t) {
|
|
|
431
431
|
let r = x(t.time), i = x(n.time);
|
|
432
432
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function zn(e) {
|
|
435
435
|
return [
|
|
436
436
|
e.time,
|
|
437
437
|
e.open,
|
|
@@ -440,7 +440,7 @@ function Ln(e) {
|
|
|
440
440
|
e.close
|
|
441
441
|
].every(Number.isFinite);
|
|
442
442
|
}
|
|
443
|
-
var
|
|
443
|
+
var Bn = class {
|
|
444
444
|
shown = new H();
|
|
445
445
|
whole = null;
|
|
446
446
|
aside = null;
|
|
@@ -483,7 +483,7 @@ var Rn = class {
|
|
|
483
483
|
}
|
|
484
484
|
let t = null, n = e;
|
|
485
485
|
if (this.whole) {
|
|
486
|
-
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(
|
|
486
|
+
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(zn).map((e) => this.inSeriesUnit(e)).filter((e) => (r === void 0 || e.time < r) && !i.has(e.time) && i.add(e.time)).sort((e, t) => e.time - t.time);
|
|
487
487
|
this.whole = [...a, ...this.whole];
|
|
488
488
|
let o = this.hoursFilter(this.whole);
|
|
489
489
|
t = a.length, n = o ? a.filter((e) => o(e.time)) : a;
|
|
@@ -495,8 +495,8 @@ var Rn = class {
|
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
497
|
mergeSnapshot(e) {
|
|
498
|
-
if (this.aside) return this.aside.setData(
|
|
499
|
-
let t =
|
|
498
|
+
if (this.aside) return this.aside.setData(Vn(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = Vn(this.whole ?? this.shown.getData(), e);
|
|
500
500
|
return t ? (this.shown.setData(this.regularOnly(t)), !0) : !1;
|
|
501
501
|
}
|
|
502
502
|
refilter() {
|
|
@@ -553,7 +553,7 @@ var Rn = class {
|
|
|
553
553
|
mergeTick(e) {
|
|
554
554
|
if (this.aside) return this.aside.updateLastBarFromTick(e), this.wrote("aside", !1);
|
|
555
555
|
let t = this.whole ? this.hoursFilter(this.whole) : null;
|
|
556
|
-
if (t && this.whole && !t(
|
|
556
|
+
if (t && this.whole && !t(Ln(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
557
557
|
let n = this.shown.getLength();
|
|
558
558
|
this.shown.updateLastBarFromTick(e);
|
|
559
559
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -596,7 +596,7 @@ var Rn = class {
|
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
if (!z(e)) return U;
|
|
599
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Fn(n, t.time) : -1;
|
|
600
600
|
if (n) {
|
|
601
601
|
if (r < 0 || !z(n[r])) return U;
|
|
602
602
|
let e = this.hoursFilter(n);
|
|
@@ -630,7 +630,7 @@ var Rn = class {
|
|
|
630
630
|
this.shown.updateLastBar(e);
|
|
631
631
|
}
|
|
632
632
|
inSeriesUnit(e) {
|
|
633
|
-
return
|
|
633
|
+
return Rn(this.whole ?? this.shown.getData(), e);
|
|
634
634
|
}
|
|
635
635
|
replaceHidden(e, t, n) {
|
|
636
636
|
let r = B(n), i = !V(e[t], r);
|
|
@@ -667,14 +667,14 @@ var Rn = class {
|
|
|
667
667
|
return !r || r(e.time);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
function
|
|
670
|
+
function Vn(e, t) {
|
|
671
671
|
let n = t[0]?.time, r = 0;
|
|
672
672
|
for (; n !== void 0 && r < e.length && e[r].time < n;) r++;
|
|
673
673
|
return r === 0 || r === e.length ? null : e.slice(0, r).concat(t);
|
|
674
674
|
}
|
|
675
675
|
//#endregion
|
|
676
676
|
//#region src/model/PriceFit.ts
|
|
677
|
-
var
|
|
677
|
+
var Hn = o ** -7, Un = class {
|
|
678
678
|
auto;
|
|
679
679
|
preferred;
|
|
680
680
|
pending = !0;
|
|
@@ -707,7 +707,7 @@ var Bn = o ** -7, Vn = class {
|
|
|
707
707
|
}
|
|
708
708
|
fit(e, t, n, r) {
|
|
709
709
|
if (t.length === 0) return;
|
|
710
|
-
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o =
|
|
710
|
+
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o = Gn(Gn(h(t, i, a, 0), r.overlayRange(i, a)), r.compareRange(t, n)), s = r.volumeRatio(t, i, a), c = s === null ? k : s + Hn;
|
|
711
711
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
712
712
|
top: c,
|
|
713
713
|
bottom: k
|
|
@@ -717,11 +717,11 @@ var Bn = o ** -7, Vn = class {
|
|
|
717
717
|
}), e.fitToPrices(o.min, o.max);
|
|
718
718
|
}
|
|
719
719
|
};
|
|
720
|
-
function
|
|
720
|
+
function Wn(e, t, n) {
|
|
721
721
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
722
722
|
return !1;
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Gn(e, t) {
|
|
725
725
|
return e ? t ? {
|
|
726
726
|
min: Math.min(e.min, t.min),
|
|
727
727
|
max: Math.max(e.max, t.max)
|
|
@@ -729,18 +729,18 @@ function Un(e, t) {
|
|
|
729
729
|
}
|
|
730
730
|
//#endregion
|
|
731
731
|
//#region src/model/DisplaySeries.ts
|
|
732
|
-
var
|
|
732
|
+
var Kn = class {
|
|
733
733
|
series = null;
|
|
734
734
|
madeAt = null;
|
|
735
735
|
epoch = 0;
|
|
736
|
-
memo = new
|
|
736
|
+
memo = new lt();
|
|
737
737
|
constructor(e) {
|
|
738
738
|
this.sources = e;
|
|
739
739
|
}
|
|
740
740
|
get() {
|
|
741
741
|
let e = this.sources.bars();
|
|
742
742
|
if (e.length === 0) return e;
|
|
743
|
-
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ?
|
|
743
|
+
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ? On(e, (e) => this.sources.stepAt(e)) : void 0, i = this.sources.version(), a = this.madeAt;
|
|
744
744
|
return this.series && a && a.version === i && a.type === t && a.options === n && a.step === r && a.epoch === this.epoch ? this.series : (this.series = this.make(t, e, n, r), this.madeAt = {
|
|
745
745
|
version: i,
|
|
746
746
|
type: t,
|
|
@@ -757,14 +757,14 @@ var Wn = class {
|
|
|
757
757
|
}
|
|
758
758
|
make(e, t, n, r) {
|
|
759
759
|
let { lookup: i } = this.sources;
|
|
760
|
-
if (e !== "pointAndFigure" || i(e)) return
|
|
761
|
-
let { columns: a, boxSize: o } =
|
|
760
|
+
if (e !== "pointAndFigure" || i(e)) return Mn(e, t, i, n, r, this.memo);
|
|
761
|
+
let { columns: a, boxSize: o } = gn(t, n, this.memo);
|
|
762
762
|
return this.sources.onBoxSize(o), a;
|
|
763
763
|
}
|
|
764
|
-
},
|
|
764
|
+
}, qn = {
|
|
765
765
|
min: 0,
|
|
766
766
|
max: 100
|
|
767
|
-
},
|
|
767
|
+
}, Jn = class {
|
|
768
768
|
layout = null;
|
|
769
769
|
infos = null;
|
|
770
770
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -772,7 +772,7 @@ var Wn = class {
|
|
|
772
772
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
773
773
|
}
|
|
774
774
|
resolved() {
|
|
775
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
775
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(Yn(this.layout))), this.layout;
|
|
776
776
|
}
|
|
777
777
|
invalidate() {
|
|
778
778
|
this.layout = null, this.infos = null;
|
|
@@ -784,7 +784,7 @@ var Wn = class {
|
|
|
784
784
|
if (this.infos) return this.infos;
|
|
785
785
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
786
786
|
return this.infos = this.resolved().panels.map((e) => {
|
|
787
|
-
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...
|
|
787
|
+
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...qn }, s = this.styles.get(i);
|
|
788
788
|
return {
|
|
789
789
|
instanceId: i,
|
|
790
790
|
members: this.sources.getPaneMembers(i),
|
|
@@ -833,7 +833,7 @@ var Wn = class {
|
|
|
833
833
|
this.styles.delete(e), t && n && this.styles.set(t, n), this.infos = null;
|
|
834
834
|
}
|
|
835
835
|
baseline(e, t, n) {
|
|
836
|
-
let r = this.sources.
|
|
836
|
+
let r = this.sources.peekOutput(e)?.series, i = this.sources.getIndicatorDescriptor(e);
|
|
837
837
|
if (!r || !i) return;
|
|
838
838
|
let a = i.plots?.[0]?.key;
|
|
839
839
|
for (let e = Math.max(0, t); e <= n && e < r.length; e++) {
|
|
@@ -844,7 +844,7 @@ var Wn = class {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
};
|
|
847
|
-
function
|
|
847
|
+
function Yn(e) {
|
|
848
848
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
849
849
|
for (let t of e.panels) t.config.position !== "top" && t.config.position !== "bottom" || (n = Math.min(n, t.rect.y), r = Math.max(r, t.rect.y + t.rect.height));
|
|
850
850
|
return {
|
|
@@ -852,10 +852,10 @@ function qn(e) {
|
|
|
852
852
|
bottom: r
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function Xn(e) {
|
|
856
856
|
return e.length > 0 ? { renames: e } : {};
|
|
857
857
|
}
|
|
858
|
-
var G = (e, t) => JSON.stringify(e) === JSON.stringify(t),
|
|
858
|
+
var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
859
859
|
steps;
|
|
860
860
|
snapshot;
|
|
861
861
|
enabled;
|
|
@@ -891,7 +891,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
891
891
|
...o,
|
|
892
892
|
after: n,
|
|
893
893
|
at: i,
|
|
894
|
-
...
|
|
894
|
+
...Xn([...o.renames ?? [], ...r])
|
|
895
895
|
}
|
|
896
896
|
}) : this.steps.push({
|
|
897
897
|
...c,
|
|
@@ -900,7 +900,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
900
900
|
after: n,
|
|
901
901
|
subject: e,
|
|
902
902
|
at: i,
|
|
903
|
-
...
|
|
903
|
+
...Xn(r)
|
|
904
904
|
}
|
|
905
905
|
});
|
|
906
906
|
}
|
|
@@ -938,7 +938,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
938
938
|
}
|
|
939
939
|
});
|
|
940
940
|
}
|
|
941
|
-
},
|
|
941
|
+
}, Qn = class {
|
|
942
942
|
constructor(e, t, n) {
|
|
943
943
|
this.members = e, this.slots = t, this.handover = n;
|
|
944
944
|
}
|
|
@@ -1017,7 +1017,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
//#endregion
|
|
1019
1019
|
//#region src/model/IndicatorSetup.ts
|
|
1020
|
-
function
|
|
1020
|
+
function $n(e, t, n) {
|
|
1021
1021
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1022
1022
|
return e.getActiveIndicators().map((t) => {
|
|
1023
1023
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1045,7 +1045,7 @@ function Zn(e, t, n) {
|
|
|
1045
1045
|
};
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1048
|
+
function er(e, t) {
|
|
1049
1049
|
for (let [n, r] of t) n.paneSize !== void 0 && e.setPanelSize(r, n.paneSize), (n.paneSize !== void 0 || n.paneCollapsed) && e.setPanelCollapsed(r, !!n.paneCollapsed), n.paneSize !== void 0 && e.setPanelScale(r, {
|
|
1050
1050
|
log: !!n.paneLog,
|
|
1051
1051
|
invert: !!n.paneInvert,
|
|
@@ -1056,7 +1056,7 @@ function Qn(e, t) {
|
|
|
1056
1056
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1057
1057
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function tr(e) {
|
|
1060
1060
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1061
1061
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1062
1062
|
i.add(e.instanceId);
|
|
@@ -1070,23 +1070,23 @@ function $n(e) {
|
|
|
1070
1070
|
for (let t of e) a(t);
|
|
1071
1071
|
return n;
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function nr(e, t) {
|
|
1074
1074
|
return e.id === t.id && (e.pane ?? null) === (t.pane ?? null) && (e.scale ?? null) === (t.scale ?? null) && e.position === void 0 == (t.position === void 0);
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function rr(e, t) {
|
|
1077
1077
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1078
1078
|
for (let t of e) {
|
|
1079
1079
|
let e = n.get(t.instanceId);
|
|
1080
|
-
e &&
|
|
1080
|
+
e && nr(t, e) && ir(t, e) && r.add(t.instanceId);
|
|
1081
1081
|
}
|
|
1082
1082
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1083
1083
|
return r;
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function ir(e, t) {
|
|
1086
1086
|
let n = Object.keys(e.params);
|
|
1087
1087
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function ar(e, t) {
|
|
1090
1090
|
let n = { ...e };
|
|
1091
1091
|
for (let [e, r] of Object.entries(n)) {
|
|
1092
1092
|
let i = S(r), a = i && t.get(i.instanceId);
|
|
@@ -1096,11 +1096,11 @@ function rr(e, t) {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region src/model/SymbolRequests.ts
|
|
1099
|
-
function
|
|
1099
|
+
function or(e, t) {
|
|
1100
1100
|
let n = t.symbol;
|
|
1101
|
-
return
|
|
1101
|
+
return ut.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1102
1102
|
}
|
|
1103
|
-
var
|
|
1103
|
+
var sr = class {
|
|
1104
1104
|
asked = /* @__PURE__ */ new Set();
|
|
1105
1105
|
constructor(e, t) {
|
|
1106
1106
|
this.readers = e, this.held = t;
|
|
@@ -1108,14 +1108,14 @@ var ar = class {
|
|
|
1108
1108
|
required() {
|
|
1109
1109
|
let e = /* @__PURE__ */ new Set();
|
|
1110
1110
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1111
|
-
let n =
|
|
1111
|
+
let n = or(t.id, t.params);
|
|
1112
1112
|
n && e.add(n);
|
|
1113
1113
|
}
|
|
1114
1114
|
return [...e];
|
|
1115
1115
|
}
|
|
1116
1116
|
readersOf(e) {
|
|
1117
1117
|
let t = e.trim();
|
|
1118
|
-
return this.readers.getActiveIndicators().filter((e) =>
|
|
1118
|
+
return this.readers.getActiveIndicators().filter((e) => ut.has(e.id) && String(e.params.symbol ?? "").trim() === t).map((e) => e.instanceId);
|
|
1119
1119
|
}
|
|
1120
1120
|
given(e) {
|
|
1121
1121
|
this.asked.delete(e.trim());
|
|
@@ -1126,20 +1126,20 @@ var ar = class {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
toAsk(e) {
|
|
1128
1128
|
this.forgetUnread();
|
|
1129
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1129
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? or(t.id, t.params) : "";
|
|
1130
1130
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1131
1131
|
}
|
|
1132
|
-
},
|
|
1133
|
-
function
|
|
1134
|
-
if (!
|
|
1132
|
+
}, cr = (e, t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1133
|
+
function lr(e, t, n, r) {
|
|
1134
|
+
if (!cr(e, t)) {
|
|
1135
1135
|
for (let t of n) {
|
|
1136
1136
|
let n = r(t.id);
|
|
1137
|
-
if (n &&
|
|
1137
|
+
if (n && cr(e, n.chartRect)) return t.id;
|
|
1138
1138
|
}
|
|
1139
1139
|
return null;
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function ur(e, t, n, r) {
|
|
1143
1143
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1144
1144
|
let i = n();
|
|
1145
1145
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1147,12 +1147,12 @@ function cr(e, t, n, r) {
|
|
|
1147
1147
|
data: r()
|
|
1148
1148
|
};
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function dr(e, t, n) {
|
|
1151
1151
|
return !n && e.some((e) => e.id === t);
|
|
1152
1152
|
}
|
|
1153
1153
|
//#endregion
|
|
1154
1154
|
//#region src/HistoryPager.ts
|
|
1155
|
-
var
|
|
1155
|
+
var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
1156
1156
|
loader = null;
|
|
1157
1157
|
pageSize = 500;
|
|
1158
1158
|
loading = !1;
|
|
@@ -1207,7 +1207,7 @@ var ur = 5e3, dr = 6e4, fr = 500, pr = class {
|
|
|
1207
1207
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1208
1208
|
state: "loaded",
|
|
1209
1209
|
count: 0
|
|
1210
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1210
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(pr, fr * 2 ** (this.failures - 1)), this.emit({
|
|
1211
1211
|
state: "error",
|
|
1212
1212
|
count: 0,
|
|
1213
1213
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1240,10 +1240,10 @@ var ur = 5e3, dr = 6e4, fr = 500, pr = class {
|
|
|
1240
1240
|
};
|
|
1241
1241
|
//#endregion
|
|
1242
1242
|
//#region src/ThemeManager.ts
|
|
1243
|
-
function
|
|
1243
|
+
function gr(e, t) {
|
|
1244
1244
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1245
1245
|
}
|
|
1246
|
-
var
|
|
1246
|
+
var _r = class e {
|
|
1247
1247
|
base;
|
|
1248
1248
|
shape = null;
|
|
1249
1249
|
font = null;
|
|
@@ -1268,7 +1268,7 @@ var hr = class e {
|
|
|
1268
1268
|
return this.base;
|
|
1269
1269
|
}
|
|
1270
1270
|
setTheme(t) {
|
|
1271
|
-
let n = e.read(t), r = this.font !== null &&
|
|
1271
|
+
let n = e.read(t), r = this.font !== null && gr(n.font, this.base.font);
|
|
1272
1272
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1273
1273
|
...this.base,
|
|
1274
1274
|
shape: {
|
|
@@ -1350,7 +1350,7 @@ var hr = class e {
|
|
|
1350
1350
|
};
|
|
1351
1351
|
//#endregion
|
|
1352
1352
|
//#region src/style/styleOptions.ts
|
|
1353
|
-
function
|
|
1353
|
+
function vr(e, t) {
|
|
1354
1354
|
return t ? {
|
|
1355
1355
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1356
1356
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1358,22 +1358,22 @@ function gr(e, t) {
|
|
|
1358
1358
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1359
1359
|
} : {};
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function yr(e) {
|
|
1362
1362
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1363
1363
|
return {
|
|
1364
1364
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1365
1365
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1366
1366
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1367
1367
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1368
|
-
...
|
|
1369
|
-
...
|
|
1368
|
+
...vr("horizontal", n?.hLine),
|
|
1369
|
+
...vr("vertical", n?.vLine),
|
|
1370
1370
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1371
1371
|
...e.overrides
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
//#endregion
|
|
1375
1375
|
//#region src/layout/LayoutManager.ts
|
|
1376
|
-
var
|
|
1376
|
+
var br = 200, xr = 80, K = (e) => e.position === "top" || e.position === "bottom", Sr = class {
|
|
1377
1377
|
panels = [];
|
|
1378
1378
|
containerWidth = 0;
|
|
1379
1379
|
containerHeight = 0;
|
|
@@ -1390,8 +1390,8 @@ var vr = 200, yr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1390
1390
|
this.panels.push({
|
|
1391
1391
|
id: e,
|
|
1392
1392
|
position: t,
|
|
1393
|
-
size: r ?? (i ?
|
|
1394
|
-
minSize: i ?
|
|
1393
|
+
size: r ?? (i ? br : n),
|
|
1394
|
+
minSize: i ? xr : a,
|
|
1395
1395
|
content: {
|
|
1396
1396
|
type: "indicator",
|
|
1397
1397
|
indicatorInstanceId: e
|
|
@@ -1460,7 +1460,7 @@ var vr = 200, yr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1460
1460
|
let r = this.panels.find((t) => t.id === e);
|
|
1461
1461
|
if (r) {
|
|
1462
1462
|
let i = r.position === "left" || r.position === "right", o = t === "left" || t === "right";
|
|
1463
|
-
r.position = t, i !== o && (r.size = o ?
|
|
1463
|
+
r.position = t, i !== o && (r.size = o ? br : n, r.minSize = o ? xr : a), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
1466
|
setPanelSize(e, t) {
|
|
@@ -1580,8 +1580,8 @@ var vr = 200, yr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1580
1580
|
getMainChartRect() {
|
|
1581
1581
|
return this.resolve().mainChartRect;
|
|
1582
1582
|
}
|
|
1583
|
-
},
|
|
1584
|
-
function
|
|
1583
|
+
}, Cr = 14, wr = 14, Tr = 22, Er = 4;
|
|
1584
|
+
function Dr(e) {
|
|
1585
1585
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure: c } = e, u = e.tagPrecision ?? l(t, n), d = u, f = r === null ? [t, n] : [
|
|
1586
1586
|
t,
|
|
1587
1587
|
n,
|
|
@@ -1590,16 +1590,16 @@ function Tr(e) {
|
|
|
1590
1590
|
for (let t of f) {
|
|
1591
1591
|
if (!Number.isFinite(t)) continue;
|
|
1592
1592
|
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : _(t, u, i), r = e.format ? n : _(t, d, i);
|
|
1593
|
-
p = Math.max(p, c(n, `500 ${o}px ${a}`) +
|
|
1593
|
+
p = Math.max(p, c(n, `500 ${o}px ${a}`) + Cr, c(r, `bold 11px ${a}`) + wr, c(r, `600 ${o}px ${a}`) + Tr);
|
|
1594
1594
|
}
|
|
1595
|
-
return p <= s ? s : Math.ceil(p /
|
|
1595
|
+
return p <= s ? s : Math.ceil(p / Er) * Er;
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function Or(e, t) {
|
|
1598
1598
|
return t > e || t <= e - 12 ? t : e;
|
|
1599
1599
|
}
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/layout/labelWidths.ts
|
|
1602
|
-
var
|
|
1602
|
+
var kr = 512, Ar = class {
|
|
1603
1603
|
widths = /* @__PURE__ */ new Map();
|
|
1604
1604
|
fonts;
|
|
1605
1605
|
forget = () => this.widths.clear();
|
|
@@ -1610,12 +1610,12 @@ var Dr = 512, Or = class {
|
|
|
1610
1610
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1611
1611
|
if (i !== void 0) return i;
|
|
1612
1612
|
let a = n();
|
|
1613
|
-
return this.widths.size >=
|
|
1613
|
+
return this.widths.size >= kr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1614
1614
|
}
|
|
1615
1615
|
destroy() {
|
|
1616
1616
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1617
1617
|
}
|
|
1618
|
-
},
|
|
1618
|
+
}, jr = class {
|
|
1619
1619
|
netY = 0;
|
|
1620
1620
|
travelX = 0;
|
|
1621
1621
|
engaged = !1;
|
|
@@ -1631,8 +1631,8 @@ var Dr = 512, Or = class {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
return this.engaged;
|
|
1633
1633
|
}
|
|
1634
|
-
},
|
|
1635
|
-
function
|
|
1634
|
+
}, Mr = 1;
|
|
1635
|
+
function Nr(e, t) {
|
|
1636
1636
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1637
1637
|
}
|
|
1638
1638
|
function q(e) {
|
|
@@ -1646,24 +1646,24 @@ function q(e) {
|
|
|
1646
1646
|
//#endregion
|
|
1647
1647
|
//#region src/plugins/registry.ts
|
|
1648
1648
|
var J = /* @__PURE__ */ new Map();
|
|
1649
|
-
function
|
|
1649
|
+
function Pr(e) {
|
|
1650
1650
|
J.set(q(e), e);
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1652
|
+
function Fr(e) {
|
|
1653
1653
|
return J.delete(e);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function Ir() {
|
|
1656
1656
|
return [...J.values()];
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1658
|
+
function Lr() {
|
|
1659
1659
|
J.clear();
|
|
1660
1660
|
}
|
|
1661
1661
|
//#endregion
|
|
1662
1662
|
//#region src/plugins/PluginManager.ts
|
|
1663
|
-
var
|
|
1663
|
+
var Rr = class {
|
|
1664
1664
|
plugins = /* @__PURE__ */ new Map();
|
|
1665
1665
|
constructor(e, t = {}) {
|
|
1666
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1666
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Ir()) this.add(e);
|
|
1667
1667
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1668
1668
|
}
|
|
1669
1669
|
register(e) {
|
|
@@ -1693,15 +1693,15 @@ var Ir = class {
|
|
|
1693
1693
|
add(e) {
|
|
1694
1694
|
this.plugins.set(q(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1695
1695
|
}
|
|
1696
|
-
},
|
|
1696
|
+
}, zr = {
|
|
1697
1697
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1698
1698
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1699
1699
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1700
1700
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1701
1701
|
positionClose: (e, t) => e.closePosition(t),
|
|
1702
|
-
positionReverse: (e, t, n) =>
|
|
1702
|
+
positionReverse: (e, t, n) => Br(e, t, n)
|
|
1703
1703
|
};
|
|
1704
|
-
async function
|
|
1704
|
+
async function Br(e, t, n) {
|
|
1705
1705
|
let { reversing: r } = n;
|
|
1706
1706
|
if (!r.has(t.positionId)) {
|
|
1707
1707
|
r.add(t.positionId);
|
|
@@ -1730,7 +1730,7 @@ async function Rr(e, t, n) {
|
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function Vr(e, t) {
|
|
1734
1734
|
let n = [], r = null, i = {
|
|
1735
1735
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1736
1736
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1740,8 +1740,8 @@ function zr(e, t) {
|
|
|
1740
1740
|
e.data && t.onFill?.(e.data);
|
|
1741
1741
|
};
|
|
1742
1742
|
e.on("orders", a), e.on("positions", o), e.on("error", s), e.on("fill", c), n.push(() => e.off("orders", a), () => e.off("positions", o), () => e.off("error", s), () => e.off("fill", c));
|
|
1743
|
-
for (let r of Object.keys(
|
|
1744
|
-
let a =
|
|
1743
|
+
for (let r of Object.keys(zr)) {
|
|
1744
|
+
let a = zr[r], o = t.onIntent(r, (n) => {
|
|
1745
1745
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1746
1746
|
message: `Execution command failed: ${r}`,
|
|
1747
1747
|
cause: e
|
|
@@ -1755,7 +1755,7 @@ function zr(e, t) {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
//#endregion
|
|
1757
1757
|
//#region src/replay/ReplayStepLoader.ts
|
|
1758
|
-
var
|
|
1758
|
+
var Hr = 1e3, Ur = class {
|
|
1759
1759
|
pieces = /* @__PURE__ */ new Map();
|
|
1760
1760
|
asked = /* @__PURE__ */ new Set();
|
|
1761
1761
|
inFlight = !1;
|
|
@@ -1788,7 +1788,7 @@ var Br = 1e3, Vr = class {
|
|
|
1788
1788
|
this.done = !0;
|
|
1789
1789
|
}
|
|
1790
1790
|
ask(e, t) {
|
|
1791
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1791
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(Hr / n)), s = Math.min(e.length, t + o), c = s < e.length ? e[s].time : e[e.length - 1].time + r, l = e.slice(t, s);
|
|
1792
1792
|
for (let e of l) this.asked.add(e.time);
|
|
1793
1793
|
this.inFlight = !0, a({
|
|
1794
1794
|
state: "loading",
|
|
@@ -1829,12 +1829,12 @@ var Br = 1e3, Vr = class {
|
|
|
1829
1829
|
...n === void 0 ? {} : { error: n }
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
|
-
},
|
|
1833
|
-
function
|
|
1834
|
-
let n = (e.high - e.low) *
|
|
1835
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1832
|
+
}, Wr = 1 / 3, Gr = .25, Kr = .5;
|
|
1833
|
+
function qr(e, t) {
|
|
1834
|
+
let n = (e.high - e.low) * Gr;
|
|
1835
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * Kr;
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function Jr(e) {
|
|
1838
1838
|
return e.close >= e.open ? [
|
|
1839
1839
|
e.open,
|
|
1840
1840
|
e.low,
|
|
@@ -1847,22 +1847,22 @@ function Kr(e) {
|
|
|
1847
1847
|
e.close
|
|
1848
1848
|
];
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
let r =
|
|
1850
|
+
function Yr(e, t, n) {
|
|
1851
|
+
let r = Jr(e), i = [
|
|
1852
1852
|
1,
|
|
1853
1853
|
2,
|
|
1854
1854
|
3
|
|
1855
1855
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1856
1856
|
return r.forEach((r, c) => {
|
|
1857
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1857
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : Wr), !(c === 0 && t > 0) && o.push({
|
|
1858
1858
|
price: r,
|
|
1859
1859
|
time: e.time,
|
|
1860
1860
|
at: (t + s) / n
|
|
1861
1861
|
});
|
|
1862
1862
|
}), o;
|
|
1863
1863
|
}
|
|
1864
|
-
function
|
|
1865
|
-
let n = t.length > 0 &&
|
|
1864
|
+
function Xr(e, t = []) {
|
|
1865
|
+
let n = t.length > 0 && qr(e, t) ? t : [e], r = n.length, i = Zr(n.flatMap((e, t) => Yr(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1866
1866
|
return {
|
|
1867
1867
|
bar: e,
|
|
1868
1868
|
points: i,
|
|
@@ -1872,7 +1872,7 @@ function Jr(e, t = []) {
|
|
|
1872
1872
|
}))
|
|
1873
1873
|
};
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function Zr(e, t) {
|
|
1876
1876
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1877
1877
|
...e,
|
|
1878
1878
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1887,7 +1887,7 @@ function Yr(e, t) {
|
|
|
1887
1887
|
};
|
|
1888
1888
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Qr(e, t) {
|
|
1891
1891
|
let n = e.points;
|
|
1892
1892
|
if (t <= n[0].at) return n[0].price;
|
|
1893
1893
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1896,8 +1896,8 @@ function Xr(e, t) {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
return n[n.length - 1].price;
|
|
1898
1898
|
}
|
|
1899
|
-
var
|
|
1900
|
-
function
|
|
1899
|
+
var $r = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1900
|
+
function ei(e, t) {
|
|
1901
1901
|
let n = 0, r = 0;
|
|
1902
1902
|
for (let i of e.volumeAt) {
|
|
1903
1903
|
if (t >= i.at) {
|
|
@@ -1908,10 +1908,10 @@ function Qr(e, t) {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
return n;
|
|
1910
1910
|
}
|
|
1911
|
-
function
|
|
1912
|
-
let n =
|
|
1911
|
+
function ti(e, t) {
|
|
1912
|
+
let n = $r(t);
|
|
1913
1913
|
if (n >= 1) return { ...e.bar };
|
|
1914
|
-
let r =
|
|
1914
|
+
let r = Qr(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1915
1915
|
for (let t of e.points) {
|
|
1916
1916
|
if (t.at > n) break;
|
|
1917
1917
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1922,11 +1922,11 @@ function $r(e, t) {
|
|
|
1922
1922
|
high: i,
|
|
1923
1923
|
low: a,
|
|
1924
1924
|
close: r,
|
|
1925
|
-
volume:
|
|
1925
|
+
volume: ei(e, n)
|
|
1926
1926
|
};
|
|
1927
1927
|
}
|
|
1928
|
-
function
|
|
1929
|
-
let n =
|
|
1928
|
+
function ni(e, t) {
|
|
1929
|
+
let n = $r(t), r = 0;
|
|
1930
1930
|
for (let t of e.points) {
|
|
1931
1931
|
if (t.at > n) break;
|
|
1932
1932
|
r = t.at;
|
|
@@ -1939,12 +1939,12 @@ function Y(e, t, n) {
|
|
|
1939
1939
|
if (a.at > n) break;
|
|
1940
1940
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1941
1941
|
}
|
|
1942
|
-
let a =
|
|
1942
|
+
let a = Qr(e, n);
|
|
1943
1943
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1944
1944
|
}
|
|
1945
1945
|
//#endregion
|
|
1946
1946
|
//#region src/replay/replayStep.ts
|
|
1947
|
-
var
|
|
1947
|
+
var ri = [
|
|
1948
1948
|
"1m",
|
|
1949
1949
|
"3m",
|
|
1950
1950
|
"5m",
|
|
@@ -1955,27 +1955,27 @@ var ti = [
|
|
|
1955
1955
|
"4h",
|
|
1956
1956
|
"1d"
|
|
1957
1957
|
];
|
|
1958
|
-
function
|
|
1958
|
+
function ii(e, t) {
|
|
1959
1959
|
let n = E(e);
|
|
1960
|
-
return n > 0 ?
|
|
1960
|
+
return n > 0 ? ri.filter((e) => {
|
|
1961
1961
|
let r = E(e);
|
|
1962
1962
|
return r < n && n % r === 0 && t(e);
|
|
1963
1963
|
}) : [];
|
|
1964
1964
|
}
|
|
1965
|
-
function
|
|
1966
|
-
let r =
|
|
1965
|
+
function ai(e, t, n) {
|
|
1966
|
+
let r = ii(t, n);
|
|
1967
1967
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1968
1968
|
let i = E(t);
|
|
1969
1969
|
return r.find((e) => i / E(e) <= 60) ?? null;
|
|
1970
1970
|
}
|
|
1971
1971
|
//#endregion
|
|
1972
1972
|
//#region src/model/AlertWatch.ts
|
|
1973
|
-
function
|
|
1973
|
+
function oi(e, t) {
|
|
1974
1974
|
e.setBarTime(t.barTime);
|
|
1975
1975
|
let n = new Map([["price", t.price]]);
|
|
1976
|
-
t.lines &&
|
|
1976
|
+
t.lines && si(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function si(e, t, n) {
|
|
1979
1979
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
1980
1980
|
for (let e of r) {
|
|
1981
1981
|
if (n.has(e)) continue;
|
|
@@ -1985,7 +1985,7 @@ function ai(e, t, n) {
|
|
|
1985
1985
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
1986
1986
|
}
|
|
1987
1987
|
}
|
|
1988
|
-
function
|
|
1988
|
+
function ci(e, t, n, r) {
|
|
1989
1989
|
let i = (e) => {
|
|
1990
1990
|
let i = e.indexOf(":");
|
|
1991
1991
|
if (i <= 0) return null;
|
|
@@ -2007,35 +2007,35 @@ function oi(e, t, n, r) {
|
|
|
2007
2007
|
});
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
function
|
|
2010
|
+
function li(e, t) {
|
|
2011
2011
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2012
2012
|
return r ? r + e.slice(n) : e;
|
|
2013
2013
|
}
|
|
2014
|
-
var
|
|
2014
|
+
var ui = [
|
|
2015
2015
|
"crossing",
|
|
2016
2016
|
"crossingUp",
|
|
2017
2017
|
"crossingDown"
|
|
2018
2018
|
];
|
|
2019
|
-
function
|
|
2019
|
+
function di(e, t, n, r, i) {
|
|
2020
2020
|
e.clearAlerts();
|
|
2021
2021
|
for (let a of t) {
|
|
2022
2022
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2023
2023
|
if (a.drawingId) {
|
|
2024
|
-
r(a.drawingId) &&
|
|
2024
|
+
r(a.drawingId) && ui.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2025
2025
|
continue;
|
|
2026
2026
|
}
|
|
2027
2027
|
let t = {
|
|
2028
|
-
...
|
|
2029
|
-
...a.target ? { target:
|
|
2028
|
+
...Wt(a),
|
|
2029
|
+
...a.target ? { target: li(a.target, n) } : {}
|
|
2030
2030
|
};
|
|
2031
2031
|
try {
|
|
2032
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2032
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, li(a.channel, n), a.label, t);
|
|
2033
2033
|
} catch (e) {
|
|
2034
2034
|
i(e);
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
var
|
|
2038
|
+
var fi = class {
|
|
2039
2039
|
kept = /* @__PURE__ */ new Map();
|
|
2040
2040
|
constructor(e) {
|
|
2041
2041
|
this.alerts = e;
|
|
@@ -2052,7 +2052,7 @@ var ui = class {
|
|
|
2052
2052
|
return this.kept.clear(), this.alerts.pruneDrawingAlerts(e);
|
|
2053
2053
|
}
|
|
2054
2054
|
};
|
|
2055
|
-
function
|
|
2055
|
+
function pi(e, t) {
|
|
2056
2056
|
let n = 0, r = e.length;
|
|
2057
2057
|
for (; n < r;) {
|
|
2058
2058
|
let i = n + r >> 1;
|
|
@@ -2060,7 +2060,7 @@ function di(e, t) {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
return n;
|
|
2062
2062
|
}
|
|
2063
|
-
function
|
|
2063
|
+
function mi(e, t) {
|
|
2064
2064
|
let n = 0, r = e.length;
|
|
2065
2065
|
for (; n < r;) {
|
|
2066
2066
|
let i = n + r >> 1;
|
|
@@ -2068,18 +2068,18 @@ function fi(e, t) {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
return n;
|
|
2070
2070
|
}
|
|
2071
|
-
function
|
|
2071
|
+
function hi(e) {
|
|
2072
2072
|
let t = 0, n = 0;
|
|
2073
2073
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
2074
2074
|
let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
|
|
2075
2075
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2077
|
+
function gi(e) {
|
|
2078
2078
|
let t = [], n = Math.ceil(e.length / 500);
|
|
2079
|
-
for (let r = 0; r < e.length; r += n) t.push(...
|
|
2079
|
+
for (let r = 0; r < e.length; r += n) t.push(...hi(e.slice(r, r + n)));
|
|
2080
2080
|
return t;
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function _i(e, t, n) {
|
|
2083
2083
|
let r = e[t];
|
|
2084
2084
|
return r ? n.time === null ? {
|
|
2085
2085
|
marks: [[r.close, r.time]],
|
|
@@ -2088,14 +2088,14 @@ function hi(e, t, n) {
|
|
|
2088
2088
|
fraction: n.fraction
|
|
2089
2089
|
}
|
|
2090
2090
|
} : r.time <= n.time ? null : {
|
|
2091
|
-
marks:
|
|
2091
|
+
marks: gi(e.slice(mi(e, n.time), t + 1)),
|
|
2092
2092
|
fed: {
|
|
2093
2093
|
time: r.time,
|
|
2094
2094
|
fraction: n.fraction
|
|
2095
2095
|
}
|
|
2096
2096
|
} : null;
|
|
2097
2097
|
}
|
|
2098
|
-
function
|
|
2098
|
+
function vi(e, t, n, r, i, a) {
|
|
2099
2099
|
let o = e[t];
|
|
2100
2100
|
if (!o) return null;
|
|
2101
2101
|
let s = {
|
|
@@ -2103,7 +2103,7 @@ function gi(e, t, n, r, i, a) {
|
|
|
2103
2103
|
fraction: r
|
|
2104
2104
|
};
|
|
2105
2105
|
if (i.time === null) return {
|
|
2106
|
-
marks: [[
|
|
2106
|
+
marks: [[ti(n, r).close, o.time]],
|
|
2107
2107
|
fed: s
|
|
2108
2108
|
};
|
|
2109
2109
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
@@ -2111,20 +2111,20 @@ function gi(e, t, n, r, i, a) {
|
|
|
2111
2111
|
marks: Y(n, i.fraction, r),
|
|
2112
2112
|
fed: s
|
|
2113
2113
|
};
|
|
2114
|
-
let c = [], l =
|
|
2115
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...Y(a(e, l), i.fraction, 1)), c.push(...
|
|
2114
|
+
let c = [], l = pi(e, i.time);
|
|
2115
|
+
return e[l]?.time === i.time && i.fraction < 1 && c.push(...Y(a(e, l), i.fraction, 1)), c.push(...gi(e.slice(mi(e, i.time), t))), c.push(...Y(n, -1, r)), {
|
|
2116
2116
|
marks: c,
|
|
2117
2117
|
fed: s
|
|
2118
2118
|
};
|
|
2119
2119
|
}
|
|
2120
2120
|
//#endregion
|
|
2121
2121
|
//#region src/Chart.ts
|
|
2122
|
-
var
|
|
2123
|
-
function
|
|
2122
|
+
var yi = "exchange", bi = yi;
|
|
2123
|
+
function xi(e) {
|
|
2124
2124
|
if (typeof e == "string" && e !== "exchange" && !b(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
2125
2125
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2126
2126
|
}
|
|
2127
|
-
function
|
|
2127
|
+
function Si(e, t) {
|
|
2128
2128
|
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : T(e);
|
|
2129
2129
|
return i === void 0 ? e : {
|
|
2130
2130
|
...e,
|
|
@@ -2132,20 +2132,22 @@ function bi(e, t) {
|
|
|
2132
2132
|
timezone: i
|
|
2133
2133
|
};
|
|
2134
2134
|
}
|
|
2135
|
-
var
|
|
2135
|
+
var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
2136
2136
|
ArrowLeft: [-1, 0],
|
|
2137
2137
|
ArrowRight: [1, 0],
|
|
2138
2138
|
ArrowUp: [0, -1],
|
|
2139
2139
|
ArrowDown: [0, 1]
|
|
2140
|
-
},
|
|
2141
|
-
static version = "1.
|
|
2140
|
+
}, Oi = new Set(["horizontalLine", "crossLine"]), ki = new Set(["verticalLine", "crossLine"]), Ai = class {
|
|
2141
|
+
static version = "1.84.1";
|
|
2142
2142
|
engine;
|
|
2143
2143
|
viewport;
|
|
2144
|
-
series = new
|
|
2144
|
+
series = new Bn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2145
2145
|
themeManager;
|
|
2146
2146
|
layoutManager;
|
|
2147
2147
|
pluginManager;
|
|
2148
2148
|
indicatorEngine;
|
|
2149
|
+
indicatorWorker = null;
|
|
2150
|
+
indicatorsLanding = !1;
|
|
2149
2151
|
drawingManager;
|
|
2150
2152
|
drawingRenderer;
|
|
2151
2153
|
tradingManager;
|
|
@@ -2166,7 +2168,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2166
2168
|
renderDeferred = !1;
|
|
2167
2169
|
priceAxisWidth = s;
|
|
2168
2170
|
measureCtx;
|
|
2169
|
-
labelWidths = new
|
|
2171
|
+
labelWidths = new Ar();
|
|
2170
2172
|
containerSizeCache = null;
|
|
2171
2173
|
containerSizeCacheTime = 0;
|
|
2172
2174
|
lastEmittedRange = null;
|
|
@@ -2179,7 +2181,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2179
2181
|
unrestoredIndicators = [];
|
|
2180
2182
|
drawingAlerts = null;
|
|
2181
2183
|
zoomAreaMode = !1;
|
|
2182
|
-
priceAxisAddButton = new
|
|
2184
|
+
priceAxisAddButton = new rt();
|
|
2183
2185
|
displayTz = null;
|
|
2184
2186
|
timeZoneSetting = null;
|
|
2185
2187
|
symbolInfo = null;
|
|
@@ -2209,7 +2211,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2209
2211
|
signalMarkerManager;
|
|
2210
2212
|
tradeZoneManager;
|
|
2211
2213
|
measureOverlay;
|
|
2212
|
-
selectionBoxOverlay = new
|
|
2214
|
+
selectionBoxOverlay = new ft();
|
|
2213
2215
|
replayManager;
|
|
2214
2216
|
replayBarUnsub = null;
|
|
2215
2217
|
replaySeeking = !1;
|
|
@@ -2224,7 +2226,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2224
2226
|
replayForming = null;
|
|
2225
2227
|
replayPhaseUnsub = null;
|
|
2226
2228
|
undoRedoManager;
|
|
2227
|
-
autoSaveScheduler = new
|
|
2229
|
+
autoSaveScheduler = new Nn((e) => this.saveState(e));
|
|
2228
2230
|
animator;
|
|
2229
2231
|
crosshairTooltip;
|
|
2230
2232
|
pinnedTooltip;
|
|
@@ -2236,14 +2238,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2236
2238
|
disposed = !1;
|
|
2237
2239
|
chartTypeOptions = {};
|
|
2238
2240
|
mainSeriesVisible = !0;
|
|
2239
|
-
priceLines = new
|
|
2240
|
-
symbolSeries = new
|
|
2241
|
+
priceLines = new it();
|
|
2242
|
+
symbolSeries = new yt();
|
|
2241
2243
|
extendedHours = !0;
|
|
2242
2244
|
replayRestarting = !1;
|
|
2243
2245
|
symbolRequests;
|
|
2244
2246
|
gridRenderer;
|
|
2245
2247
|
priceAxis;
|
|
2246
|
-
leftPriceAxis = new
|
|
2248
|
+
leftPriceAxis = new nt();
|
|
2247
2249
|
leftScaleRequested = !1;
|
|
2248
2250
|
leftAxisWidth = s;
|
|
2249
2251
|
leftViewport = null;
|
|
@@ -2274,10 +2276,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2274
2276
|
snapshotKey = null;
|
|
2275
2277
|
historyCheckQueued = !1;
|
|
2276
2278
|
constructor(e, t) {
|
|
2277
|
-
t.timeZone != null &&
|
|
2279
|
+
t.timeZone != null && xi(t.timeZone), this.container = e, this.options = {
|
|
2278
2280
|
...t,
|
|
2279
2281
|
chartType: t.chartType ?? "candlestick"
|
|
2280
|
-
}, this.numberLocale = t.numberLocale ?? "en-US", this.priceFit = new
|
|
2282
|
+
}, this.numberLocale = t.numberLocale ?? "en-US", this.priceFit = new Un(t.autoScale !== !1), this.display = new Kn({
|
|
2281
2283
|
bars: () => this.series.bars(),
|
|
2282
2284
|
version: () => this.series.version(),
|
|
2283
2285
|
chartType: () => this.options.chartType,
|
|
@@ -2285,7 +2287,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2285
2287
|
lookup: (e) => this.pluginManager.getChartType(e),
|
|
2286
2288
|
stepAt: (e) => this.stepAt(e),
|
|
2287
2289
|
onBoxSize: (e) => {
|
|
2288
|
-
this.chartRenderer instanceof
|
|
2290
|
+
this.chartRenderer instanceof tt && this.chartRenderer.setBoxSize(e);
|
|
2289
2291
|
}
|
|
2290
2292
|
});
|
|
2291
2293
|
let n = t.features ?? {};
|
|
@@ -2324,19 +2326,19 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2324
2326
|
logScale: n.logScale ?? !0,
|
|
2325
2327
|
timeframes: n.timeframes ?? [],
|
|
2326
2328
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
2327
|
-
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new
|
|
2329
|
+
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new hr({
|
|
2328
2330
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2329
2331
|
prepend: (e) => this.prependBars(e),
|
|
2330
2332
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2331
|
-
}), this.themeManager = new
|
|
2333
|
+
}), this.themeManager = new _r(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(yr(t), "host", !1), this.container.style.backgroundColor || (this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background), this.layoutManager = new Sr(), this.indicatorEngine = new Ve(), this.panes = new Jn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new Qn(this.indicatorEngine, this.layoutManager, {
|
|
2332
2334
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2333
2335
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2334
2336
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2335
|
-
}), this.symbolRequests = new
|
|
2337
|
+
}), this.symbolRequests = new sr(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Rr(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Fe(), Kt(this.indicatorEngine), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new gt(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), t.indicatorWorker === "auto" && this.useIndicatorWorker(), this.drawingManager = new Me(), Gt(this.drawingManager), this.drawingRenderer = new Ne(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingRenderer.setTimeFormat((e) => this.crosshairHandler.formatTime(e, this.getDisplayData())), this.drawingManager.setRequestRender(() => {
|
|
2336
2338
|
this.syncRenderContext(), this.engine.requestRender(i.Overlay), this.scheduleAutoSave();
|
|
2337
2339
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2338
2340
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2339
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new
|
|
2341
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new wt(), this.indicatorHistory = new Zn({
|
|
2340
2342
|
steps: this.undoRedoManager,
|
|
2341
2343
|
snapshot: () => this.getIndicatorSetup(),
|
|
2342
2344
|
enabled: () => this.features.drawingUndoRedo
|
|
@@ -2353,23 +2355,23 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2353
2355
|
primary: e[0] ?? null
|
|
2354
2356
|
})), this.drawingManager.setForeignHistory((e, t) => {
|
|
2355
2357
|
e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
|
|
2356
|
-
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new
|
|
2358
|
+
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new St({
|
|
2357
2359
|
enabled: this.features.trading,
|
|
2358
2360
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
2359
|
-
}), this.tradingRenderer = new
|
|
2361
|
+
}), this.tradingRenderer = new Ct(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
2360
2362
|
this.eventBus.emit(e, t);
|
|
2361
|
-
}), this.engine = new
|
|
2363
|
+
}), this.engine = new at(e, t.maxPixelRatio);
|
|
2362
2364
|
let a = this.engine.dprManager.getContainerSize();
|
|
2363
|
-
if (this.viewport = new
|
|
2365
|
+
if (this.viewport = new Tt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), t.barLayout && this.viewport.setBarLayout(t.barLayout), this.viewport.setPanLimits({
|
|
2364
2366
|
freePan: t.freePan ?? !0,
|
|
2365
2367
|
minVisibleBars: t.panLimits?.minVisibleBars ?? 3
|
|
2366
2368
|
}), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
|
|
2367
2369
|
if (e.width <= 0 || e.height <= 0) return;
|
|
2368
2370
|
let t = this.viewport.isAtEnd();
|
|
2369
2371
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2370
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ie(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new
|
|
2372
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ie(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new nt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new bt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new De(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), Lt(t.crosshair?.cursor) && this.crosshairHandler.setCursor(t.crosshair.cursor), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2371
2373
|
if (e !== null && t) {
|
|
2372
|
-
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o =
|
|
2374
|
+
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = jt(n), s = r ? o[e]?.time ?? r.time : void 0;
|
|
2373
2375
|
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(i.Hover);
|
|
2374
2376
|
let c = this.viewport.getState(), l = t.y >= c.chartRect.y && t.y <= c.chartRect.y + c.chartRect.height;
|
|
2375
2377
|
if (r && l && this.features.crosshairTooltip) {
|
|
@@ -2381,7 +2383,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2381
2383
|
prevClose: a,
|
|
2382
2384
|
priceRange: c.priceRange,
|
|
2383
2385
|
plot: c.chartRect,
|
|
2384
|
-
barStepMs:
|
|
2386
|
+
barStepMs: Mt(o),
|
|
2385
2387
|
timeUnit: d(o)
|
|
2386
2388
|
});
|
|
2387
2389
|
} else this.crosshairTooltip.hide();
|
|
@@ -2399,12 +2401,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2399
2401
|
}
|
|
2400
2402
|
}), this.chartLegend = new xe(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setResizeListener(() => {
|
|
2401
2403
|
this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
|
|
2402
|
-
}), this.watermark = new
|
|
2404
|
+
}), this.watermark = new kt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new Ot(), this.volumeProfile = new Dt(), this.marketProfile = new qe(), this.depthHeatmap = new je(), this.periodLevels = new Qe(), this.pivotMarkers = new et(), this.barCountdown = new _e(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new pt(), this.sessionShading = new mt(), this.compareRenderer = new Se(), t.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
2403
2405
|
visible: t.sessionBreaks.visible ?? !0,
|
|
2404
2406
|
color: t.sessionBreaks.color,
|
|
2405
2407
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
2406
2408
|
lineWidth: t.sessionBreaks.lineWidth
|
|
2407
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new me(), this.crosshairTooltip = new Oe(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new
|
|
2409
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new me(), this.crosshairTooltip = new Oe(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new $e(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = C(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Pi(t.shapes)), t.font && this.themeManager.setFont(Ni(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new We({
|
|
2408
2410
|
scrollBars: (e) => {
|
|
2409
2411
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2410
2412
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2421,7 +2423,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2421
2423
|
},
|
|
2422
2424
|
fitContent: () => this.fitContent()
|
|
2423
2425
|
}), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
|
|
2424
|
-
this.a11y = new
|
|
2426
|
+
this.a11y = new un(e, {
|
|
2425
2427
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
2426
2428
|
timeframe: () => this.streamTimeframe ?? "",
|
|
2427
2429
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
@@ -2452,7 +2454,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2452
2454
|
}
|
|
2453
2455
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2454
2456
|
}
|
|
2455
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new ke(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new pe(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.drawingAlerts = new
|
|
2457
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new ke(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new pe(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.drawingAlerts = new fi(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(Rt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2456
2458
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2457
2459
|
kind: "alert",
|
|
2458
2460
|
alert: "triggered",
|
|
@@ -2468,7 +2470,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2468
2470
|
this.eventBus.emit("alertExpired", X(e));
|
|
2469
2471
|
}), this.alertManager.on("updated", (e) => {
|
|
2470
2472
|
this.eventBus.emit("alertUpdate", X(e));
|
|
2471
|
-
}), this.signalMarkerManager = new
|
|
2473
|
+
}), this.signalMarkerManager = new ht(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
2472
2474
|
this.eventBus.emit("signalMarkerAdd", {
|
|
2473
2475
|
id: e.id,
|
|
2474
2476
|
source: e.source,
|
|
@@ -2476,14 +2478,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2476
2478
|
});
|
|
2477
2479
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
2478
2480
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
2479
|
-
}), this.tradeZoneManager = new
|
|
2481
|
+
}), this.tradeZoneManager = new xt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
2480
2482
|
this.eventBus.emit("tradeZoneAdd", {
|
|
2481
2483
|
id: e.id,
|
|
2482
2484
|
direction: e.direction
|
|
2483
2485
|
});
|
|
2484
2486
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
2485
2487
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
2486
|
-
}), this.replayManager = new
|
|
2488
|
+
}), this.replayManager = new st(), this.replayManager.on("complete", () => {
|
|
2487
2489
|
let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
|
|
2488
2490
|
t && this.eventBus.emit("replayComplete", {
|
|
2489
2491
|
barIndex: e,
|
|
@@ -2491,9 +2493,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2491
2493
|
});
|
|
2492
2494
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2493
2495
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2494
|
-
}), this.measureOverlay = new
|
|
2495
|
-
let e = new
|
|
2496
|
-
this.interactionManager.setPanHandler(new
|
|
2496
|
+
}), this.measureOverlay = new Je(), this.interactionManager = new He(e), this.features.panning) {
|
|
2497
|
+
let e = new jr();
|
|
2498
|
+
this.interactionManager.setPanHandler(new Xe((t, n) => {
|
|
2497
2499
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2498
2500
|
}, () => e.reset()));
|
|
2499
2501
|
}
|
|
@@ -2505,7 +2507,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2505
2507
|
scales: !this.indicatorEngine.hasLeftScaleOverlays()
|
|
2506
2508
|
}
|
|
2507
2509
|
})), this.features.zooming) {
|
|
2508
|
-
this.interactionManager.setZoomHandler(new
|
|
2510
|
+
this.interactionManager.setZoomHandler(new At((e, t) => {
|
|
2509
2511
|
this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
|
|
2510
2512
|
}));
|
|
2511
2513
|
let e = new ge((e) => {
|
|
@@ -2533,7 +2535,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2533
2535
|
y: t.y
|
|
2534
2536
|
});
|
|
2535
2537
|
})), this.interactionManager.setChartContextMenu((e, t) => this.eventBus.hasListeners("chartContextMenu") ? (this.eventBus.emit("chartContextMenu", this.contextAt(e, t)), !0) : !1), this.applyPriceAxisAdd(), this.interactionManager.setPriceAxisAddButton(this.priceAxisAddButton, (e) => {
|
|
2536
|
-
let t =
|
|
2538
|
+
let t = tn(e.y, this.viewport.getState());
|
|
2537
2539
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
2538
2540
|
price: t,
|
|
2539
2541
|
x: e.x,
|
|
@@ -2546,7 +2548,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2546
2548
|
let e = new fe(this.alertManager, () => this.viewport.getState());
|
|
2547
2549
|
this.interactionManager.setAlertDragHandler(e);
|
|
2548
2550
|
}
|
|
2549
|
-
let o = new
|
|
2551
|
+
let o = new Ze();
|
|
2550
2552
|
o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
|
|
2551
2553
|
let t = this.getDisplayData();
|
|
2552
2554
|
if (t.length === 0) return;
|
|
@@ -2570,7 +2572,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2570
2572
|
x: e.x,
|
|
2571
2573
|
y: e.y
|
|
2572
2574
|
}), t.length === 0) return;
|
|
2573
|
-
let r =
|
|
2575
|
+
let r = en(e.x, this.viewport.getState());
|
|
2574
2576
|
r < 0 || r >= t.length || this.eventBus.emit("barClick", {
|
|
2575
2577
|
bar: t[r],
|
|
2576
2578
|
barIndex: r,
|
|
@@ -2615,7 +2617,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2615
2617
|
end: () => {
|
|
2616
2618
|
let e = this.selectionBoxOverlay.end();
|
|
2617
2619
|
if (e && this.zoomAreaMode) {
|
|
2618
|
-
if (e.x1 - e.x0 <
|
|
2620
|
+
if (e.x1 - e.x0 < Ti) return;
|
|
2619
2621
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
2620
2622
|
return;
|
|
2621
2623
|
}
|
|
@@ -2697,7 +2699,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2697
2699
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2698
2700
|
if (t.width <= 0) return;
|
|
2699
2701
|
let { from: n, to: r } = e;
|
|
2700
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2702
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(wi, r - n));
|
|
2701
2703
|
}));
|
|
2702
2704
|
}
|
|
2703
2705
|
useStreamHistory(e, t, n = !0) {
|
|
@@ -2811,7 +2813,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2811
2813
|
return this.extendedHours;
|
|
2812
2814
|
}
|
|
2813
2815
|
sessionKeep(e) {
|
|
2814
|
-
return this.extendedHours ? null :
|
|
2816
|
+
return this.extendedHours ? null : an(this.symbolInfo, e);
|
|
2815
2817
|
}
|
|
2816
2818
|
reapplyExtendedHours() {
|
|
2817
2819
|
if (!this.series.refilter()) return;
|
|
@@ -2822,7 +2824,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2822
2824
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2823
2825
|
}
|
|
2824
2826
|
setShapes(e) {
|
|
2825
|
-
let t =
|
|
2827
|
+
let t = Pi(e);
|
|
2826
2828
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2827
2829
|
...this.themeManager.getTheme().shape,
|
|
2828
2830
|
...t
|
|
@@ -2834,7 +2836,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2834
2836
|
setFont(e) {
|
|
2835
2837
|
if (e === null) this.themeManager.setFont(null);
|
|
2836
2838
|
else {
|
|
2837
|
-
let t =
|
|
2839
|
+
let t = Ni(e);
|
|
2838
2840
|
if (Object.keys(t).length === 0) return;
|
|
2839
2841
|
this.themeManager.setFont(t);
|
|
2840
2842
|
}
|
|
@@ -2950,8 +2952,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2950
2952
|
return {
|
|
2951
2953
|
...e,
|
|
2952
2954
|
priceRange: {
|
|
2953
|
-
min: t.min - n *
|
|
2954
|
-
max: t.max + n *
|
|
2955
|
+
min: t.min - n * Ci,
|
|
2956
|
+
max: t.max + n * Ci
|
|
2955
2957
|
},
|
|
2956
2958
|
logScale: !1,
|
|
2957
2959
|
scaleMode: "regular",
|
|
@@ -3015,8 +3017,25 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3015
3017
|
let t = this.panes.style(this.indicatorPanes.paneOf(e));
|
|
3016
3018
|
return t ? { ...t } : null;
|
|
3017
3019
|
}
|
|
3018
|
-
getIndicatorOutput(e) {
|
|
3019
|
-
return this.indicatorEngine.getOutput(e);
|
|
3020
|
+
getIndicatorOutput(e, t = {}) {
|
|
3021
|
+
return t.drawn ? this.indicatorEngine.peekOutput(e) : this.indicatorEngine.getOutput(e);
|
|
3022
|
+
}
|
|
3023
|
+
useIndicatorWorker() {
|
|
3024
|
+
this.indicatorWorker = It.acquire(), this.indicatorEngine.useWorker(this.indicatorWorker.client, {
|
|
3025
|
+
minBars: Be,
|
|
3026
|
+
onLand: () => this.indicatorsLandedSoon()
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3029
|
+
indicatorsLandedSoon() {
|
|
3030
|
+
this.indicatorsLanding || (this.indicatorsLanding = !0, queueMicrotask(() => {
|
|
3031
|
+
this.indicatorsLanding = !1, this.indicatorsLanded();
|
|
3032
|
+
}));
|
|
3033
|
+
}
|
|
3034
|
+
indicatorsLanded() {
|
|
3035
|
+
if (this.disposed) return;
|
|
3036
|
+
this.announceIndicatorUpdate(0), this.updateViewportAndRender();
|
|
3037
|
+
let e = this.series.bars().at(-1), t = this.alertManager.getAlerts().some((e) => e.channel !== "price" || e.target !== void 0);
|
|
3038
|
+
this.features.alerts && t && e && !this.replaySession && this.checkAlerts(e.close);
|
|
3020
3039
|
}
|
|
3021
3040
|
registerIndicator(e) {
|
|
3022
3041
|
this.pluginManager.registerIndicator(e);
|
|
@@ -3025,8 +3044,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3025
3044
|
return this.pluginManager;
|
|
3026
3045
|
}
|
|
3027
3046
|
static indicators() {
|
|
3028
|
-
let e = new
|
|
3029
|
-
return
|
|
3047
|
+
let e = new Ve();
|
|
3048
|
+
return Kt(e), e.getAvailableIndicators();
|
|
3030
3049
|
}
|
|
3031
3050
|
setPanelPosition(e, t) {
|
|
3032
3051
|
this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
|
|
@@ -3236,7 +3255,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3236
3255
|
}
|
|
3237
3256
|
autoFib() {
|
|
3238
3257
|
if (!this.features.drawings) return null;
|
|
3239
|
-
let e = this.getDisplayData(), t = this.viewport.getState(), n =
|
|
3258
|
+
let e = this.getDisplayData(), t = this.viewport.getState(), n = Nt(e, t.visibleRange.from, t.visibleRange.to);
|
|
3240
3259
|
return n ? this.addDrawing({
|
|
3241
3260
|
type: "fibRetracement",
|
|
3242
3261
|
anchors: [n[0], n[1]]
|
|
@@ -3249,9 +3268,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3249
3268
|
return this.drawingManager.removeDrawings(e);
|
|
3250
3269
|
}
|
|
3251
3270
|
nudgeSelectedDrawings(e) {
|
|
3252
|
-
let t =
|
|
3271
|
+
let t = Di[e.key];
|
|
3253
3272
|
if (!t || !this.features.drawings || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
3254
|
-
let n = e.shiftKey ?
|
|
3273
|
+
let n = e.shiftKey ? Ei : 1, r = {
|
|
3255
3274
|
...this.viewport.getState(),
|
|
3256
3275
|
data: this.getDisplayData()
|
|
3257
3276
|
};
|
|
@@ -3392,7 +3411,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3392
3411
|
x: t.x,
|
|
3393
3412
|
y: t.y
|
|
3394
3413
|
};
|
|
3395
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
3414
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = tn(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
|
|
3396
3415
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
3397
3416
|
e && (r.pane = e.instanceId);
|
|
3398
3417
|
}
|
|
@@ -3400,7 +3419,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3400
3419
|
}
|
|
3401
3420
|
applyPriceAxisAdd() {
|
|
3402
3421
|
let e = this.features.priceAxisAddButton && this.features.crosshair;
|
|
3403
|
-
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ?
|
|
3422
|
+
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Ye : 0);
|
|
3404
3423
|
}
|
|
3405
3424
|
setPriceAxisAddButton(e) {
|
|
3406
3425
|
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(i.Overlay);
|
|
@@ -3657,11 +3676,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3657
3676
|
this.replayTrades() || this.tradingManager.setCurrentPrice(e), this.features.alerts && this.checkAlerts(e);
|
|
3658
3677
|
}
|
|
3659
3678
|
checkAlerts(e) {
|
|
3660
|
-
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.replaySession || this.series.length() === 0 ? null : (e) =>
|
|
3661
|
-
|
|
3679
|
+
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.indicatorEngine, r = this.replaySession || this.series.length() === 0 ? null : (e) => n.isComputingInWorker(e) ? void 0 : n.peekOutput(e)?.series;
|
|
3680
|
+
oi(this.alertManager, {
|
|
3662
3681
|
price: e,
|
|
3663
3682
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3664
|
-
lines:
|
|
3683
|
+
lines: r
|
|
3665
3684
|
});
|
|
3666
3685
|
}
|
|
3667
3686
|
setTradingConfig(e) {
|
|
@@ -3670,11 +3689,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3670
3689
|
async connect(e) {
|
|
3671
3690
|
let t = {
|
|
3672
3691
|
...e,
|
|
3673
|
-
adapter:
|
|
3692
|
+
adapter: qt(e),
|
|
3674
3693
|
feed: void 0
|
|
3675
3694
|
};
|
|
3676
3695
|
if (!j(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
3677
|
-
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new
|
|
3696
|
+
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new vt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (e) => {
|
|
3678
3697
|
let n = this.streamSeriesKey(t.adapter);
|
|
3679
3698
|
n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(e) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(e) : (this.replaySession && this.useStreamHistory(t.adapter, t.historyPageSize, !1), this.setData(e)), this.snapshotKey = n, this.useStreamHistory(t.adapter, t.historyPageSize);
|
|
3680
3699
|
}), this.streamManager.on("barClose", (e) => {
|
|
@@ -3736,7 +3755,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3736
3755
|
}, 1e3);
|
|
3737
3756
|
}
|
|
3738
3757
|
streamSeriesKey(e) {
|
|
3739
|
-
let t = P(e), n = this.streamTimeframe, r = t instanceof
|
|
3758
|
+
let t = P(e), n = this.streamTimeframe, r = t instanceof ct && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3740
3759
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3741
3760
|
}
|
|
3742
3761
|
setStreamTarget(e, t) {
|
|
@@ -3779,7 +3798,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3779
3798
|
}
|
|
3780
3799
|
connectExecution(e, t = {}) {
|
|
3781
3800
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3782
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3801
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Vr(e, {
|
|
3783
3802
|
onIntent: (e, t) => {
|
|
3784
3803
|
let n = (e) => t(e.payload);
|
|
3785
3804
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -3910,7 +3929,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3910
3929
|
setVisibleRangePreset(e) {
|
|
3911
3930
|
let t = this.getDisplayData();
|
|
3912
3931
|
if (t.length === 0) return;
|
|
3913
|
-
let n = t.length - 1, r = d(t), i =
|
|
3932
|
+
let n = t.length - 1, r = d(t), i = Ut(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
3914
3933
|
if (a === null || a < t[0].time) {
|
|
3915
3934
|
this.fitContent();
|
|
3916
3935
|
return;
|
|
@@ -4095,14 +4114,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4095
4114
|
return this.crosshairHandler.getMode();
|
|
4096
4115
|
}
|
|
4097
4116
|
setCrosshairCursor(e) {
|
|
4098
|
-
!
|
|
4117
|
+
!Lt(e) || e === this.crosshairHandler.getCursor() || (this.crosshairHandler.setCursor(e), this.applyIdleCursor(), this.engine.requestRender(i.Hover), this.eventBus.emit("crosshairCursorChange", { cursor: e }));
|
|
4099
4118
|
}
|
|
4100
4119
|
getCrosshairCursor() {
|
|
4101
4120
|
return this.crosshairHandler.getCursor();
|
|
4102
4121
|
}
|
|
4103
4122
|
applyIdleCursor() {
|
|
4104
4123
|
let e = this.themeManager.getTheme(), t = e.style?.crosshair.vertical.color ?? e.crosshair;
|
|
4105
|
-
this.interactionManager.setIdleCursor(
|
|
4124
|
+
this.interactionManager.setIdleCursor(Ft(this.crosshairHandler.getCursor(), t, e.background));
|
|
4106
4125
|
}
|
|
4107
4126
|
setCrosshairPosition(e) {
|
|
4108
4127
|
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(i.Hover);
|
|
@@ -4118,7 +4137,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4118
4137
|
}
|
|
4119
4138
|
let t = this.crosshairSeries(), n = e >= 0 && e < t.length ? t[e] : void 0, r = n && e > 0 ? t[e - 1] : void 0;
|
|
4120
4139
|
this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(n ?? null, r ?? null);
|
|
4121
|
-
let i = n ?
|
|
4140
|
+
let i = n ? jt(t)[e]?.time ?? n.time : void 0;
|
|
4122
4141
|
this.eventBus.emit("crosshairSync", {
|
|
4123
4142
|
barIndex: e,
|
|
4124
4143
|
...n ? { bar: n } : {},
|
|
@@ -4197,7 +4216,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4197
4216
|
return this.periodLevels.getPeriod();
|
|
4198
4217
|
}
|
|
4199
4218
|
setTimeZone(e) {
|
|
4200
|
-
|
|
4219
|
+
xi(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
4201
4220
|
}
|
|
4202
4221
|
getTimeZone() {
|
|
4203
4222
|
return this.timeZoneSetting;
|
|
@@ -4233,7 +4252,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4233
4252
|
this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
|
|
4234
4253
|
}
|
|
4235
4254
|
holdStudyZone() {
|
|
4236
|
-
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(),
|
|
4255
|
+
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), dt);
|
|
4237
4256
|
}
|
|
4238
4257
|
endStudyZoneWait() {
|
|
4239
4258
|
this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
|
|
@@ -4262,7 +4281,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4262
4281
|
}
|
|
4263
4282
|
useSymbolInfo(e) {
|
|
4264
4283
|
let t = e && this.symbolInfo?.symbol === e.symbol ? T(this.symbolInfo) : void 0;
|
|
4265
|
-
this.symbolInfo = e ?
|
|
4284
|
+
this.symbolInfo = e ? Si({
|
|
4266
4285
|
...e,
|
|
4267
4286
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
4268
4287
|
}, t) : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(i.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
@@ -4287,7 +4306,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4287
4306
|
if (!e || typeof e != "object") return;
|
|
4288
4307
|
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
4289
4308
|
if (!n(e.symbol)) return;
|
|
4290
|
-
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i =
|
|
4309
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = Si({
|
|
4291
4310
|
...r,
|
|
4292
4311
|
...e,
|
|
4293
4312
|
symbol: e.symbol || r?.symbol || t
|
|
@@ -4326,7 +4345,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4326
4345
|
return this.sessionShading.isVisible();
|
|
4327
4346
|
}
|
|
4328
4347
|
setSessionShadingConfig(e) {
|
|
4329
|
-
this.hostSessionHours =
|
|
4348
|
+
this.hostSessionHours = Vt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(i.Background);
|
|
4330
4349
|
}
|
|
4331
4350
|
setTooltipVisible(e) {
|
|
4332
4351
|
e || this.crosshairTooltip.hide();
|
|
@@ -4348,11 +4367,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4348
4367
|
return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
|
|
4349
4368
|
}
|
|
4350
4369
|
async takeGpu(e, t, n) {
|
|
4351
|
-
let { gpu: r, reason: i } = await
|
|
4352
|
-
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ?
|
|
4370
|
+
let { gpu: r, reason: i } = await Bt(e);
|
|
4371
|
+
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? Pt() > 0 ? this.takeGpu(e, t, n) : (this.waitForGpu(() => void this.takeGpu(e, t, !1)), n && this.applyRenderer(null, "limit"), this.getRenderer()) : ((r || n) && this.applyRenderer(r, i), this.getRenderer());
|
|
4353
4372
|
}
|
|
4354
4373
|
waitForGpu(e) {
|
|
4355
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
4374
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? $t(e) : null;
|
|
4356
4375
|
}
|
|
4357
4376
|
getRenderer() {
|
|
4358
4377
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -4522,24 +4541,24 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4522
4541
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
4523
4542
|
if (!this.replaySession) {
|
|
4524
4543
|
if (this.series.length() === 0) return;
|
|
4525
|
-
this.series.beginReplay(), this.replaySession =
|
|
4544
|
+
this.series.beginReplay(), this.replaySession = zi(this.currentSymbol);
|
|
4526
4545
|
}
|
|
4527
4546
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4528
4547
|
c.animate = c.animate === !0;
|
|
4529
4548
|
let l = this.series.inHoursShown(this.series.liveBars()), u = t > 0 && i === void 0 && a !== !1, d = c.startIndex;
|
|
4530
|
-
i !== void 0 && d === void 0 ? d =
|
|
4549
|
+
i !== void 0 && d === void 0 ? d = pi(l, i) : u && d !== void 0 && (d += t);
|
|
4531
4550
|
let f = u ? t : a && d !== void 0 && d > 0 ? Math.min(Math.floor(d), l.length - 1) : 0, p = f > 0 ? l.slice(f) : l;
|
|
4532
4551
|
d !== void 0 && (c.startIndex = d - f), n.windowTime = f > 0 ? p[0]?.time ?? null : null, n.steps = r ?? null, n.stepsSymbol = this.currentSymbol, n.until = null, n.animate = c.animate, n.step = c.animate ? s ?? null : null, this.replayRevealMarks = o !== !1, this.useReplayLoader(n, !0);
|
|
4533
4552
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4534
4553
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4535
4554
|
let h = this.replayStepsSeries;
|
|
4536
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4555
|
+
h && c.startIndex !== void 0 && (c.startIndex = qi(h, p, c.startIndex));
|
|
4537
4556
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4538
4557
|
this.revealReplayMarks(this.replayRevealMarks ? _?.time ?? null : null), n.held && (n.held.state = c.paused ? "paused" : "playing", c.paused = !0), !c.paused && c.startIndex !== void 0 && c.startIndex >= 1 && this.replaySeek(c.startIndex - 1), this.replayManager.play(c);
|
|
4539
4558
|
}
|
|
4540
4559
|
buildReplay(e, t, n) {
|
|
4541
4560
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4542
|
-
this.replayPieces = r && t ?
|
|
4561
|
+
this.replayPieces = r && t ? Xi(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4543
4562
|
let a = this.replayRestarting;
|
|
4544
4563
|
this.replayRestarting = !0;
|
|
4545
4564
|
try {
|
|
@@ -4553,7 +4572,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4553
4572
|
let n = t, a = e[t];
|
|
4554
4573
|
if (i) {
|
|
4555
4574
|
let r = i[t];
|
|
4556
|
-
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ?
|
|
4575
|
+
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? Qi(c, r) : Ji(e[n], i, t), a = Yi(i, e, t, n) ? e[n] : c;
|
|
4557
4576
|
}
|
|
4558
4577
|
let u = this.replayForming;
|
|
4559
4578
|
this.replayForming = null, s = t;
|
|
@@ -4577,7 +4596,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4577
4596
|
});
|
|
4578
4597
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4579
4598
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4580
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4599
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Zi() ? ni(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = ti(r, i);
|
|
4581
4600
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4582
4601
|
index: t,
|
|
4583
4602
|
path: r
|
|
@@ -4595,19 +4614,19 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4595
4614
|
}
|
|
4596
4615
|
replayPathOf(e, t) {
|
|
4597
4616
|
let n = e[t];
|
|
4598
|
-
return
|
|
4617
|
+
return Xr(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4599
4618
|
}
|
|
4600
4619
|
loadReplaySteps(e, t) {
|
|
4601
4620
|
let n = this.replayLoader?.loader;
|
|
4602
4621
|
if (!n) return;
|
|
4603
4622
|
n.evictBefore(e[t].time);
|
|
4604
4623
|
let r = this.replayManager.getStepMs();
|
|
4605
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
4624
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(Fi / r) : 1);
|
|
4606
4625
|
}
|
|
4607
4626
|
useReplayLoader(e, t) {
|
|
4608
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4627
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? ai(e.step, r, (e) => j(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
4609
4628
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4610
|
-
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new
|
|
4629
|
+
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new Ur({
|
|
4611
4630
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4612
4631
|
step: i,
|
|
4613
4632
|
ratio: Math.max(1, Math.round(l / E(i))),
|
|
@@ -4623,7 +4642,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4623
4642
|
feedReplayForming(e, t, n, r) {
|
|
4624
4643
|
let i = this.replaySession;
|
|
4625
4644
|
if (!i || !this.executionAdapter?.setMarkPrice) return;
|
|
4626
|
-
let a =
|
|
4645
|
+
let a = vi(e, t, n, r, {
|
|
4627
4646
|
time: i.fedTime,
|
|
4628
4647
|
fraction: i.fedFraction
|
|
4629
4648
|
}, (e, t) => this.replayPathOf(e, t));
|
|
@@ -4645,9 +4664,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4645
4664
|
if (!t) return;
|
|
4646
4665
|
let n = this.series.inHoursShown(this.series.liveBars());
|
|
4647
4666
|
if (n.length === 0) return;
|
|
4648
|
-
let r = t.windowTime === null ? 0 : Math.min(
|
|
4667
|
+
let r = t.windowTime === null ? 0 : Math.min(pi(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4649
4668
|
this.useReplayLoader(t, !1);
|
|
4650
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4669
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Hi(o ?? i, t.until);
|
|
4651
4670
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4652
4671
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4653
4672
|
return;
|
|
@@ -4655,7 +4674,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4655
4674
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4656
4675
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4657
4676
|
let d = this.replayManager.remainingMs();
|
|
4658
|
-
this.clearBarHolders(), t.animate &&
|
|
4677
|
+
this.clearBarHolders(), t.animate && Vi(t, this.replayCoarse, i);
|
|
4659
4678
|
let f = this.replayRestarting;
|
|
4660
4679
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4661
4680
|
try {
|
|
@@ -4678,14 +4697,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4678
4697
|
}
|
|
4679
4698
|
replayStepsOver(e, t, n = !1) {
|
|
4680
4699
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4681
|
-
let r =
|
|
4682
|
-
return r && (n ||
|
|
4700
|
+
let r = Ki(this.series.inHoursShown(e.steps), t);
|
|
4701
|
+
return r && (n || Wi(r, t)) ? r : null;
|
|
4683
4702
|
}
|
|
4684
4703
|
canPageBackForReplay(e) {
|
|
4685
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4704
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < Ii;
|
|
4686
4705
|
}
|
|
4687
4706
|
async pageBackForReplay(e) {
|
|
4688
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4707
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = Ii, this.rebaseReplay("older"));
|
|
4689
4708
|
}
|
|
4690
4709
|
holdReplay() {
|
|
4691
4710
|
let e = this.replaySession;
|
|
@@ -4718,7 +4737,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4718
4737
|
this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4719
4738
|
}
|
|
4720
4739
|
replaySeekToTime(e) {
|
|
4721
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4740
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, Hi(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4722
4741
|
}
|
|
4723
4742
|
feedReplayPrice(e, t) {
|
|
4724
4743
|
let n = this.executionAdapter;
|
|
@@ -4733,7 +4752,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4733
4752
|
feedReplaySteps(e, t) {
|
|
4734
4753
|
let n = this.replaySession;
|
|
4735
4754
|
if (!n || !this.executionAdapter?.setMarkPrice) return;
|
|
4736
|
-
let r =
|
|
4755
|
+
let r = _i(e, t, {
|
|
4737
4756
|
time: n.fedTime,
|
|
4738
4757
|
fraction: n.fedFraction
|
|
4739
4758
|
});
|
|
@@ -4747,7 +4766,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4747
4766
|
}
|
|
4748
4767
|
replaySeekToBar(e) {
|
|
4749
4768
|
let t = this.replayStepsSeries;
|
|
4750
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4769
|
+
this.replaySeek(t && this.replayCoarse ? qi(t, this.replayCoarse, e) : e);
|
|
4751
4770
|
}
|
|
4752
4771
|
replayPause() {
|
|
4753
4772
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4788,7 +4807,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4788
4807
|
let { x: r, y: c } = this.drawingManager.anchorPoint(t.type, e, n);
|
|
4789
4808
|
i = Math.min(i, r), a = Math.max(a, r), o = Math.min(o, c), s = Math.max(s, c);
|
|
4790
4809
|
}
|
|
4791
|
-
if (
|
|
4810
|
+
if (Oi.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), ki.has(t.type) && ([o, s] = [r.y, r.y + r.height]), a < r.x || i > r.x + r.width || s < r.y || o > r.y + r.height) return null;
|
|
4792
4811
|
let c = this.drawingManager.drawnExtent(e);
|
|
4793
4812
|
return c && (i = Math.min(i, c.x), a = Math.max(a, c.x + c.width), o = Math.min(o, c.y), s = Math.max(s, c.y + c.height)), i = Math.max(i, r.x), a = Math.min(a, r.x + r.width), o = Math.max(o, r.y), s = Math.min(s, r.y + r.height), i <= a && o <= s ? {
|
|
4794
4813
|
x: i,
|
|
@@ -4839,12 +4858,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4839
4858
|
});
|
|
4840
4859
|
}
|
|
4841
4860
|
restoreIndicators(e, t) {
|
|
4842
|
-
let n =
|
|
4861
|
+
let n = tr(e), r = /* @__PURE__ */ new Map();
|
|
4843
4862
|
this.unrestoredIndicators = [];
|
|
4844
4863
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4845
4864
|
if (t) {
|
|
4846
4865
|
let e = this.getIndicatorSetup();
|
|
4847
|
-
for (let t of
|
|
4866
|
+
for (let t of rr(e, n)) o.add(t);
|
|
4848
4867
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4849
4868
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4850
4869
|
for (let e = !0; e;) {
|
|
@@ -4855,7 +4874,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4855
4874
|
}
|
|
4856
4875
|
}
|
|
4857
4876
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4858
|
-
let s = (e) =>
|
|
4877
|
+
let s = (e) => ar(e, r);
|
|
4859
4878
|
for (let e of n) {
|
|
4860
4879
|
let n = null;
|
|
4861
4880
|
if (o.has(e.instanceId)) {
|
|
@@ -4888,7 +4907,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4888
4907
|
}
|
|
4889
4908
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
4890
4909
|
}
|
|
4891
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
4910
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), er(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
4892
4911
|
}
|
|
4893
4912
|
restoreLooks(e, t) {
|
|
4894
4913
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -4908,7 +4927,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4908
4927
|
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? oe(t.paneStyle) : null);
|
|
4909
4928
|
}
|
|
4910
4929
|
getIndicatorSetup() {
|
|
4911
|
-
return [
|
|
4930
|
+
return [...$n(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
4912
4931
|
}
|
|
4913
4932
|
applyIndicatorSetup(e) {
|
|
4914
4933
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -4917,7 +4936,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4917
4936
|
});
|
|
4918
4937
|
}
|
|
4919
4938
|
followIndicatorAlerts(e, t) {
|
|
4920
|
-
this.features.alerts &&
|
|
4939
|
+
this.features.alerts && ci(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
4921
4940
|
}
|
|
4922
4941
|
beginIndicatorEdit(e) {
|
|
4923
4942
|
this.indicatorHistory.begin(e);
|
|
@@ -4941,17 +4960,17 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4941
4960
|
keptPaneDrawings = [];
|
|
4942
4961
|
replayingIndicatorStep = !1;
|
|
4943
4962
|
takesDrawing(e, t) {
|
|
4944
|
-
return
|
|
4963
|
+
return dr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
4945
4964
|
}
|
|
4946
4965
|
renamePane(e, t) {
|
|
4947
4966
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
4948
4967
|
}
|
|
4949
4968
|
drawingPaneAt(e) {
|
|
4950
|
-
return
|
|
4969
|
+
return lr(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
4951
4970
|
}
|
|
4952
4971
|
drawingPaneViewport(e) {
|
|
4953
4972
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
4954
|
-
return
|
|
4973
|
+
return ur(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
4955
4974
|
}
|
|
4956
4975
|
saveState(e) {
|
|
4957
4976
|
if (!this.features.saveLoad) return null;
|
|
@@ -4965,7 +4984,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4965
4984
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
4966
4985
|
this.drawingManager.renamePanes(n);
|
|
4967
4986
|
let r = new Set(this.unrestoredIndicators.map((e) => e.instanceId)), i = this.drawingManager.getDrawings(), a = i.filter((e) => e.paneId === void 0 || this.takesDrawing(e.paneId, e.type));
|
|
4968
|
-
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts &&
|
|
4987
|
+
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts && di(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
4969
4988
|
console.warn("Layout alert left out:", e);
|
|
4970
4989
|
}), this.markStateChanged();
|
|
4971
4990
|
}
|
|
@@ -5030,10 +5049,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5030
5049
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(n), this.eventBus.emit("resize", e);
|
|
5031
5050
|
}
|
|
5032
5051
|
destroy() {
|
|
5033
|
-
this.disposed = !0, this.stopWatchingVisibility?.(), this.stopWatchingVisibility = null, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.labelWidths.destroy(), this.container.innerHTML = "";
|
|
5052
|
+
this.disposed = !0, this.indicatorEngine.stopWorker(), this.indicatorWorker?.release(), this.indicatorWorker = null, this.stopWatchingVisibility?.(), this.stopWatchingVisibility = null, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.labelWidths.destroy(), this.container.innerHTML = "";
|
|
5034
5053
|
}
|
|
5035
5054
|
createChartRenderer(e) {
|
|
5036
|
-
let t =
|
|
5055
|
+
let t = jn(e, (e) => this.pluginManager.getChartType(e));
|
|
5037
5056
|
return t instanceof Re && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5038
5057
|
}
|
|
5039
5058
|
crosshairSeries() {
|
|
@@ -5052,7 +5071,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5052
5071
|
}
|
|
5053
5072
|
exportBars() {
|
|
5054
5073
|
if (this.isTimeAligned()) return this.series.bars();
|
|
5055
|
-
let e = this.getDisplayData(), t =
|
|
5074
|
+
let e = this.getDisplayData(), t = jt(e);
|
|
5056
5075
|
return e.map((e, n) => ({
|
|
5057
5076
|
...e,
|
|
5058
5077
|
time: t[n]?.time ?? e.time
|
|
@@ -5111,7 +5130,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5111
5130
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5112
5131
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5113
5132
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5114
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5133
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && Wn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5115
5134
|
});
|
|
5116
5135
|
}
|
|
5117
5136
|
updateViewportAndRender(e = !1) {
|
|
@@ -5126,7 +5145,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5126
5145
|
fitLeftAxisWidth() {
|
|
5127
5146
|
let e = this.leftViewport;
|
|
5128
5147
|
if (!e) return !1;
|
|
5129
|
-
let t = this.themeManager.getTheme(), n =
|
|
5148
|
+
let t = this.themeManager.getTheme(), n = Dr({
|
|
5130
5149
|
min: e.priceRange.min,
|
|
5131
5150
|
max: e.priceRange.max,
|
|
5132
5151
|
lastPrice: null,
|
|
@@ -5135,12 +5154,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5135
5154
|
fontFamily: t.font.family,
|
|
5136
5155
|
fontSizeSmall: t.font.sizeSmall,
|
|
5137
5156
|
measure: (e, t) => this.measureText(e, t)
|
|
5138
|
-
}), r =
|
|
5157
|
+
}), r = Or(this.leftAxisWidth, n);
|
|
5139
5158
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5140
5159
|
}
|
|
5141
5160
|
fitPriceAxisWidth() {
|
|
5142
5161
|
if (!this.features.priceAxis) return !1;
|
|
5143
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5162
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = Dr({
|
|
5144
5163
|
min: e.min,
|
|
5145
5164
|
max: e.max,
|
|
5146
5165
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5151,14 +5170,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5151
5170
|
fontFamily: t.font.family,
|
|
5152
5171
|
fontSizeSmall: t.font.sizeSmall,
|
|
5153
5172
|
measure: (e, t) => this.measureText(e, t)
|
|
5154
|
-
}), r =
|
|
5173
|
+
}), r = Or(this.priceAxisWidth, n);
|
|
5155
5174
|
return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5156
5175
|
}
|
|
5157
5176
|
measureText(e, t) {
|
|
5158
5177
|
let n = this.engine.layerManager.getLayer(i.Main)?.ctx;
|
|
5159
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
5178
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => ji(n, e, t));
|
|
5160
5179
|
let r = n ?? this.detachedMeasureContext();
|
|
5161
|
-
return r ?
|
|
5180
|
+
return r ? ji(r, e, t) : e.length * 7;
|
|
5162
5181
|
}
|
|
5163
5182
|
detachedMeasureContext() {
|
|
5164
5183
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -5246,7 +5265,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5246
5265
|
});
|
|
5247
5266
|
}
|
|
5248
5267
|
drawOverlayPlugins(e, t) {
|
|
5249
|
-
let n =
|
|
5268
|
+
let n = Nr(this.pluginManager.getOverlays(), t);
|
|
5250
5269
|
if (n.length === 0) return;
|
|
5251
5270
|
let r = {
|
|
5252
5271
|
viewport: this.viewport.getState(),
|
|
@@ -5267,15 +5286,15 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5267
5286
|
};
|
|
5268
5287
|
}
|
|
5269
5288
|
};
|
|
5270
|
-
function
|
|
5289
|
+
function ji(e, t, n) {
|
|
5271
5290
|
let r = e.font;
|
|
5272
5291
|
e.font = n;
|
|
5273
5292
|
let i = e.measureText(t).width;
|
|
5274
5293
|
return e.font = r, i;
|
|
5275
5294
|
}
|
|
5276
|
-
var
|
|
5277
|
-
function
|
|
5278
|
-
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <=
|
|
5295
|
+
var Mi = 300;
|
|
5296
|
+
function Ni(e) {
|
|
5297
|
+
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <= Mi && !/[;{}<>\\]|\/\*/.test(e);
|
|
5279
5298
|
n(e.family) && (t.family = e.family), n(e.textFamily) && (t.textFamily = e.textFamily);
|
|
5280
5299
|
for (let n of [
|
|
5281
5300
|
"sizeSmall",
|
|
@@ -5287,7 +5306,7 @@ function ji(e) {
|
|
|
5287
5306
|
}
|
|
5288
5307
|
return t;
|
|
5289
5308
|
}
|
|
5290
|
-
function
|
|
5309
|
+
function Pi(e) {
|
|
5291
5310
|
let t = e.tagRadius;
|
|
5292
5311
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
5293
5312
|
}
|
|
@@ -5306,8 +5325,8 @@ function X(e) {
|
|
|
5306
5325
|
bars: e.bars
|
|
5307
5326
|
};
|
|
5308
5327
|
}
|
|
5309
|
-
var
|
|
5310
|
-
function
|
|
5328
|
+
var Fi = 8e3, Ii = 10, Li = 50, Ri = .001;
|
|
5329
|
+
function zi(e) {
|
|
5311
5330
|
return {
|
|
5312
5331
|
price: null,
|
|
5313
5332
|
fedTime: null,
|
|
@@ -5322,48 +5341,48 @@ function Li(e) {
|
|
|
5322
5341
|
held: null
|
|
5323
5342
|
};
|
|
5324
5343
|
}
|
|
5325
|
-
function
|
|
5344
|
+
function Bi(e, t) {
|
|
5326
5345
|
let n = e[t + 1];
|
|
5327
|
-
return n ? n.time - e[t].time :
|
|
5346
|
+
return n ? n.time - e[t].time : Gi(e);
|
|
5328
5347
|
}
|
|
5329
|
-
function
|
|
5348
|
+
function Vi(e, t, n) {
|
|
5330
5349
|
let r = e.fedTime;
|
|
5331
5350
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5332
|
-
let i =
|
|
5351
|
+
let i = Bi(t, Z(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Z(n, a), s = n[o].time;
|
|
5333
5352
|
if (s > a) return;
|
|
5334
|
-
let c =
|
|
5353
|
+
let c = Bi(n, o);
|
|
5335
5354
|
if (a === s && o > 0) {
|
|
5336
5355
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
5337
5356
|
return;
|
|
5338
5357
|
}
|
|
5339
5358
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5340
5359
|
}
|
|
5341
|
-
function
|
|
5342
|
-
let n =
|
|
5343
|
-
return n > r && r >= 0 && e[r].time +
|
|
5360
|
+
function Hi(e, t) {
|
|
5361
|
+
let n = mi(e, t), r = e.length - 1;
|
|
5362
|
+
return n > r && r >= 0 && e[r].time + Gi(e) <= t ? r : Math.max(-1, n - 2);
|
|
5344
5363
|
}
|
|
5345
|
-
function
|
|
5364
|
+
function Ui(e) {
|
|
5346
5365
|
let t = Infinity;
|
|
5347
5366
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
5348
5367
|
return t;
|
|
5349
5368
|
}
|
|
5350
|
-
function
|
|
5351
|
-
if (!(
|
|
5352
|
-
let n = Math.max(0, e.length -
|
|
5369
|
+
function Wi(e, t) {
|
|
5370
|
+
if (!(Ui(e) < Ui(t))) return !1;
|
|
5371
|
+
let n = Math.max(0, e.length - Li);
|
|
5353
5372
|
for (let r = n; r < e.length; r++) {
|
|
5354
|
-
let n = t[Z(t, e[r].time)], i = (n.high - n.low) *
|
|
5373
|
+
let n = t[Z(t, e[r].time)], i = (n.high - n.low) * Ri + 2 ** -52;
|
|
5355
5374
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5356
5375
|
}
|
|
5357
5376
|
return !0;
|
|
5358
5377
|
}
|
|
5359
|
-
function
|
|
5378
|
+
function Gi(e) {
|
|
5360
5379
|
let t = 0;
|
|
5361
5380
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5362
5381
|
return t > 0 ? t : Infinity;
|
|
5363
5382
|
}
|
|
5364
|
-
function
|
|
5383
|
+
function Ki(e, t) {
|
|
5365
5384
|
if (t.length === 0) return null;
|
|
5366
|
-
let n = t[t.length - 1].time +
|
|
5385
|
+
let n = t[t.length - 1].time + Gi(t), r = e.filter((e) => zn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5367
5386
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5368
5387
|
if (i.length === 0) return null;
|
|
5369
5388
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5379,26 +5398,26 @@ function Z(e, t) {
|
|
|
5379
5398
|
}
|
|
5380
5399
|
return n;
|
|
5381
5400
|
}
|
|
5382
|
-
function
|
|
5401
|
+
function qi(e, t, n) {
|
|
5383
5402
|
let r = Math.max(0, Math.min(Math.floor(Number.isFinite(n) ? n : 0), t.length - 1)), i = r + 1 < t.length ? t[r + 1].time : Infinity, a = -1;
|
|
5384
5403
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5385
5404
|
return Math.max(0, a);
|
|
5386
5405
|
}
|
|
5387
|
-
function
|
|
5406
|
+
function Ji(e, t, n) {
|
|
5388
5407
|
let r = n;
|
|
5389
5408
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5390
5409
|
let i = {
|
|
5391
5410
|
...t[r],
|
|
5392
5411
|
time: e.time
|
|
5393
5412
|
};
|
|
5394
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5413
|
+
for (let e = r + 1; e <= n; e++) i = Qi(i, t[e]);
|
|
5395
5414
|
return i;
|
|
5396
5415
|
}
|
|
5397
|
-
function
|
|
5416
|
+
function Yi(e, t, n, r) {
|
|
5398
5417
|
let i = e[n + 1], a = t[r + 1];
|
|
5399
5418
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5400
5419
|
}
|
|
5401
|
-
function
|
|
5420
|
+
function Xi(e, t) {
|
|
5402
5421
|
let n = /* @__PURE__ */ new Map();
|
|
5403
5422
|
for (let r of e) {
|
|
5404
5423
|
let e = t[Z(t, r.time)].time, i = n.get(e);
|
|
@@ -5406,10 +5425,10 @@ function Ji(e, t) {
|
|
|
5406
5425
|
}
|
|
5407
5426
|
return n;
|
|
5408
5427
|
}
|
|
5409
|
-
function
|
|
5428
|
+
function Zi() {
|
|
5410
5429
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5411
5430
|
}
|
|
5412
|
-
function
|
|
5431
|
+
function Qi(e, t) {
|
|
5413
5432
|
return {
|
|
5414
5433
|
time: e.time,
|
|
5415
5434
|
open: e.open,
|
|
@@ -5421,26 +5440,26 @@ function Xi(e, t) {
|
|
|
5421
5440
|
}
|
|
5422
5441
|
//#endregion
|
|
5423
5442
|
//#region src/io/parseOHLCV.ts
|
|
5424
|
-
var
|
|
5443
|
+
var $i = [
|
|
5425
5444
|
"time",
|
|
5426
5445
|
"timestamp",
|
|
5427
5446
|
"date",
|
|
5428
5447
|
"datetime",
|
|
5429
5448
|
"t"
|
|
5430
|
-
],
|
|
5449
|
+
], ea = ["open", "o"], ta = ["high", "h"], na = ["low", "l"], ra = ["close", "c"], ia = [
|
|
5431
5450
|
"volume",
|
|
5432
5451
|
"vol",
|
|
5433
5452
|
"v"
|
|
5434
5453
|
];
|
|
5435
|
-
function
|
|
5454
|
+
function aa(e) {
|
|
5436
5455
|
let t = e.trim();
|
|
5437
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5456
|
+
return t ? t[0] === "[" || t[0] === "{" ? oa(t) : sa(t) : {
|
|
5438
5457
|
data: [],
|
|
5439
5458
|
rowCount: 0,
|
|
5440
5459
|
skipped: 0
|
|
5441
5460
|
};
|
|
5442
5461
|
}
|
|
5443
|
-
function
|
|
5462
|
+
function oa(e) {
|
|
5444
5463
|
let t;
|
|
5445
5464
|
try {
|
|
5446
5465
|
t = JSON.parse(e);
|
|
@@ -5450,19 +5469,19 @@ function ia(e) {
|
|
|
5450
5469
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5451
5470
|
let n = [], r = 0;
|
|
5452
5471
|
for (let e of t) {
|
|
5453
|
-
let t = Array.isArray(e) ?
|
|
5472
|
+
let t = Array.isArray(e) ? fa(e) : da(e);
|
|
5454
5473
|
t ? n.push(t) : r++;
|
|
5455
5474
|
}
|
|
5456
|
-
return
|
|
5475
|
+
return ma(n, t.length, r);
|
|
5457
5476
|
}
|
|
5458
|
-
function
|
|
5477
|
+
function sa(e) {
|
|
5459
5478
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5460
5479
|
if (t.length === 0) return {
|
|
5461
5480
|
data: [],
|
|
5462
5481
|
rowCount: 0,
|
|
5463
5482
|
skipped: 0
|
|
5464
5483
|
};
|
|
5465
|
-
let n =
|
|
5484
|
+
let n = ca(t[0]), r = la(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? ua(r) : {
|
|
5466
5485
|
time: 0,
|
|
5467
5486
|
open: 1,
|
|
5468
5487
|
high: 2,
|
|
@@ -5473,7 +5492,7 @@ function aa(e) {
|
|
|
5473
5492
|
if (a.time < 0 || a.open < 0 || a.high < 0 || a.low < 0 || a.close < 0) throw Error("CSV is missing required column(s): time, open, high, low, close");
|
|
5474
5493
|
let o = [], s = 0;
|
|
5475
5494
|
for (let e = +!!i; e < t.length; e++) {
|
|
5476
|
-
let r =
|
|
5495
|
+
let r = la(t[e], n), i = pa(r[a.time]), c = Q(r[a.open]), l = Q(r[a.high]), u = Q(r[a.low]), d = Q(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
5477
5496
|
if (i === null || ![
|
|
5478
5497
|
c,
|
|
5479
5498
|
l,
|
|
@@ -5492,9 +5511,9 @@ function aa(e) {
|
|
|
5492
5511
|
volume: Number.isFinite(f) ? f : 0
|
|
5493
5512
|
});
|
|
5494
5513
|
}
|
|
5495
|
-
return
|
|
5514
|
+
return ma(o, t.length - +!!i, s);
|
|
5496
5515
|
}
|
|
5497
|
-
function
|
|
5516
|
+
function ca(e) {
|
|
5498
5517
|
let t = {
|
|
5499
5518
|
",": 0,
|
|
5500
5519
|
";": 0,
|
|
@@ -5506,7 +5525,7 @@ function oa(e) {
|
|
|
5506
5525
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5507
5526
|
return n;
|
|
5508
5527
|
}
|
|
5509
|
-
function
|
|
5528
|
+
function la(e, t) {
|
|
5510
5529
|
let n = [], r = "", i = !1;
|
|
5511
5530
|
for (let a = 0; a < e.length; a++) {
|
|
5512
5531
|
let o = e[a];
|
|
@@ -5514,25 +5533,25 @@ function sa(e, t) {
|
|
|
5514
5533
|
}
|
|
5515
5534
|
return n.push(r), n;
|
|
5516
5535
|
}
|
|
5517
|
-
function
|
|
5536
|
+
function ua(e) {
|
|
5518
5537
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5519
5538
|
return {
|
|
5520
|
-
time: t(
|
|
5521
|
-
open: t(
|
|
5522
|
-
high: t(
|
|
5523
|
-
low: t(
|
|
5524
|
-
close: t(
|
|
5525
|
-
volume: t(
|
|
5539
|
+
time: t($i),
|
|
5540
|
+
open: t(ea),
|
|
5541
|
+
high: t(ta),
|
|
5542
|
+
low: t(na),
|
|
5543
|
+
close: t(ra),
|
|
5544
|
+
volume: t(ia)
|
|
5526
5545
|
};
|
|
5527
5546
|
}
|
|
5528
|
-
function
|
|
5547
|
+
function da(e) {
|
|
5529
5548
|
let t = (t) => {
|
|
5530
5549
|
for (let n of t) {
|
|
5531
5550
|
if (e[n] !== void 0) return e[n];
|
|
5532
5551
|
let t = n.toUpperCase();
|
|
5533
5552
|
if (e[t] !== void 0) return e[t];
|
|
5534
5553
|
}
|
|
5535
|
-
}, n =
|
|
5554
|
+
}, n = pa(String(t($i) ?? "")), r = Number(t(ea)), i = Number(t(ta)), a = Number(t(na)), o = Number(t(ra)), s = Number(t(ia) ?? 0);
|
|
5536
5555
|
return n === null || ![
|
|
5537
5556
|
r,
|
|
5538
5557
|
i,
|
|
@@ -5547,9 +5566,9 @@ function la(e) {
|
|
|
5547
5566
|
volume: Number.isFinite(s) ? s : 0
|
|
5548
5567
|
};
|
|
5549
5568
|
}
|
|
5550
|
-
function
|
|
5569
|
+
function fa(e) {
|
|
5551
5570
|
if (e.length < 5) return null;
|
|
5552
|
-
let t =
|
|
5571
|
+
let t = pa(String(e[0])), n = Number(e[1]), r = Number(e[2]), i = Number(e[3]), a = Number(e[4]), o = e.length >= 6 ? Number(e[5]) : 0;
|
|
5553
5572
|
return t === null || ![
|
|
5554
5573
|
n,
|
|
5555
5574
|
r,
|
|
@@ -5567,7 +5586,7 @@ function ua(e) {
|
|
|
5567
5586
|
function Q(e) {
|
|
5568
5587
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5569
5588
|
}
|
|
5570
|
-
function
|
|
5589
|
+
function pa(e) {
|
|
5571
5590
|
let t = e.trim();
|
|
5572
5591
|
if (!t) return null;
|
|
5573
5592
|
let n = Number(t);
|
|
@@ -5575,7 +5594,7 @@ function da(e) {
|
|
|
5575
5594
|
let r = Date.parse(t);
|
|
5576
5595
|
return Number.isFinite(r) ? r : null;
|
|
5577
5596
|
}
|
|
5578
|
-
function
|
|
5597
|
+
function ma(e, t, n) {
|
|
5579
5598
|
e.sort((e, t) => e.time - t.time);
|
|
5580
5599
|
let r = [];
|
|
5581
5600
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5587,7 +5606,7 @@ function fa(e, t, n) {
|
|
|
5587
5606
|
}
|
|
5588
5607
|
//#endregion
|
|
5589
5608
|
//#region src/io/DragDropImporter.ts
|
|
5590
|
-
var
|
|
5609
|
+
var ha = class {
|
|
5591
5610
|
host;
|
|
5592
5611
|
overlay = null;
|
|
5593
5612
|
callbacks;
|
|
@@ -5608,19 +5627,19 @@ var pa = class {
|
|
|
5608
5627
|
this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
|
|
5609
5628
|
}
|
|
5610
5629
|
onDragEnter(e) {
|
|
5611
|
-
|
|
5630
|
+
ga(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5612
5631
|
}
|
|
5613
5632
|
onDragOver(e) {
|
|
5614
|
-
|
|
5633
|
+
ga(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5615
5634
|
}
|
|
5616
5635
|
onDragLeave(e) {
|
|
5617
|
-
|
|
5636
|
+
ga(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5618
5637
|
}
|
|
5619
5638
|
async onDrop(e) {
|
|
5620
5639
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5621
5640
|
let t = e.dataTransfer?.files?.[0];
|
|
5622
5641
|
if (t) try {
|
|
5623
|
-
let e =
|
|
5642
|
+
let e = aa(await t.text());
|
|
5624
5643
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5625
5644
|
this.callbacks.onData(e.data, e, t);
|
|
5626
5645
|
} catch (e) {
|
|
@@ -5651,12 +5670,12 @@ var pa = class {
|
|
|
5651
5670
|
this.overlay?.remove(), this.overlay = null;
|
|
5652
5671
|
}
|
|
5653
5672
|
};
|
|
5654
|
-
function
|
|
5673
|
+
function ga(e) {
|
|
5655
5674
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5656
5675
|
}
|
|
5657
5676
|
//#endregion
|
|
5658
5677
|
//#region src/grid/gridShapes.ts
|
|
5659
|
-
var
|
|
5678
|
+
var _a = {
|
|
5660
5679
|
"1x1": {
|
|
5661
5680
|
cols: 1,
|
|
5662
5681
|
rows: 1
|
|
@@ -5861,11 +5880,11 @@ var ha = {
|
|
|
5861
5880
|
cols: 3,
|
|
5862
5881
|
rows: 3
|
|
5863
5882
|
}
|
|
5864
|
-
},
|
|
5865
|
-
function
|
|
5866
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(
|
|
5883
|
+
}, va = Object.keys(_a);
|
|
5884
|
+
function ya(e) {
|
|
5885
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(_a, e);
|
|
5867
5886
|
}
|
|
5868
|
-
function
|
|
5887
|
+
function ba(e) {
|
|
5869
5888
|
if (e.areas) return e.areas;
|
|
5870
5889
|
let t = [];
|
|
5871
5890
|
for (let n = 0; n < e.rows; n++) for (let r = 0; r < e.cols; r++) t.push([
|
|
@@ -5876,16 +5895,16 @@ function va(e) {
|
|
|
5876
5895
|
]);
|
|
5877
5896
|
return t;
|
|
5878
5897
|
}
|
|
5879
|
-
function
|
|
5898
|
+
function xa(e) {
|
|
5880
5899
|
return e.areas?.length ?? e.cols * e.rows;
|
|
5881
5900
|
}
|
|
5882
|
-
function
|
|
5901
|
+
function Sa([e, t, n, r]) {
|
|
5883
5902
|
return `${t + 1} / ${e + 1} / span ${r} / span ${n}`;
|
|
5884
5903
|
}
|
|
5885
|
-
function
|
|
5886
|
-
e.style.gridArea = t ?
|
|
5904
|
+
function Ca(e, t) {
|
|
5905
|
+
e.style.gridArea = t ? Sa(t) : "";
|
|
5887
5906
|
}
|
|
5888
|
-
function
|
|
5907
|
+
function wa(e) {
|
|
5889
5908
|
if (!e.areas) return null;
|
|
5890
5909
|
let t = e.areas.find(([, , e, t]) => e * t > 1);
|
|
5891
5910
|
if (!t) return null;
|
|
@@ -5894,7 +5913,7 @@ function Sa(e) {
|
|
|
5894
5913
|
}
|
|
5895
5914
|
//#endregion
|
|
5896
5915
|
//#region src/state/layoutStorage.ts
|
|
5897
|
-
function
|
|
5916
|
+
function Ta(e) {
|
|
5898
5917
|
let t = {
|
|
5899
5918
|
id: e.id,
|
|
5900
5919
|
name: e.name,
|
|
@@ -5902,11 +5921,11 @@ function Ca(e) {
|
|
|
5902
5921
|
};
|
|
5903
5922
|
return e.symbol !== void 0 && (t.symbol = e.symbol), e.timeframe !== void 0 && (t.timeframe = e.timeframe), e.kind !== void 0 && (t.kind = e.kind), t;
|
|
5904
5923
|
}
|
|
5905
|
-
var
|
|
5906
|
-
function
|
|
5924
|
+
var Ea = (e, t) => t.updatedAt - e.updatedAt;
|
|
5925
|
+
function Da(e) {
|
|
5907
5926
|
if (typeof e != "object" || !e) return null;
|
|
5908
5927
|
let t = e;
|
|
5909
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
5928
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Ta({
|
|
5910
5929
|
id: t.id,
|
|
5911
5930
|
name: t.name,
|
|
5912
5931
|
updatedAt: t.updatedAt,
|
|
@@ -5915,17 +5934,17 @@ function Ta(e) {
|
|
|
5915
5934
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
5916
5935
|
});
|
|
5917
5936
|
}
|
|
5918
|
-
function
|
|
5919
|
-
let t =
|
|
5937
|
+
function Oa(e) {
|
|
5938
|
+
let t = Da(e), n = t ? e.content : void 0;
|
|
5920
5939
|
return t && typeof n == "string" ? {
|
|
5921
5940
|
...t,
|
|
5922
5941
|
content: n
|
|
5923
5942
|
} : null;
|
|
5924
5943
|
}
|
|
5925
|
-
function
|
|
5944
|
+
function ka(e = []) {
|
|
5926
5945
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
5927
5946
|
return {
|
|
5928
|
-
list: () => [...t.values()].map(
|
|
5947
|
+
list: () => [...t.values()].map(Ta).sort(Ea),
|
|
5929
5948
|
load: (e) => {
|
|
5930
5949
|
let n = t.get(e);
|
|
5931
5950
|
return n ? { ...n } : null;
|
|
@@ -5938,7 +5957,7 @@ function Da(e = []) {
|
|
|
5938
5957
|
}
|
|
5939
5958
|
};
|
|
5940
5959
|
}
|
|
5941
|
-
function
|
|
5960
|
+
function Aa(e = "tcw:layouts:") {
|
|
5942
5961
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
5943
5962
|
let e;
|
|
5944
5963
|
try {
|
|
@@ -5946,10 +5965,10 @@ function Oa(e = "tcw:layouts:") {
|
|
|
5946
5965
|
} catch {
|
|
5947
5966
|
return [];
|
|
5948
5967
|
}
|
|
5949
|
-
return Array.isArray(e) ? e.map(
|
|
5968
|
+
return Array.isArray(e) ? e.map(Da).filter((e) => e !== null) : [];
|
|
5950
5969
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
5951
5970
|
return {
|
|
5952
|
-
list: () => r().sort(
|
|
5971
|
+
list: () => r().sort(Ea),
|
|
5953
5972
|
load: (e) => {
|
|
5954
5973
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
5955
5974
|
return t && i !== null ? {
|
|
@@ -5958,7 +5977,7 @@ function Oa(e = "tcw:layouts:") {
|
|
|
5958
5977
|
} : null;
|
|
5959
5978
|
},
|
|
5960
5979
|
save: (e) => {
|
|
5961
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
5980
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Ta(e)]);
|
|
5962
5981
|
},
|
|
5963
5982
|
remove: (e) => {
|
|
5964
5983
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -5967,14 +5986,14 @@ function Oa(e = "tcw:layouts:") {
|
|
|
5967
5986
|
}
|
|
5968
5987
|
//#endregion
|
|
5969
5988
|
//#region src/state/LayoutSession.ts
|
|
5970
|
-
var
|
|
5989
|
+
var ja = 80;
|
|
5971
5990
|
function $(e) {
|
|
5972
5991
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
5973
5992
|
}
|
|
5974
|
-
function
|
|
5993
|
+
function Ma() {
|
|
5975
5994
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
5976
5995
|
}
|
|
5977
|
-
function
|
|
5996
|
+
function Na(e) {
|
|
5978
5997
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
5979
5998
|
return {
|
|
5980
5999
|
id: t,
|
|
@@ -5985,7 +6004,7 @@ function ja(e) {
|
|
|
5985
6004
|
...o === void 0 ? {} : { kind: o }
|
|
5986
6005
|
};
|
|
5987
6006
|
}
|
|
5988
|
-
var
|
|
6007
|
+
var Pa = class {
|
|
5989
6008
|
currentLayout = null;
|
|
5990
6009
|
savedContent = null;
|
|
5991
6010
|
dirty = !1;
|
|
@@ -6001,7 +6020,7 @@ var Ma = class {
|
|
|
6001
6020
|
now;
|
|
6002
6021
|
newId;
|
|
6003
6022
|
constructor(e, t, n = {}) {
|
|
6004
|
-
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ??
|
|
6023
|
+
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ?? Ma;
|
|
6005
6024
|
}
|
|
6006
6025
|
current() {
|
|
6007
6026
|
return this.currentLayout;
|
|
@@ -6017,7 +6036,7 @@ var Ma = class {
|
|
|
6017
6036
|
}
|
|
6018
6037
|
async list() {
|
|
6019
6038
|
let e = await this.storage.list();
|
|
6020
|
-
return Array.isArray(e) ? e.map(
|
|
6039
|
+
return Array.isArray(e) ? e.map(Da).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
6021
6040
|
}
|
|
6022
6041
|
save() {
|
|
6023
6042
|
return this.queue(() => {
|
|
@@ -6031,7 +6050,7 @@ var Ma = class {
|
|
|
6031
6050
|
}
|
|
6032
6051
|
open(e) {
|
|
6033
6052
|
return this.queue(async () => {
|
|
6034
|
-
let t =
|
|
6053
|
+
let t = Oa(await this.storage.load(e));
|
|
6035
6054
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
6036
6055
|
this.cancelTimer(), this.applying++;
|
|
6037
6056
|
try {
|
|
@@ -6041,13 +6060,13 @@ var Ma = class {
|
|
|
6041
6060
|
} finally {
|
|
6042
6061
|
this.applying--;
|
|
6043
6062
|
}
|
|
6044
|
-
return this.cancelTimer(), this.currentLayout =
|
|
6063
|
+
return this.cancelTimer(), this.currentLayout = Na(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
6045
6064
|
});
|
|
6046
6065
|
}
|
|
6047
6066
|
rename(e, t) {
|
|
6048
6067
|
let n = $(t);
|
|
6049
6068
|
return n ? this.queue(async () => {
|
|
6050
|
-
let t =
|
|
6069
|
+
let t = Oa(await this.storage.load(e));
|
|
6051
6070
|
!t || t.id !== e || (await this.storage.save({
|
|
6052
6071
|
...t,
|
|
6053
6072
|
name: n
|
|
@@ -6125,7 +6144,7 @@ var Ma = class {
|
|
|
6125
6144
|
content: n.content
|
|
6126
6145
|
};
|
|
6127
6146
|
await this.storage.save(r);
|
|
6128
|
-
let i =
|
|
6147
|
+
let i = Na(r);
|
|
6129
6148
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
6130
6149
|
}
|
|
6131
6150
|
forget() {
|
|
@@ -6146,6 +6165,6 @@ var Ma = class {
|
|
|
6146
6165
|
}
|
|
6147
6166
|
};
|
|
6148
6167
|
//#endregion
|
|
6149
|
-
export {
|
|
6168
|
+
export { mr as A, Pr as C, q as D, Nr as E, H as M, z as N, Sr as O, V as P, Ir as S, Mr as T, yi as _, ka as a, Rr as b, ba as c, ya as d, Ca as f, bi as g, Ai as h, Aa as i, fr as j, _r as k, xa as l, aa as m, ja as n, va as o, ha as p, $ as r, _a as s, Pa as t, wa as u, ii as v, Fr as w, Lr as x, ai as y };
|
|
6150
6169
|
|
|
6151
|
-
//# sourceMappingURL=LayoutSession
|
|
6170
|
+
//# sourceMappingURL=LayoutSession-BhA7O3fL.js.map
|