@tradecanvas/chart 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/{LayoutSession-QZPqjaRt.js → LayoutSession-DECsVW1x.js} +2 -2
  2. package/dist/{LayoutSession-QZPqjaRt.js.map → LayoutSession-DECsVW1x.js.map} +1 -1
  3. package/dist/{LayoutSession-DUkQpWp6.cjs → LayoutSession-Dx5up0ZJ.cjs} +2 -2
  4. package/dist/{LayoutSession-DUkQpWp6.cjs.map → LayoutSession-Dx5up0ZJ.cjs.map} +1 -1
  5. package/dist/{WidgetCommandPalette-CdqVGBYg.cjs → WidgetCommandPalette-CASDu1gu.cjs} +2 -2
  6. package/dist/{WidgetCommandPalette-CdqVGBYg.cjs.map → WidgetCommandPalette-CASDu1gu.cjs.map} +1 -1
  7. package/dist/{WidgetCommandPalette-BRVQZRQe.js → WidgetCommandPalette-DpP-lG1A.js} +2 -2
  8. package/dist/{WidgetCommandPalette-BRVQZRQe.js.map → WidgetCommandPalette-DpP-lG1A.js.map} +1 -1
  9. package/dist/{WidgetDrawingSettings-CFksb9-G.cjs → WidgetDrawingSettings-BpX4Cdys.cjs} +2 -2
  10. package/dist/{WidgetDrawingSettings-CFksb9-G.cjs.map → WidgetDrawingSettings-BpX4Cdys.cjs.map} +1 -1
  11. package/dist/{WidgetDrawingSettings-DBBFUUg7.js → WidgetDrawingSettings-Cwds8CdJ.js} +2 -2
  12. package/dist/{WidgetDrawingSettings-DBBFUUg7.js.map → WidgetDrawingSettings-Cwds8CdJ.js.map} +1 -1
  13. package/dist/{WidgetIndicatorPicker-DiB_819o.cjs → WidgetIndicatorPicker-CTK-2QvV.cjs} +2 -2
  14. package/dist/{WidgetIndicatorPicker-DiB_819o.cjs.map → WidgetIndicatorPicker-CTK-2QvV.cjs.map} +1 -1
  15. package/dist/{WidgetIndicatorPicker-CcIYSWPd.js → WidgetIndicatorPicker-DsFCT2xZ.js} +2 -2
  16. package/dist/{WidgetIndicatorPicker-CcIYSWPd.js.map → WidgetIndicatorPicker-DsFCT2xZ.js.map} +1 -1
  17. package/dist/{WidgetIndicatorSettings-DcRbZpJJ.js → WidgetIndicatorSettings-D3W40Nud.js} +3 -3
  18. package/dist/{WidgetIndicatorSettings-DcRbZpJJ.js.map → WidgetIndicatorSettings-D3W40Nud.js.map} +1 -1
  19. package/dist/{WidgetIndicatorSettings-GnMFEumO.cjs → WidgetIndicatorSettings-DRt-E8Y_.cjs} +2 -2
  20. package/dist/{WidgetIndicatorSettings-GnMFEumO.cjs.map → WidgetIndicatorSettings-DRt-E8Y_.cjs.map} +1 -1
  21. package/dist/{WidgetSettings-Ds8LIQJL.js → WidgetSettings-BsjEg-Dj.js} +2 -2
  22. package/dist/{WidgetSettings-Ds8LIQJL.js.map → WidgetSettings-BsjEg-Dj.js.map} +1 -1
  23. package/dist/{WidgetSettings-BnXD_NEb.cjs → WidgetSettings-D0fnEBqC.cjs} +2 -2
  24. package/dist/{WidgetSettings-BnXD_NEb.cjs.map → WidgetSettings-D0fnEBqC.cjs.map} +1 -1
  25. package/dist/{WidgetSymbolSearch-CB27E553.cjs → WidgetSymbolSearch-CTfNYC_m.cjs} +2 -2
  26. package/dist/{WidgetSymbolSearch-CB27E553.cjs.map → WidgetSymbolSearch-CTfNYC_m.cjs.map} +1 -1
  27. package/dist/{WidgetSymbolSearch-W9ZoSxTR.js → WidgetSymbolSearch-Cxxq4SrK.js} +2 -2
  28. package/dist/{WidgetSymbolSearch-W9ZoSxTR.js.map → WidgetSymbolSearch-Cxxq4SrK.js.map} +1 -1
  29. package/dist/{i18n-BudCuwZD.js → i18n-COYPJUtF.js} +33 -33
  30. package/dist/i18n-COYPJUtF.js.map +1 -0
  31. package/dist/i18n-Q4mxL2mj.cjs +2 -0
  32. package/dist/i18n-Q4mxL2mj.cjs.map +1 -0
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/{indicatorInputWords-BfiSCSB-.js → indicatorInputWords-DFmWy8Ah.js} +2 -2
  36. package/dist/{indicatorInputWords-BfiSCSB-.js.map → indicatorInputWords-DFmWy8Ah.js.map} +1 -1
  37. package/dist/{indicatorInputWords-CdAL8a73.cjs → indicatorInputWords-hVKLYuVB.cjs} +2 -2
  38. package/dist/{indicatorInputWords-CdAL8a73.cjs.map → indicatorInputWords-hVKLYuVB.cjs.map} +1 -1
  39. package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -1
  40. package/dist/widget/WidgetSelectionToolbar.d.ts +7 -1
  41. package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -1
  42. package/dist/widget/index.cjs +3 -3
  43. package/dist/widget/index.cjs.map +1 -1
  44. package/dist/widget/index.js +515 -517
  45. package/dist/widget/index.js.map +1 -1
  46. package/dist/widget/locales/index.cjs +1 -1
  47. package/dist/widget/locales/index.js +1 -1
  48. package/package.json +3 -3
  49. package/dist/i18n-BudCuwZD.js.map +0 -1
  50. package/dist/i18n-D8MhJwUv.cjs +0 -2
  51. package/dist/i18n-D8MhJwUv.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-QZPqjaRt.js";
1
+ import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-DECsVW1x.js";
2
2
  import { _ as h, b as g, g as te, h as _, l as v, m as ne, n as re, t as ie, v as ae, y as oe } from "../widgetLocales-BX7VRdl5.js";
3
3
  import { t as se } from "../monthView-N8yDaTqZ.js";
4
4
  import { a as ce, c as le, d as ue, f as de, i as fe, l as pe, n as me, o as y, r as he, s as ge, t as _e, u as ve } from "../widgetFeatures-BM6u0u74.js";
5
5
  import { a as b, c as ye, i as x, l as be, n as xe, o as Se, r as Ce, s as we } from "../focusTrap-Br9Zfje0.js";
6
6
  import { a as Te, d as S, i as Ee, l as De, n as Oe, o as ke, r as Ae, s as je, t as Me, u as Ne } from "../symbolCatalog-B_9kDAjE.js";
7
7
  import { a as Pe, c as Fe, f as C, u as Ie } from "../settingsControls-DIjzCFHI.js";
8
- import { a as Le, c as Re, i as ze, n as Be, o as Ve, r as w, s as He, t as T } from "../i18n-BudCuwZD.js";
9
- import { r as Ue } from "../indicatorInputWords-BfiSCSB-.js";
8
+ import { a as Le, c as Re, i as ze, n as Be, o as Ve, r as w, s as He, t as T } from "../i18n-COYPJUtF.js";
9
+ import { r as Ue } from "../indicatorInputWords-DFmWy8Ah.js";
10
10
  import { t as We } from "../platformKeys-Dd1qOCjF.js";
11
11
  import { CHART_SPACING as Ge, CHART_STYLE_KEYS as Ke, DARK_THEME as qe, FIGURES_FONT_FAMILY as Je, LIGHT_THEME as Ye, PHI as Xe, SANS_FONT_FAMILY as Ze, barTimeUnit as E, evenPx as Qe, formatPrice as $e, formatVolumeLoc as et, indicatorSource as tt, isTimeFrame as nt, isValidTimeZone as rt, marketStatus as it, offsetAt as at, ownFillColor as ot, parseIndicatorSource as st, phiStep as ct, readChartStyleOverrides as lt, readChartTypeOptions as ut, readIndicatorPlotStyles as dt, readNews as ft, readQuote as pt, resampleBars as mt, sanitizeDrawingStyle as ht, stepDecimals as gt, symbolTimeZone as _t, tickBarCount as D, tickerOf as O, timeParts as vt, timeframeFollowsDays as yt, timeframeToMs as k, tzLabel as bt, wallToUtc as xt, zoneOffsetMinutes as St, zonedDateFormatter as Ct } from "@tradecanvas/commons";
12
12
  import { ChartStateManager as wt, MAX_ALERT_BARS as Tt, MIN_ALERT_BARS as Et, RANGE_PRESETS as Dt, ResamplingAdapter as Ot, SYMBOL_INDICATOR_IDS as kt, adapterFromFeed as At, indicatorCategory as jt, indicatorValuePrecision as Mt, isCrosshairCursor as Nt, plotColor as Pt, plotShown as Ft, rangePresetStart as It, servesTimeframe as Lt, sourceParam as Rt, withResampling as A } from "@tradecanvas/core";
@@ -4697,18 +4697,18 @@ var ro = class {
4697
4697
  color: "color",
4698
4698
  fill: "fillColor",
4699
4699
  textColor: "textColor"
4700
- }, uo = 10, G = 4, fo = 4, po = 20, mo = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([\d\s.,%/+-]+\)|[a-z]+)$/i;
4701
- function ho(e) {
4702
- return typeof e == "string" && mo.test(e.trim()) ? e.trim() : "#7d8696";
4703
- }
4700
+ }, uo = 32, fo = .618, G = 4, po = 4, mo = 20, ho = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([\d\s.,%/+-]+\)|[a-z]+)$/i;
4704
4701
  function go(e) {
4705
- let t = Number(e);
4706
- return Number.isFinite(t) && t > 0 ? Math.min(t, po) : 1;
4702
+ return typeof e == "string" && ho.test(e.trim()) ? e.trim() : "#7d8696";
4707
4703
  }
4708
4704
  function _o(e) {
4705
+ let t = Number(e);
4706
+ return Number.isFinite(t) && t > 0 ? Math.min(t, mo) : 1;
4707
+ }
4708
+ function vo(e) {
4709
4709
  return so.includes(e) ? e : "solid";
4710
4710
  }
