@tradecanvas/chart 1.25.0 → 1.26.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.
@@ -1,12 +1,12 @@
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, barTimeUnit as c, chartStyleValue as l, computePriceLimits as u, formatPrice as d, fractionTick as f, indicatorSource as p, isValidTimeZone as m, mergeBar as h, normalizeBarTime as g, parseIndicatorSource as _, priceFormatterFor as v, priceStepAt as ee, readChartStyleOverrides as y, readChartTypeOptions as b, readIndicatorPlotStyles as x, readPaneStyle as S, resolveChartTheme as te, sessionMinute as C, setLocale as ne, stepDecimals as re, tickBarCount as ie, timeframeToMs as ae, volumeColor as oe, zonedDateFormatter as se } from "@tradecanvas/commons";
2
- import { AlertDragHandler as ce, AlertManager as le, Animator as ue, AreaRenderer as de, AxisDragHandler as fe, BarCountdown as pe, BarRenderer as me, BaselineRenderer as he, CandlestickRenderer as ge, ChartLegend as _e, ChartStateManager as w, CompareRenderer as ve, CompareSymbolIndicator as ye, CorrelationCoefficientIndicator as be, CorrelationLogIndicator as xe, CrosshairHandler as Se, CrosshairTooltip as Ce, CurrentPriceLine as we, DEFAULT_SESSION_HOURS as Te, DataExporter as T, DepthHeatmapRenderer as Ee, DrawingManager as De, DrawingRenderer as Oe, EquivolumeRenderer as ke, EventBus as Ae, GridRenderer as je, HLCAreaRenderer as Me, HiLoRenderer as E, HollowCandleRenderer as Ne, IndicatorEngine as D, InteractionManager as Pe, KagiRenderer as Fe, KeyboardHandler as Ie, LineRenderer as Le, LineWithMarkersRenderer as Re, MarketProfileRenderer as ze, MeasureOverlay as Be, PanHandler as Ve, PaneResizeHandler as He, PeriodLevelsRenderer as Ue, PinnedTooltip as We, PivotMarkersRenderer as Ge, PointAndFigureRenderer as O, PriceAxis as k, PriceAxisAddButton as Ke, PriceLines as qe, RenderEngine as Je, RenkoRenderer as Ye, ReplayManager as Xe, Screenshot as A, SelectionBoxOverlay as Ze, SessionBreaks as Qe, SessionShading as $e, SignalMarkerManager as et, SpreadIndicator as tt, StepLineRenderer as nt, StreamManager as rt, SymbolSeriesStore as it, TimeAxis as at, TradeZoneManager as ot, TradingManager as st, TradingRenderer as ct, UndoRedoManager as lt, Viewport as ut, VolumeCandleRenderer as dt, VolumeProfileRenderer as ft, VolumeRenderer as pt, Watermark as mt, ZoomHandler as ht, barTimeStepMs as gt, findDominantSwing as _t, gpuContextsLeft as vt, isRegularSession as yt, loadWebGL as bt, mergeSessionHours as xt, priceToY as St, rangePresetStart as Ct, readAlertOptions as wt, registerBuiltInDrawingTools as Tt, registerBuiltInIndicators as j, servesTimeframe as M, sourceParam as N, timeToX as Et, timestampToBarIndex as P, toHeikinAshi as Dt, toKagi as Ot, toLineBreak as kt, toPointAndFigure as At, toRangeBars as jt, toRenko as Mt, whenGpuContextFree as Nt, withResampling as Pt, xToBarIndex as Ft, xToTime as F, yToPrice as It } 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, barTimeUnit as c, chartStyleValue as l, computePriceLimits as u, formatPrice as d, fractionTick as f, indicatorSource as p, isValidTimeZone as m, mergeBar as h, normalizeBarTime as g, padPriceRange as _, parseIndicatorSource as v, priceFormatterFor as ee, priceStepAt as te, readChartStyleOverrides as ne, readChartTypeOptions as y, readIndicatorPlotStyles as b, readPaneStyle as x, resolveChartTheme as re, sessionMinute as S, 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 ve, ChartLegend as ye, ChartStateManager as C, CompareRenderer as be, CompareSymbolIndicator as xe, CorrelationCoefficientIndicator as Se, CorrelationLogIndicator as Ce, CrosshairHandler as we, CrosshairTooltip as Te, CurrentPriceLine as Ee, DEFAULT_SESSION_HOURS as De, DataExporter as w, DepthHeatmapRenderer as Oe, DrawingManager as ke, DrawingRenderer as Ae, EquivolumeRenderer as je, EventBus as Me, GridRenderer as Ne, HLCAreaRenderer as Pe, HiLoRenderer as T, HollowCandleRenderer as Fe, IndicatorEngine as E, InteractionManager as Ie, KagiRenderer as Le, KeyboardHandler as Re, LineRenderer as ze, LineWithMarkersRenderer as Be, MarketProfileRenderer as Ve, MeasureOverlay as He, PanHandler as Ue, PaneResizeHandler as We, PeriodLevelsRenderer as Ge, PinnedTooltip as Ke, PivotMarkersRenderer as qe, PointAndFigureRenderer as D, PriceAxis as O, PriceAxisAddButton as Je, PriceLines as Ye, RenderEngine as Xe, RenkoRenderer as Ze, ReplayManager as Qe, Screenshot as k, 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, priceToY as wt, rangePresetStart as Tt, readAlertOptions as Et, registerBuiltInDrawingTools as Dt, registerBuiltInIndicators as A, servesTimeframe as j, sourceParam as M, timeToX as Ot, timestampToBarIndex as N, toHeikinAshi as kt, toKagi as At, toLineBreak as jt, toPointAndFigure as Mt, toRangeBars as Nt, toRenko as P, whenGpuContextFree as Pt, withResampling as Ft, xToBarIndex as It, xToTime as F, yToPrice as Lt } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
- var Lt = 864e5, Rt = 10;
5
- function zt(e, t) {
4
+ var Rt = 864e5, zt = 10;
5
+ function Bt(e, t) {
6
6
  let n = e?.timezone;
7
7
  if (!n || !m(n) || t.length < 2) return null;
8
8
  let r = (e?.sessions ?? []).flatMap((e) => {
9
- let t = C(e.start), n = C(e.end);
9
+ let t = S(e.start), n = S(e.end);
10
10
  return t === null || n === null ? [] : [{
11
11
  startMinute: t,
12
12
  endMinute: n
@@ -14,34 +14,34 @@ function zt(e, t) {
14
14
  });
15
15
  if (r.length === 0) return null;
16
16
  let i = c(t), a = Infinity;
17
- for (let e = Math.max(1, t.length - Rt); e < t.length; e++) {
17
+ for (let e = Math.max(1, t.length - zt); e < t.length; e++) {
18
18
  let n = (t[e].time - t[e - 1].time) * i;
19
19
  n > 0 && n < a && (a = n);
20
20
  }
21
- if (!(a < Lt)) return null;
21
+ if (!(a < Rt)) return null;
22
22
  let o = {
23
23
  timeZone: n,
24
24
  windows: r,
25
25
  startMinute: r[0].startMinute,
26
26
  endMinute: r[r.length - 1].endMinute
27
27
  };
28
- return (e) => yt(e * i, o);
28
+ return (e) => xt(e * i, o);
29
29
  }
30
30
  //#endregion
31
31
  //#region src/chartA11y.ts
32
- var Bt = {
32
+ var Vt = {
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
- }, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Vt = [
39
+ }, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Ht = [
40
40
  "role",
41
41
  "aria-roledescription",
42
42
  "aria-label",
43
43
  "aria-describedby"
44
- ], Ht = 400, Ut = 1e3, Wt = class {
44
+ ], Ut = 400, Wt = 1e3, Gt = class {
45
45
  live;
46
46
  help;
47
47
  labels;
@@ -55,20 +55,20 @@ var Bt = {
55
55
  };
56
56
  constructor(e, t, n = {}) {
57
57
  this.container = e, this.source = t, this.labels = {
58
- ...Bt,
58
+ ...Vt,
59
59
  ...n
60
60
  };
61
- for (let t of Vt) this.before.set(t, e.getAttribute(t));
62
- e.setAttribute("role", "application"), this.help = Gt("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 = Gt("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 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();
63
63
  }
64
64
  setLabels(e) {
65
65
  this.labels = {
66
- ...Bt,
66
+ ...Vt,
67
67
  ...e
68
68
  }, this.applyLabels();
69
69
  }
70
70
  refresh(e = !1) {
71
- let t = Ut - (Date.now() - this.summaryAt);
71
+ let t = Wt - (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 Bt = {
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
- }, Ht);
83
+ }, Ut);
84
84
  }
85
85
  readBar(e) {
86
86
  let t = this.source.bars();
@@ -99,7 +99,7 @@ var Bt = {
99
99
  high: a(i.high),
100
100
  low: a(i.low),
101
101
  close: a(i.close),
102
- volume: Kt(i.volume ?? 0)
102
+ volume: qt(i.volume ?? 0)
103
103
  }));
104
104
  }
105
105
  destroy() {
@@ -140,7 +140,7 @@ var Bt = {
140
140
  this.live.textContent = e;
141
141
  }
142
142
  };
143
- function Gt(e, t) {
143
+ function Kt(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 Gt(e, t) {
154
154
  border: "0"
155
155
  }), n;
156
156
  }
157
- function Kt(e) {
157
+ function qt(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 qt(e, t, n, r) {
162
+ function Jt(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 qt(e, t, n, r) {
169
169
  }
170
170
  //#endregion
171
171
  //#region src/charts/ChartTypeStrategy.ts
172
- function Jt(e) {
172
+ function Yt(e) {
173
173
  switch (e) {
174
174
  case "candlestick":
175
175
  case "heikinAshi":
176
176
  case "lineBreak":
177
- case "rangeBars": return new ge();
178
- case "line": return new Le();
179
- case "area": return new de();
180
- case "bar": return new me();
181
- case "hollowCandle": return new Ne();
182
- case "baseline": return new he();
183
- case "renko": return new Ye();
184
- case "kagi": return new Fe();
185
- case "pointAndFigure": return new O();
186
- case "volumeCandles": return new dt();
187
- case "equivolume": return new ke();
188
- case "hlcArea": return new Me();
189
- case "stepLine": return new nt();
190
- case "lineWithMarkers": return new Re();
191
- case "hiLo": return new E();
192
- default: return new ge();
177
+ case "rangeBars": return new ve();
178
+ case "line": return new ze();
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 Ze();
184
+ case "kagi": return new Le();
185
+ case "pointAndFigure": return new D();
186
+ case "volumeCandles": return new pt();
187
+ case "equivolume": return new je();
188
+ case "hlcArea": return new Pe();
189
+ case "stepLine": return new it();
190
+ case "lineWithMarkers": return new Be();
191
+ case "hiLo": return new T();
192
+ default: return new ve();
193
193
  }
194
194
  }
195
- function Yt(e, t, n = {}) {
195
+ function Xt(e, t, n = {}) {
196
196
  if (t.length === 0) return t;
197
197
  switch (e) {
198
- case "heikinAshi": return Dt(t);
198
+ case "heikinAshi": return kt(t);
199
199
  case "renko": {
200
200
  let e = n.renko?.boxSize;
201
- return typeof e == "number" ? Mt(t, { brickSize: e }) : Mt(t, {
201
+ return typeof e == "number" ? P(t, { brickSize: e }) : P(t, {
202
202
  brickSize: 0,
203
203
  useATR: !0,
204
204
  atrPeriod: n.renko?.atrPeriod ?? 14
205
205
  });
206
206
  }
207
- case "lineBreak": return kt(t, n.lineBreak?.lines ?? 3);
208
- case "kagi": return Ot(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
- case "pointAndFigure": return At(t, Zt(t, n), n.pointAndFigure?.reversal ?? 3);
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);
210
210
  case "rangeBars": {
211
211
  let e = n.rangeBars?.range;
212
- return jt(t, { rangeSize: typeof e == "number" ? e : Qt(t) * .005 });
212
+ return Nt(t, { rangeSize: typeof e == "number" ? e : $t(t) * .005 });
213
213
  }
214
214
  default: return t;
215
215
  }
216
216
  }
217
- function Xt(e) {
217
+ function Zt(e) {
218
218
  switch (e) {
219
219
  case "heikinAshi":
220
220
  case "renko":
@@ -226,29 +226,29 @@ function Xt(e) {
226
226
  }
227
227
  }
228
228
  function L(e) {
229
- return e !== "heikinAshi" && Xt(e);
229
+ return e !== "heikinAshi" && Zt(e);
230
230
  }
231
- function Zt(e, t = {}) {
231
+ function Qt(e, t = {}) {
232
232
  let n = t.pointAndFigure?.boxSize;
233
- return typeof n == "number" ? n : Qt(e) * .01;
233
+ return typeof n == "number" ? n : $t(e) * .01;
234
234
  }
235
- function Qt(e) {
235
+ function $t(e) {
236
236
  let t = 0;
237
237
  for (let n of e) t += n.close;
238
238
  return t / e.length;
239
239
  }
240
- function $t(e, t) {
240
+ function en(e, t) {
241
241
  let n = t?.(e);
242
- return n ? n.createRenderer() : Jt(e);
242
+ return n ? n.createRenderer() : Yt(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) : Yt(e, t, r);
247
+ return i?.transform ? i.transform(t) : Xt(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;
@@ -283,7 +283,7 @@ function R(e) {
283
283
  let { open: t, high: n, low: r, close: i } = e;
284
284
  return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
285
285
  }
286
- function nn(e) {
286
+ function rn(e) {
287
287
  return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
288
288
  }
289
289
  function z(e) {
@@ -315,7 +315,7 @@ var B = class {
315
315
  let t = [];
316
316
  for (let n = 0; n < e.length; n++) {
317
317
  let r = e[n];
318
- R(r) && t.push(nn(r) ? r : z(r));
318
+ R(r) && t.push(rn(r) ? r : z(r));
319
319
  }
320
320
  this.data = t;
321
321
  }
@@ -324,7 +324,7 @@ var B = class {
324
324
  for (let r = 0; r < e.length; r++) {
325
325
  if (!R(e[r])) continue;
326
326
  let i = this.withSeriesTime(e[r]);
327
- i.time >= t || n.push(nn(i) ? i : z(i));
327
+ i.time >= t || n.push(rn(i) ? i : z(i));
328
328
  }
329
329
  if (n.length === 0) return 0;
330
330
  n.sort((e, t) => e.time - t.time);
@@ -353,7 +353,7 @@ var B = class {
353
353
  clear() {
354
354
  this.data = [];
355
355
  }
356
- }, rn = 5e3, an = 6e4, on = 500, sn = class {
356
+ }, an = 5e3, on = 6e4, sn = 500, cn = class {
357
357
  loader = null;
358
358
  pageSize = 500;
359
359
  loading = !1;
@@ -394,7 +394,7 @@ var B = class {
394
394
  try {
395
395
  r = await e(t, this.pageSize);
396
396
  } catch (e) {
397
- return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(an, rn * 2 ** (this.failures - 1)), this.emit({
397
+ return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(on, an * 2 ** (this.failures - 1)), this.emit({
398
398
  state: "error",
399
399
  count: 0,
400
400
  error: e instanceof Error ? e.message : String(e)
@@ -424,7 +424,7 @@ var B = class {
424
424
  now() {
425
425
  return this.host.now ? this.host.now() : Date.now();
426
426
  }
427
- }, cn = class t {
427
+ }, ln = class t {
428
428
  base;
429
429
  shape = null;
430
430
  chartType = "candlestick";
@@ -441,7 +441,7 @@ var B = class {
441
441
  return i;
442
442
  }
443
443
  getTheme() {
444
- return this.effective ??= te(this.base, this.chartType, this.merged()), this.effective;
444
+ return this.effective ??= re(this.base, this.chartType, this.merged()), this.effective;
445
445
  }
446
446
  getBaseTheme() {
447
447
  return this.base;
@@ -510,7 +510,7 @@ var B = class {
510
510
  };
511
511
  //#endregion
512
512
  //#region src/style/styleOptions.ts
513
- function ln(e, t) {
513
+ function un(e, t) {
514
514
  return t ? {
515
515
  ...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
516
516
  ...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
@@ -518,22 +518,22 @@ function ln(e, t) {
518
518
  ...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
519
519
  } : {};
520
520
  }
521
- function un(e) {
521
+ function dn(e) {
522
522
  let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
523
523
  return {
524
524
  ...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
525
525
  ...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
526
526
  ...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
527
527
  ...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
528
- ...ln("horizontal", n?.hLine),
529
- ...ln("vertical", n?.vLine),
528
+ ...un("horizontal", n?.hLine),
529
+ ...un("vertical", n?.vLine),
530
530
  ...r === void 0 ? {} : { "crosshair.labelBackground": r },
531
531
  ...e.overrides
532
532
  };
533
533
  }
534
534
  //#endregion
535
535
  //#region src/layout/LayoutManager.ts
536
- var dn = 200, fn = 80, V = (e) => e.position === "top" || e.position === "bottom", pn = class {
536
+ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom", mn = class {
537
537
  panels = [];
538
538
  containerWidth = 0;
539
539
  containerHeight = 0;
@@ -549,8 +549,8 @@ var dn = 200, fn = 80, V = (e) => e.position === "top" || e.position === "bottom
549
549
  this.panels.push({
550
550
  id: e,
551
551
  position: n,
552
- size: r ?? (a ? dn : t),
553
- minSize: a ? fn : i,
552
+ size: r ?? (a ? fn : t),
553
+ minSize: a ? pn : i,
554
554
  content: {
555
555
  type: "indicator",
556
556
  indicatorInstanceId: e
@@ -619,7 +619,7 @@ var dn = 200, fn = 80, V = (e) => e.position === "top" || e.position === "bottom
619
619
  let r = this.panels.find((t) => t.id === e);
620
620
  if (r) {
621
621
  let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
622
- r.position = n, a !== o && (r.size = o ? dn : t, r.minSize = o ? fn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
622
+ r.position = n, a !== o && (r.size = o ? fn : t, r.minSize = o ? pn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
623
623
  }
624
624
  }
625
625
  setPanelSize(e, t) {
@@ -735,8 +735,8 @@ var dn = 200, fn = 80, V = (e) => e.position === "top" || e.position === "bottom
735
735
  getMainChartRect() {
736
736
  return this.resolve().mainChartRect;
737
737
  }
738
- }, mn = 14, hn = 14, gn = 22, _n = 4;
739
- function vn(e) {
738
+ }, hn = 14, gn = 14, _n = 22, vn = 4;
739
+ function yn(e) {
740
740
  let { min: t, max: n, lastPrice: r, locale: i, fontFamily: o, fontSizeSmall: c, measure: l } = e, u = e.tagPrecision ?? s(t, n), f = u, p = r === null ? [t, n] : [
741
741
  t,
742
742
  n,
@@ -745,14 +745,14 @@ function vn(e) {
745
745
  for (let t of p) {
746
746
  if (!Number.isFinite(t)) continue;
747
747
  let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : d(t, u, i), r = e.format ? n : d(t, f, i);
748
- m = Math.max(m, l(n, `500 ${c}px ${o}`) + mn, l(r, `bold 11px ${o}`) + hn, l(r, `600 ${c}px ${o}`) + gn);
748
+ m = Math.max(m, l(n, `500 ${c}px ${o}`) + hn, l(r, `bold 11px ${o}`) + gn, l(r, `600 ${c}px ${o}`) + _n);
749
749
  }
750
- return m <= a ? a : Math.ceil(m / _n) * _n;
750
+ return m <= a ? a : Math.ceil(m / vn) * vn;
751
751
  }
752
- function yn(e, t) {
752
+ function bn(e, t) {
753
753
  return t > e || t <= e - 12 ? t : e;
754
754
  }
755
- var bn = class {
755
+ var xn = class {
756
756
  netY = 0;
757
757
  travelX = 0;
758
758
  engaged = !1;
@@ -768,8 +768,8 @@ var bn = class {
768
768
  }
769
769
  return this.engaged;
770
770
  }
771
- }, xn = 1;
772
- function Sn(e, t) {
771
+ }, Sn = 1;
772
+ function Cn(e, t) {
773
773
  return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
774
774
  }
775
775
  function H(e) {
@@ -783,24 +783,24 @@ function H(e) {
783
783
  //#endregion
784
784
  //#region src/plugins/registry.ts
785
785
  var U = /* @__PURE__ */ new Map();
786
- function Cn(e) {
786
+ function wn(e) {
787
787
  U.set(H(e), e);
788
788
  }
789
- function wn(e) {
789
+ function Tn(e) {
790
790
  return U.delete(e);
791
791
  }
792
- function Tn() {
792
+ function En() {
793
793
  return [...U.values()];
794
794
  }
795
- function En() {
795
+ function Dn() {
796
796
  U.clear();
797
797
  }
798
798
  //#endregion
799
799
  //#region src/plugins/PluginManager.ts
800
- var Dn = class {
800
+ var On = class {
801
801
  plugins = /* @__PURE__ */ new Map();
802
802
  constructor(e, t = {}) {
803
- if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Tn()) this.add(e);
803
+ if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of En()) this.add(e);
804
804
  for (let e of t.plugins ?? []) this.add(e);
805
805
  }
806
806
  register(e) {
@@ -830,15 +830,15 @@ var Dn = class {
830
830
  add(e) {
831
831
  this.plugins.set(H(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
832
832
  }
833
- }, On = {
833
+ }, kn = {
834
834
  orderPlace: (e, t) => e.placeOrder(t),
835
835
  orderModify: (e, t) => e.modifyOrder(t),
836
836
  orderCancel: (e, t) => e.cancelOrder(t),
837
837
  positionModify: (e, t) => e.modifyPosition(t),
838
838
  positionClose: (e, t) => e.closePosition(t),
839
- positionReverse: (e, t, n) => kn(e, t, n)
839
+ positionReverse: (e, t, n) => An(e, t, n)
840
840
  };
841
- async function kn(e, t, n) {
841
+ async function An(e, t, n) {
842
842
  let { reversing: r } = n;
843
843
  if (!r.has(t.positionId)) {
844
844
  r.add(t.positionId);
@@ -867,7 +867,7 @@ async function kn(e, t, n) {
867
867
  }
868
868
  }
869
869
  }
870
- function An(e, t) {
870
+ function jn(e, t) {
871
871
  let n = [], r = null, i = {
872
872
  positions: () => r ?? t.getPositions?.() ?? [],
873
873
  reversing: /* @__PURE__ */ new Set()
@@ -877,8 +877,8 @@ function An(e, t) {
877
877
  e.data && t.onFill?.(e.data);
878
878
  };
879
879
  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));
880
- for (let r of Object.keys(On)) {
881
- let a = On[r], o = t.onIntent(r, (n) => {
880
+ for (let r of Object.keys(kn)) {
881
+ let a = kn[r], o = t.onIntent(r, (n) => {
882
882
  Promise.resolve(a(e, n, i)).catch((e) => t.onError({
883
883
  message: `Execution command failed: ${r}`,
884
884
  cause: e
@@ -892,16 +892,16 @@ function An(e, t) {
892
892
  }
893
893
  //#endregion
894
894
  //#region src/Chart.ts
895
- var jn = {
895
+ var Mn = {
896
896
  min: 0,
897
897
  max: 100
898
- }, Mn = "exchange";
899
- function Nn(e) {
898
+ }, Nn = "exchange";
899
+ function Pn(e) {
900
900
  if (typeof e == "string" && e !== "exchange" && !m(e)) throw RangeError(`Unknown time zone: ${e}`);
901
901
  if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
902
902
  }
903
- var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine", "crossLine"]), Bn = new Set(["verticalLine", "crossLine"]), Vn = class {
904
- static version = "1.25.0";
903
+ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine", "crossLine"]), Vn = new Set(["verticalLine", "crossLine"]), Hn = class {
904
+ static version = "1.26.0";
905
905
  engine;
906
906
  viewport;
907
907
  dataManager;
@@ -939,14 +939,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
939
939
  indicatorHistoryDepth = 0;
940
940
  removedDrawingAlerts = /* @__PURE__ */ new Map();
941
941
  zoomAreaMode = !1;
942
- priceAxisAddButton = new Ke();
942
+ priceAxisAddButton = new Je();
943
943
  displayTz = null;
944
944
  timezoneSetting = null;
945
945
  symbolInfo = null;
946
946
  symbolInfoSeq = 0;
947
947
  sessionBreaks;
948
948
  sessionShading;
949
- hostSessionHours = { ...Te };
949
+ hostSessionHours = { ...De };
950
950
  compareRenderer;
951
951
  countdownInterval = null;
952
952
  volumeRenderer;
@@ -959,7 +959,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
959
959
  signalMarkerManager;
960
960
  tradeZoneManager;
961
961
  measureOverlay;
962
- selectionBoxOverlay = new Ze();
962
+ selectionBoxOverlay = new $e();
963
963
  replayManager;
964
964
  replayBarUnsub = null;
965
965
  replaySeeking = !1;
@@ -969,7 +969,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
969
969
  replayRevealMarks = !0;
970
970
  replayOffset = 0;
971
971
  undoRedoManager;
972
- autoSaveScheduler = new tn((e) => this.saveState(e));
972
+ autoSaveScheduler = new nn((e) => this.saveState(e));
973
973
  animator;
974
974
  crosshairTooltip;
975
975
  pinnedTooltip;
@@ -981,15 +981,15 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
981
981
  disposed = !1;
982
982
  chartTypeOptions = {};
983
983
  mainSeriesVisible = !0;
984
- priceLines = new qe();
985
- symbolSeries = new it();
984
+ priceLines = new Ye();
985
+ symbolSeries = new ot();
986
986
  extendedHours = !0;
987
987
  replayRestarting = !1;
988
988
  fullSeries = null;
989
989
  requestedSymbols = /* @__PURE__ */ new Set();
990
990
  gridRenderer;
991
991
  priceAxis;
992
- leftPriceAxis = new k();
992
+ leftPriceAxis = new O();
993
993
  leftScaleRequested = !1;
994
994
  leftAxisWidth = a;
995
995
  leftViewport = null;
@@ -1020,7 +1020,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1020
1020
  snapshotKey = null;
1021
1021
  historyCheckQueued = !1;
1022
1022
  constructor(e, t) {
1023
- t.timeZone != null && Nn(t.timeZone), this.container = e, this.options = {
1023
+ t.timeZone != null && Pn(t.timeZone), this.container = e, this.options = {
1024
1024
  ...t,
1025
1025
  chartType: t.chartType ?? "candlestick"
1026
1026
  }, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
@@ -1058,15 +1058,15 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1058
1058
  logScale: n.logScale ?? !0,
1059
1059
  timeframes: n.timeframes ?? [],
1060
1060
  defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
1061
- }, 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 B(), this.history = new sn({
1061
+ }, 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 B(), this.history = new cn({
1062
1062
  oldestTime: () => this.dataManager.getData()[0]?.time ?? null,
1063
1063
  prepend: (e) => this.prependBars(e),
1064
1064
  emit: (e) => this.eventBus.emit("historyLoad", e)
1065
- }), this.themeManager = new cn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(un(t), "host", !1), this.layoutManager = new pn(), this.indicatorEngine = new D(), this.pluginManager = new Dn(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ae(), j(this.indicatorEngine), this.indicatorEngine.register(new ye(this.symbolSeries)), this.indicatorEngine.register(new tt(this.symbolSeries)), this.indicatorEngine.register(new be(this.symbolSeries)), this.indicatorEngine.register(new xe(this.symbolSeries)), this.drawingManager = new De(), Tt(this.drawingManager), this.drawingRenderer = new Oe(this.drawingManager), this.drawingManager.setRequestRender(() => {
1065
+ }), this.themeManager = new ln(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(dn(t), "host", !1), this.layoutManager = new mn(), this.indicatorEngine = new E(), this.pluginManager = new On(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Me(), A(this.indicatorEngine), this.indicatorEngine.register(new xe(this.symbolSeries)), this.indicatorEngine.register(new rt(this.symbolSeries)), this.indicatorEngine.register(new Se(this.symbolSeries)), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.drawingManager = new ke(), Dt(this.drawingManager), this.drawingRenderer = new Ae(this.drawingManager), this.drawingManager.setRequestRender(() => {
1066
1066
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1067
1067
  }), this.drawingManager.setEventCallback((e, t) => {
1068
1068
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1069
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new lt();
1069
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new dt();
1070
1070
  let i = "";
1071
1071
  this.undoRedoManager.setOnChange(() => {
1072
1072
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1079,21 +1079,21 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1079
1079
  primary: e[0] ?? null
1080
1080
  })), this.drawingManager.setForeignHistory((e, t) => {
1081
1081
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
1082
- }), 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 st({
1082
+ }), 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({
1083
1083
  enabled: this.features.trading,
1084
1084
  contextMenu: { enabled: this.features.tradingContextMenu }
1085
- }), this.tradingRenderer = new ct(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1085
+ }), this.tradingRenderer = new ut(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1086
1086
  this.eventBus.emit(e, t);
1087
- }), this.engine = new Je(e);
1087
+ }), this.engine = new Xe(e);
1088
1088
  let a = this.engine.dprManager.getContainerSize();
1089
- if (this.viewport = new ut(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1089
+ if (this.viewport = new ft(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1090
1090
  freePan: t.freePan ?? !0,
1091
1091
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1092
1092
  }), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1093
1093
  if (e.width <= 0 || e.height <= 0) return;
1094
1094
  let t = this.viewport.isAtEnd();
1095
1095
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
1096
- }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new je(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new k(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new at(), this.crosshairHandler = new Se(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
1096
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ne(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new O(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new st(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new we(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
1097
1097
  if (e !== null && t) {
1098
1098
  let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0;
1099
1099
  this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null);
@@ -1102,7 +1102,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1102
1102
  prevClose: e > 0 ? n[e - 1]?.close : void 0,
1103
1103
  priceRange: i.priceRange,
1104
1104
  plot: i.chartRect,
1105
- barStepMs: gt(n),
1105
+ barStepMs: vt(n),
1106
1106
  timeUnit: c(n)
1107
1107
  }) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
1108
1108
  point: t,
@@ -1110,12 +1110,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1110
1110
  barIndex: e
1111
1111
  });
1112
1112
  } else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
1113
- }), this.chartLegend = new _e(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new mt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new pt(), this.volumeProfile = new ft(), this.marketProfile = new ze(), this.depthHeatmap = new Ee(), this.periodLevels = new Ue(), this.pivotMarkers = new Ge(), this.barCountdown = new pe(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new Qe(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new $e(), this.compareRenderer = new ve(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1113
+ }), this.chartLegend = new ye(), 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 Ve(), this.depthHeatmap = new Oe(), this.periodLevels = new Ge(), this.pivotMarkers = new qe(), this.barCountdown = new he(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new et(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new tt(), this.compareRenderer = new be(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1114
1114
  visible: t.sessionBreaks.visible ?? !0,
1115
1115
  color: t.sessionBreaks.color,
1116
1116
  lineStyle: t.sessionBreaks.lineStyle,
1117
1117
  lineWidth: t.sessionBreaks.lineWidth
1118
- }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new ue(), this.crosshairTooltip = new Ce(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new We(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = b(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Wn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Ie({
1118
+ }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new fe(), this.crosshairTooltip = new Te(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Ke(), 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(Gn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Re({
1119
1119
  scrollBars: (e) => {
1120
1120
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1121
1121
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1132,14 +1132,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1132
1132
  },
1133
1133
  fitContent: () => this.fitContent()
1134
1134
  }), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
1135
- this.a11y = new Wt(e, {
1135
+ this.a11y = new Gt(e, {
1136
1136
  symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
1137
1137
  timeframe: () => this.streamTimeframe ?? "",
1138
1138
  chartType: () => this.options.chartType ?? "candlestick",
1139
1139
  bars: () => this.getDisplayData(),
1140
1140
  visibleRange: () => this.viewport.getState().visibleRange,
1141
1141
  formatPrice: (e) => this.formatPrice(e),
1142
- formatTime: (e) => se(this.numberLocale || "en-US", {
1142
+ formatTime: (e) => le(this.numberLocale || "en-US", {
1143
1143
  dateStyle: "medium",
1144
1144
  timeStyle: "short"
1145
1145
  }, this.displayTz)(e * c(this.getDisplayData())),
@@ -1162,7 +1162,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1162
1162
  }
1163
1163
  this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
1164
1164
  }
1165
- }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new we(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new le(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1165
+ }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ee(), 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) => {
1166
1166
  this.eventBus.emit("alertTriggered", G(e)), this.eventBus.emit("dataUpdate", {
1167
1167
  alert: "triggered",
1168
1168
  alertId: e.id,
@@ -1177,7 +1177,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1177
1177
  this.eventBus.emit("alertExpired", G(e));
1178
1178
  }), this.alertManager.on("updated", (e) => {
1179
1179
  this.eventBus.emit("alertUpdate", G(e));
1180
- }), this.signalMarkerManager = new et(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1180
+ }), this.signalMarkerManager = new nt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1181
1181
  this.eventBus.emit("signalMarkerAdd", {
1182
1182
  id: e.id,
1183
1183
  source: e.source,
@@ -1185,14 +1185,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1185
1185
  });
1186
1186
  }), this.signalMarkerManager.on("removed", (e) => {
1187
1187
  this.eventBus.emit("signalMarkerRemove", { id: e });
1188
- }), this.tradeZoneManager = new ot(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1188
+ }), this.tradeZoneManager = new ct(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1189
1189
  this.eventBus.emit("tradeZoneAdd", {
1190
1190
  id: e.id,
1191
1191
  direction: e.direction
1192
1192
  });
1193
1193
  }), this.tradeZoneManager.on("removed", (e) => {
1194
1194
  this.eventBus.emit("tradeZoneRemove", { id: e });
1195
- }), this.replayManager = new Xe(), this.replayManager.on("complete", () => {
1195
+ }), this.replayManager = new Qe(), this.replayManager.on("complete", () => {
1196
1196
  let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1197
1197
  t && this.eventBus.emit("replayComplete", {
1198
1198
  barIndex: e,
@@ -1200,9 +1200,9 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1200
1200
  });
1201
1201
  }), this.replayManager.on("stateChange", (e) => {
1202
1202
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1203
- }), this.measureOverlay = new Be(), this.interactionManager = new Pe(e), this.features.panning) {
1204
- let e = new bn();
1205
- this.interactionManager.setPanHandler(new Ve((t, n) => {
1203
+ }), this.measureOverlay = new He(), this.interactionManager = new Ie(e), this.features.panning) {
1204
+ let e = new xn();
1205
+ this.interactionManager.setPanHandler(new Ue((t, n) => {
1206
1206
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.options.autoScale = !1, this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1207
1207
  }, () => e.reset()));
1208
1208
  }
@@ -1214,10 +1214,10 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1214
1214
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1215
1215
  }
1216
1216
  })), this.features.zooming) {
1217
- this.interactionManager.setZoomHandler(new ht((e, t) => {
1217
+ this.interactionManager.setZoomHandler(new _t((e, t) => {
1218
1218
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1219
1219
  }));
1220
- let e = new fe((e) => {
1220
+ let e = new me((e) => {
1221
1221
  this.options.autoScale = !1, this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
1222
1222
  }, (e) => {
1223
1223
  let t = this.viewport.getState().chartRect.width;
@@ -1237,7 +1237,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1237
1237
  y: t.y
1238
1238
  });
1239
1239
  })), 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) => {
1240
- let t = It(e.y, this.viewport.getState());
1240
+ let t = Lt(e.y, this.viewport.getState());
1241
1241
  Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
1242
1242
  price: t,
1243
1243
  x: e.x,
@@ -1247,10 +1247,10 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1247
1247
  ...this.viewport.getState(),
1248
1248
  data: this.getDisplayData()
1249
1249
  })), this.features.alerts) {
1250
- let e = new ce(this.alertManager, () => this.viewport.getState());
1250
+ let e = new ue(this.alertManager, () => this.viewport.getState());
1251
1251
  this.interactionManager.setAlertDragHandler(e);
1252
1252
  }
1253
- let o = new He();
1253
+ let o = new We();
1254
1254
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1255
1255
  let t = this.getDisplayData();
1256
1256
  if (t.length === 0) return;
@@ -1274,7 +1274,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1274
1274
  x: e.x,
1275
1275
  y: e.y
1276
1276
  }), t.length === 0) return;
1277
- let r = Ft(e.x, this.viewport.getState());
1277
+ let r = It(e.x, this.viewport.getState());
1278
1278
  r < 0 || r >= t.length || this.eventBus.emit("barClick", {
1279
1279
  bar: t[r],
1280
1280
  barIndex: r,
@@ -1314,7 +1314,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1314
1314
  end: () => {
1315
1315
  let e = this.selectionBoxOverlay.end();
1316
1316
  if (e && this.zoomAreaMode) {
1317
- if (e.x1 - e.x0 < Rn) return;
1317
+ if (e.x1 - e.x0 < zn) return;
1318
1318
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1319
1319
  return;
1320
1320
  }
@@ -1351,7 +1351,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1351
1351
  if (this.replaySession) return 0;
1352
1352
  let t = null;
1353
1353
  if (this.fullSeries) {
1354
- 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);
1354
+ let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => $n(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1355
1355
  this.fullSeries = [...i, ...this.fullSeries];
1356
1356
  let a = this.sessionKeep(this.fullSeries);
1357
1357
  t = i.length, e = a ? i.filter((e) => a(e.time)) : i;
@@ -1360,7 +1360,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1360
1360
  if (a === 0) return t ?? 0;
1361
1361
  let o = this.dataManager.getData();
1362
1362
  if (this.crosshairHandler.setData(o), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), i !== void 0) {
1363
- let e = Math.round(P(i, this.getDisplayData()));
1363
+ let e = Math.round(N(i, this.getDisplayData()));
1364
1364
  this.viewport.prependBars(e - r);
1365
1365
  }
1366
1366
  return this.updateViewportAndRender(), t ?? a;
@@ -1393,13 +1393,13 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1393
1393
  this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
1394
1394
  if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || L(this.options.chartType)) return;
1395
1395
  let { from: e, to: t } = this.viewport.getState().visibleRange;
1396
- this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Ln, t - e));
1396
+ this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Rn, t - e));
1397
1397
  }));
1398
1398
  }
1399
1399
  useStreamHistory(e, t) {
1400
1400
  if (this.hostHistoryLoader) return;
1401
- let n = Pt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1402
- if (!r || i === null || ie(i) !== null) {
1401
+ let n = Ft(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1402
+ if (!r || i === null || oe(i) !== null) {
1403
1403
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
1404
1404
  return;
1405
1405
  }
@@ -1471,11 +1471,11 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1471
1471
  setChartTypeOptions(e) {
1472
1472
  this.chartTypeOptions = {
1473
1473
  ...this.chartTypeOptions,
1474
- ...b(e)
1474
+ ...y(e)
1475
1475
  }, this.displayDataCache = null, this.updateViewportAndRender(!0), this.markStateChanged();
1476
1476
  }
1477
1477
  getChartTypeOptions() {
1478
- return b(this.chartTypeOptions);
1478
+ return y(this.chartTypeOptions);
1479
1479
  }
1480
1480
  setExtendedHours(e) {
1481
1481
  e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
@@ -1484,7 +1484,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1484
1484
  return this.extendedHours;
1485
1485
  }
1486
1486
  sessionKeep(e) {
1487
- return this.extendedHours ? null : zt(this.symbolInfo, e);
1487
+ return this.extendedHours ? null : Bt(this.symbolInfo, e);
1488
1488
  }
1489
1489
  shownBars(e) {
1490
1490
  let t = this.sessionKeep(e);
@@ -1525,7 +1525,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1525
1525
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
1526
1526
  }
1527
1527
  setShapes(e) {
1528
- let t = Wn(e);
1528
+ let t = Gn(e);
1529
1529
  t.tagRadius !== void 0 && (this.themeManager.setShape({
1530
1530
  ...this.themeManager.getTheme().shape,
1531
1531
  ...t
@@ -1597,14 +1597,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1597
1597
  this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
1598
1598
  }
1599
1599
  updateIndicatorNow(e, t) {
1600
- let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? N(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1600
+ let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? M(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1601
1601
  this.indicatorEngine.updateIndicator(e, t, this.dataManager.getData()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
1602
1602
  instanceId: e,
1603
1603
  change: "params"
1604
1604
  }), this.requestMissingSymbols(e);
1605
1605
  let a = this.indicatorEngine.getIndicatorConfig(e);
1606
1606
  if (n?.placement === "overlay" && a && r && a.params[r] !== i) {
1607
- let t = _(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : _(i) ? null : a.pane ?? null;
1607
+ let t = v(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : v(i) ? null : a.pane ?? null;
1608
1608
  (n ?? void 0) !== a.pane && (this.indicatorEngine.setPane(e, n), this.eventBus.emit("indicatorChange", {
1609
1609
  instanceId: e,
1610
1610
  change: "pane"
@@ -1615,7 +1615,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1615
1615
  paneFor(e, t, n, r) {
1616
1616
  if (n) return this.paneHostOf(n, r);
1617
1617
  if (e.placement !== "overlay") return null;
1618
- let i = N(e), a = i ? _(t[i]) : null;
1618
+ let i = M(e), a = i ? v(t[i]) : null;
1619
1619
  return a ? this.paneHostOf(a.instanceId, r) : null;
1620
1620
  }
1621
1621
  paneHostOf(e, t) {
@@ -1658,8 +1658,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1658
1658
  return {
1659
1659
  ...e,
1660
1660
  priceRange: {
1661
- min: t.min - n * Fn,
1662
- max: t.max + n * Fn
1661
+ min: t.min - n * In,
1662
+ max: t.max + n * In
1663
1663
  },
1664
1664
  logScale: !1,
1665
1665
  scaleMode: "regular",
@@ -1706,7 +1706,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1706
1706
  this.indicatorEngine.setStyleDefaults(e, null);
1707
1707
  return;
1708
1708
  }
1709
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : x(n);
1709
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : b(n);
1710
1710
  this.indicatorEngine.setStyleDefaults(e, {
1711
1711
  ...r,
1712
1712
  ...i ? { plots: i } : {}
@@ -1714,7 +1714,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1714
1714
  }
1715
1715
  setPaneStyle(e, t) {
1716
1716
  let n = this.paneOf(e);
1717
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? S(t) : null));
1717
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? x(t) : null));
1718
1718
  }
1719
1719
  setPaneStyleNow(e, t) {
1720
1720
  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());
@@ -1733,8 +1733,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1733
1733
  return this.pluginManager;
1734
1734
  }
1735
1735
  static indicators() {
1736
- let e = new D();
1737
- return j(e), e.getAvailableIndicators();
1736
+ let e = new E();
1737
+ return A(e), e.getAvailableIndicators();
1738
1738
  }
1739
1739
  setPanelPosition(e, t) {
1740
1740
  this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
@@ -1757,8 +1757,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1757
1757
  paneMoveHost(e, t) {
1758
1758
  let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
1759
1759
  if (!n || !r) return;
1760
- let i = N(r);
1761
- if (r.placement === "overlay" && i && _(n.params[i])) return;
1760
+ let i = M(r);
1761
+ if (r.placement === "overlay" && i && v(n.params[i])) return;
1762
1762
  if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
1763
1763
  if (t === "new") {
1764
1764
  let t = this.layoutManager.getPanels().some((t) => t.id === e);
@@ -1869,7 +1869,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1869
1869
  roundPrice(e) {
1870
1870
  if (!Number.isFinite(e)) return e;
1871
1871
  let t = this.stepAt(e);
1872
- if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(re(t)));
1872
+ if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ae(t)));
1873
1873
  let { min: n, max: r } = this.viewport.getState().priceRange;
1874
1874
  return Number(e.toFixed(this.marketPricePrecision ?? s(n, r)));
1875
1875
  }
@@ -1879,7 +1879,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1879
1879
  }
1880
1880
  stepAt(e) {
1881
1881
  let t = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
1882
- return t !== void 0 && t > 0 ? t : this.marketConfig ? ee(e, this.marketConfig) : void 0;
1882
+ return t !== void 0 && t > 0 ? t : this.marketConfig ? te(e, this.marketConfig) : void 0;
1883
1883
  }
1884
1884
  getPriceStep(e) {
1885
1885
  let t = this.stepAt(e ?? this.lastClose());
@@ -1894,7 +1894,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1894
1894
  return this.priceFormatter;
1895
1895
  }
1896
1896
  applyPriceFormat(e) {
1897
- this.priceFormatter = v(e), this.priceUnit = e && typeof e != "function" ? f(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
1897
+ this.priceFormatter = ee(e), this.priceUnit = e && typeof e != "function" ? f(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
1898
1898
  }
1899
1899
  setTimeFormatter(e) {
1900
1900
  this.applyTimeFormatter(e), this.engine.requestRender();
@@ -1950,7 +1950,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
1950
1950
  }
1951
1951
  autoFib() {
1952
1952
  if (!this.features.drawings) return null;
1953
- let e = this.getDisplayData(), t = this.viewport.getState(), n = _t(e, t.visibleRange.from, t.visibleRange.to);
1953
+ let e = this.getDisplayData(), t = this.viewport.getState(), n = yt(e, t.visibleRange.from, t.visibleRange.to);
1954
1954
  return n ? this.addDrawing({
1955
1955
  type: "fibRetracement",
1956
1956
  anchors: [n[0], n[1]]
@@ -2025,7 +2025,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2025
2025
  recordUndo(e) {
2026
2026
  if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
2027
2027
  let t = performance.now(), n = this.undoRedoManager.last();
2028
- if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < In) {
2028
+ if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Ln) {
2029
2029
  this.undoRedoManager.replaceLast({
2030
2030
  ...n,
2031
2031
  custom: {
@@ -2072,7 +2072,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2072
2072
  x: t.x,
2073
2073
  y: t.y
2074
2074
  };
2075
- if ((e === "plot" || e === "priceAxis") && (r.price = It(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
2075
+ if ((e === "plot" || e === "priceAxis") && (r.price = Lt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
2076
2076
  let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
2077
2077
  e && (r.pane = e.instanceId);
2078
2078
  }
@@ -2143,7 +2143,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2143
2143
  for (let e of this.indicatorEngine.getActiveIndicators()) {
2144
2144
  let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
2145
2145
  if (!t) continue;
2146
- let r = qt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2146
+ 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) => ({
2147
2147
  key: e,
2148
2148
  title: e
2149
2149
  }));
@@ -2167,11 +2167,11 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2167
2167
  }
2168
2168
  getExportText(e = "csv", t = {}) {
2169
2169
  let { bars: n, columns: r } = this.getExportData(t);
2170
- return e === "json" ? T.toJSON(n, r) : T.toCSV(n, r);
2170
+ return e === "json" ? w.toJSON(n, r) : w.toCSV(n, r);
2171
2171
  }
2172
2172
  download(e, t, n) {
2173
2173
  let r = this.getExportText(e, n);
2174
- e === "json" ? T.download(r, t ?? "chart-data.json", "application/json") : T.download(r, t ?? "chart-data.csv", "text/csv");
2174
+ e === "json" ? w.download(r, t ?? "chart-data.json", "application/json") : w.download(r, t ?? "chart-data.csv", "text/csv");
2175
2175
  }
2176
2176
  setAutoSave(e, t = 5e3) {
2177
2177
  this.autoSaveScheduler.enable(e, t);
@@ -2221,7 +2221,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2221
2221
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2222
2222
  }
2223
2223
  updateIndicatorStyleNow(e, t) {
2224
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : x(n);
2224
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : b(n);
2225
2225
  this.indicatorEngine.updateIndicatorStyle(e, {
2226
2226
  ...r,
2227
2227
  ...i ? { plots: i } : {}
@@ -2331,8 +2331,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2331
2331
  this.features.trading && this.tradingManager.setConfig(e);
2332
2332
  }
2333
2333
  async connect(e) {
2334
- if (!M(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2335
- this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new rt(), this.streamManager.on("snapshot", (t) => {
2334
+ if (!j(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2335
+ this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new at(), this.streamManager.on("snapshot", (t) => {
2336
2336
  let n = `${this.currentSymbol}|${this.streamTimeframe}`;
2337
2337
  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);
2338
2338
  }), this.streamManager.on("barClose", (e) => {
@@ -2381,14 +2381,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2381
2381
  }), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
2382
2382
  let t = this.streamManager;
2383
2383
  if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
2384
- let n = ae(e.timeframe);
2384
+ let n = se(e.timeframe);
2385
2385
  this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
2386
2386
  this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
2387
2387
  }, 1e3);
2388
2388
  }
2389
2389
  setStreamTarget(e, t) {
2390
2390
  let n = this.announcedSymbol, r = this.announcedTimeframe;
2391
- this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = ie(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2391
+ this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = oe(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2392
2392
  symbol: e,
2393
2393
  previous: n
2394
2394
  })), t !== r && (this.announcedTimeframe = t, this.eventBus.emit("timeframeChange", {
@@ -2399,8 +2399,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2399
2399
  async switchStream(e, t) {
2400
2400
  if (!this.streamManager) return;
2401
2401
  let n = this.streamAdapter;
2402
- if (n && !M(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2403
- this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(ae(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
2402
+ if (n && !j(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2403
+ 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);
2404
2404
  }
2405
2405
  isTimeframeAllowed(e) {
2406
2406
  let t = this.features.timeframes;
@@ -2415,7 +2415,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2415
2415
  }
2416
2416
  connectExecution(e, t = {}) {
2417
2417
  if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
2418
- this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = An(e, {
2418
+ this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = jn(e, {
2419
2419
  onIntent: (e, t) => {
2420
2420
  let n = (e) => t(e.payload);
2421
2421
  return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
@@ -2506,18 +2506,18 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2506
2506
  goToTime(e) {
2507
2507
  let t = this.getDisplayData();
2508
2508
  if (t.length === 0 || !Number.isFinite(e)) return -1;
2509
- let n = Math.max(0, Math.min(t.length - 1, Math.floor(P(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2509
+ let n = Math.max(0, Math.min(t.length - 1, Math.floor(N(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2510
2510
  return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
2511
2511
  }
2512
2512
  setVisibleRangePreset(e) {
2513
2513
  let t = this.getDisplayData();
2514
2514
  if (t.length === 0) return;
2515
- let n = t.length - 1, r = c(t), i = Ct(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2515
+ let n = t.length - 1, r = c(t), i = Tt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2516
2516
  if (a === null || a < t[0].time) {
2517
2517
  this.fitContent();
2518
2518
  return;
2519
2519
  }
2520
- let o = P(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2520
+ let o = N(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2521
2521
  this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
2522
2522
  }
2523
2523
  scrollToEnd() {
@@ -2531,7 +2531,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2531
2531
  setVisibleRange(e, t) {
2532
2532
  let n = this.getDisplayData();
2533
2533
  if (n.length === 0) return;
2534
- let r = P(Math.min(e, t), n), i = P(Math.max(e, t), n);
2534
+ let r = N(Math.min(e, t), n), i = N(Math.max(e, t), n);
2535
2535
  this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
2536
2536
  }
2537
2537
  setPanLimits(e) {
@@ -2574,7 +2574,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2574
2574
  this.applyStyle(e, t.layer ?? "host", !0);
2575
2575
  }
2576
2576
  setOverrides(e, t = {}) {
2577
- let n = t.layer ?? "host", { overrides: r, rejected: i } = y(e);
2577
+ let n = t.layer ?? "host", { overrides: r, rejected: i } = ne(e);
2578
2578
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
2579
2579
  let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
2580
2580
  this.themeManager.setOverrides(a, n) && this.styleChanged(n);
@@ -2593,7 +2593,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2593
2593
  return this.themeManager.getStyleValue(e);
2594
2594
  }
2595
2595
  applyStyle(e, t, n) {
2596
- let { overrides: r, rejected: i } = y(e);
2596
+ let { overrides: r, rejected: i } = ne(e);
2597
2597
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
2598
2598
  }
2599
2599
  styleChanged(e) {
@@ -2623,7 +2623,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2623
2623
  e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
2624
2624
  }
2625
2625
  setCrosshairTime(e) {
2626
- let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(P(e, t));
2626
+ let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(N(e, t));
2627
2627
  n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
2628
2628
  }
2629
2629
  getData() {
@@ -2685,7 +2685,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2685
2685
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2686
2686
  }
2687
2687
  setTimezone(e) {
2688
- Nn(e), this.timezoneSetting = e, this.applyTimezone();
2688
+ Pn(e), this.timezoneSetting = e, this.applyTimezone();
2689
2689
  }
2690
2690
  getTimezone() {
2691
2691
  return this.timezoneSetting;
@@ -2703,7 +2703,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2703
2703
  sessions: e.sessions?.map((e) => ({ ...e }))
2704
2704
  } : null, this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
2705
2705
  let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
2706
- let t = C(e.start), n = C(e.end);
2706
+ let t = S(e.start), n = S(e.end);
2707
2707
  return t === null || n === null ? [] : [{
2708
2708
  startMinute: t,
2709
2709
  endMinute: n
@@ -2760,7 +2760,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2760
2760
  return this.sessionShading.isVisible();
2761
2761
  }
2762
2762
  setSessionShadingConfig(e) {
2763
- this.hostSessionHours = xt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2763
+ this.hostSessionHours = Ct(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2764
2764
  }
2765
2765
  setTooltipVisible(e) {
2766
2766
  e || this.crosshairTooltip.hide();
@@ -2779,11 +2779,11 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2779
2779
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2780
2780
  }
2781
2781
  async takeGpu(e, t, n) {
2782
- let { gpu: r, reason: i } = await bt(e);
2783
- return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? vt() > 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());
2782
+ let { gpu: r, reason: i } = await St(e);
2783
+ 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());
2784
2784
  }
2785
2785
  waitForGpu(e) {
2786
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Nt(e) : null;
2786
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Pt(e) : null;
2787
2787
  }
2788
2788
  getRenderer() {
2789
2789
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -2801,23 +2801,23 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2801
2801
  this.engine.getGpu() && this.engine.renderNow();
2802
2802
  }
2803
2803
  screenshot(e) {
2804
- this.features.screenshot && (this.freshFrame(), A.download(this.container, e, this.themeManager.getTheme().background));
2804
+ this.features.screenshot && (this.freshFrame(), k.download(this.container, e, this.themeManager.getTheme().background));
2805
2805
  }
2806
2806
  async copyScreenshot() {
2807
2807
  if (!this.features.screenshot) return !1;
2808
2808
  try {
2809
2809
  this.freshFrame();
2810
- let e = await A.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2810
+ let e = await k.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2811
2811
  return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
2812
2812
  } catch {
2813
2813
  return !1;
2814
2814
  }
2815
2815
  }
2816
2816
  screenshotDataURL() {
2817
- return this.features.screenshot ? (this.freshFrame(), A.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2817
+ return this.features.screenshot ? (this.freshFrame(), k.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2818
2818
  }
2819
2819
  async screenshotBlob() {
2820
- return this.features.screenshot ? (this.freshFrame(), A.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2820
+ return this.features.screenshot ? (this.freshFrame(), k.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2821
2821
  }
2822
2822
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
2823
2823
  if (!this.features.alerts) return null;
@@ -2953,23 +2953,23 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2953
2953
  };
2954
2954
  }
2955
2955
  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;
2956
- r !== void 0 && l === void 0 ? l = qn(s, r) : c && l !== void 0 && (l += t);
2956
+ r !== void 0 && l === void 0 ? l = Jn(s, r) : c && l !== void 0 && (l += t);
2957
2957
  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;
2958
2958
  l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
2959
- let f = n ? Zn(n, d) : null;
2959
+ let f = n ? Qn(n, d) : null;
2960
2960
  this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
2961
2961
  try {
2962
2962
  this.replayManager.load(f ?? d);
2963
2963
  } finally {
2964
2964
  this.replayRestarting = !1;
2965
2965
  }
2966
- f && o.startIndex !== void 0 && (o.startIndex = er(f, d, o.startIndex)), this.replayBarUnsub?.();
2966
+ f && o.startIndex !== void 0 && (o.startIndex = tr(f, d, o.startIndex)), this.replayBarUnsub?.();
2967
2967
  let p = -1, m = -1, h = null, g = f ?? d;
2968
2968
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
2969
2969
  let t = e, n = d[e];
2970
2970
  if (f) {
2971
2971
  let r = f[e];
2972
- t = $n(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? nr(h, r) : tr(d[t], f, e), n = h;
2972
+ t = er(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? rr(h, r) : nr(d[t], f, e), n = h;
2973
2973
  }
2974
2974
  m = e;
2975
2975
  let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
@@ -3021,20 +3021,20 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3021
3021
  return;
3022
3022
  }
3023
3023
  if (i.time <= n.fedTime) return;
3024
- let a = e.slice(Jn(e, n.fedTime), t + 1);
3024
+ let a = e.slice(Yn(e, n.fedTime), t + 1);
3025
3025
  n.fedTime = i.time;
3026
- let o = Math.ceil(a.length / Kn);
3027
- for (let e = 0; e < a.length; e += o) for (let [t, n] of Yn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3026
+ let o = Math.ceil(a.length / qn);
3027
+ for (let e = 0; e < a.length; e += o) for (let [t, n] of Xn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3028
3028
  this.tradingManager.setCurrentPrice(i.close);
3029
3029
  }
3030
3030
  getReplayBarIndex() {
3031
3031
  if (!this.replaySession) return -1;
3032
3032
  let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
3033
- return t && this.replayCoarse ? $n(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3033
+ return t && this.replayCoarse ? er(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3034
3034
  }
3035
3035
  replaySeekToBar(e) {
3036
3036
  let t = this.replayStepsSeries;
3037
- this.replaySeek(t && this.replayCoarse ? er(t, this.replayCoarse, e) : e);
3037
+ this.replaySeek(t && this.replayCoarse ? tr(t, this.replayCoarse, e) : e);
3038
3038
  }
3039
3039
  replayPause() {
3040
3040
  this.replayManager.pause();
@@ -3066,10 +3066,10 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3066
3066
  data: this.getDisplayData()
3067
3067
  }, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
3068
3068
  for (let e of t.anchors) {
3069
- let t = Et(e.time, n), r = St(e.price, n);
3069
+ let t = Ot(e.time, n), r = wt(e.price, n);
3070
3070
  i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
3071
3071
  }
3072
- return zn.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Bn.has(t.type) && ([o, s] = [r.y, r.y + r.height]), i = Math.max(i, r.x), a = Math.min(a, r.x + r.width), o = Math.max(o, r.y), s = Math.min(s, r.y + r.height), i <= a && o <= s ? {
3072
+ return Bn.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Vn.has(t.type) && ([o, s] = [r.y, r.y + r.height]), i = Math.max(i, r.x), a = Math.min(a, r.x + r.width), o = Math.max(o, r.y), s = Math.min(s, r.y + r.height), i <= a && o <= s ? {
3073
3073
  x: i,
3074
3074
  y: o,
3075
3075
  width: a - i,
@@ -3097,7 +3097,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3097
3097
  return this.replayManager.getProgress();
3098
3098
  }
3099
3099
  captureSnapshot() {
3100
- return w.capture({
3100
+ return C.capture({
3101
3101
  getDrawings: () => this.getDrawings(),
3102
3102
  getTheme: () => this.themeManager.getBaseTheme(),
3103
3103
  getAlerts: () => this.getAlerts(),
@@ -3110,14 +3110,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3110
3110
  });
3111
3111
  }
3112
3112
  restoreIndicators(e, t) {
3113
- let n = Hn(e), r = /* @__PURE__ */ new Map();
3113
+ let n = Un(e), r = /* @__PURE__ */ new Map();
3114
3114
  this.unrestoredIndicators = [];
3115
3115
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3116
3116
  if (t) {
3117
3117
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3118
3118
  for (let n of t) {
3119
3119
  let t = e.get(n.instanceId);
3120
- t && Un(n, t) && o.add(n.instanceId);
3120
+ t && Wn(n, t) && o.add(n.instanceId);
3121
3121
  }
3122
3122
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3123
3123
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3125,7 +3125,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3125
3125
  let s = (e) => {
3126
3126
  let t = { ...e };
3127
3127
  for (let [e, n] of Object.entries(t)) {
3128
- let i = _(n), a = i && r.get(i.instanceId);
3128
+ let i = v(n), a = i && r.get(i.instanceId);
3129
3129
  a && (t[e] = p(a, i.key));
3130
3130
  }
3131
3131
  return t;
@@ -3177,7 +3177,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3177
3177
  let o = this.indicatorEngine.getIndicatorConfig(e);
3178
3178
  (t.visible ?? !0) !== (o?.visible ?? !0) && this.setIndicatorVisible(e, t.visible ?? !0);
3179
3179
  let s = t.levels ?? null;
3180
- JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? S(t.paneStyle) : null);
3180
+ JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? x(t.paneStyle) : null);
3181
3181
  }
3182
3182
  restorePanes(e) {
3183
3183
  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, {
@@ -3258,7 +3258,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3258
3258
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3259
3259
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3260
3260
  if (JSON.stringify(n) === JSON.stringify(i)) return r;
3261
- let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < In && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3261
+ let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Ln && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3262
3262
  type: "indicators",
3263
3263
  before: null,
3264
3264
  after: null
@@ -3286,12 +3286,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3286
3286
  }
3287
3287
  saveState(e) {
3288
3288
  if (!this.features.saveLoad) return null;
3289
- let t = this.captureSnapshot(), n = w.serialize(t);
3290
- return e && w.saveToStorage(e, t), n;
3289
+ let t = this.captureSnapshot(), n = C.serialize(t);
3290
+ return e && C.saveToStorage(e, t), n;
3291
3291
  }
3292
3292
  loadState(e) {
3293
3293
  if (!this.features.saveLoad) return;
3294
- let t = w.deserialize(e);
3294
+ let t = C.deserialize(e);
3295
3295
  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");
3296
3296
  let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
3297
3297
  if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
@@ -3302,7 +3302,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3302
3302
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3303
3303
  return r ? r + e.slice(t) : e;
3304
3304
  }, r = t(e.channel), i = {
3305
- ...wt(e),
3305
+ ...Et(e),
3306
3306
  ...e.target ? { target: t(e.target) } : {}
3307
3307
  };
3308
3308
  if (!e.expired) {
@@ -3322,22 +3322,22 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3322
3322
  }
3323
3323
  loadStateFromStorage(e) {
3324
3324
  if (!this.features.saveLoad) return !1;
3325
- let t = w.loadFromStorage(e);
3326
- return t ? (this.loadState(w.serialize(t)), !0) : !1;
3325
+ let t = C.loadFromStorage(e);
3326
+ return t ? (this.loadState(C.serialize(t)), !0) : !1;
3327
3327
  }
3328
3328
  downloadState(e) {
3329
- this.features.saveLoad && w.downloadFile(this.captureSnapshot(), e);
3329
+ this.features.saveLoad && C.downloadFile(this.captureSnapshot(), e);
3330
3330
  }
3331
3331
  async loadStateFromFile() {
3332
3332
  if (!this.features.saveLoad) return;
3333
- let e = await w.loadFromFile();
3334
- this.loadState(w.serialize(e));
3333
+ let e = await C.loadFromFile();
3334
+ this.loadState(C.serialize(e));
3335
3335
  }
3336
3336
  setLocale(e) {
3337
- ne(e), this.engine.requestRender();
3337
+ ie(e), this.engine.requestRender();
3338
3338
  }
3339
3339
  setNumberLocale(e) {
3340
- 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();
3340
+ this.numberLocale = e, this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.timeAxis.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.sessionBreaks.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
3341
3341
  }
3342
3342
  getNumberLocale() {
3343
3343
  return this.numberLocale;
@@ -3350,15 +3350,15 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3350
3350
  candleDown: e.colorScheme.down,
3351
3351
  candleUpWick: e.colorScheme.up,
3352
3352
  candleDownWick: e.colorScheme.down,
3353
- volumeUp: oe(e.colorScheme.up),
3354
- volumeDown: oe(e.colorScheme.down)
3353
+ volumeUp: ce(e.colorScheme.up),
3354
+ volumeDown: ce(e.colorScheme.down)
3355
3355
  };
3356
3356
  this.themeManager.setTheme(t);
3357
3357
  }
3358
3358
  e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
3359
3359
  }
3360
3360
  applyPricePrecision(e) {
3361
- this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? Pn), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3361
+ this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? Fn), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3362
3362
  }
3363
3363
  getMarket() {
3364
3364
  return this.marketConfig;
@@ -3395,8 +3395,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3395
3395
  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 = "";
3396
3396
  }
3397
3397
  createChartRenderer(e) {
3398
- let t = $t(e, (e) => this.pluginManager.getChartType(e));
3399
- return t instanceof E && t.setPriceText((e) => this.formatPrice(e)), t;
3398
+ let t = en(e, (e) => this.pluginManager.getChartType(e));
3399
+ return t instanceof T && t.setPriceText((e) => this.formatPrice(e)), t;
3400
3400
  }
3401
3401
  crosshairSeries() {
3402
3402
  return this.isTimeAligned() ? this.dataManager.getData() : this.getDisplayData();
@@ -3405,8 +3405,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3405
3405
  if (this.displayDataCache) return this.displayDataCache;
3406
3406
  let e = this.dataManager.getData();
3407
3407
  if (e.length === 0) return e;
3408
- let t = en(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3409
- return this.chartRenderer instanceof O && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(Zt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3408
+ let t = tn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3409
+ return this.chartRenderer instanceof D && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(Qt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3410
3410
  }
3411
3411
  recalcIndicatorsFrom(e, t) {
3412
3412
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3441,12 +3441,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3441
3441
  this.viewport.setScaleBaseline(t[e]?.close);
3442
3442
  }
3443
3443
  if (n) {
3444
- let e = Gn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3444
+ let e = Kn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3445
3445
  if (e) {
3446
3446
  let t = r.priceRange, n = Math.min(t.min, e.min), i = Math.max(t.max, e.max);
3447
3447
  if (n < t.min || i > t.max) {
3448
- let e = i - n || 1;
3449
- this.viewport.setPriceRange(n - e * .02, i + e * .02);
3448
+ let e = _(n, i, .02, this.viewport.isLogScale());
3449
+ this.viewport.setPriceRange(e.min, e.max);
3450
3450
  }
3451
3451
  }
3452
3452
  }
@@ -3465,7 +3465,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3465
3465
  fitLeftAxisWidth() {
3466
3466
  let e = this.leftViewport;
3467
3467
  if (!e) return !1;
3468
- let t = this.themeManager.getTheme(), n = vn({
3468
+ let t = this.themeManager.getTheme(), n = yn({
3469
3469
  min: e.priceRange.min,
3470
3470
  max: e.priceRange.max,
3471
3471
  lastPrice: null,
@@ -3474,12 +3474,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3474
3474
  fontFamily: t.font.family,
3475
3475
  fontSizeSmall: t.font.sizeSmall,
3476
3476
  measure: (e, t) => this.measureText(e, t)
3477
- }), r = yn(this.leftAxisWidth, n);
3477
+ }), r = bn(this.leftAxisWidth, n);
3478
3478
  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);
3479
3479
  }
3480
3480
  fitPriceAxisWidth() {
3481
3481
  if (!this.features.priceAxis) return !1;
3482
- let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = vn({
3482
+ let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = yn({
3483
3483
  min: e.min,
3484
3484
  max: e.max,
3485
3485
  lastPrice: this.currentPriceLine.getPrice(),
@@ -3490,7 +3490,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3490
3490
  fontFamily: t.font.family,
3491
3491
  fontSizeSmall: t.font.sizeSmall,
3492
3492
  measure: (e, t) => this.measureText(e, t)
3493
- }), r = yn(this.priceAxisWidth, n);
3493
+ }), r = bn(this.priceAxisWidth, n);
3494
3494
  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);
3495
3495
  }
3496
3496
  measureText(e, t) {
@@ -3534,7 +3534,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3534
3534
  buildPanelRenderInfos() {
3535
3535
  if (this.panelInfoCache) return this.panelInfoCache;
3536
3536
  let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
3537
- 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) ?? { ...jn }, o = {
3537
+ 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) ?? { ...Mn }, o = {
3538
3538
  x: e.rect.x,
3539
3539
  y: e.rect.y + 20,
3540
3540
  width: e.rect.width,
@@ -3616,7 +3616,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3616
3616
  });
3617
3617
  }
3618
3618
  drawOverlayPlugins(e, t) {
3619
- let n = Sn(this.pluginManager.getOverlays(), t);
3619
+ let n = Cn(this.pluginManager.getOverlays(), t);
3620
3620
  if (n.length === 0) return;
3621
3621
  let r = {
3622
3622
  viewport: this.viewport.getState(),
@@ -3637,11 +3637,11 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3637
3637
  };
3638
3638
  }
3639
3639
  };
3640
- function Hn(e) {
3640
+ function Un(e) {
3641
3641
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3642
3642
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3643
3643
  i.add(e.instanceId);
3644
- let o = [e.pane, ...Object.values(e.params).map((e) => _(e)?.instanceId)];
3644
+ let o = [e.pane, ...Object.values(e.params).map((e) => v(e)?.instanceId)];
3645
3645
  for (let e of o) {
3646
3646
  let n = e ? t.get(e) : void 0;
3647
3647
  n && a(n);
@@ -3651,10 +3651,10 @@ function Hn(e) {
3651
3651
  for (let t of e) a(t);
3652
3652
  return n;
3653
3653
  }
3654
- function Un(e, t) {
3654
+ function Wn(e, t) {
3655
3655
  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);
3656
3656
  }
3657
- function Wn(e) {
3657
+ function Gn(e) {
3658
3658
  let t = e.tagRadius;
3659
3659
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3660
3660
  }
@@ -3664,7 +3664,7 @@ var W = new Set([
3664
3664
  "correlation",
3665
3665
  "correlationlog"
3666
3666
  ]);
3667
- function Gn(e, t) {
3667
+ function Kn(e, t) {
3668
3668
  return e ? t ? {
3669
3669
  min: Math.min(e.min, t.min),
3670
3670
  max: Math.max(e.max, t.max)
@@ -3685,8 +3685,8 @@ function G(e) {
3685
3685
  bars: e.bars
3686
3686
  };
3687
3687
  }
3688
- var Kn = 500;
3689
- function qn(e, t) {
3688
+ var qn = 500;
3689
+ function Jn(e, t) {
3690
3690
  let n = 0, r = e.length;
3691
3691
  for (; n < r;) {
3692
3692
  let i = n + r >> 1;
@@ -3694,7 +3694,7 @@ function qn(e, t) {
3694
3694
  }
3695
3695
  return n;
3696
3696
  }
3697
- function Jn(e, t) {
3697
+ function Yn(e, t) {
3698
3698
  let n = 0, r = e.length;
3699
3699
  for (; n < r;) {
3700
3700
  let i = n + r >> 1;
@@ -3702,20 +3702,20 @@ function Jn(e, t) {
3702
3702
  }
3703
3703
  return n;
3704
3704
  }
3705
- function Yn(e) {
3705
+ function Xn(e) {
3706
3706
  let t = 0, n = 0;
3707
3707
  for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
3708
3708
  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];
3709
3709
  return [...a ? [r, i] : [i, r], [o.close, o.time]];
3710
3710
  }
3711
- function Xn(e) {
3711
+ function Zn(e) {
3712
3712
  let t = 0;
3713
3713
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
3714
3714
  return t > 0 ? t : Infinity;
3715
3715
  }
3716
- function Zn(e, t) {
3716
+ function Qn(e, t) {
3717
3717
  if (t.length === 0) return null;
3718
- let n = t[t.length - 1].time + Xn(t), r = e.filter((e) => Qn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3718
+ let n = t[t.length - 1].time + Zn(t), r = e.filter((e) => $n(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3719
3719
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
3720
3720
  if (i.length === 0) return null;
3721
3721
  let a = t.findIndex((e) => e.time >= i[0].time);
@@ -3723,7 +3723,7 @@ function Zn(e, t) {
3723
3723
  let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
3724
3724
  return [...o, ...s];
3725
3725
  }
3726
- function Qn(e) {
3726
+ function $n(e) {
3727
3727
  return [
3728
3728
  e.time,
3729
3729
  e.open,
@@ -3732,7 +3732,7 @@ function Qn(e) {
3732
3732
  e.close
3733
3733
  ].every(Number.isFinite);
3734
3734
  }
3735
- function $n(e, t) {
3735
+ function er(e, t) {
3736
3736
  let n = 0, r = e.length - 1;
3737
3737
  for (; n < r;) {
3738
3738
  let i = n + r + 1 >> 1;
@@ -3740,22 +3740,22 @@ function $n(e, t) {
3740
3740
  }
3741
3741
  return n;
3742
3742
  }
3743
- function er(e, t, n) {
3743
+ function tr(e, t, n) {
3744
3744
  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;
3745
3745
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
3746
3746
  return Math.max(0, a);
3747
3747
  }
3748
- function tr(e, t, n) {
3748
+ function nr(e, t, n) {
3749
3749
  let r = n;
3750
3750
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
3751
3751
  let i = {
3752
3752
  ...t[r],
3753
3753
  time: e.time
3754
3754
  };
3755
- for (let e = r + 1; e <= n; e++) i = nr(i, t[e]);
3755
+ for (let e = r + 1; e <= n; e++) i = rr(i, t[e]);
3756
3756
  return i;
3757
3757
  }
3758
- function nr(e, t) {
3758
+ function rr(e, t) {
3759
3759
  return {
3760
3760
  time: e.time,
3761
3761
  open: e.open,
@@ -3773,26 +3773,26 @@ function K(e, t) {
3773
3773
  }
3774
3774
  //#endregion
3775
3775
  //#region src/io/parseOHLCV.ts
3776
- var rr = [
3776
+ var ir = [
3777
3777
  "time",
3778
3778
  "timestamp",
3779
3779
  "date",
3780
3780
  "datetime",
3781
3781
  "t"
3782
- ], ir = ["open", "o"], ar = ["high", "h"], or = ["low", "l"], sr = ["close", "c"], cr = [
3782
+ ], ar = ["open", "o"], or = ["high", "h"], sr = ["low", "l"], cr = ["close", "c"], lr = [
3783
3783
  "volume",
3784
3784
  "vol",
3785
3785
  "v"
3786
3786
  ];
3787
- function lr(e) {
3787
+ function ur(e) {
3788
3788
  let t = e.trim();
3789
- return t ? t[0] === "[" || t[0] === "{" ? ur(t) : dr(t) : {
3789
+ return t ? t[0] === "[" || t[0] === "{" ? dr(t) : fr(t) : {
3790
3790
  data: [],
3791
3791
  rowCount: 0,
3792
3792
  skipped: 0
3793
3793
  };
3794
3794
  }
3795
- function ur(e) {
3795
+ function dr(e) {
3796
3796
  let t;
3797
3797
  try {
3798
3798
  t = JSON.parse(e);
@@ -3807,14 +3807,14 @@ function ur(e) {
3807
3807
  }
3808
3808
  return _r(n, t.length, r);
3809
3809
  }
3810
- function dr(e) {
3810
+ function fr(e) {
3811
3811
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
3812
3812
  if (t.length === 0) return {
3813
3813
  data: [],
3814
3814
  rowCount: 0,
3815
3815
  skipped: 0
3816
3816
  };
3817
- let n = fr(t[0]), r = pr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? mr(r) : {
3817
+ let n = pr(t[0]), r = q(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? mr(r) : {
3818
3818
  time: 0,
3819
3819
  open: 1,
3820
3820
  high: 2,
@@ -3825,7 +3825,7 @@ function dr(e) {
3825
3825
  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");
3826
3826
  let o = [], s = 0;
3827
3827
  for (let e = +!!i; e < t.length; e++) {
3828
- let r = pr(t[e], n), i = J(r[a.time]), c = q(r[a.open]), l = q(r[a.high]), u = q(r[a.low]), d = q(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
3828
+ let r = q(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;
3829
3829
  if (i === null || ![
3830
3830
  c,
3831
3831
  l,
@@ -3846,7 +3846,7 @@ function dr(e) {
3846
3846
  }
3847
3847
  return _r(o, t.length - +!!i, s);
3848
3848
  }
3849
- function fr(e) {
3849
+ function pr(e) {
3850
3850
  let t = {
3851
3851
  ",": 0,
3852
3852
  ";": 0,
@@ -3858,7 +3858,7 @@ function fr(e) {
3858
3858
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
3859
3859
  return n;
3860
3860
  }
3861
- function pr(e, t) {
3861
+ function q(e, t) {
3862
3862
  let n = [], r = "", i = !1;
3863
3863
  for (let a = 0; a < e.length; a++) {
3864
3864
  let o = e[a];
@@ -3869,12 +3869,12 @@ function pr(e, t) {
3869
3869
  function mr(e) {
3870
3870
  let t = (t) => e.findIndex((e) => t.includes(e));
3871
3871
  return {
3872
- time: t(rr),
3873
- open: t(ir),
3874
- high: t(ar),
3875
- low: t(or),
3876
- close: t(sr),
3877
- volume: t(cr)
3872
+ time: t(ir),
3873
+ open: t(ar),
3874
+ high: t(or),
3875
+ low: t(sr),
3876
+ close: t(cr),
3877
+ volume: t(lr)
3878
3878
  };
3879
3879
  }
3880
3880
  function hr(e) {
@@ -3884,7 +3884,7 @@ function hr(e) {
3884
3884
  let t = n.toUpperCase();
3885
3885
  if (e[t] !== void 0) return e[t];
3886
3886
  }
3887
- }, n = J(String(t(rr) ?? "")), r = Number(t(ir)), i = Number(t(ar)), a = Number(t(or)), o = Number(t(sr)), s = Number(t(cr) ?? 0);
3887
+ }, n = Y(String(t(ir) ?? "")), r = Number(t(ar)), i = Number(t(or)), a = Number(t(sr)), o = Number(t(cr)), s = Number(t(lr) ?? 0);
3888
3888
  return n === null || ![
3889
3889
  r,
3890
3890
  i,
@@ -3901,7 +3901,7 @@ function hr(e) {
3901
3901
  }
3902
3902
  function gr(e) {
3903
3903
  if (e.length < 5) return null;
3904
- let t = J(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;
3904
+ 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;
3905
3905
  return t === null || ![
3906
3906
  n,
3907
3907
  r,
@@ -3916,10 +3916,10 @@ function gr(e) {
3916
3916
  volume: Number.isFinite(o) ? o : 0
3917
3917
  };
3918
3918
  }
3919
- function q(e) {
3919
+ function J(e) {
3920
3920
  return e === void 0 || e.trim() === "" ? NaN : Number(e);
3921
3921
  }
3922
- function J(e) {
3922
+ function Y(e) {
3923
3923
  let t = e.trim();
3924
3924
  if (!t) return null;
3925
3925
  let n = Number(t);
@@ -3960,19 +3960,19 @@ var vr = class {
3960
3960
  this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
3961
3961
  }
3962
3962
  onDragEnter(e) {
3963
- Y(e) && (e.preventDefault(), this.depth++, this.showOverlay());
3963
+ X(e) && (e.preventDefault(), this.depth++, this.showOverlay());
3964
3964
  }
3965
3965
  onDragOver(e) {
3966
- Y(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
3966
+ X(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
3967
3967
  }
3968
3968
  onDragLeave(e) {
3969
- Y(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
3969
+ X(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
3970
3970
  }
3971
3971
  async onDrop(e) {
3972
3972
  e.preventDefault(), this.depth = 0, this.hideOverlay();
3973
3973
  let t = e.dataTransfer?.files?.[0];
3974
3974
  if (t) try {
3975
- let e = lr(await t.text());
3975
+ let e = ur(await t.text());
3976
3976
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
3977
3977
  this.callbacks.onData(e.data, e, t);
3978
3978
  } catch (e) {
@@ -4003,12 +4003,12 @@ var vr = class {
4003
4003
  this.overlay?.remove(), this.overlay = null;
4004
4004
  }
4005
4005
  };
4006
- function Y(e) {
4006
+ function X(e) {
4007
4007
  return e.dataTransfer?.types?.includes("Files") ?? !1;
4008
4008
  }
4009
4009
  //#endregion
4010
4010
  //#region src/state/layoutStorage.ts
4011
- function X(e) {
4011
+ function Z(e) {
4012
4012
  let t = {
4013
4013
  id: e.id,
4014
4014
  name: e.name,
@@ -4016,11 +4016,11 @@ function X(e) {
4016
4016
  };
4017
4017
  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;
4018
4018
  }
4019
- var Z = (e, t) => t.updatedAt - e.updatedAt;
4019
+ var yr = (e, t) => t.updatedAt - e.updatedAt;
4020
4020
  function Q(e) {
4021
4021
  if (typeof e != "object" || !e) return null;
4022
4022
  let t = e;
4023
- return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : X({
4023
+ return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Z({
4024
4024
  id: t.id,
4025
4025
  name: t.name,
4026
4026
  updatedAt: t.updatedAt,
@@ -4029,17 +4029,17 @@ function Q(e) {
4029
4029
  kind: typeof t.kind == "string" ? t.kind : void 0
4030
4030
  });
4031
4031
  }
4032
- function yr(e) {
4032
+ function br(e) {
4033
4033
  let t = Q(e), n = t ? e.content : void 0;
4034
4034
  return t && typeof n == "string" ? {
4035
4035
  ...t,
4036
4036
  content: n
4037
4037
  } : null;
4038
4038
  }
4039
- function br(e = []) {
4039
+ function xr(e = []) {
4040
4040
  let t = new Map(e.map((e) => [e.id, { ...e }]));
4041
4041
  return {
4042
- list: () => [...t.values()].map(X).sort(Z),
4042
+ list: () => [...t.values()].map(Z).sort(yr),
4043
4043
  load: (e) => {
4044
4044
  let n = t.get(e);
4045
4045
  return n ? { ...n } : null;
@@ -4052,7 +4052,7 @@ function br(e = []) {
4052
4052
  }
4053
4053
  };
4054
4054
  }
4055
- function xr(e = "tcw:layouts:") {
4055
+ function Sr(e = "tcw:layouts:") {
4056
4056
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
4057
4057
  let e;
4058
4058
  try {
@@ -4063,7 +4063,7 @@ function xr(e = "tcw:layouts:") {
4063
4063
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
4064
4064
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
4065
4065
  return {
4066
- list: () => r().sort(Z),
4066
+ list: () => r().sort(yr),
4067
4067
  load: (e) => {
4068
4068
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
4069
4069
  return t && i !== null ? {
@@ -4072,7 +4072,7 @@ function xr(e = "tcw:layouts:") {
4072
4072
  } : null;
4073
4073
  },
4074
4074
  save: (e) => {
4075
- localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), X(e)]);
4075
+ localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Z(e)]);
4076
4076
  },
4077
4077
  remove: (e) => {
4078
4078
  i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
@@ -4081,14 +4081,14 @@ function xr(e = "tcw:layouts:") {
4081
4081
  }
4082
4082
  //#endregion
4083
4083
  //#region src/state/LayoutSession.ts
4084
- var Sr = 80;
4084
+ var Cr = 80;
4085
4085
  function $(e) {
4086
4086
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
4087
4087
  }
4088
- function Cr() {
4088
+ function wr() {
4089
4089
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4090
4090
  }
4091
- function wr(e) {
4091
+ function Tr(e) {
4092
4092
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
4093
4093
  return {
4094
4094
  id: t,
@@ -4099,7 +4099,7 @@ function wr(e) {
4099
4099
  ...o === void 0 ? {} : { kind: o }
4100
4100
  };
4101
4101
  }
4102
- var Tr = class {
4102
+ var Er = class {
4103
4103
  currentLayout = null;
4104
4104
  savedContent = null;
4105
4105
  dirty = !1;
@@ -4115,7 +4115,7 @@ var Tr = class {
4115
4115
  now;
4116
4116
  newId;
4117
4117
  constructor(e, t, n = {}) {
4118
- 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 ?? Cr;
4118
+ 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 ?? wr;
4119
4119
  }
4120
4120
  current() {
4121
4121
  return this.currentLayout;
@@ -4145,7 +4145,7 @@ var Tr = class {
4145
4145
  }
4146
4146
  open(e) {
4147
4147
  return this.queue(async () => {
4148
- let t = yr(await this.storage.load(e));
4148
+ let t = br(await this.storage.load(e));
4149
4149
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4150
4150
  this.cancelTimer(), this.applying++;
4151
4151
  try {
@@ -4155,13 +4155,13 @@ var Tr = class {
4155
4155
  } finally {
4156
4156
  this.applying--;
4157
4157
  }
4158
- return this.cancelTimer(), this.currentLayout = wr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4158
+ return this.cancelTimer(), this.currentLayout = Tr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4159
4159
  });
4160
4160
  }
4161
4161
  rename(e, t) {
4162
4162
  let n = $(t);
4163
4163
  return n ? this.queue(async () => {
4164
- let t = yr(await this.storage.load(e));
4164
+ let t = br(await this.storage.load(e));
4165
4165
  !t || t.id !== e || (await this.storage.save({
4166
4166
  ...t,
4167
4167
  name: n
@@ -4239,7 +4239,7 @@ var Tr = class {
4239
4239
  content: n.content
4240
4240
  };
4241
4241
  await this.storage.save(r);
4242
- let i = wr(r);
4242
+ let i = Tr(r);
4243
4243
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4244
4244
  }
4245
4245
  forget() {
@@ -4260,6 +4260,6 @@ var Tr = class {
4260
4260
  }
4261
4261
  };
4262
4262
  //#endregion
4263
- export { qt as C, B as S, H as _, br as a, on as b, Vn as c, En as d, Tn as f, Sn as g, xn as h, xr as i, Mn as l, wn as m, Sr as n, vr as o, Cn as p, $ as r, lr as s, Tr as t, Dn as u, pn as v, rn as x, cn as y };
4263
+ export { Jt as C, B as S, H as _, xr as a, sn as b, Hn as c, Dn as d, En as f, Cn as g, Sn as h, Sr as i, Nn as l, Tn as m, Cr as n, vr as o, wn as p, $ as r, ur as s, Er as t, On as u, mn as v, an as x, ln as y };
4264
4264
 
4265
- //# sourceMappingURL=LayoutSession-BD1CfXIS.js.map
4265
+ //# sourceMappingURL=LayoutSession-BE7ZZGLi.js.map