@tradecanvas/chart 1.82.0 → 1.83.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-CLlUszTA.js → LayoutSession--k_77YkA.js} +617 -379
- package/dist/LayoutSession--k_77YkA.js.map +1 -0
- package/dist/LayoutSession-CEqWF-nM.cjs +2 -0
- package/dist/LayoutSession-CEqWF-nM.cjs.map +1 -0
- package/dist/{WidgetCommandPalette-p4DQCe57.js → WidgetCommandPalette-DHGvEl9n.js} +2 -2
- package/dist/{WidgetCommandPalette-p4DQCe57.js.map → WidgetCommandPalette-DHGvEl9n.js.map} +1 -1
- package/dist/{WidgetCommandPalette-BNBL1mO2.cjs → WidgetCommandPalette-Ol8Z923q.cjs} +2 -2
- package/dist/{WidgetCommandPalette-BNBL1mO2.cjs.map → WidgetCommandPalette-Ol8Z923q.cjs.map} +1 -1
- package/dist/{WidgetDrawingSettings-D7l2NkVj.js → WidgetDrawingSettings-CSB88SvC.js} +2 -2
- package/dist/{WidgetDrawingSettings-D7l2NkVj.js.map → WidgetDrawingSettings-CSB88SvC.js.map} +1 -1
- package/dist/{WidgetDrawingSettings-BqGuAMz3.cjs → WidgetDrawingSettings-XL1Z9-ly.cjs} +2 -2
- package/dist/{WidgetDrawingSettings-BqGuAMz3.cjs.map → WidgetDrawingSettings-XL1Z9-ly.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-BOxIKUn-.cjs → WidgetIndicatorPicker-K01RJSLs.cjs} +2 -2
- package/dist/{WidgetIndicatorPicker-BOxIKUn-.cjs.map → WidgetIndicatorPicker-K01RJSLs.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-Bk0y6c35.js → WidgetIndicatorPicker-a4rpptDc.js} +2 -2
- package/dist/{WidgetIndicatorPicker-Bk0y6c35.js.map → WidgetIndicatorPicker-a4rpptDc.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-BmOqq2Fv.js → WidgetIndicatorSettings-BmIFp19I.js} +3 -3
- package/dist/{WidgetIndicatorSettings-BmOqq2Fv.js.map → WidgetIndicatorSettings-BmIFp19I.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-DrPcNSxS.cjs → WidgetIndicatorSettings-CJWR-x9q.cjs} +2 -2
- package/dist/{WidgetIndicatorSettings-DrPcNSxS.cjs.map → WidgetIndicatorSettings-CJWR-x9q.cjs.map} +1 -1
- package/dist/{WidgetSettings-C6m55YF0.js → WidgetSettings-9clgY3_1.js} +2 -2
- package/dist/{WidgetSettings-C6m55YF0.js.map → WidgetSettings-9clgY3_1.js.map} +1 -1
- package/dist/{WidgetSettings-B57_tUke.cjs → WidgetSettings-D6COgRaB.cjs} +2 -2
- package/dist/{WidgetSettings-B57_tUke.cjs.map → WidgetSettings-D6COgRaB.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-8HMKUv2P.cjs → WidgetSymbolSearch-6EB31v-O.cjs} +2 -2
- package/dist/{WidgetSymbolSearch-8HMKUv2P.cjs.map → WidgetSymbolSearch-6EB31v-O.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-BdI1egoq.js → WidgetSymbolSearch-DToOqJoG.js} +2 -2
- package/dist/{WidgetSymbolSearch-BdI1egoq.js.map → WidgetSymbolSearch-DToOqJoG.js.map} +1 -1
- package/dist/grid/ChartGrid.d.ts +9 -1
- package/dist/grid/ChartGrid.d.ts.map +1 -1
- package/dist/grid/gridShapes.d.ts +43 -0
- package/dist/grid/gridShapes.d.ts.map +1 -0
- package/dist/i18n-D0SPfH2s.cjs +2 -0
- package/dist/i18n-D0SPfH2s.cjs.map +1 -0
- package/dist/{i18n-BMzvClhl.js → i18n-nWmX3G55.js} +11 -1
- package/dist/i18n-nWmX3G55.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -179
- package/dist/index.js.map +1 -1
- package/dist/{indicatorInputWords-Dn_gEPug.js → indicatorInputWords-D0SGBaUD.js} +2 -2
- package/dist/{indicatorInputWords-Dn_gEPug.js.map → indicatorInputWords-D0SGBaUD.js.map} +1 -1
- package/dist/{indicatorInputWords-DGObUFDn.cjs → indicatorInputWords-HqTGFokF.cjs} +2 -2
- package/dist/{indicatorInputWords-DGObUFDn.cjs.map → indicatorInputWords-HqTGFokF.cjs.map} +1 -1
- package/dist/widget/ChartWidget.d.ts +2 -0
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/ChartWidgetGrid.d.ts +7 -10
- package/dist/widget/ChartWidgetGrid.d.ts.map +1 -1
- package/dist/widget/GridLayoutPicker.d.ts +55 -0
- package/dist/widget/GridLayoutPicker.d.ts.map +1 -0
- package/dist/widget/WatchlistStore.d.ts +11 -0
- package/dist/widget/WatchlistStore.d.ts.map +1 -1
- package/dist/widget/WidgetDockArea.d.ts +1 -0
- package/dist/widget/WidgetDockArea.d.ts.map +1 -1
- package/dist/widget/WidgetToolbar.d.ts.map +1 -1
- package/dist/widget/WidgetWatchlist.d.ts +3 -0
- package/dist/widget/WidgetWatchlist.d.ts.map +1 -1
- package/dist/widget/WidgetWatchlists.d.ts +1 -0
- package/dist/widget/WidgetWatchlists.d.ts.map +1 -1
- package/dist/widget/index.cjs +59 -4
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.d.ts +1 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +1662 -1532
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/locales/ar.d.ts.map +1 -1
- package/dist/widget/locales/cs.d.ts.map +1 -1
- package/dist/widget/locales/da.d.ts.map +1 -1
- package/dist/widget/locales/de.d.ts.map +1 -1
- package/dist/widget/locales/el.d.ts.map +1 -1
- package/dist/widget/locales/en.d.ts +5 -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 +141 -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/types.d.ts +7 -1
- package/dist/widget/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-CLlUszTA.js.map +0 -1
- package/dist/LayoutSession-Cs8SJ1LU.cjs +0 -2
- package/dist/LayoutSession-Cs8SJ1LU.cjs.map +0 -1
- package/dist/i18n-BMzvClhl.js.map +0 -1
- package/dist/i18n-Dq-eMISy.cjs +0 -2
- package/dist/i18n-Dq-eMISy.cjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as e } from "./indicatorLabel-BsidWCv1.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
|
|
3
|
-
import { AlertDragHandler as
|
|
2
|
+
import { DARK_THEME as t, DEFAULT_PANEL_HEIGHT as n, LIGHT_THEME as r, LayerType as i, MIN_PANEL_HEIGHT as a, PHI as o, PRICE_AXIS_WIDTH as s, TIME_AXIS_HEIGHT as c, autoPricePrecision as l, barDateZone as u, barTimeUnit as d, barsAreDaily as f, chartStyleValue as p, computePriceLimits as m, computePriceRange as h, createMarketTheme as g, formatPrice as _, fractionTick as v, indicatorSource as y, isValidTimeZone as b, mergeBar as ee, niceNumber as te, normalizeBarTime as x, parseIndicatorSource as S, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as C, readIndicatorPlotStyles as ae, readPaneStyle as oe, resolveChartTheme as se, sessionMinute as w, setLocale as ce, stepDecimals as le, symbolTimeZone as T, tickBarCount as ue, timeframeToMs as E, zonedDateFormatter as de } from "@tradecanvas/commons";
|
|
3
|
+
import { AlertDragHandler as fe, AlertManager as pe, Animator as me, AreaRenderer as he, AxisDragHandler as ge, BarCountdown as _e, BarRenderer as ve, BaselineRenderer as ye, CandlestickRenderer as be, ChartLegend as xe, ChartStateManager as D, CompareRenderer as Se, CompareSymbolIndicator as Ce, CompareSymbolPaneIndicator as we, CorrelationCoefficientIndicator as Te, CorrelationLogIndicator as Ee, CrosshairHandler as De, CrosshairTooltip as Oe, CurrentPriceLine as ke, DEFAULT_SESSION_HOURS as Ae, DataExporter as O, DepthHeatmapRenderer as je, DrawingManager as Me, DrawingRenderer as Ne, EquivolumeRenderer as Pe, EventBus as Fe, GridRenderer as Ie, HLCAreaRenderer as Le, HiLoRenderer as Re, HollowCandleRenderer as ze, IndicatorEngine as Be, InteractionManager as Ve, KagiRenderer as He, KeyboardHandler as Ue, LineRenderer as We, LineWithMarkersRenderer as Ge, MarketProfileRenderer as Ke, MeasureOverlay as qe, PRICE_AXIS_ADD_STRIP as Je, PRICE_SCALE_MARGIN as k, PanHandler as Ye, PaneResizeHandler as Xe, PeriodLevelsRenderer as Ze, PinnedTooltip as Qe, PivotMarkersRenderer as $e, PointAndFigureRenderer as et, PriceAxis as tt, PriceAxisAddButton as nt, PriceLines as rt, RenderEngine as it, RenkoRenderer as at, ReplayManager as ot, ResamplingAdapter as st, ReshapeMemo as ct, SYMBOL_INDICATOR_IDS as lt, SYMBOL_ZONE_WAIT_MS as ut, Screenshot as A, SelectionBoxOverlay as dt, SessionBreaks as ft, SessionShading as pt, SignalMarkerManager as mt, SpreadIndicator as ht, StepLineRenderer as gt, StreamManager as _t, SymbolSeriesStore as vt, TimeAxis as yt, TradeZoneManager as bt, TradingManager as xt, TradingRenderer as St, UndoRedoManager as Ct, Viewport as wt, VolumeCandleRenderer as Tt, VolumeProfileRenderer as Et, VolumeRenderer as Dt, Watermark as Ot, ZoomHandler as kt, axisTimes as At, barTimeStepMs as jt, findDominantSwing as Mt, gpuContextsLeft as Nt, idleCssCursor as Pt, isCrosshairCursor as Ft, isPriceLevelAlert as It, isRegularSession as Lt, loadWebGL as Rt, mergeSessionHours as zt, pointAndFigureColumns as Bt, rangePresetStart as Vt, readAlertOptions as Ht, registerBuiltInDrawingTools as Ut, registerBuiltInIndicators as Wt, servesTimeframe as j, sourceParam as M, streamAdapterOf as Gt, timestampToBarIndex as N, toHeikinAshi as Kt, toKagi as qt, toLineBreak as Jt, toRangeBars as Yt, toRenko as Xt, whenGpuContextFree as Zt, withResampling as P, xToBarIndex as Qt, xToTime as F, yToPrice as $t } from "@tradecanvas/core";
|
|
4
4
|
//#region src/regularHours.ts
|
|
5
5
|
var en = 864e5, tn = 10;
|
|
6
6
|
function nn(e, t) {
|
|
7
|
-
let n =
|
|
7
|
+
let n = T(e);
|
|
8
8
|
if (!n || !b(n) || t.length < 2) return null;
|
|
9
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
10
|
-
let t =
|
|
10
|
+
let t = w(e.start), n = w(e.end);
|
|
11
11
|
return t === null || n === null ? [] : [{
|
|
12
12
|
startMinute: t,
|
|
13
13
|
endMinute: n
|
|
@@ -165,22 +165,22 @@ function dn(e) {
|
|
|
165
165
|
case "candlestick":
|
|
166
166
|
case "heikinAshi":
|
|
167
167
|
case "lineBreak":
|
|
168
|
-
case "rangeBars": return new
|
|
169
|
-
case "line": return new
|
|
170
|
-
case "area": return new
|
|
171
|
-
case "bar": return new
|
|
172
|
-
case "hollowCandle": return new
|
|
173
|
-
case "baseline": return new
|
|
174
|
-
case "renko": return new
|
|
175
|
-
case "kagi": return new
|
|
176
|
-
case "pointAndFigure": return new
|
|
177
|
-
case "volumeCandles": return new
|
|
178
|
-
case "equivolume": return new
|
|
179
|
-
case "hlcArea": return new
|
|
180
|
-
case "stepLine": return new
|
|
181
|
-
case "lineWithMarkers": return new
|
|
182
|
-
case "hiLo": return new
|
|
183
|
-
default: return new
|
|
168
|
+
case "rangeBars": return new be();
|
|
169
|
+
case "line": return new We();
|
|
170
|
+
case "area": return new he();
|
|
171
|
+
case "bar": return new ve();
|
|
172
|
+
case "hollowCandle": return new ze();
|
|
173
|
+
case "baseline": return new ye();
|
|
174
|
+
case "renko": return new at();
|
|
175
|
+
case "kagi": return new He();
|
|
176
|
+
case "pointAndFigure": return new et();
|
|
177
|
+
case "volumeCandles": return new Tt();
|
|
178
|
+
case "equivolume": return new Pe();
|
|
179
|
+
case "hlcArea": return new Le();
|
|
180
|
+
case "stepLine": return new gt();
|
|
181
|
+
case "lineWithMarkers": return new Ge();
|
|
182
|
+
case "hiLo": return new Re();
|
|
183
|
+
default: return new be();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
function fn(e, t, n = {}, r, i) {
|
|
@@ -327,37 +327,37 @@ function B(e) {
|
|
|
327
327
|
volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function V(e, t) {
|
|
331
331
|
return e === t || e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Nn(e, t) {
|
|
334
334
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
335
335
|
if (e[n].time === t) return n;
|
|
336
336
|
if (e[n].time < t) return -1;
|
|
337
337
|
}
|
|
338
338
|
return -1;
|
|
339
339
|
}
|
|
340
|
-
var
|
|
340
|
+
var Pn = {
|
|
341
341
|
index: -1,
|
|
342
342
|
changed: !1
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function Fn(e, t) {
|
|
345
345
|
if (e.length === 0) return t;
|
|
346
346
|
let n = x(t);
|
|
347
347
|
return d(e) === 1 ? n : n / 1e3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
let n =
|
|
349
|
+
function In(e, t) {
|
|
350
|
+
let n = Fn(e, t.time);
|
|
351
351
|
return n === t.time ? t : {
|
|
352
352
|
...t,
|
|
353
353
|
time: n
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
var
|
|
356
|
+
var H = class {
|
|
357
357
|
data = [];
|
|
358
358
|
changes = 0;
|
|
359
359
|
withSeriesTime(e) {
|
|
360
|
-
return
|
|
360
|
+
return In(this.data, e);
|
|
361
361
|
}
|
|
362
362
|
getData() {
|
|
363
363
|
return this.data;
|
|
@@ -399,11 +399,11 @@ var Rn = class {
|
|
|
399
399
|
this.data[this.data.length - 1] = t;
|
|
400
400
|
}
|
|
401
401
|
replaceBar(e) {
|
|
402
|
-
if (!z(e)) return
|
|
403
|
-
let t = this.withSeriesTime(e), n =
|
|
404
|
-
if (n < 0) return
|
|
402
|
+
if (!z(e)) return Pn;
|
|
403
|
+
let t = this.withSeriesTime(e), n = Nn(this.data, t.time);
|
|
404
|
+
if (n < 0) return Pn;
|
|
405
405
|
let r = B(t);
|
|
406
|
-
return
|
|
406
|
+
return V(this.data[n], r) ? {
|
|
407
407
|
index: n,
|
|
408
408
|
changed: !1
|
|
409
409
|
} : (this.data[n] = r, this.changes++, {
|
|
@@ -420,18 +420,18 @@ var Rn = class {
|
|
|
420
420
|
clear() {
|
|
421
421
|
this.data = [], this.changes++;
|
|
422
422
|
}
|
|
423
|
-
},
|
|
423
|
+
}, U = {
|
|
424
424
|
to: "none",
|
|
425
425
|
index: -1,
|
|
426
426
|
changed: !1
|
|
427
427
|
};
|
|
428
|
-
function
|
|
428
|
+
function W(e, t) {
|
|
429
429
|
let n = e[e.length - 1];
|
|
430
430
|
if (!n) return "append";
|
|
431
431
|
let r = x(t.time), i = x(n.time);
|
|
432
432
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Ln(e) {
|
|
435
435
|
return [
|
|
436
436
|
e.time,
|
|
437
437
|
e.open,
|
|
@@ -440,8 +440,8 @@ function zn(e) {
|
|
|
440
440
|
e.close
|
|
441
441
|
].every(Number.isFinite);
|
|
442
442
|
}
|
|
443
|
-
var
|
|
444
|
-
shown = new
|
|
443
|
+
var Rn = class {
|
|
444
|
+
shown = new H();
|
|
445
445
|
whole = null;
|
|
446
446
|
aside = null;
|
|
447
447
|
shownRevision = 0;
|
|
@@ -483,7 +483,7 @@ var Bn = class {
|
|
|
483
483
|
}
|
|
484
484
|
let t = null, n = e;
|
|
485
485
|
if (this.whole) {
|
|
486
|
-
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(
|
|
486
|
+
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(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);
|
|
487
487
|
this.whole = [...a, ...this.whole];
|
|
488
488
|
let o = this.hoursFilter(this.whole);
|
|
489
489
|
t = a.length, n = o ? a.filter((e) => o(e.time)) : a;
|
|
@@ -495,8 +495,8 @@ var Bn = class {
|
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
497
|
mergeSnapshot(e) {
|
|
498
|
-
if (this.aside) return this.aside.setData(
|
|
499
|
-
let t =
|
|
498
|
+
if (this.aside) return this.aside.setData(zn(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = zn(this.whole ?? this.shown.getData(), e);
|
|
500
500
|
return t ? (this.shown.setData(this.regularOnly(t)), !0) : !1;
|
|
501
501
|
}
|
|
502
502
|
refilter() {
|
|
@@ -553,7 +553,7 @@ var Bn = class {
|
|
|
553
553
|
mergeTick(e) {
|
|
554
554
|
if (this.aside) return this.aside.updateLastBarFromTick(e), this.wrote("aside", !1);
|
|
555
555
|
let t = this.whole ? this.hoursFilter(this.whole) : null;
|
|
556
|
-
if (t && this.whole && !t(
|
|
556
|
+
if (t && this.whole && !t(Fn(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
557
557
|
let n = this.shown.getLength();
|
|
558
558
|
this.shown.updateLastBarFromTick(e);
|
|
559
559
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -565,14 +565,14 @@ var Bn = class {
|
|
|
565
565
|
}
|
|
566
566
|
placeStreamBar(e) {
|
|
567
567
|
if (this.aside) {
|
|
568
|
-
let t =
|
|
568
|
+
let t = W(this.aside.getData(), e);
|
|
569
569
|
return t === "append" ? this.aside.appendBar(e) : t === "update" && this.aside.updateLastBar(e), this.wrote(t === "stale" ? "none" : "aside", !1);
|
|
570
570
|
}
|
|
571
|
-
let t = this.inSeriesUnit(e), n =
|
|
571
|
+
let t = this.inSeriesUnit(e), n = W(this.whole ?? this.shown.getData(), t);
|
|
572
572
|
if (n === "stale") return this.wrote("none", !1);
|
|
573
573
|
let r = this.startWholeSeries(t, n);
|
|
574
574
|
if (!this.take(t, n)) return this.wrote("hidden", r);
|
|
575
|
-
let i = this.shown.getLength(), a =
|
|
575
|
+
let i = this.shown.getLength(), a = W(this.shown.getData(), t);
|
|
576
576
|
return a === "stale" ? {
|
|
577
577
|
to: "none",
|
|
578
578
|
before: i,
|
|
@@ -586,7 +586,7 @@ var Bn = class {
|
|
|
586
586
|
replace(e) {
|
|
587
587
|
if (this.aside) {
|
|
588
588
|
let { index: t, changed: n } = this.aside.replaceBar(e);
|
|
589
|
-
return t < 0 ?
|
|
589
|
+
return t < 0 ? U : (n && this.onLiveChange({
|
|
590
590
|
kind: "bar",
|
|
591
591
|
time: this.aside.getData()[t].time
|
|
592
592
|
}), {
|
|
@@ -595,22 +595,22 @@ var Bn = class {
|
|
|
595
595
|
changed: n
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
if (!z(e)) return
|
|
599
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
598
|
+
if (!z(e)) return U;
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Nn(n, t.time) : -1;
|
|
600
600
|
if (n) {
|
|
601
|
-
if (r < 0 || !z(n[r])) return
|
|
601
|
+
if (r < 0 || !z(n[r])) return U;
|
|
602
602
|
let e = this.hoursFilter(n);
|
|
603
603
|
if (e && !e(t.time)) return this.replaceHidden(n, r, t);
|
|
604
604
|
}
|
|
605
605
|
let { index: i, changed: a } = this.shown.replaceBar(t);
|
|
606
|
-
return i < 0 ?
|
|
606
|
+
return i < 0 ? U : (a && (n && (n[r] = this.shown.getData()[i]), this.shownRevision++), {
|
|
607
607
|
to: "shown",
|
|
608
608
|
index: i,
|
|
609
609
|
changed: a
|
|
610
610
|
});
|
|
611
611
|
}
|
|
612
612
|
beginReplay() {
|
|
613
|
-
this.aside || (this.aside = new
|
|
613
|
+
this.aside || (this.aside = new H(), this.aside.setData(this.whole ?? this.shown.getData()));
|
|
614
614
|
}
|
|
615
615
|
endReplay() {
|
|
616
616
|
let e = this.aside;
|
|
@@ -630,10 +630,10 @@ var Bn = class {
|
|
|
630
630
|
this.shown.updateLastBar(e);
|
|
631
631
|
}
|
|
632
632
|
inSeriesUnit(e) {
|
|
633
|
-
return
|
|
633
|
+
return In(this.whole ?? this.shown.getData(), e);
|
|
634
634
|
}
|
|
635
635
|
replaceHidden(e, t, n) {
|
|
636
|
-
let r = B(n), i = !
|
|
636
|
+
let r = B(n), i = !V(e[t], r);
|
|
637
637
|
return i && (e[t] = r), {
|
|
638
638
|
to: "hidden",
|
|
639
639
|
index: -1,
|
|
@@ -667,14 +667,14 @@ var Bn = class {
|
|
|
667
667
|
return !r || r(e.time);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
function
|
|
670
|
+
function zn(e, t) {
|
|
671
671
|
let n = t[0]?.time, r = 0;
|
|
672
672
|
for (; n !== void 0 && r < e.length && e[r].time < n;) r++;
|
|
673
673
|
return r === 0 || r === e.length ? null : e.slice(0, r).concat(t);
|
|
674
674
|
}
|
|
675
675
|
//#endregion
|
|
676
676
|
//#region src/model/PriceFit.ts
|
|
677
|
-
var
|
|
677
|
+
var Bn = o ** -7, Vn = class {
|
|
678
678
|
auto;
|
|
679
679
|
preferred;
|
|
680
680
|
pending = !0;
|
|
@@ -707,21 +707,21 @@ var Hn = o ** -7, Un = class {
|
|
|
707
707
|
}
|
|
708
708
|
fit(e, t, n, r) {
|
|
709
709
|
if (t.length === 0) return;
|
|
710
|
-
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o =
|
|
710
|
+
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o = Un(Un(h(t, i, a, 0), r.overlayRange(i, a)), r.compareRange(t, n)), s = r.volumeRatio(t, i, a), c = s === null ? k : s + Bn;
|
|
711
711
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
712
712
|
top: c,
|
|
713
|
-
bottom:
|
|
713
|
+
bottom: k
|
|
714
714
|
} : {
|
|
715
|
-
top:
|
|
715
|
+
top: k,
|
|
716
716
|
bottom: c
|
|
717
717
|
}), e.fitToPrices(o.min, o.max);
|
|
718
718
|
}
|
|
719
719
|
};
|
|
720
|
-
function
|
|
720
|
+
function Hn(e, t, n) {
|
|
721
721
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
722
722
|
return !1;
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Un(e, t) {
|
|
725
725
|
return e ? t ? {
|
|
726
726
|
min: Math.min(e.min, t.min),
|
|
727
727
|
max: Math.max(e.max, t.max)
|
|
@@ -729,11 +729,11 @@ function Gn(e, t) {
|
|
|
729
729
|
}
|
|
730
730
|
//#endregion
|
|
731
731
|
//#region src/model/DisplaySeries.ts
|
|
732
|
-
var
|
|
732
|
+
var Wn = class {
|
|
733
733
|
series = null;
|
|
734
734
|
madeAt = null;
|
|
735
735
|
epoch = 0;
|
|
736
|
-
memo = new
|
|
736
|
+
memo = new ct();
|
|
737
737
|
constructor(e) {
|
|
738
738
|
this.sources = e;
|
|
739
739
|
}
|
|
@@ -761,10 +761,10 @@ var Kn = class {
|
|
|
761
761
|
let { columns: a, boxSize: o } = mn(t, n, this.memo);
|
|
762
762
|
return this.sources.onBoxSize(o), a;
|
|
763
763
|
}
|
|
764
|
-
},
|
|
764
|
+
}, Gn = {
|
|
765
765
|
min: 0,
|
|
766
766
|
max: 100
|
|
767
|
-
},
|
|
767
|
+
}, Kn = class {
|
|
768
768
|
layout = null;
|
|
769
769
|
infos = null;
|
|
770
770
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -772,7 +772,7 @@ var Kn = class {
|
|
|
772
772
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
773
773
|
}
|
|
774
774
|
resolved() {
|
|
775
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
775
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(qn(this.layout))), this.layout;
|
|
776
776
|
}
|
|
777
777
|
invalidate() {
|
|
778
778
|
this.layout = null, this.infos = null;
|
|
@@ -784,7 +784,7 @@ var Kn = class {
|
|
|
784
784
|
if (this.infos) return this.infos;
|
|
785
785
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
786
786
|
return this.infos = this.resolved().panels.map((e) => {
|
|
787
|
-
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...
|
|
787
|
+
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...Gn }, s = this.styles.get(i);
|
|
788
788
|
return {
|
|
789
789
|
instanceId: i,
|
|
790
790
|
members: this.sources.getPaneMembers(i),
|
|
@@ -844,7 +844,7 @@ var Kn = class {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
};
|
|
847
|
-
function
|
|
847
|
+
function qn(e) {
|
|
848
848
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
849
849
|
for (let t of e.panels) t.config.position !== "top" && t.config.position !== "bottom" || (n = Math.min(n, t.rect.y), r = Math.max(r, t.rect.y + t.rect.height));
|
|
850
850
|
return {
|
|
@@ -852,10 +852,10 @@ function Yn(e) {
|
|
|
852
852
|
bottom: r
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function Jn(e) {
|
|
856
856
|
return e.length > 0 ? { renames: e } : {};
|
|
857
857
|
}
|
|
858
|
-
var
|
|
858
|
+
var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
859
859
|
steps;
|
|
860
860
|
snapshot;
|
|
861
861
|
enabled;
|
|
@@ -877,21 +877,21 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
877
877
|
this.renames = i;
|
|
878
878
|
}
|
|
879
879
|
let o = this.snapshot();
|
|
880
|
-
return
|
|
880
|
+
return G(n, o) || this.push(e, n, o, r), a;
|
|
881
881
|
}
|
|
882
882
|
push(e, t, n, r) {
|
|
883
|
-
let i = this.now(), a = this.steps.last(), o = a?.type === "indicators" ? a.indicators : void 0, s = e !== void 0 && o?.subject === e && i - (o.at ?? 0) < 800 &&
|
|
883
|
+
let i = this.now(), a = this.steps.last(), o = a?.type === "indicators" ? a.indicators : void 0, s = e !== void 0 && o?.subject === e && i - (o.at ?? 0) < 800 && G(o.after, t), c = {
|
|
884
884
|
type: "indicators",
|
|
885
885
|
before: null,
|
|
886
886
|
after: null
|
|
887
887
|
};
|
|
888
|
-
s && o ?
|
|
888
|
+
s && o ? G(o.before, n) ? this.steps.dropLast() : this.steps.replaceLast({
|
|
889
889
|
...c,
|
|
890
890
|
indicators: {
|
|
891
891
|
...o,
|
|
892
892
|
after: n,
|
|
893
893
|
at: i,
|
|
894
|
-
...
|
|
894
|
+
...Jn([...o.renames ?? [], ...r])
|
|
895
895
|
}
|
|
896
896
|
}) : this.steps.push({
|
|
897
897
|
...c,
|
|
@@ -900,7 +900,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
900
900
|
after: n,
|
|
901
901
|
subject: e,
|
|
902
902
|
at: i,
|
|
903
|
-
...
|
|
903
|
+
...Jn(r)
|
|
904
904
|
}
|
|
905
905
|
});
|
|
906
906
|
}
|
|
@@ -926,7 +926,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
926
926
|
if (!e) return;
|
|
927
927
|
this.edit = null, this.depth--;
|
|
928
928
|
let t = this.snapshot();
|
|
929
|
-
|
|
929
|
+
G(t, e.before) || this.steps.push({
|
|
930
930
|
type: "indicators",
|
|
931
931
|
before: null,
|
|
932
932
|
after: null,
|
|
@@ -938,7 +938,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
938
938
|
}
|
|
939
939
|
});
|
|
940
940
|
}
|
|
941
|
-
},
|
|
941
|
+
}, Xn = class {
|
|
942
942
|
constructor(e, t, n) {
|
|
943
943
|
this.members = e, this.slots = t, this.handover = n;
|
|
944
944
|
}
|
|
@@ -1017,7 +1017,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
//#endregion
|
|
1019
1019
|
//#region src/model/IndicatorSetup.ts
|
|
1020
|
-
function
|
|
1020
|
+
function Zn(e, t, n) {
|
|
1021
1021
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1022
1022
|
return e.getActiveIndicators().map((t) => {
|
|
1023
1023
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1045,7 +1045,7 @@ function $n(e, t, n) {
|
|
|
1045
1045
|
};
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1048
|
+
function Qn(e, t) {
|
|
1049
1049
|
for (let [n, r] of t) n.paneSize !== void 0 && e.setPanelSize(r, n.paneSize), (n.paneSize !== void 0 || n.paneCollapsed) && e.setPanelCollapsed(r, !!n.paneCollapsed), n.paneSize !== void 0 && e.setPanelScale(r, {
|
|
1050
1050
|
log: !!n.paneLog,
|
|
1051
1051
|
invert: !!n.paneInvert,
|
|
@@ -1056,7 +1056,7 @@ function er(e, t) {
|
|
|
1056
1056
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1057
1057
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function $n(e) {
|
|
1060
1060
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1061
1061
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1062
1062
|
i.add(e.instanceId);
|
|
@@ -1070,23 +1070,23 @@ function tr(e) {
|
|
|
1070
1070
|
for (let t of e) a(t);
|
|
1071
1071
|
return n;
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function er(e, t) {
|
|
1074
1074
|
return e.id === t.id && (e.pane ?? null) === (t.pane ?? null) && (e.scale ?? null) === (t.scale ?? null) && e.position === void 0 == (t.position === void 0);
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function tr(e, t) {
|
|
1077
1077
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1078
1078
|
for (let t of e) {
|
|
1079
1079
|
let e = n.get(t.instanceId);
|
|
1080
|
-
e &&
|
|
1080
|
+
e && er(t, e) && nr(t, e) && r.add(t.instanceId);
|
|
1081
1081
|
}
|
|
1082
1082
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1083
1083
|
return r;
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function nr(e, t) {
|
|
1086
1086
|
let n = Object.keys(e.params);
|
|
1087
1087
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function rr(e, t) {
|
|
1090
1090
|
let n = { ...e };
|
|
1091
1091
|
for (let [e, r] of Object.entries(n)) {
|
|
1092
1092
|
let i = S(r), a = i && t.get(i.instanceId);
|
|
@@ -1096,11 +1096,11 @@ function ar(e, t) {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region src/model/SymbolRequests.ts
|
|
1099
|
-
function
|
|
1099
|
+
function ir(e, t) {
|
|
1100
1100
|
let n = t.symbol;
|
|
1101
|
-
return
|
|
1101
|
+
return lt.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1102
1102
|
}
|
|
1103
|
-
var
|
|
1103
|
+
var ar = class {
|
|
1104
1104
|
asked = /* @__PURE__ */ new Set();
|
|
1105
1105
|
constructor(e, t) {
|
|
1106
1106
|
this.readers = e, this.held = t;
|
|
@@ -1108,14 +1108,14 @@ var sr = class {
|
|
|
1108
1108
|
required() {
|
|
1109
1109
|
let e = /* @__PURE__ */ new Set();
|
|
1110
1110
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1111
|
-
let n =
|
|
1111
|
+
let n = ir(t.id, t.params);
|
|
1112
1112
|
n && e.add(n);
|
|
1113
1113
|
}
|
|
1114
1114
|
return [...e];
|
|
1115
1115
|
}
|
|
1116
1116
|
readersOf(e) {
|
|
1117
1117
|
let t = e.trim();
|
|
1118
|
-
return this.readers.getActiveIndicators().filter((e) =>
|
|
1118
|
+
return this.readers.getActiveIndicators().filter((e) => lt.has(e.id) && String(e.params.symbol ?? "").trim() === t).map((e) => e.instanceId);
|
|
1119
1119
|
}
|
|
1120
1120
|
given(e) {
|
|
1121
1121
|
this.asked.delete(e.trim());
|
|
@@ -1126,20 +1126,20 @@ var sr = class {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
toAsk(e) {
|
|
1128
1128
|
this.forgetUnread();
|
|
1129
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1129
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? ir(t.id, t.params) : "";
|
|
1130
1130
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1131
1131
|
}
|
|
1132
|
-
},
|
|
1133
|
-
function
|
|
1134
|
-
if (!
|
|
1132
|
+
}, 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)) {
|
|
1135
1135
|
for (let t of n) {
|
|
1136
1136
|
let n = r(t.id);
|
|
1137
|
-
if (n &&
|
|
1137
|
+
if (n && or(e, n.chartRect)) return t.id;
|
|
1138
1138
|
}
|
|
1139
1139
|
return null;
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function cr(e, t, n, r) {
|
|
1143
1143
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1144
1144
|
let i = n();
|
|
1145
1145
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1147,12 +1147,12 @@ function ur(e, t, n, r) {
|
|
|
1147
1147
|
data: r()
|
|
1148
1148
|
};
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function lr(e, t, n) {
|
|
1151
1151
|
return !n && e.some((e) => e.id === t);
|
|
1152
1152
|
}
|
|
1153
1153
|
//#endregion
|
|
1154
1154
|
//#region src/HistoryPager.ts
|
|
1155
|
-
var
|
|
1155
|
+
var ur = 5e3, dr = 6e4, fr = 500, pr = class {
|
|
1156
1156
|
loader = null;
|
|
1157
1157
|
pageSize = 500;
|
|
1158
1158
|
loading = !1;
|
|
@@ -1207,7 +1207,7 @@ var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
|
1207
1207
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1208
1208
|
state: "loaded",
|
|
1209
1209
|
count: 0
|
|
1210
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1210
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(dr, ur * 2 ** (this.failures - 1)), this.emit({
|
|
1211
1211
|
state: "error",
|
|
1212
1212
|
count: 0,
|
|
1213
1213
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1240,10 +1240,10 @@ var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
|
1240
1240
|
};
|
|
1241
1241
|
//#endregion
|
|
1242
1242
|
//#region src/ThemeManager.ts
|
|
1243
|
-
function
|
|
1243
|
+
function mr(e, t) {
|
|
1244
1244
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1245
1245
|
}
|
|
1246
|
-
var
|
|
1246
|
+
var hr = class e {
|
|
1247
1247
|
base;
|
|
1248
1248
|
shape = null;
|
|
1249
1249
|
font = null;
|
|
@@ -1262,13 +1262,13 @@ var _r = class e {
|
|
|
1262
1262
|
return i;
|
|
1263
1263
|
}
|
|
1264
1264
|
getTheme() {
|
|
1265
|
-
return this.effective ??=
|
|
1265
|
+
return this.effective ??= se(this.base, this.chartType, this.merged()), this.effective;
|
|
1266
1266
|
}
|
|
1267
1267
|
getBaseTheme() {
|
|
1268
1268
|
return this.base;
|
|
1269
1269
|
}
|
|
1270
1270
|
setTheme(t) {
|
|
1271
|
-
let n = e.read(t), r = this.font !== null &&
|
|
1271
|
+
let n = e.read(t), r = this.font !== null && mr(n.font, this.base.font);
|
|
1272
1272
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1273
1273
|
...this.base,
|
|
1274
1274
|
shape: {
|
|
@@ -1350,7 +1350,7 @@ var _r = class e {
|
|
|
1350
1350
|
};
|
|
1351
1351
|
//#endregion
|
|
1352
1352
|
//#region src/style/styleOptions.ts
|
|
1353
|
-
function
|
|
1353
|
+
function gr(e, t) {
|
|
1354
1354
|
return t ? {
|
|
1355
1355
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1356
1356
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1358,22 +1358,22 @@ function vr(e, t) {
|
|
|
1358
1358
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1359
1359
|
} : {};
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function _r(e) {
|
|
1362
1362
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1363
1363
|
return {
|
|
1364
1364
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1365
1365
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1366
1366
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1367
1367
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1368
|
-
...
|
|
1369
|
-
...
|
|
1368
|
+
...gr("horizontal", n?.hLine),
|
|
1369
|
+
...gr("vertical", n?.vLine),
|
|
1370
1370
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1371
1371
|
...e.overrides
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
//#endregion
|
|
1375
1375
|
//#region src/layout/LayoutManager.ts
|
|
1376
|
-
var
|
|
1376
|
+
var vr = 200, yr = 80, K = (e) => e.position === "top" || e.position === "bottom", br = class {
|
|
1377
1377
|
panels = [];
|
|
1378
1378
|
containerWidth = 0;
|
|
1379
1379
|
containerHeight = 0;
|
|
@@ -1390,8 +1390,8 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1390
1390
|
this.panels.push({
|
|
1391
1391
|
id: e,
|
|
1392
1392
|
position: t,
|
|
1393
|
-
size: r ?? (i ?
|
|
1394
|
-
minSize: i ?
|
|
1393
|
+
size: r ?? (i ? vr : n),
|
|
1394
|
+
minSize: i ? yr : a,
|
|
1395
1395
|
content: {
|
|
1396
1396
|
type: "indicator",
|
|
1397
1397
|
indicatorInstanceId: e
|
|
@@ -1410,14 +1410,14 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1410
1410
|
}
|
|
1411
1411
|
setPanelCollapsed(e, t) {
|
|
1412
1412
|
let n = this.panels.find((t) => t.id === e);
|
|
1413
|
-
return !n || !
|
|
1413
|
+
return !n || !K(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
|
|
1414
1414
|
}
|
|
1415
1415
|
isPanelCollapsed(e) {
|
|
1416
1416
|
return !!this.panels.find((t) => t.id === e)?.collapsed;
|
|
1417
1417
|
}
|
|
1418
1418
|
isPanelShownCollapsed(e) {
|
|
1419
1419
|
let t = this.panels.find((t) => t.id === e);
|
|
1420
|
-
return !t || !
|
|
1420
|
+
return !t || !K(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
|
|
1421
1421
|
}
|
|
1422
1422
|
setPanelScale(e, t) {
|
|
1423
1423
|
let n = this.panels.find((t) => t.id === e);
|
|
@@ -1433,7 +1433,7 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1433
1433
|
}
|
|
1434
1434
|
setMaximizedPanel(e) {
|
|
1435
1435
|
let t = e === null ? null : this.panels.find((t) => t.id === e);
|
|
1436
|
-
return e !== null && (!t || !
|
|
1436
|
+
return e !== null && (!t || !K(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
|
|
1437
1437
|
}
|
|
1438
1438
|
getMaximizedPanel() {
|
|
1439
1439
|
return this.maximized;
|
|
@@ -1454,19 +1454,19 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1454
1454
|
this.panels = [...this.panels].sort((e, n) => t(e) - t(n));
|
|
1455
1455
|
}
|
|
1456
1456
|
shownSize(e, t) {
|
|
1457
|
-
return
|
|
1457
|
+
return K(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
|
|
1458
1458
|
}
|
|
1459
1459
|
setPanelPosition(e, t) {
|
|
1460
1460
|
let r = this.panels.find((t) => t.id === e);
|
|
1461
1461
|
if (r) {
|
|
1462
1462
|
let i = r.position === "left" || r.position === "right", o = t === "left" || t === "right";
|
|
1463
|
-
r.position = t, i !== o && (r.size = o ?
|
|
1463
|
+
r.position = t, i !== o && (r.size = o ? vr : n, r.minSize = o ? yr : a), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
1466
|
setPanelSize(e, t) {
|
|
1467
1467
|
let n = this.panels.find((t) => t.id === e);
|
|
1468
1468
|
if (n) {
|
|
1469
|
-
let e =
|
|
1469
|
+
let e = K(n) ? this.containerHeight - c - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
|
|
1470
1470
|
n.size = Math.max(n.minSize, r), n.collapsed = void 0, this.maximized = null;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
@@ -1580,8 +1580,8 @@ var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1580
1580
|
getMainChartRect() {
|
|
1581
1581
|
return this.resolve().mainChartRect;
|
|
1582
1582
|
}
|
|
1583
|
-
},
|
|
1584
|
-
function
|
|
1583
|
+
}, xr = 14, Sr = 14, Cr = 22, wr = 4;
|
|
1584
|
+
function Tr(e) {
|
|
1585
1585
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure: c } = e, u = e.tagPrecision ?? l(t, n), d = u, f = r === null ? [t, n] : [
|
|
1586
1586
|
t,
|
|
1587
1587
|
n,
|
|
@@ -1590,16 +1590,16 @@ function Dr(e) {
|
|
|
1590
1590
|
for (let t of f) {
|
|
1591
1591
|
if (!Number.isFinite(t)) continue;
|
|
1592
1592
|
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : _(t, u, i), r = e.format ? n : _(t, d, i);
|
|
1593
|
-
p = Math.max(p, c(n, `500 ${o}px ${a}`) +
|
|
1593
|
+
p = Math.max(p, c(n, `500 ${o}px ${a}`) + xr, c(r, `bold 11px ${a}`) + Sr, c(r, `600 ${o}px ${a}`) + Cr);
|
|
1594
1594
|
}
|
|
1595
|
-
return p <= s ? s : Math.ceil(p /
|
|
1595
|
+
return p <= s ? s : Math.ceil(p / wr) * wr;
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function Er(e, t) {
|
|
1598
1598
|
return t > e || t <= e - 12 ? t : e;
|
|
1599
1599
|
}
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/layout/labelWidths.ts
|
|
1602
|
-
var
|
|
1602
|
+
var Dr = 512, Or = class {
|
|
1603
1603
|
widths = /* @__PURE__ */ new Map();
|
|
1604
1604
|
fonts;
|
|
1605
1605
|
forget = () => this.widths.clear();
|
|
@@ -1610,12 +1610,12 @@ var kr = 512, Ar = class {
|
|
|
1610
1610
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1611
1611
|
if (i !== void 0) return i;
|
|
1612
1612
|
let a = n();
|
|
1613
|
-
return this.widths.size >=
|
|
1613
|
+
return this.widths.size >= Dr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1614
1614
|
}
|
|
1615
1615
|
destroy() {
|
|
1616
1616
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1617
1617
|
}
|
|
1618
|
-
},
|
|
1618
|
+
}, kr = class {
|
|
1619
1619
|
netY = 0;
|
|
1620
1620
|
travelX = 0;
|
|
1621
1621
|
engaged = !1;
|
|
@@ -1631,11 +1631,11 @@ var kr = 512, Ar = class {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
return this.engaged;
|
|
1633
1633
|
}
|
|
1634
|
-
},
|
|
1635
|
-
function
|
|
1634
|
+
}, Ar = 1;
|
|
1635
|
+
function jr(e, t) {
|
|
1636
1636
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function q(e) {
|
|
1639
1639
|
switch (e.kind) {
|
|
1640
1640
|
case "indicator": return `indicator:${e.plugin.descriptor.id}`;
|
|
1641
1641
|
case "drawing": return `drawing:${e.plugin.descriptor.type}`;
|
|
@@ -1645,25 +1645,25 @@ function G(e) {
|
|
|
1645
1645
|
}
|
|
1646
1646
|
//#endregion
|
|
1647
1647
|
//#region src/plugins/registry.ts
|
|
1648
|
-
var
|
|
1649
|
-
function
|
|
1650
|
-
|
|
1648
|
+
var J = /* @__PURE__ */ new Map();
|
|
1649
|
+
function Mr(e) {
|
|
1650
|
+
J.set(q(e), e);
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1653
|
-
return
|
|
1652
|
+
function Nr(e) {
|
|
1653
|
+
return J.delete(e);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1656
|
-
return [...
|
|
1655
|
+
function Pr() {
|
|
1656
|
+
return [...J.values()];
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1659
|
-
|
|
1658
|
+
function Fr() {
|
|
1659
|
+
J.clear();
|
|
1660
1660
|
}
|
|
1661
1661
|
//#endregion
|
|
1662
1662
|
//#region src/plugins/PluginManager.ts
|
|
1663
|
-
var
|
|
1663
|
+
var Ir = class {
|
|
1664
1664
|
plugins = /* @__PURE__ */ new Map();
|
|
1665
1665
|
constructor(e, t = {}) {
|
|
1666
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1666
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Pr()) this.add(e);
|
|
1667
1667
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1668
1668
|
}
|
|
1669
1669
|
register(e) {
|
|
@@ -1691,17 +1691,17 @@ var Rr = class {
|
|
|
1691
1691
|
return e;
|
|
1692
1692
|
}
|
|
1693
1693
|
add(e) {
|
|
1694
|
-
this.plugins.set(
|
|
1694
|
+
this.plugins.set(q(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1695
1695
|
}
|
|
1696
|
-
},
|
|
1696
|
+
}, Lr = {
|
|
1697
1697
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1698
1698
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1699
1699
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1700
1700
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1701
1701
|
positionClose: (e, t) => e.closePosition(t),
|
|
1702
|
-
positionReverse: (e, t, n) =>
|
|
1702
|
+
positionReverse: (e, t, n) => Rr(e, t, n)
|
|
1703
1703
|
};
|
|
1704
|
-
async function
|
|
1704
|
+
async function Rr(e, t, n) {
|
|
1705
1705
|
let { reversing: r } = n;
|
|
1706
1706
|
if (!r.has(t.positionId)) {
|
|
1707
1707
|
r.add(t.positionId);
|
|
@@ -1730,7 +1730,7 @@ async function Br(e, t, n) {
|
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function zr(e, t) {
|
|
1734
1734
|
let n = [], r = null, i = {
|
|
1735
1735
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1736
1736
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1740,8 +1740,8 @@ function Vr(e, t) {
|
|
|
1740
1740
|
e.data && t.onFill?.(e.data);
|
|
1741
1741
|
};
|
|
1742
1742
|
e.on("orders", a), e.on("positions", o), e.on("error", s), e.on("fill", c), n.push(() => e.off("orders", a), () => e.off("positions", o), () => e.off("error", s), () => e.off("fill", c));
|
|
1743
|
-
for (let r of Object.keys(
|
|
1744
|
-
let a =
|
|
1743
|
+
for (let r of Object.keys(Lr)) {
|
|
1744
|
+
let a = Lr[r], o = t.onIntent(r, (n) => {
|
|
1745
1745
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1746
1746
|
message: `Execution command failed: ${r}`,
|
|
1747
1747
|
cause: e
|
|
@@ -1755,7 +1755,7 @@ function Vr(e, t) {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
//#endregion
|
|
1757
1757
|
//#region src/replay/ReplayStepLoader.ts
|
|
1758
|
-
var
|
|
1758
|
+
var Br = 1e3, Vr = class {
|
|
1759
1759
|
pieces = /* @__PURE__ */ new Map();
|
|
1760
1760
|
asked = /* @__PURE__ */ new Set();
|
|
1761
1761
|
inFlight = !1;
|
|
@@ -1788,7 +1788,7 @@ var Hr = 1e3, Ur = class {
|
|
|
1788
1788
|
this.done = !0;
|
|
1789
1789
|
}
|
|
1790
1790
|
ask(e, t) {
|
|
1791
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1791
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(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);
|
|
1792
1792
|
for (let e of l) this.asked.add(e.time);
|
|
1793
1793
|
this.inFlight = !0, a({
|
|
1794
1794
|
state: "loading",
|
|
@@ -1829,12 +1829,12 @@ var Hr = 1e3, Ur = class {
|
|
|
1829
1829
|
...n === void 0 ? {} : { error: n }
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
|
-
},
|
|
1833
|
-
function
|
|
1834
|
-
let n = (e.high - e.low) *
|
|
1835
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1832
|
+
}, 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;
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function Kr(e) {
|
|
1838
1838
|
return e.close >= e.open ? [
|
|
1839
1839
|
e.open,
|
|
1840
1840
|
e.low,
|
|
@@ -1847,22 +1847,22 @@ function Jr(e) {
|
|
|
1847
1847
|
e.close
|
|
1848
1848
|
];
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
let r =
|
|
1850
|
+
function qr(e, t, n) {
|
|
1851
|
+
let r = Kr(e), i = [
|
|
1852
1852
|
1,
|
|
1853
1853
|
2,
|
|
1854
1854
|
3
|
|
1855
1855
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1856
1856
|
return r.forEach((r, c) => {
|
|
1857
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1857
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : Hr), !(c === 0 && t > 0) && o.push({
|
|
1858
1858
|
price: r,
|
|
1859
1859
|
time: e.time,
|
|
1860
1860
|
at: (t + s) / n
|
|
1861
1861
|
});
|
|
1862
1862
|
}), o;
|
|
1863
1863
|
}
|
|
1864
|
-
function
|
|
1865
|
-
let n = t.length > 0 &&
|
|
1864
|
+
function 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;
|
|
1866
1866
|
return {
|
|
1867
1867
|
bar: e,
|
|
1868
1868
|
points: i,
|
|
@@ -1872,7 +1872,7 @@ function Xr(e, t = []) {
|
|
|
1872
1872
|
}))
|
|
1873
1873
|
};
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function Yr(e, t) {
|
|
1876
1876
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1877
1877
|
...e,
|
|
1878
1878
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1887,7 +1887,7 @@ function Zr(e, t) {
|
|
|
1887
1887
|
};
|
|
1888
1888
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Xr(e, t) {
|
|
1891
1891
|
let n = e.points;
|
|
1892
1892
|
if (t <= n[0].at) return n[0].price;
|
|
1893
1893
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1896,8 +1896,8 @@ function Qr(e, t) {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
return n[n.length - 1].price;
|
|
1898
1898
|
}
|
|
1899
|
-
var
|
|
1900
|
-
function
|
|
1899
|
+
var Zr = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1900
|
+
function Qr(e, t) {
|
|
1901
1901
|
let n = 0, r = 0;
|
|
1902
1902
|
for (let i of e.volumeAt) {
|
|
1903
1903
|
if (t >= i.at) {
|
|
@@ -1908,10 +1908,10 @@ function ei(e, t) {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
return n;
|
|
1910
1910
|
}
|
|
1911
|
-
function
|
|
1912
|
-
let n =
|
|
1911
|
+
function $r(e, t) {
|
|
1912
|
+
let n = Zr(t);
|
|
1913
1913
|
if (n >= 1) return { ...e.bar };
|
|
1914
|
-
let r =
|
|
1914
|
+
let r = Xr(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1915
1915
|
for (let t of e.points) {
|
|
1916
1916
|
if (t.at > n) break;
|
|
1917
1917
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1922,29 +1922,29 @@ function ti(e, t) {
|
|
|
1922
1922
|
high: i,
|
|
1923
1923
|
low: a,
|
|
1924
1924
|
close: r,
|
|
1925
|
-
volume:
|
|
1925
|
+
volume: Qr(e, n)
|
|
1926
1926
|
};
|
|
1927
1927
|
}
|
|
1928
|
-
function
|
|
1929
|
-
let n =
|
|
1928
|
+
function ei(e, t) {
|
|
1929
|
+
let n = Zr(t), r = 0;
|
|
1930
1930
|
for (let t of e.points) {
|
|
1931
1931
|
if (t.at > n) break;
|
|
1932
1932
|
r = t.at;
|
|
1933
1933
|
}
|
|
1934
1934
|
return r;
|
|
1935
1935
|
}
|
|
1936
|
-
function
|
|
1936
|
+
function Y(e, t, n) {
|
|
1937
1937
|
let r = [], i = e.bar.time;
|
|
1938
1938
|
for (let a of e.points) {
|
|
1939
1939
|
if (a.at > n) break;
|
|
1940
1940
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1941
1941
|
}
|
|
1942
|
-
let a =
|
|
1942
|
+
let a = Xr(e, n);
|
|
1943
1943
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1944
1944
|
}
|
|
1945
1945
|
//#endregion
|
|
1946
1946
|
//#region src/replay/replayStep.ts
|
|
1947
|
-
var
|
|
1947
|
+
var ti = [
|
|
1948
1948
|
"1m",
|
|
1949
1949
|
"3m",
|
|
1950
1950
|
"5m",
|
|
@@ -1955,27 +1955,27 @@ var ri = [
|
|
|
1955
1955
|
"4h",
|
|
1956
1956
|
"1d"
|
|
1957
1957
|
];
|
|
1958
|
-
function
|
|
1959
|
-
let n =
|
|
1960
|
-
return n > 0 ?
|
|
1961
|
-
let r =
|
|
1958
|
+
function ni(e, t) {
|
|
1959
|
+
let n = E(e);
|
|
1960
|
+
return n > 0 ? ti.filter((e) => {
|
|
1961
|
+
let r = E(e);
|
|
1962
1962
|
return r < n && n % r === 0 && t(e);
|
|
1963
1963
|
}) : [];
|
|
1964
1964
|
}
|
|
1965
|
-
function
|
|
1966
|
-
let r =
|
|
1965
|
+
function ri(e, t, n) {
|
|
1966
|
+
let r = ni(t, n);
|
|
1967
1967
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1968
|
-
let i =
|
|
1969
|
-
return r.find((e) => i /
|
|
1968
|
+
let i = E(t);
|
|
1969
|
+
return r.find((e) => i / E(e) <= 60) ?? null;
|
|
1970
1970
|
}
|
|
1971
1971
|
//#endregion
|
|
1972
1972
|
//#region src/model/AlertWatch.ts
|
|
1973
|
-
function
|
|
1973
|
+
function ii(e, t) {
|
|
1974
1974
|
e.setBarTime(t.barTime);
|
|
1975
1975
|
let n = new Map([["price", t.price]]);
|
|
1976
|
-
t.lines &&
|
|
1976
|
+
t.lines && ai(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function ai(e, t, n) {
|
|
1979
1979
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
1980
1980
|
for (let e of r) {
|
|
1981
1981
|
if (n.has(e)) continue;
|
|
@@ -1985,7 +1985,7 @@ function si(e, t, n) {
|
|
|
1985
1985
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
1986
1986
|
}
|
|
1987
1987
|
}
|
|
1988
|
-
function
|
|
1988
|
+
function oi(e, t, n, r) {
|
|
1989
1989
|
let i = (e) => {
|
|
1990
1990
|
let i = e.indexOf(":");
|
|
1991
1991
|
if (i <= 0) return null;
|
|
@@ -2007,35 +2007,35 @@ function ci(e, t, n, r) {
|
|
|
2007
2007
|
});
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
function
|
|
2010
|
+
function si(e, t) {
|
|
2011
2011
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2012
2012
|
return r ? r + e.slice(n) : e;
|
|
2013
2013
|
}
|
|
2014
|
-
var
|
|
2014
|
+
var ci = [
|
|
2015
2015
|
"crossing",
|
|
2016
2016
|
"crossingUp",
|
|
2017
2017
|
"crossingDown"
|
|
2018
2018
|
];
|
|
2019
|
-
function
|
|
2019
|
+
function li(e, t, n, r, i) {
|
|
2020
2020
|
e.clearAlerts();
|
|
2021
2021
|
for (let a of t) {
|
|
2022
2022
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2023
2023
|
if (a.drawingId) {
|
|
2024
|
-
r(a.drawingId) &&
|
|
2024
|
+
r(a.drawingId) && ci.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2025
2025
|
continue;
|
|
2026
2026
|
}
|
|
2027
2027
|
let t = {
|
|
2028
2028
|
...Ht(a),
|
|
2029
|
-
...a.target ? { target:
|
|
2029
|
+
...a.target ? { target: si(a.target, n) } : {}
|
|
2030
2030
|
};
|
|
2031
2031
|
try {
|
|
2032
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2032
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, si(a.channel, n), a.label, t);
|
|
2033
2033
|
} catch (e) {
|
|
2034
2034
|
i(e);
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
var
|
|
2038
|
+
var ui = class {
|
|
2039
2039
|
kept = /* @__PURE__ */ new Map();
|
|
2040
2040
|
constructor(e) {
|
|
2041
2041
|
this.alerts = e;
|
|
@@ -2052,7 +2052,7 @@ var fi = class {
|
|
|
2052
2052
|
return this.kept.clear(), this.alerts.pruneDrawingAlerts(e);
|
|
2053
2053
|
}
|
|
2054
2054
|
};
|
|
2055
|
-
function
|
|
2055
|
+
function di(e, t) {
|
|
2056
2056
|
let n = 0, r = e.length;
|
|
2057
2057
|
for (; n < r;) {
|
|
2058
2058
|
let i = n + r >> 1;
|
|
@@ -2060,7 +2060,7 @@ function J(e, t) {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
return n;
|
|
2062
2062
|
}
|
|
2063
|
-
function
|
|
2063
|
+
function fi(e, t) {
|
|
2064
2064
|
let n = 0, r = e.length;
|
|
2065
2065
|
for (; n < r;) {
|
|
2066
2066
|
let i = n + r >> 1;
|
|
@@ -2088,7 +2088,7 @@ function hi(e, t, n) {
|
|
|
2088
2088
|
fraction: n.fraction
|
|
2089
2089
|
}
|
|
2090
2090
|
} : r.time <= n.time ? null : {
|
|
2091
|
-
marks: mi(e.slice(
|
|
2091
|
+
marks: mi(e.slice(fi(e, n.time), t + 1)),
|
|
2092
2092
|
fed: {
|
|
2093
2093
|
time: r.time,
|
|
2094
2094
|
fraction: n.fraction
|
|
@@ -2103,16 +2103,16 @@ function gi(e, t, n, r, i, a) {
|
|
|
2103
2103
|
fraction: r
|
|
2104
2104
|
};
|
|
2105
2105
|
if (i.time === null) return {
|
|
2106
|
-
marks: [[
|
|
2106
|
+
marks: [[$r(n, r).close, o.time]],
|
|
2107
2107
|
fed: s
|
|
2108
2108
|
};
|
|
2109
2109
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
2110
2110
|
if (o.time === i.time) return {
|
|
2111
|
-
marks:
|
|
2111
|
+
marks: Y(n, i.fraction, r),
|
|
2112
2112
|
fed: s
|
|
2113
2113
|
};
|
|
2114
|
-
let c = [], l =
|
|
2115
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...
|
|
2114
|
+
let c = [], l = di(e, i.time);
|
|
2115
|
+
return e[l]?.time === i.time && i.fraction < 1 && c.push(...Y(a(e, l), i.fraction, 1)), c.push(...mi(e.slice(fi(e, i.time), t))), c.push(...Y(n, -1, r)), {
|
|
2116
2116
|
marks: c,
|
|
2117
2117
|
fed: s
|
|
2118
2118
|
};
|
|
@@ -2125,7 +2125,7 @@ function yi(e) {
|
|
|
2125
2125
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2126
2126
|
}
|
|
2127
2127
|
function bi(e, t) {
|
|
2128
|
-
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r :
|
|
2128
|
+
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : T(e);
|
|
2129
2129
|
return i === void 0 ? e : {
|
|
2130
2130
|
...e,
|
|
2131
2131
|
timeZone: i,
|
|
@@ -2138,10 +2138,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2138
2138
|
ArrowUp: [0, -1],
|
|
2139
2139
|
ArrowDown: [0, 1]
|
|
2140
2140
|
}, Ei = new Set(["horizontalLine", "crossLine"]), Di = new Set(["verticalLine", "crossLine"]), Oi = class {
|
|
2141
|
-
static version = "1.
|
|
2141
|
+
static version = "1.83.1";
|
|
2142
2142
|
engine;
|
|
2143
2143
|
viewport;
|
|
2144
|
-
series = new
|
|
2144
|
+
series = new Rn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2145
2145
|
themeManager;
|
|
2146
2146
|
layoutManager;
|
|
2147
2147
|
pluginManager;
|
|
@@ -2166,7 +2166,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2166
2166
|
renderDeferred = !1;
|
|
2167
2167
|
priceAxisWidth = s;
|
|
2168
2168
|
measureCtx;
|
|
2169
|
-
labelWidths = new
|
|
2169
|
+
labelWidths = new Or();
|
|
2170
2170
|
containerSizeCache = null;
|
|
2171
2171
|
containerSizeCacheTime = 0;
|
|
2172
2172
|
lastEmittedRange = null;
|
|
@@ -2179,7 +2179,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2179
2179
|
unrestoredIndicators = [];
|
|
2180
2180
|
drawingAlerts = null;
|
|
2181
2181
|
zoomAreaMode = !1;
|
|
2182
|
-
priceAxisAddButton = new
|
|
2182
|
+
priceAxisAddButton = new nt();
|
|
2183
2183
|
displayTz = null;
|
|
2184
2184
|
timeZoneSetting = null;
|
|
2185
2185
|
symbolInfo = null;
|
|
@@ -2190,7 +2190,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2190
2190
|
studyZoneReleaseQueued = !1;
|
|
2191
2191
|
sessionBreaks;
|
|
2192
2192
|
sessionShading;
|
|
2193
|
-
hostSessionHours = { ...
|
|
2193
|
+
hostSessionHours = { ...Ae };
|
|
2194
2194
|
compareRenderer;
|
|
2195
2195
|
countdownInterval = null;
|
|
2196
2196
|
pausedFor = {
|
|
@@ -2209,7 +2209,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2209
2209
|
signalMarkerManager;
|
|
2210
2210
|
tradeZoneManager;
|
|
2211
2211
|
measureOverlay;
|
|
2212
|
-
selectionBoxOverlay = new
|
|
2212
|
+
selectionBoxOverlay = new dt();
|
|
2213
2213
|
replayManager;
|
|
2214
2214
|
replayBarUnsub = null;
|
|
2215
2215
|
replaySeeking = !1;
|
|
@@ -2236,14 +2236,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2236
2236
|
disposed = !1;
|
|
2237
2237
|
chartTypeOptions = {};
|
|
2238
2238
|
mainSeriesVisible = !0;
|
|
2239
|
-
priceLines = new
|
|
2240
|
-
symbolSeries = new
|
|
2239
|
+
priceLines = new rt();
|
|
2240
|
+
symbolSeries = new vt();
|
|
2241
2241
|
extendedHours = !0;
|
|
2242
2242
|
replayRestarting = !1;
|
|
2243
2243
|
symbolRequests;
|
|
2244
2244
|
gridRenderer;
|
|
2245
2245
|
priceAxis;
|
|
2246
|
-
leftPriceAxis = new
|
|
2246
|
+
leftPriceAxis = new tt();
|
|
2247
2247
|
leftScaleRequested = !1;
|
|
2248
2248
|
leftAxisWidth = s;
|
|
2249
2249
|
leftViewport = null;
|
|
@@ -2277,7 +2277,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2277
2277
|
t.timeZone != null && yi(t.timeZone), this.container = e, this.options = {
|
|
2278
2278
|
...t,
|
|
2279
2279
|
chartType: t.chartType ?? "candlestick"
|
|
2280
|
-
}, 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({
|
|
2281
2281
|
bars: () => this.series.bars(),
|
|
2282
2282
|
version: () => this.series.version(),
|
|
2283
2283
|
chartType: () => this.options.chartType,
|
|
@@ -2285,7 +2285,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2285
2285
|
lookup: (e) => this.pluginManager.getChartType(e),
|
|
2286
2286
|
stepAt: (e) => this.stepAt(e),
|
|
2287
2287
|
onBoxSize: (e) => {
|
|
2288
|
-
this.chartRenderer instanceof
|
|
2288
|
+
this.chartRenderer instanceof et && this.chartRenderer.setBoxSize(e);
|
|
2289
2289
|
}
|
|
2290
2290
|
});
|
|
2291
2291
|
let n = t.features ?? {};
|
|
@@ -2324,19 +2324,19 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2324
2324
|
logScale: n.logScale ?? !0,
|
|
2325
2325
|
timeframes: n.timeframes ?? [],
|
|
2326
2326
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
2327
|
-
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new
|
|
2327
|
+
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new pr({
|
|
2328
2328
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2329
2329
|
prepend: (e) => this.prependBars(e),
|
|
2330
2330
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2331
|
-
}), this.themeManager = new
|
|
2331
|
+
}), this.themeManager = new hr(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(_r(t), "host", !1), this.container.style.backgroundColor || (this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background), this.layoutManager = new br(), this.indicatorEngine = new Be(), this.panes = new Kn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new Xn(this.indicatorEngine, this.layoutManager, {
|
|
2332
2332
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2333
2333
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2334
2334
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2335
|
-
}), this.symbolRequests = new
|
|
2335
|
+
}), this.symbolRequests = new ar(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Ir(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Fe(), Wt(this.indicatorEngine), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new ht(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.drawingManager = new Me(), Ut(this.drawingManager), this.drawingRenderer = new Ne(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingRenderer.setTimeFormat((e) => this.crosshairHandler.formatTime(e, this.getDisplayData())), this.drawingManager.setRequestRender(() => {
|
|
2336
2336
|
this.syncRenderContext(), this.engine.requestRender(i.Overlay), this.scheduleAutoSave();
|
|
2337
2337
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2338
2338
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2339
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new
|
|
2339
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new Ct(), this.indicatorHistory = new Yn({
|
|
2340
2340
|
steps: this.undoRedoManager,
|
|
2341
2341
|
snapshot: () => this.getIndicatorSetup(),
|
|
2342
2342
|
enabled: () => this.features.drawingUndoRedo
|
|
@@ -2353,23 +2353,23 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2353
2353
|
primary: e[0] ?? null
|
|
2354
2354
|
})), this.drawingManager.setForeignHistory((e, t) => {
|
|
2355
2355
|
e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
|
|
2356
|
-
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new
|
|
2356
|
+
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new xt({
|
|
2357
2357
|
enabled: this.features.trading,
|
|
2358
2358
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
2359
|
-
}), this.tradingRenderer = new
|
|
2359
|
+
}), this.tradingRenderer = new St(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
2360
2360
|
this.eventBus.emit(e, t);
|
|
2361
|
-
}), this.engine = new
|
|
2361
|
+
}), this.engine = new it(e, t.maxPixelRatio);
|
|
2362
2362
|
let a = this.engine.dprManager.getContainerSize();
|
|
2363
|
-
if (this.viewport = new
|
|
2363
|
+
if (this.viewport = new wt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), t.barLayout && this.viewport.setBarLayout(t.barLayout), this.viewport.setPanLimits({
|
|
2364
2364
|
freePan: t.freePan ?? !0,
|
|
2365
2365
|
minVisibleBars: t.panLimits?.minVisibleBars ?? 3
|
|
2366
2366
|
}), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
|
|
2367
2367
|
if (e.width <= 0 || e.height <= 0) return;
|
|
2368
2368
|
let t = this.viewport.isAtEnd();
|
|
2369
2369
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2370
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new
|
|
2370
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ie(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new tt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new yt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new De(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), Ft(t.crosshair?.cursor) && this.crosshairHandler.setCursor(t.crosshair.cursor), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2371
2371
|
if (e !== null && t) {
|
|
2372
|
-
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o =
|
|
2372
|
+
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = At(n), s = r ? o[e]?.time ?? r.time : void 0;
|
|
2373
2373
|
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(i.Hover);
|
|
2374
2374
|
let c = this.viewport.getState(), l = t.y >= c.chartRect.y && t.y <= c.chartRect.y + c.chartRect.height;
|
|
2375
2375
|
if (r && l && this.features.crosshairTooltip) {
|
|
@@ -2397,14 +2397,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2397
2397
|
let e = this.crosshairHandler.getSyncedSlot();
|
|
2398
2398
|
e !== null && this.showSyncedBar(e);
|
|
2399
2399
|
}
|
|
2400
|
-
}), this.chartLegend = new
|
|
2400
|
+
}), this.chartLegend = new xe(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setResizeListener(() => {
|
|
2401
2401
|
this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
|
|
2402
|
-
}), this.watermark = new
|
|
2402
|
+
}), this.watermark = new Ot(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new Dt(), this.volumeProfile = new Et(), this.marketProfile = new Ke(), this.depthHeatmap = new je(), this.periodLevels = new Ze(), this.pivotMarkers = new $e(), this.barCountdown = new _e(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new ft(), this.sessionShading = new pt(), this.compareRenderer = new Se(), t.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
2403
2403
|
visible: t.sessionBreaks.visible ?? !0,
|
|
2404
2404
|
color: t.sessionBreaks.color,
|
|
2405
2405
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
2406
2406
|
lineWidth: t.sessionBreaks.lineWidth
|
|
2407
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new
|
|
2407
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new me(), this.crosshairTooltip = new Oe(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Qe(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = C(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Mi(t.shapes)), t.font && this.themeManager.setFont(ji(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Ue({
|
|
2408
2408
|
scrollBars: (e) => {
|
|
2409
2409
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2410
2410
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2452,7 +2452,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2452
2452
|
}
|
|
2453
2453
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2454
2454
|
}
|
|
2455
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new
|
|
2455
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new ke(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new pe(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.drawingAlerts = new ui(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(It).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2456
2456
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2457
2457
|
kind: "alert",
|
|
2458
2458
|
alert: "triggered",
|
|
@@ -2468,7 +2468,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2468
2468
|
this.eventBus.emit("alertExpired", X(e));
|
|
2469
2469
|
}), this.alertManager.on("updated", (e) => {
|
|
2470
2470
|
this.eventBus.emit("alertUpdate", X(e));
|
|
2471
|
-
}), this.signalMarkerManager = new
|
|
2471
|
+
}), this.signalMarkerManager = new mt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
2472
2472
|
this.eventBus.emit("signalMarkerAdd", {
|
|
2473
2473
|
id: e.id,
|
|
2474
2474
|
source: e.source,
|
|
@@ -2476,14 +2476,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2476
2476
|
});
|
|
2477
2477
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
2478
2478
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
2479
|
-
}), this.tradeZoneManager = new
|
|
2479
|
+
}), this.tradeZoneManager = new bt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(i.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
2480
2480
|
this.eventBus.emit("tradeZoneAdd", {
|
|
2481
2481
|
id: e.id,
|
|
2482
2482
|
direction: e.direction
|
|
2483
2483
|
});
|
|
2484
2484
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
2485
2485
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
2486
|
-
}), this.replayManager = new
|
|
2486
|
+
}), this.replayManager = new ot(), this.replayManager.on("complete", () => {
|
|
2487
2487
|
let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
|
|
2488
2488
|
t && this.eventBus.emit("replayComplete", {
|
|
2489
2489
|
barIndex: e,
|
|
@@ -2491,9 +2491,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2491
2491
|
});
|
|
2492
2492
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2493
2493
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2494
|
-
}), this.measureOverlay = new
|
|
2495
|
-
let e = new
|
|
2496
|
-
this.interactionManager.setPanHandler(new
|
|
2494
|
+
}), this.measureOverlay = new qe(), this.interactionManager = new Ve(e), this.features.panning) {
|
|
2495
|
+
let e = new kr();
|
|
2496
|
+
this.interactionManager.setPanHandler(new Ye((t, n) => {
|
|
2497
2497
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2498
2498
|
}, () => e.reset()));
|
|
2499
2499
|
}
|
|
@@ -2505,10 +2505,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2505
2505
|
scales: !this.indicatorEngine.hasLeftScaleOverlays()
|
|
2506
2506
|
}
|
|
2507
2507
|
})), this.features.zooming) {
|
|
2508
|
-
this.interactionManager.setZoomHandler(new
|
|
2508
|
+
this.interactionManager.setZoomHandler(new kt((e, t) => {
|
|
2509
2509
|
this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
|
|
2510
2510
|
}));
|
|
2511
|
-
let e = new
|
|
2511
|
+
let e = new ge((e) => {
|
|
2512
2512
|
this.holdPriceScale(), this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
|
|
2513
2513
|
}, (e) => {
|
|
2514
2514
|
let t = this.viewport.getState().chartRect.width;
|
|
@@ -2543,10 +2543,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2543
2543
|
...this.viewport.getState(),
|
|
2544
2544
|
data: this.getDisplayData()
|
|
2545
2545
|
})), this.features.alerts) {
|
|
2546
|
-
let e = new
|
|
2546
|
+
let e = new fe(this.alertManager, () => this.viewport.getState());
|
|
2547
2547
|
this.interactionManager.setAlertDragHandler(e);
|
|
2548
2548
|
}
|
|
2549
|
-
let o = new
|
|
2549
|
+
let o = new Xe();
|
|
2550
2550
|
o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
|
|
2551
2551
|
let t = this.getDisplayData();
|
|
2552
2552
|
if (t.length === 0) return;
|
|
@@ -2703,7 +2703,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2703
2703
|
useStreamHistory(e, t, n = !0) {
|
|
2704
2704
|
if (this.hostHistoryLoader) return;
|
|
2705
2705
|
let r = P(e), i = r.fetchHistoryBefore, a = this.streamTimeframe;
|
|
2706
|
-
if (!i || a === null ||
|
|
2706
|
+
if (!i || a === null || ue(a) !== null) {
|
|
2707
2707
|
this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
|
|
2708
2708
|
return;
|
|
2709
2709
|
}
|
|
@@ -2798,11 +2798,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2798
2798
|
setChartTypeOptions(e) {
|
|
2799
2799
|
this.chartTypeOptions = {
|
|
2800
2800
|
...this.chartTypeOptions,
|
|
2801
|
-
...
|
|
2801
|
+
...C(e)
|
|
2802
2802
|
}, this.updateViewportAndRender(!0), this.fitFewColumns(), this.a11y?.refresh(!0), this.markStateChanged();
|
|
2803
2803
|
}
|
|
2804
2804
|
getChartTypeOptions() {
|
|
2805
|
-
return
|
|
2805
|
+
return C(this.chartTypeOptions);
|
|
2806
2806
|
}
|
|
2807
2807
|
setExtendedHours(e) {
|
|
2808
2808
|
e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
|
|
@@ -2998,7 +2998,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2998
2998
|
this.indicatorEngine.setStyleDefaults(e, null);
|
|
2999
2999
|
return;
|
|
3000
3000
|
}
|
|
3001
|
-
let { plots: n, ...r } = t, i = n === void 0 ? void 0 :
|
|
3001
|
+
let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ae(n);
|
|
3002
3002
|
this.indicatorEngine.setStyleDefaults(e, {
|
|
3003
3003
|
...r,
|
|
3004
3004
|
...i ? { plots: i } : {}
|
|
@@ -3006,7 +3006,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3006
3006
|
}
|
|
3007
3007
|
setPaneStyle(e, t) {
|
|
3008
3008
|
let n = this.indicatorPanes.paneOf(e);
|
|
3009
|
-
this.layoutManager.getPanels().some((e) => e.id === n) && this.indicatorHistory.record(n, () => this.setPaneStyleNow(n, t ?
|
|
3009
|
+
this.layoutManager.getPanels().some((e) => e.id === n) && this.indicatorHistory.record(n, () => this.setPaneStyleNow(n, t ? oe(t) : null));
|
|
3010
3010
|
}
|
|
3011
3011
|
setPaneStyleNow(e, t) {
|
|
3012
3012
|
this.panes.setStyle(e, t) && (this.syncRenderContext(), this.engine.requestRender(), this.markStateChanged());
|
|
@@ -3025,7 +3025,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3025
3025
|
return this.pluginManager;
|
|
3026
3026
|
}
|
|
3027
3027
|
static indicators() {
|
|
3028
|
-
let e = new
|
|
3028
|
+
let e = new Be();
|
|
3029
3029
|
return Wt(e), e.getAvailableIndicators();
|
|
3030
3030
|
}
|
|
3031
3031
|
setPanelPosition(e, t) {
|
|
@@ -3152,7 +3152,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3152
3152
|
roundPrice(e) {
|
|
3153
3153
|
if (!Number.isFinite(e)) return e;
|
|
3154
3154
|
let t = this.stepAt(e);
|
|
3155
|
-
if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(
|
|
3155
|
+
if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(le(t)));
|
|
3156
3156
|
let { min: n, max: r } = this.viewport.getState().priceRange;
|
|
3157
3157
|
return Number(e.toFixed(this.marketPricePrecision ?? l(n, r)));
|
|
3158
3158
|
}
|
|
@@ -3400,7 +3400,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3400
3400
|
}
|
|
3401
3401
|
applyPriceAxisAdd() {
|
|
3402
3402
|
let e = this.features.priceAxisAddButton && this.features.crosshair;
|
|
3403
|
-
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ?
|
|
3403
|
+
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Je : 0);
|
|
3404
3404
|
}
|
|
3405
3405
|
setPriceAxisAddButton(e) {
|
|
3406
3406
|
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(i.Overlay);
|
|
@@ -3491,11 +3491,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3491
3491
|
}
|
|
3492
3492
|
getExportText(e = "csv", t = {}) {
|
|
3493
3493
|
let { bars: n, columns: r } = this.getExportData(t);
|
|
3494
|
-
return e === "json" ?
|
|
3494
|
+
return e === "json" ? O.toJSON(n, r) : O.toCSV(n, r);
|
|
3495
3495
|
}
|
|
3496
3496
|
download(e, t, n) {
|
|
3497
3497
|
let r = this.getExportText(e, n);
|
|
3498
|
-
e === "json" ?
|
|
3498
|
+
e === "json" ? O.download(r, t ?? "chart-data.json", "application/json") : O.download(r, t ?? "chart-data.csv", "text/csv");
|
|
3499
3499
|
}
|
|
3500
3500
|
setAutoSave(e, t = 5e3) {
|
|
3501
3501
|
this.autoSaveScheduler.enable(e, t);
|
|
@@ -3557,7 +3557,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3557
3557
|
this.indicatorHistory.record(e, () => this.updateIndicatorStyleNow(e, t));
|
|
3558
3558
|
}
|
|
3559
3559
|
updateIndicatorStyleNow(e, t) {
|
|
3560
|
-
let { plots: n, ...r } = t, i = n === void 0 ? void 0 :
|
|
3560
|
+
let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ae(n);
|
|
3561
3561
|
this.indicatorEngine.updateIndicatorStyle(e, {
|
|
3562
3562
|
...r,
|
|
3563
3563
|
...i ? { plots: i } : {}
|
|
@@ -3658,7 +3658,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3658
3658
|
}
|
|
3659
3659
|
checkAlerts(e) {
|
|
3660
3660
|
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.replaySession || this.series.length() === 0 ? null : (e) => this.indicatorEngine.getOutput(e)?.series;
|
|
3661
|
-
|
|
3661
|
+
ii(this.alertManager, {
|
|
3662
3662
|
price: e,
|
|
3663
3663
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3664
3664
|
lines: n
|
|
@@ -3674,7 +3674,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3674
3674
|
feed: void 0
|
|
3675
3675
|
};
|
|
3676
3676
|
if (!j(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
3677
|
-
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new
|
|
3677
|
+
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new _t(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (e) => {
|
|
3678
3678
|
let n = this.streamSeriesKey(t.adapter);
|
|
3679
3679
|
n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(e) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(e) : (this.replaySession && this.useStreamHistory(t.adapter, t.historyPageSize, !1), this.setData(e)), this.snapshotKey = n, this.useStreamHistory(t.adapter, t.historyPageSize);
|
|
3680
3680
|
}), this.streamManager.on("barClose", (e) => {
|
|
@@ -3730,18 +3730,18 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3730
3730
|
}), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = t.autoScroll !== !1, this.setStreamTarget(t.symbol, t.timeframe), this.streamAdapter = t.adapter;
|
|
3731
3731
|
let n = this.streamManager;
|
|
3732
3732
|
if (this.resolveStreamSymbol(t.adapter, t.symbol), await n.connect(t), this.streamManager !== n) return;
|
|
3733
|
-
let r =
|
|
3733
|
+
let r = E(t.timeframe);
|
|
3734
3734
|
this.barCountdown.setTimeframeMs(r), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
|
|
3735
3735
|
this.barCountdown.isVisible() && this.engine.requestRender(i.Hover);
|
|
3736
3736
|
}, 1e3);
|
|
3737
3737
|
}
|
|
3738
3738
|
streamSeriesKey(e) {
|
|
3739
|
-
let t = P(e), n = this.streamTimeframe, r = t instanceof
|
|
3739
|
+
let t = P(e), n = this.streamTimeframe, r = t instanceof st && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3740
3740
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3741
3741
|
}
|
|
3742
3742
|
setStreamTarget(e, t) {
|
|
3743
3743
|
let n = this.announcedSymbol;
|
|
3744
|
-
this.currentSymbol = e, this.streamTimeframe = t, this.tickStream =
|
|
3744
|
+
this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = ue(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
|
|
3745
3745
|
symbol: e,
|
|
3746
3746
|
previous: n
|
|
3747
3747
|
})), this.useTimeframe(t);
|
|
@@ -3760,7 +3760,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3760
3760
|
if (!this.streamManager) return;
|
|
3761
3761
|
let n = this.streamAdapter;
|
|
3762
3762
|
if (n && !j(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
3763
|
-
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(
|
|
3763
|
+
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(E(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
|
|
3764
3764
|
}
|
|
3765
3765
|
isIndicatorAllowed(e) {
|
|
3766
3766
|
let t = this.features.indicatorIds;
|
|
@@ -3779,7 +3779,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3779
3779
|
}
|
|
3780
3780
|
connectExecution(e, t = {}) {
|
|
3781
3781
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3782
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3782
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = zr(e, {
|
|
3783
3783
|
onIntent: (e, t) => {
|
|
3784
3784
|
let n = (e) => t(e.payload);
|
|
3785
3785
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -4118,7 +4118,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4118
4118
|
}
|
|
4119
4119
|
let t = this.crosshairSeries(), n = e >= 0 && e < t.length ? t[e] : void 0, r = n && e > 0 ? t[e - 1] : void 0;
|
|
4120
4120
|
this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(n ?? null, r ?? null);
|
|
4121
|
-
let i = n ?
|
|
4121
|
+
let i = n ? At(t)[e]?.time ?? n.time : void 0;
|
|
4122
4122
|
this.eventBus.emit("crosshairSync", {
|
|
4123
4123
|
barIndex: e,
|
|
4124
4124
|
...n ? { bar: n } : {},
|
|
@@ -4206,7 +4206,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4206
4206
|
return this.displayTz;
|
|
4207
4207
|
}
|
|
4208
4208
|
getExchangeTimeZone() {
|
|
4209
|
-
return [
|
|
4209
|
+
return [T(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && b(e)) ?? null;
|
|
4210
4210
|
}
|
|
4211
4211
|
setTimezone(e) {
|
|
4212
4212
|
this.setTimeZone(e);
|
|
@@ -4233,7 +4233,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4233
4233
|
this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
|
|
4234
4234
|
}
|
|
4235
4235
|
holdStudyZone() {
|
|
4236
|
-
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(),
|
|
4236
|
+
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), ut);
|
|
4237
4237
|
}
|
|
4238
4238
|
endStudyZoneWait() {
|
|
4239
4239
|
this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
|
|
@@ -4248,7 +4248,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4248
4248
|
}
|
|
4249
4249
|
spokenBarTime(e) {
|
|
4250
4250
|
let t = this.getDisplayData(), n = e * d(t), r = this.numberLocale || "en-US";
|
|
4251
|
-
return f(t) === !0 ?
|
|
4251
|
+
return f(t) === !0 ? de(r, { dateStyle: "medium" }, u(n, this.displayTz, this.getExchangeTimeZone()))(n) : de(r, {
|
|
4252
4252
|
dateStyle: "medium",
|
|
4253
4253
|
timeStyle: "short"
|
|
4254
4254
|
}, this.displayTz)(n);
|
|
@@ -4261,18 +4261,18 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4261
4261
|
this.studyZoneHeld = !1, this.endStudyZoneWait(), this.useSymbolInfo(e);
|
|
4262
4262
|
}
|
|
4263
4263
|
useSymbolInfo(e) {
|
|
4264
|
-
let t = e && this.symbolInfo?.symbol === e.symbol ?
|
|
4264
|
+
let t = e && this.symbolInfo?.symbol === e.symbol ? T(this.symbolInfo) : void 0;
|
|
4265
4265
|
this.symbolInfo = e ? bi({
|
|
4266
4266
|
...e,
|
|
4267
4267
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
4268
4268
|
}, 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);
|
|
4269
4269
|
let n = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
|
|
4270
|
-
let t =
|
|
4270
|
+
let t = w(e.start), n = w(e.end);
|
|
4271
4271
|
return t === null || n === null ? [] : [{
|
|
4272
4272
|
startMinute: t,
|
|
4273
4273
|
endMinute: n
|
|
4274
4274
|
}];
|
|
4275
|
-
}), r =
|
|
4275
|
+
}), r = T(this.symbolInfo);
|
|
4276
4276
|
this.sessionShading.replaceConfig(n.length > 0 && r && b(r) ? {
|
|
4277
4277
|
timeZone: r,
|
|
4278
4278
|
windows: n,
|
|
@@ -4291,7 +4291,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4291
4291
|
...r,
|
|
4292
4292
|
...e,
|
|
4293
4293
|
symbol: e.symbol || r?.symbol || t
|
|
4294
|
-
},
|
|
4294
|
+
}, T(r));
|
|
4295
4295
|
r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
|
|
4296
4296
|
}
|
|
4297
4297
|
resolveStreamSymbol(e, t) {
|
|
@@ -4374,7 +4374,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4374
4374
|
this.engine.getGpu() && this.engine.renderNow();
|
|
4375
4375
|
}
|
|
4376
4376
|
screenshot(e) {
|
|
4377
|
-
this.features.screenshot && (this.freshFrame(),
|
|
4377
|
+
this.features.screenshot && (this.freshFrame(), A.download(this.container, e, this.themeManager.getTheme().background));
|
|
4378
4378
|
}
|
|
4379
4379
|
async copyScreenshot() {
|
|
4380
4380
|
if (!this.features.screenshot) return !1;
|
|
@@ -4382,7 +4382,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4382
4382
|
if (!t?.write || !e) return !1;
|
|
4383
4383
|
try {
|
|
4384
4384
|
this.freshFrame();
|
|
4385
|
-
let n =
|
|
4385
|
+
let n = A.toBlob(this.container, this.themeManager.getTheme().background).then((e) => {
|
|
4386
4386
|
if (!e) throw Error("No chart image to copy");
|
|
4387
4387
|
return e;
|
|
4388
4388
|
});
|
|
@@ -4400,10 +4400,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4400
4400
|
}
|
|
4401
4401
|
}
|
|
4402
4402
|
screenshotDataURL() {
|
|
4403
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
4403
|
+
return this.features.screenshot ? (this.freshFrame(), A.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
|
|
4404
4404
|
}
|
|
4405
4405
|
async screenshotBlob() {
|
|
4406
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
4406
|
+
return this.features.screenshot ? (this.freshFrame(), A.toBlob(this.container, this.themeManager.getTheme().background)) : null;
|
|
4407
4407
|
}
|
|
4408
4408
|
addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
|
|
4409
4409
|
if (!this.features.alerts) return null;
|
|
@@ -4527,19 +4527,19 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4527
4527
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4528
4528
|
c.animate = c.animate === !0;
|
|
4529
4529
|
let l = this.series.inHoursShown(this.series.liveBars()), u = t > 0 && i === void 0 && a !== !1, d = c.startIndex;
|
|
4530
|
-
i !== void 0 && d === void 0 ? d =
|
|
4530
|
+
i !== void 0 && d === void 0 ? d = di(l, i) : u && d !== void 0 && (d += t);
|
|
4531
4531
|
let f = u ? t : a && d !== void 0 && d > 0 ? Math.min(Math.floor(d), l.length - 1) : 0, p = f > 0 ? l.slice(f) : l;
|
|
4532
4532
|
d !== void 0 && (c.startIndex = d - f), n.windowTime = f > 0 ? p[0]?.time ?? null : null, n.steps = r ?? null, n.stepsSymbol = this.currentSymbol, n.until = null, n.animate = c.animate, n.step = c.animate ? s ?? null : null, this.replayRevealMarks = o !== !1, this.useReplayLoader(n, !0);
|
|
4533
4533
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4534
4534
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4535
4535
|
let h = this.replayStepsSeries;
|
|
4536
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4536
|
+
h && c.startIndex !== void 0 && (c.startIndex = Gi(h, p, c.startIndex));
|
|
4537
4537
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4538
4538
|
this.revealReplayMarks(this.replayRevealMarks ? _?.time ?? null : null), n.held && (n.held.state = c.paused ? "paused" : "playing", c.paused = !0), !c.paused && c.startIndex !== void 0 && c.startIndex >= 1 && this.replaySeek(c.startIndex - 1), this.replayManager.play(c);
|
|
4539
4539
|
}
|
|
4540
4540
|
buildReplay(e, t, n) {
|
|
4541
4541
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4542
|
-
this.replayPieces = r && t ?
|
|
4542
|
+
this.replayPieces = r && t ? Ji(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4543
4543
|
let a = this.replayRestarting;
|
|
4544
4544
|
this.replayRestarting = !0;
|
|
4545
4545
|
try {
|
|
@@ -4553,7 +4553,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4553
4553
|
let n = t, a = e[t];
|
|
4554
4554
|
if (i) {
|
|
4555
4555
|
let r = i[t];
|
|
4556
|
-
n =
|
|
4556
|
+
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? Xi(c, r) : Ki(e[n], i, t), a = qi(i, e, t, n) ? e[n] : c;
|
|
4557
4557
|
}
|
|
4558
4558
|
let u = this.replayForming;
|
|
4559
4559
|
this.replayForming = null, s = t;
|
|
@@ -4577,7 +4577,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4577
4577
|
});
|
|
4578
4578
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4579
4579
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4580
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4580
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Yi() ? ei(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = $r(r, i);
|
|
4581
4581
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4582
4582
|
index: t,
|
|
4583
4583
|
path: r
|
|
@@ -4595,7 +4595,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4595
4595
|
}
|
|
4596
4596
|
replayPathOf(e, t) {
|
|
4597
4597
|
let n = e[t];
|
|
4598
|
-
return
|
|
4598
|
+
return Jr(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4599
4599
|
}
|
|
4600
4600
|
loadReplaySteps(e, t) {
|
|
4601
4601
|
let n = this.replayLoader?.loader;
|
|
@@ -4605,12 +4605,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4605
4605
|
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(Ni / r) : 1);
|
|
4606
4606
|
}
|
|
4607
4607
|
useReplayLoader(e, t) {
|
|
4608
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4608
|
+
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}`;
|
|
4609
4609
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4610
|
-
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l =
|
|
4610
|
+
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new Vr({
|
|
4611
4611
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4612
4612
|
step: i,
|
|
4613
|
-
ratio: Math.max(1, Math.round(l /
|
|
4613
|
+
ratio: Math.max(1, Math.round(l / E(i))),
|
|
4614
4614
|
barMs: l,
|
|
4615
4615
|
keep: (e) => this.series.inHoursShown(e),
|
|
4616
4616
|
report: (e) => this.eventBus.emit("replayStepsLoad", e)
|
|
@@ -4645,7 +4645,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4645
4645
|
if (!t) return;
|
|
4646
4646
|
let n = this.series.inHoursShown(this.series.liveBars());
|
|
4647
4647
|
if (n.length === 0) return;
|
|
4648
|
-
let r = t.windowTime === null ? 0 : Math.min(
|
|
4648
|
+
let r = t.windowTime === null ? 0 : Math.min(di(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4649
4649
|
this.useReplayLoader(t, !1);
|
|
4650
4650
|
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Bi(o ?? i, t.until);
|
|
4651
4651
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
@@ -4678,7 +4678,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4678
4678
|
}
|
|
4679
4679
|
replayStepsOver(e, t, n = !1) {
|
|
4680
4680
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4681
|
-
let r =
|
|
4681
|
+
let r = Wi(this.series.inHoursShown(e.steps), t);
|
|
4682
4682
|
return r && (n || Hi(r, t)) ? r : null;
|
|
4683
4683
|
}
|
|
4684
4684
|
canPageBackForReplay(e) {
|
|
@@ -4743,11 +4743,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4743
4743
|
if (!this.replaySession) return -1;
|
|
4744
4744
|
if (this.replayForming) return this.replayForming.index;
|
|
4745
4745
|
let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
|
|
4746
|
-
return t && this.replayCoarse ?
|
|
4746
|
+
return t && this.replayCoarse ? Z(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
|
|
4747
4747
|
}
|
|
4748
4748
|
replaySeekToBar(e) {
|
|
4749
4749
|
let t = this.replayStepsSeries;
|
|
4750
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4750
|
+
this.replaySeek(t && this.replayCoarse ? Gi(t, this.replayCoarse, e) : e);
|
|
4751
4751
|
}
|
|
4752
4752
|
replayPause() {
|
|
4753
4753
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4826,7 +4826,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4826
4826
|
};
|
|
4827
4827
|
}
|
|
4828
4828
|
captureSnapshot() {
|
|
4829
|
-
return
|
|
4829
|
+
return D.capture({
|
|
4830
4830
|
getDrawings: () => [...this.getDrawings().filter((e) => e.paneId === void 0 || this.layoutManager.getPanels().some((t) => t.id === e.paneId)), ...this.keptPaneDrawings],
|
|
4831
4831
|
getTheme: () => this.themeManager.getBaseTheme(),
|
|
4832
4832
|
getAlerts: () => this.getAlerts(),
|
|
@@ -4839,12 +4839,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4839
4839
|
});
|
|
4840
4840
|
}
|
|
4841
4841
|
restoreIndicators(e, t) {
|
|
4842
|
-
let n =
|
|
4842
|
+
let n = $n(e), r = /* @__PURE__ */ new Map();
|
|
4843
4843
|
this.unrestoredIndicators = [];
|
|
4844
4844
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4845
4845
|
if (t) {
|
|
4846
4846
|
let e = this.getIndicatorSetup();
|
|
4847
|
-
for (let t of
|
|
4847
|
+
for (let t of tr(e, n)) o.add(t);
|
|
4848
4848
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4849
4849
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4850
4850
|
for (let e = !0; e;) {
|
|
@@ -4855,7 +4855,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4855
4855
|
}
|
|
4856
4856
|
}
|
|
4857
4857
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4858
|
-
let s = (e) =>
|
|
4858
|
+
let s = (e) => rr(e, r);
|
|
4859
4859
|
for (let e of n) {
|
|
4860
4860
|
let n = null;
|
|
4861
4861
|
if (o.has(e.instanceId)) {
|
|
@@ -4888,7 +4888,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4888
4888
|
}
|
|
4889
4889
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
4890
4890
|
}
|
|
4891
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
4891
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), Qn(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
4892
4892
|
}
|
|
4893
4893
|
restoreLooks(e, t) {
|
|
4894
4894
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -4905,10 +4905,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4905
4905
|
let s = t.levels ?? null;
|
|
4906
4906
|
JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s);
|
|
4907
4907
|
let c = t.intervals ?? null;
|
|
4908
|
-
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ?
|
|
4908
|
+
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? oe(t.paneStyle) : null);
|
|
4909
4909
|
}
|
|
4910
4910
|
getIndicatorSetup() {
|
|
4911
|
-
return [
|
|
4911
|
+
return [...Zn(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
4912
4912
|
}
|
|
4913
4913
|
applyIndicatorSetup(e) {
|
|
4914
4914
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -4917,7 +4917,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4917
4917
|
});
|
|
4918
4918
|
}
|
|
4919
4919
|
followIndicatorAlerts(e, t) {
|
|
4920
|
-
this.features.alerts &&
|
|
4920
|
+
this.features.alerts && oi(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
4921
4921
|
}
|
|
4922
4922
|
beginIndicatorEdit(e) {
|
|
4923
4923
|
this.indicatorHistory.begin(e);
|
|
@@ -4941,49 +4941,49 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4941
4941
|
keptPaneDrawings = [];
|
|
4942
4942
|
replayingIndicatorStep = !1;
|
|
4943
4943
|
takesDrawing(e, t) {
|
|
4944
|
-
return
|
|
4944
|
+
return lr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
4945
4945
|
}
|
|
4946
4946
|
renamePane(e, t) {
|
|
4947
4947
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
4948
4948
|
}
|
|
4949
4949
|
drawingPaneAt(e) {
|
|
4950
|
-
return
|
|
4950
|
+
return sr(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
4951
4951
|
}
|
|
4952
4952
|
drawingPaneViewport(e) {
|
|
4953
4953
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
4954
|
-
return
|
|
4954
|
+
return cr(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
4955
4955
|
}
|
|
4956
4956
|
saveState(e) {
|
|
4957
4957
|
if (!this.features.saveLoad) return null;
|
|
4958
|
-
let t = this.captureSnapshot(), n =
|
|
4959
|
-
return e &&
|
|
4958
|
+
let t = this.captureSnapshot(), n = D.serialize(t);
|
|
4959
|
+
return e && D.saveToStorage(e, t), n;
|
|
4960
4960
|
}
|
|
4961
4961
|
loadState(e) {
|
|
4962
4962
|
if (!this.features.saveLoad) return;
|
|
4963
|
-
let t =
|
|
4963
|
+
let t = D.deserialize(e);
|
|
4964
4964
|
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");
|
|
4965
4965
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
4966
4966
|
this.drawingManager.renamePanes(n);
|
|
4967
4967
|
let r = new Set(this.unrestoredIndicators.map((e) => e.instanceId)), i = this.drawingManager.getDrawings(), a = i.filter((e) => e.paneId === void 0 || this.takesDrawing(e.paneId, e.type));
|
|
4968
|
-
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts &&
|
|
4968
|
+
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts && li(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
4969
4969
|
console.warn("Layout alert left out:", e);
|
|
4970
4970
|
}), this.markStateChanged();
|
|
4971
4971
|
}
|
|
4972
4972
|
loadStateFromStorage(e) {
|
|
4973
4973
|
if (!this.features.saveLoad) return !1;
|
|
4974
|
-
let t =
|
|
4975
|
-
return t ? (this.loadState(
|
|
4974
|
+
let t = D.loadFromStorage(e);
|
|
4975
|
+
return t ? (this.loadState(D.serialize(t)), !0) : !1;
|
|
4976
4976
|
}
|
|
4977
4977
|
downloadState(e) {
|
|
4978
|
-
this.features.saveLoad &&
|
|
4978
|
+
this.features.saveLoad && D.downloadFile(this.captureSnapshot(), e);
|
|
4979
4979
|
}
|
|
4980
4980
|
async loadStateFromFile() {
|
|
4981
4981
|
if (!this.features.saveLoad) return;
|
|
4982
|
-
let e = await
|
|
4983
|
-
this.loadState(
|
|
4982
|
+
let e = await D.loadFromFile();
|
|
4983
|
+
this.loadState(D.serialize(e));
|
|
4984
4984
|
}
|
|
4985
4985
|
setLocale(e) {
|
|
4986
|
-
|
|
4986
|
+
ce(e), this.engine.requestRender();
|
|
4987
4987
|
}
|
|
4988
4988
|
setNumberLocale(e) {
|
|
4989
4989
|
this.numberLocale = e, this.viewport.setNumberLocale(e), this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.timeAxis.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.pinnedTooltip.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
|
|
@@ -5034,7 +5034,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5034
5034
|
}
|
|
5035
5035
|
createChartRenderer(e) {
|
|
5036
5036
|
let t = kn(e, (e) => this.pluginManager.getChartType(e));
|
|
5037
|
-
return t instanceof
|
|
5037
|
+
return t instanceof Re && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5038
5038
|
}
|
|
5039
5039
|
crosshairSeries() {
|
|
5040
5040
|
return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
|
|
@@ -5052,7 +5052,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5052
5052
|
}
|
|
5053
5053
|
exportBars() {
|
|
5054
5054
|
if (this.isTimeAligned()) return this.series.bars();
|
|
5055
|
-
let e = this.getDisplayData(), t =
|
|
5055
|
+
let e = this.getDisplayData(), t = At(e);
|
|
5056
5056
|
return e.map((e, n) => ({
|
|
5057
5057
|
...e,
|
|
5058
5058
|
time: t[n]?.time ?? e.time
|
|
@@ -5111,7 +5111,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5111
5111
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5112
5112
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5113
5113
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5114
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5114
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && Hn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5115
5115
|
});
|
|
5116
5116
|
}
|
|
5117
5117
|
updateViewportAndRender(e = !1) {
|
|
@@ -5126,7 +5126,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5126
5126
|
fitLeftAxisWidth() {
|
|
5127
5127
|
let e = this.leftViewport;
|
|
5128
5128
|
if (!e) return !1;
|
|
5129
|
-
let t = this.themeManager.getTheme(), n =
|
|
5129
|
+
let t = this.themeManager.getTheme(), n = Tr({
|
|
5130
5130
|
min: e.priceRange.min,
|
|
5131
5131
|
max: e.priceRange.max,
|
|
5132
5132
|
lastPrice: null,
|
|
@@ -5135,12 +5135,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5135
5135
|
fontFamily: t.font.family,
|
|
5136
5136
|
fontSizeSmall: t.font.sizeSmall,
|
|
5137
5137
|
measure: (e, t) => this.measureText(e, t)
|
|
5138
|
-
}), r =
|
|
5138
|
+
}), r = Er(this.leftAxisWidth, n);
|
|
5139
5139
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5140
5140
|
}
|
|
5141
5141
|
fitPriceAxisWidth() {
|
|
5142
5142
|
if (!this.features.priceAxis) return !1;
|
|
5143
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5143
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = Tr({
|
|
5144
5144
|
min: e.min,
|
|
5145
5145
|
max: e.max,
|
|
5146
5146
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5151,7 +5151,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5151
5151
|
fontFamily: t.font.family,
|
|
5152
5152
|
fontSizeSmall: t.font.sizeSmall,
|
|
5153
5153
|
measure: (e, t) => this.measureText(e, t)
|
|
5154
|
-
}), r =
|
|
5154
|
+
}), r = Er(this.priceAxisWidth, n);
|
|
5155
5155
|
return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5156
5156
|
}
|
|
5157
5157
|
measureText(e, t) {
|
|
@@ -5246,7 +5246,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5246
5246
|
});
|
|
5247
5247
|
}
|
|
5248
5248
|
drawOverlayPlugins(e, t) {
|
|
5249
|
-
let n =
|
|
5249
|
+
let n = jr(this.pluginManager.getOverlays(), t);
|
|
5250
5250
|
if (n.length === 0) return;
|
|
5251
5251
|
let r = {
|
|
5252
5252
|
viewport: this.viewport.getState(),
|
|
@@ -5324,12 +5324,12 @@ function Li(e) {
|
|
|
5324
5324
|
}
|
|
5325
5325
|
function Ri(e, t) {
|
|
5326
5326
|
let n = e[t + 1];
|
|
5327
|
-
return n ? n.time - e[t].time :
|
|
5327
|
+
return n ? n.time - e[t].time : Ui(e);
|
|
5328
5328
|
}
|
|
5329
5329
|
function zi(e, t, n) {
|
|
5330
5330
|
let r = e.fedTime;
|
|
5331
5331
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5332
|
-
let i = Ri(t,
|
|
5332
|
+
let i = Ri(t, Z(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Z(n, a), s = n[o].time;
|
|
5333
5333
|
if (s > a) return;
|
|
5334
5334
|
let c = Ri(n, o);
|
|
5335
5335
|
if (a === s && o > 0) {
|
|
@@ -5339,8 +5339,8 @@ function zi(e, t, n) {
|
|
|
5339
5339
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5340
5340
|
}
|
|
5341
5341
|
function Bi(e, t) {
|
|
5342
|
-
let n =
|
|
5343
|
-
return n > r && r >= 0 && e[r].time +
|
|
5342
|
+
let n = fi(e, t), r = e.length - 1;
|
|
5343
|
+
return n > r && r >= 0 && e[r].time + Ui(e) <= t ? r : Math.max(-1, n - 2);
|
|
5344
5344
|
}
|
|
5345
5345
|
function Vi(e) {
|
|
5346
5346
|
let t = Infinity;
|
|
@@ -5351,19 +5351,19 @@ function Hi(e, t) {
|
|
|
5351
5351
|
if (!(Vi(e) < Vi(t))) return !1;
|
|
5352
5352
|
let n = Math.max(0, e.length - Fi);
|
|
5353
5353
|
for (let r = n; r < e.length; r++) {
|
|
5354
|
-
let n = t[
|
|
5354
|
+
let n = t[Z(t, e[r].time)], i = (n.high - n.low) * Ii + 2 ** -52;
|
|
5355
5355
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5356
5356
|
}
|
|
5357
5357
|
return !0;
|
|
5358
5358
|
}
|
|
5359
|
-
function
|
|
5359
|
+
function Ui(e) {
|
|
5360
5360
|
let t = 0;
|
|
5361
5361
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5362
5362
|
return t > 0 ? t : Infinity;
|
|
5363
5363
|
}
|
|
5364
|
-
function
|
|
5364
|
+
function Wi(e, t) {
|
|
5365
5365
|
if (t.length === 0) return null;
|
|
5366
|
-
let n = t[t.length - 1].time +
|
|
5366
|
+
let n = t[t.length - 1].time + Ui(t), r = e.filter((e) => Ln(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5367
5367
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5368
5368
|
if (i.length === 0) return null;
|
|
5369
5369
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5371,7 +5371,7 @@ function Ui(e, t) {
|
|
|
5371
5371
|
let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
|
|
5372
5372
|
return [...o, ...s];
|
|
5373
5373
|
}
|
|
5374
|
-
function
|
|
5374
|
+
function Z(e, t) {
|
|
5375
5375
|
let n = 0, r = e.length - 1;
|
|
5376
5376
|
for (; n < r;) {
|
|
5377
5377
|
let i = n + r + 1 >> 1;
|
|
@@ -5379,37 +5379,37 @@ function Q(e, t) {
|
|
|
5379
5379
|
}
|
|
5380
5380
|
return n;
|
|
5381
5381
|
}
|
|
5382
|
-
function
|
|
5382
|
+
function Gi(e, t, n) {
|
|
5383
5383
|
let r = Math.max(0, Math.min(Math.floor(Number.isFinite(n) ? n : 0), t.length - 1)), i = r + 1 < t.length ? t[r + 1].time : Infinity, a = -1;
|
|
5384
5384
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5385
5385
|
return Math.max(0, a);
|
|
5386
5386
|
}
|
|
5387
|
-
function
|
|
5387
|
+
function Ki(e, t, n) {
|
|
5388
5388
|
let r = n;
|
|
5389
5389
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5390
5390
|
let i = {
|
|
5391
5391
|
...t[r],
|
|
5392
5392
|
time: e.time
|
|
5393
5393
|
};
|
|
5394
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5394
|
+
for (let e = r + 1; e <= n; e++) i = Xi(i, t[e]);
|
|
5395
5395
|
return i;
|
|
5396
5396
|
}
|
|
5397
|
-
function
|
|
5397
|
+
function qi(e, t, n, r) {
|
|
5398
5398
|
let i = e[n + 1], a = t[r + 1];
|
|
5399
5399
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5400
5400
|
}
|
|
5401
|
-
function
|
|
5401
|
+
function Ji(e, t) {
|
|
5402
5402
|
let n = /* @__PURE__ */ new Map();
|
|
5403
5403
|
for (let r of e) {
|
|
5404
|
-
let e = t[
|
|
5404
|
+
let e = t[Z(t, r.time)].time, i = n.get(e);
|
|
5405
5405
|
i ? i.push(r) : n.set(e, [r]);
|
|
5406
5406
|
}
|
|
5407
5407
|
return n;
|
|
5408
5408
|
}
|
|
5409
|
-
function
|
|
5409
|
+
function Yi() {
|
|
5410
5410
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5411
5411
|
}
|
|
5412
|
-
function
|
|
5412
|
+
function Xi(e, t) {
|
|
5413
5413
|
return {
|
|
5414
5414
|
time: e.time,
|
|
5415
5415
|
open: e.open,
|
|
@@ -5421,26 +5421,26 @@ function Yi(e, t) {
|
|
|
5421
5421
|
}
|
|
5422
5422
|
//#endregion
|
|
5423
5423
|
//#region src/io/parseOHLCV.ts
|
|
5424
|
-
var
|
|
5424
|
+
var Zi = [
|
|
5425
5425
|
"time",
|
|
5426
5426
|
"timestamp",
|
|
5427
5427
|
"date",
|
|
5428
5428
|
"datetime",
|
|
5429
5429
|
"t"
|
|
5430
|
-
],
|
|
5430
|
+
], Qi = ["open", "o"], $i = ["high", "h"], ea = ["low", "l"], ta = ["close", "c"], na = [
|
|
5431
5431
|
"volume",
|
|
5432
5432
|
"vol",
|
|
5433
5433
|
"v"
|
|
5434
5434
|
];
|
|
5435
|
-
function
|
|
5435
|
+
function ra(e) {
|
|
5436
5436
|
let t = e.trim();
|
|
5437
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5437
|
+
return t ? t[0] === "[" || t[0] === "{" ? ia(t) : aa(t) : {
|
|
5438
5438
|
data: [],
|
|
5439
5439
|
rowCount: 0,
|
|
5440
5440
|
skipped: 0
|
|
5441
5441
|
};
|
|
5442
5442
|
}
|
|
5443
|
-
function
|
|
5443
|
+
function ia(e) {
|
|
5444
5444
|
let t;
|
|
5445
5445
|
try {
|
|
5446
5446
|
t = JSON.parse(e);
|
|
@@ -5450,19 +5450,19 @@ function ra(e) {
|
|
|
5450
5450
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5451
5451
|
let n = [], r = 0;
|
|
5452
5452
|
for (let e of t) {
|
|
5453
|
-
let t = Array.isArray(e) ?
|
|
5453
|
+
let t = Array.isArray(e) ? ua(e) : la(e);
|
|
5454
5454
|
t ? n.push(t) : r++;
|
|
5455
5455
|
}
|
|
5456
|
-
return
|
|
5456
|
+
return fa(n, t.length, r);
|
|
5457
5457
|
}
|
|
5458
|
-
function
|
|
5458
|
+
function aa(e) {
|
|
5459
5459
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5460
5460
|
if (t.length === 0) return {
|
|
5461
5461
|
data: [],
|
|
5462
5462
|
rowCount: 0,
|
|
5463
5463
|
skipped: 0
|
|
5464
5464
|
};
|
|
5465
|
-
let n =
|
|
5465
|
+
let n = oa(t[0]), r = sa(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? ca(r) : {
|
|
5466
5466
|
time: 0,
|
|
5467
5467
|
open: 1,
|
|
5468
5468
|
high: 2,
|
|
@@ -5473,7 +5473,7 @@ function ia(e) {
|
|
|
5473
5473
|
if (a.time < 0 || a.open < 0 || a.high < 0 || a.low < 0 || a.close < 0) throw Error("CSV is missing required column(s): time, open, high, low, close");
|
|
5474
5474
|
let o = [], s = 0;
|
|
5475
5475
|
for (let e = +!!i; e < t.length; e++) {
|
|
5476
|
-
let r =
|
|
5476
|
+
let r = sa(t[e], n), i = da(r[a.time]), c = Q(r[a.open]), l = Q(r[a.high]), u = Q(r[a.low]), d = Q(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
5477
5477
|
if (i === null || ![
|
|
5478
5478
|
c,
|
|
5479
5479
|
l,
|
|
@@ -5492,9 +5492,9 @@ function ia(e) {
|
|
|
5492
5492
|
volume: Number.isFinite(f) ? f : 0
|
|
5493
5493
|
});
|
|
5494
5494
|
}
|
|
5495
|
-
return
|
|
5495
|
+
return fa(o, t.length - +!!i, s);
|
|
5496
5496
|
}
|
|
5497
|
-
function
|
|
5497
|
+
function oa(e) {
|
|
5498
5498
|
let t = {
|
|
5499
5499
|
",": 0,
|
|
5500
5500
|
";": 0,
|
|
@@ -5506,7 +5506,7 @@ function aa(e) {
|
|
|
5506
5506
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5507
5507
|
return n;
|
|
5508
5508
|
}
|
|
5509
|
-
function
|
|
5509
|
+
function sa(e, t) {
|
|
5510
5510
|
let n = [], r = "", i = !1;
|
|
5511
5511
|
for (let a = 0; a < e.length; a++) {
|
|
5512
5512
|
let o = e[a];
|
|
@@ -5514,25 +5514,25 @@ function oa(e, t) {
|
|
|
5514
5514
|
}
|
|
5515
5515
|
return n.push(r), n;
|
|
5516
5516
|
}
|
|
5517
|
-
function
|
|
5517
|
+
function ca(e) {
|
|
5518
5518
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5519
5519
|
return {
|
|
5520
|
-
time: t(
|
|
5521
|
-
open: t(
|
|
5522
|
-
high: t(
|
|
5523
|
-
low: t(
|
|
5524
|
-
close: t(
|
|
5525
|
-
volume: t(
|
|
5520
|
+
time: t(Zi),
|
|
5521
|
+
open: t(Qi),
|
|
5522
|
+
high: t($i),
|
|
5523
|
+
low: t(ea),
|
|
5524
|
+
close: t(ta),
|
|
5525
|
+
volume: t(na)
|
|
5526
5526
|
};
|
|
5527
5527
|
}
|
|
5528
|
-
function
|
|
5528
|
+
function la(e) {
|
|
5529
5529
|
let t = (t) => {
|
|
5530
5530
|
for (let n of t) {
|
|
5531
5531
|
if (e[n] !== void 0) return e[n];
|
|
5532
5532
|
let t = n.toUpperCase();
|
|
5533
5533
|
if (e[t] !== void 0) return e[t];
|
|
5534
5534
|
}
|
|
5535
|
-
}, n =
|
|
5535
|
+
}, n = da(String(t(Zi) ?? "")), r = Number(t(Qi)), i = Number(t($i)), a = Number(t(ea)), o = Number(t(ta)), s = Number(t(na) ?? 0);
|
|
5536
5536
|
return n === null || ![
|
|
5537
5537
|
r,
|
|
5538
5538
|
i,
|
|
@@ -5547,9 +5547,9 @@ function ca(e) {
|
|
|
5547
5547
|
volume: Number.isFinite(s) ? s : 0
|
|
5548
5548
|
};
|
|
5549
5549
|
}
|
|
5550
|
-
function
|
|
5550
|
+
function ua(e) {
|
|
5551
5551
|
if (e.length < 5) return null;
|
|
5552
|
-
let t =
|
|
5552
|
+
let t = da(String(e[0])), n = Number(e[1]), r = Number(e[2]), i = Number(e[3]), a = Number(e[4]), o = e.length >= 6 ? Number(e[5]) : 0;
|
|
5553
5553
|
return t === null || ![
|
|
5554
5554
|
n,
|
|
5555
5555
|
r,
|
|
@@ -5564,10 +5564,10 @@ function la(e) {
|
|
|
5564
5564
|
volume: Number.isFinite(o) ? o : 0
|
|
5565
5565
|
};
|
|
5566
5566
|
}
|
|
5567
|
-
function
|
|
5567
|
+
function Q(e) {
|
|
5568
5568
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5569
5569
|
}
|
|
5570
|
-
function
|
|
5570
|
+
function da(e) {
|
|
5571
5571
|
let t = e.trim();
|
|
5572
5572
|
if (!t) return null;
|
|
5573
5573
|
let n = Number(t);
|
|
@@ -5575,7 +5575,7 @@ function ua(e) {
|
|
|
5575
5575
|
let r = Date.parse(t);
|
|
5576
5576
|
return Number.isFinite(r) ? r : null;
|
|
5577
5577
|
}
|
|
5578
|
-
function
|
|
5578
|
+
function fa(e, t, n) {
|
|
5579
5579
|
e.sort((e, t) => e.time - t.time);
|
|
5580
5580
|
let r = [];
|
|
5581
5581
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5587,7 +5587,7 @@ function da(e, t, n) {
|
|
|
5587
5587
|
}
|
|
5588
5588
|
//#endregion
|
|
5589
5589
|
//#region src/io/DragDropImporter.ts
|
|
5590
|
-
var
|
|
5590
|
+
var pa = class {
|
|
5591
5591
|
host;
|
|
5592
5592
|
overlay = null;
|
|
5593
5593
|
callbacks;
|
|
@@ -5608,19 +5608,19 @@ var fa = class {
|
|
|
5608
5608
|
this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
|
|
5609
5609
|
}
|
|
5610
5610
|
onDragEnter(e) {
|
|
5611
|
-
|
|
5611
|
+
ma(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5612
5612
|
}
|
|
5613
5613
|
onDragOver(e) {
|
|
5614
|
-
|
|
5614
|
+
ma(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5615
5615
|
}
|
|
5616
5616
|
onDragLeave(e) {
|
|
5617
|
-
|
|
5617
|
+
ma(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5618
5618
|
}
|
|
5619
5619
|
async onDrop(e) {
|
|
5620
5620
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5621
5621
|
let t = e.dataTransfer?.files?.[0];
|
|
5622
5622
|
if (t) try {
|
|
5623
|
-
let e =
|
|
5623
|
+
let e = ra(await t.text());
|
|
5624
5624
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5625
5625
|
this.callbacks.onData(e.data, e, t);
|
|
5626
5626
|
} catch (e) {
|
|
@@ -5651,12 +5651,250 @@ var fa = class {
|
|
|
5651
5651
|
this.overlay?.remove(), this.overlay = null;
|
|
5652
5652
|
}
|
|
5653
5653
|
};
|
|
5654
|
-
function
|
|
5654
|
+
function ma(e) {
|
|
5655
5655
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5656
5656
|
}
|
|
5657
5657
|
//#endregion
|
|
5658
|
+
//#region src/grid/gridShapes.ts
|
|
5659
|
+
var ha = {
|
|
5660
|
+
"1x1": {
|
|
5661
|
+
cols: 1,
|
|
5662
|
+
rows: 1
|
|
5663
|
+
},
|
|
5664
|
+
"1x2": {
|
|
5665
|
+
cols: 2,
|
|
5666
|
+
rows: 1
|
|
5667
|
+
},
|
|
5668
|
+
"2x1": {
|
|
5669
|
+
cols: 1,
|
|
5670
|
+
rows: 2
|
|
5671
|
+
},
|
|
5672
|
+
"1x3": {
|
|
5673
|
+
cols: 3,
|
|
5674
|
+
rows: 1
|
|
5675
|
+
},
|
|
5676
|
+
"3x1": {
|
|
5677
|
+
cols: 1,
|
|
5678
|
+
rows: 3
|
|
5679
|
+
},
|
|
5680
|
+
"1+2": {
|
|
5681
|
+
cols: 2,
|
|
5682
|
+
rows: 2,
|
|
5683
|
+
areas: [
|
|
5684
|
+
[
|
|
5685
|
+
0,
|
|
5686
|
+
0,
|
|
5687
|
+
1,
|
|
5688
|
+
2
|
|
5689
|
+
],
|
|
5690
|
+
[
|
|
5691
|
+
1,
|
|
5692
|
+
0,
|
|
5693
|
+
1,
|
|
5694
|
+
1
|
|
5695
|
+
],
|
|
5696
|
+
[
|
|
5697
|
+
1,
|
|
5698
|
+
1,
|
|
5699
|
+
1,
|
|
5700
|
+
1
|
|
5701
|
+
]
|
|
5702
|
+
]
|
|
5703
|
+
},
|
|
5704
|
+
"2+1": {
|
|
5705
|
+
cols: 2,
|
|
5706
|
+
rows: 2,
|
|
5707
|
+
areas: [
|
|
5708
|
+
[
|
|
5709
|
+
0,
|
|
5710
|
+
0,
|
|
5711
|
+
1,
|
|
5712
|
+
1
|
|
5713
|
+
],
|
|
5714
|
+
[
|
|
5715
|
+
0,
|
|
5716
|
+
1,
|
|
5717
|
+
1,
|
|
5718
|
+
1
|
|
5719
|
+
],
|
|
5720
|
+
[
|
|
5721
|
+
1,
|
|
5722
|
+
0,
|
|
5723
|
+
1,
|
|
5724
|
+
2
|
|
5725
|
+
]
|
|
5726
|
+
]
|
|
5727
|
+
},
|
|
5728
|
+
"1/2": {
|
|
5729
|
+
cols: 2,
|
|
5730
|
+
rows: 2,
|
|
5731
|
+
areas: [
|
|
5732
|
+
[
|
|
5733
|
+
0,
|
|
5734
|
+
0,
|
|
5735
|
+
2,
|
|
5736
|
+
1
|
|
5737
|
+
],
|
|
5738
|
+
[
|
|
5739
|
+
0,
|
|
5740
|
+
1,
|
|
5741
|
+
1,
|
|
5742
|
+
1
|
|
5743
|
+
],
|
|
5744
|
+
[
|
|
5745
|
+
1,
|
|
5746
|
+
1,
|
|
5747
|
+
1,
|
|
5748
|
+
1
|
|
5749
|
+
]
|
|
5750
|
+
]
|
|
5751
|
+
},
|
|
5752
|
+
"2/1": {
|
|
5753
|
+
cols: 2,
|
|
5754
|
+
rows: 2,
|
|
5755
|
+
areas: [
|
|
5756
|
+
[
|
|
5757
|
+
0,
|
|
5758
|
+
0,
|
|
5759
|
+
1,
|
|
5760
|
+
1
|
|
5761
|
+
],
|
|
5762
|
+
[
|
|
5763
|
+
1,
|
|
5764
|
+
0,
|
|
5765
|
+
1,
|
|
5766
|
+
1
|
|
5767
|
+
],
|
|
5768
|
+
[
|
|
5769
|
+
0,
|
|
5770
|
+
1,
|
|
5771
|
+
2,
|
|
5772
|
+
1
|
|
5773
|
+
]
|
|
5774
|
+
]
|
|
5775
|
+
},
|
|
5776
|
+
"2x2": {
|
|
5777
|
+
cols: 2,
|
|
5778
|
+
rows: 2
|
|
5779
|
+
},
|
|
5780
|
+
"1x4": {
|
|
5781
|
+
cols: 4,
|
|
5782
|
+
rows: 1
|
|
5783
|
+
},
|
|
5784
|
+
"4x1": {
|
|
5785
|
+
cols: 1,
|
|
5786
|
+
rows: 4
|
|
5787
|
+
},
|
|
5788
|
+
"1+3": {
|
|
5789
|
+
cols: 2,
|
|
5790
|
+
rows: 3,
|
|
5791
|
+
areas: [
|
|
5792
|
+
[
|
|
5793
|
+
0,
|
|
5794
|
+
0,
|
|
5795
|
+
1,
|
|
5796
|
+
3
|
|
5797
|
+
],
|
|
5798
|
+
[
|
|
5799
|
+
1,
|
|
5800
|
+
0,
|
|
5801
|
+
1,
|
|
5802
|
+
1
|
|
5803
|
+
],
|
|
5804
|
+
[
|
|
5805
|
+
1,
|
|
5806
|
+
1,
|
|
5807
|
+
1,
|
|
5808
|
+
1
|
|
5809
|
+
],
|
|
5810
|
+
[
|
|
5811
|
+
1,
|
|
5812
|
+
2,
|
|
5813
|
+
1,
|
|
5814
|
+
1
|
|
5815
|
+
]
|
|
5816
|
+
]
|
|
5817
|
+
},
|
|
5818
|
+
"1/3": {
|
|
5819
|
+
cols: 3,
|
|
5820
|
+
rows: 2,
|
|
5821
|
+
areas: [
|
|
5822
|
+
[
|
|
5823
|
+
0,
|
|
5824
|
+
0,
|
|
5825
|
+
3,
|
|
5826
|
+
1
|
|
5827
|
+
],
|
|
5828
|
+
[
|
|
5829
|
+
0,
|
|
5830
|
+
1,
|
|
5831
|
+
1,
|
|
5832
|
+
1
|
|
5833
|
+
],
|
|
5834
|
+
[
|
|
5835
|
+
1,
|
|
5836
|
+
1,
|
|
5837
|
+
1,
|
|
5838
|
+
1
|
|
5839
|
+
],
|
|
5840
|
+
[
|
|
5841
|
+
2,
|
|
5842
|
+
1,
|
|
5843
|
+
1,
|
|
5844
|
+
1
|
|
5845
|
+
]
|
|
5846
|
+
]
|
|
5847
|
+
},
|
|
5848
|
+
"2x3": {
|
|
5849
|
+
cols: 3,
|
|
5850
|
+
rows: 2
|
|
5851
|
+
},
|
|
5852
|
+
"3x2": {
|
|
5853
|
+
cols: 2,
|
|
5854
|
+
rows: 3
|
|
5855
|
+
},
|
|
5856
|
+
"2x4": {
|
|
5857
|
+
cols: 4,
|
|
5858
|
+
rows: 2
|
|
5859
|
+
},
|
|
5860
|
+
"3x3": {
|
|
5861
|
+
cols: 3,
|
|
5862
|
+
rows: 3
|
|
5863
|
+
}
|
|
5864
|
+
}, ga = Object.keys(ha);
|
|
5865
|
+
function _a(e) {
|
|
5866
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(ha, e);
|
|
5867
|
+
}
|
|
5868
|
+
function va(e) {
|
|
5869
|
+
if (e.areas) return e.areas;
|
|
5870
|
+
let t = [];
|
|
5871
|
+
for (let n = 0; n < e.rows; n++) for (let r = 0; r < e.cols; r++) t.push([
|
|
5872
|
+
r,
|
|
5873
|
+
n,
|
|
5874
|
+
1,
|
|
5875
|
+
1
|
|
5876
|
+
]);
|
|
5877
|
+
return t;
|
|
5878
|
+
}
|
|
5879
|
+
function ya(e) {
|
|
5880
|
+
return e.areas?.length ?? e.cols * e.rows;
|
|
5881
|
+
}
|
|
5882
|
+
function ba([e, t, n, r]) {
|
|
5883
|
+
return `${t + 1} / ${e + 1} / span ${r} / span ${n}`;
|
|
5884
|
+
}
|
|
5885
|
+
function xa(e, t) {
|
|
5886
|
+
e.style.gridArea = t ? ba(t) : "";
|
|
5887
|
+
}
|
|
5888
|
+
function Sa(e) {
|
|
5889
|
+
if (!e.areas) return null;
|
|
5890
|
+
let t = e.areas.find(([, , e, t]) => e * t > 1);
|
|
5891
|
+
if (!t) return null;
|
|
5892
|
+
let [n, r, i, a] = t;
|
|
5893
|
+
return a === e.rows && i < e.cols ? n === 0 ? "left" : "right" : r === 0 ? "top" : "bottom";
|
|
5894
|
+
}
|
|
5895
|
+
//#endregion
|
|
5658
5896
|
//#region src/state/layoutStorage.ts
|
|
5659
|
-
function
|
|
5897
|
+
function Ca(e) {
|
|
5660
5898
|
let t = {
|
|
5661
5899
|
id: e.id,
|
|
5662
5900
|
name: e.name,
|
|
@@ -5664,11 +5902,11 @@ function ma(e) {
|
|
|
5664
5902
|
};
|
|
5665
5903
|
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;
|
|
5666
5904
|
}
|
|
5667
|
-
var
|
|
5668
|
-
function
|
|
5905
|
+
var wa = (e, t) => t.updatedAt - e.updatedAt;
|
|
5906
|
+
function Ta(e) {
|
|
5669
5907
|
if (typeof e != "object" || !e) return null;
|
|
5670
5908
|
let t = e;
|
|
5671
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
5909
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Ca({
|
|
5672
5910
|
id: t.id,
|
|
5673
5911
|
name: t.name,
|
|
5674
5912
|
updatedAt: t.updatedAt,
|
|
@@ -5677,17 +5915,17 @@ function ga(e) {
|
|
|
5677
5915
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
5678
5916
|
});
|
|
5679
5917
|
}
|
|
5680
|
-
function
|
|
5681
|
-
let t =
|
|
5918
|
+
function Ea(e) {
|
|
5919
|
+
let t = Ta(e), n = t ? e.content : void 0;
|
|
5682
5920
|
return t && typeof n == "string" ? {
|
|
5683
5921
|
...t,
|
|
5684
5922
|
content: n
|
|
5685
5923
|
} : null;
|
|
5686
5924
|
}
|
|
5687
|
-
function
|
|
5925
|
+
function Da(e = []) {
|
|
5688
5926
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
5689
5927
|
return {
|
|
5690
|
-
list: () => [...t.values()].map(
|
|
5928
|
+
list: () => [...t.values()].map(Ca).sort(wa),
|
|
5691
5929
|
load: (e) => {
|
|
5692
5930
|
let n = t.get(e);
|
|
5693
5931
|
return n ? { ...n } : null;
|
|
@@ -5700,7 +5938,7 @@ function va(e = []) {
|
|
|
5700
5938
|
}
|
|
5701
5939
|
};
|
|
5702
5940
|
}
|
|
5703
|
-
function
|
|
5941
|
+
function Oa(e = "tcw:layouts:") {
|
|
5704
5942
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
5705
5943
|
let e;
|
|
5706
5944
|
try {
|
|
@@ -5708,10 +5946,10 @@ function ya(e = "tcw:layouts:") {
|
|
|
5708
5946
|
} catch {
|
|
5709
5947
|
return [];
|
|
5710
5948
|
}
|
|
5711
|
-
return Array.isArray(e) ? e.map(
|
|
5949
|
+
return Array.isArray(e) ? e.map(Ta).filter((e) => e !== null) : [];
|
|
5712
5950
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
5713
5951
|
return {
|
|
5714
|
-
list: () => r().sort(
|
|
5952
|
+
list: () => r().sort(wa),
|
|
5715
5953
|
load: (e) => {
|
|
5716
5954
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
5717
5955
|
return t && i !== null ? {
|
|
@@ -5720,7 +5958,7 @@ function ya(e = "tcw:layouts:") {
|
|
|
5720
5958
|
} : null;
|
|
5721
5959
|
},
|
|
5722
5960
|
save: (e) => {
|
|
5723
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
5961
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Ca(e)]);
|
|
5724
5962
|
},
|
|
5725
5963
|
remove: (e) => {
|
|
5726
5964
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -5729,14 +5967,14 @@ function ya(e = "tcw:layouts:") {
|
|
|
5729
5967
|
}
|
|
5730
5968
|
//#endregion
|
|
5731
5969
|
//#region src/state/LayoutSession.ts
|
|
5732
|
-
var
|
|
5733
|
-
function
|
|
5970
|
+
var ka = 80;
|
|
5971
|
+
function $(e) {
|
|
5734
5972
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
5735
5973
|
}
|
|
5736
|
-
function
|
|
5974
|
+
function Aa() {
|
|
5737
5975
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
5738
5976
|
}
|
|
5739
|
-
function
|
|
5977
|
+
function ja(e) {
|
|
5740
5978
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
5741
5979
|
return {
|
|
5742
5980
|
id: t,
|
|
@@ -5747,7 +5985,7 @@ function Ca(e) {
|
|
|
5747
5985
|
...o === void 0 ? {} : { kind: o }
|
|
5748
5986
|
};
|
|
5749
5987
|
}
|
|
5750
|
-
var
|
|
5988
|
+
var Ma = class {
|
|
5751
5989
|
currentLayout = null;
|
|
5752
5990
|
savedContent = null;
|
|
5753
5991
|
dirty = !1;
|
|
@@ -5763,7 +6001,7 @@ var wa = class {
|
|
|
5763
6001
|
now;
|
|
5764
6002
|
newId;
|
|
5765
6003
|
constructor(e, t, n = {}) {
|
|
5766
|
-
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 ??
|
|
6004
|
+
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ?? Aa;
|
|
5767
6005
|
}
|
|
5768
6006
|
current() {
|
|
5769
6007
|
return this.currentLayout;
|
|
@@ -5779,7 +6017,7 @@ var wa = class {
|
|
|
5779
6017
|
}
|
|
5780
6018
|
async list() {
|
|
5781
6019
|
let e = await this.storage.list();
|
|
5782
|
-
return Array.isArray(e) ? e.map(
|
|
6020
|
+
return Array.isArray(e) ? e.map(Ta).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
5783
6021
|
}
|
|
5784
6022
|
save() {
|
|
5785
6023
|
return this.queue(() => {
|
|
@@ -5788,12 +6026,12 @@ var wa = class {
|
|
|
5788
6026
|
});
|
|
5789
6027
|
}
|
|
5790
6028
|
saveAs(e) {
|
|
5791
|
-
let t =
|
|
6029
|
+
let t = $(e);
|
|
5792
6030
|
return t ? this.queue(() => this.write(this.newId(), t)) : Promise.reject(/* @__PURE__ */ Error("A layout needs a name"));
|
|
5793
6031
|
}
|
|
5794
6032
|
open(e) {
|
|
5795
6033
|
return this.queue(async () => {
|
|
5796
|
-
let t =
|
|
6034
|
+
let t = Ea(await this.storage.load(e));
|
|
5797
6035
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
5798
6036
|
this.cancelTimer(), this.applying++;
|
|
5799
6037
|
try {
|
|
@@ -5803,13 +6041,13 @@ var wa = class {
|
|
|
5803
6041
|
} finally {
|
|
5804
6042
|
this.applying--;
|
|
5805
6043
|
}
|
|
5806
|
-
return this.cancelTimer(), this.currentLayout =
|
|
6044
|
+
return this.cancelTimer(), this.currentLayout = ja(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
5807
6045
|
});
|
|
5808
6046
|
}
|
|
5809
6047
|
rename(e, t) {
|
|
5810
|
-
let n =
|
|
6048
|
+
let n = $(t);
|
|
5811
6049
|
return n ? this.queue(async () => {
|
|
5812
|
-
let t =
|
|
6050
|
+
let t = Ea(await this.storage.load(e));
|
|
5813
6051
|
!t || t.id !== e || (await this.storage.save({
|
|
5814
6052
|
...t,
|
|
5815
6053
|
name: n
|
|
@@ -5887,7 +6125,7 @@ var wa = class {
|
|
|
5887
6125
|
content: n.content
|
|
5888
6126
|
};
|
|
5889
6127
|
await this.storage.save(r);
|
|
5890
|
-
let i =
|
|
6128
|
+
let i = ja(r);
|
|
5891
6129
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
5892
6130
|
}
|
|
5893
6131
|
forget() {
|
|
@@ -5908,6 +6146,6 @@ var wa = class {
|
|
|
5908
6146
|
}
|
|
5909
6147
|
};
|
|
5910
6148
|
//#endregion
|
|
5911
|
-
export {
|
|
6149
|
+
export { fr as A, Mr as C, q as D, jr as E, H as M, z as N, br as O, V as P, Pr as S, Ar as T, _i as _, Da as a, Ir as b, va as c, _a as d, xa as f, vi as g, Oi as h, Oa as i, ur as j, hr as k, ya as l, ra as m, ka as n, ga as o, pa as p, $ as r, ha as s, Ma as t, Sa as u, ni as v, Nr as w, Fr as x, ri as y };
|
|
5912
6150
|
|
|
5913
|
-
//# sourceMappingURL=LayoutSession
|
|
6151
|
+
//# sourceMappingURL=LayoutSession--k_77YkA.js.map
|