@tradecanvas/core 0.7.0 → 0.8.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.
package/dist/index.js CHANGED
@@ -163,9 +163,20 @@ function O(e, t) {
163
163
  let i = t[r].time, a = t[n].time, o = a === i ? 0 : (e - i) / (a - i);
164
164
  return r + o;
165
165
  }
166
+ function k(e, t) {
167
+ let n = t.data;
168
+ return n && n.length > 0 ? O(e, n) : e;
169
+ }
170
+ function A(e, t) {
171
+ return w(k(e, t), t);
172
+ }
173
+ function j(e, t) {
174
+ let n = E(e, t), r = t.data;
175
+ return r && r.length > 0 ? r[Math.max(0, Math.min(r.length - 1, n))].time : n;
176
+ }
166
177
  //#endregion
167
178
  //#region src/engine/RenderEngine.ts
168
- var k = class {
179
+ var ee = class {
169
180
  layerManager;
170
181
  renderLoop;
171
182
  dprManager;
@@ -310,14 +321,16 @@ var k = class {
310
321
  destroy() {
311
322
  this.renderLoop.stop(), this.dprManager.destroy(), this.layerManager.destroy();
312
323
  }
313
- }, A = class {
324
+ }, te = class {
314
325
  state;
315
326
  dataLength = 0;
316
327
  minBarWidth;
317
328
  maxBarWidth;
318
329
  rightMarginBars;
319
330
  constructor(e, r, i = 2, a = 30, o = 5) {
320
- this.minBarWidth = i, this.maxBarWidth = a, this.rightMarginBars = o, this.state = {
331
+ this.minBarWidth = i, this.maxBarWidth = a, this.rightMarginBars = o;
332
+ let s = this.computeChartRect(e, r);
333
+ this.state = {
321
334
  visibleRange: {
322
335
  from: 0,
323
336
  to: 0
@@ -329,7 +342,7 @@ var k = class {
329
342
  barWidth: n,
330
343
  barSpacing: t,
331
344
  offset: 0,
332
- chartRect: this.computeChartRect(e, r)
345
+ chartRect: s
333
346
  };
334
347
  }
335
348
  getState() {
@@ -416,12 +429,12 @@ var k = class {
416
429
  };
417
430
  //#endregion
418
431
  //#region src/viewport/DataWindow.ts
419
- function ee(e, t) {
432
+ function ne(e, t) {
420
433
  return _(e, t.visibleRange.from, t.visibleRange.to);
421
434
  }
422
435
  //#endregion
423
436
  //#region src/charts/CandlestickRenderer.ts
424
- var te = class {
437
+ var re = class {
425
438
  render(e, t, n, r) {
426
439
  let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
427
440
  if (f === 0) return;
@@ -434,7 +447,7 @@ var te = class {
434
447
  }
435
448
  e.strokeStyle = r.candleUpWick, e.lineWidth = 1, e.stroke(_), e.strokeStyle = r.candleDownWick, e.stroke(v), e.fillStyle = r.candleUp, e.fill(y), e.fillStyle = r.candleDown, e.fill(b);
436
449
  }
437
- }, ne = class {
450
+ }, ie = class {
438
451
  render(e, t, n, r) {
439
452
  let { from: i, to: a } = n.visibleRange;
440
453
  if (i > a || t.length === 0) return;
@@ -449,7 +462,7 @@ var te = class {
449
462
  }
450
463
  e.stroke();
451
464
  }
452
- }, re = class {
465
+ }, ae = class {
453
466
  render(e, t, n, r) {
454
467
  let { from: i, to: a } = n.visibleRange;
455
468
  if (i > a || t.length === 0) return;
@@ -463,7 +476,7 @@ var te = class {
463
476
  for (let n = i + 1; n <= a && n < t.length; n++) e.lineTo(n * o + s, d + (l - t[n].close) * p);
464
477
  e.stroke();
465
478
  }
466
- }, ie = class {
479
+ }, oe = class {
467
480
  render(e, t, n, r) {
468
481
  let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
469
482
  if (f === 0) return;
@@ -474,7 +487,7 @@ var te = class {
474
487
  }
475
488
  e.lineWidth = 1, e.strokeStyle = r.candleUp, e.stroke(_), e.strokeStyle = r.candleDown, e.stroke(v);
476
489
  }
477
- }, ae = class {
490
+ }, se = class {
478
491
  render(e, t, n, r) {
479
492
  let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
480
493
  if (f === 0) return;
@@ -493,7 +506,7 @@ var te = class {
493
506
  e.strokeStyle = r.candleDown;
494
507
  for (let t of b) e.strokeRect(t.x, t.y, t.w, t.h);
495
508
  }
496
- }, oe = class {
509
+ }, ce = class {
497
510
  baselinePrice = null;
498
511
  setBaseline(e) {
499
512
  this.baselinePrice = e;
@@ -534,7 +547,7 @@ var te = class {
534
547
  for (let a = t; a <= n && a < e.length; a++) r += e[a].close, i++;
535
548
  return i > 0 ? r / i : 0;
536
549
  }
537
- }, se = class {
550
+ }, le = class {
538
551
  render(e, t, n, r) {
539
552
  let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
540
553
  if (f === 0) return;
@@ -545,7 +558,7 @@ var te = class {
545
558
  }
546
559
  e.fillStyle = r.candleUp, e.fill(_), e.fillStyle = r.candleDown, e.fill(v), e.lineWidth = 1, e.strokeStyle = r.candleUp, e.stroke(y), e.strokeStyle = r.candleDown, e.stroke(b);
547
560
  }
548
- }, ce = class {
561
+ }, ue = class {
549
562
  render(e, t, n, r) {
550
563
  let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
551
564
  if (f === 0) return;
@@ -559,7 +572,7 @@ var te = class {
559
572
  }
560
573
  e.strokeStyle = r.candleUp, e.lineWidth = 3, e.stroke(_), e.strokeStyle = r.candleDown, e.lineWidth = 1, e.stroke(v);
561
574
  }
562
- }, le = class {
575
+ }, de = class {
563
576
  boxSize = 1;
564
577
  setBoxSize(e) {
565
578
  this.boxSize = e;
@@ -577,7 +590,7 @@ var te = class {
577
590
  }
578
591
  e.lineWidth = 1.5, e.strokeStyle = r.candleUp, e.stroke(y), e.strokeStyle = r.candleDown, e.stroke(b);
579
592
  }
580
- }, ue = class {
593
+ }, fe = class {
581
594
  render(e, t, n, r) {
582
595
  let { from: i, to: a } = n.visibleRange, { min: o, max: s } = n.priceRange, c = s - o;
583
596
  if (c === 0 || i > a || t.length === 0) return;
@@ -593,7 +606,32 @@ var te = class {
593
606
  }
594
607
  e.strokeStyle = r.candleUpWick, e.lineWidth = 1, e.stroke(h), e.strokeStyle = r.candleDownWick, e.stroke(g), e.fillStyle = r.candleUp, e.fill(_), e.fillStyle = r.candleDown, e.fill(v);
595
608
  }
596
- }, de = class {
609
+ }, pe = class {
610
+ render(e, t, n, r) {
611
+ let { from: i, to: a } = n.visibleRange, { min: o, max: s } = n.priceRange, c = s - o;
612
+ if (c === 0 || i > a || t.length === 0) return;
613
+ let l = n.barWidth + n.barSpacing, u = -n.offset + n.chartRect.x + n.barWidth / 2, d = n.chartRect.y, f = n.chartRect.height / c, p = n.barWidth, m = 0;
614
+ for (let e = i; e <= a && e < t.length; e++) t[e].volume > m && (m = t[e].volume);
615
+ m === 0 && (m = 1);
616
+ let h = new Path2D(), g = new Path2D(), _ = new Path2D(), v = new Path2D(), y = (e) => e * l + u, b = (e) => d + (s - e) * f;
617
+ for (let e = i; e <= a && e < t.length; e++) {
618
+ let n = t[e], r = e > 0 ? t[e - 1] : n, i = y(e), a = b(n.high), o = b(n.low), s = n.close >= r.close, c = p * Math.max(.15, n.volume / m), l = c / 2, u = Math.max(o - a, 1), d = s ? h : g, f = s ? _ : v;
619
+ d.rect(i - l, a, c, u), f.rect(i - l, a, c, u);
620
+ }
621
+ e.fillStyle = me(r.candleUp, .55), e.fill(h), e.fillStyle = me(r.candleDown, .55), e.fill(g), e.lineWidth = 1, e.strokeStyle = r.candleUpWick, e.stroke(_), e.strokeStyle = r.candleDownWick, e.stroke(v);
622
+ }
623
+ };
624
+ function me(e, t) {
625
+ if (e.startsWith("#")) {
626
+ let n = Math.round(Math.max(0, Math.min(1, t)) * 255).toString(16).padStart(2, "0");
627
+ if (e.length === 7) return `${e}${n}`;
628
+ if (e.length === 9) return `${e.slice(0, 7)}${n}`;
629
+ }
630
+ return e;
631
+ }
632
+ //#endregion
633
+ //#region src/charts/HLCAreaRenderer.ts
634
+ var he = class {
597
635
  render(e, t, n, r) {
598
636
  let { from: i, to: a } = n.visibleRange;
599
637
  if (i > a || t.length === 0) return;
@@ -622,7 +660,7 @@ var te = class {
622
660
  }
623
661
  e.stroke();
624
662
  }
625
- }, fe = class {
663
+ }, ge = class {
626
664
  render(e, t, n, r) {
627
665
  let { from: i, to: a } = n.visibleRange;
628
666
  if (i > a || t.length === 0) return;
@@ -637,7 +675,7 @@ var te = class {
637
675
  }
638
676
  e.stroke();
639
677
  }
640
- }, pe = class {
678
+ }, _e = class {
641
679
  render(e, t, n, r) {
642
680
  let { from: i, to: a } = n.visibleRange;
643
681
  if (i > a || t.length === 0) return;
@@ -658,7 +696,7 @@ var te = class {
658
696
  for (let { x: e, y: t } of h) _.moveTo(e + g, t), _.arc(e, t, g, 0, Math.PI * 2);
659
697
  e.fillStyle = r.lineColor, e.fill(_), e.strokeStyle = r.background, e.lineWidth = 1, e.stroke(_);
660
698
  }
661
- }, me = class {
699
+ }, ve = class {
662
700
  visible = !0;
663
701
  heightRatio = .2;
664
702
  setVisible(e) {
@@ -679,7 +717,7 @@ var te = class {
679
717
  }
680
718
  e.globalAlpha = .35, e.fillStyle = r.candleUp, e.fill(h), e.fillStyle = r.candleDown, e.fill(g), e.globalAlpha = 1;
681
719
  }
682
- }, he = class {
720
+ }, ye = class {
683
721
  symbols = /* @__PURE__ */ new Map();
684
722
  mode = "percent";
685
723
  setMode(e) {
@@ -734,7 +772,7 @@ var te = class {
734
772
  };
735
773
  //#endregion
736
774
  //#region src/charts/transforms/heikinAshi.ts
737
- function ge(e) {
775
+ function be(e) {
738
776
  if (e.length === 0) return [];
739
777
  let t = [], n = e[0].open, r = (e[0].open + e[0].high + e[0].low + e[0].close) / 4;
740
778
  for (let i = 0; i < e.length; i++) {
@@ -752,10 +790,10 @@ function ge(e) {
752
790
  }
753
791
  //#endregion
754
792
  //#region src/charts/transforms/renko.ts
755
- function _e(e, t) {
793
+ function xe(e, t) {
756
794
  if (e.length === 0) return [];
757
795
  let n = t.brickSize;
758
- t.useATR && e.length > (t.atrPeriod ?? 14) && (n = ve(e, t.atrPeriod ?? 14)), n <= 0 && (n = 1);
796
+ t.useATR && e.length > (t.atrPeriod ?? 14) && (n = Se(e, t.atrPeriod ?? 14)), n <= 0 && (n = 1);
759
797
  let r = [], i = Math.round(e[0].close / n) * n, a = e[0].time;
760
798
  for (let t = 1; t < e.length; t++) {
761
799
  let o = e[t].close - i, s = Math.floor(Math.abs(o) / n);
@@ -776,7 +814,7 @@ function _e(e, t) {
776
814
  }
777
815
  return r;
778
816
  }
779
- function ve(e, t) {
817
+ function Se(e, t) {
780
818
  let n = 0;
781
819
  for (let r = 1; r <= Math.min(t, e.length - 1); r++) {
782
820
  let t = Math.max(e[r].high - e[r].low, Math.abs(e[r].high - e[r - 1].close), Math.abs(e[r].low - e[r - 1].close));
@@ -786,7 +824,7 @@ function ve(e, t) {
786
824
  }
787
825
  //#endregion
788
826
  //#region src/charts/transforms/lineBreak.ts
789
- function ye(e, t = 3) {
827
+ function Ce(e, t = 3) {
790
828
  if (e.length === 0) return [];
791
829
  let n = [], r = 0;
792
830
  n.push({
@@ -827,7 +865,7 @@ function ye(e, t = 3) {
827
865
  }
828
866
  //#endregion
829
867
  //#region src/charts/transforms/kagi.ts
830
- function be(e, t = 4) {
868
+ function we(e, t = 4) {
831
869
  if (e.length < 2) return e.slice();
832
870
  let n = [], r = e[1].close >= e[0].close ? 1 : -1, i = e[0].close, a = e[0].close, o = e[0].close, s = 0;
833
871
  for (let c = 1; c < e.length; c++) {
@@ -866,7 +904,7 @@ function be(e, t = 4) {
866
904
  }
867
905
  //#endregion
868
906
  //#region src/charts/transforms/pointAndFigure.ts
869
- function xe(e, t, n = 3) {
907
+ function Te(e, t, n = 3) {
870
908
  if (e.length === 0 || t <= 0) return [];
871
909
  let r = [], i = 0, a = 0, o = 0, s = 0, c = Math.round(e[0].close / t) * t;
872
910
  a = c, o = c, i = 1;
@@ -899,7 +937,7 @@ function xe(e, t, n = 3) {
899
937
  }
900
938
  //#endregion
901
939
  //#region src/charts/transforms/rangeBars.ts
902
- function Se(e, t) {
940
+ function Ee(e, t) {
903
941
  if (e.length === 0 || t.rangeSize <= 0) return [];
904
942
  let n = [], r = e[0].time, i = e[0].open, a = i, o = i, s = 0, c = (e, c) => {
905
943
  for (e > a && (a = e), e < o && (o = e), s += c; a - o >= t.rangeSize;) {
@@ -930,7 +968,7 @@ function Se(e, t) {
930
968
  }
931
969
  //#endregion
932
970
  //#region src/indicators/IndicatorBase.ts
933
- var j = class {
971
+ var M = class {
934
972
  drawLine(e, t, n, r) {
935
973
  if (!(t.length < 2)) {
936
974
  e.beginPath(), e.strokeStyle = n, e.lineWidth = r, e.lineJoin = "round", e.moveTo(t[0].x, t[0].y);
@@ -965,7 +1003,7 @@ var j = class {
965
1003
  }
966
1004
  return i;
967
1005
  }
968
- }, Ce = 1, we = class {
1006
+ }, De = 1, Oe = class {
969
1007
  registry = /* @__PURE__ */ new Map();
970
1008
  instances = /* @__PURE__ */ new Map();
971
1009
  register(e) {
@@ -977,7 +1015,7 @@ var j = class {
977
1015
  addIndicator(e, t = {}, n) {
978
1016
  let r = this.registry.get(e);
979
1017
  if (!r) throw Error(`Unknown indicator: ${e}`);
980
- let i = `tc_${e}_${Ce++}`, a = {
1018
+ let i = `tc_${e}_${De++}`, a = {
981
1019
  id: e,
982
1020
  instanceId: i,
983
1021
  params: {
@@ -1072,7 +1110,7 @@ var j = class {
1072
1110
  };
1073
1111
  //#endregion
1074
1112
  //#region src/indicators/params.ts
1075
- function M(e, t, n) {
1113
+ function N(e, t, n) {
1076
1114
  let r = e.params[t];
1077
1115
  if (typeof r == "number" && Number.isFinite(r)) return r;
1078
1116
  if (typeof r == "string") {
@@ -1081,13 +1119,13 @@ function M(e, t, n) {
1081
1119
  }
1082
1120
  return n;
1083
1121
  }
1084
- function N(e, t, n, r = 1) {
1085
- let i = M(e, t, n);
1122
+ function P(e, t, n, r = 1) {
1123
+ let i = N(e, t, n);
1086
1124
  return Math.max(r, Math.floor(i));
1087
1125
  }
1088
1126
  //#endregion
1089
1127
  //#region src/indicators/overlay/SMA.ts
1090
- var P = class extends j {
1128
+ var ke = class extends M {
1091
1129
  descriptor = {
1092
1130
  id: "sma",
1093
1131
  name: "Simple Moving Average",
@@ -1095,7 +1133,7 @@ var P = class extends j {
1095
1133
  defaultConfig: { period: 20 }
1096
1134
  };
1097
1135
  calculate(e, t) {
1098
- let n = N(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null), a = 0;
1136
+ let n = P(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null), a = 0;
1099
1137
  for (let t = 0; t < e.length; t++) if (a += e[t].close, t >= n && (a -= e[t - n].close), t >= n - 1) {
1100
1138
  let o = { value: a / n };
1101
1139
  r.set(e[t].time, o), i[t] = o;
@@ -1119,7 +1157,7 @@ var P = class extends j {
1119
1157
  }
1120
1158
  e.stroke();
1121
1159
  }
1122
- }, F = class extends j {
1160
+ }, Ae = class extends M {
1123
1161
  descriptor = {
1124
1162
  id: "ema",
1125
1163
  name: "Exponential Moving Average",
@@ -1127,7 +1165,7 @@ var P = class extends j {
1127
1165
  defaultConfig: { period: 20 }
1128
1166
  };
1129
1167
  calculate(e, t) {
1130
- let n = N(t, "period", 20, 1), r = 2 / (n + 1), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null), o = 0;
1168
+ let n = P(t, "period", 20, 1), r = 2 / (n + 1), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null), o = 0;
1131
1169
  for (let t = 0; t < e.length; t++) {
1132
1170
  if (t < n - 1) {
1133
1171
  o += e[t].close;
@@ -1156,7 +1194,7 @@ var P = class extends j {
1156
1194
  }
1157
1195
  e.stroke();
1158
1196
  }
1159
- }, Te = class extends j {
1197
+ }, je = class extends M {
1160
1198
  descriptor = {
1161
1199
  id: "bb",
1162
1200
  name: "Bollinger Bands",
@@ -1167,7 +1205,7 @@ var P = class extends j {
1167
1205
  }
1168
1206
  };
1169
1207
  calculate(e, t) {
1170
- let n = N(t, "period", 20, 1), r = M(t, "stdDev", 2), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null), o = 0, s = 0;
1208
+ let n = P(t, "period", 20, 1), r = N(t, "stdDev", 2), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null), o = 0, s = 0;
1171
1209
  for (let t = 0; t < e.length; t++) {
1172
1210
  let c = e[t].close;
1173
1211
  if (o += c, s += c * c, t >= n) {
@@ -1211,7 +1249,7 @@ var P = class extends j {
1211
1249
  e.stroke();
1212
1250
  }
1213
1251
  }
1214
- }, Ee = class extends j {
1252
+ }, Me = class extends M {
1215
1253
  descriptor = {
1216
1254
  id: "vwap",
1217
1255
  name: "Volume Weighted Average Price",
@@ -1246,7 +1284,7 @@ var P = class extends j {
1246
1284
  }
1247
1285
  e.stroke();
1248
1286
  }
1249
- }, De = class extends j {
1287
+ }, Ne = class extends M {
1250
1288
  descriptor = {
1251
1289
  id: "ichimoku",
1252
1290
  name: "Ichimoku Cloud",
@@ -1259,7 +1297,7 @@ var P = class extends j {
1259
1297
  }
1260
1298
  };
1261
1299
  calculate(e, t) {
1262
- let n = N(t, "tenkan", 9, 1), r = N(t, "kijun", 26, 1), i = N(t, "senkou", 52, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null), s = (t) => {
1300
+ let n = P(t, "tenkan", 9, 1), r = P(t, "kijun", 26, 1), i = P(t, "senkou", 52, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null), s = (t) => {
1263
1301
  let n = new Float64Array(e.length), r = new Float64Array(e.length);
1264
1302
  for (let i = 0; i < e.length; i++) {
1265
1303
  let a = -Infinity, o = Infinity, s = Math.max(0, i - t + 1);
@@ -1306,7 +1344,7 @@ var P = class extends j {
1306
1344
  };
1307
1345
  x(c, l, u, r.colors[0], r.lineWidths[0]), x(d, f, p, r.colors[1] ?? "#FF9800", r.lineWidths[0]), x(m, h, g, r.colors[2] ?? "#26A69A", 1), x(_, v, b, r.colors[3] ?? "#EF5350", 1);
1308
1346
  }
1309
- }, Oe = class extends j {
1347
+ }, Pe = class extends M {
1310
1348
  descriptor = {
1311
1349
  id: "psar",
1312
1350
  name: "Parabolic SAR",
@@ -1317,7 +1355,7 @@ var P = class extends j {
1317
1355
  }
1318
1356
  };
1319
1357
  calculate(e, t) {
1320
- let n = M(t, "step", .02), r = M(t, "max", .2), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1358
+ let n = N(t, "step", .02), r = N(t, "max", .2), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1321
1359
  if (e.length < 2) return {
1322
1360
  values: i,
1323
1361
  series: a
@@ -1352,7 +1390,7 @@ var P = class extends j {
1352
1390
  e.beginPath(), e.arc(o, c, s, 0, Math.PI * 2), e.fillStyle = a.trend === 1 ? r.colors[0] : r.colors[1] ?? "#EF5350", e.fill();
1353
1391
  }
1354
1392
  }
1355
- }, ke = class extends j {
1393
+ }, Fe = class extends M {
1356
1394
  descriptor = {
1357
1395
  id: "supertrend",
1358
1396
  name: "Supertrend",
@@ -1363,7 +1401,7 @@ var P = class extends j {
1363
1401
  }
1364
1402
  };
1365
1403
  calculate(e, t) {
1366
- let n = N(t, "period", 10, 1), r = M(t, "multiplier", 3), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1404
+ let n = P(t, "period", 10, 1), r = N(t, "multiplier", 3), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1367
1405
  if (e.length < n) return {
1368
1406
  values: i,
1369
1407
  series: a
@@ -1400,7 +1438,7 @@ var P = class extends j {
1400
1438
  d !== 0 && (e.beginPath(), e.strokeStyle = p === 1 ? s : c, e.lineWidth = r.lineWidths[0] + .5, e.moveTo(l, u), e.lineTo(o, f), e.stroke()), l = o, u = f, d = p;
1401
1439
  }
1402
1440
  }
1403
- }, Ae = class extends j {
1441
+ }, Ie = class extends M {
1404
1442
  descriptor = {
1405
1443
  id: "keltner",
1406
1444
  name: "Keltner Channel",
@@ -1412,7 +1450,7 @@ var P = class extends j {
1412
1450
  }
1413
1451
  };
1414
1452
  calculate(e, t) {
1415
- let n = N(t, "emaPeriod", 20, 1), r = N(t, "atrPeriod", 10, 1), i = M(t, "multiplier", 1.5), a = /* @__PURE__ */ new Map();
1453
+ let n = P(t, "emaPeriod", 20, 1), r = P(t, "atrPeriod", 10, 1), i = N(t, "multiplier", 1.5), a = /* @__PURE__ */ new Map();
1416
1454
  if (e.length < Math.max(n, r)) return { values: a };
1417
1455
  let o = 2 / (n + 1), s = e[0].close, c = [s];
1418
1456
  for (let t = 1; t < e.length; t++) s = (e[t].close - s) * o + s, c.push(s);
@@ -1457,7 +1495,7 @@ var P = class extends j {
1457
1495
  }
1458
1496
  this.drawBand(e, s, l, y(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? r.colors[0], r.lineWidths[0]), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
1459
1497
  }
1460
- }, je = class extends j {
1498
+ }, Le = class extends M {
1461
1499
  descriptor = {
1462
1500
  id: "donchian",
1463
1501
  name: "Donchian Channel",
@@ -1465,7 +1503,7 @@ var P = class extends j {
1465
1503
  defaultConfig: { period: 20 }
1466
1504
  };
1467
1505
  calculate(e, t) {
1468
- let n = N(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1506
+ let n = P(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1469
1507
  for (let t = n - 1; t < e.length; t++) {
1470
1508
  let a = -Infinity, o = Infinity;
1471
1509
  for (let r = t - n + 1; r <= t; r++) e[r].high > a && (a = e[r].high), e[r].low < o && (o = e[r].low);
@@ -1502,7 +1540,7 @@ var P = class extends j {
1502
1540
  }
1503
1541
  this.drawBand(e, s, l, y(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? "#787B86", 1), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
1504
1542
  }
1505
- }, Me = [
1543
+ }, Re = [
1506
1544
  "s3",
1507
1545
  "s2",
1508
1546
  "s1",
@@ -1510,7 +1548,7 @@ var P = class extends j {
1510
1548
  "r1",
1511
1549
  "r2",
1512
1550
  "r3"
1513
- ], Ne = class extends j {
1551
+ ], ze = class extends M {
1514
1552
  descriptor = {
1515
1553
  id: "pivots",
1516
1554
  name: "Pivot Points (Classic)",
@@ -1518,7 +1556,7 @@ var P = class extends j {
1518
1556
  defaultConfig: { lookback: 24 }
1519
1557
  };
1520
1558
  calculate(e, t) {
1521
- let n = N(t, "lookback", 24, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1559
+ let n = P(t, "lookback", 24, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1522
1560
  if (e.length <= n) return {
1523
1561
  values: r,
1524
1562
  series: i
@@ -1546,7 +1584,7 @@ var P = class extends j {
1546
1584
  let i = t.series;
1547
1585
  if (!i) return;
1548
1586
  let { from: a, to: o } = n.visibleRange, s = r.colors[0], c = r.colors[1] ?? "#EF5350", l = r.colors[2] ?? "#26A69A", u = r.lineWidths[0], d = (e) => e === "pp" ? s : e.startsWith("r") ? c : l;
1549
- for (let t of Me) {
1587
+ for (let t of Re) {
1550
1588
  e.beginPath(), e.strokeStyle = d(t), e.lineWidth = t === "pp" ? u : Math.max(1, u - 1), t !== "pp" && e.setLineDash([4, 3]);
1551
1589
  let r = !1;
1552
1590
  for (let s = a; s <= o && s < i.length; s++) {
@@ -1558,7 +1596,7 @@ var P = class extends j {
1558
1596
  e.stroke(), e.setLineDash([]);
1559
1597
  }
1560
1598
  }
1561
- }, Pe = class extends j {
1599
+ }, Be = class extends M {
1562
1600
  descriptor = {
1563
1601
  id: "avwap",
1564
1602
  name: "Anchored VWAP",
@@ -1566,7 +1604,7 @@ var P = class extends j {
1566
1604
  defaultConfig: { anchorTime: 0 }
1567
1605
  };
1568
1606
  calculate(e, t) {
1569
- let n = M(t, "anchorTime", 0), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null), a = 0;
1607
+ let n = N(t, "anchorTime", 0), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null), a = 0;
1570
1608
  if (n > 0 && (a = e.findIndex((e) => e.time >= n), a < 0)) return {
1571
1609
  values: r,
1572
1610
  series: i
@@ -1598,7 +1636,7 @@ var P = class extends j {
1598
1636
  }
1599
1637
  e.stroke();
1600
1638
  }
1601
- }, Fe = class extends j {
1639
+ }, Ve = class extends M {
1602
1640
  descriptor = {
1603
1641
  id: "zigzag",
1604
1642
  name: "ZigZag",
@@ -1606,7 +1644,7 @@ var P = class extends j {
1606
1644
  defaultConfig: { deviation: 5 }
1607
1645
  };
1608
1646
  calculate(e, t) {
1609
- let n = Math.max(.01, M(t, "deviation", 5)) / 100, r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1647
+ let n = Math.max(.01, N(t, "deviation", 5)) / 100, r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1610
1648
  if (e.length < 2) return {
1611
1649
  values: r,
1612
1650
  series: i,
@@ -1663,7 +1701,7 @@ var P = class extends j {
1663
1701
  e.stroke();
1664
1702
  }
1665
1703
  }
1666
- }, Ie = class extends j {
1704
+ }, He = class extends M {
1667
1705
  descriptor = {
1668
1706
  id: "lrc",
1669
1707
  name: "Linear Regression Channel",
@@ -1674,7 +1712,7 @@ var P = class extends j {
1674
1712
  }
1675
1713
  };
1676
1714
  calculate(e, t) {
1677
- let n = N(t, "period", 100, 2), r = M(t, "stdDev", 2), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1715
+ let n = P(t, "period", 100, 2), r = N(t, "stdDev", 2), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1678
1716
  if (e.length < n) return {
1679
1717
  values: i,
1680
1718
  series: a
@@ -1726,7 +1764,7 @@ var P = class extends j {
1726
1764
  }
1727
1765
  this.drawBand(e, s, l, y(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? r.colors[0], r.lineWidths[0]), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
1728
1766
  }
1729
- }, Le = class extends j {
1767
+ }, Ue = class extends M {
1730
1768
  descriptor = {
1731
1769
  id: "hma",
1732
1770
  name: "Hull Moving Average",
@@ -1734,12 +1772,12 @@ var P = class extends j {
1734
1772
  defaultConfig: { period: 21 }
1735
1773
  };
1736
1774
  calculate(e, t) {
1737
- let n = N(t, "period", 21, 2), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1775
+ let n = P(t, "period", 21, 2), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1738
1776
  if (e.length < n) return {
1739
1777
  values: r,
1740
1778
  series: i
1741
1779
  };
1742
- let a = e.map((e) => e.close), o = Math.max(2, Math.floor(n / 2)), s = Math.max(2, Math.floor(Math.sqrt(n))), c = Re(a, n), l = Re(a, o), u = ze(a.map((e, t) => c[t] === null || l[t] === null ? null : 2 * l[t] - c[t]), s);
1780
+ let a = e.map((e) => e.close), o = Math.max(2, Math.floor(n / 2)), s = Math.max(2, Math.floor(Math.sqrt(n))), c = We(a, n), l = We(a, o), u = Ge(a.map((e, t) => c[t] === null || l[t] === null ? null : 2 * l[t] - c[t]), s);
1743
1781
  for (let t = 0; t < e.length; t++) {
1744
1782
  if (u[t] === null) continue;
1745
1783
  let n = { value: u[t] };
@@ -1765,7 +1803,7 @@ var P = class extends j {
1765
1803
  e.stroke();
1766
1804
  }
1767
1805
  };
1768
- function Re(e, t) {
1806
+ function We(e, t) {
1769
1807
  let n = Array(e.length).fill(null);
1770
1808
  if (e.length < t) return n;
1771
1809
  let r = t * (t + 1) / 2;
@@ -1776,7 +1814,7 @@ function Re(e, t) {
1776
1814
  }
1777
1815
  return n;
1778
1816
  }
1779
- function ze(e, t) {
1817
+ function Ge(e, t) {
1780
1818
  let n = Array(e.length).fill(null), r = t * (t + 1) / 2;
1781
1819
  for (let i = t - 1; i < e.length; i++) {
1782
1820
  let a = 0, o = !0;
@@ -1794,7 +1832,7 @@ function ze(e, t) {
1794
1832
  }
1795
1833
  //#endregion
1796
1834
  //#region src/indicators/panel/AwesomeOscillator.ts
1797
- var Be = class extends j {
1835
+ var Ke = class extends M {
1798
1836
  descriptor = {
1799
1837
  id: "ao",
1800
1838
  name: "Awesome Oscillator",
@@ -1805,7 +1843,7 @@ var Be = class extends j {
1805
1843
  }
1806
1844
  };
1807
1845
  calculate(e, t) {
1808
- let n = N(t, "fast", 5, 1), r = N(t, "slow", 34, 1), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1846
+ let n = P(t, "fast", 5, 1), r = P(t, "slow", 34, 1), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1809
1847
  if (e.length < r) return {
1810
1848
  values: i,
1811
1849
  series: a
@@ -1842,7 +1880,7 @@ var Be = class extends j {
1842
1880
  e.fillStyle = r.up ? m : h, e.fillRect(a - p, s, n.barWidth, c);
1843
1881
  }
1844
1882
  }
1845
- }, Ve = class extends j {
1883
+ }, qe = class extends M {
1846
1884
  descriptor = {
1847
1885
  id: "chaikinOsc",
1848
1886
  name: "Chaikin Oscillator",
@@ -1853,7 +1891,7 @@ var Be = class extends j {
1853
1891
  }
1854
1892
  };
1855
1893
  calculate(e, t) {
1856
- let n = N(t, "fast", 3, 1), r = N(t, "slow", 10, 1), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1894
+ let n = P(t, "fast", 3, 1), r = P(t, "slow", 10, 1), i = /* @__PURE__ */ new Map(), a = Array(e.length).fill(null);
1857
1895
  if (e.length < r) return {
1858
1896
  values: i,
1859
1897
  series: a
@@ -1891,7 +1929,7 @@ var Be = class extends j {
1891
1929
  e.fillStyle = r.value >= 0 ? m : h, e.fillRect(a - p, s, n.barWidth, c);
1892
1930
  }
1893
1931
  }
1894
- }, He = class extends j {
1932
+ }, Je = class extends M {
1895
1933
  descriptor = {
1896
1934
  id: "rsi",
1897
1935
  name: "Relative Strength Index",
@@ -1899,7 +1937,7 @@ var Be = class extends j {
1899
1937
  defaultConfig: { period: 14 }
1900
1938
  };
1901
1939
  calculate(e, t) {
1902
- let n = N(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1940
+ let n = P(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
1903
1941
  if (e.length < n + 1) return {
1904
1942
  values: r,
1905
1943
  series: i
@@ -1942,7 +1980,7 @@ var Be = class extends j {
1942
1980
  }
1943
1981
  e.stroke();
1944
1982
  }
1945
- }, Ue = class extends j {
1983
+ }, Ye = class extends M {
1946
1984
  descriptor = {
1947
1985
  id: "macd",
1948
1986
  name: "MACD",
@@ -1954,7 +1992,7 @@ var Be = class extends j {
1954
1992
  }
1955
1993
  };
1956
1994
  calculate(e, t) {
1957
- let n = N(t, "fast", 12, 1), r = N(t, "slow", 26, 1), i = N(t, "signal", 9, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null);
1995
+ let n = P(t, "fast", 12, 1), r = P(t, "slow", 26, 1), i = P(t, "signal", 9, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null);
1958
1996
  if (e.length < r) return {
1959
1997
  values: a,
1960
1998
  series: o
@@ -2009,7 +2047,7 @@ var Be = class extends j {
2009
2047
  }
2010
2048
  e.fillStyle = m, e.fill(v), e.fillStyle = h, e.fill(y), e.strokeStyle = g, e.lineWidth = r.lineWidths[0], e.lineJoin = "round", e.stroke(S), e.strokeStyle = _, e.stroke(C);
2011
2049
  }
2012
- }, We = class extends j {
2050
+ }, F = class extends M {
2013
2051
  descriptor = {
2014
2052
  id: "stochastic",
2015
2053
  name: "Stochastic Oscillator",
@@ -2021,7 +2059,7 @@ var Be = class extends j {
2021
2059
  }
2022
2060
  };
2023
2061
  calculate(e, t) {
2024
- let n = N(t, "kPeriod", 14, 1), r = N(t, "dPeriod", 3, 1), i = N(t, "smooth", 3, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null);
2062
+ let n = P(t, "kPeriod", 14, 1), r = P(t, "dPeriod", 3, 1), i = P(t, "smooth", 3, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null);
2025
2063
  if (e.length < n) return {
2026
2064
  values: a,
2027
2065
  series: o
@@ -2084,7 +2122,7 @@ var Be = class extends j {
2084
2122
  };
2085
2123
  l("k", r.colors[0]), l("d", r.colors[1] ?? "#FF9800");
2086
2124
  }
2087
- }, Ge = class extends j {
2125
+ }, Xe = class extends M {
2088
2126
  descriptor = {
2089
2127
  id: "atr",
2090
2128
  name: "Average True Range",
@@ -2092,7 +2130,7 @@ var Be = class extends j {
2092
2130
  defaultConfig: { period: 14 }
2093
2131
  };
2094
2132
  calculate(e, t) {
2095
- let n = N(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2133
+ let n = P(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2096
2134
  if (e.length < 2) return {
2097
2135
  values: r,
2098
2136
  series: i
@@ -2138,7 +2176,7 @@ var Be = class extends j {
2138
2176
  }
2139
2177
  e.stroke();
2140
2178
  }
2141
- }, Ke = class extends j {
2179
+ }, Ze = class extends M {
2142
2180
  descriptor = {
2143
2181
  id: "adx",
2144
2182
  name: "Average Directional Index",
@@ -2146,7 +2184,7 @@ var Be = class extends j {
2146
2184
  defaultConfig: { period: 14 }
2147
2185
  };
2148
2186
  calculate(e, t) {
2149
- let n = N(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2187
+ let n = P(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2150
2188
  if (e.length < n * 2) return {
2151
2189
  values: r,
2152
2190
  series: i
@@ -2211,7 +2249,7 @@ var Be = class extends j {
2211
2249
  };
2212
2250
  l("adx", r.colors[0]), l("plusDI", r.colors[1] ?? "#26A69A"), l("minusDI", r.colors[2] ?? "#EF5350");
2213
2251
  }
2214
- }, qe = class extends j {
2252
+ }, Qe = class extends M {
2215
2253
  descriptor = {
2216
2254
  id: "obv",
2217
2255
  name: "On Balance Volume",
@@ -2257,7 +2295,7 @@ var Be = class extends j {
2257
2295
  }
2258
2296
  e.stroke();
2259
2297
  }
2260
- }, Je = class extends j {
2298
+ }, $e = class extends M {
2261
2299
  descriptor = {
2262
2300
  id: "williamsR",
2263
2301
  name: "Williams %R",
@@ -2265,7 +2303,7 @@ var Be = class extends j {
2265
2303
  defaultConfig: { period: 14 }
2266
2304
  };
2267
2305
  calculate(e, t) {
2268
- let n = N(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2306
+ let n = P(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2269
2307
  for (let t = n - 1; t < e.length; t++) {
2270
2308
  let a = -Infinity, o = Infinity;
2271
2309
  for (let r = t - n + 1; r <= t; r++) e[r].high > a && (a = e[r].high), e[r].low < o && (o = e[r].low);
@@ -2297,7 +2335,7 @@ var Be = class extends j {
2297
2335
  }
2298
2336
  e.stroke();
2299
2337
  }
2300
- }, Ye = class extends j {
2338
+ }, et = class extends M {
2301
2339
  descriptor = {
2302
2340
  id: "cci",
2303
2341
  name: "Commodity Channel Index",
@@ -2305,7 +2343,7 @@ var Be = class extends j {
2305
2343
  defaultConfig: { period: 20 }
2306
2344
  };
2307
2345
  calculate(e, t) {
2308
- let n = N(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2346
+ let n = P(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2309
2347
  for (let t = n - 1; t < e.length; t++) {
2310
2348
  let a = 0;
2311
2349
  for (let r = t - n + 1; r <= t; r++) a += (e[r].high + e[r].low + e[r].close) / 3;
@@ -2352,7 +2390,7 @@ var Be = class extends j {
2352
2390
  }
2353
2391
  e.stroke();
2354
2392
  }
2355
- }, Xe = class extends j {
2393
+ }, tt = class extends M {
2356
2394
  descriptor = {
2357
2395
  id: "mfi",
2358
2396
  name: "Money Flow Index",
@@ -2360,7 +2398,7 @@ var Be = class extends j {
2360
2398
  defaultConfig: { period: 14 }
2361
2399
  };
2362
2400
  calculate(e, t) {
2363
- let n = N(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2401
+ let n = P(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2364
2402
  if (e.length < n + 1) return {
2365
2403
  values: r,
2366
2404
  series: i
@@ -2397,7 +2435,7 @@ var Be = class extends j {
2397
2435
  }
2398
2436
  e.stroke();
2399
2437
  }
2400
- }, Ze = class extends j {
2438
+ }, nt = class extends M {
2401
2439
  descriptor = {
2402
2440
  id: "aroon",
2403
2441
  name: "Aroon",
@@ -2405,7 +2443,7 @@ var Be = class extends j {
2405
2443
  defaultConfig: { period: 25 }
2406
2444
  };
2407
2445
  calculate(e, t) {
2408
- let n = N(t, "period", 25, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2446
+ let n = P(t, "period", 25, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2409
2447
  for (let t = n; t < e.length; t++) {
2410
2448
  let a = 0, o = 0, s = -Infinity, c = Infinity;
2411
2449
  for (let r = 0; r <= n; r++) {
@@ -2439,7 +2477,7 @@ var Be = class extends j {
2439
2477
  };
2440
2478
  l("up", r.colors[0]), l("down", r.colors[1] ?? "#EF5350");
2441
2479
  }
2442
- }, Qe = class extends j {
2480
+ }, rt = class extends M {
2443
2481
  descriptor = {
2444
2482
  id: "roc",
2445
2483
  name: "Rate of Change",
@@ -2447,7 +2485,7 @@ var Be = class extends j {
2447
2485
  defaultConfig: { period: 12 }
2448
2486
  };
2449
2487
  calculate(e, t) {
2450
- let n = N(t, "period", 12, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2488
+ let n = P(t, "period", 12, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2451
2489
  for (let t = n; t < e.length; t++) {
2452
2490
  let a = e[t - n].close, o = { value: a === 0 ? 0 : (e[t].close - a) / a * 100 };
2453
2491
  r.set(e[t].time, o), i[t] = o;
@@ -2483,7 +2521,7 @@ var Be = class extends j {
2483
2521
  }
2484
2522
  e.stroke();
2485
2523
  }
2486
- }, $e = class extends j {
2524
+ }, it = class extends M {
2487
2525
  descriptor = {
2488
2526
  id: "tsi",
2489
2527
  name: "True Strength Index",
@@ -2500,7 +2538,7 @@ var Be = class extends j {
2500
2538
  return r;
2501
2539
  }
2502
2540
  calculate(e, t) {
2503
- let n = N(t, "longPeriod", 25, 1), r = N(t, "shortPeriod", 13, 1), i = N(t, "signalPeriod", 7, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null);
2541
+ let n = P(t, "longPeriod", 25, 1), r = P(t, "shortPeriod", 13, 1), i = P(t, "signalPeriod", 7, 1), a = /* @__PURE__ */ new Map(), o = Array(e.length).fill(null);
2504
2542
  if (e.length < 2) return {
2505
2543
  values: a,
2506
2544
  series: o
@@ -2552,7 +2590,7 @@ var Be = class extends j {
2552
2590
  };
2553
2591
  h("tsi", r.colors[0]), h("signal", r.colors[1] ?? "#FF9800");
2554
2592
  }
2555
- }, et = class extends j {
2593
+ }, at = class extends M {
2556
2594
  descriptor = {
2557
2595
  id: "cmf",
2558
2596
  name: "Chaikin Money Flow",
@@ -2560,7 +2598,7 @@ var Be = class extends j {
2560
2598
  defaultConfig: { period: 20 }
2561
2599
  };
2562
2600
  calculate(e, t) {
2563
- let n = N(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2601
+ let n = P(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2564
2602
  for (let t = n - 1; t < e.length; t++) {
2565
2603
  let a = 0, o = 0;
2566
2604
  for (let r = t - n + 1; r <= t; r++) {
@@ -2597,7 +2635,7 @@ var Be = class extends j {
2597
2635
  }
2598
2636
  }
2599
2637
  }
2600
- }, tt = class extends j {
2638
+ }, ot = class extends M {
2601
2639
  descriptor = {
2602
2640
  id: "stddev",
2603
2641
  name: "Standard Deviation",
@@ -2605,7 +2643,7 @@ var Be = class extends j {
2605
2643
  defaultConfig: { period: 20 }
2606
2644
  };
2607
2645
  calculate(e, t) {
2608
- let n = N(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2646
+ let n = P(t, "period", 20, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2609
2647
  for (let t = n - 1; t < e.length; t++) {
2610
2648
  let a = 0;
2611
2649
  for (let r = t - n + 1; r <= t; r++) a += e[r].close;
@@ -2643,7 +2681,7 @@ var Be = class extends j {
2643
2681
  }
2644
2682
  e.stroke();
2645
2683
  }
2646
- }, nt = class extends j {
2684
+ }, st = class extends M {
2647
2685
  descriptor = {
2648
2686
  id: "volumeProfile",
2649
2687
  name: "Volume Profile",
@@ -2651,7 +2689,7 @@ var Be = class extends j {
2651
2689
  defaultConfig: { rows: 24 }
2652
2690
  };
2653
2691
  calculate(e, t) {
2654
- let n = N(t, "rows", 24, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2692
+ let n = P(t, "rows", 24, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2655
2693
  if (e.length === 0) return {
2656
2694
  values: r,
2657
2695
  series: i
@@ -2693,7 +2731,7 @@ var Be = class extends j {
2693
2731
  e.fillStyle = l[t] > u * .7 ? r.colors[1] ?? "rgba(255, 152, 0, 0.5)" : r.colors[0] ?? "rgba(33, 150, 243, 0.3)", e.fillRect(i.x, s - d / 2, p, Math.max(d - 1, 1));
2694
2732
  }
2695
2733
  }
2696
- }, rt = class extends j {
2734
+ }, ct = class extends M {
2697
2735
  descriptor = {
2698
2736
  id: "ad",
2699
2737
  name: "Accumulation/Distribution",
@@ -2739,7 +2777,7 @@ var Be = class extends j {
2739
2777
  }
2740
2778
  e.stroke();
2741
2779
  }
2742
- }, it = class extends j {
2780
+ }, lt = class extends M {
2743
2781
  descriptor = {
2744
2782
  id: "vroc",
2745
2783
  name: "Volume Rate of Change",
@@ -2747,7 +2785,7 @@ var Be = class extends j {
2747
2785
  defaultConfig: { period: 14 }
2748
2786
  };
2749
2787
  calculate(e, t) {
2750
- let n = N(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2788
+ let n = P(t, "period", 14, 1), r = /* @__PURE__ */ new Map(), i = Array(e.length).fill(null);
2751
2789
  for (let t = n; t < e.length; t++) {
2752
2790
  let a = e[t - n].volume, o = { value: a === 0 ? 0 : (e[t].volume - a) / a * 100 };
2753
2791
  r.set(e[t].time, o), i[t] = o;
@@ -2781,19 +2819,19 @@ var Be = class extends j {
2781
2819
  };
2782
2820
  //#endregion
2783
2821
  //#region src/indicators/registry.ts
2784
- function at(e) {
2785
- e.register(new P()), e.register(new F()), e.register(new Te()), e.register(new Ee()), e.register(new De()), e.register(new Oe()), e.register(new ke()), e.register(new Ae()), e.register(new je()), e.register(new Ne()), e.register(new Pe()), e.register(new Fe()), e.register(new Ie()), e.register(new Le()), e.register(new He()), e.register(new Ue()), e.register(new We()), e.register(new Ge()), e.register(new Ke()), e.register(new qe()), e.register(new Je()), e.register(new Ye()), e.register(new Xe()), e.register(new Ze()), e.register(new Qe()), e.register(new $e()), e.register(new et()), e.register(new tt()), e.register(new nt()), e.register(new rt()), e.register(new it()), e.register(new Be()), e.register(new Ve());
2822
+ function ut(e) {
2823
+ e.register(new ke()), e.register(new Ae()), e.register(new je()), e.register(new Me()), e.register(new Ne()), e.register(new Pe()), e.register(new Fe()), e.register(new Ie()), e.register(new Le()), e.register(new ze()), e.register(new Be()), e.register(new Ve()), e.register(new He()), e.register(new Ue()), e.register(new Je()), e.register(new Ye()), e.register(new F()), e.register(new Xe()), e.register(new Ze()), e.register(new Qe()), e.register(new $e()), e.register(new et()), e.register(new tt()), e.register(new nt()), e.register(new rt()), e.register(new it()), e.register(new at()), e.register(new ot()), e.register(new st()), e.register(new ct()), e.register(new lt()), e.register(new Ke()), e.register(new qe());
2786
2824
  }
2787
2825
  //#endregion
2788
2826
  //#region src/indicators/worker/messages.ts
2789
- function ot(e) {
2827
+ function dt(e) {
2790
2828
  if (typeof e != "object" || !e) return !1;
2791
2829
  let t = e;
2792
2830
  return typeof t.requestId == "number" ? t.type === "result" || t.type === "pong" || t.type === "error" : !1;
2793
2831
  }
2794
2832
  //#endregion
2795
2833
  //#region src/indicators/worker/IndicatorWorkerHost.ts
2796
- var st = class {
2834
+ var ft = class {
2797
2835
  worker;
2798
2836
  fallbackPlugins;
2799
2837
  timeoutMs;
@@ -2858,7 +2896,7 @@ var st = class {
2858
2896
  handleMessage(e) {
2859
2897
  let t = e.data;
2860
2898
  if (t !== void 0) {
2861
- if (!ot(t)) return;
2899
+ if (!dt(t)) return;
2862
2900
  this.dispatchResponse(t);
2863
2901
  return;
2864
2902
  }
@@ -2879,7 +2917,7 @@ var st = class {
2879
2917
  t.resolve(e.output);
2880
2918
  }
2881
2919
  }
2882
- }, ct = class {
2920
+ }, pt = class {
2883
2921
  visible = !0;
2884
2922
  setVisible(e) {
2885
2923
  this.visible = e;
@@ -2908,7 +2946,7 @@ var st = class {
2908
2946
  }
2909
2947
  e.stroke();
2910
2948
  }
2911
- }, lt = class {
2949
+ }, mt = class {
2912
2950
  locale = "en-US";
2913
2951
  setLocale(e) {
2914
2952
  this.locale = e;
@@ -2931,7 +2969,7 @@ var st = class {
2931
2969
  e.fillStyle = n.axisLabel;
2932
2970
  for (let { y: t, text: n } of p) e.fillText(n, a + 5, t);
2933
2971
  }
2934
- }, I = /* @__PURE__ */ new Date(), ut = (e) => e < 10 ? "0" + e : "" + e, dt = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60, ft = `UTC${dt >= 0 ? "+" : ""}${dt}`, pt = class {
2972
+ }, I = /* @__PURE__ */ new Date(), ht = (e) => e < 10 ? "0" + e : "" + e, gt = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60, _t = `UTC${gt >= 0 ? "+" : ""}${gt}`, vt = class {
2935
2973
  render(e, t, n, r, i) {
2936
2974
  let { chartRect: a } = t, o = i ?? a.y + a.height;
2937
2975
  e.strokeStyle = n.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(a.x, o + .5), e.lineTo(a.x + a.width, o + .5), e.stroke();
@@ -2943,12 +2981,12 @@ var st = class {
2943
2981
  let n = t * s + d, i = r[t].time, a = i > 0xe8d4a51000 ? i : i * 1e3;
2944
2982
  I.setTime(a);
2945
2983
  let l = I.getDate(), u = I.getMonth() + 1, p = I.getHours(), m = I.getMinutes(), h;
2946
- l === f ? h = `${ut(p)}:${ut(m)}` : (h = `${u}/${l}`, f = l), e.fillText(h, n, o + 5);
2984
+ l === f ? h = `${ht(p)}:${ht(m)}` : (h = `${u}/${l}`, f = l), e.fillText(h, n, o + 5);
2947
2985
  }
2948
2986
  let p = a.x + a.width - 4, m = o + 4;
2949
- e.font = `${n.font.sizeSmall - 1}px ${n.font.family}`, e.textAlign = "right", e.textBaseline = "top", e.fillStyle = n.textSecondary, e.fillText(ft, p, m);
2987
+ e.font = `${n.font.sizeSmall - 1}px ${n.font.family}`, e.textAlign = "right", e.textBaseline = "top", e.fillStyle = n.textSecondary, e.fillText(_t, p, m);
2950
2988
  }
2951
- }, mt = class {
2989
+ }, yt = class {
2952
2990
  panHandler = null;
2953
2991
  zoomHandler = null;
2954
2992
  crosshairHandler = null;
@@ -3013,7 +3051,7 @@ var st = class {
3013
3051
  this.drawingManager?.onKeyDown(e.key, e.ctrlKey || e.metaKey) && e.preventDefault();
3014
3052
  }, s = (t) => {
3015
3053
  let n = e();
3016
- this.tradingManager && n && (t.preventDefault(), this.tradingManager.onContextMenu(this.getMousePos(t), n));
3054
+ !this.tradingManager || !n || this.tradingManager.onContextMenu(this.getMousePos(t), n) && t.preventDefault();
3017
3055
  }, c = (e) => {
3018
3056
  if (e.preventDefault(), this.invalidateRect(), e.touches.length === 1) {
3019
3057
  let t = this.getTouchPos(e.touches[0]);
@@ -3076,7 +3114,7 @@ var st = class {
3076
3114
  y: (e.clientY + t.clientY) / 2 - n.top
3077
3115
  };
3078
3116
  }
3079
- }, ht = class {
3117
+ }, bt = class {
3080
3118
  dragging = !1;
3081
3119
  lastX = 0;
3082
3120
  lastTime = 0;
@@ -3112,7 +3150,7 @@ var st = class {
3112
3150
  stopMomentum() {
3113
3151
  this.momentumId &&= (cancelAnimationFrame(this.momentumId), 0);
3114
3152
  }
3115
- }, gt = class {
3153
+ }, xt = class {
3116
3154
  callback;
3117
3155
  sensitivity;
3118
3156
  pendingDelta = 0;
@@ -3131,7 +3169,7 @@ var st = class {
3131
3169
  dispose() {
3132
3170
  this.rafId &&= (cancelAnimationFrame(this.rafId), 0);
3133
3171
  }
3134
- }, _t = class {
3172
+ }, St = class {
3135
3173
  position = null;
3136
3174
  callback = null;
3137
3175
  data = [];
@@ -3193,7 +3231,7 @@ var st = class {
3193
3231
  flushCallback(e, t) {
3194
3232
  this.callback?.(e, t);
3195
3233
  }
3196
- }, vt = class {
3234
+ }, Ct = class {
3197
3235
  callbacks;
3198
3236
  enabled = !0;
3199
3237
  constructor(e) {
@@ -3219,7 +3257,7 @@ var st = class {
3219
3257
  default: return !1;
3220
3258
  }
3221
3259
  }
3222
- }, yt = class {
3260
+ }, wt = class {
3223
3261
  el = null;
3224
3262
  visible = !1;
3225
3263
  timeEl;
@@ -3258,8 +3296,8 @@ var st = class {
3258
3296
  this.changeEl.textContent = `${l}${a(s)} (${l}${c.toFixed(2)}%)`, this.changeEl.style.color = i;
3259
3297
  let u = t.volume;
3260
3298
  this.volEl.textContent = `Vol ${u >= 1e6 ? (u / 1e6).toFixed(1) + "M" : u >= 1e3 ? (u / 1e3).toFixed(1) + "K" : u.toFixed(0)}`, this.volEl.style.color = n.textSecondary;
3261
- let d = bt(n.background);
3262
- this.el.style.background = d ? xt(n.background, .95) : xt(n.background, .97), this.el.style.border = `1px solid ${n.axisLine}`, this.el.style.boxShadow = d ? "0 4px 12px rgba(0,0,0,0.5)" : "0 4px 12px rgba(0,0,0,0.15)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", !this.measured && this.visible && (this.measuredWidth = this.el.offsetWidth, this.measuredHeight = this.el.offsetHeight, this.measured = !0);
3299
+ let d = Tt(n.background);
3300
+ this.el.style.background = d ? Et(n.background, .95) : Et(n.background, .97), this.el.style.border = `1px solid ${n.axisLine}`, this.el.style.boxShadow = d ? "0 4px 12px rgba(0,0,0,0.5)" : "0 4px 12px rgba(0,0,0,0.15)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", !this.measured && this.visible && (this.measuredWidth = this.el.offsetWidth, this.measuredHeight = this.el.offsetHeight, this.measured = !0);
3263
3301
  let f = e.x + 16, p = e.y - 40;
3264
3302
  f + this.measuredWidth > r.width - 80 && (f = e.x - this.measuredWidth - 16), p < 4 && (p = 4), p + this.measuredHeight > r.height && (p = r.height - this.measuredHeight - 4), this.el.style.transform = `translate(${Math.round(f)}px, ${Math.round(p)}px)`, this.el.style.left = "0", this.el.style.top = "0", this.visible ||= (this.el.style.display = "block", !0);
3265
3303
  }
@@ -3284,7 +3322,7 @@ var st = class {
3284
3322
  return document.createElement("span");
3285
3323
  }
3286
3324
  };
3287
- function bt(e) {
3325
+ function Tt(e) {
3288
3326
  if (e.startsWith("#")) {
3289
3327
  let t = e.slice(1), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t.slice(0, 6), r = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), a = parseInt(n.slice(4, 6), 16);
3290
3328
  return (.299 * r + .587 * i + .114 * a) / 255 < .5;
@@ -3296,7 +3334,7 @@ function bt(e) {
3296
3334
  }
3297
3335
  return !0;
3298
3336
  }
3299
- function xt(e, t) {
3337
+ function Et(e, t) {
3300
3338
  if (e.startsWith("#")) {
3301
3339
  let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
3302
3340
  return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
@@ -3305,7 +3343,7 @@ function xt(e, t) {
3305
3343
  }
3306
3344
  //#endregion
3307
3345
  //#region src/events/EventBus.ts
3308
- var St = class {
3346
+ var Dt = class {
3309
3347
  listeners = /* @__PURE__ */ new Map();
3310
3348
  tauriBridge = null;
3311
3349
  on(e, t) {
@@ -3346,13 +3384,13 @@ var St = class {
3346
3384
  }
3347
3385
  anchorToPixel(e, t) {
3348
3386
  return {
3349
- x: w(e.time, t),
3387
+ x: A(e.time, t),
3350
3388
  y: T(e.price, t)
3351
3389
  };
3352
3390
  }
3353
3391
  pixelToAnchor(e, t) {
3354
3392
  return {
3355
- time: E(e.x, t),
3393
+ time: j(e.x, t),
3356
3394
  price: D(e.y, t)
3357
3395
  };
3358
3396
  }
@@ -3391,7 +3429,7 @@ var St = class {
3391
3429
  let r = n.x - t.x, i = n.y - t.y, a = Math.hypot(r, i);
3392
3430
  return a === 0 ? Math.hypot(e.x - t.x, e.y - t.y) : Math.abs(r * (t.y - e.y) - i * (t.x - e.x)) / a;
3393
3431
  }
3394
- }, Ct = 1;
3432
+ }, Ot = 1;
3395
3433
  function R(e) {
3396
3434
  return {
3397
3435
  ...e,
@@ -3400,7 +3438,7 @@ function R(e) {
3400
3438
  meta: e.meta ? { ...e.meta } : void 0
3401
3439
  };
3402
3440
  }
3403
- var wt = class {
3441
+ var kt = class {
3404
3442
  registry = /* @__PURE__ */ new Map();
3405
3443
  drawings = [];
3406
3444
  state = "idle";
@@ -3456,31 +3494,31 @@ var wt = class {
3456
3494
  time: e,
3457
3495
  price: t
3458
3496
  };
3459
- let r = this.displayDataGetter?.() ?? this.dataGetter(), i = Math.round(e);
3460
- if (i < 0 || i >= r.length) return {
3497
+ let r = this.displayDataGetter?.() ?? this.dataGetter();
3498
+ if (r.length === 0) return {
3461
3499
  time: e,
3462
3500
  price: t
3463
3501
  };
3464
- let a = r[i], o = [
3465
- a.open,
3466
- a.high,
3467
- a.low,
3468
- a.close
3469
- ], s = o[0], c = Math.abs(t - s);
3470
- for (let e = 1; e < o.length; e++) {
3471
- let n = Math.abs(t - o[e]);
3472
- n < c && (c = n, s = o[e]);
3502
+ let i = !!(n?.data && n.data.length > 0), a = Math.max(0, Math.min(r.length - 1, Math.round(i ? O(e, r) : e))), o = r[a], s = [
3503
+ o.open,
3504
+ o.high,
3505
+ o.low,
3506
+ o.close
3507
+ ], c = s[0], l = Math.abs(t - c);
3508
+ for (let e = 1; e < s.length; e++) {
3509
+ let n = Math.abs(t - s[e]);
3510
+ n < l && (l = n, c = s[e]);
3473
3511
  }
3474
3512
  if (n) {
3475
3513
  let e = n.chartRect.height / (n.priceRange.max - n.priceRange.min || 1);
3476
- if (c * e > 30) return {
3477
- time: i,
3514
+ if (l * e > 30) return {
3515
+ time: i ? o.time : a,
3478
3516
  price: t
3479
3517
  };
3480
3518
  }
3481
3519
  return {
3482
- time: i,
3483
- price: s
3520
+ time: i ? o.time : a,
3521
+ price: c
3484
3522
  };
3485
3523
  }
3486
3524
  undo() {
@@ -3559,7 +3597,7 @@ var wt = class {
3559
3597
  if (this.state === "creating" && this.creatingDrawing) {
3560
3598
  let n = this.registry.get(this.creatingDrawing.type);
3561
3599
  if (n && this.committedAnchors < n.descriptor.requiredAnchors) {
3562
- let n = E(e.x, t), r = D(e.y, t);
3600
+ let n = j(e.x, t), r = D(e.y, t);
3563
3601
  return this.previewAnchor = this.snapToOHLC(n, r, t), this.requestRender?.(), !0;
3564
3602
  }
3565
3603
  }
@@ -3591,7 +3629,21 @@ var wt = class {
3591
3629
  return this.drawings;
3592
3630
  }
3593
3631
  setDrawings(e) {
3594
- this.drawings = e, this.requestRender?.();
3632
+ this.drawings = this.upgradeLegacyAnchors(e), this.requestRender?.();
3633
+ }
3634
+ upgradeLegacyAnchors(e) {
3635
+ let t = this.dataGetter?.();
3636
+ return !t || t.length === 0 ? e : e.map((e) => ({
3637
+ ...e,
3638
+ anchors: e.anchors.map((e) => {
3639
+ if (e.time >= 1e9) return e;
3640
+ let n = Math.max(0, Math.min(t.length - 1, Math.round(e.time)));
3641
+ return {
3642
+ ...e,
3643
+ time: t[n].time
3644
+ };
3645
+ })
3646
+ }));
3595
3647
  }
3596
3648
  removeDrawing(e) {
3597
3649
  let t = this.drawings.find((t) => t.id === e);
@@ -3605,9 +3657,11 @@ var wt = class {
3605
3657
  let t = this.drawings.find((t) => t.id === e);
3606
3658
  if (!t) return null;
3607
3659
  let n = structuredClone(t);
3608
- return n.id = `tc_drawing_${Ct++}`, n.anchors = n.anchors.map((e) => ({
3660
+ n.id = `tc_drawing_${Ot++}`;
3661
+ let r = this.computeBarOffsetTime(3);
3662
+ return n.anchors = n.anchors.map((e) => ({
3609
3663
  ...e,
3610
- time: e.time + 3
3664
+ time: e.time + r
3611
3665
  })), n.locked = !1, this.drawings.push(n), this.undoRedo?.push({
3612
3666
  type: "drawingCreate",
3613
3667
  before: null,
@@ -3641,13 +3695,20 @@ var wt = class {
3641
3695
  }
3642
3696
  e.restore();
3643
3697
  }
3698
+ computeBarOffsetTime(e) {
3699
+ let t = this.dataGetter?.();
3700
+ if (!t || t.length < 2) return e;
3701
+ let n = Math.max(0, t.length - 20), r = [];
3702
+ for (let e = n + 1; e < t.length; e++) r.push(t[e].time - t[e - 1].time);
3703
+ return r.length === 0 ? e : (r.sort((e, t) => e - t), e * r[Math.floor(r.length / 2)]);
3704
+ }
3644
3705
  handleCreationClick(e, t) {
3645
3706
  if (!this.activeTool) return !1;
3646
3707
  let n = this.registry.get(this.activeTool);
3647
3708
  if (!n) return !1;
3648
- let r = E(e.x, t), i = D(e.y, t), a = this.snapToOHLC(r, i, t);
3709
+ let r = j(e.x, t), i = D(e.y, t), a = this.snapToOHLC(r, i, t);
3649
3710
  return this.creatingDrawing ? (this.creatingDrawing.anchors.push(a), this.committedAnchors++, this.previewAnchor = null, this.committedAnchors >= n.descriptor.requiredAnchors && this.finalizeCreation(), this.requestRender?.(), !0) : (this.creatingDrawing = {
3650
- id: `tc_drawing_${Ct++}`,
3711
+ id: `tc_drawing_${Ot++}`,
3651
3712
  type: this.activeTool,
3652
3713
  anchors: [a],
3653
3714
  style: { ...this.activeStyle },
@@ -3685,7 +3746,7 @@ var wt = class {
3685
3746
  handleMove(e, t) {
3686
3747
  let n = this.drawings.find((e) => e.id === this.selectedDrawingId);
3687
3748
  if (!n || !this.dragStartPoint) return !1;
3688
- let r = E(e.x, t) - E(this.dragStartPoint.x, t), i = D(e.y, t) - D(this.dragStartPoint.y, t);
3749
+ let r = j(e.x, t) - j(this.dragStartPoint.x, t), i = D(e.y, t) - D(this.dragStartPoint.y, t);
3689
3750
  return n.anchors = this.dragStartAnchors.map((e) => ({
3690
3751
  time: e.time + r,
3691
3752
  price: e.price + i
@@ -3694,18 +3755,18 @@ var wt = class {
3694
3755
  handleResize(e, t) {
3695
3756
  let n = this.drawings.find((e) => e.id === this.selectedDrawingId);
3696
3757
  return !n || this.dragAnchorIndex < 0 ? !1 : (n.anchors[this.dragAnchorIndex] = {
3697
- time: E(e.x, t),
3758
+ time: j(e.x, t),
3698
3759
  price: D(e.y, t)
3699
3760
  }, this.requestRender?.(), !0);
3700
3761
  }
3701
- }, Tt = class {
3762
+ }, At = class {
3702
3763
  constructor(e) {
3703
3764
  this.manager = e;
3704
3765
  }
3705
3766
  render(e, t) {
3706
3767
  this.manager.render(e, t);
3707
3768
  }
3708
- }, Et = class extends L {
3769
+ }, jt = class extends L {
3709
3770
  descriptor = {
3710
3771
  type: "trendLine",
3711
3772
  name: "Trend Line",
@@ -3721,7 +3782,7 @@ var wt = class {
3721
3782
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
3722
3783
  return this.distanceToLine(e, i, a) <= r;
3723
3784
  }
3724
- }, Dt = class extends L {
3785
+ }, Mt = class extends L {
3725
3786
  descriptor = {
3726
3787
  type: "horizontalLine",
3727
3788
  name: "Horizontal Line",
@@ -3737,7 +3798,7 @@ var wt = class {
3737
3798
  let i = T(t.anchors[0].price, n);
3738
3799
  return Math.abs(e.y - i) <= r && e.x >= n.chartRect.x && e.x <= n.chartRect.x + n.chartRect.width;
3739
3800
  }
3740
- }, Ot = class extends L {
3801
+ }, Nt = class extends L {
3741
3802
  descriptor = {
3742
3803
  type: "verticalLine",
3743
3804
  name: "Vertical Line",
@@ -3753,7 +3814,7 @@ var wt = class {
3753
3814
  let i = this.anchorToPixel(t.anchors[0], n), { chartRect: a } = n;
3754
3815
  return Math.abs(e.x - i.x) <= r && e.y >= a.y && e.y <= a.y + a.height;
3755
3816
  }
3756
- }, kt = class extends L {
3817
+ }, Pt = class extends L {
3757
3818
  descriptor = {
3758
3819
  type: "ray",
3759
3820
  name: "Ray",
@@ -3771,7 +3832,7 @@ var wt = class {
3771
3832
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = a.x - i.x, s = a.y - i.y;
3772
3833
  return ((e.x - i.x) * o + (e.y - i.y) * s) / (o * o + s * s) < 0 ? !1 : this.distanceToInfiniteLine(e, i, a) <= r;
3773
3834
  }
3774
- }, At = class extends L {
3835
+ }, Ft = class extends L {
3775
3836
  descriptor = {
3776
3837
  type: "extendedLine",
3777
3838
  name: "Extended Line",
@@ -3789,7 +3850,7 @@ var wt = class {
3789
3850
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
3790
3851
  return this.distanceToInfiniteLine(e, i, a) <= r;
3791
3852
  }
3792
- }, jt = class extends L {
3853
+ }, It = class extends L {
3793
3854
  descriptor = {
3794
3855
  type: "parallelChannel",
3795
3856
  name: "Parallel Channel",
@@ -3826,7 +3887,7 @@ var wt = class {
3826
3887
  }
3827
3888
  return !1;
3828
3889
  }
3829
- }, Mt = class extends L {
3890
+ }, Lt = class extends L {
3830
3891
  descriptor = {
3831
3892
  type: "regressionChannel",
3832
3893
  name: "Regression Channel",
@@ -3857,7 +3918,7 @@ var wt = class {
3857
3918
  .618,
3858
3919
  .786,
3859
3920
  1
3860
- ], Nt = class extends L {
3921
+ ], Rt = class extends L {
3861
3922
  descriptor = {
3862
3923
  type: "fibRetracement",
3863
3924
  name: "Fibonacci Retracement",
@@ -3891,7 +3952,7 @@ var wt = class {
3891
3952
  }
3892
3953
  return !1;
3893
3954
  }
3894
- }, Pt = [
3955
+ }, zt = [
3895
3956
  0,
3896
3957
  .618,
3897
3958
  1,
@@ -3900,7 +3961,7 @@ var wt = class {
3900
3961
  2.618,
3901
3962
  3.618,
3902
3963
  4.236
3903
- ], Ft = class extends L {
3964
+ ], Bt = class extends L {
3904
3965
  descriptor = {
3905
3966
  type: "fibExtension",
3906
3967
  name: "Fibonacci Extension",
@@ -3916,7 +3977,7 @@ var wt = class {
3916
3977
  }
3917
3978
  let { chartRect: i } = n, a = t.anchors[0].price, o = t.anchors[1].price, s = t.anchors[2].price, c = a - o;
3918
3979
  e.font = "11px sans-serif", e.textBaseline = "middle", e.textAlign = "left";
3919
- for (let r of Pt) {
3980
+ for (let r of zt) {
3920
3981
  let a = T(s + c * r, n);
3921
3982
  this.applyLineStyle(e, t.style), e.globalAlpha = r === 0 || r === 1 ? 1 : .6, e.beginPath(), e.moveTo(i.x, a), e.lineTo(i.x + i.width, a), e.stroke(), e.fillStyle = t.style.color, e.fillText(`${(r * 100).toFixed(1)}%`, i.x + 4, a - 2);
3922
3983
  }
@@ -3927,13 +3988,13 @@ var wt = class {
3927
3988
  let { chartRect: i } = n;
3928
3989
  if (e.x < i.x - r || e.x > i.x + i.width + r) return !1;
3929
3990
  let a = t.anchors[0].price - t.anchors[1].price;
3930
- for (let i of Pt) {
3991
+ for (let i of zt) {
3931
3992
  let o = T(t.anchors[2].price + a * i, n);
3932
3993
  if (Math.abs(e.y - o) <= r) return !0;
3933
3994
  }
3934
3995
  return !1;
3935
3996
  }
3936
- }, It = class extends L {
3997
+ }, Vt = class extends L {
3937
3998
  descriptor = {
3938
3999
  type: "rectangle",
3939
4000
  name: "Rectangle",
@@ -3951,7 +4012,7 @@ var wt = class {
3951
4012
  let u = Math.min(i.x, a.x) + r, d = Math.min(i.y, a.y) + r, f = Math.max(i.x, a.x) - r, p = Math.max(i.y, a.y) - r;
3952
4013
  return !(e.x > u && e.x < f && e.y > d && e.y < p) || !!t.style.fillColor;
3953
4014
  }
3954
- }, Lt = class extends L {
4015
+ }, Ht = class extends L {
3955
4016
  descriptor = {
3956
4017
  type: "ellipse",
3957
4018
  name: "Ellipse",
@@ -3967,7 +4028,7 @@ var wt = class {
3967
4028
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = (i.x + a.x) / 2, s = (i.y + a.y) / 2, c = Math.max(Math.abs(a.x - i.x) / 2, 1), l = Math.max(Math.abs(a.y - i.y) / 2, 1), u = (e.x - o) / c, d = (e.y - s) / l, f = Math.sqrt(u * u + d * d), p = r / Math.max(Math.min(c, l), 4);
3968
4029
  return t.style.fillColor ? f <= 1 + p : Math.abs(f - 1) <= p;
3969
4030
  }
3970
- }, Rt = class extends L {
4031
+ }, Ut = class extends L {
3971
4032
  descriptor = {
3972
4033
  type: "triangle",
3973
4034
  name: "Triangle",
@@ -3993,7 +4054,7 @@ var wt = class {
3993
4054
  }
3994
4055
  return !1;
3995
4056
  }
3996
- }, zt = class extends L {
4057
+ }, Wt = class extends L {
3997
4058
  descriptor = {
3998
4059
  type: "pitchfork",
3999
4060
  name: "Andrews' Pitchfork",
@@ -4029,7 +4090,7 @@ var wt = class {
4029
4090
  };
4030
4091
  return this.distanceToInfiniteLine(e, a, u) <= r || this.distanceToInfiniteLine(e, o, d) <= r;
4031
4092
  }
4032
- }, Bt = [
4093
+ }, Gt = [
4033
4094
  "1",
4034
4095
  "2",
4035
4096
  "3",
@@ -4038,7 +4099,7 @@ var wt = class {
4038
4099
  "A",
4039
4100
  "B",
4040
4101
  "C"
4041
- ], Vt = class extends L {
4102
+ ], Kt = class extends L {
4042
4103
  descriptor = {
4043
4104
  type: "elliottWave",
4044
4105
  name: "Elliott Wave",
@@ -4050,9 +4111,9 @@ var wt = class {
4050
4111
  this.applyLineStyle(e, t.style), e.beginPath(), e.moveTo(i[0].x, i[0].y);
4051
4112
  for (let t = 1; t < i.length; t++) e.lineTo(i[t].x, i[t].y);
4052
4113
  e.stroke(), this.resetLineStyle(e), e.font = "bold 12px sans-serif", e.fillStyle = t.style.color, e.textAlign = "center";
4053
- for (let t = 0; t < i.length && t < Bt.length; t++) {
4114
+ for (let t = 0; t < i.length && t < Gt.length; t++) {
4054
4115
  let n = t % 2 == 0 ? -12 : 12;
4055
- e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(Bt[t], i[t].x, i[t].y + n);
4116
+ e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(Gt[t], i[t].x, i[t].y + n);
4056
4117
  }
4057
4118
  r && this.renderAnchorHandles(e, t, n);
4058
4119
  }
@@ -4062,7 +4123,7 @@ var wt = class {
4062
4123
  for (let t = 0; t < i.length - 1; t++) if (this.distanceToLine(e, i[t], i[t + 1]) <= r) return !0;
4063
4124
  return !1;
4064
4125
  }
4065
- }, Ht = class extends L {
4126
+ }, qt = class extends L {
4066
4127
  descriptor = {
4067
4128
  type: "priceRange",
4068
4129
  name: "Price Range",
@@ -4080,7 +4141,7 @@ var wt = class {
4080
4141
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y);
4081
4142
  return e.x >= o - r && e.x <= s + r && e.y >= c - r && e.y <= l + r;
4082
4143
  }
4083
- }, Ut = class extends L {
4144
+ }, Jt = class extends L {
4084
4145
  descriptor = {
4085
4146
  type: "dateRange",
4086
4147
  name: "Date Range",
@@ -4090,15 +4151,15 @@ var wt = class {
4090
4151
  if (t.anchors.length < 2) return;
4091
4152
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), { chartRect: o } = n, s = Math.min(i.x, a.x), c = Math.max(i.x, a.x);
4092
4153
  e.fillStyle = "rgba(33, 150, 243, 0.08)", e.fillRect(s, o.y, c - s, o.height), this.applyLineStyle(e, t.style), e.beginPath(), e.moveTo(s, o.y), e.lineTo(s, o.y + o.height), e.stroke(), e.beginPath(), e.moveTo(c, o.y), e.lineTo(c, o.y + o.height), e.stroke(), this.resetLineStyle(e);
4093
- let l = Math.abs(t.anchors[1].time - t.anchors[0].time);
4094
- e.font = "12px sans-serif", e.fillStyle = t.style.color, e.textAlign = "center", e.textBaseline = "top", e.fillText(`${l} bars`, (s + c) / 2, o.y + 4), r && this.renderAnchorHandles(e, t, n);
4154
+ let l = k(t.anchors[0].time, n), u = k(t.anchors[1].time, n), d = Math.max(0, Math.round(Math.abs(u - l)));
4155
+ e.font = "12px sans-serif", e.fillStyle = t.style.color, e.textAlign = "center", e.textBaseline = "top", e.fillText(`${d} bars`, (s + c) / 2, o.y + 4), r && this.renderAnchorHandles(e, t, n);
4095
4156
  }
4096
4157
  hitTest(e, t, n, r) {
4097
4158
  if (t.anchors.length < 2) return !1;
4098
4159
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), { chartRect: o } = n, s = Math.min(i.x, a.x), c = Math.max(i.x, a.x);
4099
4160
  return e.x >= s - r && e.x <= c + r && e.y >= o.y && e.y <= o.y + o.height;
4100
4161
  }
4101
- }, Wt = class extends L {
4162
+ }, Yt = class extends L {
4102
4163
  descriptor = {
4103
4164
  type: "measure",
4104
4165
  name: "Measure",
@@ -4108,11 +4169,11 @@ var wt = class {
4108
4169
  if (t.anchors.length < 2) return;
4109
4170
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
4110
4171
  this.applyLineStyle(e, t.style), e.setLineDash([4, 4]), e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(a.x, a.y), e.stroke(), this.resetLineStyle(e);
4111
- let o = t.anchors[1].price - t.anchors[0].price, s = Math.abs(t.anchors[1].time - t.anchors[0].time), c = t.anchors[0].price === 0 ? 0 : o / t.anchors[0].price * 100, l = [`Price: ${o >= 0 ? "+" : ""}${o.toFixed(2)} (${c >= 0 ? "+" : ""}${c.toFixed(2)}%)`, `Bars: ${s}`], u = (i.x + a.x) / 2, d = (i.y + a.y) / 2;
4172
+ let o = t.anchors[1].price - t.anchors[0].price, s = k(t.anchors[0].time, n), c = k(t.anchors[1].time, n), l = Math.max(0, Math.round(Math.abs(c - s))), u = t.anchors[0].price === 0 ? 0 : o / t.anchors[0].price * 100, d = [`Price: ${o >= 0 ? "+" : ""}${o.toFixed(2)} (${u >= 0 ? "+" : ""}${u.toFixed(2)}%)`, `Bars: ${l}`], f = (i.x + a.x) / 2, p = (i.y + a.y) / 2;
4112
4173
  e.font = "11px sans-serif", e.textAlign = "center", e.textBaseline = "bottom";
4113
- let f = Math.max(...l.map((t) => e.measureText(t).width));
4114
- e.fillStyle = "rgba(0, 0, 0, 0.7)", e.fillRect(u - f / 2 - 6, d - l.length * 14 - 4, f + 12, l.length * 14 + 8), e.fillStyle = "#FFFFFF";
4115
- for (let t = 0; t < l.length; t++) e.fillText(l[t], u, d - (l.length - 1 - t) * 14);
4174
+ let m = Math.max(...d.map((t) => e.measureText(t).width));
4175
+ e.fillStyle = "rgba(0, 0, 0, 0.7)", e.fillRect(f - m / 2 - 6, p - d.length * 14 - 4, m + 12, d.length * 14 + 8), e.fillStyle = "#FFFFFF";
4176
+ for (let t = 0; t < d.length; t++) e.fillText(d[t], f, p - (d.length - 1 - t) * 14);
4116
4177
  r && this.renderAnchorHandles(e, t, n);
4117
4178
  }
4118
4179
  hitTest(e, t, n, r) {
@@ -4123,12 +4184,12 @@ var wt = class {
4123
4184
  };
4124
4185
  //#endregion
4125
4186
  //#region src/drawings/tools/TextAnnotation.ts
4126
- function Gt(e, t = "Text") {
4187
+ function Xt(e, t = "Text") {
4127
4188
  if (typeof e.style.text == "string" && e.style.text.length > 0) return e.style.text;
4128
4189
  let n = e.meta?.text;
4129
4190
  return typeof n == "string" && n.length > 0 ? n : t;
4130
4191
  }
4131
- var Kt = class extends L {
4192
+ var Zt = class extends L {
4132
4193
  descriptor = {
4133
4194
  type: "text",
4134
4195
  name: "Text",
@@ -4136,7 +4197,7 @@ var Kt = class extends L {
4136
4197
  };
4137
4198
  render(e, t, n, r) {
4138
4199
  if (t.anchors.length < 1) return;
4139
- let i = this.anchorToPixel(t.anchors[0], n), a = Gt(t), o = t.style.fontSize || 14;
4200
+ let i = this.anchorToPixel(t.anchors[0], n), a = Xt(t), o = t.style.fontSize || 14;
4140
4201
  if (e.font = `${o}px sans-serif`, e.fillStyle = t.style.color, e.textAlign = "left", e.textBaseline = "top", r) {
4141
4202
  let n = e.measureText(a);
4142
4203
  e.strokeStyle = t.style.color, e.lineWidth = 1, e.setLineDash([3, 3]), e.strokeRect(i.x - 2, i.y - 2, n.width + 4, o + 4), e.setLineDash([]);
@@ -4148,7 +4209,7 @@ var Kt = class extends L {
4148
4209
  let i = this.anchorToPixel(t.anchors[0], n), a = t.style.fontSize || 14;
4149
4210
  return e.x >= i.x - r && e.x <= i.x + 80 + r && e.y >= i.y - r && e.y <= i.y + a + r;
4150
4211
  }
4151
- }, qt = class extends L {
4212
+ }, Qt = class extends L {
4152
4213
  descriptor = {
4153
4214
  type: "arrow",
4154
4215
  name: "Arrow",
@@ -4166,7 +4227,7 @@ var Kt = class extends L {
4166
4227
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
4167
4228
  return this.distanceToLine(e, i, a) <= r;
4168
4229
  }
4169
- }, Jt = [
4230
+ }, $t = [
4170
4231
  {
4171
4232
  label: "8x1",
4172
4233
  ratio: 8
@@ -4203,7 +4264,7 @@ var Kt = class extends L {
4203
4264
  label: "1x8",
4204
4265
  ratio: .125
4205
4266
  }
4206
- ], Yt = class extends L {
4267
+ ], en = class extends L {
4207
4268
  descriptor = {
4208
4269
  type: "gannFan",
4209
4270
  name: "Gann Fan",
@@ -4215,7 +4276,7 @@ var Kt = class extends L {
4215
4276
  if (Math.abs(o) < 1) return;
4216
4277
  let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
4217
4278
  this.applyLineStyle(e, t.style);
4218
- for (let { label: n, ratio: r } of Jt) {
4279
+ for (let { label: n, ratio: r } of $t) {
4219
4280
  let a = c * r, o = d, s = i.y + a * (o - i.x);
4220
4281
  e.globalAlpha = r === 1 ? 1 : .5, e.lineWidth = r === 1 ? t.style.lineWidth : Math.max(.5, t.style.lineWidth * .7), e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(o, s), e.stroke();
4221
4282
  let f = o - l * 4, p = s;
@@ -4228,7 +4289,7 @@ var Kt = class extends L {
4228
4289
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = a.x - i.x, s = a.y - i.y;
4229
4290
  if (Math.abs(o) < 1) return !1;
4230
4291
  let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
4231
- for (let { ratio: t } of Jt) {
4292
+ for (let { ratio: t } of $t) {
4232
4293
  let n = c * t, a = d, o = i.y + n * (a - i.x);
4233
4294
  if (this.distanceToLine(e, i, {
4234
4295
  x: a,
@@ -4245,7 +4306,7 @@ var Kt = class extends L {
4245
4306
  .667,
4246
4307
  .75,
4247
4308
  1
4248
- ], Xt = class extends L {
4309
+ ], tn = class extends L {
4249
4310
  descriptor = {
4250
4311
  type: "gannBox",
4251
4312
  name: "Gann Box",
@@ -4292,7 +4353,7 @@ var Kt = class extends L {
4292
4353
  y: l
4293
4354
  }) <= r;
4294
4355
  }
4295
- }, Zt = class extends L {
4356
+ }, nn = class extends L {
4296
4357
  descriptor = {
4297
4358
  type: "anchoredVWAP",
4298
4359
  name: "Anchored VWAP",
@@ -4308,7 +4369,7 @@ var Kt = class extends L {
4308
4369
  }
4309
4370
  render(e, t, n, r) {
4310
4371
  if (t.anchors.length < 1 || !this.dataGetter) return;
4311
- let i = this.dataGetter(), a = Math.max(0, Math.round(t.anchors[0].time));
4372
+ let i = this.dataGetter(), a = Math.max(0, Math.round(k(t.anchors[0].time, n)));
4312
4373
  if (a >= i.length) return;
4313
4374
  let { vwap: o, upper1: s, lower1: c, upper2: l, lower2: u } = this.computeVWAP(i, a), { chartRect: d } = n, f = n.barWidth + n.barSpacing;
4314
4375
  if (this.applyLineStyle(e, t.style), e.lineWidth = t.style.lineWidth + .5, this.drawLine(e, o, a, n, d, f), this.showBands && o.length > 1 && (e.globalAlpha = .4, e.lineWidth = Math.max(.5, t.style.lineWidth * .6), e.setLineDash([4, 3]), this.drawLine(e, s, a, n, d, f), this.drawLine(e, c, a, n, d, f), e.globalAlpha = .25, this.drawLine(e, l, a, n, d, f), this.drawLine(e, u, a, n, d, f), e.globalAlpha = 1), this.resetLineStyle(e), o.length > 0) {
@@ -4349,7 +4410,7 @@ var Kt = class extends L {
4349
4410
  }
4350
4411
  hitTest(e, t, n, r) {
4351
4412
  if (t.anchors.length < 1 || !this.dataGetter) return !1;
4352
- let i = this.dataGetter(), a = Math.max(0, Math.round(t.anchors[0].time));
4413
+ let i = this.dataGetter(), a = Math.max(0, Math.round(k(t.anchors[0].time, n)));
4353
4414
  if (a >= i.length) return !1;
4354
4415
  let { vwap: o } = this.computeVWAP(i, a);
4355
4416
  for (let t = 1; t < o.length; t++) {
@@ -4364,7 +4425,7 @@ var Kt = class extends L {
4364
4425
  }
4365
4426
  return !1;
4366
4427
  }
4367
- }, Qt = class extends L {
4428
+ }, rn = class extends L {
4368
4429
  descriptor = {
4369
4430
  type: "volumeProfileRange",
4370
4431
  name: "Volume Profile (Range)",
@@ -4377,44 +4438,84 @@ var Kt = class extends L {
4377
4438
  }
4378
4439
  render(e, t, n, r) {
4379
4440
  if (t.anchors.length < 2 || !this.dataGetter) return;
4380
- let i = this.dataGetter(), a = Math.max(0, Math.min(Math.round(t.anchors[0].time), Math.round(t.anchors[1].time))), o = Math.min(i.length - 1, Math.max(Math.round(t.anchors[0].time), Math.round(t.anchors[1].time)));
4381
- if (a >= i.length || o < 0 || a > o) return;
4382
- let s = Infinity, c = -Infinity;
4383
- for (let e = a; e <= o; e++) i[e].low < s && (s = i[e].low), i[e].high > c && (c = i[e].high);
4384
- if (s >= c) return;
4385
- let l = (c - s) / this.numBins, u = new Float64Array(this.numBins), d = 0;
4386
- for (let e = a; e <= o; e++) {
4387
- let t = i[e], n = t.volume ?? 1, r = Math.max(0, Math.floor((t.low - s) / l)), a = Math.min(this.numBins - 1, Math.floor((t.high - s) / l)), o = n / (a - r + 1);
4388
- for (let e = r; e <= a; e++) u[e] += o, u[e] > d && (d = u[e]);
4389
- }
4390
- if (d === 0) return;
4391
- let f = 0;
4392
- for (let e = 1; e < this.numBins; e++) u[e] > u[f] && (f = e);
4393
- let p = w(o, n) + n.barWidth, m = t.style.color, h = t.style.fillColor ?? "#FF9800";
4441
+ let i = this.dataGetter(), a = Math.round(k(t.anchors[0].time, n)), o = Math.round(k(t.anchors[1].time, n)), s = Math.max(0, Math.min(a, o)), c = Math.min(i.length - 1, Math.max(a, o));
4442
+ if (s >= i.length || c < 0 || s > c) return;
4443
+ let l = Infinity, u = -Infinity;
4444
+ for (let e = s; e <= c; e++) i[e].low < l && (l = i[e].low), i[e].high > u && (u = i[e].high);
4445
+ if (l >= u) return;
4446
+ let d = (u - l) / this.numBins, f = new Float64Array(this.numBins), p = 0;
4447
+ for (let e = s; e <= c; e++) {
4448
+ let t = i[e], n = t.volume ?? 1, r = Math.max(0, Math.floor((t.low - l) / d)), a = Math.min(this.numBins - 1, Math.floor((t.high - l) / d)), o = n / (a - r + 1);
4449
+ for (let e = r; e <= a; e++) f[e] += o, f[e] > p && (p = f[e]);
4450
+ }
4451
+ if (p === 0) return;
4452
+ let m = 0;
4453
+ for (let e = 1; e < this.numBins; e++) f[e] > f[m] && (m = e);
4454
+ let h = w(c, n) + n.barWidth, g = t.style.color, _ = t.style.fillColor ?? "#FF9800";
4394
4455
  e.save();
4395
4456
  for (let t = 0; t < this.numBins; t++) {
4396
- let r = u[t] / d * 100, i = s + (t + 1) * l, a = s + t * l, o = T(i, n), c = T(a, n), g = Math.abs(c - o);
4397
- e.globalAlpha = .35, e.fillStyle = t === f ? h : m, e.fillRect(p, Math.min(o, c), r, Math.max(1, g - .5));
4457
+ let r = f[t] / p * 100, i = l + (t + 1) * d, a = l + t * d, o = T(i, n), s = T(a, n), c = Math.abs(s - o);
4458
+ e.globalAlpha = .35, e.fillStyle = t === m ? _ : g, e.fillRect(h, Math.min(o, s), r, Math.max(1, c - .5));
4398
4459
  }
4399
- let g = s + (f + .5) * l, _ = T(g, n);
4400
- e.globalAlpha = .7, e.strokeStyle = h, e.lineWidth = 1, e.setLineDash([4, 3]), e.beginPath();
4401
- let v = w(a, n) - n.barWidth / 2;
4402
- e.moveTo(v, _), e.lineTo(p + 100, _), e.stroke(), e.fillStyle = h, e.font = "9px sans-serif", e.textAlign = "left", e.textBaseline = "bottom", e.globalAlpha = .8, e.fillText(`POC ${g.toFixed(2)}`, p + 100 + 4, _ - 2), e.restore(), r && this.renderAnchorHandles(e, t, n);
4460
+ let v = l + (m + .5) * d, y = T(v, n);
4461
+ e.globalAlpha = .7, e.strokeStyle = _, e.lineWidth = 1, e.setLineDash([4, 3]), e.beginPath();
4462
+ let b = w(s, n) - n.barWidth / 2;
4463
+ e.moveTo(b, y), e.lineTo(h + 100, y), e.stroke(), e.fillStyle = _, e.font = "9px sans-serif", e.textAlign = "left", e.textBaseline = "bottom", e.globalAlpha = .8, e.fillText(`POC ${v.toFixed(2)}`, h + 100 + 4, y - 2), e.restore(), r && this.renderAnchorHandles(e, t, n);
4403
4464
  }
4404
4465
  hitTest(e, t, n, r) {
4405
4466
  if (t.anchors.length < 2) return !1;
4406
4467
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x) - r, s = Math.max(i.x, a.x) + 100 + r, c = Math.min(i.y, a.y) - r, l = Math.max(i.y, a.y) + r;
4407
4468
  return e.x >= o && e.x <= s && e.y >= c && e.y <= l;
4408
4469
  }
4470
+ }, an = [
4471
+ 1,
4472
+ 2,
4473
+ 3,
4474
+ 5,
4475
+ 8,
4476
+ 13,
4477
+ 21,
4478
+ 34,
4479
+ 55
4480
+ ], on = class extends L {
4481
+ descriptor = {
4482
+ type: "fibTimeZones",
4483
+ name: "Fibonacci Time Zones",
4484
+ requiredAnchors: 2
4485
+ };
4486
+ render(e, t, n, r) {
4487
+ if (t.anchors.length < 2) return;
4488
+ let i = t.anchors[0], a = t.anchors[1].time - i.time;
4489
+ if (a === 0) return;
4490
+ let { chartRect: o } = n;
4491
+ e.font = "11px sans-serif", e.textBaseline = "top", e.textAlign = "center", this.applyLineStyle(e, t.style);
4492
+ for (let r of an) {
4493
+ let s = A(i.time + a * r, n);
4494
+ s < o.x || s > o.x + o.width || (e.globalAlpha = r === 1 ? 1 : .55, e.beginPath(), e.moveTo(s, o.y), e.lineTo(s, o.y + o.height), e.stroke(), e.fillStyle = t.style.color, e.fillText(String(r), s, o.y + 2));
4495
+ }
4496
+ e.globalAlpha = 1, this.resetLineStyle(e), r && this.renderAnchorHandles(e, t, n);
4497
+ }
4498
+ hitTest(e, t, n, r) {
4499
+ if (t.anchors.length < 2) return !1;
4500
+ let i = t.anchors[0], a = t.anchors[1].time - i.time;
4501
+ if (a === 0) return !1;
4502
+ let { chartRect: o } = n;
4503
+ if (e.y < o.y || e.y > o.y + o.height) return !1;
4504
+ for (let t of an) {
4505
+ let o = A(i.time + a * t, n);
4506
+ if (Math.abs(e.x - o) <= r) return !0;
4507
+ }
4508
+ return !1;
4509
+ }
4409
4510
  };
4410
4511
  //#endregion
4411
4512
  //#region src/drawings/tools/index.ts
4412
- function $t(e) {
4413
- e.register(new Et()), e.register(new Dt()), e.register(new Ot()), e.register(new kt()), e.register(new At()), e.register(new jt()), e.register(new Mt()), e.register(new Nt()), e.register(new Ft()), e.register(new It()), e.register(new Lt()), e.register(new Rt()), e.register(new zt()), e.register(new Vt()), e.register(new Ht()), e.register(new Ut()), e.register(new Wt()), e.register(new Kt()), e.register(new qt()), e.register(new Yt()), e.register(new Xt()), e.register(new Zt()), e.register(new Qt());
4513
+ function sn(e) {
4514
+ e.register(new jt()), e.register(new Mt()), e.register(new Nt()), e.register(new Pt()), e.register(new Ft()), e.register(new It()), e.register(new Lt()), e.register(new Rt()), e.register(new Bt()), e.register(new Vt()), e.register(new Ht()), e.register(new Ut()), e.register(new Wt()), e.register(new Kt()), e.register(new qt()), e.register(new Jt()), e.register(new Yt()), e.register(new Zt()), e.register(new Qt()), e.register(new en()), e.register(new tn()), e.register(new nn()), e.register(new rn()), e.register(new on());
4414
4515
  }
4415
4516
  //#endregion
4416
4517
  //#region src/trading/OrderRenderer.ts
4417
- var en = class {
4518
+ var cn = class {
4418
4519
  render(e, t, n, r, i, a) {
4419
4520
  let o = i.orderColors?.buy ?? "#26A69A", s = i.orderColors?.sell ?? "#EF5350", { chartRect: c } = n;
4420
4521
  for (let i of t) {
@@ -4455,7 +4556,7 @@ var en = class {
4455
4556
  };
4456
4557
  //#endregion
4457
4558
  //#region src/trading/positionFormat.ts
4458
- function tn(e, t, n) {
4559
+ function ln(e, t, n) {
4459
4560
  let r = Math.min(Math.max(e.closedQuantity ?? 0, 0), e.quantity), i = e.quantity - r, a = e.side === "buy" ? 1 : -1, o = (t - e.entryPrice) * i * a, s = e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * a;
4460
4561
  return {
4461
4562
  side: e.side,
@@ -4469,9 +4570,9 @@ function tn(e, t, n) {
4469
4570
  precision: n
4470
4571
  };
4471
4572
  }
4472
- var nn = /\{(side|qty|closedQty|openQty|entry|price|pnl|pnlPct|pnlSign)\}/g;
4473
- function rn(e, t) {
4474
- return e.replace(nn, (e, n) => {
4573
+ var un = /\{(side|qty|closedQty|openQty|entry|price|pnl|pnlPct|pnlSign)\}/g;
4574
+ function dn(e, t) {
4575
+ return e.replace(un, (e, n) => {
4475
4576
  switch (n) {
4476
4577
  case "side": return t.side.toUpperCase();
4477
4578
  case "qty": return String(t.quantity);
@@ -4486,10 +4587,10 @@ function rn(e, t) {
4486
4587
  }
4487
4588
  });
4488
4589
  }
4489
- function an(e, t) {
4490
- return typeof e == "function" ? e(t) : rn(e ?? "{side} {qty} | P&L: {pnlSign}{pnl}", t);
4590
+ function fn(e, t) {
4591
+ return typeof e == "function" ? e(t) : dn(e ?? "{side} {qty} | P&L: {pnlSign}{pnl}", t);
4491
4592
  }
4492
- function on(e, t, n) {
4593
+ function pn(e, t, n) {
4493
4594
  if (!t || t.length === 0) return n;
4494
4595
  let r = [...t].sort((e, t) => e.pnl - t.pnl), i;
4495
4596
  for (let t of r) if (e >= t.pnl) i = t.color;
@@ -4498,20 +4599,20 @@ function on(e, t, n) {
4498
4599
  }
4499
4600
  //#endregion
4500
4601
  //#region src/trading/PositionRenderer.ts
4501
- var sn = class {
4602
+ var mn = class {
4502
4603
  render(e, t, n, r, i, a) {
4503
4604
  let { chartRect: o } = r, s = a.positionColors?.profit ?? "#26A69A", c = a.positionColors?.loss ?? "#EF5350", l = a.positionColors?.entry ?? "#2196F3", u = a.pricePrecision ?? 2;
4504
4605
  for (let d of t) {
4505
4606
  let t = T(d.entryPrice, r);
4506
4607
  if (e.strokeStyle = l, e.lineWidth = 1.5, e.setLineDash([]), e.beginPath(), e.moveTo(o.x, Math.round(t) + .5), e.lineTo(o.x + o.width, Math.round(t) + .5), e.stroke(), n !== null) {
4507
- let f = T(n, r), p = tn(d, n, u), m = p.pnl, h = m >= 0 ? s : c, g = on(m, a.pnlThresholds, h);
4608
+ let f = T(n, r), p = ln(d, n, u), m = p.pnl, h = m >= 0 ? s : c, g = pn(m, a.pnlThresholds, h);
4508
4609
  e.fillStyle = g, e.globalAlpha = .08;
4509
4610
  let _ = Math.min(t, f), v = Math.abs(f - t);
4510
4611
  if (e.fillRect(o.x, _, o.width, v), e.globalAlpha = 1, p.closedQuantity > 0 && d.quantity > 0) {
4511
4612
  let t = p.closedQuantity / d.quantity;
4512
4613
  e.fillStyle = l, e.globalAlpha = .25, e.fillRect(o.x, _, Math.max(2, o.width * t * .04) + 2, v), e.globalAlpha = 1;
4513
4614
  }
4514
- let y = an(a.positionLabel, p);
4615
+ let y = fn(a.positionLabel, p);
4515
4616
  e.font = `bold 11px ${i.font.family}`;
4516
4617
  let b = e.measureText(y).width + 12, x = o.x + 8;
4517
4618
  e.fillStyle = g, e.globalAlpha = .9, e.fillRect(x, t - 10, b, 20), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.textAlign = "left", e.fillText(y, x + 6, t);
@@ -4534,7 +4635,7 @@ var sn = class {
4534
4635
  e.fillStyle = o, e.fillRect(c, t - 9, u - 2, 18), e.fillStyle = "#FFFFFF", e.font = `11px ${r.font.family}`, e.textAlign = "left", e.textBaseline = "middle", e.fillText(i.entryPrice.toFixed(s), c + 5, t);
4535
4636
  }
4536
4637
  }
4537
- }, V = class {
4638
+ }, hn = class {
4538
4639
  render(e, t, n, r) {
4539
4640
  if (!r.depthOverlay?.enabled) return;
4540
4641
  let { chartRect: i } = n, a = r.depthOverlay.bidColor ?? "rgba(38,166,154,0.15)", o = r.depthOverlay.askColor ?? "rgba(239,83,80,0.15)", s = r.depthOverlay.maxWidth ?? 100, c = 0, l = [], u = 0;
@@ -4565,7 +4666,7 @@ var sn = class {
4565
4666
  e.fillRect(p - o, a - f / 2, o, f);
4566
4667
  }
4567
4668
  }
4568
- }, cn = class {
4669
+ }, gn = class {
4569
4670
  dragState = null;
4570
4671
  startY = 0;
4571
4672
  dragging = !1;
@@ -4629,7 +4730,7 @@ var sn = class {
4629
4730
  isActive() {
4630
4731
  return this.dragState !== null;
4631
4732
  }
4632
- }, ln = class {
4733
+ }, _n = class {
4633
4734
  menuElement = null;
4634
4735
  removeHandler = null;
4635
4736
  onItemSelect = null;
@@ -4713,17 +4814,17 @@ var sn = class {
4713
4814
  destroy() {
4714
4815
  this.hide(), this.onItemSelect = null;
4715
4816
  }
4716
- }, un = class {
4817
+ }, vn = class {
4717
4818
  orders = [];
4718
4819
  positions = [];
4719
4820
  depthData = null;
4720
4821
  currentPrice = null;
4721
4822
  config;
4722
- orderRenderer = new en();
4723
- positionRenderer = new sn();
4724
- depthOverlay = new V();
4823
+ orderRenderer = new cn();
4824
+ positionRenderer = new mn();
4825
+ depthOverlay = new hn();
4725
4826
  dragHandler;
4726
- contextMenu = new ln();
4827
+ contextMenu = new _n();
4727
4828
  requestRender = null;
4728
4829
  eventCallback = null;
4729
4830
  container = null;
@@ -4731,7 +4832,7 @@ var sn = class {
4731
4832
  this.config = {
4732
4833
  ...s,
4733
4834
  ...e
4734
- }, this.dragHandler = new cn(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
4835
+ }, this.dragHandler = new gn(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
4735
4836
  this.eventCallback?.("orderPlace", e);
4736
4837
  };
4737
4838
  }
@@ -4792,7 +4893,7 @@ var sn = class {
4792
4893
  destroy() {
4793
4894
  this.contextMenu.destroy();
4794
4895
  }
4795
- }, dn = class {
4896
+ }, yn = class {
4796
4897
  constructor(e) {
4797
4898
  this.manager = e;
4798
4899
  }
@@ -4802,7 +4903,7 @@ var sn = class {
4802
4903
  renderAxisBadges(e, t, n) {
4803
4904
  this.manager.renderAxisBadges(e, t, n);
4804
4905
  }
4805
- }, H = class {
4906
+ }, V = class {
4806
4907
  listeners = /* @__PURE__ */ new Map();
4807
4908
  on(e, t) {
4808
4909
  let n = this.listeners.get(e);
@@ -4824,7 +4925,7 @@ var sn = class {
4824
4925
  removeAllListeners() {
4825
4926
  this.listeners.clear();
4826
4927
  }
4827
- }, fn = class extends H {
4928
+ }, bn = class extends V {
4828
4929
  currentBar = null;
4829
4930
  timeframeMs;
4830
4931
  tickRing;
@@ -4886,7 +4987,7 @@ var sn = class {
4886
4987
  alignToTimeframe(e) {
4887
4988
  return Math.floor(e / this.timeframeMs) * this.timeframeMs;
4888
4989
  }
4889
- }, U = class extends H {
4990
+ }, H = class extends V {
4890
4991
  config;
4891
4992
  attempt = 0;
4892
4993
  timer = null;
@@ -4933,7 +5034,7 @@ var sn = class {
4933
5034
  let e = this.config.baseDelay, t = this.config.backoffMultiplier ** (this.attempt - 1), n = Math.min(e * t, this.config.maxDelay), r = n * .25 * (Math.random() * 2 - 1);
4934
5035
  return Math.max(0, Math.round(n + r));
4935
5036
  }
4936
- }, pn = class {
5037
+ }, xn = class {
4937
5038
  price = null;
4938
5039
  previousClose = null;
4939
5040
  visible = !0;
@@ -4964,12 +5065,12 @@ var sn = class {
4964
5065
  let f = s - 5;
4965
5066
  e.beginPath(), e.moveTo(f, r), e.lineTo(f + 5, r - 5), e.lineTo(f + 5, r + 5), e.closePath(), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.textAlign = "left", e.fillText(c, s + 5, r);
4966
5067
  }
4967
- }, mn = class extends H {
5068
+ }, Sn = class extends V {
4968
5069
  config = null;
4969
5070
  adapter = null;
4970
5071
  aggregator = null;
4971
5072
  reconnector;
4972
- priceLine = new pn();
5073
+ priceLine = new xn();
4973
5074
  state = "disconnected";
4974
5075
  lastPrice = null;
4975
5076
  previousClose = null;
@@ -4977,13 +5078,13 @@ var sn = class {
4977
5078
  heartbeatTimer = null;
4978
5079
  lastMessageTime = 0;
4979
5080
  constructor() {
4980
- super(), this.reconnector = new U(), this.wireReconnector();
5081
+ super(), this.reconnector = new H(), this.wireReconnector();
4981
5082
  }
4982
5083
  async connect(e) {
4983
5084
  this.disconnect(), this.config = {
4984
5085
  ...a,
4985
5086
  ...e
4986
- }, this.adapter = e.adapter, this.aggregator = new fn(e.timeframe), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new U(e.reconnect ?? r), this.wireReconnector(), this.aggregator.on("bar", (e) => {
5087
+ }, this.adapter = e.adapter, this.aggregator = new bn(e.timeframe), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new H(e.reconnect ?? r), this.wireReconnector(), this.aggregator.on("bar", (e) => {
4987
5088
  this.emit("barUpdate", e), this.updatePrice(e.close);
4988
5089
  }), this.aggregator.on("barClose", (e) => {
4989
5090
  this.previousClose = e.close, this.emit("barClose", e);
@@ -5093,14 +5194,98 @@ var sn = class {
5093
5194
  dispose() {
5094
5195
  this.disconnect(), this.removeAllListeners();
5095
5196
  }
5197
+ }, Cn = class extends V {
5198
+ data;
5199
+ speed;
5200
+ index;
5201
+ status = "idle";
5202
+ timer = null;
5203
+ constructor(e) {
5204
+ if (super(), e.data.length === 0) throw Error("ReplayController requires non-empty data");
5205
+ this.data = e.data, this.speed = Math.max(.01, e.speed ?? 1), this.index = Math.max(0, Math.min(e.startIndex ?? 0, e.data.length)), e.autoStart && this.start();
5206
+ }
5207
+ getStatus() {
5208
+ return this.status;
5209
+ }
5210
+ getIndex() {
5211
+ return this.index;
5212
+ }
5213
+ getTotal() {
5214
+ return this.data.length;
5215
+ }
5216
+ getPrefix() {
5217
+ return this.data.slice(0, this.index);
5218
+ }
5219
+ start() {
5220
+ if (this.status !== "playing") {
5221
+ if (this.index >= this.data.length) {
5222
+ this.transition("finished");
5223
+ return;
5224
+ }
5225
+ this.transition("playing"), this.scheduleNext();
5226
+ }
5227
+ }
5228
+ pause() {
5229
+ this.status === "playing" && (this.clearTimer(), this.transition("paused"));
5230
+ }
5231
+ resume() {
5232
+ this.status === "paused" && this.start();
5233
+ }
5234
+ stop() {
5235
+ this.clearTimer(), this.index = 0, this.transition("idle");
5236
+ }
5237
+ step(e = 1) {
5238
+ if (!(e <= 0)) {
5239
+ this.clearTimer();
5240
+ for (let t = 0; t < e; t++) if (!this.emitNext()) return;
5241
+ this.status !== "finished" && this.transition("paused");
5242
+ }
5243
+ }
5244
+ seek(e) {
5245
+ let t = Math.max(0, Math.min(e, this.data.length));
5246
+ this.clearTimer(), this.index = t;
5247
+ let n = t >= this.data.length ? "finished" : "paused";
5248
+ this.transition(n);
5249
+ }
5250
+ setSpeed(e) {
5251
+ this.speed = Math.max(.01, e), this.status === "playing" && (this.clearTimer(), this.scheduleNext());
5252
+ }
5253
+ destroy() {
5254
+ this.clearTimer(), this.removeAllListeners();
5255
+ }
5256
+ scheduleNext() {
5257
+ let e = 1e3 / this.speed;
5258
+ this.timer = setTimeout(() => {
5259
+ this.timer = null, this.status === "playing" && this.emitNext() && this.scheduleNext();
5260
+ }, e);
5261
+ }
5262
+ emitNext() {
5263
+ if (this.index >= this.data.length) return this.transition("finished"), this.emit("finished", { total: this.data.length }), !1;
5264
+ let e = this.data[this.index], t = this.index;
5265
+ return this.index++, this.emit("bar", {
5266
+ bar: e,
5267
+ index: t,
5268
+ total: this.data.length
5269
+ }), this.index >= this.data.length ? (this.transition("finished"), this.emit("finished", { total: this.data.length }), !1) : !0;
5270
+ }
5271
+ clearTimer() {
5272
+ this.timer !== null && (clearTimeout(this.timer), this.timer = null);
5273
+ }
5274
+ transition(e) {
5275
+ this.status !== e && (this.status = e, this.emit("stateChange", {
5276
+ status: e,
5277
+ index: this.index,
5278
+ total: this.data.length
5279
+ }));
5280
+ }
5096
5281
  };
5097
5282
  //#endregion
5098
5283
  //#region src/realtime/adapters/binanceTypes.ts
5099
- function hn(e) {
5284
+ function wn(e) {
5100
5285
  if (!Array.isArray(e) || e.length < 6) return null;
5101
5286
  let t = e[0];
5102
5287
  if (typeof t != "number" || !Number.isFinite(t)) return null;
5103
- let n = W(e[1]), r = W(e[2]), i = W(e[3]), a = W(e[4]), o = W(e[5]);
5288
+ let n = U(e[1]), r = U(e[2]), i = U(e[3]), a = U(e[4]), o = U(e[5]);
5104
5289
  return n === null || r === null || i === null || a === null || o === null ? null : {
5105
5290
  time: t,
5106
5291
  open: n,
@@ -5110,11 +5295,11 @@ function hn(e) {
5110
5295
  volume: o
5111
5296
  };
5112
5297
  }
5113
- function gn(e) {
5114
- if (!_n(e)) return null;
5298
+ function Tn(e) {
5299
+ if (!En(e)) return null;
5115
5300
  let t = e.t;
5116
5301
  if (typeof t != "number" || !Number.isFinite(t)) return null;
5117
- let n = W(e.o), r = W(e.h), i = W(e.l), a = W(e.c), o = W(e.v);
5302
+ let n = U(e.o), r = U(e.h), i = U(e.l), a = U(e.c), o = U(e.v);
5118
5303
  if (n === null || r === null || i === null || a === null || o === null) return null;
5119
5304
  let s = typeof e.x == "boolean" ? e.x : !1;
5120
5305
  return {
@@ -5129,7 +5314,7 @@ function gn(e) {
5129
5314
  closed: s
5130
5315
  };
5131
5316
  }
5132
- function W(e) {
5317
+ function U(e) {
5133
5318
  if (typeof e == "number") return Number.isFinite(e) ? e : null;
5134
5319
  if (typeof e == "string") {
5135
5320
  let t = parseFloat(e);
@@ -5137,12 +5322,12 @@ function W(e) {
5137
5322
  }
5138
5323
  return null;
5139
5324
  }
5140
- function _n(e) {
5325
+ function En(e) {
5141
5326
  return typeof e == "object" && !!e;
5142
5327
  }
5143
5328
  //#endregion
5144
5329
  //#region src/realtime/adapters/BinanceAdapter.ts
5145
- var vn = {
5330
+ var Dn = {
5146
5331
  "1s": "1s",
5147
5332
  "1m": "1m",
5148
5333
  "3m": "3m",
@@ -5159,7 +5344,7 @@ var vn = {
5159
5344
  "3d": "3d",
5160
5345
  "1w": "1w",
5161
5346
  "1M": "1M"
5162
- }, yn = class {
5347
+ }, On = class {
5163
5348
  name = "binance";
5164
5349
  ws = null;
5165
5350
  state = "disconnected";
@@ -5180,13 +5365,13 @@ var vn = {
5180
5365
  return this.state;
5181
5366
  }
5182
5367
  async fetchHistory(e, t, n = 500) {
5183
- let r = vn[t] ?? "15m", i = `${this.restBase}/klines?symbol=${e}&interval=${r}&limit=${n}`, a = await fetch(i);
5368
+ let r = Dn[t] ?? "15m", i = `${this.restBase}/klines?symbol=${e}&interval=${r}&limit=${n}`, a = await fetch(i);
5184
5369
  if (!a.ok) throw Error(`Binance REST error: ${a.status}`);
5185
5370
  let o = await a.json();
5186
5371
  if (!Array.isArray(o)) return [];
5187
5372
  let s = [];
5188
5373
  for (let e of o) {
5189
- let t = hn(e);
5374
+ let t = wn(e);
5190
5375
  t && s.push(t);
5191
5376
  }
5192
5377
  return s;
@@ -5203,7 +5388,7 @@ var vn = {
5203
5388
  }
5204
5389
  connectWs() {
5205
5390
  if (!this.config) return;
5206
- let e = `${this.config.symbol.toLowerCase()}@kline_${vn[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
5391
+ let e = `${this.config.symbol.toLowerCase()}@kline_${Dn[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
5207
5392
  this.setState("connecting");
5208
5393
  try {
5209
5394
  this.ws = new WebSocket(t);
@@ -5228,7 +5413,7 @@ var vn = {
5228
5413
  };
5229
5414
  }
5230
5415
  handleKline(e) {
5231
- let t = gn(e);
5416
+ let t = Tn(e);
5232
5417
  if (!t) return;
5233
5418
  let { bar: n, closed: r } = t;
5234
5419
  this.emitEvent("bar", {
@@ -5254,7 +5439,7 @@ var vn = {
5254
5439
  for (let e of n) e(r);
5255
5440
  }
5256
5441
  }
5257
- }, bn = class {
5442
+ }, kn = class {
5258
5443
  name = "mock";
5259
5444
  state = "disconnected";
5260
5445
  listeners = /* @__PURE__ */ new Map();
@@ -5349,7 +5534,7 @@ var vn = {
5349
5534
  for (let e of n) e(r);
5350
5535
  }
5351
5536
  }
5352
- }, xn = {
5537
+ }, An = {
5353
5538
  visible: !0,
5354
5539
  showSymbol: !0,
5355
5540
  showOHLC: !0,
@@ -5357,8 +5542,8 @@ var vn = {
5357
5542
  showVolume: !0,
5358
5543
  position: "top-left",
5359
5544
  fontSize: 12
5360
- }, Sn = class {
5361
- config = { ...xn };
5545
+ }, jn = class {
5546
+ config = { ...An };
5362
5547
  symbol = "";
5363
5548
  timeframe = "";
5364
5549
  hoverBar = null;
@@ -5449,7 +5634,7 @@ var vn = {
5449
5634
  }
5450
5635
  }
5451
5636
  }
5452
- }, Cn = class {
5637
+ }, Mn = class {
5453
5638
  static toDataURL(e, t) {
5454
5639
  let n = e.querySelectorAll("canvas");
5455
5640
  if (n.length === 0) return "";
@@ -5471,7 +5656,7 @@ var vn = {
5471
5656
  let i = document.createElement("a");
5472
5657
  i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i);
5473
5658
  }
5474
- }, wn = class {
5659
+ }, Nn = class {
5475
5660
  config = null;
5476
5661
  setConfig(e) {
5477
5662
  this.config = e;
@@ -5481,7 +5666,7 @@ var vn = {
5481
5666
  let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = this.config.color ?? n.textSecondary;
5482
5667
  e.save(), e.globalAlpha = .07, e.font = `bold ${i}px ${n.font.family}`, e.fillStyle = a, e.textAlign = "center", e.textBaseline = "middle", e.fillText(this.config.text, r.x + r.width / 2, r.y + r.height / 2), e.restore();
5483
5668
  }
5484
- }, Tn = class {
5669
+ }, Pn = class {
5485
5670
  visible = !0;
5486
5671
  timeframeMs = 0;
5487
5672
  setVisible(e) {
@@ -5504,7 +5689,7 @@ var vn = {
5504
5689
  let t = Math.ceil(e / 1e3), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
5505
5690
  return n > 0 ? `${n}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}` : `${r}:${String(i).padStart(2, "0")}`;
5506
5691
  }
5507
- }, En = class {
5692
+ }, Fn = class {
5508
5693
  config = { visible: !1 };
5509
5694
  cachedBreaks = [];
5510
5695
  lastDataLength = 0;
@@ -5548,7 +5733,7 @@ var vn = {
5548
5733
  invalidateCache() {
5549
5734
  this.lastDataLength = 0, this.cachedBreaks = [];
5550
5735
  }
5551
- }, Dn = 1, On = class extends H {
5736
+ }, In = 1, Ln = class extends V {
5552
5737
  alerts = [];
5553
5738
  lastPrice = null;
5554
5739
  requestRender = null;
@@ -5560,7 +5745,7 @@ var vn = {
5560
5745
  this.pricePrecision = e;
5561
5746
  }
5562
5747
  addAlert(e, t = "crossing", n, r = !1) {
5563
- let i = `tc_alert_${Dn++}`, a = {
5748
+ let i = `tc_alert_${In++}`, a = {
5564
5749
  id: i,
5565
5750
  price: e,
5566
5751
  condition: t,
@@ -5640,7 +5825,7 @@ var vn = {
5640
5825
  e.fillText(s, r.x + r.width - 4, a - 2);
5641
5826
  }
5642
5827
  }
5643
- }, kn = class extends H {
5828
+ }, Rn = class extends V {
5644
5829
  data = [];
5645
5830
  currentIndex = 0;
5646
5831
  timer = null;
@@ -5694,24 +5879,24 @@ var vn = {
5694
5879
  dispose() {
5695
5880
  this.stop(), this.removeAllListeners(), this.data = [];
5696
5881
  }
5697
- }, G = 1;
5698
- function K(e) {
5882
+ }, W = 1;
5883
+ function G(e) {
5699
5884
  return typeof e == "object" && !!e && !Array.isArray(e);
5700
5885
  }
5701
- function q(e) {
5886
+ function K(e) {
5702
5887
  return Array.isArray(e) ? e : [];
5703
5888
  }
5704
- function An(e, t) {
5889
+ function zn(e, t) {
5705
5890
  return typeof e == "string" ? e : t;
5706
5891
  }
5707
- function J(e, t) {
5892
+ function q(e, t) {
5708
5893
  return typeof e == "number" && Number.isFinite(e) ? e : t;
5709
5894
  }
5710
- function jn(e) {
5711
- if (!K(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || !K(e.style)) return null;
5895
+ function Bn(e) {
5896
+ if (!G(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || !G(e.style)) return null;
5712
5897
  let t = [];
5713
5898
  for (let n of e.anchors) {
5714
- if (!K(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
5899
+ if (!G(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
5715
5900
  t.push({
5716
5901
  time: n.time,
5717
5902
  price: n.price
@@ -5725,52 +5910,52 @@ function jn(e) {
5725
5910
  style: n,
5726
5911
  visible: typeof e.visible == "boolean" ? e.visible : !0,
5727
5912
  locked: typeof e.locked == "boolean" ? e.locked : !1,
5728
- meta: K(e.meta) ? e.meta : void 0
5913
+ meta: G(e.meta) ? e.meta : void 0
5729
5914
  };
5730
5915
  }
5731
- function Mn(e) {
5732
- return !K(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
5916
+ function Vn(e) {
5917
+ return !G(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
5733
5918
  }
5734
- function Nn(e) {
5735
- return !K(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
5919
+ function Hn(e) {
5920
+ return !G(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
5736
5921
  }
5737
- function Pn(e) {
5738
- if (!K(e)) return Fn();
5739
- typeof e.version == "number" && e.version !== G && console.warn(`Chart state version mismatch: ${e.version} vs ${G}`);
5740
- let t = K(e.viewport) ? e.viewport : {}, n = [];
5741
- for (let t of q(e.indicators)) K(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || K(t.params) && n.push({
5922
+ function Un(e) {
5923
+ if (!G(e)) return Wn();
5924
+ typeof e.version == "number" && e.version !== W && console.warn(`Chart state version mismatch: ${e.version} vs ${W}`);
5925
+ let t = G(e.viewport) ? e.viewport : {}, n = [];
5926
+ for (let t of K(e.indicators)) G(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || G(t.params) && n.push({
5742
5927
  id: t.id,
5743
5928
  instanceId: t.instanceId,
5744
5929
  params: t.params,
5745
5930
  position: typeof t.position == "string" ? t.position : void 0
5746
5931
  }));
5747
5932
  let r = [];
5748
- for (let t of q(e.drawings)) {
5749
- let e = jn(t);
5933
+ for (let t of K(e.drawings)) {
5934
+ let e = Bn(t);
5750
5935
  e && r.push(e);
5751
5936
  }
5752
5937
  let i = [];
5753
- for (let t of q(e.orders)) {
5754
- let e = Mn(t);
5938
+ for (let t of K(e.orders)) {
5939
+ let e = Vn(t);
5755
5940
  e && i.push(e);
5756
5941
  }
5757
5942
  let a = [];
5758
- for (let t of q(e.positions)) {
5759
- let e = Nn(t);
5943
+ for (let t of K(e.positions)) {
5944
+ let e = Hn(t);
5760
5945
  e && a.push(e);
5761
5946
  }
5762
5947
  let o = [];
5763
- for (let t of q(e.alerts)) K(t) && typeof t.id == "string" && o.push(t);
5948
+ for (let t of K(e.alerts)) G(t) && typeof t.id == "string" && o.push(t);
5764
5949
  return {
5765
- version: typeof e.version == "number" ? e.version : G,
5766
- timestamp: J(e.timestamp, Date.now()),
5950
+ version: typeof e.version == "number" ? e.version : W,
5951
+ timestamp: q(e.timestamp, Date.now()),
5767
5952
  symbol: typeof e.symbol == "string" ? e.symbol : void 0,
5768
5953
  timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
5769
- chartType: An(e.chartType, "candlestick"),
5954
+ chartType: zn(e.chartType, "candlestick"),
5770
5955
  viewport: {
5771
- barWidth: J(t.barWidth, 8),
5772
- barSpacing: J(t.barSpacing, 2),
5773
- offset: J(t.offset, 0)
5956
+ barWidth: q(t.barWidth, 8),
5957
+ barSpacing: q(t.barSpacing, 2),
5958
+ offset: q(t.offset, 0)
5774
5959
  },
5775
5960
  theme: typeof e.theme == "string" ? e.theme : void 0,
5776
5961
  locale: typeof e.locale == "string" ? e.locale : void 0,
@@ -5781,9 +5966,9 @@ function Pn(e) {
5781
5966
  alerts: o
5782
5967
  };
5783
5968
  }
5784
- function Fn() {
5969
+ function Wn() {
5785
5970
  return {
5786
- version: G,
5971
+ version: W,
5787
5972
  timestamp: Date.now(),
5788
5973
  chartType: "candlestick",
5789
5974
  viewport: {
@@ -5798,10 +5983,10 @@ function Fn() {
5798
5983
  alerts: []
5799
5984
  };
5800
5985
  }
5801
- var In = class {
5986
+ var Gn = class {
5802
5987
  static capture(e, t) {
5803
5988
  return {
5804
- version: G,
5989
+ version: W,
5805
5990
  timestamp: Date.now(),
5806
5991
  chartType: t?.chartType ?? "candlestick",
5807
5992
  symbol: t?.symbol,
@@ -5823,7 +6008,7 @@ var In = class {
5823
6008
  return JSON.stringify(e);
5824
6009
  }
5825
6010
  static deserialize(e) {
5826
- return Pn(JSON.parse(e));
6011
+ return Un(JSON.parse(e));
5827
6012
  }
5828
6013
  static saveToStorage(e, t) {
5829
6014
  localStorage.setItem(e, this.serialize(t));
@@ -5850,7 +6035,7 @@ var In = class {
5850
6035
  }, n.click();
5851
6036
  });
5852
6037
  }
5853
- }, Ln = class {
6038
+ }, Kn = class {
5854
6039
  undoStack = [];
5855
6040
  redoStack = [];
5856
6041
  maxHistory = 50;
@@ -5886,7 +6071,7 @@ var In = class {
5886
6071
  redoCount: this.redoStack.length
5887
6072
  };
5888
6073
  }
5889
- }, Rn = class {
6074
+ }, qn = class {
5890
6075
  static toCSV(e) {
5891
6076
  return ["Time,Open,High,Low,Close,Volume", ...e.map((e) => `${new Date(e.time).toISOString()},${e.open},${e.high},${e.low},${e.close},${e.volume}`)].join("\n");
5892
6077
  }
@@ -5904,7 +6089,7 @@ var In = class {
5904
6089
  let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
5905
6090
  a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
5906
6091
  }
5907
- }, zn = 1, Bn = class extends H {
6092
+ }, Jn = 1, Yn = class extends V {
5908
6093
  markers = [];
5909
6094
  style = { ...i };
5910
6095
  requestRender = null;
@@ -5925,7 +6110,7 @@ var In = class {
5925
6110
  return { ...this.style };
5926
6111
  }
5927
6112
  addMarker(e) {
5928
- let t = e.id ?? `tc_signal_${zn++}`, n = {
6113
+ let t = e.id ?? `tc_signal_${Jn++}`, n = {
5929
6114
  ...e,
5930
6115
  id: t
5931
6116
  };
@@ -5979,7 +6164,7 @@ var In = class {
5979
6164
  renderArrow(e, t, n, r, i, a) {
5980
6165
  e.fillStyle = a, e.beginPath(), r === "long" ? (e.moveTo(t, n - i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n + i * .4), e.lineTo(t + i * .2, n + i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : r === "short" ? (e.moveTo(t, n + i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n - i * .4), e.lineTo(t + i * .2, n - i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : e.arc(t, n, i * .4, 0, Math.PI * 2), e.closePath(), e.fill();
5981
6166
  }
5982
- }, Vn = 1, Hn = class extends H {
6167
+ }, Xn = 1, Zn = class extends V {
5983
6168
  zones = [];
5984
6169
  style = { ...o };
5985
6170
  requestRender = null;
@@ -6004,7 +6189,7 @@ var In = class {
6004
6189
  return { ...this.style };
6005
6190
  }
6006
6191
  addZone(e) {
6007
- let t = e.id ?? `tc_zone_${Vn++}`, n = {
6192
+ let t = e.id ?? `tc_zone_${Xn++}`, n = {
6008
6193
  ...e,
6009
6194
  id: t
6010
6195
  };
@@ -6055,7 +6240,7 @@ var In = class {
6055
6240
  }
6056
6241
  a.showLabel && t.label && (e.font = `9px ${i.font.family}`, e.fillStyle = b, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, f + 4, m + 3), e.globalAlpha = 1);
6057
6242
  }
6058
- }, Un = {
6243
+ }, Qn = {
6059
6244
  linear: (e) => e,
6060
6245
  easeOutCubic: (e) => 1 - (1 - e) ** 3,
6061
6246
  easeOutQuart: (e) => 1 - (1 - e) ** 4,
@@ -6063,7 +6248,7 @@ var In = class {
6063
6248
  easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
6064
6249
  easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
6065
6250
  spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
6066
- }, Wn = class {
6251
+ }, $n = class {
6067
6252
  animations = /* @__PURE__ */ new Map();
6068
6253
  frameId = 0;
6069
6254
  running = !1;
@@ -6071,7 +6256,7 @@ var In = class {
6071
6256
  this.animations.set(e, {
6072
6257
  startTime: -1,
6073
6258
  duration: t.duration,
6074
- easing: t.easing ?? Un.easeOutCubic,
6259
+ easing: t.easing ?? Qn.easeOutCubic,
6075
6260
  onUpdate: t.onUpdate,
6076
6261
  onComplete: t.onComplete
6077
6262
  }), this.running || (this.running = !0, this.tick());
@@ -6106,10 +6291,10 @@ var In = class {
6106
6291
  };
6107
6292
  //#endregion
6108
6293
  //#region src/finance/BaseFinanceChart.ts
6109
- function Gn(t) {
6294
+ function er(t) {
6110
6295
  return !t || t === "dark" ? e : t === "light" ? c : t;
6111
6296
  }
6112
- var Kn = class {
6297
+ var tr = class {
6113
6298
  canvas;
6114
6299
  ctx;
6115
6300
  container;
@@ -6120,7 +6305,7 @@ var Kn = class {
6120
6305
  frameId = null;
6121
6306
  resizeObserver;
6122
6307
  constructor(e, t) {
6123
- this.container = e, this.theme = Gn(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
6308
+ this.container = e, this.theme = er(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
6124
6309
  this.updateSize(), this.requestRender();
6125
6310
  }), this.resizeObserver.observe(e);
6126
6311
  }
@@ -6135,12 +6320,12 @@ var Kn = class {
6135
6320
  }));
6136
6321
  }
6137
6322
  setTheme(e) {
6138
- this.theme = Gn(e), this.requestRender();
6323
+ this.theme = er(e), this.requestRender();
6139
6324
  }
6140
6325
  destroy() {
6141
6326
  this.frameId !== null && cancelAnimationFrame(this.frameId), this.resizeObserver.disconnect(), this.canvas.remove();
6142
6327
  }
6143
- }, qn = class {
6328
+ }, nr = class {
6144
6329
  pos = null;
6145
6330
  canvas;
6146
6331
  onUpdate;
@@ -6172,7 +6357,7 @@ var Kn = class {
6172
6357
  };
6173
6358
  //#endregion
6174
6359
  //#region src/finance/SparklineRenderer.ts
6175
- function Jn(e, t, n, r, i) {
6360
+ function rr(e, t, n, r, i) {
6176
6361
  let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
6177
6362
  if (a.length < 2 || t <= 0 || n <= 0) return;
6178
6363
  let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
@@ -6197,8 +6382,8 @@ function Jn(e, t, n, r, i) {
6197
6382
  }
6198
6383
  //#endregion
6199
6384
  //#region src/finance/DepthChartRenderer.ts
6200
- var Yn = 50, Xn = 60, Y = 20, Zn = .2;
6201
- function Qn(e) {
6385
+ var ir = 50, ar = 60, J = 20, or = .2;
6386
+ function sr(e) {
6202
6387
  let t = [...e].sort((e, t) => t.price - e.price), n = [], r = 0;
6203
6388
  for (let e of t) r += e.volume, n.push({
6204
6389
  price: e.price,
@@ -6206,7 +6391,7 @@ function Qn(e) {
6206
6391
  });
6207
6392
  return n;
6208
6393
  }
6209
- function $n(e) {
6394
+ function cr(e) {
6210
6395
  let t = [...e].sort((e, t) => e.price - t.price), n = [], r = 0;
6211
6396
  for (let e of t) r += e.volume, n.push({
6212
6397
  price: e.price,
@@ -6214,20 +6399,20 @@ function $n(e) {
6214
6399
  });
6215
6400
  return n;
6216
6401
  }
6217
- function er(e, t) {
6402
+ function lr(e, t) {
6218
6403
  return {
6219
- left: Yn,
6220
- right: e - Xn,
6221
- top: Y,
6222
- bottom: t - Y,
6223
- plotWidth: e - Yn - Xn,
6224
- plotHeight: t - Y * 2
6404
+ left: ir,
6405
+ right: e - ar,
6406
+ top: J,
6407
+ bottom: t - J,
6408
+ plotWidth: e - ir - ar,
6409
+ plotHeight: t - J * 2
6225
6410
  };
6226
6411
  }
6227
- function tr(e, t, n, r) {
6412
+ function ur(e, t, n, r) {
6228
6413
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6229
6414
  }
6230
- function nr(e, t, n, r, i, a, o, s) {
6415
+ function dr(e, t, n, r, i, a, o, s) {
6231
6416
  let { left: c, right: l, top: u, bottom: d, plotWidth: f, plotHeight: p } = t;
6232
6417
  e.save(), e.strokeStyle = a.grid, e.lineWidth = .5, e.fillStyle = a.axisLabel, e.font = `${a.font.sizeSmall}px ${a.font.family}`;
6233
6418
  let h = m(0, i, 5);
@@ -6242,7 +6427,7 @@ function nr(e, t, n, r, i, a, o, s) {
6242
6427
  }
6243
6428
  e.restore();
6244
6429
  }
6245
- function rr(e, t, n, r, i, a, o, s, c) {
6430
+ function fr(e, t, n, r, i, a, o, s, c) {
6246
6431
  if (t.length === 0) return;
6247
6432
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - e / a * f;
6248
6433
  if (e.beginPath(), c === "bid") {
@@ -6275,14 +6460,14 @@ function rr(e, t, n, r, i, a, o, s, c) {
6275
6460
  }
6276
6461
  e.strokeStyle = s, e.lineWidth = 1.5, e.stroke();
6277
6462
  }
6278
- function ir(e, t, n, r, i, a, o, s, c) {
6463
+ function pr(e, t, n, r, i, a, o, s, c) {
6279
6464
  let { left: l, top: u, bottom: d, plotWidth: f } = r, p = l + (t - i) / a * f;
6280
6465
  if (e.save(), e.strokeStyle = o.textSecondary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(p, u), e.lineTo(p, d), e.stroke(), e.restore(), s) {
6281
6466
  let t = `Spread: ${c(n)}`;
6282
6467
  e.save(), e.font = `${o.font.sizeSmall}px ${o.font.family}`, e.fillStyle = o.textSecondary, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t, p, u - 2), e.restore();
6283
6468
  }
6284
6469
  }
6285
- function ar(e, t, n, r, i, a, o, s, c, l, u) {
6470
+ function mr(e, t, n, r, i, a, o, s, c, l, u) {
6286
6471
  let { left: d, top: f, bottom: p, plotWidth: m, plotHeight: h } = i, g = t.x;
6287
6472
  if (g < d || g > i.right) return;
6288
6473
  let _ = a + (g - d) / m * o, v = 0, y = "";
@@ -6308,47 +6493,47 @@ function ar(e, t, n, r, i, a, o, s, c, l, u) {
6308
6493
  for (let t = 0; t < b.length; t++) e.fillText(b[t], C + 8, w + 6 + t * (c.font.sizeSmall + 4));
6309
6494
  e.restore();
6310
6495
  }
6311
- function or(e) {
6496
+ function hr(e) {
6312
6497
  return e.toFixed(2);
6313
6498
  }
6314
- function sr(e) {
6499
+ function gr(e) {
6315
6500
  return e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(0);
6316
6501
  }
6317
- function cr(e, t, n, r, i, a) {
6502
+ function _r(e, t, n, r, i, a) {
6318
6503
  let { data: o } = r;
6319
6504
  if (o.bids.length === 0 && o.asks.length === 0 || t <= 0 || n <= 0) return;
6320
- let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ?? or, m = r.volumeFormat ?? sr, h = Qn(o.bids), g = $n(o.asks), _ = h.length > 0 ? h[0].price : 0, v = g.length > 0 ? g[0].price : 0, y = h.length > 0 && g.length > 0 ? (_ + v) / 2 : _ || v, b = g.length > 0 && h.length > 0 ? v - _ : 0, x = h.length > 0 ? h[h.length - 1].price : y, S = g.length > 0 ? g[g.length - 1].price : y, C = Math.max(y - x, S - y) * (1 + Zn), w = y - C, T = y + C, E = T - w, D = h.length > 0 ? h[h.length - 1].cumulativeVolume : 0, O = g.length > 0 ? g[g.length - 1].cumulativeVolume : 0, k = Math.max(D, O) || 1, A = er(t, n);
6321
- tr(e, t, n, i.background), nr(e, A, w, T, k, i, p, m), rr(e, h, A, w, E, k, l, s, "bid"), rr(e, g, A, w, E, k, u, c, "ask"), d && ir(e, y, b, A, w, E, i, f, p), a && ar(e, a, h, g, A, w, E, k, i, p, m);
6505
+ let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ?? hr, m = r.volumeFormat ?? gr, h = sr(o.bids), g = cr(o.asks), _ = h.length > 0 ? h[0].price : 0, v = g.length > 0 ? g[0].price : 0, y = h.length > 0 && g.length > 0 ? (_ + v) / 2 : _ || v, b = g.length > 0 && h.length > 0 ? v - _ : 0, x = h.length > 0 ? h[h.length - 1].price : y, S = g.length > 0 ? g[g.length - 1].price : y, C = Math.max(y - x, S - y) * (1 + or), w = y - C, T = y + C, E = T - w, D = h.length > 0 ? h[h.length - 1].cumulativeVolume : 0, O = g.length > 0 ? g[g.length - 1].cumulativeVolume : 0, k = Math.max(D, O) || 1, A = lr(t, n);
6506
+ ur(e, t, n, i.background), dr(e, A, w, T, k, i, p, m), fr(e, h, A, w, E, k, l, s, "bid"), fr(e, g, A, w, E, k, u, c, "ask"), d && pr(e, y, b, A, w, E, i, f, p), a && mr(e, a, h, g, A, w, E, k, i, p, m);
6322
6507
  }
6323
6508
  //#endregion
6324
6509
  //#region src/finance/EquityCurveRenderer.ts
6325
- var lr = 70, ur = 30, dr = 20, fr = 20, pr = .05;
6326
- function mr(e, t) {
6510
+ var vr = 70, yr = 30, br = 20, xr = 20, Sr = .05;
6511
+ function Cr(e, t) {
6327
6512
  return {
6328
- left: lr,
6329
- right: e - dr,
6330
- top: fr,
6331
- bottom: t - ur,
6332
- plotWidth: e - lr - dr,
6333
- plotHeight: t - fr - ur
6513
+ left: vr,
6514
+ right: e - br,
6515
+ top: xr,
6516
+ bottom: t - yr,
6517
+ plotWidth: e - vr - br,
6518
+ plotHeight: t - xr - yr
6334
6519
  };
6335
6520
  }
6336
- function hr(e, t) {
6521
+ function wr(e, t) {
6337
6522
  let n = Infinity, r = -Infinity;
6338
6523
  for (let t of e) t.value < n && (n = t.value), t.value > r && (r = t.value);
6339
6524
  if (t) for (let e of t) e.value < n && (n = e.value), e.value > r && (r = e.value);
6340
- let i = (r - n) * pr;
6525
+ let i = (r - n) * Sr;
6341
6526
  return {
6342
6527
  valMin: n - i,
6343
6528
  valMax: r + i
6344
6529
  };
6345
6530
  }
6346
- function gr(e) {
6531
+ function Tr(e) {
6347
6532
  let t = [], n = -Infinity;
6348
6533
  for (let r of e) r.value > n && (n = r.value), t.push(n);
6349
6534
  return t;
6350
6535
  }
6351
- function _r(e) {
6536
+ function Er(e) {
6352
6537
  let t = 864e5;
6353
6538
  if (365.25 * t, e < 7 * t) {
6354
6539
  let e = new Intl.DateTimeFormat(void 0, {
@@ -6370,13 +6555,13 @@ function _r(e) {
6370
6555
  });
6371
6556
  return (e) => n.format(new Date(e));
6372
6557
  }
6373
- function vr(e) {
6558
+ function Dr(e) {
6374
6559
  return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
6375
6560
  }
6376
- function yr(e, t, n, r) {
6561
+ function Or(e, t, n, r) {
6377
6562
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6378
6563
  }
6379
- function br(e, t, n, r, i, a, o, s, c) {
6564
+ function kr(e, t, n, r, i, a, o, s, c) {
6380
6565
  let { left: l, right: u, top: d, bottom: f, plotWidth: p, plotHeight: h } = t;
6381
6566
  e.save(), e.strokeStyle = o.grid, e.lineWidth = .5, e.fillStyle = o.axisLabel, e.font = `${o.font.sizeSmall}px ${o.font.family}`;
6382
6567
  let g = m(n, r, 6), _ = Math.ceil(n / g) * g;
@@ -6391,21 +6576,21 @@ function br(e, t, n, r, i, a, o, s, c) {
6391
6576
  }
6392
6577
  e.restore();
6393
6578
  }
6394
- function xr(e, t, n, r, i, a, o, s, c) {
6579
+ function Ar(e, t, n, r, i, a, o, s, c) {
6395
6580
  if (t.length < 2) return;
6396
6581
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - (e - a) / o * f;
6397
6582
  e.save(), e.beginPath(), e.moveTo(p(t[0].time), m(t[0].value));
6398
6583
  for (let n = 1; n < t.length; n++) e.lineTo(p(t[n].time), m(t[n].value));
6399
6584
  e.strokeStyle = s, e.lineWidth = c, e.lineJoin = "round", e.stroke(), e.restore();
6400
6585
  }
6401
- function Sr(e, t, n, r, i, a, o, s) {
6586
+ function jr(e, t, n, r, i, a, o, s) {
6402
6587
  if (t.length < 2) return;
6403
6588
  let { left: c, bottom: l, plotWidth: u, plotHeight: d } = n, f = (e) => c + (e - r) / i * u, p = (e) => l - (e - a) / o * d, m = e.createLinearGradient(0, n.top, 0, l);
6404
6589
  m.addColorStop(0, s + "40"), m.addColorStop(1, "transparent"), e.save(), e.beginPath(), e.moveTo(f(t[0].time), p(t[0].value));
6405
6590
  for (let n = 1; n < t.length; n++) e.lineTo(f(t[n].time), p(t[n].value));
6406
6591
  e.lineTo(f(t[t.length - 1].time), l), e.lineTo(f(t[0].time), l), e.closePath(), e.fillStyle = m, e.fill(), e.restore();
6407
6592
  }
6408
- function Cr(e, t, n, r, i, a, o, s, c) {
6593
+ function Mr(e, t, n, r, i, a, o, s, c) {
6409
6594
  if (t.length < 2) return;
6410
6595
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = r, p = (e) => l + (e - i) / a * d, m = (e) => u - (e - o) / s * f;
6411
6596
  e.save(), e.fillStyle = c, e.beginPath(), e.moveTo(p(t[0].time), m(n[0]));
@@ -6413,12 +6598,12 @@ function Cr(e, t, n, r, i, a, o, s, c) {
6413
6598
  for (let n = t.length - 1; n >= 0; n--) e.lineTo(p(t[n].time), m(t[n].value));
6414
6599
  e.closePath(), e.fill(), e.restore();
6415
6600
  }
6416
- function wr(e, t, n, r, i, a, o, s, c, l) {
6601
+ function Nr(e, t, n, r, i, a, o, s, c, l) {
6417
6602
  if (t.length === 0) return;
6418
6603
  let { left: u, bottom: d, plotWidth: f, plotHeight: p } = n, m = t[t.length - 1], h = u + (m.time - r) / i * f, g = d - (m.value - a) / o * p;
6419
6604
  e.save(), e.font = `${l.font.sizeSmall}px ${l.font.family}`, e.fillStyle = c, e.textAlign = "left", e.textBaseline = "middle", e.fillText(s, h + 4, g), e.restore();
6420
6605
  }
6421
- function Tr(e, t, n, r, i, a, o, s, c, l, u, d) {
6606
+ function Pr(e, t, n, r, i, a, o, s, c, l, u, d) {
6422
6607
  let { left: f, top: p, bottom: m, plotWidth: h, plotHeight: g } = i, _ = t.x;
6423
6608
  if (_ < f || _ > i.right) return;
6424
6609
  e.save(), e.strokeStyle = l.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(_, p), e.lineTo(_, m), e.stroke(), e.restore();
@@ -6436,15 +6621,15 @@ function Tr(e, t, n, r, i, a, o, s, c, l, u, d) {
6436
6621
  for (let t = 0; t < S.length; t++) e.fillText(S[t], D + 8, O + 6 + t * (l.font.sizeSmall + 4));
6437
6622
  e.restore();
6438
6623
  }
6439
- function Er(e, t, n, r, i, a) {
6624
+ function Fr(e, t, n, r, i, a) {
6440
6625
  let { data: o } = r;
6441
6626
  if (o.length < 2 || t <= 0 || n <= 0) return;
6442
- let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ?? vr, { valMin: g, valMax: _ } = hr(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? _r(x), C = mr(t, n);
6443
- yr(e, t, n, i.background), br(e, C, g, _, y, b, i, h, S), l && Cr(e, o, gr(o), C, y, x, g, v, u), d && Sr(e, o, C, y, x, g, v, s), xr(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (xr(e, f, C, y, x, g, v, p, 1), wr(e, f, C, y, x, g, v, m, p, i)), a && Tr(e, a, o, f, C, y, x, g, v, i, S, h);
6627
+ let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ?? Dr, { valMin: g, valMax: _ } = wr(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? Er(x), C = Cr(t, n);
6628
+ Or(e, t, n, i.background), kr(e, C, g, _, y, b, i, h, S), l && Mr(e, o, Tr(o), C, y, x, g, v, u), d && jr(e, o, C, y, x, g, v, s), Ar(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (Ar(e, f, C, y, x, g, v, p, 1), Nr(e, f, C, y, x, g, v, m, p, i)), a && Pr(e, a, o, f, C, y, x, g, v, i, S, h);
6444
6629
  }
6445
6630
  //#endregion
6446
6631
  //#region src/finance/HeatmapLayout.ts
6447
- function Dr(e, t, n) {
6632
+ function Ir(e, t, n) {
6448
6633
  if (e.length === 0) return [];
6449
6634
  let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
6450
6635
  for (let a = 0; a < r; a++) {
@@ -6461,7 +6646,7 @@ function Dr(e, t, n) {
6461
6646
  }
6462
6647
  return c;
6463
6648
  }
6464
- function Or(e, t) {
6649
+ function Y(e, t) {
6465
6650
  let n = e.reduce((e, t) => e + t, 0);
6466
6651
  if (n === 0 || t === 0) return Infinity;
6467
6652
  let r = 0;
@@ -6491,7 +6676,7 @@ function X(e, t, n, r, i, a) {
6491
6676
  }), l += s;
6492
6677
  }
6493
6678
  }
6494
- function kr(e, t, n, r, i) {
6679
+ function Lr(e, t, n, r, i) {
6495
6680
  if (e.length === 0) return;
6496
6681
  let a = n.width >= n.height, o = a ? n.height : n.width;
6497
6682
  if (e.length === 1) {
@@ -6501,7 +6686,7 @@ function kr(e, t, n, r, i) {
6501
6686
  let s = [], c = [], l = 0;
6502
6687
  for (; l < e.length;) {
6503
6688
  let u = [...s, e[l]];
6504
- if (s.length === 0 || Or(u, o) <= Or(s, o)) s.push(e[l]), c.push(t[l]), l++;
6689
+ if (s.length === 0 || Y(u, o) <= Y(s, o)) s.push(e[l]), c.push(t[l]), l++;
6505
6690
  else {
6506
6691
  X(s, c, n, a, r, i);
6507
6692
  let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
@@ -6515,28 +6700,28 @@ function kr(e, t, n, r, i) {
6515
6700
  y: n.y + d,
6516
6701
  width: n.width,
6517
6702
  height: n.height - d
6518
- }, kr(e.slice(l), t.slice(l), n, r, i);
6703
+ }, Lr(e.slice(l), t.slice(l), n, r, i);
6519
6704
  return;
6520
6705
  }
6521
6706
  }
6522
6707
  s.length > 0 && X(s, c, n, a, r, i);
6523
6708
  }
6524
- function Ar(e, t, n) {
6709
+ function Rr(e, t, n) {
6525
6710
  if (e.length === 0) return [];
6526
6711
  let r = [...e].sort((e, t) => t.weight - e.weight), i = r.reduce((e, t) => e + Math.max(0, t.weight), 0);
6527
6712
  if (i === 0) return [];
6528
6713
  let a = t.width * t.height, o = r.map((e) => Math.max(0, e.weight) / i * a), s = r.map((e) => e.id), c = [];
6529
- return kr(o, s, { ...t }, n, c), c;
6714
+ return Lr(o, s, { ...t }, n, c), c;
6530
6715
  }
6531
6716
  //#endregion
6532
6717
  //#region src/finance/HeatmapRenderer.ts
6533
- function jr(e) {
6718
+ function zr(e) {
6534
6719
  return (e >= 0 ? "+" : "") + e.toFixed(2) + "%";
6535
6720
  }
6536
- function Mr(e) {
6721
+ function Br(e) {
6537
6722
  return e.label;
6538
6723
  }
6539
- function Nr(e, t) {
6724
+ function Vr(e, t) {
6540
6725
  let n = t.min ?? -5, r = t.max ?? 5;
6541
6726
  if (e <= n) return t.negative;
6542
6727
  if (e >= r) return t.positive;
@@ -6551,7 +6736,7 @@ function Z(e, t, n, r, i, a) {
6551
6736
  let o = Math.min(a, r / 2, i / 2);
6552
6737
  e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.arcTo(t + r, n, t + r, n + o, o), e.lineTo(t + r, n + i - o), e.arcTo(t + r, n + i, t + r - o, n + i, o), e.lineTo(t + o, n + i), e.arcTo(t, n + i, t, n + i - o, o), e.lineTo(t, n + o), e.arcTo(t, n, t + o, n, o), e.closePath();
6553
6738
  }
6554
- function Pr(e, t, n, r, i, a, o, s, c, l, u) {
6739
+ function Hr(e, t, n, r, i, a, o, s, c, l, u) {
6555
6740
  if (i < 40 || a < 30) return;
6556
6741
  let d = n + i / 2, f = r + a / 2;
6557
6742
  if (e.save(), e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 2, e.fillStyle = "#FFFFFF", e.textAlign = "center", s) {
@@ -6564,7 +6749,7 @@ function Pr(e, t, n, r, i, a, o, s, c, l, u) {
6564
6749
  }
6565
6750
  e.restore();
6566
6751
  }
6567
- function Fr(e, t, n, r, i, a, o, s) {
6752
+ function Ur(e, t, n, r, i, a, o, s) {
6568
6753
  let c = [o(t), s(t.value)];
6569
6754
  if (t.meta) for (let [e, n] of Object.entries(t.meta)) c.push(e + ": " + String(n));
6570
6755
  e.save(), e.font = a.font.sizeSmall + "px " + a.font.family;
@@ -6573,13 +6758,13 @@ function Fr(e, t, n, r, i, a, o, s) {
6573
6758
  for (let t = 0; t < c.length; t++) e.fillText(c[t], f + 8, p + 6 + t * u);
6574
6759
  e.restore();
6575
6760
  }
6576
- function Ir(e, t, n, r, i, a, o, s) {
6761
+ function Wr(e, t, n, r, i, a, o, s) {
6577
6762
  if (r.length === 0 || i.length === 0 || t <= 0 || n <= 0) return null;
6578
6763
  let c = a.colorScale ?? {
6579
6764
  negative: "#EF5350",
6580
6765
  zero: "#424242",
6581
6766
  positive: "#26A69A"
6582
- }, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ?? jr, p = a.labelFormat ?? Mr, m = /* @__PURE__ */ new Map();
6767
+ }, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ?? zr, p = a.labelFormat ?? Br, m = /* @__PURE__ */ new Map();
6583
6768
  for (let e of r) m.set(e.id, e);
6584
6769
  let h = null, g = null;
6585
6770
  if (s) for (let e of i) {
@@ -6600,37 +6785,37 @@ function Ir(e, t, n, r, i, a, o, s) {
6600
6785
  if (!n) continue;
6601
6786
  let { x: r, y: i, width: a, height: s } = t.rect;
6602
6787
  if (a <= 0 || s <= 0) continue;
6603
- let g = Nr(n.value, c);
6604
- Z(e, r, i, a, s, l), e.fillStyle = g, e.fill(), Pr(e, n, r, i, a, s, o, u, d, p, f), t.id === h && (Z(e, r, i, a, s, l), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
6788
+ let g = Vr(n.value, c);
6789
+ Z(e, r, i, a, s, l), e.fillStyle = g, e.fill(), Hr(e, n, r, i, a, s, o, u, d, p, f), t.id === h && (Z(e, r, i, a, s, l), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
6605
6790
  }
6606
- return g && s && Fr(e, g.cell, s, t, n, o, p, f), g;
6791
+ return g && s && Ur(e, g.cell, s, t, n, o, p, f), g;
6607
6792
  }
6608
6793
  //#endregion
6609
6794
  //#region src/finance/WaterfallRenderer.ts
6610
- var Lr = 60, Rr = 12, zr = 24, Br = 40, Vr = .7, Hr = 1;
6611
- function Ur(e) {
6795
+ var Gr = 60, Kr = 12, qr = 24, Jr = 40, Yr = .7, Xr = 1;
6796
+ function Zr(e) {
6612
6797
  return e.type ? e.type : e.value > 0 ? "positive" : e.value < 0 ? "negative" : "subtotal";
6613
6798
  }
6614
- function Wr(e) {
6799
+ function Qr(e) {
6615
6800
  let t = Math.abs(e);
6616
6801
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
6617
6802
  }
6618
- function Gr(e, t) {
6803
+ function $r(e, t) {
6619
6804
  return {
6620
- left: Lr,
6621
- right: e - Rr,
6622
- top: zr,
6623
- bottom: t - Br,
6624
- plotWidth: e - Lr - Rr,
6625
- plotHeight: t - zr - Br
6805
+ left: Gr,
6806
+ right: e - Kr,
6807
+ top: qr,
6808
+ bottom: t - Jr,
6809
+ plotWidth: e - Gr - Kr,
6810
+ plotHeight: t - qr - Jr
6626
6811
  };
6627
6812
  }
6628
- function Kr(e, t, n, r, i) {
6813
+ function ei(e, t, n, r, i) {
6629
6814
  let a = Array(e.length), o = Array(e.length), s = t.plotWidth / e.length, c = s * n, l = (s - c) / 2, { left: u, bottom: d, plotHeight: f } = t, p = 0;
6630
6815
  for (let t = 0; t < e.length; t++) {
6631
- let n = e[t], m = Ur(n), h, g;
6816
+ let n = e[t], m = Zr(n), h, g;
6632
6817
  m === "total" || m === "subtotal" ? (h = 0, g = n.value, p = n.value) : (h = p, g = p + n.value, p = g);
6633
- let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y), Hr), C = u + t * s, w = C + l;
6818
+ let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y), Xr), C = u + t * s, w = C + l;
6634
6819
  a[t] = {
6635
6820
  label: n.label,
6636
6821
  value: n.value,
@@ -6650,14 +6835,14 @@ function Kr(e, t, n, r, i) {
6650
6835
  cumulatives: o
6651
6836
  };
6652
6837
  }
6653
- function qr(e) {
6838
+ function ti(e) {
6654
6839
  if (e.length === 0) return {
6655
6840
  valMin: 0,
6656
6841
  valMax: 1
6657
6842
  };
6658
6843
  let t = 0, n = 0, r = 0;
6659
6844
  for (let i = 0; i < e.length; i++) {
6660
- let a = e[i], o = Ur(a), s, c;
6845
+ let a = e[i], o = Zr(a), s, c;
6661
6846
  o === "total" || o === "subtotal" ? (s = 0, c = a.value, r = a.value) : (s = r, c = r + a.value, r = c), s < t && (t = s), c < t && (t = c), s > n && (n = s), c > n && (n = c);
6662
6847
  }
6663
6848
  let i = (n - t || 1) * .1;
@@ -6666,10 +6851,10 @@ function qr(e) {
6666
6851
  valMax: n + i
6667
6852
  };
6668
6853
  }
6669
- function Jr(e, t, n, r) {
6854
+ function ni(e, t, n, r) {
6670
6855
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6671
6856
  }
6672
- function Yr(e, t, n, r, i, a) {
6857
+ function ri(e, t, n, r, i, a) {
6673
6858
  let { left: o, right: s, top: c, bottom: l, plotHeight: u } = t, d = r - n || 1;
6674
6859
  e.strokeStyle = i.grid, e.lineWidth = .5, e.fillStyle = i.axisLabel, e.font = `${i.font.sizeSmall}px ${i.font.family}`, e.textAlign = "right", e.textBaseline = "middle";
6675
6860
  let f = m(n, r, 5), p = Math.ceil(n / f) * f;
@@ -6688,7 +6873,7 @@ function Yr(e, t, n, r, i, a) {
6688
6873
  e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(o, t), e.lineTo(s, t), e.stroke();
6689
6874
  }
6690
6875
  }
6691
- function Xr(e, t, n) {
6876
+ function ii(e, t, n) {
6692
6877
  let r = [
6693
6878
  "positive",
6694
6879
  "negative",
@@ -6707,7 +6892,7 @@ function Xr(e, t, n) {
6707
6892
  s && (e.fillStyle = o, e.fill());
6708
6893
  }
6709
6894
  }
6710
- function Zr(e, t, n, r, i, a, o) {
6895
+ function ai(e, t, n, r, i, a, o) {
6711
6896
  if (o === "none" || t.length < 2) return;
6712
6897
  let { bottom: s, plotHeight: c } = n;
6713
6898
  e.strokeStyle = a, e.lineWidth = 1, o === "dashed" ? e.setLineDash([4, 4]) : e.setLineDash([]), e.beginPath();
@@ -6717,7 +6902,7 @@ function Zr(e, t, n, r, i, a, o) {
6717
6902
  }
6718
6903
  e.stroke(), e.setLineDash([]);
6719
6904
  }
6720
- function Qr(e, t, n, r, i, a) {
6905
+ function oi(e, t, n, r, i, a) {
6721
6906
  e.fillStyle = r.text, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center";
6722
6907
  for (let r = 0; r < t.length; r++) {
6723
6908
  let o = t[r], s;
@@ -6726,7 +6911,7 @@ function Qr(e, t, n, r, i, a) {
6726
6911
  o.end < o.start ? (e.textBaseline = "top", e.fillText(s, c, o.rectY + o.rectH + 4)) : (e.textBaseline = "bottom", e.fillText(s, c, o.rectY - 4));
6727
6912
  }
6728
6913
  }
6729
- function $r(e, t, n, r, i) {
6914
+ function si(e, t, n, r, i) {
6730
6915
  e.fillStyle = r.axisLabel, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "top";
6731
6916
  let a = n.bottom + 6, o = t.length > 0 ? t[0].slotW - 4 : 0, s = !1;
6732
6917
  for (let n = 0; n < t.length; n++) if (e.measureText(i(t[n].label)).width > o) {
@@ -6747,7 +6932,7 @@ function $r(e, t, n, r, i) {
6747
6932
  }
6748
6933
  e.setTransform(1, 0, 0, 1, 0, 0), e.restore();
6749
6934
  }
6750
- function ei(e, t, n) {
6935
+ function ci(e, t, n) {
6751
6936
  if (t < n.left || t > n.right) return null;
6752
6937
  for (let n = 0; n < e.length; n++) {
6753
6938
  let r = e[n];
@@ -6755,7 +6940,7 @@ function ei(e, t, n) {
6755
6940
  }
6756
6941
  return null;
6757
6942
  }
6758
- function ti(e, t, n, r, i, a, o, s) {
6943
+ function li(e, t, n, r, i, a, o, s) {
6759
6944
  let c = t[r], l = n[r], u = Math.round(c.slotX + c.slotW / 2) + .5;
6760
6945
  e.strokeStyle = o.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(u, a.top), e.lineTo(u, a.bottom), e.stroke(), e.setLineDash([]);
6761
6946
  let d = [
@@ -6774,31 +6959,31 @@ function ti(e, t, n, r, i, a, o, s) {
6774
6959
  let _ = o.font.sizeSmall + 4;
6775
6960
  for (let t = 0; t < d.length; t++) e.fillText(d[t], h + 8, g + 6 + t * _);
6776
6961
  }
6777
- function ni(e, t, n, r, i, a) {
6962
+ function ui(e, t, n, r, i, a) {
6778
6963
  let { data: o } = r;
6779
6964
  if (!o || o.length === 0 || t <= 0 || n <= 0) return { hitBar: null };
6780
- let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ?? Vr, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? Wr, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = qr(o), b = y - v || 1, x = Gr(t, n), { bars: S, cumulatives: C } = Kr(o, x, p, v, b);
6781
- Jr(e, t, n, i.background), Yr(e, x, v, y, i, g), Zr(e, S, x, v, b, d, f), Xr(e, S, {
6965
+ let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ?? Yr, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? Qr, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = ti(o), b = y - v || 1, x = $r(t, n), { bars: S, cumulatives: C } = ei(o, x, p, v, b);
6966
+ ni(e, t, n, i.background), ri(e, x, v, y, i, g), ai(e, S, x, v, b, d, f), ii(e, S, {
6782
6967
  positive: s,
6783
6968
  negative: c,
6784
6969
  total: l,
6785
6970
  subtotal: u
6786
- }), m && Qr(e, S, C, i, g, h), $r(e, S, x, i, _);
6787
- let w = a ? ei(S, a.x, x) : null;
6788
- return a && w !== null && ti(e, S, C, w, a, x, i, g), { hitBar: w };
6971
+ }), m && oi(e, S, C, i, g, h), si(e, S, x, i, _);
6972
+ let w = a ? ci(S, a.x, x) : null;
6973
+ return a && w !== null && li(e, S, C, w, a, x, i, g), { hitBar: w };
6789
6974
  }
6790
6975
  //#endregion
6791
6976
  //#region src/finance/GaugeRenderer.ts
6792
- var ri = Math.PI / 180, ii = 135, ai = 405, oi = .25;
6793
- function si(e) {
6977
+ var di = Math.PI / 180, fi = 135, pi = 405, mi = .25;
6978
+ function hi(e) {
6794
6979
  let t = Math.abs(e);
6795
6980
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
6796
6981
  }
6797
6982
  function Q(e, t, n) {
6798
6983
  return e < t ? t : e > n ? n : e;
6799
6984
  }
6800
- function ci(e, t, n) {
6801
- let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ?? ii) * ri, s = (n.endAngle ?? ai) * ri, c = n.thickness ?? oi, l = e / 2, u = t / 2 + t * .05, d = Math.max(10, Math.min(e, t) / 2 - 24);
6985
+ function gi(e, t, n) {
6986
+ let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ?? fi) * di, s = (n.endAngle ?? pi) * di, c = n.thickness ?? mi, l = e / 2, u = t / 2 + t * .05, d = Math.max(10, Math.min(e, t) / 2 - 24);
6802
6987
  return {
6803
6988
  cx: l,
6804
6989
  cy: u,
@@ -6816,38 +7001,38 @@ function $(e, t) {
6816
7001
  let n = Q((e - t.min) / t.range, 0, 1);
6817
7002
  return t.startAngle + t.angleRange * n;
6818
7003
  }
6819
- function li(e, t, n, r) {
7004
+ function _i(e, t, n, r) {
6820
7005
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6821
7006
  }
6822
- function ui(e, t, n) {
7007
+ function vi(e, t, n) {
6823
7008
  e.beginPath(), e.arc(t.cx, t.cy, t.radius, t.startAngle, t.endAngle, !1), e.arc(t.cx, t.cy, t.innerRadius, t.endAngle, t.startAngle, !0), e.closePath(), e.fillStyle = n, e.fill();
6824
7009
  }
6825
- function di(e, t, n) {
7010
+ function yi(e, t, n) {
6826
7011
  let r = Q(n.from, t.min, t.max), i = Q(n.to, t.min, t.max);
6827
7012
  if (i <= r) return;
6828
7013
  let a = $(r, t), o = $(i, t);
6829
7014
  e.beginPath(), e.arc(t.cx, t.cy, t.radius, a, o, !1), e.arc(t.cx, t.cy, t.innerRadius, o, a, !0), e.closePath(), e.fillStyle = n.color, e.fill();
6830
7015
  }
6831
- function fi(e, t, n, r, i) {
7016
+ function bi(e, t, n, r, i) {
6832
7017
  let a = $(n, t);
6833
7018
  a <= t.startAngle || (e.globalAlpha = i, e.beginPath(), e.arc(t.cx, t.cy, t.radius, t.startAngle, a, !1), e.arc(t.cx, t.cy, t.innerRadius, a, t.startAngle, !0), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1);
6834
7019
  }
6835
- function pi(e, t, n, r) {
7020
+ function xi(e, t, n, r) {
6836
7021
  let i = $(n, t), a = Math.cos(i), o = Math.sin(i), s = t.radius - 2, c = t.innerRadius * .25, l = -o, u = a, d = t.cx + a * s, f = t.cy + o * s, p = t.cx + l * 4 - a * c, m = t.cy + u * 4 - o * c, h = t.cx - l * 4 - a * c, g = t.cy - u * 4 - o * c;
6837
7022
  e.beginPath(), e.moveTo(d, f), e.lineTo(p, m), e.lineTo(h, g), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.innerRadius * .12), 0, Math.PI * 2), e.fill();
6838
7023
  }
6839
- function mi(e, t, n, r, i) {
7024
+ function Si(e, t, n, r, i) {
6840
7025
  let a = Math.round(t.innerRadius * .55), o = Math.round(i.font.sizeMedium);
6841
7026
  e.fillStyle = i.text, e.textAlign = "center", e.textBaseline = "middle", e.font = `600 ${a}px ${i.font.family}`;
6842
7027
  let s = !!r, c = s ? t.cy - o * .6 : t.cy - a * .1;
6843
7028
  e.fillText(n, t.cx, c), s && (e.fillStyle = i.textSecondary, e.font = `${o}px ${i.font.family}`, e.fillText(r, t.cx, t.cy + a * .55));
6844
7029
  }
6845
- function hi(e, t, n, r) {
7030
+ function Ci(e, t, n, r) {
6846
7031
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`;
6847
7032
  let i = t.radius + 10, a = Math.cos(t.startAngle), o = Math.sin(t.startAngle), s = Math.cos(t.endAngle), c = Math.sin(t.endAngle), l = t.cx + a * i, u = t.cy + o * i, d = t.cx + s * i, f = t.cy + c * i;
6848
7033
  e.textBaseline = "middle", e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(n(t.min), l, u), e.textAlign = s < -.2 ? "right" : s > .2 ? "left" : "center", e.fillText(n(t.max), d, f);
6849
7034
  }
6850
- function gi(e, t, n, r) {
7035
+ function wi(e, t, n, r) {
6851
7036
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "middle";
6852
7037
  let i = (t.radius + t.innerRadius) / 2;
6853
7038
  for (let r = 0; r < n.length; r++) {
@@ -6857,15 +7042,15 @@ function gi(e, t, n, r) {
6857
7042
  e.fillText(a.label, s, c);
6858
7043
  }
6859
7044
  }
6860
- function _i(e, t, n, r, i, a) {
7045
+ function Ti(e, t, n, r, i, a) {
6861
7046
  if (t <= 0 || n <= 0) return;
6862
- let o = ci(t, n, r), s = r.trackColor ?? i.grid, c = r.needleColor ?? i.text, l = r.showValue !== !1, u = r.showZoneLabels === !0, d = r.valueFormat ?? si, f = Q(a, o.min, o.max);
6863
- li(e, t, n, i.background), ui(e, o, s);
7047
+ let o = gi(t, n, r), s = r.trackColor ?? i.grid, c = r.needleColor ?? i.text, l = r.showValue !== !1, u = r.showZoneLabels === !0, d = r.valueFormat ?? hi, f = Q(a, o.min, o.max);
7048
+ _i(e, t, n, i.background), vi(e, o, s);
6864
7049
  let p = r.zones;
6865
- if (p && p.length > 0) for (let t = 0; t < p.length; t++) di(e, o, p[t]);
6866
- fi(e, o, f, c, .12), pi(e, o, f, c), l && mi(e, o, d(f), r.label, i), hi(e, o, d, i), u && p && p.length > 0 && gi(e, o, p, i);
7050
+ if (p && p.length > 0) for (let t = 0; t < p.length; t++) yi(e, o, p[t]);
7051
+ bi(e, o, f, c, .12), xi(e, o, f, c), l && Si(e, o, d(f), r.label, i), Ci(e, o, d, i), u && p && p.length > 0 && wi(e, o, p, i);
6867
7052
  }
6868
7053
  //#endregion
6869
- export { Ke as ADXIndicator, Ge as ATRIndicator, rt as AccumulationDistributionIndicator, On as AlertManager, Pe as AnchoredVWAPIndicator, Zt as AnchoredVWAPTool, Wn as Animator, re as AreaRenderer, Ze as AroonIndicator, qt as ArrowTool, Be as AwesomeOscillatorIndicator, Tn as BarCountdown, ie as BarRenderer, Kn as BaseFinanceChart, oe as BaselineRenderer, yn as BinanceAdapter, Te as BollingerBandsIndicator, Ye as CCIIndicator, et as CMFIndicator, te as CandlestickRenderer, b as CanvasLayer, Ve as ChaikinOscillatorIndicator, Sn as ChartLegend, In as ChartStateManager, he as CompareRenderer, _t as CrosshairHandler, yt as CrosshairTooltip, pn as CurrentPriceLine, xn as DEFAULT_LEGEND_CONFIG, C as DPRManager, Rn as DataExporter, Ut as DateRangeTool, V as DepthOverlay, je as DonchianChannelIndicator, L as DrawingBase, wt as DrawingManager, Tt as DrawingRenderer, F as EMAIndicator, Un as Easing, Vt as ElliottWaveTool, Lt as EllipseTool, H as Emitter, St as EventBus, At as ExtendedLineTool, Ft as FibExtensionTool, Nt as FibRetracementTool, qn as FinanceCrosshair, Xt as GannBoxTool, Yt as GannFanTool, ct as GridRenderer, de as HLCAreaRenderer, ae as HollowCandleRenderer, Dt as HorizontalLineTool, Le as HullMAIndicator, De as IchimokuIndicator, j as IndicatorBase, we as IndicatorEngine, st as IndicatorWorkerHost, mt as InteractionManager, ce as KagiRenderer, Ae as KeltnerChannelIndicator, vt as KeyboardHandler, x as LayerManager, ne as LineRenderer, pe as LineWithMarkersRenderer, Ie as LinearRegressionChannelIndicator, Ue as MACDIndicator, Xe as MFIIndicator, Wt as MeasureTool, bn as MockAdapter, qe as OBVIndicator, en as OrderRenderer, ht as PanHandler, Oe as ParabolicSARIndicator, jt as ParallelChannelTool, zt as PitchforkTool, Ne as PivotPointsIndicator, le as PointAndFigureRenderer, sn as PositionRenderer, lt as PriceAxis, Ht as PriceRangeTool, Qe as ROCIndicator, He as RSIIndicator, kt as RayTool, U as ReconnectManager, It as RectangleTool, Mt as RegressionChannelTool, k as RenderEngine, S as RenderLoop, se as RenkoRenderer, kn as ReplayManager, P as SMAIndicator, Cn as Screenshot, En as SessionBreaks, Bn as SignalMarkerManager, tt as StdDevIndicator, fe as StepLineRenderer, We as StochasticIndicator, mn as StreamManager, ke as SupertrendIndicator, $e as TSIIndicator, Kt as TextAnnotationTool, fn as TickAggregator, pt as TimeAxis, Hn as TradeZoneManager, ln as TradingContextMenu, cn as TradingDragHandler, un as TradingManager, dn as TradingRenderer, Et as TrendLineTool, Rt as TriangleTool, Ln as UndoRedoManager, it as VROCIndicator, Ee as VWAPIndicator, Ot as VerticalLineTool, A as Viewport, ue as VolumeCandleRenderer, nt as VolumeProfileIndicator, Qt as VolumeProfileRangeTool, me as VolumeRenderer, wn as Watermark, Je as WilliamsRIndicator, Fe as ZigZagIndicator, gt as ZoomHandler, w as barIndexToX, N as getIntParam, M as getNumberParam, ee as getVisibleData, ot as isWorkerResponse, Ar as layoutSquarifiedTreemap, Dr as layoutUniformGrid, T as priceToY, $t as registerBuiltInDrawingTools, at as registerBuiltInIndicators, cr as renderDepthChart, Er as renderEquityCurve, _i as renderGauge, Ir as renderHeatmap, Jn as renderSparkline, ni as renderWaterfall, O as timestampToBarIndex, ge as toHeikinAshi, be as toKagi, ye as toLineBreak, xe as toPointAndFigure, Se as toRangeBars, _e as toRenko, E as xToBarIndex, D as yToPrice };
7054
+ export { Ze as ADXIndicator, Xe as ATRIndicator, ct as AccumulationDistributionIndicator, Ln as AlertManager, Be as AnchoredVWAPIndicator, nn as AnchoredVWAPTool, $n as Animator, ae as AreaRenderer, nt as AroonIndicator, Qt as ArrowTool, Ke as AwesomeOscillatorIndicator, Pn as BarCountdown, oe as BarRenderer, tr as BaseFinanceChart, ce as BaselineRenderer, On as BinanceAdapter, je as BollingerBandsIndicator, et as CCIIndicator, at as CMFIndicator, re as CandlestickRenderer, b as CanvasLayer, qe as ChaikinOscillatorIndicator, jn as ChartLegend, Gn as ChartStateManager, ye as CompareRenderer, St as CrosshairHandler, wt as CrosshairTooltip, xn as CurrentPriceLine, An as DEFAULT_LEGEND_CONFIG, C as DPRManager, qn as DataExporter, Jt as DateRangeTool, hn as DepthOverlay, Le as DonchianChannelIndicator, L as DrawingBase, kt as DrawingManager, At as DrawingRenderer, Ae as EMAIndicator, Qn as Easing, Kt as ElliottWaveTool, Ht as EllipseTool, V as Emitter, pe as EquivolumeRenderer, Dt as EventBus, Ft as ExtendedLineTool, Bt as FibExtensionTool, Rt as FibRetracementTool, on as FibTimeZonesTool, nr as FinanceCrosshair, tn as GannBoxTool, en as GannFanTool, pt as GridRenderer, he as HLCAreaRenderer, se as HollowCandleRenderer, Mt as HorizontalLineTool, Ue as HullMAIndicator, Ne as IchimokuIndicator, M as IndicatorBase, Oe as IndicatorEngine, ft as IndicatorWorkerHost, yt as InteractionManager, ue as KagiRenderer, Ie as KeltnerChannelIndicator, Ct as KeyboardHandler, x as LayerManager, ie as LineRenderer, _e as LineWithMarkersRenderer, He as LinearRegressionChannelIndicator, Ye as MACDIndicator, tt as MFIIndicator, Yt as MeasureTool, kn as MockAdapter, Qe as OBVIndicator, cn as OrderRenderer, bt as PanHandler, Pe as ParabolicSARIndicator, It as ParallelChannelTool, Wt as PitchforkTool, ze as PivotPointsIndicator, de as PointAndFigureRenderer, mn as PositionRenderer, mt as PriceAxis, qt as PriceRangeTool, rt as ROCIndicator, Je as RSIIndicator, Pt as RayTool, H as ReconnectManager, Vt as RectangleTool, Lt as RegressionChannelTool, ee as RenderEngine, S as RenderLoop, le as RenkoRenderer, Cn as ReplayController, Rn as ReplayManager, ke as SMAIndicator, Mn as Screenshot, Fn as SessionBreaks, Yn as SignalMarkerManager, ot as StdDevIndicator, ge as StepLineRenderer, F as StochasticIndicator, Sn as StreamManager, Fe as SupertrendIndicator, it as TSIIndicator, Zt as TextAnnotationTool, bn as TickAggregator, vt as TimeAxis, Zn as TradeZoneManager, _n as TradingContextMenu, gn as TradingDragHandler, vn as TradingManager, yn as TradingRenderer, jt as TrendLineTool, Ut as TriangleTool, Kn as UndoRedoManager, lt as VROCIndicator, Me as VWAPIndicator, Nt as VerticalLineTool, te as Viewport, fe as VolumeCandleRenderer, st as VolumeProfileIndicator, rn as VolumeProfileRangeTool, ve as VolumeRenderer, Nn as Watermark, $e as WilliamsRIndicator, Ve as ZigZagIndicator, xt as ZoomHandler, w as barIndexToX, P as getIntParam, N as getNumberParam, ne as getVisibleData, dt as isWorkerResponse, Rr as layoutSquarifiedTreemap, Ir as layoutUniformGrid, T as priceToY, sn as registerBuiltInDrawingTools, ut as registerBuiltInIndicators, _r as renderDepthChart, Fr as renderEquityCurve, Ti as renderGauge, Wr as renderHeatmap, rr as renderSparkline, ui as renderWaterfall, k as resolveBarIndex, A as timeToX, O as timestampToBarIndex, be as toHeikinAshi, we as toKagi, Ce as toLineBreak, Te as toPointAndFigure, Ee as toRangeBars, xe as toRenko, E as xToBarIndex, j as xToTime, D as yToPrice };
6870
7055
 
6871
7056
  //# sourceMappingURL=index.js.map