@tradecanvas/chart 1.25.0 → 1.27.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.27.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
- }), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1092
+ }), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), 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,9 +2531,15 @@ 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
+ setMinBarUnit(e) {
2538
+ this.viewport.setMinBarUnit(e), this.updateViewportAndRender();
2539
+ }
2540
+ getMinBarUnit() {
2541
+ return this.viewport.getMinBarUnit();
2542
+ }
2537
2543
  setPanLimits(e) {
2538
2544
  this.viewport.setPanLimits(e), this.updateViewportAndRender();
2539
2545
  }
@@ -2574,7 +2580,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2574
2580
  this.applyStyle(e, t.layer ?? "host", !0);
2575
2581
  }
2576
2582
  setOverrides(e, t = {}) {
2577
- let n = t.layer ?? "host", { overrides: r, rejected: i } = y(e);
2583
+ let n = t.layer ?? "host", { overrides: r, rejected: i } = ne(e);
2578
2584
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
2579
2585
  let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
2580
2586
  this.themeManager.setOverrides(a, n) && this.styleChanged(n);
@@ -2593,7 +2599,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2593
2599
  return this.themeManager.getStyleValue(e);
2594
2600
  }
2595
2601
  applyStyle(e, t, n) {
2596
- let { overrides: r, rejected: i } = y(e);
2602
+ let { overrides: r, rejected: i } = ne(e);
2597
2603
  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
2604
  }
2599
2605
  styleChanged(e) {
@@ -2623,7 +2629,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2623
2629
  e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
2624
2630
  }
2625
2631
  setCrosshairTime(e) {
2626
- let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(P(e, t));
2632
+ let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(N(e, t));
2627
2633
  n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
2628
2634
  }
2629
2635
  getData() {
@@ -2685,7 +2691,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2685
2691
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2686
2692
  }
2687
2693
  setTimezone(e) {
2688
- Nn(e), this.timezoneSetting = e, this.applyTimezone();
2694
+ Pn(e), this.timezoneSetting = e, this.applyTimezone();
2689
2695
  }
2690
2696
  getTimezone() {
2691
2697
  return this.timezoneSetting;
@@ -2703,7 +2709,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2703
2709
  sessions: e.sessions?.map((e) => ({ ...e }))
2704
2710
  } : null, this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
2705
2711
  let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
2706
- let t = C(e.start), n = C(e.end);
2712
+ let t = S(e.start), n = S(e.end);
2707
2713
  return t === null || n === null ? [] : [{
2708
2714
  startMinute: t,
2709
2715
  endMinute: n
@@ -2760,7 +2766,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2760
2766
  return this.sessionShading.isVisible();
2761
2767
  }
2762
2768
  setSessionShadingConfig(e) {
2763
- this.hostSessionHours = xt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2769
+ this.hostSessionHours = Ct(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2764
2770
  }
2765
2771
  setTooltipVisible(e) {
2766
2772
  e || this.crosshairTooltip.hide();
@@ -2779,11 +2785,11 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2779
2785
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2780
2786
  }
2781
2787
  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());
2788
+ let { gpu: r, reason: i } = await St(e);
2789
+ 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
2790
  }
2785
2791
  waitForGpu(e) {
2786
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Nt(e) : null;
2792
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Pt(e) : null;
2787
2793
  }
2788
2794
  getRenderer() {
2789
2795
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -2801,23 +2807,23 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2801
2807
  this.engine.getGpu() && this.engine.renderNow();
2802
2808
  }
2803
2809
  screenshot(e) {
2804
- this.features.screenshot && (this.freshFrame(), A.download(this.container, e, this.themeManager.getTheme().background));
2810
+ this.features.screenshot && (this.freshFrame(), k.download(this.container, e, this.themeManager.getTheme().background));
2805
2811
  }
2806
2812
  async copyScreenshot() {
2807
2813
  if (!this.features.screenshot) return !1;
2808
2814
  try {
2809
2815
  this.freshFrame();
2810
- let e = await A.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2816
+ let e = await k.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2811
2817
  return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
2812
2818
  } catch {
2813
2819
  return !1;
2814
2820
  }
2815
2821
  }
