@tradecanvas/chart 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +90 -1070
  2. package/dist/Chart.d.ts +16 -5
  3. package/dist/Chart.d.ts.map +1 -1
  4. package/dist/LayoutSession-6FNgfBby.cjs +2 -0
  5. package/dist/LayoutSession-6FNgfBby.cjs.map +1 -0
  6. package/dist/{LayoutSession-Bwz14MjP.js → LayoutSession-DepARyHT.js} +306 -292
  7. package/dist/LayoutSession-DepARyHT.js.map +1 -0
  8. package/dist/i18n-CIHfGH-4.cjs +2 -0
  9. package/dist/i18n-CIHfGH-4.cjs.map +1 -0
  10. package/dist/{i18n-BH0McEvQ.js → i18n-fBzhlejv.js} +7 -1
  11. package/dist/i18n-fBzhlejv.js.map +1 -0
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +49 -49
  16. package/dist/index.js.map +1 -1
  17. package/dist/widget/ChartWidget.d.ts +2 -0
  18. package/dist/widget/ChartWidget.d.ts.map +1 -1
  19. package/dist/widget/WidgetOrderTicket.d.ts +5 -0
  20. package/dist/widget/WidgetOrderTicket.d.ts.map +1 -1
  21. package/dist/widget/index.cjs +14 -14
  22. package/dist/widget/index.cjs.map +1 -1
  23. package/dist/widget/index.js +305 -280
  24. package/dist/widget/index.js.map +1 -1
  25. package/dist/widget/locales/ar.d.ts.map +1 -1
  26. package/dist/widget/locales/cs.d.ts.map +1 -1
  27. package/dist/widget/locales/da.d.ts.map +1 -1
  28. package/dist/widget/locales/de.d.ts.map +1 -1
  29. package/dist/widget/locales/el.d.ts.map +1 -1
  30. package/dist/widget/locales/en.d.ts +3 -0
  31. package/dist/widget/locales/en.d.ts.map +1 -1
  32. package/dist/widget/locales/es.d.ts.map +1 -1
  33. package/dist/widget/locales/et.d.ts.map +1 -1
  34. package/dist/widget/locales/fa.d.ts.map +1 -1
  35. package/dist/widget/locales/fr.d.ts.map +1 -1
  36. package/dist/widget/locales/he.d.ts.map +1 -1
  37. package/dist/widget/locales/hu.d.ts.map +1 -1
  38. package/dist/widget/locales/id.d.ts.map +1 -1
  39. package/dist/widget/locales/index.cjs +1 -1
  40. package/dist/widget/locales/index.cjs.map +1 -1
  41. package/dist/widget/locales/index.js +85 -1
  42. package/dist/widget/locales/index.js.map +1 -1
  43. package/dist/widget/locales/it.d.ts.map +1 -1
  44. package/dist/widget/locales/ja.d.ts.map +1 -1
  45. package/dist/widget/locales/ko.d.ts.map +1 -1
  46. package/dist/widget/locales/ms.d.ts.map +1 -1
  47. package/dist/widget/locales/nb.d.ts.map +1 -1
  48. package/dist/widget/locales/nl.d.ts.map +1 -1
  49. package/dist/widget/locales/pl.d.ts.map +1 -1
  50. package/dist/widget/locales/pt.d.ts.map +1 -1
  51. package/dist/widget/locales/ro.d.ts.map +1 -1
  52. package/dist/widget/locales/ru.d.ts.map +1 -1
  53. package/dist/widget/locales/sk.d.ts.map +1 -1
  54. package/dist/widget/locales/sv.d.ts.map +1 -1
  55. package/dist/widget/locales/th.d.ts.map +1 -1
  56. package/dist/widget/locales/tr.d.ts.map +1 -1
  57. package/dist/widget/locales/vi.d.ts.map +1 -1
  58. package/dist/widget/locales/zh.d.ts.map +1 -1
  59. package/dist/widget/locales/zhHant.d.ts.map +1 -1
  60. package/dist/widget/orderTicket.d.ts +19 -2
  61. package/dist/widget/orderTicket.d.ts.map +1 -1
  62. package/package.json +7 -3
  63. package/dist/LayoutSession-Bwz14MjP.js.map +0 -1
  64. package/dist/LayoutSession-C3NIrkK8.cjs +0 -2
  65. package/dist/LayoutSession-C3NIrkK8.cjs.map +0 -1
  66. package/dist/i18n-BH0McEvQ.js.map +0 -1
  67. package/dist/i18n-D0C88QUR.cjs +0 -2
  68. package/dist/i18n-D0C88QUR.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
