@tradecanvas/chart 1.50.0 → 1.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Chart.d.ts +194 -11
- package/dist/Chart.d.ts.map +1 -1
- package/dist/DataManager.d.ts +24 -0
- package/dist/DataManager.d.ts.map +1 -1
- package/dist/{LayoutSession-Dcvn5KMK.js → LayoutSession-4SLt8-0u.js} +676 -386
- package/dist/LayoutSession-4SLt8-0u.js.map +1 -0
- package/dist/LayoutSession-BOtFzvMm.cjs +2 -0
- package/dist/LayoutSession-BOtFzvMm.cjs.map +1 -0
- package/dist/SeriesStore.d.ts +31 -0
- package/dist/SeriesStore.d.ts.map +1 -1
- package/dist/charts/ChartTypeStrategy.d.ts +32 -5
- package/dist/charts/ChartTypeStrategy.d.ts.map +1 -1
- package/dist/finance/performanceData.d.ts +17 -2
- package/dist/finance/performanceData.d.ts.map +1 -1
- package/dist/frameworks/feedBars.d.ts +22 -6
- package/dist/frameworks/feedBars.d.ts.map +1 -1
- package/dist/i18n-BjW5GVrO.cjs +2 -0
- package/dist/i18n-BjW5GVrO.cjs.map +1 -0
- package/dist/{i18n-DjzoHpMJ.js → i18n-C7b-2BJ5.js} +33 -1
- package/dist/i18n-C7b-2BJ5.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -98
- package/dist/index.js.map +1 -1
- package/dist/io/resampleOHLCV.d.ts +10 -4
- package/dist/io/resampleOHLCV.d.ts.map +1 -1
- package/dist/layout/labelWidths.d.ts +16 -0
- package/dist/layout/labelWidths.d.ts.map +1 -0
- package/dist/widget/ChartWidget.d.ts +278 -15
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/ChartWidgetGrid.d.ts.map +1 -1
- package/dist/widget/WatchlistStore.d.ts.map +1 -1
- package/dist/widget/WidgetContextMenu.d.ts +25 -3
- package/dist/widget/WidgetContextMenu.d.ts.map +1 -1
- package/dist/widget/WidgetDataWindow.d.ts +7 -0
- package/dist/widget/WidgetDataWindow.d.ts.map +1 -1
- package/dist/widget/WidgetHotkeySheet.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorLegend.d.ts +23 -3
- package/dist/widget/WidgetIndicatorLegend.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -1
- package/dist/widget/WidgetLayoutsUI.d.ts.map +1 -1
- package/dist/widget/WidgetObjectTree.d.ts +7 -1
- package/dist/widget/WidgetObjectTree.d.ts.map +1 -1
- package/dist/widget/WidgetSettings.d.ts +11 -3
- package/dist/widget/WidgetSettings.d.ts.map +1 -1
- package/dist/widget/WidgetStatusBar.d.ts +110 -3
- package/dist/widget/WidgetStatusBar.d.ts.map +1 -1
- package/dist/widget/WidgetSymbolSearch.d.ts +73 -20
- package/dist/widget/WidgetSymbolSearch.d.ts.map +1 -1
- package/dist/widget/WidgetToolbar.d.ts +65 -6
- package/dist/widget/WidgetToolbar.d.ts.map +1 -1
- package/dist/widget/WidgetTradeMenu.d.ts.map +1 -1
- package/dist/widget/chartSettingsStore.d.ts +76 -0
- package/dist/widget/chartSettingsStore.d.ts.map +1 -0
- package/dist/widget/chartTemplates.d.ts.map +1 -1
- package/dist/widget/compareLegend.d.ts +20 -0
- package/dist/widget/compareLegend.d.ts.map +1 -0
- package/dist/widget/hostButtons.d.ts +5 -2
- package/dist/widget/hostButtons.d.ts.map +1 -1
- package/dist/widget/index.cjs +542 -127
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.d.ts +1 -1
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +2909 -1750
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/indicatorInputWords.d.ts +19 -0
- package/dist/widget/indicatorInputWords.d.ts.map +1 -0
- package/dist/widget/locales/ar.d.ts.map +1 -1
- package/dist/widget/locales/cs.d.ts.map +1 -1
- package/dist/widget/locales/da.d.ts.map +1 -1
- package/dist/widget/locales/de.d.ts.map +1 -1
- package/dist/widget/locales/el.d.ts.map +1 -1
- package/dist/widget/locales/en.d.ts +16 -0
- package/dist/widget/locales/en.d.ts.map +1 -1
- package/dist/widget/locales/es.d.ts.map +1 -1
- package/dist/widget/locales/et.d.ts.map +1 -1
- package/dist/widget/locales/fa.d.ts.map +1 -1
- package/dist/widget/locales/fr.d.ts.map +1 -1
- package/dist/widget/locales/he.d.ts.map +1 -1
- package/dist/widget/locales/hu.d.ts.map +1 -1
- package/dist/widget/locales/id.d.ts.map +1 -1
- package/dist/widget/locales/index.cjs +1 -1
- package/dist/widget/locales/index.cjs.map +1 -1
- package/dist/widget/locales/index.js +449 -1
- package/dist/widget/locales/index.js.map +1 -1
- package/dist/widget/locales/it.d.ts.map +1 -1
- package/dist/widget/locales/ja.d.ts.map +1 -1
- package/dist/widget/locales/ko.d.ts.map +1 -1
- package/dist/widget/locales/ms.d.ts.map +1 -1
- package/dist/widget/locales/nb.d.ts.map +1 -1
- package/dist/widget/locales/nl.d.ts.map +1 -1
- package/dist/widget/locales/pl.d.ts.map +1 -1
- package/dist/widget/locales/pt.d.ts.map +1 -1
- package/dist/widget/locales/ro.d.ts.map +1 -1
- package/dist/widget/locales/ru.d.ts.map +1 -1
- package/dist/widget/locales/sk.d.ts.map +1 -1
- package/dist/widget/locales/sv.d.ts.map +1 -1
- package/dist/widget/locales/th.d.ts.map +1 -1
- package/dist/widget/locales/tr.d.ts.map +1 -1
- package/dist/widget/locales/vi.d.ts.map +1 -1
- package/dist/widget/locales/zh.d.ts.map +1 -1
- package/dist/widget/locales/zhHant.d.ts.map +1 -1
- package/dist/widget/selectMenu.d.ts.map +1 -1
- package/dist/widget/settingsRows.d.ts +12 -3
- package/dist/widget/settingsRows.d.ts.map +1 -1
- package/dist/widget/symbolBadge.d.ts +26 -0
- package/dist/widget/symbolBadge.d.ts.map +1 -0
- package/dist/widget/symbolCatalog.d.ts +62 -0
- package/dist/widget/symbolCatalog.d.ts.map +1 -0
- package/dist/widget/symbolCell.d.ts +8 -0
- package/dist/widget/symbolCell.d.ts.map +1 -0
- package/dist/widget/symbolInfoView.d.ts +3 -0
- package/dist/widget/symbolInfoView.d.ts.map +1 -1
- package/dist/widget/symbolMatch.d.ts +38 -0
- package/dist/widget/symbolMatch.d.ts.map +1 -0
- package/dist/widget/symbolSearchFilters.d.ts +52 -0
- package/dist/widget/symbolSearchFilters.d.ts.map +1 -0
- package/dist/widget/types.d.ts +88 -11
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetCompare.d.ts +18 -0
- package/dist/widget/widgetCompare.d.ts.map +1 -1
- package/dist/widget/widgetLayout.d.ts +13 -1
- package/dist/widget/widgetLayout.d.ts.map +1 -1
- package/dist/widget/widgetSettingsLook.d.ts +3 -1
- package/dist/widget/widgetSettingsLook.d.ts.map +1 -1
- package/dist/widget/widgetShareState.d.ts +8 -0
- package/dist/widget/widgetShareState.d.ts.map +1 -1
- package/dist/widget/widgetTimezones.d.ts +4 -1
- package/dist/widget/widgetTimezones.d.ts.map +1 -1
- package/dist/widget/widgetUI.d.ts +2 -1
- package/dist/widget/widgetUI.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-BBw0ke8V.cjs +0 -2
- package/dist/LayoutSession-BBw0ke8V.cjs.map +0 -1
- package/dist/LayoutSession-Dcvn5KMK.js.map +0 -1
- package/dist/i18n-DVeWlg64.cjs +0 -2
- package/dist/i18n-DVeWlg64.cjs.map +0 -1
- package/dist/i18n-DjzoHpMJ.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PHI as a, PRICE_AXIS_WIDTH as o, TIME_AXIS_HEIGHT as s, autoPricePrecision as c,
|
|
2
|
-
import { AlertDragHandler as
|
|
1
|
+
import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PHI as a, PRICE_AXIS_WIDTH as o, TIME_AXIS_HEIGHT as s, autoPricePrecision as c, barDateZone as l, barTimeUnit as u, barsAreDaily as d, chartStyleValue as f, computePriceLimits as p, computePriceRange as m, formatPrice as h, fractionTick as g, indicatorSource as _, isValidTimeZone as v, mergeBar as ee, niceNumber as te, normalizeBarTime as y, parseIndicatorSource as b, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as x, readChartTypeOptions as S, readIndicatorPlotStyles as ie, readPaneStyle as ae, resolveChartTheme as oe, sessionMinute as C, setLocale as se, stepDecimals as ce, symbolTimeZone as w, tickBarCount as le, timeframeToMs as ue, zonedDateFormatter as de } from "@tradecanvas/commons";
|
|
2
|
+
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 T, CompareRenderer as Se, CompareSymbolIndicator as Ce, CorrelationCoefficientIndicator as we, CorrelationLogIndicator as Te, CrosshairHandler as Ee, CrosshairTooltip as De, CurrentPriceLine as Oe, DEFAULT_SESSION_HOURS as ke, DataExporter as E, DepthHeatmapRenderer as Ae, DrawingManager as je, DrawingRenderer as Me, EquivolumeRenderer as Ne, EventBus as Pe, GridRenderer as Fe, HLCAreaRenderer as Ie, HiLoRenderer as D, HollowCandleRenderer as Le, IndicatorEngine as Re, InteractionManager as ze, KagiRenderer as Be, KeyboardHandler as Ve, LineRenderer as He, LineWithMarkersRenderer as Ue, MarketProfileRenderer as We, MeasureOverlay as Ge, PRICE_SCALE_MARGIN as O, PanHandler as Ke, PaneResizeHandler as qe, PeriodLevelsRenderer as Je, PinnedTooltip as Ye, PivotMarkersRenderer as Xe, PointAndFigureRenderer as Ze, PriceAxis as Qe, PriceAxisAddButton as $e, PriceLines as et, RenderEngine as tt, RenkoRenderer as nt, ReplayManager as rt, ResamplingAdapter as it, ReshapeMemo as at, SYMBOL_INDICATOR_IDS as k, SYMBOL_ZONE_WAIT_MS as ot, Screenshot as A, SelectionBoxOverlay as st, SessionBreaks as ct, SessionShading as lt, SignalMarkerManager as ut, SpreadIndicator as dt, StepLineRenderer as ft, StreamManager as pt, SymbolSeriesStore as mt, TimeAxis as ht, TradeZoneManager as gt, TradingManager as _t, TradingRenderer as vt, UndoRedoManager as yt, Viewport as bt, VolumeCandleRenderer as xt, VolumeProfileRenderer as St, VolumeRenderer as Ct, Watermark as wt, ZoomHandler as Tt, barTimeStepMs as Et, findDominantSwing as Dt, gpuContextsLeft as Ot, isPriceLevelAlert as kt, isRegularSession as At, loadWebGL as jt, mergeSessionHours as Mt, pointAndFigureColumns as Nt, priceToY as Pt, rangePresetStart as Ft, readAlertOptions as It, registerBuiltInDrawingTools as Lt, registerBuiltInIndicators as Rt, servesTimeframe as zt, sourceParam as j, timeToX as Bt, timestampToBarIndex as M, toHeikinAshi as Vt, toKagi as Ht, toLineBreak as Ut, toRangeBars as Wt, toRenko as Gt, whenGpuContextFree as Kt, withResampling as N, xToBarIndex as qt, xToTime as P, yToPrice as Jt } from "@tradecanvas/core";
|
|
3
3
|
//#region src/regularHours.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
4
|
+
var Yt = 864e5, Xt = 10;
|
|
5
|
+
function Zt(e, t) {
|
|
6
6
|
let n = w(e);
|
|
7
|
-
if (!n || !
|
|
7
|
+
if (!n || !v(n) || t.length < 2) return null;
|
|
8
8
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
9
9
|
let t = C(e.start), n = C(e.end);
|
|
10
10
|
return t === null || n === null ? [] : [{
|
|
@@ -13,35 +13,35 @@ function Ht(e, t) {
|
|
|
13
13
|
}];
|
|
14
14
|
});
|
|
15
15
|
if (r.length === 0) return null;
|
|
16
|
-
let i =
|
|
17
|
-
for (let e = Math.max(1, t.length -
|
|
16
|
+
let i = u(t), a = Infinity;
|
|
17
|
+
for (let e = Math.max(1, t.length - Xt); e < t.length; e++) {
|
|
18
18
|
let n = (t[e].time - t[e - 1].time) * i;
|
|
19
19
|
n > 0 && n < a && (a = n);
|
|
20
20
|
}
|
|
21
|
-
if (!(a <
|
|
21
|
+
if (!(a < Yt)) return null;
|
|
22
22
|
let o = {
|
|
23
23
|
timeZone: n,
|
|
24
24
|
windows: r,
|
|
25
25
|
startMinute: r[0].startMinute,
|
|
26
26
|
endMinute: r[r.length - 1].endMinute
|
|
27
27
|
};
|
|
28
|
-
return (e) =>
|
|
28
|
+
return (e) => At(e * i, o);
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/chartA11y.ts
|
|
32
|
-
var
|
|
32
|
+
var Qt = {
|
|
33
33
|
role: "chart",
|
|
34
34
|
summary: "{what}. Last price {close}.",
|
|
35
35
|
empty: "Chart, no data.",
|
|
36
36
|
view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
|
|
37
37
|
bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
|
|
38
38
|
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."
|
|
39
|
-
},
|
|
39
|
+
}, F = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), $t = [
|
|
40
40
|
"role",
|
|
41
41
|
"aria-roledescription",
|
|
42
42
|
"aria-label",
|
|
43
43
|
"aria-describedby"
|
|
44
|
-
],
|
|
44
|
+
], en = 400, tn = 1e3, nn = class {
|
|
45
45
|
live;
|
|
46
46
|
help;
|
|
47
47
|
labels;
|
|
@@ -55,20 +55,20 @@ var Ut = {
|
|
|
55
55
|
};
|
|
56
56
|
constructor(e, t, n = {}) {
|
|
57
57
|
this.container = e, this.source = t, this.labels = {
|
|
58
|
-
...
|
|
58
|
+
...Qt,
|
|
59
59
|
...n
|
|
60
60
|
};
|
|
61
|
-
for (let t of
|
|
62
|
-
e.setAttribute("role", "application"), this.help =
|
|
61
|
+
for (let t of $t) this.before.set(t, e.getAttribute(t));
|
|
62
|
+
e.setAttribute("role", "application"), this.help = rn("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 = rn("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();
|
|
63
63
|
}
|
|
64
64
|
setLabels(e) {
|
|
65
65
|
this.labels = {
|
|
66
|
-
...
|
|
66
|
+
...Qt,
|
|
67
67
|
...e
|
|
68
68
|
}, this.applyLabels();
|
|
69
69
|
}
|
|
70
70
|
refresh(e = !1) {
|
|
71
|
-
let t =
|
|
71
|
+
let t = tn - (Date.now() - this.summaryAt);
|
|
72
72
|
if (e || t <= 0 || this.container.getAttribute("aria-label") === this.labels.empty) {
|
|
73
73
|
this.summaryTimer && clearTimeout(this.summaryTimer), this.summaryTimer = null, this.summaryAt = Date.now(), this.container.setAttribute("aria-label", this.summary());
|
|
74
74
|
return;
|
|
@@ -80,7 +80,7 @@ var Ut = {
|
|
|
80
80
|
viewMoved() {
|
|
81
81
|
this.cursor = null, this.viewTimer && clearTimeout(this.viewTimer), this.viewTimer = setTimeout(() => {
|
|
82
82
|
this.viewTimer = null, this.say(this.viewText());
|
|
83
|
-
},
|
|
83
|
+
}, en);
|
|
84
84
|
}
|
|
85
85
|
readBar(e) {
|
|
86
86
|
let t = this.source.bars();
|
|
@@ -93,13 +93,13 @@ var Ut = {
|
|
|
93
93
|
let i = t[this.cursor];
|
|
94
94
|
this.source.showBar(i.time);
|
|
95
95
|
let a = this.source.formatPrice;
|
|
96
|
-
this.say(
|
|
96
|
+
this.say(F(this.labels.bar, {
|
|
97
97
|
time: this.source.formatTime(i.time),
|
|
98
98
|
open: a(i.open),
|
|
99
99
|
high: a(i.high),
|
|
100
100
|
low: a(i.low),
|
|
101
101
|
close: a(i.close),
|
|
102
|
-
volume:
|
|
102
|
+
volume: an(i.volume ?? 0)
|
|
103
103
|
}));
|
|
104
104
|
}
|
|
105
105
|
destroy() {
|
|
@@ -118,7 +118,7 @@ var Ut = {
|
|
|
118
118
|
this.labels.typeName ? this.labels.typeName(t) : t,
|
|
119
119
|
this.source.timeframe()
|
|
120
120
|
].filter(Boolean).join(", ");
|
|
121
|
-
return
|
|
121
|
+
return F(this.labels.summary, {
|
|
122
122
|
what: n,
|
|
123
123
|
close: this.source.formatPrice(e[e.length - 1].close)
|
|
124
124
|
});
|
|
@@ -128,7 +128,7 @@ var Ut = {
|
|
|
128
128
|
if (e.length === 0) return this.labels.empty;
|
|
129
129
|
let t = this.source.visibleRange(), n = Math.max(0, Math.min(e.length - 1, Math.ceil(t.from))), r = Math.max(n, Math.min(e.length - 1, Math.floor(t.to))), i = -Infinity, a = Infinity;
|
|
130
130
|
for (let t = n; t <= r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
131
|
-
return
|
|
131
|
+
return F(this.labels.view, {
|
|
132
132
|
count: r - n + 1,
|
|
133
133
|
from: this.source.formatTime(e[n].time),
|
|
134
134
|
to: this.source.formatTime(e[r].time),
|
|
@@ -140,7 +140,7 @@ var Ut = {
|
|
|
140
140
|
this.live.textContent = e;
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
function
|
|
143
|
+
function rn(e, t) {
|
|
144
144
|
let n = document.createElement(e);
|
|
145
145
|
return n.className = t, Object.assign(n.style, {
|
|
146
146
|
position: "absolute",
|
|
@@ -154,12 +154,12 @@ function Jt(e, t) {
|
|
|
154
154
|
border: "0"
|
|
155
155
|
}), n;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function an(e) {
|
|
158
158
|
return Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/indicatorLabel.ts
|
|
162
|
-
function
|
|
162
|
+
function on(e, t, n, r) {
|
|
163
163
|
let i = Object.keys(n || t).map((e) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)).slice(0, 3).map((e) => String(Number(e.toFixed(4)))), a = typeof t.symbol == "string" && t.symbol ? [t.symbol] : [];
|
|
164
164
|
return [
|
|
165
165
|
e === "spread" && t.mode === "ratio" ? "Ratio" : r ?? e.toUpperCase(),
|
|
@@ -169,52 +169,52 @@ function Xt(e, t, n, r) {
|
|
|
169
169
|
}
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/charts/ChartTypeStrategy.ts
|
|
172
|
-
function
|
|
172
|
+
function sn(e) {
|
|
173
173
|
switch (e) {
|
|
174
174
|
case "candlestick":
|
|
175
175
|
case "heikinAshi":
|
|
176
176
|
case "lineBreak":
|
|
177
|
-
case "rangeBars": return new
|
|
178
|
-
case "line": return new
|
|
179
|
-
case "area": return new
|
|
180
|
-
case "bar": return new
|
|
181
|
-
case "hollowCandle": return new
|
|
182
|
-
case "baseline": return new
|
|
183
|
-
case "renko": return new
|
|
184
|
-
case "kagi": return new
|
|
185
|
-
case "pointAndFigure": return new
|
|
186
|
-
case "volumeCandles": return new
|
|
187
|
-
case "equivolume": return new
|
|
188
|
-
case "hlcArea": return new
|
|
189
|
-
case "stepLine": return new
|
|
190
|
-
case "lineWithMarkers": return new
|
|
177
|
+
case "rangeBars": return new be();
|
|
178
|
+
case "line": return new He();
|
|
179
|
+
case "area": return new he();
|
|
180
|
+
case "bar": return new ve();
|
|
181
|
+
case "hollowCandle": return new Le();
|
|
182
|
+
case "baseline": return new ye();
|
|
183
|
+
case "renko": return new nt();
|
|
184
|
+
case "kagi": return new Be();
|
|
185
|
+
case "pointAndFigure": return new Ze();
|
|
186
|
+
case "volumeCandles": return new xt();
|
|
187
|
+
case "equivolume": return new Ne();
|
|
188
|
+
case "hlcArea": return new Ie();
|
|
189
|
+
case "stepLine": return new ft();
|
|
190
|
+
case "lineWithMarkers": return new Ue();
|
|
191
191
|
case "hiLo": return new D();
|
|
192
|
-
default: return new
|
|
192
|
+
default: return new be();
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function cn(e, t, n = {}, r, i) {
|
|
196
196
|
if (t.length === 0) return t;
|
|
197
197
|
switch (e) {
|
|
198
|
-
case "heikinAshi": return
|
|
198
|
+
case "heikinAshi": return Vt(t);
|
|
199
199
|
case "renko": {
|
|
200
200
|
let e = n.renko?.boxSize;
|
|
201
|
-
return typeof e == "number" ?
|
|
201
|
+
return typeof e == "number" ? Gt(t, { brickSize: e }, i) : Gt(t, {
|
|
202
202
|
brickSize: 0,
|
|
203
203
|
useATR: !0,
|
|
204
204
|
atrPeriod: n.renko?.atrPeriod ?? 14
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
case "lineBreak": return Mt(t, n.lineBreak?.lines ?? 3);
|
|
208
|
-
case "kagi": return jt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
|
|
209
|
-
case "pointAndFigure": return Nt(t, en(t, n), n.pointAndFigure?.reversal ?? 3);
|
|
210
|
-
case "rangeBars": {
|
|
211
|
-
let e = n.rangeBars?.range;
|
|
212
|
-
return Pt(t, { rangeSize: typeof e == "number" ? e : tn(t) * .005 });
|
|
205
|
+
}, i);
|
|
213
206
|
}
|
|
207
|
+
case "lineBreak": return Ut(t, n.lineBreak?.lines ?? 3);
|
|
208
|
+
case "kagi": return Ht(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
209
|
+
case "pointAndFigure": return un(t, n, i).columns;
|
|
210
|
+
case "rangeBars": return Wt(t, {
|
|
211
|
+
rangeSize: _n(t, n, r),
|
|
212
|
+
includeForming: !0
|
|
213
|
+
}, i);
|
|
214
214
|
default: return t;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ln(e) {
|
|
218
218
|
switch (e) {
|
|
219
219
|
case "heikinAshi":
|
|
220
220
|
case "renko":
|
|
@@ -225,30 +225,65 @@ function $t(e) {
|
|
|
225
225
|
default: return !1;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
return e !== "heikinAshi" &&
|
|
228
|
+
function I(e) {
|
|
229
|
+
return e !== "heikinAshi" && ln(e);
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
let
|
|
233
|
-
return typeof
|
|
231
|
+
function un(e, t = {}, n) {
|
|
232
|
+
let r = t.pointAndFigure?.boxSize;
|
|
233
|
+
return Nt(e, typeof r == "number" ? r : dn(e) * .01, t.pointAndFigure?.reversal ?? 3, n);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function dn(e) {
|
|
236
236
|
let t = 0;
|
|
237
237
|
for (let n of e) t += n.close;
|
|
238
238
|
return t / e.length;
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
var fn = 100, pn = 3, mn = .01, hn = 15, gn = (e) => Number(e.toPrecision(hn));
|
|
241
|
+
function _n(e, t = {}, n) {
|
|
242
|
+
let r = t.rangeBars?.range;
|
|
243
|
+
if (typeof r == "number") return r;
|
|
244
|
+
let i = e.length >= pn ? yn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
245
|
+
return Sn(gn(te(i > 0 ? i : a * mn || 1, !0)), n);
|
|
246
|
+
}
|
|
247
|
+
function vn(e) {
|
|
248
|
+
let t = e.length - 1;
|
|
249
|
+
return {
|
|
250
|
+
from: Math.max(0, t - fn),
|
|
251
|
+
end: t
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function yn(e) {
|
|
255
|
+
let { from: t, end: n } = vn(e), r = 0;
|
|
256
|
+
for (let i = t; i < n; i++) {
|
|
257
|
+
let { high: t, low: n } = e[i], a = i > 0 ? e[i - 1].close : n;
|
|
258
|
+
r += Math.max(t - n, Math.abs(t - a), Math.abs(n - a));
|
|
259
|
+
}
|
|
260
|
+
return n > t ? r / (n - t) : 0;
|
|
261
|
+
}
|
|
262
|
+
function bn(e, t) {
|
|
263
|
+
let { from: n, end: r } = vn(e);
|
|
264
|
+
if (r <= n) return t(e[e.length - 1]?.close ?? 0);
|
|
265
|
+
let i = -Infinity, a = Infinity;
|
|
266
|
+
for (let t = n; t < r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
267
|
+
return xn(t(i), t(a));
|
|
268
|
+
}
|
|
269
|
+
function xn(e, t) {
|
|
270
|
+
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
271
|
+
}
|
|
272
|
+
function Sn(e, t) {
|
|
273
|
+
return t === void 0 || !(t > 0) ? e : gn(Math.max(1, Math.round(e / t)) * t);
|
|
274
|
+
}
|
|
275
|
+
function Cn(e, t) {
|
|
241
276
|
let n = t?.(e);
|
|
242
|
-
return n ? n.createRenderer() :
|
|
277
|
+
return n ? n.createRenderer() : sn(e);
|
|
243
278
|
}
|
|
244
|
-
function
|
|
279
|
+
function wn(e, t, n, r, i, a) {
|
|
245
280
|
if (t.length === 0) return t;
|
|
246
|
-
let
|
|
247
|
-
return
|
|
281
|
+
let o = n?.(e);
|
|
282
|
+
return o?.transform ? o.transform(t) : cn(e, t, r, i, a);
|
|
248
283
|
}
|
|
249
284
|
//#endregion
|
|
250
285
|
//#region src/state/AutoSaveScheduler.ts
|
|
251
|
-
var
|
|
286
|
+
var Tn = class {
|
|
252
287
|
timer = null;
|
|
253
288
|
delayMs = 0;
|
|
254
289
|
key = null;
|
|
@@ -278,15 +313,15 @@ var an = class {
|
|
|
278
313
|
};
|
|
279
314
|
//#endregion
|
|
280
315
|
//#region src/DataManager.ts
|
|
281
|
-
function
|
|
316
|
+
function L(e) {
|
|
282
317
|
if (!e || typeof e.time != "number" || !Number.isFinite(e.time)) return !1;
|
|
283
318
|
let { open: t, high: n, low: r, close: i } = e;
|
|
284
319
|
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));
|
|
285
320
|
}
|
|
286
|
-
function
|
|
321
|
+
function En(e) {
|
|
287
322
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
288
323
|
}
|
|
289
|
-
function
|
|
324
|
+
function R(e) {
|
|
290
325
|
return {
|
|
291
326
|
...e,
|
|
292
327
|
high: Math.max(e.open, e.high, e.low, e.close),
|
|
@@ -294,22 +329,36 @@ function B(e) {
|
|
|
294
329
|
volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
|
|
295
330
|
};
|
|
296
331
|
}
|
|
297
|
-
function
|
|
332
|
+
function z(e, t) {
|
|
333
|
+
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;
|
|
334
|
+
}
|
|
335
|
+
function Dn(e, t) {
|
|
336
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
337
|
+
if (e[n].time === t) return n;
|
|
338
|
+
if (e[n].time < t) return -1;
|
|
339
|
+
}
|
|
340
|
+
return -1;
|
|
341
|
+
}
|
|
342
|
+
var On = {
|
|
343
|
+
index: -1,
|
|
344
|
+
changed: !1
|
|
345
|
+
};
|
|
346
|
+
function kn(e, t) {
|
|
298
347
|
if (e.length === 0) return t;
|
|
299
|
-
let n =
|
|
300
|
-
return
|
|
348
|
+
let n = y(t);
|
|
349
|
+
return u(e) === 1 ? n : n / 1e3;
|
|
301
350
|
}
|
|
302
|
-
function
|
|
303
|
-
let n =
|
|
351
|
+
function An(e, t) {
|
|
352
|
+
let n = kn(e, t.time);
|
|
304
353
|
return n === t.time ? t : {
|
|
305
354
|
...t,
|
|
306
355
|
time: n
|
|
307
356
|
};
|
|
308
357
|
}
|
|
309
|
-
var
|
|
358
|
+
var B = class {
|
|
310
359
|
data = [];
|
|
311
360
|
withSeriesTime(e) {
|
|
312
|
-
return
|
|
361
|
+
return An(this.data, e);
|
|
313
362
|
}
|
|
314
363
|
getData() {
|
|
315
364
|
return this.data;
|
|
@@ -318,16 +367,16 @@ var V = class {
|
|
|
318
367
|
let t = [];
|
|
319
368
|
for (let n = 0; n < e.length; n++) {
|
|
320
369
|
let r = e[n];
|
|
321
|
-
|
|
370
|
+
L(r) && t.push(En(r) ? r : R(r));
|
|
322
371
|
}
|
|
323
372
|
this.data = t;
|
|
324
373
|
}
|
|
325
374
|
prependBars(e) {
|
|
326
375
|
let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
|
|
327
376
|
for (let r = 0; r < e.length; r++) {
|
|
328
|
-
if (!
|
|
377
|
+
if (!L(e[r])) continue;
|
|
329
378
|
let i = this.withSeriesTime(e[r]);
|
|
330
|
-
i.time >= t || n.push(
|
|
379
|
+
i.time >= t || n.push(En(i) ? i : R(i));
|
|
331
380
|
}
|
|
332
381
|
if (n.length === 0) return 0;
|
|
333
382
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -336,19 +385,32 @@ var V = class {
|
|
|
336
385
|
return n.length = r, this.data = n.concat(this.data), r;
|
|
337
386
|
}
|
|
338
387
|
appendBar(e) {
|
|
339
|
-
|
|
388
|
+
L(e) && this.data.push(R(this.withSeriesTime(e)));
|
|
340
389
|
}
|
|
341
390
|
updateLastBar(e) {
|
|
342
|
-
if (!
|
|
343
|
-
let t =
|
|
391
|
+
if (!L(e)) return;
|
|
392
|
+
let t = R(this.withSeriesTime(e));
|
|
344
393
|
if (this.data.length === 0) {
|
|
345
394
|
this.data.push(t);
|
|
346
395
|
return;
|
|
347
396
|
}
|
|
348
397
|
this.data[this.data.length - 1] = t;
|
|
349
398
|
}
|
|
399
|
+
replaceBar(e) {
|
|
400
|
+
if (!L(e)) return On;
|
|
401
|
+
let t = this.withSeriesTime(e), n = Dn(this.data, t.time);
|
|
402
|
+
if (n < 0) return On;
|
|
403
|
+
let r = R(t);
|
|
404
|
+
return z(this.data[n], r) ? {
|
|
405
|
+
index: n,
|
|
406
|
+
changed: !1
|
|
407
|
+
} : (this.data[n] = r, {
|
|
408
|
+
index: n,
|
|
409
|
+
changed: !0
|
|
410
|
+
});
|
|
411
|
+
}
|
|
350
412
|
updateLastBarFromTick(e) {
|
|
351
|
-
this.data.length !== 0 && (!isFinite(e.price) || e.price < 0 || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0) || (this.data[this.data.length - 1] =
|
|
413
|
+
this.data.length !== 0 && (!isFinite(e.price) || e.price < 0 || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0) || (this.data[this.data.length - 1] = ee(this.data[this.data.length - 1], this.withSeriesTime(e))));
|
|
352
414
|
}
|
|
353
415
|
getLength() {
|
|
354
416
|
return this.data.length;
|
|
@@ -356,16 +418,18 @@ var V = class {
|
|
|
356
418
|
clear() {
|
|
357
419
|
this.data = [];
|
|
358
420
|
}
|
|
421
|
+
}, V = {
|
|
422
|
+
to: "none",
|
|
423
|
+
index: -1,
|
|
424
|
+
changed: !1
|
|
359
425
|
};
|
|
360
|
-
//#endregion
|
|
361
|
-
//#region src/SeriesStore.ts
|
|
362
426
|
function H(e, t) {
|
|
363
427
|
let n = e[e.length - 1];
|
|
364
428
|
if (!n) return "append";
|
|
365
|
-
let r =
|
|
429
|
+
let r = y(t.time), i = y(n.time);
|
|
366
430
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
367
431
|
}
|
|
368
|
-
function
|
|
432
|
+
function jn(e) {
|
|
369
433
|
return [
|
|
370
434
|
e.time,
|
|
371
435
|
e.open,
|
|
@@ -374,10 +438,11 @@ function ln(e) {
|
|
|
374
438
|
e.close
|
|
375
439
|
].every(Number.isFinite);
|
|
376
440
|
}
|
|
377
|
-
var
|
|
378
|
-
shown = new
|
|
441
|
+
var Mn = class {
|
|
442
|
+
shown = new B();
|
|
379
443
|
whole = null;
|
|
380
444
|
aside = null;
|
|
445
|
+
shownRevision = 0;
|
|
381
446
|
constructor(e) {
|
|
382
447
|
this.hoursFilter = e;
|
|
383
448
|
}
|
|
@@ -387,6 +452,9 @@ var un = class {
|
|
|
387
452
|
length() {
|
|
388
453
|
return this.shown.getLength();
|
|
389
454
|
}
|
|
455
|
+
revision() {
|
|
456
|
+
return this.shownRevision;
|
|
457
|
+
}
|
|
390
458
|
liveBars() {
|
|
391
459
|
return this.aside?.getData() ?? this.whole ?? this.shown.getData();
|
|
392
460
|
}
|
|
@@ -396,7 +464,7 @@ var un = class {
|
|
|
396
464
|
prepend(e) {
|
|
397
465
|
let t = null, n = e;
|
|
398
466
|
if (this.whole) {
|
|
399
|
-
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(
|
|
467
|
+
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(jn).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);
|
|
400
468
|
this.whole = [...a, ...this.whole];
|
|
401
469
|
let o = this.hoursFilter(this.whole);
|
|
402
470
|
t = a.length, n = o ? a.filter((e) => o(e.time)) : a;
|
|
@@ -466,7 +534,7 @@ var un = class {
|
|
|
466
534
|
mergeTick(e) {
|
|
467
535
|
if (this.aside) return this.aside.updateLastBarFromTick(e), this.wrote("aside", !1);
|
|
468
536
|
let t = this.whole ? this.hoursFilter(this.whole) : null;
|
|
469
|
-
if (t && this.whole && !t(
|
|
537
|
+
if (t && this.whole && !t(kn(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
470
538
|
let n = this.shown.getLength();
|
|
471
539
|
this.shown.updateLastBarFromTick(e);
|
|
472
540
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -496,11 +564,34 @@ var un = class {
|
|
|
496
564
|
refiltered: r
|
|
497
565
|
});
|
|
498
566
|
}
|
|
567
|
+
replace(e) {
|
|
568
|
+
if (this.aside) {
|
|
569
|
+
let { index: t, changed: n } = this.aside.replaceBar(e);
|
|
570
|
+
return t < 0 ? V : {
|
|
571
|
+
to: "aside",
|
|
572
|
+
index: -1,
|
|
573
|
+
changed: n
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
if (!L(e)) return V;
|
|
577
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Dn(n, t.time) : -1;
|
|
578
|
+
if (n) {
|
|
579
|
+
if (r < 0 || !L(n[r])) return V;
|
|
580
|
+
let e = this.hoursFilter(n);
|
|
581
|
+
if (e && !e(t.time)) return this.replaceHidden(n, r, t);
|
|
582
|
+
}
|
|
583
|
+
let { index: i, changed: a } = this.shown.replaceBar(t);
|
|
584
|
+
return i < 0 ? V : (a && (n && (n[r] = this.shown.getData()[i]), this.shownRevision++), {
|
|
585
|
+
to: "shown",
|
|
586
|
+
index: i,
|
|
587
|
+
changed: a
|
|
588
|
+
});
|
|
589
|
+
}
|
|
499
590
|
loadAside(e) {
|
|
500
591
|
this.aside?.setData(e);
|
|
501
592
|
}
|
|
502
593
|
beginReplay() {
|
|
503
|
-
this.aside || (this.aside = new
|
|
594
|
+
this.aside || (this.aside = new B(), this.aside.setData(this.whole ?? this.shown.getData()));
|
|
504
595
|
}
|
|
505
596
|
endReplay() {
|
|
506
597
|
let e = this.aside;
|
|
@@ -520,7 +611,15 @@ var un = class {
|
|
|
520
611
|
this.shown.updateLastBar(e);
|
|
521
612
|
}
|
|
522
613
|
inSeriesUnit(e) {
|
|
523
|
-
return
|
|
614
|
+
return An(this.whole ?? this.shown.getData(), e);
|
|
615
|
+
}
|
|
616
|
+
replaceHidden(e, t, n) {
|
|
617
|
+
let r = R(n), i = !z(e[t], r);
|
|
618
|
+
return i && (e[t] = r), {
|
|
619
|
+
to: "hidden",
|
|
620
|
+
index: -1,
|
|
621
|
+
changed: i
|
|
622
|
+
};
|
|
524
623
|
}
|
|
525
624
|
wrote(e, t) {
|
|
526
625
|
return {
|
|
@@ -548,7 +647,7 @@ var un = class {
|
|
|
548
647
|
let r = this.hoursFilter(n);
|
|
549
648
|
return !r || r(e.time);
|
|
550
649
|
}
|
|
551
|
-
},
|
|
650
|
+
}, Nn = 5e3, Pn = 6e4, Fn = 500, In = class {
|
|
552
651
|
loader = null;
|
|
553
652
|
pageSize = 500;
|
|
554
653
|
loading = !1;
|
|
@@ -589,7 +688,7 @@ var un = class {
|
|
|
589
688
|
try {
|
|
590
689
|
r = await e(t, this.pageSize);
|
|
591
690
|
} catch (e) {
|
|
592
|
-
return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(
|
|
691
|
+
return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(Pn, Nn * 2 ** (this.failures - 1)), this.emit({
|
|
593
692
|
state: "error",
|
|
594
693
|
count: 0,
|
|
595
694
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -622,10 +721,10 @@ var un = class {
|
|
|
622
721
|
};
|
|
623
722
|
//#endregion
|
|
624
723
|
//#region src/ThemeManager.ts
|
|
625
|
-
function
|
|
724
|
+
function Ln(e, t) {
|
|
626
725
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
627
726
|
}
|
|
628
|
-
var
|
|
727
|
+
var Rn = class t {
|
|
629
728
|
base;
|
|
630
729
|
shape = null;
|
|
631
730
|
font = null;
|
|
@@ -644,13 +743,13 @@ var gn = class t {
|
|
|
644
743
|
return i;
|
|
645
744
|
}
|
|
646
745
|
getTheme() {
|
|
647
|
-
return this.effective ??=
|
|
746
|
+
return this.effective ??= oe(this.base, this.chartType, this.merged()), this.effective;
|
|
648
747
|
}
|
|
649
748
|
getBaseTheme() {
|
|
650
749
|
return this.base;
|
|
651
750
|
}
|
|
652
751
|
setTheme(e) {
|
|
653
|
-
let n = t.read(e), r = this.font !== null &&
|
|
752
|
+
let n = t.read(e), r = this.font !== null && Ln(n.font, this.base.font);
|
|
654
753
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
655
754
|
...this.base,
|
|
656
755
|
shape: {
|
|
@@ -715,7 +814,7 @@ var gn = class t {
|
|
|
715
814
|
return JSON.stringify(e) === JSON.stringify(this.getUserOverrides()) ? !1 : (this.user = new Map(Object.entries(e).map(([e, t]) => [e, { ...t }])), this.effective = null, !0);
|
|
716
815
|
}
|
|
717
816
|
getStyleValue(e) {
|
|
718
|
-
return
|
|
817
|
+
return f(this.base, this.merged(), e, this.chartType);
|
|
719
818
|
}
|
|
720
819
|
layer(e) {
|
|
721
820
|
return e === "host" ? this.host : this.user.get(this.base.name) ?? {};
|
|
@@ -732,7 +831,7 @@ var gn = class t {
|
|
|
732
831
|
};
|
|
733
832
|
//#endregion
|
|
734
833
|
//#region src/style/styleOptions.ts
|
|
735
|
-
function
|
|
834
|
+
function zn(e, t) {
|
|
736
835
|
return t ? {
|
|
737
836
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
738
837
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -740,22 +839,22 @@ function _n(e, t) {
|
|
|
740
839
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
741
840
|
} : {};
|
|
742
841
|
}
|
|
743
|
-
function
|
|
842
|
+
function Bn(e) {
|
|
744
843
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
745
844
|
return {
|
|
746
845
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
747
846
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
748
847
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
749
848
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
750
|
-
...
|
|
751
|
-
...
|
|
849
|
+
...zn("horizontal", n?.hLine),
|
|
850
|
+
...zn("vertical", n?.vLine),
|
|
752
851
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
753
852
|
...e.overrides
|
|
754
853
|
};
|
|
755
854
|
}
|
|
756
855
|
//#endregion
|
|
757
856
|
//#region src/layout/LayoutManager.ts
|
|
758
|
-
var
|
|
857
|
+
var Vn = 200, Hn = 80, U = (e) => e.position === "top" || e.position === "bottom", Un = class {
|
|
759
858
|
panels = [];
|
|
760
859
|
containerWidth = 0;
|
|
761
860
|
containerHeight = 0;
|
|
@@ -771,8 +870,8 @@ var yn = 200, bn = 80, U = (e) => e.position === "top" || e.position === "bottom
|
|
|
771
870
|
this.panels.push({
|
|
772
871
|
id: e,
|
|
773
872
|
position: n,
|
|
774
|
-
size: r ?? (a ?
|
|
775
|
-
minSize: a ?
|
|
873
|
+
size: r ?? (a ? Vn : t),
|
|
874
|
+
minSize: a ? Hn : i,
|
|
776
875
|
content: {
|
|
777
876
|
type: "indicator",
|
|
778
877
|
indicatorInstanceId: e
|
|
@@ -841,7 +940,7 @@ var yn = 200, bn = 80, U = (e) => e.position === "top" || e.position === "bottom
|
|
|
841
940
|
let r = this.panels.find((t) => t.id === e);
|
|
842
941
|
if (r) {
|
|
843
942
|
let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
|
|
844
|
-
r.position = n, a !== o && (r.size = o ?
|
|
943
|
+
r.position = n, a !== o && (r.size = o ? Vn : t, r.minSize = o ? Hn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
845
944
|
}
|
|
846
945
|
}
|
|
847
946
|
setPanelSize(e, t) {
|
|
@@ -957,24 +1056,42 @@ var yn = 200, bn = 80, U = (e) => e.position === "top" || e.position === "bottom
|
|
|
957
1056
|
getMainChartRect() {
|
|
958
1057
|
return this.resolve().mainChartRect;
|
|
959
1058
|
}
|
|
960
|
-
},
|
|
961
|
-
function
|
|
1059
|
+
}, Wn = 14, Gn = 14, Kn = 22, qn = 4;
|
|
1060
|
+
function Jn(e) {
|
|
962
1061
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: s, measure: l } = e, u = e.tagPrecision ?? c(t, n), d = u, f = r === null ? [t, n] : [
|
|
963
1062
|
t,
|
|
964
1063
|
n,
|
|
965
1064
|
r
|
|
966
|
-
],
|
|
1065
|
+
], p = o;
|
|
967
1066
|
for (let t of f) {
|
|
968
1067
|
if (!Number.isFinite(t)) continue;
|
|
969
|
-
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) :
|
|
970
|
-
|
|
1068
|
+
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : h(t, u, i), r = e.format ? n : h(t, d, i);
|
|
1069
|
+
p = Math.max(p, l(n, `500 ${s}px ${a}`) + Wn, l(r, `bold 11px ${a}`) + Gn, l(r, `600 ${s}px ${a}`) + Kn);
|
|
971
1070
|
}
|
|
972
|
-
return
|
|
1071
|
+
return p <= o ? o : Math.ceil(p / qn) * qn;
|
|
973
1072
|
}
|
|
974
|
-
function
|
|
1073
|
+
function Yn(e, t) {
|
|
975
1074
|
return t > e || t <= e - 12 ? t : e;
|
|
976
1075
|
}
|
|
977
|
-
|
|
1076
|
+
//#endregion
|
|
1077
|
+
//#region src/layout/labelWidths.ts
|
|
1078
|
+
var Xn = 512, Zn = class {
|
|
1079
|
+
widths = /* @__PURE__ */ new Map();
|
|
1080
|
+
fonts;
|
|
1081
|
+
forget = () => this.widths.clear();
|
|
1082
|
+
constructor() {
|
|
1083
|
+
this.fonts = typeof document < "u" ? document.fonts ?? null : null, this.fonts?.addEventListener("loadingdone", this.forget);
|
|
1084
|
+
}
|
|
1085
|
+
get(e, t, n) {
|
|
1086
|
+
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1087
|
+
if (i !== void 0) return i;
|
|
1088
|
+
let a = n();
|
|
1089
|
+
return this.widths.size >= Xn && this.widths.clear(), this.widths.set(r, a), a;
|
|
1090
|
+
}
|
|
1091
|
+
destroy() {
|
|
1092
|
+
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1093
|
+
}
|
|
1094
|
+
}, Qn = class {
|
|
978
1095
|
netY = 0;
|
|
979
1096
|
travelX = 0;
|
|
980
1097
|
engaged = !1;
|
|
@@ -990,8 +1107,8 @@ var On = class {
|
|
|
990
1107
|
}
|
|
991
1108
|
return this.engaged;
|
|
992
1109
|
}
|
|
993
|
-
},
|
|
994
|
-
function
|
|
1110
|
+
}, $n = 1;
|
|
1111
|
+
function er(e, t) {
|
|
995
1112
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
996
1113
|
}
|
|
997
1114
|
function W(e) {
|
|
@@ -1005,24 +1122,24 @@ function W(e) {
|
|
|
1005
1122
|
//#endregion
|
|
1006
1123
|
//#region src/plugins/registry.ts
|
|
1007
1124
|
var G = /* @__PURE__ */ new Map();
|
|
1008
|
-
function
|
|
1125
|
+
function tr(e) {
|
|
1009
1126
|
G.set(W(e), e);
|
|
1010
1127
|
}
|
|
1011
|
-
function
|
|
1128
|
+
function nr(e) {
|
|
1012
1129
|
return G.delete(e);
|
|
1013
1130
|
}
|
|
1014
|
-
function
|
|
1131
|
+
function rr() {
|
|
1015
1132
|
return [...G.values()];
|
|
1016
1133
|
}
|
|
1017
|
-
function
|
|
1134
|
+
function ir() {
|
|
1018
1135
|
G.clear();
|
|
1019
1136
|
}
|
|
1020
1137
|
//#endregion
|
|
1021
1138
|
//#region src/plugins/PluginManager.ts
|
|
1022
|
-
var
|
|
1139
|
+
var ar = class {
|
|
1023
1140
|
plugins = /* @__PURE__ */ new Map();
|
|
1024
1141
|
constructor(e, t = {}) {
|
|
1025
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1142
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of rr()) this.add(e);
|
|
1026
1143
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1027
1144
|
}
|
|
1028
1145
|
register(e) {
|
|
@@ -1052,15 +1169,15 @@ var Fn = class {
|
|
|
1052
1169
|
add(e) {
|
|
1053
1170
|
this.plugins.set(W(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1054
1171
|
}
|
|
1055
|
-
},
|
|
1172
|
+
}, or = {
|
|
1056
1173
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1057
1174
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1058
1175
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1059
1176
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1060
1177
|
positionClose: (e, t) => e.closePosition(t),
|
|
1061
|
-
positionReverse: (e, t, n) =>
|
|
1178
|
+
positionReverse: (e, t, n) => sr(e, t, n)
|
|
1062
1179
|
};
|
|
1063
|
-
async function
|
|
1180
|
+
async function sr(e, t, n) {
|
|
1064
1181
|
let { reversing: r } = n;
|
|
1065
1182
|
if (!r.has(t.positionId)) {
|
|
1066
1183
|
r.add(t.positionId);
|
|
@@ -1089,7 +1206,7 @@ async function Ln(e, t, n) {
|
|
|
1089
1206
|
}
|
|
1090
1207
|
}
|
|
1091
1208
|
}
|
|
1092
|
-
function
|
|
1209
|
+
function cr(e, t) {
|
|
1093
1210
|
let n = [], r = null, i = {
|
|
1094
1211
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1095
1212
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1099,8 +1216,8 @@ function Rn(e, t) {
|
|
|
1099
1216
|
e.data && t.onFill?.(e.data);
|
|
1100
1217
|
};
|
|
1101
1218
|
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));
|
|
1102
|
-
for (let r of Object.keys(
|
|
1103
|
-
let a =
|
|
1219
|
+
for (let r of Object.keys(or)) {
|
|
1220
|
+
let a = or[r], o = t.onIntent(r, (n) => {
|
|
1104
1221
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1105
1222
|
message: `Execution command failed: ${r}`,
|
|
1106
1223
|
cause: e
|
|
@@ -1114,15 +1231,15 @@ function Rn(e, t) {
|
|
|
1114
1231
|
}
|
|
1115
1232
|
//#endregion
|
|
1116
1233
|
//#region src/Chart.ts
|
|
1117
|
-
var
|
|
1234
|
+
var lr = {
|
|
1118
1235
|
min: 0,
|
|
1119
1236
|
max: 100
|
|
1120
|
-
},
|
|
1121
|
-
function
|
|
1122
|
-
if (typeof e == "string" && e !== "exchange" && !
|
|
1237
|
+
}, ur = "exchange", dr = ur;
|
|
1238
|
+
function fr(e) {
|
|
1239
|
+
if (typeof e == "string" && e !== "exchange" && !v(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
1123
1240
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
1124
1241
|
}
|
|
1125
|
-
function
|
|
1242
|
+
function pr(e, t) {
|
|
1126
1243
|
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : w(e);
|
|
1127
1244
|
return i === void 0 ? e : {
|
|
1128
1245
|
...e,
|
|
@@ -1130,11 +1247,11 @@ function Un(e, t) {
|
|
|
1130
1247
|
timezone: i
|
|
1131
1248
|
};
|
|
1132
1249
|
}
|
|
1133
|
-
var
|
|
1134
|
-
static version = "1.
|
|
1250
|
+
var mr = .08, hr = a ** -7, gr = 800, _r = 20, vr = 8, yr = new Set(["horizontalLine", "crossLine"]), br = new Set(["verticalLine", "crossLine"]), xr = class {
|
|
1251
|
+
static version = "1.52.0";
|
|
1135
1252
|
engine;
|
|
1136
1253
|
viewport;
|
|
1137
|
-
series = new
|
|
1254
|
+
series = new Mn((e) => this.sessionKeep(e));
|
|
1138
1255
|
themeManager;
|
|
1139
1256
|
layoutManager;
|
|
1140
1257
|
pluginManager;
|
|
@@ -1149,6 +1266,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1149
1266
|
execTeardown = null;
|
|
1150
1267
|
autoScrollOnNewBar = !0;
|
|
1151
1268
|
displayDataCache = null;
|
|
1269
|
+
reshapeMemo = new at();
|
|
1270
|
+
displayDataStep;
|
|
1152
1271
|
indicatorUpdateFrom = null;
|
|
1153
1272
|
resolvedLayoutCache = null;
|
|
1154
1273
|
panelInfoCache = null;
|
|
@@ -1158,6 +1277,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1158
1277
|
renderDeferred = !1;
|
|
1159
1278
|
priceAxisWidth = o;
|
|
1160
1279
|
measureCtx;
|
|
1280
|
+
labelWidths = new Zn();
|
|
1161
1281
|
containerSizeCache = null;
|
|
1162
1282
|
containerSizeCacheTime = 0;
|
|
1163
1283
|
lastEmittedRange = null;
|
|
@@ -1171,14 +1291,18 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1171
1291
|
indicatorEdit = null;
|
|
1172
1292
|
removedDrawingAlerts = /* @__PURE__ */ new Map();
|
|
1173
1293
|
zoomAreaMode = !1;
|
|
1174
|
-
priceAxisAddButton = new
|
|
1294
|
+
priceAxisAddButton = new $e();
|
|
1175
1295
|
displayTz = null;
|
|
1176
1296
|
timeZoneSetting = null;
|
|
1177
1297
|
symbolInfo = null;
|
|
1178
1298
|
symbolInfoSeq = 0;
|
|
1299
|
+
studyZoneHeld = !1;
|
|
1300
|
+
studyZone = null;
|
|
1301
|
+
studyZoneTimer = null;
|
|
1302
|
+
studyZoneReleaseQueued = !1;
|
|
1179
1303
|
sessionBreaks;
|
|
1180
1304
|
sessionShading;
|
|
1181
|
-
hostSessionHours = { ...
|
|
1305
|
+
hostSessionHours = { ...ke };
|
|
1182
1306
|
compareRenderer;
|
|
1183
1307
|
countdownInterval = null;
|
|
1184
1308
|
pausedFor = {
|
|
@@ -1197,7 +1321,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1197
1321
|
signalMarkerManager;
|
|
1198
1322
|
tradeZoneManager;
|
|
1199
1323
|
measureOverlay;
|
|
1200
|
-
selectionBoxOverlay = new
|
|
1324
|
+
selectionBoxOverlay = new st();
|
|
1201
1325
|
replayManager;
|
|
1202
1326
|
replayBarUnsub = null;
|
|
1203
1327
|
replaySeeking = !1;
|
|
@@ -1207,7 +1331,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1207
1331
|
replayRevealMarks = !0;
|
|
1208
1332
|
replayOffset = 0;
|
|
1209
1333
|
undoRedoManager;
|
|
1210
|
-
autoSaveScheduler = new
|
|
1334
|
+
autoSaveScheduler = new Tn((e) => this.saveState(e));
|
|
1211
1335
|
animator;
|
|
1212
1336
|
crosshairTooltip;
|
|
1213
1337
|
pinnedTooltip;
|
|
@@ -1219,14 +1343,14 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1219
1343
|
disposed = !1;
|
|
1220
1344
|
chartTypeOptions = {};
|
|
1221
1345
|
mainSeriesVisible = !0;
|
|
1222
|
-
priceLines = new
|
|
1223
|
-
symbolSeries = new
|
|
1346
|
+
priceLines = new et();
|
|
1347
|
+
symbolSeries = new mt();
|
|
1224
1348
|
extendedHours = !0;
|
|
1225
1349
|
replayRestarting = !1;
|
|
1226
1350
|
requestedSymbols = /* @__PURE__ */ new Set();
|
|
1227
1351
|
gridRenderer;
|
|
1228
1352
|
priceAxis;
|
|
1229
|
-
leftPriceAxis = new
|
|
1353
|
+
leftPriceAxis = new Qe();
|
|
1230
1354
|
leftScaleRequested = !1;
|
|
1231
1355
|
leftAxisWidth = o;
|
|
1232
1356
|
leftViewport = null;
|
|
@@ -1242,6 +1366,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1242
1366
|
priceUnit = null;
|
|
1243
1367
|
paneTitles = !0;
|
|
1244
1368
|
defaultAutoScale;
|
|
1369
|
+
priceFitPending = !0;
|
|
1370
|
+
seriesArriving = !0;
|
|
1245
1371
|
keyboardHandler = null;
|
|
1246
1372
|
a11y = null;
|
|
1247
1373
|
onWindowKeyDown = null;
|
|
@@ -1257,7 +1383,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1257
1383
|
snapshotKey = null;
|
|
1258
1384
|
historyCheckQueued = !1;
|
|
1259
1385
|
constructor(e, t) {
|
|
1260
|
-
t.timeZone != null &&
|
|
1386
|
+
t.timeZone != null && fr(t.timeZone), this.container = e, this.options = {
|
|
1261
1387
|
...t,
|
|
1262
1388
|
chartType: t.chartType ?? "candlestick"
|
|
1263
1389
|
}, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
|
|
@@ -1295,15 +1421,15 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1295
1421
|
logScale: n.logScale ?? !0,
|
|
1296
1422
|
timeframes: n.timeframes ?? [],
|
|
1297
1423
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
1298
|
-
}, 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
|
|
1424
|
+
}, 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 In({
|
|
1299
1425
|
oldestTime: () => this.series.bars()[0]?.time ?? null,
|
|
1300
1426
|
prepend: (e) => this.prependBars(e),
|
|
1301
1427
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
1302
|
-
}), this.themeManager = new
|
|
1428
|
+
}), this.themeManager = new Rn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(Bn(t), "host", !1), this.layoutManager = new Un(), this.indicatorEngine = new Re(), this.pluginManager = new ar(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Pe(), Rt(this.indicatorEngine), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.indicatorEngine.register(new dt(this.symbolSeries)), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.drawingManager = new je(), Lt(this.drawingManager), this.drawingRenderer = new Me(this.drawingManager), this.drawingManager.setRequestRender(() => {
|
|
1303
1429
|
this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
|
|
1304
1430
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
1305
1431
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
1306
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new
|
|
1432
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new yt();
|
|
1307
1433
|
let i = "";
|
|
1308
1434
|
this.undoRedoManager.setOnChange(() => {
|
|
1309
1435
|
let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
|
|
@@ -1316,21 +1442,21 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1316
1442
|
primary: e[0] ?? null
|
|
1317
1443
|
})), this.drawingManager.setForeignHistory((e, t) => {
|
|
1318
1444
|
e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
|
|
1319
|
-
}), this.drawingManager.setDataGetter(() => this.series.bars()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new
|
|
1445
|
+
}), 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 _t({
|
|
1320
1446
|
enabled: this.features.trading,
|
|
1321
1447
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
1322
|
-
}), this.tradingRenderer = new
|
|
1448
|
+
}), this.tradingRenderer = new vt(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
1323
1449
|
this.eventBus.emit(e, t);
|
|
1324
|
-
}), this.engine = new
|
|
1450
|
+
}), this.engine = new tt(e, t.maxPixelRatio);
|
|
1325
1451
|
let a = this.engine.dprManager.getContainerSize();
|
|
1326
|
-
if (this.viewport = new
|
|
1452
|
+
if (this.viewport = new bt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), t.barLayout && this.viewport.setBarLayout(t.barLayout), this.viewport.setPanLimits({
|
|
1327
1453
|
freePan: t.freePan ?? !0,
|
|
1328
1454
|
minVisibleBars: t.panLimits?.minVisibleBars ?? 3
|
|
1329
1455
|
}), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
|
|
1330
1456
|
if (e.width <= 0 || e.height <= 0) return;
|
|
1331
1457
|
let t = this.viewport.isAtEnd();
|
|
1332
1458
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
|
|
1333
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new
|
|
1459
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Fe(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new Qe(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new ht(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Ee(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
1334
1460
|
if (e !== null && t) {
|
|
1335
1461
|
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0;
|
|
1336
1462
|
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null);
|
|
@@ -1339,20 +1465,20 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1339
1465
|
prevClose: e > 0 ? n[e - 1]?.close : void 0,
|
|
1340
1466
|
priceRange: i.priceRange,
|
|
1341
1467
|
plot: i.chartRect,
|
|
1342
|
-
barStepMs:
|
|
1343
|
-
timeUnit:
|
|
1468
|
+
barStepMs: Et(n),
|
|
1469
|
+
timeUnit: u(n)
|
|
1344
1470
|
}) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
|
|
1345
1471
|
point: t,
|
|
1346
1472
|
bar: r,
|
|
1347
1473
|
barIndex: e
|
|
1348
1474
|
});
|
|
1349
1475
|
} else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
|
|
1350
|
-
}), this.chartLegend = new
|
|
1476
|
+
}), this.chartLegend = new xe(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new wt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new Ct(), this.volumeProfile = new St(), this.marketProfile = new We(), this.depthHeatmap = new Ae(), this.periodLevels = new Je(), this.pivotMarkers = new Xe(), this.barCountdown = new _e(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new ct(), this.sessionShading = new lt(), this.compareRenderer = new Se(), t.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
1351
1477
|
visible: t.sessionBreaks.visible ?? !0,
|
|
1352
1478
|
color: t.sessionBreaks.color,
|
|
1353
1479
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
1354
1480
|
lineWidth: t.sessionBreaks.lineWidth
|
|
1355
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new
|
|
1481
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new me(), this.crosshairTooltip = new De(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Ye(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = S(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Dr(t.shapes)), t.font && this.themeManager.setFont(Er(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Ve({
|
|
1356
1482
|
scrollBars: (e) => {
|
|
1357
1483
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
1358
1484
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -1369,17 +1495,14 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1369
1495
|
},
|
|
1370
1496
|
fitContent: () => this.fitContent()
|
|
1371
1497
|
}), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
|
|
1372
|
-
this.a11y = new
|
|
1498
|
+
this.a11y = new nn(e, {
|
|
1373
1499
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
1374
1500
|
timeframe: () => this.streamTimeframe ?? "",
|
|
1375
1501
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
1376
1502
|
bars: () => this.getDisplayData(),
|
|
1377
1503
|
visibleRange: () => this.viewport.getState().visibleRange,
|
|
1378
1504
|
formatPrice: (e) => this.formatPrice(e),
|
|
1379
|
-
formatTime: (e) =>
|
|
1380
|
-
dateStyle: "medium",
|
|
1381
|
-
timeStyle: "short"
|
|
1382
|
-
}, this.displayTz)(e * l(this.getDisplayData())),
|
|
1505
|
+
formatTime: (e) => this.spokenBarTime(e),
|
|
1383
1506
|
showBar: (e) => this.setCrosshairTime(e)
|
|
1384
1507
|
}, t.a11y?.labels);
|
|
1385
1508
|
for (let e of [
|
|
@@ -1399,7 +1522,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1399
1522
|
}
|
|
1400
1523
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
1401
1524
|
}
|
|
1402
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new
|
|
1525
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Oe(), 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(r.Overlay)), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(kt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
1403
1526
|
this.eventBus.emit("alertTriggered", K(e)), this.eventBus.emit("dataUpdate", {
|
|
1404
1527
|
kind: "alert",
|
|
1405
1528
|
alert: "triggered",
|
|
@@ -1415,7 +1538,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1415
1538
|
this.eventBus.emit("alertExpired", K(e));
|
|
1416
1539
|
}), this.alertManager.on("updated", (e) => {
|
|
1417
1540
|
this.eventBus.emit("alertUpdate", K(e));
|
|
1418
|
-
}), this.signalMarkerManager = new
|
|
1541
|
+
}), this.signalMarkerManager = new ut(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
1419
1542
|
this.eventBus.emit("signalMarkerAdd", {
|
|
1420
1543
|
id: e.id,
|
|
1421
1544
|
source: e.source,
|
|
@@ -1423,14 +1546,14 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1423
1546
|
});
|
|
1424
1547
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
1425
1548
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
1426
|
-
}), this.tradeZoneManager = new
|
|
1549
|
+
}), this.tradeZoneManager = new gt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
1427
1550
|
this.eventBus.emit("tradeZoneAdd", {
|
|
1428
1551
|
id: e.id,
|
|
1429
1552
|
direction: e.direction
|
|
1430
1553
|
});
|
|
1431
1554
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
1432
1555
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
1433
|
-
}), this.replayManager = new
|
|
1556
|
+
}), this.replayManager = new rt(), this.replayManager.on("complete", () => {
|
|
1434
1557
|
let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
|
|
1435
1558
|
t && this.eventBus.emit("replayComplete", {
|
|
1436
1559
|
barIndex: e,
|
|
@@ -1438,10 +1561,10 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1438
1561
|
});
|
|
1439
1562
|
}), this.replayManager.on("stateChange", (e) => {
|
|
1440
1563
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
1441
|
-
}), this.measureOverlay = new
|
|
1442
|
-
let e = new
|
|
1443
|
-
this.interactionManager.setPanHandler(new
|
|
1444
|
-
t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.
|
|
1564
|
+
}), this.measureOverlay = new Ge(), this.interactionManager = new ze(e), this.features.panning) {
|
|
1565
|
+
let e = new Qn();
|
|
1566
|
+
this.interactionManager.setPanHandler(new Ke((t, n) => {
|
|
1567
|
+
t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
1445
1568
|
}, () => e.reset()));
|
|
1446
1569
|
}
|
|
1447
1570
|
if (this.interactionManager.setAxisStrips(() => ({
|
|
@@ -1452,11 +1575,11 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1452
1575
|
scales: !this.indicatorEngine.hasLeftScaleOverlays()
|
|
1453
1576
|
}
|
|
1454
1577
|
})), this.features.zooming) {
|
|
1455
|
-
this.interactionManager.setZoomHandler(new
|
|
1578
|
+
this.interactionManager.setZoomHandler(new Tt((e, t) => {
|
|
1456
1579
|
this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
|
|
1457
1580
|
}));
|
|
1458
|
-
let e = new
|
|
1459
|
-
this.
|
|
1581
|
+
let e = new ge((e) => {
|
|
1582
|
+
this.holdPriceScale(), this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
|
|
1460
1583
|
}, (e) => {
|
|
1461
1584
|
let t = this.viewport.getState().chartRect.width;
|
|
1462
1585
|
this.viewport.zoom(1 / e - 1, t / 2), this.updateViewportAndRender();
|
|
@@ -1475,7 +1598,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1475
1598
|
y: t.y
|
|
1476
1599
|
});
|
|
1477
1600
|
})), this.interactionManager.setChartContextMenu((e, t) => this.eventBus.hasListeners("chartContextMenu") ? (this.eventBus.emit("chartContextMenu", this.contextAt(e, t)), !0) : !1), this.priceAxisAddButton.setEnabled(this.features.priceAxisAddButton && this.features.crosshair), this.interactionManager.setPriceAxisAddButton(this.priceAxisAddButton, (e) => {
|
|
1478
|
-
let t =
|
|
1601
|
+
let t = Jt(e.y, this.viewport.getState());
|
|
1479
1602
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
1480
1603
|
price: t,
|
|
1481
1604
|
x: e.x,
|
|
@@ -1485,15 +1608,15 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1485
1608
|
...this.viewport.getState(),
|
|
1486
1609
|
data: this.getDisplayData()
|
|
1487
1610
|
})), this.features.alerts) {
|
|
1488
|
-
let e = new
|
|
1611
|
+
let e = new fe(this.alertManager, () => this.viewport.getState());
|
|
1489
1612
|
this.interactionManager.setAlertDragHandler(e);
|
|
1490
1613
|
}
|
|
1491
|
-
let o = new
|
|
1614
|
+
let o = new qe();
|
|
1492
1615
|
o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
|
|
1493
1616
|
let t = this.getDisplayData();
|
|
1494
1617
|
if (t.length === 0) return;
|
|
1495
1618
|
let n = this.viewport.getState(), i = n.barWidth + n.barSpacing, a = Math.round((n.offset + e.x) / i);
|
|
1496
|
-
a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme(),
|
|
1619
|
+
a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme(), u(t), d(t) === !0), this.pinnedTooltip.reposition(this.viewport.getState(), this.series.bars()[a] ?? null, a, this.themeManager.getTheme()), this.engine.requestRender(r.Overlay));
|
|
1497
1620
|
}), this.interactionManager.setSignalMarkerHitTest((e) => this.eventBus.hasListeners("signalMarkerHover") || this.eventBus.hasListeners("signalMarkerClick") ? this.signalMarkerManager.markerAt(e, this.viewport.getState()) : null, (e, t) => this.eventBus.emit("signalMarkerHover", {
|
|
1498
1621
|
marker: e,
|
|
1499
1622
|
x: t.x,
|
|
@@ -1512,7 +1635,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1512
1635
|
x: e.x,
|
|
1513
1636
|
y: e.y
|
|
1514
1637
|
}), t.length === 0) return;
|
|
1515
|
-
let r =
|
|
1638
|
+
let r = qt(e.x, this.viewport.getState());
|
|
1516
1639
|
r < 0 || r >= t.length || this.eventBus.emit("barClick", {
|
|
1517
1640
|
bar: t[r],
|
|
1518
1641
|
barIndex: r,
|
|
@@ -1555,7 +1678,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1555
1678
|
end: () => {
|
|
1556
1679
|
let e = this.selectionBoxOverlay.end();
|
|
1557
1680
|
if (e && this.zoomAreaMode) {
|
|
1558
|
-
if (e.x1 - e.x0 <
|
|
1681
|
+
if (e.x1 - e.x0 < vr) return;
|
|
1559
1682
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
1560
1683
|
return;
|
|
1561
1684
|
}
|
|
@@ -1586,8 +1709,10 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1586
1709
|
this.loadSeries(e, !1);
|
|
1587
1710
|
}
|
|
1588
1711
|
loadSeries(e, t) {
|
|
1589
|
-
this.snapshotKey = null, this.endReplaySession(), this.history.reset(), this.series.load(e), this.crosshairHandler.setData(this.series.bars()), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.options.autoScale = this.defaultAutoScale;
|
|
1590
|
-
let n = this.series.bars()
|
|
1712
|
+
this.snapshotKey = null, this.endReplaySession(), this.history.reset(), this.series.load(e), this.crosshairHandler.setData(this.series.bars()), this.displayDataCache = null, this.reshapeMemo.clear(), this.sessionBreaks.invalidateCache(), this.options.autoScale = this.defaultAutoScale, this.priceFitPending = !0;
|
|
1713
|
+
let n = this.series.bars();
|
|
1714
|
+
this.seriesArriving = n.length === 0;
|
|
1715
|
+
let r = n[n.length - 1];
|
|
1591
1716
|
t || (this.alertManager.clearLastValues(), r && this.alertManager.seedLastValue("price", r.close)), this.recalcIndicators(n), r && this.currentPriceLine.setPrice(r.close), this.updateViewportAndRender(!0), this.emitBars(n.length);
|
|
1592
1717
|
}
|
|
1593
1718
|
prependBars(e) {
|
|
@@ -1595,8 +1720,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1595
1720
|
let t = this.getDisplayData(), n = Math.max(0, Math.min(t.length - 1, Math.floor(this.viewport.getState().visibleRange.from))), r = t[n]?.time, { added: i, taken: a } = this.series.prepend(e);
|
|
1596
1721
|
if (i === 0) return a;
|
|
1597
1722
|
let o = this.series.bars();
|
|
1598
|
-
if (this.crosshairHandler.setData(o), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), r !== void 0) {
|
|
1599
|
-
let e = Math.round(
|
|
1723
|
+
if (this.crosshairHandler.setData(o), this.displayDataCache = null, this.reshapeMemo.clear(), this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), r !== void 0) {
|
|
1724
|
+
let e = Math.round(M(r, this.getDisplayData()));
|
|
1600
1725
|
this.viewport.prependBars(e - n);
|
|
1601
1726
|
}
|
|
1602
1727
|
return this.updateViewportAndRender(), a;
|
|
@@ -1608,7 +1733,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1608
1733
|
return;
|
|
1609
1734
|
}
|
|
1610
1735
|
let n = this.series.bars();
|
|
1611
|
-
this.crosshairHandler.setData(n), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.recalcIndicators(n), n.length > 0 && this.currentPriceLine.setPrice(n[n.length - 1].close), this.updateViewportAndRender(t), this.emitBars(n.length);
|
|
1736
|
+
this.crosshairHandler.setData(n), this.displayDataCache = null, this.reshapeMemo.clear(), this.sessionBreaks.invalidateCache(), this.recalcIndicators(n), n.length > 0 && this.currentPriceLine.setPrice(n[n.length - 1].close), this.updateViewportAndRender(t), this.emitBars(n.length);
|
|
1612
1737
|
}
|
|
1613
1738
|
setHistoryLoader(e, t) {
|
|
1614
1739
|
this.historyFromStream = !1, this.hostHistoryLoader = e !== null, this.history.setLoader(e, t?.pageSize), this.checkHistory();
|
|
@@ -1624,17 +1749,17 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1624
1749
|
}
|
|
1625
1750
|
checkHistory() {
|
|
1626
1751
|
this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
|
|
1627
|
-
if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() ||
|
|
1752
|
+
if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || I(this.options.chartType)) return;
|
|
1628
1753
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
1629
1754
|
if (t.width <= 0) return;
|
|
1630
1755
|
let { from: n, to: r } = e;
|
|
1631
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
1756
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(_r, r - n));
|
|
1632
1757
|
}));
|
|
1633
1758
|
}
|
|
1634
1759
|
useStreamHistory(e, t) {
|
|
1635
1760
|
if (this.hostHistoryLoader) return;
|
|
1636
|
-
let n =
|
|
1637
|
-
if (!r || i === null ||
|
|
1761
|
+
let n = N(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
|
|
1762
|
+
if (!r || i === null || le(i) !== null) {
|
|
1638
1763
|
this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
|
|
1639
1764
|
return;
|
|
1640
1765
|
}
|
|
@@ -1642,17 +1767,17 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1642
1767
|
this.history.setLoader((e, t) => r.call(n, a, i, e, t), t), this.historyFromStream = !0, this.checkHistory();
|
|
1643
1768
|
}
|
|
1644
1769
|
appendBar(e) {
|
|
1645
|
-
if (!
|
|
1770
|
+
if (!L(e)) return;
|
|
1646
1771
|
let t = this.series.append(e);
|
|
1647
1772
|
if (t.refiltered && (this.displayDataCache = null), t.to !== "shown") {
|
|
1648
1773
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
1649
1774
|
return;
|
|
1650
1775
|
}
|
|
1651
1776
|
let n = this.autoScrollOnNewBar && this.viewport.isAtEnd(), r = t.before, i = this.series.bars();
|
|
1652
|
-
this.crosshairHandler.setData(i), this.displayDataCache = null, this.recalcIndicatorsFrom(i, i.length - 2), this.currentPriceLine.setPrice(e.close), this.updateViewportAndRender(n), i.length !== r && this.emitBars(i.length), this.followLivePrice(e.close);
|
|
1777
|
+
this.crosshairHandler.setData(i), this.displayDataCache = null, this.recalcIndicatorsFrom(i, i.length - 2), this.currentPriceLine.setPrice(e.close, i[i.length - 2]?.close), this.updateViewportAndRender(n), i.length !== r && this.emitBars(i.length), this.followLivePrice(e.close);
|
|
1653
1778
|
}
|
|
1654
1779
|
appendBars(e) {
|
|
1655
|
-
if (e = e.filter(
|
|
1780
|
+
if (e = e.filter(L), e.length === 0) return;
|
|
1656
1781
|
let t = e[e.length - 1].close, n = this.series.appendMany(e);
|
|
1657
1782
|
if (n.refiltered && (this.displayDataCache = null), n.shown === 0) {
|
|
1658
1783
|
this.takeLivePrice(t), n.aside || this.scheduleRender();
|
|
@@ -1661,10 +1786,10 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1661
1786
|
let r = this.autoScrollOnNewBar && this.viewport.isAtEnd(), i = n.before;
|
|
1662
1787
|
this.displayDataCache = null;
|
|
1663
1788
|
let a = this.series.bars();
|
|
1664
|
-
this.recalcIndicatorsFrom(a, i - 1), this.crosshairHandler.setData(a), this.currentPriceLine.setPrice(t), this.updateViewportAndRender(r), a.length !== i && this.emitBars(a.length), this.followLivePrice(t);
|
|
1789
|
+
this.recalcIndicatorsFrom(a, i - 1), this.crosshairHandler.setData(a), this.currentPriceLine.setPrice(t, a[a.length - 2]?.close), this.updateViewportAndRender(r), a.length !== i && this.emitBars(a.length), this.followLivePrice(t);
|
|
1665
1790
|
}
|
|
1666
1791
|
updateLastBar(e) {
|
|
1667
|
-
if (!
|
|
1792
|
+
if (!L(e)) return;
|
|
1668
1793
|
let t = this.series.updateLast(e);
|
|
1669
1794
|
if (t.refiltered && (this.displayDataCache = null), t.to !== "shown") {
|
|
1670
1795
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -1685,6 +1810,29 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1685
1810
|
let n = this.series.bars();
|
|
1686
1811
|
this.recalcIndicatorsFrom(n, n.length - 1), this.followLivePrice(e.price), this.scheduleRender();
|
|
1687
1812
|
}
|
|
1813
|
+
updateBar(e) {
|
|
1814
|
+
if (!L(e)) return !1;
|
|
1815
|
+
let t = this.series.replace(e);
|
|
1816
|
+
return t.to === "none" ? !1 : (t.to === "shown" && t.changed && this.showCorrection(t.index), !0);
|
|
1817
|
+
}
|
|
1818
|
+
showCorrection(e) {
|
|
1819
|
+
let t = this.series.bars(), n = t[e];
|
|
1820
|
+
this.displayDataCache = null, this.reshapeMemo.clear(), this.indicatorEngine.deferRecalculateFrom(t, e), this.announceIndicatorUpdate(e), e === t.length - 1 && (this.currentPriceLine.setPrice(n.close, t[e - 1]?.close), this.alertManager.seedLastValue("price", n.close)), this.refreshShownBar(e), this.eventBus.emit("dataUpdate", {
|
|
1821
|
+
kind: "correction",
|
|
1822
|
+
time: n.time,
|
|
1823
|
+
index: e
|
|
1824
|
+
}), this.scheduleRender();
|
|
1825
|
+
}
|
|
1826
|
+
refreshShownBar(e) {
|
|
1827
|
+
let t = this.pinnedTooltip.isPinned() ? this.pinnedTooltip.getPinnedIndex() : -1, n = this.crosshairHandler.getReportedBarIndex();
|
|
1828
|
+
if (t < e && n === null) return;
|
|
1829
|
+
let r = this.isTimeAligned();
|
|
1830
|
+
if (r && t >= e) {
|
|
1831
|
+
let e = this.getDisplayData();
|
|
1832
|
+
e[t] && this.pinnedTooltip.pin(e[t], t, this.themeManager.getTheme(), u(e), d(e) === !0);
|
|
1833
|
+
}
|
|
1834
|
+
n !== null && (!r || n === e || n === e + 1) && this.crosshairHandler.refresh();
|
|
1835
|
+
}
|
|
1688
1836
|
getChartType() {
|
|
1689
1837
|
return this.options.chartType ?? "candlestick";
|
|
1690
1838
|
}
|
|
@@ -1696,17 +1844,17 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1696
1844
|
});
|
|
1697
1845
|
}
|
|
1698
1846
|
applyTimeSpacing() {
|
|
1699
|
-
let e = !this.tickStream && !
|
|
1847
|
+
let e = !this.tickStream && !I(this.options.chartType);
|
|
1700
1848
|
this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
|
|
1701
1849
|
}
|
|
1702
1850
|
setChartTypeOptions(e) {
|
|
1703
1851
|
this.chartTypeOptions = {
|
|
1704
1852
|
...this.chartTypeOptions,
|
|
1705
|
-
...
|
|
1706
|
-
}, this.displayDataCache = null, this.updateViewportAndRender(!0), this.markStateChanged();
|
|
1853
|
+
...S(e)
|
|
1854
|
+
}, this.displayDataCache = null, this.updateViewportAndRender(!0), this.a11y?.refresh(!0), this.markStateChanged();
|
|
1707
1855
|
}
|
|
1708
1856
|
getChartTypeOptions() {
|
|
1709
|
-
return
|
|
1857
|
+
return S(this.chartTypeOptions);
|
|
1710
1858
|
}
|
|
1711
1859
|
setExtendedHours(e) {
|
|
1712
1860
|
e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
|
|
@@ -1715,18 +1863,18 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1715
1863
|
return this.extendedHours;
|
|
1716
1864
|
}
|
|
1717
1865
|
sessionKeep(e) {
|
|
1718
|
-
return this.extendedHours ? null :
|
|
1866
|
+
return this.extendedHours ? null : Zt(this.symbolInfo, e);
|
|
1719
1867
|
}
|
|
1720
1868
|
reapplyExtendedHours() {
|
|
1721
1869
|
if (!this.series.refilter()) return;
|
|
1722
1870
|
let e = this.series.bars();
|
|
1723
|
-
this.crosshairHandler.setData(e), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.recalcIndicators(e), this.updateViewportAndRender(!0), this.emitBars(e.length);
|
|
1871
|
+
this.crosshairHandler.setData(e), this.displayDataCache = null, this.reshapeMemo.clear(), this.sessionBreaks.invalidateCache(), this.recalcIndicators(e), this.updateViewportAndRender(!0), this.emitBars(e.length);
|
|
1724
1872
|
}
|
|
1725
1873
|
quoteLines() {
|
|
1726
1874
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
1727
1875
|
}
|
|
1728
1876
|
setShapes(e) {
|
|
1729
|
-
let t =
|
|
1877
|
+
let t = Dr(e);
|
|
1730
1878
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
1731
1879
|
...this.themeManager.getTheme().shape,
|
|
1732
1880
|
...t
|
|
@@ -1738,7 +1886,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1738
1886
|
setFont(e) {
|
|
1739
1887
|
if (e === null) this.themeManager.setFont(null);
|
|
1740
1888
|
else {
|
|
1741
|
-
let t =
|
|
1889
|
+
let t = Er(e);
|
|
1742
1890
|
if (Object.keys(t).length === 0) return;
|
|
1743
1891
|
this.themeManager.setFont(t);
|
|
1744
1892
|
}
|
|
@@ -1789,7 +1937,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1789
1937
|
setSymbolSeries(e, t) {
|
|
1790
1938
|
e = e.trim(), this.symbolSeries.set(e, t), this.requestedSymbols.delete(e);
|
|
1791
1939
|
let n = this.series.bars(), r = !1;
|
|
1792
|
-
for (let t of this.indicatorEngine.getActiveIndicators()) !
|
|
1940
|
+
for (let t of this.indicatorEngine.getActiveIndicators()) !k.has(t.id) || String(t.params.symbol ?? "").trim() !== e.trim() || (this.indicatorEngine.updateIndicator(t.instanceId, {}, n), r = !0);
|
|
1793
1941
|
r && (this.announceIndicatorUpdate(0), this.updateViewportAndRender());
|
|
1794
1942
|
}
|
|
1795
1943
|
forgetUnreadSymbols() {
|
|
@@ -1803,27 +1951,27 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1803
1951
|
let e = /* @__PURE__ */ new Set();
|
|
1804
1952
|
for (let t of this.indicatorEngine.getActiveIndicators()) {
|
|
1805
1953
|
let n = t.params.symbol;
|
|
1806
|
-
|
|
1954
|
+
k.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
|
|
1807
1955
|
}
|
|
1808
1956
|
return [...e];
|
|
1809
1957
|
}
|
|
1810
1958
|
requestMissingSymbols(e) {
|
|
1811
1959
|
this.forgetUnreadSymbols();
|
|
1812
|
-
let t = this.indicatorEngine.getIndicatorConfig(e), n = t &&
|
|
1960
|
+
let t = this.indicatorEngine.getIndicatorConfig(e), n = t && k.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
|
|
1813
1961
|
!n || this.symbolSeries.has(n) || this.requestedSymbols.has(n) || (this.requestedSymbols.add(n), this.eventBus.emit("symbolSeriesRequest", { symbol: n }));
|
|
1814
1962
|
}
|
|
1815
1963
|
updateIndicator(e, t) {
|
|
1816
1964
|
this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
|
|
1817
1965
|
}
|
|
1818
1966
|
updateIndicatorNow(e, t) {
|
|
1819
|
-
let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ?
|
|
1967
|
+
let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? j(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
|
|
1820
1968
|
this.indicatorEngine.updateIndicator(e, t, this.series.bars()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
|
|
1821
1969
|
instanceId: e,
|
|
1822
1970
|
change: "params"
|
|
1823
1971
|
}), this.requestMissingSymbols(e);
|
|
1824
1972
|
let a = this.indicatorEngine.getIndicatorConfig(e);
|
|
1825
1973
|
if (n?.placement === "overlay" && a && r && a.params[r] !== i) {
|
|
1826
|
-
let t =
|
|
1974
|
+
let t = b(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : b(i) ? null : a.pane ?? null;
|
|
1827
1975
|
(n ?? void 0) !== a.pane && (this.indicatorEngine.setPane(e, n), this.eventBus.emit("indicatorChange", {
|
|
1828
1976
|
instanceId: e,
|
|
1829
1977
|
change: "pane"
|
|
@@ -1834,7 +1982,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1834
1982
|
paneFor(e, t, n, r) {
|
|
1835
1983
|
if (n) return this.paneHostOf(n, r);
|
|
1836
1984
|
if (e.placement !== "overlay") return null;
|
|
1837
|
-
let i =
|
|
1985
|
+
let i = j(e), a = i ? b(t[i]) : null;
|
|
1838
1986
|
return a ? this.paneHostOf(a.instanceId, r) : null;
|
|
1839
1987
|
}
|
|
1840
1988
|
paneHostOf(e, t) {
|
|
@@ -1861,6 +2009,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1861
2009
|
setLeftPriceScaleVisible(e) {
|
|
1862
2010
|
this.leftScaleRequested = e, this.updateViewportAndRender();
|
|
1863
2011
|
}
|
|
2012
|
+
isLeftPriceScaleVisible() {
|
|
2013
|
+
return this.leftScaleRequested;
|
|
2014
|
+
}
|
|
1864
2015
|
isLeftPriceScaleShown() {
|
|
1865
2016
|
return this.features.priceAxis !== !1 && (this.leftScaleRequested || this.indicatorEngine.hasLeftScaleOverlays());
|
|
1866
2017
|
}
|
|
@@ -1877,13 +2028,14 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1877
2028
|
return {
|
|
1878
2029
|
...e,
|
|
1879
2030
|
priceRange: {
|
|
1880
|
-
min: t.min - n *
|
|
1881
|
-
max: t.max + n *
|
|
2031
|
+
min: t.min - n * mr,
|
|
2032
|
+
max: t.max + n * mr
|
|
1882
2033
|
},
|
|
1883
2034
|
logScale: !1,
|
|
1884
2035
|
scaleMode: "regular",
|
|
1885
2036
|
invertScale: !1,
|
|
1886
2037
|
formatPrice: void 0,
|
|
2038
|
+
pricePrecision: void 0,
|
|
1887
2039
|
priceUnit: void 0
|
|
1888
2040
|
};
|
|
1889
2041
|
}
|
|
@@ -1930,7 +2082,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1930
2082
|
this.indicatorEngine.setStyleDefaults(e, null);
|
|
1931
2083
|
return;
|
|
1932
2084
|
}
|
|
1933
|
-
let { plots: n, ...r } = t, i = n === void 0 ? void 0 :
|
|
2085
|
+
let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ie(n);
|
|
1934
2086
|
this.indicatorEngine.setStyleDefaults(e, {
|
|
1935
2087
|
...r,
|
|
1936
2088
|
...i ? { plots: i } : {}
|
|
@@ -1938,7 +2090,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1938
2090
|
}
|
|
1939
2091
|
setPaneStyle(e, t) {
|
|
1940
2092
|
let n = this.paneOf(e);
|
|
1941
|
-
this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ?
|
|
2093
|
+
this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? ae(t) : null));
|
|
1942
2094
|
}
|
|
1943
2095
|
setPaneStyleNow(e, t) {
|
|
1944
2096
|
JSON.stringify(t) !== JSON.stringify(this.paneStyles.get(e) ?? null) && (t ? this.paneStyles.set(e, t) : this.paneStyles.delete(e), this.panelInfoCache = null, this.syncRenderContext(), this.engine.requestRender(), this.markStateChanged());
|
|
@@ -1957,8 +2109,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1957
2109
|
return this.pluginManager;
|
|
1958
2110
|
}
|
|
1959
2111
|
static indicators() {
|
|
1960
|
-
let e = new
|
|
1961
|
-
return
|
|
2112
|
+
let e = new Re();
|
|
2113
|
+
return Rt(e), e.getAvailableIndicators();
|
|
1962
2114
|
}
|
|
1963
2115
|
setPanelPosition(e, t) {
|
|
1964
2116
|
this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
|
|
@@ -1981,8 +2133,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
1981
2133
|
paneMoveHost(e, t) {
|
|
1982
2134
|
let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
|
|
1983
2135
|
if (!n || !r) return;
|
|
1984
|
-
let i =
|
|
1985
|
-
if (r.placement === "overlay" && i &&
|
|
2136
|
+
let i = j(r);
|
|
2137
|
+
if (r.placement === "overlay" && i && b(n.params[i])) return;
|
|
1986
2138
|
if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
|
|
1987
2139
|
if (t === "new") {
|
|
1988
2140
|
let t = this.layoutManager.getPanels().some((t) => t.id === e);
|
|
@@ -2080,6 +2232,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2080
2232
|
setIndicatorValueLabelsVisible(e) {
|
|
2081
2233
|
this.features.indicatorValueLabels = e, this.syncRenderContext(), this.engine.requestRender();
|
|
2082
2234
|
}
|
|
2235
|
+
isIndicatorValueLabelsVisible() {
|
|
2236
|
+
return this.features.indicatorValueLabels;
|
|
2237
|
+
}
|
|
2083
2238
|
setPaneTitlesVisible(e) {
|
|
2084
2239
|
this.paneTitles = e, this.engine.requestRender();
|
|
2085
2240
|
}
|
|
@@ -2088,12 +2243,12 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2088
2243
|
return this.features.legend ? e + this.chartLegend.getHeight() : e;
|
|
2089
2244
|
}
|
|
2090
2245
|
isTimeAligned() {
|
|
2091
|
-
return
|
|
2246
|
+
return I(this.options.chartType) ? !1 : this.getDisplayData().length === this.series.length();
|
|
2092
2247
|
}
|
|
2093
2248
|
roundPrice(e) {
|
|
2094
2249
|
if (!Number.isFinite(e)) return e;
|
|
2095
2250
|
let t = this.stepAt(e);
|
|
2096
|
-
if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(
|
|
2251
|
+
if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ce(t)));
|
|
2097
2252
|
let { min: n, max: r } = this.viewport.getState().priceRange;
|
|
2098
2253
|
return Number(e.toFixed(this.marketPricePrecision ?? c(n, r)));
|
|
2099
2254
|
}
|
|
@@ -2103,7 +2258,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2103
2258
|
}
|
|
2104
2259
|
stepAt(e) {
|
|
2105
2260
|
let t = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
|
|
2106
|
-
return t !== void 0 && t > 0 ? t : this.marketConfig ?
|
|
2261
|
+
return t !== void 0 && t > 0 ? t : this.marketConfig ? re(e, this.marketConfig) : void 0;
|
|
2107
2262
|
}
|
|
2108
2263
|
getPriceStep(e) {
|
|
2109
2264
|
let t = this.stepAt(e ?? this.lastClose());
|
|
@@ -2118,7 +2273,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2118
2273
|
return this.priceFormatter;
|
|
2119
2274
|
}
|
|
2120
2275
|
applyPriceFormat(e) {
|
|
2121
|
-
this.priceFormatter =
|
|
2276
|
+
this.priceFormatter = ne(e), this.priceUnit = e && typeof e != "function" ? g(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
|
|
2122
2277
|
}
|
|
2123
2278
|
setTimeFormatter(e) {
|
|
2124
2279
|
this.applyTimeFormatter(e), this.engine.requestRender();
|
|
@@ -2129,7 +2284,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2129
2284
|
formatPrice(e) {
|
|
2130
2285
|
if (this.priceFormatter) return this.priceFormatter(e);
|
|
2131
2286
|
let { min: t, max: n } = this.viewport.getState().priceRange;
|
|
2132
|
-
return
|
|
2287
|
+
return h(e, this.marketPricePrecision ?? c(t, n), this.numberLocale);
|
|
2133
2288
|
}
|
|
2134
2289
|
setDrawingTool(e) {
|
|
2135
2290
|
this.features.drawings && (e && this.features.drawingTools.length > 0 && !this.features.drawingTools.includes(e) || (e && this.setZoomAreaMode(!1), this.drawingManager.setActiveTool(e)));
|
|
@@ -2177,7 +2332,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2177
2332
|
}
|
|
2178
2333
|
autoFib() {
|
|
2179
2334
|
if (!this.features.drawings) return null;
|
|
2180
|
-
let e = this.getDisplayData(), t = this.viewport.getState(), n =
|
|
2335
|
+
let e = this.getDisplayData(), t = this.viewport.getState(), n = Dt(e, t.visibleRange.from, t.visibleRange.to);
|
|
2181
2336
|
return n ? this.addDrawing({
|
|
2182
2337
|
type: "fibRetracement",
|
|
2183
2338
|
anchors: [n[0], n[1]]
|
|
@@ -2255,7 +2410,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2255
2410
|
recordUndo(e) {
|
|
2256
2411
|
if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
|
|
2257
2412
|
let t = performance.now(), n = this.undoRedoManager.last();
|
|
2258
|
-
if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at <
|
|
2413
|
+
if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < gr) {
|
|
2259
2414
|
this.undoRedoManager.replaceLast({
|
|
2260
2415
|
...n,
|
|
2261
2416
|
custom: {
|
|
@@ -2302,7 +2457,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2302
2457
|
x: t.x,
|
|
2303
2458
|
y: t.y
|
|
2304
2459
|
};
|
|
2305
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
2460
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = Jt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = P(t.x, n)), e === "pane") {
|
|
2306
2461
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
2307
2462
|
e && (r.pane = e.instanceId);
|
|
2308
2463
|
}
|
|
@@ -2328,7 +2483,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2328
2483
|
...this.viewport.getState(),
|
|
2329
2484
|
data: this.getDisplayData()
|
|
2330
2485
|
};
|
|
2331
|
-
this.setVisibleRange(
|
|
2486
|
+
this.setVisibleRange(P(e.x0, t), P(e.x1, t));
|
|
2332
2487
|
}
|
|
2333
2488
|
lockAllDrawings() {
|
|
2334
2489
|
this.drawingManager.lockAllDrawings();
|
|
@@ -2373,7 +2528,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2373
2528
|
for (let e of this.indicatorEngine.getActiveIndicators()) {
|
|
2374
2529
|
let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
|
|
2375
2530
|
if (!t) continue;
|
|
2376
|
-
let r =
|
|
2531
|
+
let r = on(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
|
|
2377
2532
|
key: e,
|
|
2378
2533
|
title: e
|
|
2379
2534
|
}));
|
|
@@ -2463,7 +2618,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2463
2618
|
this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
|
|
2464
2619
|
}
|
|
2465
2620
|
updateIndicatorStyleNow(e, t) {
|
|
2466
|
-
let { plots: n, ...r } = t, i = n === void 0 ? void 0 :
|
|
2621
|
+
let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ie(n);
|
|
2467
2622
|
this.indicatorEngine.updateIndicatorStyle(e, {
|
|
2468
2623
|
...r,
|
|
2469
2624
|
...i ? { plots: i } : {}
|
|
@@ -2582,21 +2737,26 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2582
2737
|
this.features.trading && this.tradingManager.setConfig(e);
|
|
2583
2738
|
}
|
|
2584
2739
|
async connect(e) {
|
|
2585
|
-
if (!
|
|
2586
|
-
this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new
|
|
2587
|
-
let n =
|
|
2740
|
+
if (!zt(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
|
|
2741
|
+
this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new pt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (t) => {
|
|
2742
|
+
let n = this.streamSeriesKey(e.adapter);
|
|
2588
2743
|
this.replaySession ? this.series.loadAside(t) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(t) : this.setData(t), this.snapshotKey = n, this.useStreamHistory(e.adapter, e.historyPageSize);
|
|
2589
2744
|
}), this.streamManager.on("barClose", (e) => {
|
|
2590
|
-
if (!
|
|
2745
|
+
if (!L(e)) return;
|
|
2591
2746
|
let t = this.series.placeStreamBar(e);
|
|
2592
|
-
if (t.refiltered && (this.displayDataCache = null), t.to === "
|
|
2747
|
+
if (t.refiltered && (this.displayDataCache = null), t.to === "none") {
|
|
2748
|
+
this.updateBar(e);
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
if (t.to === "aside" && this.followLivePrice(e.close), t.to !== "shown") return;
|
|
2593
2752
|
let n = this.autoScrollOnNewBar && this.viewport.isAtEnd(), r = t.before, i = this.series.bars();
|
|
2594
2753
|
this.crosshairHandler.setData(i), this.displayDataCache = null, this.recalcIndicatorsFrom(i, i.length - 2), this.updateViewportAndRender(n), i.length !== r && this.emitBars(i.length), this.followLivePrice(e.close);
|
|
2754
|
+
}), this.streamManager.on("barCorrection", (e) => {
|
|
2755
|
+
this.updateBar(e);
|
|
2595
2756
|
}), this.streamManager.on("barUpdate", (e) => {
|
|
2596
|
-
if (!
|
|
2597
|
-
this.replaySession || this.currentPriceLine.setPrice(e.close);
|
|
2757
|
+
if (!L(e)) return;
|
|
2598
2758
|
let t = this.series.placeStreamBar(e);
|
|
2599
|
-
if (t.refiltered && (this.displayDataCache = null), this.replaySession) return;
|
|
2759
|
+
if (t.refiltered && (this.displayDataCache = null), t.to === "none" || (this.replaySession || this.currentPriceLine.setPrice(e.close), this.replaySession)) return;
|
|
2600
2760
|
let n = t.before;
|
|
2601
2761
|
if (t.to !== "shown") {
|
|
2602
2762
|
this.scheduleRender();
|
|
@@ -2634,14 +2794,18 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2634
2794
|
}), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
|
|
2635
2795
|
let t = this.streamManager;
|
|
2636
2796
|
if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
|
|
2637
|
-
let n =
|
|
2797
|
+
let n = ue(e.timeframe);
|
|
2638
2798
|
this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
|
|
2639
2799
|
this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
|
|
2640
2800
|
}, 1e3);
|
|
2641
2801
|
}
|
|
2802
|
+
streamSeriesKey(e) {
|
|
2803
|
+
let t = N(e), n = this.streamTimeframe, r = t instanceof it && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
2804
|
+
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
2805
|
+
}
|
|
2642
2806
|
setStreamTarget(e, t) {
|
|
2643
2807
|
let n = this.announcedSymbol;
|
|
2644
|
-
this.currentSymbol = e, this.streamTimeframe = t, this.tickStream =
|
|
2808
|
+
this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = le(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
|
|
2645
2809
|
symbol: e,
|
|
2646
2810
|
previous: n
|
|
2647
2811
|
})), this.useTimeframe(t);
|
|
@@ -2659,8 +2823,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2659
2823
|
async switchStream(e, t) {
|
|
2660
2824
|
if (!this.streamManager) return;
|
|
2661
2825
|
let n = this.streamAdapter;
|
|
2662
|
-
if (n && !
|
|
2663
|
-
this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(
|
|
2826
|
+
if (n && !zt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
2827
|
+
this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(ue(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
|
|
2664
2828
|
}
|
|
2665
2829
|
isIndicatorAllowed(e) {
|
|
2666
2830
|
let t = this.features.indicatorIds;
|
|
@@ -2675,11 +2839,11 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2675
2839
|
this.isTimeframeAllowed(e) && await this.switchStream(this.currentSymbol, e);
|
|
2676
2840
|
}
|
|
2677
2841
|
disconnectStream() {
|
|
2678
|
-
this.symbolInfoSeq++, this.priceLines.setBidAsk(null), this.streamManager &&= (this.streamManager.dispose(), null), this.historyFromStream &&= (this.history.setLoader(null), !1), this.streamAdapter = null, this.tickStream = !1, this.applyTimeSpacing();
|
|
2842
|
+
this.symbolInfoSeq++, this.releaseStudyZoneAfterCaller(), this.priceLines.setBidAsk(null), this.streamManager &&= (this.streamManager.dispose(), null), this.historyFromStream &&= (this.history.setLoader(null), !1), this.streamAdapter = null, this.tickStream = !1, this.applyTimeSpacing();
|
|
2679
2843
|
}
|
|
2680
2844
|
connectExecution(e, t = {}) {
|
|
2681
2845
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
2682
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
2846
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = cr(e, {
|
|
2683
2847
|
onIntent: (e, t) => {
|
|
2684
2848
|
let n = (e) => t(e.payload);
|
|
2685
2849
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -2705,6 +2869,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2705
2869
|
setBarCountdownVisible(e) {
|
|
2706
2870
|
this.barCountdown.setVisible(e && this.features.barCountdown), this.engine.requestRender(r.Hover);
|
|
2707
2871
|
}
|
|
2872
|
+
isBarCountdownVisible() {
|
|
2873
|
+
return this.barCountdown.isVisible();
|
|
2874
|
+
}
|
|
2708
2875
|
setSessionBreaksVisible(e) {
|
|
2709
2876
|
this.sessionBreaks.setVisible(e), this.engine.requestRender(r.Background);
|
|
2710
2877
|
}
|
|
@@ -2715,19 +2882,50 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2715
2882
|
data: n,
|
|
2716
2883
|
color: r,
|
|
2717
2884
|
visible: !0
|
|
2718
|
-
}), this.updateViewportAndRender()
|
|
2885
|
+
}), this.updateViewportAndRender(), this.eventBus.emit("compareChange", {
|
|
2886
|
+
id: e,
|
|
2887
|
+
change: "add"
|
|
2888
|
+
}));
|
|
2719
2889
|
}
|
|
2720
2890
|
removeCompareSymbol(e) {
|
|
2721
|
-
this.compareRenderer.removeSymbol(e), this.updateViewportAndRender()
|
|
2891
|
+
this.compareRenderer.removeSymbol(e), this.updateViewportAndRender(), this.eventBus.emit("compareChange", {
|
|
2892
|
+
id: e,
|
|
2893
|
+
change: "remove"
|
|
2894
|
+
});
|
|
2722
2895
|
}
|
|
2723
2896
|
updateCompareData(e, t) {
|
|
2724
|
-
this.compareRenderer.setSymbolData(e, t), this.updateViewportAndRender()
|
|
2897
|
+
this.compareRenderer.setSymbolData(e, t), this.updateViewportAndRender(), this.eventBus.emit("compareChange", {
|
|
2898
|
+
id: e,
|
|
2899
|
+
change: "data"
|
|
2900
|
+
});
|
|
2725
2901
|
}
|
|
2726
2902
|
setCompareMode(e) {
|
|
2727
2903
|
this.compareRenderer.setMode(e), this.updateViewportAndRender();
|
|
2728
2904
|
}
|
|
2905
|
+
setCompareVisible(e, t) {
|
|
2906
|
+
this.compareRenderer.setSymbolVisible(e, t), this.updateViewportAndRender(), this.eventBus.emit("compareChange", {
|
|
2907
|
+
id: e,
|
|
2908
|
+
change: "visible"
|
|
2909
|
+
});
|
|
2910
|
+
}
|
|
2911
|
+
getCompareValues(e) {
|
|
2912
|
+
if (!this.comparesDrawn()) {
|
|
2913
|
+
let e = this.series.bars();
|
|
2914
|
+
return this.compareRenderer.valuesAt(e, null, e.length - 1);
|
|
2915
|
+
}
|
|
2916
|
+
let t = this.getDisplayData();
|
|
2917
|
+
return this.compareRenderer.valuesAt(t, this.viewport.getState(), e ?? t.length - 1);
|
|
2918
|
+
}
|
|
2919
|
+
comparesDrawn() {
|
|
2920
|
+
return this.isTimeAligned();
|
|
2921
|
+
}
|
|
2729
2922
|
clearCompareSymbols() {
|
|
2923
|
+
let e = this.compareRenderer.getSymbols().map((e) => e.id);
|
|
2730
2924
|
this.compareRenderer.clear(), this.updateViewportAndRender();
|
|
2925
|
+
for (let t of e) this.eventBus.emit("compareChange", {
|
|
2926
|
+
id: t,
|
|
2927
|
+
change: "remove"
|
|
2928
|
+
});
|
|
2731
2929
|
}
|
|
2732
2930
|
setLogScale(e) {
|
|
2733
2931
|
e && !this.features.logScale || (this.viewport.setLogScale(e), this.updateViewportAndRender());
|
|
@@ -2770,18 +2968,18 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2770
2968
|
goToTime(e) {
|
|
2771
2969
|
let t = this.getDisplayData();
|
|
2772
2970
|
if (t.length === 0 || !Number.isFinite(e)) return -1;
|
|
2773
|
-
let n = Math.max(0, Math.min(t.length - 1, Math.floor(
|
|
2971
|
+
let n = Math.max(0, Math.min(t.length - 1, Math.floor(M(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
|
|
2774
2972
|
return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
|
|
2775
2973
|
}
|
|
2776
2974
|
setVisibleRangePreset(e) {
|
|
2777
2975
|
let t = this.getDisplayData();
|
|
2778
2976
|
if (t.length === 0) return;
|
|
2779
|
-
let n = t.length - 1, r =
|
|
2977
|
+
let n = t.length - 1, r = u(t), i = Ft(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
2780
2978
|
if (a === null || a < t[0].time) {
|
|
2781
2979
|
this.fitContent();
|
|
2782
2980
|
return;
|
|
2783
2981
|
}
|
|
2784
|
-
let o =
|
|
2982
|
+
let o = M(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
|
|
2785
2983
|
this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
|
|
2786
2984
|
}
|
|
2787
2985
|
scrollToEnd() {
|
|
@@ -2806,7 +3004,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2806
3004
|
setVisibleRange(e, t) {
|
|
2807
3005
|
let n = this.getDisplayData();
|
|
2808
3006
|
if (n.length === 0) return;
|
|
2809
|
-
let r =
|
|
3007
|
+
let r = M(Math.min(e, t), n), i = M(Math.max(e, t), n);
|
|
2810
3008
|
this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
|
|
2811
3009
|
}
|
|
2812
3010
|
suspend() {
|
|
@@ -2912,7 +3110,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2912
3110
|
this.applyStyle(e, t.layer ?? "host", !0);
|
|
2913
3111
|
}
|
|
2914
3112
|
setOverrides(e, t = {}) {
|
|
2915
|
-
let n = t.layer ?? "host", { overrides: r, rejected: i } =
|
|
3113
|
+
let n = t.layer ?? "host", { overrides: r, rejected: i } = x(e);
|
|
2916
3114
|
i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
|
|
2917
3115
|
let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
|
|
2918
3116
|
this.themeManager.setOverrides(a, n) && this.styleChanged(n);
|
|
@@ -2931,7 +3129,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2931
3129
|
return this.themeManager.getStyleValue(e);
|
|
2932
3130
|
}
|
|
2933
3131
|
applyStyle(e, t, n) {
|
|
2934
|
-
let { overrides: r, rejected: i } =
|
|
3132
|
+
let { overrides: r, rejected: i } = x(e);
|
|
2935
3133
|
i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
|
|
2936
3134
|
}
|
|
2937
3135
|
styleChanged(e) {
|
|
@@ -2946,7 +3144,10 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2946
3144
|
}), this.engine.requestRender(r.Background);
|
|
2947
3145
|
}
|
|
2948
3146
|
setAutoScale(e) {
|
|
2949
|
-
this.options.autoScale = e, this.defaultAutoScale = e, this.updateViewportAndRender();
|
|
3147
|
+
this.options.autoScale = e, this.defaultAutoScale = e, !e && this.series.length() > 0 && (this.seriesArriving = !1), this.updateViewportAndRender();
|
|
3148
|
+
}
|
|
3149
|
+
holdPriceScale() {
|
|
3150
|
+
this.options.autoScale = !1, this.priceFitPending = !1;
|
|
2950
3151
|
}
|
|
2951
3152
|
isAutoScale() {
|
|
2952
3153
|
return this.options.autoScale !== !1;
|
|
@@ -2961,7 +3162,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2961
3162
|
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
|
|
2962
3163
|
}
|
|
2963
3164
|
setCrosshairTime(e) {
|
|
2964
|
-
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(
|
|
3165
|
+
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(M(e, t));
|
|
2965
3166
|
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
|
|
2966
3167
|
}
|
|
2967
3168
|
getData() {
|
|
@@ -2976,6 +3177,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2976
3177
|
setVolumeVisible(e) {
|
|
2977
3178
|
this.volumeRenderer.setVisible(e), this.updateViewportAndRender();
|
|
2978
3179
|
}
|
|
3180
|
+
isVolumeVisible() {
|
|
3181
|
+
return this.features.volume && this.volumeRenderer.isVisible();
|
|
3182
|
+
}
|
|
2979
3183
|
setVolumeProfileVisible(e) {
|
|
2980
3184
|
this.volumeProfile.setVisible(e), this.engine.requestRender(r.Main);
|
|
2981
3185
|
}
|
|
@@ -2994,6 +3198,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
2994
3198
|
setMarketProfileConfig(e) {
|
|
2995
3199
|
e.buckets !== void 0 && this.marketProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.marketProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.marketProfile.setOpacity(e.opacity), e.valueAreaPct !== void 0 && this.marketProfile.setValueAreaPct(e.valueAreaPct), e.highlightPoC !== void 0 && this.marketProfile.setHighlightPoC(e.highlightPoC), e.showStats !== void 0 && this.marketProfile.setShowStats(e.showStats), e.splitBySession !== void 0 && this.marketProfile.setSplitBySession(e.splitBySession), e.letters !== void 0 && this.marketProfile.setLetters(e.letters), this.engine.requestRender(r.Main);
|
|
2996
3200
|
}
|
|
3201
|
+
getMarketProfileConfig() {
|
|
3202
|
+
return this.marketProfile.getConfig();
|
|
3203
|
+
}
|
|
2997
3204
|
getMarketProfileStats() {
|
|
2998
3205
|
return this.marketProfile.getStats();
|
|
2999
3206
|
}
|
|
@@ -3006,6 +3213,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3006
3213
|
setDepthHeatmapConfig(e) {
|
|
3007
3214
|
e.opacity !== void 0 && this.depthHeatmap.setOpacity(e.opacity), e.capacity !== void 0 && this.depthHeatmap.setCapacity(e.capacity), this.engine.requestRender(r.Main);
|
|
3008
3215
|
}
|
|
3216
|
+
getDepthHeatmapConfig() {
|
|
3217
|
+
return this.depthHeatmap.getConfig();
|
|
3218
|
+
}
|
|
3009
3219
|
pushDepthSnapshot(e, t) {
|
|
3010
3220
|
let n = this.series.bars(), i = t ?? n[n.length - 1]?.time;
|
|
3011
3221
|
i === void 0 || !Number.isFinite(i) || (this.depthHeatmap.push(i, e), this.depthHeatmap.isVisible() && this.engine.requestRender(r.Main));
|
|
@@ -3022,8 +3232,11 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3022
3232
|
setPeriodLevelsPeriod(e) {
|
|
3023
3233
|
this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
|
|
3024
3234
|
}
|
|
3235
|
+
getPeriodLevelsPeriod() {
|
|
3236
|
+
return this.periodLevels.getPeriod();
|
|
3237
|
+
}
|
|
3025
3238
|
setTimeZone(e) {
|
|
3026
|
-
|
|
3239
|
+
fr(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
3027
3240
|
}
|
|
3028
3241
|
getTimeZone() {
|
|
3029
3242
|
return this.timeZoneSetting;
|
|
@@ -3032,7 +3245,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3032
3245
|
return this.displayTz;
|
|
3033
3246
|
}
|
|
3034
3247
|
getExchangeTimeZone() {
|
|
3035
|
-
return [w(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e &&
|
|
3248
|
+
return [w(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && v(e)) ?? null;
|
|
3036
3249
|
}
|
|
3037
3250
|
setTimezone(e) {
|
|
3038
3251
|
this.setTimeZone(e);
|
|
@@ -3049,13 +3262,46 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3049
3262
|
setTimezoneOffset(e) {
|
|
3050
3263
|
this.setTimeZone(e);
|
|
3051
3264
|
}
|
|
3265
|
+
applyExchangeZone() {
|
|
3266
|
+
let e = this.getExchangeTimeZone();
|
|
3267
|
+
this.timeAxis.setExchangeTimeZone(e), this.crosshairHandler.setExchangeTimeZone(e), this.crosshairTooltip.setExchangeTimeZone(e), this.pinnedTooltip.setExchangeTimeZone(e), this.studyZoneHeld || this.applyStudyZone(e);
|
|
3268
|
+
}
|
|
3269
|
+
applyStudyZone(e) {
|
|
3270
|
+
this.studyZone = e, this.streamManager?.setTimeZone(e), this.periodLevels.setExchangeTimeZone(e), this.marketProfile.setExchangeTimeZone(e);
|
|
3271
|
+
let t = this.series.bars();
|
|
3272
|
+
this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
|
|
3273
|
+
}
|
|
3274
|
+
holdStudyZone() {
|
|
3275
|
+
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), ot);
|
|
3276
|
+
}
|
|
3277
|
+
endStudyZoneWait() {
|
|
3278
|
+
this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
|
|
3279
|
+
}
|
|
3280
|
+
releaseStudyZone() {
|
|
3281
|
+
this.endStudyZoneWait(), this.studyZoneHeld && (this.studyZoneHeld = !1, this.applyStudyZone(this.getExchangeTimeZone()), this.disposed || this.updateViewportAndRender());
|
|
3282
|
+
}
|
|
3283
|
+
releaseStudyZoneAfterCaller() {
|
|
3284
|
+
this.studyZoneHeld && (this.endStudyZoneWait(), this.studyZoneReleaseQueued = !0, queueMicrotask(() => {
|
|
3285
|
+
!this.studyZoneReleaseQueued || this.disposed || this.releaseStudyZone();
|
|
3286
|
+
}));
|
|
3287
|
+
}
|
|
3288
|
+
spokenBarTime(e) {
|
|
3289
|
+
let t = this.getDisplayData(), n = e * u(t), r = this.numberLocale || "en-US";
|
|
3290
|
+
return d(t) === !0 ? de(r, { dateStyle: "medium" }, l(n, this.displayTz, this.getExchangeTimeZone()))(n) : de(r, {
|
|
3291
|
+
dateStyle: "medium",
|
|
3292
|
+
timeStyle: "short"
|
|
3293
|
+
}, this.displayTz)(n);
|
|
3294
|
+
}
|
|
3052
3295
|
applyTimeZone() {
|
|
3053
3296
|
let e = this.timeZoneSetting === "exchange" ? this.getExchangeTimeZone() ?? "UTC" : this.timeZoneSetting;
|
|
3054
3297
|
this.displayTz = e, this.timeAxis.setTimezoneOffset(e), this.crosshairHandler.setTimezoneOffset(e), this.crosshairTooltip.setTimezoneOffset(e), this.pinnedTooltip.setTimezone(e), this.sessionBreaks.setTimezone(e), this.engine.requestRender();
|
|
3055
3298
|
}
|
|
3056
3299
|
setSymbolInfo(e) {
|
|
3300
|
+
this.studyZoneHeld = !1, this.endStudyZoneWait(), this.useSymbolInfo(e);
|
|
3301
|
+
}
|
|
3302
|
+
useSymbolInfo(e) {
|
|
3057
3303
|
let t = e && this.symbolInfo?.symbol === e.symbol ? w(this.symbolInfo) : void 0;
|
|
3058
|
-
this.symbolInfo = e ?
|
|
3304
|
+
this.symbolInfo = e ? pr({
|
|
3059
3305
|
...e,
|
|
3060
3306
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
3061
3307
|
}, t) : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(r.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
@@ -3066,12 +3312,12 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3066
3312
|
endMinute: n
|
|
3067
3313
|
}];
|
|
3068
3314
|
}), i = w(this.symbolInfo);
|
|
3069
|
-
this.sessionShading.replaceConfig(n.length > 0 && i &&
|
|
3315
|
+
this.sessionShading.replaceConfig(n.length > 0 && i && v(i) ? {
|
|
3070
3316
|
timeZone: i,
|
|
3071
3317
|
windows: n,
|
|
3072
3318
|
startMinute: n[0].startMinute,
|
|
3073
3319
|
endMinute: n[n.length - 1].endMinute
|
|
3074
|
-
} : this.hostSessionHours), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.reapplyExtendedHours(), this.updateViewportAndRender(), this.eventBus.emit("symbolInfoChange", { info: this.symbolInfo });
|
|
3320
|
+
} : this.hostSessionHours), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), this.reapplyExtendedHours(), this.updateViewportAndRender(), this.eventBus.emit("symbolInfoChange", { info: this.symbolInfo });
|
|
3075
3321
|
}
|
|
3076
3322
|
getSymbolInfo() {
|
|
3077
3323
|
return this.symbolInfo;
|
|
@@ -3080,7 +3326,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3080
3326
|
if (!e || typeof e != "object") return;
|
|
3081
3327
|
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
3082
3328
|
if (!n(e.symbol)) return;
|
|
3083
|
-
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i =
|
|
3329
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = pr({
|
|
3084
3330
|
...r,
|
|
3085
3331
|
...e,
|
|
3086
3332
|
symbol: e.symbol || r?.symbol || t
|
|
@@ -3088,14 +3334,16 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3088
3334
|
r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
|
|
3089
3335
|
}
|
|
3090
3336
|
resolveStreamSymbol(e, t) {
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3337
|
+
let n = N(e), r = n.resolveSymbol?.bind(n);
|
|
3338
|
+
if (this.symbolInfo && this.symbolInfo.symbol !== t ? (r ? this.holdStudyZone() : this.studyZoneHeld = !1, this.useSymbolInfo(null)) : r && this.studyZoneHeld && this.holdStudyZone(), !r) {
|
|
3339
|
+
this.releaseStudyZone();
|
|
3340
|
+
return;
|
|
3341
|
+
}
|
|
3342
|
+
let i = ++this.symbolInfoSeq;
|
|
3343
|
+
Promise.resolve().then(() => r(t)).then((e) => {
|
|
3344
|
+
i === this.symbolInfoSeq && (e && this.currentSymbol === t ? this.setSymbolInfo(e) : this.releaseStudyZone());
|
|
3097
3345
|
}, (e) => {
|
|
3098
|
-
|
|
3346
|
+
i === this.symbolInfoSeq && (this.releaseStudyZone(), console.warn(`No symbol info for "${t}":`, e));
|
|
3099
3347
|
});
|
|
3100
3348
|
}
|
|
3101
3349
|
setPivotMarkersVisible(e) {
|
|
@@ -3107,6 +3355,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3107
3355
|
setPivotMarkersConfig(e) {
|
|
3108
3356
|
(e.left !== void 0 || e.right !== void 0) && this.pivotMarkers.setStrength(e.left ?? 5, e.right ?? e.left ?? 5), e.showLabels !== void 0 && this.pivotMarkers.setShowLabels(e.showLabels), e.structureLabels !== void 0 && this.pivotMarkers.setStructureLabels(e.structureLabels), this.engine.requestRender(r.Overlay);
|
|
3109
3357
|
}
|
|
3358
|
+
getPivotMarkersConfig() {
|
|
3359
|
+
return this.pivotMarkers.getConfig();
|
|
3360
|
+
}
|
|
3110
3361
|
setSessionShadingVisible(e) {
|
|
3111
3362
|
this.sessionShading.setVisible(e), this.engine.requestRender(r.Background);
|
|
3112
3363
|
}
|
|
@@ -3114,7 +3365,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3114
3365
|
return this.sessionShading.isVisible();
|
|
3115
3366
|
}
|
|
3116
3367
|
setSessionShadingConfig(e) {
|
|
3117
|
-
this.hostSessionHours =
|
|
3368
|
+
this.hostSessionHours = Mt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
|
|
3118
3369
|
}
|
|
3119
3370
|
setTooltipVisible(e) {
|
|
3120
3371
|
e || this.crosshairTooltip.hide();
|
|
@@ -3122,6 +3373,9 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3122
3373
|
setLegend(e) {
|
|
3123
3374
|
this.chartLegend.setConfig(e), this.engine.requestRender(r.Hover);
|
|
3124
3375
|
}
|
|
3376
|
+
isLegendVisible() {
|
|
3377
|
+
return this.features.legend && this.chartLegend.getConfig().visible;
|
|
3378
|
+
}
|
|
3125
3379
|
setSymbolName(e) {
|
|
3126
3380
|
this.chartLegend.setSymbol(e), this.engine.requestRender(r.Hover);
|
|
3127
3381
|
}
|
|
@@ -3133,11 +3387,11 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3133
3387
|
return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
|
|
3134
3388
|
}
|
|
3135
3389
|
async takeGpu(e, t, n) {
|
|
3136
|
-
let { gpu: r, reason: i } = await
|
|
3137
|
-
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ?
|
|
3390
|
+
let { gpu: r, reason: i } = await jt(e);
|
|
3391
|
+
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? Ot() > 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());
|
|
3138
3392
|
}
|
|
3139
3393
|
waitForGpu(e) {
|
|
3140
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
3394
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Kt(e) : null;
|
|
3141
3395
|
}
|
|
3142
3396
|
getRenderer() {
|
|
3143
3397
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -3159,23 +3413,36 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3159
3413
|
this.engine.getGpu() && this.engine.renderNow();
|
|
3160
3414
|
}
|
|
3161
3415
|
screenshot(e) {
|
|
3162
|
-
this.features.screenshot && (this.freshFrame(),
|
|
3416
|
+
this.features.screenshot && (this.freshFrame(), A.download(this.container, e, this.themeManager.getTheme().background));
|
|
3163
3417
|
}
|
|
3164
3418
|
async copyScreenshot() {
|
|
3165
3419
|
if (!this.features.screenshot) return !1;
|
|
3420
|
+
let e = globalThis.ClipboardItem, t = typeof navigator > "u" ? void 0 : navigator.clipboard;
|
|
3421
|
+
if (!t?.write || !e) return !1;
|
|
3166
3422
|
try {
|
|
3167
3423
|
this.freshFrame();
|
|
3168
|
-
let
|
|
3169
|
-
|
|
3424
|
+
let n = A.toBlob(this.container, this.themeManager.getTheme().background).then((e) => {
|
|
3425
|
+
if (!e) throw Error("No chart image to copy");
|
|
3426
|
+
return e;
|
|
3427
|
+
});
|
|
3428
|
+
n.catch(() => {});
|
|
3429
|
+
let r;
|
|
3430
|
+
try {
|
|
3431
|
+
r = new e({ "image/png": n });
|
|
3432
|
+
} catch (t) {
|
|
3433
|
+
if (!(t instanceof TypeError)) throw t;
|
|
3434
|
+
r = new e({ "image/png": await n });
|
|
3435
|
+
}
|
|
3436
|
+
return await t.write([r]), !0;
|
|
3170
3437
|
} catch {
|
|
3171
3438
|
return !1;
|
|
3172
3439
|
}
|
|
3173
3440
|
}
|
|
3174
3441
|
screenshotDataURL() {
|
|
3175
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
3442
|
+
return this.features.screenshot ? (this.freshFrame(), A.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
|
|
3176
3443
|
}
|
|
3177
3444
|
async screenshotBlob() {
|
|
3178
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
3445
|
+
return this.features.screenshot ? (this.freshFrame(), A.toBlob(this.container, this.themeManager.getTheme().background)) : null;
|
|
3179
3446
|
}
|
|
3180
3447
|
addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
|
|
3181
3448
|
if (!this.features.alerts) return null;
|
|
@@ -3309,23 +3576,23 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3309
3576
|
};
|
|
3310
3577
|
}
|
|
3311
3578
|
let { steps: n, startTime: r, hideHistory: i, revealMarks: a, ...o } = e ?? {}, s = this.series.inHoursShown(this.series.liveBars()), c = t > 0 && r === void 0 && i !== !1, l = o.startIndex;
|
|
3312
|
-
r !== void 0 && l === void 0 ? l =
|
|
3579
|
+
r !== void 0 && l === void 0 ? l = jr(s, r) : c && l !== void 0 && (l += t);
|
|
3313
3580
|
let u = c ? t : i && l !== void 0 && l > 0 ? Math.min(Math.floor(l), s.length - 1) : 0, d = u > 0 ? s.slice(u) : s;
|
|
3314
3581
|
l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
|
|
3315
|
-
let f = n ?
|
|
3582
|
+
let f = n ? Fr(n, d) : null;
|
|
3316
3583
|
this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
|
|
3317
3584
|
try {
|
|
3318
3585
|
this.replayManager.load(f ?? d);
|
|
3319
3586
|
} finally {
|
|
3320
3587
|
this.replayRestarting = !1;
|
|
3321
3588
|
}
|
|
3322
|
-
f && o.startIndex !== void 0 && (o.startIndex =
|
|
3589
|
+
f && o.startIndex !== void 0 && (o.startIndex = Lr(f, d, o.startIndex)), this.replayBarUnsub?.();
|
|
3323
3590
|
let p = -1, m = -1, h = null, g = f ?? d;
|
|
3324
3591
|
this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
|
|
3325
3592
|
let t = e, n = d[e];
|
|
3326
3593
|
if (f) {
|
|
3327
3594
|
let r = f[e];
|
|
3328
|
-
t =
|
|
3595
|
+
t = Ir(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? zr(h, r) : Rr(d[t], f, e), n = h;
|
|
3329
3596
|
}
|
|
3330
3597
|
m = e;
|
|
3331
3598
|
let r = t + 1, i = p > 0 && r >= p && this.series.length() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
|
|
@@ -3336,7 +3603,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3336
3603
|
} else this.series.showReplayed([...d.slice(0, t), n]), this.recalcIndicators(this.series.bars());
|
|
3337
3604
|
p = r, this.currentPriceLine.setPrice(n.close, t > 0 ? d[t - 1].close : void 0), this.crosshairHandler.setData(this.series.bars());
|
|
3338
3605
|
let o = g[e + 1]?.time ?? g[e].time + (e > 0 ? g[e].time - g[e - 1].time : 1);
|
|
3339
|
-
this.replayRevealMarks && this.revealReplayMarks(o), this.displayDataCache = null, this.updateViewportAndRender(a), this.feedReplaySteps(g, e), this.eventBus.emit("replayStep", {
|
|
3606
|
+
this.replayRevealMarks && this.revealReplayMarks(o), this.displayDataCache = null, this.reshapeMemo.clear(), this.updateViewportAndRender(a), this.feedReplaySteps(g, e), this.eventBus.emit("replayStep", {
|
|
3340
3607
|
barIndex: t,
|
|
3341
3608
|
time: d[t].time,
|
|
3342
3609
|
until: o,
|
|
@@ -3377,20 +3644,20 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3377
3644
|
return;
|
|
3378
3645
|
}
|
|
3379
3646
|
if (i.time <= n.fedTime) return;
|
|
3380
|
-
let a = e.slice(
|
|
3647
|
+
let a = e.slice(Mr(e, n.fedTime), t + 1);
|
|
3381
3648
|
n.fedTime = i.time;
|
|
3382
|
-
let o = Math.ceil(a.length /
|
|
3383
|
-
for (let e = 0; e < a.length; e += o) for (let [t, n] of
|
|
3649
|
+
let o = Math.ceil(a.length / Ar);
|
|
3650
|
+
for (let e = 0; e < a.length; e += o) for (let [t, n] of Nr(a.slice(e, e + o))) r.setMarkPrice(t, n);
|
|
3384
3651
|
this.tradingManager.setCurrentPrice(i.close);
|
|
3385
3652
|
}
|
|
3386
3653
|
getReplayBarIndex() {
|
|
3387
3654
|
if (!this.replaySession) return -1;
|
|
3388
3655
|
let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
|
|
3389
|
-
return t && this.replayCoarse ?
|
|
3656
|
+
return t && this.replayCoarse ? Ir(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
|
|
3390
3657
|
}
|
|
3391
3658
|
replaySeekToBar(e) {
|
|
3392
3659
|
let t = this.replayStepsSeries;
|
|
3393
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
3660
|
+
this.replaySeek(t && this.replayCoarse ? Lr(t, this.replayCoarse, e) : e);
|
|
3394
3661
|
}
|
|
3395
3662
|
replayPause() {
|
|
3396
3663
|
this.replayManager.pause();
|
|
@@ -3422,10 +3689,10 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3422
3689
|
data: this.getDisplayData()
|
|
3423
3690
|
}, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
3424
3691
|
for (let e of t.anchors) {
|
|
3425
|
-
let t =
|
|
3692
|
+
let t = Bt(e.time, n), r = Pt(e.price, n);
|
|
3426
3693
|
i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
|
|
3427
3694
|
}
|
|
3428
|
-
return
|
|
3695
|
+
return yr.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), br.has(t.type) && ([o, s] = [r.y, r.y + r.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 ? {
|
|
3429
3696
|
x: i,
|
|
3430
3697
|
y: o,
|
|
3431
3698
|
width: a - i,
|
|
@@ -3469,14 +3736,14 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3469
3736
|
});
|
|
3470
3737
|
}
|
|
3471
3738
|
restoreIndicators(e, t) {
|
|
3472
|
-
let n =
|
|
3739
|
+
let n = Sr(e), r = /* @__PURE__ */ new Map();
|
|
3473
3740
|
this.unrestoredIndicators = [];
|
|
3474
3741
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
3475
3742
|
if (t) {
|
|
3476
3743
|
let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
|
|
3477
3744
|
for (let n of t) {
|
|
3478
3745
|
let t = e.get(n.instanceId);
|
|
3479
|
-
t &&
|
|
3746
|
+
t && Cr(n, t) && o.add(n.instanceId);
|
|
3480
3747
|
}
|
|
3481
3748
|
for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
|
|
3482
3749
|
for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
|
|
@@ -3484,8 +3751,8 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3484
3751
|
let s = (e) => {
|
|
3485
3752
|
let t = { ...e };
|
|
3486
3753
|
for (let [e, n] of Object.entries(t)) {
|
|
3487
|
-
let i =
|
|
3488
|
-
a && (t[e] =
|
|
3754
|
+
let i = b(n), a = i && r.get(i.instanceId);
|
|
3755
|
+
a && (t[e] = _(a, i.key));
|
|
3489
3756
|
}
|
|
3490
3757
|
return t;
|
|
3491
3758
|
};
|
|
@@ -3538,7 +3805,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3538
3805
|
let s = t.levels ?? null;
|
|
3539
3806
|
JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s);
|
|
3540
3807
|
let c = t.intervals ?? null;
|
|
3541
|
-
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ?
|
|
3808
|
+
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? ae(t.paneStyle) : null);
|
|
3542
3809
|
}
|
|
3543
3810
|
restorePanes(e) {
|
|
3544
3811
|
for (let [t, n] of e) t.paneSize !== void 0 && this.layoutManager.setPanelSize(n, t.paneSize), (t.paneSize !== void 0 || t.paneCollapsed) && this.layoutManager.setPanelCollapsed(n, !!t.paneCollapsed), t.paneSize !== void 0 && this.layoutManager.setPanelScale(n, {
|
|
@@ -3643,7 +3910,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3643
3910
|
if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
|
|
3644
3911
|
let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
|
|
3645
3912
|
if (JSON.stringify(n) === JSON.stringify(i)) return r;
|
|
3646
|
-
let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) <
|
|
3913
|
+
let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < gr && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
|
|
3647
3914
|
type: "indicators",
|
|
3648
3915
|
before: null,
|
|
3649
3916
|
after: null
|
|
@@ -3677,7 +3944,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3677
3944
|
loadState(e) {
|
|
3678
3945
|
if (!this.features.saveLoad) return;
|
|
3679
3946
|
let t = T.deserialize(e);
|
|
3680
|
-
this.chartTypeOptions = t.chartTypeOptions ?? {}, this.displayDataCache = null, t.chartType && this.setChartType(t.chartType), t.drawings && this.setDrawings(t.drawings), (t.theme === "dark" || t.theme === "light") && this.setTheme(t.theme), t.version >= 3 && this.themeManager.setUserOverrides(t.overrides ?? {}) && this.styleChanged("user");
|
|
3947
|
+
this.chartTypeOptions = t.chartTypeOptions ?? {}, this.displayDataCache = null, this.reshapeMemo.clear(), t.chartType && this.setChartType(t.chartType), t.drawings && this.setDrawings(t.drawings), (t.theme === "dark" || t.theme === "light") && this.setTheme(t.theme), t.version >= 3 && this.themeManager.setUserOverrides(t.overrides ?? {}) && this.styleChanged("user");
|
|
3681
3948
|
let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
3682
3949
|
if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
|
|
3683
3950
|
this.alertManager.clearAlerts();
|
|
@@ -3687,7 +3954,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3687
3954
|
let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
|
|
3688
3955
|
return r ? r + e.slice(t) : e;
|
|
3689
3956
|
}, r = t(e.channel), i = {
|
|
3690
|
-
...
|
|
3957
|
+
...It(e),
|
|
3691
3958
|
...e.target ? { target: t(e.target) } : {}
|
|
3692
3959
|
};
|
|
3693
3960
|
if (!e.expired) {
|
|
@@ -3719,16 +3986,16 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3719
3986
|
this.loadState(T.serialize(e));
|
|
3720
3987
|
}
|
|
3721
3988
|
setLocale(e) {
|
|
3722
|
-
|
|
3989
|
+
se(e), this.engine.requestRender();
|
|
3723
3990
|
}
|
|
3724
3991
|
setNumberLocale(e) {
|
|
3725
|
-
this.numberLocale = e, this.viewport.setNumberLocale(e), this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.timeAxis.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.
|
|
3992
|
+
this.numberLocale = e, this.viewport.setNumberLocale(e), this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.timeAxis.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.pinnedTooltip.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
|
|
3726
3993
|
}
|
|
3727
3994
|
getNumberLocale() {
|
|
3728
3995
|
return this.numberLocale;
|
|
3729
3996
|
}
|
|
3730
3997
|
setMarket(e) {
|
|
3731
|
-
if (this.marketConfig = e, this.timeZoneSetting === "exchange" && this.applyTimeZone(), e.colorScheme) {
|
|
3998
|
+
if (this.marketConfig = e, this.studyZoneHeld = !1, this.endStudyZoneWait(), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), e.colorScheme) {
|
|
3732
3999
|
let t = {
|
|
3733
4000
|
...this.themeManager.getBaseTheme(),
|
|
3734
4001
|
candleUp: e.colorScheme.up,
|
|
@@ -3738,17 +4005,17 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3738
4005
|
};
|
|
3739
4006
|
this.themeManager.setTheme(t);
|
|
3740
4007
|
}
|
|
3741
|
-
e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
|
|
4008
|
+
e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender(), this.eventBus.emit("marketChange", { market: e });
|
|
3742
4009
|
}
|
|
3743
4010
|
applyPricePrecision(e) {
|
|
3744
|
-
this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e), this.tradeZoneManager.setPricePrecision(e), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
|
|
4011
|
+
this.marketPricePrecision = e, this.viewport.setPricePrecision(e), this.pinnedTooltip.setPricePrecision(e), this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e), this.tradeZoneManager.setPricePrecision(e), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
|
|
3745
4012
|
}
|
|
3746
4013
|
getMarket() {
|
|
3747
4014
|
return this.marketConfig;
|
|
3748
4015
|
}
|
|
3749
4016
|
getPriceLimits() {
|
|
3750
4017
|
let e = this.marketConfig;
|
|
3751
|
-
return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null :
|
|
4018
|
+
return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : p(e.priceLimits.referencePrice, e);
|
|
3752
4019
|
}
|
|
3753
4020
|
setPriceLimits(e) {
|
|
3754
4021
|
this.marketConfig?.priceLimits && (this.marketConfig = {
|
|
@@ -3775,21 +4042,27 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3775
4042
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(n), this.eventBus.emit("resize", e);
|
|
3776
4043
|
}
|
|
3777
4044
|
destroy() {
|
|
3778
|
-
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.container.innerHTML = "";
|
|
4045
|
+
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 = "";
|
|
3779
4046
|
}
|
|
3780
4047
|
createChartRenderer(e) {
|
|
3781
|
-
let t =
|
|
4048
|
+
let t = Cn(e, (e) => this.pluginManager.getChartType(e));
|
|
3782
4049
|
return t instanceof D && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
3783
4050
|
}
|
|
3784
4051
|
crosshairSeries() {
|
|
3785
4052
|
return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
|
|
3786
4053
|
}
|
|
3787
4054
|
getDisplayData() {
|
|
3788
|
-
|
|
3789
|
-
|
|
4055
|
+
let e = this.series.bars(), t = this.options.chartType === "rangeBars" ? bn(e, (e) => this.stepAt(e)) : void 0;
|
|
4056
|
+
if (this.displayDataCache && t === this.displayDataStep) return this.displayDataCache;
|
|
3790
4057
|
if (e.length === 0) return e;
|
|
3791
|
-
let
|
|
3792
|
-
return this.
|
|
4058
|
+
let n = this.displaySeries(e, t);
|
|
4059
|
+
return this.displayDataCache = n, this.displayDataStep = t, n;
|
|
4060
|
+
}
|
|
4061
|
+
displaySeries(e, t) {
|
|
4062
|
+
let n = this.options.chartType, r = (e) => this.pluginManager.getChartType(e);
|
|
4063
|
+
if (n !== "pointAndFigure" || r(n)) return wn(n, e, r, this.chartTypeOptions, t, this.reshapeMemo);
|
|
4064
|
+
let { columns: i, boxSize: a } = un(e, this.chartTypeOptions, this.reshapeMemo);
|
|
4065
|
+
return this.chartRenderer instanceof Ze && this.chartRenderer.setBoxSize(a), i;
|
|
3793
4066
|
}
|
|
3794
4067
|
recalcIndicatorsFrom(e, t) {
|
|
3795
4068
|
this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
|
|
@@ -3831,23 +4104,23 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3831
4104
|
this.panelInfoCache = null, this.fitDataAndAxes(), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
|
|
3832
4105
|
}
|
|
3833
4106
|
applyDataToViewport(e = !1) {
|
|
3834
|
-
let t = this.getDisplayData(), n = this.options.autoScale !== !1;
|
|
4107
|
+
let t = this.getDisplayData(), n = this.options.autoScale !== !1 || this.priceFitPending;
|
|
3835
4108
|
this.viewport.updateData(t, !1), e && (this.viewport.scrollToEnd(), this.viewport.updateData(t, !1));
|
|
3836
4109
|
let r = this.viewport.getState();
|
|
3837
4110
|
if (t.length > 0) {
|
|
3838
4111
|
let e = Math.max(0, Math.min(r.visibleRange.from, t.length - 1));
|
|
3839
4112
|
this.viewport.setScaleBaseline(t[e]?.close);
|
|
3840
4113
|
}
|
|
3841
|
-
return n && this.fitPriceScale(t,
|
|
4114
|
+
return n && this.fitPriceScale(t, this.viewport.getState()), t;
|
|
3842
4115
|
}
|
|
3843
4116
|
fitPriceScale(e, t) {
|
|
3844
4117
|
if (e.length === 0) return;
|
|
3845
|
-
let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i =
|
|
4118
|
+
let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i = kr(kr(m(e, n, r, 0), this.indicatorEngine.getOverlayPriceRange(n, r)), this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null), a = this.features.volume && this.volumeRenderer.isVisible() && Or(e, n, r) ? this.volumeRenderer.getHeightRatio() + hr : O;
|
|
3846
4119
|
this.viewport.setScaleMargins(this.viewport.isInvertScale() ? {
|
|
3847
4120
|
top: a,
|
|
3848
|
-
bottom:
|
|
4121
|
+
bottom: O
|
|
3849
4122
|
} : {
|
|
3850
|
-
top:
|
|
4123
|
+
top: O,
|
|
3851
4124
|
bottom: a
|
|
3852
4125
|
}), this.viewport.fitToPrices(i.min, i.max);
|
|
3853
4126
|
}
|
|
@@ -3857,14 +4130,19 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3857
4130
|
this.viewport.setChartRect(t.mainChartRect), this.fitDataAndAxes(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
|
|
3858
4131
|
}
|
|
3859
4132
|
fitDataAndAxes(e = !1) {
|
|
3860
|
-
this.applyDataToViewport(e);
|
|
3861
|
-
|
|
3862
|
-
|
|
4133
|
+
let t = this.applyDataToViewport(e), n = this.fitPriceAxisWidth();
|
|
4134
|
+
this.leftViewport = this.computeLeftViewport(), (this.fitLeftAxisWidth() || n) && this.applyDataToViewport(e), this.priceFitPending && this.priceFitDone(t) && (this.priceFitPending = !1);
|
|
4135
|
+
}
|
|
4136
|
+
priceFitDone(e) {
|
|
4137
|
+
let { chartRect: t, offset: n, barWidth: r, barSpacing: i } = this.viewport.getState();
|
|
4138
|
+
if (e.length === 0 || t.width <= 0) return !1;
|
|
4139
|
+
let a = n <= 0 && e.length * (r + i) - n <= t.width;
|
|
4140
|
+
return !(this.seriesArriving && a);
|
|
3863
4141
|
}
|
|
3864
4142
|
fitLeftAxisWidth() {
|
|
3865
4143
|
let e = this.leftViewport;
|
|
3866
4144
|
if (!e) return !1;
|
|
3867
|
-
let t = this.themeManager.getTheme(), n =
|
|
4145
|
+
let t = this.themeManager.getTheme(), n = Jn({
|
|
3868
4146
|
min: e.priceRange.min,
|
|
3869
4147
|
max: e.priceRange.max,
|
|
3870
4148
|
lastPrice: null,
|
|
@@ -3873,12 +4151,12 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3873
4151
|
fontFamily: t.font.family,
|
|
3874
4152
|
fontSizeSmall: t.font.sizeSmall,
|
|
3875
4153
|
measure: (e, t) => this.measureText(e, t)
|
|
3876
|
-
}), r =
|
|
4154
|
+
}), r = Yn(this.leftAxisWidth, n);
|
|
3877
4155
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
3878
4156
|
}
|
|
3879
4157
|
fitPriceAxisWidth() {
|
|
3880
4158
|
if (!this.features.priceAxis) return !1;
|
|
3881
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
4159
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = Jn({
|
|
3882
4160
|
min: e.min,
|
|
3883
4161
|
max: e.max,
|
|
3884
4162
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -3889,13 +4167,17 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3889
4167
|
fontFamily: t.font.family,
|
|
3890
4168
|
fontSizeSmall: t.font.sizeSmall,
|
|
3891
4169
|
measure: (e, t) => this.measureText(e, t)
|
|
3892
|
-
}), r =
|
|
4170
|
+
}), r = Yn(this.priceAxisWidth, n);
|
|
3893
4171
|
return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
3894
4172
|
}
|
|
3895
4173
|
measureText(e, t) {
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
4174
|
+
let n = this.engine.layerManager.getLayer(r.Main)?.ctx;
|
|
4175
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => wr(n, e, t));
|
|
4176
|
+
let i = n ?? this.detachedMeasureContext();
|
|
4177
|
+
return i ? wr(i, e, t) : e.length * 7;
|
|
4178
|
+
}
|
|
4179
|
+
detachedMeasureContext() {
|
|
4180
|
+
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
3899
4181
|
}
|
|
3900
4182
|
emitViewportEvents() {
|
|
3901
4183
|
let e = this.viewport.getState(), t = Math.max(0, Math.floor(e.visibleRange.from)), n = Math.max(t, Math.ceil(e.visibleRange.to));
|
|
@@ -3933,7 +4215,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3933
4215
|
buildPanelRenderInfos() {
|
|
3934
4216
|
if (this.panelInfoCache) return this.panelInfoCache;
|
|
3935
4217
|
let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
|
|
3936
|
-
let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...
|
|
4218
|
+
let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...lr }, o = {
|
|
3937
4219
|
x: e.rect.x,
|
|
3938
4220
|
y: e.rect.y + 20,
|
|
3939
4221
|
width: e.rect.width,
|
|
@@ -3952,6 +4234,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3952
4234
|
scaleMode: e.config.percentScale ? "percentage" : "regular",
|
|
3953
4235
|
scaleBaseline: e.config.percentScale ? this.paneBaseline(e.config.id, n, r) : void 0,
|
|
3954
4236
|
formatPrice: void 0,
|
|
4237
|
+
pricePrecision: void 0,
|
|
3955
4238
|
priceUnit: void 0,
|
|
3956
4239
|
invertScale: !!e.config.invertScale
|
|
3957
4240
|
}
|
|
@@ -3991,7 +4274,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
3991
4274
|
barCountdown: this.barCountdown,
|
|
3992
4275
|
sessionBreaks: this.sessionBreaks,
|
|
3993
4276
|
sessionShading: this.sessionShading,
|
|
3994
|
-
compareRenderer: this.compareRenderer,
|
|
4277
|
+
compareRenderer: this.comparesDrawn() ? this.compareRenderer : null,
|
|
3995
4278
|
alertManager: this.features.alerts ? this.alertManager : null,
|
|
3996
4279
|
measureOverlay: this.measureOverlay,
|
|
3997
4280
|
selectionBoxOverlay: this.selectionBoxOverlay,
|
|
@@ -4007,6 +4290,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
4007
4290
|
},
|
|
4008
4291
|
theme: this.themeManager.getTheme(),
|
|
4009
4292
|
data: n,
|
|
4293
|
+
seriesRevision: this.series.revision(),
|
|
4010
4294
|
numberLocale: this.numberLocale,
|
|
4011
4295
|
paneTitles: this.paneTitles,
|
|
4012
4296
|
indicatorValueLabels: this.features.indicatorValueLabels,
|
|
@@ -4015,7 +4299,7 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
4015
4299
|
});
|
|
4016
4300
|
}
|
|
4017
4301
|
drawOverlayPlugins(e, t) {
|
|
4018
|
-
let n =
|
|
4302
|
+
let n = er(this.pluginManager.getOverlays(), t);
|
|
4019
4303
|
if (n.length === 0) return;
|
|
4020
4304
|
let r = {
|
|
4021
4305
|
viewport: this.viewport.getState(),
|
|
@@ -4036,11 +4320,11 @@ var Wn = .08, Gn = a ** -7, Kn = 800, qn = 20, Jn = 8, Yn = new Set(["horizontal
|
|
|
4036
4320
|
};
|
|
4037
4321
|
}
|
|
4038
4322
|
};
|
|
4039
|
-
function
|
|
4323
|
+
function Sr(e) {
|
|
4040
4324
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
4041
4325
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
4042
4326
|
i.add(e.instanceId);
|
|
4043
|
-
let o = [e.pane, ...Object.values(e.params).map((e) =>
|
|
4327
|
+
let o = [e.pane, ...Object.values(e.params).map((e) => b(e)?.instanceId)];
|
|
4044
4328
|
for (let e of o) {
|
|
4045
4329
|
let n = e ? t.get(e) : void 0;
|
|
4046
4330
|
n && a(n);
|
|
@@ -4050,13 +4334,19 @@ function Qn(e) {
|
|
|
4050
4334
|
for (let t of e) a(t);
|
|
4051
4335
|
return n;
|
|
4052
4336
|
}
|
|
4053
|
-
function
|
|
4337
|
+
function Cr(e, t) {
|
|
4054
4338
|
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);
|
|
4055
4339
|
}
|
|
4056
|
-
|
|
4057
|
-
|
|
4340
|
+
function wr(e, t, n) {
|
|
4341
|
+
let r = e.font;
|
|
4342
|
+
e.font = n;
|
|
4343
|
+
let i = e.measureText(t).width;
|
|
4344
|
+
return e.font = r, i;
|
|
4345
|
+
}
|
|
4346
|
+
var Tr = 300;
|
|
4347
|
+
function Er(e) {
|
|
4058
4348
|
let t = {}, n = e.family;
|
|
4059
|
-
typeof n == "string" && n.trim() !== "" && n.length <=
|
|
4349
|
+
typeof n == "string" && n.trim() !== "" && n.length <= Tr && !/[;{}<>\\]|\/\*/.test(n) && (t.family = n);
|
|
4060
4350
|
for (let n of [
|
|
4061
4351
|
"sizeSmall",
|
|
4062
4352
|
"sizeMedium",
|
|
@@ -4067,15 +4357,15 @@ function tr(e) {
|
|
|
4067
4357
|
}
|
|
4068
4358
|
return t;
|
|
4069
4359
|
}
|
|
4070
|
-
function
|
|
4360
|
+
function Dr(e) {
|
|
4071
4361
|
let t = e.tagRadius;
|
|
4072
4362
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
4073
4363
|
}
|
|
4074
|
-
function
|
|
4364
|
+
function Or(e, t, n) {
|
|
4075
4365
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
4076
4366
|
return !1;
|
|
4077
4367
|
}
|
|
4078
|
-
function
|
|
4368
|
+
function kr(e, t) {
|
|
4079
4369
|
return e ? t ? {
|
|
4080
4370
|
min: Math.min(e.min, t.min),
|
|
4081
4371
|
max: Math.max(e.max, t.max)
|
|
@@ -4096,8 +4386,8 @@ function K(e) {
|
|
|
4096
4386
|
bars: e.bars
|
|
4097
4387
|
};
|
|
4098
4388
|
}
|
|
4099
|
-
var
|
|
4100
|
-
function
|
|
4389
|
+
var Ar = 500;
|
|
4390
|
+
function jr(e, t) {
|
|
4101
4391
|
let n = 0, r = e.length;
|
|
4102
4392
|
for (; n < r;) {
|
|
4103
4393
|
let i = n + r >> 1;
|
|
@@ -4105,7 +4395,7 @@ function or(e, t) {
|
|
|
4105
4395
|
}
|
|
4106
4396
|
return n;
|
|
4107
4397
|
}
|
|
4108
|
-
function
|
|
4398
|
+
function Mr(e, t) {
|
|
4109
4399
|
let n = 0, r = e.length;
|
|
4110
4400
|
for (; n < r;) {
|
|
4111
4401
|
let i = n + r >> 1;
|
|
@@ -4113,20 +4403,20 @@ function sr(e, t) {
|
|
|
4113
4403
|
}
|
|
4114
4404
|
return n;
|
|
4115
4405
|
}
|
|
4116
|
-
function
|
|
4406
|
+
function Nr(e) {
|
|
4117
4407
|
let t = 0, n = 0;
|
|
4118
4408
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
4119
4409
|
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];
|
|
4120
4410
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
4121
4411
|
}
|
|
4122
|
-
function
|
|
4412
|
+
function Pr(e) {
|
|
4123
4413
|
let t = 0;
|
|
4124
4414
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
4125
4415
|
return t > 0 ? t : Infinity;
|
|
4126
4416
|
}
|
|
4127
|
-
function
|
|
4417
|
+
function Fr(e, t) {
|
|
4128
4418
|
if (t.length === 0) return null;
|
|
4129
|
-
let n = t[t.length - 1].time +
|
|
4419
|
+
let n = t[t.length - 1].time + Pr(t), r = e.filter((e) => jn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
4130
4420
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
4131
4421
|
if (i.length === 0) return null;
|
|
4132
4422
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -4134,7 +4424,7 @@ function ur(e, t) {
|
|
|
4134
4424
|
let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
|
|
4135
4425
|
return [...o, ...s];
|
|
4136
4426
|
}
|
|
4137
|
-
function
|
|
4427
|
+
function Ir(e, t) {
|
|
4138
4428
|
let n = 0, r = e.length - 1;
|
|
4139
4429
|
for (; n < r;) {
|
|
4140
4430
|
let i = n + r + 1 >> 1;
|
|
@@ -4142,22 +4432,22 @@ function dr(e, t) {
|
|
|
4142
4432
|
}
|
|
4143
4433
|
return n;
|
|
4144
4434
|
}
|
|
4145
|
-
function
|
|
4435
|
+
function Lr(e, t, n) {
|
|
4146
4436
|
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;
|
|
4147
4437
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
4148
4438
|
return Math.max(0, a);
|
|
4149
4439
|
}
|
|
4150
|
-
function
|
|
4440
|
+
function Rr(e, t, n) {
|
|
4151
4441
|
let r = n;
|
|
4152
4442
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
4153
4443
|
let i = {
|
|
4154
4444
|
...t[r],
|
|
4155
4445
|
time: e.time
|
|
4156
4446
|
};
|
|
4157
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
4447
|
+
for (let e = r + 1; e <= n; e++) i = zr(i, t[e]);
|
|
4158
4448
|
return i;
|
|
4159
4449
|
}
|
|
4160
|
-
function
|
|
4450
|
+
function zr(e, t) {
|
|
4161
4451
|
return {
|
|
4162
4452
|
time: e.time,
|
|
4163
4453
|
open: e.open,
|
|
@@ -4169,26 +4459,26 @@ function mr(e, t) {
|
|
|
4169
4459
|
}
|
|
4170
4460
|
//#endregion
|
|
4171
4461
|
//#region src/io/parseOHLCV.ts
|
|
4172
|
-
var
|
|
4462
|
+
var Br = [
|
|
4173
4463
|
"time",
|
|
4174
4464
|
"timestamp",
|
|
4175
4465
|
"date",
|
|
4176
4466
|
"datetime",
|
|
4177
4467
|
"t"
|
|
4178
|
-
],
|
|
4468
|
+
], Vr = ["open", "o"], Hr = ["high", "h"], Ur = ["low", "l"], Wr = ["close", "c"], Gr = [
|
|
4179
4469
|
"volume",
|
|
4180
4470
|
"vol",
|
|
4181
4471
|
"v"
|
|
4182
4472
|
];
|
|
4183
4473
|
function q(e) {
|
|
4184
4474
|
let t = e.trim();
|
|
4185
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
4475
|
+
return t ? t[0] === "[" || t[0] === "{" ? Kr(t) : qr(t) : {
|
|
4186
4476
|
data: [],
|
|
4187
4477
|
rowCount: 0,
|
|
4188
4478
|
skipped: 0
|
|
4189
4479
|
};
|
|
4190
4480
|
}
|
|
4191
|
-
function
|
|
4481
|
+
function Kr(e) {
|
|
4192
4482
|
let t;
|
|
4193
4483
|
try {
|
|
4194
4484
|
t = JSON.parse(e);
|
|
@@ -4198,19 +4488,19 @@ function xr(e) {
|
|
|
4198
4488
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
4199
4489
|
let n = [], r = 0;
|
|
4200
4490
|
for (let e of t) {
|
|
4201
|
-
let t = Array.isArray(e) ?
|
|
4491
|
+
let t = Array.isArray(e) ? Qr(e) : Zr(e);
|
|
4202
4492
|
t ? n.push(t) : r++;
|
|
4203
4493
|
}
|
|
4204
|
-
return
|
|
4494
|
+
return $r(n, t.length, r);
|
|
4205
4495
|
}
|
|
4206
|
-
function
|
|
4496
|
+
function qr(e) {
|
|
4207
4497
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
4208
4498
|
if (t.length === 0) return {
|
|
4209
4499
|
data: [],
|
|
4210
4500
|
rowCount: 0,
|
|
4211
4501
|
skipped: 0
|
|
4212
4502
|
};
|
|
4213
|
-
let n =
|
|
4503
|
+
let n = Jr(t[0]), r = Yr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? Xr(r) : {
|
|
4214
4504
|
time: 0,
|
|
4215
4505
|
open: 1,
|
|
4216
4506
|
high: 2,
|
|
@@ -4221,7 +4511,7 @@ function Sr(e) {
|
|
|
4221
4511
|
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");
|
|
4222
4512
|
let o = [], s = 0;
|
|
4223
4513
|
for (let e = +!!i; e < t.length; e++) {
|
|
4224
|
-
let r =
|
|
4514
|
+
let r = Yr(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
4225
4515
|
if (i === null || ![
|
|
4226
4516
|
c,
|
|
4227
4517
|
l,
|
|
@@ -4240,9 +4530,9 @@ function Sr(e) {
|
|
|
4240
4530
|
volume: Number.isFinite(f) ? f : 0
|
|
4241
4531
|
});
|
|
4242
4532
|
}
|
|
4243
|
-
return
|
|
4533
|
+
return $r(o, t.length - +!!i, s);
|
|
4244
4534
|
}
|
|
4245
|
-
function
|
|
4535
|
+
function Jr(e) {
|
|
4246
4536
|
let t = {
|
|
4247
4537
|
",": 0,
|
|
4248
4538
|
";": 0,
|
|
@@ -4254,7 +4544,7 @@ function Cr(e) {
|
|
|
4254
4544
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
4255
4545
|
return n;
|
|
4256
4546
|
}
|
|
4257
|
-
function
|
|
4547
|
+
function Yr(e, t) {
|
|
4258
4548
|
let n = [], r = "", i = !1;
|
|
4259
4549
|
for (let a = 0; a < e.length; a++) {
|
|
4260
4550
|
let o = e[a];
|
|
@@ -4262,25 +4552,25 @@ function wr(e, t) {
|
|
|
4262
4552
|
}
|
|
4263
4553
|
return n.push(r), n;
|
|
4264
4554
|
}
|
|
4265
|
-
function
|
|
4555
|
+
function Xr(e) {
|
|
4266
4556
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
4267
4557
|
return {
|
|
4268
|
-
time: t(
|
|
4269
|
-
open: t(
|
|
4270
|
-
high: t(
|
|
4271
|
-
low: t(
|
|
4272
|
-
close: t(
|
|
4273
|
-
volume: t(
|
|
4558
|
+
time: t(Br),
|
|
4559
|
+
open: t(Vr),
|
|
4560
|
+
high: t(Hr),
|
|
4561
|
+
low: t(Ur),
|
|
4562
|
+
close: t(Wr),
|
|
4563
|
+
volume: t(Gr)
|
|
4274
4564
|
};
|
|
4275
4565
|
}
|
|
4276
|
-
function
|
|
4566
|
+
function Zr(e) {
|
|
4277
4567
|
let t = (t) => {
|
|
4278
4568
|
for (let n of t) {
|
|
4279
4569
|
if (e[n] !== void 0) return e[n];
|
|
4280
4570
|
let t = n.toUpperCase();
|
|
4281
4571
|
if (e[t] !== void 0) return e[t];
|
|
4282
4572
|
}
|
|
4283
|
-
}, n = Y(String(t(
|
|
4573
|
+
}, n = Y(String(t(Br) ?? "")), r = Number(t(Vr)), i = Number(t(Hr)), a = Number(t(Ur)), o = Number(t(Wr)), s = Number(t(Gr) ?? 0);
|
|
4284
4574
|
return n === null || ![
|
|
4285
4575
|
r,
|
|
4286
4576
|
i,
|
|
@@ -4295,7 +4585,7 @@ function Er(e) {
|
|
|
4295
4585
|
volume: Number.isFinite(s) ? s : 0
|
|
4296
4586
|
};
|
|
4297
4587
|
}
|
|
4298
|
-
function
|
|
4588
|
+
function Qr(e) {
|
|
4299
4589
|
if (e.length < 5) return null;
|
|
4300
4590
|
let t = Y(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;
|
|
4301
4591
|
return t === null || ![
|
|
@@ -4319,11 +4609,11 @@ function Y(e) {
|
|
|
4319
4609
|
let t = e.trim();
|
|
4320
4610
|
if (!t) return null;
|
|
4321
4611
|
let n = Number(t);
|
|
4322
|
-
if (Number.isFinite(n) && n > 0) return
|
|
4612
|
+
if (Number.isFinite(n) && n > 0) return y(n);
|
|
4323
4613
|
let r = Date.parse(t);
|
|
4324
4614
|
return Number.isFinite(r) ? r : null;
|
|
4325
4615
|
}
|
|
4326
|
-
function
|
|
4616
|
+
function $r(e, t, n) {
|
|
4327
4617
|
e.sort((e, t) => e.time - t.time);
|
|
4328
4618
|
let r = [];
|
|
4329
4619
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -4335,7 +4625,7 @@ function Or(e, t, n) {
|
|
|
4335
4625
|
}
|
|
4336
4626
|
//#endregion
|
|
4337
4627
|
//#region src/io/DragDropImporter.ts
|
|
4338
|
-
var
|
|
4628
|
+
var ei = class {
|
|
4339
4629
|
host;
|
|
4340
4630
|
overlay = null;
|
|
4341
4631
|
callbacks;
|
|
@@ -4412,7 +4702,7 @@ function Z(e) {
|
|
|
4412
4702
|
};
|
|
4413
4703
|
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;
|
|
4414
4704
|
}
|
|
4415
|
-
var
|
|
4705
|
+
var ti = (e, t) => t.updatedAt - e.updatedAt;
|
|
4416
4706
|
function Q(e) {
|
|
4417
4707
|
if (typeof e != "object" || !e) return null;
|
|
4418
4708
|
let t = e;
|
|
@@ -4425,17 +4715,17 @@ function Q(e) {
|
|
|
4425
4715
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
4426
4716
|
});
|
|
4427
4717
|
}
|
|
4428
|
-
function
|
|
4718
|
+
function ni(e) {
|
|
4429
4719
|
let t = Q(e), n = t ? e.content : void 0;
|
|
4430
4720
|
return t && typeof n == "string" ? {
|
|
4431
4721
|
...t,
|
|
4432
4722
|
content: n
|
|
4433
4723
|
} : null;
|
|
4434
4724
|
}
|
|
4435
|
-
function
|
|
4725
|
+
function ri(e = []) {
|
|
4436
4726
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
4437
4727
|
return {
|
|
4438
|
-
list: () => [...t.values()].map(Z).sort(
|
|
4728
|
+
list: () => [...t.values()].map(Z).sort(ti),
|
|
4439
4729
|
load: (e) => {
|
|
4440
4730
|
let n = t.get(e);
|
|
4441
4731
|
return n ? { ...n } : null;
|
|
@@ -4448,7 +4738,7 @@ function Mr(e = []) {
|
|
|
4448
4738
|
}
|
|
4449
4739
|
};
|
|
4450
4740
|
}
|
|
4451
|
-
function
|
|
4741
|
+
function ii(e = "tcw:layouts:") {
|
|
4452
4742
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
4453
4743
|
let e;
|
|
4454
4744
|
try {
|
|
@@ -4459,7 +4749,7 @@ function Nr(e = "tcw:layouts:") {
|
|
|
4459
4749
|
return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
|
|
4460
4750
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
4461
4751
|
return {
|
|
4462
|
-
list: () => r().sort(
|
|
4752
|
+
list: () => r().sort(ti),
|
|
4463
4753
|
load: (e) => {
|
|
4464
4754
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
4465
4755
|
return t && i !== null ? {
|
|
@@ -4477,14 +4767,14 @@ function Nr(e = "tcw:layouts:") {
|
|
|
4477
4767
|
}
|
|
4478
4768
|
//#endregion
|
|
4479
4769
|
//#region src/state/LayoutSession.ts
|
|
4480
|
-
var
|
|
4770
|
+
var ai = 80;
|
|
4481
4771
|
function $(e) {
|
|
4482
4772
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
4483
4773
|
}
|
|
4484
|
-
function
|
|
4774
|
+
function oi() {
|
|
4485
4775
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
4486
4776
|
}
|
|
4487
|
-
function
|
|
4777
|
+
function si(e) {
|
|
4488
4778
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
4489
4779
|
return {
|
|
4490
4780
|
id: t,
|
|
@@ -4495,7 +4785,7 @@ function Ir(e) {
|
|
|
4495
4785
|
...o === void 0 ? {} : { kind: o }
|
|
4496
4786
|
};
|
|
4497
4787
|
}
|
|
4498
|
-
var
|
|
4788
|
+
var ci = class {
|
|
4499
4789
|
currentLayout = null;
|
|
4500
4790
|
savedContent = null;
|
|
4501
4791
|
dirty = !1;
|
|
@@ -4511,7 +4801,7 @@ var Lr = class {
|
|
|
4511
4801
|
now;
|
|
4512
4802
|
newId;
|
|
4513
4803
|
constructor(e, t, n = {}) {
|
|
4514
|
-
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 ??
|
|
4804
|
+
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 ?? oi;
|
|
4515
4805
|
}
|
|
4516
4806
|
current() {
|
|
4517
4807
|
return this.currentLayout;
|
|
@@ -4541,7 +4831,7 @@ var Lr = class {
|
|
|
4541
4831
|
}
|
|
4542
4832
|
open(e) {
|
|
4543
4833
|
return this.queue(async () => {
|
|
4544
|
-
let t =
|
|
4834
|
+
let t = ni(await this.storage.load(e));
|
|
4545
4835
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
4546
4836
|
this.cancelTimer(), this.applying++;
|
|
4547
4837
|
try {
|
|
@@ -4551,13 +4841,13 @@ var Lr = class {
|
|
|
4551
4841
|
} finally {
|
|
4552
4842
|
this.applying--;
|
|
4553
4843
|
}
|
|
4554
|
-
return this.cancelTimer(), this.currentLayout =
|
|
4844
|
+
return this.cancelTimer(), this.currentLayout = si(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
4555
4845
|
});
|
|
4556
4846
|
}
|
|
4557
4847
|
rename(e, t) {
|
|
4558
4848
|
let n = $(t);
|
|
4559
4849
|
return n ? this.queue(async () => {
|
|
4560
|
-
let t =
|
|
4850
|
+
let t = ni(await this.storage.load(e));
|
|
4561
4851
|
!t || t.id !== e || (await this.storage.save({
|
|
4562
4852
|
...t,
|
|
4563
4853
|
name: n
|
|
@@ -4635,7 +4925,7 @@ var Lr = class {
|
|
|
4635
4925
|
content: n.content
|
|
4636
4926
|
};
|
|
4637
4927
|
await this.storage.save(r);
|
|
4638
|
-
let i =
|
|
4928
|
+
let i = si(r);
|
|
4639
4929
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
4640
4930
|
}
|
|
4641
4931
|
forget() {
|
|
@@ -4656,6 +4946,6 @@ var Lr = class {
|
|
|
4656
4946
|
}
|
|
4657
4947
|
};
|
|
4658
4948
|
//#endregion
|
|
4659
|
-
export {
|
|
4949
|
+
export { B as C, on as E, Nn as S, z as T, er as _, ri as a, Rn as b, xr as c, ar as d, ir as f, $n as g, nr as h, ii as i, dr as l, tr as m, ai as n, ei as o, rr as p, $ as r, q as s, ci as t, ur as u, W as v, L as w, Fn as x, Un as y };
|
|
4660
4950
|
|
|
4661
|
-
//# sourceMappingURL=LayoutSession-
|
|
4951
|
+
//# sourceMappingURL=LayoutSession-4SLt8-0u.js.map
|