2816
2822
  screenshotDataURL() {
2817
- return this.features.screenshot ? (this.freshFrame(), A.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2823
+ return this.features.screenshot ? (this.freshFrame(), k.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2818
2824
  }
2819
2825
  async screenshotBlob() {
2820
- return this.features.screenshot ? (this.freshFrame(), A.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2826
+ return this.features.screenshot ? (this.freshFrame(), k.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2821
2827
  }
2822
2828
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
2823
2829
  if (!this.features.alerts) return null;
@@ -2953,23 +2959,23 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
2953
2959
  };
2954
2960
  }
2955
2961
  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);
2962
+ r !== void 0 && l === void 0 ? l = Jn(s, r) : c && l !== void 0 && (l += t);
2957
2963
  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
2964
  l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
2959
- let f = n ? Zn(n, d) : null;
2965
+ let f = n ? Qn(n, d) : null;
2960
2966
  this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
2961
2967
  try {
2962
2968
  this.replayManager.load(f ?? d);
2963
2969
  } finally {
2964
2970
  this.replayRestarting = !1;
2965
2971
  }
2966
- f && o.startIndex !== void 0 && (o.startIndex = er(f, d, o.startIndex)), this.replayBarUnsub?.();
2972
+ f && o.startIndex !== void 0 && (o.startIndex = tr(f, d, o.startIndex)), this.replayBarUnsub?.();
2967
2973
  let p = -1, m = -1, h = null, g = f ?? d;
2968
2974
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
2969
2975
  let t = e, n = d[e];
2970
2976
  if (f) {
2971
2977
  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;
2978
+ 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
2979
  }
2974
2980
  m = e;
2975
2981
  let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
@@ -3021,20 +3027,20 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3021
3027
  return;
3022
3028
  }
3023
3029
  if (i.time <= n.fedTime) return;
3024
- let a = e.slice(Jn(e, n.fedTime), t + 1);
3030
+ let a = e.slice(Yn(e, n.fedTime), t + 1);
3025
3031
  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);
3032
+ let o = Math.ceil(a.length / qn);
3033
+ 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
3034
  this.tradingManager.setCurrentPrice(i.close);
3029
3035
  }