4711
- var vo = class {
4711
+ var yo = class {
4712
4712
  el;
4713
4713
  pop;
4714
4714
  target = null;
@@ -4750,9 +4750,9 @@ var vo = class {
4750
4750
  show(e) {
4751
4751
  this.target = e;
4752
4752
  let t = e.style, n = [
4753
- ho(t.color),
4754
- go(t.lineWidth),
4755
- _o(t.lineStyle),
4753
+ go(t.color),
4754
+ _o(t.lineWidth),
4755
+ vo(t.lineStyle),
4756
4756
  e.locked,
4757
4757
  e.canDelete,
4758
4758
  e.canSettings,
@@ -4774,14 +4774,14 @@ var vo = class {
4774
4774
  this.onDragEnd(), document.removeEventListener("pointerdown", this.onDocDown, !0), this.el.remove(), this.pop.remove();
4775
4775
  }
4776
4776
  render(e) {
4777
- let t = this.t, n = ho(e.style.color), r = go(e.style.lineWidth), i = _o(e.style.lineStyle), a = e.locked, o = this.el.contains(document.activeElement) ? document.activeElement.dataset.action : void 0, s = (e, t, n, r = "") => `<button type="button" class="tcw-sel-btn${r}" data-action="${e}" aria-label="${S(t)}" title="${S(t)}">${n}</button>`, c = (e, t, n) => s(e, t, n, " tcw-sel-has-pop").replace("<button ", "<button aria-haspopup=\"dialog\" aria-expanded=\"false\" ");
4777
+ let t = this.t, n = go(e.style.color), r = _o(e.style.lineWidth), i = vo(e.style.lineStyle), a = e.locked, o = this.el.contains(document.activeElement) ? document.activeElement.dataset.action : void 0, s = (e, t, n, r = "") => `<button type="button" class="tcw-sel-btn${r}" data-action="${e}" aria-label="${S(t)}" title="${S(t)}">${n}</button>`, c = (e, t, n) => s(e, t, n, " tcw-sel-has-pop").replace("<button ", "<button aria-haspopup=\"dialog\" aria-expanded=\"false\" ");
4778
4778
  this.el.innerHTML = [
4779
4779
  "<span class=\"tcw-sel-grip\" aria-hidden=\"true\"></span>",
4780
4780
  c("color", t("drawingSettings.color"), `<span class="tcw-sel-color" style="background:${S(n)}"></span>`),
4781
4781
  c("width", t("drawingSettings.lineWidth"), `<span class="tcw-sel-width" style="--w:${r}px"></span><span class="tcw-sel-num">${r}px</span>`),
4782
- c("lineStyle", t("drawingSettings.lineStyle"), yo(i)),
4783
- e.canFill ? c("fill", t("drawingSettings.fill"), `<span class="tcw-sel-color tcw-sel-fill" style="background:${S(ho(ot(e.style) ?? n))}"></span>`) : "",
4784
- e.canText ? c("textColor", t("drawingSettings.textColor"), `<span class="tcw-sel-text" style="--c:${S(ho(e.style.textColor ?? n))}">T</span>`) : "",
4782
+ c("lineStyle", t("drawingSettings.lineStyle"), bo(i)),
4783
+ e.canFill ? c("fill", t("drawingSettings.fill"), `<span class="tcw-sel-color tcw-sel-fill" style="background:${S(go(ot(e.style) ?? n))}"></span>`) : "",
4784
+ e.canText ? c("textColor", t("drawingSettings.textColor"), `<span class="tcw-sel-text" style="--c:${S(go(e.style.textColor ?? n))}">T</span>`) : "",
4785
4785
  "<span class=\"tcw-sel-sep\" aria-hidden=\"true\"></span>",
4786
4786
  e.canSettings ? s("settings", t("legend.settings"), x("settings", 15)) : "",
4787
4787
  e.canAlert ? s("alert", t("drawingSettings.addAlert"), x("bell", 15)) : "",
@@ -4800,19 +4800,17 @@ var vo = class {
4800
4800
  t && e?.focus();
4801
4801
  }
4802
4802
  place(e) {
4803
- let { rect: t, bounds: n } = e, { w: r, h: i } = this.size ?? {
4803
+ let { bounds: t } = e, { w: n, h: r } = this.size ?? {
4804
4804
  w: 0,
4805
4805
  h: 0
4806
4806
  };
4807
4807
  if (this.pinned) {
4808
- let e = Math.max(n.x + G, Math.min(this.pinned.left, n.x + n.width - r - G)), t = Math.max(n.y + G, Math.min(this.pinned.top, n.y + n.height - i - G));
4809
- this.el.style.left = `${Math.round(e)}px`, this.el.style.top = `${Math.round(t)}px`;
4808
+ let e = Math.max(t.x + G, Math.min(this.pinned.left, t.x + t.width - n - G)), i = Math.max(t.y + G, Math.min(this.pinned.top, t.y + t.height - r - G));
4809
+ this.el.style.left = `${Math.round(e)}px`, this.el.style.top = `${Math.round(i)}px`;
4810
4810
  return;
4811
4811
  }
4812
- let a = t.x + t.width / 2 - r / 2;
4813
- a = Math.max(n.x + G, Math.min(a, n.x + n.width - r - G));
4814
- let o = t.y - i - uo;
4815
- o < n.y + G && (o = Math.min(t.y + t.height + uo, n.y + n.height - i - G)), o = Math.max(o, n.y + G), this.el.style.left = `${Math.round(a)}px`, this.el.style.top = `${Math.round(o)}px`;
4812
+ let i = Math.max(t.x + G, t.x + (t.width - n) / 2), a = n > t.width * fo, o = t.y + t.height - r - G, s = Math.max(t.y + G, a ? o : Math.min(t.y + uo, o));
4813
+ this.el.style.left = `${Math.round(i)}px`, this.el.style.top = `${Math.round(s)}px`;
4816
4814
  }
4817
4815
  onClick(e) {
4818
4816
  let t = e.target.closest("[data-action]");
@@ -4843,8 +4841,8 @@ var vo = class {
4843
4841
  r < 0 || (e.preventDefault(), this.rove(t[r], !0));
4844
4842
  }
4845
4843
  openPopover(e, t) {
4846
- let n = this.target.style, r = ho(e === "fill" ? ot(n) ?? n.color : e === "textColor" ? n.textColor ?? n.color : n.color).toLowerCase(), i = go(n.lineWidth), a = _o(n.lineStyle), o = (e, t, n, r = "") => `<button type="button" class="${e}${t ? " tcw-sel-on" : ""}" aria-pressed="${t}" ${n}>${r}</button>`;
4847
- this.openPop = e, e === "color" || e === "fill" || e === "textColor" ? this.pop.innerHTML = ao.map((e) => o("tcw-sel-swatch", e.toLowerCase() === r, `data-color="${e}" style="background:${e}" aria-label="${e}"`)).join("") : e === "width" ? this.pop.innerHTML = oo.map((e) => o("tcw-sel-option", e === i, `data-width="${e}"`, `<span class="tcw-sel-width" style="--w:${e}px"></span>${e}px`)).join("") : this.pop.innerHTML = so.map((e) => o("tcw-sel-option", e === a, `data-style="${e}"`, yo(e) + S(this.t(`drawingSettings.lineStyle.${e}`)))).join(""), this.pop.className = `tcw-sel-pop tcw-sel-pop--${e}`, this.pop.setAttribute("aria-label", t.getAttribute("aria-label") ?? ""), this.pop.hidden = !1;
4844
+ let n = this.target.style, r = go(e === "fill" ? ot(n) ?? n.color : e === "textColor" ? n.textColor ?? n.color : n.color).toLowerCase(), i = _o(n.lineWidth), a = vo(n.lineStyle), o = (e, t, n, r = "") => `<button type="button" class="${e}${t ? " tcw-sel-on" : ""}" aria-pressed="${t}" ${n}>${r}</button>`;
4845
+ this.openPop = e, e === "color" || e === "fill" || e === "textColor" ? this.pop.innerHTML = ao.map((e) => o("tcw-sel-swatch", e.toLowerCase() === r, `data-color="${e}" style="background:${e}" aria-label="${e}"`)).join("") : e === "width" ? this.pop.innerHTML = oo.map((e) => o("tcw-sel-option", e === i, `data-width="${e}"`, `<span class="tcw-sel-width" style="--w:${e}px"></span>${e}px`)).join("") : this.pop.innerHTML = so.map((e) => o("tcw-sel-option", e === a, `data-style="${e}"`, bo(e) + S(this.t(`drawingSettings.lineStyle.${e}`)))).join(""), this.pop.className = `tcw-sel-pop tcw-sel-pop--${e}`, this.pop.setAttribute("aria-label", t.getAttribute("aria-label") ?? ""), this.pop.hidden = !1;
4848
4846
  for (let e of this.el.querySelectorAll("[aria-expanded=\"true\"]")) e.setAttribute("aria-expanded", "false");
4849
4847
  t.setAttribute("aria-expanded", "true"), this.placePop(), this.pop.querySelector(".tcw-sel-on, button")?.focus();
4850
4848
  }
@@ -4855,7 +4853,7 @@ var vo = class {
4855
4853
  }
4856
4854
  let t = [...this.pop.querySelectorAll("button")], n = t.indexOf(document.activeElement);
4857
4855
  if (n < 0) return;
4858
- let r = this.openPop === "color" || this.openPop === "fill" || this.openPop === "textColor" ? fo : 1, i = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : e.key === "ArrowDown" ? r : e.key === "ArrowUp" ? -r : 0;
4856
+ let r = this.openPop === "color" || this.openPop === "fill" || this.openPop === "textColor" ? po : 1, i = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : e.key === "ArrowDown" ? r : e.key === "ArrowUp" ? -r : 0;
4859
4857
  i && (e.preventDefault(), t[(n + i + t.length) % t.length].focus());
4860
4858
  }
4861
4859
  placePop() {
@@ -4866,7 +4864,7 @@ var vo = class {
4866
4864
  let t = e.target.closest("button");
4867
4865
  if (!t) return;
4868
4866
  let n = this.openPop && this.openPop in lo ? lo[this.openPop] : "color";
4869
- t.dataset.color ? this.callbacks.onStyle({ [n]: t.dataset.color }) : t.dataset.width ? this.callbacks.onStyle({ lineWidth: Number(t.dataset.width) }) : t.dataset.style && this.callbacks.onStyle({ lineStyle: _o(t.dataset.style) }), this.closePop(!0);
4867
+ t.dataset.color ? this.callbacks.onStyle({ [n]: t.dataset.color }) : t.dataset.width ? this.callbacks.onStyle({ lineWidth: Number(t.dataset.width) }) : t.dataset.style && this.callbacks.onStyle({ lineStyle: vo(t.dataset.style) }), this.closePop(!0);
4870
4868
  }
4871
4869
  closePop(e = !1) {
4872
4870
  if (!this.openPop) return;
@@ -4874,7 +4872,7 @@ var vo = class {
4874
4872
  t?.setAttribute("aria-expanded", "false"), this.openPop = null, this.pop.hidden = !0, e && t?.focus();
4875
4873
  }
4876
4874
  };
4877
- function yo(e) {
4875
+ function bo(e) {
4878
4876
  return `<svg class="tcw-sel-line" width="22" height="10" viewBox="0 0 22 10" aria-hidden="true"><line x1="1" y1="5" x2="21" y2="5" stroke="currentColor" stroke-width="2"${e === "dashed" ? " stroke-dasharray=\"4 3\"" : e === "dotted" ? " stroke-dasharray=\"1 3\" stroke-linecap=\"round\"" : ""}/></svg>`;
4879
4877
  }
4880
4878
  //#endregion
@@ -4922,7 +4920,7 @@ var K = {
4922
4920
  wrap: 240,
4923
4921
  fontSize: 14
4924
4922
  }
4925
- }, bo = new Set([
4923
+ }, xo = new Set([
4926
4924
  "trendLine",
4927
4925
  "ray",
4928
4926
  "extendedLine",
@@ -4933,7 +4931,7 @@ var K = {
4933
4931
  "horizontalRay",
4934
4932
  "verticalLine",
4935
4933
  "rectangle"
4936
- ]), xo = { priceLabel: "#ffffff" }, So = 8, Co = 6, wo = 1.3, To = 120, Eo = 229, Do = 500, Oo = 8, ko = 400, Ao = class {
4934
+ ]), So = { priceLabel: "#ffffff" }, Co = 8, wo = 6, To = 1.3, Eo = 120, Do = 229, Oo = 500, ko = 8, Ao = 400, jo = class {
4937
4935
  wrap = null;
4938
4936
  area = null;
4939
4937
  target = null;
@@ -4943,7 +4941,7 @@ var K = {
4943
4941
  offSince = 0;
4944
4942
  onPressAway = (e) => {
4945
4943
  if (!(!this.area || e.target === this.area)) {
4946
- if (this.area.value === this.target?.text && performance.now() - this.openedAt < Do) {
4944
+ if (this.area.value === this.target?.text && performance.now() - this.openedAt < Oo) {
4947
4945
  e.preventDefault(), e.stopPropagation();
4948
4946
  return;
4949
4947
  }
@@ -4971,15 +4969,15 @@ var K = {
4971
4969
  fontWeight: a ? "bold" : "normal",
4972
4970
  fontStyle: o ? "italic" : "normal",
4973
4971
  fontFamily: s,
4974
- lineHeight: String(wo),
4972
+ lineHeight: String(To),
4975
4973
  color: e.color,
4976
- padding: `${Co}px ${So}px`
4974
+ padding: `${wo}px ${Co}px`
4977
4975
  }), r.addEventListener("input", () => {
4978
4976
  this.fit(), this.target?.onInput(r.value);
4979
4977
  let e = this.target?.rect();
4980
4978
  e && this.place(e);
4981
4979
  }), r.addEventListener("keydown", (e) => {
4982
- e.stopPropagation(), !(e.isComposing || e.keyCode === Eo) && (e.key === "Escape" ? (e.preventDefault(), this.finish(!1, !0)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this.finish(!0, !0)));
4980
+ e.stopPropagation(), !(e.isComposing || e.keyCode === Do) && (e.key === "Escape" ? (e.preventDefault(), this.finish(!1, !0)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this.finish(!0, !0)));
4983
4981
  }), r.addEventListener("blur", () => this.finish(!0, !1)), n.appendChild(r), this.layer().appendChild(n), this.wrap = n, this.area = r, this.place(t), this.fit(), r.focus(), r.select(), this.openedAt = performance.now(), this.offSince = 0, document.addEventListener("pointerdown", this.onPressAway, !0), document.addEventListener("mousedown", this.onPressAway, !0), this.follow(), !0;
4984
4982
  }
4985
4983
  commit() {
@@ -5000,10 +4998,10 @@ var K = {
5000
4998
  place(e) {
5001
4999
  let t = this.area;
5002
5000
  if (!t) return;
5003
- let n = Math.max(To, window.innerWidth - Oo * 2);
5004
- t.style.maxWidth = `${n}px`, t.style.width = `${Math.min(n, Math.max(To, e.width))}px`, t.style.minHeight = `${e.height}px`;
5005
- let r = t.offsetWidth || Math.max(To, e.width), i = t.offsetHeight || e.height;
5006
- t.style.left = `${Math.max(Oo, Math.min(e.x, window.innerWidth - Oo - r))}px`, t.style.top = `${Math.max(Oo, Math.min(e.y, window.innerHeight - Oo - i))}px`;
5001
+ let n = Math.max(Eo, window.innerWidth - ko * 2);
5002
+ t.style.maxWidth = `${n}px`, t.style.width = `${Math.min(n, Math.max(Eo, e.width))}px`, t.style.minHeight = `${e.height}px`;
5003
+ let r = t.offsetWidth || Math.max(Eo, e.width), i = t.offsetHeight || e.height;
5004
+ t.style.left = `${Math.max(ko, Math.min(e.x, window.innerWidth - ko - r))}px`, t.style.top = `${Math.max(ko, Math.min(e.y, window.innerHeight - ko - i))}px`;
5007
5005
  }
5008
5006
  offWindow(e) {
5009
5007
  return e.x > window.innerWidth || e.x + e.width < 0 || e.y > window.innerHeight || e.y + e.height < 0;
@@ -5016,14 +5014,14 @@ var K = {
5016
5014
  this.frame = requestAnimationFrame(() => {
5017
5015
  if (!this.target || this.done) return;
5018
5016
  let e = this.target.rect(), t = e !== null && this.offWindow(e);
5019
- if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince > ko) {
5017
+ if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince > Ao) {
5020
5018
  this.finish(!0, !1);
5021
5019
  return;
5022
5020
  }
5023
5021
  this.place(e), this.follow();
5024
5022
  });
5025
5023
  }
5026
- }, jo = [
5024
+ }, Mo = [
5027
5025
  {
5028
5026
  id: "regularScale",
5029
5027
  mode: "regular",
@@ -5044,7 +5042,7 @@ var K = {
5044
5042
  mode: "indexedTo100",
5045
5043
  label: "settings.scale.indexedTo100"
5046
5044
  }
5047
- ], Mo = [
5045
+ ], No = [
5048
5046
  {
5049
5047
  action: "resetView",
5050
5048
  keys: "Alt+R",
@@ -5061,20 +5059,20 @@ var K = {
5061
5059
  feature: "hotkeys.goToDate"
5062
5060
  }
5063
5061
  ];
5064
- function No(e) {
5065
- return jo.find((t) => t.id === e)?.mode;
5062
+ function Po(e) {
5063
+ return Mo.find((t) => t.id === e)?.mode;
5066
5064
  }
5067
- function Po(...e) {
5065
+ function Fo(...e) {
5068
5066
  return e.filter((e) => e.length > 0).flatMap((e, t) => t === 0 ? [...e] : ["separator", ...e]);
5069
5067
  }
5070
- function Fo(e, t) {
5068
+ function Io(e, t) {
5071
5069
  let n = t.keys[e.id];
5072
5070
  return n ? {
5073
5071
  ...e,
5074
5072
  shortcut: n
5075
5073
  } : e;
5076
5074
  }
5077
- function Io(e, t) {
5075
+ function Lo(e, t) {
5078
5076
  if (e.price === void 0 || !Number.isFinite(e.price)) return [];
5079
5077
  let n = e.formatPrice(e.price), r = [];
5080
5078
  if (e.canAlert && r.push({
@@ -5111,13 +5109,13 @@ function Io(e, t) {
5111
5109
  icon: "minus"
5112
5110
  }), r;
5113
5111
  }
5114
- var Lo = (e) => ({
5112
+ var Ro = (e) => ({
5115
5113
  id: "settings",
5116
5114
  label: e("chartMenu.settings"),
5117
5115
  icon: "settings"
5118
5116
  });
5119
- function Ro(e, t) {
5120
- let n = [Fo({
5117
+ function zo(e, t) {
5118
+ let n = [Io({
5121
5119
  id: "resetView",
5122
5120
  label: t("chartMenu.resetView")
5123
5121
  }, e)];
@@ -5150,9 +5148,9 @@ function Ro(e, t) {
5150
5148
  label: t("chartMenu.exportData"),
5151
5149
  icon: "save"
5152
5150
  }] : [];
5153
- return Po(Io(e, t), n, r, [...i, Lo(t)]);
5151
+ return Fo(Lo(e, t), n, r, [...i, Ro(t)]);
5154
5152
  }
5155
- function zo(e, t) {
5153
+ function Bo(e, t) {
5156
5154
  let n = [
5157
5155
  {
5158
5156
  id: "resetPriceScale",
@@ -5163,7 +5161,7 @@ function zo(e, t) {
5163
5161
  label: t("settings.autoScale"),
5164
5162
  checked: e.autoScale
5165
5163
  },
5166
- Fo({
5164
+ Io({
5167
5165
  id: "invertScale",
5168
5166
  label: t("chartMenu.invertScale"),
5169
5167
  checked: e.inverted
@@ -5173,7 +5171,7 @@ function zo(e, t) {
5173
5171
  label: t("settings.leftScale"),
5174
5172
  checked: e.leftScale
5175
5173
  }
5176
- ], r = jo.filter((t) => t.mode !== "logarithmic" || e.canLog).map((n) => ({
5174
+ ], r = Mo.filter((t) => t.mode !== "logarithmic" || e.canLog).map((n) => ({
5177
5175
  id: n.id,
5178
5176
  label: t(n.label),
5179
5177
  radio: !0,
@@ -5201,7 +5199,7 @@ function zo(e, t) {
5201
5199
  label: t("chartMenu.lastPriceLine"),
5202
5200
  checked: e.lines.lastPrice
5203
5201
  }];
5204
- return Po(n, r, [{
5202
+ return Fo(n, r, [{
5205
5203
  id: "labels",
5206
5204
  label: t("chartMenu.labels"),
5207
5205
  submenu: i
@@ -5209,18 +5207,18 @@ function zo(e, t) {
5209
5207
  id: "lines",
5210
5208
  label: t("chartMenu.lines"),
5211
5209
  submenu: a
5212
- }], Io({
5210
+ }], Lo({
5213
5211
  ...e,
5214
5212
  canTrade: !1,
5215
5213
  canDraw: !1
5216
- }, t), [Lo(t)]);
5214
+ }, t), [Ro(t)]);
5217
5215
  }
5218
- function Bo(e, t) {
5219
- let n = [Fo({
5216
+ function Vo(e, t) {
5217
+ let n = [Io({
5220
5218
  id: "resetView",
5221
5219
  label: t("chartMenu.resetTimeScale")
5222
5220
  }, e)];
5223
- e.canGoToDate && n.push(Fo({
5221
+ e.canGoToDate && n.push(Io({
5224
5222
  id: "goToDate",
5225
5223
  label: t("chartMenu.goToDate"),
5226
5224
  icon: "calendar"
@@ -5231,13 +5229,13 @@ function Bo(e, t) {
5231
5229
  radio: !0,
5232
5230
  checked: t.value === e.timezone.current
5233
5231
  }));
5234
- return Po(n, r.length > 0 ? [{
5232
+ return Fo(n, r.length > 0 ? [{
5235
5233
  id: "timezone",
5236
5234
  label: t("settings.timezone"),
5237
5235
  submenu: r
5238
5236
  }] : []);
5239
5237
  }
5240
- function Vo(e, t) {
5238
+ function Ho(e, t) {
5241
5239
  let n = e.pane ? [
5242
5240
  {
5243
5241
  id: "paneLog",
@@ -5255,53 +5253,53 @@ function Vo(e, t) {
5255
5253
  checked: e.pane.percent
5256
5254
  }
5257
5255
  ] : [];
5258
- return Po([Fo({
5256
+ return Fo([Io({
5259
5257
  id: "resetView",
5260
5258
  label: t("chartMenu.resetView")
5261
- }, e)], n, [Lo(t)]);
5259
+ }, e)], n, [Ro(t)]);
5262
5260
  }
5263
- function Ho(e, t, n) {
5261
+ function Uo(e, t, n) {
5264
5262
  switch (e) {
5265
- case "priceAxis": return zo(t, n);
5266
- case "timeAxis": return Bo(t, n);
5267
- case "pane": return Vo(t, n);
5268
- default: return Ro(t, n);
5263
+ case "priceAxis": return Bo(t, n);
5264
+ case "timeAxis": return Vo(t, n);
5265
+ case "pane": return Ho(t, n);
5266
+ default: return zo(t, n);
5269
5267
  }
5270
5268
  }
5271
5269
  //#endregion
5272
5270
  //#region src/widget/signedFigure.ts
5273
- var Uo = /^[-+−]/;
5274
- function Wo(e, t, n) {
5275
- let r = e.replace(Uo, "");
5276
- return r === n.replace(Uo, "") ? r : t > 0 ? `+${r}` : t < 0 ? `-${r}` : r;
5271
+ var Wo = /^[-+−]/;
5272
+ function Go(e, t, n) {
5273
+ let r = e.replace(Wo, "");
5274
+ return r === n.replace(Wo, "") ? r : t > 0 ? `+${r}` : t < 0 ? `-${r}` : r;
5277
5275
  }
5278
- function Go(e) {
5276
+ function Ko(e) {
5279
5277
  return e.startsWith("+") ? "up" : e.startsWith("-") ? "down" : null;
5280
5278
  }
5281
5279
  //#endregion
5282
5280
  //#region src/widget/WidgetAccountPanel.ts
5283
- var Ko = [
5281
+ var qo = [
5284
5282
  "positions",
5285
5283
  "orders",
5286
5284
  "history"
5287
- ], qo = [
5285
+ ], Jo = [
5288
5286
  "order",
5289
5287
  "close",
5290
5288
  "reverse",
5291
5289
  "stopLoss",
5292
5290
  "takeProfit"
5293
- ], Jo = [
5291
+ ], Yo = [
5294
5292
  "market",
5295
5293
  "limit",
5296
5294
  "stop"
5297
- ], Yo = ["gtc", "day"], q = "—", Xo = "{pnl}", Zo = 3;
5298
- function Qo(e, t, n) {
5295
+ ], Xo = ["gtc", "day"], q = "—", Zo = "{pnl}", Qo = 3;
5296
+ function $o(e, t, n) {
5299
5297
  return e.includes(t ?? "") ? t : n;
5300
5298
  }
5301
- function $o(e, t) {
5299
+ function es(e, t) {
5302
5300
  return e.length === t.length && e.every((e, n) => e === t[n]);
5303
5301
  }
5304
- function es(e, t) {
5302
+ function ts(e, t) {
5305
5303
  if (t === null) return null;
5306
5304
  let n = e.quantity - (e.closedQuantity ?? 0), r = e.side === "buy" ? 1 : -1;
5307
5305
  return {
@@ -5309,15 +5307,15 @@ function es(e, t) {
5309
5307
  pct: e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * r
5310
5308
  };
5311
5309
  }
5312
- function ts(e) {
5310
+ function ns(e) {
5313
5311
  let t = document.createElement("span");
5314
5312
  return t.dir = "ltr", t.textContent = e, t;
5315
5313
  }
5316
- function ns(e) {
5317
- let t = Go(e);
5314
+ function rs(e) {
5315
+ let t = Ko(e);
5318
5316
  return t ? `tcw-account-${t}` : "";
5319
5317
  }
5320
- var rs = class {
5318
+ var is = class {
5321
5319
  el;
5322
5320
  tabButtons = /* @__PURE__ */ new Map();
5323
5321
  tabLabels = /* @__PURE__ */ new Map();
@@ -5339,7 +5337,7 @@ var rs = class {
5339
5337
  r.className = "tcw-account-head";
5340
5338
  let i = document.createElement("div");
5341
5339
  i.className = "tcw-account-tabs", i.setAttribute("role", "tablist"), i.addEventListener("keydown", (e) => this.onTabKey(e));
5342
- for (let e of Ko) {
5340
+ for (let e of qo) {
5343
5341
  let t = document.createElement("button");
5344
5342
  t.type = "button", t.className = "tcw-account-tab", t.setAttribute("role", "tab"), t.id = `tcw-account-tab-${e}`;
5345
5343
  let n = document.createElement("span");
@@ -5367,7 +5365,7 @@ var rs = class {
5367
5365
  }
5368
5366
  update(e) {
5369
5367
  let t = this.snapshot;
5370
- if (this.snapshot = e, $o(t.positions, e.positions) && $o(t.orders, e.orders) && $o(t.fills, e.fills) && t.realisedPnl === e.realisedPnl) {
5368
+ if (this.snapshot = e, es(t.positions, e.positions) && es(t.orders, e.orders) && es(t.fills, e.fills) && t.realisedPnl === e.realisedPnl) {
5371
5369
  t.price !== e.price && (this.renderTotals(), this.open && this.tab === "positions" && this.patchPrices());
5372
5370
  return;
5373
5371
  }
@@ -5380,10 +5378,10 @@ var rs = class {
5380
5378
  this.tab = e, this.renderTabs(), this.render();
5381
5379
  }
5382
5380
  onTabKey(e) {
5383
- let t = Ko.indexOf(this.tab), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : -2;
5381
+ let t = qo.indexOf(this.tab), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : -2;
5384
5382
  if (n === -2) return;
5385
5383
  e.preventDefault();
5386
- let r = Ko[(n + Ko.length) % Ko.length];
5384
+ let r = qo[(n + qo.length) % qo.length];
5387
5385
  this.selectTab(r), this.tabButtons.get(r)?.focus();
5388
5386
  }
5389
5387
  renderTabs() {
@@ -5400,15 +5398,15 @@ var rs = class {
5400
5398
  }
5401
5399
  renderTotals() {
5402
5400
  let { positions: e, price: t, fills: n, realisedPnl: r } = this.snapshot, i = [], a = e.reduce((e, n) => {
5403
- let r = es(n, t);
5401
+ let r = ts(n, t);
5404
5402
  return r === null ? e : (e ?? 0) + r.pnl;
5405
5403
  }, null);
5406
5404
  a !== null && i.push(this.total("account.openPnl", a)), (n.length > 0 || r !== void 0 && r !== 0) && i.push(this.total("account.realised", r ?? n.reduce((e, t) => e + (t.pnl ?? 0), 0))), this.totalsEl.replaceChildren(...i);
5407
5405
  }
5408
5406
  total(e, t) {
5409
5407
  let n = document.createElement("span"), r = this.amount(t);
5410
- n.className = `tcw-account-total ${ns(r)}`.trim();
5411
- let i = this.t(e), a = i.indexOf(Xo), o = ts(r);
5408
+ n.className = `tcw-account-total ${rs(r)}`.trim();
5409
+ let i = this.t(e), a = i.indexOf(Zo), o = ns(r);
5412
5410
  return a < 0 ? n.append(`${i} `, o) : n.append(i.slice(0, a), o, i.slice(a + 5)), n;
5413
5411
  }
5414
5412
  render() {
@@ -5417,17 +5415,17 @@ var rs = class {
5417
5415
  }
5418
5416
  patchPrices() {
5419
5417
  let { price: e } = this.snapshot;
5420
- for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl, es(t.position, e));
5418
+ for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl, ts(t.position, e));
5421
5419
  }
5422
5420
  amount(e) {
5423
- return Wo(this.money(Math.abs(e)), e, this.money(0));
5421
+ return Go(this.money(Math.abs(e)), e, this.money(0));
5424
5422
  }
5425
5423
  money(e) {
5426
5424
  return this.callbacks.formatAmount ? this.callbacks.formatAmount(e) : e.toFixed(2);
5427
5425
  }
5428
5426
  percent(e) {
5429
5427
  let t = (e) => this.callbacks.formatNumber ? this.callbacks.formatNumber(e, 2) : e.toFixed(2);
5430
- return `${Wo(t(Math.abs(e)), e, t(0))}%`;
5428
+ return `${Go(t(Math.abs(e)), e, t(0))}%`;
5431
5429
  }
5432
5430
  writePnl(e, t) {
5433
5431
  if (t === null) {
@@ -5435,7 +5433,7 @@ var rs = class {
5435
5433
  return;
5436
5434
  }
5437
5435
  let n = this.amount(t.pnl);
5438
- e.className = ns(n), e.textContent = `${n} · ${this.percent(t.pct)}`;
5436
+ e.className = rs(n), e.textContent = `${n} · ${this.percent(t.pct)}`;
5439
5437
  }
5440
5438
  table(e, t, n) {
5441
5439
  if (t.length === 0) {
@@ -5480,8 +5478,8 @@ var rs = class {
5480
5478
  }
5481
5479
  renderPositions() {
5482
5480
  let { formatPrice: e } = this.callbacks, { price: t } = this.snapshot, n = [], r = this.snapshot.positions.map((r) => {
5483
- let i = r.quantity - (r.closedQuantity ?? 0), a = ts("");
5484
- this.writePnl(a, es(r, t)), n.push(a);
5481
+ let i = r.quantity - (r.closedQuantity ?? 0), a = ns("");
5482
+ this.writePnl(a, ts(r, t)), n.push(a);
5485
5483
  let o = `${this.sideText(r.side, "position")} ${i} @ ${e(r.entryPrice)}`;
5486
5484
  return [
5487
5485
  this.sideCell(r.side),
@@ -5536,13 +5534,13 @@ var rs = class {
5536
5534
  let a = [...i.tBodies[0].rows];
5537
5535
  this.snapshot.positions.forEach((e, t) => this.live.push({
5538
5536
  position: e,
5539
- price: a[t].cells[Zo],
5537
+ price: a[t].cells[Qo],
5540
5538
  pnl: n[t]
5541
5539
  }));
5542
5540
  }
5543
5541
  renderOrders() {
5544
5542
  let { formatPrice: e } = this.callbacks, t = this.snapshot.orders.map((t) => {
5545
- let n = Qo(Jo, t.type === "stopLimit" ? "stop" : t.type, "limit"), r = `${this.sideText(t.side, "trade")} ${t.quantity} @ ${e(t.price)}`;
5543
+ let n = $o(Yo, t.type === "stopLimit" ? "stop" : t.type, "limit"), r = `${this.sideText(t.side, "trade")} ${t.quantity} @ ${e(t.price)}`;
5546
5544
  return [
5547
5545
  this.sideCell(t.side, "trade"),
5548
5546
  this.t(`ticket.type.${n}`),
@@ -5550,7 +5548,7 @@ var rs = class {
5550
5548
  e(t.price),
5551
5549
  this.price(t.stopLoss),
5552
5550
  this.price(t.takeProfit),
5553
- t.timeInForce ? this.t(`ticket.tif.${Qo(Yo, t.timeInForce, "gtc")}`) : q,
5551
+ t.timeInForce ? this.t(`ticket.tif.${$o(Xo, t.timeInForce, "gtc")}`) : q,
5554
5552
  this.actions({
5555
5553
  icon: "x",
5556
5554
  label: `${this.t("account.cancelOrder")}: ${r}`,
@@ -5585,13 +5583,13 @@ var rs = class {
5585
5583
  }
5586
5584
  renderHistory() {
5587
5585
  let { formatPrice: e, formatTime: t } = this.callbacks, n = [...this.snapshot.fills].reverse().map((n) => {
5588
- let r = ts("");
5589
- return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className = ns(r.textContent)), [
5586
+ let r = ns("");
5587
+ return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className = rs(r.textContent)), [
5590
5588
  t(n.time),
5591
5589
  this.sideCell(n.side, "trade"),
5592
5590
  String(n.quantity),
5593
5591
  e(n.price),
5594
- this.t(`account.reason.${Qo(qo, n.reason, "order")}`),
5592
+ this.t(`account.reason.${$o(Jo, n.reason, "order")}`),
5595
5593
  r
5596
5594
  ];
5597
5595
  });
@@ -5613,11 +5611,11 @@ var rs = class {
5613
5611
  }
5614
5612
  ], n, "account.noFills");
5615
5613
  }
5616
- }, is = 1e-9;
5617
- function as(e, t) {
5614
+ }, as = 1e-9;
5615
+ function os(e, t) {
5618
5616
  return e.type === "market" ? t : e.price;
5619
5617
  }
5620
- function os(e, t, n = {}) {
5618
+ function ss(e, t, n = {}) {
5621
5619
  let r = [];
5622
5620
  (!(e.quantity > 0) || !Number.isFinite(e.quantity)) && r.push("quantity"), e.type !== "market" && (!(e.price > 0) || !Number.isFinite(e.price)) && r.push("price"), e.type === "market" && !((t ?? e.price) > 0) && r.push("market");
5623
5621
  let i = e.side === "buy";
@@ -5627,18 +5625,18 @@ function os(e, t, n = {}) {
5627
5625
  }
5628
5626
  let a = (e) => e === null || Number.isFinite(e) && e > 0;
5629
5627
  a(e.stopLoss) || r.push("stopLoss"), a(e.takeProfit) || r.push("takeProfit");
5630
- let o = as(e, t);
5631
- return o !== null && o > 0 && (e.stopLoss !== null && a(e.stopLoss) && (i ? e.stopLoss >= o : e.stopLoss <= o) && r.push("stopLossSide"), e.takeProfit !== null && a(e.takeProfit) && (i ? e.takeProfit <= o : e.takeProfit >= o) && r.push("takeProfitSide")), [...r, ...ss(e, n)];
5628
+ let o = os(e, t);
5629
+ return o !== null && o > 0 && (e.stopLoss !== null && a(e.stopLoss) && (i ? e.stopLoss >= o : e.stopLoss <= o) && r.push("stopLossSide"), e.takeProfit !== null && a(e.takeProfit) && (i ? e.takeProfit <= o : e.takeProfit >= o) && r.push("takeProfitSide")), [...r, ...cs(e, n)];
5632
5630
  }
5633
- function ss(e, t) {
5631
+ function cs(e, t) {
5634
5632
  let n = [], r = e.type === "market" ? null : e.price, i = [
5635
5633
  r,
5636
5634
  e.stopLoss,
5637
5635
  e.takeProfit
5638
5636
  ].filter((e) => e !== null && Number.isFinite(e) && e > 0), { roundPrice: a, limits: o, lot: s } = t;
5639
- return a && i.some((e) => Math.abs(a(e) - e) > is) && n.push("priceStep"), o && r !== null && r > 0 && (r > o.ceiling + is || r < o.floor - is) && n.push("priceLimits"), s !== void 0 && s > 1 && e.quantity > s && e.quantity % s !== 0 && n.push("lot"), n;
5637
+ return a && i.some((e) => Math.abs(a(e) - e) > as) && n.push("priceStep"), o && r !== null && r > 0 && (r > o.ceiling + as || r < o.floor - as) && n.push("priceLimits"), s !== void 0 && s > 1 && e.quantity > s && e.quantity % s !== 0 && n.push("lot"), n;
5640
5638
  }
5641
- function cs(e, t) {
5639
+ function ls(e, t) {
5642
5640
  let n = {
5643
5641
  side: e.side,
5644
5642
  type: e.type,
@@ -5647,14 +5645,14 @@ function cs(e, t) {
5647
5645
  };
5648
5646
  return e.type === "stop" && (n.stopPrice = e.price), e.type !== "market" && (n.timeInForce = e.timeInForce), e.stopLoss !== null && (n.stopLoss = e.stopLoss), e.takeProfit !== null && (n.takeProfit = e.takeProfit), n;
5649
5647
  }
5650
- function ls(e, t) {
5651
- let n = as(e, t);
5648
+ function us(e, t) {
5649
+ let n = os(e, t);
5652
5650
  if (n === null || e.stopLoss === null || e.takeProfit === null) return null;
5653
5651
  let r = Math.abs(n - e.stopLoss);
5654
5652
  return r > 0 ? Math.abs(e.takeProfit - n) / r : null;
5655
5653
  }
5656
- function us(e, t, n, r = 1) {
5657
- let i = as(e, t);
5654
+ function ds(e, t, n, r = 1) {
5655
+ let i = os(e, t);
5658
5656
  if (i === null || !(i > 0) || !Number.isFinite(n) || !(e.quantity > 0)) return null;
5659
5657
  let a = e.side === "buy" ? 1 : -1;
5660
5658
  return {
@@ -5662,18 +5660,18 @@ function us(e, t, n, r = 1) {
5662
5660
  amount: (n - i) * e.quantity * a * r
5663
5661
  };
5664
5662
  }
5665
- function ds(e, t, n = {}) {
5666
- let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i = as(e, t), a = i !== null && i > 0 && e.quantity > 0 ? i * e.quantity * r : null, o = os(e, t), s = (n, i) => n === null || o.includes(i) ? null : us(e, t, n, r)?.amount ?? null, c = s(e.stopLoss, "stopLossSide"), l = s(e.takeProfit, "takeProfitSide");
5663
+ function fs(e, t, n = {}) {
5664
+ let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i = os(e, t), a = i !== null && i > 0 && e.quantity > 0 ? i * e.quantity * r : null, o = ss(e, t), s = (n, i) => n === null || o.includes(i) ? null : ds(e, t, n, r)?.amount ?? null, c = s(e.stopLoss, "stopLossSide"), l = s(e.takeProfit, "takeProfitSide");
5667
5665
  return {
5668
5666
  value: a,
5669
5667
  risk: c,
5670
5668
  reward: l,
5671
- ratio: c !== null && l !== null ? ls(e, t) : null
5669
+ ratio: c !== null && l !== null ? us(e, t) : null
5672
5670
  };
5673
5671
  }
5674
5672
  //#endregion
5675
5673
  //#region src/widget/WidgetOrderTicket.ts
5676
- var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5674
+ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5677
5675
  backdrop;
5678
5676
  modal;
5679
5677
  symbolEl;
@@ -5684,11 +5682,11 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5684
5682
  draft = null;
5685
5683
  lastPrice = null;
5686
5684
  rules = {};
5687
- step = ys;
5688
- round = (e) => bs(e, e);
5685
+ step = bs;
5686
+ round = (e) => xs(e, e);
5689
5687
  typed = /* @__PURE__ */ new Map();
5690
5688
  returnFocus = null;
5691
- uid = ++gs;
5689
+ uid = ++_s;
5692
5690
  constructor(e, t, n = T) {
5693
5691
  this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
5694
5692
  let r = !1;
@@ -5697,7 +5695,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5697
5695
  }), this.backdrop.addEventListener("click", (e) => {
5698
5696
  e.target === this.backdrop && r && this.close(), r = !1;
5699
5697
  }), this.modal = document.createElement("div"), this.modal.className = "tcw-modal tcw-order-ticket", this.modal.setAttribute("role", "dialog"), this.modal.setAttribute("aria-modal", "true"), this.modal.setAttribute("aria-labelledby", `tcw-ticket-title-${this.uid}`), this.modal.addEventListener("keydown", (e) => {
5700
- if (e.key === "Escape" && !e.isComposing && e.keyCode !== fs) {
5698
+ if (e.key === "Escape" && !e.isComposing && e.keyCode !== ps) {
5701
5699
  e.stopPropagation(), this.close();
5702
5700
  return;
5703
5701
  }
@@ -5719,7 +5717,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5719
5717
  u.className = "tcw-footer-end", u.append(l, this.submit), c.append(u), this.modal.append(i, this.body, this.summaryEl, this.problemsEl, c), this.backdrop.appendChild(this.modal), e.appendChild(this.backdrop);
5720
5718
  }
5721
5719
  open(e) {
5722
- this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ?? ys, this.round = e.round ?? ((e) => bs(e, e)), this.typed.clear(), this.symbolEl.textContent = e.symbol ? O(e.symbol) : "";
5720
+ this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ?? bs, this.round = e.round ?? ((e) => xs(e, e)), this.typed.clear(), this.symbolEl.textContent = e.symbol ? O(e.symbol) : "";
5723
5721
  let t = this.round(e.price ?? e.lastPrice ?? 0), n = e.side ?? "buy", r = "market";
5724
5722
  e.price !== void 0 && e.lastPrice !== null && t !== e.lastPrice && (r = t < e.lastPrice == (n === "buy") ? "limit" : "stop"), this.draft = {
5725
5723
  side: n,
@@ -5755,14 +5753,14 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5755
5753
  return t > 0 ? Number((10 ** -t).toFixed(t)) : 1;
5756
5754
  }
5757
5755
  priceStep(e, t) {
5758
- return this.step(t > 0 ? e : e * hs);
5756
+ return this.step(t > 0 ? e : e * gs);
5759
5757
  }
5760
5758
  writePrice(e) {
5761
- return Number.isFinite(e) ? this.step === ys ? String(e) : e.toFixed(gt(this.step(e))) : "";
5759
+ return Number.isFinite(e) ? this.step === bs ? String(e) : e.toFixed(gt(this.step(e))) : "";
5762
5760
  }
5763
5761
  place() {
5764
5762
  let e = this.draft;
5765
- !e || os(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(cs(e, this.lastPrice)), this.close());
5763
+ !e || ss(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(ls(e, this.lastPrice)), this.close());
5766
5764
  }
5767
5765
  set(e, t = !1) {
5768
5766
  this.draft && (this.draft = {
@@ -5797,7 +5795,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5797
5795
  return r.className = "tcw-settings-label", r.textContent = this.t(e), n.append(r, t), n;
5798
5796
  }
5799
5797
  choices(e, t, n, r, i) {
5800
- let a = e === "type" ? "ticket.type" : "ticket.tif", o = vs(e, Pe(t.map((e) => ({
5798
+ let a = e === "type" ? "ticket.type" : "ticket.tif", o = ys(e, Pe(t.map((e) => ({
5801
5799
  value: e,
5802
5800
  label: this.t(`${a}.${e}`)
5803
5801
  })), n, i, this.t(r)));
@@ -5830,7 +5828,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5830
5828
  return this.stepped(e, t, (e, t) => this.priceStep(e, t), () => this.lastPrice ?? this.draft?.price ?? 0, (e) => this.writePrice(e), n);
5831
5829
  }
5832
5830
  stepped(e, t, n, r, i, a) {
5833
- let o = vs(e, document.createElement("input"));
5831
+ let o = ys(e, document.createElement("input"));
5834
5832
  o.type = "number", o.className = "tcw-indi-input", o.step = "any", o.min = "0", o.value = this.typed.get(e) ?? i(t);
5835
5833
  let s = this.t(`ticket.${e}`);
5836
5834
  o.setAttribute("aria-label", s), o.addEventListener("input", () => {
@@ -5868,25 +5866,25 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5868
5866
  if (!t) return NaN;
5869
5867
  let n = t.type === "market" ? this.lastPrice ?? t.price : t.price;
5870
5868
  if (!(n > 0)) return NaN;
5871
- let r = e === "stopLoss" ? -ps : ms;
5869
+ let r = e === "stopLoss" ? -ms : hs;
5872
5870
  return this.round(n * (1 + (t.side === "buy" ? r : -r) / 100));
5873
5871
  }
5874
5872
  check() {
5875
5873
  let e = this.draft;
5876
5874
  if (!e) return;
5877
- let t = os(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e));
5875
+ let t = ss(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e));
5878
5876
  n.join("\n") !== [...this.problemsEl.children].map((e) => e.textContent).join("\n") && this.problemsEl.replaceChildren(...n.map((e) => {
5879
5877
  let t = document.createElement("p");
5880
5878
  return t.textContent = e, t;
5881
5879
  }));
5882
5880
  for (let t of ["stopLoss", "takeProfit"]) {
5883
- let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null : us(e, this.lastPrice, r, this.rules.multiplier);
5881
+ let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null : ds(e, this.lastPrice, r, this.rules.multiplier);
5884
5882
  n && (n.textContent = i ? `${this.signedNumber(i.pct, 2)}% · ${this.amount(i.amount)}` : "");
5885
5883
  }
5886
5884
  this.renderSummary(e), this.submit.disabled = t.length > 0, this.submit.textContent = this.t(e.side === "buy" ? "ticket.placeBuy" : "ticket.placeSell");
5887
5885
  }
5888
5886
  renderSummary(e) {
5889
- let t = ds(e, this.lastPrice, this.rules), n = t.risk === null ? null : this.amount(t.risk), r = t.reward === null ? null : this.amount(t.reward), i = [
5887
+ let t = fs(e, this.lastPrice, this.rules), n = t.risk === null ? null : this.amount(t.risk), r = t.reward === null ? null : this.amount(t.reward), i = [
5890
5888
  [
5891
5889
  "value",
5892
5890
  "ticket.value",
@@ -5897,13 +5895,13 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5897
5895
  "risk",
5898
5896
  "ticket.risk",
5899
5897
  n,
5900
- n === null ? null : Go(n)
5898
+ n === null ? null : Ko(n)
5901
5899
  ],
5902
5900
  [
5903
5901
  "reward",
5904
5902
  "ticket.reward",
5905
5903
  r,
5906
- r === null ? null : Go(r)
5904
+ r === null ? null : Ko(r)
5907
5905
  ],
5908
5906
  [
5909
5907
  "ratio",
@@ -5925,10 +5923,10 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5925
5923
  return this.callbacks.formatNumber ? this.callbacks.formatNumber(e, t) : e.toFixed(t);
5926
5924
  }
5927
5925
  signedNumber(e, t) {
5928
- return Wo(this.number(Math.abs(e), t), e, this.number(0, t));
5926
+ return Go(this.number(Math.abs(e), t), e, this.number(0, t));
5929
5927
  }
5930
5928
  amount(e) {
5931
- return Wo(this.money(Math.abs(e)), e, this.money(0));
5929
+ return Go(this.money(Math.abs(e)), e, this.money(0));
5932
5930
  }
5933
5931
  money(e) {
5934
5932
  return (this.callbacks.formatAmount ?? this.callbacks.formatPrice)(e);
@@ -5941,20 +5939,20 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
5941
5939
  }) : e === "lot" ? w(t, { lot: r ?? 1 }) : t;
5942
5940
  }
5943
5941
  };
5944
- function vs(e, t) {
5942
+ function ys(e, t) {
5945
5943
  return t.dataset.ticketField = e, t;
5946
5944
  }
5947
- function ys(e) {
5945
+ function bs(e) {
5948
5946
  let t = Math.abs(e);
5949
5947
  return t > 0 ? 10 ** Math.floor(Math.log10(t / 100)) : 1;
5950
5948
  }
5951
- function bs(e, t) {
5949
+ function xs(e, t) {
5952
5950
  let n = Math.abs(t), r = n >= 10 || n === 0 ? 2 : n >= 1 ? 4 : Math.min(10, Math.ceil(-Math.log10(n)) + 3);
5953
5951
  return Number(e.toFixed(r));
5954
5952
  }
5955
5953
  //#endregion
5956
5954
  //#region src/widget/WidgetNamePrompt.ts
5957
- var xs = 0, Ss = class {
5955
+ var Ss = 0, Cs = class {
5958
5956
  backdrop;
5959
5957
  titleEl;
5960
5958
  input;
@@ -5962,7 +5960,7 @@ var xs = 0, Ss = class {
5962
5960
  request = null;
5963
5961
  returnFocus = null;
5964
5962
  busy = !1;
5965
- uid = ++xs;
5963
+ uid = ++Ss;
5966
5964
  constructor(e, t = T) {
5967
5965
  this.t = t, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
5968
5966
  let n = !1;
@@ -6022,13 +6020,13 @@ var xs = 0, Ss = class {
6022
6020
  }
6023
6021
  }
6024
6022
  }
6025
- }, Cs = 0, ws = class {
6023
+ }, ws = 0, Ts = class {
6026
6024
  el;
6027
6025
  input;
6028
6026
  hint;
6029
6027
  returnFocus = null;
6030
6028
  constructor(e, t, n) {
6031
- this.labels = t, this.onApply = n, this.el = document.createElement("div"), this.el.className = "tcw-interval-input", this.el.hidden = !0, this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "tcw-interval-field", this.input.autocomplete = "off", this.input.spellcheck = !1, this.input.maxLength = 6, this.input.setAttribute("aria-label", t.title), this.hint = document.createElement("div"), this.hint.className = "tcw-interval-hint", this.hint.setAttribute("role", "status"), this.hint.id = `tcw-interval-hint-${++Cs}`, this.input.setAttribute("aria-describedby", this.hint.id), this.el.append(this.input, this.hint), e.appendChild(this.el), this.input.addEventListener("input", () => this.check()), this.input.addEventListener("keydown", (e) => {
6029
+ this.labels = t, this.onApply = n, this.el = document.createElement("div"), this.el.className = "tcw-interval-input", this.el.hidden = !0, this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "tcw-interval-field", this.input.autocomplete = "off", this.input.spellcheck = !1, this.input.maxLength = 6, this.input.setAttribute("aria-label", t.title), this.hint = document.createElement("div"), this.hint.className = "tcw-interval-hint", this.hint.setAttribute("role", "status"), this.hint.id = `tcw-interval-hint-${++ws}`, this.input.setAttribute("aria-describedby", this.hint.id), this.el.append(this.input, this.hint), e.appendChild(this.el), this.input.addEventListener("input", () => this.check()), this.input.addEventListener("keydown", (e) => {
6032
6030
  e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), this.apply()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close());
6033
6031
  }), this.input.addEventListener("blur", () => this.close(!1));
6034
6032
  }
@@ -6059,7 +6057,7 @@ var xs = 0, Ss = class {
6059
6057
  }
6060
6058
  this.input.setAttribute("aria-invalid", "true"), this.hint.textContent = this.labels.invalid;
6061
6059
  }
6062
- }, Ts = class {
6060
+ }, Es = class {
6063
6061
  constructor(e = "tcw:indicator-templates") {
6064
6062
  this.key = e;
6065
6063
  }
@@ -6104,28 +6102,28 @@ var xs = 0, Ss = class {
6104
6102
  localStorage.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
6105
6103
  } catch {}
6106
6104
  }
6107
- }, Es = [
6105
+ }, Ds = [
6108
6106
  "regular",
6109
6107
  "logarithmic",
6110
6108
  "percentage",
6111
6109
  "indexedTo100"
6112
- ], Ds = (e) => typeof e == "object" && !!e && !Array.isArray(e);
6113
- function Os(e) {
6110
+ ], Os = (e) => typeof e == "object" && !!e && !Array.isArray(e);
6111
+ function ks(e) {
6114
6112
  let { theme: t, timestamp: n, ...r } = e;
6115
6113
  return r;
6116
6114
  }
6117
- function ks(e) {
6118
- return !Ds(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(nt(e.timeframe) || D(e.timeframe) !== null) ? null : {
6115
+ function As(e) {
6116
+ return !Os(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(nt(e.timeframe) || D(e.timeframe) !== null) ? null : {
6119
6117
  v: 1,
6120
6118
  symbol: e.symbol,
6121
6119
  timeframe: e.timeframe,
6122
- scaleMode: Es.find((t) => t === e.scaleMode) ?? "regular",
6120
+ scaleMode: Ds.find((t) => t === e.scaleMode) ?? "regular",
6123
6121
  invertScale: e.invertScale === !0,
6124
- chart: Ds(e.chart) ? Os(e.chart) : null,
6125
- ...Ds(e.settings) ? { settings: W(e.settings, Pa) } : {}
6122
+ chart: Os(e.chart) ? ks(e.chart) : null,
6123
+ ...Os(e.settings) ? { settings: W(e.settings, Pa) } : {}
6126
6124
  };
6127
6125
  }
6128
- function As(e) {
6126
+ function js(e) {
6129
6127
  try {
6130
6128
  return JSON.parse(e);
6131
6129
  } catch {
@@ -6134,16 +6132,16 @@ function As(e) {
6134
6132
  }
6135
6133
  //#endregion
6136
6134
  //#region src/widget/DrawingFavoritesStore.ts
6137
- function js() {
6135
+ function Ms() {
6138
6136
  try {
6139
6137
  return typeof localStorage < "u" ? localStorage : null;
6140
6138
  } catch {
6141
6139
  return null;
6142
6140
  }
6143
6141
  }
6144
- var Ms = class {
6142
+ var Ns = class {
6145
6143
  favorites = [];
6146
- constructor(e = "tcw:draw-favorites", t = js()) {
6144
+ constructor(e = "tcw:draw-favorites", t = Ms()) {
6147
6145
  this.storageKey = e, this.storage = t, this.load();
6148
6146
  }
6149
6147
  list() {
@@ -6180,7 +6178,7 @@ var Ms = class {
6180
6178
  };
6181
6179
  //#endregion
6182
6180
  //#region src/widget/keyboardInset.ts
6183
- function Ns(e) {
6181
+ function Ps(e) {
6184
6182
  let t = typeof window < "u" ? window.visualViewport : null;
6185
6183
  if (!t) return () => {};
6186
6184
  let n = -1, r = () => {
@@ -6194,7 +6192,7 @@ function Ns(e) {
6194
6192
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
6195
6193
  };
6196
6194
  }
6197
- function Ps(e, t) {
6195
+ function Fs(e, t) {
6198
6196
  let n = null, r = () => {
6199
6197
  let r = e.clientWidth;
6200
6198
  if (r === 0 && n !== null) return;
@@ -6218,7 +6216,7 @@ function J(e) {
6218
6216
  }
6219
6217
  };
6220
6218
  }
6221
- var Fs = class {
6219
+ var Is = class {
6222
6220
  part = null;
6223
6221
  loading = null;
6224
6222
  gone = !1;
@@ -6244,23 +6242,23 @@ var Fs = class {
6244
6242
  this.gone = !0, this.part && this.dispose(this.part), this.part = null;
6245
6243
  }
6246
6244
  }, Y = {
6247
- settings: J(() => import("../WidgetSettings-Ds8LIQJL.js")),
6248
- indicatorSettings: J(() => import("../WidgetIndicatorSettings-DcRbZpJJ.js")),
6249
- drawingSettings: J(() => import("../WidgetDrawingSettings-DBBFUUg7.js")),
6245
+ settings: J(() => import("../WidgetSettings-BsjEg-Dj.js")),
6246
+ indicatorSettings: J(() => import("../WidgetIndicatorSettings-D3W40Nud.js")),
6247
+ drawingSettings: J(() => import("../WidgetDrawingSettings-Cwds8CdJ.js")),
6250
6248
  goToDate: J(() => import("../WidgetGoToDate-hcDtezRm.js")),
6251
6249
  hotkeySheet: J(() => import("../WidgetHotkeySheet-1lRFSdvt.js")),
6252
- indicatorPicker: J(() => import("../WidgetIndicatorPicker-CcIYSWPd.js")),
6253
- commandPalette: J(() => import("../WidgetCommandPalette-BRVQZRQe.js")),
6254
- symbolSearch: J(() => import("../WidgetSymbolSearch-W9ZoSxTR.js"))
6250
+ indicatorPicker: J(() => import("../WidgetIndicatorPicker-DsFCT2xZ.js")),
6251
+ commandPalette: J(() => import("../WidgetCommandPalette-DpP-lG1A.js")),
6252
+ symbolSearch: J(() => import("../WidgetSymbolSearch-Cxxq4SrK.js"))
6255
6253
  };
6256
- async function Is() {
6254
+ async function Ls() {
6257
6255
  await Promise.all(Object.values(Y).map((e) => e.load().catch(() => null)));
6258
6256
  }
6259
6257
  //#endregion
6260
6258
  //#region src/widget/wallTime.ts
6261
- var Ls = /^(\d{4})-(\d{2})-(\d{2})$/, Rs = /^(\d{2}):(\d{2})$/;
6262
- function zs(e, t, n) {
6263
- let r = Ls.exec(e), i = t ? Rs.exec(t) : [
6259
+ var Rs = /^(\d{4})-(\d{2})-(\d{2})$/, zs = /^(\d{2}):(\d{2})$/;
6260
+ function Bs(e, t, n) {
6261
+ let r = Rs.exec(e), i = t ? zs.exec(t) : [
6264
6262
  "",
6265
6263
  "00",
6266
6264
  "00"
@@ -6290,7 +6288,7 @@ var Z = {
6290
6288
  min: 233,
6291
6289
  default: 262,
6292
6290
  max: 377
6293
- }, Bs = .382, Vs = (e) => !e.hidden && getComputedStyle(e).display !== "none", Hs = class {
6291
+ }, Vs = .382, Hs = (e) => !e.hidden && getComputedStyle(e).display !== "none", Us = class {
6294
6292
  element;
6295
6293
  panel;
6296
6294
  rail;
@@ -6337,7 +6335,7 @@ var Z = {
6337
6335
  let t = this.panel.contains(document.activeElement);
6338
6336
  if (this.hideCurrent(), this.panel.hidden = !0, t) {
6339
6337
  let t = this.pages.get(e)?.button;
6340
- (t && (this.options.railShown?.() ?? !0) && Vs(t) ? t : this.options.focusAfterClose?.(e))?.focus();
6338
+ (t && (this.options.railShown?.() ?? !0) && Hs(t) ? t : this.options.focusAfterClose?.(e))?.focus();
6341
6339
  }
6342
6340
  this.options.onChange?.(null);
6343
6341
  }
@@ -6354,7 +6352,7 @@ var Z = {
6354
6352
  return this.open_ === e;
6355
6353
  }
6356
6354
  syncRail() {
6357
- let e = [...this.pages.values()].map((e) => e.button), t = e.filter(Vs), n = e.find((e) => e.tabIndex === 0);
6355
+ let e = [...this.pages.values()].map((e) => e.button), t = e.filter(Hs), n = e.find((e) => e.tabIndex === 0);
6358
6356
  if (n && t.includes(n)) return;
6359
6357
  let r = t.find((e) => e.getAttribute("aria-pressed") === "true") ?? t[0];
6360
6358
  for (let t of e) t.tabIndex = t === r ? 0 : -1;
@@ -6378,7 +6376,7 @@ var Z = {
6378
6376
  }
6379
6377
  maxNow() {
6380
6378
  let e = this.options.room?.() ?? 0, t = Math.round(Z.max * this.scale);
6381
- return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e * Bs)));
6379
+ return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e * Vs)));
6382
6380
  }
6383
6381
  clamp(e, t = this.maxNow()) {
6384
6382
  return Math.round(Math.min(t, Math.max(this.min(), e)));
@@ -6422,12 +6420,12 @@ var Z = {
6422
6420
  for (let { button: t } of this.pages.values()) t.tabIndex = t === e ? 0 : -1;
6423
6421
  }
6424
6422
  onRailKey(e) {
6425
- let t = [...this.pages.values()].map((e) => e.button).filter(Vs), n = t.indexOf(e.target);
6423
+ let t = [...this.pages.values()].map((e) => e.button).filter(Hs), n = t.indexOf(e.target);
6426
6424
  if (n < 0) return;
6427
6425
  let r = e.key === "ArrowDown" ? (n + 1) % t.length : e.key === "ArrowUp" ? (n - 1 + t.length) % t.length : e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : -1;
6428
6426
  r < 0 || (e.preventDefault(), t[r].focus());
6429
6427
  }
6430
- }, Us = [
6428
+ }, Ws = [
6431
6429
  "percent",
6432
6430
  "scale",
6433
6431
  "pane",
@@ -6435,7 +6433,7 @@ var Z = {
6435
6433
  "ratio",
6436
6434
  "correlation",
6437
6435
  "correlationLog"
6438
- ], Ws = {
6436
+ ], Gs = {
6439
6437
  percent: "compare.percent",
6440
6438
  scale: "compare.ownScale",
6441
6439
  pane: "compare.ownPane",
@@ -6444,24 +6442,24 @@ var Z = {
6444
6442
  correlation: "compare.way.correlation",
6445
6443
  correlationLog: "compare.way.correlationLog"
6446
6444
  };
6447
- function Gs(e) {
6448
- return Us.includes(e);
6449
- }
6450
6445
  function Ks(e) {
6451
- return Us.map((t) => ({
6446
+ return Ws.includes(e);
6447
+ }
6448
+ function qs(e) {
6449
+ return Ws.map((t) => ({
6452
6450
  id: t,
6453
- label: e(Ws[t])
6451
+ label: e(Gs[t])
6454
6452
  }));
6455
6453
  }
6456
- function qs(e, t) {
6454
+ function Js(e, t) {
6457
6455
  let n = e.findIndex((e) => e.time >= t);
6458
6456
  return n < 0 ? e.length : n;
6459
6457
  }
6460
- function Js(e, t) {
6458
+ function Ys(e, t) {
6461
6459
  let n = e[0]?.time ?? Infinity, r = t.filter((e) => e.time < n);
6462
6460
  return r.length > 0 ? [...r, ...e] : null;
6463
6461
  }
6464
- function Ys(e, t) {
6462
+ function Xs(e, t) {
6465
6463
  switch (e.id) {
6466
6464
  case "compareSymbol": return t ? "pane" : "scale";
6467
6465
  case "compareSymbolPane": return "pane";
@@ -6471,24 +6469,24 @@ function Ys(e, t) {
6471
6469
  default: return null;
6472
6470
  }
6473
6471
  }
6474
- function Xs(e, t, n, r) {
6472
+ function Zs(e, t, n, r) {
6475
6473
  let i = e.map((e) => ({
6476
6474
  id: e.id,
6477
6475
  symbol: e.symbol,
6478
- way: r(Ws.percent),
6476
+ way: r(Gs.percent),
6479
6477
  color: e.color
6480
6478
  }));
6481
6479
  for (let e of t) {
6482
- let t = e.params.symbol, a = Ys(e, n.has(e.instanceId));
6480
+ let t = e.params.symbol, a = Xs(e, n.has(e.instanceId));
6483
6481
  !a || typeof t != "string" || !t || i.push({
6484
6482
  id: e.instanceId,
6485
6483
  symbol: t,
6486
- way: r(Ws[a])
6484
+ way: r(Gs[a])
6487
6485
  });
6488
6486
  }
6489
6487
  return i;
6490
6488
  }
6491
- var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", ec = class {
6489
+ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", tc = class {
6492
6490
  el;
6493
6491
  target = null;
6494
6492
  source = null;
@@ -6499,9 +6497,9 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
6499
6497
  observer;
6500
6498
  constructor(e) {
6501
6499
  this.root = e, this.el = document.createElement("div"), this.el.className = "tcw-tooltip", this.el.setAttribute("aria-hidden", "true"), e.appendChild(this.el), e.addEventListener("pointerover", this.onOver), e.addEventListener("pointerout", this.onOut), e.addEventListener("pointerdown", this.onPress, !0), e.addEventListener("keydown", this.onPress, !0), e.addEventListener("focusin", this.onFocus), e.addEventListener("focusout", this.onBlur), e.addEventListener("wheel", this.hide, { passive: !0 }), this.observer = new MutationObserver(() => {
6502
- this.pressed?.hasAttribute("title") && tc(this.pressed);
6500
+ this.pressed?.hasAttribute("title") && nc(this.pressed);
6503
6501
  let e = this.target;
6504
- !e || this.source !== "pointer" || !e.hasAttribute("title") || (tc(e), this.isVisible() && this.show(e));
6502
+ !e || this.source !== "pointer" || !e.hasAttribute("title") || (nc(e), this.isVisible() && this.show(e));
6505
6503
  }), this.observer.observe(e, {
6506
6504
  subtree: !0,
6507
6505
  attributes: !0,
@@ -6509,24 +6507,24 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
6509
6507
  });
6510
6508
  }
6511
6509
  destroy() {
6512
- this.hide(), this.pressed && nc(this.pressed), this.observer.disconnect(), this.root.removeEventListener("pointerover", this.onOver), this.root.removeEventListener("pointerout", this.onOut), this.root.removeEventListener("pointerdown", this.onPress, !0), this.root.removeEventListener("keydown", this.onPress, !0), this.root.removeEventListener("focusin", this.onFocus), this.root.removeEventListener("focusout", this.onBlur), this.root.removeEventListener("wheel", this.hide), this.el.remove();
6510
+ this.hide(), this.pressed && rc(this.pressed), this.observer.disconnect(), this.root.removeEventListener("pointerover", this.onOver), this.root.removeEventListener("pointerout", this.onOut), this.root.removeEventListener("pointerdown", this.onPress, !0), this.root.removeEventListener("keydown", this.onPress, !0), this.root.removeEventListener("focusin", this.onFocus), this.root.removeEventListener("focusout", this.onBlur), this.root.removeEventListener("wheel", this.hide), this.el.remove();
6513
6511
  }
6514
6512
  onOver = (e) => {
6515
6513
  if (e.pointerType === "touch") return;
6516
6514
  let t = this.tipTarget(e.target);
6517
- !t || t === this.pressed || t === this.target && this.source === "pointer" || (tc(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
6515
+ !t || t === this.pressed || t === this.target && this.source === "pointer" || (nc(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
6518
6516
  };
6519
6517
  onOut = (e) => {
6520
6518
  let t = e.relatedTarget, n = (e) => !!e && !!t && e.contains(t);
6521
- this.pressed && !n(this.pressed) && (nc(this.pressed), this.pressed = null), this.source === "pointer" && !n(this.target) && this.hide();
6519
+ this.pressed && !n(this.pressed) && (rc(this.pressed), this.pressed = null), this.source === "pointer" && !n(this.target) && this.hide();
6522
6520
  };
6523
6521
  onPress = () => {
6524
6522
  let e = this.target, t = this.source === "pointer";
6525
- this.warmUntil = 0, this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.el.classList.remove("tcw-tooltip--visible"), this.target = null, this.source = null, this.pressed && this.pressed !== e && nc(this.pressed), this.pressed = t ? e : null;
6523
+ this.warmUntil = 0, this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.el.classList.remove("tcw-tooltip--visible"), this.target = null, this.source = null, this.pressed && this.pressed !== e && rc(this.pressed), this.pressed = t ? e : null;
6526
6524
  };
6527
6525
  onFocus = (e) => {
6528
6526
  let t = this.tipTarget(e.target);
6529
- !t || !ac(t) || t === this.pressed || this.schedule(t, "focus", !0);
6527
+ !t || !oc(t) || t === this.pressed || this.schedule(t, "focus", !0);
6530
6528
  };
6531
6529
  onBlur = (e) => {
6532
6530
  if (this.source !== "focus") return;
@@ -6534,16 +6532,16 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
6534
6532
  this.target && t && this.target.contains(t) || this.hide();
6535
6533
  };
6536
6534
  hide = () => {
6537
- this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" && nc(this.target), this.target = null, this.source = null;
6535
+ this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" && rc(this.target), this.target = null, this.source = null;
6538
6536
  };
6539
6537
  tipTarget(e) {
6540
6538
  if (!(e instanceof Element)) return null;
6541
- let t = e.closest($s);
6539
+ let t = e.closest(ec);
6542
6540
  return t && t !== this.el && this.root.contains(t) ? t : null;
6543
6541
  }
6544
6542
  schedule(e, t, n) {
6545
6543
  let r = this.target;
6546
- if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" && nc(r), this.target = e, this.source = t, n) {
6544
+ if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" && rc(r), this.target = e, this.source = t, n) {
6547
6545
  this.show(e);
6548
6546
  return;
6549
6547
  }
@@ -6552,27 +6550,27 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
6552
6550
  }, 300);
6553
6551
  }
6554
6552
  show(e) {
6555
- if (!ic(e)) {
6553
+ if (!ac(e)) {
6556
6554
  this.hide();
6557
6555
  return;
6558
6556
  }
6559
- this.el.textContent = rc(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
6557
+ this.el.textContent = ic(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
6560
6558
  }
6561
6559
  watch(e) {
6562
6560
  cancelAnimationFrame(this.watchFrame), this.watchFrame = requestAnimationFrame(() => {
6563
- this.target === e && (ic(e) ? this.watch(e) : this.hide());
6561
+ this.target === e && (ac(e) ? this.watch(e) : this.hide());
6564
6562
  });
6565
6563
  }
6566
6564
  place(e) {
6567
- let t = this.root.getBoundingClientRect(), n = e.getBoundingClientRect(), r = this.el.offsetWidth, i = this.el.offsetHeight, a = n.left - t.left, o = n.top - t.top, s = oc(e);
6565
+ let t = this.root.getBoundingClientRect(), n = e.getBoundingClientRect(), r = this.el.offsetWidth, i = this.el.offsetHeight, a = n.left - t.left, o = n.top - t.top, s = sc(e);
6568
6566
  s === "bottom" && o + n.height + Q + i > t.height ? s = "top" : s === "top" && o - Q - i < 0 ? s = "bottom" : s === "right" && a + n.width + Q + r > t.width && (s = "left");
6569
6567
  let c, l;
6570
- s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + Q : o - Q - i) : (c = s === "right" ? a + n.width + Q : a - Q - r, l = o + n.height / 2 - i / 2), c = Math.max(Zs, Math.min(t.width - r - Zs, c)), l = Math.max(Zs, Math.min(t.height - i - Zs, l)), this.el.style.left = `${Math.round(c)}px`, this.el.style.top = `${Math.round(l)}px`;
6568
+ s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + Q : o - Q - i) : (c = s === "right" ? a + n.width + Q : a - Q - r, l = o + n.height / 2 - i / 2), c = Math.max(Qs, Math.min(t.width - r - Qs, c)), l = Math.max(Qs, Math.min(t.height - i - Qs, l)), this.el.style.left = `${Math.round(c)}px`, this.el.style.top = `${Math.round(l)}px`;
6571
6569
  let u = {
6572
- top: [0, Qs],
6573
- bottom: [0, -Qs],
6574
- left: [Qs, 0],
6575
- right: [-Qs, 0]
6570
+ top: [0, $s],
6571
+ bottom: [0, -$s],
6572
+ left: [$s, 0],
6573
+ right: [-$s, 0]
6576
6574
  }[s];
6577
6575
  this.el.style.setProperty("--tcw-tip-dx", `${u[0]}px`), this.el.style.setProperty("--tcw-tip-dy", `${u[1]}px`), this.el.dataset.side = s;
6578
6576
  }
@@ -6583,32 +6581,32 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
6583
6581
  this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
6584
6582
  }
6585
6583
  };
6586
- function tc(e) {
6584
+ function nc(e) {
6587
6585
  let t = e.getAttribute("title");
6588
6586
  t !== null && (e.dataset.tip = t, e.removeAttribute("title"));
6589
6587
  }
6590
- function nc(e) {
6588
+ function rc(e) {
6591
6589
  e.dataset.tip !== void 0 && !e.hasAttribute("title") && (e.setAttribute("title", e.dataset.tip), delete e.dataset.tip);
6592
6590
  }
6593
- function rc(e) {
6591
+ function ic(e) {
6594
6592
  return e.dataset.tip ?? e.getAttribute("title") ?? "";
6595
6593
  }
6596
- function ic(e) {
6594
+ function ac(e) {
6597
6595
  return e.isConnected && e.getClientRects().length > 0 && !e.disabled;
6598
6596
  }
6599
- function ac(e) {
6597
+ function oc(e) {
6600
6598
  try {
6601
6599
  return e.matches(":focus-visible");
6602
6600
  } catch {
6603
6601
  return !1;
6604
6602
  }
6605
6603
  }
6606
- function oc(e) {
6604
+ function sc(e) {
6607
6605
  return e.dataset.tipSide || (e.closest(".tcw-sidebar") ? "right" : e.closest(".tcw-statusbar, .tcw-replay-bar") ? "top" : "bottom");
6608
6606
  }
6609
6607
  //#endregion
6610
6608
  //#region src/widget/WidgetIndicatorLegend.ts
6611
- var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class {
6609
+ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class {
6612
6610
  stack;
6613
6611
  toggle;
6614
6612
  rows = /* @__PURE__ */ new Map();
@@ -6622,7 +6620,7 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
6622
6620
  this.host = e, this.callbacks = t, this.labels = n, this.stack = document.createElement("div"), this.stack.className = "tcw-ind-legend", y(this.stack, "indicatorLegend"), this.toggle = document.createElement("button"), this.toggle.type = "button", this.toggle.className = "tcw-ind-legend-toggle", this.toggle.addEventListener("click", () => {
6623
6621
  this.setCollapsed(!this.collapsed), this.renderToggle(this.overlayCount());
6624
6622
  }), this.stack.appendChild(this.toggle), e.appendChild(this.stack), this.stackObserver = typeof ResizeObserver > "u" || !t.onStackResize ? null : new ResizeObserver(() => this.reportStackSize()), this.stackObserver?.observe(this.stack), this.valuesObserver = typeof ResizeObserver > "u" ? null : new ResizeObserver((e) => {
6625
- for (let t of e) fc(t.target, t.contentRect.width);
6623
+ for (let t of e) pc(t.target, t.contentRect.width);
6626
6624
  });
6627
6625
  }
6628
6626
  update(e, t, n = []) {
@@ -6714,7 +6712,7 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
6714
6712
  }, c = s("visible", "eye", () => {
6715
6713
  this.callbacks.onToggleVisible(e, !m.visible, t);
6716
6714
  }, "indicatorLegend.visibility"), l = n ? null : s("settings", "settings", () => this.callbacks.onSettings(e), "indicatorSettings", "indicatorLegend.settings"), u = this.callbacks.onMore && !n ? s("more", "more", () => this.callbacks.onMore?.(e, u), "indicatorLegend.more") : null, d = s("remove", "x", () => this.callbacks.onRemove(e, t), "indicatorLegend.remove"), f = document.createElement("span");
6717
- f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++uc}`;
6715
+ f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++dc}`;
6718
6716
  let p = n ? document.createElement("span") : null;
6719
6717
  p && (p.className = "tcw-ind-legend-swatch", p.setAttribute("aria-hidden", "true"), r.append(p)), r.append(i, a, o, f);
6720
6718
  let m = {
@@ -6768,7 +6766,7 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
6768
6766
  return this.stack.querySelectorAll(":scope > .tcw-ind-legend-row").length;
6769
6767
  }
6770
6768
  renderToggle(e) {
6771
- let t = e >= sc;
6769
+ let t = e >= cc;
6772
6770
  !t && this.collapsed && this.setCollapsed(!1);
6773
6771
  let n = `${t}|${this.collapsed}|${e}`;
6774
6772
  if (n === this.toggleKey || (this.toggleKey = n, this.toggle.hidden = !t, !t)) return;
@@ -6778,19 +6776,19 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
6778
6776
  this.toggle.innerHTML = this.collapsed ? `${i}<span>${e}</span>` : i;
6779
6777
  }
6780
6778
  };
6781
- function fc(e, t) {
6782
- let n = (parseFloat(getComputedStyle(e).fontSize) || 0) * cc;
6783
- e.classList.toggle(lc, t < n);
6779
+ function pc(e, t) {
6780
+ let n = (parseFloat(getComputedStyle(e).fontSize) || 0) * lc;
6781
+ e.classList.toggle(uc, t < n);
6784
6782
  }
6785
6783
  function $(e, t, n) {
6786
6784
  e.title = t, e.setAttribute("aria-label", n ? `${t} ${n}` : t);
6787
6785
  }
6788
6786
  //#endregion
6789
6787
  //#region src/widget/legendValues.ts
6790
- function pc(e, t) {
6788
+ function mc(e, t) {
6791
6789
  return !e || e.length === 0 ? null : e[t === null ? e.length - 1 : Math.min(Math.max(t, 0), e.length - 1)] ?? null;
6792
6790
  }
6793
- function mc(e, t, n, r) {
6791
+ function hc(e, t, n, r) {
6794
6792
  if (!t) return [];
6795
6793
  let i = e.plots;
6796
6794
  if (!i) {
@@ -6820,20 +6818,20 @@ function mc(e, t, n, r) {
6820
6818
  }
6821
6819
  return o;
6822
6820
  }
6823
- var hc = /* @__PURE__ */ new Map();
6824
- function gc(e) {
6825
- let t = hc.get(e);
6821
+ var gc = /* @__PURE__ */ new Map();
6822
+ function _c(e) {
6823
+ let t = gc.get(e);
6826
6824
  return t || (t = new Intl.NumberFormat(e, {
6827
6825
  notation: "compact",
6828
6826
  maximumFractionDigits: 2
6829
- }), hc.set(e, t)), t;
6827
+ }), gc.set(e, t)), t;
6830
6828
  }
6831
- function _c(e, t = "en-US") {
6832
- return Math.abs(e) >= 1e6 ? gc(t).format(e) : $e(e, Mt(e), t);
6829
+ function vc(e, t = "en-US") {
6830
+ return Math.abs(e) >= 1e6 ? _c(t).format(e) : $e(e, Mt(e), t);
6833
6831
  }
6834
6832
  //#endregion
6835
6833
  //#region src/widget/WidgetBracketBar.ts
6836
- var vc = class {
6834
+ var yc = class {
6837
6835
  el;
6838
6836
  labelEl;
6839
6837
  callbacks;
@@ -6861,7 +6859,7 @@ var vc = class {
6861
6859
  destroy() {
6862
6860
  this.el.remove();
6863
6861
  }
6864
- }, yc = class {
6862
+ }, bc = class {
6865
6863
  options;
6866
6864
  audioCtx = null;
6867
6865
  audioEl = null;
@@ -6924,7 +6922,7 @@ var vc = class {
6924
6922
  };
6925
6923
  //#endregion
6926
6924
  //#region src/widget/ladderRows.ts
6927
- function bc(e, t = 12) {
6925
+ function xc(e, t = 12) {
6928
6926
  let n = [...e.asks].sort((e, t) => e.price - t.price).slice(0, t), r = [...e.bids].sort((e, t) => t.price - e.price).slice(0, t), i = n.length > 0 ? n[0].price : null, a = r.length > 0 ? r[0].price : null, o = i !== null && a !== null ? (i + a) / 2 : null, s = /* @__PURE__ */ new Map(), c = (e) => {
6929
6927
  let t = s.get(e);
6930
6928
  return t || (t = {
@@ -6947,7 +6945,7 @@ function bc(e, t = 12) {
6947
6945
  }
6948
6946
  //#endregion
6949
6947
  //#region src/widget/WidgetDepthLadder.ts
6950
- var xc = 1e-9, Sc = class {
6948
+ var Sc = 1e-9, Cc = class {
6951
6949
  el;
6952
6950
  colsEl;
6953
6951
  bodyEl;
@@ -6993,7 +6991,7 @@ var xc = 1e-9, Sc = class {
6993
6991
  this.open && (this.open = !1, this.el.hidden = !0, this.callbacks.onToggle?.(!1));
6994
6992
  }
6995
6993
  setData(e) {
6996
- this.model = e ? bc(e, this.levels) : null, this.render();
6994
+ this.model = e ? xc(e, this.levels) : null, this.render();
6997
6995
  }
6998
6996
  setOrders(e) {
6999
6997
  this.orders = e, this.render();
@@ -7009,7 +7007,7 @@ var xc = 1e-9, Sc = class {
7009
7007
  e.className = "tcw-ladder-empty", e.textContent = this.t("ladder.empty"), this.bodyEl.replaceChildren(e), this.drawn = [];
7010
7008
  return;
7011
7009
  }
7012
- let t = Cc(e.rows);
7010
+ let t = wc(e.rows);
7013
7011
  e.rows.length === this.drawn.length && e.rows.every((e, t) => e.price === this.drawn[t].price) || (this.drawn = e.rows.map((e) => this.newRow(e.price)), this.bodyEl.replaceChildren(...this.drawn.map((e) => e.row)));
7014
7012
  let n = e.maxVolume > 0 ? 100 / e.maxVolume : 0;
7015
7013
  e.rows.forEach((e, r) => this.fillRow(this.drawn[r], e, n, this.nearness(e.price, t))), this.putSpread(e, t), this.placeSpread();
@@ -7067,7 +7065,7 @@ var xc = 1e-9, Sc = class {
7067
7065
  return;
7068
7066
  }
7069
7067
  e.disabled = !1;
7070
- let a = wc(n);
7068
+ let a = Tc(n);
7071
7069
  e.textContent = a, e.style.setProperty("--w", `${(n * i).toFixed(1)}%`);
7072
7070
  let o = w(this.t(t === "sell" ? "ladder.sellAt" : "ladder.buyAt"), { price: this.callbacks.formatPrice(r) });
7073
7071
  e.setAttribute("aria-label", `${a}, ${o}`), e.title = o;
@@ -7079,15 +7077,15 @@ var xc = 1e-9, Sc = class {
7079
7077
  e.scrollTop += r - n - (e.clientHeight - n - this.spreadEl.offsetHeight) / 2, this.placed = !0;
7080
7078
  }
7081
7079
  };
7082
- function Cc(e) {
7080
+ function wc(e) {
7083
7081
  let t = Infinity;
7084
7082
  for (let n = 1; n < e.length; n++) t = Math.min(t, Math.abs(e[n - 1].price - e[n].price));
7085
- return Number.isFinite(t) && t > 0 ? t / 2 : xc;
7083
+ return Number.isFinite(t) && t > 0 ? t / 2 : Sc;
7086
7084
  }
7087
- function wc(e) {
7085
+ function Tc(e) {
7088
7086
  return e >= 1e3 ? `${Number((e / 1e3).toFixed(1))}k` : String(Number(e >= 1 ? e.toFixed(2) : e.toPrecision(2)));
7089
7087
  }
7090
- var Tc = class {
7088
+ var Ec = class {
7091
7089
  el;
7092
7090
  bodyEl;
7093
7091
  callbacks;
@@ -7129,11 +7127,11 @@ var Tc = class {
7129
7127
  let t = this.callbacks.formatPrice, n = e.ohlc;
7130
7128
  this.bodyEl.appendChild(this.row(this.t("dataWindow.open"), t(n.open))), this.bodyEl.appendChild(this.row(this.t("dataWindow.high"), t(n.high))), this.bodyEl.appendChild(this.row(this.t("dataWindow.low"), t(n.low))), this.bodyEl.appendChild(this.row(this.t("dataWindow.close"), t(n.close)));
7131
7129
  let r = e.change > 0 ? "up" : e.change < 0 ? "down" : "", i = e.change > 0 ? "+" : "", a = this.callbacks.formatPercent?.(e.changePct) ?? e.changePct.toFixed(2), o = e.changeText ?? t(e.change);
7132
- this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${o} (${i}${a}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), (this.callbacks.formatVolume ?? Dc)(n.volume)));
7130
+ this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${o} (${i}${a}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), (this.callbacks.formatVolume ?? Oc)(n.volume)));
7133
7131
  for (let t of e.indicators) {
7134
7132
  let e = document.createElement("div");
7135
7133
  e.className = "tcw-datawin-sub", e.textContent = t.name, this.bodyEl.appendChild(e);
7136
- for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ?? Ec(e.value)));
7134
+ for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ?? Dc(e.value)));
7137
7135
  }
7138
7136
  }
7139
7137
  row(e, t, n = "") {
@@ -7145,15 +7143,15 @@ var Tc = class {
7145
7143
  return a.className = `tcw-datawin-value${n ? ` tcw-${n}` : ""}`, a.textContent = t, r.appendChild(i), r.appendChild(a), r;
7146
7144
  }
7147
7145
  };
7148
- function Ec(e) {
7146
+ function Dc(e) {
7149
7147
  if (!Number.isFinite(e)) return "—";
7150
7148
  let t = Math.abs(e);
7151
7149
  return t >= 1e3 ? e.toFixed(2) : t >= 1 ? e.toFixed(4) : e.toPrecision(4);
7152
7150
  }
7153
- function Dc(e) {
7151
+ function Oc(e) {
7154
7152
  return e >= 1e9 ? (e / 1e9).toFixed(2) + "B" : e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(2) + "K" : e.toFixed(0);
7155
7153
  }
7156
- var Oc = [
7154
+ var kc = [
7157
7155
  [
7158
7156
  34,
7159
7157
  16,
@@ -7210,7 +7208,7 @@ var Oc = [
7210
7208
  30,
7211
7209
  !0
7212
7210
  ]
7213
- ], kc = class {
7211
+ ], Ac = class {
7214
7212
  el;
7215
7213
  label;
7216
7214
  showTimer = null;
@@ -7218,7 +7216,7 @@ var Oc = [
7218
7216
  constructor(e, t) {
7219
7217
  this.loadingText = t, this.el = document.createElement("div"), this.el.className = "tcw-loading-overlay", this.el.setAttribute("role", "status"), this.el.setAttribute("aria-live", "polite");
7220
7218
  let n = document.createElement("div");
7221
- n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"), Oc.forEach(([e, t, r, i, a], o) => {
7219
+ n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"), kc.forEach(([e, t, r, i, a], o) => {
7222
7220
  let s = document.createElement("span");
7223
7221
  s.className = a ? "tcw-loading-candle tcw-loading-candle--up" : "tcw-loading-candle", s.style.setProperty("--tcw-body-top", `${e}px`), s.style.setProperty("--tcw-body-h", `${t}px`), s.style.setProperty("--tcw-wick-top", `${r}px`), s.style.setProperty("--tcw-wick-h", `${i}px`), s.style.setProperty("--tcw-delay", `${o * 110}ms`), n.appendChild(s);
7224
7222
  }), this.el.appendChild(n), this.label = document.createElement("div"), this.label.className = "tcw-loading-label", this.label.textContent = t, this.el.appendChild(this.label), e.appendChild(this.el);
@@ -7253,7 +7251,7 @@ var Oc = [
7253
7251
  clearTimer() {
7254
7252
  this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
7255
7253
  }
7256
- }, Ac = 4e3, jc = class {
7254
+ }, jc = 4e3, Mc = class {
7257
7255
  el;
7258
7256
  text;
7259
7257
  hideTimer = null;
@@ -7263,7 +7261,7 @@ var Oc = [
7263
7261
  n.className = "tcw-history-spinner", n.setAttribute("aria-hidden", "true"), this.text = document.createElement("span"), this.el.append(n, this.text), e.appendChild(this.el);
7264
7262
  }
7265
7263
  update(e) {
7266
- this.clearTimer(), e.state === "loading" ? this.show(this.texts.loading, !1) : e.state === "error" ? (this.show(this.texts.failed, !0), this.hideTimer = setTimeout(() => this.hide(), Ac)) : this.hide();
7264
+ this.clearTimer(), e.state === "loading" ? this.show(this.texts.loading, !1) : e.state === "error" ? (this.show(this.texts.failed, !0), this.hideTimer = setTimeout(() => this.hide(), jc)) : this.hide();
7267
7265
  }
7268
7266
  destroy() {
7269
7267
  this.clearTimer(), this.el.remove();
@@ -7277,13 +7275,13 @@ var Oc = [
7277
7275
  clearTimer() {
7278
7276
  this.hideTimer !== null && clearTimeout(this.hideTimer), this.hideTimer = null;
7279
7277
  }
7280
- }, Mc = "host:";
7281
- function Nc(e, t) {
7278
+ }, Nc = "host:";
7279
+ function Pc(e, t) {
7282
7280
  return [
7283
7281
  ...e,
7284
7282
  ...e.length > 0 && t.length > 0 ? ["separator"] : [],
7285
7283
  ...t.map((e, t) => ({
7286
- id: `${Mc}${t}`,
7284
+ id: `${Nc}${t}`,
7287
7285
  label: e.label,
7288
7286
  icon: e.icon,
7289
7287
  danger: e.danger,
@@ -7291,12 +7289,12 @@ function Nc(e, t) {
7291
7289
  }))
7292
7290
  ];
7293
7291
  }
7294
- function Pc(e, t) {
7295
- return e.startsWith(Mc) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
7292
+ function Fc(e, t) {
7293
+ return e.startsWith(Nc) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
7296
7294
  }
7297
7295
  //#endregion
7298
7296
  //#region src/widget/hostHotkeys.ts
7299
- var Fc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), Ic = {
7297
+ var Ic = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), Lc = {
7300
7298
  ctrl: "ctrl",
7301
7299
  control: "ctrl",
7302
7300
  cmd: "ctrl",
@@ -7307,7 +7305,7 @@ var Fc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
7307
7305
  option: "alt",
7308
7306
  opt: "alt",
7309
7307
  shift: "shift"
7310
- }, Lc = {
7308
+ }, Rc = {
7311
7309
  esc: "escape",
7312
7310
  space: " ",
7313
7311
  spacebar: " ",
@@ -7319,7 +7317,7 @@ var Fc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
7319
7317
  return: "enter",
7320
7318
  plus: "+"
7321
7319
  };
7322
- function Rc(e) {
7320
+ function zc(e) {
7323
7321
  let t = e.split("+").map((e) => e.trim()), n = t.pop();
7324
7322
  if (!n) return null;
7325
7323
  let r = {
@@ -7329,23 +7327,23 @@ function Rc(e) {
7329
7327
  display: []
7330
7328
  };
7331
7329
  for (let e of t) {
7332
- let t = Ic[e.toLowerCase()];
7330
+ let t = Lc[e.toLowerCase()];
7333
7331
  if (!t) return null;
7334
7332
  r[t] = !0;
7335
7333
  }
7336
7334
  let i = n.toLowerCase();
7337
- if (Ic[i]) return null;
7335
+ if (Lc[i]) return null;
7338
7336
  if (/^[a-z]$/.test(i)) r.code = `Key${i.toUpperCase()}`, r.char = i;
7339
7337
  else if (/^[0-9]$/.test(i)) r.code = `Digit${i}`, r.char = i;
7340
- else if (r.key = Lc[i] ?? i, r.shift && r.key.length === 1) return null;
7338
+ else if (r.key = Rc[i] ?? i, r.shift && r.key.length === 1) return null;
7341
7339
  return r.display = [
7342
- ...r.ctrl ? [Fc ? "⌘" : "Ctrl"] : [],
7340
+ ...r.ctrl ? [Ic ? "⌘" : "Ctrl"] : [],
7343
7341
  ...r.alt ? ["Alt"] : [],
7344
7342
  ...r.shift ? ["Shift"] : [],
7345
7343
  r.key === " " ? "Space" : n.length === 1 ? n.toUpperCase() : n
7346
7344
  ], r;
7347
7345
  }
7348
- function zc(e, t) {
7346
+ function Bc(e, t) {
7349
7347
  if ((e.ctrlKey || e.metaKey) !== t.ctrl || e.altKey !== t.alt) return !1;
7350
7348
  if (t.code !== void 0) {
7351
7349
  if (e.shiftKey !== t.shift) return !1;
@@ -7355,25 +7353,25 @@ function zc(e, t) {
7355
7353
  }
7356
7354
  return t.shift && !e.shiftKey ? !1 : e.key.toLowerCase() === t.key;
7357
7355
  }
7358
- var Bc = new Set(/* @__PURE__ */ "escape(enter(delete(backspace(arrowleft(arrowright(arrowup(arrowdown(home(end(+(-(=( (,(.(ctrl+z(ctrl+shift+z(ctrl+y(ctrl+c(ctrl+v(ctrl+d(ctrl+g(ctrl+shift+g(ctrl+[(ctrl+]".split("("));
7359
- function Vc(e) {
7356
+ var Vc = new Set(/* @__PURE__ */ "escape(enter(delete(backspace(arrowleft(arrowright(arrowup(arrowdown(home(end(+(-(=( (,(.(ctrl+z(ctrl+shift+z(ctrl+y(ctrl+c(ctrl+v(ctrl+d(ctrl+g(ctrl+shift+g(ctrl+[(ctrl+]".split("("));
7357
+ function Hc(e) {
7360
7358
  let t = `${e.ctrl ? "ctrl+" : ""}${e.alt ? "alt+" : ""}${e.shift ? "shift+" : ""}${e.char ?? e.key}`;
7361
- return Bc.has(t);
7359
+ return Vc.has(t);
7362
7360
  }
7363
- function Hc(e) {
7361
+ function Uc(e) {
7364
7362
  let t = typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
7365
7363
  return t instanceof HTMLElement ? t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) : !1;
7366
7364
  }
7367
7365
  //#endregion
7368
7366
  //#region src/widget/WidgetCompares.ts
7369
- var Uc = [
7367
+ var Wc = [
7370
7368
  "#b552c9",
7371
7369
  "#1398a8",
7372
7370
  "#d4622b",
7373
7371
  "#e25592",
7374
7372
  "#6f7a8c",
7375
7373
  "#3e9a4f"
7376
- ], Wc = class {
7374
+ ], Gc = class {
7377
7375
  constructor(e) {
7378
7376
  this.host = e;
7379
7377
  }
@@ -7395,11 +7393,11 @@ var Uc = [
7395
7393
  symbols: this.host.symbolEntries(),
7396
7394
  current: this.host.state.symbol,
7397
7395
  search: this.host.symbolSearchFn(),
7398
- ways: Ks(this.host.t),
7396
+ ways: qs(this.host.t),
7399
7397
  way: this.compareWay,
7400
7398
  compared: this.comparedNow(),
7401
7399
  onAdd: (e, t) => {
7402
- Gs(t) && (this.compareWay = t, this.addCompareSymbol(e, t));
7400
+ Ks(t) && (this.compareWay = t, this.addCompareSymbol(e, t));
7403
7401
  },
7404
7402
  onRemove: (e) => this.removeCompared(e)
7405
7403
  }));
@@ -7407,7 +7405,7 @@ var Uc = [
7407
7405
  }
7408
7406
  comparedNow() {
7409
7407
  let e = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds));
7410
- return Xs(this.compares, this.host.chart.getActiveIndicators(), e, this.host.t);
7408
+ return Zs(this.compares, this.host.chart.getActiveIndicators(), e, this.host.t);
7411
7409
  }
7412
7410
  refreshCompareDialog() {
7413
7411
  this.host.symbolSearch?.isComparing() && this.host.symbolSearch.setCompared(this.comparedNow());
@@ -7427,7 +7425,7 @@ var Uc = [
7427
7425
  try {
7428
7426
  let t = await this.fetchCompareBars(this.host.adapter, e);
7429
7427
  if (!t || this.compares.some((t) => t.symbol === e)) return;
7430
- let r = this.host.state.timeframe, i = Uc[this.compares.length % Uc.length];
7428
+ let r = this.host.state.timeframe, i = Wc[this.compares.length % Wc.length];
7431
7429
  this.compares.length === 0 && this.host.chart.setCompareMode("percent"), this.host.chart.addCompareSymbol(n, O(e), t, i), this.compares = [...this.compares, {
7432
7430
  id: n,
7433
7431
  symbol: e,
@@ -7555,7 +7553,7 @@ var Uc = [
7555
7553
  }
7556
7554
  let i = r.bars[0]?.time;
7557
7555
  if (i === void 0 || r.atStart) continue;
7558
- let a = qs(this.host.chart.getData(), i);
7556
+ let a = Js(this.host.chart.getData(), i);
7559
7557
  if (a !== 0) try {
7560
7558
  if (e.fetchHistoryBefore) {
7561
7559
  let o = await e.fetchHistoryBefore(r.symbol, n, i, a);
@@ -7578,7 +7576,7 @@ var Uc = [
7578
7576
  prependCompareBars(e, t, n) {
7579
7577
  let r = this.compares.find((t) => t.id === e);
7580
7578
  if (!r) return;
7581
- let i = Js(r.bars, t);
7579
+ let i = Ys(r.bars, t);
7582
7580
  i ? this.setCompareBars(e, i, n) : this.compares = this.compares.map((t) => t.id === e ? {
7583
7581
  ...t,
7584
7582
  atStart: !0
@@ -7599,7 +7597,7 @@ var Uc = [
7599
7597
  failedAt: t
7600
7598
  } : n);
7601
7599
  }
7602
- }, Gc = class {
7600
+ }, Kc = class {
7603
7601
  constructor(e) {
7604
7602
  this.host = e;
7605
7603
  }
@@ -7744,7 +7742,7 @@ var Uc = [
7744
7742
  sparkline: r.slice()
7745
7743
  });
7746
7744
  }
7747
- }, Kc = class {
7745
+ }, qc = class {
7748
7746
  constructor(e) {
7749
7747
  this.host = e;
7750
7748
  }
@@ -7807,10 +7805,10 @@ var Uc = [
7807
7805
  if (e === "price") return t.length > 0 ? this.host.chart.roundPrice(t[t.length - 1].close) : null;
7808
7806
  let n = e.indexOf(":");
7809
7807
  if (n < 0 || t.length === 0) return null;
7810
- let r = e.slice(0, n), i = e.slice(n + 1), a = pc(this.host.chart.getIndicatorOutput(r)?.series, null)?.[i];
7808
+ let r = e.slice(0, n), i = e.slice(n + 1), a = mc(this.host.chart.getIndicatorOutput(r)?.series, null)?.[i];
7811
7809
  return typeof a == "number" && Number.isFinite(a) ? a : null;
7812
7810
  }
7813
- }, qc = class {
7811
+ }, Jc = class {
7814
7812
  constructor(e) {
7815
7813
  this.host = e;
7816
7814
  }
@@ -7887,7 +7885,7 @@ var Uc = [
7887
7885
  };
7888
7886
  //#endregion
7889
7887
  //#region src/widget/drawingMenu.ts
7890
- function Jc(e, t) {
7888
+ function Yc(e, t) {
7891
7889
  let { selected: n } = e, r = n.length === 1, i = new Set(n.map((e) => e.groupId)), a = i.size === 1 && !i.has(null), o = [];
7892
7890
  e.canConfigure && r && o.push({
7893
7891
  id: "settings",
@@ -7944,7 +7942,7 @@ function Jc(e, t) {
7944
7942
  }
7945
7943
  //#endregion
7946
7944
  //#region src/widget/WidgetMenus.ts
7947
- var Yc = class {
7945
+ var Xc = class {
7948
7946
  constructor(e) {
7949
7947
  this.host = e;
7950
7948
  }
@@ -7963,7 +7961,7 @@ var Yc = class {
7963
7961
  }] : [];
7964
7962
  });
7965
7963
  if (i.length === 0) return;
7966
- let a = ce(Jc({
7964
+ let a = ce(Yc({
7967
7965
  selected: i,
7968
7966
  canConfigure: !0,
7969
7967
  canAlert: this.host.chart.canAddDrawingAlert(e)
@@ -7971,11 +7969,11 @@ var Yc = class {
7971
7969
  id: e,
7972
7970
  type: s.type,
7973
7971
  selected: o
7974
- }) ?? [] : [], l = Nc(a, c);
7972
+ }) ?? [] : [], l = Pc(a, c);
7975
7973
  if (l.length === 0) return;
7976
7974
  let u = this.host.chartContainer.getBoundingClientRect(), d = this.host.root.getBoundingClientRect();
7977
7975
  this.drawingMenu.open(l, u.left - d.left + t, u.top - d.top + n, (t) => {
7978
- Pc(t, c) || this.runDrawingMenuAction(e, o, t);
7976
+ Fc(t, c) || this.runDrawingMenuAction(e, o, t);
7979
7977
  });
7980
7978
  }
7981
7979
  runDrawingMenuAction(e, t, n) {
@@ -8052,7 +8050,7 @@ var Yc = class {
8052
8050
  current: r.timezone,
8053
8051
  options: this.timezoneChoices()
8054
8052
  },
8055
- keys: Object.fromEntries(Mo.filter((e) => this.host.featureState.hotkeys && this.host.featureState[e.feature]).map((e) => [e.action, e.keys]))
8053
+ keys: Object.fromEntries(No.filter((e) => this.host.featureState.hotkeys && this.host.featureState[e.feature]).map((e) => [e.action, e.keys]))
8056
8054
  };
8057
8055
  }
8058
8056
  removableIndicators() {
@@ -8073,15 +8071,15 @@ var Yc = class {
8073
8071
  }
8074
8072
  openChartMenu(e, t, n, r) {
8075
8073
  if (!this.chartMenu) return;
8076
- let i = this.host.options.chartMenuItems?.(r) ?? [], a = Nc(e, i);
8074
+ let i = this.host.options.chartMenuItems?.(r) ?? [], a = Pc(e, i);
8077
8075
  if (a.length === 0) return;
8078
8076
  let o = this.host.chartContainer.getBoundingClientRect(), s = this.host.root.getBoundingClientRect();
8079
8077
  this.chartMenu.open(a, o.left - s.left + t, o.top - s.top + n, (e) => {
8080
- Pc(e, i) || (e.startsWith("tz:") ? this.host.changeSettings({ timezone: e.slice(3) }) : this.runChartMenuAction(e, r));
8078
+ Fc(e, i) || (e.startsWith("tz:") ? this.host.changeSettings({ timezone: e.slice(3) }) : this.runChartMenuAction(e, r));
8081
8079
  });
8082
8080
  }
8083
8081
  runChartMenuAction(e, t) {
8084
- let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a = No(e);
8082
+ let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a = Po(e);
8085
8083
  if (a) {
8086
8084
  this.host.changeSettings({ scaleMode: a });
8087
8085
  return;
@@ -8202,46 +8200,46 @@ var Yc = class {
8202
8200
  activeTool: null
8203
8201
  }, this.host.updateUI(), this.host.refreshDrawingsState(), this.host.refreshObjects();
8204
8202
  }
8205
- }, Xc = 2, Zc = 2;
8206
- function Qc(e, t = "en-US") {
8207
- return $e(e, Math.max(Xc, Mt(e)), t);
8208
- }
8203
+ }, Zc = 2, Qc = 2;
8209
8204
  function $c(e, t = "en-US") {
8210
- return `${Wo($e(Math.abs(e), Zc, t), e, $e(0, Zc, t))}%`;
8205
+ return $e(e, Math.max(Zc, Mt(e)), t);
8211
8206
  }
8212
- function el(e, t = "en-US", n = !0) {
8207
+ function el(e, t = "en-US") {
8208
+ return `${Go($e(Math.abs(e), Qc, t), e, $e(0, Qc, t))}%`;
8209
+ }
8210
+ function tl(e, t = "en-US", n = !0) {
8213
8211
  return e.map((e) => ({
8214
8212
  instanceId: e.id,
8215
8213
  kind: "compare",
8216
8214
  label: e.label,
8217
8215
  swatch: e.color,
8218
8216
  visible: e.visible,
8219
- ...n ? { values: tl(e, t) } : {
8217
+ ...n ? { values: nl(e, t) } : {
8220
8218
  values: [],
8221
8219
  offChartType: !0
8222
8220
  },
8223
8221
  pane: null
8224
8222
  }));
8225
8223
  }
8226
- function tl(e, t) {
8224
+ function nl(e, t) {
8227
8225
  return [...e.close === null ? [] : [{
8228
- text: Qc(e.close, t),
8226
+ text: $c(e.close, t),
8229
8227
  color: null
8230
8228
  }], ...e.change === null ? [] : [{
8231
- text: $c(e.change, t),
8229
+ text: el(e.change, t),
8232
8230
  color: null
8233
8231
  }]];
8234
8232
  }
8235
8233
  //#endregion
8236
8234
  //#region src/widget/WidgetLegendView.ts
8237
- var nl = 7, rl = 17, il = 3, al = 4;
8238
- function ol(e) {
8239
- return Ge[e.getDensity?.() ?? "comfortable"].legendInset - al;
8240
- }
8235
+ var rl = 7, il = 17, al = 3, ol = 4;
8241
8236
  function sl(e) {
8237
+ return Ge[e.getDensity?.() ?? "comfortable"].legendInset - ol;
8238
+ }
8239
+ function cl(e) {
8242
8240
  return !kt.has(e.id) && e.scale !== "left";
8243
8241
  }
8244
- var cl = class {
8242
+ var ll = class {
8245
8243
  constructor(e) {
8246
8244
  this.host = e;
8247
8245
  }
@@ -8254,13 +8252,13 @@ var cl = class {
8254
8252
  }
8255
8253
  renderLegend() {
8256
8254
  if (!this.host.indicatorLegend || this.host.destroyed) return;
8257
- let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r = ol(this.host.chart), i = n === null ? e : Math.min(Math.max(n, 0), e), a = /* @__PURE__ */ new Map();
8255
+ let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r = sl(this.host.chart), i = n === null ? e : Math.min(Math.max(n, 0), e), a = /* @__PURE__ */ new Map();
8258
8256
  for (let e of this.host.chart.getIndicatorPanes()) (e.instanceIds ?? [e.instanceId]).forEach((t, n) => a.set(t, {
8259
8257
  ...e.rect,
8260
8258
  row: n
8261
8259
  }));
8262
- let o = this.host.settingsState.numberLocale || "en-US", s = el(i >= 0 ? this.host.chart.getCompareValues?.(n === null || !t ? void 0 : i) ?? [] : [], o, t), c = this.host.chart.getActiveIndicators().map((e) => {
8263
- let t = a.get(e.instanceId) ?? null, i = pc(this.host.chart.getIndicatorOutput(e.instanceId, { drawn: !0 })?.series, n), s = this.host.chart.getIndicatorStyle(e.instanceId), c = e.visible && e.offChartType === !0, l = e.visible && e.shown === !1 && !c, u = l || c ? [] : mc(e.descriptor, i, s?.colors ?? [], s?.plots);
8260
+ let o = this.host.settingsState.numberLocale || "en-US", s = tl(i >= 0 ? this.host.chart.getCompareValues?.(n === null || !t ? void 0 : i) ?? [] : [], o, t), c = this.host.chart.getActiveIndicators().map((e) => {
8261
+ let t = a.get(e.instanceId) ?? null, i = mc(this.host.chart.getIndicatorOutput(e.instanceId, { drawn: !0 })?.series, n), s = this.host.chart.getIndicatorStyle(e.instanceId), c = e.visible && e.offChartType === !0, l = e.visible && e.shown === !1 && !c, u = l || c ? [] : hc(e.descriptor, i, s?.colors ?? [], s?.plots);
8264
8262
  return {
8265
8263
  instanceId: e.instanceId,
8266
8264
  label: Ue(e, this.host.t),
@@ -8268,19 +8266,19 @@ var cl = class {
8268
8266
  offInterval: l,
8269
8267
  offChartType: c,
8270
8268
  values: u.map((n) => ({
8271
- text: this.host.indicatorValueText(n.value, t === null && sl(e), o),
8269
+ text: this.host.indicatorValueText(n.value, t === null && cl(e), o),
8272
8270
  color: n.color
8273
8271
  })),
8274
8272
  pane: t ? {
8275
8273
  x: t.x + r,
8276
- y: t.y + Math.min(nl + t.row * rl, Math.max(nl, t.height - rl)),
8274
+ y: t.y + Math.min(rl + t.row * il, Math.max(rl, t.height - il)),
8277
8275
  width: t.width - 2 * r
8278
8276
  } : null
8279
8277
  };
8280
8278
  }), l = [...s, ...c], u = this.host.chart.getPlotRect(), d = this.host.chart.getMaximizedPane(), f = (e) => l.find((t) => t.instanceId === e)?.label ?? "", p = this.host.chart.getIndicatorPanes().map((e) => ({
8281
8279
  instanceId: e.instanceId,
8282
8280
  x: e.rect.x + e.rect.width - r,
8283
- y: e.rect.y + il,
8281
+ y: e.rect.y + al,
8284
8282
  label: f(e.instanceId),
8285
8283
  collapsed: this.host.chart.isPaneCollapsed(e.instanceId),
8286
8284
  maximized: d === e.instanceId,
@@ -8334,14 +8332,14 @@ var cl = class {
8334
8332
  let u = this.host.chart.getActiveIndicators().find((t) => t.instanceId === e)?.id ?? "", d = this.host.options.indicatorMenuItems?.({
8335
8333
  instanceId: e,
8336
8334
  indicatorId: u
8337
- }) ?? [], f = Nc(c, d);
8335
+ }) ?? [], f = Pc(c, d);
8338
8336
  if (f.length === 0) return;
8339
8337
  let p = t.getBoundingClientRect(), m = this.host.root.getBoundingClientRect();
8340
8338
  n.open(f, p.left - m.left, p.bottom - m.top + 2, (t) => {
8341
- Pc(t, d) || (t === "settings" ? this.host.openIndicatorSettings(e) : t === "remove" ? this.host.handleRemoveIndicator(e) : t.startsWith("move:") && this.host.chart.moveIndicatorToPane(e, t.slice(5)), this.scheduleLegend());
8339
+ Fc(t, d) || (t === "settings" ? this.host.openIndicatorSettings(e) : t === "remove" ? this.host.handleRemoveIndicator(e) : t.startsWith("move:") && this.host.chart.moveIndicatorToPane(e, t.slice(5)), this.scheduleLegend());
8342
8340
  }, t);
8343
8341
  }
8344
- }, ll = class {
8342
+ }, ul = class {
8345
8343
  constructor(e) {
8346
8344
  this.host = e;
8347
8345
  }
@@ -8546,7 +8544,7 @@ var cl = class {
8546
8544
  break;
8547
8545
  }
8548
8546
  }
8549
- }, ul = 0, dl = class {
8547
+ }, dl = 0, fl = class {
8550
8548
  backdrop;
8551
8549
  search;
8552
8550
  listEl;
@@ -8554,7 +8552,7 @@ var cl = class {
8554
8552
  confirming = null;
8555
8553
  returnFocus = null;
8556
8554
  loadSeq = 0;
8557
- uid = ++ul;
8555
+ uid = ++dl;
8558
8556
  constructor(e, t, n = T) {
8559
8557
  this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
8560
8558
  let r = !1;
@@ -8660,7 +8658,7 @@ var cl = class {
8660
8658
  this.confirming = null, await this.refresh(), this.isOpen() && this.search.focus();
8661
8659
  }
8662
8660
  }
8663
- }, fl = 5, pl = class {
8661
+ }, pl = 5, ml = class {
8664
8662
  menu;
8665
8663
  prompt;
8666
8664
  dialog;
@@ -8668,7 +8666,7 @@ var cl = class {
8668
8666
  constructor(e, t) {
8669
8667
  this.session = e, this.host = t;
8670
8668
  let { root: n, t: r } = t;
8671
- this.menu = new C(n, r("toolbar.layouts")), this.prompt = new Ss(n, r), this.dialog = new dl(n, {
8669
+ this.menu = new C(n, r("toolbar.layouts")), this.prompt = new Cs(n, r), this.dialog = new fl(n, {
8672
8670
  list: () => e.list(),
8673
8671
  currentId: () => e.current()?.id ?? null,
8674
8672
  onOpen: (e) => void this.open(e),
@@ -8746,7 +8744,7 @@ var cl = class {
8746
8744
  }
8747
8745
  let { session: t } = this, { t: n } = this.host, r = [];
8748
8746
  try {
8749
- r = (await t.list()).slice(0, fl);
8747
+ r = (await t.list()).slice(0, pl);
8750
8748
  } catch {}
8751
8749
  if (this.destroyed) return;
8752
8750
  let i = t.current(), a = [{
@@ -8782,53 +8780,53 @@ var cl = class {
8782
8780
  destroy() {
8783
8781
  this.destroyed = !0, this.menu.destroy(), this.prompt.destroy(), this.dialog.destroy();
8784
8782
  }
8785
- }, ml = (e) => typeof e == "object" && !!e && !Array.isArray(e), hl = globalThis.Buffer;
8786
- function gl(e) {
8787
- if (hl) return hl.from(e, "utf8").toString("base64");
8783
+ }, hl = (e) => typeof e == "object" && !!e && !Array.isArray(e), gl = globalThis.Buffer;
8784
+ function _l(e) {
8785
+ if (gl) return gl.from(e, "utf8").toString("base64");
8788
8786
  let t = new TextEncoder().encode(e), n = "";
8789
8787
  for (let e of t) n += String.fromCharCode(e);
8790
8788
  return btoa(n);
8791
8789
  }
8792
- function _l(e) {
8793
- if (hl) return hl.from(e, "base64").toString("utf8");
8790
+ function vl(e) {
8791
+ if (gl) return gl.from(e, "base64").toString("utf8");
8794
8792
  let t = atob(e), n = new Uint8Array(t.length);
8795
8793
  for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
8796
8794
  return new TextDecoder().decode(n);
8797
8795
  }
8798
- function vl(e) {
8796
+ function yl(e) {
8799
8797
  return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
8800
8798
  }
8801
- function yl(e) {
8799
+ function bl(e) {
8802
8800
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
8803
8801
  return t + (t.length % 4 == 0 ? "" : "=".repeat(4 - t.length % 4));
8804
8802
  }
8805
- function bl(e) {
8806
- return vl(gl(JSON.stringify(e)));
8807
- }
8808
8803
  function xl(e) {
8804
+ return yl(_l(JSON.stringify(e)));
8805
+ }
8806
+ function Sl(e) {
8809
8807
  if (!e) return null;
8810
8808
  try {
8811
- let t = _l(yl(e)), n = JSON.parse(t);
8809
+ let t = vl(bl(e)), n = JSON.parse(t);
8812
8810
  return !n || n.v !== 1 || typeof n.symbol != "string" ? null : {
8813
8811
  v: 1,
8814
8812
  symbol: n.symbol,
8815
8813
  timeframe: n.timeframe,
8816
8814
  chartType: n.chartType,
8817
- scaleMode: Es.find((e) => e === n.scaleMode) ?? "regular",
8815
+ scaleMode: Ds.find((e) => e === n.scaleMode) ?? "regular",
8818
8816
  indicators: Array.isArray(n.indicators) ? n.indicators : [],
8819
8817
  drawings: Array.isArray(n.drawings) ? n.drawings : [],
8820
- ...ml(n.settings) ? { settings: W(n.settings, Fa) } : {}
8818
+ ...hl(n.settings) ? { settings: W(n.settings, Fa) } : {}
8821
8819
  };
8822
8820
  } catch {
8823
8821
  return null;
8824
8822
  }
8825
8823
  }
8826
- var Sl = "tcw";
8827
- function Cl(e) {
8824
+ var Cl = "tcw";
8825
+ function wl(e) {
8828
8826
  let t = e.startsWith("#") ? e.slice(1) : e;
8829
8827
  for (let e of t.split("&")) {
8830
8828
  let t = e.indexOf("=");
8831
- if (!(t <= 0 || e.slice(0, t) !== Sl)) try {
8829
+ if (!(t <= 0 || e.slice(0, t) !== Cl)) try {
8832
8830
  return decodeURIComponent(e.slice(t + 1));
8833
8831
  } catch {
8834
8832
  return null;
@@ -8836,19 +8834,19 @@ function Cl(e) {
8836
8834
  }
8837
8835
  return null;
8838
8836
  }
8839
- function wl(e, t) {
8837
+ function Tl(e, t) {
8840
8838
  let [n] = e.split("#");
8841
- return `${n}#${Sl}=${t}`;
8839
+ return `${n}#${Cl}=${t}`;
8842
8840
  }
8843
8841
  //#endregion
8844
8842
  //#region src/widget/WidgetLayouts.ts
8845
- var Tl = [
8843
+ var El = [
8846
8844
  "legendVisible",
8847
8845
  "volumeVisible",
8848
8846
  "barCountdown",
8849
8847
  "indicatorValueLabels",
8850
8848
  "alignAxisLabels"
8851
- ], El = class {
8849
+ ], Dl = class {
8852
8850
  constructor(e) {
8853
8851
  this.host = e;
8854
8852
  }
@@ -8859,7 +8857,7 @@ var Tl = [
8859
8857
  activeLayoutKey = null;
8860
8858
  restoreSharedView() {
8861
8859
  if (!this.host.options.shareUrl || typeof location > "u") return;
8862
- let e = Cl(location.hash);
8860
+ let e = wl(location.hash);
8863
8861
  e && this.importState(e);
8864
8862
  }
8865
8863
  exportState() {
@@ -8868,9 +8866,9 @@ var Tl = [
8868
8866
  params: e.params
8869
8867
  })), t = this.host.getSettings(), n = Ya(t, {
8870
8868
  ..._,
8871
- ...Object.fromEntries(Tl.map((e) => [e, this.host.settingsDefaults[e]]))
8869
+ ...Object.fromEntries(El.map((e) => [e, this.host.settingsDefaults[e]]))
8872
8870
  });
8873
- return bl({
8871
+ return xl({
8874
8872
  v: 1,
8875
8873
  symbol: this.host.state.symbol,
8876
8874
  timeframe: this.host.state.timeframe,
@@ -8882,7 +8880,7 @@ var Tl = [
8882
8880
  });
8883
8881
  }
8884
8882
  async importState(e) {
8885
- let t = xl(e);
8883
+ let t = Sl(e);
8886
8884
  if (!t) return !1;
8887
8885
  t.symbol && t.symbol !== this.host.state.symbol && await this.host.setSymbol(t.symbol), t.timeframe && t.timeframe !== this.host.state.timeframe && await this.host.setTimeframe(t.timeframe), t.chartType && this.host.applyChartType(t.chartType);
8888
8886
  let { chartTypeOptions: n, ...r } = this.host.allowedSettings({
@@ -8899,7 +8897,7 @@ var Tl = [
8899
8897
  }))), this.host.chart.setDrawings(t.drawings), this.host.updateUI(), !0;
8900
8898
  }
8901
8899
  async copyShareLink() {
8902
- let e = wl(typeof location < "u" ? location.href : "", this.exportState());
8900
+ let e = Tl(typeof location < "u" ? location.href : "", this.exportState());
8903
8901
  try {
8904
8902
  await navigator.clipboard.writeText(e), this.host.say(this.host.t("toast.linkCopied"));
8905
8903
  } catch {
@@ -8910,7 +8908,7 @@ var Tl = [
8910
8908
  return this.layoutSession;
8911
8909
  }
8912
8910
  captureLayout() {
8913
- let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ? As(t) : null, r = n && typeof n == "object" ? Os(n) : null;
8911
+ let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ? js(t) : null, r = n && typeof n == "object" ? ks(n) : null;
8914
8912
  return {
8915
8913
  v: 1,
8916
8914
  symbol: this.host.state.symbol,
@@ -8924,7 +8922,7 @@ var Tl = [
8924
8922
  async restoreLayout(e) {
8925
8923
  if (e.symbol !== this.host.state.symbol && await this.host.setSymbol(e.symbol), e.timeframe !== this.host.state.timeframe && await this.host.setTimeframe(e.timeframe), this.host.destroyed) return;
8926
8924
  if (e.chart) {
8927
- this.host.chart.loadState(JSON.stringify(Os(e.chart)));
8925
+ this.host.chart.loadState(JSON.stringify(ks(e.chart)));
8928
8926
  let t = e.chart.chartType;
8929
8927
  typeof t == "string" && (this.host.state = {
8930
8928
  ...this.host.state,
@@ -8942,7 +8940,7 @@ var Tl = [
8942
8940
  return JSON.stringify(this.captureLayout());
8943
8941
  }
8944
8942
  async applyLayoutContent(e) {
8945
- let t = ks(As(e));
8943
+ let t = As(js(e));
8946
8944
  return t ? (await this.restoreLayout(t), !0) : !1;
8947
8945
  }
8948
8946
  setupLayouts(e) {
@@ -8961,7 +8959,7 @@ var Tl = [
8961
8959
  onChange: () => this.host.toolbar?.setLayout(t.current()?.name ?? null, t.isDirty()),
8962
8960
  onError: () => this.host.say(this.host.t("layouts.saveFailed"), "error")
8963
8961
  });
8964
- this.layoutSession = t, this.layoutsUI = new pl(t, {
8962
+ this.layoutSession = t, this.layoutsUI = new ml(t, {
8965
8963
  root: this.host.root,
8966
8964
  t: this.host.t,
8967
8965
  saveKeys: () => this.host.keysShown("hotkeys.save", `${We}+S`),
@@ -9002,19 +9000,19 @@ var Tl = [
9002
9000
  this.host.chart.disableAutoSave(), this.activeLayoutKey = null;
9003
9001
  }
9004
9002
  }
9005
- }, Dl = {
9003
+ }, Ol = {
9006
9004
  alerts: "alerts",
9007
9005
  objectTree: "objectTree",
9008
9006
  dataWindow: "dataWindow",
9009
9007
  symbolInfo: "symbolInfo",
9010
9008
  depthLadder: "depthLadder"
9011
- }, Ol = {
9009
+ }, kl = {
9012
9010
  watchlist: "watchlist",
9013
9011
  alerts: "alerts",
9014
9012
  objectTree: "objects",
9015
9013
  symbolInfo: "symbolInfo",
9016
9014
  depthLadder: "trade"
9017
- }, kl = class {
9015
+ }, Al = class {
9018
9016
  dataWindowFrame = 0;
9019
9017
  constructor(e) {
9020
9018
  this.host = e;
@@ -9031,7 +9029,7 @@ var Tl = [
9031
9029
  return !this.hasPanel(e) || !this.dock ? !1 : (this.dock.open(e), this.dock.current() === e);
9032
9030
  }
9033
9031
  hasPanel(e) {
9034
- return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[Dl[e]];
9032
+ return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[Ol[e]];
9035
9033
  }
9036
9034
  closePanel() {
9037
9035
  this.dock?.close();
@@ -9064,7 +9062,7 @@ var Tl = [
9064
9062
  indicators: []
9065
9063
  };
9066
9064
  let { bar: n, prevClose: r } = t, i = n.close - r, a = r === 0 ? 0 : i / r * 100, o = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds ?? [e.instanceId])), s = this.host.settingsState.numberLocale || "en-US", c = this.host.chart.getActiveIndicators().map((t) => {
9067
- let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) && sl(t), i = t.descriptor.plots?.map((e) => [e.key, e.title]) ?? Object.keys(n ?? {}).map((e) => [e, e]), a = n ? i.filter(([e]) => typeof n[e] == "number" && Number.isFinite(n[e])).map(([e, t]) => {
9065
+ let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) && cl(t), i = t.descriptor.plots?.map((e) => [e.key, e.title]) ?? Object.keys(n ?? {}).map((e) => [e, e]), a = n ? i.filter(([e]) => typeof n[e] == "number" && Number.isFinite(n[e])).map(([e, t]) => {
9068
9066
  let i = n[e];
9069
9067
  return {
9070
9068
  key: t,
@@ -9193,7 +9191,7 @@ var Tl = [
9193
9191
  this.host.toolbar?.setRailed("watchlist", e && this.host.featureState["dock.watchlist"]), this.host.toolbar?.setRailed("alerts", e && this.host.featureState["dock.alerts"]), this.host.toolbar?.setRailed("objects", e && this.host.featureState["dock.objectTree"]), this.host.toolbar?.fit();
9194
9192
  }
9195
9193
  panelFocusTarget(e) {
9196
- let t = Ol[e], n = t ? this.host.root.querySelector(`.tcw-toolbar [data-role="${t}"]`) : null, r = this.host.root.hasAttribute("data-tcw-narrow");
9194
+ let t = kl[e], n = t ? this.host.root.querySelector(`.tcw-toolbar [data-role="${t}"]`) : null, r = this.host.root.hasAttribute("data-tcw-narrow");
9197
9195
  return n && !n.hidden && !(r && n.classList.contains("tcw-toolbar-overflow")) ? n : this.host.root.querySelector(".tcw-toolbar-more") ?? this.host.chartContainer;
9198
9196
  }
9199
9197
  closePanelByHand(e) {
@@ -9221,29 +9219,29 @@ var Tl = [
9221
9219
  }));
9222
9220
  this.host.objectTree.setObjects(e, t, n);
9223
9221
  }
9224
- }, Al = new Set([
9222
+ }, jl = new Set([
9225
9223
  "timezone",
9226
9224
  "numberLocale",
9227
9225
  "chartTypeOptions",
9228
9226
  "logScale",
9229
9227
  "autoScale"
9230
- ]), jl = 80, Ml = (e) => typeof e == "object" && !!e && !Array.isArray(e);
9231
- function Nl(e) {
9232
- return W(e, Al);
9233
- }
9228
+ ]), Ml = 80, Nl = (e) => typeof e == "object" && !!e && !Array.isArray(e);
9234
9229
  function Pl(e) {
9230
+ return W(e, jl);
9231
+ }
9232
+ function Fl(e) {
9235
9233
  let { overrides: t } = lt(e);
9236
9234
  return Object.fromEntries(Object.entries(t).filter(([e, t]) => t !== null && v.includes(e)));
9237
9235
  }
9238
- function Fl() {
9236
+ function Il() {
9239
9237
  try {
9240
9238
  return typeof localStorage < "u" ? localStorage : null;
9241
9239
  } catch {
9242
9240
  return null;
9243
9241
  }
9244
9242
  }
9245
- var Il = class {
9246
- constructor(e = "tcw:chart-templates", t = Fl()) {
9243
+ var Ll = class {
9244
+ constructor(e = "tcw:chart-templates", t = Il()) {
9247
9245
  this.key = e, this.storage = t;
9248
9246
  }
9249
9247
  list() {
@@ -9255,10 +9253,10 @@ var Il = class {
9255
9253
  }
9256
9254
  if (!Array.isArray(e)) return [];
9257
9255
  let t = [];
9258
- for (let n of e) !Ml(n) || typeof n.name != "string" || !n.name.trim() || t.push({
9259
- name: n.name.slice(0, jl).trim(),
9260
- settings: Nl(n.settings),
9261
- style: Pl(n.style)
9256
+ for (let n of e) !Nl(n) || typeof n.name != "string" || !n.name.trim() || t.push({
9257
+ name: n.name.slice(0, Ml).trim(),
9258
+ settings: Pl(n.settings),
9259
+ style: Fl(n.style)
9262
9260
  });
9263
9261
  return t.sort((e, t) => e.name.localeCompare(t.name));
9264
9262
  }
@@ -9266,12 +9264,12 @@ var Il = class {
9266
9264
  return this.list().find((t) => t.name === e) ?? null;
9267
9265
  }
9268
9266
  save(e, t, n) {
9269
- let r = e.replace(/\s+/g, " ").slice(0, jl).trim();
9267
+ let r = e.replace(/\s+/g, " ").slice(0, Ml).trim();
9270
9268
  if (!r || !this.storage) return !1;
9271
9269
  let i = [...this.list().filter((e) => e.name !== r), {
9272
9270
  name: r,
9273
- settings: Nl(t),
9274
- style: Pl(n)
9271
+ settings: Pl(t),
9272
+ style: Fl(n)
9275
9273
  }];
9276
9274
  try {
9277
9275
  return this.storage.setItem(this.key, JSON.stringify(i)), !0;
@@ -9284,11 +9282,11 @@ var Il = class {
9284
9282
  this.storage?.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
9285
9283
  } catch {}
9286
9284
  }
9287
- }, Ll = new Set([...Ma, "autoScale"]), Rl = class {
9285
+ }, Rl = new Set([...Ma, "autoScale"]), zl = class {
9288
9286
  constructor(e) {
9289
9287
  this.host = e;
9290
9288
  }
9291
- chartTemplates = new Il();
9289
+ chartTemplates = new Ll();
9292
9290
  chartTemplatePrompt = null;
9293
9291
  settingsEdit = null;
9294
9292
  state = Qn(_);
@@ -9408,7 +9406,7 @@ var Il = class {
9408
9406
  this.touchSettings(Object.keys(n), v), this.applySettings(n), this.host.chart.resetOverrides([...v], { layer: "user" }), this.host.chart.applyOverrides(t.style, { layer: "user" }), this.host.settings?.refresh(this.shownSettings()), this.host.say(w(this.host.t("templates.applied"), { name: e }));
9409
9407
  }
9410
9408
  promptSaveChartTemplate() {
9411
- this.chartTemplatePrompt ??= new Ss(this.host.overlayHost(), this.host.t), this.chartTemplatePrompt.open({
9409
+ this.chartTemplatePrompt ??= new Cs(this.host.overlayHost(), this.host.t), this.chartTemplatePrompt.open({
9412
9410
  title: this.host.t("settings.saveTemplateTitle"),
9413
9411
  submitLabel: this.host.t("common.save"),
9414
9412
  placeholder: this.host.t("settings.templatePlaceholder"),
@@ -9518,7 +9516,7 @@ var Il = class {
9518
9516
  this.settingsState = {
9519
9517
  ...this.settingsState,
9520
9518
  ...e
9521
- }, Object.keys(e).some((e) => !Ll.has(e)) && this.host.layouts.layoutSession?.changed(), this.host.legend.scheduleLegend(), e.gridVisible !== void 0 && this.host.chart.setGridVisible(e.gridVisible), e.volumeVisible !== void 0 && this.host.chart.setVolumeVisible(e.volumeVisible), e.volumeProfileVisible !== void 0 && this.host.chart.setVolumeProfileVisible(e.volumeProfileVisible), e.marketProfileVisible !== void 0 && this.host.chart.setMarketProfileVisible(e.marketProfileVisible), e.marketProfileSplit !== void 0 && this.host.chart.setMarketProfileConfig({ splitBySession: e.marketProfileSplit }), e.marketProfileLetters !== void 0 && this.host.chart.setMarketProfileConfig({ letters: e.marketProfileLetters }), e.marketProfileBuckets !== void 0 && this.host.chart.setMarketProfileConfig({ buckets: e.marketProfileBuckets }), e.marketProfileOpacity !== void 0 && this.host.chart.setMarketProfileConfig({ opacity: e.marketProfileOpacity }), e.depthHeatmapVisible !== void 0 && this.host.chart.setDepthHeatmapVisible(e.depthHeatmapVisible), e.depthHeatmapOpacity !== void 0 && this.host.chart.setDepthHeatmapConfig({ opacity: e.depthHeatmapOpacity }), e.sessionShadingVisible !== void 0 && this.host.chart.setSessionShadingVisible(e.sessionShadingVisible), e.pivotMarkersVisible !== void 0 && this.host.chart.setPivotMarkersVisible(e.pivotMarkersVisible), e.pivotStrength !== void 0 && this.host.chart.setPivotMarkersConfig({
9519
+ }, Object.keys(e).some((e) => !Rl.has(e)) && this.host.layouts.layoutSession?.changed(), this.host.legend.scheduleLegend(), e.gridVisible !== void 0 && this.host.chart.setGridVisible(e.gridVisible), e.volumeVisible !== void 0 && this.host.chart.setVolumeVisible(e.volumeVisible), e.volumeProfileVisible !== void 0 && this.host.chart.setVolumeProfileVisible(e.volumeProfileVisible), e.marketProfileVisible !== void 0 && this.host.chart.setMarketProfileVisible(e.marketProfileVisible), e.marketProfileSplit !== void 0 && this.host.chart.setMarketProfileConfig({ splitBySession: e.marketProfileSplit }), e.marketProfileLetters !== void 0 && this.host.chart.setMarketProfileConfig({ letters: e.marketProfileLetters }), e.marketProfileBuckets !== void 0 && this.host.chart.setMarketProfileConfig({ buckets: e.marketProfileBuckets }), e.marketProfileOpacity !== void 0 && this.host.chart.setMarketProfileConfig({ opacity: e.marketProfileOpacity }), e.depthHeatmapVisible !== void 0 && this.host.chart.setDepthHeatmapVisible(e.depthHeatmapVisible), e.depthHeatmapOpacity !== void 0 && this.host.chart.setDepthHeatmapConfig({ opacity: e.depthHeatmapOpacity }), e.sessionShadingVisible !== void 0 && this.host.chart.setSessionShadingVisible(e.sessionShadingVisible), e.pivotMarkersVisible !== void 0 && this.host.chart.setPivotMarkersVisible(e.pivotMarkersVisible), e.pivotStrength !== void 0 && this.host.chart.setPivotMarkersConfig({
9522
9520
  left: e.pivotStrength,
9523
9521
  right: e.pivotStrength
9524
9522
  }), e.pivotStructureLabels !== void 0 && this.host.chart.setPivotMarkersConfig({ structureLabels: e.pivotStructureLabels }), e.periodLevelsVisible !== void 0 && this.host.chart.setPeriodLevelsVisible(e.periodLevelsVisible), e.periodLevelsPeriod !== void 0 && this.host.chart.setPeriodLevelsPeriod(e.periodLevelsPeriod), e.legendVisible !== void 0 && this.host.chart.setLegend({ visible: e.legendVisible }), e.barCountdown !== void 0 && this.host.chart.setBarCountdownVisible(e.barCountdown), e.indicatorValueLabels !== void 0 && this.host.chart.setIndicatorValueLabelsVisible(e.indicatorValueLabels), e.alignAxisLabels !== void 0 && this.host.chart.setAxisLabelsAligned(e.alignAxisLabels), e.crosshairMode !== void 0 && this.host.chart.setCrosshairMode(e.crosshairMode), e.crosshairCursor !== void 0 && this.host.chart.setCrosshairCursor(e.crosshairCursor), e.autoScale !== void 0 && this.host.chart.setAutoScale(e.autoScale), e.invertScale !== void 0 && this.host.chart.setInvertScale(e.invertScale), e.leftPriceScale !== void 0 && (this.host.chart.setLeftPriceScaleVisible(e.leftPriceScale), this.host.placeDrawingButton()), (e.scaleMode !== void 0 || e.autoScale !== void 0) && queueMicrotask(() => this.refreshScaleSwitches()), e.timezone !== void 0 && queueMicrotask(() => this.host.statusBar?.tick()), e.scaleMode === void 0 ? e.logScale !== void 0 && (this.settingsState = {
@@ -9580,8 +9578,8 @@ var Il = class {
9580
9578
  restoreSettings(e, t = null, n) {
9581
9579
  n !== void 0 && (this.host.comparing.compareScaleHeld = n && this.host.comparing.compares.length > 0), this.applySettings(e), t && t.theme === (this.host.chart.getTheme()?.name ?? "") && this.host.chart.applyOverrides(t.overrides, { layer: "user" }), this.host.settings?.refresh(this.shownSettings());
9582
9580
  }
9583
- }, zl = 13;
9584
- function Bl(e) {
9581
+ }, Bl = 13;
9582
+ function Vl(e) {
9585
9583
  let t = e.filter((e) => e !== null);
9586
9584
  if (t.length === 0) return null;
9587
9585
  let n = Math.min(...t.map((e) => e.x)), r = Math.min(...t.map((e) => e.y)), i = Math.max(...t.map((e) => e.x + e.width)), a = Math.max(...t.map((e) => e.y + e.height));
@@ -9592,7 +9590,7 @@ function Bl(e) {
9592
9590
  height: a - r
9593
9591
  };
9594
9592
  }
9595
- var Vl = class {
9593
+ var Hl = class {
9596
9594
  constructor(e) {
9597
9595
  this.host = e;
9598
9596
  }
@@ -9623,7 +9621,7 @@ var Vl = class {
9623
9621
  e.hide();
9624
9622
  return;
9625
9623
  }
9626
- let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = Bl(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
9624
+ let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c = Vl(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
9627
9625
  x: o.x + o.width / 2,
9628
9626
  y: o.y,
9629
9627
  width: 0,
@@ -9631,17 +9629,17 @@ var Vl = class {
9631
9629
  };
9632
9630
  e.show({
9633
9631
  rect: {
9632
+ x: c.x + i.x,
9633
+ y: c.y + i.y,
9634
+ width: c.width,
9635
+ height: c.height
9636
+ },
9637
+ bounds: {
9634
9638
  x: s.x + i.x,
9635
9639
  y: s.y + i.y,
9636
9640
  width: s.width,
9637
9641
  height: s.height
9638
9642
  },
9639
- bounds: {
9640
- x: o.x + i.x,
9641
- y: o.y + i.y,
9642
- width: o.width,
9643
- height: o.height
9644
- },
9645
9643
  style: a.style,
9646
9644
  locked: r.every((e) => e.locked),
9647
9645
  canDelete: r.some((e) => !e.locked),
@@ -9672,12 +9670,12 @@ var Vl = class {
9672
9670
  },
9673
9671
  text: o,
9674
9672
  font: {
9675
- size: a.fontSize || i?.fontSize || zl,
9673
+ size: a.fontSize || i?.fontSize || Bl,
9676
9674
  bold: a.bold === !0,
9677
9675
  italic: a.italic === !0,
9678
9676
  family: this.host.chart.getFont?.()?.family ?? this.host.ui.font.family
9679
9677
  },
9680
- color: a.textColor ?? xo[n.type] ?? a.color,
9678
+ color: a.textColor ?? So[n.type] ?? a.color,
9681
9679
  label: this.host.t("drawingSettings.text"),
9682
9680
  onInput: (n) => t ? this.host.chart.amendNewDrawing(e, { style: { text: n } }) : this.host.chart.updateDrawing(e, { style: { text: n } }),
9683
9681
  onCommit: (n) => {
@@ -9704,14 +9702,14 @@ var Vl = class {
9704
9702
  fill: i.fill === !0,
9705
9703
  text: i.text === !0,
9706
9704
  textLayout: K[r.type],
9707
- textColor: xo[r.type],
9708
- textPlace: bo.has(r.type),
9705
+ textColor: So[r.type],
9706
+ textPlace: xo.has(r.type),
9709
9707
  coordinates: i.anchoring !== "screen",
9710
9708
  intervals: r.intervals ?? null
9711
9709
  }, { tab: n.tab }), n.justDrawn && e.isOpen() && (this.justDrawnText = t));
9712
9710
  }
9713
9711
  promptSaveDrawingTemplate(e, t) {
9714
- this.drawingTemplatePrompt ??= new Ss(this.host.root, this.host.t), this.drawingTemplatePrompt.open({
9712
+ this.drawingTemplatePrompt ??= new Cs(this.host.root, this.host.t), this.drawingTemplatePrompt.open({
9715
9713
  title: this.host.t("drawingSettings.saveTemplateTitle"),
9716
9714
  submitLabel: this.host.t("common.save"),
9717
9715
  placeholder: this.host.drawingToolName(t.type),
@@ -9723,7 +9721,7 @@ var Vl = class {
9723
9721
  }
9724
9722
  });
9725
9723
  }
9726
- }, Hl = 200, Ul = class {
9724
+ }, Ul = 200, Wl = class {
9727
9725
  constructor(e) {
9728
9726
  this.host = e;
9729
9727
  }
@@ -9752,7 +9750,7 @@ var Vl = class {
9752
9750
  for (; o > 0 && n[o - 1].time * r >= a;) o--;
9753
9751
  let s = this.host.displayTimezone();
9754
9752
  return En({
9755
- dayShare: n.slice(-Hl).some((e) => {
9753
+ dayShare: n.slice(-Ul).some((e) => {
9756
9754
  let t = e.time * r, n = new Date(t + at(s, t) * 6e4).getUTCDay();
9757
9755
  return n === 0 || n === 6;
9758
9756
  }) ? 1 : 5 / 7,
@@ -9797,7 +9795,7 @@ var Vl = class {
9797
9795
  handleToggleTimeframeFavorite(e) {
9798
9796
  this.host.timeframeFavorites.toggle(e), this.host.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()), this.host.updateUI();
9799
9797
  }
9800
- }, Wl = 600, Gl = 24, Kl = [
9798
+ }, Gl = 600, Kl = 24, ql = [
9801
9799
  "--tcw-toolbar-h",
9802
9800
  "--tcw-control-h",
9803
9801
  "--tcw-control-h-sm",
@@ -9815,33 +9813,33 @@ var Vl = class {
9815
9813
  "--tcw-line-height",
9816
9814
  "--tcw-line-xs",
9817
9815
  "--tcw-label-size"
9818
- ], ql = 48, Jl = 5e4, Yl = 100;
9819
- function Xl() {
9816
+ ], Jl = 48, Yl = 5e4, Xl = 100;
9817
+ function Zl() {
9820
9818
  return new Promise((e) => {
9821
9819
  if (typeof requestAnimationFrame != "function" || document.hidden) {
9822
9820
  setTimeout(e, 0);
9823
9821
  return;
9824
9822
  }
9825
- let t = setTimeout(e, Yl);
9823
+ let t = setTimeout(e, Xl);
9826
9824
  requestAnimationFrame(() => setTimeout(() => {
9827
9825
  clearTimeout(t), e();
9828
9826
  }, 0));
9829
9827
  });
9830
9828
  }
9831
- var Zl = 864e5, Ql = 5e3, $l = 2e3, eu = 48, tu = "rgba(255,255,255,0.03)", nu = "rgba(0,0,0,0.03)", ru = 2;
9832
- function iu(e) {
9829
+ var Ql = 864e5, $l = 5e3, eu = 2e3, tu = 48, nu = "rgba(255,255,255,0.03)", ru = "rgba(0,0,0,0.03)", iu = 2;
9830
+ function au(e) {
9833
9831
  if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph")) return null;
9834
9832
  if (/^[a-z]$/i.test(e.key)) return e.key;
9835
9833
  let t = /^Key([A-Z])$/.exec(e.code ?? "");
9836
9834
  return t && [...e.key].length === 1 && !/[\s\d]/.test(e.key) ? t[1].toLowerCase() : null;
9837
9835
  }
9838
- var au = 1e3, ou = [
9836
+ var ou = 1e3, su = [
9839
9837
  ["barCountdown", "barCountdown"],
9840
9838
  ["logScale", "logScale"],
9841
9839
  ["legendVisible", "legend"],
9842
9840
  ["volumeVisible", "volume"]
9843
- ], su = v.filter((e) => Ke[e] !== "color");
9844
- function cu(e) {
9841
+ ], cu = v.filter((e) => Ke[e] !== "color");
9842
+ function lu(e) {
9845
9843
  if (!e.feed) return e;
9846
9844
  if (e.adapter) throw TypeError("A widget takes an adapter or a feed, not both");
9847
9845
  return {
@@ -9850,19 +9848,19 @@ function cu(e) {
9850
9848
  feed: void 0
9851
9849
  };
9852
9850
  }
9853
- var lu = class {
9854
- intervals = new Ul(this.intervalsHost());
9855
- drawingEdit = new Vl(this.drawingEditHost());
9856
- chartSettings = new Rl(this.chartSettingsHost());
9857
- docking = new kl(this.dockingHost());
9858
- layouts = new El(this.layoutsHost());
9859
- commands = new ll(this.commandsHost());
9860
- legend = new cl(this.legendHost());
9861
- menus = new Yc(this.menusHost());
9862
- trading = new qc(this.tradingHost());
9863
- alerting = new Kc(this.alertingHost());
9864
- watching = new Gc(this.watchingHost());
9865
- comparing = new Wc(this.comparingHost());
9851
+ var uu = class {
9852
+ intervals = new Wl(this.intervalsHost());
9853
+ drawingEdit = new Hl(this.drawingEditHost());
9854
+ chartSettings = new zl(this.chartSettingsHost());
9855
+ docking = new Al(this.dockingHost());
9856
+ layouts = new Dl(this.layoutsHost());
9857
+ commands = new ul(this.commandsHost());
9858
+ legend = new ll(this.legendHost());
9859
+ menus = new Xc(this.menusHost());
9860
+ trading = new Jc(this.tradingHost());
9861
+ alerting = new qc(this.alertingHost());
9862
+ watching = new Kc(this.watchingHost());
9863
+ comparing = new Gc(this.comparingHost());
9866
9864
  chart;
9867
9865
  state;
9868
9866
  themeOf = {
@@ -9931,7 +9929,7 @@ var lu = class {
9931
9929
  uiVariables = !1;
9932
9930
  chartFontBase = null;
9933
9931
  scaleObserver = null;
9934
- templates = new Ts();
9932
+ templates = new Es();
9935
9933
  templatePrompt = null;
9936
9934
  markerTip = null;
9937
9935
  dataWindow = null;
@@ -9940,11 +9938,11 @@ var lu = class {
9940
9938
  lastHoverPrevClose = null;
9941
9939
  legendHoverIndex = null;
9942
9940
  pointerOnChart = !1;
9943
- favoritesStore = new Ms();
9944
- indicatorFavorites = new Ms("tcw:indicator-favorites");
9941
+ favoritesStore = new Ns();
9942
+ indicatorFavorites = new Ns("tcw:indicator-favorites");
9945
9943
  indicatorDefaults = new ka();
9946
- timeframeFavorites = new Ms("tcw:tf-favorites");
9947
- customTimeframes = new Ms("tcw:tf-custom");
9944
+ timeframeFavorites = new Ns("tcw:tf-favorites");
9945
+ customTimeframes = new Ns("tcw:tf-custom");
9948
9946
  timeframes = [];
9949
9947
  sessionRefPrice = null;
9950
9948
  symbolInfoPanel = null;
@@ -9983,7 +9981,7 @@ var lu = class {
9983
9981
  hostLayer = null;
9984
9982
  priceAxisAddDefault = !1;
9985
9983
  constructor(e, t = {}) {
9986
- let n = cu(t);
9984
+ let n = lu(t);
9987
9985
  this.options = n;
9988
9986
  let { isDark: r, resolvedTheme: i, features: a, chartFeatures: o } = this.readOptions(n);
9989
9987
  this.buildRoot(e, n, r, i), this.buildToolbar(n, a);
@@ -10044,7 +10042,7 @@ var lu = class {
10044
10042
  ...o,
10045
10043
  priceAxisAddButton: this.priceAxisAddDefault && this.featureState["menu.priceAxisAdd"]
10046
10044
  };
10047
- if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(ou.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
10045
+ if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(su.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
10048
10046
  ...this.chartSettings.settingsState,
10049
10047
  legendVisible: o.legend !== !1,
10050
10048
  volumeVisible: o.volume !== !1,
@@ -10079,8 +10077,8 @@ var lu = class {
10079
10077
  }
10080
10078
  buildRoot(e, t, n, r) {
10081
10079
  on(), this.root = document.createElement("div"), this.root.className = "tcw-root";
10082
- let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : vu(t.locale) ? "rtl" : "ltr";
10083
- this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new ec(this.root), this.portal.className = "tcw-root tcw-portal", this.look = Qn({
10080
+ let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : yu(t.locale) ? "rtl" : "ltr";
10081
+ this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new tc(this.root), this.portal.className = "tcw-root tcw-portal", this.look = Qn({
10084
10082
  dark: n,
10085
10083
  theme: r
10086
10084
  });
@@ -10088,7 +10086,7 @@ var lu = class {
10088
10086
  this.scope.run(() => $n(() => {
10089
10087
  let { dark: e, theme: t } = this.look.get();
10090
10088
  this.root.dataset.tcwTheme = this.portal.dataset.tcwTheme = e ? "dark" : "light", a && (this.keepingLook(() => this.chart.setTheme(t)), this.paintWatermark());
10091
- })), a = !0, this.stopKeyboardInset = Ns([this.root, this.portal]), this.stopNarrow = Ps(this.root, (e) => {
10089
+ })), a = !0, this.stopKeyboardInset = Ps([this.root, this.portal]), this.stopNarrow = Fs(this.root, (e) => {
10092
10090
  this.toolbar?.fit(), e || this.sidebar?.closeOverlay(), this.docking.syncRail();
10093
10091
  }), this.ui = U(t.ui), this.uiVariables = t.ui !== void 0, this.uiScale = this.scaleNow(), this.applyLookTokens(), typeof ResizeObserver < "u" && (this.scaleObserver = new ResizeObserver(() => this.fitScale()), this.scaleObserver.observe(this.root)), this.markSwitchedOff(), this.stopFormControls = Qt([this.root, this.portal], {
10094
10092
  layer: this.overlayHost,
@@ -10165,16 +10163,16 @@ var lu = class {
10165
10163
  }, this.t), this.scope.run(() => $n(() => {
10166
10164
  let e = this.chartSettings.followCrosshairCursor();
10167
10165
  this.sidebar?.showCrosshairCursor(e);
10168
- })), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new kc(this.chartContainer, this.t("status.loading")), this.historyPill = new jc(this.chartContainer, {
10166
+ })), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new Ac(this.chartContainer, this.t("status.loading")), this.historyPill = new Mc(this.chartContainer, {
10169
10167
  loading: this.t("history.loading"),
10170
10168
  failed: this.t("history.failed")
10171
- }), this.docking.dock = new Hs(n, {
10169
+ }), this.docking.dock = new Us(n, {
10172
10170
  labels: {
10173
10171
  rail: this.t("dock.rail"),
10174
10172
  resize: this.t("dock.resize")
10175
10173
  },
10176
- savedWidth: () => gu(),
10177
- saveWidth: (e) => _u(e),
10174
+ savedWidth: () => _u(),
10175
+ saveWidth: (e) => vu(e),
10178
10176
  railShown: () => this.docking.railShown(),
10179
10177
  focusAfterClose: (e) => this.docking.panelFocusTarget(e),
10180
10178
  room: () => n.clientWidth
@@ -10277,7 +10275,7 @@ var lu = class {
10277
10275
  }
10278
10276
  }), this.clockTimer = setInterval(() => {
10279
10277
  !Kr() && this.featureState.statusBar && this.featureState["statusBar.clock"] && this.statusBar?.tick();
10280
- }, au), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
10278
+ }, ou), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
10281
10279
  title: this.t("goTo.title"),
10282
10280
  date: this.t("range.date"),
10283
10281
  range: this.t("goTo.range"),
@@ -10336,7 +10334,7 @@ var lu = class {
10336
10334
  eraser: t ?? this.state.eraser,
10337
10335
  zoomArea: n ?? this.state.zoomArea
10338
10336
  }, this.updateUI();
10339
- }), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.on("legendResize", () => this.legend.scheduleLegend()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new dc(this.chartContainer, {
10337
+ }), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.on("legendResize", () => this.legend.scheduleLegend()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new fc(this.chartContainer, {
10340
10338
  onToggleVisible: (e, t, n) => {
10341
10339
  n === "compare" ? this.chart.setCompareVisible(e, t) : this.chart.setIndicatorVisible(e, t), this.legend.scheduleLegend(), this.objectTree?.isOpen() && this.docking.refreshObjects();
10342
10340
  },
@@ -10349,7 +10347,7 @@ var lu = class {
10349
10347
  onMore: (e, t) => this.legend.openLegendMenu(e, t),
10350
10348
  onPaneAction: (e, t) => this.legend.runPaneAction(e, t),
10351
10349
  onStackResize: (e) => this.chart.setLegendStack?.(e ? {
10352
- width: ol(this.chart) + e.width,
10350
+ width: sl(this.chart) + e.width,
10353
10351
  height: 1 + e.height
10354
10352
  } : null)
10355
10353
  }, {
@@ -10398,7 +10396,7 @@ var lu = class {
10398
10396
  "dataUpdate",
10399
10397
  "symbolInfoChange"
10400
10398
  ]) this.chart.on(e, () => this.placeDrawingButton());
10401
- this.placeDrawingButton(), this.dataWindow = new Tc(this.root, {
10399
+ this.placeDrawingButton(), this.dataWindow = new Ec(this.root, {
10402
10400
  formatPrice: (e) => this.formatAlertPrice(e),
10403
10401
  formatPercent: (e) => this.formatNumber(e, 2),
10404
10402
  formatVolume: (e) => this.formatVolume(e),
@@ -10423,7 +10421,7 @@ var lu = class {
10423
10421
  },
10424
10422
  toWallTime: (e) => X(e * E(this.chart.getData()), this.displayTimezone()),
10425
10423
  fromWallTime: (e, t) => {
10426
- let n = zs(e, t, this.displayTimezone());
10424
+ let n = Bs(e, t, this.displayTimezone());
10427
10425
  return n === null ? null : n / E(this.chart.getData());
10428
10426
  },
10429
10427
  roundPrice: (e) => this.chart.roundPrice(e),
@@ -10436,7 +10434,7 @@ var lu = class {
10436
10434
  save: (t) => this.drawingEdit.promptSaveDrawingTemplate(e, t),
10437
10435
  remove: (t, n) => e.remove(t, n)
10438
10436
  }
10439
- }, this.t)), this.drawingEdit.inlineText = new Ao(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
10437
+ }, this.t)), this.drawingEdit.inlineText = new jo(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
10440
10438
  let t = e.payload.id, n = this.chart.getDrawings().find((e) => e.id === t)?.type;
10441
10439
  n && K[n] && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, n && K[n] ? { tab: "text" } : {});
10442
10440
  }), this.chart.on("drawingRemove", (e) => {
@@ -10454,7 +10452,7 @@ var lu = class {
10454
10452
  justDrawn: !0
10455
10453
  }));
10456
10454
  }, s = () => setTimeout(o, 0);
10457
- window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, Wl), this.drawingEdit.cancelTextPrompt = a;
10455
+ window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, Gl), this.drawingEdit.cancelTextPrompt = a;
10458
10456
  }), this.drawingStyle = new co(this.root, {
10459
10457
  onStyleChange: (e) => {
10460
10458
  this.chart.setDrawingStyle(e), this.chart.setSelectedDrawingStyle(e);
@@ -10466,7 +10464,7 @@ var lu = class {
10466
10464
  this.menus.drawingMenu = new C(this.root, this.t("drawingMenu.label")), this.chart.on("drawingContextMenu", (e) => {
10467
10465
  let { id: t, x: n, y: r } = e.payload;
10468
10466
  this.menus.openDrawingMenu(t, n, r);
10469
- }), this.drawingEdit.selectionToolbar = new vo(this.root, {
10467
+ }), this.drawingEdit.selectionToolbar = new yo(this.root, {
10470
10468
  onStyle: (e) => {
10471
10469
  for (let t of this.chart.getSelectedDrawingIds()) {
10472
10470
  let n = this.chart.getDrawings().find((e) => e.id === t)?.type, r = n ? K[n] : void 0, i = e.fillColor !== void 0 && r && !r.box ? {
@@ -10532,19 +10530,19 @@ var lu = class {
10532
10530
  ...this.menus.chartMenuContext(s),
10533
10531
  ...o ? { pane: this.chart.getPaneScale(o) } : {}
10534
10532
  };
10535
- this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(Ho(t, c, this.t), _e, this.featureState), n, r, {
10533
+ this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(Uo(t, c, this.t), _e, this.featureState), n, r, {
10536
10534
  area: t,
10537
10535
  price: s,
10538
10536
  time: a
10539
10537
  });
10540
10538
  }), this.chart.on("priceAxisAdd", (e) => {
10541
10539
  if (!this.featureState["menu.priceAxisAdd"]) return;
10542
- let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(Io(this.menus.chartMenuContext(i), this.t), _e, this.featureState);
10540
+ let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(Lo(this.menus.chartMenuContext(i), this.t), _e, this.featureState);
10543
10541
  this.menus.openChartMenu(a, n, r, {
10544
10542
  area: "priceAxisAdd",
10545
10543
  price: i
10546
10544
  });
10547
- }), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new ws(this.chartContainer, {
10545
+ }), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new Ts(this.chartContainer, {
10548
10546
  title: this.t("interval.title"),
10549
10547
  hint: this.t("interval.hint"),
10550
10548
  invalid: this.t("interval.invalid")
@@ -10552,7 +10550,7 @@ var lu = class {
10552
10550
  }
10553
10551
  buildTrading(e, t) {
10554
10552
  if (e.layouts !== !1 && this.layouts.setupLayouts(e.layouts === !0 || e.layouts === void 0 ? {} : e.layouts), e.trading !== !1) {
10555
- this.trading.orderTicket = new _s(this.root, {
10553
+ this.trading.orderTicket = new vs(this.root, {
10556
10554
  onSubmit: (e) => {
10557
10555
  this.chart.placeOrderIntent(e), this.say(w(this.t("ticket.sent"), {
10558
10556
  side: this.t(e.side === "buy" ? "ticket.buy" : "ticket.sell"),
@@ -10563,7 +10561,7 @@ var lu = class {
10563
10561
  formatPrice: (e) => this.formatAlertPrice(e),
10564
10562
  formatAmount: (e) => this.formatMoney(e),
10565
10563
  formatNumber: (e, t) => this.formatNumber(e, t)
10566
- }, this.t), this.trading.accountPanel = new rs(t, {
10564
+ }, this.t), this.trading.accountPanel = new is(t, {
10567
10565
  onClosePosition: (e) => this.chart.closePositionIntent(e),
10568
10566
  onReversePosition: (e) => this.chart.reversePositionIntent(e),
10569
10567
  onCancelOrder: (e) => this.chart.cancelOrderIntent(e),
@@ -10588,7 +10586,7 @@ var lu = class {
10588
10586
  ]) this.chart.on(e, () => this.trading.refreshAccountSoon());
10589
10587
  }
10590
10588
  if (e.trading !== !1) {
10591
- if (this.trading.bracketBar = new vc(this.chartContainer, {
10589
+ if (this.trading.bracketBar = new yc(this.chartContainer, {
10592
10590
  onConfirm: () => this.chart.confirmBracket(),
10593
10591
  onCancel: () => {
10594
10592
  this.chart.cancelBracket(), this.trading.bracketBar?.hide();
@@ -10597,7 +10595,7 @@ var lu = class {
10597
10595
  let t = e.payload;
10598
10596
  this.trading.bracketBar?.hide(), this.say(w(this.t(t.side === "buy" ? "bracket.longPlaced" : "bracket.shortPlaced"), { rr: t.riskReward.toFixed(2) }));
10599
10597
  }), e.depthLadder) {
10600
- this.trading.depthLadder = new Sc(this.root, {
10598
+ this.trading.depthLadder = new Cc(this.root, {
10601
10599
  onTrade: (e, t) => {
10602
10600
  this.chart.placeOrderIntent({
10603
10601
  side: e,
@@ -10639,7 +10637,7 @@ var lu = class {
10639
10637
  }, this.t), this.chart.on("alertAdd", () => this.alerting.refreshAlerts()), this.chart.on("alertRemove", () => this.alerting.refreshAlerts()), this.chart.on("alertUpdate", () => this.alerting.refreshAlerts()), this.chart.on("alertExpired", (e) => {
10640
10638
  let t = e.payload;
10641
10639
  this.alerting.refreshAlerts(), this.featureState.alerts && this.say(w(this.t("alerts.expiredToast"), { text: t.message ?? this.alerting.alertText(t) }));
10642
- }), e.alertNotifications && (this.alerting.alertNotifier = new yc(e.alertNotifications)), this.chart.on("alertTriggered", (e) => {
10640
+ }), e.alertNotifications && (this.alerting.alertNotifier = new bc(e.alertNotifications)), this.chart.on("alertTriggered", (e) => {
10643
10641
  let t = e.payload;
10644
10642
  if (this.alerting.refreshAlerts(), !this.featureState.alerts) return;
10645
10643
  let n = `${this.alerting.alertText(t)}${t.message ? ` — ${t.message}` : ""}`;
@@ -10734,8 +10732,8 @@ var lu = class {
10734
10732
  onAction: (e) => this.commands.handleAction(e),
10735
10733
  onClose: () => {}
10736
10734
  }, this.overlayHost, this.t, {
10737
- list: () => pu(),
10738
- add: (e) => mu([e, ...pu().filter((t) => t !== e)])
10735
+ list: () => mu(),
10736
+ add: (e) => hu([e, ...mu().filter((t) => t !== e)])
10739
10737
  })), this.boundGlobalKeydown = (e) => {
10740
10738
  if (this.handleHostHotkey(e) || this.featureState.hotkeys && this.replay.isOpen() && this.replay.handleReplayKey(e)) return;
10741
10739
  let t = L(this.root), n = (e) => this.featureState.hotkeys && this.featureState[e];
@@ -10756,11 +10754,11 @@ var lu = class {
10756
10754
  let t = document.activeElement;
10757
10755
  if (t && t !== document.body && !this.root.contains(t)) return;
10758
10756
  e.preventDefault(), this.intervals.intervalInput.open(e.key);
10759
- } else if (iu(e) !== null) {
10757
+ } else if (au(e) !== null) {
10760
10758
  if (e.defaultPrevented || !n("symbolTyping") || !this.featureState.symbolSearch || R() || Ar() || !L(this.root, !0)) return;
10761
10759
  let t = document.activeElement;
10762
10760
  if (t && t !== document.body && !this.root.contains(t)) return;
10763
- e.preventDefault(), this.openSymbolSearch(iu(e));
10761
+ e.preventDefault(), this.openSymbolSearch(au(e));
10764
10762
  } else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyI" || e.code === "KeyG" || e.code === "KeyR")) {
10765
10763
  if (R() || !t) return;
10766
10764
  if (e.code === "KeyI") {
@@ -10789,13 +10787,13 @@ var lu = class {
10789
10787
  }
10790
10788
  preloadDialogsWhenIdle() {
10791
10789
  let e = () => {
10792
- this.destroyed || Is();
10790
+ this.destroyed || Ls();
10793
10791
  }, t = globalThis;
10794
10792
  if (t.requestIdleCallback && t.cancelIdleCallback) {
10795
- let n = t.requestIdleCallback(e, { timeout: Ql }), r = t.cancelIdleCallback;
10793
+ let n = t.requestIdleCallback(e, { timeout: $l }), r = t.cancelIdleCallback;
10796
10794
  this.stopPreload = () => r(n);
10797
10795
  } else {
10798
- let t = setTimeout(e, $l);
10796
+ let t = setTimeout(e, eu);
10799
10797
  this.stopPreload = () => clearTimeout(t);
10800
10798
  }
10801
10799
  }
@@ -10957,7 +10955,7 @@ var lu = class {
10957
10955
  for (let t of [this.root, this.portal]) {
10958
10956
  if (ba(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
10959
10957
  let n = ya(e);
10960
- for (let e of Kl) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
10958
+ for (let e of ql) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
10961
10959
  }
10962
10960
  }
10963
10961
  fitScale() {
@@ -10966,7 +10964,7 @@ var lu = class {
10966
10964
  if (e !== this.uiScale) {
10967
10965
  if (this.ui.scale === "auto") {
10968
10966
  let t = this.root.clientWidth;
10969
- if ((e > this.uiScale ? ta(t - Gl) : ta(t + Gl)) === this.uiScale) return;
10967
+ if ((e > this.uiScale ? ta(t - Kl) : ta(t + Kl)) === this.uiScale) return;
10970
10968
  }
10971
10969
  this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
10972
10970
  }
@@ -11119,9 +11117,9 @@ var lu = class {
11119
11117
  for (let [n, r] of t) e(n) && r();
11120
11118
  }
11121
11119
  addHotkey(e) {
11122
- let t = Rc(e.keys);
11120
+ let t = zc(e.keys);
11123
11121
  if (!t) return console.warn(`[ChartWidget] Can't read the shortcut "${e.keys}": modifiers (Ctrl, Alt, Shift) and a key, joined by +.`), null;
11124
- Vc(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
11122
+ Hc(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
11125
11123
  let n = {
11126
11124
  spec: e,
11127
11125
  parsed: t
@@ -11131,8 +11129,8 @@ var lu = class {
11131
11129
  } };
11132
11130
  }
11133
11131
  handleHostHotkey(e) {
11134
- if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() || Hc(e) || Ar()) return !1;
11135
- let t = this.hostHotkeys.find((t) => zc(e, t.parsed));
11132
+ if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() || Uc(e) || Ar()) return !1;
11133
+ let t = this.hostHotkeys.find((t) => Bc(e, t.parsed));
11136
11134
  if (!t) return !1;
11137
11135
  let n = !t.parsed.ctrl && !t.parsed.alt;
11138
11136
  if (!L(this.root, n)) return !1;
@@ -11141,13 +11139,13 @@ var lu = class {
11141
11139
  }
11142
11140
  paintWatermark() {
11143
11141
  this.chart.setWatermark(De(this.state.symbol).ticker.replace("USDT", " / USDT"), {
11144
- fontSize: eu,
11145
- color: this.state.isDark ? tu : nu
11142
+ fontSize: tu,
11143
+ color: this.state.isDark ? nu : ru
11146
11144
  });
11147
11145
  }
11148
11146
  keepingLook(e) {
11149
11147
  this.chartSettings.settingsEdit && this.settings?.close();
11150
- let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(su.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
11148
+ let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(cu.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
11151
11149
  e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
11152
11150
  }
11153
11151
  sheetKeyOn(e) {
@@ -11200,7 +11198,7 @@ var lu = class {
11200
11198
  let i = e.items();
11201
11199
  if (i.length === 0) return;
11202
11200
  let a = t.menuAnchor(r);
11203
- n.openUnder(Nc([], i), a, (e) => Pc(e, i));
11201
+ n.openUnder(Pc([], i), a, (e) => Fc(e, i));
11204
11202
  }
11205
11203
  });
11206
11204
  return r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), t.tidy(), {
@@ -11286,7 +11284,7 @@ var lu = class {
11286
11284
  from: i(o.from),
11287
11285
  to: i(o.to)
11288
11286
  },
11289
- withTime: !(k(this.state.timeframe) >= Zl),
11287
+ withTime: !(k(this.state.timeframe) >= Ql),
11290
11288
  max: s,
11291
11289
  today: s
11292
11290
  });
@@ -11296,12 +11294,12 @@ var lu = class {
11296
11294
  if (t.length === 0) return;
11297
11295
  let r = E(t);
11298
11296
  if (e.kind === "date") {
11299
- let i = zs(e.date, e.time, n);
11297
+ let i = Bs(e.date, e.time, n);
11300
11298
  if (i === null) return;
11301
11299
  this.chart.goToTime(i / r), i / r < t[0].time && this.say(this.t("range.beforeData"));
11302
11300
  return;
11303
11301
  }
11304
- let i = zs(e.from.date, e.from.time, n), a = zs(e.to.date, e.to.time, n);
11302
+ let i = Bs(e.from.date, e.from.time, n), a = Bs(e.to.date, e.to.time, n);
11305
11303
  i === null || a === null || (this.chart.setVisibleRange(i / r, a / r), Math.min(i, a) / r < t[0].time && this.say(this.t("range.beforeData")));
11306
11304
  }
11307
11305
  showMarkerTip(e) {
@@ -11331,7 +11329,7 @@ var lu = class {
11331
11329
  this.say(this.t("templates.nothing"), "error");
11332
11330
  return;
11333
11331
  }
11334
- this.templatePrompt ??= new Ss(this.root, this.t), this.templatePrompt.open({
11332
+ this.templatePrompt ??= new Cs(this.root, this.t), this.templatePrompt.open({
11335
11333
  title: this.t("templates.saveTitle"),
11336
11334
  submitLabel: this.t("common.save"),
11337
11335
  placeholder: this.t("templates.namePlaceholder"),
@@ -11351,9 +11349,9 @@ var lu = class {
11351
11349
  }
11352
11350
  async switchLocalTimeframe() {
11353
11351
  if (!this.baseSeries) return;
11354
- let e = ++this.localSeq, t = this.lastLocalSwitchMs >= ql || this.baseSeries.length >= Jl;
11352
+ let e = ++this.localSeq, t = this.lastLocalSwitchMs >= Jl || this.baseSeries.length >= Yl;
11355
11353
  try {
11356
- if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await Xl(), e !== this.localSeq || this.destroyed)) return;
11354
+ if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await Zl(), e !== this.localSeq || this.destroyed)) return;
11357
11355
  this.applyTimeframeData();
11358
11356
  } finally {
11359
11357
  e === this.localSeq && this.loading.end();
@@ -11467,7 +11465,7 @@ var lu = class {
11467
11465
  defaults: r.descriptor.defaultConfig,
11468
11466
  params: r.params,
11469
11467
  inputs: r.descriptor.inputs,
11470
- lineSources: uu(t, n, this.t),
11468
+ lineSources: du(t, n, this.t),
11471
11469
  plots: r.descriptor.plots,
11472
11470
  colors: i?.colors,
11473
11471
  lineWidth: i?.lineWidths[0],
@@ -11486,7 +11484,7 @@ var lu = class {
11486
11484
  this.alerting.refreshAlerts(), this.trading.refreshAccountSoon(), this.dataWindow?.isOpen() && this.dataWindow.render(this.docking.buildDataWindowModel());
11487
11485
  }
11488
11486
  formatMoney(e) {
11489
- return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()), ru));
11487
+ return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()), iu));
11490
11488
  }
11491
11489
  formatVolume(e) {
11492
11490
  return et(e, this.chartSettings.settingsState.numberLocale || "en-US");
@@ -11507,7 +11505,7 @@ var lu = class {
11507
11505
  });
11508
11506
  }
11509
11507
  indicatorValueText(e, t, n) {
11510
- return t ? this.chart.formatPrice(e) : _c(e, n);
11508
+ return t ? this.chart.formatPrice(e) : vc(e, n);
11511
11509
  }
11512
11510
  chartSetsDecimals() {
11513
11511
  return this.chart.getMarket?.()?.pricePrecision != null || this.chart.getSymbolInfo?.()?.pricePrecision != null;
@@ -11592,7 +11590,7 @@ var lu = class {
11592
11590
  }), this.updateUI();
11593
11591
  }
11594
11592
  lazyPart(e, t) {
11595
- return new Fs(e, t, (e) => e.destroy(), () => this.say(this.t("common.partFailed"), "error"));
11593
+ return new Is(e, t, (e) => e.destroy(), () => this.say(this.t("common.partFailed"), "error"));
11596
11594
  }
11597
11595
  whenLoaded(e, t, n) {
11598
11596
  if (!e || !t()) return;
@@ -12366,7 +12364,7 @@ var lu = class {
12366
12364
  };
12367
12365
  }
12368
12366
  };
12369
- function uu(e, t, n) {
12367
+ function du(e, t, n) {
12370
12368
  let r = (e) => {
12371
12369
  let t = Rt(e.descriptor);
12372
12370
  return t && st(e.params[t])?.instanceId || null;
@@ -12389,66 +12387,66 @@ function uu(e, t, n) {
12389
12387
  }
12390
12388
  return a;
12391
12389
  }
12392
- var du = "tcw:recentCommands", fu = 10;
12393
- function pu() {
12390
+ var fu = "tcw:recentCommands", pu = 10;
12391
+ function mu() {
12394
12392
  try {
12395
- let e = JSON.parse(qr()?.getItem(du) ?? "[]");
12396
- return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, fu) : [];
12393
+ let e = JSON.parse(qr()?.getItem(fu) ?? "[]");
12394
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, pu) : [];
12397
12395
  } catch {
12398
12396
  return [];
12399
12397
  }
12400
12398
  }
12401
- function mu(e) {
12399
+ function hu(e) {
12402
12400
  try {
12403
- qr()?.setItem(du, JSON.stringify(e.slice(0, fu)));
12401
+ qr()?.setItem(fu, JSON.stringify(e.slice(0, pu)));
12404
12402
  } catch {}
12405
12403
  }
12406
- var hu = "tcw:dockWidth";
12407
- function gu() {
12404
+ var gu = "tcw:dockWidth";
12405
+ function _u() {
12408
12406
  try {
12409
- let e = Number(qr()?.getItem(hu) ?? NaN);
12407
+ let e = Number(qr()?.getItem(gu) ?? NaN);
12410
12408
  return Number.isFinite(e) && e > 0 ? e : null;
12411
12409
  } catch {
12412
12410
  return null;
12413
12411
  }
12414
12412
  }
12415
- function _u(e) {
12413
+ function vu(e) {
12416
12414
  try {
12417
- qr()?.setItem(hu, String(e));
12415
+ qr()?.setItem(gu, String(e));
12418
12416
  } catch {}
12419
12417
  }
12420
- function vu(e) {
12418
+ function yu(e) {
12421
12419
  return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
12422
12420
  }
12423
12421
  //#endregion
12424
12422
  //#region src/widget/GridLayoutPicker.ts
12425
- var yu = 2, bu = 20, xu = 2, Su = 16, Cu = 2, wu = 4, Tu = {
12423
+ var bu = 2, xu = 20, Su = 2, Cu = 16, wu = 2, Tu = 4, Eu = {
12426
12424
  left: "grid.layoutBigLeft",
12427
12425
  right: "grid.layoutBigRight",
12428
12426
  top: "grid.layoutBigTop",
12429
12427
  bottom: "grid.layoutBigBottom"
12430
12428
  };
12431
- function Eu(e, t, n) {
12432
- let r = (bu - xu * (n - 1)) / n;
12433
- return [yu + e * (r + xu), t * r + (t - 1) * xu];
12429
+ function Du(e, t, n) {
12430
+ let r = (xu - Su * (n - 1)) / n;
12431
+ return [bu + e * (r + Su), t * r + (t - 1) * Su];
12434
12432
  }
12435
- function Du(e, t = Su) {
12433
+ function Ou(e, t = Cu) {
12436
12434
  return `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${n(e).map(([t, n, r, i]) => {
12437
- let [a, o] = Eu(t, r, e.cols), [s, c] = Eu(n, i, e.rows);
12435
+ let [a, o] = Du(t, r, e.cols), [s, c] = Du(n, i, e.rows);
12438
12436
  return `<rect x="${a}" y="${s}" width="${o}" height="${c}" rx="1"/>`;
12439
12437
  }).join("")}</svg>`;
12440
12438
  }
12441
- function Ou(e, t) {
12439
+ function ku(e, t) {
12442
12440
  let n = f[e], r = s(n);
12443
12441
  if (r === 1) return t("grid.single");
12444
12442
  let i = m(n);
12445
- return i ? w(t(Tu[i]), { count: r }) : w(t("grid.layoutOption"), {
12443
+ return i ? w(t(Eu[i]), { count: r }) : w(t("grid.layoutOption"), {
12446
12444
  count: r,
12447
12445
  cols: n.cols,
12448
12446
  rows: n.rows
12449
12447
  });
12450
12448
  }
12451
- var ku = class {
12449
+ var Au = class {
12452
12450
  button;
12453
12451
  panel = null;
12454
12452
  choices;
@@ -12465,8 +12463,8 @@ var ku = class {
12465
12463
  }), this.render();
12466
12464
  }
12467
12465
  render() {
12468
- let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${Ou(n, e)}`;
12469
- this.button.innerHTML = Du(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
12466
+ let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${ku(n, e)}`;
12467
+ this.button.innerHTML = Ou(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
12470
12468
  for (let e of this.items()) e.setAttribute("aria-checked", String(e.dataset.layout === n));
12471
12469
  }
12472
12470
  isOpen() {
@@ -12507,15 +12505,15 @@ var ku = class {
12507
12505
  return a.className = "tcw-grid-picker-row", a.append(...t.map((e) => this.item(e))), r.append(i, a), r;
12508
12506
  }
12509
12507
  item(e) {
12510
- let t = Ou(e, this.options.t), n = document.createElement("button");
12511
- return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML = Du(f[e]), n.addEventListener("click", () => this.pick(e)), n;
12508
+ let t = ku(e, this.options.t), n = document.createElement("button");
12509
+ return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML = Ou(f[e]), n.addEventListener("click", () => this.pick(e)), n;
12512
12510
  }
12513
12511
  pick(e) {
12514
12512
  this.close(), this.options.onPick(e), this.render();
12515
12513
  }
12516
12514
  place(e) {
12517
- let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a - wu;
12518
- e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + Cu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - Cu - wu)}px`;
12515
+ let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a - Tu;
12516
+ e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + wu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - wu - Tu)}px`;
12519
12517
  }
12520
12518
  items() {
12521
12519
  return this.panel ? [...this.panel.querySelectorAll("[role=\"menuitemradio\"]")] : [];
@@ -12546,32 +12544,32 @@ var ku = class {
12546
12544
  let o = this.rows(), s = o.findIndex((e) => e.includes(n[r])), c = o[s].indexOf(n[r]), l = o[(s + (t === "ArrowDown" ? 1 : -1) + o.length) % o.length];
12547
12545
  return l[Math.min(c, l.length - 1)];
12548
12546
  }
12549
- }, Au = {
12547
+ }, ju = {
12550
12548
  symbol: !1,
12551
12549
  interval: !1,
12552
12550
  crosshair: !0,
12553
12551
  time: !1,
12554
12552
  drawings: !1,
12555
12553
  replay: !1
12556
- }, ju = [
12554
+ }, Mu = [
12557
12555
  "symbol",
12558
12556
  "interval",
12559
12557
  "crosshair",
12560
12558
  "time",
12561
12559
  "drawings",
12562
12560
  "replay"
12563
- ], Mu = f;
12564
- function Nu(e) {
12561
+ ], Nu = f;
12562
+ function Pu(e) {
12565
12563
  return JSON.parse(JSON.stringify(e));
12566
12564
  }
12567
- function Pu(e) {
12565
+ function Fu(e) {
12568
12566
  if (typeof e != "object" || !e) return null;
12569
12567
  let t = e;
12570
12568
  if (t.v !== 1 || t.kind !== "grid" || !r(t.layout) || !Array.isArray(t.cells)) return null;
12571
- let n = t.cells.map(ks);
12569
+ let n = t.cells.map(As);
12572
12570
  if (n.some((e) => e === null)) return null;
12573
- let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Au };
12574
- for (let e of ju) typeof i[e] == "boolean" && (a[e] = i[e]);
12571
+ let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...ju };
12572
+ for (let e of Mu) typeof i[e] == "boolean" && (a[e] = i[e]);
12575
12573
  let o = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
12576
12574
  return {
12577
12575
  v: 1,
@@ -12582,7 +12580,7 @@ function Pu(e) {
12582
12580
  cells: n
12583
12581
  };
12584
12582
  }
12585
- var Fu = class {
12583
+ var Iu = class {
12586
12584
  root;
12587
12585
  cellsEl;
12588
12586
  cells = [];
@@ -12612,9 +12610,9 @@ var Fu = class {
12612
12610
  };
12613
12611
  constructor(e, t = {}) {
12614
12612
  this.options = t, this.layout = r(t.layout) ? t.layout : "1x2", this.sync = {
12615
- ...Au,
12613
+ ...ju,
12616
12614
  ...t.sync
12617
- }, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), on(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ba(this.root, U(t.widget?.ui), { variables: t.widget?.ui !== void 0 }), t.bar !== !1 && this.root.appendChild(this.buildBar()), this.cellsEl = document.createElement("div"), this.cellsEl.className = "tcw-grid-cells", this.root.appendChild(this.cellsEl), e.appendChild(this.root), this.stopNarrow = Ps(this.root), this.applyShape();
12615
+ }, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), on(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ba(this.root, U(t.widget?.ui), { variables: t.widget?.ui !== void 0 }), t.bar !== !1 && this.root.appendChild(this.buildBar()), this.cellsEl = document.createElement("div"), this.cellsEl.className = "tcw-grid-cells", this.root.appendChild(this.cellsEl), e.appendChild(this.root), this.stopNarrow = Fs(this.root), this.applyShape();
12618
12616
  for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
12619
12617
  this.markActive();
12620
12618
  let n = this.cells[0]?.el.querySelector(".tcw-root")?.dataset.tcwTheme;
@@ -12740,7 +12738,7 @@ var Fu = class {
12740
12738
  return JSON.stringify(this.captureLayout());
12741
12739
  }
12742
12740
  async applyLayoutContent(e) {
12743
- let t = Pu(As(e));
12741
+ let t = Fu(js(e));
12744
12742
  return t ? (await this.restoreLayout(t), !0) : !1;
12745
12743
  }
12746
12744
  destroy() {
@@ -12762,7 +12760,7 @@ var Fu = class {
12762
12760
  createCell(e) {
12763
12761
  let t = document.createElement("div");
12764
12762
  t.className = "tcw-grid-cell", t.setAttribute("role", "region"), t.setAttribute("aria-label", w(this.t("grid.chart"), { n: e + 1 })), i(t, n(f[this.layout])[e]), this.cellsEl.appendChild(t);
12765
- let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new lu(t, {
12763
+ let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new uu(t, {
12766
12764
  ...r,
12767
12765
  ...a,
12768
12766
  ...a.adapter ? { feed: void 0 } : {},
@@ -12819,7 +12817,7 @@ var Fu = class {
12819
12817
  t.replaySeekToTime(n);
12820
12818
  return;
12821
12819
  }
12822
- let r = Iu(t.getData(), n);
12820
+ let r = Lu(t.getData(), n);
12823
12821
  r >= 0 && t.replayStart({
12824
12822
  startIndex: r,
12825
12823
  paused: !0
@@ -12864,7 +12862,7 @@ var Fu = class {
12864
12862
  copyDrawings(e) {
12865
12863
  let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
12866
12864
  this.quietly(() => {
12867
- for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Nu(n));
12865
+ for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Pu(n));
12868
12866
  });
12869
12867
  }
12870
12868
  mergeDrawings() {
@@ -12876,7 +12874,7 @@ var Fu = class {
12876
12874
  let e = /* @__PURE__ */ new Map();
12877
12875
  for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
12878
12876
  let n = [...e.values()];
12879
- for (let e of t) e.widget.getChart().setDrawings(Nu(n));
12877
+ for (let e of t) e.widget.getChart().setDrawings(Pu(n));
12880
12878
  }
12881
12879
  });
12882
12880
  }
@@ -12913,7 +12911,7 @@ var Fu = class {
12913
12911
  let t = document.createElement("div");
12914
12912
  t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
12915
12913
  let n = this.options.layoutChoices?.filter(r) ?? l;
12916
- n.length > 0 && (this.layoutPicker = new ku({
12914
+ n.length > 0 && (this.layoutPicker = new Au({
12917
12915
  host: this.root,
12918
12916
  t: this.t,
12919
12917
  choices: n,
@@ -12924,7 +12922,7 @@ var Fu = class {
12924
12922
  i.className = "tcw-grid-group", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.t("grid.sync"));
12925
12923
  let a = document.createElement("span");
12926
12924
  a.className = "tcw-grid-label", a.innerHTML = `${x("link", 13)}<span>${S(this.t("grid.sync"))}</span>`, i.appendChild(a);
12927
- for (let e of ju) {
12925
+ for (let e of Mu) {
12928
12926
  let t = document.createElement("button");
12929
12927
  t.type = "button", t.className = "tcw-btn tcw-grid-sync", t.textContent = this.t(`grid.sync.${e}`), t.title = this.t(`grid.sync.${e}.hint`), t.addEventListener("click", () => this.setSync({ [e]: !this.sync[e] })), this.syncButtons.set(e, t), i.appendChild(t);
12930
12928
  }
@@ -12968,7 +12966,7 @@ var Fu = class {
12968
12966
  onChange: () => this.renderLayoutsButton(),
12969
12967
  onError: () => this.toast(this.t("layouts.saveFailed"), "error")
12970
12968
  });
12971
- this.session = t, this.layoutsUI = new pl(t, {
12969
+ this.session = t, this.layoutsUI = new ml(t, {
12972
12970
  root: this.root,
12973
12971
  t: this.t,
12974
12972
  toast: (e, t) => this.toast(e, t),
@@ -12982,12 +12980,12 @@ var Fu = class {
12982
12980
  this.cells[this.active]?.widget.toast(e, t);
12983
12981
  }
12984
12982
  };
12985
- function Iu(e, t) {
12983
+ function Lu(e, t) {
12986
12984
  let n = -1;
12987
12985
  for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
12988
12986
  return n;
12989
12987
  }
12990
12988
  //#endregion
12991
- export { Se as CHART_TYPE_ICONS, lu as ChartWidget, Fu as ChartWidgetGrid, Au as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, Mu as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, fa as WIDGET_UI_PRESETS, ba as applyWidgetUI, d as cleanLayoutName, Ce as createChartTypeIcon, x as createIcon, b as createToolIcon, ze as findWidgetLocale, be as iconSvg, o as localStorageLayouts, t as memoryLayouts, Pu as readGridLayout, oi as readWatchlists, ks as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, ya as widgetUIVariables };
12989
+ export { Se as CHART_TYPE_ICONS, uu as ChartWidget, Iu as ChartWidgetGrid, ju as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, Nu as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, fa as WIDGET_UI_PRESETS, ba as applyWidgetUI, d as cleanLayoutName, Ce as createChartTypeIcon, x as createIcon, b as createToolIcon, ze as findWidgetLocale, be as iconSvg, o as localStorageLayouts, t as memoryLayouts, Fu as readGridLayout, oi as readWatchlists, As as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, ya as widgetUIVariables };
12992
12990
 
12993
12991
  //# sourceMappingURL=index.js.map