- import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PRICE_AXIS_WIDTH as a, TIME_AXIS_HEIGHT as o, autoPricePrecision as s, chartStyleValue as c, computePriceLimits as l, formatPrice as u, fractionTick as d, indicatorSource as f, isValidTimeZone as p, mergeBar as m, normalizeBarTime as h, parseIndicatorSource as g, priceFormatterFor as _, readChartStyleOverrides as v, readChartTypeOptions as y, readIndicatorPlotStyles as ee, readPaneStyle as te, resolveChartTheme as ne, sessionMinute as b, setLocale as re, stepDecimals as ie, tickBarCount as ae, timeframeToMs as x, volumeColor as S, zonedDateFormatter as oe } from "@tradecanvas/commons";
2
- import { AlertDragHandler as se, AlertManager as ce, Animator as le, AreaRenderer as ue, AxisDragHandler as de, BarCountdown as fe, BarRenderer as pe, BaselineRenderer as me, CandlestickRenderer as he, ChartLegend as ge, ChartStateManager as C, CompareRenderer as _e, CompareSymbolIndicator as ve, CorrelationCoefficientIndicator as ye, CorrelationLogIndicator as be, CrosshairHandler as xe, CrosshairTooltip as Se, CurrentPriceLine as Ce, DEFAULT_SESSION_HOURS as we, DataExporter as w, DepthHeatmapRenderer as Te, DrawingManager as Ee, DrawingRenderer as De, EquivolumeRenderer as Oe, EventBus as ke, GridRenderer as Ae, HLCAreaRenderer as je, HiLoRenderer as Me, HollowCandleRenderer as Ne, IndicatorEngine as Pe, InteractionManager as Fe, KagiRenderer as Ie, KeyboardHandler as Le, LineRenderer as Re, LineWithMarkersRenderer as ze, MarketProfileRenderer as Be, MeasureOverlay as Ve, PanHandler as He, PaneResizeHandler as Ue, PeriodLevelsRenderer as We, PinnedTooltip as Ge, PivotMarkersRenderer as Ke, PointAndFigureRenderer as T, PriceAxis as qe, PriceAxisAddButton as Je, PriceLines as Ye, RenderEngine as Xe, RenkoRenderer as Ze, ReplayManager as Qe, Screenshot as E, SelectionBoxOverlay as $e, SessionBreaks as et, SessionShading as tt, SignalMarkerManager as nt, SpreadIndicator as rt, StepLineRenderer as it, StreamManager as at, SymbolSeriesStore as ot, TimeAxis as st, TradeZoneManager as ct, TradingManager as lt, TradingRenderer as ut, UndoRedoManager as dt, Viewport as ft, VolumeCandleRenderer as pt, VolumeProfileRenderer as mt, VolumeRenderer as ht, Watermark as gt, ZoomHandler as _t, barTimeStepMs as vt, findDominantSwing as yt, gpuContextsLeft as bt, isRegularSession as xt, loadWebGL as St, mergeSessionHours as Ct, rangePresetStart as wt, readAlertOptions as Tt, registerBuiltInDrawingTools as Et, registerBuiltInIndicators as Dt, servesTimeframe as Ot, sourceParam as D, timestampToBarIndex as O, toHeikinAshi as kt, toKagi as At, toLineBreak as jt, toPointAndFigure as Mt, toRangeBars as Nt, toRenko as k, whenGpuContextFree as Pt, withResampling as Ft, xToBarIndex as It, xToTime as A, yToPrice as Lt } from "@tradecanvas/core";
1
+ import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PRICE_AXIS_WIDTH as a, TIME_AXIS_HEIGHT as o, autoPricePrecision as s, chartStyleValue as c, computePriceLimits as l, formatPrice as u, fractionTick as d, indicatorSource as f, isValidTimeZone as p, mergeBar as m, normalizeBarTime as h, parseIndicatorSource as g, priceFormatterFor as _, priceStepAt as v, readChartStyleOverrides as ee, readChartTypeOptions as y, readIndicatorPlotStyles as te, readPaneStyle as ne, resolveChartTheme as re, sessionMinute as b, setLocale as ie, stepDecimals as ae, tickBarCount as oe, timeframeToMs as se, volumeColor as ce, zonedDateFormatter as le } from "@tradecanvas/commons";
2
+ import { AlertDragHandler as ue, AlertManager as de, Animator as fe, AreaRenderer as pe, AxisDragHandler as me, BarCountdown as he, BarRenderer as ge, BaselineRenderer as _e, CandlestickRenderer as x, ChartLegend as ve, ChartStateManager as S, CompareRenderer as ye, CompareSymbolIndicator as be, CorrelationCoefficientIndicator as xe, CorrelationLogIndicator as Se, CrosshairHandler as Ce, CrosshairTooltip as we, CurrentPriceLine as Te, DEFAULT_SESSION_HOURS as Ee, DataExporter as C, DepthHeatmapRenderer as De, DrawingManager as Oe, DrawingRenderer as ke, EquivolumeRenderer as Ae, EventBus as je, GridRenderer as Me, HLCAreaRenderer as Ne, HiLoRenderer as Pe, HollowCandleRenderer as Fe, IndicatorEngine as Ie, InteractionManager as Le, KagiRenderer as Re, KeyboardHandler as ze, LineRenderer as Be, LineWithMarkersRenderer as Ve, MarketProfileRenderer as He, MeasureOverlay as Ue, PanHandler as We, PaneResizeHandler as Ge, PeriodLevelsRenderer as Ke, PinnedTooltip as qe, PivotMarkersRenderer as Je, PointAndFigureRenderer as Ye, PriceAxis as w, PriceAxisAddButton as Xe, PriceLines as Ze, RenderEngine as Qe, RenkoRenderer as $e, ReplayManager as et, Screenshot as T, SelectionBoxOverlay as tt, SessionBreaks as nt, SessionShading as rt, SignalMarkerManager as it, SpreadIndicator as at, StepLineRenderer as ot, StreamManager as st, SymbolSeriesStore as ct, TimeAxis as lt, TradeZoneManager as ut, TradingManager as dt, TradingRenderer as ft, UndoRedoManager as pt, Viewport as mt, VolumeCandleRenderer as ht, VolumeProfileRenderer as gt, VolumeRenderer as _t, Watermark as vt, ZoomHandler as yt, barTimeStepMs as bt, findDominantSwing as xt, gpuContextsLeft as St, isRegularSession as Ct, loadWebGL as wt, mergeSessionHours as Tt, rangePresetStart as Et, readAlertOptions as Dt, registerBuiltInDrawingTools as Ot, registerBuiltInIndicators as E, servesTimeframe as kt, sourceParam as D, timestampToBarIndex as O, toHeikinAshi as At, toKagi as jt, toLineBreak as Mt, toPointAndFigure as Nt, toRangeBars as Pt, toRenko as Ft, whenGpuContextFree as It, withResampling as Lt, xToBarIndex as Rt, xToTime as k, yToPrice as zt } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
- var Rt = 864e5, zt = 10;
5
- function Bt(e, t) {
4
+ var Bt = 864e5, Vt = 10;
5
+ function Ht(e, t) {
6
6
  let n = e?.timezone;
7
7
  if (!n || !p(n) || t.length < 2) return null;
8
8
  let r = (e?.sessions ?? []).flatMap((e) => {
@@ -14,34 +14,34 @@ function Bt(e, t) {
14
14
  });
15
15
  if (r.length === 0) return null;
16
16
  let i = Infinity;
17
- for (let e = Math.max(1, t.length - zt); e < t.length; e++) {
17
+ for (let e = Math.max(1, t.length - Vt); e < t.length; e++) {
18
18
  let n = h(t[e].time) - h(t[e - 1].time);
19
19
  n > 0 && n < i && (i = n);
20
20
  }
21
- if (!(i < Rt)) return null;
21
+ if (!(i < Bt)) return null;
22
22
  let a = {
23
23
  timeZone: n,
24
24
  windows: r,
25
25
  startMinute: r[0].startMinute,
26
26
  endMinute: r[r.length - 1].endMinute
27
27
  };
28
- return (e) => xt(h(e), a);
28
+ return (e) => Ct(h(e), a);
29
29
  }
30
30
  //#endregion
31
31
  //#region src/chartA11y.ts
32
- var Vt = {
32
+ var Ut = {
33
33
  role: "chart",
34
34
  summary: "{what}. Last price {close}.",
35
35
  empty: "Chart, no data.",
36
36
  view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
37
37
  bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
38
38
  keys: "Arrow keys scroll and zoom, Home and End go to the start and the end. Comma and period read the bars one at a time."
39
- }, j = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Ht = [
39
+ }, A = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Wt = [
40
40
  "role",
41
41
  "aria-roledescription",
42
42
  "aria-label",
43
43
  "aria-describedby"
44
- ], Ut = 400, Wt = 1e3, Gt = class {
44
+ ], Gt = 400, Kt = 1e3, qt = class {
45
45
  live;
46
46
  help;
47
47
  labels;
@@ -55,20 +55,20 @@ var Vt = {
55
55
  };
56
56
  constructor(e, t, n = {}) {
57
57
  this.container = e, this.source = t, this.labels = {
58
- ...Vt,
58
+ ...Ut,
59
59
  ...n
60
60
  };
61
- for (let t of Ht) this.before.set(t, e.getAttribute(t));
62
- e.setAttribute("role", "application"), this.help = Kt("div", "tc-sr-only"), this.help.id = `tc-chart-keys-${Math.random().toString(36).slice(2, 10)}`, e.setAttribute("aria-describedby", this.help.id), this.live = Kt("div", "tc-sr-only tc-sr-live"), this.live.setAttribute("aria-live", "polite"), this.live.setAttribute("aria-atomic", "true"), e.append(this.help, this.live), e.addEventListener("blur", this.onBlur), this.applyLabels();
61
+ for (let t of Wt) this.before.set(t, e.getAttribute(t));
62
+ e.setAttribute("role", "application"), this.help = Jt("div", "tc-sr-only"), this.help.id = `tc-chart-keys-${Math.random().toString(36).slice(2, 10)}`, e.setAttribute("aria-describedby", this.help.id), this.live = Jt("div", "tc-sr-only tc-sr-live"), this.live.setAttribute("aria-live", "polite"), this.live.setAttribute("aria-atomic", "true"), e.append(this.help, this.live), e.addEventListener("blur", this.onBlur), this.applyLabels();
63
63
  }
64
64
  setLabels(e) {
65
65
  this.labels = {
66
- ...Vt,
66
+ ...Ut,
67
67
  ...e
68
68
  }, this.applyLabels();
69
69
  }
70
70
  refresh(e = !1) {
71
- let t = Wt - (Date.now() - this.summaryAt);
71
+ let t = Kt - (Date.now() - this.summaryAt);
72
72
  if (e || t <= 0 || this.container.getAttribute("aria-label") === this.labels.empty) {
73
73
  this.summaryTimer && clearTimeout(this.summaryTimer), this.summaryTimer = null, this.summaryAt = Date.now(), this.container.setAttribute("aria-label", this.summary());
74
74
  return;
@@ -80,7 +80,7 @@ var Vt = {
80
80
  viewMoved() {
81
81
  this.cursor = null, this.viewTimer && clearTimeout(this.viewTimer), this.viewTimer = setTimeout(() => {
82
82
  this.viewTimer = null, this.say(this.viewText());
83
- }, Ut);
83
+ }, Gt);
84
84
  }
85
85
  readBar(e) {
86
86
  let t = this.source.bars();
@@ -93,13 +93,13 @@ var Vt = {
93
93
  let i = t[this.cursor];
94
94
  this.source.showBar(i.time);
95
95
  let a = this.source.formatPrice;
96
- this.say(j(this.labels.bar, {
96
+ this.say(A(this.labels.bar, {
97
97
  time: this.source.formatTime(i.time),
98
98
  open: a(i.open),
99
99
  high: a(i.high),
100
100
  low: a(i.low),
101
101
  close: a(i.close),
102
- volume: qt(i.volume ?? 0)
102
+ volume: Yt(i.volume ?? 0)
103
103
  }));
104
104
  }
105
105
  destroy() {
@@ -118,7 +118,7 @@ var Vt = {
118
118
  this.labels.typeName ? this.labels.typeName(t) : t,
119
119
  this.source.timeframe()
120
120
  ].filter(Boolean).join(", ");
121
- return j(this.labels.summary, {
121
+ return A(this.labels.summary, {
122
122
  what: n,
123
123
  close: this.source.formatPrice(e[e.length - 1].close)
124
124
  });
@@ -128,7 +128,7 @@ var Vt = {
128
128
  if (e.length === 0) return this.labels.empty;
129
129
  let t = this.source.visibleRange(), n = Math.max(0, Math.min(e.length - 1, Math.ceil(t.from))), r = Math.max(n, Math.min(e.length - 1, Math.floor(t.to))), i = -Infinity, a = Infinity;
130
130
  for (let t = n; t <= r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
131
- return j(this.labels.view, {
131
+ return A(this.labels.view, {
132
132
  count: r - n + 1,
133
133
  from: this.source.formatTime(e[n].time),
134
134
  to: this.source.formatTime(e[r].time),
@@ -140,7 +140,7 @@ var Vt = {
140
140
  this.live.textContent = e;
141
141
  }
142
142
  };
143
- function Kt(e, t) {
143
+ function Jt(e, t) {
144
144
  let n = document.createElement(e);
145
145
  return n.className = t, Object.assign(n.style, {
146
146
  position: "absolute",
@@ -154,12 +154,12 @@ function Kt(e, t) {
154
154
  border: "0"
155
155
  }), n;
156
156
  }
157
- function qt(e) {
157
+ function Yt(e) {
158
158
  return Number.isInteger(e) ? String(e) : e.toFixed(2);
159
159
  }
160
160
  //#endregion
161
161
  //#region src/indicatorLabel.ts
162
- function Jt(e, t, n, r) {
162
+ function Xt(e, t, n, r) {
163
163
  let i = Object.keys(n || t).map((e) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)).slice(0, 3).map((e) => String(Number(e.toFixed(4)))), a = typeof t.symbol == "string" && t.symbol ? [t.symbol] : [];
164
164
  return [
165
165
  e === "spread" && t.mode === "ratio" ? "Ratio" : r ?? e.toUpperCase(),
@@ -169,52 +169,52 @@ function Jt(e, t, n, r) {
169
169
  }
170
170
  //#endregion
171
171
  //#region src/charts/ChartTypeStrategy.ts
172
- function Yt(e) {
172
+ function Zt(e) {
173
173
  switch (e) {
174
174
  case "candlestick":
175
175
  case "heikinAshi":
176
176
  case "lineBreak":
177
- case "rangeBars": return new he();
178
- case "line": return new Re();
179
- case "area": return new ue();
180
- case "bar": return new pe();
181
- case "hollowCandle": return new Ne();
182
- case "baseline": return new me();
183
- case "renko": return new Ze();
184
- case "kagi": return new Ie();
185
- case "pointAndFigure": return new T();
186
- case "volumeCandles": return new pt();
187
- case "equivolume": return new Oe();
188
- case "hlcArea": return new je();
189
- case "stepLine": return new it();
190
- case "lineWithMarkers": return new ze();
191
- case "hiLo": return new Me();
192
- default: return new he();
177
+ case "rangeBars": return new x();
178
+ case "line": return new Be();
179
+ case "area": return new pe();
180
+ case "bar": return new ge();
181
+ case "hollowCandle": return new Fe();
182
+ case "baseline": return new _e();
183
+ case "renko": return new $e();
184
+ case "kagi": return new Re();
185
+ case "pointAndFigure": return new Ye();
186
+ case "volumeCandles": return new ht();
187
+ case "equivolume": return new Ae();
188
+ case "hlcArea": return new Ne();
189
+ case "stepLine": return new ot();
190
+ case "lineWithMarkers": return new Ve();
191
+ case "hiLo": return new Pe();
192
+ default: return new x();
193
193
  }
194
194
  }
195
- function Xt(e, t, n = {}) {
195
+ function Qt(e, t, n = {}) {
196
196
  if (t.length === 0) return t;
197
197
  switch (e) {
198
- case "heikinAshi": return kt(t);
198
+ case "heikinAshi": return At(t);
199
199
  case "renko": {
200
200
  let e = n.renko?.boxSize;
201
- return typeof e == "number" ? k(t, { brickSize: e }) : k(t, {
201
+ return typeof e == "number" ? Ft(t, { brickSize: e }) : Ft(t, {
202
202
  brickSize: 0,
203
203
  useATR: !0,
204
204
  atrPeriod: n.renko?.atrPeriod ?? 14
205
205
  });
206
206
  }
207
- case "lineBreak": return jt(t, n.lineBreak?.lines ?? 3);
208
- case "kagi": return At(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
- case "pointAndFigure": return Mt(t, Qt(t, n), n.pointAndFigure?.reversal ?? 3);
207
+ case "lineBreak": return Mt(t, n.lineBreak?.lines ?? 3);
208
+ case "kagi": return jt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
+ case "pointAndFigure": return Nt(t, M(t, n), n.pointAndFigure?.reversal ?? 3);
210
210
  case "rangeBars": {
211
211
  let e = n.rangeBars?.range;
212
- return Nt(t, { rangeSize: typeof e == "number" ? e : N(t) * .005 });
212
+ return Pt(t, { rangeSize: typeof e == "number" ? e : N(t) * .005 });
213
213
  }
214
214
  default: return t;
215
215
  }
216
216
  }
217
- function Zt(e) {
217
+ function $t(e) {
218
218
  switch (e) {
219
219
  case "heikinAshi":
220
220
  case "renko":
@@ -225,10 +225,10 @@ function Zt(e) {
225
225
  default: return !1;
226
226
  }
227
227
  }
228
- function M(e) {
229
- return e !== "heikinAshi" && Zt(e);
228
+ function j(e) {
229
+ return e !== "heikinAshi" && $t(e);
230
230
  }
231
- function Qt(e, t = {}) {
231
+ function M(e, t = {}) {
232
232
  let n = t.pointAndFigure?.boxSize;
233
233
  return typeof n == "number" ? n : N(e) * .01;
234
234
  }
@@ -237,18 +237,18 @@ function N(e) {
237
237
  for (let n of e) t += n.close;
238
238
  return t / e.length;
239
239
  }
240
- function $t(e, t) {
240
+ function en(e, t) {
241
241
  let n = t?.(e);
242
- return n ? n.createRenderer() : Yt(e);
242
+ return n ? n.createRenderer() : Zt(e);
243
243
  }
244
- function en(e, t, n, r) {
244
+ function tn(e, t, n, r) {
245
245
  if (t.length === 0) return t;
246
246
  let i = n?.(e);
247
- return i?.transform ? i.transform(t) : Xt(e, t, r);
247
+ return i?.transform ? i.transform(t) : Qt(e, t, r);
248
248
  }
249
249
  //#endregion
250
250
  //#region src/state/AutoSaveScheduler.ts
251
- var tn = class {
251
+ var nn = class {
252
252
  timer = null;
253
253
  delayMs = 0;
254
254
  key = null;
@@ -340,7 +340,7 @@ var L = class {
340
340
  clear() {
341
341
  this.data = [];
342
342
  }
343
- }, R = 5e3, nn = 6e4, rn = 500, an = class {
343
+ }, R = 5e3, rn = 6e4, an = 500, on = class {
344
344
  loader = null;
345
345
  pageSize = 500;
346
346
  loading = !1;
@@ -381,7 +381,7 @@ var L = class {
381
381
  try {
382
382
  r = await e(t, this.pageSize);
383
383
  } catch (e) {
384
- return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(nn, R * 2 ** (this.failures - 1)), this.emit({
384
+ return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(rn, R * 2 ** (this.failures - 1)), this.emit({
385
385
  state: "error",
386
386
  count: 0,
387
387
  error: e instanceof Error ? e.message : String(e)
@@ -428,7 +428,7 @@ var L = class {
428
428
  return i;
429
429
  }
430
430
  getTheme() {
431
- return this.effective ??= ne(this.base, this.chartType, this.merged()), this.effective;
431
+ return this.effective ??= re(this.base, this.chartType, this.merged()), this.effective;
432
432
  }
433
433
  getBaseTheme() {
434
434
  return this.base;
@@ -505,7 +505,7 @@ function B(e, t) {
505
505
  ...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
506
506
  } : {};
507
507
  }
508
- function on(e) {
508
+ function sn(e) {
509
509
  let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
510
510
  return {
511
511
  ...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
@@ -520,7 +520,7 @@ function on(e) {
520
520
  }
521
521
  //#endregion
522
522
  //#region src/layout/LayoutManager.ts
523
- var V = 200, sn = 80, H = (e) => e.position === "top" || e.position === "bottom", cn = class {
523
+ var cn = 200, ln = 80, V = (e) => e.position === "top" || e.position === "bottom", un = class {
524
524
  panels = [];
525
525
  containerWidth = 0;
526
526
  containerHeight = 0;
@@ -536,8 +536,8 @@ var V = 200, sn = 80, H = (e) => e.position === "top" || e.position === "bottom"
536
536
  this.panels.push({
537
537
  id: e,
538
538
  position: n,
539
- size: r ?? (a ? V : t),
540
- minSize: a ? sn : i,
539
+ size: r ?? (a ? cn : t),
540
+ minSize: a ? ln : i,
541
541
  content: {
542
542
  type: "indicator",
543
543
  indicatorInstanceId: e
@@ -556,14 +556,14 @@ var V = 200, sn = 80, H = (e) => e.position === "top" || e.position === "bottom"
556
556
  }
557
557
  setPanelCollapsed(e, t) {
558
558
  let n = this.panels.find((t) => t.id === e);
559
- return !n || !H(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
559
+ return !n || !V(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
560
560
  }
561
561
  isPanelCollapsed(e) {
562
562
  return !!this.panels.find((t) => t.id === e)?.collapsed;
563
563
  }
564
564
  isPanelShownCollapsed(e) {
565
565
  let t = this.panels.find((t) => t.id === e);
566
- return !t || !H(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
566
+ return !t || !V(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
567
567
  }
568
568
  setPanelScale(e, t) {
569
569
  let n = this.panels.find((t) => t.id === e);
@@ -579,7 +579,7 @@ var V = 200, sn = 80, H = (e) => e.position === "top" || e.position === "bottom"
579
579
  }
580
580
  setMaximizedPanel(e) {
581
581
  let t = e === null ? null : this.panels.find((t) => t.id === e);
582
- return e !== null && (!t || !H(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
582
+ return e !== null && (!t || !V(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
583
583
  }
584
584
  getMaximizedPanel() {
585
585
  return this.maximized;
@@ -600,19 +600,19 @@ var V = 200, sn = 80, H = (e) => e.position === "top" || e.position === "bottom"
600
600
  this.panels = [...this.panels].sort((e, n) => t(e) - t(n));
601
601
  }
602
602
  shownSize(e, t) {
603
- return H(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
603
+ return V(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
604
604
  }
605
605
  setPanelPosition(e, n) {
606
606
  let r = this.panels.find((t) => t.id === e);
607
607
  if (r) {
608
608
  let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
609
- r.position = n, a !== o && (r.size = o ? V : t, r.minSize = o ? sn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
609
+ r.position = n, a !== o && (r.size = o ? cn : t, r.minSize = o ? ln : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
610
610
  }
611
611
  }
612
612
  setPanelSize(e, t) {
613
613
  let n = this.panels.find((t) => t.id === e);
614
614
  if (n) {
615
- let e = H(n) ? this.containerHeight - o - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
615
+ let e = V(n) ? this.containerHeight - o - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
616
616
  n.size = Math.max(n.minSize, r), n.collapsed = void 0, this.maximized = null;
617
617
  }
618
618
  }
@@ -722,8 +722,8 @@ var V = 200, sn = 80, H = (e) => e.position === "top" || e.position === "bottom"
722
722
  getMainChartRect() {
723
723
  return this.resolve().mainChartRect;
724
724
  }
725
- }, ln = 14, un = 14, dn = 22, fn = 4;
726
- function pn(e) {
725
+ }, dn = 14, fn = 14, pn = 22, mn = 4;
726
+ function hn(e) {
727
727
  let { min: t, max: n, lastPrice: r, locale: i, fontFamily: o, fontSizeSmall: c, measure: l } = e, d = e.tagPrecision ?? s(t, n), f = d, p = r === null ? [t, n] : [
728
728
  t,
729
729
  n,
@@ -732,14 +732,14 @@ function pn(e) {
732
732
  for (let t of p) {
733
733
  if (!Number.isFinite(t)) continue;
734
734
  let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : u(t, d, i), r = e.format ? n : u(t, f, i);
735
- m = Math.max(m, l(n, `500 ${c}px ${o}`) + ln, l(r, `bold 11px ${o}`) + un, l(r, `600 ${c}px ${o}`) + dn);
735
+ m = Math.max(m, l(n, `500 ${c}px ${o}`) + dn, l(r, `bold 11px ${o}`) + fn, l(r, `600 ${c}px ${o}`) + pn);
736
736
  }
737
- return m <= a ? a : Math.ceil(m / fn) * fn;
737
+ return m <= a ? a : Math.ceil(m / mn) * mn;
738
738
  }
739
- function mn(e, t) {
739
+ function gn(e, t) {
740
740
  return t > e || t <= e - 12 ? t : e;
741
741
  }
742
- var hn = class {
742
+ var _n = class {
743
743
  netY = 0;
744
744
  travelX = 0;
745
745
  engaged = !1;
@@ -755,11 +755,11 @@ var hn = class {
755
755
  }
756
756
  return this.engaged;
757
757
  }
758
- }, gn = 1;
759
- function _n(e, t) {
758
+ }, vn = 1;
759
+ function yn(e, t) {
760
760
  return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
761
761
  }
762
- function U(e) {
762
+ function H(e) {
763
763
  switch (e.kind) {
764
764
  case "indicator": return `indicator:${e.plugin.descriptor.id}`;
765
765
  case "drawing": return `drawing:${e.plugin.descriptor.type}`;
@@ -769,25 +769,25 @@ function U(e) {
769
769
  }
770
770
  //#endregion
771
771
  //#region src/plugins/registry.ts
772
- var W = /* @__PURE__ */ new Map();
773
- function vn(e) {
774
- W.set(U(e), e);
772
+ var U = /* @__PURE__ */ new Map();
773
+ function bn(e) {
774
+ U.set(H(e), e);
775
775
  }
776
- function yn(e) {
777
- return W.delete(e);
776
+ function xn(e) {
777
+ return U.delete(e);
778
778
  }
779
- function bn() {
780
- return [...W.values()];
779
+ function Sn() {
780
+ return [...U.values()];
781
781
  }
782
- function xn() {
783
- W.clear();
782
+ function Cn() {
783
+ U.clear();
784
784
  }
785
785
  //#endregion
786
786
  //#region src/plugins/PluginManager.ts
787
- var Sn = class {
787
+ var W = class {
788
788
  plugins = /* @__PURE__ */ new Map();
789
789
  constructor(e, t = {}) {
790
- if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of bn()) this.add(e);
790
+ if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Sn()) this.add(e);
791
791
  for (let e of t.plugins ?? []) this.add(e);
792
792
  }
793
793
  register(e) {
@@ -815,17 +815,17 @@ var Sn = class {
815
815
  return e;
816
816
  }
817
817
  add(e) {
818
- this.plugins.set(U(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
818
+ this.plugins.set(H(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
819
819
  }
820
- }, Cn = {
820
+ }, wn = {
821
821
  orderPlace: (e, t) => e.placeOrder(t),
822
822
  orderModify: (e, t) => e.modifyOrder(t),
823
823
  orderCancel: (e, t) => e.cancelOrder(t),
824
824
  positionModify: (e, t) => e.modifyPosition(t),
825
825
  positionClose: (e, t) => e.closePosition(t),
826
- positionReverse: (e, t, n) => wn(e, t, n)
826
+ positionReverse: (e, t, n) => Tn(e, t, n)
827
827
  };
828
- async function wn(e, t, n) {
828
+ async function Tn(e, t, n) {
829
829
  let { reversing: r } = n;
830
830
  if (!r.has(t.positionId)) {
831
831
  r.add(t.positionId);
@@ -854,7 +854,7 @@ async function wn(e, t, n) {
854
854
  }
855
855
  }
856
856
  }
857
- function Tn(e, t) {
857
+ function En(e, t) {
858
858
  let n = [], r = null, i = {
859
859
  positions: () => r ?? t.getPositions?.() ?? [],
860
860
  reversing: /* @__PURE__ */ new Set()
@@ -864,8 +864,8 @@ function Tn(e, t) {
864
864
  e.data && t.onFill?.(e.data);
865
865
  };
866
866
  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));
867
- for (let r of Object.keys(Cn)) {
868
- let a = Cn[r], o = t.onIntent(r, (n) => {
867
+ for (let r of Object.keys(wn)) {
868
+ let a = wn[r], o = t.onIntent(r, (n) => {
869
869
  Promise.resolve(a(e, n, i)).catch((e) => t.onError({
870
870
  message: `Execution command failed: ${r}`,
871
871
  cause: e
@@ -879,16 +879,16 @@ function Tn(e, t) {
879
879
  }
880
880
  //#endregion
881
881
  //#region src/Chart.ts
882
- var En = {
882
+ var Dn = {
883
883
  min: 0,
884
884
  max: 100
885
- }, Dn = 0xe8d4a51000, On = "exchange";
886
- function kn(e) {
885
+ }, On = 0xe8d4a51000, kn = "exchange";
886
+ function An(e) {
887
887
  if (typeof e == "string" && e !== "exchange" && !p(e)) throw RangeError(`Unknown time zone: ${e}`);
888
888
  if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
889
889
  }
890
- var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
891
- static version = "1.19.0";
890
+ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
891
+ static version = "1.20.0";
892
892
  engine;
893
893
  viewport;
894
894
  dataManager;
@@ -926,14 +926,14 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
926
926
  indicatorHistoryDepth = 0;
927
927
  removedDrawingAlerts = /* @__PURE__ */ new Map();
928
928
  zoomAreaMode = !1;
929
- priceAxisAddButton = new Je();
929
+ priceAxisAddButton = new Xe();
930
930
  displayTz = null;
931
931
  timezoneSetting = null;
932
932
  symbolInfo = null;
933
933
  symbolInfoSeq = 0;
934
934
  sessionBreaks;
935
935
  sessionShading;
936
- hostSessionHours = { ...we };
936
+ hostSessionHours = { ...Ee };
937
937
  compareRenderer;
938
938
  countdownInterval = null;
939
939
  volumeRenderer;
@@ -946,7 +946,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
946
946
  signalMarkerManager;
947
947
  tradeZoneManager;
948
948
  measureOverlay;
949
- selectionBoxOverlay = new $e();
949
+ selectionBoxOverlay = new tt();
950
950
  replayManager;
951
951
  replayBarUnsub = null;
952
952
  replaySeeking = !1;
@@ -956,7 +956,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
956
956
  replayRevealMarks = !0;
957
957
  replayOffset = 0;
958
958
  undoRedoManager;
959
- autoSaveScheduler = new tn((e) => this.saveState(e));
959
+ autoSaveScheduler = new nn((e) => this.saveState(e));
960
960
  animator;
961
961
  crosshairTooltip;
962
962
  pinnedTooltip;
@@ -968,15 +968,15 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
968
968
  disposed = !1;
969
969
  chartTypeOptions = {};
970
970
  mainSeriesVisible = !0;
971
- priceLines = new Ye();
972
- symbolSeries = new ot();
971
+ priceLines = new Ze();
972
+ symbolSeries = new ct();
973
973
  extendedHours = !0;
974
974
  replayRestarting = !1;
975
975
  fullSeries = null;
976
976
  requestedSymbols = /* @__PURE__ */ new Set();
977
977
  gridRenderer;
978
978
  priceAxis;
979
- leftPriceAxis = new qe();
979
+ leftPriceAxis = new w();
980
980
  leftScaleRequested = !1;
981
981
  leftAxisWidth = a;
982
982
  leftViewport = null;
@@ -1007,7 +1007,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1007
1007
  snapshotKey = null;
1008
1008
  historyCheckQueued = !1;
1009
1009
  constructor(e, t) {
1010
- t.timeZone != null && kn(t.timeZone), this.container = e, this.options = {
1010
+ t.timeZone != null && An(t.timeZone), this.container = e, this.options = {
1011
1011
  ...t,
1012
1012
  chartType: t.chartType ?? "candlestick"
1013
1013
  }, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
@@ -1045,15 +1045,15 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1045
1045
  logScale: n.logScale ?? !0,
1046
1046
  timeframes: n.timeframes ?? [],
1047
1047
  defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
1048
- }, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.dataManager = new L(), this.history = new an({
1048
+ }, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.dataManager = new L(), this.history = new on({
1049
1049
  oldestTime: () => this.dataManager.getData()[0]?.time ?? null,
1050
1050
  prepend: (e) => this.prependBars(e),
1051
1051
  emit: (e) => this.eventBus.emit("historyLoad", e)
1052
- }), this.themeManager = new z(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(on(t), "host", !1), this.layoutManager = new cn(), this.indicatorEngine = new Pe(), this.pluginManager = new Sn(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new ke(), Dt(this.indicatorEngine), this.indicatorEngine.register(new ve(this.symbolSeries)), this.indicatorEngine.register(new rt(this.symbolSeries)), this.indicatorEngine.register(new ye(this.symbolSeries)), this.indicatorEngine.register(new be(this.symbolSeries)), this.drawingManager = new Ee(), Et(this.drawingManager), this.drawingRenderer = new De(this.drawingManager), this.drawingManager.setRequestRender(() => {
1052
+ }), this.themeManager = new z(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(sn(t), "host", !1), this.layoutManager = new un(), this.indicatorEngine = new Ie(), this.pluginManager = new W(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new je(), E(this.indicatorEngine), this.indicatorEngine.register(new be(this.symbolSeries)), this.indicatorEngine.register(new at(this.symbolSeries)), this.indicatorEngine.register(new xe(this.symbolSeries)), this.indicatorEngine.register(new Se(this.symbolSeries)), this.drawingManager = new Oe(), Ot(this.drawingManager), this.drawingRenderer = new ke(this.drawingManager), this.drawingManager.setRequestRender(() => {
1053
1053
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1054
1054
  }), this.drawingManager.setEventCallback((e, t) => {
1055
1055
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1056
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new dt();
1056
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new pt();
1057
1057
  let i = "";
1058
1058
  this.undoRedoManager.setOnChange(() => {
1059
1059
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1066,21 +1066,21 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1066
1066
  primary: e[0] ?? null
1067
1067
  })), this.drawingManager.setForeignHistory((e, t) => {
1068
1068
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
1069
- }), this.drawingManager.setDataGetter(() => this.dataManager.getData()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new lt({
1069
+ }), this.drawingManager.setDataGetter(() => this.dataManager.getData()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new dt({
1070
1070
  enabled: this.features.trading,
1071
1071
  contextMenu: { enabled: this.features.tradingContextMenu }
1072
- }), this.tradingRenderer = new ut(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1072
+ }), this.tradingRenderer = new ft(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1073
1073
  this.eventBus.emit(e, t);
1074
- }), this.engine = new Xe(e);
1074
+ }), this.engine = new Qe(e);
1075
1075
  let a = this.engine.dprManager.getContainerSize();
1076
- if (this.viewport = new ft(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1076
+ if (this.viewport = new mt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1077
1077
  freePan: t.freePan ?? !0,
1078
1078
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1079
1079
  }), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1080
1080
  if (e.width <= 0 || e.height <= 0) return;
1081
1081
  let t = this.viewport.isAtEnd();
1082
1082
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
1083
- }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ae(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new qe(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new st(), this.crosshairHandler = new xe(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setCallback((e, t) => {
1083
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Me(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new w(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new lt(), this.crosshairHandler = new Ce(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setCallback((e, t) => {
1084
1084
  if (e !== null && t) {
1085
1085
  let n = this.dataManager.getData(), r = e < n.length ? n[e] : void 0;
1086
1086
  this.chartLegend.setHoverBar(r ?? null);
@@ -1089,19 +1089,19 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1089
1089
  prevClose: e > 0 ? n[e - 1]?.close : void 0,
1090
1090
  priceRange: i.priceRange,
1091
1091
  plot: i.chartRect,
1092
- barStepMs: vt(n)
1092
+ barStepMs: bt(n)
1093
1093
  }) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
1094
1094
  point: t,
1095
1095
  bar: r,
1096
1096
  barIndex: e
1097
1097
  });
1098
1098
  } else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
1099
- }), this.chartLegend = new ge(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new gt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new ht(), this.volumeProfile = new mt(), this.marketProfile = new Be(), this.depthHeatmap = new Te(), this.periodLevels = new We(), this.pivotMarkers = new Ke(), this.barCountdown = new fe(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new et(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new tt(), this.compareRenderer = new _e(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1099
+ }), this.chartLegend = new ve(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new vt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new _t(), this.volumeProfile = new gt(), this.marketProfile = new He(), this.depthHeatmap = new De(), this.periodLevels = new Ke(), this.pivotMarkers = new Je(), this.barCountdown = new he(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new nt(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new rt(), this.compareRenderer = new ye(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1100
1100
  visible: t.sessionBreaks.visible ?? !0,
1101
1101
  color: t.sessionBreaks.color,
1102
1102
  lineStyle: t.sessionBreaks.lineStyle,
1103
1103
  lineWidth: t.sessionBreaks.lineWidth
1104
- }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new le(), this.crosshairTooltip = new Se(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Ge(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = y(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Rn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Le({
1104
+ }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new fe(), this.crosshairTooltip = new we(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new qe(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = y(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(zn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new ze({
1105
1105
  scrollBars: (e) => {
1106
1106
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1107
1107
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1118,17 +1118,17 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1118
1118
  },
1119
1119
  fitContent: () => this.fitContent()
1120
1120
  }), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
1121
- this.a11y = new Gt(e, {
1121
+ this.a11y = new qt(e, {
1122
1122
  symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
1123
1123
  timeframe: () => this.streamTimeframe ?? "",
1124
1124
  chartType: () => this.options.chartType ?? "candlestick",
1125
1125
  bars: () => this.getDisplayData(),
1126
1126
  visibleRange: () => this.viewport.getState().visibleRange,
1127
1127
  formatPrice: (e) => this.formatPrice(e),
1128
- formatTime: (e) => oe(this.numberLocale || "en-US", {
1128
+ formatTime: (e) => le(this.numberLocale || "en-US", {
1129
1129
  dateStyle: "medium",
1130
1130
  timeStyle: "short"
1131
- }, this.displayTz)(e > Dn ? e : e * 1e3),
1131
+ }, this.displayTz)(e > On ? e : e * 1e3),
1132
1132
  showBar: (e) => this.setCrosshairTime(e)
1133
1133
  }, t.a11y?.labels);
1134
1134
  for (let e of [
@@ -1148,7 +1148,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1148
1148
  }
1149
1149
  this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
1150
1150
  }
1151
- }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ce(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new ce(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1151
+ }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Te(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new de(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1152
1152
  this.eventBus.emit("alertTriggered", K(e)), this.eventBus.emit("dataUpdate", {
1153
1153
  alert: "triggered",
1154
1154
  alertId: e.id,
@@ -1163,7 +1163,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1163
1163
  this.eventBus.emit("alertExpired", K(e));
1164
1164
  }), this.alertManager.on("updated", (e) => {
1165
1165
  this.eventBus.emit("alertUpdate", K(e));
1166
- }), this.signalMarkerManager = new nt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1166
+ }), this.signalMarkerManager = new it(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1167
1167
  this.eventBus.emit("signalMarkerAdd", {
1168
1168
  id: e.id,
1169
1169
  source: e.source,
@@ -1171,14 +1171,14 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1171
1171
  });
1172
1172
  }), this.signalMarkerManager.on("removed", (e) => {
1173
1173
  this.eventBus.emit("signalMarkerRemove", { id: e });
1174
- }), this.tradeZoneManager = new ct(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1174
+ }), this.tradeZoneManager = new ut(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1175
1175
  this.eventBus.emit("tradeZoneAdd", {
1176
1176
  id: e.id,
1177
1177
  direction: e.direction
1178
1178
  });
1179
1179
  }), this.tradeZoneManager.on("removed", (e) => {
1180
1180
  this.eventBus.emit("tradeZoneRemove", { id: e });
1181
- }), this.replayManager = new Qe(), this.replayManager.on("complete", () => {
1181
+ }), this.replayManager = new et(), this.replayManager.on("complete", () => {
1182
1182
  let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1183
1183
  t && this.eventBus.emit("replayComplete", {
1184
1184
  barIndex: e,
@@ -1186,9 +1186,9 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1186
1186
  });
1187
1187
  }), this.replayManager.on("stateChange", (e) => {
1188
1188
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1189
- }), this.measureOverlay = new Ve(), this.interactionManager = new Fe(e), this.features.panning) {
1190
- let e = new hn();
1191
- this.interactionManager.setPanHandler(new He((t, n) => {
1189
+ }), this.measureOverlay = new Ue(), this.interactionManager = new Le(e), this.features.panning) {
1190
+ let e = new _n();
1191
+ this.interactionManager.setPanHandler(new We((t, n) => {
1192
1192
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.options.autoScale = !1, this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1193
1193
  }, () => e.reset()));
1194
1194
  }
@@ -1200,10 +1200,10 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1200
1200
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1201
1201
  }
1202
1202
  })), this.features.zooming) {
1203
- this.interactionManager.setZoomHandler(new _t((e, t) => {
1203
+ this.interactionManager.setZoomHandler(new yt((e, t) => {
1204
1204
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1205
1205
  }));
1206
- let e = new de((e) => {
1206
+ let e = new me((e) => {
1207
1207
  this.options.autoScale = !1, this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
1208
1208
  }, (e) => {
1209
1209
  let t = this.viewport.getState().chartRect.width;
@@ -1223,7 +1223,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1223
1223
  y: t.y
1224
1224
  });
1225
1225
  })), this.interactionManager.setChartContextMenu((e, t) => this.eventBus.hasListeners("chartContextMenu") ? (this.eventBus.emit("chartContextMenu", this.contextAt(e, t)), !0) : !1), this.priceAxisAddButton.setEnabled(this.features.priceAxisAddButton && this.features.crosshair), this.interactionManager.setPriceAxisAddButton(this.priceAxisAddButton, (e) => {
1226
- let t = Lt(e.y, this.viewport.getState());
1226
+ let t = zt(e.y, this.viewport.getState());
1227
1227
  Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
1228
1228
  price: t,
1229
1229
  x: e.x,
@@ -1233,10 +1233,10 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1233
1233
  ...this.viewport.getState(),
1234
1234
  data: this.getDisplayData()
1235
1235
  })), this.features.alerts) {
1236
- let e = new se(this.alertManager, () => this.viewport.getState());
1236
+ let e = new ue(this.alertManager, () => this.viewport.getState());
1237
1237
  this.interactionManager.setAlertDragHandler(e);
1238
1238
  }
1239
- let o = new Ue();
1239
+ let o = new Ge();
1240
1240
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1241
1241
  let t = this.getDisplayData();
1242
1242
  if (t.length === 0) return;
@@ -1260,7 +1260,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1260
1260
  x: e.x,
1261
1261
  y: e.y
1262
1262
  }), t.length === 0) return;
1263
- let r = It(e.x, this.viewport.getState());
1263
+ let r = Rt(e.x, this.viewport.getState());
1264
1264
  r < 0 || r >= t.length || this.eventBus.emit("barClick", {
1265
1265
  bar: t[r],
1266
1266
  barIndex: r,
@@ -1300,7 +1300,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1300
1300
  end: () => {
1301
1301
  let e = this.selectionBoxOverlay.end();
1302
1302
  if (e && this.zoomAreaMode) {
1303
- if (e.x1 - e.x0 < Pn) return;
1303
+ if (e.x1 - e.x0 < Fn) return;
1304
1304
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1305
1305
  return;
1306
1306
  }
@@ -1337,7 +1337,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1337
1337
  if (this.replaySession) return 0;
1338
1338
  let t = null;
1339
1339
  if (this.fullSeries) {
1340
- let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => Kn(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1340
+ let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => qn(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1341
1341
  this.fullSeries = [...i, ...this.fullSeries];
1342
1342
  let a = this.sessionKeep(this.fullSeries);
1343
1343
  t = i.length, e = a ? i.filter((e) => a(e.time)) : i;
@@ -1377,15 +1377,15 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1377
1377
  }
1378
1378
  checkHistory() {
1379
1379
  this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
1380
- if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || M(this.options.chartType)) return;
1380
+ if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || j(this.options.chartType)) return;
1381
1381
  let { from: e, to: t } = this.viewport.getState().visibleRange;
1382
- this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Nn, t - e));
1382
+ this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Pn, t - e));
1383
1383
  }));
1384
1384
  }
1385
1385
  useStreamHistory(e, t) {
1386
1386
  if (this.hostHistoryLoader) return;
1387
- let n = Ft(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1388
- if (!r || i === null || ae(i) !== null) {
1387
+ let n = Lt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1388
+ if (!r || i === null || oe(i) !== null) {
1389
1389
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
1390
1390
  return;
1391
1391
  }
@@ -1451,7 +1451,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1451
1451
  });
1452
1452
  }
1453
1453
  applyTimeSpacing() {
1454
- let e = !this.tickStream && !M(this.options.chartType);
1454
+ let e = !this.tickStream && !j(this.options.chartType);
1455
1455
  this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
1456
1456
  }
1457
1457
  setChartTypeOptions(e) {
@@ -1470,7 +1470,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1470
1470
  return this.extendedHours;
1471
1471
  }
1472
1472
  sessionKeep(e) {
1473
- return this.extendedHours ? null : Bt(this.symbolInfo, e);
1473
+ return this.extendedHours ? null : Ht(this.symbolInfo, e);
1474
1474
  }
1475
1475
  shownBars(e) {
1476
1476
  let t = this.sessionKeep(e);
@@ -1511,7 +1511,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1511
1511
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
1512
1512
  }
1513
1513
  setShapes(e) {
1514
- let t = Rn(e);
1514
+ let t = zn(e);
1515
1515
  t.tagRadius !== void 0 && (this.themeManager.setShape({
1516
1516
  ...this.themeManager.getTheme().shape,
1517
1517
  ...t
@@ -1644,8 +1644,8 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1644
1644
  return {
1645
1645
  ...e,
1646
1646
  priceRange: {
1647
- min: t.min - n * jn,
1648
- max: t.max + n * jn
1647
+ min: t.min - n * Mn,
1648
+ max: t.max + n * Mn
1649
1649
  },
1650
1650
  logScale: !1,
1651
1651
  scaleMode: "regular",
@@ -1692,7 +1692,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1692
1692
  this.indicatorEngine.setStyleDefaults(e, null);
1693
1693
  return;
1694
1694
  }
1695
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ee(n);
1695
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : te(n);
1696
1696
  this.indicatorEngine.setStyleDefaults(e, {
1697
1697
  ...r,
1698
1698
  ...i ? { plots: i } : {}
@@ -1700,7 +1700,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1700
1700
  }
1701
1701
  setPaneStyle(e, t) {
1702
1702
  let n = this.paneOf(e);
1703
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? te(t) : null));
1703
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? ne(t) : null));
1704
1704
  }
1705
1705
  setPaneStyleNow(e, t) {
1706
1706
  JSON.stringify(t) !== JSON.stringify(this.paneStyles.get(e) ?? null) && (t ? this.paneStyles.set(e, t) : this.paneStyles.delete(e), this.panelInfoCache = null, this.syncRenderContext(), this.engine.requestRender(), this.markStateChanged());
@@ -1719,8 +1719,8 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1719
1719
  return this.pluginManager;
1720
1720
  }
1721
1721
  static indicators() {
1722
- let e = new Pe();
1723
- return Dt(e), e.getAvailableIndicators();
1722
+ let e = new Ie();
1723
+ return E(e), e.getAvailableIndicators();
1724
1724
  }
1725
1725
  setPanelPosition(e, t) {
1726
1726
  this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
@@ -1850,20 +1850,28 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1850
1850
  return this.features.legend ? e + this.chartLegend.getHeight() : e;
1851
1851
  }
1852
1852
  isTimeAligned() {
1853
- return M(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1853
+ return j(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1854
1854
  }
1855
1855
  roundPrice(e) {
1856
1856
  if (!Number.isFinite(e)) return e;
1857
- let t = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
1858
- if (t !== void 0 && t > 0) return Number((Math.round(e / t) * t).toFixed(ie(t)));
1857
+ let t = this.stepAt(e);
1858
+ if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ae(t)));
1859
1859
  let { min: n, max: r } = this.viewport.getState().priceRange;
1860
1860
  return Number(e.toFixed(this.marketPricePrecision ?? s(n, r)));
1861
1861
  }
1862
- getPriceStep() {
1863
- let e = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
1864
- if (e !== void 0 && e > 0) return e;
1865
- let { min: t, max: n } = this.viewport.getState().priceRange, r = this.marketPricePrecision ?? s(t, n);
1866
- return Number((10 ** -r).toFixed(r));
1862
+ lastClose() {
1863
+ let e = this.dataManager.getData();
1864
+ return e[e.length - 1]?.close ?? 0;
1865
+ }
1866
+ stepAt(e) {
1867
+ let t = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
1868
+ return t !== void 0 && t > 0 ? t : this.marketConfig ? v(e, this.marketConfig) : void 0;
1869
+ }
1870
+ getPriceStep(e) {
1871
+ let t = this.stepAt(e ?? this.lastClose());
1872
+ if (t !== void 0) return t;
1873
+ let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ?? s(n, r);
1874
+ return Number((10 ** -i).toFixed(i));
1867
1875
  }
1868
1876
  setPriceFormat(e) {
1869
1877
  this.applyPriceFormat(e), this.updateViewportAndRender();
@@ -1928,7 +1936,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
1928
1936
  }
1929
1937
  autoFib() {
1930
1938
  if (!this.features.drawings) return null;
1931
- let e = this.getDisplayData(), t = this.viewport.getState(), n = yt(e, t.visibleRange.from, t.visibleRange.to);
1939
+ let e = this.getDisplayData(), t = this.viewport.getState(), n = xt(e, t.visibleRange.from, t.visibleRange.to);
1932
1940
  return n ? this.addDrawing({
1933
1941
  type: "fibRetracement",
1934
1942
  anchors: [n[0], n[1]]
@@ -2003,7 +2011,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2003
2011
  recordUndo(e) {
2004
2012
  if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
2005
2013
  let t = performance.now(), n = this.undoRedoManager.last();
2006
- if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Mn) {
2014
+ if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Nn) {
2007
2015
  this.undoRedoManager.replaceLast({
2008
2016
  ...n,
2009
2017
  custom: {
@@ -2050,7 +2058,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2050
2058
  x: t.x,
2051
2059
  y: t.y
2052
2060
  };
2053
- if ((e === "plot" || e === "priceAxis") && (r.price = Lt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = A(t.x, n)), e === "pane") {
2061
+ if ((e === "plot" || e === "priceAxis") && (r.price = zt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = k(t.x, n)), e === "pane") {
2054
2062
  let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
2055
2063
  e && (r.pane = e.instanceId);
2056
2064
  }
@@ -2076,7 +2084,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2076
2084
  ...this.viewport.getState(),
2077
2085
  data: this.getDisplayData()
2078
2086
  };
2079
- this.setVisibleRange(A(e.x0, t), A(e.x1, t));
2087
+ this.setVisibleRange(k(e.x0, t), k(e.x1, t));
2080
2088
  }
2081
2089
  lockAllDrawings() {
2082
2090
  this.drawingManager.lockAllDrawings();
@@ -2121,7 +2129,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2121
2129
  for (let e of this.indicatorEngine.getActiveIndicators()) {
2122
2130
  let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
2123
2131
  if (!t) continue;
2124
- let r = Jt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2132
+ let r = Xt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2125
2133
  key: e,
2126
2134
  title: e
2127
2135
  }));
@@ -2145,11 +2153,11 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2145
2153
  }
2146
2154
  getExportText(e = "csv", t = {}) {
2147
2155
  let { bars: n, columns: r } = this.getExportData(t);
2148
- return e === "json" ? w.toJSON(n, r) : w.toCSV(n, r);
2156
+ return e === "json" ? C.toJSON(n, r) : C.toCSV(n, r);
2149
2157
  }
2150
2158
  download(e, t, n) {
2151
2159
  let r = this.getExportText(e, n);
2152
- e === "json" ? w.download(r, t ?? "chart-data.json", "application/json") : w.download(r, t ?? "chart-data.csv", "text/csv");
2160
+ e === "json" ? C.download(r, t ?? "chart-data.json", "application/json") : C.download(r, t ?? "chart-data.csv", "text/csv");
2153
2161
  }
2154
2162
  setAutoSave(e, t = 5e3) {
2155
2163
  this.autoSaveScheduler.enable(e, t);
@@ -2199,7 +2207,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2199
2207
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2200
2208
  }
2201
2209
  updateIndicatorStyleNow(e, t) {
2202
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ee(n);
2210
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : te(n);
2203
2211
  this.indicatorEngine.updateIndicatorStyle(e, {
2204
2212
  ...r,
2205
2213
  ...i ? { plots: i } : {}
@@ -2309,8 +2317,8 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2309
2317
  this.features.trading && this.tradingManager.setConfig(e);
2310
2318
  }
2311
2319
  async connect(e) {
2312
- if (!Ot(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2313
- this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new at(), this.streamManager.on("snapshot", (t) => {
2320
+ if (!kt(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2321
+ this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new st(), this.streamManager.on("snapshot", (t) => {
2314
2322
  let n = `${this.currentSymbol}|${this.streamTimeframe}`;
2315
2323
  this.replaySession ? this.replaySession.live.setData(t) : n === this.snapshotKey && this.dataManager.getLength() > 0 ? this.mergeSnapshot(t) : this.setData(t), this.snapshotKey = n, this.useStreamHistory(e.adapter, e.historyPageSize);
2316
2324
  }), this.streamManager.on("barClose", (e) => {
@@ -2359,14 +2367,14 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2359
2367
  }), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
2360
2368
  let t = this.streamManager;
2361
2369
  if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
2362
- let n = x(e.timeframe);
2370
+ let n = se(e.timeframe);
2363
2371
  this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
2364
2372
  this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
2365
2373
  }, 1e3);
2366
2374
  }
2367
2375
  setStreamTarget(e, t) {
2368
2376
  let n = this.announcedSymbol, r = this.announcedTimeframe;
2369
- this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = ae(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2377
+ this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = oe(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2370
2378
  symbol: e,
2371
2379
  previous: n
2372
2380
  })), t !== r && (this.announcedTimeframe = t, this.eventBus.emit("timeframeChange", {
@@ -2377,8 +2385,8 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2377
2385
  async switchStream(e, t) {
2378
2386
  if (!this.streamManager) return;
2379
2387
  let n = this.streamAdapter;
2380
- if (n && !Ot(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2381
- this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(x(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
2388
+ if (n && !kt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2389
+ this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(se(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
2382
2390
  }
2383
2391
  isTimeframeAllowed(e) {
2384
2392
  let t = this.features.timeframes;
@@ -2393,7 +2401,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2393
2401
  }
2394
2402
  connectExecution(e, t = {}) {
2395
2403
  if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
2396
- this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Tn(e, {
2404
+ this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = En(e, {
2397
2405
  onIntent: (e, t) => {
2398
2406
  let n = (e) => t(e.payload);
2399
2407
  return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
@@ -2490,7 +2498,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2490
2498
  setVisibleRangePreset(e) {
2491
2499
  let t = this.getDisplayData();
2492
2500
  if (t.length === 0) return;
2493
- let n = t.length - 1, r = t[n].time > Dn ? 1 : 1e3, i = wt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2501
+ let n = t.length - 1, r = t[n].time > On ? 1 : 1e3, i = Et(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2494
2502
  if (a === null || a < t[0].time) {
2495
2503
  this.fitContent();
2496
2504
  return;
@@ -2552,7 +2560,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2552
2560
  this.applyStyle(e, t.layer ?? "host", !0);
2553
2561
  }
2554
2562
  setOverrides(e, t = {}) {
2555
- let n = t.layer ?? "host", { overrides: r, rejected: i } = v(e);
2563
+ let n = t.layer ?? "host", { overrides: r, rejected: i } = ee(e);
2556
2564
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
2557
2565
  let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
2558
2566
  this.themeManager.setOverrides(a, n) && this.styleChanged(n);
@@ -2571,7 +2579,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2571
2579
  return this.themeManager.getStyleValue(e);
2572
2580
  }
2573
2581
  applyStyle(e, t, n) {
2574
- let { overrides: r, rejected: i } = v(e);
2582
+ let { overrides: r, rejected: i } = ee(e);
2575
2583
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
2576
2584
  }
2577
2585
  styleChanged(e) {
@@ -2663,7 +2671,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2663
2671
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2664
2672
  }
2665
2673
  setTimezone(e) {
2666
- kn(e), this.timezoneSetting = e, this.applyTimezone();
2674
+ An(e), this.timezoneSetting = e, this.applyTimezone();
2667
2675
  }
2668
2676
  getTimezone() {
2669
2677
  return this.timezoneSetting;
@@ -2738,7 +2746,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2738
2746
  return this.sessionShading.isVisible();
2739
2747
  }
2740
2748
  setSessionShadingConfig(e) {
2741
- this.hostSessionHours = Ct(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2749
+ this.hostSessionHours = Tt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2742
2750
  }
2743
2751
  setTooltipVisible(e) {
2744
2752
  e || this.crosshairTooltip.hide();
@@ -2757,11 +2765,11 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2757
2765
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2758
2766
  }
2759
2767
  async takeGpu(e, t, n) {
2760
- let { gpu: r, reason: i } = await St(e);
2761
- return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? bt() > 0 ? this.takeGpu(e, t, n) : (this.waitForGpu(() => void this.takeGpu(e, t, !1)), n && this.applyRenderer(null, "limit"), this.getRenderer()) : ((r || n) && this.applyRenderer(r, i), this.getRenderer());
2768
+ let { gpu: r, reason: i } = await wt(e);
2769
+ return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? St() > 0 ? this.takeGpu(e, t, n) : (this.waitForGpu(() => void this.takeGpu(e, t, !1)), n && this.applyRenderer(null, "limit"), this.getRenderer()) : ((r || n) && this.applyRenderer(r, i), this.getRenderer());
2762
2770
  }
2763
2771
  waitForGpu(e) {
2764
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Pt(e) : null;
2772
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? It(e) : null;
2765
2773
  }
2766
2774
  getRenderer() {
2767
2775
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -2779,23 +2787,23 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2779
2787
  this.engine.getGpu() && this.engine.renderNow();
2780
2788
  }
2781
2789
  screenshot(e) {
2782
- this.features.screenshot && (this.freshFrame(), E.download(this.container, e, this.themeManager.getTheme().background));
2790
+ this.features.screenshot && (this.freshFrame(), T.download(this.container, e, this.themeManager.getTheme().background));
2783
2791
  }
2784
2792
  async copyScreenshot() {
2785
2793
  if (!this.features.screenshot) return !1;
2786
2794
  try {
2787
2795
  this.freshFrame();
2788
- let e = await E.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2796
+ let e = await T.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2789
2797
  return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
2790
2798
  } catch {
2791
2799
  return !1;
2792
2800
  }
2793
2801
  }
2794
2802
  screenshotDataURL() {
2795
- return this.features.screenshot ? (this.freshFrame(), E.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2803
+ return this.features.screenshot ? (this.freshFrame(), T.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2796
2804
  }
2797
2805
  async screenshotBlob() {
2798
- return this.features.screenshot ? (this.freshFrame(), E.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2806
+ return this.features.screenshot ? (this.freshFrame(), T.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2799
2807
  }
2800
2808
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
2801
2809
  if (!this.features.alerts) return null;
@@ -2931,23 +2939,23 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2931
2939
  };
2932
2940
  }
2933
2941
  let { steps: n, startTime: r, hideHistory: i, revealMarks: a, ...o } = e ?? {}, s = this.shownBars(this.replaySession.live.getData()), c = t > 0 && r === void 0 && i !== !1, l = o.startIndex;
2934
- r !== void 0 && l === void 0 ? l = Vn(s, r) : c && l !== void 0 && (l += t);
2942
+ r !== void 0 && l === void 0 ? l = Hn(s, r) : c && l !== void 0 && (l += t);
2935
2943
  let u = c ? t : i && l !== void 0 && l > 0 ? Math.min(Math.floor(l), s.length - 1) : 0, d = u > 0 ? s.slice(u) : s;
2936
2944
  l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
2937
- let f = n ? Gn(n, d) : null;
2945
+ let f = n ? Kn(n, d) : null;
2938
2946
  this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
2939
2947
  try {
2940
2948
  this.replayManager.load(f ?? d);
2941
2949
  } finally {
2942
2950
  this.replayRestarting = !1;
2943
2951
  }
2944
- f && o.startIndex !== void 0 && (o.startIndex = Jn(f, d, o.startIndex)), this.replayBarUnsub?.();
2952
+ f && o.startIndex !== void 0 && (o.startIndex = Yn(f, d, o.startIndex)), this.replayBarUnsub?.();
2945
2953
  let p = -1, m = -1, h = null, g = f ?? d;
2946
2954
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
2947
2955
  let t = e, n = d[e];
2948
2956
  if (f) {
2949
2957
  let r = f[e];
2950
- t = qn(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? Xn(h, r) : Yn(d[t], f, e), n = h;
2958
+ t = Jn(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? Zn(h, r) : Xn(d[t], f, e), n = h;
2951
2959
  }
2952
2960
  m = e;
2953
2961
  let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
@@ -2999,20 +3007,20 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
2999
3007
  return;
3000
3008
  }
3001
3009
  if (i.time <= n.fedTime) return;
3002
- let a = e.slice(Hn(e, n.fedTime), t + 1);
3010
+ let a = e.slice(Un(e, n.fedTime), t + 1);
3003
3011
  n.fedTime = i.time;
3004
- let o = Math.ceil(a.length / Bn);
3005
- for (let e = 0; e < a.length; e += o) for (let [t, n] of Un(a.slice(e, e + o))) r.setMarkPrice(t, n);
3012
+ let o = Math.ceil(a.length / Vn);
3013
+ for (let e = 0; e < a.length; e += o) for (let [t, n] of Wn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3006
3014
  this.tradingManager.setCurrentPrice(i.close);
3007
3015
  }
3008
3016
  getReplayBarIndex() {
3009
3017
  if (!this.replaySession) return -1;
3010
3018
  let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
3011
- return t && this.replayCoarse ? qn(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3019
+ return t && this.replayCoarse ? Jn(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3012
3020
  }
3013
3021
  replaySeekToBar(e) {
3014
3022
  let t = this.replayStepsSeries;
3015
- this.replaySeek(t && this.replayCoarse ? Jn(t, this.replayCoarse, e) : e);
3023
+ this.replaySeek(t && this.replayCoarse ? Yn(t, this.replayCoarse, e) : e);
3016
3024
  }
3017
3025
  replayPause() {
3018
3026
  this.replayManager.pause();
@@ -3057,7 +3065,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3057
3065
  return this.replayManager.getProgress();
3058
3066
  }
3059
3067
  captureSnapshot() {
3060
- return C.capture({
3068
+ return S.capture({
3061
3069
  getDrawings: () => this.getDrawings(),
3062
3070
  getTheme: () => this.themeManager.getBaseTheme(),
3063
3071
  getAlerts: () => this.getAlerts(),
@@ -3070,14 +3078,14 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3070
3078
  });
3071
3079
  }
3072
3080
  restoreIndicators(e, t) {
3073
- let n = In(e), r = /* @__PURE__ */ new Map();
3081
+ let n = Ln(e), r = /* @__PURE__ */ new Map();
3074
3082
  this.unrestoredIndicators = [];
3075
3083
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3076
3084
  if (t) {
3077
3085
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3078
3086
  for (let n of t) {
3079
3087
  let t = e.get(n.instanceId);
3080
- t && Ln(n, t) && o.add(n.instanceId);
3088
+ t && Rn(n, t) && o.add(n.instanceId);
3081
3089
  }
3082
3090
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3083
3091
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3137,7 +3145,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3137
3145
  let o = this.indicatorEngine.getIndicatorConfig(e);
3138
3146
  (t.visible ?? !0) !== (o?.visible ?? !0) && this.setIndicatorVisible(e, t.visible ?? !0);
3139
3147
  let s = t.levels ?? null;
3140
- JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? te(t.paneStyle) : null);
3148
+ JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? ne(t.paneStyle) : null);
3141
3149
  }
3142
3150
  restorePanes(e) {
3143
3151
  for (let [t, n] of e) t.paneSize !== void 0 && this.layoutManager.setPanelSize(n, t.paneSize), (t.paneSize !== void 0 || t.paneCollapsed) && this.layoutManager.setPanelCollapsed(n, !!t.paneCollapsed), t.paneSize !== void 0 && this.layoutManager.setPanelScale(n, {
@@ -3218,7 +3226,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3218
3226
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3219
3227
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3220
3228
  if (JSON.stringify(n) === JSON.stringify(i)) return r;
3221
- let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Mn && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3229
+ let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Nn && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3222
3230
  type: "indicators",
3223
3231
  before: null,
3224
3232
  after: null
@@ -3246,12 +3254,12 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3246
3254
  }
3247
3255
  saveState(e) {
3248
3256
  if (!this.features.saveLoad) return null;
3249
- let t = this.captureSnapshot(), n = C.serialize(t);
3250
- return e && C.saveToStorage(e, t), n;
3257
+ let t = this.captureSnapshot(), n = S.serialize(t);
3258
+ return e && S.saveToStorage(e, t), n;
3251
3259
  }
3252
3260
  loadState(e) {
3253
3261
  if (!this.features.saveLoad) return;
3254
- let t = C.deserialize(e);
3262
+ let t = S.deserialize(e);
3255
3263
  this.chartTypeOptions = t.chartTypeOptions ?? {}, this.displayDataCache = null, t.chartType && this.setChartType(t.chartType), t.drawings && this.setDrawings(t.drawings), (t.theme === "dark" || t.theme === "light") && this.setTheme(t.theme), t.version >= 3 && this.themeManager.setUserOverrides(t.overrides ?? {}) && this.styleChanged("user");
3256
3264
  let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
3257
3265
  if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
@@ -3262,7 +3270,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3262
3270
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3263
3271
  return r ? r + e.slice(t) : e;
3264
3272
  }, r = t(e.channel), i = {
3265
- ...Tt(e),
3273
+ ...Dt(e),
3266
3274
  ...e.target ? { target: t(e.target) } : {}
3267
3275
  };
3268
3276
  if (!e.expired) {
@@ -3282,19 +3290,19 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3282
3290
  }
3283
3291
  loadStateFromStorage(e) {
3284
3292
  if (!this.features.saveLoad) return !1;
3285
- let t = C.loadFromStorage(e);
3286
- return t ? (this.loadState(C.serialize(t)), !0) : !1;
3293
+ let t = S.loadFromStorage(e);
3294
+ return t ? (this.loadState(S.serialize(t)), !0) : !1;
3287
3295
  }
3288
3296
  downloadState(e) {
3289
- this.features.saveLoad && C.downloadFile(this.captureSnapshot(), e);
3297
+ this.features.saveLoad && S.downloadFile(this.captureSnapshot(), e);
3290
3298
  }
3291
3299
  async loadStateFromFile() {
3292
3300
  if (!this.features.saveLoad) return;
3293
- let e = await C.loadFromFile();
3294
- this.loadState(C.serialize(e));
3301
+ let e = await S.loadFromFile();
3302
+ this.loadState(S.serialize(e));
3295
3303
  }
3296
3304
  setLocale(e) {
3297
- re(e), this.engine.requestRender();
3305
+ ie(e), this.engine.requestRender();
3298
3306
  }
3299
3307
  setNumberLocale(e) {
3300
3308
  this.numberLocale = e, this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.sessionBreaks.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
@@ -3310,24 +3318,31 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3310
3318
  candleDown: e.colorScheme.down,
3311
3319
  candleUpWick: e.colorScheme.up,
3312
3320
  candleDownWick: e.colorScheme.down,
3313
- volumeUp: S(e.colorScheme.up),
3314
- volumeDown: S(e.colorScheme.down)
3321
+ volumeUp: ce(e.colorScheme.up),
3322
+ volumeDown: ce(e.colorScheme.down)
3315
3323
  };
3316
3324
  this.themeManager.setTheme(t);
3317
3325
  }
3318
3326
  e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
3319
3327
  }
3320
3328
  applyPricePrecision(e) {
3321
- this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? An), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3329
+ this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? jn), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3322
3330
  }
3323
3331
  getMarket() {
3324
3332
  return this.marketConfig;
3325
3333
  }
3334
+ getPriceLimits() {
3335
+ let e = this.marketConfig;
3336
+ return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : l(e.priceLimits.referencePrice, e);
3337
+ }
3326
3338
  setPriceLimits(e) {
3327
- this.marketConfig && (l(e, this.marketConfig) && (this.marketConfig.priceLimits = {
3328
- ...this.marketConfig.priceLimits,
3329
- referencePrice: e
3330
- }), this.engine.requestRender());
3339
+ this.marketConfig?.priceLimits && (this.marketConfig = {
3340
+ ...this.marketConfig,
3341
+ priceLimits: {
3342
+ ...this.marketConfig.priceLimits,
3343
+ referencePrice: e
3344
+ }
3345
+ }, this.engine.requestRender());
3331
3346
  }
3332
3347
  getFeatures() {
3333
3348
  return this.features;
@@ -3348,15 +3363,15 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3348
3363
  this.disposed = !0, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.container.innerHTML = "";
3349
3364
  }
3350
3365
  createChartRenderer(e) {
3351
- let t = $t(e, (e) => this.pluginManager.getChartType(e));
3352
- return t instanceof Me && t.setPriceText((e) => this.formatPrice(e)), t;
3366
+ let t = en(e, (e) => this.pluginManager.getChartType(e));
3367
+ return t instanceof Pe && t.setPriceText((e) => this.formatPrice(e)), t;
3353
3368
  }
3354
3369
  getDisplayData() {
3355
3370
  if (this.displayDataCache) return this.displayDataCache;
3356
3371
  let e = this.dataManager.getData();
3357
3372
  if (e.length === 0) return e;
3358
- let t = en(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3359
- return this.chartRenderer instanceof T && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(Qt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3373
+ let t = tn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3374
+ return this.chartRenderer instanceof Ye && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(M(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3360
3375
  }
3361
3376
  recalcIndicatorsFrom(e, t) {
3362
3377
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3391,7 +3406,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3391
3406
  this.viewport.setScaleBaseline(t[e]?.close);
3392
3407
  }
3393
3408
  if (n) {
3394
- let e = zn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3409
+ let e = Bn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3395
3410
  if (e) {
3396
3411
  let t = r.priceRange, n = Math.min(t.min, e.min), i = Math.max(t.max, e.max);
3397
3412
  if (n < t.min || i > t.max) {
@@ -3415,7 +3430,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3415
3430
  fitLeftAxisWidth() {
3416
3431
  let e = this.leftViewport;
3417
3432
  if (!e) return !1;
3418
- let t = this.themeManager.getTheme(), n = pn({
3433
+ let t = this.themeManager.getTheme(), n = hn({
3419
3434
  min: e.priceRange.min,
3420
3435
  max: e.priceRange.max,
3421
3436
  lastPrice: null,
@@ -3424,12 +3439,12 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3424
3439
  fontFamily: t.font.family,
3425
3440
  fontSizeSmall: t.font.sizeSmall,
3426
3441
  measure: (e, t) => this.measureText(e, t)
3427
- }), r = mn(this.leftAxisWidth, n);
3442
+ }), r = gn(this.leftAxisWidth, n);
3428
3443
  return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
3429
3444
  }
3430
3445
  fitPriceAxisWidth() {
3431
3446
  if (!this.features.priceAxis) return !1;
3432
- let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = pn({
3447
+ let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = hn({
3433
3448
  min: e.min,
3434
3449
  max: e.max,
3435
3450
  lastPrice: this.currentPriceLine.getPrice(),
@@ -3440,7 +3455,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3440
3455
  fontFamily: t.font.family,
3441
3456
  fontSizeSmall: t.font.sizeSmall,
3442
3457
  measure: (e, t) => this.measureText(e, t)
3443
- }), r = mn(this.priceAxisWidth, n);
3458
+ }), r = gn(this.priceAxisWidth, n);
3444
3459
  return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
3445
3460
  }
3446
3461
  measureText(e, t) {
@@ -3484,7 +3499,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3484
3499
  buildPanelRenderInfos() {
3485
3500
  if (this.panelInfoCache) return this.panelInfoCache;
3486
3501
  let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
3487
- let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...En }, o = {
3502
+ let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...Dn }, o = {
3488
3503
  x: e.rect.x,
3489
3504
  y: e.rect.y + 20,
3490
3505
  width: e.rect.width,
@@ -3566,7 +3581,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3566
3581
  });
3567
3582
  }
3568
3583
  drawOverlayPlugins(e, t) {
3569
- let n = _n(this.pluginManager.getOverlays(), t);
3584
+ let n = yn(this.pluginManager.getOverlays(), t);
3570
3585
  if (n.length === 0) return;
3571
3586
  let r = {
3572
3587
  viewport: this.viewport.getState(),
@@ -3576,19 +3591,18 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
3576
3591
  for (let t of n) t.render(e, r);
3577
3592
  }
3578
3593
  buildPriceLimits() {
3579
- if (!this.marketConfig?.priceLimits?.enabled || !this.marketConfig.priceLimits.referencePrice) return null;
3580
- let e = l(this.marketConfig.priceLimits.referencePrice, this.marketConfig);
3581
- return e ? {
3594
+ let e = this.getPriceLimits();
3595
+ return !e || !this.marketConfig ? null : {
3582
3596
  ...e,
3583
3597
  colors: this.marketConfig.colorScheme ? {
3584
3598
  ceiling: this.marketConfig.colorScheme.ceiling,
3585
3599
  floor: this.marketConfig.colorScheme.floor,
3586
3600
  reference: this.marketConfig.colorScheme.reference
3587
3601
  } : void 0
3588
- } : null;
3602
+ };
3589
3603
  }
3590
3604
  };
3591
- function In(e) {
3605
+ function Ln(e) {
3592
3606
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3593
3607
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3594
3608
  i.add(e.instanceId);
@@ -3602,10 +3616,10 @@ function In(e) {
3602
3616
  for (let t of e) a(t);
3603
3617
  return n;
3604
3618
  }
3605
- function Ln(e, t) {
3619
+ function Rn(e, t) {
3606
3620
  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);
3607
3621
  }
3608
- function Rn(e) {
3622
+ function zn(e) {
3609
3623
  let t = e.tagRadius;
3610
3624
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3611
3625
  }
@@ -3615,7 +3629,7 @@ var G = new Set([
3615
3629
  "correlation",
3616
3630
  "correlationlog"
3617
3631
  ]);
3618
- function zn(e, t) {
3632
+ function Bn(e, t) {
3619
3633
  return e ? t ? {
3620
3634
  min: Math.min(e.min, t.min),
3621
3635
  max: Math.max(e.max, t.max)
@@ -3636,8 +3650,8 @@ function K(e) {
3636
3650
  bars: e.bars
3637
3651
  };
3638
3652
  }
3639
- var Bn = 500;
3640
- function Vn(e, t) {
3653
+ var Vn = 500;
3654
+ function Hn(e, t) {
3641
3655
  let n = 0, r = e.length;
3642
3656
  for (; n < r;) {
3643
3657
  let i = n + r >> 1;
@@ -3645,7 +3659,7 @@ function Vn(e, t) {
3645
3659
  }
3646
3660
  return n;
3647
3661
  }
3648
- function Hn(e, t) {
3662
+ function Un(e, t) {
3649
3663
  let n = 0, r = e.length;
3650
3664
  for (; n < r;) {
3651
3665
  let i = n + r >> 1;
@@ -3653,20 +3667,20 @@ function Hn(e, t) {
3653
3667
  }
3654
3668
  return n;
3655
3669
  }
3656
- function Un(e) {
3670
+ function Wn(e) {
3657
3671
  let t = 0, n = 0;
3658
3672
  for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
3659
3673
  let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
3660
3674
  return [...a ? [r, i] : [i, r], [o.close, o.time]];
3661
3675
  }
3662
- function Wn(e) {
3676
+ function Gn(e) {
3663
3677
  let t = 0;
3664
3678
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
3665
3679
  return t > 0 ? t : Infinity;
3666
3680
  }
3667
- function Gn(e, t) {
3681
+ function Kn(e, t) {
3668
3682
  if (t.length === 0) return null;
3669
- let n = t[t.length - 1].time + Wn(t), r = e.filter((e) => Kn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3683
+ let n = t[t.length - 1].time + Gn(t), r = e.filter((e) => qn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3670
3684
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
3671
3685
  if (i.length === 0) return null;
3672
3686
  let a = t.findIndex((e) => e.time >= i[0].time);
@@ -3674,7 +3688,7 @@ function Gn(e, t) {
3674
3688
  let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
3675
3689
  return [...o, ...s];
3676
3690
  }
3677
- function Kn(e) {
3691
+ function qn(e) {
3678
3692
  return [
3679
3693
  e.time,
3680
3694
  e.open,
@@ -3683,7 +3697,7 @@ function Kn(e) {
3683
3697
  e.close
3684
3698
  ].every(Number.isFinite);
3685
3699
  }
3686
- function qn(e, t) {
3700
+ function Jn(e, t) {
3687
3701
  let n = 0, r = e.length - 1;
3688
3702
  for (; n < r;) {
3689
3703
  let i = n + r + 1 >> 1;
@@ -3691,22 +3705,22 @@ function qn(e, t) {
3691
3705
  }
3692
3706
  return n;
3693
3707
  }
3694
- function Jn(e, t, n) {
3708
+ function Yn(e, t, n) {
3695
3709
  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;
3696
3710
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
3697
3711
  return Math.max(0, a);
3698
3712
  }
3699
- function Yn(e, t, n) {
3713
+ function Xn(e, t, n) {
3700
3714
  let r = n;
3701
3715
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
3702
3716
  let i = {
3703
3717
  ...t[r],
3704
3718
  time: e.time
3705
3719
  };
3706
- for (let e = r + 1; e <= n; e++) i = Xn(i, t[e]);
3720
+ for (let e = r + 1; e <= n; e++) i = Zn(i, t[e]);
3707
3721
  return i;
3708
3722
  }
3709
- function Xn(e, t) {
3723
+ function Zn(e, t) {
3710
3724
  return {
3711
3725
  time: e.time,
3712
3726
  open: e.open,
@@ -3724,26 +3738,26 @@ function q(e, t) {
3724
3738
  }
3725
3739
  //#endregion
3726
3740
  //#region src/io/parseOHLCV.ts
3727
- var Zn = [
3741
+ var Qn = [
3728
3742
  "time",
3729
3743
  "timestamp",
3730
3744
  "date",
3731
3745
  "datetime",
3732
3746
  "t"
3733
- ], Qn = ["open", "o"], $n = ["high", "h"], er = ["low", "l"], tr = ["close", "c"], nr = [
3747
+ ], $n = ["open", "o"], er = ["high", "h"], tr = ["low", "l"], nr = ["close", "c"], rr = [
3734
3748
  "volume",
3735
3749
  "vol",
3736
3750
  "v"
3737
3751
  ];
3738
- function rr(e) {
3752
+ function ir(e) {
3739
3753
  let t = e.trim();
3740
- return t ? t[0] === "[" || t[0] === "{" ? ir(t) : ar(t) : {
3754
+ return t ? t[0] === "[" || t[0] === "{" ? ar(t) : or(t) : {
3741
3755
  data: [],
3742
3756
  rowCount: 0,
3743
3757
  skipped: 0
3744
3758
  };
3745
3759
  }
3746
- function ir(e) {
3760
+ function ar(e) {
3747
3761
  let t;
3748
3762
  try {
3749
3763
  t = JSON.parse(e);
@@ -3753,19 +3767,19 @@ function ir(e) {
3753
3767
  if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
3754
3768
  let n = [], r = 0;
3755
3769
  for (let e of t) {
3756
- let t = Array.isArray(e) ? ur(e) : lr(e);
3770
+ let t = Array.isArray(e) ? dr(e) : ur(e);
3757
3771
  t ? n.push(t) : r++;
3758
3772
  }
3759
- return dr(n, t.length, r);
3773
+ return fr(n, t.length, r);
3760
3774
  }
3761
- function ar(e) {
3775
+ function or(e) {
3762
3776
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
3763
3777
  if (t.length === 0) return {
3764
3778
  data: [],
3765
3779
  rowCount: 0,
3766
3780
  skipped: 0
3767
3781
  };
3768
- let n = or(t[0]), r = sr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? cr(r) : {
3782
+ let n = sr(t[0]), r = cr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? lr(r) : {
3769
3783
  time: 0,
3770
3784
  open: 1,
3771
3785
  high: 2,
@@ -3776,7 +3790,7 @@ function ar(e) {
3776
3790
  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");
3777
3791
  let o = [], s = 0;
3778
3792
  for (let e = +!!i; e < t.length; e++) {
3779
- let r = sr(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
3793
+ let r = cr(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
3780
3794
  if (i === null || ![
3781
3795
  c,
3782
3796
  l,
@@ -3795,9 +3809,9 @@ function ar(e) {
3795
3809
  volume: Number.isFinite(f) ? f : 0
3796
3810
  });
3797
3811
  }
3798
- return dr(o, t.length - +!!i, s);
3812
+ return fr(o, t.length - +!!i, s);
3799
3813
  }
3800
- function or(e) {
3814
+ function sr(e) {
3801
3815
  let t = {
3802
3816
  ",": 0,
3803
3817
  ";": 0,
@@ -3809,7 +3823,7 @@ function or(e) {
3809
3823
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
3810
3824
  return n;
3811
3825
  }
3812
- function sr(e, t) {
3826
+ function cr(e, t) {
3813
3827
  let n = [], r = "", i = !1;
3814
3828
  for (let a = 0; a < e.length; a++) {
3815
3829
  let o = e[a];
@@ -3817,25 +3831,25 @@ function sr(e, t) {
3817
3831
  }
3818
3832
  return n.push(r), n;
3819
3833
  }
3820
- function cr(e) {
3834
+ function lr(e) {
3821
3835
  let t = (t) => e.findIndex((e) => t.includes(e));
3822
3836
  return {
3823
- time: t(Zn),
3824
- open: t(Qn),
3825
- high: t($n),
3826
- low: t(er),
3827
- close: t(tr),
3828
- volume: t(nr)
3837
+ time: t(Qn),
3838
+ open: t($n),
3839
+ high: t(er),
3840
+ low: t(tr),
3841
+ close: t(nr),
3842
+ volume: t(rr)
3829
3843
  };
3830
3844
  }
3831
- function lr(e) {
3845
+ function ur(e) {
3832
3846
  let t = (t) => {
3833
3847
  for (let n of t) {
3834
3848
  if (e[n] !== void 0) return e[n];
3835
3849
  let t = n.toUpperCase();
3836
3850
  if (e[t] !== void 0) return e[t];
3837
3851
  }
3838
- }, n = Y(String(t(Zn) ?? "")), r = Number(t(Qn)), i = Number(t($n)), a = Number(t(er)), o = Number(t(tr)), s = Number(t(nr) ?? 0);
3852
+ }, n = Y(String(t(Qn) ?? "")), r = Number(t($n)), i = Number(t(er)), a = Number(t(tr)), o = Number(t(nr)), s = Number(t(rr) ?? 0);
3839
3853
  return n === null || ![
3840
3854
  r,
3841
3855
  i,
@@ -3850,7 +3864,7 @@ function lr(e) {
3850
3864
  volume: Number.isFinite(s) ? s : 0
3851
3865
  };
3852
3866
  }
3853
- function ur(e) {
3867
+ function dr(e) {
3854
3868
  if (e.length < 5) return null;
3855
3869
  let t = Y(String(e[0])), n = Number(e[1]), r = Number(e[2]), i = Number(e[3]), a = Number(e[4]), o = e.length >= 6 ? Number(e[5]) : 0;
3856
3870
  return t === null || ![
@@ -3878,7 +3892,7 @@ function Y(e) {
3878
3892
  let r = Date.parse(t);
3879
3893
  return Number.isFinite(r) ? r : null;
3880
3894
  }
3881
- function dr(e, t, n) {
3895
+ function fr(e, t, n) {
3882
3896
  e.sort((e, t) => e.time - t.time);
3883
3897
  let r = [];
3884
3898
  for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
@@ -3890,7 +3904,7 @@ function dr(e, t, n) {
3890
3904
  }
3891
3905
  //#endregion
3892
3906
  //#region src/io/DragDropImporter.ts
3893
- var fr = class {
3907
+ var pr = class {
3894
3908
  host;
3895
3909
  overlay = null;
3896
3910
  callbacks;
@@ -3923,7 +3937,7 @@ var fr = class {
3923
3937
  e.preventDefault(), this.depth = 0, this.hideOverlay();
3924
3938
  let t = e.dataTransfer?.files?.[0];
3925
3939
  if (t) try {
3926
- let e = rr(await t.text());
3940
+ let e = ir(await t.text());
3927
3941
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
3928
3942
  this.callbacks.onData(e.data, e, t);
3929
3943
  } catch (e) {
@@ -3967,7 +3981,7 @@ function Z(e) {
3967
3981
  };
3968
3982
  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;
3969
3983
  }
3970
- var pr = (e, t) => t.updatedAt - e.updatedAt;
3984
+ var mr = (e, t) => t.updatedAt - e.updatedAt;
3971
3985
  function Q(e) {
3972
3986
  if (typeof e != "object" || !e) return null;
3973
3987
  let t = e;
@@ -3980,17 +3994,17 @@ function Q(e) {
3980
3994
  kind: typeof t.kind == "string" ? t.kind : void 0
3981
3995
  });
3982
3996
  }
3983
- function mr(e) {
3997
+ function hr(e) {
3984
3998
  let t = Q(e), n = t ? e.content : void 0;
3985
3999
  return t && typeof n == "string" ? {
3986
4000
  ...t,
3987
4001
  content: n
3988
4002
  } : null;
3989
4003
  }
3990
- function hr(e = []) {
4004
+ function gr(e = []) {
3991
4005
  let t = new Map(e.map((e) => [e.id, { ...e }]));
3992
4006
  return {
3993
- list: () => [...t.values()].map(Z).sort(pr),
4007
+ list: () => [...t.values()].map(Z).sort(mr),
3994
4008
  load: (e) => {
3995
4009
  let n = t.get(e);
3996
4010
  return n ? { ...n } : null;
@@ -4003,7 +4017,7 @@ function hr(e = []) {
4003
4017
  }
4004
4018
  };
4005
4019
  }
4006
- function gr(e = "tcw:layouts:") {
4020
+ function _r(e = "tcw:layouts:") {
4007
4021
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
4008
4022
  let e;
4009
4023
  try {
@@ -4014,7 +4028,7 @@ function gr(e = "tcw:layouts:") {
4014
4028
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
4015
4029
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
4016
4030
  return {
4017
- list: () => r().sort(pr),
4031
+ list: () => r().sort(mr),
4018
4032
  load: (e) => {
4019
4033
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
4020
4034
  return t && i !== null ? {
@@ -4032,14 +4046,14 @@ function gr(e = "tcw:layouts:") {
4032
4046
  }
4033
4047
  //#endregion
4034
4048
  //#region src/state/LayoutSession.ts
4035
- var _r = 80;
4049
+ var vr = 80;
4036
4050
  function $(e) {
4037
4051
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
4038
4052
  }
4039
- function vr() {
4053
+ function yr() {
4040
4054
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4041
4055
  }
4042
- function yr(e) {
4056
+ function br(e) {
4043
4057
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
4044
4058
  return {
4045
4059
  id: t,
@@ -4050,7 +4064,7 @@ function yr(e) {
4050
4064
  ...o === void 0 ? {} : { kind: o }
4051
4065
  };
4052
4066
  }
4053
- var br = class {
4067
+ var xr = class {
4054
4068
  currentLayout = null;
4055
4069
  savedContent = null;
4056
4070
  dirty = !1;
@@ -4066,7 +4080,7 @@ var br = class {
4066
4080
  now;
4067
4081
  newId;
4068
4082
  constructor(e, t, n = {}) {
4069
- 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 ?? vr;
4083
+ 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 ?? yr;
4070
4084
  }
4071
4085
  current() {
4072
4086
  return this.currentLayout;
@@ -4096,7 +4110,7 @@ var br = class {
4096
4110
  }
4097
4111
  open(e) {
4098
4112
  return this.queue(async () => {
4099
- let t = mr(await this.storage.load(e));
4113
+ let t = hr(await this.storage.load(e));
4100
4114
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4101
4115
  this.cancelTimer(), this.applying++;
4102
4116
  try {
@@ -4106,13 +4120,13 @@ var br = class {
4106
4120
  } finally {
4107
4121
  this.applying--;
4108
4122
  }
4109
- return this.cancelTimer(), this.currentLayout = yr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4123
+ return this.cancelTimer(), this.currentLayout = br(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4110
4124
  });
4111
4125
  }
4112
4126
  rename(e, t) {
4113
4127
  let n = $(t);
4114
4128
  return n ? this.queue(async () => {
4115
- let t = mr(await this.storage.load(e));
4129
+ let t = hr(await this.storage.load(e));
4116
4130
  !t || t.id !== e || (await this.storage.save({
4117
4131
  ...t,
4118
4132
  name: n
@@ -4190,7 +4204,7 @@ var br = class {
4190
4204
  content: n.content
4191
4205
  };
4192
4206
  await this.storage.save(r);
4193
- let i = yr(r);
4207
+ let i = br(r);
4194
4208
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4195
4209
  }
4196
4210
  forget() {
@@ -4211,6 +4225,6 @@ var br = class {
4211
4225
  }
4212
4226
  };
4213
4227
  //#endregion
4214
- export { Jt as C, L as S, U as _, hr as a, rn as b, Fn as c, xn as d, bn as f, _n as g, gn as h, gr as i, On as l, yn as m, _r as n, fr as o, vn as p, $ as r, rr as s, br as t, Sn as u, cn as v, R as x, z as y };
4228
+ export { Xt as C, L as S, H as _, gr as a, an as b, In as c, Cn as d, Sn as f, yn as g, vn as h, _r as i, kn as l, xn as m, vr as n, pr as o, bn as p, $ as r, ir as s, xr as t, W as u, un as v, R as x, z as y };
4215
4229
 
4216
- //# sourceMappingURL=LayoutSession-Bwz14MjP.js.map
4230
+ //# sourceMappingURL=LayoutSession-DepARyHT.js.map