3030
3036
  getReplayBarIndex() {
3031
3037
  if (!this.replaySession) return -1;
3032
3038
  let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
3033
- return t && this.replayCoarse ? $n(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3039
+ return t && this.replayCoarse ? er(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3034
3040
  }
3035
3041
  replaySeekToBar(e) {
3036
3042
  let t = this.replayStepsSeries;
3037
- this.replaySeek(t && this.replayCoarse ? er(t, this.replayCoarse, e) : e);
3043
+ this.replaySeek(t && this.replayCoarse ? tr(t, this.replayCoarse, e) : e);
3038
3044
  }
3039
3045
  replayPause() {
3040
3046
  this.replayManager.pause();
@@ -3066,10 +3072,10 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3066
3072
  data: this.getDisplayData()
3067
3073
  }, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
3068
3074
  for (let e of t.anchors) {
3069
- let t = Et(e.time, n), r = St(e.price, n);
3075
+ let t = Ot(e.time, n), r = wt(e.price, n);
3070
3076
  i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
3071
3077
  }
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 ? {
3078
+ 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
3079
  x: i,
3074
3080
  y: o,
3075
3081
  width: a - i,
@@ -3097,7 +3103,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3097
3103
  return this.replayManager.getProgress();
3098
3104
  }
3099
3105
  captureSnapshot() {
3100
- return w.capture({
3106
+ return C.capture({
3101
3107
  getDrawings: () => this.getDrawings(),
3102
3108
  getTheme: () => this.themeManager.getBaseTheme(),
3103
3109
  getAlerts: () => this.getAlerts(),
@@ -3110,14 +3116,14 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3110
3116
  });
3111
3117
  }
3112
3118
  restoreIndicators(e, t) {
3113
- let n = Hn(e), r = /* @__PURE__ */ new Map();
3119
+ let n = Un(e), r = /* @__PURE__ */ new Map();
3114
3120
  this.unrestoredIndicators = [];
3115
3121
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3116
3122
  if (t) {
3117
3123
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3118
3124
  for (let n of t) {
3119
3125
  let t = e.get(n.instanceId);
3120
- t && Un(n, t) && o.add(n.instanceId);
3126
+ t && Wn(n, t) && o.add(n.instanceId);
3121
3127
  }
3122
3128
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3123
3129
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3125,7 +3131,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3125
3131
  let s = (e) => {
3126
3132
  let t = { ...e };
3127
3133
  for (let [e, n] of Object.entries(t)) {
3128
- let i = _(n), a = i && r.get(i.instanceId);
3134
+ let i = v(n), a = i && r.get(i.instanceId);
3129
3135
  a && (t[e] = p(a, i.key));
3130
3136
  }
3131
3137
  return t;
@@ -3177,7 +3183,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3177
3183
  let o = this.indicatorEngine.getIndicatorConfig(e);
3178
3184
  (t.visible ?? !0) !== (o?.visible ?? !0) && this.setIndicatorVisible(e, t.visible ?? !0);
3179
3185
  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);
3186
+ JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? x(t.paneStyle) : null);
3181
3187
  }
3182
3188
  restorePanes(e) {
3183
3189
  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 +3264,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3258
3264
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3259
3265
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3260
3266
  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 = {
3267
+ 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
3268
  type: "indicators",
3263
3269
  before: null,
3264
3270
  after: null
@@ -3286,12 +3292,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3286
3292
  }
3287
3293
  saveState(e) {
3288
3294
  if (!this.features.saveLoad) return null;
3289
- let t = this.captureSnapshot(), n = w.serialize(t);
3290
- return e && w.saveToStorage(e, t), n;
3295
+ let t = this.captureSnapshot(), n = C.serialize(t);
3296
+ return e && C.saveToStorage(e, t), n;
3291
3297
  }
3292
3298
  loadState(e) {
3293
3299
  if (!this.features.saveLoad) return;
3294
- let t = w.deserialize(e);
3300
+ let t = C.deserialize(e);
3295
3301
  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
3302
  let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
3297
3303
  if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
@@ -3302,7 +3308,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3302
3308
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3303
3309
  return r ? r + e.slice(t) : e;
3304
3310
  }, r = t(e.channel), i = {
3305
- ...wt(e),
3311
+ ...Et(e),
3306
3312
  ...e.target ? { target: t(e.target) } : {}
3307
3313
  };
3308
3314
  if (!e.expired) {
@@ -3322,22 +3328,22 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3322
3328
  }
3323
3329
  loadStateFromStorage(e) {
3324
3330
  if (!this.features.saveLoad) return !1;
3325
- let t = w.loadFromStorage(e);
3326
- return t ? (this.loadState(w.serialize(t)), !0) : !1;
3331
+ let t = C.loadFromStorage(e);
3332
+ return t ? (this.loadState(C.serialize(t)), !0) : !1;
3327
3333
  }
3328
3334
  downloadState(e) {
3329
- this.features.saveLoad && w.downloadFile(this.captureSnapshot(), e);
3335
+ this.features.saveLoad && C.downloadFile(this.captureSnapshot(), e);
3330
3336
  }
3331
3337
  async loadStateFromFile() {
3332
3338
  if (!this.features.saveLoad) return;
3333
- let e = await w.loadFromFile();
3334
- this.loadState(w.serialize(e));
3339
+ let e = await C.loadFromFile();
3340
+ this.loadState(C.serialize(e));
3335
3341
  }
3336
3342
  setLocale(e) {
3337
- ne(e), this.engine.requestRender();
3343
+ ie(e), this.engine.requestRender();
3338
3344
  }
3339
3345
  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();
3346
+ 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
3347
  }
3342
3348
  getNumberLocale() {
3343
3349
  return this.numberLocale;
@@ -3350,15 +3356,15 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3350
3356
  candleDown: e.colorScheme.down,
3351
3357
  candleUpWick: e.colorScheme.up,
3352
3358
  candleDownWick: e.colorScheme.down,
3353
- volumeUp: oe(e.colorScheme.up),
3354
- volumeDown: oe(e.colorScheme.down)
3359
+ volumeUp: ce(e.colorScheme.up),
3360
+ volumeDown: ce(e.colorScheme.down)
3355
3361
  };
3356
3362
  this.themeManager.setTheme(t);
3357
3363
  }
3358
3364
  e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
3359
3365
  }
3360
3366
  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);
3367
+ 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
3368
  }
