@tradecanvas/chart 1.82.0 → 1.83.0

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