@tradecanvas/chart 1.71.0 → 1.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LayoutSession-DO4bYkUi.cjs +2 -0
- package/dist/LayoutSession-DO4bYkUi.cjs.map +1 -0
- package/dist/{LayoutSession-BOQCN6yY.js → LayoutSession-qRYG8GTD.js} +539 -552
- package/dist/LayoutSession-qRYG8GTD.js.map +1 -0
- package/dist/WidgetCommandPalette-CeCLHPy1.js +177 -0
- package/dist/WidgetCommandPalette-CeCLHPy1.js.map +1 -0
- package/dist/WidgetCommandPalette-ZZNbWwCZ.cjs +2 -0
- package/dist/WidgetCommandPalette-ZZNbWwCZ.cjs.map +1 -0
- package/dist/WidgetDrawingSettings-BeW8fX7r.js +474 -0
- package/dist/WidgetDrawingSettings-BeW8fX7r.js.map +1 -0
- package/dist/WidgetDrawingSettings-Cyl2u_u8.cjs +2 -0
- package/dist/WidgetDrawingSettings-Cyl2u_u8.cjs.map +1 -0
- package/dist/WidgetGoToDate-BNdngHlg.cjs +2 -0
- package/dist/WidgetGoToDate-BNdngHlg.cjs.map +1 -0
- package/dist/WidgetGoToDate-hcDtezRm.js +191 -0
- package/dist/WidgetGoToDate-hcDtezRm.js.map +1 -0
- package/dist/WidgetHotkeySheet-1lRFSdvt.js +416 -0
- package/dist/WidgetHotkeySheet-1lRFSdvt.js.map +1 -0
- package/dist/WidgetHotkeySheet-y5LWKSG6.cjs +2 -0
- package/dist/WidgetHotkeySheet-y5LWKSG6.cjs.map +1 -0
- package/dist/WidgetIndicatorPicker-CGvZ5kYd.js +245 -0
- package/dist/WidgetIndicatorPicker-CGvZ5kYd.js.map +1 -0
- package/dist/WidgetIndicatorPicker-DuKJFPRC.cjs +2 -0
- package/dist/WidgetIndicatorPicker-DuKJFPRC.cjs.map +1 -0
- package/dist/WidgetIndicatorSettings-C7vpco6e.cjs +2 -0
- package/dist/WidgetIndicatorSettings-C7vpco6e.cjs.map +1 -0
- package/dist/WidgetIndicatorSettings-dDkqzzYo.js +326 -0
- package/dist/WidgetIndicatorSettings-dDkqzzYo.js.map +1 -0
- package/dist/WidgetSettings-D7Pq42zW.cjs +2 -0
- package/dist/WidgetSettings-D7Pq42zW.cjs.map +1 -0
- package/dist/WidgetSettings-eOo93L7Z.js +546 -0
- package/dist/WidgetSettings-eOo93L7Z.js.map +1 -0
- package/dist/WidgetSymbolSearch-C4OR42nZ.cjs +2 -0
- package/dist/WidgetSymbolSearch-C4OR42nZ.cjs.map +1 -0
- package/dist/WidgetSymbolSearch-CvPpjIwa.js +580 -0
- package/dist/WidgetSymbolSearch-CvPpjIwa.js.map +1 -0
- package/dist/focusTrap-Br9Zfje0.js +27 -0
- package/dist/focusTrap-Br9Zfje0.js.map +1 -0
- package/dist/focusTrap-DrhhmG0V.cjs +2 -0
- package/dist/focusTrap-DrhhmG0V.cjs.map +1 -0
- package/dist/i18n-C2nQBZTY.cjs +2 -0
- package/dist/i18n-C2nQBZTY.cjs.map +1 -0
- package/dist/{i18n-DUmd4Z_r.js → i18n-C5v6Tzp1.js} +3 -1
- package/dist/i18n-C5v6Tzp1.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/indicatorInputWords-Bd9Pt6qp.js +25 -0
- package/dist/indicatorInputWords-Bd9Pt6qp.js.map +1 -0
- package/dist/indicatorInputWords-CTA4IcJR.cjs +2 -0
- package/dist/indicatorInputWords-CTA4IcJR.cjs.map +1 -0
- package/dist/indicatorLabel-BNZvaOcl.cjs +2 -0
- package/dist/indicatorLabel-BNZvaOcl.cjs.map +1 -0
- package/dist/indicatorLabel-Sbegyhp2.js +17 -0
- package/dist/indicatorLabel-Sbegyhp2.js.map +1 -0
- package/dist/indicatorSettingsTabs-B0liE3ST.cjs +2 -0
- package/dist/indicatorSettingsTabs-B0liE3ST.cjs.map +1 -0
- package/dist/indicatorSettingsTabs-XcgMdbLp.js +161 -0
- package/dist/indicatorSettingsTabs-XcgMdbLp.js.map +1 -0
- package/dist/monthView-B-CieFDJ.cjs +2 -0
- package/dist/monthView-B-CieFDJ.cjs.map +1 -0
- package/dist/monthView-N8yDaTqZ.js +198 -0
- package/dist/monthView-N8yDaTqZ.js.map +1 -0
- package/dist/platformKeys-B82-j1Fs.cjs +2 -0
- package/dist/platformKeys-B82-j1Fs.cjs.map +1 -0
- package/dist/platformKeys-Dd1qOCjF.js +5 -0
- package/dist/platformKeys-Dd1qOCjF.js.map +1 -0
- package/dist/settingsControls-DIjzCFHI.js +379 -0
- package/dist/settingsControls-DIjzCFHI.js.map +1 -0
- package/dist/settingsControls-Tn8_vJJv.cjs +2 -0
- package/dist/settingsControls-Tn8_vJJv.cjs.map +1 -0
- package/dist/symbolCatalog-CA1fpz3s.js +90 -0
- package/dist/symbolCatalog-CA1fpz3s.js.map +1 -0
- package/dist/symbolCatalog-Dx1YnZgm.cjs +2 -0
- package/dist/symbolCatalog-Dx1YnZgm.cjs.map +1 -0
- package/dist/widget/ChartWidget.d.ts +102 -582
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetAlerts.d.ts +35 -0
- package/dist/widget/WidgetAlerts.d.ts.map +1 -0
- package/dist/widget/WidgetChartSettings.d.ts +194 -0
- package/dist/widget/WidgetChartSettings.d.ts.map +1 -0
- package/dist/widget/WidgetCommands.d.ts +54 -0
- package/dist/widget/WidgetCommands.d.ts.map +1 -0
- package/dist/widget/WidgetCompares.d.ts +140 -0
- package/dist/widget/WidgetCompares.d.ts.map +1 -0
- package/dist/widget/WidgetDockArea.d.ts +89 -0
- package/dist/widget/WidgetDockArea.d.ts.map +1 -0
- package/dist/widget/WidgetDrawingEdit.d.ts +73 -0
- package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -0
- package/dist/widget/WidgetGoToDate.d.ts +1 -14
- package/dist/widget/WidgetGoToDate.d.ts.map +1 -1
- package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -1
- package/dist/widget/WidgetIntervals.d.ts +66 -0
- package/dist/widget/WidgetIntervals.d.ts.map +1 -0
- package/dist/widget/WidgetLayouts.d.ts +85 -0
- package/dist/widget/WidgetLayouts.d.ts.map +1 -0
- package/dist/widget/WidgetLegendView.d.ts +54 -0
- package/dist/widget/WidgetLegendView.d.ts.map +1 -0
- package/dist/widget/WidgetMenus.d.ts +79 -0
- package/dist/widget/WidgetMenus.d.ts.map +1 -0
- package/dist/widget/WidgetReplay.d.ts +199 -0
- package/dist/widget/WidgetReplay.d.ts.map +1 -0
- package/dist/widget/WidgetTrading.d.ts +48 -0
- package/dist/widget/WidgetTrading.d.ts.map +1 -0
- package/dist/widget/WidgetWatchlists.d.ts +77 -0
- package/dist/widget/WidgetWatchlists.d.ts.map +1 -0
- package/dist/widget/drawingSettingsTabs.d.ts +2 -19
- package/dist/widget/drawingSettingsTabs.d.ts.map +1 -1
- package/dist/widget/drawingText.d.ts +24 -0
- package/dist/widget/drawingText.d.ts.map +1 -0
- package/dist/widget/index.cjs +22 -23
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +6193 -9868
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/keyTarget.d.ts +4 -0
- package/dist/widget/keyTarget.d.ts.map +1 -1
- package/dist/widget/lazyPart.d.ts +47 -0
- package/dist/widget/lazyPart.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 +1 -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 +29 -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/pageEnv.d.ts +5 -0
- package/dist/widget/pageEnv.d.ts.map +1 -0
- package/dist/widget/signals.d.ts +41 -0
- package/dist/widget/signals.d.ts.map +1 -0
- package/dist/widget/wallTime.d.ts +15 -0
- package/dist/widget/wallTime.d.ts.map +1 -0
- package/dist/widget/widgetDialogs.d.ts +17 -0
- package/dist/widget/widgetDialogs.d.ts.map +1 -0
- package/dist/widgetFeatures-BM6u0u74.js +186 -0
- package/dist/widgetFeatures-BM6u0u74.js.map +1 -0
- package/dist/widgetFeatures-BZ8OVPN2.cjs +3 -0
- package/dist/widgetFeatures-BZ8OVPN2.cjs.map +1 -0
- package/dist/widgetLocales-BPK5i0Ok.cjs +2 -0
- package/dist/widgetLocales-BPK5i0Ok.cjs.map +1 -0
- package/dist/widgetLocales-DgTR8JSu.js +838 -0
- package/dist/widgetLocales-DgTR8JSu.js.map +1 -0
- package/package.json +3 -3
- package/dist/LayoutSession-BOQCN6yY.js.map +0 -1
- package/dist/LayoutSession-RF8OqOXy.cjs +0 -2
- package/dist/LayoutSession-RF8OqOXy.cjs.map +0 -1
- package/dist/i18n-BsstZ9md.cjs +0 -2
- package/dist/i18n-BsstZ9md.cjs.map +0 -1
- package/dist/i18n-DUmd4Z_r.js.map +0 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as e } from "./indicatorLabel-Sbegyhp2.js";
|
|
2
|
+
import { DARK_THEME as t, DEFAULT_PANEL_HEIGHT as n, LIGHT_THEME as r, LayerType as i, MIN_PANEL_HEIGHT as a, PHI as o, PRICE_AXIS_WIDTH as s, TIME_AXIS_HEIGHT as c, autoPricePrecision as l, barDateZone as u, barTimeUnit as d, barsAreDaily as f, chartStyleValue as p, computePriceLimits as m, computePriceRange as h, createMarketTheme as g, formatPrice as _, fractionTick as v, indicatorSource as y, isValidTimeZone as b, mergeBar as ee, niceNumber as te, normalizeBarTime as x, parseIndicatorSource as S, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as ae, readIndicatorPlotStyles as oe, readPaneStyle as se, resolveChartTheme as ce, sessionMinute as C, setLocale as le, stepDecimals as ue, symbolTimeZone as w, tickBarCount as de, timeframeToMs as T, zonedDateFormatter as fe } from "@tradecanvas/commons";
|
|
3
|
+
import { AlertDragHandler as pe, AlertManager as me, Animator as he, AreaRenderer as ge, AxisDragHandler as _e, BarCountdown as ve, BarRenderer as ye, BaselineRenderer as be, CandlestickRenderer as xe, ChartLegend as Se, ChartStateManager as E, CompareRenderer as Ce, CompareSymbolIndicator as we, CompareSymbolPaneIndicator as Te, CorrelationCoefficientIndicator as Ee, CorrelationLogIndicator as De, CrosshairHandler as Oe, CrosshairTooltip as ke, CurrentPriceLine as Ae, DEFAULT_SESSION_HOURS as je, DataExporter as D, DepthHeatmapRenderer as Me, DrawingManager as Ne, DrawingRenderer as Pe, EquivolumeRenderer as Fe, EventBus as Ie, GridRenderer as Le, HLCAreaRenderer as Re, HiLoRenderer as ze, HollowCandleRenderer as Be, IndicatorEngine as Ve, InteractionManager as He, KagiRenderer as Ue, KeyboardHandler as We, LineRenderer as Ge, LineWithMarkersRenderer as Ke, MarketProfileRenderer as qe, MeasureOverlay as Je, PRICE_AXIS_ADD_STRIP as Ye, PRICE_SCALE_MARGIN as O, PanHandler as Xe, PaneResizeHandler as Ze, PeriodLevelsRenderer as Qe, PinnedTooltip as $e, PivotMarkersRenderer as et, PointAndFigureRenderer as tt, PriceAxis as nt, PriceAxisAddButton as rt, PriceLines as it, RenderEngine as at, RenkoRenderer as ot, ReplayManager as st, ResamplingAdapter as ct, ReshapeMemo as lt, SYMBOL_INDICATOR_IDS as ut, SYMBOL_ZONE_WAIT_MS as dt, Screenshot as k, SelectionBoxOverlay as ft, SessionBreaks as pt, SessionShading as mt, SignalMarkerManager as ht, SpreadIndicator as gt, StepLineRenderer as _t, StreamManager as vt, SymbolSeriesStore as yt, TimeAxis as bt, TradeZoneManager as xt, TradingManager as St, TradingRenderer as Ct, UndoRedoManager as wt, Viewport as Tt, VolumeCandleRenderer as Et, VolumeProfileRenderer as Dt, VolumeRenderer as Ot, Watermark as kt, ZoomHandler as At, axisTimes as A, barTimeStepMs as jt, findDominantSwing as Mt, gpuContextsLeft as Nt, isPriceLevelAlert as Pt, isRegularSession as Ft, loadWebGL as It, mergeSessionHours as Lt, pointAndFigureColumns as Rt, rangePresetStart as zt, readAlertOptions as Bt, registerBuiltInDrawingTools as Vt, registerBuiltInIndicators as Ht, servesTimeframe as j, sourceParam as M, streamAdapterOf as Ut, timestampToBarIndex as N, toHeikinAshi as Wt, toKagi as Gt, toLineBreak as Kt, toRangeBars as qt, toRenko as Jt, whenGpuContextFree as Yt, withResampling as P, xToBarIndex as Xt, xToTime as F, yToPrice as Zt } from "@tradecanvas/core";
|
|
3
4
|
//#region src/regularHours.ts
|
|
4
5
|
var Qt = 864e5, $t = 10;
|
|
5
6
|
function en(e, t) {
|
|
6
|
-
let n =
|
|
7
|
-
if (!n || !
|
|
7
|
+
let n = w(e);
|
|
8
|
+
if (!n || !b(n) || t.length < 2) return null;
|
|
8
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
9
|
-
let t =
|
|
10
|
+
let t = C(e.start), n = C(e.end);
|
|
10
11
|
return t === null || n === null ? [] : [{
|
|
11
12
|
startMinute: t,
|
|
12
13
|
endMinute: n
|
|
13
14
|
}];
|
|
14
15
|
});
|
|
15
16
|
if (r.length === 0) return null;
|
|
16
|
-
let i =
|
|
17
|
+
let i = d(t), a = Infinity;
|
|
17
18
|
for (let e = Math.max(1, t.length - $t); e < t.length; e++) {
|
|
18
19
|
let n = (t[e].time - t[e - 1].time) * i;
|
|
19
20
|
n > 0 && n < a && (a = n);
|
|
@@ -36,7 +37,7 @@ var tn = {
|
|
|
36
37
|
view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
|
|
37
38
|
bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
|
|
38
39
|
keys: "Arrow keys scroll and zoom, Home and End go to the start and the end. Comma and period read the bars one at a time."
|
|
39
|
-
},
|
|
40
|
+
}, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), nn = [
|
|
40
41
|
"role",
|
|
41
42
|
"aria-roledescription",
|
|
42
43
|
"aria-label",
|
|
@@ -93,7 +94,7 @@ var tn = {
|
|
|
93
94
|
let i = t[this.cursor];
|
|
94
95
|
this.source.showBar(i.time);
|
|
95
96
|
let a = this.source.formatPrice;
|
|
96
|
-
this.say(
|
|
97
|
+
this.say(I(this.labels.bar, {
|
|
97
98
|
time: this.source.formatTime(i.time),
|
|
98
99
|
open: a(i.open),
|
|
99
100
|
high: a(i.high),
|
|
@@ -118,7 +119,7 @@ var tn = {
|
|
|
118
119
|
this.labels.typeName ? this.labels.typeName(t) : t,
|
|
119
120
|
this.source.timeframe()
|
|
120
121
|
].filter(Boolean).join(", ");
|
|
121
|
-
return
|
|
122
|
+
return I(this.labels.summary, {
|
|
122
123
|
what: n,
|
|
123
124
|
close: this.source.formatPrice(e[e.length - 1].close)
|
|
124
125
|
});
|
|
@@ -128,7 +129,7 @@ var tn = {
|
|
|
128
129
|
if (e.length === 0) return this.labels.empty;
|
|
129
130
|
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
131
|
for (let t = n; t <= r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
131
|
-
return
|
|
132
|
+
return I(this.labels.view, {
|
|
132
133
|
count: r - n + 1,
|
|
133
134
|
from: this.source.formatTime(e[n].time),
|
|
134
135
|
to: this.source.formatTime(e[r].time),
|
|
@@ -158,22 +159,8 @@ function cn(e) {
|
|
|
158
159
|
return Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
159
160
|
}
|
|
160
161
|
//#endregion
|
|
161
|
-
//#region src/indicatorLabel.ts
|
|
162
|
-
var ln = 3, un = {
|
|
163
|
-
stochrsi: 4,
|
|
164
|
-
ichimoku: 4
|
|
165
|
-
};
|
|
166
|
-
function dn(e, t, n, r) {
|
|
167
|
-
let i = Object.keys(n || t).map((e) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)).slice(0, un[e] ?? ln).map((e) => String(Number(e.toFixed(4)))), a = typeof t.symbol == "string" && t.symbol ? [t.symbol] : [];
|
|
168
|
-
return [
|
|
169
|
-
e === "spread" && t.mode === "ratio" ? "Ratio" : r ?? e.toUpperCase(),
|
|
170
|
-
...a,
|
|
171
|
-
...i
|
|
172
|
-
].join(" ");
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
162
|
//#region src/charts/ChartTypeStrategy.ts
|
|
176
|
-
function
|
|
163
|
+
function ln(e) {
|
|
177
164
|
switch (e) {
|
|
178
165
|
case "candlestick":
|
|
179
166
|
case "heikinAshi":
|
|
@@ -196,7 +183,7 @@ function fn(e) {
|
|
|
196
183
|
default: return new xe();
|
|
197
184
|
}
|
|
198
185
|
}
|
|
199
|
-
function
|
|
186
|
+
function un(e, t, n = {}, r, i) {
|
|
200
187
|
if (t.length === 0) return t;
|
|
201
188
|
switch (e) {
|
|
202
189
|
case "heikinAshi": return Wt(t);
|
|
@@ -210,15 +197,15 @@ function pn(e, t, n = {}, r, i) {
|
|
|
210
197
|
}
|
|
211
198
|
case "lineBreak": return Kt(t, n.lineBreak?.lines ?? 3);
|
|
212
199
|
case "kagi": return Gt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
213
|
-
case "pointAndFigure": return
|
|
200
|
+
case "pointAndFigure": return fn(t, n, i).columns;
|
|
214
201
|
case "rangeBars": return qt(t, {
|
|
215
|
-
rangeSize:
|
|
202
|
+
rangeSize: xn(t, n, r),
|
|
216
203
|
includeForming: !0
|
|
217
204
|
}, i);
|
|
218
205
|
default: return t;
|
|
219
206
|
}
|
|
220
207
|
}
|
|
221
|
-
function
|
|
208
|
+
function dn(e) {
|
|
222
209
|
switch (e) {
|
|
223
210
|
case "heikinAshi":
|
|
224
211
|
case "renko":
|
|
@@ -229,72 +216,72 @@ function mn(e) {
|
|
|
229
216
|
default: return !1;
|
|
230
217
|
}
|
|
231
218
|
}
|
|
232
|
-
function
|
|
233
|
-
return e !== "heikinAshi" &&
|
|
219
|
+
function L(e) {
|
|
220
|
+
return e !== "heikinAshi" && dn(e);
|
|
234
221
|
}
|
|
235
|
-
function
|
|
236
|
-
return Rt(e,
|
|
222
|
+
function fn(e, t = {}, n) {
|
|
223
|
+
return Rt(e, hn(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
237
224
|
}
|
|
238
|
-
var
|
|
239
|
-
function
|
|
225
|
+
var pn = 50, mn = .01;
|
|
226
|
+
function hn(e, t = {}) {
|
|
240
227
|
let n = t.pointAndFigure?.boxSize;
|
|
241
228
|
if (typeof n == "number") return n;
|
|
242
|
-
let r =
|
|
243
|
-
return r > 0 ?
|
|
229
|
+
let r = gn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
230
|
+
return r > 0 ? R(te(r / pn, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * mn || 1;
|
|
244
231
|
}
|
|
245
|
-
function
|
|
232
|
+
function gn(e, t) {
|
|
246
233
|
let n = -Infinity, r = Infinity;
|
|
247
234
|
for (let i = 0; i < t; i++) e[i].high > n && (n = e[i].high), e[i].low < r && (r = e[i].low);
|
|
248
235
|
let i = n - r;
|
|
249
236
|
return Number.isFinite(i) ? i : 0;
|
|
250
237
|
}
|
|
251
|
-
var
|
|
252
|
-
function
|
|
238
|
+
var _n = 100, vn = 3, yn = .01, bn = 15, R = (e) => Number(e.toPrecision(bn));
|
|
239
|
+
function xn(e, t = {}, n) {
|
|
253
240
|
let r = t.rangeBars?.range;
|
|
254
241
|
if (typeof r == "number") return r;
|
|
255
|
-
let i = e.length >=
|
|
256
|
-
return
|
|
242
|
+
let i = e.length >= vn ? Cn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
243
|
+
return En(R(te(i > 0 ? i : a * yn || 1, !0)), n);
|
|
257
244
|
}
|
|
258
|
-
function
|
|
245
|
+
function Sn(e) {
|
|
259
246
|
let t = e.length - 1;
|
|
260
247
|
return {
|
|
261
|
-
from: Math.max(0, t -
|
|
248
|
+
from: Math.max(0, t - _n),
|
|
262
249
|
end: t
|
|
263
250
|
};
|
|
264
251
|
}
|
|
265
|
-
function
|
|
266
|
-
let { from: t, end: n } =
|
|
252
|
+
function Cn(e) {
|
|
253
|
+
let { from: t, end: n } = Sn(e), r = 0;
|
|
267
254
|
for (let i = t; i < n; i++) {
|
|
268
255
|
let { high: t, low: n } = e[i], a = i > 0 ? e[i - 1].close : n;
|
|
269
256
|
r += Math.max(t - n, Math.abs(t - a), Math.abs(n - a));
|
|
270
257
|
}
|
|
271
258
|
return n > t ? r / (n - t) : 0;
|
|
272
259
|
}
|
|
273
|
-
function
|
|
274
|
-
let { from: n, end: r } =
|
|
260
|
+
function wn(e, t) {
|
|
261
|
+
let { from: n, end: r } = Sn(e);
|
|
275
262
|
if (r <= n) return t(e[e.length - 1]?.close ?? 0);
|
|
276
263
|
let i = -Infinity, a = Infinity;
|
|
277
264
|
for (let t = n; t < r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
278
|
-
return
|
|
265
|
+
return Tn(t(i), t(a));
|
|
279
266
|
}
|
|
280
|
-
function
|
|
267
|
+
function Tn(e, t) {
|
|
281
268
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
282
269
|
}
|
|
283
|
-
function
|
|
284
|
-
return t === void 0 || !(t > 0) ? e :
|
|
270
|
+
function En(e, t) {
|
|
271
|
+
return t === void 0 || !(t > 0) ? e : R(Math.max(1, Math.round(e / t)) * t);
|
|
285
272
|
}
|
|
286
|
-
function
|
|
273
|
+
function Dn(e, t) {
|
|
287
274
|
let n = t?.(e);
|
|
288
|
-
return n ? n.createRenderer() :
|
|
275
|
+
return n ? n.createRenderer() : ln(e);
|
|
289
276
|
}
|
|
290
|
-
function
|
|
277
|
+
function On(e, t, n, r, i, a) {
|
|
291
278
|
if (t.length === 0) return t;
|
|
292
279
|
let o = n?.(e);
|
|
293
|
-
return o?.transform ? o.transform(t) :
|
|
280
|
+
return o?.transform ? o.transform(t) : un(e, t, r, i, a);
|
|
294
281
|
}
|
|
295
282
|
//#endregion
|
|
296
283
|
//#region src/state/AutoSaveScheduler.ts
|
|
297
|
-
var
|
|
284
|
+
var kn = class {
|
|
298
285
|
timer = null;
|
|
299
286
|
delayMs = 0;
|
|
300
287
|
key = null;
|
|
@@ -324,15 +311,15 @@ var Mn = class {
|
|
|
324
311
|
};
|
|
325
312
|
//#endregion
|
|
326
313
|
//#region src/DataManager.ts
|
|
327
|
-
function
|
|
314
|
+
function z(e) {
|
|
328
315
|
if (!e || typeof e.time != "number" || !Number.isFinite(e.time)) return !1;
|
|
329
316
|
let { open: t, high: n, low: r, close: i } = e;
|
|
330
317
|
return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
|
|
331
318
|
}
|
|
332
|
-
function
|
|
319
|
+
function An(e) {
|
|
333
320
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
334
321
|
}
|
|
335
|
-
function
|
|
322
|
+
function B(e) {
|
|
336
323
|
return {
|
|
337
324
|
...e,
|
|
338
325
|
high: Math.max(e.open, e.high, e.low, e.close),
|
|
@@ -340,37 +327,37 @@ function z(e) {
|
|
|
340
327
|
volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
|
|
341
328
|
};
|
|
342
329
|
}
|
|
343
|
-
function
|
|
330
|
+
function jn(e, t) {
|
|
344
331
|
return e === t || e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume;
|
|
345
332
|
}
|
|
346
|
-
function
|
|
333
|
+
function Mn(e, t) {
|
|
347
334
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
348
335
|
if (e[n].time === t) return n;
|
|
349
336
|
if (e[n].time < t) return -1;
|
|
350
337
|
}
|
|
351
338
|
return -1;
|
|
352
339
|
}
|
|
353
|
-
var
|
|
340
|
+
var Nn = {
|
|
354
341
|
index: -1,
|
|
355
342
|
changed: !1
|
|
356
343
|
};
|
|
357
|
-
function
|
|
344
|
+
function Pn(e, t) {
|
|
358
345
|
if (e.length === 0) return t;
|
|
359
|
-
let n =
|
|
360
|
-
return
|
|
346
|
+
let n = x(t);
|
|
347
|
+
return d(e) === 1 ? n : n / 1e3;
|
|
361
348
|
}
|
|
362
|
-
function
|
|
363
|
-
let n =
|
|
349
|
+
function Fn(e, t) {
|
|
350
|
+
let n = Pn(e, t.time);
|
|
364
351
|
return n === t.time ? t : {
|
|
365
352
|
...t,
|
|
366
353
|
time: n
|
|
367
354
|
};
|
|
368
355
|
}
|
|
369
|
-
var
|
|
356
|
+
var In = class {
|
|
370
357
|
data = [];
|
|
371
358
|
changes = 0;
|
|
372
359
|
withSeriesTime(e) {
|
|
373
|
-
return
|
|
360
|
+
return Fn(this.data, e);
|
|
374
361
|
}
|
|
375
362
|
getData() {
|
|
376
363
|
return this.data;
|
|
@@ -382,16 +369,16 @@ var B = class {
|
|
|
382
369
|
let t = [];
|
|
383
370
|
for (let n = 0; n < e.length; n++) {
|
|
384
371
|
let r = e[n];
|
|
385
|
-
|
|
372
|
+
z(r) && t.push(An(r) ? r : B(r));
|
|
386
373
|
}
|
|
387
374
|
this.data = t, this.changes++;
|
|
388
375
|
}
|
|
389
376
|
prependBars(e) {
|
|
390
377
|
let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
|
|
391
378
|
for (let r = 0; r < e.length; r++) {
|
|
392
|
-
if (!
|
|
379
|
+
if (!z(e[r])) continue;
|
|
393
380
|
let i = this.withSeriesTime(e[r]);
|
|
394
|
-
i.time >= t || n.push(
|
|
381
|
+
i.time >= t || n.push(An(i) ? i : B(i));
|
|
395
382
|
}
|
|
396
383
|
if (n.length === 0) return 0;
|
|
397
384
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -400,11 +387,11 @@ var B = class {
|
|
|
400
387
|
return n.length = r, this.data = n.concat(this.data), this.changes++, r;
|
|
401
388
|
}
|
|
402
389
|
appendBar(e) {
|
|
403
|
-
|
|
390
|
+
z(e) && (this.data.push(B(this.withSeriesTime(e))), this.changes++);
|
|
404
391
|
}
|
|
405
392
|
updateLastBar(e) {
|
|
406
|
-
if (!
|
|
407
|
-
let t =
|
|
393
|
+
if (!z(e)) return;
|
|
394
|
+
let t = B(this.withSeriesTime(e));
|
|
408
395
|
if (this.changes++, this.data.length === 0) {
|
|
409
396
|
this.data.push(t);
|
|
410
397
|
return;
|
|
@@ -412,11 +399,11 @@ var B = class {
|
|
|
412
399
|
this.data[this.data.length - 1] = t;
|
|
413
400
|
}
|
|
414
401
|
replaceBar(e) {
|
|
415
|
-
if (!
|
|
416
|
-
let t = this.withSeriesTime(e), n =
|
|
417
|
-
if (n < 0) return
|
|
418
|
-
let r =
|
|
419
|
-
return
|
|
402
|
+
if (!z(e)) return Nn;
|
|
403
|
+
let t = this.withSeriesTime(e), n = Mn(this.data, t.time);
|
|
404
|
+
if (n < 0) return Nn;
|
|
405
|
+
let r = B(t);
|
|
406
|
+
return jn(this.data[n], r) ? {
|
|
420
407
|
index: n,
|
|
421
408
|
changed: !1
|
|
422
409
|
} : (this.data[n] = r, this.changes++, {
|
|
@@ -441,10 +428,10 @@ var B = class {
|
|
|
441
428
|
function H(e, t) {
|
|
442
429
|
let n = e[e.length - 1];
|
|
443
430
|
if (!n) return "append";
|
|
444
|
-
let r =
|
|
431
|
+
let r = x(t.time), i = x(n.time);
|
|
445
432
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
446
433
|
}
|
|
447
|
-
function
|
|
434
|
+
function Ln(e) {
|
|
448
435
|
return [
|
|
449
436
|
e.time,
|
|
450
437
|
e.open,
|
|
@@ -453,8 +440,8 @@ function zn(e) {
|
|
|
453
440
|
e.close
|
|
454
441
|
].every(Number.isFinite);
|
|
455
442
|
}
|
|
456
|
-
var
|
|
457
|
-
shown = new
|
|
443
|
+
var Rn = class {
|
|
444
|
+
shown = new In();
|
|
458
445
|
whole = null;
|
|
459
446
|
aside = null;
|
|
460
447
|
shownRevision = 0;
|
|
@@ -496,7 +483,7 @@ var Bn = class {
|
|
|
496
483
|
}
|
|
497
484
|
let t = null, n = e;
|
|
498
485
|
if (this.whole) {
|
|
499
|
-
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(
|
|
486
|
+
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(Ln).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);
|
|
500
487
|
this.whole = [...a, ...this.whole];
|
|
501
488
|
let o = this.hoursFilter(this.whole);
|
|
502
489
|
t = a.length, n = o ? a.filter((e) => o(e.time)) : a;
|
|
@@ -508,8 +495,8 @@ var Bn = class {
|
|
|
508
495
|
};
|
|
509
496
|
}
|
|
510
497
|
mergeSnapshot(e) {
|
|
511
|
-
if (this.aside) return this.aside.setData(
|
|
512
|
-
let t =
|
|
498
|
+
if (this.aside) return this.aside.setData(zn(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = zn(this.whole ?? this.shown.getData(), e);
|
|
513
500
|
return t ? (this.shown.setData(this.regularOnly(t)), !0) : !1;
|
|
514
501
|
}
|
|
515
502
|
refilter() {
|
|
@@ -566,7 +553,7 @@ var Bn = class {
|
|
|
566
553
|
mergeTick(e) {
|
|
567
554
|
if (this.aside) return this.aside.updateLastBarFromTick(e), this.wrote("aside", !1);
|
|
568
555
|
let t = this.whole ? this.hoursFilter(this.whole) : null;
|
|
569
|
-
if (t && this.whole && !t(
|
|
556
|
+
if (t && this.whole && !t(Pn(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
570
557
|
let n = this.shown.getLength();
|
|
571
558
|
this.shown.updateLastBarFromTick(e);
|
|
572
559
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -608,10 +595,10 @@ var Bn = class {
|
|
|
608
595
|
changed: n
|
|
609
596
|
});
|
|
610
597
|
}
|
|
611
|
-
if (!
|
|
612
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
598
|
+
if (!z(e)) return V;
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Mn(n, t.time) : -1;
|
|
613
600
|
if (n) {
|
|
614
|
-
if (r < 0 || !
|
|
601
|
+
if (r < 0 || !z(n[r])) return V;
|
|
615
602
|
let e = this.hoursFilter(n);
|
|
616
603
|
if (e && !e(t.time)) return this.replaceHidden(n, r, t);
|
|
617
604
|
}
|
|
@@ -623,7 +610,7 @@ var Bn = class {
|
|
|
623
610
|
});
|
|
624
611
|
}
|
|
625
612
|
beginReplay() {
|
|
626
|
-
this.aside || (this.aside = new
|
|
613
|
+
this.aside || (this.aside = new In(), this.aside.setData(this.whole ?? this.shown.getData()));
|
|
627
614
|
}
|
|
628
615
|
endReplay() {
|
|
629
616
|
let e = this.aside;
|
|
@@ -643,10 +630,10 @@ var Bn = class {
|
|
|
643
630
|
this.shown.updateLastBar(e);
|
|
644
631
|
}
|
|
645
632
|
inSeriesUnit(e) {
|
|
646
|
-
return
|
|
633
|
+
return Fn(this.whole ?? this.shown.getData(), e);
|
|
647
634
|
}
|
|
648
635
|
replaceHidden(e, t, n) {
|
|
649
|
-
let r =
|
|
636
|
+
let r = B(n), i = !jn(e[t], r);
|
|
650
637
|
return i && (e[t] = r), {
|
|
651
638
|
to: "hidden",
|
|
652
639
|
index: -1,
|
|
@@ -680,14 +667,14 @@ var Bn = class {
|
|
|
680
667
|
return !r || r(e.time);
|
|
681
668
|
}
|
|
682
669
|
};
|
|
683
|
-
function
|
|
670
|
+
function zn(e, t) {
|
|
684
671
|
let n = t[0]?.time, r = 0;
|
|
685
672
|
for (; n !== void 0 && r < e.length && e[r].time < n;) r++;
|
|
686
673
|
return r === 0 || r === e.length ? null : e.slice(0, r).concat(t);
|
|
687
674
|
}
|
|
688
675
|
//#endregion
|
|
689
676
|
//#region src/model/PriceFit.ts
|
|
690
|
-
var
|
|
677
|
+
var Bn = o ** -7, Vn = class {
|
|
691
678
|
auto;
|
|
692
679
|
preferred;
|
|
693
680
|
pending = !0;
|
|
@@ -720,21 +707,21 @@ var Hn = a ** -7, Un = class {
|
|
|
720
707
|
}
|
|
721
708
|
fit(e, t, n, r) {
|
|
722
709
|
if (t.length === 0) return;
|
|
723
|
-
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o =
|
|
710
|
+
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o = Un(Un(h(t, i, a, 0), r.overlayRange(i, a)), r.compareRange(t, n)), s = r.volumeRatio(t, i, a), c = s === null ? O : s + Bn;
|
|
724
711
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
725
712
|
top: c,
|
|
726
|
-
bottom:
|
|
713
|
+
bottom: O
|
|
727
714
|
} : {
|
|
728
|
-
top:
|
|
715
|
+
top: O,
|
|
729
716
|
bottom: c
|
|
730
717
|
}), e.fitToPrices(o.min, o.max);
|
|
731
718
|
}
|
|
732
719
|
};
|
|
733
|
-
function
|
|
720
|
+
function Hn(e, t, n) {
|
|
734
721
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
735
722
|
return !1;
|
|
736
723
|
}
|
|
737
|
-
function
|
|
724
|
+
function Un(e, t) {
|
|
738
725
|
return e ? t ? {
|
|
739
726
|
min: Math.min(e.min, t.min),
|
|
740
727
|
max: Math.max(e.max, t.max)
|
|
@@ -742,7 +729,7 @@ function Gn(e, t) {
|
|
|
742
729
|
}
|
|
743
730
|
//#endregion
|
|
744
731
|
//#region src/model/DisplaySeries.ts
|
|
745
|
-
var
|
|
732
|
+
var Wn = class {
|
|
746
733
|
series = null;
|
|
747
734
|
madeAt = null;
|
|
748
735
|
epoch = 0;
|
|
@@ -753,7 +740,7 @@ var Kn = class {
|
|
|
753
740
|
get() {
|
|
754
741
|
let e = this.sources.bars();
|
|
755
742
|
if (e.length === 0) return e;
|
|
756
|
-
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ?
|
|
743
|
+
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ? wn(e, (e) => this.sources.stepAt(e)) : void 0, i = this.sources.version(), a = this.madeAt;
|
|
757
744
|
return this.series && a && a.version === i && a.type === t && a.options === n && a.step === r && a.epoch === this.epoch ? this.series : (this.series = this.make(t, e, n, r), this.madeAt = {
|
|
758
745
|
version: i,
|
|
759
746
|
type: t,
|
|
@@ -770,14 +757,14 @@ var Kn = class {
|
|
|
770
757
|
}
|
|
771
758
|
make(e, t, n, r) {
|
|
772
759
|
let { lookup: i } = this.sources;
|
|
773
|
-
if (e !== "pointAndFigure" || i(e)) return
|
|
774
|
-
let { columns: a, boxSize: o } =
|
|
760
|
+
if (e !== "pointAndFigure" || i(e)) return On(e, t, i, n, r, this.memo);
|
|
761
|
+
let { columns: a, boxSize: o } = fn(t, n, this.memo);
|
|
775
762
|
return this.sources.onBoxSize(o), a;
|
|
776
763
|
}
|
|
777
|
-
},
|
|
764
|
+
}, Gn = {
|
|
778
765
|
min: 0,
|
|
779
766
|
max: 100
|
|
780
|
-
},
|
|
767
|
+
}, Kn = class {
|
|
781
768
|
layout = null;
|
|
782
769
|
infos = null;
|
|
783
770
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -785,7 +772,7 @@ var Kn = class {
|
|
|
785
772
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
786
773
|
}
|
|
787
774
|
resolved() {
|
|
788
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
775
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(qn(this.layout))), this.layout;
|
|
789
776
|
}
|
|
790
777
|
invalidate() {
|
|
791
778
|
this.layout = null, this.infos = null;
|
|
@@ -797,7 +784,7 @@ var Kn = class {
|
|
|
797
784
|
if (this.infos) return this.infos;
|
|
798
785
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
799
786
|
return this.infos = this.resolved().panels.map((e) => {
|
|
800
|
-
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...
|
|
787
|
+
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...Gn }, s = this.styles.get(i);
|
|
801
788
|
return {
|
|
802
789
|
instanceId: i,
|
|
803
790
|
members: this.sources.getPaneMembers(i),
|
|
@@ -857,7 +844,7 @@ var Kn = class {
|
|
|
857
844
|
}
|
|
858
845
|
}
|
|
859
846
|
};
|
|
860
|
-
function
|
|
847
|
+
function qn(e) {
|
|
861
848
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
862
849
|
for (let t of e.panels) t.config.position !== "top" && t.config.position !== "bottom" || (n = Math.min(n, t.rect.y), r = Math.max(r, t.rect.y + t.rect.height));
|
|
863
850
|
return {
|
|
@@ -865,10 +852,10 @@ function Yn(e) {
|
|
|
865
852
|
bottom: r
|
|
866
853
|
};
|
|
867
854
|
}
|
|
868
|
-
function
|
|
855
|
+
function Jn(e) {
|
|
869
856
|
return e.length > 0 ? { renames: e } : {};
|
|
870
857
|
}
|
|
871
|
-
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t),
|
|
858
|
+
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
872
859
|
steps;
|
|
873
860
|
snapshot;
|
|
874
861
|
enabled;
|
|
@@ -904,7 +891,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
904
891
|
...o,
|
|
905
892
|
after: n,
|
|
906
893
|
at: i,
|
|
907
|
-
...
|
|
894
|
+
...Jn([...o.renames ?? [], ...r])
|
|
908
895
|
}
|
|
909
896
|
}) : this.steps.push({
|
|
910
897
|
...c,
|
|
@@ -913,7 +900,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
913
900
|
after: n,
|
|
914
901
|
subject: e,
|
|
915
902
|
at: i,
|
|
916
|
-
...
|
|
903
|
+
...Jn(r)
|
|
917
904
|
}
|
|
918
905
|
});
|
|
919
906
|
}
|
|
@@ -951,7 +938,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
951
938
|
}
|
|
952
939
|
});
|
|
953
940
|
}
|
|
954
|
-
},
|
|
941
|
+
}, Xn = class {
|
|
955
942
|
constructor(e, t, n) {
|
|
956
943
|
this.members = e, this.slots = t, this.handover = n;
|
|
957
944
|
}
|
|
@@ -970,24 +957,24 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
970
957
|
paneFor(e, t, n, r) {
|
|
971
958
|
if (n) return this.hostOf(n, r);
|
|
972
959
|
if (e.placement !== "overlay") return null;
|
|
973
|
-
let i =
|
|
960
|
+
let i = M(e), a = i ? S(t[i]) : null;
|
|
974
961
|
return a ? this.hostOf(a.instanceId, r) : null;
|
|
975
962
|
}
|
|
976
963
|
sourceOf(e) {
|
|
977
|
-
let t = this.members.getIndicatorDescriptor(e), n = t ?
|
|
964
|
+
let t = this.members.getIndicatorDescriptor(e), n = t ? M(t) : null;
|
|
978
965
|
return n ? this.members.getIndicatorConfig(e)?.params[n] : void 0;
|
|
979
966
|
}
|
|
980
967
|
followSource(e, t) {
|
|
981
|
-
let n = this.members.getIndicatorDescriptor(e), r = this.members.getIndicatorConfig(e), i = n ?
|
|
968
|
+
let n = this.members.getIndicatorDescriptor(e), r = this.members.getIndicatorConfig(e), i = n ? M(n) : null;
|
|
982
969
|
if (n?.placement !== "overlay" || !r || !i || r.params[i] === t) return !1;
|
|
983
|
-
let a =
|
|
970
|
+
let a = S(r.params[i]), o = a ? this.hostOf(a.instanceId, e) : S(t) ? null : r.pane ?? null;
|
|
984
971
|
return (o ?? void 0) === r.pane ? !1 : (this.members.setPane(e, o), !0);
|
|
985
972
|
}
|
|
986
973
|
moveHost(e, t) {
|
|
987
974
|
let n = this.members.getIndicatorConfig(e), r = this.members.getIndicatorDescriptor(e);
|
|
988
975
|
if (!n || !r) return;
|
|
989
|
-
let i =
|
|
990
|
-
if (r.placement === "overlay" && i &&
|
|
976
|
+
let i = M(r);
|
|
977
|
+
if (r.placement === "overlay" && i && S(n.params[i])) return;
|
|
991
978
|
if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
|
|
992
979
|
if (t === "new") return r.placement === "panel" && !this.ownsPane(e) ? null : void 0;
|
|
993
980
|
let a = this.hostOf(t, e);
|
|
@@ -1030,7 +1017,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
1030
1017
|
};
|
|
1031
1018
|
//#endregion
|
|
1032
1019
|
//#region src/model/IndicatorSetup.ts
|
|
1033
|
-
function
|
|
1020
|
+
function Zn(e, t, n) {
|
|
1034
1021
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1035
1022
|
return e.getActiveIndicators().map((t) => {
|
|
1036
1023
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1058,7 +1045,7 @@ function $n(e, t, n) {
|
|
|
1058
1045
|
};
|
|
1059
1046
|
});
|
|
1060
1047
|
}
|
|
1061
|
-
function
|
|
1048
|
+
function Qn(e, t) {
|
|
1062
1049
|
for (let [n, r] of t) n.paneSize !== void 0 && e.setPanelSize(r, n.paneSize), (n.paneSize !== void 0 || n.paneCollapsed) && e.setPanelCollapsed(r, !!n.paneCollapsed), n.paneSize !== void 0 && e.setPanelScale(r, {
|
|
1063
1050
|
log: !!n.paneLog,
|
|
1064
1051
|
invert: !!n.paneInvert,
|
|
@@ -1069,11 +1056,11 @@ function er(e, t) {
|
|
|
1069
1056
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1070
1057
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1071
1058
|
}
|
|
1072
|
-
function
|
|
1059
|
+
function $n(e) {
|
|
1073
1060
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1074
1061
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1075
1062
|
i.add(e.instanceId);
|
|
1076
|
-
let o = [e.pane, ...Object.values(e.params).map((e) =>
|
|
1063
|
+
let o = [e.pane, ...Object.values(e.params).map((e) => S(e)?.instanceId)];
|
|
1077
1064
|
for (let e of o) {
|
|
1078
1065
|
let n = e ? t.get(e) : void 0;
|
|
1079
1066
|
n && a(n);
|
|
@@ -1083,37 +1070,37 @@ function tr(e) {
|
|
|
1083
1070
|
for (let t of e) a(t);
|
|
1084
1071
|
return n;
|
|
1085
1072
|
}
|
|
1086
|
-
function
|
|
1073
|
+
function er(e, t) {
|
|
1087
1074
|
return e.id === t.id && (e.pane ?? null) === (t.pane ?? null) && (e.scale ?? null) === (t.scale ?? null) && e.position === void 0 == (t.position === void 0);
|
|
1088
1075
|
}
|
|
1089
|
-
function
|
|
1076
|
+
function tr(e, t) {
|
|
1090
1077
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1091
1078
|
for (let t of e) {
|
|
1092
1079
|
let e = n.get(t.instanceId);
|
|
1093
|
-
e &&
|
|
1080
|
+
e && er(t, e) && nr(t, e) && r.add(t.instanceId);
|
|
1094
1081
|
}
|
|
1095
1082
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1096
1083
|
return r;
|
|
1097
1084
|
}
|
|
1098
|
-
function
|
|
1085
|
+
function nr(e, t) {
|
|
1099
1086
|
let n = Object.keys(e.params);
|
|
1100
1087
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1101
1088
|
}
|
|
1102
|
-
function
|
|
1089
|
+
function rr(e, t) {
|
|
1103
1090
|
let n = { ...e };
|
|
1104
1091
|
for (let [e, r] of Object.entries(n)) {
|
|
1105
|
-
let i =
|
|
1106
|
-
a && (n[e] =
|
|
1092
|
+
let i = S(r), a = i && t.get(i.instanceId);
|
|
1093
|
+
a && (n[e] = y(a, i.key));
|
|
1107
1094
|
}
|
|
1108
1095
|
return n;
|
|
1109
1096
|
}
|
|
1110
1097
|
//#endregion
|
|
1111
1098
|
//#region src/model/SymbolRequests.ts
|
|
1112
|
-
function
|
|
1099
|
+
function ir(e, t) {
|
|
1113
1100
|
let n = t.symbol;
|
|
1114
1101
|
return ut.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1115
1102
|
}
|
|
1116
|
-
var
|
|
1103
|
+
var ar = class {
|
|
1117
1104
|
asked = /* @__PURE__ */ new Set();
|
|
1118
1105
|
constructor(e, t) {
|
|
1119
1106
|
this.readers = e, this.held = t;
|
|
@@ -1121,7 +1108,7 @@ var sr = class {
|
|
|
1121
1108
|
required() {
|
|
1122
1109
|
let e = /* @__PURE__ */ new Set();
|
|
1123
1110
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1124
|
-
let n =
|
|
1111
|
+
let n = ir(t.id, t.params);
|
|
1125
1112
|
n && e.add(n);
|
|
1126
1113
|
}
|
|
1127
1114
|
return [...e];
|
|
@@ -1139,20 +1126,20 @@ var sr = class {
|
|
|
1139
1126
|
}
|
|
1140
1127
|
toAsk(e) {
|
|
1141
1128
|
this.forgetUnread();
|
|
1142
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1129
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? ir(t.id, t.params) : "";
|
|
1143
1130
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1144
1131
|
}
|
|
1145
|
-
},
|
|
1146
|
-
function
|
|
1147
|
-
if (!
|
|
1132
|
+
}, or = (e, t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1133
|
+
function sr(e, t, n, r) {
|
|
1134
|
+
if (!or(e, t)) {
|
|
1148
1135
|
for (let t of n) {
|
|
1149
1136
|
let n = r(t.id);
|
|
1150
|
-
if (n &&
|
|
1137
|
+
if (n && or(e, n.chartRect)) return t.id;
|
|
1151
1138
|
}
|
|
1152
1139
|
return null;
|
|
1153
1140
|
}
|
|
1154
1141
|
}
|
|
1155
|
-
function
|
|
1142
|
+
function cr(e, t, n, r) {
|
|
1156
1143
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1157
1144
|
let i = n();
|
|
1158
1145
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1160,12 +1147,12 @@ function ur(e, t, n, r) {
|
|
|
1160
1147
|
data: r()
|
|
1161
1148
|
};
|
|
1162
1149
|
}
|
|
1163
|
-
function
|
|
1150
|
+
function lr(e, t, n) {
|
|
1164
1151
|
return !n && e.some((e) => e.id === t);
|
|
1165
1152
|
}
|
|
1166
1153
|
//#endregion
|
|
1167
1154
|
//#region src/HistoryPager.ts
|
|
1168
|
-
var
|
|
1155
|
+
var ur = 5e3, dr = 6e4, fr = 500, pr = class {
|
|
1169
1156
|
loader = null;
|
|
1170
1157
|
pageSize = 500;
|
|
1171
1158
|
loading = !1;
|
|
@@ -1220,7 +1207,7 @@ var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
|
1220
1207
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1221
1208
|
state: "loaded",
|
|
1222
1209
|
count: 0
|
|
1223
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1210
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(dr, ur * 2 ** (this.failures - 1)), this.emit({
|
|
1224
1211
|
state: "error",
|
|
1225
1212
|
count: 0,
|
|
1226
1213
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1253,10 +1240,10 @@ var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
|
1253
1240
|
};
|
|
1254
1241
|
//#endregion
|
|
1255
1242
|
//#region src/ThemeManager.ts
|
|
1256
|
-
function
|
|
1243
|
+
function mr(e, t) {
|
|
1257
1244
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1258
1245
|
}
|
|
1259
|
-
var
|
|
1246
|
+
var hr = class e {
|
|
1260
1247
|
base;
|
|
1261
1248
|
shape = null;
|
|
1262
1249
|
font = null;
|
|
@@ -1265,13 +1252,13 @@ var _r = class t {
|
|
|
1265
1252
|
host = {};
|
|
1266
1253
|
user = /* @__PURE__ */ new Map();
|
|
1267
1254
|
effective = null;
|
|
1268
|
-
constructor(
|
|
1269
|
-
this.base =
|
|
1255
|
+
constructor(t) {
|
|
1256
|
+
this.base = e.read(t), this.themeFont = this.base.font;
|
|
1270
1257
|
}
|
|
1271
|
-
static read(
|
|
1272
|
-
if (!
|
|
1273
|
-
if (
|
|
1274
|
-
let { style:
|
|
1258
|
+
static read(e) {
|
|
1259
|
+
if (!e || e === "dark") return { ...t };
|
|
1260
|
+
if (e === "light") return { ...r };
|
|
1261
|
+
let { style: n, ...i } = e;
|
|
1275
1262
|
return i;
|
|
1276
1263
|
}
|
|
1277
1264
|
getTheme() {
|
|
@@ -1280,8 +1267,8 @@ var _r = class t {
|
|
|
1280
1267
|
getBaseTheme() {
|
|
1281
1268
|
return this.base;
|
|
1282
1269
|
}
|
|
1283
|
-
setTheme(
|
|
1284
|
-
let n =
|
|
1270
|
+
setTheme(t) {
|
|
1271
|
+
let n = e.read(t), r = this.font !== null && mr(n.font, this.base.font);
|
|
1285
1272
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1286
1273
|
...this.base,
|
|
1287
1274
|
shape: {
|
|
@@ -1346,7 +1333,7 @@ var _r = class t {
|
|
|
1346
1333
|
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);
|
|
1347
1334
|
}
|
|
1348
1335
|
getStyleValue(e) {
|
|
1349
|
-
return
|
|
1336
|
+
return p(this.base, this.merged(), e, this.chartType);
|
|
1350
1337
|
}
|
|
1351
1338
|
layer(e) {
|
|
1352
1339
|
return e === "host" ? this.host : this.user.get(this.base.name) ?? {};
|
|
@@ -1363,7 +1350,7 @@ var _r = class t {
|
|
|
1363
1350
|
};
|
|
1364
1351
|
//#endregion
|
|
1365
1352
|
//#region src/style/styleOptions.ts
|
|
1366
|
-
function
|
|
1353
|
+
function gr(e, t) {
|
|
1367
1354
|
return t ? {
|
|
1368
1355
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1369
1356
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1371,40 +1358,40 @@ function vr(e, t) {
|
|
|
1371
1358
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1372
1359
|
} : {};
|
|
1373
1360
|
}
|
|
1374
|
-
function
|
|
1361
|
+
function _r(e) {
|
|
1375
1362
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1376
1363
|
return {
|
|
1377
1364
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1378
1365
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1379
1366
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1380
1367
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1381
|
-
...
|
|
1382
|
-
...
|
|
1368
|
+
...gr("horizontal", n?.hLine),
|
|
1369
|
+
...gr("vertical", n?.vLine),
|
|
1383
1370
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1384
1371
|
...e.overrides
|
|
1385
1372
|
};
|
|
1386
1373
|
}
|
|
1387
1374
|
//#endregion
|
|
1388
1375
|
//#region src/layout/LayoutManager.ts
|
|
1389
|
-
var
|
|
1376
|
+
var vr = 200, yr = 80, W = (e) => e.position === "top" || e.position === "bottom", br = class {
|
|
1390
1377
|
panels = [];
|
|
1391
1378
|
containerWidth = 0;
|
|
1392
1379
|
containerHeight = 0;
|
|
1393
|
-
priceAxisWidth =
|
|
1380
|
+
priceAxisWidth = s;
|
|
1394
1381
|
leftAxisWidth = 0;
|
|
1395
1382
|
maximized = null;
|
|
1396
1383
|
aside = /* @__PURE__ */ new Set();
|
|
1397
1384
|
resize(e, t) {
|
|
1398
1385
|
this.containerWidth = e, this.containerHeight = t;
|
|
1399
1386
|
}
|
|
1400
|
-
addPanel(e,
|
|
1387
|
+
addPanel(e, t = "bottom", r) {
|
|
1401
1388
|
this.maximized = null;
|
|
1402
|
-
let
|
|
1389
|
+
let i = t === "left" || t === "right";
|
|
1403
1390
|
this.panels.push({
|
|
1404
1391
|
id: e,
|
|
1405
|
-
position:
|
|
1406
|
-
size: r ?? (
|
|
1407
|
-
minSize:
|
|
1392
|
+
position: t,
|
|
1393
|
+
size: r ?? (i ? vr : n),
|
|
1394
|
+
minSize: i ? yr : a,
|
|
1408
1395
|
content: {
|
|
1409
1396
|
type: "indicator",
|
|
1410
1397
|
indicatorInstanceId: e
|
|
@@ -1469,17 +1456,17 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1469
1456
|
shownSize(e, t) {
|
|
1470
1457
|
return W(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
|
|
1471
1458
|
}
|
|
1472
|
-
setPanelPosition(e,
|
|
1459
|
+
setPanelPosition(e, t) {
|
|
1473
1460
|
let r = this.panels.find((t) => t.id === e);
|
|
1474
1461
|
if (r) {
|
|
1475
|
-
let
|
|
1476
|
-
r.position =
|
|
1462
|
+
let i = r.position === "left" || r.position === "right", o = t === "left" || t === "right";
|
|
1463
|
+
r.position = t, i !== o && (r.size = o ? vr : n, r.minSize = o ? yr : a), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1477
1464
|
}
|
|
1478
1465
|
}
|
|
1479
1466
|
setPanelSize(e, t) {
|
|
1480
1467
|
let n = this.panels.find((t) => t.id === e);
|
|
1481
1468
|
if (n) {
|
|
1482
|
-
let e = W(n) ? this.containerHeight -
|
|
1469
|
+
let e = W(n) ? this.containerHeight - c - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
|
|
1483
1470
|
n.size = Math.max(n.minSize, r), n.collapsed = void 0, this.maximized = null;
|
|
1484
1471
|
}
|
|
1485
1472
|
}
|
|
@@ -1497,11 +1484,11 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1497
1484
|
return this.aside = new Set(e), t;
|
|
1498
1485
|
}
|
|
1499
1486
|
resolve() {
|
|
1500
|
-
let e = this.panels.filter((e) => !this.aside.has(e.id)), t = e.filter((e) => e.position === "left"), n = e.filter((e) => e.position === "right"), r = e.filter((e) => e.position === "top"), i = e.filter((e) => e.position === "bottom"), a = (r.length + i.length - 1) * 20, o = this.maximized ? e.find((e) => e.id === this.maximized) : void 0,
|
|
1487
|
+
let e = this.panels.filter((e) => !this.aside.has(e.id)), t = e.filter((e) => e.position === "left"), n = e.filter((e) => e.position === "right"), r = e.filter((e) => e.position === "top"), i = e.filter((e) => e.position === "bottom"), a = (r.length + i.length - 1) * 20, o = this.maximized ? e.find((e) => e.id === this.maximized) : void 0, s = Math.max(o?.minSize ?? 0, this.containerHeight - c - 48 - a), l = (e) => this.shownSize(e, s), u = t.reduce((e, t) => e + t.size, 0), d = n.reduce((e, t) => e + t.size, 0), f = r.reduce((e, t) => e + l(t), 0), p = i.reduce((e, t) => e + l(t), 0), m = u + this.leftAxisWidth, h = {
|
|
1501
1488
|
x: m,
|
|
1502
1489
|
y: f,
|
|
1503
1490
|
width: Math.max(0, this.containerWidth - m - d - this.priceAxisWidth),
|
|
1504
|
-
height: Math.max(0, this.containerHeight - f - p -
|
|
1491
|
+
height: Math.max(0, this.containerHeight - f - p - c)
|
|
1505
1492
|
}, g = [], _ = [], v = 0;
|
|
1506
1493
|
for (let e of t) g.push({
|
|
1507
1494
|
config: e,
|
|
@@ -1509,7 +1496,7 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1509
1496
|
x: v,
|
|
1510
1497
|
y: 0,
|
|
1511
1498
|
width: e.size,
|
|
1512
|
-
height: this.containerHeight -
|
|
1499
|
+
height: this.containerHeight - c
|
|
1513
1500
|
}
|
|
1514
1501
|
}), _.push({
|
|
1515
1502
|
panelId: e.id,
|
|
@@ -1572,7 +1559,7 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1572
1559
|
x: v,
|
|
1573
1560
|
y: 0,
|
|
1574
1561
|
width: e.size,
|
|
1575
|
-
height: this.containerHeight -
|
|
1562
|
+
height: this.containerHeight - c
|
|
1576
1563
|
}
|
|
1577
1564
|
}), _.push({
|
|
1578
1565
|
panelId: e.id,
|
|
@@ -1593,26 +1580,26 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1593
1580
|
getMainChartRect() {
|
|
1594
1581
|
return this.resolve().mainChartRect;
|
|
1595
1582
|
}
|
|
1596
|
-
},
|
|
1597
|
-
function
|
|
1598
|
-
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall:
|
|
1583
|
+
}, xr = 14, Sr = 14, Cr = 22, wr = 4;
|
|
1584
|
+
function Tr(e) {
|
|
1585
|
+
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure: c } = e, u = e.tagPrecision ?? l(t, n), d = u, f = r === null ? [t, n] : [
|
|
1599
1586
|
t,
|
|
1600
1587
|
n,
|
|
1601
1588
|
r
|
|
1602
|
-
], p =
|
|
1589
|
+
], p = s;
|
|
1603
1590
|
for (let t of f) {
|
|
1604
1591
|
if (!Number.isFinite(t)) continue;
|
|
1605
|
-
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) :
|
|
1606
|
-
p = Math.max(p,
|
|
1592
|
+
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : _(t, u, i), r = e.format ? n : _(t, d, i);
|
|
1593
|
+
p = Math.max(p, c(n, `500 ${o}px ${a}`) + xr, c(r, `bold 11px ${a}`) + Sr, c(r, `600 ${o}px ${a}`) + Cr);
|
|
1607
1594
|
}
|
|
1608
|
-
return p <=
|
|
1595
|
+
return p <= s ? s : Math.ceil(p / wr) * wr;
|
|
1609
1596
|
}
|
|
1610
|
-
function
|
|
1597
|
+
function Er(e, t) {
|
|
1611
1598
|
return t > e || t <= e - 12 ? t : e;
|
|
1612
1599
|
}
|
|
1613
1600
|
//#endregion
|
|
1614
1601
|
//#region src/layout/labelWidths.ts
|
|
1615
|
-
var
|
|
1602
|
+
var Dr = 512, Or = class {
|
|
1616
1603
|
widths = /* @__PURE__ */ new Map();
|
|
1617
1604
|
fonts;
|
|
1618
1605
|
forget = () => this.widths.clear();
|
|
@@ -1623,12 +1610,12 @@ var kr = 512, Ar = class {
|
|
|
1623
1610
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1624
1611
|
if (i !== void 0) return i;
|
|
1625
1612
|
let a = n();
|
|
1626
|
-
return this.widths.size >=
|
|
1613
|
+
return this.widths.size >= Dr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1627
1614
|
}
|
|
1628
1615
|
destroy() {
|
|
1629
1616
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1630
1617
|
}
|
|
1631
|
-
},
|
|
1618
|
+
}, kr = class {
|
|
1632
1619
|
netY = 0;
|
|
1633
1620
|
travelX = 0;
|
|
1634
1621
|
engaged = !1;
|
|
@@ -1644,8 +1631,8 @@ var kr = 512, Ar = class {
|
|
|
1644
1631
|
}
|
|
1645
1632
|
return this.engaged;
|
|
1646
1633
|
}
|
|
1647
|
-
},
|
|
1648
|
-
function
|
|
1634
|
+
}, Ar = 1;
|
|
1635
|
+
function jr(e, t) {
|
|
1649
1636
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1650
1637
|
}
|
|
1651
1638
|
function G(e) {
|
|
@@ -1659,24 +1646,24 @@ function G(e) {
|
|
|
1659
1646
|
//#endregion
|
|
1660
1647
|
//#region src/plugins/registry.ts
|
|
1661
1648
|
var K = /* @__PURE__ */ new Map();
|
|
1662
|
-
function
|
|
1649
|
+
function Mr(e) {
|
|
1663
1650
|
K.set(G(e), e);
|
|
1664
1651
|
}
|
|
1665
|
-
function
|
|
1652
|
+
function Nr(e) {
|
|
1666
1653
|
return K.delete(e);
|
|
1667
1654
|
}
|
|
1668
|
-
function
|
|
1655
|
+
function Pr() {
|
|
1669
1656
|
return [...K.values()];
|
|
1670
1657
|
}
|
|
1671
|
-
function
|
|
1658
|
+
function Fr() {
|
|
1672
1659
|
K.clear();
|
|
1673
1660
|
}
|
|
1674
1661
|
//#endregion
|
|
1675
1662
|
//#region src/plugins/PluginManager.ts
|
|
1676
|
-
var
|
|
1663
|
+
var Ir = class {
|
|
1677
1664
|
plugins = /* @__PURE__ */ new Map();
|
|
1678
1665
|
constructor(e, t = {}) {
|
|
1679
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1666
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Pr()) this.add(e);
|
|
1680
1667
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1681
1668
|
}
|
|
1682
1669
|
register(e) {
|
|
@@ -1706,15 +1693,15 @@ var Rr = class {
|
|
|
1706
1693
|
add(e) {
|
|
1707
1694
|
this.plugins.set(G(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1708
1695
|
}
|
|
1709
|
-
},
|
|
1696
|
+
}, Lr = {
|
|
1710
1697
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1711
1698
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1712
1699
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1713
1700
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1714
1701
|
positionClose: (e, t) => e.closePosition(t),
|
|
1715
|
-
positionReverse: (e, t, n) =>
|
|
1702
|
+
positionReverse: (e, t, n) => Rr(e, t, n)
|
|
1716
1703
|
};
|
|
1717
|
-
async function
|
|
1704
|
+
async function Rr(e, t, n) {
|
|
1718
1705
|
let { reversing: r } = n;
|
|
1719
1706
|
if (!r.has(t.positionId)) {
|
|
1720
1707
|
r.add(t.positionId);
|
|
@@ -1743,7 +1730,7 @@ async function Br(e, t, n) {
|
|
|
1743
1730
|
}
|
|
1744
1731
|
}
|
|
1745
1732
|
}
|
|
1746
|
-
function
|
|
1733
|
+
function zr(e, t) {
|
|
1747
1734
|
let n = [], r = null, i = {
|
|
1748
1735
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1749
1736
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1753,8 +1740,8 @@ function Vr(e, t) {
|
|
|
1753
1740
|
e.data && t.onFill?.(e.data);
|
|
1754
1741
|
};
|
|
1755
1742
|
e.on("orders", a), e.on("positions", o), e.on("error", s), e.on("fill", c), n.push(() => e.off("orders", a), () => e.off("positions", o), () => e.off("error", s), () => e.off("fill", c));
|
|
1756
|
-
for (let r of Object.keys(
|
|
1757
|
-
let a =
|
|
1743
|
+
for (let r of Object.keys(Lr)) {
|
|
1744
|
+
let a = Lr[r], o = t.onIntent(r, (n) => {
|
|
1758
1745
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1759
1746
|
message: `Execution command failed: ${r}`,
|
|
1760
1747
|
cause: e
|
|
@@ -1768,7 +1755,7 @@ function Vr(e, t) {
|
|
|
1768
1755
|
}
|
|
1769
1756
|
//#endregion
|
|
1770
1757
|
//#region src/replay/ReplayStepLoader.ts
|
|
1771
|
-
var
|
|
1758
|
+
var Br = 1e3, Vr = class {
|
|
1772
1759
|
pieces = /* @__PURE__ */ new Map();
|
|
1773
1760
|
asked = /* @__PURE__ */ new Set();
|
|
1774
1761
|
inFlight = !1;
|
|
@@ -1801,7 +1788,7 @@ var Hr = 1e3, Ur = class {
|
|
|
1801
1788
|
this.done = !0;
|
|
1802
1789
|
}
|
|
1803
1790
|
ask(e, t) {
|
|
1804
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1791
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(Br / n)), s = Math.min(e.length, t + o), c = s < e.length ? e[s].time : e[e.length - 1].time + r, l = e.slice(t, s);
|
|
1805
1792
|
for (let e of l) this.asked.add(e.time);
|
|
1806
1793
|
this.inFlight = !0, a({
|
|
1807
1794
|
state: "loading",
|
|
@@ -1842,12 +1829,12 @@ var Hr = 1e3, Ur = class {
|
|
|
1842
1829
|
...n === void 0 ? {} : { error: n }
|
|
1843
1830
|
});
|
|
1844
1831
|
}
|
|
1845
|
-
},
|
|
1846
|
-
function
|
|
1847
|
-
let n = (e.high - e.low) *
|
|
1848
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1832
|
+
}, Hr = 1 / 3, Ur = .25, Wr = .5;
|
|
1833
|
+
function Gr(e, t) {
|
|
1834
|
+
let n = (e.high - e.low) * Ur;
|
|
1835
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * Wr;
|
|
1849
1836
|
}
|
|
1850
|
-
function
|
|
1837
|
+
function Kr(e) {
|
|
1851
1838
|
return e.close >= e.open ? [
|
|
1852
1839
|
e.open,
|
|
1853
1840
|
e.low,
|
|
@@ -1860,22 +1847,22 @@ function Jr(e) {
|
|
|
1860
1847
|
e.close
|
|
1861
1848
|
];
|
|
1862
1849
|
}
|
|
1863
|
-
function
|
|
1864
|
-
let r =
|
|
1850
|
+
function qr(e, t, n) {
|
|
1851
|
+
let r = Kr(e), i = [
|
|
1865
1852
|
1,
|
|
1866
1853
|
2,
|
|
1867
1854
|
3
|
|
1868
1855
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1869
1856
|
return r.forEach((r, c) => {
|
|
1870
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1857
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : Hr), !(c === 0 && t > 0) && o.push({
|
|
1871
1858
|
price: r,
|
|
1872
1859
|
time: e.time,
|
|
1873
1860
|
at: (t + s) / n
|
|
1874
1861
|
});
|
|
1875
1862
|
}), o;
|
|
1876
1863
|
}
|
|
1877
|
-
function
|
|
1878
|
-
let n = t.length > 0 &&
|
|
1864
|
+
function Jr(e, t = []) {
|
|
1865
|
+
let n = t.length > 0 && Gr(e, t) ? t : [e], r = n.length, i = Yr(n.flatMap((e, t) => qr(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1879
1866
|
return {
|
|
1880
1867
|
bar: e,
|
|
1881
1868
|
points: i,
|
|
@@ -1885,7 +1872,7 @@ function Xr(e, t = []) {
|
|
|
1885
1872
|
}))
|
|
1886
1873
|
};
|
|
1887
1874
|
}
|
|
1888
|
-
function
|
|
1875
|
+
function Yr(e, t) {
|
|
1889
1876
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1890
1877
|
...e,
|
|
1891
1878
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1900,7 +1887,7 @@ function Zr(e, t) {
|
|
|
1900
1887
|
};
|
|
1901
1888
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1902
1889
|
}
|
|
1903
|
-
function
|
|
1890
|
+
function Xr(e, t) {
|
|
1904
1891
|
let n = e.points;
|
|
1905
1892
|
if (t <= n[0].at) return n[0].price;
|
|
1906
1893
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1909,8 +1896,8 @@ function Qr(e, t) {
|
|
|
1909
1896
|
}
|
|
1910
1897
|
return n[n.length - 1].price;
|
|
1911
1898
|
}
|
|
1912
|
-
var
|
|
1913
|
-
function
|
|
1899
|
+
var Zr = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1900
|
+
function Qr(e, t) {
|
|
1914
1901
|
let n = 0, r = 0;
|
|
1915
1902
|
for (let i of e.volumeAt) {
|
|
1916
1903
|
if (t >= i.at) {
|
|
@@ -1921,10 +1908,10 @@ function ei(e, t) {
|
|
|
1921
1908
|
}
|
|
1922
1909
|
return n;
|
|
1923
1910
|
}
|
|
1924
|
-
function
|
|
1925
|
-
let n =
|
|
1911
|
+
function $r(e, t) {
|
|
1912
|
+
let n = Zr(t);
|
|
1926
1913
|
if (n >= 1) return { ...e.bar };
|
|
1927
|
-
let r =
|
|
1914
|
+
let r = Xr(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1928
1915
|
for (let t of e.points) {
|
|
1929
1916
|
if (t.at > n) break;
|
|
1930
1917
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1935,11 +1922,11 @@ function ti(e, t) {
|
|
|
1935
1922
|
high: i,
|
|
1936
1923
|
low: a,
|
|
1937
1924
|
close: r,
|
|
1938
|
-
volume:
|
|
1925
|
+
volume: Qr(e, n)
|
|
1939
1926
|
};
|
|
1940
1927
|
}
|
|
1941
|
-
function
|
|
1942
|
-
let n =
|
|
1928
|
+
function ei(e, t) {
|
|
1929
|
+
let n = Zr(t), r = 0;
|
|
1943
1930
|
for (let t of e.points) {
|
|
1944
1931
|
if (t.at > n) break;
|
|
1945
1932
|
r = t.at;
|
|
@@ -1952,12 +1939,12 @@ function q(e, t, n) {
|
|
|
1952
1939
|
if (a.at > n) break;
|
|
1953
1940
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1954
1941
|
}
|
|
1955
|
-
let a =
|
|
1942
|
+
let a = Xr(e, n);
|
|
1956
1943
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1957
1944
|
}
|
|
1958
1945
|
//#endregion
|
|
1959
1946
|
//#region src/replay/replayStep.ts
|
|
1960
|
-
var
|
|
1947
|
+
var ti = [
|
|
1961
1948
|
"1m",
|
|
1962
1949
|
"3m",
|
|
1963
1950
|
"5m",
|
|
@@ -1968,27 +1955,27 @@ var ri = [
|
|
|
1968
1955
|
"4h",
|
|
1969
1956
|
"1d"
|
|
1970
1957
|
];
|
|
1971
|
-
function
|
|
1972
|
-
let n =
|
|
1973
|
-
return n > 0 ?
|
|
1974
|
-
let r =
|
|
1958
|
+
function ni(e, t) {
|
|
1959
|
+
let n = T(e);
|
|
1960
|
+
return n > 0 ? ti.filter((e) => {
|
|
1961
|
+
let r = T(e);
|
|
1975
1962
|
return r < n && n % r === 0 && t(e);
|
|
1976
1963
|
}) : [];
|
|
1977
1964
|
}
|
|
1978
|
-
function
|
|
1979
|
-
let r =
|
|
1965
|
+
function ri(e, t, n) {
|
|
1966
|
+
let r = ni(t, n);
|
|
1980
1967
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1981
|
-
let i =
|
|
1982
|
-
return r.find((e) => i /
|
|
1968
|
+
let i = T(t);
|
|
1969
|
+
return r.find((e) => i / T(e) <= 60) ?? null;
|
|
1983
1970
|
}
|
|
1984
1971
|
//#endregion
|
|
1985
1972
|
//#region src/model/AlertWatch.ts
|
|
1986
|
-
function
|
|
1973
|
+
function ii(e, t) {
|
|
1987
1974
|
e.setBarTime(t.barTime);
|
|
1988
1975
|
let n = new Map([["price", t.price]]);
|
|
1989
|
-
t.lines &&
|
|
1976
|
+
t.lines && ai(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
1990
1977
|
}
|
|
1991
|
-
function
|
|
1978
|
+
function ai(e, t, n) {
|
|
1992
1979
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
1993
1980
|
for (let e of r) {
|
|
1994
1981
|
if (n.has(e)) continue;
|
|
@@ -1998,7 +1985,7 @@ function si(e, t, n) {
|
|
|
1998
1985
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
1999
1986
|
}
|
|
2000
1987
|
}
|
|
2001
|
-
function
|
|
1988
|
+
function oi(e, t, n, r) {
|
|
2002
1989
|
let i = (e) => {
|
|
2003
1990
|
let i = e.indexOf(":");
|
|
2004
1991
|
if (i <= 0) return null;
|
|
@@ -2020,35 +2007,35 @@ function ci(e, t, n, r) {
|
|
|
2020
2007
|
});
|
|
2021
2008
|
}
|
|
2022
2009
|
}
|
|
2023
|
-
function
|
|
2010
|
+
function si(e, t) {
|
|
2024
2011
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2025
2012
|
return r ? r + e.slice(n) : e;
|
|
2026
2013
|
}
|
|
2027
|
-
var
|
|
2014
|
+
var ci = [
|
|
2028
2015
|
"crossing",
|
|
2029
2016
|
"crossingUp",
|
|
2030
2017
|
"crossingDown"
|
|
2031
2018
|
];
|
|
2032
|
-
function
|
|
2019
|
+
function li(e, t, n, r, i) {
|
|
2033
2020
|
e.clearAlerts();
|
|
2034
2021
|
for (let a of t) {
|
|
2035
2022
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2036
2023
|
if (a.drawingId) {
|
|
2037
|
-
r(a.drawingId) &&
|
|
2024
|
+
r(a.drawingId) && ci.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2038
2025
|
continue;
|
|
2039
2026
|
}
|
|
2040
2027
|
let t = {
|
|
2041
2028
|
...Bt(a),
|
|
2042
|
-
...a.target ? { target:
|
|
2029
|
+
...a.target ? { target: si(a.target, n) } : {}
|
|
2043
2030
|
};
|
|
2044
2031
|
try {
|
|
2045
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2032
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, si(a.channel, n), a.label, t);
|
|
2046
2033
|
} catch (e) {
|
|
2047
2034
|
i(e);
|
|
2048
2035
|
}
|
|
2049
2036
|
}
|
|
2050
2037
|
}
|
|
2051
|
-
var
|
|
2038
|
+
var ui = class {
|
|
2052
2039
|
kept = /* @__PURE__ */ new Map();
|
|
2053
2040
|
constructor(e) {
|
|
2054
2041
|
this.alerts = e;
|
|
@@ -2081,18 +2068,18 @@ function Y(e, t) {
|
|
|
2081
2068
|
}
|
|
2082
2069
|
return n;
|
|
2083
2070
|
}
|
|
2084
|
-
function
|
|
2071
|
+
function di(e) {
|
|
2085
2072
|
let t = 0, n = 0;
|
|
2086
2073
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
2087
2074
|
let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
|
|
2088
2075
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
2089
2076
|
}
|
|
2090
|
-
function
|
|
2077
|
+
function fi(e) {
|
|
2091
2078
|
let t = [], n = Math.ceil(e.length / 500);
|
|
2092
|
-
for (let r = 0; r < e.length; r += n) t.push(...
|
|
2079
|
+
for (let r = 0; r < e.length; r += n) t.push(...di(e.slice(r, r + n)));
|
|
2093
2080
|
return t;
|
|
2094
2081
|
}
|
|
2095
|
-
function
|
|
2082
|
+
function pi(e, t, n) {
|
|
2096
2083
|
let r = e[t];
|
|
2097
2084
|
return r ? n.time === null ? {
|
|
2098
2085
|
marks: [[r.close, r.time]],
|
|
@@ -2101,14 +2088,14 @@ function hi(e, t, n) {
|
|
|
2101
2088
|
fraction: n.fraction
|
|
2102
2089
|
}
|
|
2103
2090
|
} : r.time <= n.time ? null : {
|
|
2104
|
-
marks:
|
|
2091
|
+
marks: fi(e.slice(Y(e, n.time), t + 1)),
|
|
2105
2092
|
fed: {
|
|
2106
2093
|
time: r.time,
|
|
2107
2094
|
fraction: n.fraction
|
|
2108
2095
|
}
|
|
2109
2096
|
} : null;
|
|
2110
2097
|
}
|
|
2111
|
-
function
|
|
2098
|
+
function mi(e, t, n, r, i, a) {
|
|
2112
2099
|
let o = e[t];
|
|
2113
2100
|
if (!o) return null;
|
|
2114
2101
|
let s = {
|
|
@@ -2116,7 +2103,7 @@ function gi(e, t, n, r, i, a) {
|
|
|
2116
2103
|
fraction: r
|
|
2117
2104
|
};
|
|
2118
2105
|
if (i.time === null) return {
|
|
2119
|
-
marks: [[
|
|
2106
|
+
marks: [[$r(n, r).close, o.time]],
|
|
2120
2107
|
fed: s
|
|
2121
2108
|
};
|
|
2122
2109
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
@@ -2125,36 +2112,36 @@ function gi(e, t, n, r, i, a) {
|
|
|
2125
2112
|
fed: s
|
|
2126
2113
|
};
|
|
2127
2114
|
let c = [], l = J(e, i.time);
|
|
2128
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...
|
|
2115
|
+
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...fi(e.slice(Y(e, i.time), t))), c.push(...q(n, -1, r)), {
|
|
2129
2116
|
marks: c,
|
|
2130
2117
|
fed: s
|
|
2131
2118
|
};
|
|
2132
2119
|
}
|
|
2133
2120
|
//#endregion
|
|
2134
2121
|
//#region src/Chart.ts
|
|
2135
|
-
var
|
|
2136
|
-
function
|
|
2137
|
-
if (typeof e == "string" && e !== "exchange" && !
|
|
2122
|
+
var hi = "exchange", gi = hi;
|
|
2123
|
+
function _i(e) {
|
|
2124
|
+
if (typeof e == "string" && e !== "exchange" && !b(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
2138
2125
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2139
2126
|
}
|
|
2140
|
-
function
|
|
2141
|
-
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r :
|
|
2127
|
+
function vi(e, t) {
|
|
2128
|
+
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : w(e);
|
|
2142
2129
|
return i === void 0 ? e : {
|
|
2143
2130
|
...e,
|
|
2144
2131
|
timeZone: i,
|
|
2145
2132
|
timezone: i
|
|
2146
2133
|
};
|
|
2147
2134
|
}
|
|
2148
|
-
var
|
|
2135
|
+
var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
2149
2136
|
ArrowLeft: [-1, 0],
|
|
2150
2137
|
ArrowRight: [1, 0],
|
|
2151
2138
|
ArrowUp: [0, -1],
|
|
2152
2139
|
ArrowDown: [0, 1]
|
|
2153
|
-
},
|
|
2154
|
-
static version = "1.
|
|
2140
|
+
}, wi = new Set(["horizontalLine", "crossLine"]), Ti = new Set(["verticalLine", "crossLine"]), Ei = class {
|
|
2141
|
+
static version = "1.72.1";
|
|
2155
2142
|
engine;
|
|
2156
2143
|
viewport;
|
|
2157
|
-
series = new
|
|
2144
|
+
series = new Rn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2158
2145
|
themeManager;
|
|
2159
2146
|
layoutManager;
|
|
2160
2147
|
pluginManager;
|
|
@@ -2177,9 +2164,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2177
2164
|
lastBackground = null;
|
|
2178
2165
|
renderScheduled = !1;
|
|
2179
2166
|
renderDeferred = !1;
|
|
2180
|
-
priceAxisWidth =
|
|
2167
|
+
priceAxisWidth = s;
|
|
2181
2168
|
measureCtx;
|
|
2182
|
-
labelWidths = new
|
|
2169
|
+
labelWidths = new Or();
|
|
2183
2170
|
containerSizeCache = null;
|
|
2184
2171
|
containerSizeCacheTime = 0;
|
|
2185
2172
|
lastEmittedRange = null;
|
|
@@ -2237,7 +2224,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2237
2224
|
replayForming = null;
|
|
2238
2225
|
replayPhaseUnsub = null;
|
|
2239
2226
|
undoRedoManager;
|
|
2240
|
-
autoSaveScheduler = new
|
|
2227
|
+
autoSaveScheduler = new kn((e) => this.saveState(e));
|
|
2241
2228
|
animator;
|
|
2242
2229
|
crosshairTooltip;
|
|
2243
2230
|
pinnedTooltip;
|
|
@@ -2258,7 +2245,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2258
2245
|
priceAxis;
|
|
2259
2246
|
leftPriceAxis = new nt();
|
|
2260
2247
|
leftScaleRequested = !1;
|
|
2261
|
-
leftAxisWidth =
|
|
2248
|
+
leftAxisWidth = s;
|
|
2262
2249
|
leftViewport = null;
|
|
2263
2250
|
timeAxis;
|
|
2264
2251
|
options;
|
|
@@ -2287,10 +2274,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2287
2274
|
snapshotKey = null;
|
|
2288
2275
|
historyCheckQueued = !1;
|
|
2289
2276
|
constructor(e, t) {
|
|
2290
|
-
t.timeZone != null &&
|
|
2277
|
+
t.timeZone != null && _i(t.timeZone), this.container = e, this.options = {
|
|
2291
2278
|
...t,
|
|
2292
2279
|
chartType: t.chartType ?? "candlestick"
|
|
2293
|
-
}, this.numberLocale = t.numberLocale ?? "en-US", this.priceFit = new
|
|
2280
|
+
}, this.numberLocale = t.numberLocale ?? "en-US", this.priceFit = new Vn(t.autoScale !== !1), this.display = new Wn({
|
|
2294
2281
|
bars: () => this.series.bars(),
|
|
2295
2282
|
version: () => this.series.version(),
|
|
2296
2283
|
chartType: () => this.options.chartType,
|
|
@@ -2336,27 +2323,27 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2336
2323
|
logScale: n.logScale ?? !0,
|
|
2337
2324
|
timeframes: n.timeframes ?? [],
|
|
2338
2325
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
2339
|
-
}, 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
|
|
2326
|
+
}, 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 pr({
|
|
2340
2327
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2341
2328
|
prepend: (e) => this.prependBars(e),
|
|
2342
2329
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2343
|
-
}), this.themeManager = new
|
|
2330
|
+
}), this.themeManager = new hr(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(_r(t), "host", !1), this.layoutManager = new br(), this.indicatorEngine = new Ve(), this.panes = new Kn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new Xn(this.indicatorEngine, this.layoutManager, {
|
|
2344
2331
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2345
2332
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2346
2333
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2347
|
-
}), this.symbolRequests = new
|
|
2348
|
-
this.syncRenderContext(), this.engine.requestRender(
|
|
2334
|
+
}), this.symbolRequests = new ar(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Ir(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ie(), Ht(this.indicatorEngine), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new gt(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.indicatorEngine.register(new De(this.symbolSeries)), this.drawingManager = new Ne(), Vt(this.drawingManager), this.drawingRenderer = new Pe(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingRenderer.setTimeFormat((e) => this.crosshairHandler.formatTime(e, this.getDisplayData())), this.drawingManager.setRequestRender(() => {
|
|
2335
|
+
this.syncRenderContext(), this.engine.requestRender(i.Overlay), this.scheduleAutoSave();
|
|
2349
2336
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2350
2337
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2351
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new wt(), this.indicatorHistory = new
|
|
2338
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new wt(), this.indicatorHistory = new Yn({
|
|
2352
2339
|
steps: this.undoRedoManager,
|
|
2353
2340
|
snapshot: () => this.getIndicatorSetup(),
|
|
2354
2341
|
enabled: () => this.features.drawingUndoRedo
|
|
2355
2342
|
});
|
|
2356
|
-
let
|
|
2343
|
+
let r = "";
|
|
2357
2344
|
this.undoRedoManager.setOnChange(() => {
|
|
2358
2345
|
let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
|
|
2359
|
-
n !==
|
|
2346
|
+
n !== r && (r = n, this.eventBus.emit("historyChange", {
|
|
2360
2347
|
canUndo: e,
|
|
2361
2348
|
canRedo: t
|
|
2362
2349
|
}));
|
|
@@ -2368,7 +2355,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2368
2355
|
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new St({
|
|
2369
2356
|
enabled: this.features.trading,
|
|
2370
2357
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
2371
|
-
}), this.tradingRenderer = new Ct(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(
|
|
2358
|
+
}), this.tradingRenderer = new Ct(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
2372
2359
|
this.eventBus.emit(e, t);
|
|
2373
2360
|
}), this.engine = new at(e, t.maxPixelRatio);
|
|
2374
2361
|
let a = this.engine.dprManager.getContainerSize();
|
|
@@ -2381,31 +2368,31 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2381
2368
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2382
2369
|
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Le(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new nt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new bt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Oe(), 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) => {
|
|
2383
2370
|
if (e !== null && t) {
|
|
2384
|
-
let n = this.crosshairSeries(),
|
|
2385
|
-
this.chartLegend.setHoverBar(
|
|
2371
|
+
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = A(n), s = r ? o[e]?.time ?? r.time : void 0;
|
|
2372
|
+
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(i.Hover);
|
|
2386
2373
|
let c = this.viewport.getState(), l = t.y >= c.chartRect.y && t.y <= c.chartRect.y + c.chartRect.height;
|
|
2387
|
-
if (
|
|
2388
|
-
let e = s ===
|
|
2389
|
-
...
|
|
2390
|
-
time: s ??
|
|
2374
|
+
if (r && l && this.features.crosshairTooltip) {
|
|
2375
|
+
let e = s === r.time ? r : {
|
|
2376
|
+
...r,
|
|
2377
|
+
time: s ?? r.time
|
|
2391
2378
|
};
|
|
2392
2379
|
this.crosshairTooltip.show(t, e, this.themeManager.getTheme(), this.cachedContainerSize(), {
|
|
2393
2380
|
prevClose: a,
|
|
2394
2381
|
priceRange: c.priceRange,
|
|
2395
2382
|
plot: c.chartRect,
|
|
2396
2383
|
barStepMs: jt(o),
|
|
2397
|
-
timeUnit:
|
|
2384
|
+
timeUnit: d(o)
|
|
2398
2385
|
});
|
|
2399
2386
|
} else this.crosshairTooltip.hide();
|
|
2400
|
-
this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(),
|
|
2387
|
+
this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
|
|
2401
2388
|
point: t,
|
|
2402
|
-
bar:
|
|
2389
|
+
bar: r,
|
|
2403
2390
|
barIndex: e,
|
|
2404
2391
|
...s === void 0 ? {} : { time: s },
|
|
2405
2392
|
...a === void 0 ? {} : { prevClose: a }
|
|
2406
2393
|
});
|
|
2407
2394
|
} else {
|
|
2408
|
-
this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.features.legend && this.engine.requestRender(
|
|
2395
|
+
this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.features.legend && this.engine.requestRender(i.Hover), this.eventBus.emit("crosshairLeave", {});
|
|
2409
2396
|
let e = this.crosshairHandler.getSyncedSlot();
|
|
2410
2397
|
e !== null && this.showSyncedBar(e);
|
|
2411
2398
|
}
|
|
@@ -2416,7 +2403,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2416
2403
|
color: t.sessionBreaks.color,
|
|
2417
2404
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
2418
2405
|
lineWidth: t.sessionBreaks.lineWidth
|
|
2419
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new ke(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new $e(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = ae(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(
|
|
2406
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new ke(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new $e(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = ae(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Ai(t.shapes)), t.font && this.themeManager.setFont(ki(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new We({
|
|
2420
2407
|
scrollBars: (e) => {
|
|
2421
2408
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2422
2409
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2464,7 +2451,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2464
2451
|
}
|
|
2465
2452
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2466
2453
|
}
|
|
2467
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ae(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new me(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(
|
|
2454
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ae(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new me(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.drawingAlerts = new ui(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(Pt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2468
2455
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2469
2456
|
kind: "alert",
|
|
2470
2457
|
alert: "triggered",
|
|
@@ -2480,7 +2467,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2480
2467
|
this.eventBus.emit("alertExpired", X(e));
|
|
2481
2468
|
}), this.alertManager.on("updated", (e) => {
|
|
2482
2469
|
this.eventBus.emit("alertUpdate", X(e));
|
|
2483
|
-
}), this.signalMarkerManager = new ht(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(
|
|
2470
|
+
}), this.signalMarkerManager = new ht(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
2484
2471
|
this.eventBus.emit("signalMarkerAdd", {
|
|
2485
2472
|
id: e.id,
|
|
2486
2473
|
source: e.source,
|
|
@@ -2488,7 +2475,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2488
2475
|
});
|
|
2489
2476
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
2490
2477
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
2491
|
-
}), this.tradeZoneManager = new xt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(
|
|
2478
|
+
}), this.tradeZoneManager = new xt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
2492
2479
|
this.eventBus.emit("tradeZoneAdd", {
|
|
2493
2480
|
id: e.id,
|
|
2494
2481
|
direction: e.direction
|
|
@@ -2504,7 +2491,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2504
2491
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2505
2492
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2506
2493
|
}), this.measureOverlay = new Je(), this.interactionManager = new He(e), this.features.panning) {
|
|
2507
|
-
let e = new
|
|
2494
|
+
let e = new kr();
|
|
2508
2495
|
this.interactionManager.setPanHandler(new Xe((t, n) => {
|
|
2509
2496
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2510
2497
|
}, () => e.reset()));
|
|
@@ -2562,8 +2549,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2562
2549
|
o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
|
|
2563
2550
|
let t = this.getDisplayData();
|
|
2564
2551
|
if (t.length === 0) return;
|
|
2565
|
-
let n = this.viewport.getState(),
|
|
2566
|
-
a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme(),
|
|
2552
|
+
let n = this.viewport.getState(), r = n.barWidth + n.barSpacing, a = Math.round((n.offset + e.x) / r);
|
|
2553
|
+
a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme(), d(t), f(t) === !0), this.pinnedTooltip.reposition(this.viewport.getState(), this.series.bars()[a] ?? null, a, this.themeManager.getTheme()), this.engine.requestRender(i.Overlay));
|
|
2567
2554
|
}), 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", {
|
|
2568
2555
|
marker: e,
|
|
2569
2556
|
x: t.x,
|
|
@@ -2600,7 +2587,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2600
2587
|
});
|
|
2601
2588
|
return;
|
|
2602
2589
|
}
|
|
2603
|
-
this.pinnedTooltip.isPinned() && (this.pinnedTooltip.unpin(), this.engine.requestRender(
|
|
2590
|
+
this.pinnedTooltip.isPinned() && (this.pinnedTooltip.unpin(), this.engine.requestRender(i.Overlay));
|
|
2604
2591
|
}), this.interactionManager.setConfirmHandler(() => this.features.trading && this.tradingManager.isBracketActive() ? (this.tradingManager.confirmBracket(), !0) : !1), this.interactionManager.setMeasureHandlers({
|
|
2605
2592
|
begin: (e) => {
|
|
2606
2593
|
this.measureOverlay.begin(e, this.viewport.getState(), this.getDisplayData());
|
|
@@ -2627,7 +2614,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2627
2614
|
end: () => {
|
|
2628
2615
|
let e = this.selectionBoxOverlay.end();
|
|
2629
2616
|
if (e && this.zoomAreaMode) {
|
|
2630
|
-
if (e.x1 - e.x0 <
|
|
2617
|
+
if (e.x1 - e.x0 < xi) return;
|
|
2631
2618
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
2632
2619
|
return;
|
|
2633
2620
|
}
|
|
@@ -2639,13 +2626,13 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2639
2626
|
s !== null && (e.isClick ? this.drawingManager.toggleSelectionAt({
|
|
2640
2627
|
x: e.x1,
|
|
2641
2628
|
y: e.y1
|
|
2642
|
-
}, t) : this.drawingManager.selectInRect(e, t, s), this.engine.requestRender(
|
|
2629
|
+
}, t) : this.drawingManager.selectInRect(e, t, s), this.engine.requestRender(i.Overlay));
|
|
2643
2630
|
},
|
|
2644
2631
|
cancel: () => {
|
|
2645
2632
|
this.selectionBoxOverlay.cancel(), this.setZoomAreaMode(!1);
|
|
2646
2633
|
}
|
|
2647
2634
|
}), this.interactionManager.setOverlayDirtyCallback((e) => {
|
|
2648
|
-
this.engine.requestRender(e ?
|
|
2635
|
+
this.engine.requestRender(e ? i.Hover : i.Overlay);
|
|
2649
2636
|
}), this.interactionManager.setPageScroll(t.pageScroll ?? !1), this.interactionManager.attach(), t.timeZone !== void 0 && t.timeZone !== null && this.setTimeZone(t.timeZone), t.leftPriceScale && (this.leftScaleRequested = !0), this.syncRenderContext(), this.engine.start(), this.watchVisibility(e, t.pauseWhenHidden !== !1), this.engine.onGpuLost = () => this.eventBus.emit("rendererChange", {
|
|
2650
2637
|
renderer: "canvas",
|
|
2651
2638
|
reason: "contextLost"
|
|
@@ -2669,7 +2656,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2669
2656
|
loadDuringReplay(e) {
|
|
2670
2657
|
this.snapshotKey = null, this.history.reset(), this.alertManager.clearLastValues();
|
|
2671
2658
|
let t = e[e.length - 1];
|
|
2672
|
-
t &&
|
|
2659
|
+
t && z(t) && this.alertManager.seedLastValue("price", t.close), this.replaySession && (this.replaySession.price = null), this.series.load(e);
|
|
2673
2660
|
}
|
|
2674
2661
|
prependBars(e) {
|
|
2675
2662
|
if (this.replaySession) return this.series.prepend(e).taken;
|
|
@@ -2677,7 +2664,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2677
2664
|
if (i === 0) return a;
|
|
2678
2665
|
let o = this.series.bars();
|
|
2679
2666
|
if (this.crosshairHandler.setData(o), this.display.reset(), this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), r !== void 0) {
|
|
2680
|
-
let e = Math.round(
|
|
2667
|
+
let e = Math.round(N(r, this.getDisplayData()));
|
|
2681
2668
|
this.viewport.prependBars(e - n);
|
|
2682
2669
|
}
|
|
2683
2670
|
return this.updateViewportAndRender(), a;
|
|
@@ -2705,16 +2692,16 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2705
2692
|
}
|
|
2706
2693
|
checkHistory() {
|
|
2707
2694
|
this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
|
|
2708
|
-
if (this.historyCheckQueued = !1, !this.replayPages() || !this.history.hasLoader() ||
|
|
2695
|
+
if (this.historyCheckQueued = !1, !this.replayPages() || !this.history.hasLoader() || L(this.options.chartType)) return;
|
|
2709
2696
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2710
2697
|
if (t.width <= 0) return;
|
|
2711
2698
|
let { from: n, to: r } = e;
|
|
2712
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2699
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(bi, r - n));
|
|
2713
2700
|
}));
|
|
2714
2701
|
}
|
|
2715
2702
|
useStreamHistory(e, t, n = !0) {
|
|
2716
2703
|
if (this.hostHistoryLoader) return;
|
|
2717
|
-
let r =
|
|
2704
|
+
let r = P(e), i = r.fetchHistoryBefore, a = this.streamTimeframe;
|
|
2718
2705
|
if (!i || a === null || de(a) !== null) {
|
|
2719
2706
|
this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
|
|
2720
2707
|
return;
|
|
@@ -2723,7 +2710,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2723
2710
|
this.history.setLoader((e, t) => i.call(r, o, a, e, t), t), this.historyFromStream = !0, n && this.checkHistory();
|
|
2724
2711
|
}
|
|
2725
2712
|
appendBar(e) {
|
|
2726
|
-
if (!
|
|
2713
|
+
if (!z(e)) return;
|
|
2727
2714
|
let t = this.series.append(e);
|
|
2728
2715
|
if (t.to !== "shown") {
|
|
2729
2716
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -2733,7 +2720,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2733
2720
|
this.crosshairHandler.setData(i), 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);
|
|
2734
2721
|
}
|
|
2735
2722
|
appendBars(e) {
|
|
2736
|
-
if (e = e.filter(
|
|
2723
|
+
if (e = e.filter(z), e.length === 0) return;
|
|
2737
2724
|
let t = e[e.length - 1].close, n = this.series.appendMany(e);
|
|
2738
2725
|
if (n.shown === 0) {
|
|
2739
2726
|
this.takeLivePrice(t), n.aside || this.scheduleRender();
|
|
@@ -2743,7 +2730,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2743
2730
|
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);
|
|
2744
2731
|
}
|
|
2745
2732
|
updateLastBar(e) {
|
|
2746
|
-
if (!
|
|
2733
|
+
if (!z(e)) return;
|
|
2747
2734
|
let t = this.series.updateLast(e);
|
|
2748
2735
|
if (t.to !== "shown") {
|
|
2749
2736
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -2765,7 +2752,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2765
2752
|
this.recalcIndicatorsFrom(n, n.length - 1), this.followLivePrice(e.price), this.scheduleRender();
|
|
2766
2753
|
}
|
|
2767
2754
|
updateBar(e) {
|
|
2768
|
-
if (!
|
|
2755
|
+
if (!z(e)) return !1;
|
|
2769
2756
|
let t = this.series.replace(e);
|
|
2770
2757
|
return t.to === "none" ? !1 : (t.to === "shown" && t.changed && this.showCorrection(t.index), !0);
|
|
2771
2758
|
}
|
|
@@ -2783,7 +2770,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2783
2770
|
let r = this.isTimeAligned();
|
|
2784
2771
|
if (r && t >= e) {
|
|
2785
2772
|
let e = this.getDisplayData();
|
|
2786
|
-
e[t] && this.pinnedTooltip.pin(e[t], t, this.themeManager.getTheme(),
|
|
2773
|
+
e[t] && this.pinnedTooltip.pin(e[t], t, this.themeManager.getTheme(), d(e), f(e) === !0);
|
|
2787
2774
|
}
|
|
2788
2775
|
n !== null && (!r || n === e || n === e + 1) && this.crosshairHandler.refresh();
|
|
2789
2776
|
}
|
|
@@ -2799,12 +2786,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2799
2786
|
}
|
|
2800
2787
|
fitFewColumns() {
|
|
2801
2788
|
let e = this.options.chartType;
|
|
2802
|
-
if (!
|
|
2789
|
+
if (!L(e) || this.pluginManager.getChartType(e)) return;
|
|
2803
2790
|
let t = this.getDisplayData().length, { chartRect: n, barWidth: r, barSpacing: i } = this.viewport.getState(), a = n.width / (r + i);
|
|
2804
2791
|
t > 0 && a > t + this.viewport.getRightMargin() && this.fitContent();
|
|
2805
2792
|
}
|
|
2806
2793
|
applyTimeSpacing() {
|
|
2807
|
-
let e = !this.tickStream && !
|
|
2794
|
+
let e = !this.tickStream && !L(this.options.chartType);
|
|
2808
2795
|
this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
|
|
2809
2796
|
}
|
|
2810
2797
|
setChartTypeOptions(e) {
|
|
@@ -2834,7 +2821,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2834
2821
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2835
2822
|
}
|
|
2836
2823
|
setShapes(e) {
|
|
2837
|
-
let t =
|
|
2824
|
+
let t = Ai(e);
|
|
2838
2825
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2839
2826
|
...this.themeManager.getTheme().shape,
|
|
2840
2827
|
...t
|
|
@@ -2846,7 +2833,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2846
2833
|
setFont(e) {
|
|
2847
2834
|
if (e === null) this.themeManager.setFont(null);
|
|
2848
2835
|
else {
|
|
2849
|
-
let t =
|
|
2836
|
+
let t = ki(e);
|
|
2850
2837
|
if (Object.keys(t).length === 0) return;
|
|
2851
2838
|
this.themeManager.setFont(t);
|
|
2852
2839
|
}
|
|
@@ -2874,7 +2861,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2874
2861
|
return this.priceLines.isHighLowVisible();
|
|
2875
2862
|
}
|
|
2876
2863
|
setBidAsk(e) {
|
|
2877
|
-
this.priceLines.setBidAsk(e), this.engine.requestRender(
|
|
2864
|
+
this.priceLines.setBidAsk(e), this.engine.requestRender(i.Overlay);
|
|
2878
2865
|
}
|
|
2879
2866
|
getBidAsk() {
|
|
2880
2867
|
return this.priceLines.getBidAsk();
|
|
@@ -2962,8 +2949,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2962
2949
|
return {
|
|
2963
2950
|
...e,
|
|
2964
2951
|
priceRange: {
|
|
2965
|
-
min: t.min - n *
|
|
2966
|
-
max: t.max + n *
|
|
2952
|
+
min: t.min - n * yi,
|
|
2953
|
+
max: t.max + n * yi
|
|
2967
2954
|
},
|
|
2968
2955
|
logScale: !1,
|
|
2969
2956
|
scaleMode: "regular",
|
|
@@ -3153,14 +3140,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3153
3140
|
}), n;
|
|
3154
3141
|
}
|
|
3155
3142
|
isTimeAligned() {
|
|
3156
|
-
return
|
|
3143
|
+
return L(this.options.chartType) ? !1 : this.getDisplayData().length === this.series.length();
|
|
3157
3144
|
}
|
|
3158
3145
|
roundPrice(e) {
|
|
3159
3146
|
if (!Number.isFinite(e)) return e;
|
|
3160
3147
|
let t = this.stepAt(e);
|
|
3161
3148
|
if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ue(t)));
|
|
3162
3149
|
let { min: n, max: r } = this.viewport.getState().priceRange;
|
|
3163
|
-
return Number(e.toFixed(this.marketPricePrecision ??
|
|
3150
|
+
return Number(e.toFixed(this.marketPricePrecision ?? l(n, r)));
|
|
3164
3151
|
}
|
|
3165
3152
|
lastClose() {
|
|
3166
3153
|
let e = this.series.bars();
|
|
@@ -3173,7 +3160,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3173
3160
|
getPriceStep(e) {
|
|
3174
3161
|
let t = this.stepAt(e ?? this.lastClose());
|
|
3175
3162
|
if (t !== void 0) return t;
|
|
3176
|
-
let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ??
|
|
3163
|
+
let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ?? l(n, r);
|
|
3177
3164
|
return Number((10 ** -i).toFixed(i));
|
|
3178
3165
|
}
|
|
3179
3166
|
setPriceFormat(e) {
|
|
@@ -3183,7 +3170,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3183
3170
|
return this.priceFormatter;
|
|
3184
3171
|
}
|
|
3185
3172
|
applyPriceFormat(e) {
|
|
3186
|
-
this.priceFormatter = ne(e), this.priceUnit = e && typeof e != "function" ?
|
|
3173
|
+
this.priceFormatter = ne(e), this.priceUnit = e && typeof e != "function" ? v(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
|
|
3187
3174
|
}
|
|
3188
3175
|
setTimeFormatter(e) {
|
|
3189
3176
|
this.applyTimeFormatter(e), this.engine.requestRender();
|
|
@@ -3194,7 +3181,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3194
3181
|
formatPrice(e) {
|
|
3195
3182
|
if (this.priceFormatter) return this.priceFormatter(e);
|
|
3196
3183
|
let { min: t, max: n } = this.viewport.getState().priceRange;
|
|
3197
|
-
return
|
|
3184
|
+
return _(e, this.marketPricePrecision ?? l(t, n), this.numberLocale);
|
|
3198
3185
|
}
|
|
3199
3186
|
setDrawingTool(e) {
|
|
3200
3187
|
this.features.drawings && (e && this.features.drawingTools.length > 0 && !this.features.drawingTools.includes(e) || (e && this.setZoomAreaMode(!1), this.drawingManager.setActiveTool(e)));
|
|
@@ -3255,9 +3242,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3255
3242
|
return this.drawingManager.removeDrawings(e);
|
|
3256
3243
|
}
|
|
3257
3244
|
nudgeSelectedDrawings(e) {
|
|
3258
|
-
let t =
|
|
3245
|
+
let t = Ci[e.key];
|
|
3259
3246
|
if (!t || !this.features.drawings || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
3260
|
-
let n = e.shiftKey ?
|
|
3247
|
+
let n = e.shiftKey ? Si : 1, r = {
|
|
3261
3248
|
...this.viewport.getState(),
|
|
3262
3249
|
data: this.getDisplayData()
|
|
3263
3250
|
};
|
|
@@ -3398,7 +3385,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3398
3385
|
x: t.x,
|
|
3399
3386
|
y: t.y
|
|
3400
3387
|
};
|
|
3401
|
-
if ((e === "plot" || e === "priceAxis") && (r.price = Zt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time =
|
|
3388
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = Zt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
|
|
3402
3389
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
3403
3390
|
e && (r.pane = e.instanceId);
|
|
3404
3391
|
}
|
|
@@ -3409,7 +3396,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3409
3396
|
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Ye : 0);
|
|
3410
3397
|
}
|
|
3411
3398
|
setPriceAxisAddButton(e) {
|
|
3412
|
-
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(
|
|
3399
|
+
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(i.Overlay);
|
|
3413
3400
|
}
|
|
3414
3401
|
setEraserMode(e) {
|
|
3415
3402
|
e && this.setZoomAreaMode(!1), this.drawingManager.setEraser(e && this.features.drawings);
|
|
@@ -3428,7 +3415,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3428
3415
|
...this.viewport.getState(),
|
|
3429
3416
|
data: this.getDisplayData()
|
|
3430
3417
|
};
|
|
3431
|
-
this.setVisibleRange(
|
|
3418
|
+
this.setVisibleRange(F(e.x0, t), F(e.x1, t));
|
|
3432
3419
|
}
|
|
3433
3420
|
lockAllDrawings() {
|
|
3434
3421
|
this.drawingManager.lockAllDrawings();
|
|
@@ -3458,50 +3445,50 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3458
3445
|
range: "all"
|
|
3459
3446
|
});
|
|
3460
3447
|
}
|
|
3461
|
-
getExportData(
|
|
3462
|
-
let
|
|
3463
|
-
if (
|
|
3448
|
+
getExportData(t = {}) {
|
|
3449
|
+
let n = this.exportBars(), r = 0, i = n.length - 1;
|
|
3450
|
+
if (t.range === "visible") {
|
|
3464
3451
|
let { visibleRange: e } = this.viewport.getState();
|
|
3465
|
-
|
|
3452
|
+
r = Math.max(0, e.from), i = Math.min(n.length - 1, e.to);
|
|
3466
3453
|
}
|
|
3467
|
-
let
|
|
3468
|
-
if (
|
|
3469
|
-
bars:
|
|
3454
|
+
let a = n.slice(r, i + 1);
|
|
3455
|
+
if (t.indicators === !1) return {
|
|
3456
|
+
bars: a,
|
|
3470
3457
|
columns: []
|
|
3471
3458
|
};
|
|
3472
|
-
let
|
|
3473
|
-
for (let
|
|
3474
|
-
let
|
|
3475
|
-
if (!
|
|
3476
|
-
let
|
|
3459
|
+
let o = [];
|
|
3460
|
+
for (let t of this.indicatorEngine.getActiveIndicators()) {
|
|
3461
|
+
let n = this.indicatorEngine.getOutput(t.instanceId)?.series;
|
|
3462
|
+
if (!n) continue;
|
|
3463
|
+
let i = e(t.id, t.params, t.descriptor.defaultConfig, t.descriptor.shortName), s = t.descriptor.plots ?? Object.keys(n.find((e) => e) ?? {}).map((e) => ({
|
|
3477
3464
|
key: e,
|
|
3478
3465
|
title: e
|
|
3479
3466
|
}));
|
|
3480
|
-
for (let e of
|
|
3481
|
-
let
|
|
3482
|
-
|
|
3483
|
-
name: `${
|
|
3484
|
-
values:
|
|
3467
|
+
for (let e of s) {
|
|
3468
|
+
let t = s.length > 1 ? ` ${e.title ?? e.key}` : "";
|
|
3469
|
+
o.push({
|
|
3470
|
+
name: `${i}${t}`,
|
|
3471
|
+
values: a.map((t, i) => n[r + i]?.[e.key] ?? null)
|
|
3485
3472
|
});
|
|
3486
3473
|
}
|
|
3487
3474
|
}
|
|
3488
|
-
let
|
|
3489
|
-
for (let e of
|
|
3490
|
-
let t = (
|
|
3491
|
-
|
|
3475
|
+
let s = /* @__PURE__ */ new Map();
|
|
3476
|
+
for (let e of o) {
|
|
3477
|
+
let t = (s.get(e.name) ?? 0) + 1;
|
|
3478
|
+
s.set(e.name, t), t > 1 && (e.name = `${e.name} (${t})`);
|
|
3492
3479
|
}
|
|
3493
3480
|
return {
|
|
3494
|
-
bars:
|
|
3495
|
-
columns:
|
|
3481
|
+
bars: a,
|
|
3482
|
+
columns: o
|
|
3496
3483
|
};
|
|
3497
3484
|
}
|
|
3498
3485
|
getExportText(e = "csv", t = {}) {
|
|
3499
3486
|
let { bars: n, columns: r } = this.getExportData(t);
|
|
3500
|
-
return e === "json" ?
|
|
3487
|
+
return e === "json" ? D.toJSON(n, r) : D.toCSV(n, r);
|
|
3501
3488
|
}
|
|
3502
3489
|
download(e, t, n) {
|
|
3503
3490
|
let r = this.getExportText(e, n);
|
|
3504
|
-
e === "json" ?
|
|
3491
|
+
e === "json" ? D.download(r, t ?? "chart-data.json", "application/json") : D.download(r, t ?? "chart-data.csv", "text/csv");
|
|
3505
3492
|
}
|
|
3506
3493
|
setAutoSave(e, t = 5e3) {
|
|
3507
3494
|
this.autoSaveScheduler.enable(e, t);
|
|
@@ -3664,7 +3651,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3664
3651
|
}
|
|
3665
3652
|
checkAlerts(e) {
|
|
3666
3653
|
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.replaySession || this.series.length() === 0 ? null : (e) => this.indicatorEngine.getOutput(e)?.series;
|
|
3667
|
-
|
|
3654
|
+
ii(this.alertManager, {
|
|
3668
3655
|
price: e,
|
|
3669
3656
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3670
3657
|
lines: n
|
|
@@ -3679,12 +3666,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3679
3666
|
adapter: Ut(e),
|
|
3680
3667
|
feed: void 0
|
|
3681
3668
|
};
|
|
3682
|
-
if (!
|
|
3669
|
+
if (!j(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
3683
3670
|
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new vt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (e) => {
|
|
3684
3671
|
let n = this.streamSeriesKey(t.adapter);
|
|
3685
3672
|
n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(e) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(e) : (this.replaySession && this.useStreamHistory(t.adapter, t.historyPageSize, !1), this.setData(e)), this.snapshotKey = n, this.useStreamHistory(t.adapter, t.historyPageSize);
|
|
3686
3673
|
}), this.streamManager.on("barClose", (e) => {
|
|
3687
|
-
if (!
|
|
3674
|
+
if (!z(e)) return;
|
|
3688
3675
|
let t = this.series.placeStreamBar(e);
|
|
3689
3676
|
if (t.to === "none") {
|
|
3690
3677
|
this.updateBar(e);
|
|
@@ -3696,7 +3683,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3696
3683
|
}), this.streamManager.on("barCorrection", (e) => {
|
|
3697
3684
|
this.updateBar(e);
|
|
3698
3685
|
}), this.streamManager.on("barUpdate", (e) => {
|
|
3699
|
-
if (!
|
|
3686
|
+
if (!z(e)) return;
|
|
3700
3687
|
let t = this.series.placeStreamBar(e);
|
|
3701
3688
|
if (t.to === "none" || (this.replaySession || this.currentPriceLine.setPrice(e.close), this.replaySession)) return;
|
|
3702
3689
|
let n = t.before;
|
|
@@ -3721,7 +3708,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3721
3708
|
};
|
|
3722
3709
|
return;
|
|
3723
3710
|
}
|
|
3724
|
-
this.currentPriceLine.setPrice(e, t ?? void 0), this.engine.requestRender(
|
|
3711
|
+
this.currentPriceLine.setPrice(e, t ?? void 0), this.engine.requestRender(i.Overlay);
|
|
3725
3712
|
}
|
|
3726
3713
|
}), this.streamManager.on("connectionChange", (e) => {
|
|
3727
3714
|
this.eventBus.emit("dataUpdate", {
|
|
@@ -3736,13 +3723,13 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3736
3723
|
}), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = t.autoScroll !== !1, this.setStreamTarget(t.symbol, t.timeframe), this.streamAdapter = t.adapter;
|
|
3737
3724
|
let n = this.streamManager;
|
|
3738
3725
|
if (this.resolveStreamSymbol(t.adapter, t.symbol), await n.connect(t), this.streamManager !== n) return;
|
|
3739
|
-
let
|
|
3740
|
-
this.barCountdown.setTimeframeMs(
|
|
3741
|
-
this.barCountdown.isVisible() && this.engine.requestRender(
|
|
3726
|
+
let r = T(t.timeframe);
|
|
3727
|
+
this.barCountdown.setTimeframeMs(r), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
|
|
3728
|
+
this.barCountdown.isVisible() && this.engine.requestRender(i.Hover);
|
|
3742
3729
|
}, 1e3);
|
|
3743
3730
|
}
|
|
3744
3731
|
streamSeriesKey(e) {
|
|
3745
|
-
let t =
|
|
3732
|
+
let t = P(e), n = this.streamTimeframe, r = t instanceof ct && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3746
3733
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3747
3734
|
}
|
|
3748
3735
|
setStreamTarget(e, t) {
|
|
@@ -3753,7 +3740,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3753
3740
|
})), this.useTimeframe(t);
|
|
3754
3741
|
}
|
|
3755
3742
|
setDataTimeframe(e) {
|
|
3756
|
-
this.streamManager || (this.useTimeframe(e), this.engine.requestRender(
|
|
3743
|
+
this.streamManager || (this.useTimeframe(e), this.engine.requestRender(i.Hover));
|
|
3757
3744
|
}
|
|
3758
3745
|
useTimeframe(e) {
|
|
3759
3746
|
let t = this.announcedTimeframe;
|
|
@@ -3765,8 +3752,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3765
3752
|
async switchStream(e, t) {
|
|
3766
3753
|
if (!this.streamManager) return;
|
|
3767
3754
|
let n = this.streamAdapter;
|
|
3768
|
-
if (n && !
|
|
3769
|
-
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(
|
|
3755
|
+
if (n && !j(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
3756
|
+
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(T(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
|
|
3770
3757
|
}
|
|
3771
3758
|
isIndicatorAllowed(e) {
|
|
3772
3759
|
let t = this.features.indicatorIds;
|
|
@@ -3785,7 +3772,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3785
3772
|
}
|
|
3786
3773
|
connectExecution(e, t = {}) {
|
|
3787
3774
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3788
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3775
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = zr(e, {
|
|
3789
3776
|
onIntent: (e, t) => {
|
|
3790
3777
|
let n = (e) => t(e.payload);
|
|
3791
3778
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -3809,13 +3796,13 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3809
3796
|
return this.executionAdapter;
|
|
3810
3797
|
}
|
|
3811
3798
|
setBarCountdownVisible(e) {
|
|
3812
|
-
this.barCountdown.setVisible(e && this.features.barCountdown), this.engine.requestRender(
|
|
3799
|
+
this.barCountdown.setVisible(e && this.features.barCountdown), this.engine.requestRender(i.Hover);
|
|
3813
3800
|
}
|
|
3814
3801
|
isBarCountdownVisible() {
|
|
3815
3802
|
return this.barCountdown.isVisible();
|
|
3816
3803
|
}
|
|
3817
3804
|
setSessionBreaksVisible(e) {
|
|
3818
|
-
this.sessionBreaks.setVisible(e), this.engine.requestRender(
|
|
3805
|
+
this.sessionBreaks.setVisible(e), this.engine.requestRender(i.Background);
|
|
3819
3806
|
}
|
|
3820
3807
|
addCompareSymbol(e, t, n, r) {
|
|
3821
3808
|
this.features.compareSymbols && (this.compareRenderer.addSymbol({
|
|
@@ -3888,7 +3875,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3888
3875
|
return this.viewport.getScaleMode();
|
|
3889
3876
|
}
|
|
3890
3877
|
setSessionBreaksConfig(e) {
|
|
3891
|
-
this.sessionBreaks.setConfig(e), this.engine.requestRender(
|
|
3878
|
+
this.sessionBreaks.setConfig(e), this.engine.requestRender(i.Background);
|
|
3892
3879
|
}
|
|
3893
3880
|
getConnectionState() {
|
|
3894
3881
|
return this.streamManager?.getConnectionState() ?? "disconnected";
|
|
@@ -3910,18 +3897,18 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3910
3897
|
goToTime(e) {
|
|
3911
3898
|
let t = this.getDisplayData();
|
|
3912
3899
|
if (t.length === 0 || !Number.isFinite(e)) return -1;
|
|
3913
|
-
let n = Math.max(0, Math.min(t.length - 1, Math.floor(
|
|
3900
|
+
let n = Math.max(0, Math.min(t.length - 1, Math.floor(N(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
|
|
3914
3901
|
return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
|
|
3915
3902
|
}
|
|
3916
3903
|
setVisibleRangePreset(e) {
|
|
3917
3904
|
let t = this.getDisplayData();
|
|
3918
3905
|
if (t.length === 0) return;
|
|
3919
|
-
let n = t.length - 1, r =
|
|
3906
|
+
let n = t.length - 1, r = d(t), i = zt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
3920
3907
|
if (a === null || a < t[0].time) {
|
|
3921
3908
|
this.fitContent();
|
|
3922
3909
|
return;
|
|
3923
3910
|
}
|
|
3924
|
-
let o =
|
|
3911
|
+
let o = N(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
|
|
3925
3912
|
this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
|
|
3926
3913
|
}
|
|
3927
3914
|
scrollToEnd() {
|
|
@@ -3946,7 +3933,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3946
3933
|
setVisibleRange(e, t) {
|
|
3947
3934
|
let n = this.getDisplayData();
|
|
3948
3935
|
if (n.length === 0) return;
|
|
3949
|
-
let r =
|
|
3936
|
+
let r = N(Math.min(e, t), n), i = N(Math.max(e, t), n);
|
|
3950
3937
|
this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
|
|
3951
3938
|
}
|
|
3952
3939
|
suspend() {
|
|
@@ -4083,7 +4070,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4083
4070
|
this.watermark.setConfig({
|
|
4084
4071
|
text: e,
|
|
4085
4072
|
...t
|
|
4086
|
-
}), this.engine.requestRender(
|
|
4073
|
+
}), this.engine.requestRender(i.Background);
|
|
4087
4074
|
}
|
|
4088
4075
|
setAutoScale(e) {
|
|
4089
4076
|
this.priceFit.setAuto(e, this.series.length() > 0), this.updateViewportAndRender();
|
|
@@ -4095,17 +4082,17 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4095
4082
|
return this.priceFit.isAuto();
|
|
4096
4083
|
}
|
|
4097
4084
|
setCrosshairMode(e) {
|
|
4098
|
-
this.crosshairHandler.setMode(e), this.engine.requestRender(
|
|
4085
|
+
this.crosshairHandler.setMode(e), this.engine.requestRender(i.Hover);
|
|
4099
4086
|
}
|
|
4100
4087
|
getCrosshairMode() {
|
|
4101
4088
|
return this.crosshairHandler.getMode();
|
|
4102
4089
|
}
|
|
4103
4090
|
setCrosshairPosition(e) {
|
|
4104
|
-
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(
|
|
4091
|
+
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(i.Hover);
|
|
4105
4092
|
}
|
|
4106
4093
|
setCrosshairTime(e) {
|
|
4107
|
-
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(
|
|
4108
|
-
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.showSyncedBar(n), this.engine.requestRender(
|
|
4094
|
+
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(N(e, t));
|
|
4095
|
+
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.showSyncedBar(n), this.engine.requestRender(i.Hover));
|
|
4109
4096
|
}
|
|
4110
4097
|
showSyncedBar(e) {
|
|
4111
4098
|
if (e === null) {
|
|
@@ -4114,7 +4101,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4114
4101
|
}
|
|
4115
4102
|
let t = this.crosshairSeries(), n = e >= 0 && e < t.length ? t[e] : void 0, r = n && e > 0 ? t[e - 1] : void 0;
|
|
4116
4103
|
this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(n ?? null, r ?? null);
|
|
4117
|
-
let i = n ?
|
|
4104
|
+
let i = n ? A(t)[e]?.time ?? n.time : void 0;
|
|
4118
4105
|
this.eventBus.emit("crosshairSync", {
|
|
4119
4106
|
barIndex: e,
|
|
4120
4107
|
...n ? { bar: n } : {},
|
|
@@ -4126,7 +4113,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4126
4113
|
return this.series.bars();
|
|
4127
4114
|
}
|
|
4128
4115
|
setGridVisible(e) {
|
|
4129
|
-
this.gridRenderer.setVisible(e), this.engine.requestRender(
|
|
4116
|
+
this.gridRenderer.setVisible(e), this.engine.requestRender(i.Background);
|
|
4130
4117
|
}
|
|
4131
4118
|
isGridVisible() {
|
|
4132
4119
|
return this.gridRenderer.isVisible();
|
|
@@ -4138,22 +4125,22 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4138
4125
|
return this.features.volume && this.volumeRenderer.isVisible();
|
|
4139
4126
|
}
|
|
4140
4127
|
setVolumeProfileVisible(e) {
|
|
4141
|
-
this.volumeProfile.setVisible(e), this.engine.requestRender(
|
|
4128
|
+
this.volumeProfile.setVisible(e), this.engine.requestRender(i.Main);
|
|
4142
4129
|
}
|
|
4143
4130
|
isVolumeProfileVisible() {
|
|
4144
4131
|
return this.volumeProfile.isVisible();
|
|
4145
4132
|
}
|
|
4146
4133
|
setVolumeProfileConfig(e) {
|
|
4147
|
-
e.buckets !== void 0 && this.volumeProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.volumeProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.volumeProfile.setOpacity(e.opacity), e.highlightPoC !== void 0 && this.volumeProfile.setHighlightPoC(e.highlightPoC), this.engine.requestRender(
|
|
4134
|
+
e.buckets !== void 0 && this.volumeProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.volumeProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.volumeProfile.setOpacity(e.opacity), e.highlightPoC !== void 0 && this.volumeProfile.setHighlightPoC(e.highlightPoC), this.engine.requestRender(i.Main);
|
|
4148
4135
|
}
|
|
4149
4136
|
setMarketProfileVisible(e) {
|
|
4150
|
-
this.marketProfile.setVisible(e), this.engine.requestRender(
|
|
4137
|
+
this.marketProfile.setVisible(e), this.engine.requestRender(i.Main);
|
|
4151
4138
|
}
|
|
4152
4139
|
isMarketProfileVisible() {
|
|
4153
4140
|
return this.marketProfile.isVisible();
|
|
4154
4141
|
}
|
|
4155
4142
|
setMarketProfileConfig(e) {
|
|
4156
|
-
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(
|
|
4143
|
+
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(i.Main);
|
|
4157
4144
|
}
|
|
4158
4145
|
getMarketProfileConfig() {
|
|
4159
4146
|
return this.marketProfile.getConfig();
|
|
@@ -4162,38 +4149,38 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4162
4149
|
return this.marketProfile.getStats();
|
|
4163
4150
|
}
|
|
4164
4151
|
setDepthHeatmapVisible(e) {
|
|
4165
|
-
this.depthHeatmap.setVisible(e), this.engine.requestRender(
|
|
4152
|
+
this.depthHeatmap.setVisible(e), this.engine.requestRender(i.Main);
|
|
4166
4153
|
}
|
|
4167
4154
|
isDepthHeatmapVisible() {
|
|
4168
4155
|
return this.depthHeatmap.isVisible();
|
|
4169
4156
|
}
|
|
4170
4157
|
setDepthHeatmapConfig(e) {
|
|
4171
|
-
e.opacity !== void 0 && this.depthHeatmap.setOpacity(e.opacity), e.capacity !== void 0 && this.depthHeatmap.setCapacity(e.capacity), this.engine.requestRender(
|
|
4158
|
+
e.opacity !== void 0 && this.depthHeatmap.setOpacity(e.opacity), e.capacity !== void 0 && this.depthHeatmap.setCapacity(e.capacity), this.engine.requestRender(i.Main);
|
|
4172
4159
|
}
|
|
4173
4160
|
getDepthHeatmapConfig() {
|
|
4174
4161
|
return this.depthHeatmap.getConfig();
|
|
4175
4162
|
}
|
|
4176
4163
|
pushDepthSnapshot(e, t) {
|
|
4177
|
-
let n = this.series.bars(),
|
|
4178
|
-
|
|
4164
|
+
let n = this.series.bars(), r = t ?? n[n.length - 1]?.time;
|
|
4165
|
+
r === void 0 || !Number.isFinite(r) || (this.depthHeatmap.push(r, e), this.depthHeatmap.isVisible() && this.engine.requestRender(i.Main));
|
|
4179
4166
|
}
|
|
4180
4167
|
clearDepthHeatmap() {
|
|
4181
|
-
this.depthHeatmap.clear(), this.engine.requestRender(
|
|
4168
|
+
this.depthHeatmap.clear(), this.engine.requestRender(i.Main);
|
|
4182
4169
|
}
|
|
4183
4170
|
setPeriodLevelsVisible(e) {
|
|
4184
|
-
this.periodLevels.setVisible(e), this.engine.requestRender(
|
|
4171
|
+
this.periodLevels.setVisible(e), this.engine.requestRender(i.Main);
|
|
4185
4172
|
}
|
|
4186
4173
|
isPeriodLevelsVisible() {
|
|
4187
4174
|
return this.periodLevels.isVisible();
|
|
4188
4175
|
}
|
|
4189
4176
|
setPeriodLevelsPeriod(e) {
|
|
4190
|
-
this.periodLevels.setPeriod(e), this.engine.requestRender(
|
|
4177
|
+
this.periodLevels.setPeriod(e), this.engine.requestRender(i.Main);
|
|
4191
4178
|
}
|
|
4192
4179
|
getPeriodLevelsPeriod() {
|
|
4193
4180
|
return this.periodLevels.getPeriod();
|
|
4194
4181
|
}
|
|
4195
4182
|
setTimeZone(e) {
|
|
4196
|
-
|
|
4183
|
+
_i(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
4197
4184
|
}
|
|
4198
4185
|
getTimeZone() {
|
|
4199
4186
|
return this.timeZoneSetting;
|
|
@@ -4202,7 +4189,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4202
4189
|
return this.displayTz;
|
|
4203
4190
|
}
|
|
4204
4191
|
getExchangeTimeZone() {
|
|
4205
|
-
return [
|
|
4192
|
+
return [w(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && b(e)) ?? null;
|
|
4206
4193
|
}
|
|
4207
4194
|
setTimezone(e) {
|
|
4208
4195
|
this.setTimeZone(e);
|
|
@@ -4243,8 +4230,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4243
4230
|
}));
|
|
4244
4231
|
}
|
|
4245
4232
|
spokenBarTime(e) {
|
|
4246
|
-
let t = this.getDisplayData(), n = e *
|
|
4247
|
-
return
|
|
4233
|
+
let t = this.getDisplayData(), n = e * d(t), r = this.numberLocale || "en-US";
|
|
4234
|
+
return f(t) === !0 ? fe(r, { dateStyle: "medium" }, u(n, this.displayTz, this.getExchangeTimeZone()))(n) : fe(r, {
|
|
4248
4235
|
dateStyle: "medium",
|
|
4249
4236
|
timeStyle: "short"
|
|
4250
4237
|
}, this.displayTz)(n);
|
|
@@ -4257,20 +4244,20 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4257
4244
|
this.studyZoneHeld = !1, this.endStudyZoneWait(), this.useSymbolInfo(e);
|
|
4258
4245
|
}
|
|
4259
4246
|
useSymbolInfo(e) {
|
|
4260
|
-
let t = e && this.symbolInfo?.symbol === e.symbol ?
|
|
4261
|
-
this.symbolInfo = e ?
|
|
4247
|
+
let t = e && this.symbolInfo?.symbol === e.symbol ? w(this.symbolInfo) : void 0;
|
|
4248
|
+
this.symbolInfo = e ? vi({
|
|
4262
4249
|
...e,
|
|
4263
4250
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
4264
|
-
}, t) : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(
|
|
4251
|
+
}, t) : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(i.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
4265
4252
|
let n = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
|
|
4266
|
-
let t =
|
|
4253
|
+
let t = C(e.start), n = C(e.end);
|
|
4267
4254
|
return t === null || n === null ? [] : [{
|
|
4268
4255
|
startMinute: t,
|
|
4269
4256
|
endMinute: n
|
|
4270
4257
|
}];
|
|
4271
|
-
}),
|
|
4272
|
-
this.sessionShading.replaceConfig(n.length > 0 &&
|
|
4273
|
-
timeZone:
|
|
4258
|
+
}), r = w(this.symbolInfo);
|
|
4259
|
+
this.sessionShading.replaceConfig(n.length > 0 && r && b(r) ? {
|
|
4260
|
+
timeZone: r,
|
|
4274
4261
|
windows: n,
|
|
4275
4262
|
startMinute: n[0].startMinute,
|
|
4276
4263
|
endMinute: n[n.length - 1].endMinute
|
|
@@ -4283,15 +4270,15 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4283
4270
|
if (!e || typeof e != "object") return;
|
|
4284
4271
|
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
4285
4272
|
if (!n(e.symbol)) return;
|
|
4286
|
-
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i =
|
|
4273
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = vi({
|
|
4287
4274
|
...r,
|
|
4288
4275
|
...e,
|
|
4289
4276
|
symbol: e.symbol || r?.symbol || t
|
|
4290
|
-
},
|
|
4277
|
+
}, w(r));
|
|
4291
4278
|
r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
|
|
4292
4279
|
}
|
|
4293
4280
|
resolveStreamSymbol(e, t) {
|
|
4294
|
-
let n =
|
|
4281
|
+
let n = P(e), r = n.resolveSymbol?.bind(n);
|
|
4295
4282
|
if (this.symbolInfo && this.symbolInfo.symbol !== t ? (r ? this.holdStudyZone() : this.studyZoneHeld = !1, this.useSymbolInfo(null)) : r && this.studyZoneHeld && this.holdStudyZone(), !r) {
|
|
4296
4283
|
this.releaseStudyZone();
|
|
4297
4284
|
return;
|
|
@@ -4304,40 +4291,40 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4304
4291
|
});
|
|
4305
4292
|
}
|
|
4306
4293
|
setPivotMarkersVisible(e) {
|
|
4307
|
-
this.pivotMarkers.setVisible(e), this.engine.requestRender(
|
|
4294
|
+
this.pivotMarkers.setVisible(e), this.engine.requestRender(i.Overlay);
|
|
4308
4295
|
}
|
|
4309
4296
|
isPivotMarkersVisible() {
|
|
4310
4297
|
return this.pivotMarkers.isVisible();
|
|
4311
4298
|
}
|
|
4312
4299
|
setPivotMarkersConfig(e) {
|
|
4313
|
-
(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(
|
|
4300
|
+
(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(i.Overlay);
|
|
4314
4301
|
}
|
|
4315
4302
|
getPivotMarkersConfig() {
|
|
4316
4303
|
return this.pivotMarkers.getConfig();
|
|
4317
4304
|
}
|
|
4318
4305
|
setSessionShadingVisible(e) {
|
|
4319
|
-
this.sessionShading.setVisible(e), this.engine.requestRender(
|
|
4306
|
+
this.sessionShading.setVisible(e), this.engine.requestRender(i.Background);
|
|
4320
4307
|
}
|
|
4321
4308
|
isSessionShadingVisible() {
|
|
4322
4309
|
return this.sessionShading.isVisible();
|
|
4323
4310
|
}
|
|
4324
4311
|
setSessionShadingConfig(e) {
|
|
4325
|
-
this.hostSessionHours = Lt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(
|
|
4312
|
+
this.hostSessionHours = Lt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(i.Background);
|
|
4326
4313
|
}
|
|
4327
4314
|
setTooltipVisible(e) {
|
|
4328
4315
|
e || this.crosshairTooltip.hide();
|
|
4329
4316
|
}
|
|
4330
4317
|
setLegend(e) {
|
|
4331
|
-
this.chartLegend.setConfig(e), this.engine.requestRender(
|
|
4318
|
+
this.chartLegend.setConfig(e), this.engine.requestRender(i.Hover);
|
|
4332
4319
|
}
|
|
4333
4320
|
isLegendVisible() {
|
|
4334
4321
|
return this.features.legend && this.chartLegend.getConfig().visible;
|
|
4335
4322
|
}
|
|
4336
4323
|
setSymbolName(e) {
|
|
4337
|
-
this.chartLegend.setSymbol(e), this.engine.requestRender(
|
|
4324
|
+
this.chartLegend.setSymbol(e), this.engine.requestRender(i.Hover);
|
|
4338
4325
|
}
|
|
4339
4326
|
setStatusText(e) {
|
|
4340
|
-
this.chartLegend.setStatusText(e), this.engine.requestRender(
|
|
4327
|
+
this.chartLegend.setStatusText(e), this.engine.requestRender(i.Hover);
|
|
4341
4328
|
}
|
|
4342
4329
|
async setRenderer(e) {
|
|
4343
4330
|
let t = ++this.rendererToken;
|
|
@@ -4370,7 +4357,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4370
4357
|
this.engine.getGpu() && this.engine.renderNow();
|
|
4371
4358
|
}
|
|
4372
4359
|
screenshot(e) {
|
|
4373
|
-
this.features.screenshot && (this.freshFrame(),
|
|
4360
|
+
this.features.screenshot && (this.freshFrame(), k.download(this.container, e, this.themeManager.getTheme().background));
|
|
4374
4361
|
}
|
|
4375
4362
|
async copyScreenshot() {
|
|
4376
4363
|
if (!this.features.screenshot) return !1;
|
|
@@ -4378,7 +4365,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4378
4365
|
if (!t?.write || !e) return !1;
|
|
4379
4366
|
try {
|
|
4380
4367
|
this.freshFrame();
|
|
4381
|
-
let n =
|
|
4368
|
+
let n = k.toBlob(this.container, this.themeManager.getTheme().background).then((e) => {
|
|
4382
4369
|
if (!e) throw Error("No chart image to copy");
|
|
4383
4370
|
return e;
|
|
4384
4371
|
});
|
|
@@ -4396,10 +4383,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4396
4383
|
}
|
|
4397
4384
|
}
|
|
4398
4385
|
screenshotDataURL() {
|
|
4399
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
4386
|
+
return this.features.screenshot ? (this.freshFrame(), k.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
|
|
4400
4387
|
}
|
|
4401
4388
|
async screenshotBlob() {
|
|
4402
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
4389
|
+
return this.features.screenshot ? (this.freshFrame(), k.toBlob(this.container, this.themeManager.getTheme().background)) : null;
|
|
4403
4390
|
}
|
|
4404
4391
|
addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
|
|
4405
4392
|
if (!this.features.alerts) return null;
|
|
@@ -4472,7 +4459,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4472
4459
|
this.alertManager.saveToStorage(e);
|
|
4473
4460
|
}
|
|
4474
4461
|
loadAlerts(e) {
|
|
4475
|
-
this.alertManager.loadFromStorage(e), this.alertManager.pruneDrawingAlerts(new Set(this.drawingManager.getDrawings().map((e) => e.id))), this.engine.requestRender(
|
|
4462
|
+
this.alertManager.loadFromStorage(e), this.alertManager.pruneDrawingAlerts(new Set(this.drawingManager.getDrawings().map((e) => e.id))), this.engine.requestRender(i.Overlay);
|
|
4476
4463
|
}
|
|
4477
4464
|
addSignalMarker(e) {
|
|
4478
4465
|
return this.signalMarkerManager.addMarker(e);
|
|
@@ -4518,7 +4505,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4518
4505
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
4519
4506
|
if (!this.replaySession) {
|
|
4520
4507
|
if (this.series.length() === 0) return;
|
|
4521
|
-
this.series.beginReplay(), this.replaySession =
|
|
4508
|
+
this.series.beginReplay(), this.replaySession = Fi(this.currentSymbol);
|
|
4522
4509
|
}
|
|
4523
4510
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4524
4511
|
c.animate = c.animate === !0;
|
|
@@ -4529,13 +4516,13 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4529
4516
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4530
4517
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4531
4518
|
let h = this.replayStepsSeries;
|
|
4532
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4519
|
+
h && c.startIndex !== void 0 && (c.startIndex = Hi(h, p, c.startIndex));
|
|
4533
4520
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4534
4521
|
this.revealReplayMarks(this.replayRevealMarks ? _?.time ?? null : null), n.held && (n.held.state = c.paused ? "paused" : "playing", c.paused = !0), !c.paused && c.startIndex !== void 0 && c.startIndex >= 1 && this.replaySeek(c.startIndex - 1), this.replayManager.play(c);
|
|
4535
4522
|
}
|
|
4536
4523
|
buildReplay(e, t, n) {
|
|
4537
4524
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4538
|
-
this.replayPieces = r && t ?
|
|
4525
|
+
this.replayPieces = r && t ? Gi(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4539
4526
|
let a = this.replayRestarting;
|
|
4540
4527
|
this.replayRestarting = !0;
|
|
4541
4528
|
try {
|
|
@@ -4549,7 +4536,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4549
4536
|
let n = t, a = e[t];
|
|
4550
4537
|
if (i) {
|
|
4551
4538
|
let r = i[t];
|
|
4552
|
-
n = Q(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ?
|
|
4539
|
+
n = Q(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? qi(c, r) : Ui(e[n], i, t), a = Wi(i, e, t, n) ? e[n] : c;
|
|
4553
4540
|
}
|
|
4554
4541
|
let u = this.replayForming;
|
|
4555
4542
|
this.replayForming = null, s = t;
|
|
@@ -4573,7 +4560,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4573
4560
|
});
|
|
4574
4561
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4575
4562
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4576
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4563
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Ki() ? ei(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = $r(r, i);
|
|
4577
4564
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4578
4565
|
index: t,
|
|
4579
4566
|
path: r
|
|
@@ -4591,22 +4578,22 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4591
4578
|
}
|
|
4592
4579
|
replayPathOf(e, t) {
|
|
4593
4580
|
let n = e[t];
|
|
4594
|
-
return
|
|
4581
|
+
return Jr(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4595
4582
|
}
|
|
4596
4583
|
loadReplaySteps(e, t) {
|
|
4597
4584
|
let n = this.replayLoader?.loader;
|
|
4598
4585
|
if (!n) return;
|
|
4599
4586
|
n.evictBefore(e[t].time);
|
|
4600
4587
|
let r = this.replayManager.getStepMs();
|
|
4601
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
4588
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(ji / r) : 1);
|
|
4602
4589
|
}
|
|
4603
4590
|
useReplayLoader(e, t) {
|
|
4604
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4591
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? ri(e.step, r, (e) => j(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
4605
4592
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4606
|
-
let o =
|
|
4593
|
+
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = T(r), u = new Vr({
|
|
4607
4594
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4608
4595
|
step: i,
|
|
4609
|
-
ratio: Math.max(1, Math.round(l /
|
|
4596
|
+
ratio: Math.max(1, Math.round(l / T(i))),
|
|
4610
4597
|
barMs: l,
|
|
4611
4598
|
keep: (e) => this.series.inHoursShown(e),
|
|
4612
4599
|
report: (e) => this.eventBus.emit("replayStepsLoad", e)
|
|
@@ -4619,7 +4606,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4619
4606
|
feedReplayForming(e, t, n, r) {
|
|
4620
4607
|
let i = this.replaySession;
|
|
4621
4608
|
if (!i || !this.executionAdapter?.setMarkPrice) return;
|
|
4622
|
-
let a =
|
|
4609
|
+
let a = mi(e, t, n, r, {
|
|
4623
4610
|
time: i.fedTime,
|
|
4624
4611
|
fraction: i.fedFraction
|
|
4625
4612
|
}, (e, t) => this.replayPathOf(e, t));
|
|
@@ -4643,7 +4630,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4643
4630
|
if (n.length === 0) return;
|
|
4644
4631
|
let r = t.windowTime === null ? 0 : Math.min(J(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4645
4632
|
this.useReplayLoader(t, !1);
|
|
4646
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4633
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Ri(o ?? i, t.until);
|
|
4647
4634
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4648
4635
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4649
4636
|
return;
|
|
@@ -4651,7 +4638,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4651
4638
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4652
4639
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4653
4640
|
let d = this.replayManager.remainingMs();
|
|
4654
|
-
this.clearBarHolders(), t.animate &&
|
|
4641
|
+
this.clearBarHolders(), t.animate && Li(t, this.replayCoarse, i);
|
|
4655
4642
|
let f = this.replayRestarting;
|
|
4656
4643
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4657
4644
|
try {
|
|
@@ -4674,14 +4661,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4674
4661
|
}
|
|
4675
4662
|
replayStepsOver(e, t, n = !1) {
|
|
4676
4663
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4677
|
-
let r =
|
|
4678
|
-
return r && (n ||
|
|
4664
|
+
let r = Vi(this.series.inHoursShown(e.steps), t);
|
|
4665
|
+
return r && (n || Bi(r, t)) ? r : null;
|
|
4679
4666
|
}
|
|
4680
4667
|
canPageBackForReplay(e) {
|
|
4681
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4668
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < Mi;
|
|
4682
4669
|
}
|
|
4683
4670
|
async pageBackForReplay(e) {
|
|
4684
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4671
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = Mi, this.rebaseReplay("older"));
|
|
4685
4672
|
}
|
|
4686
4673
|
holdReplay() {
|
|
4687
4674
|
let e = this.replaySession;
|
|
@@ -4714,7 +4701,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4714
4701
|
this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4715
4702
|
}
|
|
4716
4703
|
replaySeekToTime(e) {
|
|
4717
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4704
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, Ri(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4718
4705
|
}
|
|
4719
4706
|
feedReplayPrice(e, t) {
|
|
4720
4707
|
let n = this.executionAdapter;
|
|
@@ -4729,7 +4716,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4729
4716
|
feedReplaySteps(e, t) {
|
|
4730
4717
|
let n = this.replaySession;
|
|
4731
4718
|
if (!n || !this.executionAdapter?.setMarkPrice) return;
|
|
4732
|
-
let r =
|
|
4719
|
+
let r = pi(e, t, {
|
|
4733
4720
|
time: n.fedTime,
|
|
4734
4721
|
fraction: n.fedFraction
|
|
4735
4722
|
});
|
|
@@ -4743,7 +4730,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4743
4730
|
}
|
|
4744
4731
|
replaySeekToBar(e) {
|
|
4745
4732
|
let t = this.replayStepsSeries;
|
|
4746
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4733
|
+
this.replaySeek(t && this.replayCoarse ? Hi(t, this.replayCoarse, e) : e);
|
|
4747
4734
|
}
|
|
4748
4735
|
replayPause() {
|
|
4749
4736
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4784,7 +4771,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4784
4771
|
let { x: r, y: c } = this.drawingManager.anchorPoint(t.type, e, n);
|
|
4785
4772
|
i = Math.min(i, r), a = Math.max(a, r), o = Math.min(o, c), s = Math.max(s, c);
|
|
4786
4773
|
}
|
|
4787
|
-
return
|
|
4774
|
+
return wi.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Ti.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 ? {
|
|
4788
4775
|
x: i,
|
|
4789
4776
|
y: o,
|
|
4790
4777
|
width: a - i,
|
|
@@ -4820,7 +4807,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4820
4807
|
};
|
|
4821
4808
|
}
|
|
4822
4809
|
captureSnapshot() {
|
|
4823
|
-
return
|
|
4810
|
+
return E.capture({
|
|
4824
4811
|
getDrawings: () => [...this.getDrawings().filter((e) => e.paneId === void 0 || this.layoutManager.getPanels().some((t) => t.id === e.paneId)), ...this.keptPaneDrawings],
|
|
4825
4812
|
getTheme: () => this.themeManager.getBaseTheme(),
|
|
4826
4813
|
getAlerts: () => this.getAlerts(),
|
|
@@ -4833,12 +4820,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4833
4820
|
});
|
|
4834
4821
|
}
|
|
4835
4822
|
restoreIndicators(e, t) {
|
|
4836
|
-
let n =
|
|
4823
|
+
let n = $n(e), r = /* @__PURE__ */ new Map();
|
|
4837
4824
|
this.unrestoredIndicators = [];
|
|
4838
4825
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4839
4826
|
if (t) {
|
|
4840
4827
|
let e = this.getIndicatorSetup();
|
|
4841
|
-
for (let t of
|
|
4828
|
+
for (let t of tr(e, n)) o.add(t);
|
|
4842
4829
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4843
4830
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4844
4831
|
for (let e = !0; e;) {
|
|
@@ -4849,7 +4836,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4849
4836
|
}
|
|
4850
4837
|
}
|
|
4851
4838
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4852
|
-
let s = (e) =>
|
|
4839
|
+
let s = (e) => rr(e, r);
|
|
4853
4840
|
for (let e of n) {
|
|
4854
4841
|
let n = null;
|
|
4855
4842
|
if (o.has(e.instanceId)) {
|
|
@@ -4882,7 +4869,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4882
4869
|
}
|
|
4883
4870
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
4884
4871
|
}
|
|
4885
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
4872
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), Qn(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
4886
4873
|
}
|
|
4887
4874
|
restoreLooks(e, t) {
|
|
4888
4875
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -4902,7 +4889,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4902
4889
|
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? se(t.paneStyle) : null);
|
|
4903
4890
|
}
|
|
4904
4891
|
getIndicatorSetup() {
|
|
4905
|
-
return [
|
|
4892
|
+
return [...Zn(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
4906
4893
|
}
|
|
4907
4894
|
applyIndicatorSetup(e) {
|
|
4908
4895
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -4911,7 +4898,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4911
4898
|
});
|
|
4912
4899
|
}
|
|
4913
4900
|
followIndicatorAlerts(e, t) {
|
|
4914
|
-
this.features.alerts &&
|
|
4901
|
+
this.features.alerts && oi(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
4915
4902
|
}
|
|
4916
4903
|
beginIndicatorEdit(e) {
|
|
4917
4904
|
this.indicatorHistory.begin(e);
|
|
@@ -4935,46 +4922,46 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4935
4922
|
keptPaneDrawings = [];
|
|
4936
4923
|
replayingIndicatorStep = !1;
|
|
4937
4924
|
takesDrawing(e, t) {
|
|
4938
|
-
return
|
|
4925
|
+
return lr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
4939
4926
|
}
|
|
4940
4927
|
renamePane(e, t) {
|
|
4941
4928
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
4942
4929
|
}
|
|
4943
4930
|
drawingPaneAt(e) {
|
|
4944
|
-
return
|
|
4931
|
+
return sr(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
4945
4932
|
}
|
|
4946
4933
|
drawingPaneViewport(e) {
|
|
4947
4934
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
4948
|
-
return
|
|
4935
|
+
return cr(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
4949
4936
|
}
|
|
4950
4937
|
saveState(e) {
|
|
4951
4938
|
if (!this.features.saveLoad) return null;
|
|
4952
|
-
let t = this.captureSnapshot(), n =
|
|
4953
|
-
return e &&
|
|
4939
|
+
let t = this.captureSnapshot(), n = E.serialize(t);
|
|
4940
|
+
return e && E.saveToStorage(e, t), n;
|
|
4954
4941
|
}
|
|
4955
4942
|
loadState(e) {
|
|
4956
4943
|
if (!this.features.saveLoad) return;
|
|
4957
|
-
let t =
|
|
4944
|
+
let t = E.deserialize(e);
|
|
4958
4945
|
this.chartTypeOptions = t.chartTypeOptions ?? {}, this.display.reset(), 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");
|
|
4959
4946
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
4960
4947
|
this.drawingManager.renamePanes(n);
|
|
4961
4948
|
let r = new Set(this.unrestoredIndicators.map((e) => e.instanceId)), i = this.drawingManager.getDrawings(), a = i.filter((e) => e.paneId === void 0 || this.takesDrawing(e.paneId, e.type));
|
|
4962
|
-
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts &&
|
|
4949
|
+
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts && li(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
4963
4950
|
console.warn("Layout alert left out:", e);
|
|
4964
4951
|
}), this.markStateChanged();
|
|
4965
4952
|
}
|
|
4966
4953
|
loadStateFromStorage(e) {
|
|
4967
4954
|
if (!this.features.saveLoad) return !1;
|
|
4968
|
-
let t =
|
|
4969
|
-
return t ? (this.loadState(
|
|
4955
|
+
let t = E.loadFromStorage(e);
|
|
4956
|
+
return t ? (this.loadState(E.serialize(t)), !0) : !1;
|
|
4970
4957
|
}
|
|
4971
4958
|
downloadState(e) {
|
|
4972
|
-
this.features.saveLoad &&
|
|
4959
|
+
this.features.saveLoad && E.downloadFile(this.captureSnapshot(), e);
|
|
4973
4960
|
}
|
|
4974
4961
|
async loadStateFromFile() {
|
|
4975
4962
|
if (!this.features.saveLoad) return;
|
|
4976
|
-
let e = await
|
|
4977
|
-
this.loadState(
|
|
4963
|
+
let e = await E.loadFromFile();
|
|
4964
|
+
this.loadState(E.serialize(e));
|
|
4978
4965
|
}
|
|
4979
4966
|
setLocale(e) {
|
|
4980
4967
|
le(e), this.engine.requestRender();
|
|
@@ -4986,7 +4973,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4986
4973
|
return this.numberLocale;
|
|
4987
4974
|
}
|
|
4988
4975
|
setMarket(e) {
|
|
4989
|
-
this.marketConfig = e, this.studyZoneHeld = !1, this.endStudyZoneWait(), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), e.colorScheme && this.themeManager.setTheme(
|
|
4976
|
+
this.marketConfig = e, this.studyZoneHeld = !1, this.endStudyZoneWait(), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), e.colorScheme && this.themeManager.setTheme(g(this.themeManager.getBaseTheme(), e.colorScheme)), e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender(), this.eventBus.emit("marketChange", { market: e });
|
|
4990
4977
|
}
|
|
4991
4978
|
applyPricePrecision(e) {
|
|
4992
4979
|
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);
|
|
@@ -4996,7 +4983,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4996
4983
|
}
|
|
4997
4984
|
getPriceLimits() {
|
|
4998
4985
|
let e = this.marketConfig;
|
|
4999
|
-
return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null :
|
|
4986
|
+
return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : m(e.priceLimits.referencePrice, e);
|
|
5000
4987
|
}
|
|
5001
4988
|
setPriceLimits(e) {
|
|
5002
4989
|
this.marketConfig?.priceLimits && (this.marketConfig = {
|
|
@@ -5012,7 +4999,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5012
4999
|
}
|
|
5013
5000
|
setFeatures(e) {
|
|
5014
5001
|
let t = this.getLegendBottom();
|
|
5015
|
-
Object.assign(this.features, e), e.legend !== void 0 && this.getLegendBottom() !== t && this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), (e.priceAxisAddButton !== void 0 || e.crosshair !== void 0) && (this.applyPriceAxisAdd(), this.engine.requestRender(
|
|
5002
|
+
Object.assign(this.features, e), e.legend !== void 0 && this.getLegendBottom() !== t && this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), (e.priceAxisAddButton !== void 0 || e.crosshair !== void 0) && (this.applyPriceAxisAdd(), this.engine.requestRender(i.Overlay)), e.grid !== void 0 && this.engine.requestRender(i.Background), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.updateViewportAndRender()), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
|
|
5016
5003
|
}
|
|
5017
5004
|
resize() {
|
|
5018
5005
|
let e = this.engine.dprManager.readContainerSize();
|
|
@@ -5027,7 +5014,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5027
5014
|
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 = "";
|
|
5028
5015
|
}
|
|
5029
5016
|
createChartRenderer(e) {
|
|
5030
|
-
let t =
|
|
5017
|
+
let t = Dn(e, (e) => this.pluginManager.getChartType(e));
|
|
5031
5018
|
return t instanceof ze && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5032
5019
|
}
|
|
5033
5020
|
crosshairSeries() {
|
|
@@ -5046,7 +5033,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5046
5033
|
}
|
|
5047
5034
|
exportBars() {
|
|
5048
5035
|
if (this.isTimeAligned()) return this.series.bars();
|
|
5049
|
-
let e = this.getDisplayData(), t =
|
|
5036
|
+
let e = this.getDisplayData(), t = A(e);
|
|
5050
5037
|
return e.map((e, n) => ({
|
|
5051
5038
|
...e,
|
|
5052
5039
|
time: t[n]?.time ?? e.time
|
|
@@ -5105,7 +5092,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5105
5092
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5106
5093
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5107
5094
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5108
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5095
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && Hn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5109
5096
|
});
|
|
5110
5097
|
}
|
|
5111
5098
|
updateViewportAndRender(e = !1) {
|
|
@@ -5120,7 +5107,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5120
5107
|
fitLeftAxisWidth() {
|
|
5121
5108
|
let e = this.leftViewport;
|
|
5122
5109
|
if (!e) return !1;
|
|
5123
|
-
let t = this.themeManager.getTheme(), n =
|
|
5110
|
+
let t = this.themeManager.getTheme(), n = Tr({
|
|
5124
5111
|
min: e.priceRange.min,
|
|
5125
5112
|
max: e.priceRange.max,
|
|
5126
5113
|
lastPrice: null,
|
|
@@ -5129,12 +5116,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5129
5116
|
fontFamily: t.font.family,
|
|
5130
5117
|
fontSizeSmall: t.font.sizeSmall,
|
|
5131
5118
|
measure: (e, t) => this.measureText(e, t)
|
|
5132
|
-
}), r =
|
|
5119
|
+
}), r = Er(this.leftAxisWidth, n);
|
|
5133
5120
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5134
5121
|
}
|
|
5135
5122
|
fitPriceAxisWidth() {
|
|
5136
5123
|
if (!this.features.priceAxis) return !1;
|
|
5137
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5124
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = Tr({
|
|
5138
5125
|
min: e.min,
|
|
5139
5126
|
max: e.max,
|
|
5140
5127
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5145,14 +5132,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5145
5132
|
fontFamily: t.font.family,
|
|
5146
5133
|
fontSizeSmall: t.font.sizeSmall,
|
|
5147
5134
|
measure: (e, t) => this.measureText(e, t)
|
|
5148
|
-
}), r =
|
|
5135
|
+
}), r = Er(this.priceAxisWidth, n);
|
|
5149
5136
|
return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5150
5137
|
}
|
|
5151
5138
|
measureText(e, t) {
|
|
5152
|
-
let n = this.engine.layerManager.getLayer(
|
|
5153
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
5154
|
-
let
|
|
5155
|
-
return
|
|
5139
|
+
let n = this.engine.layerManager.getLayer(i.Main)?.ctx;
|
|
5140
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => Di(n, e, t));
|
|
5141
|
+
let r = n ?? this.detachedMeasureContext();
|
|
5142
|
+
return r ? Di(r, e, t) : e.length * 7;
|
|
5156
5143
|
}
|
|
5157
5144
|
detachedMeasureContext() {
|
|
5158
5145
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -5239,7 +5226,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5239
5226
|
});
|
|
5240
5227
|
}
|
|
5241
5228
|
drawOverlayPlugins(e, t) {
|
|
5242
|
-
let n =
|
|
5229
|
+
let n = jr(this.pluginManager.getOverlays(), t);
|
|
5243
5230
|
if (n.length === 0) return;
|
|
5244
5231
|
let r = {
|
|
5245
5232
|
viewport: this.viewport.getState(),
|
|
@@ -5260,16 +5247,16 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5260
5247
|
};
|
|
5261
5248
|
}
|
|
5262
5249
|
};
|
|
5263
|
-
function
|
|
5250
|
+
function Di(e, t, n) {
|
|
5264
5251
|
let r = e.font;
|
|
5265
5252
|
e.font = n;
|
|
5266
5253
|
let i = e.measureText(t).width;
|
|
5267
5254
|
return e.font = r, i;
|
|
5268
5255
|
}
|
|
5269
|
-
var
|
|
5270
|
-
function
|
|
5256
|
+
var Oi = 300;
|
|
5257
|
+
function ki(e) {
|
|
5271
5258
|
let t = {}, n = e.family;
|
|
5272
|
-
typeof n == "string" && n.trim() !== "" && n.length <=
|
|
5259
|
+
typeof n == "string" && n.trim() !== "" && n.length <= Oi && !/[;{}<>\\]|\/\*/.test(n) && (t.family = n);
|
|
5273
5260
|
for (let n of [
|
|
5274
5261
|
"sizeSmall",
|
|
5275
5262
|
"sizeMedium",
|
|
@@ -5280,7 +5267,7 @@ function ji(e) {
|
|
|
5280
5267
|
}
|
|
5281
5268
|
return t;
|
|
5282
5269
|
}
|
|
5283
|
-
function
|
|
5270
|
+
function Ai(e) {
|
|
5284
5271
|
let t = e.tagRadius;
|
|
5285
5272
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
5286
5273
|
}
|
|
@@ -5299,8 +5286,8 @@ function X(e) {
|
|
|
5299
5286
|
bars: e.bars
|
|
5300
5287
|
};
|
|
5301
5288
|
}
|
|
5302
|
-
var
|
|
5303
|
-
function
|
|
5289
|
+
var ji = 8e3, Mi = 10, Ni = 50, Pi = .001;
|
|
5290
|
+
function Fi(e) {
|
|
5304
5291
|
return {
|
|
5305
5292
|
price: null,
|
|
5306
5293
|
fedTime: null,
|
|
@@ -5315,36 +5302,36 @@ function Li(e) {
|
|
|
5315
5302
|
held: null
|
|
5316
5303
|
};
|
|
5317
5304
|
}
|
|
5318
|
-
function
|
|
5305
|
+
function Ii(e, t) {
|
|
5319
5306
|
let n = e[t + 1];
|
|
5320
5307
|
return n ? n.time - e[t].time : Z(e);
|
|
5321
5308
|
}
|
|
5322
|
-
function
|
|
5309
|
+
function Li(e, t, n) {
|
|
5323
5310
|
let r = e.fedTime;
|
|
5324
5311
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5325
|
-
let i =
|
|
5312
|
+
let i = Ii(t, Q(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Q(n, a), s = n[o].time;
|
|
5326
5313
|
if (s > a) return;
|
|
5327
|
-
let c =
|
|
5314
|
+
let c = Ii(n, o);
|
|
5328
5315
|
if (a === s && o > 0) {
|
|
5329
5316
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
5330
5317
|
return;
|
|
5331
5318
|
}
|
|
5332
5319
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5333
5320
|
}
|
|
5334
|
-
function
|
|
5321
|
+
function Ri(e, t) {
|
|
5335
5322
|
let n = Y(e, t), r = e.length - 1;
|
|
5336
5323
|
return n > r && r >= 0 && e[r].time + Z(e) <= t ? r : Math.max(-1, n - 2);
|
|
5337
5324
|
}
|
|
5338
|
-
function
|
|
5325
|
+
function zi(e) {
|
|
5339
5326
|
let t = Infinity;
|
|
5340
5327
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
5341
5328
|
return t;
|
|
5342
5329
|
}
|
|
5343
|
-
function
|
|
5344
|
-
if (!(
|
|
5345
|
-
let n = Math.max(0, e.length -
|
|
5330
|
+
function Bi(e, t) {
|
|
5331
|
+
if (!(zi(e) < zi(t))) return !1;
|
|
5332
|
+
let n = Math.max(0, e.length - Ni);
|
|
5346
5333
|
for (let r = n; r < e.length; r++) {
|
|
5347
|
-
let n = t[Q(t, e[r].time)], i = (n.high - n.low) *
|
|
5334
|
+
let n = t[Q(t, e[r].time)], i = (n.high - n.low) * Pi + 2 ** -52;
|
|
5348
5335
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5349
5336
|
}
|
|
5350
5337
|
return !0;
|
|
@@ -5354,9 +5341,9 @@ function Z(e) {
|
|
|
5354
5341
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5355
5342
|
return t > 0 ? t : Infinity;
|
|
5356
5343
|
}
|
|
5357
|
-
function
|
|
5344
|
+
function Vi(e, t) {
|
|
5358
5345
|
if (t.length === 0) return null;
|
|
5359
|
-
let n = t[t.length - 1].time + Z(t), r = e.filter((e) =>
|
|
5346
|
+
let n = t[t.length - 1].time + Z(t), r = e.filter((e) => Ln(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5360
5347
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5361
5348
|
if (i.length === 0) return null;
|
|
5362
5349
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5372,26 +5359,26 @@ function Q(e, t) {
|
|
|
5372
5359
|
}
|
|
5373
5360
|
return n;
|
|
5374
5361
|
}
|
|
5375
|
-
function
|
|
5362
|
+
function Hi(e, t, n) {
|
|
5376
5363
|
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;
|
|
5377
5364
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5378
5365
|
return Math.max(0, a);
|
|
5379
5366
|
}
|
|
5380
|
-
function
|
|
5367
|
+
function Ui(e, t, n) {
|
|
5381
5368
|
let r = n;
|
|
5382
5369
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5383
5370
|
let i = {
|
|
5384
5371
|
...t[r],
|
|
5385
5372
|
time: e.time
|
|
5386
5373
|
};
|
|
5387
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5374
|
+
for (let e = r + 1; e <= n; e++) i = qi(i, t[e]);
|
|
5388
5375
|
return i;
|
|
5389
5376
|
}
|
|
5390
|
-
function
|
|
5377
|
+
function Wi(e, t, n, r) {
|
|
5391
5378
|
let i = e[n + 1], a = t[r + 1];
|
|
5392
5379
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5393
5380
|
}
|
|
5394
|
-
function
|
|
5381
|
+
function Gi(e, t) {
|
|
5395
5382
|
let n = /* @__PURE__ */ new Map();
|
|
5396
5383
|
for (let r of e) {
|
|
5397
5384
|
let e = t[Q(t, r.time)].time, i = n.get(e);
|
|
@@ -5399,10 +5386,10 @@ function qi(e, t) {
|
|
|
5399
5386
|
}
|
|
5400
5387
|
return n;
|
|
5401
5388
|
}
|
|
5402
|
-
function
|
|
5389
|
+
function Ki() {
|
|
5403
5390
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5404
5391
|
}
|
|
5405
|
-
function
|
|
5392
|
+
function qi(e, t) {
|
|
5406
5393
|
return {
|
|
5407
5394
|
time: e.time,
|
|
5408
5395
|
open: e.open,
|
|
@@ -5414,26 +5401,26 @@ function Yi(e, t) {
|
|
|
5414
5401
|
}
|
|
5415
5402
|
//#endregion
|
|
5416
5403
|
//#region src/io/parseOHLCV.ts
|
|
5417
|
-
var
|
|
5404
|
+
var Ji = [
|
|
5418
5405
|
"time",
|
|
5419
5406
|
"timestamp",
|
|
5420
5407
|
"date",
|
|
5421
5408
|
"datetime",
|
|
5422
5409
|
"t"
|
|
5423
|
-
],
|
|
5410
|
+
], Yi = ["open", "o"], Xi = ["high", "h"], Zi = ["low", "l"], Qi = ["close", "c"], $i = [
|
|
5424
5411
|
"volume",
|
|
5425
5412
|
"vol",
|
|
5426
5413
|
"v"
|
|
5427
5414
|
];
|
|
5428
|
-
function
|
|
5415
|
+
function ea(e) {
|
|
5429
5416
|
let t = e.trim();
|
|
5430
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5417
|
+
return t ? t[0] === "[" || t[0] === "{" ? ta(t) : na(t) : {
|
|
5431
5418
|
data: [],
|
|
5432
5419
|
rowCount: 0,
|
|
5433
5420
|
skipped: 0
|
|
5434
5421
|
};
|
|
5435
5422
|
}
|
|
5436
|
-
function
|
|
5423
|
+
function ta(e) {
|
|
5437
5424
|
let t;
|
|
5438
5425
|
try {
|
|
5439
5426
|
t = JSON.parse(e);
|
|
@@ -5443,19 +5430,19 @@ function ra(e) {
|
|
|
5443
5430
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5444
5431
|
let n = [], r = 0;
|
|
5445
5432
|
for (let e of t) {
|
|
5446
|
-
let t = Array.isArray(e) ?
|
|
5433
|
+
let t = Array.isArray(e) ? sa(e) : oa(e);
|
|
5447
5434
|
t ? n.push(t) : r++;
|
|
5448
5435
|
}
|
|
5449
|
-
return
|
|
5436
|
+
return la(n, t.length, r);
|
|
5450
5437
|
}
|
|
5451
|
-
function
|
|
5438
|
+
function na(e) {
|
|
5452
5439
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5453
5440
|
if (t.length === 0) return {
|
|
5454
5441
|
data: [],
|
|
5455
5442
|
rowCount: 0,
|
|
5456
5443
|
skipped: 0
|
|
5457
5444
|
};
|
|
5458
|
-
let n =
|
|
5445
|
+
let n = ra(t[0]), r = ia(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? aa(r) : {
|
|
5459
5446
|
time: 0,
|
|
5460
5447
|
open: 1,
|
|
5461
5448
|
high: 2,
|
|
@@ -5466,7 +5453,7 @@ function ia(e) {
|
|
|
5466
5453
|
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");
|
|
5467
5454
|
let o = [], s = 0;
|
|
5468
5455
|
for (let e = +!!i; e < t.length; e++) {
|
|
5469
|
-
let r =
|
|
5456
|
+
let r = ia(t[e], n), i = ca(r[a.time]), c = $(r[a.open]), l = $(r[a.high]), u = $(r[a.low]), d = $(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
5470
5457
|
if (i === null || ![
|
|
5471
5458
|
c,
|
|
5472
5459
|
l,
|
|
@@ -5485,9 +5472,9 @@ function ia(e) {
|
|
|
5485
5472
|
volume: Number.isFinite(f) ? f : 0
|
|
5486
5473
|
});
|
|
5487
5474
|
}
|
|
5488
|
-
return
|
|
5475
|
+
return la(o, t.length - +!!i, s);
|
|
5489
5476
|
}
|
|
5490
|
-
function
|
|
5477
|
+
function ra(e) {
|
|
5491
5478
|
let t = {
|
|
5492
5479
|
",": 0,
|
|
5493
5480
|
";": 0,
|
|
@@ -5499,7 +5486,7 @@ function aa(e) {
|
|
|
5499
5486
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5500
5487
|
return n;
|
|
5501
5488
|
}
|
|
5502
|
-
function
|
|
5489
|
+
function ia(e, t) {
|
|
5503
5490
|
let n = [], r = "", i = !1;
|
|
5504
5491
|
for (let a = 0; a < e.length; a++) {
|
|
5505
5492
|
let o = e[a];
|
|
@@ -5507,25 +5494,25 @@ function oa(e, t) {
|
|
|
5507
5494
|
}
|
|
5508
5495
|
return n.push(r), n;
|
|
5509
5496
|
}
|
|
5510
|
-
function
|
|
5497
|
+
function aa(e) {
|
|
5511
5498
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5512
5499
|
return {
|
|
5513
|
-
time: t(
|
|
5514
|
-
open: t(
|
|
5515
|
-
high: t(
|
|
5516
|
-
low: t(
|
|
5517
|
-
close: t(
|
|
5518
|
-
volume: t(
|
|
5500
|
+
time: t(Ji),
|
|
5501
|
+
open: t(Yi),
|
|
5502
|
+
high: t(Xi),
|
|
5503
|
+
low: t(Zi),
|
|
5504
|
+
close: t(Qi),
|
|
5505
|
+
volume: t($i)
|
|
5519
5506
|
};
|
|
5520
5507
|
}
|
|
5521
|
-
function
|
|
5508
|
+
function oa(e) {
|
|
5522
5509
|
let t = (t) => {
|
|
5523
5510
|
for (let n of t) {
|
|
5524
5511
|
if (e[n] !== void 0) return e[n];
|
|
5525
5512
|
let t = n.toUpperCase();
|
|
5526
5513
|
if (e[t] !== void 0) return e[t];
|
|
5527
5514
|
}
|
|
5528
|
-
}, n =
|
|
5515
|
+
}, n = ca(String(t(Ji) ?? "")), r = Number(t(Yi)), i = Number(t(Xi)), a = Number(t(Zi)), o = Number(t(Qi)), s = Number(t($i) ?? 0);
|
|
5529
5516
|
return n === null || ![
|
|
5530
5517
|
r,
|
|
5531
5518
|
i,
|
|
@@ -5540,9 +5527,9 @@ function ca(e) {
|
|
|
5540
5527
|
volume: Number.isFinite(s) ? s : 0
|
|
5541
5528
|
};
|
|
5542
5529
|
}
|
|
5543
|
-
function
|
|
5530
|
+
function sa(e) {
|
|
5544
5531
|
if (e.length < 5) return null;
|
|
5545
|
-
let t =
|
|
5532
|
+
let t = ca(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;
|
|
5546
5533
|
return t === null || ![
|
|
5547
5534
|
n,
|
|
5548
5535
|
r,
|
|
@@ -5560,15 +5547,15 @@ function la(e) {
|
|
|
5560
5547
|
function $(e) {
|
|
5561
5548
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5562
5549
|
}
|
|
5563
|
-
function
|
|
5550
|
+
function ca(e) {
|
|
5564
5551
|
let t = e.trim();
|
|
5565
5552
|
if (!t) return null;
|
|
5566
5553
|
let n = Number(t);
|
|
5567
|
-
if (Number.isFinite(n) && n > 0) return
|
|
5554
|
+
if (Number.isFinite(n) && n > 0) return x(n);
|
|
5568
5555
|
let r = Date.parse(t);
|
|
5569
5556
|
return Number.isFinite(r) ? r : null;
|
|
5570
5557
|
}
|
|
5571
|
-
function
|
|
5558
|
+
function la(e, t, n) {
|
|
5572
5559
|
e.sort((e, t) => e.time - t.time);
|
|
5573
5560
|
let r = [];
|
|
5574
5561
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5580,7 +5567,7 @@ function da(e, t, n) {
|
|
|
5580
5567
|
}
|
|
5581
5568
|
//#endregion
|
|
5582
5569
|
//#region src/io/DragDropImporter.ts
|
|
5583
|
-
var
|
|
5570
|
+
var ua = class {
|
|
5584
5571
|
host;
|
|
5585
5572
|
overlay = null;
|
|
5586
5573
|
callbacks;
|
|
@@ -5601,19 +5588,19 @@ var fa = class {
|
|
|
5601
5588
|
this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
|
|
5602
5589
|
}
|
|
5603
5590
|
onDragEnter(e) {
|
|
5604
|
-
|
|
5591
|
+
da(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5605
5592
|
}
|
|
5606
5593
|
onDragOver(e) {
|
|
5607
|
-
|
|
5594
|
+
da(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5608
5595
|
}
|
|
5609
5596
|
onDragLeave(e) {
|
|
5610
|
-
|
|
5597
|
+
da(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5611
5598
|
}
|
|
5612
5599
|
async onDrop(e) {
|
|
5613
5600
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5614
5601
|
let t = e.dataTransfer?.files?.[0];
|
|
5615
5602
|
if (t) try {
|
|
5616
|
-
let e =
|
|
5603
|
+
let e = ea(await t.text());
|
|
5617
5604
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5618
5605
|
this.callbacks.onData(e.data, e, t);
|
|
5619
5606
|
} catch (e) {
|
|
@@ -5644,12 +5631,12 @@ var fa = class {
|
|
|
5644
5631
|
this.overlay?.remove(), this.overlay = null;
|
|
5645
5632
|
}
|
|
5646
5633
|
};
|
|
5647
|
-
function
|
|
5634
|
+
function da(e) {
|
|
5648
5635
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5649
5636
|
}
|
|
5650
5637
|
//#endregion
|
|
5651
5638
|
//#region src/state/layoutStorage.ts
|
|
5652
|
-
function
|
|
5639
|
+
function fa(e) {
|
|
5653
5640
|
let t = {
|
|
5654
5641
|
id: e.id,
|
|
5655
5642
|
name: e.name,
|
|
@@ -5657,11 +5644,11 @@ function ma(e) {
|
|
|
5657
5644
|
};
|
|
5658
5645
|
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;
|
|
5659
5646
|
}
|
|
5660
|
-
var
|
|
5661
|
-
function
|
|
5647
|
+
var pa = (e, t) => t.updatedAt - e.updatedAt;
|
|
5648
|
+
function ma(e) {
|
|
5662
5649
|
if (typeof e != "object" || !e) return null;
|
|
5663
5650
|
let t = e;
|
|
5664
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
5651
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : fa({
|
|
5665
5652
|
id: t.id,
|
|
5666
5653
|
name: t.name,
|
|
5667
5654
|
updatedAt: t.updatedAt,
|
|
@@ -5670,17 +5657,17 @@ function ga(e) {
|
|
|
5670
5657
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
5671
5658
|
});
|
|
5672
5659
|
}
|
|
5673
|
-
function
|
|
5674
|
-
let t =
|
|
5660
|
+
function ha(e) {
|
|
5661
|
+
let t = ma(e), n = t ? e.content : void 0;
|
|
5675
5662
|
return t && typeof n == "string" ? {
|
|
5676
5663
|
...t,
|
|
5677
5664
|
content: n
|
|
5678
5665
|
} : null;
|
|
5679
5666
|
}
|
|
5680
|
-
function
|
|
5667
|
+
function ga(e = []) {
|
|
5681
5668
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
5682
5669
|
return {
|
|
5683
|
-
list: () => [...t.values()].map(
|
|
5670
|
+
list: () => [...t.values()].map(fa).sort(pa),
|
|
5684
5671
|
load: (e) => {
|
|
5685
5672
|
let n = t.get(e);
|
|
5686
5673
|
return n ? { ...n } : null;
|
|
@@ -5693,7 +5680,7 @@ function va(e = []) {
|
|
|
5693
5680
|
}
|
|
5694
5681
|
};
|
|
5695
5682
|
}
|
|
5696
|
-
function
|
|
5683
|
+
function _a(e = "tcw:layouts:") {
|
|
5697
5684
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
5698
5685
|
let e;
|
|
5699
5686
|
try {
|
|
@@ -5701,10 +5688,10 @@ function ya(e = "tcw:layouts:") {
|
|
|
5701
5688
|
} catch {
|
|
5702
5689
|
return [];
|
|
5703
5690
|
}
|
|
5704
|
-
return Array.isArray(e) ? e.map(
|
|
5691
|
+
return Array.isArray(e) ? e.map(ma).filter((e) => e !== null) : [];
|
|
5705
5692
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
5706
5693
|
return {
|
|
5707
|
-
list: () => r().sort(
|
|
5694
|
+
list: () => r().sort(pa),
|
|
5708
5695
|
load: (e) => {
|
|
5709
5696
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
5710
5697
|
return t && i !== null ? {
|
|
@@ -5713,7 +5700,7 @@ function ya(e = "tcw:layouts:") {
|
|
|
5713
5700
|
} : null;
|
|
5714
5701
|
},
|
|
5715
5702
|
save: (e) => {
|
|
5716
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
5703
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), fa(e)]);
|
|
5717
5704
|
},
|
|
5718
5705
|
remove: (e) => {
|
|
5719
5706
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -5722,14 +5709,14 @@ function ya(e = "tcw:layouts:") {
|
|
|
5722
5709
|
}
|
|
5723
5710
|
//#endregion
|
|
5724
5711
|
//#region src/state/LayoutSession.ts
|
|
5725
|
-
var
|
|
5726
|
-
function
|
|
5712
|
+
var va = 80;
|
|
5713
|
+
function ya(e) {
|
|
5727
5714
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
5728
5715
|
}
|
|
5729
|
-
function
|
|
5716
|
+
function ba() {
|
|
5730
5717
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
5731
5718
|
}
|
|
5732
|
-
function
|
|
5719
|
+
function xa(e) {
|
|
5733
5720
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
5734
5721
|
return {
|
|
5735
5722
|
id: t,
|
|
@@ -5740,7 +5727,7 @@ function Ca(e) {
|
|
|
5740
5727
|
...o === void 0 ? {} : { kind: o }
|
|
5741
5728
|
};
|
|
5742
5729
|
}
|
|
5743
|
-
var
|
|
5730
|
+
var Sa = class {
|
|
5744
5731
|
currentLayout = null;
|
|
5745
5732
|
savedContent = null;
|
|
5746
5733
|
dirty = !1;
|
|
@@ -5756,7 +5743,7 @@ var wa = class {
|
|
|
5756
5743
|
now;
|
|
5757
5744
|
newId;
|
|
5758
5745
|
constructor(e, t, n = {}) {
|
|
5759
|
-
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 ??
|
|
5746
|
+
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 ?? ba;
|
|
5760
5747
|
}
|
|
5761
5748
|
current() {
|
|
5762
5749
|
return this.currentLayout;
|
|
@@ -5772,7 +5759,7 @@ var wa = class {
|
|
|
5772
5759
|
}
|
|
5773
5760
|
async list() {
|
|
5774
5761
|
let e = await this.storage.list();
|
|
5775
|
-
return Array.isArray(e) ? e.map(
|
|
5762
|
+
return Array.isArray(e) ? e.map(ma).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
5776
5763
|
}
|
|
5777
5764
|
save() {
|
|
5778
5765
|
return this.queue(() => {
|
|
@@ -5781,12 +5768,12 @@ var wa = class {
|
|
|
5781
5768
|
});
|
|
5782
5769
|
}
|
|
5783
5770
|
saveAs(e) {
|
|
5784
|
-
let t =
|
|
5771
|
+
let t = ya(e);
|
|
5785
5772
|
return t ? this.queue(() => this.write(this.newId(), t)) : Promise.reject(/* @__PURE__ */ Error("A layout needs a name"));
|
|
5786
5773
|
}
|
|
5787
5774
|
open(e) {
|
|
5788
5775
|
return this.queue(async () => {
|
|
5789
|
-
let t =
|
|
5776
|
+
let t = ha(await this.storage.load(e));
|
|
5790
5777
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
5791
5778
|
this.cancelTimer(), this.applying++;
|
|
5792
5779
|
try {
|
|
@@ -5796,13 +5783,13 @@ var wa = class {
|
|
|
5796
5783
|
} finally {
|
|
5797
5784
|
this.applying--;
|
|
5798
5785
|
}
|
|
5799
|
-
return this.cancelTimer(), this.currentLayout =
|
|
5786
|
+
return this.cancelTimer(), this.currentLayout = xa(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
5800
5787
|
});
|
|
5801
5788
|
}
|
|
5802
5789
|
rename(e, t) {
|
|
5803
|
-
let n =
|
|
5790
|
+
let n = ya(t);
|
|
5804
5791
|
return n ? this.queue(async () => {
|
|
5805
|
-
let t =
|
|
5792
|
+
let t = ha(await this.storage.load(e));
|
|
5806
5793
|
!t || t.id !== e || (await this.storage.save({
|
|
5807
5794
|
...t,
|
|
5808
5795
|
name: n
|
|
@@ -5880,7 +5867,7 @@ var wa = class {
|
|
|
5880
5867
|
content: n.content
|
|
5881
5868
|
};
|
|
5882
5869
|
await this.storage.save(r);
|
|
5883
|
-
let i =
|
|
5870
|
+
let i = xa(r);
|
|
5884
5871
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
5885
5872
|
}
|
|
5886
5873
|
forget() {
|
|
@@ -5901,6 +5888,6 @@ var wa = class {
|
|
|
5901
5888
|
}
|
|
5902
5889
|
};
|
|
5903
5890
|
//#endregion
|
|
5904
|
-
export {
|
|
5891
|
+
export { fr as C, jn as D, z as E, hr as S, In as T, Nr as _, ga as a, G as b, Ei as c, ni as d, ri as f, Mr as g, Pr as h, _a as i, gi as l, Fr as m, va as n, ua as o, Ir as p, ya as r, ea as s, Sa as t, hi as u, Ar as v, ur as w, br as x, jr as y };
|
|
5905
5892
|
|
|
5906
|
-
//# sourceMappingURL=LayoutSession-
|
|
5893
|
+
//# sourceMappingURL=LayoutSession-qRYG8GTD.js.map
|