3363
3369
  getMarket() {
3364
3370
  return this.marketConfig;
@@ -3395,8 +3401,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3395
3401
  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
3402
  }
3397
3403
  createChartRenderer(e) {
3398
- let t = $t(e, (e) => this.pluginManager.getChartType(e));
3399
- return t instanceof E && t.setPriceText((e) => this.formatPrice(e)), t;
3404
+ let t = en(e, (e) => this.pluginManager.getChartType(e));
3405
+ return t instanceof T && t.setPriceText((e) => this.formatPrice(e)), t;
3400
3406
  }
3401
3407
  crosshairSeries() {
3402
3408
  return this.isTimeAligned() ? this.dataManager.getData() : this.getDisplayData();
@@ -3405,8 +3411,8 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3405
3411
  if (this.displayDataCache) return this.displayDataCache;
3406
3412
  let e = this.dataManager.getData();
3407
3413
  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;
3414
+ let t = tn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3415
+ return this.chartRenderer instanceof D && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(Qt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3410
3416
  }
3411
3417
  recalcIndicatorsFrom(e, t) {
3412
3418
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3441,12 +3447,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3441
3447
  this.viewport.setScaleBaseline(t[e]?.close);
3442
3448
  }
3443
3449
  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);
3450
+ 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
3451
  if (e) {
3446
3452
  let t = r.priceRange, n = Math.min(t.min, e.min), i = Math.max(t.max, e.max);
3447
3453
  if (n < t.min || i > t.max) {
3448
- let e = i - n || 1;
3449
- this.viewport.setPriceRange(n - e * .02, i + e * .02);
3454
+ let e = _(n, i, .02, this.viewport.isLogScale());
3455
+ this.viewport.setPriceRange(e.min, e.max);
3450
3456
  }
3451
3457
  }
3452
3458
  }
@@ -3465,7 +3471,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3465
3471
  fitLeftAxisWidth() {
3466
3472
  let e = this.leftViewport;
3467
3473
  if (!e) return !1;
3468
- let t = this.themeManager.getTheme(), n = vn({
3474
+ let t = this.themeManager.getTheme(), n = yn({
3469
3475
  min: e.priceRange.min,
3470
3476
  max: e.priceRange.max,
3471
3477
  lastPrice: null,
@@ -3474,12 +3480,12 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3474
3480
  fontFamily: t.font.family,
3475
3481
  fontSizeSmall: t.font.sizeSmall,
3476
3482
  measure: (e, t) => this.measureText(e, t)
3477
- }), r = yn(this.leftAxisWidth, n);
3483
+ }), r = bn(this.leftAxisWidth, n);
3478
3484
  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
3485
  }
3480
3486
  fitPriceAxisWidth() {
3481
3487
  if (!this.features.priceAxis) return !1;
3482
- let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = vn({
3488
+ let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = yn({
3483
3489
  min: e.min,
3484
3490
  max: e.max,
3485
3491
  lastPrice: this.currentPriceLine.getPrice(),
@@ -3490,7 +3496,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3490
3496
  fontFamily: t.font.family,
3491
3497
  fontSizeSmall: t.font.sizeSmall,
3492
3498
  measure: (e, t) => this.measureText(e, t)
3493
- }), r = yn(this.priceAxisWidth, n);
3499
+ }), r = bn(this.priceAxisWidth, n);
3494
3500
  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
3501
  }
3496
3502
  measureText(e, t) {
@@ -3534,7 +3540,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3534
3540
  buildPanelRenderInfos() {
3535
3541
  if (this.panelInfoCache) return this.panelInfoCache;
3536
3542
  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 = {
3543
+ 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
3544
  x: e.rect.x,
3539
3545
  y: e.rect.y + 20,
3540
3546
  width: e.rect.width,
@@ -3616,7 +3622,7 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3616
3622
  });
3617
3623
  }
3618
3624
  drawOverlayPlugins(e, t) {
3619
- let n = Sn(this.pluginManager.getOverlays(), t);
3625
+ let n = Cn(this.pluginManager.getOverlays(), t);
3620
3626
  if (n.length === 0) return;
3621
3627
  let r = {
3622
3628
  viewport: this.viewport.getState(),
@@ -3637,11 +3643,11 @@ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine",
3637
3643
  };
3638
3644
  }
3639
3645
  };
3640
- function Hn(e) {
3646
+ function Un(e) {
3641
3647
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3642
3648
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3643
3649
  i.add(e.instanceId);
3644
- let o = [e.pane, ...Object.values(e.params).map((e) => _(e)?.instanceId)];
3650
+ let o = [e.pane, ...Object.values(e.params).map((e) => v(e)?.instanceId)];
3645
3651
  for (let e of o) {
3646
3652
  let n = e ? t.get(e) : void 0;
3647
3653
  n && a(n);
@@ -3651,10 +3657,10 @@ function Hn(e) {
3651
3657
  for (let t of e) a(t);
3652
3658
  return n;
3653
3659
  }
3654
- function Un(e, t) {
3660
+ function Wn(e, t) {
3655
3661
  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
3662
  }
3657
- function Wn(e) {
3663
+ function Gn(e) {
3658
3664
  let t = e.tagRadius;
3659
3665
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3660
3666
  }
@@ -3664,7 +3670,7 @@ var W = new Set([
3664
3670
  "correlation",
3665
3671
  "correlationlog"
3666
3672
  ]);
3667
- function Gn(e, t) {
3673
+ function Kn(e, t) {
3668
3674
  return e ? t ? {
3669
3675
  min: Math.min(e.min, t.min),
3670
3676
  max: Math.max(e.max, t.max)
@@ -3685,8 +3691,8 @@ function G(e) {
3685
3691
  bars: e.bars
3686
3692
  };
3687
3693
  }
3688
- var Kn = 500;
3689
- function qn(e, t) {
3694
+ var qn = 500;
3695
+ function Jn(e, t) {
3690
3696
  let n = 0, r = e.length;
3691
3697
  for (; n < r;) {
3692
3698
  let i = n + r >> 1;
@@ -3694,7 +3700,7 @@ function qn(e, t) {
3694
3700
  }
3695
3701
  return n;
3696
3702
  }
3697
- function Jn(e, t) {
3703
+ function Yn(e, t) {
3698
3704
  let n = 0, r = e.length;
3699
3705
  for (; n < r;) {
3700
3706
  let i = n + r >> 1;
@@ -3702,20 +3708,20 @@ function Jn(e, t) {
3702
3708
  }
3703
3709
  return n;
3704
3710
  }
3705
- function Yn(e) {
3711
+ function Xn(e) {
3706
3712
  let t = 0, n = 0;
3707
3713
  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
3714
  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
3715
  return [...a ? [r, i] : [i, r], [o.close, o.time]];
3710
3716
  }
3711
- function Xn(e) {
3717
+ function Zn(e) {
3712
3718
  let t = 0;
3713
3719
  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
3720
  return t > 0 ? t : Infinity;
3715
3721
  }
3716
- function Zn(e, t) {
3722
+ function Qn(e, t) {
3717
3723
  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 = [];
3724
+ 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
3725
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
3720
3726
  if (i.length === 0) return null;
3721
3727
  let a = t.findIndex((e) => e.time >= i[0].time);
@@ -3723,7 +3729,7 @@ function Zn(e, t) {
3723
3729
  let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
3724
3730
  return [...o, ...s];
3725
3731
  }
3726
- function Qn(e) {
3732
+ function $n(e) {
3727
3733
  return [
3728
3734
  e.time,
3729
3735
  e.open,
@@ -3732,7 +3738,7 @@ function Qn(e) {
3732
3738
  e.close
3733
3739
  ].every(Number.isFinite);
3734
3740
  }
3735
- function $n(e, t) {
3741
+ function er(e, t) {
3736
3742
  let n = 0, r = e.length - 1;
3737
3743
  for (; n < r;) {
3738
3744
  let i = n + r + 1 >> 1;
@@ -3740,22 +3746,22 @@ function $n(e, t) {
3740
3746
  }
3741
3747
  return n;
3742
3748
  }
3743
- function er(e, t, n) {
3749
+ function tr(e, t, n) {
3744
3750
  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
3751
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
3746
3752
  return Math.max(0, a);
3747
3753
  }
3748
- function tr(e, t, n) {
3754
+ function nr(e, t, n) {
3749
3755
  let r = n;
3750
3756
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
3751
3757
  let i = {
3752
3758
  ...t[r],
3753
3759
  time: e.time
3754
3760
  };
3755
- for (let e = r + 1; e <= n; e++) i = nr(i, t[e]);
3761
+ for (let e = r + 1; e <= n; e++) i = rr(i, t[e]);
3756
3762
  return i;
3757
3763
  }
3758
- function nr(e, t) {
3764
+ function rr(e, t) {
3759
3765
  return {
3760
3766
  time: e.time,
3761
3767
  open: e.open,
@@ -3773,26 +3779,26 @@ function K(e, t) {
3773
3779
  }
3774
3780
  //#endregion
3775
3781
  //#region src/io/parseOHLCV.ts
3776
- var rr = [
3782
+ var ir = [
3777
3783
  "time",
3778
3784
  "timestamp",
3779
3785
  "date",
3780
3786
  "datetime",
3781
3787
  "t"
3782
- ], ir = ["open", "o"], ar = ["high", "h"], or = ["low", "l"], sr = ["close", "c"], cr = [
3788
+ ], ar = ["open", "o"], or = ["high", "h"], sr = ["low", "l"], cr = ["close", "c"], lr = [
3783
3789
  "volume",
3784
3790
  "vol",
3785
3791
  "v"
3786
3792
  ];
3787
- function lr(e) {
3793
+ function ur(e) {
3788
3794
  let t = e.trim();
3789
- return t ? t[0] === "[" || t[0] === "{" ? ur(t) : dr(t) : {
3795
+ return t ? t[0] === "[" || t[0] === "{" ? dr(t) : fr(t) : {
3790
3796
  data: [],
3791
3797
  rowCount: 0,
3792
3798
  skipped: 0
3793
3799
  };
3794
3800
  }
3795
- function ur(e) {
3801
+ function dr(e) {
3796
3802
  let t;
3797
3803
  try {
3798
3804
  t = JSON.parse(e);
@@ -3807,14 +3813,14 @@ function ur(e) {
3807
3813
  }
3808
3814
  return _r(n, t.length, r);
3809
3815
  }
3810
- function dr(e) {
3816
+ function fr(e) {
3811
3817
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
3812
3818
  if (t.length === 0) return {
3813
3819
  data: [],
3814
3820
  rowCount: 0,
3815
3821
  skipped: 0
3816
3822
  };
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) : {
3823
+ 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
3824
  time: 0,
3819
3825
  open: 1,
3820
3826
  high: 2,
@@ -3825,7 +3831,7 @@ function dr(e) {
3825
3831
  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
3832
  let o = [], s = 0;
3827
3833
  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;
3834
+ 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
3835
  if (i === null || ![
3830
3836
  c,
3831
3837
  l,
@@ -3846,7 +3852,7 @@ function dr(e) {
3846
3852
  }
3847
3853
  return _r(o, t.length - +!!i, s);
3848
3854
  }
3849
- function fr(e) {
3855
+ function pr(e) {
3850
3856
  let t = {
3851
3857
  ",": 0,
3852
3858
  ";": 0,
@@ -3858,7 +3864,7 @@ function fr(e) {
3858
3864
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
3859
3865
  return n;
3860
3866
  }
3861
- function pr(e, t) {
3867
+ function q(e, t) {
3862
3868
  let n = [], r = "", i = !1;
3863
3869
  for (let a = 0; a < e.length; a++) {
3864
3870
  let o = e[a];
@@ -3869,12 +3875,12 @@ function pr(e, t) {
3869
3875
  function mr(e) {
3870
3876
  let t = (t) => e.findIndex((e) => t.includes(e));
3871
3877
  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)
3878
+ time: t(ir),
3879
+ open: t(ar),
3880
+ high: t(or),
3881
+ low: t(sr),
3882
+ close: t(cr),
3883
+ volume: t(lr)
3878
3884
  };
3879
3885
  }
3880
3886
  function hr(e) {
@@ -3884,7 +3890,7 @@ function hr(e) {
3884
3890
  let t = n.toUpperCase();
3885
3891
  if (e[t] !== void 0) return e[t];
3886
3892
  }
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);
3893
+ }, 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
3894
  return n === null || ![
3889
3895
  r,
3890
3896
  i,
@@ -3901,7 +3907,7 @@ function hr(e) {
3901
3907
  }
3902
3908
  function gr(e) {
3903
3909
  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;
3910
+ 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
3911
  return t === null || ![
3906
3912
  n,
3907
3913
  r,
@@ -3916,10 +3922,10 @@ function gr(e) {
3916
3922
  volume: Number.isFinite(o) ? o : 0
3917
3923
  };
3918
3924
  }
3919
- function q(e) {
3925
+ function J(e) {
3920
3926
  return e === void 0 || e.trim() === "" ? NaN : Number(e);
3921
3927
  }
3922
- function J(e) {
3928
+ function Y(e) {
3923
3929
  let t = e.trim();
3924
3930
  if (!t) return null;
3925
3931
  let n = Number(t);
@@ -3960,19 +3966,19 @@ var vr = class {
3960
3966
  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
3967
  }
3962
3968
  onDragEnter(e) {
3963
- Y(e) && (e.preventDefault(), this.depth++, this.showOverlay());
3969
+ X(e) && (e.preventDefault(), this.depth++, this.showOverlay());
3964
3970
  }
3965
3971
  onDragOver(e) {
3966
- Y(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
3972
+ X(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
3967
3973
  }
3968
3974
  onDragLeave(e) {
3969
- Y(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
3975
+ X(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
3970
3976
  }
3971
3977
  async onDrop(e) {
3972
3978
  e.preventDefault(), this.depth = 0, this.hideOverlay();
3973
3979
  let t = e.dataTransfer?.files?.[0];
3974
3980
  if (t) try {
3975
- let e = lr(await t.text());
3981
+ let e = ur(await t.text());
3976
3982
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
3977
3983
  this.callbacks.onData(e.data, e, t);
3978
3984
  } catch (e) {
@@ -4003,12 +4009,12 @@ var vr = class {
4003
4009
  this.overlay?.remove(), this.overlay = null;
4004
4010
  }
4005
4011
  };
4006
- function Y(e) {
4012
+ function X(e) {
4007
4013
  return e.dataTransfer?.types?.includes("Files") ?? !1;
4008
4014
  }
4009
4015
  //#endregion
4010
4016
  //#region src/state/layoutStorage.ts
4011
- function X(e) {
4017
+ function Z(e) {
4012
4018
  let t = {
4013
4019
  id: e.id,
4014
4020
  name: e.name,
@@ -4016,11 +4022,11 @@ function X(e) {
4016
4022
  };
4017
4023
  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
4024
  }
4019
- var Z = (e, t) => t.updatedAt - e.updatedAt;
4025
+ var yr = (e, t) => t.updatedAt - e.updatedAt;
4020
4026
  function Q(e) {
4021
4027
  if (typeof e != "object" || !e) return null;
4022
4028
  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({
4029
+ return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Z({
4024
4030
  id: t.id,
4025
4031
  name: t.name,
4026
4032
  updatedAt: t.updatedAt,
@@ -4029,17 +4035,17 @@ function Q(e) {
4029
4035
  kind: typeof t.kind == "string" ? t.kind : void 0
4030
4036
  });
4031
4037
  }
4032
- function yr(e) {
4038
+ function br(e) {
4033
4039
  let t = Q(e), n = t ? e.content : void 0;
4034
4040
  return t && typeof n == "string" ? {
4035
4041
  ...t,
4036
4042
  content: n
4037
4043
  } : null;
4038
4044
  }
4039
- function br(e = []) {
4045
+ function xr(e = []) {
4040
4046
  let t = new Map(e.map((e) => [e.id, { ...e }]));
4041
4047
  return {
4042
- list: () => [...t.values()].map(X).sort(Z),
4048
+ list: () => [...t.values()].map(Z).sort(yr),
4043
4049
  load: (e) => {
4044
4050
  let n = t.get(e);
4045
4051
  return n ? { ...n } : null;
@@ -4052,7 +4058,7 @@ function br(e = []) {
4052
4058
  }
4053
4059
  };
4054
4060
  }
4055
- function xr(e = "tcw:layouts:") {
4061
+ function Sr(e = "tcw:layouts:") {
4056
4062
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
4057
4063
  let e;
4058
4064
  try {
@@ -4063,7 +4069,7 @@ function xr(e = "tcw:layouts:") {
4063
4069
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
4064
4070
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
4065
4071
  return {
4066
- list: () => r().sort(Z),
4072
+ list: () => r().sort(yr),
4067
4073
  load: (e) => {
4068
4074
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
4069
4075
  return t && i !== null ? {
@@ -4072,7 +4078,7 @@ function xr(e = "tcw:layouts:") {
4072
4078
  } : null;
4073
4079
  },
4074
4080
  save: (e) => {
4075
- localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), X(e)]);
4081
+ localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Z(e)]);
4076
4082
  },
4077
4083
  remove: (e) => {
4078
4084
  i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
@@ -4081,14 +4087,14 @@ function xr(e = "tcw:layouts:") {
4081
4087
  }
4082
4088
  //#endregion
4083
4089
  //#region src/state/LayoutSession.ts
4084
- var Sr = 80;
4090
+ var Cr = 80;
4085
4091
  function $(e) {
4086
4092
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
4087
4093
  }
4088
- function Cr() {
4094
+ function wr() {
4089
4095
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4090
4096
  }
4091
- function wr(e) {
4097
+ function Tr(e) {
4092
4098
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
4093
4099
  return {
4094
4100
  id: t,
@@ -4099,7 +4105,7 @@ function wr(e) {
4099
4105
  ...o === void 0 ? {} : { kind: o }
4100
4106
  };
4101
4107
  }
4102
- var Tr = class {
4108
+ var Er = class {
4103
4109
  currentLayout = null;
4104
4110
  savedContent = null;
4105
4111
  dirty = !1;
@@ -4115,7 +4121,7 @@ var Tr = class {
4115
4121
  now;
4116
4122
  newId;
4117
4123
  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;
4124
+ 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
4125
  }
4120
4126
  current() {
4121
4127
  return this.currentLayout;
@@ -4145,7 +4151,7 @@ var Tr = class {
4145
4151
  }
4146
4152
  open(e) {
4147
4153
  return this.queue(async () => {
4148
- let t = yr(await this.storage.load(e));
4154
+ let t = br(await this.storage.load(e));
4149
4155
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4150
4156
  this.cancelTimer(), this.applying++;
4151
4157
  try {
@@ -4155,13 +4161,13 @@ var Tr = class {
4155
4161
  } finally {
4156
4162
  this.applying--;
4157
4163
  }
4158
- return this.cancelTimer(), this.currentLayout = wr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4164
+ return this.cancelTimer(), this.currentLayout = Tr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4159
4165
  });
4160
4166
  }
4161
4167
  rename(e, t) {
4162
4168
  let n = $(t);
4163
4169
  return n ? this.queue(async () => {
4164
- let t = yr(await this.storage.load(e));
4170
+ let t = br(await this.storage.load(e));
4165
4171
  !t || t.id !== e || (await this.storage.save({
4166
4172
  ...t,
4167
4173
  name: n
@@ -4239,7 +4245,7 @@ var Tr = class {
4239
4245
  content: n.content
4240
4246
  };
4241
4247
  await this.storage.save(r);
4242
- let i = wr(r);
4248
+ let i = Tr(r);
4243
4249
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4244
4250
  }
4245
4251
  forget() {
@@ -4260,6 +4266,6 @@ var Tr = class {
4260
4266
  }
4261
4267
  };
4262
4268
  //#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 };
4269
+ 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
4270
 
4265
- //# sourceMappingURL=LayoutSession-BD1CfXIS.js.map
4271
+ //# sourceMappingURL=LayoutSession-CUS33zmB.js.map